@feedmepos/mf-connect 0.1.46-prod → 0.1.48-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 (105) hide show
  1. package/dist/{Analytic--PTYdTCz.js → Analytic-DrjBaKmx.js} +113 -113
  2. package/dist/{App-CCFCux3P.js → App-eIaytGsZ.js} +632 -622
  3. package/dist/{Bin-D3mLTCYx.js → Bin-CVp0eFwl.js} +9 -9
  4. package/dist/{Broadcast-17Aiufxx.js → Broadcast-DBgBT6yz.js} +40 -40
  5. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CMVquBaq.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CugJWeBo.js} +18 -18
  6. package/dist/{Card-Bx26e5ll.js → Card-DkP6oJVn.js} +239 -239
  7. package/dist/{Collections-B_lm_p0s.js → Collections-DYb_aeTW.js} +31 -31
  8. package/dist/{Credit-Bfdh01Hf.js → Credit-WVv_PL5D.js} +74 -74
  9. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-DWNvRorl.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-Dt9c2kvf.js} +756 -753
  10. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-CkYlghNU.js → EffectSheet.vue_vue_type_style_index_0_lang-DT3y4k1C.js} +96 -96
  11. package/dist/{Experience-DScp4H4M.js → Experience-BdH44wBG.js} +41 -41
  12. package/dist/{Game-Cn2BXwaA.js → Game-C7jxRESY.js} +31 -31
  13. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-D1KQpDGg.js +144 -0
  14. package/dist/{Index-BATr5dcp.js → Index-DYr1p4sh.js} +54 -54
  15. package/dist/{Marketing-B6lhSaKk.js → Marketing-Djl27fez.js} +24 -24
  16. package/dist/{Member-Cr_Ehw_n.js → Member-CWXedfTG.js} +63 -63
  17. package/dist/MemberList-C2TvGi22.js +1606 -0
  18. package/dist/MemberOverview-wL_ailso.js +58 -0
  19. package/dist/{MemberTransactions-YlC-iE41.js → MemberTransactions-BSUocGg9.js} +1 -1
  20. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-nTBRadZx.js → MessageInput.vue_vue_type_script_setup_true_lang-D8xPA6jM.js} +2287 -2221
  21. package/dist/{Mission-Bddme86f.js → Mission-BVx9Cqi5.js} +20 -20
  22. package/dist/{Overview-BGOM1IKg.js → Overview-DyXF9zfB.js} +337 -337
  23. package/dist/{Point-vcnTW6lY.js → Point-ovkgTwZO.js} +41 -41
  24. package/dist/{Promotion-DuCvytdc.js → Promotion-B0Q6GItP.js} +42 -42
  25. package/dist/{Queue-Cuw7WTP_.js → Queue-BAWG1Hh-.js} +12 -12
  26. package/dist/{Record-Dc6BPAGi.js → Record-CTp80g4A.js} +10 -10
  27. package/dist/{Reward-8MFxn8we.js → Reward-_Jow1lJ7.js} +173 -173
  28. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-8k-usg9S.js → RewardGroup.vue_vue_type_script_setup_true_lang-BV8xCejA.js} +11 -11
  29. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DkDAuGY0.js +1763 -0
  30. package/dist/Segment-CsdJ1SjK.js +882 -0
  31. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-B2LYvXlN.js → SelectItems.vue_vue_type_script_setup_true_lang-DH3oIm2t.js} +14 -14
  32. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-CaFLnq7P.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-DvVrjpxR.js} +11 -11
  33. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-DLAqn-0P.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-D5gV89Xk.js} +3 -3
  34. package/dist/Setting-BZRA50LO.js +1936 -0
  35. package/dist/{Store-DdBnVwnq.js → Store-CFnCN_7-.js} +238 -238
  36. package/dist/StoreRewards-B_McpBz-.js +423 -0
  37. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-BPPoaGqc.js → StoreTransactions.vue_vue_type_script_setup_true_lang-vL0vr-Xn.js} +185 -185
  38. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-D0ae_2E5.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-C1ZlLdme.js} +1 -1
  39. package/dist/{Tier-BpQ8DXK4.js → Tier-CCYFu6kJ.js} +106 -106
  40. package/dist/{Title-D6jghz1v.js → Title-7Mg-Ml4z.js} +95 -95
  41. package/dist/{Transaction-BQWs-6G7.js → Transaction-BqZrbpZi.js} +2 -2
  42. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-C2dJuE64.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-C6ZwPUD4.js} +6 -6
  43. package/dist/{Voucher-DnL_66X2.js → Voucher-Yty_7SuS.js} +36 -36
  44. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-Bt12t3gB.js +419 -0
  45. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-yj2c4i_u.js → ZodTextField.vue_vue_type_script_setup_true_lang-C3NHrEIl.js} +1 -1
  46. package/dist/{app-Cemiie6P.js → app-2EJP4psh.js} +31 -31
  47. package/dist/app-Dzon--6x.js +57962 -0
  48. package/dist/app.js +1 -1
  49. package/dist/{business-BTJVFnrW.js → business-BehG4fR2.js} +1 -1
  50. package/dist/{campaign-XX6bwpYj.js → campaign-BpaiTG4f.js} +10 -10
  51. package/dist/{campaign-C34w0eci.js → campaign-CAcP56Sz.js} +2 -2
  52. package/dist/{campaign.enum-CTMwHgAV.js → campaign.enum-BWjI8Hop.js} +1 -1
  53. package/dist/{campaign.fn-nJl0vZum.js → campaign.fn-PVdB1-V1.js} +123 -123
  54. package/dist/{collectible.enum-DpJV0kLI.js → collectible.enum-BYmuqayi.js} +1 -1
  55. package/dist/{collection.fn-D5beOWlp.js → collection.fn-CbH8hbWW.js} +2 -2
  56. package/dist/{dto-CCxjvwZe.js → dto-Dd3Oc4QO.js} +4 -4
  57. package/dist/{effect-B9ryfTOn.js → effect-DvEQNEl0.js} +1 -1
  58. package/dist/{email-addresses-Bn80jSud.js → email-addresses-C-9JrAi8.js} +1 -1
  59. package/dist/{export-CLB408ho.js → export-RWE9Cn-d.js} +4 -4
  60. package/dist/{helper-DgoAVTVe.js → helper-Bl6LdWED.js} +1 -1
  61. package/dist/{index-D90Ba87K.js → index-1bU9cLqV.js} +1 -1
  62. package/dist/{index-DsgbkezN.js → index-BCQMVr1J.js} +1 -1
  63. package/dist/{index-Djq2lySj.js → index-Bgnrbk5x.js} +1 -1
  64. package/dist/{index-Blmkh0Ui.js → index-Bjf5Z2QE.js} +4 -4
  65. package/dist/{index-DUtQaOO2.js → index-CFW9ogow.js} +1 -1
  66. package/dist/{index-t_4aIo1w.js → index-CfgczUMX.js} +2 -2
  67. package/dist/{index-FMcRNPk_.js → index-CzCqc7ph.js} +1 -1
  68. package/dist/{index-B9wdSOIQ.js → index-DX1X6Owa.js} +1 -1
  69. package/dist/{index-KYo_FgI8.js → index-DZN5WWgq.js} +3 -3
  70. package/dist/{index-B2BKFdEy.js → index-DhUvELhc.js} +1023 -1023
  71. package/dist/{index-DCrV9spQ.js → index-DpoNuVc-.js} +6 -6
  72. package/dist/{index-JY8MjiBK.js → index-G_XSbrXB.js} +3 -3
  73. package/dist/{index-bkL81TwC.js → index-VVy4GPzJ.js} +1 -1
  74. package/dist/{index-eiHOH5QM.js → index-wOExBjGo.js} +1 -1
  75. package/dist/{index.esm2017-toVKAoKi.js → index.esm2017-DfgZFSqe.js} +1 -1
  76. package/dist/{loading-vrEcUlJa.js → loading-qlqqYGF3.js} +1 -1
  77. package/dist/{membership-ChiyKtoA.js → membership-Bh_1iu5v.js} +3 -3
  78. package/dist/{moment-BWErdI6_.js → moment-D7p2TMB-.js} +6 -1
  79. package/dist/{money-tOAuywfS.js → money-DvTB_Fek.js} +1 -1
  80. package/dist/{number-DiXSJR50.js → number-DJQ3gi1P.js} +1 -1
  81. package/dist/objectid-BKU0cEuv.js +145 -0
  82. package/dist/{plugins-p8ID0wqZ.js → plugins-DJpBrPbQ.js} +2 -2
  83. package/dist/{reward-Bo4HsVNH.js → reward-DZ4KlN9B.js} +1 -1
  84. package/dist/{rule-LDThYbT7.js → rule-DV0yCGlq.js} +4 -4
  85. package/dist/rule-builder-D6ihVPNO.js +93 -0
  86. package/dist/{template-C6cnCLah.js → template-ElP-JIFL.js} +63 -63
  87. package/dist/timezone-FaHjut_D.js +1150 -0
  88. package/dist/{trigger-ZyJEZVxL.js → trigger-D8wnJVTA.js} +4 -4
  89. package/dist/usePagination-Ds-cuHop.js +223 -0
  90. package/dist/{user-WDNaXiRu.js → user-NWV9KppR.js} +1 -1
  91. package/dist/{vue-i18n-BWI3POch.js → vue-i18n-CkbS-IDD.js} +157 -157
  92. package/dist/{xlsx-JDV04zZH.js → xlsx-CdQE5RZi.js} +226 -226
  93. package/package.json +5 -4
  94. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-ByhTB9Ie.js +0 -144
  95. package/dist/MemberList-B5ogB2E6.js +0 -1606
  96. package/dist/MemberOverview-C2n9oJZh.js +0 -58
  97. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DRCwMmo5.js +0 -1752
  98. package/dist/Segment-BJm5XtlX.js +0 -882
  99. package/dist/Setting-CUyfrLYA.js +0 -1936
  100. package/dist/StoreRewards-B_yzVh4Z.js +0 -423
  101. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-naUCARDO.js +0 -419
  102. package/dist/app-Cwax62X-.js +0 -33357
  103. package/dist/objectid-C856JGM4.js +0 -145
  104. package/dist/rule-builder-7iBcFApT.js +0 -89
  105. package/dist/usePagination-JoYaROkV.js +0 -223
@@ -0,0 +1,1763 @@
1
+ import { defineComponent as A, computed as I, resolveComponent as E, openBlock as n, createElementBlock as F, createElementVNode as R, createVNode as b, unref as e, createTextVNode as te, toDisplayString as W, withCtx as q, onMounted as z, createBlock as V, createCommentVNode as M, ref as $, Fragment as h, renderList as N, normalizeClass as H, watch as de, resolveDynamicComponent as ae, onBeforeMount as ue, isRef as pe, createSlots as se } from "vue";
2
+ import { a as ye, C as ce, b as ve, c as be, d as fe } from "./index-CfgczUMX.js";
3
+ import { R as O, a as ge } from "./rule-builder-D6ihVPNO.js";
4
+ import { useDialog as le, useDialogChild as ie, useSnackbar as ke } from "@feedmepos/ui-library";
5
+ import { a as Ve, R as x, S as Ee, C as L, W as Te, T as re, O as ne } from "./rule-DV0yCGlq.js";
6
+ import { p as Se } from "./plugins-DJpBrPbQ.js";
7
+ import { h as J } from "./moment-D7p2TMB-.js";
8
+ import { z as Fe } from "./app-2EJP4psh.js";
9
+ import { u as Q } from "./membership-Bh_1iu5v.js";
10
+ import { u as X } from "./business-BehG4fR2.js";
11
+ import "./index-DhUvELhc.js";
12
+ import { _ as C } from "./CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js";
13
+ import { c as me } from "./object-qECH92oz.js";
14
+ import { Z } from "./zod-Bg2FbC-D.js";
15
+ import { _ as Ue } from "./SelectItems.vue_vue_type_script_setup_true_lang-DH3oIm2t.js";
16
+ import "./index-Bjf5Z2QE.js";
17
+ import "./index-DpoNuVc-.js";
18
+ import "./index-CFW9ogow.js";
19
+ import "./index-DZN5WWgq.js";
20
+ const xe = { class: "flex items-center justify-between" }, Ye = { class: "flex items-center gap-8 xs:flex-wrap" }, Re = { class: "text-fm-color-primary line-clamp-1 text-ellipsis" }, Ce = /* @__PURE__ */ A({
21
+ __name: "RuleEntry",
22
+ props: {
23
+ modelValue: {
24
+ type: Object,
25
+ required: !0
26
+ }
27
+ },
28
+ emits: ["edit", "remove"],
29
+ setup(l, { emit: Y }) {
30
+ const y = l, s = I(() => {
31
+ const [u, c] = Object.entries(y.modelValue.conditions)[0];
32
+ return {
33
+ negated: y.modelValue.negated == !0,
34
+ property: y.modelValue.property,
35
+ operator: u,
36
+ equator: c
37
+ };
38
+ }), o = Y, m = I(
39
+ () => Ve(
40
+ s.value.property,
41
+ s.value.operator,
42
+ s.value.equator,
43
+ s.value.negated
44
+ )
45
+ );
46
+ async function t(u) {
47
+ u.stopPropagation(), await Se.remove("Are you sure you want to remove this rule?") && o("remove", y.modelValue);
48
+ }
49
+ return (u, c) => {
50
+ var v;
51
+ const d = E("FmChip"), p = E("FmTooltip"), f = E("FmIcon");
52
+ return n(), F("div", xe, [
53
+ R("div", Ye, [
54
+ b(d, {
55
+ label: (v = e(ye).find((k) => k.property === y.modelValue.property)) == null ? void 0 : v.name,
56
+ class: "!text-fm-color-typo-info !bg-fm-color-system-info-100"
57
+ }, null, 8, ["label"]),
58
+ c[1] || (c[1] = R("div", { class: "h-[26px] border-l-2 rounded-md border-fm-color-neutral-gray-100" }, null, -1)),
59
+ R("div", {
60
+ onClick: c[0] || (c[0] = (k) => o("edit", y.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(W(e(m)[0]) + " ", 1),
64
+ b(p, {
65
+ "z-index": 1e3,
66
+ content: e(m)[1]
67
+ }, {
68
+ default: q(() => [
69
+ R("div", Re, W(e(m)[1]), 1)
70
+ ]),
71
+ _: 1
72
+ }, 8, ["content"])
73
+ ])
74
+ ]),
75
+ b(f, {
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
+ "LAST_X_DAY",
95
+ "CUSTOM"
96
+ ]);
97
+ const De = [
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: "_isRange",
148
+ equator: {
149
+ op: "this",
150
+ unit: "day",
151
+ ignoreYear: !0
152
+ }
153
+ }
154
+ ]
155
+ },
156
+ {
157
+ type: "BIRTHDAY",
158
+ name: "Birthday Week",
159
+ for: ["user"],
160
+ rules: [
161
+ {
162
+ property: "user.birthday",
163
+ operator: "_isRange",
164
+ equator: {
165
+ op: "this",
166
+ unit: "week",
167
+ ignoreYear: !0
168
+ }
169
+ }
170
+ ]
171
+ },
172
+ {
173
+ type: "BIRTHDAY",
174
+ name: "Birthday Month",
175
+ for: ["user"],
176
+ rules: [
177
+ {
178
+ property: "user.birthday",
179
+ operator: "_isRange",
180
+ equator: {
181
+ op: "this",
182
+ unit: "month",
183
+ ignoreYear: !0
184
+ }
185
+ }
186
+ ]
187
+ },
188
+ {
189
+ type: "BIRTHDAY",
190
+ name: "N day before birthday",
191
+ for: ["user"],
192
+ rules: [
193
+ {
194
+ property: "user.birthday",
195
+ operator: "_isDay",
196
+ equator: {
197
+ op: "before",
198
+ x: 1,
199
+ ignoreYear: !0
200
+ }
201
+ }
202
+ ]
203
+ },
204
+ {
205
+ type: "TIER",
206
+ name: "Specific tier",
207
+ for: ["user"],
208
+ rules: [
209
+ {
210
+ property: "user.tier",
211
+ operator: "_equal",
212
+ equator: 1
213
+ }
214
+ ]
215
+ },
216
+ {
217
+ type: "TITLE",
218
+ name: "Specific title",
219
+ for: ["user"],
220
+ rules: [
221
+ {
222
+ property: "user.titles",
223
+ operator: "_hasAny",
224
+ equator: []
225
+ }
226
+ ]
227
+ },
228
+ {
229
+ type: "LAST_X_DAY",
230
+ name: "Last visit in X days",
231
+ for: ["user"],
232
+ rules: [
233
+ {
234
+ property: "user.stats.lastVisit",
235
+ operator: "_isRange",
236
+ equator: {
237
+ op: "last",
238
+ unit: "day",
239
+ ignoreYear: !0,
240
+ x: 0
241
+ }
242
+ }
243
+ ],
244
+ premium: !0
245
+ },
246
+ {
247
+ type: "CUSTOM",
248
+ name: "Weekday special",
249
+ for: ["trigger"],
250
+ rules: [
251
+ {
252
+ property: "trigger.date",
253
+ operator: "_rrule",
254
+ equator: "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=MO,TU,WE,TH,FR;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
255
+ }
256
+ ]
257
+ },
258
+ {
259
+ type: "CUSTOM",
260
+ name: "Weekend special",
261
+ for: ["trigger"],
262
+ rules: [
263
+ {
264
+ property: "trigger.date",
265
+ operator: "_rrule",
266
+ equator: "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU,SA;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
267
+ }
268
+ ]
269
+ },
270
+ {
271
+ type: "CUSTOM",
272
+ name: "Happy hour",
273
+ for: ["trigger"],
274
+ rules: [
275
+ {
276
+ property: "trigger.time",
277
+ operator: "_isBetweenTime",
278
+ equator: [
279
+ {
280
+ start: "21:00",
281
+ end: "23:59"
282
+ }
283
+ ]
284
+ }
285
+ ]
286
+ },
287
+ {
288
+ type: "CUSTOM",
289
+ name: "Mother's day special",
290
+ for: ["trigger"],
291
+ rules: [
292
+ {
293
+ property: "trigger.date",
294
+ operator: "_rrule",
295
+ equator: "RRULE:FREQ=YEARLY;WKST=SU;BYDAY=+2SU;BYMONTH=5;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
296
+ }
297
+ ]
298
+ },
299
+ {
300
+ type: "CUSTOM",
301
+ name: "Father's day special",
302
+ for: ["trigger"],
303
+ rules: [
304
+ {
305
+ property: "trigger.date",
306
+ operator: "_rrule",
307
+ equator: "RRULE:FREQ=YEARLY;WKST=SU;BYDAY=+3SU;BYMONTH=6;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
308
+ }
309
+ ]
310
+ },
311
+ {
312
+ type: "CUSTOM",
313
+ name: "Christmas",
314
+ for: ["trigger"],
315
+ rules: [
316
+ {
317
+ property: "trigger.date",
318
+ operator: "_rrule",
319
+ equator: "RRULE:FREQ=YEARLY;WKST=SU;BYMONTH=12;BYMONTHDAY=25;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
320
+ }
321
+ ]
322
+ },
323
+ {
324
+ type: "CUSTOM",
325
+ name: "Feedback rating",
326
+ for: ["feedback"],
327
+ rules: [
328
+ {
329
+ property: "feedback.rating",
330
+ operator: "_lessThanOrEqual",
331
+ equator: 5
332
+ }
333
+ ]
334
+ },
335
+ {
336
+ type: "CUSTOM",
337
+ name: "Custom",
338
+ for: ["trigger", "user", "bill", "feedback"],
339
+ rules: [
340
+ {
341
+ property: "trigger.date",
342
+ operator: "_isOnDate",
343
+ equator: J().format("YYYY-MM-DD")
344
+ }
345
+ ]
346
+ }
347
+ ], Oe = { class: "flex flex-nowrap gap-x-4 items-center" }, we = /* @__PURE__ */ A({
348
+ __name: "IsDayInput",
349
+ props: {
350
+ modelValue: {
351
+ type: Object
352
+ }
353
+ },
354
+ emits: ["update:model-value"],
355
+ setup(l, { emit: Y }) {
356
+ const y = l, s = Y;
357
+ z(() => {
358
+ y.modelValue || s("update:model-value", {
359
+ op: "before",
360
+ x: 1
361
+ });
362
+ });
363
+ function o(m) {
364
+ const t = me(
365
+ y.modelValue ?? {
366
+ op: "before",
367
+ x: 1
368
+ }
369
+ );
370
+ s("update:model-value", {
371
+ ...t,
372
+ ...m
373
+ });
374
+ }
375
+ return (m, t) => {
376
+ var c, d, p;
377
+ const u = E("FmStepperField");
378
+ return n(), F("div", Oe, [
379
+ b(u, {
380
+ class: "w-1/3",
381
+ "model-value": ((c = l.modelValue) == null ? void 0 : c.x) ?? null,
382
+ max: 365,
383
+ "show-steppers": !1,
384
+ "append-text": "days",
385
+ "onUpdate:modelValue": t[0] || (t[0] = (f) => o({ x: f }))
386
+ }, null, 8, ["model-value"]),
387
+ b(C, {
388
+ "model-value": ((d = l.modelValue) == null ? void 0 : d.op) ?? void 0,
389
+ items: [
390
+ { label: "before", value: "before" },
391
+ { label: "after", value: "after" }
392
+ ],
393
+ "onUpdate:modelValue": t[1] || (t[1] = (f) => o({ op: f }))
394
+ }, null, 8, ["model-value"]),
395
+ b(C, {
396
+ "model-value": ((p = l.modelValue) == null ? void 0 : p.ignoreYear) ?? !1,
397
+ items: [
398
+ { label: "same year", value: !1 },
399
+ { label: "ignore year", value: !0 }
400
+ ],
401
+ required: !0,
402
+ "onUpdate:modelValue": t[2] || (t[2] = (f) => o({ ignoreYear: f == !0 }))
403
+ }, null, 8, ["model-value"])
404
+ ]);
405
+ };
406
+ }
407
+ }), he = { class: "grid grid-cols-4 gap-x-4 items-center" }, qe = /* @__PURE__ */ A({
408
+ __name: "IsRangeInput",
409
+ props: {
410
+ modelValue: {
411
+ type: Object,
412
+ default: () => ({
413
+ op: "this",
414
+ unit: "day",
415
+ ignoreYear: !0
416
+ })
417
+ }
418
+ },
419
+ emits: ["update:model-value"],
420
+ setup(l, { emit: Y }) {
421
+ const y = l, s = Y;
422
+ z(() => {
423
+ y.modelValue || s("update:model-value", {
424
+ op: "this",
425
+ unit: "day",
426
+ ignoreYear: !0
427
+ });
428
+ });
429
+ const o = [
430
+ { label: "day", value: "day" },
431
+ { label: "week", value: "week" },
432
+ { label: "month", value: "month" },
433
+ { label: "quarter", value: "quarter" },
434
+ { label: "year", value: "year" }
435
+ ], m = [
436
+ {
437
+ label: "this",
438
+ value: "this"
439
+ },
440
+ {
441
+ label: "last",
442
+ value: "last"
443
+ },
444
+ {
445
+ label: "next",
446
+ value: "next"
447
+ }
448
+ ];
449
+ return (t, u) => {
450
+ var d, p, f, v, k;
451
+ const c = E("FmStepperField");
452
+ return n(), F("div", he, [
453
+ b(C, {
454
+ "model-value": (d = l.modelValue) == null ? void 0 : d.op,
455
+ label: "",
456
+ items: m,
457
+ required: !0,
458
+ "onUpdate:modelValue": u[0] || (u[0] = (i) => s("update:model-value", { op: i, unit: "day", ignoreYear: !1 }))
459
+ }, null, 8, ["model-value"]),
460
+ ((p = l.modelValue) == null ? void 0 : p.op) != "this" ? (n(), V(c, {
461
+ key: 0,
462
+ "model-value": ((f = l.modelValue) == null ? void 0 : f.x) || 0,
463
+ max: 365,
464
+ "show-steppers": !1,
465
+ "onUpdate:modelValue": u[1] || (u[1] = (i) => s("update:model-value", {
466
+ op: l.modelValue.op,
467
+ unit: l.modelValue.unit,
468
+ ignoreYear: l.modelValue.ignoreYear == !0,
469
+ x: i
470
+ }))
471
+ }, null, 8, ["model-value"])) : M("", !0),
472
+ b(C, {
473
+ "model-value": (v = l.modelValue) == null ? void 0 : v.unit,
474
+ label: "",
475
+ items: o,
476
+ required: !0,
477
+ "onUpdate:modelValue": u[2] || (u[2] = (i) => s("update:model-value", { ...y.modelValue, unit: i }))
478
+ }, null, 8, ["model-value"]),
479
+ b(C, {
480
+ label: "",
481
+ "model-value": (k = l.modelValue) == null ? void 0 : k.ignoreYear,
482
+ items: [
483
+ { label: "same", value: !1 },
484
+ { label: "ignore", value: !0 }
485
+ ],
486
+ required: !0,
487
+ "onUpdate:modelValue": u[3] || (u[3] = (i) => s("update:model-value", {
488
+ ...y.modelValue,
489
+ ignoreYear: i == !0
490
+ }))
491
+ }, null, 8, ["model-value"])
492
+ ]);
493
+ };
494
+ }
495
+ }), Be = { class: "space-y-8" }, Me = { class: "text-fm-color-primary rounded-md border-dashed border-2 p-8" }, Ie = {
496
+ key: 0,
497
+ class: "flex items-center gap-8"
498
+ }, Ae = { class: "flex gap-4" }, Ne = {
499
+ key: 0,
500
+ class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
501
+ }, Pe = ["onClick"], $e = {
502
+ key: 1,
503
+ class: "flex items-center gap-8"
504
+ }, Le = { class: "flex gap-4 xs:gap-[2px]" }, He = { class: "grid grid-cols-6 gap-8" }, We = {
505
+ key: 0,
506
+ class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
507
+ }, je = ["onClick"], Ke = {
508
+ key: 1,
509
+ class: "grid grid-cols-2 items-center gap-8"
510
+ }, _e = { class: "flex gap-4" }, Ge = {
511
+ key: 4,
512
+ class: "flex items-center justify-end gap-8"
513
+ }, ee = /* @__PURE__ */ A({
514
+ __name: "RruleInput",
515
+ props: {
516
+ modelValue: {
517
+ type: String
518
+ },
519
+ startDate: {
520
+ type: Object
521
+ },
522
+ applyButton: {
523
+ type: Boolean
524
+ },
525
+ fixedFrequency: {
526
+ type: Boolean
527
+ }
528
+ },
529
+ emits: ["update:model-value", "cancel"],
530
+ setup(l, { emit: Y }) {
531
+ const y = l, s = Y, o = $(
532
+ y.modelValue ? x.fromString(y.modelValue) : new x({
533
+ dtstart: y.startDate,
534
+ freq: x.DAILY,
535
+ wkst: x.SU,
536
+ interval: 1,
537
+ byhour: 0,
538
+ byminute: 0,
539
+ bysecond: 0
540
+ })
541
+ );
542
+ function m(t) {
543
+ var u;
544
+ if ("freq" in t)
545
+ switch (t.freq) {
546
+ case x.WEEKLY:
547
+ o.value = new x({
548
+ dtstart: y.startDate,
549
+ freq: t.freq,
550
+ interval: 1,
551
+ byhour: 0,
552
+ byminute: 0,
553
+ bysecond: 0,
554
+ wkst: x.SU,
555
+ byweekday: [x.MO]
556
+ });
557
+ break;
558
+ case x.MONTHLY:
559
+ o.value = new x({
560
+ dtstart: y.startDate,
561
+ freq: t.freq,
562
+ interval: 1,
563
+ byhour: 0,
564
+ byminute: 0,
565
+ bysecond: 0,
566
+ bymonthday: [(/* @__PURE__ */ new Date()).getDate()],
567
+ wkst: x.SU
568
+ });
569
+ break;
570
+ case x.YEARLY:
571
+ o.value = new x({
572
+ dtstart: y.startDate,
573
+ freq: t.freq,
574
+ interval: 1,
575
+ byhour: 0,
576
+ byminute: 0,
577
+ bysecond: 0,
578
+ wkst: x.SU,
579
+ bymonth: [(/* @__PURE__ */ new Date()).getMonth() + 1],
580
+ bymonthday: [(/* @__PURE__ */ new Date()).getDate()]
581
+ });
582
+ break;
583
+ default:
584
+ o.value = new x({
585
+ dtstart: y.startDate,
586
+ freq: t.freq,
587
+ interval: 1,
588
+ byhour: 0,
589
+ byminute: 0,
590
+ bysecond: 0,
591
+ wkst: x.SU
592
+ });
593
+ }
594
+ t.interval && t.interval > 0 && (o.value = new x({
595
+ ...o.value.origOptions,
596
+ dtstart: y.startDate,
597
+ interval: t.interval
598
+ })), "byweekday" in t && t.byweekday && Array.isArray(t.byweekday) && t.byweekday.length > 0 && (o.value.options.bymonthday.length > 0 && o.value.options.freq == x.MONTHLY && (o.value.options.bymonthday = []), o.value = new x({
599
+ ...o.value.origOptions,
600
+ dtstart: y.startDate,
601
+ bymonthday: [],
602
+ byweekday: t.byweekday
603
+ })), "bysetpos" in t && t.bysetpos != null && (o.value = new x({
604
+ ...o.value.origOptions,
605
+ dtstart: y.startDate,
606
+ bymonthday: [],
607
+ bysetpos: t.bysetpos,
608
+ byweekday: ((u = o.value.options.byweekday) == null ? void 0 : u.length) > 0 ? o.value.options.byweekday : [6]
609
+ })), "bymonthday" in t && t.bymonthday && Array.isArray(t.bymonthday) && t.bymonthday.length > 0 && (o.value = new x({
610
+ ...o.value.origOptions,
611
+ dtstart: y.startDate,
612
+ bysetpos: [],
613
+ byweekday: [],
614
+ bymonthday: t.bymonthday
615
+ })), "bymonth" in t && t.bymonth && Array.isArray(t.bymonth) && t.bymonth.length > 0 && (o.value = new x({
616
+ ...o.value.origOptions,
617
+ dtstart: y.startDate,
618
+ bysetpos: [],
619
+ bymonth: t.bymonth
620
+ })), "bynweekday" in t && t.bynweekday && (o.value = new x({
621
+ ...o.value.origOptions,
622
+ dtstart: y.startDate,
623
+ bysetpos: [],
624
+ byweekday: new Te(
625
+ t.bynweekday[0][0],
626
+ t.bynweekday[0][1]
627
+ )
628
+ })), y.applyButton || s("update:model-value", o.value.toString());
629
+ }
630
+ return z(() => {
631
+ y.modelValue || s(
632
+ "update:model-value",
633
+ new x({
634
+ dtstart: y.startDate,
635
+ freq: x.DAILY,
636
+ wkst: x.SU,
637
+ interval: 1,
638
+ byhour: 0,
639
+ byminute: 0,
640
+ bysecond: 0
641
+ }).toString()
642
+ );
643
+ }), (t, u) => {
644
+ var v, k, i;
645
+ const c = E("FmStepperField"), d = E("FmChip"), p = E("FmButtonGroup"), f = E("FmButton");
646
+ return n(), F("div", Be, [
647
+ R("div", Me, W(e(Ee)(e(o).options)), 1),
648
+ l.fixedFrequency ? M("", !0) : (n(), F("div", Ie, [
649
+ u[8] || (u[8] = R("div", null, "Repeat every", -1)),
650
+ b(c, {
651
+ class: "w-[100px]",
652
+ "model-value": e(o).options.interval,
653
+ "onUpdate:modelValue": u[0] || (u[0] = (a) => m({ interval: a > 0 ? a : e(o).options.interval })),
654
+ min: 1
655
+ }, null, 8, ["model-value"]),
656
+ b(C, {
657
+ class: "w-min",
658
+ items: e(L).frequencies,
659
+ "model-value": e(o).origOptions.freq,
660
+ "onUpdate:modelValue": u[1] || (u[1] = (a) => m({ freq: a }))
661
+ }, null, 8, ["items", "model-value"])
662
+ ])),
663
+ e(o).options.freq === e(x).WEEKLY ? (n(), F(h, { key: 1 }, [
664
+ u[9] || (u[9] = R("div", null, "Repeat on", -1)),
665
+ R("div", Ae, [
666
+ (n(!0), F(h, null, N(e(L).weekdays, (a) => {
667
+ var S;
668
+ return n(), V(d, {
669
+ class: H(["cursor-pointer", `${(S = e(o).options.byweekday) != null && S.includes(a.value) ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
670
+ label: a.label[0],
671
+ key: a.value,
672
+ compact: !0,
673
+ onClick: () => {
674
+ var g, w;
675
+ m({
676
+ byweekday: (g = e(o).options.byweekday) != null && g.includes(a.value) ? ((w = e(o).options.byweekday) == null ? void 0 : w.filter((U) => U !== a.value)) || [] : [...e(o).options.byweekday || [], a.value]
677
+ });
678
+ }
679
+ }, null, 8, ["class", "label", "onClick"]);
680
+ }), 128))
681
+ ])
682
+ ], 64)) : M("", !0),
683
+ e(o).options.freq == e(x).MONTHLY ? (n(), F(h, { key: 2 }, [
684
+ b(p, {
685
+ "model-value": e(o).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": u[2] || (u[2] = (a) => {
695
+ a.label == "Each" ? m({ bymonthday: [1] }) : m({ bysetpos: 1 });
696
+ })
697
+ }, null, 8, ["model-value"]),
698
+ e(o).options.bymonthday.length > 0 ? (n(), F("div", Ne, [
699
+ (n(!0), F(h, null, N(e(L).dates, (a) => (n(), F("div", {
700
+ key: a.value,
701
+ class: H(["cursor-pointer text-center outline-1 outline-fm-color-neutral-gray-100 outline", `${e(o).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" : ""}`]),
702
+ onClick: (S) => m({
703
+ bymonthday: e(o).options.bymonthday.includes(a.value) ? e(o).options.bymonthday.filter((g) => g !== a.value) : [...e(o).options.bymonthday, a.value]
704
+ })
705
+ }, W(a.value), 11, Pe))), 128))
706
+ ])) : (n(), F("div", $e, [
707
+ b(C, {
708
+ items: e(L).ordinals,
709
+ "model-value": (v = e(o).options.bysetpos) == null ? void 0 : v[0],
710
+ "onUpdate:modelValue": u[3] || (u[3] = (a) => m({ bysetpos: a }))
711
+ }, null, 8, ["items", "model-value"]),
712
+ R("div", Le, [
713
+ (n(!0), F(h, null, N(e(L).weekdays, (a) => {
714
+ var S;
715
+ return n(), V(d, {
716
+ class: H(["cursor-pointer", `${(S = e(o).options.byweekday) != null && S.includes(a.value) ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
717
+ label: a.label[0],
718
+ key: a.value,
719
+ compact: !0,
720
+ onClick: () => {
721
+ m({
722
+ byweekday: [a.value]
723
+ });
724
+ }
725
+ }, null, 8, ["class", "label", "onClick"]);
726
+ }), 128))
727
+ ])
728
+ ]))
729
+ ], 64)) : M("", !0),
730
+ e(o).options.freq == e(x).YEARLY ? (n(), F(h, { key: 3 }, [
731
+ u[10] || (u[10] = R("div", null, "Month", -1)),
732
+ R("div", He, [
733
+ (n(!0), F(h, null, N(e(L).months, (a) => {
734
+ var S, g;
735
+ return n(), V(d, {
736
+ key: a.value,
737
+ class: H(["cursor-pointer", {
738
+ "bg-fm-color-primary text-white": (S = e(o).options.bymonth) == null ? void 0 : S.includes(
739
+ a.value
740
+ ),
741
+ "bg-fm-color-gray-200 text-fm-color-gray-800": !((g = e(o).options.bymonth) != null && g.includes(a.value))
742
+ }]),
743
+ label: a.shortName,
744
+ compact: !0,
745
+ onClick: (w) => m({
746
+ bymonth: (e(o).options.bymonth ?? []).includes(a.value) ? (e(o).options.bymonth ?? []).filter((U) => U !== a.value) : [...e(o).options.bymonth ?? [], a.value]
747
+ })
748
+ }, null, 8, ["class", "label", "onClick"]);
749
+ }), 128))
750
+ ]),
751
+ b(p, {
752
+ "model-value": e(o).options.bymonthday.length ? { label: "Each" } : { label: "On the" },
753
+ items: [
754
+ {
755
+ label: "Each"
756
+ },
757
+ {
758
+ label: "On the"
759
+ }
760
+ ],
761
+ "onUpdate:modelValue": u[4] || (u[4] = (a) => {
762
+ a.label == "Each" ? m({
763
+ bymonthday: [1],
764
+ bymonth: e(o).options.bymonth ?? [1]
765
+ }) : m({
766
+ byweekday: [e(x).SU.nth(1)],
767
+ bymonth: e(o).options.bymonth ?? [1]
768
+ });
769
+ })
770
+ }, null, 8, ["model-value"]),
771
+ e(o).options.bymonthday.length > 0 ? (n(), F("div", We, [
772
+ (n(!0), F(h, null, N(Array(31).fill(null).map((a, S) => S + 1), (a) => (n(), F("div", {
773
+ key: a,
774
+ class: H(["cursor-pointer text-center outline-1 outline-fm-color-neutral-gray-100 outline", `${e(o).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" : ""}`]),
775
+ onClick: (S) => m({
776
+ bymonthday: e(o).options.bymonthday.includes(a) ? e(o).options.bymonthday.filter((g) => g !== a) : [...e(o).options.bymonthday, a]
777
+ })
778
+ }, W(a), 11, je))), 128))
779
+ ])) : (n(), F("div", Ke, [
780
+ b(C, {
781
+ items: e(L).ordinals,
782
+ "model-value": (i = (k = e(o).options.bynweekday) == null ? void 0 : k[0]) == null ? void 0 : i[1],
783
+ "onUpdate:modelValue": u[5] || (u[5] = (a) => {
784
+ var S, g;
785
+ return m({
786
+ bynweekday: [[((g = (S = e(o).options.bynweekday) == null ? void 0 : S[0]) == null ? void 0 : g[0]) ?? 1, a]]
787
+ });
788
+ })
789
+ }, null, 8, ["items", "model-value"]),
790
+ R("div", _e, [
791
+ (n(!0), F(h, null, N(e(L).weekdays, (a) => {
792
+ var S, g;
793
+ return n(), V(d, {
794
+ class: H(["cursor-pointer", `${((g = (S = e(o).options.bynweekday) == null ? void 0 : S[0]) == null ? void 0 : g[0]) === a.value ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
795
+ label: a.label[0],
796
+ key: a.value,
797
+ compact: !0,
798
+ onClick: () => {
799
+ var w, U;
800
+ m({
801
+ bynweekday: [
802
+ [a.value, ((U = (w = e(o).options.bynweekday) == null ? void 0 : w[0]) == null ? void 0 : U[1]) ?? 1]
803
+ ]
804
+ });
805
+ }
806
+ }, null, 8, ["class", "label", "onClick"]);
807
+ }), 128))
808
+ ])
809
+ ]))
810
+ ], 64)) : M("", !0),
811
+ l.applyButton ? (n(), F("div", Ge, [
812
+ b(f, {
813
+ label: "Cancel",
814
+ variant: "tertiary",
815
+ onClick: u[6] || (u[6] = (a) => s("cancel"))
816
+ }),
817
+ b(f, {
818
+ label: "Apply",
819
+ onClick: u[7] || (u[7] = (a) => s("update:model-value", e(o).toString()))
820
+ })
821
+ ])) : M("", !0)
822
+ ]);
823
+ };
824
+ }
825
+ }), Qe = { class: "grid grid-cols-4 gap-8 w-full flex-wrap py-16" }, ze = /* @__PURE__ */ A({
826
+ __name: "IsInMonthInput",
827
+ props: {
828
+ modelValue: {
829
+ type: Object,
830
+ required: !0
831
+ }
832
+ },
833
+ emits: ["update:model-value"],
834
+ setup(l, { emit: Y }) {
835
+ const y = l, s = Y, o = J.months().map((m, t) => ({
836
+ name: m,
837
+ shortName: J().month(t).format("MMM"),
838
+ value: t
839
+ }));
840
+ return z(() => {
841
+ y.modelValue || s("update:model-value", []);
842
+ }), (m, t) => {
843
+ const u = E("FmChip");
844
+ return n(), F("div", Qe, [
845
+ (n(!0), F(h, null, N(e(o), (c) => {
846
+ var d, p;
847
+ return n(), V(u, {
848
+ class: H(["cursor-pointer", {
849
+ "bg-fm-color-primary text-white": (d = l.modelValue) == null ? void 0 : d.includes(c.value),
850
+ "bg-fm-color-gray-200 text-fm-color-gray-800": !((p = l.modelValue) != null && p.includes(
851
+ c.value
852
+ ))
853
+ }]),
854
+ label: c.name,
855
+ key: c.value,
856
+ compact: !0,
857
+ onClick: (f) => s(
858
+ "update:model-value",
859
+ l.modelValue.includes(c.value) ? l.modelValue.filter((v) => v !== c.value) : [...l.modelValue, c.value]
860
+ )
861
+ }, null, 8, ["class", "label", "onClick"]);
862
+ }), 128))
863
+ ]);
864
+ };
865
+ }
866
+ }), Xe = { class: "" }, Ze = { class: "flex justify-end gap-8 w-full" }, Je = /* @__PURE__ */ A({
867
+ __name: "MenuDialog",
868
+ props: {
869
+ modelValue: { type: Boolean },
870
+ initialValue: {},
871
+ filterItems: { type: Function }
872
+ },
873
+ emits: ["update:model-value", "confirm"],
874
+ setup(l, { emit: Y }) {
875
+ const y = l, s = $(), o = $(!1), m = Y;
876
+ function t() {
877
+ var c;
878
+ (c = s.value) == null || c.onConfirm(), m("update:model-value", !1);
879
+ }
880
+ function u() {
881
+ m("update:model-value", !1);
882
+ }
883
+ return de(
884
+ () => y.modelValue,
885
+ (c) => {
886
+ o.value = c;
887
+ }
888
+ ), z(() => {
889
+ o.value = y.modelValue;
890
+ }), (c, d) => {
891
+ const p = E("FmButton"), f = E("FmDialog");
892
+ return n(), V(f, {
893
+ "content-scrollable": !1,
894
+ contentClass: "pt-0",
895
+ modelValue: o.value,
896
+ "onUpdate:modelValue": d[0] || (d[0] = (v) => o.value = v),
897
+ title: "Select Items",
898
+ "close-button": !1
899
+ }, {
900
+ "dialog-header": q(() => [...d[1] || (d[1] = [
901
+ R("div", null, "Select Item", -1)
902
+ ])]),
903
+ "dialog-footer": q(() => [
904
+ R("div", Ze, [
905
+ b(p, {
906
+ variant: "tertiary",
907
+ onClick: u,
908
+ label: "Cancel"
909
+ }),
910
+ b(p, {
911
+ variant: "primary",
912
+ onClick: t,
913
+ label: "Confirm"
914
+ })
915
+ ])
916
+ ]),
917
+ default: q(() => [
918
+ R("div", Xe, [
919
+ b(Ue, {
920
+ ref_key: "selectItemRef",
921
+ ref: s,
922
+ "initial-value": l.initialValue,
923
+ "filter-items": l.filterItems,
924
+ "on-complete": (v) => {
925
+ m("confirm", v), u();
926
+ }
927
+ }, null, 8, ["initial-value", "filter-items", "on-complete"])
928
+ ])
929
+ ]),
930
+ _: 1
931
+ }, 8, ["modelValue"]);
932
+ };
933
+ }
934
+ }), et = { id: "select-menu" }, tt = /* @__PURE__ */ A({
935
+ __name: "SelectMenu",
936
+ props: {
937
+ modelValue: {}
938
+ },
939
+ emits: ["update:model-value"],
940
+ setup(l, { emit: Y }) {
941
+ const y = l, s = $(!1), o = I(() => {
942
+ var u;
943
+ return ((u = y.modelValue) == null ? void 0 : u.length) || 0;
944
+ }), m = Y;
945
+ function t(u) {
946
+ m("update:model-value", u);
947
+ }
948
+ return (u, c) => {
949
+ const d = E("FmField");
950
+ return n(), F("div", et, [
951
+ b(d, {
952
+ class: "text-fm-color-typo-tertiary",
953
+ onClick: c[0] || (c[0] = (p) => s.value = !0)
954
+ }, {
955
+ default: q(() => [
956
+ te(W(o.value) + " item(s) selected ", 1)
957
+ ]),
958
+ _: 1
959
+ }),
960
+ b(Je, {
961
+ modelValue: s.value,
962
+ "onUpdate:modelValue": [
963
+ c[1] || (c[1] = (p) => s.value = p),
964
+ c[2] || (c[2] = (p) => s.value = p)
965
+ ],
966
+ "initial-value": l.modelValue,
967
+ onConfirm: t
968
+ }, null, 8, ["modelValue", "initial-value"])
969
+ ]);
970
+ };
971
+ }
972
+ }), lt = {
973
+ key: 19,
974
+ class: "fm-typo-en-body-lg-600"
975
+ }, ot = /* @__PURE__ */ A({
976
+ __name: "RuleEquator",
977
+ props: {
978
+ type: {
979
+ type: String,
980
+ required: !0
981
+ },
982
+ operator: {
983
+ type: String,
984
+ required: !0
985
+ },
986
+ modelValue: {
987
+ type: Object
988
+ }
989
+ },
990
+ emits: ["update:model-value"],
991
+ setup(l, { emit: Y }) {
992
+ const y = l, s = Y, o = I(() => {
993
+ const m = ce[y.operator].safeParse(y.modelValue);
994
+ return m.success ? [] : m.error.errors;
995
+ });
996
+ return (m, t) => {
997
+ var i, a, S, g, w, U;
998
+ const u = E("FmTextField"), c = E("FmStepperField"), d = E("FmSimpleDatePicker"), p = E("FmSimpleDateRangePicker"), f = E("FmTimeRangePicker"), v = E("FmTimePicker"), k = E("FmHelperText");
999
+ return n(), F("div", {
1000
+ class: H({ "pb-4": e(o).length })
1001
+ }, [
1002
+ l.type === "text" ? (n(), V(u, {
1003
+ key: 0,
1004
+ "model-value": l.modelValue,
1005
+ "onUpdate:modelValue": t[0] || (t[0] = (r) => s("update:model-value", r))
1006
+ }, null, 8, ["model-value"])) : l.type === "number" ? (n(), V(c, {
1007
+ key: 1,
1008
+ "model-value": l.modelValue,
1009
+ "onUpdate:modelValue": t[1] || (t[1] = (r) => s("update:model-value", r))
1010
+ }, null, 8, ["model-value"])) : l.operator == "_isDay" ? (n(), V(ae(we), {
1011
+ key: 2,
1012
+ "model-value": l.modelValue,
1013
+ "onUpdate:modelValue": t[2] || (t[2] = (r) => s("update:model-value", r))
1014
+ }, null, 8, ["model-value"])) : l.operator == "_isRange" ? (n(), V(ae(qe), {
1015
+ key: 3,
1016
+ "model-value": l.modelValue,
1017
+ "onUpdate:modelValue": t[3] || (t[3] = (r) => s("update:model-value", r))
1018
+ }, null, 8, ["model-value"])) : l.operator == "_isOnDate" ? (n(), V(d, {
1019
+ key: 4,
1020
+ "model-value": l.modelValue,
1021
+ "onUpdate:modelValue": t[4] || (t[4] = (r) => s("update:model-value", r))
1022
+ }, null, 8, ["model-value"])) : l.operator == "_isBetween" ? (n(), V(p, {
1023
+ key: 5,
1024
+ "model-value": {
1025
+ startDate: (i = l.modelValue) == null ? void 0 : i.start,
1026
+ endDate: (a = l.modelValue) == null ? void 0 : a.end
1027
+ },
1028
+ "onUpdate:modelValue": t[5] || (t[5] = (r) => {
1029
+ s("update:model-value", {
1030
+ start: r.startDate,
1031
+ end: r.endDate
1032
+ });
1033
+ })
1034
+ }, null, 8, ["model-value"])) : l.operator == "_isInMonth" ? (n(), V(ze, {
1035
+ key: 6,
1036
+ "model-value": l.modelValue,
1037
+ "onUpdate:modelValue": t[6] || (t[6] = (r) => s("update:model-value", r))
1038
+ }, null, 8, ["model-value"])) : l.operator == "_rrule" ? (n(), V(ee, {
1039
+ key: 7,
1040
+ "model-value": l.modelValue,
1041
+ "onUpdate:modelValue": t[7] || (t[7] = (r) => s("update:model-value", r))
1042
+ }, null, 8, ["model-value"])) : l.operator == "_isBetweenTime" ? (n(), V(f, {
1043
+ key: 8,
1044
+ "disable-time-check": !0,
1045
+ "model-value": [(g = (S = l.modelValue) == null ? void 0 : S[0]) == null ? void 0 : g.start, (U = (w = l.modelValue) == null ? void 0 : w[0]) == null ? void 0 : U.end],
1046
+ "onUpdate:modelValue": t[8] || (t[8] = (r) => s("update:model-value", [
1047
+ {
1048
+ start: r[0],
1049
+ end: r[1]
1050
+ }
1051
+ ]))
1052
+ }, null, 8, ["model-value"])) : l.operator == "_isOnTime" ? (n(), V(v, {
1053
+ key: 9,
1054
+ "model-value": l.modelValue,
1055
+ "onUpdate:modelValue": t[9] || (t[9] = (r) => s("update:model-value", r))
1056
+ }, null, 8, ["model-value"])) : l.type == "tier" ? (n(), V(C, {
1057
+ key: 10,
1058
+ items: (e(Q)().sortedTiers ?? []).map((r, B) => ({
1059
+ label: `Tier ${B + 1} - ${r.name}`,
1060
+ value: B + 1
1061
+ })),
1062
+ "model-value": l.modelValue,
1063
+ "onUpdate:modelValue": t[10] || (t[10] = (r) => s("update:model-value", r))
1064
+ }, null, 8, ["items", "model-value"])) : l.type == "boolean" ? (n(), V(C, {
1065
+ key: 11,
1066
+ multiselect: !0,
1067
+ items: [
1068
+ { label: "true", value: !0 },
1069
+ { label: "false", value: !1 }
1070
+ ],
1071
+ "model-value": l.modelValue ?? [],
1072
+ "onUpdate:modelValue": t[11] || (t[11] = (r) => s("update:model-value", r))
1073
+ }, null, 8, ["model-value"])) : l.type == "exist" ? (n(), V(C, {
1074
+ key: 12,
1075
+ items: [
1076
+ { label: "true", value: "true" },
1077
+ { label: "false", value: "false" }
1078
+ ],
1079
+ "model-value": l.modelValue ?? [],
1080
+ "onUpdate:modelValue": t[12] || (t[12] = (r) => s("update:model-value", r))
1081
+ }, null, 8, ["model-value"])) : l.type == "gender" ? (n(), V(C, {
1082
+ key: 13,
1083
+ multiselect: !0,
1084
+ items: [
1085
+ { label: "Male", value: "MALE" },
1086
+ { label: "Female", value: "FEMALE" }
1087
+ ],
1088
+ "model-value": l.modelValue ?? [],
1089
+ "onUpdate:modelValue": t[13] || (t[13] = (r) => s("update:model-value", r))
1090
+ }, null, 8, ["model-value"])) : l.type == "collectible" ? (n(), V(C, {
1091
+ key: 14,
1092
+ multiselect: !0,
1093
+ items: [],
1094
+ "model-value": l.modelValue ?? [],
1095
+ "onUpdate:modelValue": t[14] || (t[14] = (r) => s("update:model-value", r))
1096
+ }, null, 8, ["model-value"])) : l.type == "segment" ? (n(), V(C, {
1097
+ key: 15,
1098
+ multiselect: !0,
1099
+ items: e(Q)().segmentOptions,
1100
+ "model-value": l.modelValue ?? [],
1101
+ "onUpdate:modelValue": t[15] || (t[15] = (r) => s("update:model-value", r)),
1102
+ label: "Select segment(s) to match"
1103
+ }, null, 8, ["items", "model-value"])) : l.type == "title" ? (n(), V(C, {
1104
+ key: 16,
1105
+ multiselect: !0,
1106
+ items: (e(Q)().sortedTitles ?? []).map((r) => ({
1107
+ label: r.name,
1108
+ value: r._id
1109
+ })),
1110
+ "model-value": l.modelValue ?? [],
1111
+ "onUpdate:modelValue": t[16] || (t[16] = (r) => s("update:model-value", r))
1112
+ }, null, 8, ["items", "model-value"])) : l.type == "product" ? (n(), V(tt, {
1113
+ key: 17,
1114
+ "model-value": l.modelValue,
1115
+ "onUpdate:modelValue": t[17] || (t[17] = (r) => s("update:model-value", r))
1116
+ }, null, 8, ["model-value"])) : l.type == "location" ? (n(), V(C, {
1117
+ key: 18,
1118
+ multiselect: !0,
1119
+ items: e(X)().locations.map((r) => ({
1120
+ label: r.name,
1121
+ value: r._id
1122
+ })),
1123
+ "model-value": l.modelValue ?? [],
1124
+ "onUpdate:modelValue": t[18] || (t[18] = (r) => s("update:model-value", r))
1125
+ }, null, 8, ["items", "model-value"])) : (n(), F("div", lt, "Rule: " + W(l.type) + " Not implemented", 1)),
1126
+ b(k, {
1127
+ class: "items-end",
1128
+ state: e(Z).helperState(e(o), ""),
1129
+ text: e(Z).helperText(e(o), "")
1130
+ }, null, 8, ["state", "text"])
1131
+ ], 2);
1132
+ };
1133
+ }
1134
+ }), at = { class: "space-y-4" }, rt = { class: "flex items-center gap-8" }, nt = { class: "flex items-center justify-end gap-8 pt-16 w-full" }, ut = /* @__PURE__ */ A({
1135
+ __name: "CustomRuleDialog",
1136
+ props: {
1137
+ triggerType: {
1138
+ type: String,
1139
+ required: !0
1140
+ },
1141
+ includeOnly: {
1142
+ type: String
1143
+ },
1144
+ modelValue: {
1145
+ type: Object,
1146
+ default: () => {
1147
+ }
1148
+ }
1149
+ },
1150
+ setup(l) {
1151
+ const Y = le(), y = Q(), { emitData: s, emitAction: o } = ie(), m = l, t = I(
1152
+ () => ve(m.triggerType, m.includeOnly)
1153
+ ), u = (U) => re[t.value.find((r) => r.property === U).type], c = I(() => {
1154
+ if (!v.value) return [];
1155
+ const U = t.value.find(
1156
+ (r) => r.property === v.value.property
1157
+ );
1158
+ return U ? re[U.type].filter((r) => {
1159
+ var B, P;
1160
+ return !((P = (B = ne[r]) == null ? void 0 : B.exclude) != null && P.includes(v.value.property));
1161
+ }).map((r) => ({
1162
+ label: ne[r].name,
1163
+ value: r
1164
+ })) : [];
1165
+ }), d = be, p = I(() => {
1166
+ const U = d.safeParse(v.value);
1167
+ return U.success ? [] : U.error.errors;
1168
+ }), f = $(!1), v = $(
1169
+ me(m.modelValue) ?? O.constructEntry(
1170
+ t.value[0].property,
1171
+ u(t.value[0].property)[0],
1172
+ null
1173
+ )
1174
+ ), k = I(() => {
1175
+ var j;
1176
+ const { property: U, negated: r, conditions: B } = v.value, P = Object.keys(B || {})[0], K = Object.values(B || {})[0];
1177
+ return {
1178
+ property: U,
1179
+ negated: r == !0,
1180
+ type: (j = t.value.find((_) => _.property === U)) == null ? void 0 : j.type,
1181
+ operator: P,
1182
+ equator: K
1183
+ };
1184
+ });
1185
+ function i(U) {
1186
+ v.value = O.constructEntry(
1187
+ U,
1188
+ u(U)[0],
1189
+ null
1190
+ );
1191
+ }
1192
+ function a(U) {
1193
+ v.value = { ...v.value, negated: U == !0 };
1194
+ }
1195
+ function S(U) {
1196
+ v.value = {
1197
+ ...v.value,
1198
+ conditions: { [U]: null }
1199
+ };
1200
+ }
1201
+ function g(U) {
1202
+ v.value.conditions = {
1203
+ [k.value.operator]: U
1204
+ };
1205
+ }
1206
+ function w() {
1207
+ s(v.value), o("primary"), Y.close();
1208
+ }
1209
+ return ue(async () => {
1210
+ await y.readMembership();
1211
+ }), (U, r) => {
1212
+ const B = E("FmIcon"), P = E("FmField"), K = E("FmPill"), j = E("FmMenuItem"), _ = E("FmMenu"), G = E("FmButton");
1213
+ return n(), F("div", at, [
1214
+ r[5] || (r[5] = R("div", { class: "fm-typo-en-body-lg-400" }, "Property", -1)),
1215
+ b(_, {
1216
+ shift: !0,
1217
+ placement: "bottom-start",
1218
+ modelValue: e(f),
1219
+ "onUpdate:modelValue": r[0] || (r[0] = (D) => pe(f) ? f.value = D : null),
1220
+ onMenuChanged: r[1] || (r[1] = (D) => f.value = D),
1221
+ "max-height": 300
1222
+ }, {
1223
+ "menu-button": q(() => [
1224
+ b(P, null, {
1225
+ append: q(() => [
1226
+ b(B, {
1227
+ name: e(f) ? "expand_less" : "expand_more"
1228
+ }, null, 8, ["name"])
1229
+ ]),
1230
+ default: q(() => {
1231
+ var D;
1232
+ return [
1233
+ te(W((D = e(t).find((T) => T.property == e(v).property)) == null ? void 0 : D.name) + " ", 1)
1234
+ ];
1235
+ }),
1236
+ _: 1
1237
+ })
1238
+ ]),
1239
+ default: q(() => [
1240
+ (n(!0), F(h, null, N(e(t), (D) => (n(), V(j, {
1241
+ key: D.property,
1242
+ "model-value": e(v).property == D.property,
1243
+ label: D.name,
1244
+ disabled: D.premium && !e(X)().isPremium,
1245
+ onClick: (T) => D.premium && !e(X)().isPremium ? null : i(D.property)
1246
+ }, se({ _: 2 }, [
1247
+ D.premium ? {
1248
+ name: "append",
1249
+ fn: q(() => [
1250
+ b(K, { variant: "premium" })
1251
+ ]),
1252
+ key: "0"
1253
+ } : void 0
1254
+ ]), 1032, ["model-value", "label", "disabled", "onClick"]))), 128))
1255
+ ]),
1256
+ _: 1
1257
+ }, 8, ["modelValue"]),
1258
+ r[6] || (r[6] = R("div", { class: "fm-typo-en-body-lg-400" }, "Check to perform", -1)),
1259
+ R("div", rt, [
1260
+ b(C, {
1261
+ class: "w-1/4",
1262
+ items: [
1263
+ { label: "is", value: !1 },
1264
+ { label: "is not", value: !0 }
1265
+ ],
1266
+ "model-value": e(v).negated ?? !1,
1267
+ "onUpdate:modelValue": a
1268
+ }, null, 8, ["model-value"]),
1269
+ b(C, {
1270
+ class: "flex-1",
1271
+ items: e(c),
1272
+ "model-value": e(k).operator,
1273
+ "onUpdate:modelValue": S
1274
+ }, null, 8, ["items", "model-value"])
1275
+ ]),
1276
+ R("div", null, [
1277
+ r[4] || (r[4] = R("div", { class: "fm-typo-en-body-lg-400" }, "Criteria", -1)),
1278
+ e(k).type ? (n(), V(ot, {
1279
+ key: 0,
1280
+ type: e(k).type,
1281
+ operator: e(k).operator,
1282
+ "model-value": e(k).equator,
1283
+ "onUpdate:modelValue": g
1284
+ }, null, 8, ["type", "operator", "model-value"])) : M("", !0)
1285
+ ]),
1286
+ R("div", nt, [
1287
+ b(G, {
1288
+ onClick: r[2] || (r[2] = (D) => e(Y).close()),
1289
+ label: "Cancel",
1290
+ variant: "tertiary"
1291
+ }),
1292
+ b(G, {
1293
+ onClick: r[3] || (r[3] = (D) => w()),
1294
+ disabled: e(p).length > 0,
1295
+ label: "Save"
1296
+ }, null, 8, ["disabled"])
1297
+ ])
1298
+ ]);
1299
+ };
1300
+ }
1301
+ }), st = { class: "flex flex-col gap-8" }, it = { class: "grid grid-cols-2 items-center" }, mt = { class: "flex items-center gap-8" }, dt = { class: "pt-16 flex items-center self-end gap-8" }, pt = /* @__PURE__ */ A({
1302
+ __name: "PresetRuleDialog",
1303
+ props: {
1304
+ preset: {
1305
+ type: String,
1306
+ required: !0
1307
+ },
1308
+ defaultValue: {
1309
+ type: Object
1310
+ },
1311
+ modelValue: {
1312
+ type: Object
1313
+ }
1314
+ },
1315
+ setup(l) {
1316
+ const Y = le(), { emitData: y, emitAction: s } = ie(), o = Q(), m = l;
1317
+ function t() {
1318
+ const { operator: k, equator: i } = d.value;
1319
+ switch (m.preset) {
1320
+ case "MIN_SPEND":
1321
+ case "SPECIFIC_DATE":
1322
+ case "SPECIFIC_TIMERANGE":
1323
+ case "WEEKLY":
1324
+ case "MONTHLY":
1325
+ case "BIRTHDAY":
1326
+ case "TIER":
1327
+ return `Applies to ${o.sortedTiers.filter((S, g) => k == "_equal" ? g + 1 == i : k == "_moreThanOrEqual" ? g + 1 >= i : g + 1 <= i).map((S) => S.name).join(", ")}`;
1328
+ }
1329
+ }
1330
+ function u() {
1331
+ var k, i;
1332
+ switch (m.preset) {
1333
+ case "MIN_SPEND":
1334
+ return O.constructEntry("bill.amount", "_moreThanOrEqual", 0);
1335
+ case "SPECIFIC_DATE":
1336
+ return O.constructEntry(
1337
+ "trigger.date",
1338
+ "_isOnDate",
1339
+ (/* @__PURE__ */ new Date()).toISOString()
1340
+ );
1341
+ case "SPECIFIC_TIMERANGE":
1342
+ return O.constructEntry("trigger.time", "_isBetweenTime", [
1343
+ { start: "00:00", end: "23:59" }
1344
+ ]);
1345
+ case "WEEKLY":
1346
+ return O.constructEntry(
1347
+ "trigger.date",
1348
+ "_rrule",
1349
+ "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1350
+ );
1351
+ case "MONTHLY":
1352
+ return O.constructEntry(
1353
+ "trigger.date",
1354
+ "_rrule",
1355
+ "RRULE:FREQ=MONTHLY;WKST=SU;BYMONTHDAY=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1356
+ );
1357
+ case "BIRTHDAY":
1358
+ console.log("birthday", m);
1359
+ const a = O.constructEntry(
1360
+ m.defaultValue.property,
1361
+ m.defaultValue.operator,
1362
+ m.defaultValue.equator
1363
+ );
1364
+ return console.log(a), a;
1365
+ case "TIER":
1366
+ return O.constructEntry("user.tier", "_equal", 1);
1367
+ case "TITLE":
1368
+ return O.constructEntry("user.titles", "_hasAny", [
1369
+ (i = (k = o.sortedTitles) == null ? void 0 : k[0]) == null ? void 0 : i._id
1370
+ ]);
1371
+ case "LAST_X_DAY":
1372
+ return O.constructEntry("user.stats.lastVisit", "_isRange", {
1373
+ op: "last",
1374
+ unit: "day",
1375
+ ignoreYear: !0,
1376
+ x: 0
1377
+ });
1378
+ case "CUSTOM":
1379
+ throw new Error("Not implemented");
1380
+ }
1381
+ }
1382
+ const c = $(u()), d = I(() => {
1383
+ const k = O.simplify(c.value);
1384
+ return {
1385
+ ...k,
1386
+ equator: k.equator
1387
+ };
1388
+ });
1389
+ function p(k, i) {
1390
+ const a = d.value;
1391
+ c.value = O.constructEntry(
1392
+ a.property,
1393
+ i ?? a.operator,
1394
+ k,
1395
+ c.value.name
1396
+ );
1397
+ }
1398
+ function f() {
1399
+ y(c.value), s("primary"), Y.close();
1400
+ }
1401
+ const v = I(() => {
1402
+ const k = fe.safeParse(c.value);
1403
+ return k.success ? [] : k.error.errors;
1404
+ });
1405
+ return ue(async () => {
1406
+ await o.readMembership();
1407
+ }), (k, i) => {
1408
+ var K, j, _, G, D;
1409
+ const a = E("FmStepperField"), S = E("FmDatePicker"), g = E("FmTimeRangePicker"), w = E("FmRadio"), U = E("FmSelect"), r = E("FmRadioGroup"), B = E("FmHelperText"), P = E("FmButton");
1410
+ return n(), F("div", st, [
1411
+ l.preset == "MIN_SPEND" ? (n(), V(a, {
1412
+ key: 0,
1413
+ label: "Minimum spend",
1414
+ "model-value": e(d).equator,
1415
+ "onUpdate:modelValue": i[0] || (i[0] = (T) => p(T))
1416
+ }, null, 8, ["model-value"])) : M("", !0),
1417
+ l.preset == "LAST_X_DAY" ? (n(), V(a, {
1418
+ key: 1,
1419
+ label: "",
1420
+ min: 0,
1421
+ prepent: "Day(s)",
1422
+ "model-value": e(d).equator.x,
1423
+ rules: [(T) => T >= 0 || "Value must be greater than 0"],
1424
+ "onUpdate:modelValue": i[1] || (i[1] = (T) => p({
1425
+ op: "last",
1426
+ unit: "day",
1427
+ ignoreYear: !0,
1428
+ x: T
1429
+ }))
1430
+ }, null, 8, ["model-value", "rules"])) : l.preset == "SPECIFIC_DATE" ? (n(), V(S, {
1431
+ key: 2,
1432
+ label: "Specific Date",
1433
+ "model-value": e(d).equator,
1434
+ "onUpdate:modelValue": i[2] || (i[2] = (T) => p(T))
1435
+ }, null, 8, ["model-value"])) : l.preset == "SPECIFIC_TIMERANGE" ? (n(), V(g, {
1436
+ key: 3,
1437
+ label: "Time is between",
1438
+ "disable-time-check": !0,
1439
+ "model-value": [(j = (K = e(d).equator) == null ? void 0 : K[0]) == null ? void 0 : j.start, (G = (_ = e(d).equator) == null ? void 0 : _[0]) == null ? void 0 : G.end],
1440
+ "onUpdate:modelValue": i[3] || (i[3] = (T) => p([
1441
+ {
1442
+ start: T[0],
1443
+ end: T[1]
1444
+ }
1445
+ ]))
1446
+ }, null, 8, ["model-value"])) : l.preset == "WEEKLY" ? (n(), V(ee, {
1447
+ key: 4,
1448
+ label: "Weekly",
1449
+ "fixed-frequency": !0,
1450
+ "model-value": e(d).equator,
1451
+ "onUpdate:modelValue": i[4] || (i[4] = (T) => p(T))
1452
+ }, null, 8, ["model-value"])) : l.preset == "MONTHLY" ? (n(), V(ee, {
1453
+ key: 5,
1454
+ label: "Weekly",
1455
+ "fixed-frequency": !0,
1456
+ "model-value": e(d).equator,
1457
+ "onUpdate:modelValue": i[5] || (i[5] = (T) => p(T))
1458
+ }, null, 8, ["model-value"])) : l.preset == "BIRTHDAY" ? (n(), F(h, { key: 6 }, [
1459
+ R("div", it, [
1460
+ b(w, {
1461
+ label: "N days before birthday",
1462
+ value: "_isDay",
1463
+ "model-value": e(d).operator,
1464
+ "onUpdate:modelValue": i[6] || (i[6] = () => {
1465
+ p(
1466
+ {
1467
+ op: "after",
1468
+ x: 1,
1469
+ ignoreYear: !0
1470
+ },
1471
+ "_isDay"
1472
+ );
1473
+ })
1474
+ }, null, 8, ["model-value"]),
1475
+ R("div", mt, [
1476
+ b(w, {
1477
+ label: "Is in this",
1478
+ value: "_isRange",
1479
+ "model-value": e(d).operator,
1480
+ "onUpdate:modelValue": i[7] || (i[7] = () => {
1481
+ p(
1482
+ {
1483
+ op: "this",
1484
+ unit: "day",
1485
+ ignoreYear: !0
1486
+ },
1487
+ "_isRange"
1488
+ );
1489
+ })
1490
+ }, null, 8, ["model-value"]),
1491
+ e(d).operator == "_isRange" ? (n(), V(U, {
1492
+ key: 0,
1493
+ items: ["day", "week", "month"].map((T) => ({ label: T, value: T })),
1494
+ "model-value": e(d).equator.unit,
1495
+ "onUpdate:modelValue": i[8] || (i[8] = (T) => p(
1496
+ {
1497
+ op: "this",
1498
+ unit: T,
1499
+ ignoreYear: !0
1500
+ },
1501
+ "_isRange"
1502
+ ))
1503
+ }, null, 8, ["items", "model-value"])) : M("", !0)
1504
+ ])
1505
+ ]),
1506
+ e(d).operator == "_isDay" ? (n(), V(a, {
1507
+ key: 0,
1508
+ label: "Days before birthday",
1509
+ "show-steppers": !1,
1510
+ "model-value": e(d).equator.x,
1511
+ "onUpdate:modelValue": i[9] || (i[9] = (T) => p({
1512
+ op: "after",
1513
+ x: T,
1514
+ ignoreYear: !0
1515
+ }))
1516
+ }, null, 8, ["model-value"])) : M("", !0)
1517
+ ], 64)) : l.preset == "TIER" ? (n(), F(h, { key: 7 }, [
1518
+ b(r, {
1519
+ inline: !0,
1520
+ "model-value": e(d).operator,
1521
+ "onUpdate:modelValue": i[10] || (i[10] = (T) => p(e(d).equator, T))
1522
+ }, {
1523
+ default: q(() => [
1524
+ b(w, {
1525
+ value: "_moreThanOrEqual",
1526
+ label: "At least"
1527
+ }),
1528
+ b(w, {
1529
+ value: "_equal",
1530
+ label: "Equal"
1531
+ }),
1532
+ b(w, {
1533
+ value: "_lessThanOrEqual",
1534
+ label: "At most"
1535
+ })
1536
+ ]),
1537
+ _: 1
1538
+ }, 8, ["model-value"]),
1539
+ b(C, {
1540
+ items: (e(o).sortedTiers ?? []).map((T, oe) => ({
1541
+ label: `Tier ${oe + 1} - ${T.name}`,
1542
+ value: oe + 1
1543
+ })),
1544
+ "model-value": e(d).equator,
1545
+ "onUpdate:modelValue": i[11] || (i[11] = (T) => p(T))
1546
+ }, null, 8, ["items", "model-value"]),
1547
+ b(B, {
1548
+ text: t()
1549
+ }, null, 8, ["text"])
1550
+ ], 64)) : l.preset == "TITLE" ? (n(), V(C, {
1551
+ key: 8,
1552
+ label: "User has title",
1553
+ items: (e(o).sortedTitles ?? []).map((T) => ({
1554
+ label: T.name,
1555
+ value: T._id
1556
+ })),
1557
+ "model-value": (D = e(d).equator) == null ? void 0 : D[0],
1558
+ "onUpdate:modelValue": i[12] || (i[12] = (T) => p([T]))
1559
+ }, null, 8, ["items", "model-value"])) : M("", !0),
1560
+ b(B, {
1561
+ class: "mt-[-8px]",
1562
+ text: e(Z).helperText(e(v), ""),
1563
+ state: e(Z).helperState(e(v), "")
1564
+ }, null, 8, ["text", "state"]),
1565
+ R("div", dt, [
1566
+ b(P, {
1567
+ onClick: i[13] || (i[13] = (T) => e(Y).close()),
1568
+ label: "Cancel",
1569
+ variant: "tertiary"
1570
+ }),
1571
+ b(P, {
1572
+ onClick: i[14] || (i[14] = (T) => f()),
1573
+ disabled: e(v).length > 0,
1574
+ label: "Save"
1575
+ }, null, 8, ["disabled"])
1576
+ ])
1577
+ ]);
1578
+ };
1579
+ }
1580
+ }), yt = /* @__PURE__ */ A({
1581
+ __name: "RuleConfigurator",
1582
+ props: {
1583
+ triggerType: {
1584
+ type: String,
1585
+ required: !0
1586
+ },
1587
+ includeOnly: {
1588
+ type: String
1589
+ },
1590
+ modelValue: {
1591
+ type: Object,
1592
+ default: () => {
1593
+ }
1594
+ }
1595
+ },
1596
+ emits: ["update:model-value"],
1597
+ setup(l, { expose: Y, emit: y }) {
1598
+ const s = X(), o = l, m = y, t = le(), u = $();
1599
+ function c(f) {
1600
+ const [v] = f.rules;
1601
+ t.open({
1602
+ title: f.name,
1603
+ closeButton: !1,
1604
+ dismissAway: !1,
1605
+ contentComponent: pt,
1606
+ contentComponentProps: {
1607
+ preset: f.type,
1608
+ defaultValue: v,
1609
+ modelValue: o.modelValue
1610
+ }
1611
+ }).onPrimary((k) => m("update:model-value", k));
1612
+ }
1613
+ function d(f) {
1614
+ t.open({
1615
+ title: "Edit rule",
1616
+ closeButton: !1,
1617
+ dismissAway: !1,
1618
+ contentComponent: ut,
1619
+ contentComponentProps: {
1620
+ triggerType: o.triggerType,
1621
+ includeOnly: o.includeOnly,
1622
+ modelValue: f
1623
+ }
1624
+ }).onPrimary((v) => m("update:model-value", v));
1625
+ }
1626
+ function p(f) {
1627
+ if (f.type == "CUSTOM") {
1628
+ const [v] = f.rules;
1629
+ return d(
1630
+ O.constructEntry(v.property, v.operator, v.equator)
1631
+ );
1632
+ }
1633
+ return c(f);
1634
+ }
1635
+ return Y({
1636
+ showCustomDialog: d
1637
+ }), (f, v) => {
1638
+ const k = E("FmButton"), i = E("FmPill"), a = E("FmMenuItem"), S = E("FmMenu");
1639
+ return n(), V(S, {
1640
+ shift: !0,
1641
+ placement: "top-start"
1642
+ }, {
1643
+ "menu-button": q(() => [
1644
+ b(k, {
1645
+ label: "Add condition",
1646
+ icon: "add",
1647
+ class: "text-fm-color-primary border-fm-color-primary",
1648
+ "icon-color": "primary",
1649
+ variant: "secondary"
1650
+ })
1651
+ ]),
1652
+ default: q(() => [
1653
+ (n(!0), F(h, null, N(e(De).filter(
1654
+ (g) => !l.includeOnly || g.for.includes(l.includeOnly)
1655
+ ), (g) => (n(), V(a, {
1656
+ key: g.name,
1657
+ "model-value": g.name == e(u),
1658
+ label: g.name,
1659
+ onClick: () => {
1660
+ g != null && g.premium && !e(s).isPremium || p(g);
1661
+ },
1662
+ disabled: (g == null ? void 0 : g.premium) && !e(s).isPremium
1663
+ }, se({ _: 2 }, [
1664
+ g != null && g.premium ? {
1665
+ name: "append",
1666
+ fn: q(() => [
1667
+ b(i, { variant: "premium" })
1668
+ ]),
1669
+ key: "0"
1670
+ } : void 0
1671
+ ]), 1032, ["model-value", "label", "onClick", "disabled"]))), 128))
1672
+ ]),
1673
+ _: 1
1674
+ });
1675
+ };
1676
+ }
1677
+ }), ht = /* @__PURE__ */ A({
1678
+ __name: "RuleGroup",
1679
+ props: {
1680
+ triggerType: {
1681
+ type: String,
1682
+ required: !0
1683
+ },
1684
+ includeOnly: {
1685
+ type: String
1686
+ },
1687
+ modelValue: {
1688
+ type: Object
1689
+ }
1690
+ },
1691
+ emits: ["update:model-value"],
1692
+ setup(l, { emit: Y }) {
1693
+ const y = l, s = Y, o = ke(), m = I(
1694
+ () => y.modelValue ?? O.scaffoldGroup()
1695
+ ), t = I(() => O.getLogic(m.value)), u = $();
1696
+ function c(d, p) {
1697
+ try {
1698
+ const f = O.setRuleToGroup(d, p);
1699
+ s("update:model-value", f);
1700
+ } catch (f) {
1701
+ o.open({
1702
+ message: f.message,
1703
+ type: "error"
1704
+ });
1705
+ }
1706
+ }
1707
+ return (d, p) => {
1708
+ const f = E("FmButtonGroup"), v = E("FmCard");
1709
+ return n(), V(v, { variant: "outlined" }, {
1710
+ default: q(() => [
1711
+ b(v, { class: "border-l-4 border-fm-color-primary p-16 space-y-16" }, {
1712
+ default: q(() => [
1713
+ p[3] || (p[3] = R("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " When ", -1)),
1714
+ b(yt, {
1715
+ ref_key: "configuratorRef",
1716
+ ref: u,
1717
+ "include-only": l.includeOnly,
1718
+ "trigger-type": l.triggerType,
1719
+ "onUpdate:modelValue": p[0] || (p[0] = (k) => c(e(m), k))
1720
+ }, null, 8, ["include-only", "trigger-type"]),
1721
+ (n(!0), F(h, null, N(e(m).rules, (k, i) => {
1722
+ var a;
1723
+ return n(), F(h, null, [
1724
+ e(ge)(k) ? (n(), V(Ce, {
1725
+ "model-value": k,
1726
+ key: i,
1727
+ onEdit: (a = e(u)) == null ? void 0 : a.showCustomDialog,
1728
+ onRemove: p[1] || (p[1] = (S) => {
1729
+ s(
1730
+ "update:model-value",
1731
+ e(O).removeEntry(e(m), S.name)
1732
+ );
1733
+ })
1734
+ }, null, 8, ["model-value", "onEdit"])) : M("", !0),
1735
+ b(f, {
1736
+ class: "w-[200px]",
1737
+ disabled: Object.keys(e(m).rules).length < 2,
1738
+ items: [{ label: "And" }, { label: "Or" }],
1739
+ "model-value": e(t) === "&&" ? { label: "And" } : { label: "Or" },
1740
+ "onUpdate:modelValue": p[2] || (p[2] = (S) => s(
1741
+ "update:model-value",
1742
+ e(O).setRuleToGroup(
1743
+ e(m),
1744
+ [],
1745
+ S.label === "And" ? "&&" : "||"
1746
+ )
1747
+ ))
1748
+ }, null, 8, ["disabled", "model-value"])
1749
+ ], 64);
1750
+ }), 256))
1751
+ ]),
1752
+ _: 1
1753
+ })
1754
+ ]),
1755
+ _: 1
1756
+ });
1757
+ };
1758
+ }
1759
+ });
1760
+ export {
1761
+ ht as _,
1762
+ ee as a
1763
+ };