@isettingkit/business-rules 0.1.28 → 0.1.30

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