@feedmepos/mf-connect 0.1.0-beta.3 → 0.1.0-beta.31

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