@feedmepos/mf-connect 0.1.9-prod → 0.1.10-prod

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 (90) hide show
  1. package/dist/{Analytic-8Ew7y5t9.js → Analytic-CpSbitWV.js} +24 -23
  2. package/dist/{App-3BVNH3r-.js → App-BPT8XzjX.js} +56 -51
  3. package/dist/{Broadcast-CrsPUhLT.js → Broadcast-CJHpiQeN.js} +8 -8
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DE300Y56.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DUPqWdIm.js} +7 -7
  5. package/dist/Card-Bvn36zqZ.js +895 -0
  6. package/dist/{Collections-djS9hLI8.js → Collections-Bq6OxsJC.js} +24 -29
  7. package/dist/{Credit-D4KEvIov.js → Credit-Dno_g7dW.js} +8 -8
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-BjM81fmS.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-cGbwORhw.js} +648 -1284
  9. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-aEWfdpCg.js → EffectSheet.vue_vue_type_style_index_0_lang-Ho7zwlbb.js} +19 -19
  10. package/dist/{Experience-2FPLO7aV.js → Experience-BC1qSIGO.js} +8 -8
  11. package/dist/{Game-e_UjVJgU.js → Game-C_CKGMBW.js} +8 -8
  12. package/dist/Index-BXFaWTfw.js +255 -0
  13. package/dist/{Marketing-B2hCjZ2r.js → Marketing-Ni0WAie5.js} +5 -5
  14. package/dist/{Member-D_ykRIBb.js → Member-djnisrK1.js} +4 -4
  15. package/dist/{MemberList-LmzzYxEn.js → MemberList-CclU-3B7.js} +193 -189
  16. package/dist/{MemberTransactions-B2vqlKaP.js → MemberTransactions-DVVsv3Ux.js} +1 -1
  17. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-DQ2ubF0N.js → MessageInput.vue_vue_type_script_setup_true_lang-khyDg1m4.js} +2 -2
  18. package/dist/Mission-Z5somdo_.js +273 -0
  19. package/dist/Overview-BvMVz3lQ.js +1074 -0
  20. package/dist/{Point-DFriwWWY.js → Point-DdPukiTg.js} +8 -8
  21. package/dist/{Promotion-Db3IEs2F.js → Promotion-DCqdIwjG.js} +9 -9
  22. package/dist/Record-CvMxXm1B.js +337 -0
  23. package/dist/Reward-CiJHGXfQ.js +441 -0
  24. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-CrGCBRmH.js +150 -0
  25. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-tnT6i0Jq.js +1638 -0
  26. package/dist/{Segment-CE8q9JV2.js → Segment-CQb3j-o0.js} +13 -13
  27. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-B7YqIU5D.js +181 -0
  28. package/dist/{Setting-Vcz1S27V.js → Setting-91cK3ssU.js} +31 -31
  29. package/dist/Store-B-uldUKt.js +1744 -0
  30. package/dist/{StoreRewards-Dt30AkWo.js → StoreRewards-dDNeFlA9.js} +12 -12
  31. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BVb1X0aq.js +1132 -0
  32. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-f59onlgt.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-Ds0WxGxr.js} +1 -1
  33. package/dist/{Tier-a6yXEtLd.js → Tier-_jMaLj3u.js} +19 -19
  34. package/dist/{Title-A3-2EI0w.js → Title-By7o67aT.js} +19 -19
  35. package/dist/{Transaction-DswABr2P.js → Transaction-BLpEgeI2.js} +2 -2
  36. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-Bf_nO9zH.js +130 -0
  37. package/dist/{Voucher-DEoVgZYa.js → Voucher-CG5tfibn.js} +11 -11
  38. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DpQUoXyQ.js +419 -0
  39. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-ccc1vxjS.js → ZodTextField.vue_vue_type_script_setup_true_lang-YwGR2En3.js} +1 -1
  40. package/dist/{app-C23GfQGq.js → app-DDmTqTb7.js} +1 -1
  41. package/dist/{app-C66C2KLW.js → app-vCqTQIeC.js} +424 -273
  42. package/dist/app.js +1 -1
  43. package/dist/{business-DNAVZOSH.js → business-Cz78KGF2.js} +1 -1
  44. package/dist/{campaign-Cv0HaUD1.js → campaign-BBd4o7F_.js} +2 -2
  45. package/dist/campaign.enum-CIhi0b-m.js +20 -0
  46. package/dist/campaign.fn-5silF1DK.js +758 -0
  47. package/dist/collectible.enum-cMIQ6ogq.js +19 -0
  48. package/dist/{collection.fn-Dxzr2oPt.js → collection.fn-BGc7Qeli.js} +2 -2
  49. package/dist/dto-i04OPJfW.js +2018 -0
  50. package/dist/{effect-CUuL8Tci.js → effect-D8UzkYRg.js} +1 -1
  51. package/dist/{email-addresses-Yt3s7i2b.js → email-addresses-u05o35hN.js} +1 -1
  52. package/dist/{export-CNg5YWMm.js → export-BEXuPYEd.js} +3 -3
  53. package/dist/{helper-DzmKNFue.js → helper-RptRJGv6.js} +1 -1
  54. package/dist/{index-Dnf7j71V.js → index-B8s-gucK.js} +9 -3
  55. package/dist/{index-B88e_9YI.js → index-BjHZUhiH.js} +1 -1
  56. package/dist/{index-O9lB54LY.js → index-Bpu2DYUc.js} +1348 -1342
  57. package/dist/{index-BK8X9RF6.js → index-C6-rCMhD.js} +3 -3
  58. package/dist/{index-D0obMrAS.js → index-Cq_ZIbRm.js} +173 -62
  59. package/dist/{index-CsCgQ8gt.js → index-DFAnoAe9.js} +1 -1
  60. package/dist/index-DbyJ6Nyn.js +54 -0
  61. package/dist/{index-yzH5eyKW.js → index-Dt6K2eG8.js} +1 -1
  62. package/dist/{index-9CXt2kbQ.js → index-DwzoqCt8.js} +293 -287
  63. package/dist/index-UfL5qRzR.js +1049 -0
  64. package/dist/index-g8EbRVnr.js +32 -0
  65. package/dist/{index-QuBsnXgx.js → index-hEE_ntHd.js} +1 -1
  66. package/dist/index-vh86FiIQ.js +10 -0
  67. package/dist/{index.esm2017-TpBElhnN.js → index.esm2017-BSzW_yaL.js} +1 -1
  68. package/dist/{loading-ChoC5E9d.js → loading-DjEdwdnj.js} +156 -153
  69. package/dist/{membership-CU-k0-Tf.js → membership-BL9Xs8lD.js} +52 -44
  70. package/dist/{money-DANmyTBj.js → money-D7lq0cx-.js} +1 -1
  71. package/dist/{number-DrocTWDD.js → number-BiDabTkI.js} +1 -1
  72. package/dist/objectid-CXf0jb1W.js +145 -0
  73. package/dist/reward-Cr8rbe5R.js +36 -0
  74. package/dist/{rule-builder-3YRdr18A.js → rule-builder-DPKFZ5UX.js} +1 -1
  75. package/dist/{rule-BQLmpER9.js → rule-vkYJij4h.js} +4 -3
  76. package/dist/{template-DOKU1QkY.js → template-Bep5Y5ch.js} +4 -4
  77. package/dist/trigger-fWhQ3bqv.js +144 -0
  78. package/dist/{usePagination-JGI7x0W7.js → usePagination-DSF5b4hM.js} +1 -1
  79. package/dist/user-9UiaP0xs.js +54 -0
  80. package/dist/{vue-i18n-Bch1JmhI.js → vue-i18n-BhiDOB1j.js} +232 -232
  81. package/package.json +2 -2
  82. package/dist/Card-DndggRLr.js +0 -1036
  83. package/dist/Mission-CsLdMq1M.js +0 -261
  84. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-_P2yImhi.js +0 -1804
  85. package/dist/Store-C8kT7JN5.js +0 -1531
  86. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Cc2F_06x.js +0 -1065
  87. package/dist/dto-CcrufW2j.js +0 -2770
  88. package/dist/index-C7745kXl.js +0 -755
  89. package/dist/index-CZ28ywyB.js +0 -298
  90. package/dist/user-Bm4KttFq.js +0 -37
@@ -0,0 +1,1638 @@
1
+ import { defineComponent as I, computed as q, resolveComponent as k, openBlock as n, createElementBlock as V, createElementVNode as x, createVNode as v, unref as e, createTextVNode as te, toDisplayString as H, withCtx as M, onMounted as z, createBlock as f, createCommentVNode as B, ref as A, Fragment as w, renderList as N, normalizeClass as _, watch as ie, resolveDynamicComponent as ae, onBeforeMount as re, isRef as me, createSlots as de } from "vue";
2
+ import { a as pe, C as ye, b as ce, c as ve, d as be } from "./index-Bpu2DYUc.js";
3
+ import { R as O, a as fe } from "./rule-builder-DPKFZ5UX.js";
4
+ import { a as ge, R as S, S as ke, C as P, W as Ee, T as ne, O as Ve } from "./rule-vkYJij4h.js";
5
+ import { p as Te } from "./loading-DjEdwdnj.js";
6
+ import { useDialog as le, useDialogChild as ue } from "@feedmepos/ui-library";
7
+ import { h as J } from "./moment-BWErdI6_.js";
8
+ import { z as Fe } from "./app-vCqTQIeC.js";
9
+ import { u as Q } from "./membership-BL9Xs8lD.js";
10
+ import { u as X } from "./business-Cz78KGF2.js";
11
+ import { _ as R } from "./CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js";
12
+ import { c as se } from "./object-qECH92oz.js";
13
+ import { Z } from "./zod-Bg2FbC-D.js";
14
+ import { _ as Se } from "./SelectItems.vue_vue_type_script_setup_true_lang-B7YqIU5D.js";
15
+ import "./index-DwzoqCt8.js";
16
+ import "./index-UfL5qRzR.js";
17
+ import "./index-Cq_ZIbRm.js";
18
+ import "./index-hEE_ntHd.js";
19
+ import "./index-DbyJ6Nyn.js";
20
+ const Ue = { class: "flex items-center justify-between" }, Ce = { class: "flex items-center gap-8 xs:flex-wrap" }, he = /* @__PURE__ */ x("div", { class: "h-[26px] border-l-2 rounded-md border-fm-color-neutral-gray-100" }, null, -1), xe = { class: "text-fm-color-primary line-clamp-1 text-ellipsis" }, Re = /* @__PURE__ */ I({
21
+ __name: "RuleEntry",
22
+ props: {
23
+ modelValue: {
24
+ type: Object,
25
+ required: !0
26
+ }
27
+ },
28
+ emits: ["edit", "remove"],
29
+ setup(o, { emit: h }) {
30
+ const p = o, u = q(() => {
31
+ const [i, m] = Object.entries(p.modelValue.conditions)[0];
32
+ return {
33
+ negated: p.modelValue.negated == !0,
34
+ property: p.modelValue.property,
35
+ operator: i,
36
+ equator: m
37
+ };
38
+ }), l = h, y = q(
39
+ () => ge(
40
+ u.value.property,
41
+ u.value.operator,
42
+ u.value.equator,
43
+ u.value.negated
44
+ )
45
+ );
46
+ async function t(i) {
47
+ i.stopPropagation(), await Te.remove("Are you sure you want to remove this rule?") && l("remove", p.modelValue);
48
+ }
49
+ return (i, m) => {
50
+ var g;
51
+ const c = k("FmChip"), d = k("FmTooltip"), b = k("FmIcon");
52
+ return n(), V("div", Ue, [
53
+ x("div", Ce, [
54
+ v(c, {
55
+ label: (g = e(pe).find((E) => E.property === p.modelValue.property)) == null ? void 0 : g.name,
56
+ class: "!text-fm-color-typo-info !bg-fm-color-system-info-100"
57
+ }, null, 8, ["label"]),
58
+ he,
59
+ x("div", {
60
+ onClick: m[0] || (m[0] = (E) => l("edit", p.modelValue)),
61
+ class: "inline-flex rounded-md items-center gap-4 justify-center h-[30px] px-8 py-4 text-fm-color-typo-primary !bg-transparent border-dashed border-2 fm-typo-en-body-md-600 cursor-pointer"
62
+ }, [
63
+ te(H(e(y)[0]) + " ", 1),
64
+ v(d, {
65
+ "z-index": 1e3,
66
+ content: e(y)[1]
67
+ }, {
68
+ default: M(() => [
69
+ x("div", xe, H(e(y)[1]), 1)
70
+ ]),
71
+ _: 1
72
+ }, 8, ["content"])
73
+ ])
74
+ ]),
75
+ v(b, {
76
+ name: "close",
77
+ size: "md",
78
+ class: "cursor-pointer hover:bg-neutral-300 rounded-lg",
79
+ onClick: t
80
+ })
81
+ ]);
82
+ };
83
+ }
84
+ });
85
+ Fe.enum([
86
+ "MIN_SPEND",
87
+ "SPECIFIC_DATE",
88
+ "SPECIFIC_TIMERANGE",
89
+ "WEEKLY",
90
+ "MONTHLY",
91
+ "BIRTHDAY",
92
+ "TIER",
93
+ "TITLE",
94
+ "CUSTOM"
95
+ ]);
96
+ const Ye = [
97
+ {
98
+ type: "MIN_SPEND",
99
+ name: "Minimum spend",
100
+ for: ["bill"],
101
+ rules: []
102
+ },
103
+ {
104
+ type: "SPECIFIC_DATE",
105
+ name: "Specific date",
106
+ for: ["trigger"],
107
+ rules: []
108
+ },
109
+ {
110
+ type: "SPECIFIC_TIMERANGE",
111
+ name: "Specific time range",
112
+ for: ["trigger"],
113
+ rules: []
114
+ },
115
+ {
116
+ type: "WEEKLY",
117
+ name: "Weekly",
118
+ for: ["trigger"],
119
+ rules: [
120
+ {
121
+ property: "trigger.date",
122
+ operator: "_rrule",
123
+ equator: "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
124
+ }
125
+ ]
126
+ },
127
+ {
128
+ type: "MONTHLY",
129
+ name: "Monthly",
130
+ for: ["trigger"],
131
+ rules: [
132
+ {
133
+ property: "trigger.date",
134
+ operator: "_rrule",
135
+ equator: "RRULE:FREQ=MONTHLY;WKST=SU;BYMONTHDAY=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
136
+ }
137
+ ]
138
+ },
139
+ {
140
+ type: "BIRTHDAY",
141
+ name: "Birthday",
142
+ for: ["user"],
143
+ rules: [
144
+ {
145
+ property: "user.birthday",
146
+ operator: "_isDay",
147
+ equator: {
148
+ op: "this",
149
+ unit: "day",
150
+ ignoreYear: !0
151
+ }
152
+ }
153
+ ]
154
+ },
155
+ {
156
+ type: "TIER",
157
+ name: "Specific tier",
158
+ for: ["user"],
159
+ rules: [
160
+ {
161
+ property: "user.tier",
162
+ operator: "_equal",
163
+ equator: 1
164
+ }
165
+ ]
166
+ },
167
+ {
168
+ type: "TITLE",
169
+ name: "Specific title",
170
+ for: ["user"],
171
+ rules: [
172
+ {
173
+ property: "user.titles",
174
+ operator: "_hasAny",
175
+ equator: []
176
+ }
177
+ ]
178
+ },
179
+ {
180
+ type: "CUSTOM",
181
+ name: "Weekday special",
182
+ for: ["trigger"],
183
+ rules: [
184
+ {
185
+ property: "trigger.date",
186
+ operator: "_rrule",
187
+ equator: "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=MO,TU,WE,TH,FR;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
188
+ }
189
+ ]
190
+ },
191
+ {
192
+ type: "CUSTOM",
193
+ name: "Weekend special",
194
+ for: ["trigger"],
195
+ rules: [
196
+ {
197
+ property: "trigger.date",
198
+ operator: "_rrule",
199
+ equator: "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU,SA;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
200
+ }
201
+ ]
202
+ },
203
+ {
204
+ type: "CUSTOM",
205
+ name: "Happy hour",
206
+ for: ["trigger"],
207
+ rules: [
208
+ {
209
+ property: "trigger.time",
210
+ operator: "_isBetweenTime",
211
+ equator: [
212
+ {
213
+ start: "21:00",
214
+ end: "23:59"
215
+ }
216
+ ]
217
+ }
218
+ ]
219
+ },
220
+ {
221
+ type: "CUSTOM",
222
+ name: "Mother's day special",
223
+ for: ["trigger"],
224
+ rules: [
225
+ {
226
+ property: "trigger.date",
227
+ operator: "_rrule",
228
+ equator: "RRULE:FREQ=YEARLY;WKST=SU;BYDAY=+2SU;BYMONTH=5;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
229
+ }
230
+ ]
231
+ },
232
+ {
233
+ type: "CUSTOM",
234
+ name: "Father's day special",
235
+ for: ["trigger"],
236
+ rules: [
237
+ {
238
+ property: "trigger.date",
239
+ operator: "_rrule",
240
+ equator: "RRULE:FREQ=YEARLY;WKST=SU;BYDAY=+3SU;BYMONTH=6;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
241
+ }
242
+ ]
243
+ },
244
+ {
245
+ type: "CUSTOM",
246
+ name: "Christmas",
247
+ for: ["trigger"],
248
+ rules: [
249
+ {
250
+ property: "trigger.date",
251
+ operator: "_rrule",
252
+ equator: "RRULE:FREQ=YEARLY;WKST=SU;BYMONTH=12;BYMONTHDAY=25;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
253
+ }
254
+ ]
255
+ },
256
+ {
257
+ type: "CUSTOM",
258
+ name: "Feedback rating",
259
+ for: ["feedback"],
260
+ rules: [
261
+ {
262
+ property: "feedback.rating",
263
+ operator: "_lessThanOrEqual",
264
+ equator: 5
265
+ }
266
+ ]
267
+ },
268
+ {
269
+ type: "CUSTOM",
270
+ name: "Custom",
271
+ for: ["trigger", "user", "bill", "feedback"],
272
+ rules: [
273
+ {
274
+ property: "trigger.date",
275
+ operator: "_isOnDate",
276
+ equator: J().format("YYYY-MM-DD")
277
+ }
278
+ ]
279
+ }
280
+ ], Oe = { class: "flex flex-nowrap gap-x-4 items-center" }, De = /* @__PURE__ */ I({
281
+ __name: "IsDayInput",
282
+ props: {
283
+ modelValue: {
284
+ type: Object
285
+ }
286
+ },
287
+ emits: ["update:model-value"],
288
+ setup(o, { emit: h }) {
289
+ const p = o, u = h;
290
+ z(() => {
291
+ p.modelValue || u("update:model-value", {
292
+ op: "before",
293
+ x: 1
294
+ });
295
+ });
296
+ function l(y) {
297
+ const t = se(
298
+ p.modelValue ?? {
299
+ op: "before",
300
+ x: 1
301
+ }
302
+ );
303
+ u("update:model-value", {
304
+ ...t,
305
+ ...y
306
+ });
307
+ }
308
+ return (y, t) => {
309
+ var m, c, d;
310
+ const i = k("FmStepperField");
311
+ return n(), V("div", Oe, [
312
+ v(i, {
313
+ class: "w-1/3",
314
+ "model-value": ((m = o.modelValue) == null ? void 0 : m.x) ?? null,
315
+ max: 365,
316
+ "show-steppers": !1,
317
+ "append-text": "days",
318
+ "onUpdate:modelValue": t[0] || (t[0] = (b) => l({ x: b }))
319
+ }, null, 8, ["model-value"]),
320
+ v(R, {
321
+ "model-value": ((c = o.modelValue) == null ? void 0 : c.op) ?? void 0,
322
+ items: [
323
+ { label: "before", value: "before" },
324
+ { label: "after", value: "after" }
325
+ ],
326
+ "onUpdate:modelValue": t[1] || (t[1] = (b) => l({ op: b }))
327
+ }, null, 8, ["model-value"]),
328
+ v(R, {
329
+ "model-value": ((d = o.modelValue) == null ? void 0 : d.ignoreYear) ?? !1,
330
+ items: [
331
+ { label: "same year", value: !1 },
332
+ { label: "ignore year", value: !0 }
333
+ ],
334
+ required: !0,
335
+ "onUpdate:modelValue": t[2] || (t[2] = (b) => l({ ignoreYear: b == !0 }))
336
+ }, null, 8, ["model-value"])
337
+ ]);
338
+ };
339
+ }
340
+ }), we = { class: "grid grid-cols-4 gap-x-4 items-center" }, Me = /* @__PURE__ */ I({
341
+ __name: "IsRangeInput",
342
+ props: {
343
+ modelValue: {
344
+ type: Object,
345
+ default: () => ({
346
+ op: "this",
347
+ unit: "day",
348
+ ignoreYear: !0
349
+ })
350
+ }
351
+ },
352
+ emits: ["update:model-value"],
353
+ setup(o, { emit: h }) {
354
+ const p = o, u = h;
355
+ z(() => {
356
+ p.modelValue || u("update:model-value", {
357
+ op: "this",
358
+ unit: "day",
359
+ ignoreYear: !0
360
+ });
361
+ });
362
+ const l = [
363
+ { label: "day", value: "day" },
364
+ { label: "week", value: "week" },
365
+ { label: "month", value: "month" },
366
+ { label: "quarter", value: "quarter" },
367
+ { label: "year", value: "year" }
368
+ ], y = [
369
+ {
370
+ label: "this",
371
+ value: "this"
372
+ },
373
+ {
374
+ label: "last",
375
+ value: "last"
376
+ },
377
+ {
378
+ label: "next",
379
+ value: "next"
380
+ }
381
+ ];
382
+ return (t, i) => {
383
+ var c, d, b, g, E;
384
+ const m = k("FmStepperField");
385
+ return n(), V("div", we, [
386
+ v(R, {
387
+ "model-value": (c = o.modelValue) == null ? void 0 : c.op,
388
+ label: "",
389
+ items: y,
390
+ required: !0,
391
+ "onUpdate:modelValue": i[0] || (i[0] = (s) => u("update:model-value", { op: s, unit: "day", ignoreYear: !1 }))
392
+ }, null, 8, ["model-value"]),
393
+ ((d = o.modelValue) == null ? void 0 : d.op) != "this" ? (n(), f(m, {
394
+ key: 0,
395
+ "model-value": ((b = o.modelValue) == null ? void 0 : b.x) || 0,
396
+ max: 365,
397
+ "show-steppers": !1,
398
+ "onUpdate:modelValue": i[1] || (i[1] = (s) => u("update:model-value", {
399
+ op: o.modelValue.op,
400
+ unit: o.modelValue.unit,
401
+ ignoreYear: o.modelValue.ignoreYear == !0,
402
+ x: s
403
+ }))
404
+ }, null, 8, ["model-value"])) : B("", !0),
405
+ v(R, {
406
+ "model-value": (g = o.modelValue) == null ? void 0 : g.unit,
407
+ label: "",
408
+ items: l,
409
+ required: !0,
410
+ "onUpdate:modelValue": i[2] || (i[2] = (s) => u("update:model-value", { ...p.modelValue, unit: s }))
411
+ }, null, 8, ["model-value"]),
412
+ v(R, {
413
+ label: "",
414
+ "model-value": (E = o.modelValue) == null ? void 0 : E.ignoreYear,
415
+ items: [
416
+ { label: "same", value: !1 },
417
+ { label: "ignore", value: !0 }
418
+ ],
419
+ required: !0,
420
+ "onUpdate:modelValue": i[3] || (i[3] = (s) => u("update:model-value", {
421
+ ...p.modelValue,
422
+ ignoreYear: s == !0
423
+ }))
424
+ }, null, 8, ["model-value"])
425
+ ]);
426
+ };
427
+ }
428
+ }), qe = { class: "space-y-8" }, Ie = { class: "text-fm-color-primary rounded-md border-dashed border-2 p-8" }, Be = {
429
+ key: 0,
430
+ class: "flex items-center gap-8"
431
+ }, $e = /* @__PURE__ */ x("div", null, "Repeat every", -1), Ne = /* @__PURE__ */ x("div", null, "Repeat on", -1), Ae = { class: "flex gap-4" }, Pe = {
432
+ key: 0,
433
+ class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
434
+ }, _e = ["onClick"], Le = {
435
+ key: 1,
436
+ class: "flex items-center gap-8"
437
+ }, He = { class: "flex gap-4 xs:gap-[2px]" }, We = /* @__PURE__ */ x("div", null, "Month", -1), je = { class: "grid grid-cols-6 gap-8" }, Ke = {
438
+ key: 0,
439
+ class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
440
+ }, Ge = ["onClick"], Qe = {
441
+ key: 1,
442
+ class: "grid grid-cols-2 items-center gap-8"
443
+ }, ze = { class: "flex gap-4" }, Ze = {
444
+ key: 4,
445
+ class: "flex items-center justify-end gap-8"
446
+ }, ee = /* @__PURE__ */ I({
447
+ __name: "RruleInput",
448
+ props: {
449
+ modelValue: {
450
+ type: String
451
+ },
452
+ startDate: {
453
+ type: Object
454
+ },
455
+ applyButton: {
456
+ type: Boolean
457
+ },
458
+ fixedFrequency: {
459
+ type: Boolean
460
+ }
461
+ },
462
+ emits: ["update:model-value", "cancel"],
463
+ setup(o, { emit: h }) {
464
+ const p = o, u = h, l = A(
465
+ p.modelValue ? S.fromString(p.modelValue) : new S({
466
+ dtstart: p.startDate,
467
+ freq: S.DAILY,
468
+ wkst: S.SU,
469
+ interval: 1,
470
+ byhour: 0,
471
+ byminute: 0,
472
+ bysecond: 0
473
+ })
474
+ );
475
+ function y(t) {
476
+ var i;
477
+ if ("freq" in t)
478
+ switch (t.freq) {
479
+ case S.WEEKLY:
480
+ l.value = new S({
481
+ dtstart: p.startDate,
482
+ freq: t.freq,
483
+ interval: 1,
484
+ byhour: 0,
485
+ byminute: 0,
486
+ bysecond: 0,
487
+ wkst: S.SU,
488
+ byweekday: [S.MO]
489
+ });
490
+ break;
491
+ case S.MONTHLY:
492
+ l.value = new S({
493
+ dtstart: p.startDate,
494
+ freq: t.freq,
495
+ interval: 1,
496
+ byhour: 0,
497
+ byminute: 0,
498
+ bysecond: 0,
499
+ bymonthday: [(/* @__PURE__ */ new Date()).getDate()],
500
+ wkst: S.SU
501
+ });
502
+ break;
503
+ case S.YEARLY:
504
+ l.value = new S({
505
+ dtstart: p.startDate,
506
+ freq: t.freq,
507
+ interval: 1,
508
+ byhour: 0,
509
+ byminute: 0,
510
+ bysecond: 0,
511
+ wkst: S.SU,
512
+ bymonth: [(/* @__PURE__ */ new Date()).getMonth() + 1],
513
+ bymonthday: [(/* @__PURE__ */ new Date()).getDate()]
514
+ });
515
+ break;
516
+ default:
517
+ l.value = new S({
518
+ dtstart: p.startDate,
519
+ freq: t.freq,
520
+ interval: 1,
521
+ byhour: 0,
522
+ byminute: 0,
523
+ bysecond: 0,
524
+ wkst: S.SU
525
+ });
526
+ }
527
+ t.interval && t.interval > 0 && (l.value = new S({
528
+ ...l.value.origOptions,
529
+ dtstart: p.startDate,
530
+ interval: t.interval
531
+ })), "byweekday" in t && t.byweekday && Array.isArray(t.byweekday) && t.byweekday.length > 0 && (l.value.options.bymonthday.length > 0 && l.value.options.freq == S.MONTHLY && (l.value.options.bymonthday = []), l.value = new S({
532
+ ...l.value.origOptions,
533
+ dtstart: p.startDate,
534
+ bymonthday: [],
535
+ byweekday: t.byweekday
536
+ })), "bysetpos" in t && t.bysetpos != null && (l.value = new S({
537
+ ...l.value.origOptions,
538
+ dtstart: p.startDate,
539
+ bymonthday: [],
540
+ bysetpos: t.bysetpos,
541
+ byweekday: ((i = l.value.options.byweekday) == null ? void 0 : i.length) > 0 ? l.value.options.byweekday : [6]
542
+ })), "bymonthday" in t && t.bymonthday && Array.isArray(t.bymonthday) && t.bymonthday.length > 0 && (l.value = new S({
543
+ ...l.value.origOptions,
544
+ dtstart: p.startDate,
545
+ bysetpos: [],
546
+ byweekday: [],
547
+ bymonthday: t.bymonthday
548
+ })), "bymonth" in t && t.bymonth && Array.isArray(t.bymonth) && t.bymonth.length > 0 && (l.value = new S({
549
+ ...l.value.origOptions,
550
+ dtstart: p.startDate,
551
+ bysetpos: [],
552
+ bymonth: t.bymonth
553
+ })), "bynweekday" in t && t.bynweekday && (l.value = new S({
554
+ ...l.value.origOptions,
555
+ dtstart: p.startDate,
556
+ bysetpos: [],
557
+ byweekday: new Ee(
558
+ t.bynweekday[0][0],
559
+ t.bynweekday[0][1]
560
+ )
561
+ })), p.applyButton || u("update:model-value", l.value.toString());
562
+ }
563
+ return z(() => {
564
+ p.modelValue || u(
565
+ "update:model-value",
566
+ new S({
567
+ dtstart: p.startDate,
568
+ freq: S.DAILY,
569
+ wkst: S.SU,
570
+ interval: 1,
571
+ byhour: 0,
572
+ byminute: 0,
573
+ bysecond: 0
574
+ }).toString()
575
+ );
576
+ }), (t, i) => {
577
+ var g, E, s;
578
+ const m = k("FmStepperField"), c = k("FmChip"), d = k("FmButtonGroup"), b = k("FmButton");
579
+ return n(), V("div", qe, [
580
+ x("div", Ie, H(e(ke)(e(l).options)), 1),
581
+ o.fixedFrequency ? B("", !0) : (n(), V("div", Be, [
582
+ $e,
583
+ v(m, {
584
+ class: "w-[100px]",
585
+ "model-value": e(l).options.interval,
586
+ "onUpdate:modelValue": i[0] || (i[0] = (a) => y({ interval: a > 0 ? a : e(l).options.interval })),
587
+ min: 1
588
+ }, null, 8, ["model-value"]),
589
+ v(R, {
590
+ class: "w-min",
591
+ items: e(P).frequencies,
592
+ "model-value": e(l).origOptions.freq,
593
+ "onUpdate:modelValue": i[1] || (i[1] = (a) => y({ freq: a }))
594
+ }, null, 8, ["items", "model-value"])
595
+ ])),
596
+ e(l).options.freq === e(S).WEEKLY ? (n(), V(w, { key: 1 }, [
597
+ Ne,
598
+ x("div", Ae, [
599
+ (n(!0), V(w, null, N(e(P).weekdays, (a) => {
600
+ var U;
601
+ return n(), f(c, {
602
+ class: _(["cursor-pointer", `${(U = e(l).options.byweekday) != null && U.includes(a.value) ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
603
+ label: a.label[0],
604
+ key: a.value,
605
+ compact: !0,
606
+ onClick: () => {
607
+ var C, D;
608
+ y({
609
+ byweekday: (C = e(l).options.byweekday) != null && C.includes(a.value) ? ((D = e(l).options.byweekday) == null ? void 0 : D.filter((F) => F !== a.value)) || [] : [...e(l).options.byweekday || [], a.value]
610
+ });
611
+ }
612
+ }, null, 8, ["class", "label", "onClick"]);
613
+ }), 128))
614
+ ])
615
+ ], 64)) : B("", !0),
616
+ e(l).options.freq == e(S).MONTHLY ? (n(), V(w, { key: 2 }, [
617
+ v(d, {
618
+ "model-value": e(l).options.bymonthday.length ? { label: "Each" } : { label: "On the" },
619
+ items: [
620
+ {
621
+ label: "Each"
622
+ },
623
+ {
624
+ label: "On the"
625
+ }
626
+ ],
627
+ "onUpdate:modelValue": i[2] || (i[2] = (a) => {
628
+ a.label == "Each" ? y({ bymonthday: [1] }) : y({ bysetpos: 1 });
629
+ })
630
+ }, null, 8, ["model-value"]),
631
+ e(l).options.bymonthday.length > 0 ? (n(), V("div", Pe, [
632
+ (n(!0), V(w, null, N(e(P).dates, (a) => (n(), V("div", {
633
+ key: a.value,
634
+ class: _(["cursor-pointer text-center outline-1 outline-fm-color-neutral-gray-100 outline", `${e(l).options.bymonthday.includes(a.value) ? "bg-fm-color-primary text-fm-color-typo-white outline-transparent" : "bg-transparent text-fm-color-typo-primary"} ${a.value == 31 ? "border-r" : ""}`]),
635
+ onClick: (U) => y({
636
+ bymonthday: e(l).options.bymonthday.includes(a.value) ? e(l).options.bymonthday.filter((C) => C !== a.value) : [...e(l).options.bymonthday, a.value]
637
+ })
638
+ }, H(a.value), 11, _e))), 128))
639
+ ])) : (n(), V("div", Le, [
640
+ v(R, {
641
+ items: e(P).ordinals,
642
+ "model-value": (g = e(l).options.bysetpos) == null ? void 0 : g[0],
643
+ "onUpdate:modelValue": i[3] || (i[3] = (a) => y({ bysetpos: a }))
644
+ }, null, 8, ["items", "model-value"]),
645
+ x("div", He, [
646
+ (n(!0), V(w, null, N(e(P).weekdays, (a) => {
647
+ var U;
648
+ return n(), f(c, {
649
+ class: _(["cursor-pointer", `${(U = e(l).options.byweekday) != null && U.includes(a.value) ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
650
+ label: a.label[0],
651
+ key: a.value,
652
+ compact: !0,
653
+ onClick: () => {
654
+ y({
655
+ byweekday: [a.value]
656
+ });
657
+ }
658
+ }, null, 8, ["class", "label", "onClick"]);
659
+ }), 128))
660
+ ])
661
+ ]))
662
+ ], 64)) : B("", !0),
663
+ e(l).options.freq == e(S).YEARLY ? (n(), V(w, { key: 3 }, [
664
+ We,
665
+ x("div", je, [
666
+ (n(!0), V(w, null, N(e(P).months, (a) => {
667
+ var U, C;
668
+ return n(), f(c, {
669
+ key: a.value,
670
+ class: _(["cursor-pointer", {
671
+ "bg-fm-color-primary text-white": (U = e(l).options.bymonth) == null ? void 0 : U.includes(
672
+ a.value
673
+ ),
674
+ "bg-fm-color-gray-200 text-fm-color-gray-800": !((C = e(l).options.bymonth) != null && C.includes(a.value))
675
+ }]),
676
+ label: a.shortName,
677
+ compact: !0,
678
+ onClick: (D) => y({
679
+ bymonth: (e(l).options.bymonth ?? []).includes(a.value) ? (e(l).options.bymonth ?? []).filter((F) => F !== a.value) : [...e(l).options.bymonth ?? [], a.value]
680
+ })
681
+ }, null, 8, ["class", "label", "onClick"]);
682
+ }), 128))
683
+ ]),
684
+ v(d, {
685
+ "model-value": e(l).options.bymonthday.length ? { label: "Each" } : { label: "On the" },
686
+ items: [
687
+ {
688
+ label: "Each"
689
+ },
690
+ {
691
+ label: "On the"
692
+ }
693
+ ],
694
+ "onUpdate:modelValue": i[4] || (i[4] = (a) => {
695
+ a.label == "Each" ? y({
696
+ bymonthday: [1],
697
+ bymonth: e(l).options.bymonth ?? [1]
698
+ }) : y({
699
+ byweekday: [e(S).SU.nth(1)],
700
+ bymonth: e(l).options.bymonth ?? [1]
701
+ });
702
+ })
703
+ }, null, 8, ["model-value"]),
704
+ e(l).options.bymonthday.length > 0 ? (n(), V("div", Ke, [
705
+ (n(!0), V(w, null, N(Array(31).fill(null).map((a, U) => U + 1), (a) => (n(), V("div", {
706
+ key: a,
707
+ class: _(["cursor-pointer text-center outline-1 outline-fm-color-neutral-gray-100 outline", `${e(l).options.bymonthday.includes(a) ? "bg-fm-color-primary text-fm-color-typo-white outline-transparent" : "bg-transparent text-fm-color-typo-primary"} ${a == 31 ? "border-r" : ""}`]),
708
+ onClick: (U) => y({
709
+ bymonthday: e(l).options.bymonthday.includes(a) ? e(l).options.bymonthday.filter((C) => C !== a) : [...e(l).options.bymonthday, a]
710
+ })
711
+ }, H(a), 11, Ge))), 128))
712
+ ])) : (n(), V("div", Qe, [
713
+ v(R, {
714
+ items: e(P).ordinals,
715
+ "model-value": (s = (E = e(l).options.bynweekday) == null ? void 0 : E[0]) == null ? void 0 : s[1],
716
+ "onUpdate:modelValue": i[5] || (i[5] = (a) => {
717
+ var U, C;
718
+ return y({
719
+ bynweekday: [[((C = (U = e(l).options.bynweekday) == null ? void 0 : U[0]) == null ? void 0 : C[0]) ?? 1, a]]
720
+ });
721
+ })
722
+ }, null, 8, ["items", "model-value"]),
723
+ x("div", ze, [
724
+ (n(!0), V(w, null, N(e(P).weekdays, (a) => {
725
+ var U, C;
726
+ return n(), f(c, {
727
+ class: _(["cursor-pointer", `${((C = (U = e(l).options.bynweekday) == null ? void 0 : U[0]) == null ? void 0 : C[0]) === a.value ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
728
+ label: a.label[0],
729
+ key: a.value,
730
+ compact: !0,
731
+ onClick: () => {
732
+ var D, F;
733
+ y({
734
+ bynweekday: [
735
+ [a.value, ((F = (D = e(l).options.bynweekday) == null ? void 0 : D[0]) == null ? void 0 : F[1]) ?? 1]
736
+ ]
737
+ });
738
+ }
739
+ }, null, 8, ["class", "label", "onClick"]);
740
+ }), 128))
741
+ ])
742
+ ]))
743
+ ], 64)) : B("", !0),
744
+ o.applyButton ? (n(), V("div", Ze, [
745
+ v(b, {
746
+ label: "Cancel",
747
+ variant: "tertiary",
748
+ onClick: i[6] || (i[6] = (a) => u("cancel"))
749
+ }),
750
+ v(b, {
751
+ label: "Apply",
752
+ onClick: i[7] || (i[7] = (a) => u("update:model-value", e(l).toString()))
753
+ })
754
+ ])) : B("", !0)
755
+ ]);
756
+ };
757
+ }
758
+ }), Je = { class: "grid grid-cols-4 gap-8 w-full flex-wrap py-16" }, Xe = /* @__PURE__ */ I({
759
+ __name: "IsInMonthInput",
760
+ props: {
761
+ modelValue: {
762
+ type: Object,
763
+ required: !0
764
+ }
765
+ },
766
+ emits: ["update:model-value"],
767
+ setup(o, { emit: h }) {
768
+ const p = o, u = h, l = J.months().map((y, t) => ({
769
+ name: y,
770
+ shortName: J().month(t).format("MMM"),
771
+ value: t
772
+ }));
773
+ return z(() => {
774
+ p.modelValue || u("update:model-value", []);
775
+ }), (y, t) => {
776
+ const i = k("FmChip");
777
+ return n(), V("div", Je, [
778
+ (n(!0), V(w, null, N(e(l), (m) => {
779
+ var c, d;
780
+ return n(), f(i, {
781
+ class: _(["cursor-pointer", {
782
+ "bg-fm-color-primary text-white": (c = o.modelValue) == null ? void 0 : c.includes(m.value),
783
+ "bg-fm-color-gray-200 text-fm-color-gray-800": !((d = o.modelValue) != null && d.includes(
784
+ m.value
785
+ ))
786
+ }]),
787
+ label: m.name,
788
+ key: m.value,
789
+ compact: !0,
790
+ onClick: (b) => u(
791
+ "update:model-value",
792
+ o.modelValue.includes(m.value) ? o.modelValue.filter((g) => g !== m.value) : [...o.modelValue, m.value]
793
+ )
794
+ }, null, 8, ["class", "label", "onClick"]);
795
+ }), 128))
796
+ ]);
797
+ };
798
+ }
799
+ }), et = /* @__PURE__ */ x("div", null, "Select Item", -1), tt = { class: "" }, lt = { class: "flex justify-end gap-8 w-full" }, ot = /* @__PURE__ */ I({
800
+ __name: "MenuDialog",
801
+ props: {
802
+ modelValue: { type: Boolean },
803
+ initialValue: {},
804
+ filterItems: { type: Function }
805
+ },
806
+ emits: ["update:model-value", "confirm"],
807
+ setup(o, { emit: h }) {
808
+ const p = o, u = A(), l = A(!1), y = h;
809
+ function t() {
810
+ var m;
811
+ (m = u.value) == null || m.onConfirm(), y("update:model-value", !1);
812
+ }
813
+ function i() {
814
+ y("update:model-value", !1);
815
+ }
816
+ return ie(
817
+ () => p.modelValue,
818
+ (m) => {
819
+ l.value = m;
820
+ }
821
+ ), z(() => {
822
+ l.value = p.modelValue;
823
+ }), (m, c) => {
824
+ const d = k("FmButton"), b = k("FmDialog");
825
+ return n(), f(b, {
826
+ "content-scrollable": !1,
827
+ contentClass: "pt-0",
828
+ modelValue: l.value,
829
+ "onUpdate:modelValue": c[0] || (c[0] = (g) => l.value = g),
830
+ title: "Select Items",
831
+ "close-button": !1
832
+ }, {
833
+ "dialog-header": M(() => [
834
+ et
835
+ ]),
836
+ "dialog-footer": M(() => [
837
+ x("div", lt, [
838
+ v(d, {
839
+ variant: "tertiary",
840
+ onClick: i,
841
+ label: "Cancel"
842
+ }),
843
+ v(d, {
844
+ variant: "primary",
845
+ onClick: t,
846
+ label: "Confirm"
847
+ })
848
+ ])
849
+ ]),
850
+ default: M(() => [
851
+ x("div", tt, [
852
+ v(Se, {
853
+ ref_key: "selectItemRef",
854
+ ref: u,
855
+ "initial-value": m.initialValue,
856
+ "filter-items": m.filterItems,
857
+ "on-complete": (g) => {
858
+ y("confirm", g), i();
859
+ }
860
+ }, null, 8, ["initial-value", "filter-items", "on-complete"])
861
+ ])
862
+ ]),
863
+ _: 1
864
+ }, 8, ["modelValue"]);
865
+ };
866
+ }
867
+ }), at = { id: "select-menu" }, nt = /* @__PURE__ */ I({
868
+ __name: "SelectMenu",
869
+ props: {
870
+ modelValue: {}
871
+ },
872
+ emits: ["update:model-value"],
873
+ setup(o, { emit: h }) {
874
+ const p = o, u = A(!1), l = q(() => {
875
+ var i;
876
+ return ((i = p.modelValue) == null ? void 0 : i.length) || 0;
877
+ }), y = h;
878
+ function t(i) {
879
+ y("update:model-value", i);
880
+ }
881
+ return (i, m) => {
882
+ const c = k("FmField");
883
+ return n(), V("div", at, [
884
+ v(c, {
885
+ class: "text-fm-color-typo-tertiary",
886
+ onClick: m[0] || (m[0] = (d) => u.value = !0)
887
+ }, {
888
+ default: M(() => [
889
+ te(H(l.value) + " item(s) selected ", 1)
890
+ ]),
891
+ _: 1
892
+ }),
893
+ v(ot, {
894
+ modelValue: u.value,
895
+ "onUpdate:modelValue": [
896
+ m[1] || (m[1] = (d) => u.value = d),
897
+ m[2] || (m[2] = (d) => u.value = d)
898
+ ],
899
+ "initial-value": i.modelValue,
900
+ onConfirm: t
901
+ }, null, 8, ["modelValue", "initial-value"])
902
+ ]);
903
+ };
904
+ }
905
+ }), rt = {
906
+ key: 19,
907
+ class: "fm-typo-en-body-lg-600"
908
+ }, ut = /* @__PURE__ */ I({
909
+ __name: "RuleEquator",
910
+ props: {
911
+ type: {
912
+ type: String,
913
+ required: !0
914
+ },
915
+ operator: {
916
+ type: String,
917
+ required: !0
918
+ },
919
+ modelValue: {
920
+ type: Object
921
+ }
922
+ },
923
+ emits: ["update:model-value"],
924
+ setup(o, { emit: h }) {
925
+ const p = o, u = h, l = q(() => {
926
+ const y = ye[p.operator].safeParse(p.modelValue);
927
+ return y.success ? [] : y.error.errors;
928
+ });
929
+ return (y, t) => {
930
+ var s, a, U, C, D, F;
931
+ const i = k("FmTextField"), m = k("FmStepperField"), c = k("FmSimpleDatePicker"), d = k("FmSimpleDateRangePicker"), b = k("FmTimeRangePicker"), g = k("FmTimePicker"), E = k("FmHelperText");
932
+ return n(), V("div", {
933
+ class: _({ "pb-4": e(l).length })
934
+ }, [
935
+ o.type === "text" ? (n(), f(i, {
936
+ key: 0,
937
+ "model-value": o.modelValue,
938
+ "onUpdate:modelValue": t[0] || (t[0] = (r) => u("update:model-value", r))
939
+ }, null, 8, ["model-value"])) : o.type === "number" ? (n(), f(m, {
940
+ key: 1,
941
+ "model-value": o.modelValue,
942
+ "onUpdate:modelValue": t[1] || (t[1] = (r) => u("update:model-value", r))
943
+ }, null, 8, ["model-value"])) : o.operator == "_isDay" ? (n(), f(ae(De), {
944
+ key: 2,
945
+ "model-value": o.modelValue,
946
+ "onUpdate:modelValue": t[2] || (t[2] = (r) => u("update:model-value", r))
947
+ }, null, 8, ["model-value"])) : o.operator == "_isRange" ? (n(), f(ae(Me), {
948
+ key: 3,
949
+ "model-value": o.modelValue,
950
+ "onUpdate:modelValue": t[3] || (t[3] = (r) => u("update:model-value", r))
951
+ }, null, 8, ["model-value"])) : o.operator == "_isOnDate" ? (n(), f(c, {
952
+ key: 4,
953
+ "model-value": o.modelValue,
954
+ "onUpdate:modelValue": t[4] || (t[4] = (r) => u("update:model-value", r))
955
+ }, null, 8, ["model-value"])) : o.operator == "_isBetween" ? (n(), f(d, {
956
+ key: 5,
957
+ "model-value": {
958
+ startDate: (s = o.modelValue) == null ? void 0 : s.start,
959
+ endDate: (a = o.modelValue) == null ? void 0 : a.end
960
+ },
961
+ "onUpdate:modelValue": t[5] || (t[5] = (r) => {
962
+ u("update:model-value", {
963
+ start: r.startDate,
964
+ end: r.endDate
965
+ });
966
+ })
967
+ }, null, 8, ["model-value"])) : o.operator == "_isInMonth" ? (n(), f(Xe, {
968
+ key: 6,
969
+ "model-value": o.modelValue,
970
+ "onUpdate:modelValue": t[6] || (t[6] = (r) => u("update:model-value", r))
971
+ }, null, 8, ["model-value"])) : o.operator == "_rrule" ? (n(), f(ee, {
972
+ key: 7,
973
+ "model-value": o.modelValue,
974
+ "onUpdate:modelValue": t[7] || (t[7] = (r) => u("update:model-value", r))
975
+ }, null, 8, ["model-value"])) : o.operator == "_isBetweenTime" ? (n(), f(b, {
976
+ key: 8,
977
+ "disable-time-check": !0,
978
+ "model-value": [(C = (U = o.modelValue) == null ? void 0 : U[0]) == null ? void 0 : C.start, (F = (D = o.modelValue) == null ? void 0 : D[0]) == null ? void 0 : F.end],
979
+ "onUpdate:modelValue": t[8] || (t[8] = (r) => u("update:model-value", [
980
+ {
981
+ start: r[0],
982
+ end: r[1]
983
+ }
984
+ ]))
985
+ }, null, 8, ["model-value"])) : o.operator == "_isOnTime" ? (n(), f(g, {
986
+ key: 9,
987
+ "model-value": o.modelValue,
988
+ "onUpdate:modelValue": t[9] || (t[9] = (r) => u("update:model-value", r))
989
+ }, null, 8, ["model-value"])) : o.type == "tier" ? (n(), f(R, {
990
+ key: 10,
991
+ items: (e(Q)().sortedTiers ?? []).map((r, $) => ({
992
+ label: `Tier ${$ + 1} - ${r.name}`,
993
+ value: $ + 1
994
+ })),
995
+ "model-value": o.modelValue,
996
+ "onUpdate:modelValue": t[10] || (t[10] = (r) => u("update:model-value", r))
997
+ }, null, 8, ["items", "model-value"])) : o.type == "boolean" ? (n(), f(R, {
998
+ key: 11,
999
+ multiselect: !0,
1000
+ items: [
1001
+ { label: "true", value: !0 },
1002
+ { label: "false", value: !1 }
1003
+ ],
1004
+ "model-value": o.modelValue ?? [],
1005
+ "onUpdate:modelValue": t[11] || (t[11] = (r) => u("update:model-value", r))
1006
+ }, null, 8, ["model-value"])) : o.type == "exist" ? (n(), f(R, {
1007
+ key: 12,
1008
+ items: [
1009
+ { label: "true", value: "true" },
1010
+ { label: "false", value: "false" }
1011
+ ],
1012
+ "model-value": o.modelValue ?? [],
1013
+ "onUpdate:modelValue": t[12] || (t[12] = (r) => u("update:model-value", r))
1014
+ }, null, 8, ["model-value"])) : o.type == "gender" ? (n(), f(R, {
1015
+ key: 13,
1016
+ multiselect: !0,
1017
+ items: [
1018
+ { label: "Male", value: "MALE" },
1019
+ { label: "Female", value: "FEMALE" }
1020
+ ],
1021
+ "model-value": o.modelValue ?? [],
1022
+ "onUpdate:modelValue": t[13] || (t[13] = (r) => u("update:model-value", r))
1023
+ }, null, 8, ["model-value"])) : o.type == "collectible" ? (n(), f(R, {
1024
+ key: 14,
1025
+ multiselect: !0,
1026
+ items: [],
1027
+ "model-value": o.modelValue ?? [],
1028
+ "onUpdate:modelValue": t[14] || (t[14] = (r) => u("update:model-value", r))
1029
+ }, null, 8, ["model-value"])) : o.type == "segment" ? (n(), f(R, {
1030
+ key: 15,
1031
+ multiselect: !0,
1032
+ items: e(Q)().segmentOptions,
1033
+ "model-value": o.modelValue ?? [],
1034
+ "onUpdate:modelValue": t[15] || (t[15] = (r) => u("update:model-value", r)),
1035
+ label: "Select segment(s) to match"
1036
+ }, null, 8, ["items", "model-value"])) : o.type == "title" ? (n(), f(R, {
1037
+ key: 16,
1038
+ multiselect: !0,
1039
+ items: (e(Q)().sortedTitles ?? []).map((r) => ({
1040
+ label: r.name,
1041
+ value: r._id
1042
+ })),
1043
+ "model-value": o.modelValue ?? [],
1044
+ "onUpdate:modelValue": t[16] || (t[16] = (r) => u("update:model-value", r))
1045
+ }, null, 8, ["items", "model-value"])) : o.type == "product" ? (n(), f(nt, {
1046
+ key: 17,
1047
+ "model-value": o.modelValue,
1048
+ "onUpdate:modelValue": t[17] || (t[17] = (r) => u("update:model-value", r))
1049
+ }, null, 8, ["model-value"])) : o.type == "location" ? (n(), f(R, {
1050
+ key: 18,
1051
+ multiselect: !0,
1052
+ items: e(X)().locations.map((r) => ({
1053
+ label: r.name,
1054
+ value: r._id
1055
+ })),
1056
+ "model-value": o.modelValue ?? [],
1057
+ "onUpdate:modelValue": t[18] || (t[18] = (r) => u("update:model-value", r))
1058
+ }, null, 8, ["items", "model-value"])) : (n(), V("div", rt, "Rule Not implemented")),
1059
+ v(E, {
1060
+ class: "items-end",
1061
+ state: e(Z).helperState(e(l), ""),
1062
+ text: e(Z).helperText(e(l), "")
1063
+ }, null, 8, ["state", "text"])
1064
+ ], 2);
1065
+ };
1066
+ }
1067
+ }), st = { class: "space-y-4" }, it = /* @__PURE__ */ x("div", { class: "fm-typo-en-body-lg-400" }, "Property", -1), mt = /* @__PURE__ */ x("div", { class: "fm-typo-en-body-lg-400" }, "Check to perform", -1), dt = { class: "flex items-center gap-8" }, pt = /* @__PURE__ */ x("div", { class: "fm-typo-en-body-lg-400" }, "Criteria", -1), yt = { class: "flex items-center justify-end gap-8 pt-16 w-full" }, ct = /* @__PURE__ */ I({
1068
+ __name: "CustomRuleDialog",
1069
+ props: {
1070
+ triggerType: {
1071
+ type: String,
1072
+ required: !0
1073
+ },
1074
+ includeOnly: {
1075
+ type: String
1076
+ },
1077
+ modelValue: {
1078
+ type: Object,
1079
+ default: () => {
1080
+ }
1081
+ }
1082
+ },
1083
+ setup(o) {
1084
+ const h = le(), p = Q(), { emitData: u, emitAction: l } = ue(), y = o, t = q(
1085
+ () => ce(y.triggerType, y.includeOnly)
1086
+ ), i = (F) => ne[t.value.find((r) => r.property === F).type], m = q(() => {
1087
+ if (!g.value) return [];
1088
+ const F = t.value.find(
1089
+ (r) => r.property === g.value.property
1090
+ );
1091
+ return F ? ne[F.type].map((r) => ({
1092
+ label: Ve[r].name,
1093
+ value: r
1094
+ })) : [];
1095
+ }), c = ve, d = q(() => {
1096
+ const F = c.safeParse(g.value);
1097
+ return F.success ? [] : F.error.errors;
1098
+ }), b = A(!1), g = A(
1099
+ se(y.modelValue) ?? O.constructEntry(
1100
+ t.value[0].property,
1101
+ i(t.value[0].property)[0],
1102
+ null
1103
+ )
1104
+ ), E = q(() => {
1105
+ var L;
1106
+ const { property: F, negated: r, conditions: $ } = g.value, W = Object.keys($ || {})[0], j = Object.values($ || {})[0];
1107
+ return {
1108
+ property: F,
1109
+ negated: r == !0,
1110
+ type: (L = t.value.find((K) => K.property === F)) == null ? void 0 : L.type,
1111
+ operator: W,
1112
+ equator: j
1113
+ };
1114
+ });
1115
+ function s(F) {
1116
+ g.value = O.constructEntry(
1117
+ F,
1118
+ i(F)[0],
1119
+ null
1120
+ );
1121
+ }
1122
+ function a(F) {
1123
+ g.value = { ...g.value, negated: F == !0 };
1124
+ }
1125
+ function U(F) {
1126
+ g.value = {
1127
+ ...g.value,
1128
+ conditions: { [F]: null }
1129
+ };
1130
+ }
1131
+ function C(F) {
1132
+ g.value.conditions = {
1133
+ [E.value.operator]: F
1134
+ };
1135
+ }
1136
+ function D() {
1137
+ u(g.value), l("primary"), h.close();
1138
+ }
1139
+ return re(async () => {
1140
+ await p.readMembership();
1141
+ }), (F, r) => {
1142
+ const $ = k("FmIcon"), W = k("FmField"), j = k("FmPill"), L = k("FmMenuItem"), K = k("FmMenu"), G = k("FmButton");
1143
+ return n(), V("div", st, [
1144
+ it,
1145
+ v(K, {
1146
+ shift: !0,
1147
+ placement: "top-start",
1148
+ modelValue: e(b),
1149
+ "onUpdate:modelValue": r[0] || (r[0] = (Y) => me(b) ? b.value = Y : null),
1150
+ onMenuChanged: r[1] || (r[1] = (Y) => b.value = Y)
1151
+ }, {
1152
+ "menu-button": M(() => [
1153
+ v(W, null, {
1154
+ append: M(() => [
1155
+ v($, {
1156
+ name: e(b) ? "expand_less" : "expand_more"
1157
+ }, null, 8, ["name"])
1158
+ ]),
1159
+ default: M(() => {
1160
+ var Y;
1161
+ return [
1162
+ te(H((Y = e(t).find((T) => T.property == e(g).property)) == null ? void 0 : Y.name) + " ", 1)
1163
+ ];
1164
+ }),
1165
+ _: 1
1166
+ })
1167
+ ]),
1168
+ default: M(() => [
1169
+ (n(!0), V(w, null, N(e(t), (Y) => (n(), f(L, {
1170
+ key: Y.property,
1171
+ "model-value": e(g).property == Y.property,
1172
+ label: Y.name,
1173
+ disabled: Y.premium && !e(X)().isPremium,
1174
+ onClick: (T) => Y.premium && !e(X)().isPremium ? null : s(Y.property)
1175
+ }, de({ _: 2 }, [
1176
+ Y.premium ? {
1177
+ name: "append",
1178
+ fn: M(() => [
1179
+ v(j, { variant: "premium" })
1180
+ ]),
1181
+ key: "0"
1182
+ } : void 0
1183
+ ]), 1032, ["model-value", "label", "disabled", "onClick"]))), 128))
1184
+ ]),
1185
+ _: 1
1186
+ }, 8, ["modelValue"]),
1187
+ mt,
1188
+ x("div", dt, [
1189
+ v(R, {
1190
+ class: "w-1/4",
1191
+ items: [
1192
+ { label: "is", value: !1 },
1193
+ { label: "is not", value: !0 }
1194
+ ],
1195
+ "model-value": e(g).negated ?? !1,
1196
+ "onUpdate:modelValue": a
1197
+ }, null, 8, ["model-value"]),
1198
+ v(R, {
1199
+ class: "flex-1",
1200
+ items: e(m),
1201
+ "model-value": e(E).operator,
1202
+ "onUpdate:modelValue": U
1203
+ }, null, 8, ["items", "model-value"])
1204
+ ]),
1205
+ x("div", null, [
1206
+ pt,
1207
+ e(E).type ? (n(), f(ut, {
1208
+ key: 0,
1209
+ type: e(E).type,
1210
+ operator: e(E).operator,
1211
+ "model-value": e(E).equator,
1212
+ "onUpdate:modelValue": C
1213
+ }, null, 8, ["type", "operator", "model-value"])) : B("", !0)
1214
+ ]),
1215
+ x("div", yt, [
1216
+ v(G, {
1217
+ onClick: r[2] || (r[2] = (Y) => e(h).close()),
1218
+ label: "Cancel",
1219
+ variant: "tertiary"
1220
+ }),
1221
+ v(G, {
1222
+ onClick: r[3] || (r[3] = (Y) => D()),
1223
+ disabled: e(d).length > 0,
1224
+ label: "Save"
1225
+ }, null, 8, ["disabled"])
1226
+ ])
1227
+ ]);
1228
+ };
1229
+ }
1230
+ }), vt = { class: "flex flex-col gap-8" }, bt = { class: "grid grid-cols-2 items-center" }, ft = { class: "flex items-center gap-8" }, gt = { class: "pt-16 flex items-center self-end gap-8" }, kt = /* @__PURE__ */ I({
1231
+ __name: "PresetRuleDialog",
1232
+ props: {
1233
+ preset: {
1234
+ type: String,
1235
+ required: !0
1236
+ },
1237
+ modelValue: {
1238
+ type: Object
1239
+ }
1240
+ },
1241
+ setup(o) {
1242
+ const h = le(), { emitData: p, emitAction: u } = ue(), l = Q(), y = o;
1243
+ function t() {
1244
+ const { operator: E, equator: s } = c.value;
1245
+ switch (y.preset) {
1246
+ case "MIN_SPEND":
1247
+ case "SPECIFIC_DATE":
1248
+ case "SPECIFIC_TIMERANGE":
1249
+ case "WEEKLY":
1250
+ case "MONTHLY":
1251
+ case "BIRTHDAY":
1252
+ case "TIER":
1253
+ return `Applies to ${l.sortedTiers.filter((U, C) => E == "_equal" ? C + 1 == s : E == "_moreThanOrEqual" ? C + 1 >= s : C + 1 <= s).map((U) => U.name).join(", ")}`;
1254
+ }
1255
+ }
1256
+ function i() {
1257
+ var E, s;
1258
+ switch (y.preset) {
1259
+ case "MIN_SPEND":
1260
+ return O.constructEntry("bill.amount", "_moreThanOrEqual", 0);
1261
+ case "SPECIFIC_DATE":
1262
+ return O.constructEntry("trigger.date", "_isOnDate", "");
1263
+ case "SPECIFIC_TIMERANGE":
1264
+ return O.constructEntry("trigger.time", "_isBetweenTime", [
1265
+ { start: "00:00", end: "23:59" }
1266
+ ]);
1267
+ case "WEEKLY":
1268
+ return O.constructEntry(
1269
+ "trigger.date",
1270
+ "_rrule",
1271
+ "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1272
+ );
1273
+ case "MONTHLY":
1274
+ return O.constructEntry(
1275
+ "trigger.date",
1276
+ "_rrule",
1277
+ "RRULE:FREQ=MONTHLY;WKST=SU;BYMONTHDAY=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1278
+ );
1279
+ case "BIRTHDAY":
1280
+ return O.constructEntry("user.birthday", "_isDay", {
1281
+ op: "after",
1282
+ x: 1,
1283
+ ignoreYear: !0
1284
+ });
1285
+ case "TIER":
1286
+ return O.constructEntry("user.tier", "_equal", 1);
1287
+ case "TITLE":
1288
+ return O.constructEntry("user.titles", "_hasAny", [
1289
+ (s = (E = l.sortedTitles) == null ? void 0 : E[0]) == null ? void 0 : s._id
1290
+ ]);
1291
+ case "CUSTOM":
1292
+ throw new Error("Not implemented");
1293
+ }
1294
+ }
1295
+ const m = A(i()), c = q(() => {
1296
+ const E = O.simplify(m.value);
1297
+ return {
1298
+ ...E,
1299
+ equator: E.equator
1300
+ };
1301
+ });
1302
+ function d(E, s) {
1303
+ const a = c.value;
1304
+ m.value = O.constructEntry(
1305
+ a.property,
1306
+ s ?? a.operator,
1307
+ E,
1308
+ m.value.name
1309
+ );
1310
+ }
1311
+ function b() {
1312
+ p(m.value), u("primary"), h.close();
1313
+ }
1314
+ const g = q(() => {
1315
+ const E = be.safeParse(m.value);
1316
+ return E.success ? [] : E.error.errors;
1317
+ });
1318
+ return re(async () => {
1319
+ await l.readMembership();
1320
+ }), (E, s) => {
1321
+ var j, L, K, G, Y;
1322
+ const a = k("FmStepperField"), U = k("FmDatePicker"), C = k("FmTimeRangePicker"), D = k("FmRadio"), F = k("FmSelect"), r = k("FmRadioGroup"), $ = k("FmHelperText"), W = k("FmButton");
1323
+ return n(), V("div", vt, [
1324
+ o.preset == "MIN_SPEND" ? (n(), f(a, {
1325
+ key: 0,
1326
+ label: "Minimum spend",
1327
+ "model-value": e(c).equator,
1328
+ "onUpdate:modelValue": s[0] || (s[0] = (T) => d(T))
1329
+ }, null, 8, ["model-value"])) : o.preset == "SPECIFIC_DATE" ? (n(), f(U, {
1330
+ key: 1,
1331
+ label: "Specific Date",
1332
+ "model-value": e(c).equator,
1333
+ "onUpdate:modelValue": s[1] || (s[1] = (T) => d(T))
1334
+ }, null, 8, ["model-value"])) : o.preset == "SPECIFIC_TIMERANGE" ? (n(), f(C, {
1335
+ key: 2,
1336
+ label: "Time is between",
1337
+ "disable-time-check": !0,
1338
+ "model-value": [(L = (j = e(c).equator) == null ? void 0 : j[0]) == null ? void 0 : L.start, (G = (K = e(c).equator) == null ? void 0 : K[0]) == null ? void 0 : G.end],
1339
+ "onUpdate:modelValue": s[2] || (s[2] = (T) => d([
1340
+ {
1341
+ start: T[0],
1342
+ end: T[1]
1343
+ }
1344
+ ]))
1345
+ }, null, 8, ["model-value"])) : o.preset == "WEEKLY" ? (n(), f(ee, {
1346
+ key: 3,
1347
+ label: "Weekly",
1348
+ "fixed-frequency": !0,
1349
+ "model-value": e(c).equator,
1350
+ "onUpdate:modelValue": s[3] || (s[3] = (T) => d(T))
1351
+ }, null, 8, ["model-value"])) : o.preset == "MONTHLY" ? (n(), f(ee, {
1352
+ key: 4,
1353
+ label: "Weekly",
1354
+ "fixed-frequency": !0,
1355
+ "model-value": e(c).equator,
1356
+ "onUpdate:modelValue": s[4] || (s[4] = (T) => d(T))
1357
+ }, null, 8, ["model-value"])) : o.preset == "BIRTHDAY" ? (n(), V(w, { key: 5 }, [
1358
+ x("div", bt, [
1359
+ v(D, {
1360
+ label: "N days before birthday",
1361
+ value: "_isDay",
1362
+ "model-value": e(c).operator,
1363
+ "onUpdate:modelValue": s[5] || (s[5] = () => {
1364
+ d(
1365
+ {
1366
+ op: "after",
1367
+ x: 1,
1368
+ ignoreYear: !0
1369
+ },
1370
+ "_isDay"
1371
+ );
1372
+ })
1373
+ }, null, 8, ["model-value"]),
1374
+ x("div", ft, [
1375
+ v(D, {
1376
+ label: "Is in this",
1377
+ value: "_isRange",
1378
+ "model-value": e(c).operator,
1379
+ "onUpdate:modelValue": s[6] || (s[6] = () => {
1380
+ d(
1381
+ {
1382
+ op: "this",
1383
+ unit: "day",
1384
+ ignoreYear: !0
1385
+ },
1386
+ "_isRange"
1387
+ );
1388
+ })
1389
+ }, null, 8, ["model-value"]),
1390
+ e(c).operator == "_isRange" ? (n(), f(F, {
1391
+ key: 0,
1392
+ items: ["day", "week", "month"].map((T) => ({ label: T, value: T })),
1393
+ "model-value": e(c).equator.unit,
1394
+ "onUpdate:modelValue": s[7] || (s[7] = (T) => d(
1395
+ {
1396
+ op: "this",
1397
+ unit: T,
1398
+ ignoreYear: !0
1399
+ },
1400
+ "_isRange"
1401
+ ))
1402
+ }, null, 8, ["items", "model-value"])) : B("", !0)
1403
+ ])
1404
+ ]),
1405
+ e(c).operator == "_isDay" ? (n(), f(a, {
1406
+ key: 0,
1407
+ label: "Days before birthday",
1408
+ "show-steppers": !1,
1409
+ "model-value": e(c).equator.x,
1410
+ "onUpdate:modelValue": s[8] || (s[8] = (T) => d({
1411
+ op: "after",
1412
+ x: T,
1413
+ ignoreYear: !0
1414
+ }))
1415
+ }, null, 8, ["model-value"])) : B("", !0)
1416
+ ], 64)) : o.preset == "TIER" ? (n(), V(w, { key: 6 }, [
1417
+ v(r, {
1418
+ inline: !0,
1419
+ "model-value": e(c).operator,
1420
+ "onUpdate:modelValue": s[9] || (s[9] = (T) => d(e(c).equator, T))
1421
+ }, {
1422
+ default: M(() => [
1423
+ v(D, {
1424
+ value: "_moreThanOrEqual",
1425
+ label: "At least"
1426
+ }),
1427
+ v(D, {
1428
+ value: "_equal",
1429
+ label: "Equal"
1430
+ }),
1431
+ v(D, {
1432
+ value: "_lessThanOrEqual",
1433
+ label: "At most"
1434
+ })
1435
+ ]),
1436
+ _: 1
1437
+ }, 8, ["model-value"]),
1438
+ v(R, {
1439
+ items: (e(l).sortedTiers ?? []).map((T, oe) => ({
1440
+ label: `Tier ${oe + 1} - ${T.name}`,
1441
+ value: oe + 1
1442
+ })),
1443
+ "model-value": e(c).equator,
1444
+ "onUpdate:modelValue": s[10] || (s[10] = (T) => d(T))
1445
+ }, null, 8, ["items", "model-value"]),
1446
+ v($, {
1447
+ text: t()
1448
+ }, null, 8, ["text"])
1449
+ ], 64)) : o.preset == "TITLE" ? (n(), f(R, {
1450
+ key: 7,
1451
+ label: "User has title",
1452
+ items: (e(l).sortedTitles ?? []).map((T) => ({
1453
+ label: T.name,
1454
+ value: T._id
1455
+ })),
1456
+ "model-value": (Y = e(c).equator) == null ? void 0 : Y[0],
1457
+ "onUpdate:modelValue": s[11] || (s[11] = (T) => d([T]))
1458
+ }, null, 8, ["items", "model-value"])) : B("", !0),
1459
+ v($, {
1460
+ class: "mt-[-8px]",
1461
+ text: e(Z).helperText(e(g), ""),
1462
+ state: e(Z).helperState(e(g), "")
1463
+ }, null, 8, ["text", "state"]),
1464
+ x("div", gt, [
1465
+ v(W, {
1466
+ onClick: s[12] || (s[12] = (T) => e(h).close()),
1467
+ label: "Cancel",
1468
+ variant: "tertiary"
1469
+ }),
1470
+ v(W, {
1471
+ onClick: s[13] || (s[13] = (T) => b()),
1472
+ disabled: e(g).length > 0,
1473
+ label: "Save"
1474
+ }, null, 8, ["disabled"])
1475
+ ])
1476
+ ]);
1477
+ };
1478
+ }
1479
+ }), Et = /* @__PURE__ */ I({
1480
+ __name: "RuleConfigurator",
1481
+ props: {
1482
+ triggerType: {
1483
+ type: String,
1484
+ required: !0
1485
+ },
1486
+ includeOnly: {
1487
+ type: String
1488
+ },
1489
+ modelValue: {
1490
+ type: Object,
1491
+ default: () => {
1492
+ }
1493
+ }
1494
+ },
1495
+ emits: ["update:model-value"],
1496
+ setup(o, { expose: h, emit: p }) {
1497
+ const u = o, l = p, y = le(), t = A();
1498
+ function i(d) {
1499
+ y.open({
1500
+ title: d.name,
1501
+ closeButton: !1,
1502
+ dismissAway: !1,
1503
+ contentComponent: kt,
1504
+ contentComponentProps: {
1505
+ preset: d.type,
1506
+ modelValue: u.modelValue
1507
+ }
1508
+ }).onPrimary((b) => l("update:model-value", b));
1509
+ }
1510
+ function m(d) {
1511
+ y.open({
1512
+ title: "Edit rule",
1513
+ closeButton: !1,
1514
+ dismissAway: !1,
1515
+ contentComponent: ct,
1516
+ contentComponentProps: {
1517
+ triggerType: u.triggerType,
1518
+ includeOnly: u.includeOnly,
1519
+ modelValue: d
1520
+ }
1521
+ }).onPrimary((b) => l("update:model-value", b));
1522
+ }
1523
+ function c(d) {
1524
+ if (d.type == "CUSTOM") {
1525
+ const [b] = d.rules;
1526
+ return m(
1527
+ O.constructEntry(b.property, b.operator, b.equator)
1528
+ );
1529
+ }
1530
+ return i(d);
1531
+ }
1532
+ return h({
1533
+ showCustomDialog: m
1534
+ }), (d, b) => {
1535
+ const g = k("FmButton"), E = k("FmMenuItem"), s = k("FmMenu");
1536
+ return n(), f(s, {
1537
+ shift: !0,
1538
+ placement: "top-start"
1539
+ }, {
1540
+ "menu-button": M(() => [
1541
+ v(g, {
1542
+ label: "Add condition",
1543
+ icon: "add",
1544
+ class: "text-fm-color-primary border-fm-color-primary",
1545
+ "icon-color": "primary",
1546
+ variant: "secondary"
1547
+ })
1548
+ ]),
1549
+ default: M(() => [
1550
+ (n(!0), V(w, null, N(e(Ye).filter(
1551
+ (a) => !o.includeOnly || a.for.includes(o.includeOnly)
1552
+ ), (a) => (n(), f(E, {
1553
+ key: a.name,
1554
+ "model-value": a.name == e(t),
1555
+ label: a.name,
1556
+ onClick: (U) => c(a)
1557
+ }, null, 8, ["model-value", "label", "onClick"]))), 128))
1558
+ ]),
1559
+ _: 1
1560
+ });
1561
+ };
1562
+ }
1563
+ }), Vt = /* @__PURE__ */ x("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " When ", -1), Pt = /* @__PURE__ */ I({
1564
+ __name: "RuleGroup",
1565
+ props: {
1566
+ triggerType: {
1567
+ type: String,
1568
+ required: !0
1569
+ },
1570
+ includeOnly: {
1571
+ type: String
1572
+ },
1573
+ modelValue: {
1574
+ type: Object
1575
+ }
1576
+ },
1577
+ emits: ["update:model-value"],
1578
+ setup(o, { emit: h }) {
1579
+ const p = o, u = h, l = q(
1580
+ () => p.modelValue ?? O.scaffoldGroup()
1581
+ ), y = q(() => O.getLogic(l.value)), t = A();
1582
+ return (i, m) => {
1583
+ const c = k("FmButtonGroup"), d = k("FmCard");
1584
+ return n(), f(d, { variant: "outlined" }, {
1585
+ default: M(() => [
1586
+ v(d, { class: "border-l-4 border-fm-color-primary p-16 space-y-16" }, {
1587
+ default: M(() => [
1588
+ Vt,
1589
+ v(Et, {
1590
+ ref_key: "configuratorRef",
1591
+ ref: t,
1592
+ "include-only": o.includeOnly,
1593
+ "trigger-type": o.triggerType,
1594
+ "onUpdate:modelValue": m[0] || (m[0] = (b) => u("update:model-value", e(O).setRuleToGroup(e(l), b)))
1595
+ }, null, 8, ["include-only", "trigger-type"]),
1596
+ (n(!0), V(w, null, N(e(l).rules, (b, g) => {
1597
+ var E;
1598
+ return n(), V(w, null, [
1599
+ e(fe)(b) ? (n(), f(Re, {
1600
+ "model-value": b,
1601
+ key: g,
1602
+ onEdit: (E = e(t)) == null ? void 0 : E.showCustomDialog,
1603
+ onRemove: m[1] || (m[1] = (s) => {
1604
+ u(
1605
+ "update:model-value",
1606
+ e(O).removeEntry(e(l), s.name)
1607
+ );
1608
+ })
1609
+ }, null, 8, ["model-value", "onEdit"])) : B("", !0),
1610
+ v(c, {
1611
+ class: "w-[200px]",
1612
+ disabled: Object.keys(e(l).rules).length < 2,
1613
+ items: [{ label: "And" }, { label: "Or" }],
1614
+ "model-value": e(y) === "&&" ? { label: "And" } : { label: "Or" },
1615
+ "onUpdate:modelValue": m[2] || (m[2] = (s) => u(
1616
+ "update:model-value",
1617
+ e(O).setRuleToGroup(
1618
+ e(l),
1619
+ [],
1620
+ s.label === "And" ? "&&" : "||"
1621
+ )
1622
+ ))
1623
+ }, null, 8, ["disabled", "model-value"])
1624
+ ], 64);
1625
+ }), 256))
1626
+ ]),
1627
+ _: 1
1628
+ })
1629
+ ]),
1630
+ _: 1
1631
+ });
1632
+ };
1633
+ }
1634
+ });
1635
+ export {
1636
+ Pt as _,
1637
+ ee as a
1638
+ };