@socotra/ec-react-utils 2.3.0-next.8 → 2.3.0

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.
package/dist/index.es.js CHANGED
@@ -1,206 +1,206 @@
1
- const q = (e) => {
2
- const { data: t, scope: s, dataTypes: d, rootDisplayName: b, account: y, quote: S, element: $ } = e, L = [];
1
+ const ee = (e) => {
2
+ const { data: t, scope: s, dataTypes: f, rootDisplayName: y, account: g, quote: x, element: $ } = e, Y = [];
3
3
  let k = {};
4
- const B = Object.fromEntries(
5
- Object.entries(t ?? {}).filter(([, m]) => {
4
+ const V = Object.fromEntries(
5
+ Object.entries(t ?? {}).filter(([, d]) => {
6
6
  var M;
7
- const r = (M = m.scope) == null ? void 0 : M.split(",").map((Y) => Y.trim());
8
- return !!(!r || s === "P" && (r != null && r.includes("P")) || r != null && r.includes("Q") || s === "Q" && (r != null && r.includes("Q")));
9
- }).map(([m, r]) => {
10
- var H, G, l, i, n, u, a, c, f, p, v, D, x, O, C, N, A;
11
- let M = !1, Y = !1, F = !1;
12
- const J = r.displayName ?? m, U = (H = r.type) == null ? void 0 : H.slice(-1), V = r.maxLength, Q = r.minLength, j = r.max, P = r.min, z = r.regex;
13
- let o = r.type ?? "", _;
7
+ const c = (M = d.scope) == null ? void 0 : M.split(",").map((P) => P.trim());
8
+ return !!(!c || s.some((P) => c.includes(P)));
9
+ }).map(([d, c]) => {
10
+ var H, G, u, i, n, r, a, l, o, p, b, D, w, S, I, N, A;
11
+ let M = !1, P = !1, Q = !1;
12
+ const J = c.displayName ?? d, U = (H = c.type) == null ? void 0 : H.slice(-1), B = c.maxLength, W = c.minLength, _ = c.max, L = c.min, z = c.regex;
13
+ let m = c.type ?? "", j;
14
14
  switch (U) {
15
15
  case "*":
16
- Y = !0, M = !0, o = o == null ? void 0 : o.split("*")[0];
16
+ P = !0, M = !0, m = m == null ? void 0 : m.split("*")[0];
17
17
  break;
18
18
  case "?":
19
- o = o == null ? void 0 : o.split("?")[0], M = !0;
19
+ m = m == null ? void 0 : m.split("?")[0], M = !0;
20
20
  break;
21
21
  case "+":
22
- Y = !0, o = o == null ? void 0 : o.split("+")[0];
22
+ P = !0, m = m == null ? void 0 : m.split("+")[0];
23
23
  break;
24
24
  case "!":
25
- o = o == null ? void 0 : o.split("!")[0];
25
+ m = m == null ? void 0 : m.split("!")[0];
26
26
  break;
27
27
  }
28
- switch (o) {
28
+ switch (m) {
29
29
  case "string":
30
- o = "string";
30
+ m = "string";
31
31
  break;
32
32
  case "int":
33
33
  case "long":
34
- o = "integer";
34
+ m = "integer";
35
35
  break;
36
36
  case "decimal":
37
- o = "number";
37
+ m = "number";
38
38
  break;
39
39
  case "dateTime":
40
40
  case "datetime":
41
- o = "string", _ = "date-time";
41
+ m = "string", j = "date-time";
42
42
  break;
43
43
  case "date":
44
- o = "string", _ = "date";
44
+ m = "string", j = "date";
45
45
  break;
46
46
  case "boolean":
47
47
  case "bool":
48
- o = "boolean";
48
+ m = "boolean";
49
49
  break;
50
50
  default:
51
- F = !0;
51
+ Q = !0;
52
52
  break;
53
53
  }
54
- if (!M && !F && !Y && L.push(m), F) {
55
- const T = d == null ? void 0 : d[o];
56
- if (T) {
57
- let w = Y ? [] : {};
58
- const I = q({
59
- data: T.data ?? {},
54
+ if (!M && !Q && !P && Y.push(d), Q) {
55
+ const O = f == null ? void 0 : f[m];
56
+ if (O) {
57
+ let T = P ? [] : {};
58
+ const C = ee({
59
+ data: O.data ?? {},
60
60
  scope: s,
61
- dataTypes: d,
62
- rootDisplayName: T.displayName ?? m
61
+ dataTypes: f,
62
+ rootDisplayName: O.displayName ?? d
63
63
  });
64
- return S && (l = (G = S.element) == null ? void 0 : G.data) != null && l[m] && (w = (n = (i = S.element) == null ? void 0 : i.data) == null ? void 0 : n[m]), $ && (u = $ == null ? void 0 : $.data) != null && u[m] && (w = (a = $ == null ? void 0 : $.data) == null ? void 0 : a[m]), y && (c = y == null ? void 0 : y.data) != null && c[m] && (w = (f = y == null ? void 0 : y.data) == null ? void 0 : f[m]), k = {
64
+ return x && (u = (G = x.element) == null ? void 0 : G.data) != null && u[d] && (T = (n = (i = x.element) == null ? void 0 : i.data) == null ? void 0 : n[d]), $ && (r = $ == null ? void 0 : $.data) != null && r[d] && (T = (a = $ == null ? void 0 : $.data) == null ? void 0 : a[d]), g && (l = g == null ? void 0 : g.data) != null && l[d] && (T = (o = g == null ? void 0 : g.data) == null ? void 0 : o[d]), k = {
65
65
  ...k,
66
- [`${o}`]: I
67
- }, Y ? [
68
- m,
66
+ [`${m}`]: C
67
+ }, P ? [
68
+ d,
69
69
  {
70
- title: T.displayName ?? m,
70
+ title: O.displayName ?? d,
71
71
  type: "array",
72
- default: w,
72
+ default: T,
73
73
  items: {
74
- $ref: `#/definitions/${o}`
74
+ $ref: `#/definitions/${m}`
75
75
  },
76
76
  ...!M && { minItems: 1 }
77
77
  }
78
78
  ] : [
79
- m,
79
+ d,
80
80
  {
81
- title: T.displayName ?? m,
82
- default: w,
83
- $ref: `#/definitions/${o}`
81
+ title: O.displayName ?? d,
82
+ default: T,
83
+ $ref: `#/definitions/${m}`
84
84
  }
85
85
  ];
86
86
  }
87
87
  }
88
- let g = "";
89
- if (y) {
90
- const T = (y == null ? void 0 : y.state) === "validated" ? m.charAt(0).toLowerCase() + m.slice(1) : m;
91
- g = (p = y == null ? void 0 : y.data) != null && p[T] ? (v = y == null ? void 0 : y.data) == null ? void 0 : v[T] : o === "boolean" ? !!r.defaultValue : r.defaultValue;
88
+ let v = "";
89
+ if (g) {
90
+ const O = (g == null ? void 0 : g.state) === "validated" ? d.charAt(0).toLowerCase() + d.slice(1) : d;
91
+ v = (p = g == null ? void 0 : g.data) != null && p[O] ? (b = g == null ? void 0 : g.data) == null ? void 0 : b[O] : m === "boolean" ? !!c.defaultValue : c.defaultValue;
92
92
  }
93
- return S && (g = (x = (D = S.element) == null ? void 0 : D.data) != null && x[m] ? (C = (O = S.element) == null ? void 0 : O.data) == null ? void 0 : C[m] : o === "boolean" ? !!r.defaultValue : r.defaultValue), $ && (g = (N = $ == null ? void 0 : $.data) != null && N[m] ? (A = $ == null ? void 0 : $.data) == null ? void 0 : A[m] : o === "boolean" ? !!r.defaultValue : r.defaultValue), Y ? [
94
- m,
93
+ return x && (v = (w = (D = x.element) == null ? void 0 : D.data) != null && w[d] ? (I = (S = x.element) == null ? void 0 : S.data) == null ? void 0 : I[d] : m === "boolean" ? !!c.defaultValue : c.defaultValue), $ && (v = (N = $ == null ? void 0 : $.data) != null && N[d] ? (A = $ == null ? void 0 : $.data) == null ? void 0 : A[d] : m === "boolean" ? !!c.defaultValue : c.defaultValue), P ? [
94
+ d,
95
95
  {
96
96
  title: J,
97
97
  type: "array",
98
- default: g,
98
+ default: v,
99
99
  items: {
100
- type: o,
101
- ...V && { maxLength: V },
102
- ...Q && { minLength: Q },
103
- ...P && { min: P },
104
- ...j && { max: j },
105
- ..._ && { format: _ },
106
- ...z && { pattern: r.regex }
100
+ type: m,
101
+ ...B && { maxLength: B },
102
+ ...W && { minLength: W },
103
+ ...L && { min: L },
104
+ ..._ && { max: _ },
105
+ ...j && { format: j },
106
+ ...z && { pattern: c.regex }
107
107
  },
108
108
  ...!M && { minItems: 1 }
109
109
  }
110
110
  ] : [
111
- m,
111
+ d,
112
112
  {
113
113
  title: J,
114
- type: o,
115
- ...g && { default: g },
116
- ...Q && { minLength: Q },
117
- ...V && { maxLength: V },
118
- ...P && { minimum: parseInt(P) },
119
- ...j && { maximum: parseInt(j) },
120
- ..._ && { format: _ },
121
- ...r.options && { enum: r.options },
122
- ...z && { pattern: r.regex }
114
+ type: m,
115
+ ...v && { default: v },
116
+ ...W && { minLength: W },
117
+ ...B && { maxLength: B },
118
+ ...L && { minimum: parseInt(L) },
119
+ ..._ && { maximum: parseInt(_) },
120
+ ...j && { format: j },
121
+ ...c.options && { enum: c.options },
122
+ ...z && { pattern: c.regex }
123
123
  }
124
124
  ];
125
125
  })
126
126
  );
127
127
  return {
128
- title: b || "",
128
+ title: y || "",
129
129
  type: "object",
130
130
  definitions: k,
131
- required: L,
132
- properties: B
131
+ required: Y,
132
+ properties: V
133
133
  };
134
134
  };
135
- var ee = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
136
- function te(e) {
135
+ var te = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
136
+ function ne(e) {
137
137
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
138
138
  }
139
- var K = { exports: {} };
139
+ var X = { exports: {} };
140
140
  (function(e, t) {
141
- (function(s, d) {
142
- e.exports = d();
143
- })(ee, function() {
144
- var s = 1e3, d = 6e4, b = 36e5, y = "millisecond", S = "second", $ = "minute", L = "hour", k = "day", B = "week", E = "month", m = "quarter", r = "year", M = "date", Y = "Invalid Date", F = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, J = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, U = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(l) {
145
- var i = ["th", "st", "nd", "rd"], n = l % 100;
146
- return "[" + l + (i[(n - 20) % 10] || i[n] || i[0]) + "]";
147
- } }, V = function(l, i, n) {
148
- var u = String(l);
149
- return !u || u.length >= i ? l : "" + Array(i + 1 - u.length).join(n) + l;
150
- }, Q = { s: V, z: function(l) {
151
- var i = -l.utcOffset(), n = Math.abs(i), u = Math.floor(n / 60), a = n % 60;
152
- return (i <= 0 ? "+" : "-") + V(u, 2, "0") + ":" + V(a, 2, "0");
153
- }, m: function l(i, n) {
154
- if (i.date() < n.date()) return -l(n, i);
155
- var u = 12 * (n.year() - i.year()) + (n.month() - i.month()), a = i.clone().add(u, E), c = n - a < 0, f = i.clone().add(u + (c ? -1 : 1), E);
156
- return +(-(u + (n - a) / (c ? a - f : f - a)) || 0);
157
- }, a: function(l) {
158
- return l < 0 ? Math.ceil(l) || 0 : Math.floor(l);
159
- }, p: function(l) {
160
- return { M: E, y: r, w: B, d: k, D: M, h: L, m: $, s: S, ms: y, Q: m }[l] || String(l || "").toLowerCase().replace(/s$/, "");
161
- }, u: function(l) {
162
- return l === void 0;
163
- } }, j = "en", P = {};
164
- P[j] = U;
165
- var z = "$isDayjsObject", o = function(l) {
166
- return l instanceof H || !(!l || !l[z]);
167
- }, _ = function l(i, n, u) {
141
+ (function(s, f) {
142
+ e.exports = f();
143
+ })(te, function() {
144
+ var s = 1e3, f = 6e4, y = 36e5, g = "millisecond", x = "second", $ = "minute", Y = "hour", k = "day", V = "week", E = "month", d = "quarter", c = "year", M = "date", P = "Invalid Date", Q = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, J = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, U = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(u) {
145
+ var i = ["th", "st", "nd", "rd"], n = u % 100;
146
+ return "[" + u + (i[(n - 20) % 10] || i[n] || i[0]) + "]";
147
+ } }, B = function(u, i, n) {
148
+ var r = String(u);
149
+ return !r || r.length >= i ? u : "" + Array(i + 1 - r.length).join(n) + u;
150
+ }, W = { s: B, z: function(u) {
151
+ var i = -u.utcOffset(), n = Math.abs(i), r = Math.floor(n / 60), a = n % 60;
152
+ return (i <= 0 ? "+" : "-") + B(r, 2, "0") + ":" + B(a, 2, "0");
153
+ }, m: function u(i, n) {
154
+ if (i.date() < n.date()) return -u(n, i);
155
+ var r = 12 * (n.year() - i.year()) + (n.month() - i.month()), a = i.clone().add(r, E), l = n - a < 0, o = i.clone().add(r + (l ? -1 : 1), E);
156
+ return +(-(r + (n - a) / (l ? a - o : o - a)) || 0);
157
+ }, a: function(u) {
158
+ return u < 0 ? Math.ceil(u) || 0 : Math.floor(u);
159
+ }, p: function(u) {
160
+ return { M: E, y: c, w: V, d: k, D: M, h: Y, m: $, s: x, ms: g, Q: d }[u] || String(u || "").toLowerCase().replace(/s$/, "");
161
+ }, u: function(u) {
162
+ return u === void 0;
163
+ } }, _ = "en", L = {};
164
+ L[_] = U;
165
+ var z = "$isDayjsObject", m = function(u) {
166
+ return u instanceof H || !(!u || !u[z]);
167
+ }, j = function u(i, n, r) {
168
168
  var a;
169
- if (!i) return j;
169
+ if (!i) return _;
170
170
  if (typeof i == "string") {
171
- var c = i.toLowerCase();
172
- P[c] && (a = c), n && (P[c] = n, a = c);
173
- var f = i.split("-");
174
- if (!a && f.length > 1) return l(f[0]);
171
+ var l = i.toLowerCase();
172
+ L[l] && (a = l), n && (L[l] = n, a = l);
173
+ var o = i.split("-");
174
+ if (!a && o.length > 1) return u(o[0]);
175
175
  } else {
176
176
  var p = i.name;
177
- P[p] = i, a = p;
177
+ L[p] = i, a = p;
178
178
  }
179
- return !u && a && (j = a), a || !u && j;
180
- }, g = function(l, i) {
181
- if (o(l)) return l.clone();
179
+ return !r && a && (_ = a), a || !r && _;
180
+ }, v = function(u, i) {
181
+ if (m(u)) return u.clone();
182
182
  var n = typeof i == "object" ? i : {};
183
- return n.date = l, n.args = arguments, new H(n);
184
- }, h = Q;
185
- h.l = _, h.i = o, h.w = function(l, i) {
186
- return g(l, { locale: i.$L, utc: i.$u, x: i.$x, $offset: i.$offset });
183
+ return n.date = u, n.args = arguments, new H(n);
184
+ }, h = W;
185
+ h.l = j, h.i = m, h.w = function(u, i) {
186
+ return v(u, { locale: i.$L, utc: i.$u, x: i.$x, $offset: i.$offset });
187
187
  };
188
188
  var H = function() {
189
- function l(n) {
190
- this.$L = _(n.locale, null, !0), this.parse(n), this.$x = this.$x || n.x || {}, this[z] = !0;
189
+ function u(n) {
190
+ this.$L = j(n.locale, null, !0), this.parse(n), this.$x = this.$x || n.x || {}, this[z] = !0;
191
191
  }
192
- var i = l.prototype;
192
+ var i = u.prototype;
193
193
  return i.parse = function(n) {
194
- this.$d = function(u) {
195
- var a = u.date, c = u.utc;
194
+ this.$d = function(r) {
195
+ var a = r.date, l = r.utc;
196
196
  if (a === null) return /* @__PURE__ */ new Date(NaN);
197
197
  if (h.u(a)) return /* @__PURE__ */ new Date();
198
198
  if (a instanceof Date) return new Date(a);
199
199
  if (typeof a == "string" && !/Z$/i.test(a)) {
200
- var f = a.match(F);
201
- if (f) {
202
- var p = f[2] - 1 || 0, v = (f[7] || "0").substring(0, 3);
203
- return c ? new Date(Date.UTC(f[1], p, f[3] || 1, f[4] || 0, f[5] || 0, f[6] || 0, v)) : new Date(f[1], p, f[3] || 1, f[4] || 0, f[5] || 0, f[6] || 0, v);
200
+ var o = a.match(Q);
201
+ if (o) {
202
+ var p = o[2] - 1 || 0, b = (o[7] || "0").substring(0, 3);
203
+ return l ? new Date(Date.UTC(o[1], p, o[3] || 1, o[4] || 0, o[5] || 0, o[6] || 0, b)) : new Date(o[1], p, o[3] || 1, o[4] || 0, o[5] || 0, o[6] || 0, b);
204
204
  }
205
205
  }
206
206
  return new Date(a);
@@ -211,113 +211,113 @@ var K = { exports: {} };
211
211
  }, i.$utils = function() {
212
212
  return h;
213
213
  }, i.isValid = function() {
214
- return this.$d.toString() !== Y;
215
- }, i.isSame = function(n, u) {
216
- var a = g(n);
217
- return this.startOf(u) <= a && a <= this.endOf(u);
218
- }, i.isAfter = function(n, u) {
219
- return g(n) < this.startOf(u);
220
- }, i.isBefore = function(n, u) {
221
- return this.endOf(u) < g(n);
222
- }, i.$g = function(n, u, a) {
223
- return h.u(n) ? this[u] : this.set(a, n);
214
+ return this.$d.toString() !== P;
215
+ }, i.isSame = function(n, r) {
216
+ var a = v(n);
217
+ return this.startOf(r) <= a && a <= this.endOf(r);
218
+ }, i.isAfter = function(n, r) {
219
+ return v(n) < this.startOf(r);
220
+ }, i.isBefore = function(n, r) {
221
+ return this.endOf(r) < v(n);
222
+ }, i.$g = function(n, r, a) {
223
+ return h.u(n) ? this[r] : this.set(a, n);
224
224
  }, i.unix = function() {
225
225
  return Math.floor(this.valueOf() / 1e3);
226
226
  }, i.valueOf = function() {
227
227
  return this.$d.getTime();
228
- }, i.startOf = function(n, u) {
229
- var a = this, c = !!h.u(u) || u, f = h.p(n), p = function(T, w) {
230
- var I = h.w(a.$u ? Date.UTC(a.$y, w, T) : new Date(a.$y, w, T), a);
231
- return c ? I : I.endOf(k);
232
- }, v = function(T, w) {
233
- return h.w(a.toDate()[T].apply(a.toDate("s"), (c ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(w)), a);
234
- }, D = this.$W, x = this.$M, O = this.$D, C = "set" + (this.$u ? "UTC" : "");
235
- switch (f) {
236
- case r:
237
- return c ? p(1, 0) : p(31, 11);
228
+ }, i.startOf = function(n, r) {
229
+ var a = this, l = !!h.u(r) || r, o = h.p(n), p = function(O, T) {
230
+ var C = h.w(a.$u ? Date.UTC(a.$y, T, O) : new Date(a.$y, T, O), a);
231
+ return l ? C : C.endOf(k);
232
+ }, b = function(O, T) {
233
+ return h.w(a.toDate()[O].apply(a.toDate("s"), (l ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(T)), a);
234
+ }, D = this.$W, w = this.$M, S = this.$D, I = "set" + (this.$u ? "UTC" : "");
235
+ switch (o) {
236
+ case c:
237
+ return l ? p(1, 0) : p(31, 11);
238
238
  case E:
239
- return c ? p(1, x) : p(0, x + 1);
240
- case B:
239
+ return l ? p(1, w) : p(0, w + 1);
240
+ case V:
241
241
  var N = this.$locale().weekStart || 0, A = (D < N ? D + 7 : D) - N;
242
- return p(c ? O - A : O + (6 - A), x);
242
+ return p(l ? S - A : S + (6 - A), w);
243
243
  case k:
244
244
  case M:
245
- return v(C + "Hours", 0);
246
- case L:
247
- return v(C + "Minutes", 1);
245
+ return b(I + "Hours", 0);
246
+ case Y:
247
+ return b(I + "Minutes", 1);
248
248
  case $:
249
- return v(C + "Seconds", 2);
250
- case S:
251
- return v(C + "Milliseconds", 3);
249
+ return b(I + "Seconds", 2);
250
+ case x:
251
+ return b(I + "Milliseconds", 3);
252
252
  default:
253
253
  return this.clone();
254
254
  }
255
255
  }, i.endOf = function(n) {
256
256
  return this.startOf(n, !1);
257
- }, i.$set = function(n, u) {
258
- var a, c = h.p(n), f = "set" + (this.$u ? "UTC" : ""), p = (a = {}, a[k] = f + "Date", a[M] = f + "Date", a[E] = f + "Month", a[r] = f + "FullYear", a[L] = f + "Hours", a[$] = f + "Minutes", a[S] = f + "Seconds", a[y] = f + "Milliseconds", a)[c], v = c === k ? this.$D + (u - this.$W) : u;
259
- if (c === E || c === r) {
257
+ }, i.$set = function(n, r) {
258
+ var a, l = h.p(n), o = "set" + (this.$u ? "UTC" : ""), p = (a = {}, a[k] = o + "Date", a[M] = o + "Date", a[E] = o + "Month", a[c] = o + "FullYear", a[Y] = o + "Hours", a[$] = o + "Minutes", a[x] = o + "Seconds", a[g] = o + "Milliseconds", a)[l], b = l === k ? this.$D + (r - this.$W) : r;
259
+ if (l === E || l === c) {
260
260
  var D = this.clone().set(M, 1);
261
- D.$d[p](v), D.init(), this.$d = D.set(M, Math.min(this.$D, D.daysInMonth())).$d;
262
- } else p && this.$d[p](v);
261
+ D.$d[p](b), D.init(), this.$d = D.set(M, Math.min(this.$D, D.daysInMonth())).$d;
262
+ } else p && this.$d[p](b);
263
263
  return this.init(), this;
264
- }, i.set = function(n, u) {
265
- return this.clone().$set(n, u);
264
+ }, i.set = function(n, r) {
265
+ return this.clone().$set(n, r);
266
266
  }, i.get = function(n) {
267
267
  return this[h.p(n)]();
268
- }, i.add = function(n, u) {
269
- var a, c = this;
268
+ }, i.add = function(n, r) {
269
+ var a, l = this;
270
270
  n = Number(n);
271
- var f = h.p(u), p = function(x) {
272
- var O = g(c);
273
- return h.w(O.date(O.date() + Math.round(x * n)), c);
271
+ var o = h.p(r), p = function(w) {
272
+ var S = v(l);
273
+ return h.w(S.date(S.date() + Math.round(w * n)), l);
274
274
  };
275
- if (f === E) return this.set(E, this.$M + n);
276
- if (f === r) return this.set(r, this.$y + n);
277
- if (f === k) return p(1);
278
- if (f === B) return p(7);
279
- var v = (a = {}, a[$] = d, a[L] = b, a[S] = s, a)[f] || 1, D = this.$d.getTime() + n * v;
275
+ if (o === E) return this.set(E, this.$M + n);
276
+ if (o === c) return this.set(c, this.$y + n);
277
+ if (o === k) return p(1);
278
+ if (o === V) return p(7);
279
+ var b = (a = {}, a[$] = f, a[Y] = y, a[x] = s, a)[o] || 1, D = this.$d.getTime() + n * b;
280
280
  return h.w(D, this);
281
- }, i.subtract = function(n, u) {
282
- return this.add(-1 * n, u);
281
+ }, i.subtract = function(n, r) {
282
+ return this.add(-1 * n, r);
283
283
  }, i.format = function(n) {
284
- var u = this, a = this.$locale();
285
- if (!this.isValid()) return a.invalidDate || Y;
286
- var c = n || "YYYY-MM-DDTHH:mm:ssZ", f = h.z(this), p = this.$H, v = this.$m, D = this.$M, x = a.weekdays, O = a.months, C = a.meridiem, N = function(w, I, Z, R) {
287
- return w && (w[I] || w(u, c)) || Z[I].slice(0, R);
288
- }, A = function(w) {
289
- return h.s(p % 12 || 12, w, "0");
290
- }, T = C || function(w, I, Z) {
291
- var R = w < 12 ? "AM" : "PM";
284
+ var r = this, a = this.$locale();
285
+ if (!this.isValid()) return a.invalidDate || P;
286
+ var l = n || "YYYY-MM-DDTHH:mm:ssZ", o = h.z(this), p = this.$H, b = this.$m, D = this.$M, w = a.weekdays, S = a.months, I = a.meridiem, N = function(T, C, Z, R) {
287
+ return T && (T[C] || T(r, l)) || Z[C].slice(0, R);
288
+ }, A = function(T) {
289
+ return h.s(p % 12 || 12, T, "0");
290
+ }, O = I || function(T, C, Z) {
291
+ var R = T < 12 ? "AM" : "PM";
292
292
  return Z ? R.toLowerCase() : R;
293
293
  };
294
- return c.replace(J, function(w, I) {
295
- return I || function(Z) {
294
+ return l.replace(J, function(T, C) {
295
+ return C || function(Z) {
296
296
  switch (Z) {
297
297
  case "YY":
298
- return String(u.$y).slice(-2);
298
+ return String(r.$y).slice(-2);
299
299
  case "YYYY":
300
- return h.s(u.$y, 4, "0");
300
+ return h.s(r.$y, 4, "0");
301
301
  case "M":
302
302
  return D + 1;
303
303
  case "MM":
304
304
  return h.s(D + 1, 2, "0");
305
305
  case "MMM":
306
- return N(a.monthsShort, D, O, 3);
306
+ return N(a.monthsShort, D, S, 3);
307
307
  case "MMMM":
308
- return N(O, D);
308
+ return N(S, D);
309
309
  case "D":
310
- return u.$D;
310
+ return r.$D;
311
311
  case "DD":
312
- return h.s(u.$D, 2, "0");
312
+ return h.s(r.$D, 2, "0");
313
313
  case "d":
314
- return String(u.$W);
314
+ return String(r.$W);
315
315
  case "dd":
316
- return N(a.weekdaysMin, u.$W, x, 2);
316
+ return N(a.weekdaysMin, r.$W, w, 2);
317
317
  case "ddd":
318
- return N(a.weekdaysShort, u.$W, x, 3);
318
+ return N(a.weekdaysShort, r.$W, w, 3);
319
319
  case "dddd":
320
- return x[u.$W];
320
+ return w[r.$W];
321
321
  case "H":
322
322
  return String(p);
323
323
  case "HH":
@@ -327,68 +327,68 @@ var K = { exports: {} };
327
327
  case "hh":
328
328
  return A(2);
329
329
  case "a":
330
- return T(p, v, !0);
330
+ return O(p, b, !0);
331
331
  case "A":
332
- return T(p, v, !1);
332
+ return O(p, b, !1);
333
333
  case "m":
334
- return String(v);
334
+ return String(b);
335
335
  case "mm":
336
- return h.s(v, 2, "0");
336
+ return h.s(b, 2, "0");
337
337
  case "s":
338
- return String(u.$s);
338
+ return String(r.$s);
339
339
  case "ss":
340
- return h.s(u.$s, 2, "0");
340
+ return h.s(r.$s, 2, "0");
341
341
  case "SSS":
342
- return h.s(u.$ms, 3, "0");
342
+ return h.s(r.$ms, 3, "0");
343
343
  case "Z":
344
- return f;
344
+ return o;
345
345
  }
346
346
  return null;
347
- }(w) || f.replace(":", "");
347
+ }(T) || o.replace(":", "");
348
348
  });
349
349
  }, i.utcOffset = function() {
350
350
  return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
351
- }, i.diff = function(n, u, a) {
352
- var c, f = this, p = h.p(u), v = g(n), D = (v.utcOffset() - this.utcOffset()) * d, x = this - v, O = function() {
353
- return h.m(f, v);
351
+ }, i.diff = function(n, r, a) {
352
+ var l, o = this, p = h.p(r), b = v(n), D = (b.utcOffset() - this.utcOffset()) * f, w = this - b, S = function() {
353
+ return h.m(o, b);
354
354
  };
355
355
  switch (p) {
356
- case r:
357
- c = O() / 12;
356
+ case c:
357
+ l = S() / 12;
358
358
  break;
359
359
  case E:
360
- c = O();
360
+ l = S();
361
361
  break;
362
- case m:
363
- c = O() / 3;
362
+ case d:
363
+ l = S() / 3;
364
364
  break;
365
- case B:
366
- c = (x - D) / 6048e5;
365
+ case V:
366
+ l = (w - D) / 6048e5;
367
367
  break;
368
368
  case k:
369
- c = (x - D) / 864e5;
369
+ l = (w - D) / 864e5;
370
370
  break;
371
- case L:
372
- c = x / b;
371
+ case Y:
372
+ l = w / y;
373
373
  break;
374
374
  case $:
375
- c = x / d;
375
+ l = w / f;
376
376
  break;
377
- case S:
378
- c = x / s;
377
+ case x:
378
+ l = w / s;
379
379
  break;
380
380
  default:
381
- c = x;
381
+ l = w;
382
382
  }
383
- return a ? c : h.a(c);
383
+ return a ? l : h.a(l);
384
384
  }, i.daysInMonth = function() {
385
385
  return this.endOf(E).$D;
386
386
  }, i.$locale = function() {
387
- return P[this.$L];
388
- }, i.locale = function(n, u) {
387
+ return L[this.$L];
388
+ }, i.locale = function(n, r) {
389
389
  if (!n) return this.$L;
390
- var a = this.clone(), c = _(n, u, !0);
391
- return c && (a.$L = c), a;
390
+ var a = this.clone(), l = j(n, r, !0);
391
+ return l && (a.$L = l), a;
392
392
  }, i.clone = function() {
393
393
  return h.w(this.$d, this);
394
394
  }, i.toDate = function() {
@@ -399,43 +399,60 @@ var K = { exports: {} };
399
399
  return this.$d.toISOString();
400
400
  }, i.toString = function() {
401
401
  return this.$d.toUTCString();
402
- }, l;
402
+ }, u;
403
403
  }(), G = H.prototype;
404
- return g.prototype = G, [["$ms", y], ["$s", S], ["$m", $], ["$H", L], ["$W", k], ["$M", E], ["$y", r], ["$D", M]].forEach(function(l) {
405
- G[l[1]] = function(i) {
406
- return this.$g(i, l[0], l[1]);
404
+ return v.prototype = G, [["$ms", g], ["$s", x], ["$m", $], ["$H", Y], ["$W", k], ["$M", E], ["$y", c], ["$D", M]].forEach(function(u) {
405
+ G[u[1]] = function(i) {
406
+ return this.$g(i, u[0], u[1]);
407
407
  };
408
- }), g.extend = function(l, i) {
409
- return l.$i || (l(i, H, g), l.$i = !0), g;
410
- }, g.locale = _, g.isDayjs = o, g.unix = function(l) {
411
- return g(1e3 * l);
412
- }, g.en = P[j], g.Ls = P, g.p = {}, g;
408
+ }), v.extend = function(u, i) {
409
+ return u.$i || (u(i, H, v), u.$i = !0), v;
410
+ }, v.locale = j, v.isDayjs = m, v.unix = function(u) {
411
+ return v(1e3 * u);
412
+ }, v.en = L[_], v.Ls = L, v.p = {}, v;
413
413
  });
414
- })(K);
415
- var ne = K.exports;
416
- const W = /* @__PURE__ */ te(ne), re = ({ data: e }) => {
417
- const t = {}, s = { ...e };
418
- return s.default && (s.default.startTime && (t.startTime = W(s.default.startTime).format()), s.default.endTime && (t.endTime = W(s.default.endTime).format()), s.default.expirationTime && (t.expirationTime = W(s.default.expirationTime).format())), s.advanced && (s.advanced.currency && (t.currency = s.advanced.currency), s.advanced.timezone && (t.timezone = s.advanced.timezone), s.advanced.billingPlan && (t.billingPlan = s.advanced.billingPlan), s.advanced.defaultTermDuration && (t.defaultTermDuration = s.advanced.defaultTermDuration), s.advanced.installmentPlan && (t.installmentPlan = s.advanced.installmentPlan), s.advanced.durationBasis && (t.durationBasis = s.advanced.durationBasis), s.advanced.delinquencyPlanName && (t.delinquencyPlanName = s.advanced.delinquencyPlanName)), delete s.default, delete s.advanced, t.setData = s, t;
414
+ })(X);
415
+ var ae = X.exports;
416
+ const F = /* @__PURE__ */ ne(ae), ce = ({ data: e }) => {
417
+ const t = {}, s = structuredClone(e);
418
+ return s.default && (s.default.startTime && (t.startTime = F(s.default.startTime).format()), s.default.endTime && (t.endTime = F(s.default.endTime).format()), s.default.expirationTime && (t.expirationTime = F(s.default.expirationTime).format())), s.advanced && (s.advanced.currency && (t.currency = s.advanced.currency), s.advanced.timezone && (t.timezone = s.advanced.timezone), s.advanced.billingPlan && (t.billingPlan = s.advanced.billingPlan), s.advanced.defaultTermDuration && (t.defaultTermDuration = s.advanced.defaultTermDuration), s.advanced.installmentPlan && (t.installmentPlan = s.advanced.installmentPlan), s.advanced.durationBasis && (t.durationBasis = s.advanced.durationBasis), s.advanced.delinquencyPlanName && (t.delinquencyPlanName = s.advanced.delinquencyPlanName)), s.coverageTerms && (t.setCoverageTerms = e.coverageTerms), delete s.coverageTerms, delete s.default, delete s.advanced, t.setData = s, t;
419
419
  };
420
420
  function ue(e) {
421
421
  return e == null ? void 0 : e.map((t) => (t.keyword === "pattern" && (t.message = `Invalid format, must match pattern ${t.params.pattern}`), t.keyword === "format" && (t.message = "Invalid format"), t.keyword === "required" && (t.message = "Required"), t.keyword === "minItems" && (t.message = `Must have at least ${t.params.limit} item${t.params.limit !== 1 ? "s" : ""}`), t.keyword === "maxItems" && (t.message = `Must have at most ${t.params.limit} item${t.params.limit !== 1 ? "s" : ""}`), t.keyword === "type" && (t.message = "Invalid format"), t.keyword === "maxLength" && (t.message = `Must be at most ${t.params.limit} character${t.params.limit !== 1 ? "s" : ""}`), t.keyword === "minLength" && (t.message = `Must be at least ${t.params.limit} character${t.params.limit !== 1 ? "s" : ""}`), t.keyword === "minimum" && (t.message = `Must be greater than or equal to ${t.params.limit}`), t.keyword === "maximum" && (t.message = `Must be less than or equal to ${t.params.limit}`), t.keyword === "enum" && (t.message = "Invalid value"), t));
422
422
  }
423
- const le = (e, t, s) => {
424
- var d, b;
423
+ const K = ({
424
+ coverageTermOptions: e,
425
+ coverageTermDataModel: t
426
+ }) => {
427
+ const s = structuredClone(e) ?? {}, f = t;
428
+ return Object.keys(f).forEach((y) => {
429
+ if (s[y])
430
+ return;
431
+ Object.keys(
432
+ f[y].options
433
+ ).forEach((x) => {
434
+ if (x.startsWith("*")) {
435
+ const $ = x.substring(1);
436
+ s[y] = $;
437
+ }
438
+ });
439
+ }), s;
440
+ }, le = (e, t, s) => {
441
+ var f, y, g;
425
442
  return {
426
- ...((d = e == null ? void 0 : e.element) == null ? void 0 : d.data) && {
427
- ...(b = e == null ? void 0 : e.element) == null ? void 0 : b.data
443
+ ...((f = e == null ? void 0 : e.element) == null ? void 0 : f.data) && {
444
+ ...(y = e == null ? void 0 : e.element) == null ? void 0 : y.data
428
445
  },
429
446
  default: {
430
447
  // set date to yyyy-MM-dd format if it exists
431
448
  ...(e == null ? void 0 : e.startTime) && {
432
- startTime: W(e.startTime).format("YYYY-MM-DD")
449
+ startTime: F(e.startTime).format("YYYY-MM-DD")
433
450
  },
434
451
  ...(e == null ? void 0 : e.endTime) && {
435
- endTime: W(e.endTime).format("YYYY-MM-DD")
452
+ endTime: F(e.endTime).format("YYYY-MM-DD")
436
453
  },
437
454
  ...(e == null ? void 0 : e.expirationTime) && {
438
- expirationTime: W(e.expirationTime).format("YYYY-MM-DD")
455
+ expirationTime: F(e.expirationTime).format("YYYY-MM-DD")
439
456
  }
440
457
  },
441
458
  advanced: {
@@ -446,42 +463,49 @@ const le = (e, t, s) => {
446
463
  durationBasis: (e == null ? void 0 : e.durationBasis) ?? t.defaultDurationBasis ?? void 0,
447
464
  delinquencyPlanName: (e == null ? void 0 : e.delinquencyPlanName) ?? (t == null ? void 0 : t.defaultDelinquencyPlan) ?? void 0,
448
465
  autoRenewalPlanName: (e == null ? void 0 : e.autoRenewalPlanName) ?? (t == null ? void 0 : t.defaultAutoRenewalPlan) ?? void 0
449
- }
466
+ },
467
+ coverageTerms: K({
468
+ coverageTermDataModel: s.coverageTerms,
469
+ coverageTermOptions: ((g = e == null ? void 0 : e.element) == null ? void 0 : g.coverageTerms) ?? {}
470
+ })
450
471
  };
451
- }, ce = (e) => ({
472
+ }, oe = (e, t) => ({
452
473
  ...e.data,
453
- coverageTerms: e.coverageTerms ?? {}
454
- }), ae = ({
474
+ coverageTerms: K({
475
+ coverageTermOptions: e.coverageTerms ?? {},
476
+ coverageTermDataModel: t
477
+ })
478
+ }), se = ({
455
479
  dataModel: e,
456
480
  elementType: t
457
481
  }) => {
458
482
  let s = !1;
459
- const d = t.split("Quote")[0];
460
- return Object.keys(e.exposures ?? {}).forEach((b) => {
461
- b === d && (s = e.exposures ? e.exposures[b] : {});
462
- }), s || Object.keys(e.coverages ?? {}).forEach((b) => {
463
- b === d && (s = e.coverages ? e.coverages[b] : {});
464
- }), s || Object.keys(e.policyLines ?? {}).forEach((b) => {
465
- b === d && (s = e.policyLines ? e.policyLines[b] : {});
466
- }), s || Object.keys(e.exposureGroups ?? {}).forEach((b) => {
467
- b === d && (s = e.exposureGroups ? e.exposureGroups[b] : {});
483
+ const f = t.split("Quote")[0];
484
+ return Object.keys(e.exposures ?? {}).forEach((y) => {
485
+ y === f && (s = e.exposures ? e.exposures[y] : {});
486
+ }), s || Object.keys(e.coverages ?? {}).forEach((y) => {
487
+ y === f && (s = e.coverages ? e.coverages[y] : {});
488
+ }), s || Object.keys(e.policyLines ?? {}).forEach((y) => {
489
+ y === f && (s = e.policyLines ? e.policyLines[y] : {});
490
+ }), s || Object.keys(e.exposureGroups ?? {}).forEach((y) => {
491
+ y === f && (s = e.exposureGroups ? e.exposureGroups[y] : {});
468
492
  }), s;
469
- }, X = (e, t) => {
493
+ }, q = (e, t) => {
470
494
  for (const s of e) {
471
495
  if (s.locator === t)
472
496
  return s;
473
- const d = X(
497
+ const f = q(
474
498
  s.elements ?? [],
475
499
  t
476
500
  );
477
- if (d)
478
- return d;
501
+ if (f)
502
+ return f;
479
503
  }
480
504
  return !1;
481
505
  }, ie = (e, t) => {
482
- var s, d;
483
- return ((s = e.element) == null ? void 0 : s.locator) === t ? e.element : X(
484
- ((d = e.element) == null ? void 0 : d.elements) ?? [],
506
+ var s, f;
507
+ return ((s = e.element) == null ? void 0 : s.locator) === t ? e.element : q(
508
+ ((f = e.element) == null ? void 0 : f.elements) ?? [],
485
509
  t
486
510
  );
487
511
  }, fe = ({
@@ -489,67 +513,68 @@ const le = (e, t, s) => {
489
513
  quote: t,
490
514
  elementLocator: s
491
515
  }) => {
492
- const d = ie(t, s);
493
- return d ? ae({
516
+ const f = ie(t, s);
517
+ return f ? se({
494
518
  dataModel: e,
495
- elementType: d.type
519
+ elementType: f.type
496
520
  }) : {};
497
- }, oe = (e, t) => e.filter(
498
- (d) => d.type === `${t}Quote`
521
+ }, me = (e, t) => e.filter(
522
+ (f) => f.type === `${t}Quote`
499
523
  ), de = ({
500
524
  dataModel: e,
501
525
  element: { productName: t }
502
- }) => e.products[t] ?? {}, se = (e) => {
503
- var d;
526
+ }) => e.products[t] ?? {}, re = (e) => {
527
+ var f;
504
528
  e = e ?? "";
505
- const t = e.replace(/\?|\*|!|\+/g, ""), s = (d = e.match(/\?|\*|!|\+/g)) == null ? void 0 : d.pop();
529
+ const t = e.replace(/\?|\*|!|\+/g, ""), s = (f = e.match(/\?|\*|!|\+/g)) == null ? void 0 : f.pop();
506
530
  return {
507
531
  name: t,
508
532
  quantifier: s ?? ""
509
533
  };
510
- }, me = ({
534
+ }, he = ({
511
535
  dataModel: e,
512
536
  contents: t
513
537
  }) => {
514
- const s = e.exposures ?? {}, d = e.coverages ?? {}, b = e.policyLines ?? {}, y = e.exposureGroups ?? {}, $ = (t ?? []).map((r) => {
515
- const { name: M } = se(r);
538
+ const s = e.exposures ?? {}, f = e.coverages ?? {}, y = e.policyLines ?? {}, g = e.exposureGroups ?? {}, $ = (t ?? []).map((c) => {
539
+ const { name: M } = re(c);
516
540
  return M;
517
- }), L = Object.keys(s).filter(
518
- (r) => $.includes(r)
519
- ), k = Object.keys(d).filter(
520
- (r) => $.includes(r)
521
- ), B = Object.keys(b).filter(
522
- (r) => $.includes(r)
541
+ }), Y = Object.keys(s).filter(
542
+ (c) => $.includes(c)
543
+ ), k = Object.keys(f).filter(
544
+ (c) => $.includes(c)
545
+ ), V = Object.keys(y).filter(
546
+ (c) => $.includes(c)
523
547
  ), E = Object.keys(
524
- y
525
- ).filter((r) => $.includes(r)), m = {
548
+ g
549
+ ).filter((c) => $.includes(c)), d = {
526
550
  coverages: {},
527
551
  exposures: {},
528
552
  policyLines: {},
529
553
  exposureGroups: {}
530
554
  };
531
- for (const r of L)
532
- m.exposures[r] = s[r];
533
- for (const r of k)
534
- m.coverages[r] = d[r];
535
- for (const r of B)
536
- m.policyLines[r] = b[r];
537
- for (const r of E)
538
- m.exposureGroups[r] = y[r];
539
- return m;
555
+ for (const c of Y)
556
+ d.exposures[c] = s[c];
557
+ for (const c of k)
558
+ d.coverages[c] = f[c];
559
+ for (const c of V)
560
+ d.policyLines[c] = y[c];
561
+ for (const c of E)
562
+ d.exposureGroups[c] = g[c];
563
+ return d;
540
564
  };
541
565
  export {
542
- q as dataModelToJSONSchema,
566
+ ee as dataModelToJSONSchema,
543
567
  fe as extractElementDataModel,
544
- ae as extractElementDataModelFromType,
568
+ se as extractElementDataModelFromType,
545
569
  ie as extractElementFromQuote,
546
- oe as extractElementsFromQuote,
570
+ me as extractElementsFromQuote,
547
571
  de as extractProductDataModel,
548
- me as extractProductElements,
549
- ce as getDefaultElementValues,
572
+ he as extractProductElements,
573
+ K as getCoverageTermsDefaultValues,
574
+ oe as getDefaultElementValues,
550
575
  le as getDefaultQuoteValues,
551
- re as getQuoteRequest,
552
- se as splitInputAndQuantifier,
576
+ ce as getQuoteRequest,
577
+ re as splitInputAndQuantifier,
553
578
  ue as transformErrors
554
579
  };
555
580
  //# sourceMappingURL=index.es.js.map