@isettingkit/business-rules 0.1.29 → 0.1.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 (2) hide show
  1. package/dist/index.es.js +450 -502
  2. package/package.json +2 -2
package/dist/index.es.js CHANGED
@@ -1,45 +1,45 @@
1
- import { jsxs as c, Fragment as _, jsx as a } from "react/jsx-runtime";
2
- import { ValueDataType as F, ValueHowToSetUp as f, InputRange as ae, MultipleChoices as re, DynamicField as ne } from "@isettingkit/input";
1
+ import { jsxs as u, Fragment as E, jsx as r } from "react/jsx-runtime";
2
+ import { ValueDataType as k, ValueHowToSetUp as b, DecisionConditionRender as $ } from "@isettingkit/input";
3
3
  import { Stack as s } from "@inubekit/stack";
4
- import { Divider as T } from "@inubekit/divider";
5
- import { Button as P } from "@inubekit/button";
6
- import { useState as z, useEffect as oe } from "react";
7
- import { Text as y } from "@inubekit/text";
8
- import { Date as Q } from "@inubekit/date";
9
- import { Checkbox as le } from "@inubekit/checkbox";
10
- import { Toggle as K } from "@inubekit/toggle";
11
- import { inube as S } from "@inubekit/foundations";
12
- import b, { keyframes as de } from "styled-components";
13
- import { useFormik as ie } from "formik";
14
- import { mixed as X, object as V, number as L, string as B, date as Y, lazy as se } from "yup";
15
- import { DecisionViewConditionRenderer as q } from "@isettingkit/view";
16
- import { SkeletonLine as D } from "@inubekit/skeleton";
17
- import { MdOutlineDelete as ce, MdClear as ue, MdAdd as he } from "react-icons/md";
18
- import { Icon as Z } from "@inubekit/icon";
19
- import { createPortal as pe } from "react-dom";
20
- import { Blanket as ge } from "@inubekit/blanket";
21
- import { Grid as me } from "@inubekit/grid";
22
- import { useMediaQuery as be } from "@inubekit/hooks";
23
- const fe = (e) => {
4
+ import { Divider as w } from "@inubekit/divider";
5
+ import { Button as z } from "@inubekit/button";
6
+ import { useState as _, useEffect as te } from "react";
7
+ import { Text as x } from "@inubekit/text";
8
+ import { Date as q } from "@inubekit/date";
9
+ import { Checkbox as re } from "@inubekit/checkbox";
10
+ import { Toggle as B } from "@inubekit/toggle";
11
+ import { inube as v } from "@inubekit/foundations";
12
+ import g, { keyframes as ae } from "styled-components";
13
+ import { useFormik as ne } from "formik";
14
+ import { mixed as P, object as L, number as R, string as I, date as O, lazy as j } from "yup";
15
+ import { DecisionViewConditionRenderer as N } from "@isettingkit/view";
16
+ import { SkeletonLine as T } from "@inubekit/skeleton";
17
+ import { MdOutlineDelete as oe, MdClear as ie, MdAdd as de } from "react-icons/md";
18
+ import { Icon as Q } from "@inubekit/icon";
19
+ import { createPortal as le } from "react-dom";
20
+ import { Blanket as se } from "@inubekit/blanket";
21
+ import { Grid as ce } from "@inubekit/grid";
22
+ import { useMediaQuery as ue } from "@inubekit/hooks";
23
+ const he = (e) => {
24
24
  const {
25
25
  onHandleStartChange: t,
26
- onHandleEndChange: o,
27
- onCheckClosedChange: d,
28
- labelStart: h,
29
- labelEnd: r,
30
- checkedClosed: i = !1,
31
- required: l = !1,
32
- valueStart: u = "",
33
- valueEnd: p = "",
26
+ onHandleEndChange: a,
27
+ onCheckClosedChange: n,
28
+ labelStart: c,
29
+ labelEnd: o,
30
+ checkedClosed: l = !1,
31
+ required: i = !1,
32
+ valueStart: h = "",
33
+ valueEnd: d = "",
34
34
  messageStart: m = "",
35
- messageEnd: g = "",
36
- statusStart: v = "pending",
37
- statusEnd: w = "pending"
38
- } = e, [n, R] = z(i), [N, I] = z(u), [U, $] = z(p);
39
- return /* @__PURE__ */ c(_, { children: [
40
- /* @__PURE__ */ c(s, { direction: "row", justifyContent: "space-between", margin: "10px 0", children: [
41
- /* @__PURE__ */ a(s, { children: /* @__PURE__ */ a(
42
- y,
35
+ messageEnd: p = "",
36
+ statusStart: f = "pending",
37
+ statusEnd: S = "pending"
38
+ } = e, [A, J] = _(l), [K, X] = _(h), [Z, ee] = _(d);
39
+ return /* @__PURE__ */ u(E, { children: [
40
+ /* @__PURE__ */ u(s, { direction: "row", justifyContent: "space-between", margin: "10px 0", children: [
41
+ /* @__PURE__ */ r(s, { children: /* @__PURE__ */ r(
42
+ x,
43
43
  {
44
44
  appearance: "gray",
45
45
  margin: "10px 0",
@@ -49,66 +49,66 @@ const fe = (e) => {
49
49
  children: "Vigencia"
50
50
  }
51
51
  ) }),
52
- /* @__PURE__ */ a(
52
+ /* @__PURE__ */ r(
53
53
  s,
54
54
  {
55
55
  alignContent: "center",
56
56
  justifyContent: "center",
57
57
  wrap: "wrap",
58
58
  gap: "4px",
59
- children: /* @__PURE__ */ a(
60
- le,
59
+ children: /* @__PURE__ */ r(
60
+ re,
61
61
  {
62
62
  label: "Cerrada",
63
- onChange: ({ target: x }) => {
64
- R(x.checked), d && d(x.checked);
63
+ onChange: ({ target: y }) => {
64
+ J(y.checked), n && n(y.checked);
65
65
  },
66
- checked: n,
66
+ checked: A,
67
67
  value: ""
68
68
  }
69
69
  )
70
70
  }
71
71
  )
72
72
  ] }),
73
- /* @__PURE__ */ c(s, { justifyContent: "space-between", gap: "24px", children: [
74
- /* @__PURE__ */ a(s, { width: "189px", children: /* @__PURE__ */ a(
75
- Q,
73
+ /* @__PURE__ */ u(s, { justifyContent: "space-between", gap: "24px", children: [
74
+ /* @__PURE__ */ r(s, { width: "189px", children: /* @__PURE__ */ r(
75
+ q,
76
76
  {
77
77
  id: "dateStart",
78
- label: h,
79
- onChange: (x) => {
80
- I(x.target.value), t(x);
78
+ label: c,
79
+ onChange: (y) => {
80
+ X(y.target.value), t(y);
81
81
  },
82
- value: N,
83
- required: l,
82
+ value: K,
83
+ required: i,
84
84
  size: "compact",
85
- status: v,
85
+ status: f,
86
86
  message: m
87
87
  }
88
88
  ) }),
89
- n && /* @__PURE__ */ a(s, { width: "189px", children: /* @__PURE__ */ a(
90
- Q,
89
+ A && /* @__PURE__ */ r(s, { width: "189px", children: /* @__PURE__ */ r(
90
+ q,
91
91
  {
92
92
  id: "dateEnd",
93
- label: r,
94
- onChange: (x) => {
95
- $(x.target.value), o(x);
93
+ label: o,
94
+ onChange: (y) => {
95
+ ee(y.target.value), a(y);
96
96
  },
97
- value: U,
98
- required: l,
97
+ value: Z,
98
+ required: i,
99
99
  size: "compact",
100
- status: w,
101
- message: g
100
+ status: S,
101
+ message: p
102
102
  }
103
103
  ) })
104
104
  ] })
105
105
  ] });
106
- }, ve = b.div`
106
+ }, pe = g.div`
107
107
  & > div {
108
108
  border-radius: 8px;
109
- border: 1px solid ${S.palette.neutral.N30};
109
+ border: 1px solid ${v.palette.neutral.N30};
110
110
  }
111
- `, xe = b.div`
111
+ `, ge = g.div`
112
112
  width: 100%;
113
113
  height: 100%;
114
114
  overflow-y: auto;
@@ -125,194 +125,184 @@ const fe = (e) => {
125
125
  background-color: #ebecf0;
126
126
  border-radius: 8px;
127
127
  }
128
- `, ye = (e) => {
128
+ `, me = (e) => {
129
129
  const {
130
130
  checked: t,
131
- children: o,
132
- handleToggleChange: d,
133
- id: h,
134
- labelToggle: r,
135
- name: i,
136
- valueToggle: l = ""
137
- } = e, [u, p] = z(t), m = (g) => {
138
- p(g.target.checked), d(g);
131
+ children: a,
132
+ handleToggleChange: n,
133
+ id: c,
134
+ labelToggle: o,
135
+ name: l,
136
+ valueToggle: i = ""
137
+ } = e, [h, d] = _(t), m = (p) => {
138
+ d(p.target.checked), n(p);
139
139
  };
140
- return oe(() => {
141
- p(t);
142
- }, [t]), /* @__PURE__ */ c(_, { children: [
143
- /* @__PURE__ */ a(s, { children: /* @__PURE__ */ a(
144
- K,
140
+ return te(() => {
141
+ d(t);
142
+ }, [t]), /* @__PURE__ */ u(E, { children: [
143
+ /* @__PURE__ */ r(s, { children: /* @__PURE__ */ r(
144
+ B,
145
145
  {
146
- checked: u,
147
- id: h,
148
- name: i,
146
+ checked: h,
147
+ id: c,
148
+ name: l,
149
149
  onChange: m,
150
150
  size: "small",
151
- value: l,
152
- children: /* @__PURE__ */ a(y, { size: "medium", type: "label", weight: "bold", children: r })
151
+ value: i,
152
+ children: /* @__PURE__ */ r(x, { size: "medium", type: "label", weight: "bold", children: o })
153
153
  }
154
154
  ) }),
155
- u && /* @__PURE__ */ a(_, { children: o })
155
+ h && /* @__PURE__ */ r(E, { children: a })
156
156
  ] });
157
- }, Ce = (e) => ({
158
- schema: X().test(
157
+ }, be = (e) => ({
158
+ schema: P().test(
159
159
  "isArrayOrString",
160
160
  "Must be an array of strings/numbers or a single string",
161
161
  (t) => Array.isArray(t) ? t.every(
162
- (o) => typeof o == "string" || typeof o == "number"
162
+ (a) => typeof a == "string" || typeof a == "number"
163
163
  ) : typeof t == "string"
164
164
  ),
165
165
  value: e
166
- }), we = (e) => ({
167
- schema: X().test(
166
+ }), fe = (e) => ({
167
+ schema: P().test(
168
168
  "isArrayOrString",
169
169
  "Must be an array of strings/numbers or a single string",
170
170
  (t) => Array.isArray(t) ? t.every(
171
- (o) => typeof o == "string" || typeof o == "number"
171
+ (a) => typeof a == "string" || typeof a == "number"
172
172
  ) : typeof t == "string"
173
173
  ),
174
174
  value: e
175
- }), Se = (e) => {
176
- const t = (e == null ? void 0 : e.from) ?? 0, o = (e == null ? void 0 : e.to) ?? 0;
175
+ }), xe = (e) => {
176
+ const t = (e == null ? void 0 : e.from) ?? 0, a = (e == null ? void 0 : e.to) ?? 0;
177
177
  return {
178
- schema: V({
179
- from: L().required("Range From is required").max(o, "'Range From' cannot be greater than 'Range To'").min(0, "'Range From' cannot be less than 0"),
180
- to: L().required("Range To is required").min(t, "'Range To' cannot be less than 'Range From'").min(0, "'Range To' cannot be less than 0")
178
+ schema: L({
179
+ from: R().required("Range From is required").max(a, "'Range From' cannot be greater than 'Range To'").min(0, "'Range From' cannot be less than 0"),
180
+ to: R().min(0, "To value must be greater than or equal to 0").required("To value is required").test(
181
+ "is-greater",
182
+ "To value must be greater than From value",
183
+ function(n) {
184
+ const { from: c } = this.parent;
185
+ return n > c;
186
+ }
187
+ )
181
188
  }),
182
- value: { from: t, to: o }
189
+ value: { from: t, to: a }
183
190
  };
184
- }, j = (e, t) => t === F.PERCENTAGE ? {
185
- schema: L().required("Percentage is required").min(0, "Percentage cannot be less than 0").max(100, "Percentage cannot be greater than 100"),
191
+ }, V = (e, t) => t === k.PERCENTAGE ? {
192
+ schema: R().required("Percentage is required").min(0, "Percentage cannot be less than 0").max(100, "Percentage cannot be greater than 100"),
186
193
  value: e
187
194
  } : {
188
- schema: B().required("Required"),
195
+ schema: I().required("Required"),
189
196
  value: e
190
- }, ke = (e) => ({
191
- schema: B().required("Required").test(
197
+ }, ye = (e) => ({
198
+ schema: I().required("Required").test(
192
199
  "non-empty",
193
200
  "Value cannot be empty",
194
201
  (t) => t != null && t.trim() !== ""
195
202
  ),
196
203
  value: e
197
- }), Te = {
198
- [f.LIST_OF_VALUES]: Ce,
199
- [f.LIST_OF_VALUES_MULTI]: we,
200
- [f.RANGE]: Se,
201
- [f.GREATER_THAN]: j,
202
- [f.LESS_THAN]: j,
203
- [f.EQUAL]: j
204
- }, Ee = (e) => Te[e] || ke;
205
- function De({ decision: e, onSubmitEvent: t }) {
206
- const o = {
204
+ }), ve = {
205
+ [b.LIST_OF_VALUES]: be,
206
+ [b.LIST_OF_VALUES_MULTI]: fe,
207
+ [b.RANGE]: xe,
208
+ [b.GREATER_THAN]: V,
209
+ [b.LESS_THAN]: V,
210
+ [b.EQUAL]: V
211
+ }, M = (e) => ve[e] || ye;
212
+ function Ce({ decision: e, onSubmitEvent: t }) {
213
+ const a = {
207
214
  name: e.name || "",
208
- dataType: e.dataType || "",
215
+ dataType: e.dataType || k.ALPHABETICAL,
209
216
  valueUse: e.valueUse || "",
210
- value: e.value || { from: 0, to: 0 },
217
+ value: e.value || "",
211
218
  startDate: e.startDate || "",
212
219
  endDate: e.endDate || "",
213
220
  toggleNone: !0,
214
221
  conditions: {},
215
222
  checkClosed: !1
216
- }, d = V({
217
- name: B().required("Name is required"),
218
- startDate: Y().required("Start date is required"),
219
- endDate: Y().when("checkClosed", (i, l, { parent: u }) => (u == null ? void 0 : u.checkClosed) ? l.required("End date is required").test(
223
+ }, n = L({
224
+ name: I().required("Name is required"),
225
+ startDate: O().required("Start date is required"),
226
+ endDate: O().when("checkClosed", (l, i, { parent: h }) => (h == null ? void 0 : h.checkClosed) ? i.required("End date is required").test(
220
227
  "is-after-startDate",
221
228
  "End date must be greater than or equal to Start date",
222
229
  function(m) {
223
- const g = this.parent.startDate;
224
- return !g || !m ? !0 : new Date(m) >= new Date(g);
230
+ const p = this.parent.startDate;
231
+ return !p || !m ? !0 : new Date(m) >= new Date(p);
225
232
  }
226
- ) : l.notRequired()),
227
- value: V({
228
- from: L().min(0, "From value must be greater than or equal to 0").required("From value is required"),
229
- to: L().min(0, "To value must be greater than or equal to 0").required("To value is required").test(
230
- "is-greater",
231
- "To value must be greater than From value",
232
- function(i) {
233
- const { from: l } = this.parent;
234
- return i > l;
235
- }
236
- )
237
- }).required("Range value is required"),
238
- conditions: se((i, { parent: l }) => {
239
- var p, m;
240
- return (l == null ? void 0 : l.toggleNone) && ((p = l == null ? void 0 : l.conditions) == null ? void 0 : p.length) > 0 ? V().shape({}) : V(
233
+ ) : i.notRequired()),
234
+ value: j(() => M(c.values.valueUse)(c.values.value, c.values.dataType).schema),
235
+ conditions: j((l, { parent: i }) => {
236
+ var d, m;
237
+ return (i == null ? void 0 : i.toggleNone) && ((d = i == null ? void 0 : i.conditions) == null ? void 0 : d.length) > 0 ? L().shape({}) : L(
241
238
  (m = e.conditions) == null ? void 0 : m.reduce(
242
- (g, v) => {
243
- if (h.values.conditions[v.name] !== void 0) {
244
- const w = Ee(v.valueUse);
245
- g[v.name] = w(
246
- v.value,
247
- v.dataType
239
+ (p, f) => {
240
+ if (c.values.conditions[f.name] !== void 0) {
241
+ const S = M(f.valueUse);
242
+ p[f.name] = S(
243
+ f.value,
244
+ f.dataType
248
245
  ).schema;
249
246
  }
250
- return g;
247
+ return p;
251
248
  },
252
249
  {}
253
250
  )
254
251
  );
255
252
  })
256
- }), h = ie({
257
- initialValues: o,
258
- validationSchema: d,
253
+ }), c = ne({
254
+ initialValues: a,
255
+ validationSchema: n,
259
256
  validateOnBlur: !0,
260
- onSubmit: (i) => {
261
- var u;
262
- const l = {
257
+ onSubmit: (l) => {
258
+ var h;
259
+ const i = {
263
260
  ...e,
264
- name: i.name,
265
- dataType: i.dataType,
266
- valueUse: i.valueUse,
267
- value: i.value,
268
- startDate: i.startDate,
269
- endDate: i.endDate,
270
- conditions: (u = e.conditions) == null ? void 0 : u.map((p) => ({
271
- ...p,
272
- value: i.conditions[p.name]
261
+ name: l.name,
262
+ dataType: l.dataType,
263
+ valueUse: l.valueUse,
264
+ value: l.value,
265
+ startDate: l.startDate,
266
+ endDate: l.endDate,
267
+ conditions: (h = e.conditions) == null ? void 0 : h.map((d) => ({
268
+ ...d,
269
+ value: l.conditions[d.name]
273
270
  }))
274
271
  };
275
- t(l);
272
+ t(i);
276
273
  }
277
274
  });
278
- return { formik: h, handleToggleNoneChange: (i) => {
279
- var l;
280
- h.setFieldValue("toggleNone", i), (l = e.conditions) == null || l.forEach((u) => {
281
- if (i)
282
- h.setFieldValue(`conditions.${u.name}`, void 0);
275
+ return { formik: c, handleToggleNoneChange: (l) => {
276
+ var i;
277
+ c.setFieldValue("toggleNone", l), (i = e.conditions) == null || i.forEach((h) => {
278
+ if (l)
279
+ c.setFieldValue(`conditions.${h.name}`, void 0);
283
280
  else {
284
- const p = u.valueUse === f.LIST_OF_VALUES_MULTI ? [] : "";
285
- h.setFieldValue(`conditions.${u.name}`, p);
281
+ const d = h.valueUse === b.LIST_OF_VALUES_MULTI ? [] : "";
282
+ c.setFieldValue(`conditions.${h.name}`, d);
286
283
  }
287
284
  });
288
285
  } };
289
286
  }
290
- const Ae = (e) => {
291
- var l, u, p, m, g, v, w;
292
- const { decision: t, onSubmitEvent: o, textValues: d, onCancel: h } = e, { formik: r, handleToggleNoneChange: i } = De({
287
+ const we = (e) => {
288
+ var h;
289
+ const { decision: t, onSubmitEvent: a, textValues: n, onCancel: c } = e, { formik: o, handleToggleNoneChange: l } = Ce({
293
290
  decision: t,
294
- onSubmitEvent: o
295
- });
296
- return /* @__PURE__ */ a("form", { onSubmit: r.handleSubmit, children: /* @__PURE__ */ c(s, { direction: "column", gap: "24px", children: [
297
- /* @__PURE__ */ a(
298
- ae,
299
- {
300
- id: "valueRange",
301
- typeInput: t.dataType.toLowerCase(),
302
- label: t.name,
303
- valueFrom: r.values.value.from,
304
- valueTo: r.values.value.to,
305
- handleInputChangeFrom: (n) => r.setFieldValue("value.from", n),
306
- handleInputChangeTo: (n) => r.setFieldValue("value.to", n),
307
- messageFrom: (l = r.errors.value) == null ? void 0 : l.from,
308
- messageTo: (u = r.errors.value) == null ? void 0 : u.to,
309
- statusFrom: (p = r.touched.value) != null && p.from ? (m = r.errors.value) != null && m.from ? "invalid" : "valid" : "pending",
310
- statusTo: (g = r.touched.value) != null && g.to ? (v = r.errors.value) != null && v.to ? "invalid" : "valid" : "pending",
311
- onBlur: r.handleBlur
312
- }
313
- ),
314
- /* @__PURE__ */ a(T, { dashed: !0 }),
315
- /* @__PURE__ */ a(ve, { children: /* @__PURE__ */ a(xe, { children: /* @__PURE__ */ c(
291
+ onSubmitEvent: a
292
+ }), i = {
293
+ name: t.name,
294
+ valueUse: t.valueUse,
295
+ dataType: t.dataType,
296
+ possibleValue: t.possibleValue
297
+ };
298
+ return /* @__PURE__ */ r("form", { onSubmit: o.handleSubmit, children: /* @__PURE__ */ u(s, { direction: "column", gap: "24px", children: [
299
+ $({
300
+ condition: i,
301
+ formik: o,
302
+ isDecision: !0
303
+ }),
304
+ /* @__PURE__ */ r(w, { dashed: !0 }),
305
+ /* @__PURE__ */ r(pe, { children: /* @__PURE__ */ r(ge, { children: /* @__PURE__ */ u(
316
306
  s,
317
307
  {
318
308
  direction: "column",
@@ -320,133 +310,91 @@ const Ae = (e) => {
320
310
  gap: "16px",
321
311
  height: "272px",
322
312
  children: [
323
- /* @__PURE__ */ c(s, { direction: "row", justifyContent: "space-between", children: [
324
- /* @__PURE__ */ a(y, { children: d.factsThatConditionIt }),
325
- /* @__PURE__ */ a(
326
- K,
327
- {
328
- id: "toggleNone",
329
- onChange: () => i(!r.values.toggleNone),
330
- checked: r.values.toggleNone,
331
- size: "small",
332
- children: /* @__PURE__ */ a(y, { size: "medium", type: "label", weight: "bold", children: d.none })
333
- }
334
- )
335
- ] }),
336
- /* @__PURE__ */ a(s, { direction: "column", gap: "20px", children: (w = t.conditions) == null ? void 0 : w.map((n) => {
337
- var R, N, I, U, $, M, O;
338
- return /* @__PURE__ */ a(
339
- ye,
340
- {
341
- id: `toggle-${n.name}`,
342
- name: `toggle.${n.name}`,
343
- labelToggle: n.name,
344
- checked: !r.values.toggleNone && r.values.conditions[n.name] !== void 0,
345
- handleToggleChange: (C) => {
346
- if (!C.target.checked)
347
- r.setFieldValue(
348
- `conditions.${n.name}`,
349
- void 0
350
- ), r.setFieldTouched(
351
- `conditions.${n.name}`,
352
- !1,
353
- !1
354
- );
355
- else {
356
- const E = n.valueUse === f.LIST_OF_VALUES_MULTI ? [] : "";
357
- r.setFieldValue(
358
- `conditions.${n.name}`,
359
- E
360
- );
361
- }
362
- },
363
- children: n.valueUse === f.LIST_OF_VALUES_MULTI ? /* @__PURE__ */ a(
364
- re,
365
- {
366
- id: n.name,
367
- labelSelect: n.name,
368
- labelSelected: `Selected ${n.name}`,
369
- options: (N = (R = n.possibleValue) == null ? void 0 : R.list) == null ? void 0 : N.map((C) => ({
370
- id: C,
371
- label: C,
372
- checked: (r.values.conditions[n.name] || []).includes(C)
373
- })),
374
- onHandleSelectCheckChange: (C) => {
375
- const x = C.filter((E) => E.checked).map((E) => E.id);
376
- r.setFieldValue(
377
- `conditions.${n.name}`,
378
- x
379
- ), r.setFieldTouched(
380
- `conditions.${n.name}`,
381
- !0,
382
- !0
383
- );
384
- },
385
- placeholderSelect: `Select ${n.name}`,
386
- message: (I = r.touched.conditions) != null && I[n.name] && ((U = r.errors.conditions) != null && U[n.name]) ? r.errors.conditions[n.name] : void 0,
387
- onBlur: () => r.setFieldTouched(
388
- `conditions.${n.name}`,
389
- !0,
390
- !0
391
- )
392
- }
393
- ) : /* @__PURE__ */ a(
394
- ne,
313
+ /* @__PURE__ */ u(
314
+ s,
315
+ {
316
+ justifyContent: "space-between",
317
+ alignItems: "center",
318
+ gap: "64px",
319
+ children: [
320
+ /* @__PURE__ */ r(x, { type: "title", size: "small", weight: "bold", appearance: "gray", children: n.factsThatConditionIt }),
321
+ /* @__PURE__ */ r(
322
+ B,
395
323
  {
396
- type: n.dataType.toLowerCase(),
397
- name: `conditions.${n.name}`,
398
- label: n.name,
399
- value: r.values.conditions[n.name],
400
- onChange: (C) => r.setFieldValue(
401
- `conditions.${n.name}`,
402
- C
403
- ),
404
- messageValidate: String(
405
- ($ = r.errors.conditions) == null ? void 0 : $[n.name]
406
- ),
407
- statusValidate: (M = r.touched.conditions) != null && M[n.name] ? (O = r.errors.conditions) != null && O[n.name] ? "invalid" : "valid" : void 0,
408
- onBlur: r.handleBlur
324
+ id: "toggleNone",
325
+ onChange: () => l(!o.values.toggleNone),
326
+ checked: o.values.toggleNone,
327
+ size: "small",
328
+ children: /* @__PURE__ */ r(x, { size: "medium", type: "label", weight: "bold", children: n.none })
409
329
  }
410
330
  )
331
+ ]
332
+ }
333
+ ),
334
+ /* @__PURE__ */ r(s, { direction: "column", gap: "20px", children: (h = t.conditions) == null ? void 0 : h.map((d) => /* @__PURE__ */ r(
335
+ me,
336
+ {
337
+ id: `toggle-${d.name}`,
338
+ name: `toggle.${d.name}`,
339
+ labelToggle: d.name,
340
+ checked: !o.values.toggleNone && o.values.conditions[d.name] !== void 0,
341
+ handleToggleChange: (m) => {
342
+ if (!m.target.checked)
343
+ o.setFieldValue(
344
+ `conditions.${d.name}`,
345
+ void 0
346
+ ), o.setFieldTouched(
347
+ `conditions.${d.name}`,
348
+ !1,
349
+ !1
350
+ );
351
+ else {
352
+ const f = d.valueUse === b.LIST_OF_VALUES_MULTI ? [] : "";
353
+ o.setFieldValue(
354
+ `conditions.${d.name}`,
355
+ f
356
+ );
357
+ }
411
358
  },
412
- n.name
413
- );
414
- }) })
359
+ children: $({ condition: d, formik: o })
360
+ },
361
+ d.name
362
+ )) })
415
363
  ]
416
364
  }
417
365
  ) }) }),
418
- /* @__PURE__ */ a(T, { dashed: !0 }),
419
- /* @__PURE__ */ a(
420
- fe,
366
+ /* @__PURE__ */ r(w, { dashed: !0 }),
367
+ /* @__PURE__ */ r(
368
+ he,
421
369
  {
422
- labelStart: d.termStart,
423
- labelEnd: d.termEnd,
424
- valueStart: r.values.startDate,
425
- valueEnd: r.values.endDate,
426
- messageStart: r.errors.startDate,
427
- messageEnd: r.errors.endDate,
428
- statusStart: r.touched.startDate ? r.errors.startDate ? "invalid" : "valid" : void 0,
429
- statusEnd: r.touched.endDate ? r.errors.endDate ? "invalid" : "valid" : void 0,
430
- onHandleStartChange: (n) => r.setFieldValue("startDate", n.target.value),
431
- onHandleEndChange: (n) => r.setFieldValue("endDate", n.target.value),
432
- onCheckClosedChange: (n) => {
433
- r.setFieldValue("checkClosed", n), n && r.setFieldValue("endDate", "");
370
+ labelStart: n.termStart,
371
+ labelEnd: n.termEnd,
372
+ valueStart: o.values.startDate,
373
+ valueEnd: o.values.endDate,
374
+ messageStart: o.errors.startDate,
375
+ messageEnd: o.errors.endDate,
376
+ statusStart: o.touched.startDate ? o.errors.startDate ? "invalid" : "valid" : void 0,
377
+ statusEnd: o.touched.endDate ? o.errors.endDate ? "invalid" : "valid" : void 0,
378
+ onHandleStartChange: (d) => o.setFieldValue("startDate", d.target.value),
379
+ onHandleEndChange: (d) => o.setFieldValue("endDate", d.target.value),
380
+ onCheckClosedChange: (d) => {
381
+ o.setFieldValue("checkClosed", d), d && o.setFieldValue("endDate", "");
434
382
  },
435
- checkedClosed: r.values.checkClosed
383
+ checkedClosed: o.values.checkClosed
436
384
  }
437
385
  ),
438
- /* @__PURE__ */ a(T, {}),
439
- /* @__PURE__ */ c(s, { direction: "row", justifyContent: "end", gap: "16px", children: [
440
- /* @__PURE__ */ a(P, { appearance: "gray", onClick: h, children: d.cancel }),
441
- /* @__PURE__ */ a(P, { type: "submit", children: d.confirm })
386
+ /* @__PURE__ */ r(w, {}),
387
+ /* @__PURE__ */ u(s, { direction: "row", justifyContent: "end", gap: "16px", children: [
388
+ /* @__PURE__ */ r(z, { appearance: "gray", onClick: c, children: n.cancel }),
389
+ /* @__PURE__ */ r(z, { type: "submit", children: n.confirm })
442
390
  ] })
443
391
  ] }) });
444
- }, W = b.div`
392
+ }, H = g.div`
445
393
  & > div {
446
394
  border-radius: 8px;
447
- border: 1px solid ${S.palette.neutral.N30};
395
+ border: 1px solid ${v.palette.neutral.N30};
448
396
  }
449
- `, J = b.div`
397
+ `, G = g.div`
450
398
  width: 100%;
451
399
  height: 100%;
452
400
  overflow-y: auto;
@@ -464,41 +412,41 @@ const Ae = (e) => {
464
412
  background-color: #ebecf0;
465
413
  border-radius: 8px;
466
414
  }
467
- `, Fe = (e) => e.value, Ve = (e) => e.value, _e = (e) => ({
415
+ `, ke = (e) => e.value, Se = (e) => e.value, Te = (e) => ({
468
416
  from: e.from ?? "",
469
417
  to: e.to ?? ""
470
- }), Le = (e) => e.value, Re = (e) => e.value, Ne = (e) => e.value;
471
- var k = /* @__PURE__ */ ((e) => (e.EQUAL = "equal", e.GREATER_THAN = "greater_than", e.LESS_THAN = "less_than", e.LIST_OF_VALUES = "list_of_values", e.LIST_OF_VALUES_MULTI = "list_of_values_multi", e.RANGE = "range", e))(k || {});
472
- const Ie = (e) => e.value, Ue = {
473
- [k.LIST_OF_VALUES]: Fe,
474
- [k.LIST_OF_VALUES_MULTI]: Ve,
475
- [k.RANGE]: _e,
476
- [k.GREATER_THAN]: Le,
477
- [k.LESS_THAN]: Re,
478
- [k.EQUAL]: Ne
418
+ }), De = (e) => e.value, Ee = (e) => e.value, Ae = (e) => e.value;
419
+ var C = /* @__PURE__ */ ((e) => (e.EQUAL = "equal", e.GREATER_THAN = "greater_than", e.LESS_THAN = "less_than", e.LIST_OF_VALUES = "list_of_values", e.LIST_OF_VALUES_MULTI = "list_of_values_multi", e.RANGE = "range", e))(C || {});
420
+ const Ne = (e) => e.value, _e = {
421
+ [C.LIST_OF_VALUES]: ke,
422
+ [C.LIST_OF_VALUES_MULTI]: Se,
423
+ [C.RANGE]: Te,
424
+ [C.GREATER_THAN]: De,
425
+ [C.LESS_THAN]: Ee,
426
+ [C.EQUAL]: Ae
479
427
  };
480
- function A(e) {
481
- const t = e == null ? void 0 : e.value, o = typeof t == "object" && t !== null && !Array.isArray(t), d = Ue[e == null ? void 0 : e.valueUse] || Ie;
482
- return o && d(t) || t || void 0;
428
+ function D(e) {
429
+ const t = e == null ? void 0 : e.value, a = typeof t == "object" && t !== null && !Array.isArray(t), n = _e[e == null ? void 0 : e.valueUse] || Ne;
430
+ return a && n(t) || t || void 0;
483
431
  }
484
- const ee = (e) => {
485
- const { decision: t, loading: o = !1, textValues: d } = e, h = (i) => i && Object.keys(i).length > 0, r = {
432
+ const Y = (e) => {
433
+ const { decision: t, loading: a = !1, textValues: n } = e, c = (l) => l && Object.keys(l).length > 0, o = {
486
434
  name: (t == null ? void 0 : t.name) || "",
487
435
  dataType: (t == null ? void 0 : t.dataType) || "alphabetical",
488
- value: A(t),
436
+ value: D(t),
489
437
  valueUse: (t == null ? void 0 : t.valueUse) || "equal"
490
438
  };
491
- return !o && t && d ? /* @__PURE__ */ c(s, { direction: "column", gap: "12px", children: [
492
- t && /* @__PURE__ */ a(s, { direction: "column", alignItems: "center", children: /* @__PURE__ */ a(
493
- q,
439
+ return !a && t && n ? /* @__PURE__ */ u(s, { direction: "column", gap: "12px", children: [
440
+ t && /* @__PURE__ */ r(s, { direction: "column", alignItems: "center", children: /* @__PURE__ */ r(
441
+ N,
494
442
  {
495
- element: r,
496
- valueData: A(r),
443
+ element: o,
444
+ valueData: D(o),
497
445
  type: "decision"
498
446
  }
499
447
  ) }, t.name),
500
- /* @__PURE__ */ a(T, { dashed: !0 }),
501
- /* @__PURE__ */ a(J, { children: /* @__PURE__ */ c(
448
+ /* @__PURE__ */ r(w, { dashed: !0 }),
449
+ /* @__PURE__ */ r(G, { children: /* @__PURE__ */ u(
502
450
  s,
503
451
  {
504
452
  direction: "column",
@@ -506,95 +454,95 @@ const ee = (e) => {
506
454
  justifyContent: "space-between",
507
455
  height: "203px",
508
456
  children: [
509
- /* @__PURE__ */ a(
510
- y,
457
+ /* @__PURE__ */ r(
458
+ x,
511
459
  {
512
460
  type: "label",
513
461
  size: "large",
514
462
  appearance: "dark",
515
463
  weight: "bold",
516
464
  textAlign: "center",
517
- children: d.factsThatConditionIt
465
+ children: n.factsThatConditionIt
518
466
  }
519
467
  ),
520
- t.conditions && t.conditions.map((i) => {
521
- if (i.hidden) return null;
522
- const l = i.value;
523
- return (typeof l == "object" && h(l) || l !== void 0 && typeof l == "string" && l.length > 0) && /* @__PURE__ */ a(W, { children: /* @__PURE__ */ a(s, { direction: "column", padding: "8px", children: /* @__PURE__ */ a(
524
- q,
468
+ t.conditions && t.conditions.map((l) => {
469
+ if (l.hidden) return null;
470
+ const i = l.value;
471
+ return (typeof i == "object" && c(i) || i !== void 0 && typeof i == "string" && i.length > 0) && /* @__PURE__ */ r(H, { children: /* @__PURE__ */ r(s, { direction: "column", padding: "8px", children: /* @__PURE__ */ r(
472
+ N,
525
473
  {
526
474
  element: {
527
- ...i,
528
- value: l
475
+ ...l,
476
+ value: i
529
477
  },
530
- valueData: A(i)
478
+ valueData: D(l)
531
479
  }
532
- ) }) }, i.name);
480
+ ) }) }, l.name);
533
481
  }),
534
- /* @__PURE__ */ a(T, { dashed: !0 }),
535
- /* @__PURE__ */ c(s, { direction: "column", gap: "12px", children: [
536
- (t == null ? void 0 : t.startDate) && (t == null ? void 0 : t.endDate) && /* @__PURE__ */ a(
537
- q,
482
+ /* @__PURE__ */ r(w, { dashed: !0 }),
483
+ /* @__PURE__ */ u(s, { direction: "column", gap: "12px", children: [
484
+ (t == null ? void 0 : t.startDate) && (t == null ? void 0 : t.endDate) && /* @__PURE__ */ r(
485
+ N,
538
486
  {
539
487
  element: {
540
- name: d.terms,
488
+ name: n.terms,
541
489
  value: String(t.startDate),
542
- valueUse: f.RANGE,
543
- dataType: F.DATE
490
+ valueUse: b.RANGE,
491
+ dataType: k.DATE
544
492
  },
545
- valueData: A({
546
- name: d.terms,
493
+ valueData: D({
494
+ name: n.terms,
547
495
  value: {
548
496
  from: String(t.startDate),
549
497
  to: String(t.endDate)
550
498
  },
551
- valueUse: f.RANGE,
552
- dataType: F.DATE
499
+ valueUse: b.RANGE,
500
+ dataType: k.DATE
553
501
  }),
554
502
  type: "decision"
555
503
  },
556
- d.terms
504
+ n.terms
557
505
  ),
558
- (t == null ? void 0 : t.startDate) && !(t != null && t.endDate) && /* @__PURE__ */ a(
559
- q,
506
+ (t == null ? void 0 : t.startDate) && !(t != null && t.endDate) && /* @__PURE__ */ r(
507
+ N,
560
508
  {
561
509
  element: {
562
- name: d.terms,
510
+ name: n.terms,
563
511
  value: String(t.startDate),
564
- valueUse: f.EQUAL,
565
- dataType: F.DATE
512
+ valueUse: b.EQUAL,
513
+ dataType: k.DATE
566
514
  },
567
- valueData: A({
568
- name: d.terms,
515
+ valueData: D({
516
+ name: n.terms,
569
517
  value: String(t.startDate),
570
- valueUse: f.EQUAL,
571
- dataType: F.DATE
518
+ valueUse: b.EQUAL,
519
+ dataType: k.DATE
572
520
  }),
573
521
  type: "decision"
574
522
  },
575
- d.terms
523
+ n.terms
576
524
  )
577
525
  ] })
578
526
  ]
579
527
  }
580
528
  ) })
581
- ] }) : /* @__PURE__ */ c(s, { direction: "column", gap: "12px", children: [
582
- /* @__PURE__ */ c(s, { direction: "column", alignItems: "center", gap: "4px", children: [
583
- /* @__PURE__ */ a(D, { animated: !0, width: "180px" }),
584
- /* @__PURE__ */ a(D, { animated: !0, width: "85px" })
529
+ ] }) : /* @__PURE__ */ u(s, { direction: "column", gap: "12px", children: [
530
+ /* @__PURE__ */ u(s, { direction: "column", alignItems: "center", gap: "4px", children: [
531
+ /* @__PURE__ */ r(T, { animated: !0, width: "180px" }),
532
+ /* @__PURE__ */ r(T, { animated: !0, width: "85px" })
585
533
  ] }, "loading"),
586
- /* @__PURE__ */ c(s, { direction: "column", gap: "12px", alignItems: "center", children: [
587
- /* @__PURE__ */ a(T, { dashed: !0 }),
588
- /* @__PURE__ */ a(D, { animated: !0, width: "150px" })
534
+ /* @__PURE__ */ u(s, { direction: "column", gap: "12px", alignItems: "center", children: [
535
+ /* @__PURE__ */ r(w, { dashed: !0 }),
536
+ /* @__PURE__ */ r(T, { animated: !0, width: "150px" })
589
537
  ] }),
590
- /* @__PURE__ */ a(J, { children: /* @__PURE__ */ a(
538
+ /* @__PURE__ */ r(G, { children: /* @__PURE__ */ r(
591
539
  s,
592
540
  {
593
541
  direction: "column",
594
542
  gap: "12px",
595
543
  justifyContent: "space-between",
596
544
  height: "203px",
597
- children: Array.from({ length: 5 }).map((i, l) => /* @__PURE__ */ a(W, { children: /* @__PURE__ */ c(
545
+ children: Array.from({ length: 5 }).map((l, i) => /* @__PURE__ */ r(H, { children: /* @__PURE__ */ u(
598
546
  s,
599
547
  {
600
548
  direction: "column",
@@ -602,17 +550,17 @@ const ee = (e) => {
602
550
  alignItems: "start",
603
551
  padding: "8px",
604
552
  children: [
605
- /* @__PURE__ */ a(D, { animated: !0, width: "180px" }),
606
- /* @__PURE__ */ a(D, { animated: !0, width: "85px" })
553
+ /* @__PURE__ */ r(T, { animated: !0, width: "180px" }),
554
+ /* @__PURE__ */ r(T, { animated: !0, width: "85px" })
607
555
  ]
608
556
  }
609
- ) }, `condition-${l}`))
557
+ ) }, `condition-${i}`))
610
558
  }
611
559
  ) })
612
560
  ] });
613
- }, $e = b.div`
561
+ }, Le = g.div`
614
562
  border-radius: 8px;
615
- border: 1px solid ${S.palette.neutral.N30};
563
+ border: 1px solid ${v.palette.neutral.N30};
616
564
  box-sizing: border-box;
617
565
  display: flex;
618
566
  flex-direction: column;
@@ -622,7 +570,7 @@ const ee = (e) => {
622
570
  height: 100%;
623
571
  box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
624
572
  `;
625
- b.div`
573
+ g.div`
626
574
  width: 100%;
627
575
  height: 100%;
628
576
  overflow-y: auto;
@@ -641,35 +589,35 @@ b.div`
641
589
  border-radius: 8px;
642
590
  }
643
591
  `;
644
- const G = (e) => {
645
- const { children: t, controls: o = !0, handleDelete: d, id: h } = e;
646
- return /* @__PURE__ */ a($e, { children: /* @__PURE__ */ c(s, { direction: "column", gap: "16px", padding: "12px 16px", children: [
592
+ const F = (e) => {
593
+ const { children: t, controls: a = !0, handleDelete: n, id: c } = e;
594
+ return /* @__PURE__ */ r(Le, { children: /* @__PURE__ */ u(s, { direction: "column", gap: "16px", padding: "12px 16px", children: [
647
595
  t,
648
- o && /* @__PURE__ */ c(_, { children: [
649
- /* @__PURE__ */ a(T, {}),
650
- /* @__PURE__ */ a(s, { gap: "16px", justifyContent: "end", children: /* @__PURE__ */ a(
651
- Z,
596
+ a && /* @__PURE__ */ u(E, { children: [
597
+ /* @__PURE__ */ r(w, {}),
598
+ /* @__PURE__ */ r(s, { gap: "16px", justifyContent: "end", children: /* @__PURE__ */ r(
599
+ Q,
652
600
  {
653
601
  cursorHover: !0,
654
602
  appearance: "dark",
655
603
  size: "24px",
656
- icon: /* @__PURE__ */ a(ce, {}),
604
+ icon: /* @__PURE__ */ r(oe, {}),
657
605
  onClick: () => {
658
- d(h);
606
+ n(c);
659
607
  }
660
608
  }
661
609
  ) })
662
610
  ] })
663
611
  ] }) });
664
- }, qe = b.div`
612
+ }, Ve = g.div`
665
613
  position: relative;
666
614
  & > div {
667
615
  padding: 24px 16px;
668
616
  }
669
- `, ze = b.div`
617
+ `, Re = g.div`
670
618
  background-color: ${({ theme: e }) => {
671
- var t, o;
672
- return ((o = (t = e == null ? void 0 : e.palette) == null ? void 0 : t.neutral) == null ? void 0 : o.N0) || S.palette.neutral.N0;
619
+ var t, a;
620
+ return ((a = (t = e == null ? void 0 : e.palette) == null ? void 0 : t.neutral) == null ? void 0 : a.N0) || v.palette.neutral.N0;
673
621
  }};
674
622
  max-width: 450px;
675
623
  max-height: 90vh;
@@ -697,23 +645,23 @@ const G = (e) => {
697
645
  background-color: #ebecf0;
698
646
  border-radius: 8px;
699
647
  }
700
- `, Me = (e) => {
701
- const { children: t, portalId: o, onCloseModal: d, title: h } = e, r = document.getElementById(o);
702
- if (!r)
648
+ `, Ue = (e) => {
649
+ const { children: t, portalId: a, onCloseModal: n, title: c } = e, o = document.getElementById(a);
650
+ if (!o)
703
651
  throw new Error(
704
652
  "The portal node is not defined. This can occur when the specific node used to render the portal has not been defined correctly."
705
653
  );
706
- return pe(
707
- /* @__PURE__ */ a(qe, { children: /* @__PURE__ */ a(ge, { children: /* @__PURE__ */ a(ze, { children: /* @__PURE__ */ c(s, { direction: "column", gap: "24px", children: [
708
- /* @__PURE__ */ a(s, { direction: "column", gap: "24px", children: /* @__PURE__ */ c(s, { alignItems: "center", justifyContent: "space-between", children: [
709
- /* @__PURE__ */ a(y, { type: "title", size: "large", appearance: "dark", weight: "bold", children: h }),
710
- /* @__PURE__ */ a(ue, { size: "24px", cursor: "pointer", onClick: d })
654
+ return le(
655
+ /* @__PURE__ */ r(Ve, { children: /* @__PURE__ */ r(se, { children: /* @__PURE__ */ r(Re, { children: /* @__PURE__ */ u(s, { direction: "column", gap: "24px", children: [
656
+ /* @__PURE__ */ r(s, { direction: "column", gap: "24px", children: /* @__PURE__ */ u(s, { alignItems: "center", justifyContent: "space-between", children: [
657
+ /* @__PURE__ */ r(x, { type: "title", size: "large", appearance: "dark", weight: "bold", children: c }),
658
+ /* @__PURE__ */ r(ie, { size: "24px", cursor: "pointer", onClick: n })
711
659
  ] }) }),
712
660
  t
713
661
  ] }) }) }) }),
714
- r
662
+ o
715
663
  );
716
- }, Oe = de`
664
+ }, Ie = ae`
717
665
  from {
718
666
  opacity: 0;
719
667
  transform: translateY(20px);
@@ -722,16 +670,16 @@ const G = (e) => {
722
670
  opacity: 1;
723
671
  transform: translateY(0);
724
672
  }
725
- `, te = b.div`
673
+ `, W = g.div`
726
674
  width: 100%;
727
675
  height: 100%;
728
676
  & > div {
729
- animation: ${Oe} 600ms ease-out;
677
+ animation: ${Ie} 600ms ease-out;
730
678
  }
731
679
  `;
732
- b.div`
680
+ g.div`
733
681
  border-radius: 8px;
734
- border: 1px solid ${S.palette.neutral.N30};
682
+ border: 1px solid ${v.palette.neutral.N30};
735
683
  box-sizing: border-box;
736
684
  display: flex;
737
685
  flex-direction: column;
@@ -741,7 +689,7 @@ b.div`
741
689
  height: 100%;
742
690
  box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
743
691
  `;
744
- const je = b.div`
692
+ const Fe = g.div`
745
693
  & > div {
746
694
  width: 100%;
747
695
  height: 100%;
@@ -761,16 +709,16 @@ const je = b.div`
761
709
  border-radius: 8px;
762
710
  }
763
711
  }
764
- `, He = b.div`
712
+ `, $e = g.div`
765
713
  & > div > div {
766
714
  border-radius: 8px;
767
- border: 1px solid ${S.palette.neutral.N30};
715
+ border: 1px solid ${v.palette.neutral.N30};
768
716
  box-sizing: border-box;
769
717
  box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
770
718
  }
771
- `, Be = b.div`
719
+ `, ze = g.div`
772
720
  & > div {
773
- background-color: ${S.palette.neutral.N30};
721
+ background-color: ${v.palette.neutral.N30};
774
722
  justify-content: center;
775
723
  }
776
724
  min-height: 300px;
@@ -778,139 +726,139 @@ const je = b.div`
778
726
  height: 100%;
779
727
  padding-bottom: 12px;
780
728
  `;
781
- b.div`
729
+ g.div`
782
730
  & > div {
783
731
  border-radius: 8px;
784
- border: 1px solid ${S.palette.neutral.N30};
732
+ border: 1px solid ${v.palette.neutral.N30};
785
733
  }
786
734
  `;
787
- function Ge({
735
+ function qe({
788
736
  index: e,
789
737
  handleOpenModal: t
790
738
  }) {
791
- return /* @__PURE__ */ a(
792
- G,
739
+ return /* @__PURE__ */ r(
740
+ F,
793
741
  {
794
742
  id: `loading-card-${e}`,
795
743
  handleDelete: () => {
796
744
  },
797
745
  handleView: () => t(),
798
746
  controls: !1,
799
- children: /* @__PURE__ */ a(ee, { loading: !0 })
747
+ children: /* @__PURE__ */ r(Y, { loading: !0 })
800
748
  },
801
749
  `loading-card-${e}`
802
750
  );
803
751
  }
804
- function Pe({
752
+ function Oe({
805
753
  decision: e,
806
754
  controls: t,
807
- handleOpenModal: o,
808
- handleDelete: d,
809
- textValues: h
755
+ handleOpenModal: a,
756
+ handleDelete: n,
757
+ textValues: c
810
758
  }) {
811
- return e ? /* @__PURE__ */ a(te, { children: /* @__PURE__ */ c(s, { direction: "column", gap: "4px", width: "100%", padding: "0 0 12px 0", children: [
812
- /* @__PURE__ */ a(y, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: e.id }),
813
- /* @__PURE__ */ a(
814
- G,
759
+ return e ? /* @__PURE__ */ r(W, { children: /* @__PURE__ */ u(s, { direction: "column", gap: "4px", width: "100%", padding: "0 0 12px 0", children: [
760
+ /* @__PURE__ */ r(x, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: e.id }),
761
+ /* @__PURE__ */ r(
762
+ F,
815
763
  {
816
764
  id: e.id,
817
- handleDelete: () => d(e.id),
818
- handleView: () => o(e),
765
+ handleDelete: () => n(e.id),
766
+ handleView: () => a(e),
819
767
  controls: t,
820
- children: /* @__PURE__ */ a(ee, { decision: e, textValues: h })
768
+ children: /* @__PURE__ */ r(Y, { decision: e, textValues: c })
821
769
  }
822
770
  )
823
771
  ] }) }, e.id) : null;
824
772
  }
825
- function Qe({
773
+ function je({
826
774
  index: e,
827
775
  handleOpenModal: t
828
776
  }) {
829
- return /* @__PURE__ */ a(te, { children: /* @__PURE__ */ c(s, { direction: "column", gap: "4px", width: "100%", height: "100%", children: [
830
- /* @__PURE__ */ a(y, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: "Nueva decisión" }),
831
- /* @__PURE__ */ a(Be, { onClick: () => t(), children: /* @__PURE__ */ a(
832
- G,
777
+ return /* @__PURE__ */ r(W, { children: /* @__PURE__ */ u(s, { direction: "column", gap: "4px", width: "100%", height: "100%", children: [
778
+ /* @__PURE__ */ r(x, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: "Nueva decisión" }),
779
+ /* @__PURE__ */ r(ze, { onClick: () => t(), children: /* @__PURE__ */ r(
780
+ F,
833
781
  {
834
782
  id: `add-decision-${e}`,
835
783
  handleDelete: () => {
836
784
  },
837
785
  handleView: () => t(),
838
786
  controls: !1,
839
- children: /* @__PURE__ */ c(s, { direction: "column", gap: "12px", alignItems: "center", children: [
840
- /* @__PURE__ */ a(Z, { appearance: "gray", icon: /* @__PURE__ */ a(he, {}), size: "35px" }),
841
- /* @__PURE__ */ a(y, { appearance: "gray", type: "body", size: "large", children: "Agregar decisión" })
787
+ children: /* @__PURE__ */ u(s, { direction: "column", gap: "12px", alignItems: "center", children: [
788
+ /* @__PURE__ */ r(Q, { appearance: "gray", icon: /* @__PURE__ */ r(de, {}), size: "35px" }),
789
+ /* @__PURE__ */ r(x, { appearance: "gray", type: "body", size: "large", children: "Agregar decisión" })
842
790
  ] })
843
791
  }
844
792
  ) })
845
793
  ] }) }, `add-decision-${e}`);
846
794
  }
847
- const Ye = {
848
- loading: Ge,
849
- decision: Pe,
850
- add: Qe
795
+ const Me = {
796
+ loading: qe,
797
+ decision: Oe,
798
+ add: je
851
799
  };
852
- function H(e) {
853
- const { type: t } = e, o = Ye[t];
854
- return o ? o(e) : null;
800
+ function U(e) {
801
+ const { type: t } = e, a = Me[t];
802
+ return a ? a(e) : null;
855
803
  }
856
- function We({
804
+ function He({
857
805
  controls: e,
858
806
  decisions: t,
859
- loading: o,
860
- handleOpenModal: d,
861
- handleDelete: h,
862
- textValues: r
807
+ loading: a,
808
+ handleOpenModal: n,
809
+ handleDelete: c,
810
+ textValues: o
863
811
  }) {
864
- const i = o ? Array.from({ length: 3 }).map(
865
- (u, p) => H({
812
+ const l = a ? Array.from({ length: 3 }).map(
813
+ (h, d) => U({
866
814
  type: "loading",
867
- index: p,
815
+ index: d,
868
816
  controls: e,
869
- loading: o,
870
- handleOpenModal: d,
871
- handleDelete: h,
872
- textValues: r
817
+ loading: a,
818
+ handleOpenModal: n,
819
+ handleDelete: c,
820
+ textValues: o
873
821
  })
874
822
  ) : t.map(
875
- (u) => H({
823
+ (h) => U({
876
824
  type: "decision",
877
- decision: u,
825
+ decision: h,
878
826
  controls: e,
879
- loading: o,
880
- handleOpenModal: d,
881
- handleDelete: h,
882
- textValues: r
827
+ loading: a,
828
+ handleOpenModal: n,
829
+ handleDelete: c,
830
+ textValues: o
883
831
  })
884
- ), l = (t.length === 0 || t.length < Math.floor(window.innerWidth / 300)) && !o && e;
885
- return { renderedCards: i, shouldRenderAddCard: l };
832
+ ), i = (t.length === 0 || t.length < Math.floor(window.innerWidth / 300)) && !a && e;
833
+ return { renderedCards: l, shouldRenderAddCard: i };
886
834
  }
887
- const vt = (e) => {
835
+ const mt = (e) => {
888
836
  const {
889
837
  controls: t = !0,
890
- decisions: o,
891
- textValues: d,
892
- decisionTemplate: h,
893
- isModalOpen: r,
894
- selectedDecision: i,
895
- loading: l,
896
- handleOpenModal: u,
897
- handleCloseModal: p,
838
+ decisions: a,
839
+ textValues: n,
840
+ decisionTemplate: c,
841
+ isModalOpen: o,
842
+ selectedDecision: l,
843
+ loading: i,
844
+ handleOpenModal: h,
845
+ handleCloseModal: d,
898
846
  handleSubmitForm: m,
899
- handleDelete: g
900
- } = e, v = be("(max-width: 681px)"), { renderedCards: w, shouldRenderAddCard: n } = We({
847
+ handleDelete: p
848
+ } = e, f = ue("(max-width: 681px)"), { renderedCards: S, shouldRenderAddCard: A } = He({
901
849
  controls: t,
902
- decisions: o,
903
- loading: l,
904
- handleOpenModal: u,
905
- handleDelete: g,
906
- textValues: d
850
+ decisions: a,
851
+ loading: i,
852
+ handleOpenModal: h,
853
+ handleDelete: p,
854
+ textValues: n
907
855
  });
908
- return /* @__PURE__ */ c(_, { children: [
909
- /* @__PURE__ */ a(He, { children: /* @__PURE__ */ a(je, { children: /* @__PURE__ */ c(s, { direction: "column", gap: "16px", padding: "6px", children: [
910
- o.length === 0 && !l && /* @__PURE__ */ c(y, { as: "span", type: "label", size: "large", appearance: "gray", children: [
856
+ return /* @__PURE__ */ u(E, { children: [
857
+ /* @__PURE__ */ r($e, { children: /* @__PURE__ */ r(Fe, { children: /* @__PURE__ */ u(s, { direction: "column", gap: "16px", padding: "6px", children: [
858
+ a.length === 0 && !i && /* @__PURE__ */ u(x, { as: "span", type: "label", size: "large", appearance: "gray", children: [
911
859
  "Aún no tienes definidas tasas de interés efectivas. Presiona",
912
- /* @__PURE__ */ a(
913
- y,
860
+ /* @__PURE__ */ r(
861
+ x,
914
862
  {
915
863
  as: "span",
916
864
  type: "label",
@@ -922,8 +870,8 @@ const vt = (e) => {
922
870
  ),
923
871
  "para empezar."
924
872
  ] }),
925
- /* @__PURE__ */ c(
926
- me,
873
+ /* @__PURE__ */ u(
874
+ ce,
927
875
  {
928
876
  templateColumns: "repeat(auto-fill, minmax(300px, 1fr))",
929
877
  autoFlow: "row dense",
@@ -933,35 +881,35 @@ const vt = (e) => {
933
881
  autoRows: "1fr",
934
882
  justifyItems: "center",
935
883
  padding: "6px",
936
- height: v ? "auto" : "484px",
884
+ height: f ? "auto" : "484px",
937
885
  children: [
938
- w,
939
- n && H({
886
+ S,
887
+ A && U({
940
888
  type: "add",
941
- index: o.length,
889
+ index: a.length,
942
890
  controls: t,
943
- loading: l,
944
- handleOpenModal: u,
945
- handleDelete: g,
946
- textValues: d
891
+ loading: i,
892
+ handleOpenModal: h,
893
+ handleDelete: p,
894
+ textValues: n
947
895
  })
948
896
  ]
949
897
  }
950
898
  )
951
899
  ] }) }) }),
952
- r && /* @__PURE__ */ a(
953
- Me,
900
+ o && /* @__PURE__ */ r(
901
+ Ue,
954
902
  {
955
903
  portalId: "modal-portal",
956
- onCloseModal: p,
957
- title: i ? "Editar Decisión" : "Nueva decisión",
958
- children: /* @__PURE__ */ a(
959
- Ae,
904
+ onCloseModal: d,
905
+ title: l ? "Editar Decisión" : "Nueva decisión",
906
+ children: /* @__PURE__ */ r(
907
+ we,
960
908
  {
961
- decision: i || h,
909
+ decision: l || c,
962
910
  onSubmitEvent: m,
963
- textValues: d,
964
- onCancel: () => p()
911
+ textValues: n,
912
+ onCancel: () => d()
965
913
  }
966
914
  )
967
915
  }
@@ -969,9 +917,9 @@ const vt = (e) => {
969
917
  ] });
970
918
  };
971
919
  export {
972
- G as BusinessRuleCard,
973
- ee as BusinessRuleView,
974
- vt as BusinessRules,
975
- Me as ModalRules,
976
- Ae as RulesForm
920
+ F as BusinessRuleCard,
921
+ Y as BusinessRuleView,
922
+ mt as BusinessRules,
923
+ Ue as ModalRules,
924
+ we as RulesForm
977
925
  };