@feedmepos/mf-menu-portal 1.0.4-dev.2 → 1.0.4-dev.4

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 (82) hide show
  1. package/dist/{App-DtX4DyDA.js → App-CrpoLCjA.js} +3 -3
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-C9OSr8ft.js → ApplyProduct.vue_vue_type_script_setup_true_lang-Hdsnu29V.js} +1 -1
  3. package/dist/{BindingTable.vue_vue_type_script_setup_true_lang-BJN8ajuD.js → BindingTable.vue_vue_type_script_setup_true_lang-D3CmOOPY.js} +1 -1
  4. package/dist/{Catalog-Dly_r1yA.js → Catalog-VU3HhNro.js} +4 -4
  5. package/dist/{CatalogBinding-CNG4YcVq.js → CatalogBinding-BNATtZEY.js} +3 -3
  6. package/dist/{CatalogEditTabs.vue_vue_type_script_setup_true_lang-Cy2culdR.js → CatalogEditTabs.vue_vue_type_script_setup_true_lang-BmG-xpW4.js} +3 -3
  7. package/dist/CatalogEditor.vue_vue_type_script_setup_true_lang-BFsRDFpj.js +784 -0
  8. package/dist/{CatalogLinkProductAction.vue_vue_type_script_setup_true_lang-4EZ4yM_N.js → CatalogLinkProductAction.vue_vue_type_script_setup_true_lang-Bk4FqVmx.js} +14 -14
  9. package/dist/{Category-Dz1yFYyY.js → Category-DMoXTsfG.js} +5 -5
  10. package/dist/{Category-BS-vFDYy.js → Category-DxjdQ-NN.js} +2 -2
  11. package/dist/CategoryList.vue_vue_type_script_setup_true_lang-B3Ts1O-9.js +847 -0
  12. package/dist/{CookingGuide-CmbvWFgp.js → CookingGuide-DiZZDYD-.js} +5 -5
  13. package/dist/{Group-B7s-vPXb.js → Group-DFR8q-tt.js} +5 -5
  14. package/dist/{Group-BRmWZnHh.js → Group-rzfh_o6r.js} +2 -2
  15. package/dist/GroupList.vue_vue_type_script_setup_true_lang-DiN-wQXX.js +1807 -0
  16. package/dist/Ingredient-DpjGIuH9.js +505 -0
  17. package/dist/LinkProductSideSheet.vue_vue_type_script_setup_true_lang-CnI80Ojd.js +782 -0
  18. package/dist/{MenuSetting-Ci7V_Jxn.js → MenuSetting-DR-pDSF_.js} +4 -4
  19. package/dist/OrderPacing-JcTuweqF.js +769 -0
  20. package/dist/{OrderPacingFields.vue_vue_type_script_setup_true_lang-NCH-SrZU.js → OrderPacingFields.vue_vue_type_script_setup_true_lang-HwwJ2mGv.js} +2 -2
  21. package/dist/{Preview-BBGNaj1F.js → Preview-BZyun5lZ.js} +1 -1
  22. package/dist/{PriceTierNotice.vue_vue_type_script_setup_true_lang-BXJDpDCm.js → PriceTierNotice.vue_vue_type_script_setup_true_lang-DquqNbE1.js} +1 -1
  23. package/dist/PrintRoute-CzEx2dCt.js +518 -0
  24. package/dist/{Product-DqN0NFUU.js → Product-CQb0n06E.js} +4 -4
  25. package/dist/ProductAttributeFilter.vue_vue_type_script_setup_true_lang-B2KdolJS.js +7931 -0
  26. package/dist/{ProductEditorHost.vue_vue_type_script_setup_true_lang-Fkiw4lZp.js → ProductEditorHost.vue_vue_type_script_setup_true_lang-CBlDEjqF.js} +9 -9
  27. package/dist/ProductGroupCreateSheet.vue_vue_type_script_setup_true_lang-D8NQTCLx.js +2011 -0
  28. package/dist/{ProductImageEditorDialog.vue_vue_type_script_setup_true_lang-CNWCT1OB.js → ProductImageEditorDialog.vue_vue_type_script_setup_true_lang-cG47Pu-6.js} +1 -1
  29. package/dist/{ProductInlineCreateHost.vue_vue_type_script_setup_true_lang-BoQ9mVPY.js → ProductInlineCreateHost.vue_vue_type_script_setup_true_lang-0UwUcA2L.js} +800 -749
  30. package/dist/{ProductInternalTools-CC3SWSlT.js → ProductInternalTools-QrBR1nFp.js} +2 -2
  31. package/dist/{ProductInventoryDialog-SAhsVekx.js → ProductInventoryDialog-fV38GO1a.js} +1 -1
  32. package/dist/{ProductInventoryDialog.vue_vue_type_script_setup_true_lang-BB8UIIsW.js → ProductInventoryDialog.vue_vue_type_script_setup_true_lang-Bzb3RrMg.js} +1 -1
  33. package/dist/ProductList.vue_vue_type_script_setup_true_lang-BwKQESr3.js +2765 -0
  34. package/dist/{ProductVariantTranslationSheet.vue_vue_type_script_setup_true_lang-BMDSkfcn.js → ProductVariantTranslationSheet.vue_vue_type_script_setup_true_lang-CDYcHXo1.js} +1 -1
  35. package/dist/{Products-Cn6j1DOQ.js → Products-B8tysOAL.js} +3 -3
  36. package/dist/Publish-DTvOvFNa.js +1337 -0
  37. package/dist/Recipe-Ddx31csF.js +388 -0
  38. package/dist/{Scheduler-DlaSVACJ.js → Scheduler-CST5L_cw.js} +314 -254
  39. package/dist/ServingSequence-DYyEZI2S.js +374 -0
  40. package/dist/{Setting-CyCp2uw4.js → Setting-Ip0pGjks.js} +6 -6
  41. package/dist/Subcategory-BIgjzVta.js +459 -0
  42. package/dist/{Takeaway-sVVykWDg.js → Takeaway-CekhGM-m.js} +2 -2
  43. package/dist/{Takeaway-tYHCAXYU.js → Takeaway-aXsPg4JT.js} +5 -5
  44. package/dist/{TakeawayList.vue_vue_type_script_setup_true_lang-CV24v8Zg.js → TakeawayList.vue_vue_type_script_setup_true_lang-CaRR4_j3.js} +4 -4
  45. package/dist/TreeEditorOpenner.vue_vue_type_script_setup_true_lang-CshqYpc9.js +1291 -0
  46. package/dist/Unit-BMW8u0Us.js +424 -0
  47. package/dist/{Variant-BNnR5rLv.js → Variant-CZsrYRMU.js} +5 -5
  48. package/dist/{_id_-a9ZtdjtT.js → _id_-D4swrvNa.js} +3 -3
  49. package/dist/{app-CmElp8cO.js → app-BWwwHsWi.js} +337 -337
  50. package/dist/app.js +1 -1
  51. package/dist/apps/mf-menu/src/app.d.ts +80 -0
  52. package/dist/apps/mf-menu/src/components/PriceTier/LinkPriceTierSection.vue.d.ts +9 -0
  53. package/dist/apps/mf-menu/src/components/Product/BulkCategorySelect.vue.d.ts +37 -0
  54. package/dist/apps/mf-menu/src/components/Product/ProductAttributeFilter.vue.d.ts +11 -1
  55. package/dist/apps/mf-menu/src/components/ProductList.vue.d.ts +2 -2
  56. package/dist/apps/mf-menu/src/components/feature/NestedGroupManager/NestedGroupOverrideSheets.vue.d.ts +27 -0
  57. package/dist/apps/mf-menu/src/components/feature/RestaurantAttributesFilter.vue.d.ts +20 -0
  58. package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
  59. package/dist/assets/{menu-compute-B_wpWLAj.js → menu-compute-D7TdiHt4.js} +4 -4
  60. package/dist/assets/{validate-menu-DjxNxUxH.js → validate-menu-DXppWUVq.js} +2 -2
  61. package/dist/mf-menu-portal.css +1 -1
  62. package/dist/{provide-BJRbSauL.js → provide-CDmXzkhz.js} +67539 -65978
  63. package/dist/{useActionFeedback-89GwO41T.js → useActionFeedback-Dm2HDa_2.js} +1 -1
  64. package/dist/{FormSection.vue_vue_type_script_setup_true_lang-pY-_msnM.js → vuedraggable-CBtQLb_S.js} +140 -139
  65. package/package.json +2 -2
  66. package/dist/CatalogEditor.vue_vue_type_script_setup_true_lang-Byp1db9_.js +0 -484
  67. package/dist/CategoryList.vue_vue_type_script_setup_true_lang-CrHYjrTn.js +0 -797
  68. package/dist/GroupList.vue_vue_type_script_setup_true_lang-CWr52_a-.js +0 -2183
  69. package/dist/Ingredient-BMAlctE4.js +0 -463
  70. package/dist/LinkProductSideSheet.vue_vue_type_script_setup_true_lang-CR99740r.js +0 -709
  71. package/dist/OrderPacing-Bz5kn6DY.js +0 -698
  72. package/dist/PrintRoute-BnARWdR2.js +0 -473
  73. package/dist/ProductChipSummary.vue_vue_type_script_setup_true_lang-D8DygCBl.js +0 -110
  74. package/dist/ProductGroupCreateSheet.vue_vue_type_script_setup_true_lang-DryxrG-x.js +0 -1257
  75. package/dist/ProductList.vue_vue_type_script_setup_true_lang-BDnTs366.js +0 -10353
  76. package/dist/Publish-BPJhG39B.js +0 -1261
  77. package/dist/Recipe-mt1vec5-.js +0 -350
  78. package/dist/ServingSequence-Cr1REWZP.js +0 -336
  79. package/dist/Subcategory-kuB7gYvc.js +0 -412
  80. package/dist/TreeEditorOpenner.vue_vue_type_script_setup_true_lang-Dz-Chgek.js +0 -1213
  81. package/dist/Unit-BSOvZxRy.js +0 -385
  82. package/dist/apps/mf-menu/src/views/MenuManagementEditor/RestaurantAttributesFilter.vue.d.ts +0 -2
@@ -0,0 +1,2765 @@
1
+ import { defineComponent as $e, resolveComponent as U, openBlock as o, createBlock as F, createSlots as Jt, withCtx as A, createElementVNode as u, normalizeStyle as Qt, unref as a, createElementBlock as y, createVNode as v, isRef as Zt, createCommentVNode as M, Fragment as Q, renderList as ie, toDisplayString as O, renderSlot as Ze, computed as b, ref as H, watch as ge, h as V, normalizeClass as _e, withModifiers as we, withKeys as wt, shallowRef as xe, onUnmounted as el, createTextVNode as tl, nextTick as ll } from "vue";
2
+ import { _ as Ct } from "./TranslationLanguageSelector.vue_vue_type_script_setup_true_lang-BJZ6VcrT.js";
3
+ import { useI18n as Se, useCoreStore as al } from "@feedmepos/mf-common";
4
+ import { _ as Ft, R as ol, A as $t, h as Ge } from "./app-BWwwHsWi.js";
5
+ import { _ as qe, a as nl } from "./ProductAttributeFilter.vue_vue_type_script_setup_true_lang-B2KdolJS.js";
6
+ import { a as St, b as sl, _ as rl } from "./TreeEditorOpenner.vue_vue_type_script_setup_true_lang-CshqYpc9.js";
7
+ import { u as il, a as ul } from "./ProductInlineCreateHost.vue_vue_type_script_setup_true_lang-0UwUcA2L.js";
8
+ import { components as re, useDialog as cl, useBreakpoints as ml, FmButtonVariant as fe, FmButtonColorThemeVariant as ye } from "@feedmepos/ui-library";
9
+ import { _ as dl } from "./index.vue_vue_type_script_setup_true_lang-CGPDazqs.js";
10
+ import { _ as He } from "./ProductImageEditorDialog.vue_vue_type_script_setup_true_lang-cG47Pu-6.js";
11
+ import { _ as pl } from "./TranslationViewChip.vue_vue_type_script_setup_true_lang-CAkLEmSA.js";
12
+ import { _ as vl } from "./PageLayout.vue_vue_type_script_setup_true_lang-B3szUH39.js";
13
+ import { b as Ot, u as je, d as fl } from "./provide-CDmXzkhz.js";
14
+ import { _ as bl } from "./ProductGroupCreateSheet.vue_vue_type_script_setup_true_lang-D8NQTCLx.js";
15
+ import { _ as yl } from "./ProductEditorHost.vue_vue_type_script_setup_true_lang-CBlDEjqF.js";
16
+ import { _ as It } from "./ProductFilterMenu.vue_vue_type_script_setup_true_lang-Cgc0Ms_n.js";
17
+ import { O as Ne, a as gl, _ as _l } from "./LinkProductSideSheet.vue_vue_type_script_setup_true_lang-CnI80Ojd.js";
18
+ import { u as Mt } from "./useActionFeedback-Dm2HDa_2.js";
19
+ import { _ as hl } from "./FormItem.vue_vue_type_script_setup_true_lang-C2S6QCyR.js";
20
+ import { _ as kl } from "./vuedraggable-CBtQLb_S.js";
21
+ import { u as xl } from "./useEditorValidation-Ctef5Bxt.js";
22
+ import { useRouter as wl } from "vue-router";
23
+ const Cl = {
24
+ key: 0,
25
+ class: "sticky top-0 z-10 px-8 pb-8 bg-fm-color-neutral-white"
26
+ }, Fl = {
27
+ key: 1,
28
+ class: "py-8 px-12 fm-typo-en-body-md-400 text-fm-color-typo-tertiary"
29
+ }, $l = /* @__PURE__ */ $e({
30
+ __name: "BulkCategorySelect",
31
+ props: {
32
+ items: {},
33
+ modelValue: {}
34
+ },
35
+ emits: ["update:modelValue"],
36
+ setup(C, { emit: m }) {
37
+ const t = C, L = m, { t: n } = Se(), { search: R, filtered: g, noMatches: h, reset: B } = il(
38
+ () => t.items,
39
+ (w) => w.label
40
+ ), { content: K, contentStyle: _, onMenuChanged: D } = ul();
41
+ function G(w) {
42
+ w || B(), D(w);
43
+ }
44
+ return (w, W) => {
45
+ const X = U("FmSearch"), Z = U("FmMenuItem"), r = U("FmSelect");
46
+ return o(), F(r, {
47
+ items: w.items,
48
+ multiselect: "",
49
+ "keep-selection-order": "",
50
+ "model-value": w.modelValue,
51
+ "onUpdate:modelValue": W[1] || (W[1] = (se) => L("update:modelValue", se ?? [])),
52
+ onDropdownChanged: G
53
+ }, Jt({
54
+ "menu-wrapper": A(({ handleItemChange: se }) => [
55
+ u("div", {
56
+ ref_key: "content",
57
+ ref: K,
58
+ class: "shrink-0",
59
+ style: Qt(a(_))
60
+ }, [
61
+ w.items.length ? (o(), y("div", Cl, [
62
+ v(X, {
63
+ modelValue: a(R),
64
+ "onUpdate:modelValue": W[0] || (W[0] = (ee) => Zt(R) ? R.value = ee : null),
65
+ autofocus: "",
66
+ placeholder: a(n)("menu.common.actions.search")
67
+ }, null, 8, ["modelValue", "placeholder"])
68
+ ])) : M("", !0),
69
+ (o(!0), y(Q, null, ie(a(g), (ee) => (o(), F(Z, {
70
+ key: ee.value,
71
+ label: ee.label,
72
+ "has-checkbox": "",
73
+ class: "scroll-mt-56",
74
+ "data-checked": w.modelValue.includes(ee.value),
75
+ "model-value": w.modelValue.includes(ee.value),
76
+ "onUpdate:modelValue": (S) => se(S, ee)
77
+ }, null, 8, ["label", "data-checked", "model-value", "onUpdate:modelValue"]))), 128)),
78
+ a(h) ? (o(), y("p", Fl, O(a(n)("menu.product.form.detail.category.no_results")), 1)) : M("", !0)
79
+ ], 4)
80
+ ]),
81
+ _: 2
82
+ }, [
83
+ w.$slots.default ? {
84
+ name: "default",
85
+ fn: A(() => [
86
+ Ze(w.$slots, "default")
87
+ ]),
88
+ key: "0"
89
+ } : void 0
90
+ ]), 1032, ["items", "model-value"]);
91
+ };
92
+ }
93
+ }), Sl = { class: "flex items-center gap-8" }, Il = { class: "fm-typo-en-title-md-600" }, Vl = {
94
+ key: 0,
95
+ class: "space-y-16"
96
+ }, Pl = { class: "flex items-center gap-8" }, Ll = { class: "w-[72px] h-[72px] rounded-md border border-fm-color-neutral-gray-200 flex items-center justify-center overflow-hidden" }, El = ["src", "alt"], Ol = { class: "space-y-4" }, Ml = { class: "fm-typo-en-title-md-600" }, Ul = { class: "text-fm-color-typo-secondary" }, Al = { class: "flex" }, Rl = { class: "w-[260px] space-y-16" }, Tl = { class: "flex items-center gap-4 px-8" }, Dl = { class: "fm-typo-en-title-sm-600" }, jl = { class: "flex-1 min-w-0 overflow-x-auto" }, Nl = {
97
+ key: 1,
98
+ class: "p-24 text-fm-color-typo-secondary"
99
+ }, zl = {
100
+ key: 2,
101
+ class: "flex justify-center p-24"
102
+ }, Bl = /* @__PURE__ */ $e({
103
+ __name: "ProductOverviewSheet",
104
+ props: {
105
+ modelValue: { type: Boolean },
106
+ state: {}
107
+ },
108
+ emits: ["update:modelValue"],
109
+ setup(C, { emit: m }) {
110
+ const t = C, L = m, { t: n, n: R } = Se(), g = b(
111
+ () => {
112
+ var c;
113
+ return ((c = t.state) == null ? void 0 : c.status) === "ready" ? t.state.value : null;
114
+ }
115
+ ), h = b(() => {
116
+ var c, p;
117
+ return ((c = t.state) == null ? void 0 : c.status) === "error" ? n("menu.product.overview.read_error") : ((p = t.state) == null ? void 0 : p.status) === "unavailable" ? n("menu.product.overview.unavailable") : null;
118
+ }), B = b({
119
+ get: () => t.modelValue,
120
+ set: (c) => L("update:modelValue", c)
121
+ }), K = H("product"), _ = H(null);
122
+ ge(
123
+ () => {
124
+ var c;
125
+ return (c = g.value) == null ? void 0 : c.itemId;
126
+ },
127
+ () => {
128
+ _.value = null, K.value = "product";
129
+ }
130
+ );
131
+ const D = b(() => {
132
+ var c;
133
+ return ((c = g.value) == null ? void 0 : c.scopes) ?? [];
134
+ }), G = b(
135
+ () => D.value.find(
136
+ (c) => c.catalogId === _.value
137
+ ) ?? D.value[0]
138
+ ), w = b(
139
+ () => {
140
+ var c;
141
+ return (((c = g.value) == null ? void 0 : c.groupScopes) ?? []).find(
142
+ (p) => p.catalogId === _.value
143
+ );
144
+ }
145
+ ), W = (c, p) => c === null ? n("menu.product.overview.master_product") : p;
146
+ function X(c, p) {
147
+ return c == null ? n("menu.common.labels.empty_value") : p ? R(c, {
148
+ style: "currency",
149
+ currency: p,
150
+ currencyDisplay: "narrowSymbol"
151
+ }) : R(c, { minimumFractionDigits: 2 });
152
+ }
153
+ const Z = b(
154
+ () => [
155
+ {
156
+ accessorKey: "schedulerLabel",
157
+ header: () => n("menu.common.labels.scheduler"),
158
+ enableSorting: !1,
159
+ cell: (c) => c.getValue() ?? n("menu.scheduler.dialog.sections.period.all_day")
160
+ },
161
+ {
162
+ accessorKey: "code",
163
+ header: () => n("menu.product.table.columns.code"),
164
+ enableSorting: !1,
165
+ cell: (c) => c.getValue() ?? n("menu.common.labels.empty_value")
166
+ },
167
+ {
168
+ accessorKey: "name",
169
+ header: () => n("menu.product.table.columns.name"),
170
+ enableSorting: !1
171
+ },
172
+ {
173
+ accessorKey: "price",
174
+ header: () => n("menu.product.form.variant.columns.price"),
175
+ enableSorting: !1,
176
+ cell: (c) => {
177
+ const p = c.getValue();
178
+ return X((p == null ? void 0 : p.amount) ?? null, null);
179
+ }
180
+ },
181
+ {
182
+ accessorKey: "orderFrom",
183
+ header: () => n("menu.product.table.columns.order_from"),
184
+ enableSorting: !1,
185
+ cell: (c) => {
186
+ const p = c.getValue();
187
+ return p === null ? n("menu.common.labels.empty_value") : V(
188
+ re.FmChip,
189
+ { compact: !0, class: "fm-typo-en-body-md-600" },
190
+ () => n(Ne[p])
191
+ );
192
+ }
193
+ }
194
+ ]
195
+ ), r = b({
196
+ get: () => _.value ?? "",
197
+ set: (c) => {
198
+ _.value = c || null;
199
+ }
200
+ });
201
+ ge(K, () => {
202
+ _.value = null;
203
+ });
204
+ const se = b(
205
+ () => {
206
+ var c;
207
+ return K.value === "product" ? D.value.map((p) => ({
208
+ value: p.catalogId ?? "",
209
+ label: W(p.catalogId, p.label),
210
+ badge: p.badge,
211
+ disabled: !p.linked
212
+ })) : (((c = g.value) == null ? void 0 : c.groupScopes) ?? []).map((p) => ({
213
+ value: p.catalogId ?? "",
214
+ label: W(p.catalogId, p.label),
215
+ badge: p.groups.length,
216
+ disabled: p.groups.length === 0
217
+ }));
218
+ }
219
+ ), ee = b(
220
+ () => {
221
+ var c;
222
+ return (((c = w.value) == null ? void 0 : c.groups) ?? []).map((p) => ({
223
+ groupName: p.groupName,
224
+ subRows: [...p.rows]
225
+ }));
226
+ }
227
+ ), S = H({});
228
+ ge(
229
+ ee,
230
+ (c) => {
231
+ S.value = Object.fromEntries(c.map((p, I) => [I, !0]));
232
+ },
233
+ { immediate: !0 }
234
+ );
235
+ const J = b(() => [
236
+ {
237
+ accessorKey: "code",
238
+ header: () => n("menu.product.table.columns.code"),
239
+ enableSorting: !1,
240
+ cell: ({ row: c }) => c.original.subRows ? V(
241
+ "div",
242
+ {
243
+ class: "flex items-center gap-2 fm-typo-en-body-md-600 text-fm-color-typo-secondary"
244
+ },
245
+ [
246
+ V(re.FmButton, {
247
+ icon: "keyboard_arrow_up",
248
+ variant: "tertiary",
249
+ "aria-label": n("menu.product.overview.toggle_group", {
250
+ name: c.original.groupName
251
+ }),
252
+ class: [
253
+ "cursor-pointer transition-transform",
254
+ c.getIsExpanded() ? "transform rotate-180" : ""
255
+ ],
256
+ onClick: c.getToggleExpandedHandler()
257
+ }),
258
+ n("menu.product.overview.found_in_group", {
259
+ name: c.original.groupName
260
+ })
261
+ ]
262
+ ) : c.original.code,
263
+ meta: {
264
+ colspan: (c) => c.original.subRows ? 5 : 1
265
+ }
266
+ },
267
+ ...[
268
+ {
269
+ accessorKey: "name",
270
+ header: () => n("menu.product.table.columns.name")
271
+ },
272
+ {
273
+ accessorKey: "combinationLabel",
274
+ header: () => n("menu.common.labels.variant")
275
+ },
276
+ {
277
+ accessorKey: "price",
278
+ header: () => n("menu.product.form.variant.columns.price"),
279
+ cell: ({ row: c }) => {
280
+ var p;
281
+ return X((p = c.original.price) == null ? void 0 : p.amount, null);
282
+ }
283
+ },
284
+ {
285
+ accessorKey: "orderFrom",
286
+ header: () => n("menu.product.table.columns.order_from"),
287
+ cell: ({ row: c }) => c.original.orderFrom ? V(
288
+ re.FmChip,
289
+ { compact: !0, class: "fm-typo-en-body-md-600" },
290
+ () => n(Ne[c.original.orderFrom])
291
+ ) : n("menu.common.labels.empty_value")
292
+ }
293
+ ].map((c) => ({
294
+ ...c,
295
+ enableSorting: !1,
296
+ meta: {
297
+ colspan: (p) => p.original.subRows ? 0 : 1
298
+ }
299
+ }))
300
+ ]);
301
+ return (c, p) => {
302
+ const I = U("FmCircularProgress"), $ = U("FmIcon"), N = U("FmTabs"), i = U("FmBadge"), f = U("FmCollapsibleTabs"), j = U("FmTable"), ae = U("FmSideSheet");
303
+ return o(), F(ae, {
304
+ modelValue: B.value,
305
+ "onUpdate:modelValue": p[3] || (p[3] = (z) => B.value = z),
306
+ "max-width": 1200,
307
+ "dismiss-away": ""
308
+ }, {
309
+ "side-sheet-header": A(() => {
310
+ var z;
311
+ return [
312
+ u("div", Sl, [
313
+ u("p", Il, O(a(n)("menu.product.overview.title")), 1),
314
+ ((z = c.state) == null ? void 0 : z.status) === "ready" && c.state.stale ? (o(), F(I, {
315
+ key: 0,
316
+ size: "md"
317
+ })) : M("", !0)
318
+ ])
319
+ ];
320
+ }),
321
+ default: A(() => {
322
+ var z, Y, x;
323
+ return [
324
+ g.value ? (o(), y("div", Vl, [
325
+ u("div", Pl, [
326
+ u("div", Ll, [
327
+ g.value.thumbnailUrl ? (o(), y("img", {
328
+ key: 0,
329
+ src: g.value.thumbnailUrl,
330
+ alt: g.value.name,
331
+ class: "w-full h-full object-cover"
332
+ }, null, 8, El)) : (o(), F($, {
333
+ key: 1,
334
+ name: "image",
335
+ outline: "",
336
+ color: "neutral-gray-300"
337
+ }))
338
+ ]),
339
+ u("div", Ol, [
340
+ u("p", Ml, O(g.value.code ? a(n)("menu.group.list.product_code_name", {
341
+ code: g.value.code,
342
+ name: g.value.name
343
+ }) : g.value.name), 1),
344
+ u("p", Ul, O(a(n)("menu.common.labels.a11y_labelled_name", {
345
+ label: a(n)("menu.product.overview.base_price"),
346
+ name: X(
347
+ ((z = g.value.basePrice) == null ? void 0 : z.amount) ?? null,
348
+ ((Y = g.value.basePrice) == null ? void 0 : Y.currency) ?? null
349
+ )
350
+ })), 1)
351
+ ])
352
+ ]),
353
+ v(N, {
354
+ modelValue: K.value,
355
+ "onUpdate:modelValue": p[0] || (p[0] = (T) => K.value = T),
356
+ items: [
357
+ { value: "product", label: a(n)("menu.common.labels.product") },
358
+ { value: "group", label: a(n)("menu.group.title") }
359
+ ]
360
+ }, null, 8, ["modelValue", "items"]),
361
+ u("div", Al, [
362
+ u("div", Rl, [
363
+ u("div", Tl, [
364
+ u("p", Dl, O(a(n)("menu.common.labels.catalog")), 1),
365
+ v(i, {
366
+ inline: "",
367
+ variant: "neutral",
368
+ value: K.value === "product" ? g.value.catalogCount : g.value.groupCount,
369
+ class: "!rounded-md !bg-fm-color-neutral-gray-100 !text-fm-color-typo-primary"
370
+ }, null, 8, ["value"])
371
+ ]),
372
+ v(Ft, null, {
373
+ default: A(() => [
374
+ v(f, {
375
+ modelValue: r.value,
376
+ "onUpdate:modelValue": p[1] || (p[1] = (T) => r.value = T),
377
+ items: se.value
378
+ }, null, 8, ["modelValue", "items"])
379
+ ]),
380
+ _: 1
381
+ })
382
+ ]),
383
+ p[4] || (p[4] = u("div", { class: "w-[1px] min-h-full ml-4 mr-12 bg-fm-color-neutral-gray-100 self-stretch" }, null, -1)),
384
+ u("div", jl, [
385
+ K.value === "product" && G.value ? (o(), F(j, {
386
+ key: 0,
387
+ "column-defs": Z.value,
388
+ "row-data": [...G.value.rows],
389
+ "page-size": Math.max(G.value.rows.length, 1),
390
+ "hide-footer": "",
391
+ "shrink-at": !1
392
+ }, null, 8, ["column-defs", "row-data", "page-size"])) : K.value === "group" ? (o(), F(Ft, { key: 1 }, {
393
+ default: A(() => [
394
+ v(j, {
395
+ "column-defs": J.value,
396
+ "row-data": ee.value,
397
+ "get-sub-row": (T) => T.subRows,
398
+ "expanded-state": S.value,
399
+ "page-size": 1e6,
400
+ "hide-footer": "",
401
+ "shrink-at": !1,
402
+ "onUpdate:expandedState": p[2] || (p[2] = (T) => S.value = T)
403
+ }, null, 8, ["column-defs", "row-data", "get-sub-row", "expanded-state"])
404
+ ]),
405
+ _: 1
406
+ })) : M("", !0)
407
+ ])
408
+ ])
409
+ ])) : h.value ? (o(), y("p", Nl, O(h.value), 1)) : ((x = c.state) == null ? void 0 : x.status) === "loading" ? (o(), y("div", zl, [
410
+ v(I, { size: "lg" })
411
+ ])) : M("", !0)
412
+ ];
413
+ }),
414
+ _: 1
415
+ }, 8, ["modelValue"]);
416
+ };
417
+ }
418
+ }), Kl = { class: "flex flex-col w-full h-full" }, Gl = {
419
+ key: 0,
420
+ class: "mx-16 mb-8 flex items-center gap-8 rounded-lg bg-fm-color-system-info-100 p-16"
421
+ }, ql = { class: "fm-typo-en-body-lg-400" }, Hl = { class: "fm-typo-en-body-lg-400" }, Wl = { class: "xs:overflow-x-auto xs:shrink-0" }, Xl = {
422
+ key: 1,
423
+ class: "flex-1 flex overflow-hidden xs:flex-col"
424
+ }, Yl = { class: "w-[300px] overflow-y-auto xs:w-full xs:max-h-[40%] xs:shrink-0 xs:border-b xs:border-fm-color-neutral-gray-200" }, Jl = { class: "flex min-w-0 w-full items-center gap-8" }, Ql = { class: "flex min-w-0 w-full items-center gap-8 pl-16" }, Zl = { class: "flex min-w-0 w-full items-center gap-8 pl-32" }, ea = { class: "flex-1 flex flex-col overflow-auto px-16 pb-16 pt-8 xs:px-0" }, ta = {
425
+ key: 0,
426
+ class: "border border-fm-color-neutral-gray-200 fm-corner-radius-md p-16"
427
+ }, la = { class: "flex items-center gap-8 pb-8" }, aa = { class: "fm-typo-en-title-sm-600" }, oa = { class: "fm-typo-en-title-sm-600 pb-8" }, na = {
428
+ key: 2,
429
+ class: "mt-8 px-16 fm-typo-en-body-lg-600"
430
+ }, Vt = "line-clamp-2 w-full xs:!line-clamp-none", sa = /* @__PURE__ */ $e({
431
+ __name: "ImportDiffPreview",
432
+ props: {
433
+ show: { type: Boolean },
434
+ diff: {}
435
+ },
436
+ emits: ["confirm", "cancel"],
437
+ setup(C, { emit: m }) {
438
+ var $, N;
439
+ const t = C, L = m, { t: n, n: R } = Se(), g = H(((N = ($ = t.diff) == null ? void 0 : $.tabs[0]) == null ? void 0 : N.id) ?? "product"), h = H(null), B = H(/* @__PURE__ */ new Set());
440
+ function K(i) {
441
+ const f = new Set(B.value);
442
+ f.has(i) ? f.delete(i) : f.add(i), B.value = f;
443
+ }
444
+ const _ = b(
445
+ () => {
446
+ var i;
447
+ return (((i = t.diff) == null ? void 0 : i.tabs) ?? []).map((f) => ({
448
+ value: f.id,
449
+ label: n(`menu.import_export.diff.tabs.${f.id}`)
450
+ }));
451
+ }
452
+ ), D = b(
453
+ () => {
454
+ var i;
455
+ return ((i = t.diff) == null ? void 0 : i.tabs.find((f) => f.id === g.value)) ?? null;
456
+ }
457
+ ), G = b(() => {
458
+ var i;
459
+ return ((i = D.value) == null ? void 0 : i.entities) ?? [];
460
+ }), w = b(
461
+ () => G.value.find((i) => i.key === h.value) ?? null
462
+ );
463
+ ge(
464
+ [g, G],
465
+ () => {
466
+ var i;
467
+ G.value.some((f) => f.key === h.value) || (h.value = ((i = G.value[0]) == null ? void 0 : i.key) ?? null);
468
+ },
469
+ { immediate: !0 }
470
+ );
471
+ const W = b(
472
+ () => {
473
+ var i;
474
+ return (((i = D.value) == null ? void 0 : i.groups) ?? []).map((f) => {
475
+ const j = G.value.find((x) => x.isHeading && x.groupId === f.id) ?? null, ae = G.value.filter(
476
+ (x) => x.groupId === f.id && !x.isHeading
477
+ ), z = [], Y = /* @__PURE__ */ new Map();
478
+ for (const x of ae)
479
+ Y.has(x.id) || (Y.set(x.id, []), z.push(x.id)), Y.get(x.id).push(x);
480
+ return {
481
+ ...f,
482
+ heading: j,
483
+ products: z.map((x) => {
484
+ const T = Y.get(x), te = T.find((ue) => ue.variantName === null);
485
+ return {
486
+ id: x,
487
+ name: T[0].name,
488
+ base: te ?? null,
489
+ variants: T.filter((ue) => ue.variantName !== null)
490
+ };
491
+ })
492
+ };
493
+ });
494
+ }
495
+ ), X = {
496
+ ADDON: "menu.import_export.diff.groups.addon",
497
+ takeaway: "menu.import_export.diff.tabs.takeaway",
498
+ addonGroup: "menu.import_export.diff.tabs.addonGroup",
499
+ category: "menu.import_export.diff.tabs.category",
500
+ subcategory: "menu.import_export.diff.tabs.subcategory"
501
+ };
502
+ function Z(i) {
503
+ if (i.name !== null) return i.name;
504
+ const f = X[i.id];
505
+ return f ? n(f) : i.id;
506
+ }
507
+ function r(i) {
508
+ switch (i.kind) {
509
+ case "money":
510
+ return R(i.amount / 10 ** i.precision, {
511
+ minimumFractionDigits: i.precision,
512
+ maximumFractionDigits: i.precision
513
+ });
514
+ case "moneyList":
515
+ return `[${i.items.map(
516
+ (f) => R(f.amount / 10 ** f.precision, {
517
+ minimumFractionDigits: f.precision,
518
+ maximumFractionDigits: f.precision
519
+ })
520
+ ).join(", ")}]`;
521
+ case "statutoryCharges":
522
+ return i.charges.map((f) => `${f.code} × ${R(f.unitCount)}`).join(", ");
523
+ case "absent":
524
+ return n("menu.import_export.diff.values.absent");
525
+ case "followDefault":
526
+ return n("menu.import_export.diff.values.follow_default");
527
+ default:
528
+ return i.text;
529
+ }
530
+ }
531
+ function se(i, f) {
532
+ const j = i.cells[f];
533
+ return j ? j.before === null ? r(j.after) : `${r(j.before)} > ${r(j.after)}` : n("menu.import_export.diff.values.no_change");
534
+ }
535
+ const ee = b(
536
+ () => {
537
+ var i, f;
538
+ return (((i = w.value) == null ? void 0 : i.columns) ?? ((f = D.value) == null ? void 0 : f.columns) ?? []).map(
539
+ (j) => j.id === "default" && j.name === null ? {
540
+ id: j.id,
541
+ header: () => n("menu.import_export.diff.columns.default"),
542
+ cell: (ae) => se(ae.row.original, j.id),
543
+ // Legacy's 300px floor (`PreviewProduct2.vue:96`) is wider than
544
+ // the table's whole card on a phone, where it wrapped every long
545
+ // value at 300px and left the end of each line off screen. Below
546
+ // `xs` the column takes the width the card has instead.
547
+ meta: {
548
+ headerClass: "min-w-[300px] xs:min-w-0",
549
+ cellSpanClass: Vt
550
+ }
551
+ } : {
552
+ id: j.id,
553
+ header: () => j.name ?? "",
554
+ cell: (ae) => se(ae.row.original, j.id),
555
+ meta: { cellSpanClass: Vt }
556
+ }
557
+ );
558
+ }
559
+ ), S = b(() => [
560
+ {
561
+ id: "field",
562
+ header: () => n("menu.import_export.diff.columns.field"),
563
+ cell: (i) => i.row.original.field
564
+ },
565
+ ...ee.value
566
+ ]), J = (i) => i ? "T" : "F", c = [
567
+ {
568
+ id: "product",
569
+ header: () => n("menu.group.list.columns.products"),
570
+ cell: (i) => i.row.original.name
571
+ },
572
+ {
573
+ id: "linked",
574
+ header: () => n("menu.import_export.diff.columns.default"),
575
+ cell: (i) => {
576
+ const f = i.row.original;
577
+ return `${J(f.before)} > ${J(f.after)}`;
578
+ }
579
+ }
580
+ ], p = b(() => {
581
+ var i;
582
+ return [
583
+ ...((i = w.value) == null ? void 0 : i.linkedProducts) ?? []
584
+ ];
585
+ }), I = b(
586
+ () => n("menu.import_export.diff.empty", {
587
+ tab: n(`menu.import_export.diff.tabs.${g.value}`)
588
+ })
589
+ );
590
+ return (i, f) => {
591
+ const j = U("FmIcon"), ae = U("FmTabs"), z = U("FmChip"), Y = U("FmListItem"), x = U("FmList"), T = U("FmTable");
592
+ return o(), F(He, {
593
+ show: i.show,
594
+ title: a(n)("menu.import_export.diff.title"),
595
+ "primary-action": { label: a(n)("menu.import_export.preview.actions.confirm") },
596
+ "secondary-actions": [
597
+ {
598
+ label: a(n)("menu.import_export.preview.actions.cancel"),
599
+ click: () => L("cancel")
600
+ }
601
+ ],
602
+ onOnPrimary: f[1] || (f[1] = (te) => L("confirm")),
603
+ onOnCancel: f[2] || (f[2] = (te) => L("cancel"))
604
+ }, {
605
+ default: A(() => {
606
+ var te, ue;
607
+ return [
608
+ u("div", Kl, [
609
+ (te = i.diff) != null && te.newCatalogs.length ? (o(), y("div", Gl, [
610
+ v(j, {
611
+ name: "info",
612
+ color: "system-info-300"
613
+ }),
614
+ u("div", null, [
615
+ u("p", ql, O(a(n)("menu.import_export.diff.new_catalogs")), 1),
616
+ u("ul", Hl, [
617
+ (o(!0), y(Q, null, ie(i.diff.newCatalogs, (E) => (o(), y("li", {
618
+ key: E.id
619
+ }, O(E.name), 1))), 128))
620
+ ])
621
+ ])
622
+ ])) : M("", !0),
623
+ u("div", Wl, [
624
+ v(ae, {
625
+ "model-value": g.value,
626
+ items: _.value,
627
+ "onUpdate:modelValue": f[0] || (f[0] = (E) => g.value = E)
628
+ }, null, 8, ["model-value", "items"])
629
+ ]),
630
+ G.value.length ? (o(), y("div", Xl, [
631
+ u("div", Yl, [
632
+ v(x, null, {
633
+ default: A(() => [
634
+ (o(!0), y(Q, null, ie(W.value, (E) => (o(), y(Q, {
635
+ key: E.id
636
+ }, [
637
+ v(Y, {
638
+ "data-testid": `import-diff-heading-${E.id}`,
639
+ onClick: (q) => E.heading && !E.heading.isDeleted ? h.value = E.heading.key : void 0
640
+ }, {
641
+ default: A(() => {
642
+ var q, he, ne;
643
+ return [
644
+ u("span", Jl, [
645
+ v(j, {
646
+ name: "keyboard_arrow_down",
647
+ size: "sm"
648
+ }),
649
+ u("span", {
650
+ class: _e(["fm-typo-en-body-lg-400 truncate", {
651
+ "text-fm-color-typo-disabled": (q = E.heading) == null ? void 0 : q.isDeleted
652
+ }])
653
+ }, O(Z(E)), 3),
654
+ (he = E.heading) != null && he.isDeleted ? (o(), F(z, {
655
+ key: 0,
656
+ label: a(n)("menu.import_export.diff.deleted"),
657
+ variant: "critical",
658
+ class: "ml-auto"
659
+ }, null, 8, ["label"])) : (ne = E.heading) != null && ne.isCreate ? (o(), F(z, {
660
+ key: 1,
661
+ label: a(n)("menu.import_export.diff.created"),
662
+ variant: "success",
663
+ class: "ml-auto"
664
+ }, null, 8, ["label"])) : E.heading ? (o(), F(z, {
665
+ key: 2,
666
+ label: a(n)("menu.import_export.diff.updated"),
667
+ variant: "neutral",
668
+ class: "ml-auto"
669
+ }, null, 8, ["label"])) : M("", !0)
670
+ ])
671
+ ];
672
+ }),
673
+ _: 2
674
+ }, 1032, ["data-testid", "onClick"]),
675
+ (o(!0), y(Q, null, ie(E.products, (q) => {
676
+ var he;
677
+ return o(), y(Q, {
678
+ key: q.id
679
+ }, [
680
+ v(Y, {
681
+ "data-testid": `import-diff-entry-${((he = q.base) == null ? void 0 : he.key) ?? `${E.id}/${q.id}`}`,
682
+ onClick: (ne) => q.base ? h.value = q.base.key : K(q.id)
683
+ }, {
684
+ default: A(() => {
685
+ var ne, Pe, Ce;
686
+ return [
687
+ u("span", Ql, [
688
+ v(j, {
689
+ name: q.variants.length ? "keyboard_arrow_down" : "subdirectory_arrow_right",
690
+ size: "sm",
691
+ onClick: we((et) => q.variants.length ? K(q.id) : void 0, ["stop"])
692
+ }, null, 8, ["name", "onClick"]),
693
+ u("span", {
694
+ class: _e(["fm-typo-en-body-lg-400 truncate", {
695
+ "text-fm-color-typo-disabled": (ne = q.base) == null ? void 0 : ne.isDeleted
696
+ }])
697
+ }, O(q.name), 3),
698
+ (Pe = q.base) != null && Pe.isDeleted ? (o(), F(z, {
699
+ key: 0,
700
+ label: a(n)("menu.import_export.diff.deleted"),
701
+ variant: "critical",
702
+ class: "ml-auto"
703
+ }, null, 8, ["label"])) : (Ce = q.base) != null && Ce.isCreate ? (o(), F(z, {
704
+ key: 1,
705
+ label: a(n)("menu.import_export.diff.created"),
706
+ variant: "success",
707
+ class: "ml-auto"
708
+ }, null, 8, ["label"])) : M("", !0)
709
+ ])
710
+ ];
711
+ }),
712
+ _: 2
713
+ }, 1032, ["data-testid", "onClick"]),
714
+ (o(!0), y(Q, null, ie(B.value.has(q.id) ? q.variants : [], (ne) => (o(), F(Y, {
715
+ key: ne.key,
716
+ "data-testid": `import-diff-entry-${ne.key}`,
717
+ onClick: (Pe) => h.value = ne.key
718
+ }, {
719
+ default: A(() => [
720
+ u("span", Zl, [
721
+ u("span", {
722
+ class: _e(["fm-typo-en-body-lg-400 truncate", {
723
+ "text-fm-color-typo-disabled": ne.isDeleted
724
+ }])
725
+ }, O(ne.variantName), 3),
726
+ ne.isDeleted ? (o(), F(z, {
727
+ key: 0,
728
+ label: a(n)("menu.import_export.diff.deleted"),
729
+ variant: "critical",
730
+ class: "ml-auto"
731
+ }, null, 8, ["label"])) : ne.isCreate ? (o(), F(z, {
732
+ key: 1,
733
+ label: a(n)("menu.import_export.diff.created"),
734
+ variant: "success",
735
+ class: "ml-auto"
736
+ }, null, 8, ["label"])) : M("", !0)
737
+ ])
738
+ ]),
739
+ _: 2
740
+ }, 1032, ["data-testid", "onClick"]))), 128))
741
+ ], 64);
742
+ }), 128))
743
+ ], 64))), 128))
744
+ ]),
745
+ _: 1
746
+ })
747
+ ]),
748
+ u("div", ea, [
749
+ w.value && (!w.value.isHeading || w.value.changes.length) ? (o(), y("div", ta, [
750
+ u("div", la, [
751
+ u("p", aa, O(w.value.variantName ?? w.value.name), 1),
752
+ w.value.isDeleted ? (o(), F(z, {
753
+ key: 0,
754
+ "data-testid": "import-diff-selected-deleted",
755
+ label: a(n)("menu.import_export.diff.deleted"),
756
+ variant: "critical"
757
+ }, null, 8, ["label"])) : w.value.isCreate ? (o(), F(z, {
758
+ key: 1,
759
+ "data-testid": "import-diff-selected-created",
760
+ label: a(n)("menu.import_export.diff.created"),
761
+ variant: "success"
762
+ }, null, 8, ["label"])) : M("", !0)
763
+ ]),
764
+ v(T, {
765
+ "column-defs": S.value,
766
+ "row-data": [...w.value.changes],
767
+ "hide-footer": "",
768
+ "shrink-at": !1,
769
+ "page-size": w.value.changes.length || 1
770
+ }, null, 8, ["column-defs", "row-data", "page-size"])
771
+ ])) : M("", !0),
772
+ p.value.length ? (o(), y("div", {
773
+ key: 1,
774
+ "data-testid": "import-diff-linked-products",
775
+ class: _e(["border border-fm-color-neutral-gray-200 fm-corner-radius-md p-16", { "mt-16": (ue = w.value) == null ? void 0 : ue.changes.length }])
776
+ }, [
777
+ u("p", oa, O(a(n)("menu.group.list.products_linked", {
778
+ count: p.value.length
779
+ })), 1),
780
+ v(T, {
781
+ "column-defs": c,
782
+ "row-data": p.value,
783
+ "hide-footer": "",
784
+ "shrink-at": !1,
785
+ "page-size": p.value.length
786
+ }, null, 8, ["row-data", "page-size"])
787
+ ], 2)) : M("", !0)
788
+ ])
789
+ ])) : (o(), y("p", na, O(I.value), 1))
790
+ ])
791
+ ];
792
+ }),
793
+ _: 1
794
+ }, 8, ["show", "title", "primary-action", "secondary-actions"]);
795
+ };
796
+ }
797
+ }), ra = new RegExp("([\\p{Ll}\\d])(\\p{Lu})", "gu"), ia = new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])", "gu"), ua = new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d", "u"), ca = /[^\p{L}\d]+/giu, Pt = "$1\0$2", Lt = "";
798
+ function Ut(C) {
799
+ let m = C.trim();
800
+ m = m.replace(ra, Pt).replace(ia, Pt), m = m.replace(ca, "\0");
801
+ let t = 0, L = m.length;
802
+ for (; m.charAt(t) === "\0"; )
803
+ t++;
804
+ if (t === L)
805
+ return [];
806
+ for (; m.charAt(L - 1) === "\0"; )
807
+ L--;
808
+ return m.slice(t, L).split(/\0/g);
809
+ }
810
+ function ma(C) {
811
+ const m = Ut(C);
812
+ for (let t = 0; t < m.length; t++) {
813
+ const L = m[t], n = ua.exec(L);
814
+ if (n) {
815
+ const R = n.index + (n[1] ?? n[2]).length;
816
+ m.splice(t, 1, L.slice(0, R), L.slice(R));
817
+ }
818
+ }
819
+ return m;
820
+ }
821
+ function da(C, m) {
822
+ const [t, L, n] = ba(C, m), R = pa(m == null ? void 0 : m.locale), g = va(m == null ? void 0 : m.locale), h = fa(R, g);
823
+ return t + L.map((B, K) => K === 0 ? h(B) : R(B)).join((m == null ? void 0 : m.delimiter) ?? " ") + n;
824
+ }
825
+ function pa(C) {
826
+ return C === !1 ? (m) => m.toLowerCase() : (m) => m.toLocaleLowerCase(C);
827
+ }
828
+ function va(C) {
829
+ return C === !1 ? (m) => m.toUpperCase() : (m) => m.toLocaleUpperCase(C);
830
+ }
831
+ function fa(C, m) {
832
+ return (t) => `${m(t[0])}${C(t.slice(1))}`;
833
+ }
834
+ function ba(C, m = {}) {
835
+ const t = m.split ?? (m.separateNumbers ? ma : Ut), L = m.prefixCharacters ?? Lt, n = m.suffixCharacters ?? Lt;
836
+ let R = 0, g = C.length;
837
+ for (; R < C.length; ) {
838
+ const h = C.charAt(R);
839
+ if (!L.includes(h))
840
+ break;
841
+ R++;
842
+ }
843
+ for (; g > R; ) {
844
+ const h = g - 1, B = C.charAt(h);
845
+ if (!n.includes(B))
846
+ break;
847
+ g = h;
848
+ }
849
+ return [
850
+ C.slice(0, R),
851
+ t(C.slice(R, g)),
852
+ C.slice(g)
853
+ ];
854
+ }
855
+ const ya = { class: "py-16 flex flex-col w-full h-full" }, ga = { class: "border border-fm-color-neutral-gray-100 p-16 fm-corner-radius-md" }, _a = { class: "w-[160px]" }, ha = { class: "flex-1" }, ka = { class: "truncate" }, xa = { class: "flex-1" }, wa = { class: "truncate" }, Ca = { key: 1 }, Fa = /* @__PURE__ */ $e({
856
+ __name: "ImportV3DiffPreview",
857
+ props: {
858
+ show: { type: Boolean },
859
+ diff: {}
860
+ },
861
+ emits: ["confirm", "cancel"],
862
+ setup(C, { emit: m }) {
863
+ const t = C, L = m, { t: n } = Se(), R = H(""), g = b(() => t.diff ?? []);
864
+ function h(_) {
865
+ return `${_.code} ${_.name}`.trim();
866
+ }
867
+ const B = b(
868
+ () => g.value.filter(
869
+ (_) => [
870
+ h(_),
871
+ ..._.fields.flatMap((D) => [D.before, D.after])
872
+ ].join(" ").toLowerCase().includes(R.value.toLowerCase())
873
+ )
874
+ );
875
+ function K(_) {
876
+ return _ || n("menu.import_export.v3_diff.empty_cell");
877
+ }
878
+ return (_, D) => {
879
+ const G = U("FmSearch");
880
+ return o(), F(He, {
881
+ show: _.show,
882
+ title: a(n)("menu.import_export.v3_diff.title"),
883
+ "primary-action": { label: a(n)("menu.import_export.preview.actions.confirm") },
884
+ "secondary-actions": [
885
+ {
886
+ label: a(n)("menu.import_export.preview.actions.cancel"),
887
+ click: () => L("cancel")
888
+ }
889
+ ],
890
+ onOnPrimary: D[1] || (D[1] = (w) => L("confirm")),
891
+ onOnCancel: D[2] || (D[2] = (w) => L("cancel"))
892
+ }, {
893
+ default: A(() => [
894
+ u("div", ya, [
895
+ v(kl, {
896
+ title: a(n)("menu.import_export.v3_diff.section")
897
+ }, {
898
+ "append-title": A(() => [
899
+ v(G, {
900
+ modelValue: R.value,
901
+ "onUpdate:modelValue": D[0] || (D[0] = (w) => R.value = w)
902
+ }, null, 8, ["modelValue"])
903
+ ]),
904
+ default: A(() => [
905
+ g.value.length > 0 ? (o(!0), y(Q, { key: 0 }, ie(B.value, (w) => (o(), F(hl, {
906
+ key: `${w.id}/${w.variantKey}`,
907
+ label: h(w)
908
+ }, {
909
+ default: A(() => [
910
+ u("div", ga, [
911
+ (o(!0), y(Q, null, ie(w.fields, (W, X) => (o(), y("div", {
912
+ key: W.key,
913
+ class: _e(["flex items-center gap-8", { "mb-8": X < w.fields.length - 1 }])
914
+ }, [
915
+ u("div", _a, O(a(da)(W.key)), 1),
916
+ u("div", ha, [
917
+ u("div", ka, [
918
+ v(St, {
919
+ variant: "error",
920
+ label: K(W.before)
921
+ }, null, 8, ["label"])
922
+ ])
923
+ ]),
924
+ u("div", xa, [
925
+ u("div", wa, [
926
+ v(St, {
927
+ variant: "success",
928
+ label: K(W.after)
929
+ }, null, 8, ["label"])
930
+ ])
931
+ ])
932
+ ], 2))), 128))
933
+ ])
934
+ ]),
935
+ _: 2
936
+ }, 1032, ["label"]))), 128)) : (o(), y("div", Ca, O(a(n)("menu.import_export.v3_diff.empty")), 1))
937
+ ]),
938
+ _: 1
939
+ }, 8, ["title"])
940
+ ])
941
+ ]),
942
+ _: 1
943
+ }, 8, ["show", "title", "primary-action", "secondary-actions"]);
944
+ };
945
+ }
946
+ }), $a = { class: "flex flex-col w-full h-full" }, Sa = { class: "flex-1 flex overflow-hidden" }, Ia = { class: "w-[150px] overflow-y-auto my-8" }, Va = { class: "fm-typo-en-body-lg-400 truncate" }, Pa = { class: "fm-typo-en-body-lg-400 truncate" }, La = { class: "fm-typo-en-body-lg-400 truncate" }, Ea = { class: "flex-1 flex flex-col overflow-auto p-16" }, Oa = { class: "fm-typo-en-title-sm-600 mb-16" }, Ma = { class: "fm-typo-en-title-sm-600 mb-16" }, Ua = { class: "flex gap-16 flex-wrap" }, Aa = { class: "fm-typo-en-title-sm-600 mb-16" }, Ra = /* @__PURE__ */ $e({
947
+ __name: "PreviewImportTable",
948
+ props: {
949
+ show: {
950
+ type: Boolean,
951
+ required: !0
952
+ },
953
+ tables: {
954
+ type: Object,
955
+ default: null
956
+ }
957
+ },
958
+ emits: ["confirm", "cancel"],
959
+ setup(C, { emit: m }) {
960
+ const t = C, L = m, { t: n, n: R } = Se(), g = H("products"), h = b(() => [
961
+ { value: "products", label: n("menu.import_export.preview.tabs.products") },
962
+ { value: "variants", label: n("menu.import_export.preview.tabs.variants") },
963
+ { value: "addons", label: n("menu.import_export.preview.tabs.addons") }
964
+ ]), B = b(
965
+ () => {
966
+ var S;
967
+ return ((S = t.tables) == null ? void 0 : S.categories) ?? [];
968
+ }
969
+ ), K = b(
970
+ () => {
971
+ var S;
972
+ return ((S = t.tables) == null ? void 0 : S.variantGroups) ?? [];
973
+ }
974
+ ), _ = b(
975
+ () => {
976
+ var S;
977
+ return ((S = t.tables) == null ? void 0 : S.addonGroups) ?? [];
978
+ }
979
+ ), D = H(""), G = b(
980
+ () => B.value.find(
981
+ (S) => S.id === D.value
982
+ ) ?? B.value[0]
983
+ ), w = H(""), W = b(
984
+ () => K.value.find(
985
+ (S) => S.id === w.value
986
+ ) ?? K.value[0]
987
+ ), X = H(""), Z = b(
988
+ () => _.value.find(
989
+ (S) => S.id === X.value
990
+ ) ?? _.value[0]
991
+ );
992
+ function r(S) {
993
+ return S === null ? n("menu.catalog.empty_value") : R(S.amount, {
994
+ style: "currency",
995
+ currency: S.currency,
996
+ currencyDisplay: "narrowSymbol"
997
+ }).replace(/^(\D+)\s+/, "$1");
998
+ }
999
+ const se = b(
1000
+ () => [
1001
+ {
1002
+ id: "image",
1003
+ header: () => n("menu.import_export.preview.columns.image"),
1004
+ size: 72,
1005
+ enableSorting: !1,
1006
+ cell: (S) => {
1007
+ const J = S.row.original;
1008
+ return V(
1009
+ "div",
1010
+ { class: "my-8 mx-12 flex items-center justify-center" },
1011
+ [
1012
+ V(
1013
+ re.FmCard,
1014
+ {
1015
+ variant: "outlined",
1016
+ // `!` on the height only: `.h-40` and
1017
+ // `.fm-card--outlined { height: fit-content }` are both a
1018
+ // single class, and the design-system sheet loads last in
1019
+ // the app, so an unforced `h-40` loses and the frame
1020
+ // collapses to its content — letterboxing every thumbnail.
1021
+ // Nothing in the library sets `width`. Same defect as
1022
+ // ProductList's 72px frame; see the note there.
1023
+ class: "w-40 !h-40 flex shrink-0 items-center justify-center rounded-md overflow-hidden"
1024
+ },
1025
+ () => J.thumbnailUrl ? V("img", {
1026
+ src: J.thumbnailUrl,
1027
+ alt: J.name,
1028
+ class: "w-full h-full object-cover"
1029
+ }) : V(re.FmIcon, {
1030
+ name: "image",
1031
+ outline: !0,
1032
+ color: "neutral-gray-300"
1033
+ })
1034
+ )
1035
+ ]
1036
+ );
1037
+ }
1038
+ },
1039
+ {
1040
+ accessorKey: "name",
1041
+ header: () => n("menu.import_export.preview.columns.name"),
1042
+ enableSorting: !1
1043
+ },
1044
+ {
1045
+ accessorKey: "price",
1046
+ header: () => n("menu.import_export.preview.columns.price"),
1047
+ enableSorting: !1,
1048
+ meta: { textAlign: "right" },
1049
+ cell: (S) => r(S.row.original.price)
1050
+ }
1051
+ ]
1052
+ ), ee = b(() => [
1053
+ {
1054
+ accessorKey: "name",
1055
+ header: () => n("menu.import_export.preview.columns.name"),
1056
+ enableSorting: !1
1057
+ },
1058
+ {
1059
+ accessorKey: "price",
1060
+ header: () => n("menu.import_export.preview.columns.price"),
1061
+ enableSorting: !1,
1062
+ meta: { textAlign: "right" },
1063
+ cell: (S) => r(S.row.original.price)
1064
+ },
1065
+ {
1066
+ id: "status",
1067
+ header: () => n("menu.import_export.preview.columns.status"),
1068
+ enableSorting: !1,
1069
+ cell: (S) => {
1070
+ const J = S.row.original.active;
1071
+ return V(re.FmChip, {
1072
+ variant: J ? "success" : "neutral",
1073
+ label: n(J ? "menu.import_export.preview.status.active" : "menu.import_export.preview.status.inactive")
1074
+ });
1075
+ }
1076
+ }
1077
+ ]);
1078
+ return (S, J) => {
1079
+ const c = U("FmTabs"), p = U("FmListItem"), I = U("FmList"), $ = U("FmTable"), N = U("FmChip");
1080
+ return o(), F(He, {
1081
+ show: C.show,
1082
+ title: a(n)("menu.import_export.preview.title"),
1083
+ "primary-action": { label: a(n)("menu.import_export.preview.actions.confirm") },
1084
+ "secondary-actions": [
1085
+ {
1086
+ label: a(n)("menu.import_export.preview.actions.cancel"),
1087
+ click: () => L("cancel")
1088
+ }
1089
+ ],
1090
+ onOnPrimary: J[1] || (J[1] = (i) => L("confirm")),
1091
+ onOnCancel: J[2] || (J[2] = (i) => L("cancel"))
1092
+ }, {
1093
+ default: A(() => {
1094
+ var i, f, j, ae, z, Y;
1095
+ return [
1096
+ u("div", $a, [
1097
+ u("div", null, [
1098
+ v(c, {
1099
+ "model-value": g.value,
1100
+ items: h.value,
1101
+ "onUpdate:modelValue": J[0] || (J[0] = (x) => g.value = x)
1102
+ }, null, 8, ["model-value", "items"])
1103
+ ]),
1104
+ u("div", Sa, [
1105
+ u("div", Ia, [
1106
+ v(I, { separator: "" }, {
1107
+ default: A(() => [
1108
+ g.value === "products" ? (o(!0), y(Q, { key: 0 }, ie(B.value, (x) => {
1109
+ var T;
1110
+ return o(), F(p, {
1111
+ key: x.id,
1112
+ class: _e(["!py-12 !px-16", {
1113
+ "text-fm-color-primary": ((T = G.value) == null ? void 0 : T.id) === x.id
1114
+ }]),
1115
+ onClick: (te) => D.value = x.id
1116
+ }, {
1117
+ default: A(() => [
1118
+ u("span", Va, O(x.name), 1)
1119
+ ]),
1120
+ _: 2
1121
+ }, 1032, ["class", "onClick"]);
1122
+ }), 128)) : g.value === "variants" ? (o(!0), y(Q, { key: 1 }, ie(K.value, (x) => {
1123
+ var T;
1124
+ return o(), F(p, {
1125
+ key: x.id,
1126
+ class: _e(["!py-12 !px-16", {
1127
+ "text-fm-color-primary": ((T = W.value) == null ? void 0 : T.id) === x.id
1128
+ }]),
1129
+ onClick: (te) => w.value = x.id
1130
+ }, {
1131
+ default: A(() => [
1132
+ u("span", Pa, O(x.name), 1)
1133
+ ]),
1134
+ _: 2
1135
+ }, 1032, ["class", "onClick"]);
1136
+ }), 128)) : (o(!0), y(Q, { key: 2 }, ie(_.value, (x) => {
1137
+ var T;
1138
+ return o(), F(p, {
1139
+ key: x.id,
1140
+ class: _e(["!py-12 !px-16", {
1141
+ "text-fm-color-primary": ((T = Z.value) == null ? void 0 : T.id) === x.id
1142
+ }]),
1143
+ onClick: (te) => X.value = x.id
1144
+ }, {
1145
+ default: A(() => [
1146
+ u("span", La, O(x.name), 1)
1147
+ ]),
1148
+ _: 2
1149
+ }, 1032, ["class", "onClick"]);
1150
+ }), 128))
1151
+ ]),
1152
+ _: 1
1153
+ })
1154
+ ]),
1155
+ u("div", Ea, [
1156
+ g.value === "products" ? (o(), y(Q, { key: 0 }, [
1157
+ u("p", Oa, O(((i = G.value) == null ? void 0 : i.name) ?? a(n)("menu.catalog.empty_value")), 1),
1158
+ v($, {
1159
+ "column-defs": se.value,
1160
+ "row-data": ((f = G.value) == null ? void 0 : f.products) ?? [],
1161
+ "shrink-at": !1
1162
+ }, null, 8, ["column-defs", "row-data"])
1163
+ ], 64)) : g.value === "variants" ? (o(), y(Q, { key: 1 }, [
1164
+ u("p", Ma, O(((j = W.value) == null ? void 0 : j.name) ?? a(n)("menu.catalog.empty_value")), 1),
1165
+ u("div", Ua, [
1166
+ (o(!0), y(Q, null, ie(((ae = W.value) == null ? void 0 : ae.options) ?? [], (x) => (o(), F(N, {
1167
+ key: x.name,
1168
+ label: x.name
1169
+ }, null, 8, ["label"]))), 128))
1170
+ ])
1171
+ ], 64)) : (o(), y(Q, { key: 2 }, [
1172
+ u("p", Aa, O(((z = Z.value) == null ? void 0 : z.name) ?? a(n)("menu.catalog.empty_value")), 1),
1173
+ v($, {
1174
+ "column-defs": ee.value,
1175
+ "row-data": ((Y = Z.value) == null ? void 0 : Y.addons) ?? [],
1176
+ "shrink-at": !1
1177
+ }, null, 8, ["column-defs", "row-data"])
1178
+ ], 64))
1179
+ ])
1180
+ ])
1181
+ ])
1182
+ ];
1183
+ }),
1184
+ _: 1
1185
+ }, 8, ["show", "title", "primary-action", "secondary-actions"]);
1186
+ };
1187
+ }
1188
+ }), Ta = { class: "flex w-full items-center justify-between" }, Da = ["aria-label"], ja = { class: "flex items-center gap-8 rounded-lg bg-fm-color-system-info-100 p-16 pl-24" }, Na = { class: "fm-typo-en-body-lg-400" }, za = {
1189
+ key: 0,
1190
+ class: "upload-area w-full cursor-pointer rounded-md outline-2 outline-dashed outline-fm-color-neutral-gray-300 hover:outline-fm-color-neutral-black"
1191
+ }, Ba = { class: "flex h-full w-full flex-col items-center justify-center p-16" }, Ka = { class: "fm-typo-en-body-md-400 mt-4 text-fm-color-neutral-gray-300" }, Ga = ["aria-label"], qa = { class: "mb-8 rounded-md outline-dashed outline-2 outline-fm-color-neutral-gray-300" }, Ha = { class: "p-16" }, Wa = { class: "flex w-[36px] shrink-0 items-center justify-center" }, Xa = { class: "fm-typo-en-body-lg-400 flex-1" }, Ya = {
1192
+ key: 2,
1193
+ class: "text-fm-color-typo-error",
1194
+ role: "alert"
1195
+ }, Ja = {
1196
+ key: 3,
1197
+ class: "rounded-md bg-fm-color-neutral-gray-100 p-16",
1198
+ "aria-live": "polite"
1199
+ }, Qa = { class: "fm-typo-en-body-md-600" }, Za = { class: "fm-typo-en-body-md-400" }, eo = {
1200
+ key: 0,
1201
+ class: "mt-8 flex flex-col gap-4"
1202
+ }, to = /* @__PURE__ */ $e({
1203
+ __name: "ImportExport",
1204
+ props: {
1205
+ sdk: {}
1206
+ },
1207
+ setup(C, { expose: m }) {
1208
+ const { t } = Se(), { run: L } = Mt(), n = Ot(), R = je(C.sdk.menuImportExport.view), g = H(!1), h = H(null), B = H(null), K = H("replace"), _ = b(
1209
+ () => R.value.status === "ready" ? R.value.value : null
1210
+ ), D = b(
1211
+ () => {
1212
+ var I, $, N, i;
1213
+ return !!(($ = (I = _.value) == null ? void 0 : I.preview) != null && $.ok) && !!((N = _.value) != null && N.preview.tables) && ((i = _.value) == null ? void 0 : i.previewSurface) === "vendor";
1214
+ }
1215
+ ), G = b(
1216
+ () => {
1217
+ var I, $, N, i;
1218
+ return !!(($ = (I = _.value) == null ? void 0 : I.preview) != null && $.ok) && !!((N = _.value) != null && N.preview.diff) && ((i = _.value) == null ? void 0 : i.previewSurface) === "diff";
1219
+ }
1220
+ ), w = b(
1221
+ () => {
1222
+ var I, $, N, i;
1223
+ return !!(($ = (I = _.value) == null ? void 0 : I.preview) != null && $.ok) && !!((N = _.value) != null && N.preview.v3Diff) && ((i = _.value) == null ? void 0 : i.previewSurface) === "v3Diff";
1224
+ }
1225
+ );
1226
+ function W(I) {
1227
+ return typeof File < "u" && I instanceof File;
1228
+ }
1229
+ function X(I) {
1230
+ return Array.isArray(I) ? I.filter(W) : typeof FileList < "u" && I instanceof FileList ? [...I] : W(I) ? [I] : [];
1231
+ }
1232
+ function Z() {
1233
+ h.value = null, C.sdk.menuImportExport.openImport(), g.value = !0;
1234
+ }
1235
+ m({ openImport: Z });
1236
+ function r() {
1237
+ C.sdk.menuImportExport.cancelImport(), h.value = null, g.value = !1;
1238
+ }
1239
+ async function se(I, $ = !1) {
1240
+ const N = X(I), i = await Promise.all(
1241
+ N.map(async (j) => ({
1242
+ name: j.name,
1243
+ data: await j.arrayBuffer()
1244
+ }))
1245
+ ), f = $ ? C.sdk.menuImportExport.addFiles(i) : C.sdk.menuImportExport.selectFiles(i);
1246
+ if (f.kind === "rejected") {
1247
+ h.value = n(f.issues[0]);
1248
+ return;
1249
+ }
1250
+ h.value = null;
1251
+ }
1252
+ function ee(I) {
1253
+ var $;
1254
+ K.value = I, ($ = B.value) == null || $.click();
1255
+ }
1256
+ function S(I) {
1257
+ var N;
1258
+ const $ = I.target;
1259
+ !($ instanceof HTMLInputElement) || !((N = $.files) != null && N.length) || (se($.files, K.value === "append"), $.value = "");
1260
+ }
1261
+ function J(I) {
1262
+ C.sdk.menuImportExport.removeFile(I);
1263
+ }
1264
+ async function c() {
1265
+ await L(() => C.sdk.menuImportExport.previewImport(), {
1266
+ successMessage: t("menu.import_export.actions.preview_ready"),
1267
+ showLoading: !1,
1268
+ // Every client-side preview rejection here is a raw parser exception
1269
+ // or a raw parser-adjacent cross-reference check, not a validation
1270
+ // guard — legacy passes both through as `title` (see
1271
+ // `useActionFeedback`'s `rejectedPresentation` doc comment).
1272
+ rejectedPresentation: "title"
1273
+ });
1274
+ }
1275
+ async function p() {
1276
+ var $;
1277
+ if (!(($ = _.value) != null && $.preview) && (await L(
1278
+ () => C.sdk.menuImportExport.previewImport(),
1279
+ { showLoading: !1, rejectedPresentation: "title" }
1280
+ )).kind !== "success")
1281
+ return;
1282
+ (await L(
1283
+ () => C.sdk.menuImportExport.confirmImport(),
1284
+ { successMessage: t("menu.import_export.feedback.success") }
1285
+ )).kind === "success" && r();
1286
+ }
1287
+ return (I, $) => {
1288
+ var z, Y, x, T, te, ue;
1289
+ const N = U("FmIcon"), i = U("FmSelect"), f = U("FmButton"), j = U("FmSpacer"), ae = U("FmDialog");
1290
+ return o(), y(Q, null, [
1291
+ v(Ra, {
1292
+ show: D.value,
1293
+ tables: ((Y = (z = _.value) == null ? void 0 : z.preview) == null ? void 0 : Y.tables) ?? null,
1294
+ onConfirm: p,
1295
+ onCancel: r
1296
+ }, null, 8, ["show", "tables"]),
1297
+ v(sa, {
1298
+ show: G.value,
1299
+ diff: ((T = (x = _.value) == null ? void 0 : x.preview) == null ? void 0 : T.diff) ?? null,
1300
+ onConfirm: p,
1301
+ onCancel: r
1302
+ }, null, 8, ["show", "diff"]),
1303
+ v(Fa, {
1304
+ show: w.value,
1305
+ diff: ((ue = (te = _.value) == null ? void 0 : te.preview) == null ? void 0 : ue.v3Diff) ?? null,
1306
+ onConfirm: p,
1307
+ onCancel: r
1308
+ }, null, 8, ["show", "diff"]),
1309
+ v(ae, {
1310
+ "model-value": g.value && !D.value && !G.value && !w.value,
1311
+ overlay: !0,
1312
+ "max-width": 560,
1313
+ "close-button": !1,
1314
+ "onUpdate:modelValue": $[3] || ($[3] = (E) => E ? g.value = !0 : r())
1315
+ }, {
1316
+ "dialog-header": A(() => [
1317
+ u("div", Ta, [
1318
+ u("span", null, O(a(t)("menu.import_export.dialog.title")), 1),
1319
+ v(N, {
1320
+ "aria-label": a(t)("menu.import_export.actions.cancel"),
1321
+ class: "relative -mr-24 cursor-pointer",
1322
+ name: "close",
1323
+ role: "button",
1324
+ tabindex: "0",
1325
+ onClick: r,
1326
+ onKeydown: [
1327
+ wt(r, ["enter"]),
1328
+ wt(we(r, ["prevent"]), ["space"])
1329
+ ]
1330
+ }, null, 8, ["aria-label", "onKeydown"])
1331
+ ])
1332
+ ]),
1333
+ "dialog-footer": A(() => [
1334
+ v(j),
1335
+ v(f, {
1336
+ label: a(t)("menu.import_export.actions.cancel"),
1337
+ variant: "tertiary",
1338
+ onClick: r
1339
+ }, null, 8, ["label"]),
1340
+ v(f, {
1341
+ label: a(t)("menu.import_export.actions.import"),
1342
+ variant: "primary",
1343
+ onClick: c
1344
+ }, null, 8, ["label"])
1345
+ ]),
1346
+ default: A(() => [
1347
+ _.value ? (o(), y("div", {
1348
+ key: 0,
1349
+ role: "dialog",
1350
+ "aria-label": a(t)("menu.import_export.dialog.title"),
1351
+ class: "flex flex-col gap-24"
1352
+ }, [
1353
+ u("div", ja, [
1354
+ v(N, {
1355
+ color: "system-info-300",
1356
+ name: "info"
1357
+ }),
1358
+ u("p", Na, O(a(t)("menu.import.dialog.info")), 1)
1359
+ ]),
1360
+ v(i, {
1361
+ items: _.value.importerOptions.map((E) => ({
1362
+ value: E.value,
1363
+ label: a(t)(E.labelKey)
1364
+ })),
1365
+ label: a(t)("menu.import.dialog.fields.type"),
1366
+ "model-value": _.value.importer,
1367
+ "onUpdate:modelValue": $[0] || ($[0] = (E) => I.sdk.menuImportExport.selectImporter(String(E)))
1368
+ }, null, 8, ["items", "label", "model-value"]),
1369
+ _.value.files.length === 0 ? (o(), y("div", za, [
1370
+ u("div", Ba, [
1371
+ u("input", {
1372
+ ref_key: "fileInput",
1373
+ ref: B,
1374
+ class: "hidden",
1375
+ type: "file",
1376
+ accept: ".xlsx,.xls,.json",
1377
+ multiple: "",
1378
+ onChange: S
1379
+ }, null, 544),
1380
+ v(f, {
1381
+ label: a(t)("menu.import.dialog.button.label"),
1382
+ variant: "secondary",
1383
+ onClick: $[1] || ($[1] = (E) => ee("replace"))
1384
+ }, null, 8, ["label"]),
1385
+ u("p", Ka, O(a(t)("menu.import.dialog.subtitle")), 1)
1386
+ ])
1387
+ ])) : (o(), y("div", {
1388
+ key: 1,
1389
+ class: "flex flex-col",
1390
+ "aria-label": a(t)("menu.import_export.labels.selected_files")
1391
+ }, [
1392
+ u("div", qa, [
1393
+ u("div", Ha, [
1394
+ (o(!0), y(Q, null, ie(_.value.files, (E, q) => (o(), y("div", {
1395
+ key: `${E}-${q}`,
1396
+ class: "flex items-center"
1397
+ }, [
1398
+ u("span", Wa, [
1399
+ v(N, { name: "attach_file" })
1400
+ ]),
1401
+ u("p", Xa, O(E), 1),
1402
+ v(f, {
1403
+ "aria-label": a(t)("menu.common.actions.remove"),
1404
+ "icon-color": "primary",
1405
+ "prepend-icon": "close",
1406
+ variant: "plain",
1407
+ onClick: (he) => J(q)
1408
+ }, null, 8, ["aria-label", "onClick"])
1409
+ ]))), 128))
1410
+ ]),
1411
+ u("input", {
1412
+ ref_key: "fileInput",
1413
+ ref: B,
1414
+ class: "hidden",
1415
+ type: "file",
1416
+ accept: ".xlsx,.xls,.json",
1417
+ multiple: "",
1418
+ onChange: S
1419
+ }, null, 544),
1420
+ v(f, {
1421
+ label: a(t)("menu.import_export.actions.add_new_files"),
1422
+ "prepend-icon": "add",
1423
+ variant: "plain",
1424
+ onClick: $[2] || ($[2] = (E) => ee("append"))
1425
+ }, null, 8, ["label"])
1426
+ ])
1427
+ ], 8, Ga)),
1428
+ h.value ? (o(), y("p", Ya, O(h.value), 1)) : M("", !0),
1429
+ _.value.preview ? (o(), y("section", Ja, [
1430
+ u("p", Qa, O(_.value.preview.ok ? a(t)("menu.import_export.labels.ready") : a(t)("menu.import_export.labels.has_errors")), 1),
1431
+ u("p", Za, O(a(t)("menu.import_export.labels.change_count", {
1432
+ count: _.value.preview.changes.length
1433
+ })), 1),
1434
+ _.value.preview.issues.length ? (o(), y("ul", eo, [
1435
+ (o(!0), y(Q, null, ie(_.value.preview.issues, (E, q) => (o(), y("li", {
1436
+ key: `${E.code}-${q}`
1437
+ }, O(a(n)(E)), 1))), 128))
1438
+ ])) : M("", !0)
1439
+ ])) : M("", !0)
1440
+ ], 8, Da)) : M("", !0)
1441
+ ]),
1442
+ _: 1
1443
+ }, 8, ["model-value"])
1444
+ ], 64);
1445
+ };
1446
+ }
1447
+ }), lo = { class: "flex-1 flex justify-between gap-8 pl-8" }, ao = {
1448
+ key: 0,
1449
+ class: "flex items-center"
1450
+ }, oo = { class: "bg-fm-color-neutral-gray-100 rounded-md px-8 py-4" }, no = { class: "fm-typo-en-body-md-600 font-semibold" }, so = { class: "flex items-center gap-8 ml-auto" }, ro = {
1451
+ key: 0,
1452
+ role: "alert",
1453
+ class: "text-fm-color-typo-secondary"
1454
+ }, io = {
1455
+ key: 1,
1456
+ class: "text-fm-color-typo-secondary"
1457
+ }, uo = {
1458
+ key: 2,
1459
+ class: "flex flex-1 items-center justify-center"
1460
+ }, co = {
1461
+ key: 3,
1462
+ class: "relative flex flex-col flex-1 min-h-0 space-y-8 overflow-hidden pt-16"
1463
+ }, mo = { class: "flex justify-between items-center gap-8" }, po = { class: "flex items-center gap-8" }, vo = ["aria-label"], fo = {
1464
+ key: 0,
1465
+ class: "w-[320px]"
1466
+ }, bo = { class: "flex space-x-8" }, yo = {
1467
+ key: 2,
1468
+ class: "flex items-center p-4"
1469
+ }, go = { class: "mr-8 fm-typo-en-body-md-400" }, _o = {
1470
+ key: 4,
1471
+ class: "flex flex-col flex-1 overflow-auto divide-y divide-fm-color-neutral-gray-100 pb-64"
1472
+ }, ho = { class: "flex-1 min-w-0" }, ko = { class: "flex items-center justify-between gap-8 pb-4" }, xo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, wo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Co = {
1473
+ key: 5,
1474
+ class: "absolute inset-0 flex items-center justify-center bg-white/50"
1475
+ }, Fo = { class: "w-full overflow-x-auto py-24" }, $o = "fixed right-16 bottom-[72px] z-10", Et = 37, Xo = /* @__PURE__ */ $e({
1476
+ __name: "ProductList",
1477
+ props: {
1478
+ sdk: {},
1479
+ catalogPage: { type: Boolean }
1480
+ },
1481
+ setup(C) {
1482
+ const m = C, { t, n: L } = Se(), n = wl(), R = je(m.sdk.productBatchImage.entry), g = b(() => {
1483
+ const e = [], l = R.value;
1484
+ return l.status === "ready" && l.value.state === "allowed" && e.push({
1485
+ id: "product-internal-tools",
1486
+ label: t("menu.productInternalTools.title"),
1487
+ run: () => void n.push({ name: ol.PRODUCT_INTERNAL_TOOLS })
1488
+ }), e;
1489
+ }), h = Ot(), B = (e) => e.labelMessage ? h(e.labelMessage) : e.label, K = cl(), _ = ml(), D = b(() => _.breakpoints.value.xs), G = H(!1), w = H(
1490
+ null
1491
+ );
1492
+ async function W() {
1493
+ var e;
1494
+ G.value = !G.value, G.value && (await ll(), (e = w.value) == null || e.toggleProperty(!0));
1495
+ }
1496
+ const { run: X } = Mt(), Z = je(m.sdk.item.list), r = b(
1497
+ () => Z.value.status === "ready" ? Z.value.value : null
1498
+ ), se = je(m.sdk.item.linkCatalogue), ee = b(
1499
+ () => se.value.status === "ready" ? se.value.value : null
1500
+ ), S = je(m.sdk.menuImportExport.view), J = b(() => {
1501
+ const e = S.value;
1502
+ return e.status === "ready" && e.value.canImport;
1503
+ }), c = H(null);
1504
+ function p() {
1505
+ var e;
1506
+ (e = c.value) == null || e.openImport();
1507
+ }
1508
+ const I = b(
1509
+ () => D.value && !m.catalogPage
1510
+ ), $ = b(
1511
+ () => I.value ? fe.Fab : fe.Primary
1512
+ ), N = H(!1);
1513
+ ge(D, (e) => {
1514
+ e || (N.value = !1);
1515
+ });
1516
+ const i = al(), f = b(() => {
1517
+ var l;
1518
+ const e = ((l = i.sessionUser.value) == null ? void 0 : l.permissions) ?? [];
1519
+ return $t(
1520
+ [
1521
+ {
1522
+ action: Ge.Action.manage,
1523
+ subject: Ge.Subject.Business.menu_importExport
1524
+ }
1525
+ ],
1526
+ e
1527
+ ).granted;
1528
+ }), j = b(() => {
1529
+ var l;
1530
+ const e = ((l = i.sessionUser.value) == null ? void 0 : l.permissions) ?? [];
1531
+ return $t(
1532
+ [
1533
+ {
1534
+ action: Ge.Action.manage,
1535
+ subject: Ge.Subject.Business.menu_menuManagement
1536
+ }
1537
+ ],
1538
+ e
1539
+ ).granted;
1540
+ });
1541
+ async function ae() {
1542
+ await X(
1543
+ async () => {
1544
+ const e = await m.sdk.menuImportExport.exportMenu();
1545
+ if (e.kind !== "success") return e;
1546
+ try {
1547
+ await fl(e.value);
1548
+ } catch {
1549
+ return {
1550
+ kind: "failure",
1551
+ error: {
1552
+ kind: "unexpected",
1553
+ retryable: !1,
1554
+ message: { code: "menu.error.unexpected" }
1555
+ }
1556
+ };
1557
+ }
1558
+ return e;
1559
+ },
1560
+ { successMessage: t("menu.import_export.feedback.exported") }
1561
+ );
1562
+ }
1563
+ const z = H(!1), Y = xe(null), x = xe(
1564
+ null
1565
+ ), T = xe({
1566
+ status: "loading"
1567
+ });
1568
+ let te = null;
1569
+ function ue() {
1570
+ var e, l;
1571
+ te == null || te(), te = null, (e = Y.value) == null || e.dispose(), Y.value = null, (l = x.value) == null || l.dispose(), x.value = null, T.value = { status: "loading" };
1572
+ }
1573
+ function E() {
1574
+ var l;
1575
+ ue(), x.value = m.sdk.linkProduct.selection(
1576
+ ((l = r.value) == null ? void 0 : l.availableItemIds) ?? [],
1577
+ (s) => m.sdk.item.linkProducts(s)
1578
+ );
1579
+ const e = m.sdk.linkProduct.rules();
1580
+ Y.value = e, T.value = e.get(), te = e.subscribe((s) => {
1581
+ T.value = s;
1582
+ }), z.value = !0;
1583
+ }
1584
+ function q() {
1585
+ z.value = !1, ue();
1586
+ }
1587
+ ge(z, (e) => {
1588
+ e || ue();
1589
+ });
1590
+ async function he(e) {
1591
+ (await X(
1592
+ () => {
1593
+ var s;
1594
+ return ((s = x.value) == null ? void 0 : s.submit()) ?? Promise.resolve({ kind: "cancelled" });
1595
+ },
1596
+ {
1597
+ successMessage: r.value ? h(r.value.linkSaveMessage) : ""
1598
+ }
1599
+ )).kind === "success" && q();
1600
+ }
1601
+ async function ne() {
1602
+ const e = Y.value;
1603
+ if (!e) return;
1604
+ (await X(() => e.submit(), {
1605
+ showLoading: () => T.value.status === "ready" && T.value.value.status === "submitting",
1606
+ successMessage: r.value ? h(r.value.linkSaveMessage) : ""
1607
+ })).kind === "success" && q();
1608
+ }
1609
+ const Pe = b(() => {
1610
+ var e;
1611
+ return ((e = r.value) == null ? void 0 : e.headerCount) ?? 0;
1612
+ }), Ce = b(() => {
1613
+ var e;
1614
+ return ((e = r.value) == null ? void 0 : e.rows) ?? [];
1615
+ }), et = b(() => {
1616
+ var e;
1617
+ return ((e = r.value) == null ? void 0 : e.currency) ?? null;
1618
+ }), At = b(() => {
1619
+ var e;
1620
+ return ((e = r.value) == null ? void 0 : e.currencySymbol) ?? "";
1621
+ }), Rt = b(() => {
1622
+ var e;
1623
+ return ((e = r.value) == null ? void 0 : e.taxSystemCode) ?? null;
1624
+ }), Tt = b(() => [...Ce.value]);
1625
+ function tt(e, l) {
1626
+ return e == null ? t("menu.catalog.empty_value") : L(e, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
1627
+ }
1628
+ function lt(e) {
1629
+ return e === null ? t("menu.catalog.empty_value") : L(e / 100, { style: "percent", minimumFractionDigits: 2 });
1630
+ }
1631
+ const Fe = b(() => {
1632
+ var e;
1633
+ return ((e = r.value) == null ? void 0 : e.empty) ?? !1;
1634
+ }), ze = H({}), Be = b(
1635
+ () => Object.entries(ze.value).filter(([, e]) => e).map(([e]) => e)
1636
+ ), Le = b(() => m.sdk.item.removeManyCapability(Be.value));
1637
+ function We() {
1638
+ ze.value = {};
1639
+ }
1640
+ ge(
1641
+ () => {
1642
+ var e, l;
1643
+ return [(e = r.value) == null ? void 0 : e.rows, (l = r.value) == null ? void 0 : l.attributeRule];
1644
+ },
1645
+ () => We()
1646
+ );
1647
+ const Ie = H(!1), ve = xe(null), at = xl(() => ve.value);
1648
+ let be = null;
1649
+ const Ee = xe({
1650
+ status: "loading"
1651
+ });
1652
+ let ke = null;
1653
+ const Oe = b(
1654
+ () => Ee.value.status === "ready" ? Ee.value.value : null
1655
+ ), Xe = H(!1), ce = xe(null), Me = xe(null);
1656
+ let Ue = null;
1657
+ const le = b(
1658
+ () => {
1659
+ var e;
1660
+ return ((e = Me.value) == null ? void 0 : e.status) === "ready" ? Me.value.value : null;
1661
+ }
1662
+ );
1663
+ function Ae() {
1664
+ var e;
1665
+ Ue == null || Ue(), (e = ce.value) == null || e.dispose(), Ue = null, ce.value = null, Me.value = null, Xe.value = !1;
1666
+ }
1667
+ function ot() {
1668
+ var l;
1669
+ if (!((l = le.value) != null && l.dirty)) return Ae();
1670
+ const e = ce.value;
1671
+ K.open({
1672
+ title: t("menu.product.table.bulk_edit.discard.title"),
1673
+ message: t("menu.product.table.bulk_edit.discard.message"),
1674
+ primaryActions: {
1675
+ text: t("menu.common.actions.discard"),
1676
+ close: !0,
1677
+ variant: fe.Destructive
1678
+ },
1679
+ secondaryActions: {
1680
+ text: t("menu.common.actions.cancel"),
1681
+ close: !0
1682
+ }
1683
+ }).onPrimary(() => {
1684
+ ce.value === e && Ae();
1685
+ });
1686
+ }
1687
+ function Dt() {
1688
+ Ae();
1689
+ const e = m.sdk.item.bulkEditor();
1690
+ ce.value = e, Me.value = e.get(), Ue = e.subscribe((l) => {
1691
+ Me.value = l;
1692
+ }), Xe.value = !0;
1693
+ }
1694
+ async function jt() {
1695
+ var d;
1696
+ const e = ce.value;
1697
+ if (!e) return;
1698
+ const l = ((d = le.value) == null ? void 0 : d.dirty) ?? !1;
1699
+ (await X(() => e.submit(), {
1700
+ showLoading: () => {
1701
+ var P;
1702
+ return ((P = le.value) == null ? void 0 : P.status) === "submitting";
1703
+ },
1704
+ successMessage: l && le.value ? h(le.value.saveMessage) : ""
1705
+ })).kind === "success" && Ae();
1706
+ }
1707
+ function Ye(e) {
1708
+ var l;
1709
+ ke == null || ke(), (l = ve.value) == null || l.dispose(), ve.value = m.sdk.item.editor(e), Ee.value = ve.value.get(), ke = ve.value.subscribe((s) => {
1710
+ Ee.value = s;
1711
+ });
1712
+ }
1713
+ function nt() {
1714
+ be = m.sdk.item.editorScope(), Ye(), Ie.value = !0;
1715
+ }
1716
+ function st(e) {
1717
+ be = m.sdk.item.editorScope(), Ye(e.id), Ie.value = !0;
1718
+ }
1719
+ async function Nt() {
1720
+ const e = ve.value;
1721
+ if (!e) return;
1722
+ (await X(
1723
+ () => at.submit(() => e.submit()),
1724
+ {
1725
+ showLoading: () => {
1726
+ var s;
1727
+ return ((s = Oe.value) == null ? void 0 : s.status) === "submitting";
1728
+ },
1729
+ successMessage: Oe.value ? h(Oe.value.saveMessage) : ""
1730
+ }
1731
+ )).kind === "success" && ve.value === e && (Ie.value = !1);
1732
+ }
1733
+ function zt(e) {
1734
+ var s;
1735
+ const l = ((s = Oe.value) == null ? void 0 : s.itemId) ?? void 0;
1736
+ be == null || be.select(e), Ye(l);
1737
+ }
1738
+ const Ke = H(!1), Je = xe(null);
1739
+ let Re = null, Te = null;
1740
+ function Qe() {
1741
+ Te == null || Te(), Re == null || Re.dispose(), Te = null, Re = null;
1742
+ }
1743
+ function Bt(e) {
1744
+ Qe();
1745
+ const l = m.sdk.item.overview(e.id);
1746
+ Je.value = l.get(), Re = l, Te = l.subscribe((s) => {
1747
+ Je.value = s;
1748
+ }), Ke.value = !0;
1749
+ }
1750
+ function rt(e) {
1751
+ if (!e.removeRequiresConfirmation) {
1752
+ X(() => m.sdk.item.remove(e.id), {
1753
+ successMessage: h(e.removeMessage)
1754
+ });
1755
+ return;
1756
+ }
1757
+ K.open({
1758
+ title: t("menu.common.dialog.remove.product.title"),
1759
+ message: t("menu.common.dialog.remove.product.message", {
1760
+ name: e.name
1761
+ }),
1762
+ primaryActions: {
1763
+ text: t("menu.common.actions.remove"),
1764
+ close: !0,
1765
+ variant: fe.Destructive
1766
+ },
1767
+ secondaryActions: {
1768
+ text: t("menu.common.actions.cancel"),
1769
+ close: !0
1770
+ }
1771
+ }).onPrimary(async () => {
1772
+ await X(() => m.sdk.item.remove(e.id), {
1773
+ successMessage: h(e.removeMessage)
1774
+ });
1775
+ });
1776
+ }
1777
+ function Kt() {
1778
+ var P, de;
1779
+ const e = Be.value;
1780
+ if (e.length === 0 || Le.value.state !== "allowed") return;
1781
+ const l = (P = r.value) == null ? void 0 : P.rows.find((me) => e.includes(me.id)), s = () => X(() => m.sdk.item.removeMany(e), {
1782
+ successMessage: l ? h(l.removeMessage) : t("menu.common.dialog.remove.product.success")
1783
+ }).then((me) => {
1784
+ me.kind === "success" && We();
1785
+ });
1786
+ if (!((de = r.value) == null ? void 0 : de.rows.filter((me) => e.includes(me.id)).some((me) => me.removeRequiresConfirmation))) {
1787
+ s();
1788
+ return;
1789
+ }
1790
+ K.open({
1791
+ title: t("menu.common.dialog.remove.product.title"),
1792
+ message: t("menu.common.dialog.remove.product.message", {
1793
+ name: (l == null ? void 0 : l.name) ?? ""
1794
+ }),
1795
+ primaryActions: {
1796
+ text: t("menu.common.actions.remove"),
1797
+ close: !0,
1798
+ variant: fe.Destructive
1799
+ },
1800
+ secondaryActions: {
1801
+ text: t("menu.common.actions.cancel"),
1802
+ close: !0
1803
+ }
1804
+ }).onPrimary(() => s());
1805
+ }
1806
+ const it = b(() => {
1807
+ var e;
1808
+ return [
1809
+ { label: t("menu.category.selector.all"), value: null },
1810
+ ...(((e = r.value) == null ? void 0 : e.categoryOptions) ?? []).map((l) => ({
1811
+ label: B(l),
1812
+ value: l.id
1813
+ }))
1814
+ ];
1815
+ }), Gt = b(() => {
1816
+ var e;
1817
+ return [
1818
+ { label: t("menu.common.labels.summary"), value: null },
1819
+ ...(((e = r.value) == null ? void 0 : e.scope.schedulerOptions) ?? []).map((l) => ({
1820
+ label: l.label,
1821
+ value: l.id
1822
+ }))
1823
+ ];
1824
+ });
1825
+ function ut(e) {
1826
+ return e.length === 0 ? [] : [
1827
+ V(pl, {
1828
+ nameLocale: Object.fromEntries(
1829
+ e.map((l) => [l.locale, l.value])
1830
+ ),
1831
+ showNumber: 1
1832
+ })
1833
+ ];
1834
+ }
1835
+ function ct(e) {
1836
+ return e.isAddon ? [t("menu.tree_editor.labels.addon"), ...e.categoryNames] : e.categoryNames;
1837
+ }
1838
+ const qt = b(() => {
1839
+ var e, l;
1840
+ return [
1841
+ {
1842
+ id: "image",
1843
+ header: "",
1844
+ size: 110,
1845
+ meta: {
1846
+ // The table may shrink other columns, but this column must always
1847
+ // accommodate the 72px product image and its horizontal margins.
1848
+ cellClass: "px-0 min-w-[110px]",
1849
+ headerClass: "px-0 min-w-[110px]",
1850
+ headerContentClass: "px-0"
1851
+ },
1852
+ enableSorting: !1,
1853
+ // A placeholder only where the product has no image. Uploading belongs to
1854
+ // product-image-management, an undiscovered unit that also reaches
1855
+ // media-service — rendering the frame keeps the golden comparable without
1856
+ // pulling that unit into scope.
1857
+ cell: (s) => {
1858
+ const d = s.row.original;
1859
+ return V(
1860
+ "div",
1861
+ { class: "my-8 mx-12 flex items-center justify-center" },
1862
+ [
1863
+ V(
1864
+ re.FmCard,
1865
+ {
1866
+ variant: "outlined",
1867
+ // Keeps the card square even when the child image has an
1868
+ // intrinsic ratio; legacy Thumbnail is the same fixed 72px box.
1869
+ // `w-72 h-72` IS 72px on the FeedMe scale, which is why the
1870
+ // inline `style: {width:'72px', height:'72px'}` that used to
1871
+ // sit here was removed as a restatement (ADR-0003 §2).
1872
+ //
1873
+ // The HEIGHT needs `!` and the width does not. `.h-72` and
1874
+ // `.fm-card--outlined { height: fit-content }` are both a
1875
+ // single class, so specificity ties and source order decides —
1876
+ // and the ui-library sheet loads after the utilities in the
1877
+ // app, so the card collapsed to its content: 72x26, which
1878
+ // stretched every product thumbnail into a letterbox. Nothing
1879
+ // in the library sets `width`, so `w-72` needs no help.
1880
+ //
1881
+ // A mount that loads the two sheets in the opposite order
1882
+ // renders this square, which is how every list screenshot once
1883
+ // compared clean while the real app was wrong. Do not drop the
1884
+ // `!` on the strength of a green visual comparison.
1885
+ class: "flex shrink-0 w-72 !h-72 items-center justify-center rounded-md overflow-hidden"
1886
+ },
1887
+ () => d.thumbnailUrl ? V("img", {
1888
+ src: d.thumbnailUrl,
1889
+ alt: d.name,
1890
+ class: "w-full h-full object-cover"
1891
+ }) : V(re.FmIcon, {
1892
+ name: "image",
1893
+ outline: !0,
1894
+ color: "neutral-gray-300"
1895
+ })
1896
+ )
1897
+ ]
1898
+ );
1899
+ }
1900
+ },
1901
+ {
1902
+ accessorKey: "code",
1903
+ header: () => t("menu.product.table.columns.code"),
1904
+ enableSorting: !1,
1905
+ size: 100,
1906
+ cell: (s) => s.getValue() ?? t("menu.catalog.empty_value")
1907
+ },
1908
+ {
1909
+ accessorKey: "name",
1910
+ header: () => t("menu.product.table.columns.name"),
1911
+ enableSorting: !1,
1912
+ size: 250,
1913
+ cell: (s) => {
1914
+ const d = s.row.original, P = d.translatedNames;
1915
+ return V("div", { class: "flex items-center gap-8" }, [
1916
+ V("span", { class: "text-wrap" }, d.name),
1917
+ ...ut(P)
1918
+ ]);
1919
+ }
1920
+ },
1921
+ {
1922
+ accessorKey: "price",
1923
+ header: () => V(
1924
+ "div",
1925
+ { class: "flex flex-1 justify-end" },
1926
+ t("menu.product.table.columns.price", {
1927
+ currency: At.value
1928
+ })
1929
+ ),
1930
+ enableSorting: !1,
1931
+ size: 140,
1932
+ meta: { textAlign: "right" },
1933
+ cell: (s) => {
1934
+ const d = s.getValue();
1935
+ return tt((d == null ? void 0 : d.amount) ?? null, (d == null ? void 0 : d.currency) ?? null);
1936
+ }
1937
+ },
1938
+ {
1939
+ accessorKey: "taxRatePercent",
1940
+ // The header is DATA, not copy: legacy renders the business's tax system
1941
+ // code here (ProductTable.vue:366), which is why no locale key exists.
1942
+ header: () => V(
1943
+ "div",
1944
+ { class: "flex flex-1 justify-end" },
1945
+ Rt.value ?? ""
1946
+ ),
1947
+ enableSorting: !1,
1948
+ size: 80,
1949
+ meta: { textAlign: "right" },
1950
+ cell: (s) => lt(s.getValue())
1951
+ },
1952
+ {
1953
+ accessorKey: "categoryNames",
1954
+ header: () => t("menu.product.table.columns.category"),
1955
+ enableSorting: !1,
1956
+ size: 140,
1957
+ cell: (s) => {
1958
+ const d = ct(s.row.original);
1959
+ return d.length === 0 ? t("menu.catalog.empty_value") : V(qe, {
1960
+ kind: "category",
1961
+ chips: d.map((P) => ({ key: P, label: P }))
1962
+ });
1963
+ }
1964
+ },
1965
+ ...((e = r.value) == null ? void 0 : e.subcategoryPathColumn.state) === "allowed" ? [
1966
+ {
1967
+ accessorKey: "subcategoryPath",
1968
+ header: () => t("menu.product.table.columns.subcategory"),
1969
+ enableSorting: !1,
1970
+ size: 180,
1971
+ cell: (s) => s.getValue() ?? t("menu.catalog.empty_value")
1972
+ }
1973
+ ] : [],
1974
+ ...(l = r.value) != null && l.attributeColumnVisible ? [
1975
+ {
1976
+ id: "tagging",
1977
+ accessorKey: "attributeTags",
1978
+ header: () => t("menu.product.table.columns.tagging"),
1979
+ enableSorting: !1,
1980
+ size: 140,
1981
+ cell: (s) => V(qe, {
1982
+ kind: "tagging",
1983
+ chips: s.row.original.attributeTags
1984
+ })
1985
+ }
1986
+ ] : [],
1987
+ {
1988
+ accessorKey: "orderFrom",
1989
+ header: () => t("menu.product.table.columns.order_from"),
1990
+ // The ONLY sortable column in the golden.
1991
+ enableSorting: !0,
1992
+ sortingFn: (s, d) => s.original.orderFromSortIndex - d.original.orderFromSortIndex,
1993
+ size: 140,
1994
+ cell: (s) => {
1995
+ const d = s.getValue();
1996
+ return d === null ? t("menu.catalog.empty_value") : V(
1997
+ re.FmChip,
1998
+ { compact: !0, class: "fm-typo-en-body-md-600 !px-4" },
1999
+ () => t(Ne[d])
2000
+ );
2001
+ }
2002
+ },
2003
+ {
2004
+ id: "actions",
2005
+ header: () => {
2006
+ var s;
2007
+ return V("div", { class: "w-full px-4 flex justify-end" }, [
2008
+ V(re.FmButton, {
2009
+ prependIcon: "edit",
2010
+ variant: fe.Tertiary,
2011
+ textColor: ye.NeutralGray400,
2012
+ disabled: ((s = r.value) == null ? void 0 : s.bulkEdit.state) !== "allowed",
2013
+ "aria-label": t("menu.product.table.bulk_edit.title"),
2014
+ onClick: Dt
2015
+ })
2016
+ ]);
2017
+ },
2018
+ size: 100,
2019
+ enableSorting: !1,
2020
+ meta: { textAlign: "right", headerClass: "py-4", cellClass: "pl-16" },
2021
+ cell: (s) => {
2022
+ const d = s.row.original, P = [
2023
+ V(re.FmButton, {
2024
+ icon: "overview",
2025
+ variant: "tertiary",
2026
+ textColor: "neutral-gray-400",
2027
+ "aria-label": t("menu.common.labels.a11y_labelled_name", {
2028
+ label: t("menu.product.overview.title"),
2029
+ name: d.name
2030
+ }),
2031
+ onClick: we(() => Bt(d), ["stop"])
2032
+ })
2033
+ ];
2034
+ return d.remove.state !== "hidden" && P.push(
2035
+ V(re.FmButton, {
2036
+ icon: "delete",
2037
+ variant: "tertiary",
2038
+ textColor: "neutral-gray-400",
2039
+ disabled: d.remove.state !== "allowed",
2040
+ title: d.remove.state === "disabled" ? h(d.remove.reason) : void 0,
2041
+ "aria-label": t("menu.common.labels.a11y_labelled_name", {
2042
+ label: t("menu.common.actions.remove"),
2043
+ name: d.name
2044
+ }),
2045
+ onClick: we(() => rt(d), ["stop"])
2046
+ })
2047
+ ), V("div", { class: "flex justify-end gap-4" }, P);
2048
+ }
2049
+ }
2050
+ ];
2051
+ }), Ht = b(() => [
2052
+ {
2053
+ accessorKey: "code",
2054
+ header: () => t("menu.product.table.columns.code"),
2055
+ enableSorting: !1,
2056
+ size: 100,
2057
+ cell: (e) => {
2058
+ var s;
2059
+ const l = e.row.original;
2060
+ return V(Ct, {
2061
+ modelValue: l.code,
2062
+ disabled: l.editCode.state !== "allowed",
2063
+ errorMessages: l.codeIssue ? [h(l.codeIssue)] : [],
2064
+ placeholder: ((s = l.inherited) == null ? void 0 : s.code) ?? "",
2065
+ "aria-label": t("menu.common.labels.a11y_labelled_name", {
2066
+ label: t("menu.product.table.columns.code"),
2067
+ name: l.committedName
2068
+ }),
2069
+ "onUpdate:modelValue": (d) => {
2070
+ var P;
2071
+ return (P = ce.value) == null ? void 0 : P.setCode(l.id, String(d ?? ""));
2072
+ }
2073
+ });
2074
+ }
2075
+ },
2076
+ {
2077
+ accessorKey: "name",
2078
+ header: () => t("menu.product.table.columns.name"),
2079
+ enableSorting: !1,
2080
+ size: 250,
2081
+ cell: (e) => {
2082
+ const l = e.row.original;
2083
+ return V("div", { class: "flex items-center gap-8" }, [
2084
+ V(Ct, {
2085
+ modelValue: l.name,
2086
+ disabled: l.editName.state !== "allowed",
2087
+ errorMessages: l.nameIssue ? [h(l.nameIssue)] : [],
2088
+ "aria-label": t("menu.common.labels.a11y_labelled_name", {
2089
+ label: t("menu.product.table.columns.name"),
2090
+ name: l.committedName
2091
+ }),
2092
+ "onUpdate:modelValue": (s) => {
2093
+ var d;
2094
+ return (d = ce.value) == null ? void 0 : d.setName(l.id, String(s ?? ""));
2095
+ }
2096
+ }),
2097
+ ...ut(l.translatedNames)
2098
+ ]);
2099
+ }
2100
+ },
2101
+ {
2102
+ accessorKey: "priceAmount",
2103
+ meta: { textAlign: "right" },
2104
+ header: () => {
2105
+ var e;
2106
+ return V(
2107
+ "div",
2108
+ { class: "w-full flex justify-end" },
2109
+ t("menu.product.table.columns.price", {
2110
+ currency: ((e = le.value) == null ? void 0 : e.currencySymbol) ?? ""
2111
+ })
2112
+ );
2113
+ },
2114
+ enableSorting: !1,
2115
+ size: 140,
2116
+ cell: (e) => {
2117
+ const l = e.row.original;
2118
+ return V(
2119
+ bl,
2120
+ {
2121
+ modelValue: l.priceAmount,
2122
+ commitOnInput: !0,
2123
+ inputmode: "decimal",
2124
+ disabled: l.editPrice.state !== "allowed",
2125
+ helperState: l.priceIssue ? "error" : "none",
2126
+ // The bulk editor's control is the same selling-price intent as
2127
+ // the item form. Keep its accessible name on that domain label;
2128
+ // the table header remains the localized currency column title.
2129
+ "aria-label": t("menu.common.labels.a11y_labelled_name", {
2130
+ label: t("menu.product.form.price.fields.selling_price.label"),
2131
+ name: l.committedName
2132
+ }),
2133
+ "onUpdate:modelValue": (s) => {
2134
+ var d;
2135
+ return (d = ce.value) == null ? void 0 : d.setPriceAmount(
2136
+ l.id,
2137
+ s === "" || s === null || s === void 0 ? null : Number(s)
2138
+ );
2139
+ }
2140
+ },
2141
+ l.priceIssue ? {
2142
+ "helper-text": () => [
2143
+ V("span", { class: "block" }, h(l.priceIssue)),
2144
+ V(
2145
+ "span",
2146
+ { class: "block" },
2147
+ t("menu.product.table.validation.price_min")
2148
+ )
2149
+ ]
2150
+ } : void 0
2151
+ );
2152
+ }
2153
+ },
2154
+ {
2155
+ accessorKey: "taxCode",
2156
+ meta: { textAlign: "right" },
2157
+ header: () => {
2158
+ var e;
2159
+ return V(
2160
+ "div",
2161
+ { class: "w-full flex justify-end" },
2162
+ ((e = le.value) == null ? void 0 : e.taxSystemCode) ?? ""
2163
+ );
2164
+ },
2165
+ enableSorting: !1,
2166
+ size: 120,
2167
+ cell: (e) => {
2168
+ var s, d;
2169
+ const l = e.row.original;
2170
+ return V(re.FmSelect, {
2171
+ items: (((s = le.value) == null ? void 0 : s.taxOptions) ?? []).map((P) => ({
2172
+ label: t("menu.product.table.tax_option_label", {
2173
+ name: P.name,
2174
+ percent: lt(P.percent)
2175
+ }),
2176
+ value: P.value
2177
+ })),
2178
+ modelValue: l.taxCode,
2179
+ disabled: l.editTax.state !== "allowed",
2180
+ shiftMenu: !0,
2181
+ "aria-label": t("menu.common.labels.a11y_labelled_name", {
2182
+ label: ((d = le.value) == null ? void 0 : d.taxSystemCode) ?? "",
2183
+ name: l.committedName
2184
+ }),
2185
+ "onUpdate:modelValue": (P) => {
2186
+ var de;
2187
+ return (de = ce.value) == null ? void 0 : de.setTaxCode(l.id, P ?? null);
2188
+ }
2189
+ });
2190
+ }
2191
+ },
2192
+ {
2193
+ accessorKey: "categoryIds",
2194
+ header: () => t("menu.product.table.columns.category"),
2195
+ enableSorting: !1,
2196
+ size: 140,
2197
+ cell: (e) => {
2198
+ var s;
2199
+ const l = e.row.original;
2200
+ return V(
2201
+ $l,
2202
+ {
2203
+ items: (((s = le.value) == null ? void 0 : s.categoryOptions) ?? []).map((d) => ({
2204
+ label: B(d),
2205
+ value: d.id
2206
+ })),
2207
+ hideChips: !0,
2208
+ modelValue: l.categoryIds.length ? [...l.categoryIds] : [""],
2209
+ disabled: l.editCategories.state !== "allowed",
2210
+ shiftMenu: !0,
2211
+ "aria-label": t("menu.common.labels.a11y_labelled_name", {
2212
+ label: t("menu.product.table.columns.category"),
2213
+ name: l.committedName
2214
+ }),
2215
+ "onUpdate:modelValue": (d) => {
2216
+ var P;
2217
+ return (P = ce.value) == null ? void 0 : P.setCategories(l.id, d ?? []);
2218
+ }
2219
+ },
2220
+ {
2221
+ default: () => V(
2222
+ "div",
2223
+ {
2224
+ class: [
2225
+ "break-all fm-typo-en-body-lg-400 line-clamp-1",
2226
+ l.editCategories.state === "allowed" ? "text-fm-color-typo-primary" : "text-fm-color-neutral-gray-200"
2227
+ ]
2228
+ },
2229
+ l.categoryIds.length ? l.categoryIds.map((d) => {
2230
+ var de;
2231
+ const P = (de = le.value) == null ? void 0 : de.categoryOptions.find(
2232
+ (me) => me.id === d
2233
+ );
2234
+ return P ? B(P) : "";
2235
+ }).join(t("menu.catalog.list_separator")) : t("menu.product.form.summary.fields.addon")
2236
+ )
2237
+ }
2238
+ );
2239
+ }
2240
+ },
2241
+ {
2242
+ accessorKey: "subcategoryIds",
2243
+ header: () => t("menu.product.table.columns.subcategory"),
2244
+ enableSorting: !1,
2245
+ size: 180,
2246
+ cell: (e) => {
2247
+ var s;
2248
+ const l = e.row.original;
2249
+ return V(
2250
+ re.FmSelect,
2251
+ {
2252
+ items: (((s = le.value) == null ? void 0 : s.subcategoryOptions) ?? []).map((d) => ({
2253
+ label: B(d),
2254
+ value: d.id
2255
+ })),
2256
+ multiselect: !0,
2257
+ hideChips: !0,
2258
+ keepSelectionOrder: !0,
2259
+ modelValue: [...l.subcategoryIds],
2260
+ disabled: l.editSubcategories.state !== "allowed",
2261
+ shiftMenu: !0,
2262
+ placeholder: t("menu.product.form.detail.path.placeholder"),
2263
+ "aria-label": t("menu.common.labels.a11y_labelled_name", {
2264
+ label: t("menu.product.table.columns.subcategory"),
2265
+ name: l.committedName
2266
+ }),
2267
+ "onUpdate:modelValue": (d) => {
2268
+ var P;
2269
+ return (P = ce.value) == null ? void 0 : P.setSubcategories(l.id, d ?? []);
2270
+ }
2271
+ },
2272
+ l.subcategoryIds.length ? {
2273
+ default: () => V(
2274
+ "div",
2275
+ {
2276
+ class: [
2277
+ "break-all fm-typo-en-body-lg-400 line-clamp-1",
2278
+ l.editSubcategories.state === "allowed" ? "text-fm-color-typo-primary" : "text-fm-color-neutral-gray-200"
2279
+ ]
2280
+ },
2281
+ l.subcategoryIds.map((d) => {
2282
+ var de;
2283
+ const P = (de = le.value) == null ? void 0 : de.subcategoryOptions.find(
2284
+ (me) => me.id === d
2285
+ );
2286
+ return P ? B(P) : "";
2287
+ }).filter(Boolean).join("/")
2288
+ )
2289
+ } : void 0
2290
+ );
2291
+ }
2292
+ },
2293
+ {
2294
+ accessorKey: "orderFrom",
2295
+ header: () => t("menu.product.table.columns.order_from"),
2296
+ enableSorting: !0,
2297
+ sortingFn: (e, l) => e.original.orderFromSortIndex - l.original.orderFromSortIndex,
2298
+ size: 140,
2299
+ cell: (e) => {
2300
+ var s;
2301
+ const l = e.row.original;
2302
+ return V(re.FmSelect, {
2303
+ items: (((s = le.value) == null ? void 0 : s.orderFromOptions) ?? []).map((d) => ({
2304
+ label: t(Ne[d]),
2305
+ value: d
2306
+ })),
2307
+ modelValue: l.orderFrom,
2308
+ disabled: l.editOrderFrom.state !== "allowed",
2309
+ shiftMenu: !0,
2310
+ "aria-label": t("menu.common.labels.a11y_labelled_name", {
2311
+ label: t("menu.product.table.columns.order_from"),
2312
+ name: l.committedName
2313
+ }),
2314
+ "onUpdate:modelValue": (d) => {
2315
+ var P;
2316
+ return (P = ce.value) == null ? void 0 : P.setOrderFrom(l.id, d ?? null);
2317
+ }
2318
+ });
2319
+ }
2320
+ }
2321
+ ]);
2322
+ function mt() {
2323
+ var e;
2324
+ ke == null || ke(), ke = null, (e = ve.value) == null || e.dispose(), ve.value = null, be == null || be.dispose(), be = null, Ee.value = { status: "loading" };
2325
+ }
2326
+ return ge(Ie, (e) => {
2327
+ e || mt();
2328
+ }), ge(Ke, (e) => {
2329
+ e || Qe();
2330
+ }), el(() => {
2331
+ ue(), mt(), Qe(), Ae();
2332
+ }), (e, l) => {
2333
+ var pt;
2334
+ const s = U("FmButton"), d = U("FmMenuItem"), P = U("FmBottomSheet"), de = U("FmMenu"), me = U("FmCircularProgress"), Wt = U("FmIcon"), Xt = U("FmSearch"), dt = U("FmTable"), Yt = U("FmChip");
2335
+ return o(), F(vl, {
2336
+ class: "h-[calc(100dvh-56px)]",
2337
+ heading: e.catalogPage ? ((pt = r.value) == null ? void 0 : pt.scope.catalogLabel) ?? a(t)("menu.common.labels.main") : a(t)("menu.products.title")
2338
+ }, {
2339
+ "prepend-heading": A(() => [
2340
+ Ze(e.$slots, "prepend-heading")
2341
+ ]),
2342
+ "append-heading": A(() => [
2343
+ u("div", lo, [
2344
+ e.catalogPage ? M("", !0) : (o(), y("div", ao, [
2345
+ u("div", oo, [
2346
+ u("p", no, O(a(L)(Pe.value)), 1)
2347
+ ])
2348
+ ])),
2349
+ u("div", so, [
2350
+ !D.value && !e.catalogPage && j.value ? (o(), F(rl, {
2351
+ key: 0,
2352
+ "can-open": j.value,
2353
+ "listen-for-message": !1
2354
+ }, {
2355
+ default: A(({ trigger: pe }) => [
2356
+ v(s, {
2357
+ "bg-color": a(ye).NeutralGray100,
2358
+ label: a(t)("menu.tree_editor.title"),
2359
+ "text-color": a(ye).TypoSecondary,
2360
+ variant: a(fe).Primary,
2361
+ onClick: pe
2362
+ }, null, 8, ["bg-color", "label", "text-color", "variant", "onClick"])
2363
+ ]),
2364
+ _: 1
2365
+ }, 8, ["can-open"])) : M("", !0),
2366
+ !D.value && !e.catalogPage && f.value ? (o(), y(Q, { key: 1 }, [
2367
+ v(s, {
2368
+ label: a(t)("menu.products.actions.export"),
2369
+ "bg-color": a(ye).NeutralGray100,
2370
+ "text-color": a(ye).TypoSecondary,
2371
+ variant: a(fe).Primary,
2372
+ onClick: ae
2373
+ }, null, 8, ["label", "bg-color", "text-color", "variant"]),
2374
+ v(s, {
2375
+ label: a(t)("menu.products.actions.import"),
2376
+ "bg-color": a(ye).NeutralGray100,
2377
+ "text-color": a(ye).TypoSecondary,
2378
+ variant: a(fe).Primary,
2379
+ onClick: p
2380
+ }, null, 8, ["label", "bg-color", "text-color", "variant"])
2381
+ ], 64)) : M("", !0),
2382
+ D.value && !e.catalogPage && f.value ? (o(), F(P, {
2383
+ key: 2,
2384
+ modelValue: N.value,
2385
+ "onUpdate:modelValue": l[2] || (l[2] = (pe) => N.value = pe),
2386
+ "dismiss-away": "",
2387
+ "no-header": "",
2388
+ "z-index": 1001
2389
+ }, {
2390
+ "bottom-sheet-button": A(() => [
2391
+ v(s, {
2392
+ "aria-label": a(t)("menu.products.actions.more"),
2393
+ icon: "more_vert",
2394
+ variant: "tertiary",
2395
+ onClick: l[0] || (l[0] = we((pe) => N.value = !N.value, ["stop"]))
2396
+ }, null, 8, ["aria-label"])
2397
+ ]),
2398
+ default: A(() => [
2399
+ u("div", {
2400
+ onClick: l[1] || (l[1] = (pe) => N.value = !1)
2401
+ }, [
2402
+ v(d, {
2403
+ label: a(t)("menu.products.actions.export"),
2404
+ onClick: ae
2405
+ }, null, 8, ["label"]),
2406
+ v(d, {
2407
+ label: a(t)("menu.products.actions.import"),
2408
+ onClick: p
2409
+ }, null, 8, ["label"])
2410
+ ])
2411
+ ]),
2412
+ _: 1
2413
+ }, 8, ["modelValue"])) : M("", !0),
2414
+ !D.value && !e.catalogPage && g.value.length ? (o(), F(de, {
2415
+ key: 3,
2416
+ "close-on-click": ""
2417
+ }, {
2418
+ "menu-button": A(() => [
2419
+ v(s, {
2420
+ label: a(t)("menu.products.actions.more"),
2421
+ "append-icon": "keyboard_arrow_down",
2422
+ "bg-color": a(ye).NeutralGray100,
2423
+ "text-color": a(ye).TypoSecondary,
2424
+ variant: a(fe).Primary
2425
+ }, null, 8, ["label", "bg-color", "text-color", "variant"])
2426
+ ]),
2427
+ default: A(() => [
2428
+ (o(!0), y(Q, null, ie(g.value, (pe) => (o(), F(d, {
2429
+ key: pe.id,
2430
+ class: "px-16 py-8",
2431
+ label: pe.label,
2432
+ onClick: pe.run
2433
+ }, null, 8, ["label", "onClick"]))), 128))
2434
+ ]),
2435
+ _: 1
2436
+ })) : M("", !0),
2437
+ u("div", {
2438
+ class: _e(I.value ? $o : "contents")
2439
+ }, [
2440
+ r.value && !Fe.value && r.value.create.state !== "hidden" ? (o(), F(s, {
2441
+ key: 0,
2442
+ disabled: r.value.create.state !== "allowed",
2443
+ label: a(t)("menu.products.actions.add"),
2444
+ "prepend-icon": "add",
2445
+ variant: $.value,
2446
+ onClick: nt
2447
+ }, null, 8, ["disabled", "label", "variant"])) : r.value && (!Fe.value || e.catalogPage) && r.value.link.state === "allowed" ? (o(), F(s, {
2448
+ key: 1,
2449
+ label: a(t)("menu.products.actions.link"),
2450
+ "prepend-icon": "link",
2451
+ variant: $.value,
2452
+ onClick: E
2453
+ }, null, 8, ["label", "variant"])) : r.value && (!Fe.value || e.catalogPage) && r.value.applyScheduler.state === "allowed" ? (o(), F(s, {
2454
+ key: 2,
2455
+ label: a(t)("menu.products.actions.apply_scheduler"),
2456
+ variant: $.value,
2457
+ onClick: E
2458
+ }, null, 8, ["label", "variant"])) : M("", !0)
2459
+ ], 2)
2460
+ ])
2461
+ ])
2462
+ ]),
2463
+ default: A(() => {
2464
+ var pe, vt, ft, bt, yt, gt, _t, ht, kt, xt;
2465
+ return [
2466
+ Ze(e.$slots, "navigation"),
2467
+ a(Z).status === "error" ? (o(), y("p", ro, O(a(h)(a(Z).error.message)), 1)) : a(Z).status === "unavailable" ? (o(), y("p", io, O(a(h)(a(Z).reason)), 1)) : a(Z).status === "loading" ? (o(), y("div", uo, [
2468
+ v(me, { size: "lg" })
2469
+ ])) : r.value ? (o(), y("div", co, [
2470
+ u("div", mo, [
2471
+ u("div", po, [
2472
+ v(It, {
2473
+ options: it.value,
2474
+ "model-value": ((pe = r.value) == null ? void 0 : pe.categoryFilterId) ?? null,
2475
+ "selected-values": ((vt = r.value) == null ? void 0 : vt.categoryFilterIds) ?? null,
2476
+ title: a(t)("menu.category.selector.title", {
2477
+ label: !((bt = (ft = r.value) == null ? void 0 : ft.categoryFilterIds) != null && bt.length) || r.value.categoryFilterIds.length === r.value.categoryOptions.length ? a(t)("menu.category.selector.all") : r.value.categoryFilterIds.length === 1 ? (yt = it.value.find(
2478
+ (k) => {
2479
+ var oe;
2480
+ return k.value === ((oe = r.value) == null ? void 0 : oe.categoryFilterId);
2481
+ }
2482
+ )) == null ? void 0 : yt.label : a(L)(r.value.categoryFilterIds.length)
2483
+ }),
2484
+ checkbox: "",
2485
+ "onUpdate:selectedValues": l[3] || (l[3] = (k) => e.sdk.item.filterByCategories(k))
2486
+ }, {
2487
+ default: A(() => {
2488
+ var k;
2489
+ return [
2490
+ (k = r.value) != null && k.attributeOptions.length ? (o(), y("button", {
2491
+ key: 0,
2492
+ type: "button",
2493
+ class: "pl-8 flex items-center justify-center border-l border-fm-color-neutral-gray-200",
2494
+ "aria-label": a(t)("menu.product.attributes.filter"),
2495
+ onClick: we(W, ["stop"])
2496
+ }, [
2497
+ v(Wt, {
2498
+ name: "filter_alt",
2499
+ outline: "",
2500
+ color: "neutral-gray-400",
2501
+ size: "sm"
2502
+ })
2503
+ ], 8, vo)) : M("", !0)
2504
+ ];
2505
+ }),
2506
+ _: 1
2507
+ }, 8, ["options", "model-value", "selected-values", "title"]),
2508
+ r.value && r.value.scope.schedulerSelector.state === "allowed" ? (o(), F(It, {
2509
+ key: 0,
2510
+ options: Gt.value,
2511
+ "model-value": r.value.scope.schedulerId,
2512
+ title: a(t)("menu.common.labels.scheduler_title", {
2513
+ label: r.value.scope.schedulerLabel ?? a(t)("menu.common.labels.summary")
2514
+ }),
2515
+ "onUpdate:modelValue": l[4] || (l[4] = (k) => {
2516
+ var oe;
2517
+ return e.sdk.item.selectScope({
2518
+ catalogId: ((oe = r.value) == null ? void 0 : oe.scope.catalogId) ?? null,
2519
+ schedulerId: k
2520
+ });
2521
+ })
2522
+ }, null, 8, ["options", "model-value", "title"])) : M("", !0),
2523
+ v(sl, {
2524
+ filter: (gt = r.value) == null ? void 0 : gt.restaurantFilter,
2525
+ onConfirm: l[5] || (l[5] = (k) => e.sdk.item.setRestaurantFilter(k))
2526
+ }, null, 8, ["filter"])
2527
+ ]),
2528
+ !Fe.value || (_t = r.value) != null && _t.emptyState.showSearch ? (o(), y("div", fo, [
2529
+ v(Xt, {
2530
+ autofocus: "",
2531
+ "model-value": ((ht = r.value) == null ? void 0 : ht.query) ?? "",
2532
+ placeholder: a(t)("menu.product.table.search.placeholder"),
2533
+ "aria-label": a(t)("menu.common.labels.search"),
2534
+ "onUpdate:modelValue": l[6] || (l[6] = (k) => m.sdk.item.search(String(k ?? ""), {
2535
+ formatPrice: (oe) => oe ? a(L)(oe.amount, {
2536
+ style: "currency",
2537
+ currency: oe.currency,
2538
+ currencyDisplay: "narrowSymbol"
2539
+ }) : "",
2540
+ labelOrderFrom: (oe) => a(t)(a(Ne)[oe])
2541
+ }))
2542
+ }, null, 8, ["model-value", "placeholder", "aria-label"])
2543
+ ])) : M("", !0)
2544
+ ]),
2545
+ Fe.value && r.value ? (o(), F(a(dl), {
2546
+ key: 0,
2547
+ title: a(h)(r.value.emptyState.title),
2548
+ subtitle: a(h)(r.value.emptyState.subtitle)
2549
+ }, {
2550
+ action: A(() => [
2551
+ u("div", bo, [
2552
+ r.value.create.state === "allowed" ? (o(), F(s, {
2553
+ key: 0,
2554
+ label: a(t)("menu.product.table.empty.actions.add"),
2555
+ "prepend-icon": "add",
2556
+ onClick: nt
2557
+ }, null, 8, ["label"])) : r.value.link.state === "allowed" ? (o(), F(s, {
2558
+ key: 1,
2559
+ label: a(t)("menu.common.actions.link_product"),
2560
+ "prepend-icon": "link",
2561
+ onClick: E
2562
+ }, null, 8, ["label"])) : r.value.applyScheduler.state === "allowed" ? (o(), F(s, {
2563
+ key: 2,
2564
+ label: a(t)("menu.common.actions.apply_product"),
2565
+ onClick: E
2566
+ }, null, 8, ["label"])) : M("", !0),
2567
+ r.value.emptyState.showImport && f.value ? (o(), F(s, {
2568
+ key: 3,
2569
+ label: a(t)("menu.product.table.empty.actions.import"),
2570
+ "prepend-icon": "download",
2571
+ variant: "secondary",
2572
+ disabled: !J.value,
2573
+ onClick: p
2574
+ }, null, 8, ["label", "disabled"])) : M("", !0)
2575
+ ])
2576
+ ]),
2577
+ _: 1
2578
+ }, 8, ["title", "subtitle"])) : M("", !0),
2579
+ G.value && r.value ? (o(), F(nl, {
2580
+ key: 1,
2581
+ ref_key: "filterControl",
2582
+ ref: w,
2583
+ attributes: r.value.attributeOptions,
2584
+ rule: r.value.attributeRule,
2585
+ "onUpdate:rule": l[7] || (l[7] = (k) => e.sdk.item.setAttributeFilter(k))
2586
+ }, null, 8, ["attributes", "rule"])) : M("", !0),
2587
+ Be.value.length > 0 ? (o(), y("div", yo, [
2588
+ u("p", go, O(a(t)("menu.product.table.selection.count", {
2589
+ count: Be.value.length
2590
+ })), 1),
2591
+ v(s, {
2592
+ label: a(t)("menu.product.table.selection.actions.deselect_all"),
2593
+ variant: "plain",
2594
+ onClick: We
2595
+ }, null, 8, ["label"]),
2596
+ Le.value.state !== "hidden" ? (o(), F(s, {
2597
+ key: 0,
2598
+ class: "ml-auto",
2599
+ label: a(t)("menu.product.table.selection.actions.remove"),
2600
+ "aria-label": a(t)("menu.product.table.selection.actions.remove"),
2601
+ "prepend-icon": "delete",
2602
+ variant: "secondary",
2603
+ "border-color": "system-error-300",
2604
+ "text-color": "system-error-300",
2605
+ disabled: Le.value.state !== "allowed",
2606
+ title: Le.value.state === "disabled" ? a(h)(Le.value.reason) : void 0,
2607
+ onClick: Kt
2608
+ }, null, 8, ["label", "aria-label", "disabled", "title"])) : M("", !0)
2609
+ ])) : M("", !0),
2610
+ !D.value && !Fe.value ? (o(), F(dt, {
2611
+ key: 3,
2612
+ modelValue: ze.value,
2613
+ "onUpdate:modelValue": l[8] || (l[8] = (k) => ze.value = k),
2614
+ class: "min-h-0 flex-1",
2615
+ "column-defs": qt.value,
2616
+ "row-data": Tt.value,
2617
+ "page-size": Ce.value.length,
2618
+ "get-row-id": (k) => k.id,
2619
+ selection: "multiple",
2620
+ virtual: Ce.value.length > Et,
2621
+ "virtual-row-height": 91,
2622
+ "hide-footer": "",
2623
+ "pin-header-row": "",
2624
+ "shrink-at": !1,
2625
+ onRowClick: l[9] || (l[9] = (k) => st(k.original))
2626
+ }, null, 8, ["modelValue", "column-defs", "row-data", "page-size", "get-row-id", "virtual"])) : Fe.value ? M("", !0) : (o(), y("div", _o, [
2627
+ (o(!0), y(Q, null, ie(Ce.value, (k) => {
2628
+ var oe, De;
2629
+ return o(), y("div", {
2630
+ key: k.id,
2631
+ class: "max-w-full py-12 px-16 flex items-center gap-16"
2632
+ }, [
2633
+ u("div", ho, [
2634
+ u("div", ko, [
2635
+ v(s, {
2636
+ label: k.name,
2637
+ variant: "plain",
2638
+ onClick: we((Ve) => st(k), ["stop"])
2639
+ }, null, 8, ["label", "onClick"]),
2640
+ k.orderFrom ? (o(), F(Yt, { key: 0 }, {
2641
+ default: A(() => [
2642
+ tl(O(a(t)(a(gl)[k.orderFrom])), 1)
2643
+ ]),
2644
+ _: 2
2645
+ }, 1024)) : M("", !0)
2646
+ ]),
2647
+ u("p", xo, O(tt((oe = k.price) == null ? void 0 : oe.amount, ((De = k.price) == null ? void 0 : De.currency) ?? et.value)), 1),
2648
+ u("p", wo, O(a(t)("menu.common.labels.a11y_labelled_name", {
2649
+ label: a(t)("menu.product.table.columns.code"),
2650
+ name: k.code || a(t)("menu.catalog.empty_value")
2651
+ })), 1),
2652
+ v(qe, {
2653
+ kind: "category",
2654
+ chips: ct(k).map((Ve) => ({
2655
+ key: Ve,
2656
+ label: Ve
2657
+ }))
2658
+ }, null, 8, ["chips"]),
2659
+ v(qe, {
2660
+ kind: "tagging",
2661
+ chips: k.attributeTags
2662
+ }, null, 8, ["chips"])
2663
+ ]),
2664
+ k.remove.state !== "hidden" ? (o(), F(s, {
2665
+ key: 0,
2666
+ disabled: k.remove.state !== "allowed",
2667
+ title: k.remove.state === "disabled" ? a(h)(k.remove.reason) : void 0,
2668
+ "prepend-icon": "delete",
2669
+ variant: "tertiary",
2670
+ "aria-label": a(t)("menu.common.labels.a11y_labelled_name", {
2671
+ label: a(t)("menu.common.actions.remove"),
2672
+ name: k.name
2673
+ }),
2674
+ onClick: we((Ve) => rt(k), ["stop"])
2675
+ }, null, 8, ["disabled", "title", "aria-label", "onClick"])) : M("", !0)
2676
+ ]);
2677
+ }), 128))
2678
+ ])),
2679
+ a(Z).status === "ready" && a(Z).stale ? (o(), y("div", Co, [
2680
+ v(me, { size: "lg" })
2681
+ ])) : M("", !0)
2682
+ ])) : M("", !0),
2683
+ v(_l, {
2684
+ modelValue: z.value,
2685
+ "onUpdate:modelValue": l[10] || (l[10] = (k) => z.value = k),
2686
+ catalogue: ee.value,
2687
+ "selected-product-ids": ((kt = r.value) == null ? void 0 : kt.availableItemIds) ?? [],
2688
+ "rules-session": Y.value,
2689
+ "selection-session": x.value,
2690
+ "rules-view": T.value.status === "ready" ? T.value.value : null,
2691
+ title: a(t)("menu.link_product.title"),
2692
+ onSubmit: he,
2693
+ onSubmitRules: ne
2694
+ }, null, 8, ["modelValue", "catalogue", "selected-product-ids", "rules-session", "selection-session", "rules-view", "title"]),
2695
+ v(yl, {
2696
+ open: Ie.value,
2697
+ "onUpdate:open": l[11] || (l[11] = (k) => Ie.value = k),
2698
+ sdk: e.sdk,
2699
+ session: ve.value,
2700
+ validation: a(at),
2701
+ view: Oe.value,
2702
+ onSelectScope: zt,
2703
+ onSubmit: Nt
2704
+ }, null, 8, ["open", "sdk", "session", "validation", "view"]),
2705
+ v(He, {
2706
+ show: Xe.value,
2707
+ title: a(t)("menu.product.table.bulk_edit.title"),
2708
+ "primary-action": {
2709
+ label: a(t)("menu.product.table.bulk_edit.actions.save"),
2710
+ disabled: ((xt = le.value) == null ? void 0 : xt.submit.state) !== "allowed"
2711
+ },
2712
+ "secondary-actions": [
2713
+ {
2714
+ label: a(t)("menu.product.table.bulk_edit.actions.reset_all"),
2715
+ click: () => {
2716
+ var k;
2717
+ return (k = ce.value) == null ? void 0 : k.reset();
2718
+ }
2719
+ },
2720
+ { label: a(t)("menu.common.actions.cancel"), click: ot }
2721
+ ],
2722
+ onOnPrimary: jt,
2723
+ onOnCancel: ot
2724
+ }, {
2725
+ default: A(() => {
2726
+ var k, oe, De;
2727
+ return [
2728
+ u("div", Fo, [
2729
+ v(dt, {
2730
+ class: "min-w-[1280px]",
2731
+ "column-defs": Ht.value,
2732
+ "row-data": [...((k = le.value) == null ? void 0 : k.rows) ?? []],
2733
+ "page-size": ((oe = le.value) == null ? void 0 : oe.rows.length) ?? 0,
2734
+ "get-row-id": (Ve) => Ve.id,
2735
+ virtual: (((De = le.value) == null ? void 0 : De.rows.length) ?? 0) > Et,
2736
+ "virtual-row-height": 48,
2737
+ "hide-footer": "",
2738
+ "pin-header-row": "",
2739
+ "shrink-at": !1
2740
+ }, null, 8, ["column-defs", "row-data", "page-size", "get-row-id", "virtual"])
2741
+ ])
2742
+ ];
2743
+ }),
2744
+ _: 1
2745
+ }, 8, ["show", "title", "primary-action", "secondary-actions"]),
2746
+ v(Bl, {
2747
+ modelValue: Ke.value,
2748
+ "onUpdate:modelValue": l[12] || (l[12] = (k) => Ke.value = k),
2749
+ state: Je.value
2750
+ }, null, 8, ["modelValue", "state"]),
2751
+ v(to, {
2752
+ ref_key: "importExport",
2753
+ ref: c,
2754
+ sdk: e.sdk
2755
+ }, null, 8, ["sdk"])
2756
+ ];
2757
+ }),
2758
+ _: 3
2759
+ }, 8, ["heading"]);
2760
+ };
2761
+ }
2762
+ });
2763
+ export {
2764
+ Xo as _
2765
+ };