@socotra/ec-react-utils 2.18.1 → 2.18.2-next.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.d.ts CHANGED
@@ -134,6 +134,18 @@ declare interface ElementFormData {
134
134
  */
135
135
  export declare const extractElementByLocator: <T extends ElementResponse>(response: QuoteResponse | SegmentResponse | ElementResponse, elementLocator: string) => T | null;
136
136
 
137
+ /**
138
+ * The function `extractElementFromElement takes a `QuoteResponse`, `SegmentResponse` or `ElementResponse` object and an element type string,
139
+ * and returns the element with the matching type from the quote or its nested elements.
140
+ * @param {QuoteResponse} quote - The `quote` parameter is of type `QuoteResponse`, which is an object
141
+ * containing information about a quote.
142
+ * @param {string} elementType - The `elementType` parameter is a string that represents the
143
+ * type of the element you want to extract from the `quote` object.
144
+ * @returns The function `extractElementByType` returns the element from the response object
145
+ * that matches the provided `elementType`.
146
+ */
147
+ export declare const extractElementByType: <T extends ElementResponse>(response: QuoteResponse | SegmentResponse | ElementResponse, elementType: string) => T | null;
148
+
137
149
  /**
138
150
  * The function `extractElementDataModelFromQuote` extracts element data model based on a given quote, data
139
151
  * model, and element locator.
package/dist/index.es.js CHANGED
@@ -962,9 +962,9 @@ const $g = (r) => {
962
962
  }, ht = {
963
963
  properties: {}
964
964
  }, bt = Object.fromEntries(
965
- Object.entries(t ?? {}).filter(([B, D]) => {
965
+ Object.entries(t ?? {}).filter(([B, O]) => {
966
966
  var at;
967
- const ve = (at = D.scope) == null ? void 0 : at.split(",").map((me) => me.trim()), ie = D.tag;
967
+ const ve = (at = O.scope) == null ? void 0 : at.split(",").map((me) => me.trim()), ie = O.tag;
968
968
  if (ie != null && ie.includes("hidden"))
969
969
  return b.length > 0 ? b.includes(B) : !1;
970
970
  const Me = ie == null ? void 0 : ie.find(
@@ -982,45 +982,45 @@ const $g = (r) => {
982
982
  if (nt === "==" && it === ot || nt === "!=" && it !== ot) return !1;
983
983
  }
984
984
  return !!(!ve || a.some((me) => ve.includes(me)));
985
- }).map(([B, D]) => {
985
+ }).map(([B, O]) => {
986
986
  var mi, fi, yi, hi, bi, vi, Ti, ji, Ai, _i, wi, xi, Ei, $i, Li, Si, Ci, ki, Pi;
987
987
  let ve = !1, ie = !1, Me = !1, at = !1;
988
- const me = D.displayName ?? B, Fa = (mi = D.type) == null ? void 0 : mi.slice(-1), nt = D.maxLength, vt = D.minLength, it = D.max, ot = D.min, Za = D.constraint, pi = D.regex, gi = D.precision, qe = D.tag ?? [];
989
- let O = D.type ?? "", Tt, jt = !1;
988
+ const me = O.displayName ?? B, Fa = (mi = O.type) == null ? void 0 : mi.slice(-1), nt = O.maxLength, vt = O.minLength, it = O.max, ot = O.min, Za = O.constraint, pi = O.regex, gi = O.precision, qe = O.tag ?? [];
989
+ let N = O.type ?? "", Tt, jt = !1;
990
990
  switch (Fa) {
991
991
  case "*":
992
- ie = !0, ve = !0, O = O == null ? void 0 : O.split("*")[0];
992
+ ie = !0, ve = !0, N = N == null ? void 0 : N.split("*")[0];
993
993
  break;
994
994
  case "?":
995
- O = O == null ? void 0 : O.split("?")[0], ve = !0;
995
+ N = N == null ? void 0 : N.split("?")[0], ve = !0;
996
996
  break;
997
997
  case "+":
998
- ie = !0, O = O == null ? void 0 : O.split("+")[0];
998
+ ie = !0, N = N == null ? void 0 : N.split("+")[0];
999
999
  break;
1000
1000
  case "!":
1001
- O = O == null ? void 0 : O.split("!")[0];
1001
+ N = N == null ? void 0 : N.split("!")[0];
1002
1002
  break;
1003
1003
  }
1004
- switch (O) {
1004
+ switch (N) {
1005
1005
  case "string":
1006
- O = "string";
1006
+ N = "string";
1007
1007
  break;
1008
1008
  case "int":
1009
1009
  case "long":
1010
- O = "integer";
1010
+ N = "integer";
1011
1011
  break;
1012
1012
  case "decimal":
1013
- O = "number";
1013
+ N = "number";
1014
1014
  break;
1015
1015
  case "datetime":
1016
- O = "string", Tt = "date-time", at = !0, ve && (jt = !0);
1016
+ N = "string", Tt = "date-time", at = !0, ve && (jt = !0);
1017
1017
  break;
1018
1018
  case "date":
1019
- O = "string", Tt = "date", at = !0, ve && (jt = !0);
1019
+ N = "string", Tt = "date", at = !0, ve && (jt = !0);
1020
1020
  break;
1021
1021
  case "boolean":
1022
1022
  case "bool":
1023
- O = "boolean";
1023
+ N = "boolean";
1024
1024
  break;
1025
1025
  default:
1026
1026
  Me = !0;
@@ -1040,10 +1040,10 @@ const $g = (r) => {
1040
1040
  c,
1041
1041
  `${d == null ? void 0 : d.staticLocator}.${B}`
1042
1042
  );
1043
- g && V && (D.options = V), u && Te && (D.options = Te), d && _t && (D.options = _t);
1043
+ g && V && (O.options = V), u && Te && (O.options = Te), d && _t && (O.options = _t);
1044
1044
  }
1045
1045
  if (!ve && !Me && C.push(B), Me) {
1046
- const V = i == null ? void 0 : i[O];
1046
+ const V = i == null ? void 0 : i[N];
1047
1047
  if (V) {
1048
1048
  let Te = ie ? [] : {};
1049
1049
  const _t = $g({
@@ -1052,7 +1052,7 @@ const $g = (r) => {
1052
1052
  dataTypes: i,
1053
1053
  ignoreConstraints: l,
1054
1054
  evaluatedConstraints: c,
1055
- rootDisplayName: D.displayName ?? V.displayName ?? B,
1055
+ rootDisplayName: O.displayName ?? V.displayName ?? B,
1056
1056
  customDataTypeKey: B,
1057
1057
  quote: u,
1058
1058
  account: s,
@@ -1070,15 +1070,15 @@ const $g = (r) => {
1070
1070
  }
1071
1071
  ), _t.definitions = {}, _ = {
1072
1072
  ..._,
1073
- [`${O}`]: _t
1073
+ [`${N}`]: _t
1074
1074
  }, ie ? [
1075
1075
  B,
1076
1076
  {
1077
- title: D.displayName ?? V.displayName ?? B,
1077
+ title: O.displayName ?? V.displayName ?? B,
1078
1078
  type: "array",
1079
1079
  default: Te,
1080
1080
  items: {
1081
- $ref: `#/definitions/${O}`
1081
+ $ref: `#/definitions/${N}`
1082
1082
  },
1083
1083
  ...qe && { tag: qe },
1084
1084
  ...!ve && { minItems: 1 }
@@ -1088,7 +1088,7 @@ const $g = (r) => {
1088
1088
  {
1089
1089
  title: V.displayName ?? B,
1090
1090
  default: Te,
1091
- $ref: `#/definitions/${O}`,
1091
+ $ref: `#/definitions/${N}`,
1092
1092
  ...qe && { tag: qe }
1093
1093
  }
1094
1094
  ];
@@ -1097,30 +1097,30 @@ const $g = (r) => {
1097
1097
  let At = "";
1098
1098
  if (s) {
1099
1099
  const V = (s == null ? void 0 : s.accountState) === "validated" ? B.charAt(0).toLowerCase() + B.slice(1) : B;
1100
- At = (_i = s == null ? void 0 : s.data) != null && _i[V] ? (wi = s == null ? void 0 : s.data) == null ? void 0 : wi[V] : O === "boolean" ? !!D.defaultValue : D.defaultValue;
1100
+ At = (_i = s == null ? void 0 : s.data) != null && _i[V] ? (wi = s == null ? void 0 : s.data) == null ? void 0 : wi[V] : N === "boolean" ? !!O.defaultValue : O.defaultValue;
1101
1101
  }
1102
- if (u && (At = (Ei = (xi = u.element) == null ? void 0 : xi.data) != null && Ei[B] ? (Li = ($i = u.element) == null ? void 0 : $i.data) == null ? void 0 : Li[B] : O === "boolean" ? !!D.defaultValue : D.defaultValue), g && (At = (Si = g == null ? void 0 : g.data) != null && Si[B] ? (Ci = g == null ? void 0 : g.data) == null ? void 0 : Ci[B] : O === "boolean" ? !!D.defaultValue : D.defaultValue), ie)
1102
+ if (u && (At = (Ei = (xi = u.element) == null ? void 0 : xi.data) != null && Ei[B] ? (Li = ($i = u.element) == null ? void 0 : $i.data) == null ? void 0 : Li[B] : N === "boolean" ? !!O.defaultValue : O.defaultValue), g && (At = (Si = g == null ? void 0 : g.data) != null && Si[B] ? (Ci = g == null ? void 0 : g.data) == null ? void 0 : Ci[B] : N === "boolean" ? !!O.defaultValue : O.defaultValue), ie)
1103
1103
  return [
1104
1104
  B,
1105
1105
  {
1106
1106
  title: me,
1107
1107
  type: "array",
1108
1108
  default: At,
1109
- ...D.tag ? D.tag.includes(
1109
+ ...O.tag ? O.tag.includes(
1110
1110
  "multiselect"
1111
1111
  /* MultiSelect */
1112
1112
  ) && !Me && {
1113
1113
  uniqueItems: !0
1114
1114
  } : {},
1115
1115
  items: {
1116
- type: O,
1116
+ type: N,
1117
1117
  ...nt && { maxLength: nt },
1118
1118
  ...vt && { minLength: vt },
1119
1119
  ...ot && { min: ot },
1120
1120
  ...it && { max: it },
1121
1121
  ...Tt && { format: Tt },
1122
- ...pi && { pattern: D.regex },
1123
- ...D.options && { enum: D.options },
1122
+ ...pi && { pattern: O.regex },
1123
+ ...O.options && { enum: O.options },
1124
1124
  ...at && { timezone: n },
1125
1125
  ...jt && { nullable: jt }
1126
1126
  },
@@ -1136,7 +1136,7 @@ const $g = (r) => {
1136
1136
  B,
1137
1137
  {
1138
1138
  title: me,
1139
- type: O,
1139
+ type: N,
1140
1140
  ...At && { default: At },
1141
1141
  ...vt && { minLength: vt },
1142
1142
  ...nt && { maxLength: nt },
@@ -1144,12 +1144,12 @@ const $g = (r) => {
1144
1144
  ...it && { maximum: parseFloat(it) },
1145
1145
  ...gi && { multipleOf: 1 / Math.pow(10, gi) },
1146
1146
  ...Tt && { format: Tt },
1147
- ...D.options && { enum: D.options },
1148
- ...pi && { pattern: D.regex },
1147
+ ...O.options && { enum: O.options },
1148
+ ...pi && { pattern: O.regex },
1149
1149
  ...qe && { tag: qe },
1150
1150
  ...Ua && { currency: Ua },
1151
1151
  ...at && { timezone: n },
1152
- ...O === "boolean" && {
1152
+ ...N === "boolean" && {
1153
1153
  boolean: [
1154
1154
  { value: "true", label: h },
1155
1155
  { value: "false", label: y }
@@ -2148,10 +2148,10 @@ class Mg extends Error {
2148
2148
  super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'), this.avoidNew = !0, this.value = t, this.name = "NewError";
2149
2149
  }
2150
2150
  }
2151
- function N(r, t, a, n, i) {
2152
- if (!(this instanceof N))
2151
+ function P(r, t, a, n, i) {
2152
+ if (!(this instanceof P))
2153
2153
  try {
2154
- return new N(r, t, a, n, i);
2154
+ return new P(r, t, a, n, i);
2155
2155
  } catch (l) {
2156
2156
  if (!l.avoidNew)
2157
2157
  throw l;
@@ -2172,7 +2172,7 @@ function N(r, t, a, n, i) {
2172
2172
  return s;
2173
2173
  }
2174
2174
  }
2175
- N.prototype.evaluate = function(r, t, a, n) {
2175
+ P.prototype.evaluate = function(r, t, a, n) {
2176
2176
  let i = this.parent, o = this.parentProperty, {
2177
2177
  flatten: l,
2178
2178
  wrap: s
@@ -2186,9 +2186,9 @@ N.prototype.evaluate = function(r, t, a, n) {
2186
2186
  json: t
2187
2187
  } = r), l = Object.hasOwn(r, "flatten") ? r.flatten : l, this.currResultType = Object.hasOwn(r, "resultType") ? r.resultType : this.currResultType, this.currSandbox = Object.hasOwn(r, "sandbox") ? r.sandbox : this.currSandbox, s = Object.hasOwn(r, "wrap") ? r.wrap : s, this.currEval = Object.hasOwn(r, "eval") ? r.eval : this.currEval, a = Object.hasOwn(r, "callback") ? r.callback : a, this.currOtherTypeCallback = Object.hasOwn(r, "otherTypeCallback") ? r.otherTypeCallback : this.currOtherTypeCallback, i = Object.hasOwn(r, "parent") ? r.parent : i, o = Object.hasOwn(r, "parentProperty") ? r.parentProperty : o, r = r.path;
2188
2188
  }
2189
- if (i = i || null, o = o || null, Array.isArray(r) && (r = N.toPathString(r)), !r && r !== "" || !t)
2189
+ if (i = i || null, o = o || null, Array.isArray(r) && (r = P.toPathString(r)), !r && r !== "" || !t)
2190
2190
  return;
2191
- const c = N.toPathArray(r);
2191
+ const c = P.toPathArray(r);
2192
2192
  c[0] === "$" && c.length > 1 && c.shift(), this._hasParentSelector = null;
2193
2193
  const u = this._trace(c, t, ["$"], i, o, a).filter(function(d) {
2194
2194
  return d && !d.isParentSelector;
@@ -2198,32 +2198,32 @@ N.prototype.evaluate = function(r, t, a, n) {
2198
2198
  return l && Array.isArray(f) ? d = d.concat(f) : d.push(f), d;
2199
2199
  }, []) : s ? [] : void 0;
2200
2200
  };
2201
- N.prototype._getPreferredOutput = function(r) {
2201
+ P.prototype._getPreferredOutput = function(r) {
2202
2202
  const t = this.currResultType;
2203
2203
  switch (t) {
2204
2204
  case "all": {
2205
- const a = Array.isArray(r.path) ? r.path : N.toPathArray(r.path);
2206
- return r.pointer = N.toPointer(a), r.path = typeof r.path == "string" ? r.path : N.toPathString(r.path), r;
2205
+ const a = Array.isArray(r.path) ? r.path : P.toPathArray(r.path);
2206
+ return r.pointer = P.toPointer(a), r.path = typeof r.path == "string" ? r.path : P.toPathString(r.path), r;
2207
2207
  }
2208
2208
  case "value":
2209
2209
  case "parent":
2210
2210
  case "parentProperty":
2211
2211
  return r[t];
2212
2212
  case "path":
2213
- return N.toPathString(r[t]);
2213
+ return P.toPathString(r[t]);
2214
2214
  case "pointer":
2215
- return N.toPointer(r.path);
2215
+ return P.toPointer(r.path);
2216
2216
  default:
2217
2217
  throw new TypeError("Unknown result type");
2218
2218
  }
2219
2219
  };
2220
- N.prototype._handleCallback = function(r, t, a) {
2220
+ P.prototype._handleCallback = function(r, t, a) {
2221
2221
  if (t) {
2222
2222
  const n = this._getPreferredOutput(r);
2223
- r.path = typeof r.path == "string" ? r.path : N.toPathString(r.path), t(n, a, r);
2223
+ r.path = typeof r.path == "string" ? r.path : P.toPathString(r.path), t(n, a, r);
2224
2224
  }
2225
2225
  };
2226
- N.prototype._trace = function(r, t, a, n, i, o, l, s) {
2226
+ P.prototype._trace = function(r, t, a, n, i, o, l, s) {
2227
2227
  let c;
2228
2228
  if (!r.length)
2229
2229
  return c = {
@@ -2350,7 +2350,7 @@ N.prototype._trace = function(r, t, a, n, i, o, l, s) {
2350
2350
  }
2351
2351
  return g;
2352
2352
  };
2353
- N.prototype._walk = function(r, t) {
2353
+ P.prototype._walk = function(r, t) {
2354
2354
  if (Array.isArray(r)) {
2355
2355
  const a = r.length;
2356
2356
  for (let n = 0; n < a; n++)
@@ -2359,7 +2359,7 @@ N.prototype._walk = function(r, t) {
2359
2359
  t(a);
2360
2360
  });
2361
2361
  };
2362
- N.prototype._slice = function(r, t, a, n, i, o, l) {
2362
+ P.prototype._slice = function(r, t, a, n, i, o, l) {
2363
2363
  if (!Array.isArray(a))
2364
2364
  return;
2365
2365
  const s = a.length, c = r.split(":"), u = c[2] && Number.parseInt(c[2]) || 1;
@@ -2372,54 +2372,54 @@ N.prototype._slice = function(r, t, a, n, i, o, l) {
2372
2372
  });
2373
2373
  return f;
2374
2374
  };
2375
- N.prototype._eval = function(r, t, a, n, i, o) {
2375
+ P.prototype._eval = function(r, t, a, n, i, o) {
2376
2376
  this.currSandbox._$_parentProperty = o, this.currSandbox._$_parent = i, this.currSandbox._$_property = a, this.currSandbox._$_root = this.json, this.currSandbox._$_v = t;
2377
2377
  const l = r.includes("@path");
2378
- l && (this.currSandbox._$_path = N.toPathString(n.concat([a])));
2378
+ l && (this.currSandbox._$_path = P.toPathString(n.concat([a])));
2379
2379
  const s = this.currEval + "Script:" + r;
2380
- if (!N.cache[s]) {
2380
+ if (!P.cache[s]) {
2381
2381
  let c = r.replaceAll("@parentProperty", "_$_parentProperty").replaceAll("@parent", "_$_parent").replaceAll("@property", "_$_property").replaceAll("@root", "_$_root").replaceAll(/@([.\s)[])/gu, "_$_v$1");
2382
2382
  if (l && (c = c.replaceAll("@path", "_$_path")), this.currEval === "safe" || this.currEval === !0 || this.currEval === void 0)
2383
- N.cache[s] = new this.safeVm.Script(c);
2383
+ P.cache[s] = new this.safeVm.Script(c);
2384
2384
  else if (this.currEval === "native")
2385
- N.cache[s] = new this.vm.Script(c);
2385
+ P.cache[s] = new this.vm.Script(c);
2386
2386
  else if (typeof this.currEval == "function" && this.currEval.prototype && Object.hasOwn(this.currEval.prototype, "runInNewContext")) {
2387
2387
  const u = this.currEval;
2388
- N.cache[s] = new u(c);
2388
+ P.cache[s] = new u(c);
2389
2389
  } else if (typeof this.currEval == "function")
2390
- N.cache[s] = {
2390
+ P.cache[s] = {
2391
2391
  runInNewContext: (u) => this.currEval(c, u)
2392
2392
  };
2393
2393
  else
2394
2394
  throw new TypeError(`Unknown "eval" property "${this.currEval}"`);
2395
2395
  }
2396
2396
  try {
2397
- return N.cache[s].runInNewContext(this.currSandbox);
2397
+ return P.cache[s].runInNewContext(this.currSandbox);
2398
2398
  } catch (c) {
2399
2399
  if (this.ignoreEvalErrors)
2400
2400
  return !1;
2401
2401
  throw new Error("jsonPath: " + c.message + ": " + r);
2402
2402
  }
2403
2403
  };
2404
- N.cache = {};
2405
- N.toPathString = function(r) {
2404
+ P.cache = {};
2405
+ P.toPathString = function(r) {
2406
2406
  const t = r, a = t.length;
2407
2407
  let n = "$";
2408
2408
  for (let i = 1; i < a; i++)
2409
2409
  /^(~|\^|@.*?\(\))$/u.test(t[i]) || (n += /^[0-9*]+$/u.test(t[i]) ? "[" + t[i] + "]" : "['" + t[i] + "']");
2410
2410
  return n;
2411
2411
  };
2412
- N.toPointer = function(r) {
2412
+ P.toPointer = function(r) {
2413
2413
  const t = r, a = t.length;
2414
2414
  let n = "";
2415
2415
  for (let i = 1; i < a; i++)
2416
2416
  /^(~|\^|@.*?\(\))$/u.test(t[i]) || (n += "/" + t[i].toString().replaceAll("~", "~0").replaceAll("/", "~1"));
2417
2417
  return n;
2418
2418
  };
2419
- N.toPathArray = function(r) {
2419
+ P.toPathArray = function(r) {
2420
2420
  const {
2421
2421
  cache: t
2422
- } = N;
2422
+ } = P;
2423
2423
  if (t[r])
2424
2424
  return t[r].concat();
2425
2425
  const a = [], i = r.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu, ";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu, function(o, l) {
@@ -2434,7 +2434,7 @@ N.toPathArray = function(r) {
2434
2434
  });
2435
2435
  return t[r] = i, t[r].concat();
2436
2436
  };
2437
- N.prototype.safeVm = {
2437
+ P.prototype.safeVm = {
2438
2438
  Script: Rg
2439
2439
  };
2440
2440
  const qg = function(r, t, a) {
@@ -2469,11 +2469,11 @@ class Fg {
2469
2469
  return new Function(...n, c)(...o);
2470
2470
  }
2471
2471
  }
2472
- N.prototype.vm = {
2472
+ P.prototype.vm = {
2473
2473
  Script: Fg
2474
2474
  };
2475
2475
  const gl = (r, t) => {
2476
- const a = N({
2476
+ const a = P({
2477
2477
  json: r,
2478
2478
  path: ["$", `[?(@.locator=="${t}")]`]
2479
2479
  });
@@ -2490,7 +2490,7 @@ const gl = (r, t) => {
2490
2490
  return r;
2491
2491
  return r.slice(0, -t.length);
2492
2492
  }, ml = ({ dataModel: r, elementType: t, resultType: a = "value" }) => {
2493
- const n = Zg(t), i = N({
2493
+ const n = Zg(t), i = P({
2494
2494
  path: [
2495
2495
  "$",
2496
2496
  "?(@property === 'exposures' || @property === 'coverages' || @property === 'policyLines'|| @property === 'exposureGroups')",
@@ -2693,7 +2693,7 @@ const gl = (r, t) => {
2693
2693
  }
2694
2694
  };
2695
2695
  };
2696
- var P;
2696
+ var D;
2697
2697
  (function(r) {
2698
2698
  r.assertEqual = (i) => i;
2699
2699
  function t(i) {
@@ -2728,7 +2728,7 @@ var P;
2728
2728
  return i.map((l) => typeof l == "string" ? `'${l}'` : l).join(o);
2729
2729
  }
2730
2730
  r.joinValues = n, r.jsonStringifyReplacer = (i, o) => typeof o == "bigint" ? o.toString() : o;
2731
- })(P || (P = {}));
2731
+ })(D || (D = {}));
2732
2732
  var cn;
2733
2733
  (function(r) {
2734
2734
  r.mergeShapes = (t, a) => ({
@@ -2737,7 +2737,7 @@ var cn;
2737
2737
  // second overwrites first
2738
2738
  });
2739
2739
  })(cn || (cn = {}));
2740
- const j = P.arrayToEnum([
2740
+ const j = D.arrayToEnum([
2741
2741
  "string",
2742
2742
  "nan",
2743
2743
  "number",
@@ -2779,7 +2779,7 @@ const j = P.arrayToEnum([
2779
2779
  default:
2780
2780
  return j.unknown;
2781
2781
  }
2782
- }, m = P.arrayToEnum([
2782
+ }, m = D.arrayToEnum([
2783
2783
  "invalid_type",
2784
2784
  "invalid_literal",
2785
2785
  "custom",
@@ -2841,7 +2841,7 @@ class ne extends Error {
2841
2841
  return this.message;
2842
2842
  }
2843
2843
  get message() {
2844
- return JSON.stringify(this.issues, P.jsonStringifyReplacer, 2);
2844
+ return JSON.stringify(this.issues, D.jsonStringifyReplacer, 2);
2845
2845
  }
2846
2846
  get isEmpty() {
2847
2847
  return this.issues.length === 0;
@@ -2864,19 +2864,19 @@ const Pt = (r, t) => {
2864
2864
  r.received === j.undefined ? a = "Required" : a = `Expected ${r.expected}, received ${r.received}`;
2865
2865
  break;
2866
2866
  case m.invalid_literal:
2867
- a = `Invalid literal value, expected ${JSON.stringify(r.expected, P.jsonStringifyReplacer)}`;
2867
+ a = `Invalid literal value, expected ${JSON.stringify(r.expected, D.jsonStringifyReplacer)}`;
2868
2868
  break;
2869
2869
  case m.unrecognized_keys:
2870
- a = `Unrecognized key(s) in object: ${P.joinValues(r.keys, ", ")}`;
2870
+ a = `Unrecognized key(s) in object: ${D.joinValues(r.keys, ", ")}`;
2871
2871
  break;
2872
2872
  case m.invalid_union:
2873
2873
  a = "Invalid input";
2874
2874
  break;
2875
2875
  case m.invalid_union_discriminator:
2876
- a = `Invalid discriminator value. Expected ${P.joinValues(r.options)}`;
2876
+ a = `Invalid discriminator value. Expected ${D.joinValues(r.options)}`;
2877
2877
  break;
2878
2878
  case m.invalid_enum_value:
2879
- a = `Invalid enum value. Expected ${P.joinValues(r.options)}, received '${r.received}'`;
2879
+ a = `Invalid enum value. Expected ${D.joinValues(r.options)}, received '${r.received}'`;
2880
2880
  break;
2881
2881
  case m.invalid_arguments:
2882
2882
  a = "Invalid function arguments";
@@ -2888,7 +2888,7 @@ const Pt = (r, t) => {
2888
2888
  a = "Invalid date";
2889
2889
  break;
2890
2890
  case m.invalid_string:
2891
- typeof r.validation == "object" ? "includes" in r.validation ? (a = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (a = `${a} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? a = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? a = `Invalid input: must end with "${r.validation.endsWith}"` : P.assertNever(r.validation) : r.validation !== "regex" ? a = `Invalid ${r.validation}` : a = "Invalid";
2891
+ typeof r.validation == "object" ? "includes" in r.validation ? (a = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (a = `${a} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? a = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? a = `Invalid input: must end with "${r.validation.endsWith}"` : D.assertNever(r.validation) : r.validation !== "regex" ? a = `Invalid ${r.validation}` : a = "Invalid";
2892
2892
  break;
2893
2893
  case m.too_small:
2894
2894
  r.type === "array" ? a = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "more than"} ${r.minimum} element(s)` : r.type === "string" ? a = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "over"} ${r.minimum} character(s)` : r.type === "number" ? a = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "date" ? a = `Date must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(r.minimum))}` : a = "Invalid input";
@@ -2909,7 +2909,7 @@ const Pt = (r, t) => {
2909
2909
  a = "Number must be finite";
2910
2910
  break;
2911
2911
  default:
2912
- a = t.defaultError, P.assertNever(r);
2912
+ a = t.defaultError, D.assertNever(r);
2913
2913
  }
2914
2914
  return { message: a };
2915
2915
  };
@@ -3454,7 +3454,7 @@ class fe extends S {
3454
3454
  validation: "base64url",
3455
3455
  code: m.invalid_string,
3456
3456
  message: i.message
3457
- }), a.dirty()) : P.assertNever(i);
3457
+ }), a.dirty()) : D.assertNever(i);
3458
3458
  return { status: a.value, value: t.data };
3459
3459
  }
3460
3460
  _regex(t, a, n) {
@@ -3709,7 +3709,7 @@ class ze extends S {
3709
3709
  let a;
3710
3710
  const n = new H();
3711
3711
  for (const i of this._def.checks)
3712
- i.kind === "int" ? P.isInteger(t.data) || (a = this._getOrReturnCtx(t, a), v(a, {
3712
+ i.kind === "int" ? D.isInteger(t.data) || (a = this._getOrReturnCtx(t, a), v(a, {
3713
3713
  code: m.invalid_type,
3714
3714
  expected: "integer",
3715
3715
  received: "float",
@@ -3735,7 +3735,7 @@ class ze extends S {
3735
3735
  }), n.dirty()) : i.kind === "finite" ? Number.isFinite(t.data) || (a = this._getOrReturnCtx(t, a), v(a, {
3736
3736
  code: m.not_finite,
3737
3737
  message: i.message
3738
- }), n.dirty()) : P.assertNever(i);
3738
+ }), n.dirty()) : D.assertNever(i);
3739
3739
  return { status: n.value, value: t.data };
3740
3740
  }
3741
3741
  gte(t, a) {
@@ -3847,7 +3847,7 @@ class ze extends S {
3847
3847
  return t;
3848
3848
  }
3849
3849
  get isInt() {
3850
- return !!this._def.checks.find((t) => t.kind === "int" || t.kind === "multipleOf" && P.isInteger(t.value));
3850
+ return !!this._def.checks.find((t) => t.kind === "int" || t.kind === "multipleOf" && D.isInteger(t.value));
3851
3851
  }
3852
3852
  get isFinite() {
3853
3853
  let t = null, a = null;
@@ -3897,7 +3897,7 @@ class Ke extends S {
3897
3897
  code: m.not_multiple_of,
3898
3898
  multipleOf: i.value,
3899
3899
  message: i.message
3900
- }), n.dirty()) : P.assertNever(i);
3900
+ }), n.dirty()) : D.assertNever(i);
3901
3901
  return { status: n.value, value: t.data };
3902
3902
  }
3903
3903
  _getInvalidInput(t) {
@@ -4052,7 +4052,7 @@ class pt extends S {
4052
4052
  exact: !1,
4053
4053
  maximum: i.value,
4054
4054
  type: "date"
4055
- }), a.dirty()) : P.assertNever(i);
4055
+ }), a.dirty()) : D.assertNever(i);
4056
4056
  return {
4057
4057
  status: a.value,
4058
4058
  value: new Date(t.data.getTime())
@@ -4299,7 +4299,7 @@ class U extends S {
4299
4299
  _getCached() {
4300
4300
  if (this._cached !== null)
4301
4301
  return this._cached;
4302
- const t = this._def.shape(), a = P.objectKeys(t);
4302
+ const t = this._def.shape(), a = D.objectKeys(t);
4303
4303
  return this._cached = { shape: t, keys: a };
4304
4304
  }
4305
4305
  _parse(t) {
@@ -4506,7 +4506,7 @@ class U extends S {
4506
4506
  }
4507
4507
  pick(t) {
4508
4508
  const a = {};
4509
- return P.objectKeys(t).forEach((n) => {
4509
+ return D.objectKeys(t).forEach((n) => {
4510
4510
  t[n] && this.shape[n] && (a[n] = this.shape[n]);
4511
4511
  }), new U({
4512
4512
  ...this._def,
@@ -4515,7 +4515,7 @@ class U extends S {
4515
4515
  }
4516
4516
  omit(t) {
4517
4517
  const a = {};
4518
- return P.objectKeys(this.shape).forEach((n) => {
4518
+ return D.objectKeys(this.shape).forEach((n) => {
4519
4519
  t[n] || (a[n] = this.shape[n]);
4520
4520
  }), new U({
4521
4521
  ...this._def,
@@ -4530,7 +4530,7 @@ class U extends S {
4530
4530
  }
4531
4531
  partial(t) {
4532
4532
  const a = {};
4533
- return P.objectKeys(this.shape).forEach((n) => {
4533
+ return D.objectKeys(this.shape).forEach((n) => {
4534
4534
  const i = this.shape[n];
4535
4535
  t && !t[n] ? a[n] = i : a[n] = i.optional();
4536
4536
  }), new U({
@@ -4540,7 +4540,7 @@ class U extends S {
4540
4540
  }
4541
4541
  required(t) {
4542
4542
  const a = {};
4543
- return P.objectKeys(this.shape).forEach((n) => {
4543
+ return D.objectKeys(this.shape).forEach((n) => {
4544
4544
  if (t && !t[n])
4545
4545
  a[n] = this.shape[n];
4546
4546
  else {
@@ -4555,7 +4555,7 @@ class U extends S {
4555
4555
  });
4556
4556
  }
4557
4557
  keyof() {
4558
- return Tl(P.objectKeys(this.shape));
4558
+ return Tl(D.objectKeys(this.shape));
4559
4559
  }
4560
4560
  }
4561
4561
  U.create = (r, t) => new U({
@@ -4652,7 +4652,7 @@ pr.create = (r, t) => new pr({
4652
4652
  typeName: w.ZodUnion,
4653
4653
  ...L(t)
4654
4654
  });
4655
- const Ze = (r) => r instanceof fr ? Ze(r.schema) : r instanceof he ? Ze(r.innerType()) : r instanceof yr ? [r.value] : r instanceof Ve ? r.options : r instanceof hr ? P.objectValues(r.enum) : r instanceof br ? Ze(r._def.innerType) : r instanceof ur ? [void 0] : r instanceof dr ? [null] : r instanceof Ae ? [void 0, ...Ze(r.unwrap())] : r instanceof He ? [null, ...Ze(r.unwrap())] : r instanceof Sn || r instanceof Tr ? Ze(r.unwrap()) : r instanceof vr ? Ze(r._def.innerType) : [];
4655
+ const Ze = (r) => r instanceof fr ? Ze(r.schema) : r instanceof he ? Ze(r.innerType()) : r instanceof yr ? [r.value] : r instanceof Ve ? r.options : r instanceof hr ? D.objectValues(r.enum) : r instanceof br ? Ze(r._def.innerType) : r instanceof ur ? [void 0] : r instanceof dr ? [null] : r instanceof Ae ? [void 0, ...Ze(r.unwrap())] : r instanceof He ? [null, ...Ze(r.unwrap())] : r instanceof Sn || r instanceof Tr ? Ze(r.unwrap()) : r instanceof vr ? Ze(r._def.innerType) : [];
4656
4656
  class va extends S {
4657
4657
  _parse(t) {
4658
4658
  const { ctx: a } = this._processInputParams(t);
@@ -4720,7 +4720,7 @@ function pn(r, t) {
4720
4720
  if (r === t)
4721
4721
  return { valid: !0, data: r };
4722
4722
  if (a === j.object && n === j.object) {
4723
- const i = P.objectKeys(t), o = P.objectKeys(r).filter((s) => i.indexOf(s) !== -1), l = { ...r, ...t };
4723
+ const i = D.objectKeys(t), o = D.objectKeys(r).filter((s) => i.indexOf(s) !== -1), l = { ...r, ...t };
4724
4724
  for (const s of o) {
4725
4725
  const c = pn(r[s], t[s]);
4726
4726
  if (!c.valid)
@@ -5133,7 +5133,7 @@ class Ve extends S {
5133
5133
  if (typeof t.data != "string") {
5134
5134
  const a = this._getOrReturnCtx(t), n = this._def.values;
5135
5135
  return v(a, {
5136
- expected: P.joinValues(n),
5136
+ expected: D.joinValues(n),
5137
5137
  received: a.parsedType,
5138
5138
  code: m.invalid_type
5139
5139
  }), x;
@@ -5189,17 +5189,17 @@ class hr extends S {
5189
5189
  super(...arguments), lr.set(this, void 0);
5190
5190
  }
5191
5191
  _parse(t) {
5192
- const a = P.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(t);
5192
+ const a = D.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(t);
5193
5193
  if (n.parsedType !== j.string && n.parsedType !== j.number) {
5194
- const i = P.objectValues(a);
5194
+ const i = D.objectValues(a);
5195
5195
  return v(n, {
5196
- expected: P.joinValues(i),
5196
+ expected: D.joinValues(i),
5197
5197
  received: n.parsedType,
5198
5198
  code: m.invalid_type
5199
5199
  }), x;
5200
5200
  }
5201
- if (ea(this, lr) || yl(this, lr, new Set(P.getValidEnumValues(this._def.values))), !ea(this, lr).has(t.data)) {
5202
- const i = P.objectValues(a);
5201
+ if (ea(this, lr) || yl(this, lr, new Set(D.getValidEnumValues(this._def.values))), !ea(this, lr).has(t.data)) {
5202
+ const i = D.objectValues(a);
5203
5203
  return v(n, {
5204
5204
  received: n.data,
5205
5205
  code: m.invalid_enum_value,
@@ -5316,7 +5316,7 @@ class he extends S {
5316
5316
  return { status: a.value, value: s };
5317
5317
  } else
5318
5318
  return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((l) => dt(l) ? Promise.resolve(i.transform(l.value, o)).then((s) => ({ status: a.value, value: s })) : l);
5319
- P.assertNever(i);
5319
+ D.assertNever(i);
5320
5320
  }
5321
5321
  }
5322
5322
  he.create = (r, t, a) => new he({
@@ -5563,7 +5563,7 @@ var e = /* @__PURE__ */ Object.freeze({
5563
5563
  isValid: dt,
5564
5564
  isAsync: sr,
5565
5565
  get util() {
5566
- return P;
5566
+ return D;
5567
5567
  },
5568
5568
  get objectUtil() {
5569
5569
  return cn;
@@ -16222,11 +16222,19 @@ function UC(r) {
16222
16222
  }
16223
16223
  };
16224
16224
  }
16225
+ const GC = (r, t) => {
16226
+ const a = P({
16227
+ json: r,
16228
+ path: ["$", `[?(@.type=="${t}")]`]
16229
+ });
16230
+ return a.length ? a[0] : null;
16231
+ };
16225
16232
  export {
16226
16233
  Eg as DataFieldTagFeature,
16227
16234
  bC as compareData,
16228
16235
  $g as dataModelToJSONSchema,
16229
16236
  gl as extractElementByLocator,
16237
+ GC as extractElementByType,
16230
16238
  _C as extractElementDataModelFromQuote,
16231
16239
  wC as extractElementDataModelFromSegment,
16232
16240
  ml as extractElementDataModelFromType,