@commercelayer/app-elements 6.3.0 → 6.4.1

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.
@@ -1,174 +1,174 @@
1
1
  "use client";
2
- import { t as L, B as be, D as ye, E as ve, I as je, N as _e, O as Te, P as Ne, Z as R, b as Me, d as we, e as Se, f as Ce, g as $e, h as ke, i as Ee, j as Ve, k as Re, l as F, n as Ae, o as Ie, p as Ze, q as De, r as Oe, s as Pe, u as qe, v as Le, w as Fe, x as Ge, y as ze, z as Ue, A as We, C as Je, F as Be, G as Ye, H as Xe, J as He, K as Qe, L as Ke, M as et, Q as tt, R as at, S as st, T as nt, U as rt, V as lt, W as it, X as ot, Y as ct, _ as ut, $ as dt, a0 as mt, a1 as pt, a2 as ft, a3 as ht, a4 as gt, a5 as xt, a6 as bt, a7 as yt, a8 as vt, a9 as G, aa as jt, ab as _t, ac as Tt, ad as Nt, ae as Mt, af as wt, ag as St, ah as Ct, ai as $t, aj as kt, ak as Et, al as Vt, am as Rt, an as At, ao as It, ap as Zt, aq as Dt, ar as Ot, as as Pt, at as qt, au as Lt, av as Ft, aw as Gt, ax as zt, ay as Ut, az as Wt, aA as Jt, aB as Bt, aC as Yt, aD as Xt, aE as Ht, aF as Qt, aG as Kt, aH as ea, aI as ta, aJ as aa, aK as sa, aL as na, aM as ra, aN as la, aO as ia, aP as oa, aQ as ca, aR as ua, aS as da, aT as ma, aU as t, aV as Z, aW as z, aX as $, aY as pa, aZ as fa, a_ as ha, a$ as te, b0 as y, b1 as v, b2 as T, b3 as E, b4 as D, b5 as M, b6 as j, b7 as ae, b8 as N, b9 as se, ba as ga, bb as ne, bc as xa, bd as U, be as re, bf as ba, bg as ya, bh as le, bi as ie, bj as S, bk as va, bl as w, bm as ja, bn as _a, bo as Ta } from "./main-Zwf-ZNBk.js";
3
- import W, { useReducer as Na, useCallback as C, useMemo as Ma, createContext as wa, useContext as Sa, useState as g, useEffect as _, useRef as O } from "react";
2
+ import { t as F, B as _e, D as Te, E as Ne, I as we, N as Me, O as Ce, P as Se, Z, b as $e, d as ke, e as Ee, f as Ae, g as Ve, h as Re, i as Ie, j as Ze, k as De, l as G, n as Oe, o as qe, p as Pe, q as Le, r as ze, s as Fe, u as Ge, v as Ue, w as Je, x as We, y as Be, z as Ye, A as Xe, C as He, F as Qe, G as Ke, H as et, J as tt, K as at, L as st, M as nt, Q as rt, R as lt, S as it, T as ot, U as ct, V as ut, W as dt, X as mt, Y as pt, _ as ht, $ as ft, a0 as xt, a1 as gt, a2 as bt, a3 as yt, a4 as vt, a5 as jt, a6 as _t, a7 as Tt, a8 as Nt, a9 as U, aa as wt, ab as Mt, ac as Ct, ad as St, ae as $t, af as kt, ag as Et, ah as At, ai as Vt, aj as Rt, ak as It, al as Zt, am as Dt, an as Ot, ao as qt, ap as Pt, aq as Lt, ar as zt, as as Ft, at as Gt, au as Ut, av as Jt, aw as Wt, ax as Bt, ay as Yt, az as Xt, aA as Ht, aB as Qt, aC as Kt, aD as ea, aE as ta, aF as aa, aG as sa, aH as na, aI as ra, aJ as la, aK as ia, aL as oa, aM as ca, aN as ua, aO as da, aP as ma, aQ as pa, aR as ha, aS as fa, aT as xa, aU as t, aV as q, aW as J, aX as E, aY as ga, aZ as ba, a_ as ya, a$ as y, b0 as V, b1 as M, b2 as ne, b3 as b, b4 as v, b5 as w, b6 as N, b7 as R, b8 as T, b9 as re, ba as S, bb as le, bc as va, bd as ie, be as ja, bf as W, bg as B, bh as _a, bi as P, bj as oe, bk as Ta, bl as Na, bm as wa, bn as Ma, bo as Ca } from "./main-DKRFxDxK.js";
3
+ import Y, { useReducer as Sa, useCallback as k, useMemo as ce, createContext as $a, useContext as ka, useState as x, useEffect as _, useRef as ue } from "react";
4
4
  import "react-hook-form";
5
5
  import "wouter";
6
- import { p as J } from "./parseISO-DQvhbRdk.js";
7
- function B(e, a) {
8
- const n = e.match(
6
+ import { p as X } from "./parseISO-Ctdvusm6.js";
7
+ function H(e, a) {
8
+ const s = e.match(
9
9
  /(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?/
10
10
  );
11
- return n ? L(
11
+ return s ? F(
12
12
  Date.UTC(
13
- +n[1],
14
- +n[2] - 1,
15
- +n[3],
16
- +n[4] - (+n[9] || 0) * (n[8] == "-" ? -1 : 1),
17
- +n[5] - (+n[10] || 0) * (n[8] == "-" ? -1 : 1),
18
- +n[6],
19
- +((n[7] || "0") + "00").substring(0, 3)
13
+ +s[1],
14
+ +s[2] - 1,
15
+ +s[3],
16
+ +s[4] - (+s[9] || 0) * (s[8] == "-" ? -1 : 1),
17
+ +s[5] - (+s[10] || 0) * (s[8] == "-" ? -1 : 1),
18
+ +s[6],
19
+ +((s[7] || "0") + "00").substring(0, 3)
20
20
  ),
21
21
  a?.in
22
- ) : L(NaN, a?.in);
22
+ ) : F(NaN, a?.in);
23
23
  }
24
- const b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
24
+ const g = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
25
25
  __proto__: null,
26
- BRAND: be,
27
- DIRTY: ye,
28
- EMPTY_PATH: ve,
29
- INVALID: je,
30
- NEVER: _e,
31
- OK: Te,
32
- ParseStatus: Ne,
33
- Schema: R,
34
- ZodAny: Me,
35
- ZodArray: we,
36
- ZodBigInt: Se,
37
- ZodBoolean: Ce,
38
- ZodBranded: $e,
39
- ZodCatch: ke,
40
- ZodDate: Ee,
41
- ZodDefault: Ve,
42
- ZodDiscriminatedUnion: Re,
43
- ZodEffects: F,
44
- ZodEnum: Ae,
45
- ZodError: Ie,
26
+ BRAND: _e,
27
+ DIRTY: Te,
28
+ EMPTY_PATH: Ne,
29
+ INVALID: we,
30
+ NEVER: Me,
31
+ OK: Ce,
32
+ ParseStatus: Se,
33
+ Schema: Z,
34
+ ZodAny: $e,
35
+ ZodArray: ke,
36
+ ZodBigInt: Ee,
37
+ ZodBoolean: Ae,
38
+ ZodBranded: Ve,
39
+ ZodCatch: Re,
40
+ ZodDate: Ie,
41
+ ZodDefault: Ze,
42
+ ZodDiscriminatedUnion: De,
43
+ ZodEffects: G,
44
+ ZodEnum: Oe,
45
+ ZodError: qe,
46
46
  get ZodFirstPartyTypeKind() {
47
- return Ze;
47
+ return Pe;
48
48
  },
49
- ZodFunction: De,
50
- ZodIntersection: Oe,
51
- ZodIssueCode: Pe,
52
- ZodLazy: qe,
53
- ZodLiteral: Le,
54
- ZodMap: Fe,
55
- ZodNaN: Ge,
56
- ZodNativeEnum: ze,
57
- ZodNever: Ue,
58
- ZodNull: We,
59
- ZodNullable: Je,
60
- ZodNumber: Be,
61
- ZodObject: Ye,
62
- ZodOptional: Xe,
63
- ZodParsedType: He,
64
- ZodPipeline: Qe,
65
- ZodPromise: Ke,
66
- ZodReadonly: et,
67
- ZodRecord: tt,
68
- ZodSchema: R,
69
- ZodSet: at,
70
- ZodString: st,
71
- ZodSymbol: nt,
72
- ZodTransformer: F,
73
- ZodTuple: rt,
74
- ZodType: R,
75
- ZodUndefined: lt,
76
- ZodUnion: it,
77
- ZodUnknown: ot,
78
- ZodVoid: ct,
79
- addIssueToContext: ut,
80
- any: dt,
81
- array: mt,
82
- bigint: pt,
83
- boolean: ft,
84
- coerce: ht,
85
- custom: gt,
86
- date: xt,
87
- datetimeRegex: bt,
88
- defaultErrorMap: yt,
89
- discriminatedUnion: vt,
90
- effect: G,
91
- enum: jt,
92
- function: _t,
93
- getErrorMap: Tt,
94
- getParsedType: Nt,
95
- instanceof: Mt,
96
- intersection: wt,
97
- isAborted: St,
98
- isAsync: Ct,
99
- isDirty: $t,
100
- isValid: kt,
101
- late: Et,
102
- lazy: Vt,
103
- literal: Rt,
104
- makeIssue: At,
105
- map: It,
106
- nan: Zt,
107
- nativeEnum: Dt,
108
- never: Ot,
109
- null: Pt,
110
- nullable: qt,
111
- number: Lt,
112
- object: Ft,
49
+ ZodFunction: Le,
50
+ ZodIntersection: ze,
51
+ ZodIssueCode: Fe,
52
+ ZodLazy: Ge,
53
+ ZodLiteral: Ue,
54
+ ZodMap: Je,
55
+ ZodNaN: We,
56
+ ZodNativeEnum: Be,
57
+ ZodNever: Ye,
58
+ ZodNull: Xe,
59
+ ZodNullable: He,
60
+ ZodNumber: Qe,
61
+ ZodObject: Ke,
62
+ ZodOptional: et,
63
+ ZodParsedType: tt,
64
+ ZodPipeline: at,
65
+ ZodPromise: st,
66
+ ZodReadonly: nt,
67
+ ZodRecord: rt,
68
+ ZodSchema: Z,
69
+ ZodSet: lt,
70
+ ZodString: it,
71
+ ZodSymbol: ot,
72
+ ZodTransformer: G,
73
+ ZodTuple: ct,
74
+ ZodType: Z,
75
+ ZodUndefined: ut,
76
+ ZodUnion: dt,
77
+ ZodUnknown: mt,
78
+ ZodVoid: pt,
79
+ addIssueToContext: ht,
80
+ any: ft,
81
+ array: xt,
82
+ bigint: gt,
83
+ boolean: bt,
84
+ coerce: yt,
85
+ custom: vt,
86
+ date: jt,
87
+ datetimeRegex: _t,
88
+ defaultErrorMap: Tt,
89
+ discriminatedUnion: Nt,
90
+ effect: U,
91
+ enum: wt,
92
+ function: Mt,
93
+ getErrorMap: Ct,
94
+ getParsedType: St,
95
+ instanceof: $t,
96
+ intersection: kt,
97
+ isAborted: Et,
98
+ isAsync: At,
99
+ isDirty: Vt,
100
+ isValid: Rt,
101
+ late: It,
102
+ lazy: Zt,
103
+ literal: Dt,
104
+ makeIssue: Ot,
105
+ map: qt,
106
+ nan: Pt,
107
+ nativeEnum: Lt,
108
+ never: zt,
109
+ null: Ft,
110
+ nullable: Gt,
111
+ number: Ut,
112
+ object: Jt,
113
113
  get objectUtil() {
114
- return Gt;
114
+ return Wt;
115
115
  },
116
- oboolean: zt,
117
- onumber: Ut,
118
- optional: Wt,
119
- ostring: Jt,
120
- pipeline: Bt,
121
- preprocess: Yt,
122
- promise: Xt,
123
- quotelessJson: Ht,
124
- record: Qt,
125
- set: Kt,
126
- setErrorMap: ea,
127
- strictObject: ta,
128
- string: aa,
129
- symbol: sa,
130
- transformer: G,
131
- tuple: na,
132
- undefined: ra,
133
- union: la,
134
- unknown: ia,
116
+ oboolean: Bt,
117
+ onumber: Yt,
118
+ optional: Xt,
119
+ ostring: Ht,
120
+ pipeline: Qt,
121
+ preprocess: Kt,
122
+ promise: ea,
123
+ quotelessJson: ta,
124
+ record: aa,
125
+ set: sa,
126
+ setErrorMap: na,
127
+ strictObject: ra,
128
+ string: la,
129
+ symbol: ia,
130
+ transformer: U,
131
+ tuple: oa,
132
+ undefined: ca,
133
+ union: ua,
134
+ unknown: da,
135
135
  get util() {
136
- return oa;
136
+ return ma;
137
137
  },
138
- void: ca
138
+ void: pa
139
139
  }, Symbol.toStringTag, { value: "Module" }));
140
- var Ca = 1, $a = 4;
141
- function ka(e) {
142
- return ua(e, Ca | $a);
140
+ var Ea = 1, Aa = 4;
141
+ function Va(e) {
142
+ return ha(e, Ea | Aa);
143
143
  }
144
- function A(e, a, n) {
145
- return e == null ? e : da(e, a, n);
144
+ function D(e, a, s) {
145
+ return e == null ? e : fa(e, a, s);
146
146
  }
147
- function Y(e, a) {
148
- return e == null ? !0 : ma(e, a);
147
+ function Q(e, a) {
148
+ return e == null ? !0 : xa(e, a);
149
149
  }
150
- const oe = wa(
150
+ const de = $a(
151
151
  void 0
152
152
  );
153
- function Ea(e, a) {
153
+ function Ra(e, a) {
154
154
  switch (a.type) {
155
155
  case "SET_PATH": {
156
- const n = ka(e.value);
156
+ const s = Va(e.value);
157
157
  if (/actions\.\d\.[\w_]+$/.test(a.path)) {
158
- const s = a.path.replace(/\.[\w_]+$/, "");
159
- z(n, s)?.groups == null && A(n, `${s}.groups`, []);
158
+ const n = a.path.replace(/\.[\w_]+$/, "");
159
+ J(s, n)?.groups == null && D(s, `${n}.groups`, []);
160
160
  }
161
161
  if (a.value === null)
162
162
  if (/\.\d+$/.test(a.path)) {
163
- const s = a.path.replace(/\.\d+$/, ""), o = parseInt(a.path.match(/\d+$/)?.[0] ?? "0", 10), c = z(n, s);
164
- Array.isArray(c) && (c.splice(o, 1), A(n, s, c), c.length === 0 && s.endsWith(".nested.conditions") && Y(n, s.replace(/\.conditions$/, "")));
163
+ const n = a.path.replace(/\.\d+$/, ""), i = parseInt(a.path.match(/\d+$/)?.[0] ?? "0", 10), o = J(s, n);
164
+ Array.isArray(o) && (o.splice(i, 1), D(s, n, o), o.length === 0 && n.endsWith(".nested.conditions") && Q(s, n.replace(/\.conditions$/, "")));
165
165
  } else
166
- Y(n, a.path);
166
+ Q(s, a.path);
167
167
  else
168
- A(n, a.path, a.value);
168
+ D(s, a.path, a.value);
169
169
  return {
170
170
  ...e,
171
- value: n
171
+ value: s
172
172
  };
173
173
  }
174
174
  case "SET_SELECTED_RULE_INDEX":
@@ -177,7 +177,7 @@ function Ea(e, a) {
177
177
  selectedRuleIndex: a.index
178
178
  };
179
179
  case "SET_VALUE":
180
- return Z(e.value, a.value) ? e : (a.value.rules?.length ?? 0) === 0 ? {
180
+ return q(e.value, a.value) ? e : (a.value.rules?.length ?? 0) === 0 ? {
181
181
  selectedRuleIndex: 0,
182
182
  value: {
183
183
  rules: [
@@ -198,48 +198,48 @@ function Ea(e, a) {
198
198
  return e;
199
199
  }
200
200
  }
201
- function Va({
201
+ function Ia({
202
202
  children: e,
203
203
  initialValue: a
204
204
  }) {
205
- const [n, s] = Na(Ea, {
205
+ const [s, n] = Sa(Ra, {
206
206
  value: a.value,
207
207
  selectedRuleIndex: 0
208
- }), o = C((l, i) => {
209
- s({ type: "SET_PATH", path: l, value: i });
210
- }, []), c = C((l) => {
211
- s({ type: "SET_SELECTED_RULE_INDEX", index: l }), l < 0 && setTimeout(() => {
212
- s({ type: "SET_SELECTED_RULE_INDEX", index: 0 });
208
+ }), i = k((r, u) => {
209
+ n({ type: "SET_PATH", path: r, value: u });
210
+ }, []), o = k((r) => {
211
+ n({ type: "SET_SELECTED_RULE_INDEX", index: r }), r < 0 && setTimeout(() => {
212
+ n({ type: "SET_SELECTED_RULE_INDEX", index: 0 });
213
213
  }, 50);
214
- }, []), u = C((l) => {
215
- s({ type: "SET_VALUE", value: l });
216
- }, []), r = Ma(
214
+ }, []), c = k((r) => {
215
+ n({ type: "SET_VALUE", value: r });
216
+ }, []), l = ce(
217
217
  () => ({
218
- state: n,
219
- setPath: o,
220
- setSelectedRuleIndex: c,
221
- setValue: u,
218
+ state: s,
219
+ setPath: i,
220
+ setSelectedRuleIndex: o,
221
+ setValue: c,
222
222
  availableActionTypes: a.availableActionTypes,
223
223
  schemaType: a.schemaType
224
224
  }),
225
225
  [
226
- n,
226
+ s,
227
+ i,
227
228
  o,
228
229
  c,
229
- u,
230
230
  a.availableActionTypes,
231
231
  a.schemaType
232
232
  ]
233
233
  );
234
- return /* @__PURE__ */ t.jsx(oe.Provider, { value: r, children: e });
234
+ return /* @__PURE__ */ t.jsx(de.Provider, { value: l, children: e });
235
235
  }
236
- function x() {
237
- const e = Sa(oe);
236
+ function f() {
237
+ const e = ka(de);
238
238
  if (e === void 0)
239
239
  throw new Error("useRuleEngine must be used within a RuleEngineProvider");
240
240
  return e;
241
241
  }
242
- const ce = [
242
+ const me = [
243
243
  {
244
244
  /** Matches if field value equals provided value
245
245
  * @field Integer, String, Datetime, Boolean
@@ -541,101 +541,156 @@ const ce = [
541
541
  exactMatch: !0
542
542
  }
543
543
  ];
544
- function ue(e) {
544
+ function pe(e) {
545
545
  if (typeof e == "string")
546
- return $(B(e)) ? "datetime" : "string";
546
+ return E(H(e)) ? "datetime" : "string";
547
547
  if (typeof e == "number")
548
548
  return "integer";
549
549
  if (typeof e == "boolean")
550
550
  return "boolean";
551
551
  if (Array.isArray(e)) {
552
552
  if (typeof e[0] == "string")
553
- return $(B(e[0])) ? "datetime" : "string";
553
+ return E(H(e[0])) ? "datetime" : "string";
554
554
  if (typeof e[0] == "number")
555
555
  return "integer";
556
556
  }
557
557
  return "string";
558
558
  }
559
- const de = {
559
+ const he = {
560
560
  market: "markets",
561
561
  tag: "tags",
562
562
  sku: "skus",
563
563
  sku_list: "sku_lists"
564
564
  };
565
- function Ra(e) {
566
- return de[e];
565
+ function Za(e) {
566
+ return he[e];
567
567
  }
568
- function P(e) {
569
- const [a, n] = g(void 0);
568
+ function L(e) {
569
+ const [a, s] = x(void 0);
570
570
  return _(() => {
571
- e?.field != null && pa(e.field).then((s) => {
572
- const o = ce.find(
573
- (c) => c.matcher === e.matcher
571
+ e?.field != null && ga(e.field).then((n) => {
572
+ const i = me.find(
573
+ (o) => o.matcher === e.matcher
574
574
  );
575
- n({
576
- ...s,
577
- matcherInfos: o,
578
- resourceSelectorAvailable: s?.resource?.id != null && Object.keys(de).includes(s.resource.id) && s.path.endsWith(".id") && o?.exactMatch === !0
575
+ s({
576
+ ...n,
577
+ matcherInfos: i,
578
+ resourceSelectorAvailable: n?.resource?.id != null && Object.keys(he).includes(n.resource.id) && n.path.endsWith(".id") && i?.exactMatch === !0
579
579
  });
580
- }).catch((s) => {
581
- console.error("Error fetching field info:", s);
580
+ }).catch((n) => {
581
+ console.error("Error fetching field info:", n);
582
582
  });
583
583
  }, [e?.field, e?.matcher]), { infos: a };
584
584
  }
585
- function me(e) {
586
- return e == null || e.length === 0 ? [] : fa(
587
- ha(
585
+ function fe(e) {
586
+ return e == null || e.length === 0 ? [] : ba(
587
+ ya(
588
588
  e.flatMap((a) => [
589
589
  a?.group,
590
- ...me(a?.nested?.conditions)
590
+ ...fe(a?.nested?.conditions)
591
591
  ])
592
592
  )
593
593
  );
594
594
  }
595
- function pe() {
595
+ function xe() {
596
596
  const {
597
597
  state: { selectedRuleIndex: e, value: a }
598
- } = x();
599
- return me(
598
+ } = f();
599
+ return fe(
600
600
  a.rules?.[e]?.conditions
601
601
  );
602
602
  }
603
- function Aa({
603
+ const Da = ({ children: e }) => /* @__PURE__ */ t.jsx("div", { className: "bg-white rounded-md p-4 shadow-xs flex flex-col gap-2", children: e }), ge = ({ children: e, dropdownItems: a, options: s }) => {
604
+ const [n, i] = x(!0);
605
+ return /* @__PURE__ */ t.jsx("div", { className: "bg-gray-50 rounded-md flex items-center", children: /* @__PURE__ */ t.jsx("div", { className: "flex items-center justify-between gap-2 grow p-2", children: /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col gap-2 grow", children: [
606
+ /* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
607
+ e,
608
+ /* @__PURE__ */ t.jsxs("div", { className: "border border-gray-200 rounded self-stretch flex", children: [
609
+ /* @__PURE__ */ t.jsx(
610
+ "button",
611
+ {
612
+ type: "button",
613
+ onClick: () => {
614
+ i((o) => !o);
615
+ },
616
+ className: "w-11 flex self-stretch justify-center items-center",
617
+ children: /* @__PURE__ */ t.jsx(
618
+ y,
619
+ {
620
+ name: n ? "caretUp" : "caretDown",
621
+ size: 16
622
+ }
623
+ )
624
+ }
625
+ ),
626
+ a != null && /* @__PURE__ */ t.jsx(
627
+ V,
628
+ {
629
+ className: "flex self-stretch border-gray-100 border-l",
630
+ dropdownLabel: /* @__PURE__ */ t.jsx(
631
+ "button",
632
+ {
633
+ type: "button",
634
+ className: "w-11 flex self-stretch justify-center items-center",
635
+ children: /* @__PURE__ */ t.jsx(y, { name: "dotsThreeVertical", size: 16, weight: "bold" })
636
+ }
637
+ ),
638
+ dropdownItems: a
639
+ }
640
+ )
641
+ ] })
642
+ ] }),
643
+ n && /* @__PURE__ */ t.jsx(Da, { children: s })
644
+ ] }) }) });
645
+ }, $ = ({ children: e, label: a, className: s }) => /* @__PURE__ */ t.jsxs(
646
+ "div",
647
+ {
648
+ className: M(
649
+ "flex items-center gap-4 mt-2 first-of-type:mt-0",
650
+ s
651
+ ),
652
+ children: [
653
+ /* @__PURE__ */ t.jsx("div", { className: "basis-[180px] shrink-0", children: a }),
654
+ /* @__PURE__ */ t.jsx("div", { className: "grow", children: e })
655
+ ]
656
+ }
657
+ );
658
+ function Oa({
604
659
  item: e,
605
660
  pathPrefix: a
606
661
  }) {
607
- const { setPath: n } = x();
662
+ const { setPath: s } = f();
608
663
  if (e == null)
609
664
  return null;
610
665
  switch (e.type) {
611
666
  case "buy_x_pay_y":
612
667
  return /* @__PURE__ */ t.jsxs("div", { className: "w-36 flex items-center gap-0.5", children: [
613
668
  /* @__PURE__ */ t.jsx(
614
- y,
669
+ b,
615
670
  {
616
671
  name: `${a}.value.x`,
617
672
  type: "number",
618
673
  suffix: "X",
619
674
  defaultValue: e.value?.x,
620
- onChange: (s) => {
621
- n(
675
+ onChange: (n) => {
676
+ s(
622
677
  `${a}.value.x`,
623
- parseInt(s.currentTarget.value, 10)
678
+ parseInt(n.currentTarget.value, 10)
624
679
  );
625
680
  }
626
681
  }
627
682
  ),
628
683
  /* @__PURE__ */ t.jsx(
629
- y,
684
+ b,
630
685
  {
631
686
  name: `${a}.value.y`,
632
687
  type: "number",
633
688
  suffix: "Y",
634
689
  defaultValue: e.value?.y,
635
- onChange: (s) => {
636
- n(
690
+ onChange: (n) => {
691
+ s(
637
692
  `${a}.value.y`,
638
- parseInt(s.currentTarget.value, 10)
693
+ parseInt(n.currentTarget.value, 10)
639
694
  );
640
695
  }
641
696
  }
@@ -644,31 +699,31 @@ function Aa({
644
699
  case "every_x_discount_y":
645
700
  return /* @__PURE__ */ t.jsxs("div", { className: "w-36 flex items-center gap-0.5", children: [
646
701
  /* @__PURE__ */ t.jsx(
647
- y,
702
+ b,
648
703
  {
649
704
  name: `${a}.value.x`,
650
705
  type: "number",
651
706
  suffix: "X",
652
707
  defaultValue: e.value?.x,
653
- onChange: (s) => {
654
- n(
708
+ onChange: (n) => {
709
+ s(
655
710
  `${a}.value.x`,
656
- parseInt(s.currentTarget.value, 10)
711
+ parseInt(n.currentTarget.value, 10)
657
712
  );
658
713
  }
659
714
  }
660
715
  ),
661
716
  /* @__PURE__ */ t.jsx(
662
- y,
717
+ b,
663
718
  {
664
719
  name: `${a}.value.y`,
665
720
  type: "number",
666
721
  suffix: "Y",
667
722
  defaultValue: e.value?.y,
668
- onChange: (s) => {
669
- n(
723
+ onChange: (n) => {
724
+ s(
670
725
  `${a}.value.y`,
671
- parseInt(s.currentTarget.value, 10)
726
+ parseInt(n.currentTarget.value, 10)
672
727
  );
673
728
  }
674
729
  }
@@ -677,151 +732,148 @@ function Aa({
677
732
  case "fixed_amount":
678
733
  case "fixed_price":
679
734
  return /* @__PURE__ */ t.jsx("div", { className: "w-36", children: /* @__PURE__ */ t.jsx(
680
- y,
735
+ b,
681
736
  {
682
737
  name: `${a}.value`,
683
738
  type: "number",
684
739
  defaultValue: e.value,
685
740
  min: 0,
686
741
  suffix: "cents",
687
- onChange: (s) => {
688
- n(
742
+ onChange: (n) => {
743
+ s(
689
744
  `${a}.value`,
690
- parseInt(s.currentTarget.value, 10)
745
+ parseInt(n.currentTarget.value, 10)
691
746
  );
692
747
  }
693
748
  }
694
749
  ) });
695
750
  case "percentage": {
696
- const s = (e.value * 100).toFixed(2);
751
+ const n = (e.value * 100).toFixed(2);
697
752
  return /* @__PURE__ */ t.jsx("div", { className: "w-24", children: /* @__PURE__ */ t.jsx(
698
- y,
753
+ b,
699
754
  {
700
755
  name: `${a}.value`,
701
756
  type: "number",
702
- defaultValue: s.endsWith(".00") ? s.slice(0, -3) : s,
757
+ defaultValue: n.endsWith(".00") ? n.slice(0, -3) : n,
703
758
  min: 0,
704
759
  max: 100,
705
760
  suffix: "%",
706
- onChange: (o) => {
707
- n(
761
+ onChange: (i) => {
762
+ s(
708
763
  `${a}.value`,
709
- parseFloat(o.currentTarget.value) / 100
764
+ parseFloat(i.currentTarget.value) / 100
710
765
  );
711
766
  }
712
767
  }
713
768
  ) });
714
769
  }
715
770
  default:
716
- return te();
771
+ return ne();
717
772
  }
718
773
  }
719
- function Ia({
774
+ function qa({
720
775
  item: e,
721
776
  index: a,
722
- onDelete: n
777
+ onDelete: s
723
778
  }) {
724
779
  const {
725
- setPath: s,
726
- schemaType: o,
727
- state: { selectedRuleIndex: c },
728
- availableActionTypes: u
729
- } = x(), r = pe(), l = {
780
+ setPath: n,
781
+ schemaType: i,
782
+ state: { selectedRuleIndex: o },
783
+ availableActionTypes: c
784
+ } = f(), l = xe(), r = {
730
785
  percentage: "Percentage discount",
731
786
  fixed_amount: "Fixed amount",
732
787
  fixed_price: "Fixed price",
733
788
  buy_x_pay_y: "Buy X, Pay Y",
734
789
  every_x_discount_y: "Every X, Discount Y"
735
- }, i = `rules.${c}.actions.${a}`;
790
+ }, u = `rules.${o}.actions.${a}`;
736
791
  return _(() => {
737
- r.length === 0 && (e?.groups ?? []).length > 0 && s(`${i}.groups`, []);
738
- }, [r]), /* @__PURE__ */ t.jsx("div", { className: "mb-4 last:mb-0", children: /* @__PURE__ */ t.jsxs("div", { className: "bg-gray-50 rounded-md flex items-center", children: [
739
- /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col grow", children: [
740
- /* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between gap-2 p-2", children: [
741
- /* @__PURE__ */ t.jsx("div", { className: "flex-1", children: /* @__PURE__ */ t.jsx(
742
- v,
792
+ l.length === 0 && (e?.groups ?? []).length > 0 && n(`${u}.groups`, []);
793
+ }, [l]), /* @__PURE__ */ t.jsx("div", { className: "mb-4 last:mb-0", children: /* @__PURE__ */ t.jsxs(
794
+ ge,
795
+ {
796
+ dropdownItems: s != null ? /* @__PURE__ */ t.jsx(
797
+ T,
798
+ {
799
+ label: "Delete",
800
+ onClick: () => {
801
+ n(`${u}`, null), s();
802
+ }
803
+ }
804
+ ) : void 0,
805
+ options: /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
806
+ /* @__PURE__ */ t.jsx(
807
+ $,
743
808
  {
744
- name: `${i}.type`,
745
- defaultValue: e != null ? {
746
- label: l[e.type],
747
- value: e.type
748
- } : void 0,
749
- initialValues: u.map((d) => ({
750
- value: d,
751
- label: l[d]
752
- })),
753
- onSelect: (d) => {
754
- T(d) && s(`${i}.type`, d.value);
755
- }
809
+ label: /* @__PURE__ */ t.jsx(N, { variant: "info", size: "small", children: "Apply to" }),
810
+ children: /* @__PURE__ */ t.jsx(
811
+ Pa,
812
+ {
813
+ value: e?.selector,
814
+ name: `${u}.selector`
815
+ }
816
+ )
756
817
  }
757
- ) }),
758
- /* @__PURE__ */ t.jsx(Aa, { item: e, pathPrefix: i }),
759
- /* @__PURE__ */ t.jsx("div", { className: "text-black font-bold text-sm", children: "ON" }),
760
- /* @__PURE__ */ t.jsx("div", { className: "flex-1", children: /* @__PURE__ */ t.jsx(
761
- Za,
818
+ ),
819
+ (l.length > 0 || (e?.groups ?? []).length > 0) && /* @__PURE__ */ t.jsx(
820
+ $,
762
821
  {
763
- value: e?.selector,
764
- name: `${i}.selector`
822
+ label: /* @__PURE__ */ t.jsx(N, { variant: "info", size: "small", children: "Groups" }),
823
+ children: /* @__PURE__ */ t.jsx(
824
+ v,
825
+ {
826
+ name: `${u}.groups`,
827
+ isMulti: !0,
828
+ value: e?.groups?.map((d) => ({
829
+ label: l.includes(d) ? d : `⚠️   ${d}`,
830
+ value: d
831
+ })),
832
+ initialValues: l.map((d) => ({
833
+ value: d,
834
+ label: d
835
+ })),
836
+ onSelect: (d) => {
837
+ R(d) && (n(
838
+ `${u}.groups`,
839
+ d.map((h) => h.value)
840
+ ), i === "order-rules" && d.length > 0 && n(`${u}.selector`, "order.line_items"));
841
+ }
842
+ }
843
+ )
765
844
  }
766
- ) })
845
+ )
767
846
  ] }),
768
- (r.length > 0 || (e?.groups ?? []).length > 0) && /* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between gap-2 p-2", children: [
769
- /* @__PURE__ */ t.jsx("div", { className: "text-black font-bold text-sm px-2", children: "GROUPS" }),
847
+ children: [
770
848
  /* @__PURE__ */ t.jsx("div", { className: "flex-1", children: /* @__PURE__ */ t.jsx(
771
849
  v,
772
850
  {
773
- name: `${i}.groups`,
774
- isMulti: !0,
775
- value: e?.groups?.map((d) => ({
776
- label: r.includes(d) ? d : `⚠️   ${d}`,
777
- value: d
778
- })),
779
- initialValues: r.map((d) => ({
851
+ name: `${u}.type`,
852
+ defaultValue: e != null ? {
853
+ label: r[e.type],
854
+ value: e.type
855
+ } : void 0,
856
+ initialValues: c.map((d) => ({
780
857
  value: d,
781
- label: d
858
+ label: r[d]
782
859
  })),
783
860
  onSelect: (d) => {
784
- E(d) && (s(
785
- `${i}.groups`,
786
- d.map((h) => h.value)
787
- ), o === "order-rules" && d.length > 0 && s(`${i}.selector`, "order.line_items"));
788
- }
789
- }
790
- ) })
791
- ] })
792
- ] }),
793
- n != null && /* @__PURE__ */ t.jsx(
794
- D,
795
- {
796
- className: "w-8 border-l border-gray-100 flex items-center justify-center self-stretch",
797
- dropdownLabel: /* @__PURE__ */ t.jsx(
798
- "button",
799
- {
800
- type: "button",
801
- className: "flex items-center justify-center self-stretch grow",
802
- children: /* @__PURE__ */ t.jsx(j, { name: "dotsThreeVertical", size: 16, weight: "bold" })
803
- }
804
- ),
805
- dropdownItems: /* @__PURE__ */ t.jsx(
806
- M,
807
- {
808
- label: "Delete",
809
- onClick: () => {
810
- s(`${i}`, null), n();
861
+ w(d) && n(`${u}.type`, d.value);
811
862
  }
812
863
  }
813
- )
814
- }
815
- )
816
- ] }) });
864
+ ) }),
865
+ /* @__PURE__ */ t.jsx(Oa, { item: e, pathPrefix: u })
866
+ ]
867
+ }
868
+ ) });
817
869
  }
818
- function Za({
870
+ function Pa({
819
871
  value: e,
820
872
  name: a
821
873
  }) {
822
- const { setPath: n, schemaType: s } = x(), { t: o } = ae(), c = Da[s].map((u) => ({
823
- value: u,
824
- label: o(`resource_paths.${u}`).replace(
874
+ const { setPath: s, schemaType: n } = f(), { t: i } = re(), o = La[n].map((c) => ({
875
+ value: c,
876
+ label: i(`resource_paths.${c}`).replace(
825
877
  "resource_paths.",
826
878
  ""
827
879
  )
@@ -831,15 +883,15 @@ function Za({
831
883
  {
832
884
  name: a,
833
885
  isSearchable: !1,
834
- initialValues: c,
835
- value: c.find((u) => u.value === e),
836
- onSelect: async (u) => {
837
- T(u) && n(a, u.value);
886
+ initialValues: o,
887
+ value: o.find((c) => c.value === e),
888
+ onSelect: async (c) => {
889
+ w(c) && s(a, c.value);
838
890
  }
839
891
  }
840
892
  );
841
893
  }
842
- const Da = {
894
+ const La = {
843
895
  "order-rules": [
844
896
  "order",
845
897
  "order.line_items",
@@ -853,55 +905,55 @@ const Da = {
853
905
  ],
854
906
  "price-rules": ["price"]
855
907
  };
856
- function Oa({
908
+ function za({
857
909
  actions: e
858
910
  }) {
859
- const [a, n] = g(0), {
860
- setPath: s,
861
- state: { selectedRuleIndex: o }
862
- } = x();
911
+ const [a, s] = x(0), {
912
+ setPath: n,
913
+ state: { selectedRuleIndex: i }
914
+ } = f();
863
915
  return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
864
- /* @__PURE__ */ t.jsx("div", { children: e?.map((c, u, r) => /* @__PURE__ */ t.jsx(
865
- Ia,
916
+ /* @__PURE__ */ t.jsx("div", { children: e?.map((o, c, l) => /* @__PURE__ */ t.jsx(
917
+ qa,
866
918
  {
867
- item: c,
868
- index: u,
869
- onDelete: r.length > 1 ? () => {
870
- n((l) => l + 1);
919
+ item: o,
920
+ index: c,
921
+ onDelete: l.length > 1 ? () => {
922
+ s((r) => r + 1);
871
923
  } : void 0
872
924
  },
873
- `${o}-${u}-${a}`
925
+ `${i}-${c}-${a}`
874
926
  )) }),
875
927
  /* @__PURE__ */ t.jsx("div", { className: "mt-6", children: /* @__PURE__ */ t.jsxs(
876
- N,
928
+ S,
877
929
  {
878
930
  size: "small",
879
931
  variant: "secondary",
880
932
  alignItems: "center",
881
933
  onClick: () => {
882
- s(
883
- `rules.${o}.actions.${e?.length ?? 0}`,
934
+ n(
935
+ `rules.${i}.actions.${e?.length ?? 0}`,
884
936
  void 0
885
937
  );
886
938
  },
887
939
  children: [
888
- /* @__PURE__ */ t.jsx(j, { name: "plusCircle" }),
940
+ /* @__PURE__ */ t.jsx(y, { name: "plusCircle" }),
889
941
  " Add action"
890
942
  ]
891
943
  }
892
944
  ) })
893
945
  ] });
894
946
  }
895
- function Pa({
947
+ function Fa({
896
948
  value: e,
897
949
  name: a
898
950
  }) {
899
- const { setPath: n, schemaType: s } = x(), { t: o } = ae(), c = O(null), u = s === "order-rules" ? "order" : s === "price-rules" ? "price" : void 0, r = se(
900
- qa.filter(
901
- (l) => u != null && l.startsWith(u)
902
- ).map((l) => ({
903
- value: l,
904
- label: o(`resource_paths.${l}`).replace(
951
+ const { setPath: s, schemaType: n } = f(), { t: i } = re(), o = ue(null), c = n === "order-rules" ? "order" : n === "price-rules" ? "price" : void 0, l = le(
952
+ Ga.filter(
953
+ (r) => c != null && r.startsWith(c)
954
+ ).map((r) => ({
955
+ value: r,
956
+ label: i(`resource_paths.${r}`).replace(
905
957
  "resource_paths.",
906
958
  ""
907
959
  )
@@ -911,36 +963,36 @@ function Pa({
911
963
  return /* @__PURE__ */ t.jsx(
912
964
  v,
913
965
  {
914
- ref: c,
966
+ ref: o,
915
967
  name: a,
916
- initialValues: r,
917
- defaultValue: e != null ? r.find((l) => l.value === e) ?? {
968
+ initialValues: l,
969
+ defaultValue: e != null ? l.find((r) => r.value === e) ?? {
918
970
  value: e,
919
971
  label: e
920
972
  } : void 0,
921
973
  asTextSearch: !0,
922
974
  isCreatable: !0,
923
- loadAsyncValues: async (l) => {
924
- if (u == null)
975
+ loadAsyncValues: async (r) => {
976
+ if (c == null)
925
977
  return [];
926
- const i = r.filter(
927
- (m) => m.label.includes(l)
928
- ), d = (await ga([u], l)).filter((m) => m.value.startsWith(l)).map((m) => {
929
- const f = m.type === "relationship" || m.value.endsWith(".metadata") ? `${m.value}.` : m.value;
978
+ const u = l.filter(
979
+ (m) => m.label.includes(r)
980
+ ), d = (await va([c], r)).filter((m) => m.value.startsWith(r)).map((m) => {
981
+ const p = m.type === "relationship" || m.value.endsWith(".metadata") ? `${m.value}.` : m.value;
930
982
  return {
931
- value: f,
932
- label: f
983
+ value: p,
984
+ label: p
933
985
  };
934
- }), h = l.includes(".metadata") ? [{ label: l, value: l }] : [];
935
- return [...i, ...d, ...h];
986
+ }), h = r.includes(".metadata") ? [{ label: r, value: r }] : [];
987
+ return [...u, ...d, ...h];
936
988
  },
937
- onSelect: async (l) => {
938
- T(l) && (n(a, l.value), l.value.toString().endsWith(".") && c.current?.openMenu("first"));
989
+ onSelect: async (r) => {
990
+ w(r) && (s(a, r.value), r.value.toString().endsWith(".") && o.current?.openMenu("first"));
939
991
  }
940
992
  }
941
993
  );
942
994
  }
943
- const qa = [
995
+ const Ga = [
944
996
  "order.billing_address.country_code",
945
997
  "order.country_code",
946
998
  "order.currency_code",
@@ -989,55 +1041,56 @@ const qa = [
989
1041
  "price.processed_at",
990
1042
  "price.amount_cents"
991
1043
  ];
992
- function La({
1044
+ function Ua({
993
1045
  item: e,
994
1046
  pathPrefix: a
995
1047
  }) {
996
- const { setPath: n } = x(), { infos: s } = P(e);
997
- let o = s?.field?.type;
998
- o == null && (o = ue(e?.value));
999
- const c = s?.resource?.id, u = ["tag"], r = [
1048
+ const { setPath: s } = f(), { infos: n } = L(e);
1049
+ let i = n?.field?.type;
1050
+ i == null && (i = pe(e?.value));
1051
+ const o = n?.resource?.id, c = ["tag"], l = [
1000
1052
  "matches",
1001
1053
  "does_not_match",
1002
1054
  "array_match"
1003
- ], l = ce.filter(({ fieldTypes: i, visible: d }) => d !== !1 && i.includes(o)).filter(({ matcher: i }) => c == null || c != null && !u.includes(c) || r.includes(i)).map(({ matcher: i, label: d }) => ({ value: i, label: d }));
1055
+ ], r = me.filter(({ fieldTypes: u, visible: d }) => d !== !1 && u.includes(i)).filter(({ matcher: u }) => o == null || o != null && !c.includes(o) || l.includes(u)).map(({ matcher: u, label: d }) => ({ value: u, label: d }));
1004
1056
  return /* @__PURE__ */ t.jsx(
1005
1057
  v,
1006
1058
  {
1059
+ className: "min-w-[175px]",
1007
1060
  name: `${a}.matcher`,
1008
- value: e != null ? l.find((i) => i.value === e.matcher) ?? {
1061
+ value: e != null ? r.find((u) => u.value === e.matcher) ?? {
1009
1062
  label: e.matcher != null ? `⚠️   ${e.matcher}` : "",
1010
1063
  value: e.matcher
1011
1064
  } : void 0,
1012
- initialValues: l,
1013
- onSelect: (i) => {
1014
- T(i) && (n(`${a}.matcher`, i.value), ne.includes(
1015
- i.value
1016
- ) && n(`${a}.value`, null));
1065
+ initialValues: r,
1066
+ onSelect: (u) => {
1067
+ w(u) && (s(`${a}.matcher`, u.value), ie.includes(
1068
+ u.value
1069
+ ) && s(`${a}.value`, null));
1017
1070
  }
1018
1071
  }
1019
1072
  );
1020
1073
  }
1021
- const fe = ({ value: e, pathKey: a, infos: n }) => {
1022
- const { sdkClient: s } = xa(), { setPath: o } = x(), c = n?.field?.name ?? "id", u = Ra(n?.resource?.id), { data: r, isLoading: l } = U(
1023
- u,
1074
+ const be = ({ value: e, pathKey: a, infos: s }) => {
1075
+ const { sdkClient: n } = ja(), { setPath: i } = f(), o = s?.field?.name ?? "id", c = Za(s?.resource?.id), { data: l, isLoading: r } = W(
1076
+ c,
1024
1077
  "list",
1025
- n?.resource?.id == null ? null : [I({ value: "" })]
1026
- ), { data: i, isLoading: d } = U(
1027
- u,
1078
+ s?.resource?.id == null ? null : [O({ value: "" })]
1079
+ ), { data: u, isLoading: d } = W(
1080
+ c,
1028
1081
  "list",
1029
- n?.resource?.id == null ? null : [
1082
+ s?.resource?.id == null ? null : [
1030
1083
  {
1031
- ...I({ value: "" }),
1084
+ ...O({ value: "" }),
1032
1085
  filters: {
1033
1086
  id_in: Array.isArray(e) ? e : [e]
1034
1087
  }
1035
1088
  }
1036
1089
  ]
1037
- ), h = se([...i ?? [], ...r ?? []], "id");
1038
- function p(m) {
1090
+ ), h = le([...u ?? [], ...l ?? []], "id");
1091
+ function j(m) {
1039
1092
  return {
1040
- label: h?.find((f) => f.id === m.toString())?.name ?? m.toString(),
1093
+ label: h?.find((p) => p.id === m.toString())?.name ?? m.toString(),
1041
1094
  value: m.toString()
1042
1095
  };
1043
1096
  }
@@ -1046,25 +1099,25 @@ const fe = ({ value: e, pathKey: a, infos: n }) => {
1046
1099
  {
1047
1100
  placeholder: "Search...",
1048
1101
  isClearable: !1,
1049
- isMulti: n?.matcherInfos?.isMulti,
1050
- defaultValue: Array.isArray(e) ? e.map(p) : e != null ? p(e) : void 0,
1051
- menuFooterText: r != null && r.meta.recordCount > 25 ? "Type to search for more options." : void 0,
1052
- initialValues: X(h ?? [], c),
1102
+ isMulti: s?.matcherInfos?.isMulti,
1103
+ defaultValue: Array.isArray(e) ? e.map(j) : e != null ? j(e) : void 0,
1104
+ menuFooterText: l != null && l.meta.recordCount > 25 ? "Type to search for more options." : void 0,
1105
+ initialValues: K(h ?? [], o),
1053
1106
  loadAsyncValues: async (m) => {
1054
- const f = await s[u].list(I({ value: m }));
1055
- return X(f, c);
1107
+ const p = await n[c].list(O({ value: m }));
1108
+ return K(p, o);
1056
1109
  },
1057
1110
  onSelect: (m) => {
1058
- E(m) ? o(
1111
+ R(m) ? i(
1059
1112
  a,
1060
- m.map((f) => f.value).filter((f) => f != null)
1061
- ) : T(m) && o(a, m.value);
1113
+ m.map((p) => p.value).filter((p) => p != null)
1114
+ ) : w(m) && i(a, m.value);
1062
1115
  }
1063
1116
  },
1064
- `${n?.matcherInfos?.isMulti?.toString()}-${l}-${d}`
1117
+ `${s?.matcherInfos?.isMulti?.toString()}-${r}-${d}`
1065
1118
  );
1066
1119
  };
1067
- function I({ value: e }) {
1120
+ function O({ value: e }) {
1068
1121
  return {
1069
1122
  pageSize: 25,
1070
1123
  sort: {
@@ -1075,240 +1128,332 @@ function I({ value: e }) {
1075
1128
  }
1076
1129
  };
1077
1130
  }
1078
- function X(e, a) {
1079
- return e.map((n) => ({
1080
- label: n.name,
1131
+ function K(e, a) {
1132
+ return e.map((s) => ({
1133
+ label: s.name,
1081
1134
  // @ts-expect-error TODO: fix this
1082
- value: n[a]
1135
+ value: s[a]
1083
1136
  }));
1084
1137
  }
1085
- const H = {
1138
+ const C = {
1086
1139
  in_and: {
1087
- label: "all of"
1140
+ label: "All of"
1088
1141
  },
1089
1142
  in_or: {
1090
- label: "at least one of"
1143
+ label: "At least one of"
1091
1144
  },
1092
1145
  not_in_and: {
1093
- label: "not any of"
1146
+ label: "Not any of"
1094
1147
  },
1095
1148
  not_in_or: {
1096
- label: "not at least one of"
1149
+ label: "Not at least one of"
1097
1150
  }
1098
1151
  };
1099
- function Q({
1152
+ function ee({
1100
1153
  value: e,
1101
1154
  pathPrefix: a,
1102
- hasResourceSelector: n = !1,
1103
- infos: s
1155
+ hasResourceSelector: s = !1,
1156
+ infos: n
1104
1157
  }) {
1105
- return (typeof e != "object" || Array.isArray(e) || e === null) && (e = {
1106
- in_and: []
1107
- }), /* @__PURE__ */ t.jsx("div", { children: Object.entries(e).map(([o, c], u) => /* @__PURE__ */ t.jsx(
1108
- Fa,
1109
- {
1110
- infos: s,
1111
- hasResourceSelector: n,
1112
- pathPrefix: a,
1113
- defaultValue: c,
1114
- initialMatcher: o
1115
- },
1116
- `${a}.${// biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
1117
- u}`
1118
- )) });
1158
+ const { setPath: i } = f(), o = Object.keys(
1159
+ C
1160
+ )[0], c = ce(() => typeof e == "object" && e !== null && !Array.isArray(e) ? e : {
1161
+ [o]: []
1162
+ }, [e]);
1163
+ _(() => {
1164
+ (typeof e != "object" || Array.isArray(e) || e === null) && i(a, {
1165
+ [o]: []
1166
+ });
1167
+ }, [e]);
1168
+ const l = Object.keys(C).filter(
1169
+ (r) => !(r in c)
1170
+ );
1171
+ return /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col", children: [
1172
+ Object.entries(c).map(([r, u], d) => /* @__PURE__ */ t.jsx(
1173
+ Ja,
1174
+ {
1175
+ infos: n,
1176
+ hasResourceSelector: s,
1177
+ pathPrefix: a,
1178
+ defaultValue: u,
1179
+ initialMatcher: r,
1180
+ remainingKeys: l
1181
+ },
1182
+ `${a}.${// biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
1183
+ d}`
1184
+ )),
1185
+ l.length > 0 && /* @__PURE__ */ t.jsxs(B, { top: "4", children: [
1186
+ /* @__PURE__ */ t.jsx(
1187
+ V,
1188
+ {
1189
+ className: "inline-flex",
1190
+ menuPosition: "bottom-left",
1191
+ dropdownItems: [
1192
+ l.map((r) => /* @__PURE__ */ t.jsx(
1193
+ T,
1194
+ {
1195
+ onClick: () => {
1196
+ i(`${a}.${r}`, []);
1197
+ },
1198
+ label: C[r].label
1199
+ },
1200
+ r
1201
+ ))
1202
+ ],
1203
+ dropdownLabel: /* @__PURE__ */ t.jsx("button", { type: "button", children: /* @__PURE__ */ t.jsxs(N, { className: "flex gap-2 items-center", children: [
1204
+ /* @__PURE__ */ t.jsx(N, { weight: "bold", size: "small", children: "Add value" }),
1205
+ " ",
1206
+ /* @__PURE__ */ t.jsx(y, { name: "caretDown" })
1207
+ ] }) })
1208
+ }
1209
+ ),
1210
+ /* @__PURE__ */ t.jsx(B, { top: "6", bottom: "2", children: /* @__PURE__ */ t.jsx(_a, { variant: "dashed" }) })
1211
+ ] })
1212
+ ] }, l.join("-"));
1119
1213
  }
1120
- function Fa({
1214
+ function Ja({
1121
1215
  initialMatcher: e,
1122
1216
  defaultValue: a,
1123
- pathPrefix: n,
1124
- hasResourceSelector: s,
1125
- infos: o
1217
+ pathPrefix: s,
1218
+ hasResourceSelector: n,
1219
+ infos: i,
1220
+ remainingKeys: o
1126
1221
  }) {
1127
- const [c, u] = g(e), [r, l] = g(e), [i, d] = g(a), { setPath: h } = x();
1128
- return _(() => {
1129
- c !== r && (h(`${n}.${c}`, null), u(r)), h(`${n}.${r}`, i);
1130
- }, [r, i, h]), /* @__PURE__ */ t.jsxs("div", { className: "flex gap-2 mt-2 first-of-type:mt-0", children: [
1131
- /* @__PURE__ */ t.jsx("div", { className: "shrink-0", children: /* @__PURE__ */ t.jsx(
1132
- v,
1133
- {
1134
- defaultValue: [
1135
- { value: r, label: H[r].label }
1136
- ],
1137
- initialValues: Object.entries(H).map(
1138
- ([p, { label: m }]) => ({
1139
- value: p,
1140
- label: m
1141
- })
1142
- ),
1143
- onSelect: (p) => {
1144
- T(p) && l(p.value);
1145
- }
1146
- }
1147
- ) }),
1148
- /* @__PURE__ */ t.jsx("div", { className: "grow", children: s ? /* @__PURE__ */ t.jsx(
1149
- fe,
1150
- {
1151
- infos: o,
1152
- value: i,
1153
- pathKey: `${n}.${r}`
1154
- }
1155
- ) : /* @__PURE__ */ t.jsx(
1156
- v,
1157
- {
1158
- isMulti: !0,
1159
- isCreatable: !0,
1160
- defaultValue: (Array.isArray(i) ? i : []).map((p) => ({
1161
- value: p,
1162
- label: p.toString()
1163
- })),
1164
- initialValues: [],
1165
- onSelect: (p) => {
1166
- E(p) && d(
1167
- p.map(
1168
- (m) => typeof m.value == "boolean" ? m.value.toString() : m.value
1222
+ const [c, l] = x(a), { setPath: r } = f();
1223
+ return /* @__PURE__ */ t.jsx(
1224
+ $,
1225
+ {
1226
+ label: /* @__PURE__ */ t.jsx(
1227
+ V,
1228
+ {
1229
+ className: "inline-flex",
1230
+ menuPosition: "bottom-left",
1231
+ dropdownItems: [
1232
+ o.map((u) => /* @__PURE__ */ t.jsx(
1233
+ T,
1234
+ {
1235
+ onClick: () => {
1236
+ r(`${s}.${u}`, c), r(`${s}.${e}`, null);
1237
+ },
1238
+ label: C[u].label
1239
+ },
1240
+ u
1241
+ )),
1242
+ /* @__PURE__ */ t.jsx(
1243
+ P,
1244
+ {
1245
+ hidden: o.length === 0
1246
+ },
1247
+ "divider"
1248
+ ),
1249
+ /* @__PURE__ */ t.jsx(
1250
+ T,
1251
+ {
1252
+ disabled: o.length === Object.keys(C).length - 1,
1253
+ onClick: () => {
1254
+ r(`${s}.${e}`, null);
1255
+ },
1256
+ label: "Remove"
1257
+ },
1258
+ "remove"
1169
1259
  )
1170
- );
1260
+ ],
1261
+ dropdownLabel: /* @__PURE__ */ t.jsx("button", { type: "button", children: /* @__PURE__ */ t.jsxs(
1262
+ N,
1263
+ {
1264
+ variant: "info",
1265
+ size: "small",
1266
+ className: "flex gap-2 items-center",
1267
+ children: [
1268
+ C[e].label,
1269
+ " ",
1270
+ /* @__PURE__ */ t.jsx(y, { name: "caretDown" })
1271
+ ]
1272
+ }
1273
+ ) })
1171
1274
  }
1172
- }
1173
- ) })
1174
- ] });
1275
+ ),
1276
+ children: n ? /* @__PURE__ */ t.jsx(
1277
+ be,
1278
+ {
1279
+ infos: i,
1280
+ value: c,
1281
+ pathKey: `${s}.${e}`
1282
+ }
1283
+ ) : /* @__PURE__ */ t.jsx(
1284
+ v,
1285
+ {
1286
+ isMulti: !0,
1287
+ isCreatable: !0,
1288
+ placeholder: "Enter value",
1289
+ defaultValue: (Array.isArray(c) ? c : []).map((u) => ({
1290
+ value: u,
1291
+ label: u.toString()
1292
+ })),
1293
+ initialValues: [],
1294
+ onSelect: (u) => {
1295
+ R(u) && l(
1296
+ u.map(
1297
+ (d) => typeof d.value == "boolean" ? d.value.toString() : d.value
1298
+ )
1299
+ );
1300
+ }
1301
+ }
1302
+ )
1303
+ }
1304
+ );
1175
1305
  }
1176
- function Ga({
1306
+ function Wa({
1177
1307
  value: e,
1178
1308
  onChange: a
1179
1309
  }) {
1180
- const [n, s] = g(
1310
+ const [s, n] = x(
1181
1311
  Array.isArray(e) && typeof e[0] == "number" ? e[0] : null
1182
- ), [o, c] = g(
1312
+ ), [i, o] = x(
1183
1313
  Array.isArray(e) && typeof e[1] == "number" ? e[1] : null
1184
1314
  );
1185
1315
  return /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-4", children: [
1186
1316
  /* @__PURE__ */ t.jsx("div", { className: "grow", children: /* @__PURE__ */ t.jsx(
1187
- y,
1317
+ b,
1188
1318
  {
1189
1319
  type: "number",
1190
1320
  placeholder: "Min",
1191
- value: n ?? "",
1192
- onChange: (u) => {
1193
- const r = parseInt(u.currentTarget.value, 10);
1194
- s(Number.isNaN(r) ? null : r), a([Number.isNaN(r) ? null : r, o]);
1321
+ value: s ?? "",
1322
+ onChange: (c) => {
1323
+ const l = parseInt(c.currentTarget.value, 10);
1324
+ n(Number.isNaN(l) ? null : l), a([Number.isNaN(l) ? null : l, i]);
1195
1325
  }
1196
1326
  }
1197
1327
  ) }),
1198
1328
  /* @__PURE__ */ t.jsx("span", { className: "text-gray-300", children: "to" }),
1199
1329
  /* @__PURE__ */ t.jsx("div", { className: "grow", children: /* @__PURE__ */ t.jsx(
1200
- y,
1330
+ b,
1201
1331
  {
1202
1332
  type: "number",
1203
1333
  placeholder: "Max",
1204
- value: o ?? "",
1205
- onChange: (u) => {
1206
- const r = parseInt(u.currentTarget.value, 10);
1207
- c(Number.isNaN(r) ? null : r), a([n, Number.isNaN(r) ? null : r]);
1334
+ value: i ?? "",
1335
+ onChange: (c) => {
1336
+ const l = parseInt(c.currentTarget.value, 10);
1337
+ o(Number.isNaN(l) ? null : l), a([s, Number.isNaN(l) ? null : l]);
1208
1338
  }
1209
1339
  }
1210
1340
  ) })
1211
1341
  ] });
1212
1342
  }
1213
- function za({
1343
+ function Ba({
1214
1344
  value: e,
1215
1345
  onChange: a
1216
1346
  }) {
1217
- const [n, s] = g(
1347
+ const [s, n] = x(
1218
1348
  Array.isArray(e) && typeof e[0] == "string" ? e[0] : null
1219
- ), [o, c] = g(
1349
+ ), [i, o] = x(
1220
1350
  Array.isArray(e) && typeof e[1] == "string" ? e[1] : null
1221
1351
  );
1222
1352
  return /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-4", children: [
1223
1353
  /* @__PURE__ */ t.jsx("div", { className: "grow", children: /* @__PURE__ */ t.jsx(
1224
- y,
1354
+ b,
1225
1355
  {
1226
1356
  type: "text",
1227
1357
  placeholder: "Min",
1228
- value: n ?? "",
1229
- onChange: (u) => {
1230
- const r = u.currentTarget.value;
1231
- s(r), a([r, o]);
1358
+ value: s ?? "",
1359
+ onChange: (c) => {
1360
+ const l = c.currentTarget.value;
1361
+ n(l), a([l, i]);
1232
1362
  }
1233
1363
  }
1234
1364
  ) }),
1235
1365
  /* @__PURE__ */ t.jsx("span", { className: "text-gray-300", children: "to" }),
1236
1366
  /* @__PURE__ */ t.jsx("div", { className: "grow", children: /* @__PURE__ */ t.jsx(
1237
- y,
1367
+ b,
1238
1368
  {
1239
1369
  type: "text",
1240
1370
  placeholder: "Max",
1241
- value: o ?? "",
1242
- onChange: (u) => {
1243
- const r = u.currentTarget.value;
1244
- c(r), a([n, r]);
1371
+ value: i ?? "",
1372
+ onChange: (c) => {
1373
+ const l = c.currentTarget.value;
1374
+ o(l), a([s, l]);
1245
1375
  }
1246
1376
  }
1247
1377
  ) })
1248
1378
  ] });
1249
1379
  }
1250
- function Ua({
1380
+ function Ya({
1251
1381
  item: e,
1252
1382
  pathPrefix: a
1253
1383
  }) {
1254
- const { setPath: n } = x(), { infos: s } = P(e), o = `${a}.value`, [c, u] = g(0), [r, l] = g(e?.matcher), i = e == null || ne.includes(
1384
+ const { setPath: s } = f(), { infos: n } = L(e), i = `${a}.value`, [o, c] = x(0), [l, r] = x(e?.matcher), u = e == null || ie.includes(
1255
1385
  e.matcher
1256
1386
  );
1257
- let d = s?.field?.type;
1258
- he(e) && (d == null && (d = ue(e.value)), (typeof e.value == "string" && /^{{.*}}$/.test(e.value) || Array.isArray(e.value) && e.value.some((p) => typeof p == "string" && /^{{.*}}$/.test(p))) && (d = "string"));
1259
- const h = Ja(d, e?.matcher, s);
1387
+ let d = n?.field?.type;
1388
+ ye(e) && (d == null && (d = pe(e.value)), (typeof e.value == "string" && /^{{.*}}$/.test(e.value) || Array.isArray(e.value) && e.value.some((m) => typeof m == "string" && /^{{.*}}$/.test(m))) && (d = "string"));
1389
+ const h = Xa(d, e?.matcher, n);
1260
1390
  return _(
1261
1391
  function() {
1262
- r !== e?.matcher && (l(e?.matcher), n(o, null), u((m) => m + 1));
1392
+ l !== e?.matcher && (r(e?.matcher), e?.matcher === "array_match" ? s(i, { in_and: [] }) : s(i, null), c((p) => p + 1));
1263
1393
  },
1264
1394
  [h]
1265
- ), i ? null : /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(
1266
- Wa,
1395
+ ), u ? null : h === "arrayMatch" || h === "resourceSelector" && e?.matcher === "array_match" ? /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(
1396
+ te,
1267
1397
  {
1268
1398
  item: e,
1269
1399
  fieldType: d,
1270
1400
  componentType: h,
1271
- pathKey: o
1401
+ pathKey: i
1272
1402
  }
1273
- ) }, c);
1403
+ ) }, o) : /* @__PURE__ */ t.jsx(
1404
+ $,
1405
+ {
1406
+ label: /* @__PURE__ */ t.jsx(N, { variant: "info", size: "small", children: "Value" }),
1407
+ children: /* @__PURE__ */ t.jsx(
1408
+ te,
1409
+ {
1410
+ item: e,
1411
+ fieldType: d,
1412
+ componentType: h,
1413
+ pathKey: i
1414
+ }
1415
+ )
1416
+ },
1417
+ o
1418
+ );
1274
1419
  }
1275
- function Wa({
1420
+ function te({
1276
1421
  item: e,
1277
1422
  fieldType: a,
1278
- componentType: n,
1279
- pathKey: s
1423
+ componentType: s,
1424
+ pathKey: n
1280
1425
  }) {
1281
- const { setPath: o } = x(), { user: c } = re(), { infos: u } = P(e), r = he(e) ? e.value : void 0;
1282
- switch (n) {
1426
+ const { setPath: i } = f(), { user: o } = oe(), { infos: c } = L(e), l = ye(e) ? e.value : void 0;
1427
+ switch (s) {
1283
1428
  case "date": {
1284
- const l = J(typeof r == "string" ? r : "");
1429
+ const r = X(typeof l == "string" ? l : "");
1285
1430
  return /* @__PURE__ */ t.jsx(
1286
- ya,
1431
+ Na,
1287
1432
  {
1288
- value: $(l) ? l : void 0,
1433
+ value: E(r) ? r : void 0,
1289
1434
  showTimeSelect: !0,
1290
1435
  placeholder: "Enter value",
1291
- onChange: (i) => {
1292
- o(s, i?.toJSON());
1436
+ onChange: (u) => {
1437
+ i(n, u?.toJSON());
1293
1438
  },
1294
- timezone: c?.timezone
1439
+ timezone: o?.timezone
1295
1440
  }
1296
1441
  );
1297
1442
  }
1298
1443
  case "dateRange": {
1299
- const l = Array.isArray(r) ? r.map((i) => {
1300
- const d = J(typeof i == "string" ? i : "");
1301
- return $(d) ? d : null;
1444
+ const r = Array.isArray(l) ? l.map((u) => {
1445
+ const d = X(typeof u == "string" ? u : "");
1446
+ return E(d) ? d : null;
1302
1447
  }) : [null, null];
1303
1448
  return /* @__PURE__ */ t.jsx(
1304
- ba,
1449
+ Ta,
1305
1450
  {
1306
- value: l,
1451
+ value: r,
1307
1452
  showTimeSelect: !0,
1308
- onChange: (i) => {
1309
- o(
1310
- s,
1311
- i.map((d) => d?.toJSON() ?? null)
1453
+ onChange: (u) => {
1454
+ i(
1455
+ n,
1456
+ u.map((d) => d?.toJSON() ?? null)
1312
1457
  );
1313
1458
  }
1314
1459
  }
@@ -1316,26 +1461,26 @@ function Wa({
1316
1461
  }
1317
1462
  case "numberRange":
1318
1463
  return /* @__PURE__ */ t.jsx(
1319
- Ga,
1464
+ Wa,
1320
1465
  {
1321
- value: r,
1322
- onChange: (l) => {
1323
- o(s, l);
1466
+ value: l,
1467
+ onChange: (r) => {
1468
+ i(n, r);
1324
1469
  }
1325
1470
  }
1326
1471
  );
1327
1472
  case "textRange":
1328
1473
  return /* @__PURE__ */ t.jsx(
1329
- za,
1474
+ Ba,
1330
1475
  {
1331
- value: r,
1332
- onChange: (l) => {
1333
- o(s, l);
1476
+ value: l,
1477
+ onChange: (r) => {
1478
+ i(n, r);
1334
1479
  }
1335
1480
  }
1336
1481
  );
1337
1482
  case "arrayMatch":
1338
- return /* @__PURE__ */ t.jsx(Q, { infos: u, value: r, pathPrefix: s });
1483
+ return /* @__PURE__ */ t.jsx(ee, { infos: c, value: l, pathPrefix: n });
1339
1484
  case "tag":
1340
1485
  return /* @__PURE__ */ t.jsx(
1341
1486
  v,
@@ -1343,45 +1488,45 @@ function Wa({
1343
1488
  isMulti: !0,
1344
1489
  isClearable: !1,
1345
1490
  isCreatable: !0,
1346
- defaultValue: Array.isArray(r) ? r.map((l) => ({
1347
- label: l.toString(),
1348
- value: l
1491
+ defaultValue: Array.isArray(l) ? l.map((r) => ({
1492
+ label: r.toString(),
1493
+ value: r
1349
1494
  })) : [],
1350
1495
  initialValues: [],
1351
- onSelect: (l) => {
1352
- E(l) && o(
1353
- s,
1354
- l.map((i) => {
1496
+ onSelect: (r) => {
1497
+ R(r) && i(
1498
+ n,
1499
+ r.map((u) => {
1355
1500
  if (a === "integer") {
1356
- const d = parseInt(i.value.toString(), 10);
1501
+ const d = parseInt(u.value.toString(), 10);
1357
1502
  return Number.isNaN(d) ? null : d;
1358
1503
  }
1359
- return i.value;
1360
- }).filter((i) => i != null)
1504
+ return u.value;
1505
+ }).filter((u) => u != null)
1361
1506
  );
1362
1507
  }
1363
1508
  }
1364
1509
  );
1365
1510
  case "resourceSelector":
1366
1511
  return e?.matcher === "array_match" ? /* @__PURE__ */ t.jsx(
1367
- Q,
1512
+ ee,
1368
1513
  {
1369
- infos: u,
1370
- value: r,
1371
- pathPrefix: s,
1514
+ infos: c,
1515
+ value: l,
1516
+ pathPrefix: n,
1372
1517
  hasResourceSelector: !0
1373
1518
  }
1374
- ) : /* @__PURE__ */ t.jsx(fe, { infos: u, value: r, pathKey: s });
1519
+ ) : /* @__PURE__ */ t.jsx(be, { infos: c, value: l, pathKey: n });
1375
1520
  case "number":
1376
1521
  return /* @__PURE__ */ t.jsx(
1377
- y,
1522
+ b,
1378
1523
  {
1379
- name: s,
1524
+ name: n,
1380
1525
  type: "number",
1381
- defaultValue: typeof r == "number" ? r : "",
1526
+ defaultValue: typeof l == "number" ? l : "",
1382
1527
  placeholder: "Enter value",
1383
- onChange: (l) => {
1384
- o(s, parseInt(l.currentTarget.value, 10));
1528
+ onChange: (r) => {
1529
+ i(n, parseInt(r.currentTarget.value, 10));
1385
1530
  }
1386
1531
  }
1387
1532
  );
@@ -1389,59 +1534,59 @@ function Wa({
1389
1534
  return /* @__PURE__ */ t.jsx(
1390
1535
  v,
1391
1536
  {
1392
- name: s,
1393
- defaultValue: typeof r == "boolean" ? {
1394
- label: r ? "Yes" : "No",
1395
- value: r
1537
+ name: n,
1538
+ defaultValue: typeof l == "boolean" ? {
1539
+ label: l ? "Yes" : "No",
1540
+ value: l
1396
1541
  } : void 0,
1397
1542
  initialValues: [
1398
1543
  { label: "Yes", value: !0 },
1399
1544
  { label: "No", value: !1 }
1400
1545
  ],
1401
- onSelect: (l) => {
1402
- T(l) && o(s, l.value);
1546
+ onSelect: (r) => {
1547
+ w(r) && i(n, r.value);
1403
1548
  }
1404
1549
  }
1405
1550
  );
1406
1551
  case "text":
1407
1552
  case null:
1408
1553
  return /* @__PURE__ */ t.jsx(
1409
- y,
1554
+ b,
1410
1555
  {
1411
- name: s,
1556
+ name: n,
1412
1557
  type: "text",
1413
- defaultValue: typeof r == "string" ? r : JSON.stringify(r),
1558
+ defaultValue: typeof l == "string" ? l : JSON.stringify(l),
1414
1559
  placeholder: "Enter value",
1415
- onChange: (l) => {
1416
- o(s, l.currentTarget.value);
1560
+ onChange: (r) => {
1561
+ i(n, r.currentTarget.value);
1417
1562
  }
1418
1563
  }
1419
1564
  );
1420
1565
  default:
1421
- return te();
1566
+ return ne();
1422
1567
  }
1423
1568
  }
1424
- function he(e) {
1569
+ function ye(e) {
1425
1570
  return e != null && "value" in e;
1426
1571
  }
1427
- function Ja(e, a, n) {
1428
- let s = null;
1572
+ function Xa(e, a, s) {
1573
+ let n = null;
1429
1574
  switch (e) {
1430
1575
  case "datetime": {
1431
- s = "date";
1576
+ n = "date";
1432
1577
  break;
1433
1578
  }
1434
1579
  case "boolean": {
1435
- s = "boolean";
1580
+ n = "boolean";
1436
1581
  break;
1437
1582
  }
1438
1583
  case "string": {
1439
- s = "text";
1584
+ n = "text";
1440
1585
  break;
1441
1586
  }
1442
1587
  case "integer":
1443
1588
  case "float": {
1444
- s = "number";
1589
+ n = "number";
1445
1590
  break;
1446
1591
  }
1447
1592
  case "array":
@@ -1449,7 +1594,7 @@ function Ja(e, a, n) {
1449
1594
  case "object":
1450
1595
  break;
1451
1596
  default: {
1452
- s = "text";
1597
+ n = "text";
1453
1598
  break;
1454
1599
  }
1455
1600
  }
@@ -1473,191 +1618,134 @@ function Ja(e, a, n) {
1473
1618
  case "gteq_lt":
1474
1619
  case "gt_lteq":
1475
1620
  case "gteq_lteq": {
1476
- s === "number" && (s = "numberRange"), s === "text" && (s = "textRange"), s === "date" && (s = "dateRange");
1621
+ n === "number" && (n = "numberRange"), n === "text" && (n = "textRange"), n === "date" && (n = "dateRange");
1477
1622
  break;
1478
1623
  }
1479
1624
  case "is_in":
1480
1625
  case "is_not_in": {
1481
- s = "tag";
1626
+ n = "tag";
1482
1627
  break;
1483
1628
  }
1484
1629
  case "array_match": {
1485
- s = "arrayMatch";
1630
+ n = "arrayMatch";
1486
1631
  break;
1487
1632
  }
1488
1633
  }
1489
- return n?.resourceSelectorAvailable && (s = "resourceSelector"), s;
1634
+ return s?.resourceSelectorAvailable && (n = "resourceSelector"), n;
1490
1635
  }
1491
- function Ba({
1636
+ function Ha({
1492
1637
  item: e,
1493
1638
  nestingLevel: a,
1494
- pathPrefix: n,
1495
- onDelete: s
1639
+ pathPrefix: s,
1640
+ onDelete: n
1496
1641
  }) {
1497
- const { setPath: o } = x(), [c, u] = g(!1), r = [];
1498
- return r[0] ??= [], r[0].push(
1499
- /* @__PURE__ */ t.jsx(
1500
- M,
1501
- {
1502
- label: "Set group",
1503
- onClick: () => {
1504
- u(!0);
1505
- }
1506
- }
1507
- )
1508
- ), a < 2 && r[0].push(
1642
+ const { setPath: i } = f(), o = [];
1643
+ return a < 2 && (o[0] ??= [], o[0].push(
1509
1644
  /* @__PURE__ */ t.jsx(
1510
- M,
1645
+ T,
1511
1646
  {
1512
1647
  label: "Nest conditions",
1513
1648
  onClick: () => {
1514
- o(
1515
- `${n}.nested.conditions.${(e?.nested?.conditions ?? []).length}`,
1649
+ i(
1650
+ `${s}.nested.conditions.${(e?.nested?.conditions ?? []).length}`,
1516
1651
  void 0
1517
1652
  );
1518
1653
  }
1519
1654
  }
1520
1655
  )
1521
- ), s != null && (r[1] ??= [], r[1].push(
1656
+ )), n != null && (o[1] ??= [], o[1].push(
1522
1657
  /* @__PURE__ */ t.jsx(
1523
- M,
1658
+ T,
1524
1659
  {
1525
1660
  label: "Delete",
1526
1661
  onClick: () => {
1527
- o(`${n}`, null), s();
1662
+ i(`${s}`, null), n();
1528
1663
  }
1529
1664
  }
1530
1665
  )
1531
- )), /* @__PURE__ */ t.jsxs("div", { children: [
1532
- /* @__PURE__ */ t.jsx(
1533
- Ya,
1534
- {
1535
- onClose: () => u(!1),
1536
- show: c,
1537
- pathPrefix: n,
1538
- item: e
1539
- }
1540
- ),
1541
- e?.group != null && /* @__PURE__ */ t.jsxs("div", { className: "text-xs pb-4", children: [
1542
- "Group: ",
1543
- /* @__PURE__ */ t.jsx(le, { weight: "bold", children: e.group })
1544
- ] }),
1545
- /* @__PURE__ */ t.jsxs("div", { className: "bg-gray-50 rounded-md flex items-center", children: [
1546
- /* @__PURE__ */ t.jsx("div", { className: "flex items-center justify-between gap-2 grow p-2", children: /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col gap-2 grow", children: [
1547
- /* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
1548
- /* @__PURE__ */ t.jsx("div", { className: "flex-1", children: /* @__PURE__ */ t.jsx(
1549
- Pa,
1550
- {
1551
- value: e?.field,
1552
- name: `${n}.field`
1553
- }
1554
- ) }),
1555
- /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(La, { item: e, pathPrefix: n }) })
1556
- ] }),
1557
- /* @__PURE__ */ t.jsx(Ua, { item: e, pathPrefix: n })
1558
- ] }) }),
1559
- r.length > 0 && /* @__PURE__ */ t.jsx(
1560
- D,
1561
- {
1562
- className: "w-8 border-l border-gray-100 flex items-center justify-center self-stretch shrink-0",
1563
- dropdownLabel: /* @__PURE__ */ t.jsx(
1564
- "button",
1565
- {
1566
- type: "button",
1567
- className: "flex items-center justify-center self-stretch grow",
1568
- children: /* @__PURE__ */ t.jsx(j, { name: "dotsThreeVertical", size: 16, weight: "bold" })
1569
- }
1570
- ),
1571
- dropdownItems: r.map((l, i, d) => (
1666
+ )), /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsxs(
1667
+ ge,
1668
+ {
1669
+ dropdownItems: o.map((c, l, r) => (
1670
+ // biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
1671
+ /* @__PURE__ */ t.jsxs(Y.Fragment, { children: [
1672
+ c.map((u, d) => (
1572
1673
  // biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
1573
- /* @__PURE__ */ t.jsxs(W.Fragment, { children: [
1574
- l.map((h, p) => (
1575
- // biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
1576
- /* @__PURE__ */ t.jsx(W.Fragment, { children: h }, p)
1577
- )),
1578
- i < d.length - 1 && /* @__PURE__ */ t.jsx(ie, {})
1579
- ] }, i)
1580
- ))
1581
- }
1582
- )
1583
- ] })
1584
- ] });
1674
+ /* @__PURE__ */ t.jsx(Y.Fragment, { children: u }, d)
1675
+ )),
1676
+ l < r.length - 1 && /* @__PURE__ */ t.jsx(P, {})
1677
+ ] }, l)
1678
+ )),
1679
+ options: /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
1680
+ /* @__PURE__ */ t.jsx(Ya, { item: e, pathPrefix: s }),
1681
+ /* @__PURE__ */ t.jsx(Qa, { item: e, pathPrefix: s })
1682
+ ] }),
1683
+ children: [
1684
+ /* @__PURE__ */ t.jsx("div", { className: "flex-1", children: /* @__PURE__ */ t.jsx(Fa, { value: e?.field, name: `${s}.field` }) }),
1685
+ /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(Ua, { item: e, pathPrefix: s }) })
1686
+ ]
1687
+ }
1688
+ ) });
1585
1689
  }
1586
- const Ya = ({
1587
- show: e,
1588
- onClose: a,
1589
- pathPrefix: n,
1590
- item: s
1591
- }) => {
1592
- const o = O(null), { setPath: c } = x(), u = pe(), [r, l] = g(s?.group);
1690
+ const Qa = ({ item: e, pathPrefix: a }) => {
1691
+ const { setPath: s } = f(), n = xe(), [i, o] = x(e?.group);
1593
1692
  return _(() => {
1594
- l(s?.group);
1595
- }, [s?.group, e]), /* @__PURE__ */ t.jsxs(S, { ref: o, show: e, onClose: a, size: "large", children: [
1596
- /* @__PURE__ */ t.jsx(S.Header, { children: "Set group" }),
1597
- /* @__PURE__ */ t.jsxs(S.Body, { children: [
1598
- /* @__PURE__ */ t.jsx(
1693
+ s(`${a}.group`, i);
1694
+ }, [i]), /* @__PURE__ */ t.jsx(
1695
+ $,
1696
+ {
1697
+ label: /* @__PURE__ */ t.jsx(N, { variant: "info", size: "small", children: "Groups" }),
1698
+ children: /* @__PURE__ */ t.jsx(
1599
1699
  v,
1600
1700
  {
1601
- name: `${n}.group`,
1701
+ name: `${a}.group`,
1602
1702
  isCreatable: !0,
1603
1703
  isClearable: !0,
1604
- menuPortalTarget: o.current,
1605
- initialValues: u.map((i) => ({
1704
+ initialValues: n.map((c) => ({
1705
+ value: c,
1706
+ label: c
1707
+ })),
1708
+ value: i != null ? {
1606
1709
  value: i,
1607
1710
  label: i
1608
- })),
1609
- value: r != null ? {
1610
- value: r,
1611
- label: r
1612
1711
  } : void 0,
1613
- onSelect: (i) => {
1614
- (i == null || T(i)) && l(i?.value.toString());
1712
+ onSelect: (c) => {
1713
+ (c == null || w(c)) && o(c?.value.toString());
1615
1714
  },
1616
1715
  placeholder: "Select or create group…"
1617
1716
  }
1618
- ),
1619
- /* @__PURE__ */ t.jsx(va, { top: "2", children: /* @__PURE__ */ t.jsx(le, { size: "small", variant: "info", children: "Choose an existing group or create a new one. Leave empty to remove." }) })
1620
- ] }),
1621
- /* @__PURE__ */ t.jsx(S.Footer, { children: /* @__PURE__ */ t.jsx(
1622
- N,
1623
- {
1624
- onClick: () => {
1625
- c(`${n}.group`, r), a();
1626
- },
1627
- fullWidth: !0,
1628
- children: "Save"
1629
- }
1630
- ) })
1631
- ] });
1717
+ )
1718
+ }
1719
+ );
1632
1720
  };
1633
- function ge({
1721
+ function ve({
1634
1722
  item: e,
1635
1723
  children: a,
1636
- nestingLevel: n = 0,
1637
- pathPrefix: s
1724
+ nestingLevel: s = 0,
1725
+ pathPrefix: n
1638
1726
  }) {
1639
1727
  const {
1640
- state: { selectedRuleIndex: o }
1641
- } = x(), c = e?.conditions_logic?.toLowerCase() ?? "and", { setPath: u } = x(), [r, l] = g(0), i = n > 0;
1728
+ state: { selectedRuleIndex: i }
1729
+ } = f(), o = e?.conditions_logic?.toLowerCase() ?? "and", { setPath: c } = f(), [l, r] = x(0), u = s > 0;
1642
1730
  return /* @__PURE__ */ t.jsxs(
1643
1731
  "div",
1644
1732
  {
1645
- className: w("query-group", {
1646
- "p-4 border border-gray-200 rounded-md": i
1733
+ className: M("query-group", {
1734
+ "p-4 border border-gray-200 rounded-md": u
1647
1735
  }),
1648
1736
  children: [
1649
1737
  a,
1650
1738
  e != null && (e.conditions ?? []).length > 0 && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
1651
- i && /* @__PURE__ */ t.jsxs(
1739
+ u && /* @__PURE__ */ t.jsxs(
1652
1740
  "select",
1653
1741
  {
1654
1742
  onChange: (d) => {
1655
- u(
1656
- `${s}.conditions_logic`,
1743
+ c(
1744
+ `${n}.conditions_logic`,
1657
1745
  d.currentTarget.value
1658
1746
  );
1659
1747
  },
1660
- defaultValue: c,
1748
+ defaultValue: o,
1661
1749
  className: "pl-4 pr-8 py-2 font-bold focus:ring-0 focus:outline-hidden appearance-none bg-gray-50 border border-gray-200 rounded-md text-sm leading-4",
1662
1750
  children: [
1663
1751
  /* @__PURE__ */ t.jsx("option", { value: "and", children: "Nested in AND" }),
@@ -1668,43 +1756,43 @@ function ge({
1668
1756
  /* @__PURE__ */ t.jsx(
1669
1757
  "div",
1670
1758
  {
1671
- className: w({
1672
- "border-l border-gray-200 ml-3 pt-3": i
1759
+ className: M({
1760
+ "border-l border-gray-200 ml-3 pt-3": u
1673
1761
  }),
1674
- children: e?.conditions?.map((d, h, p) => {
1675
- const m = h === p.length - 1;
1762
+ children: e?.conditions?.map((d, h, j) => {
1763
+ const m = h === j.length - 1;
1676
1764
  return /* @__PURE__ */ t.jsxs(
1677
1765
  "div",
1678
1766
  {
1679
1767
  className: "flex items-center mb-4 last:mb-0 relative",
1680
1768
  children: [
1681
- i && /* @__PURE__ */ t.jsx(Xa, { rounded: m }),
1769
+ u && /* @__PURE__ */ t.jsx(Ka, { rounded: m }),
1682
1770
  /* @__PURE__ */ t.jsx(
1683
1771
  "div",
1684
1772
  {
1685
- className: w("w-full", {
1686
- "ml-4": i
1773
+ className: M("w-full", {
1774
+ "ml-4": u
1687
1775
  }),
1688
1776
  children: /* @__PURE__ */ t.jsx(
1689
- ge,
1777
+ ve,
1690
1778
  {
1691
1779
  item: d?.nested ?? void 0,
1692
- nestingLevel: d?.nested != null ? n + 1 : d?.group != null ? 1 : 0,
1693
- pathPrefix: `${s}.conditions.${h}.nested`,
1780
+ nestingLevel: d?.nested != null ? s + 1 : 0,
1781
+ pathPrefix: `${n}.conditions.${h}.nested`,
1694
1782
  children: /* @__PURE__ */ t.jsx(
1695
1783
  "div",
1696
1784
  {
1697
- className: w({
1785
+ className: M({
1698
1786
  "mb-4": d?.nested != null
1699
1787
  }),
1700
1788
  children: /* @__PURE__ */ t.jsx(
1701
- Ba,
1789
+ Ha,
1702
1790
  {
1703
1791
  item: d,
1704
- nestingLevel: n,
1705
- pathPrefix: `${s}.conditions.${h}`,
1706
- onDelete: p.length > 1 || n > 0 ? () => {
1707
- l((f) => f + 1);
1792
+ nestingLevel: s,
1793
+ pathPrefix: `${n}.conditions.${h}`,
1794
+ onDelete: j.length > 1 || s > 0 ? () => {
1795
+ r((p) => p + 1);
1708
1796
  } : void 0
1709
1797
  }
1710
1798
  )
@@ -1716,7 +1804,7 @@ function ge({
1716
1804
  )
1717
1805
  ]
1718
1806
  },
1719
- `${o}-${h}-${r}`
1807
+ `${i}-${h}-${l}`
1720
1808
  );
1721
1809
  })
1722
1810
  }
@@ -1726,7 +1814,7 @@ function ge({
1726
1814
  }
1727
1815
  );
1728
1816
  }
1729
- function Xa({
1817
+ function Ka({
1730
1818
  rounded: e = !1
1731
1819
  }) {
1732
1820
  return e ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
@@ -1734,16 +1822,16 @@ function Xa({
1734
1822
  /* @__PURE__ */ t.jsx("div", { className: "absolute -left-px top-1/2 -translate-y-1/2 w-3.5 h-3.5 border-l border-b rounded-es-sm bg-white border-gray-200" })
1735
1823
  ] }) : /* @__PURE__ */ t.jsx("div", { className: "absolute left-0 top-1/2 -translate-y-1/2 w-3.5 h-px bg-gray-200" });
1736
1824
  }
1737
- function Ha() {
1825
+ function es() {
1738
1826
  const {
1739
1827
  setPath: e,
1740
- state: { value: a, selectedRuleIndex: n }
1741
- } = x(), [s, o] = g(
1742
- a.rules?.[n]?.name ?? ""
1828
+ state: { value: a, selectedRuleIndex: s }
1829
+ } = f(), [n, i] = x(
1830
+ a.rules?.[s]?.name ?? ""
1743
1831
  );
1744
1832
  return _(() => {
1745
- o(a.rules?.[n]?.name ?? "");
1746
- }, [n]), // <Input
1833
+ i(a.rules?.[s]?.name ?? "");
1834
+ }, [s]), // <Input
1747
1835
  // value={value.rules?.[selectedRuleIndex]?.name}
1748
1836
  // onChange={(event) => {
1749
1837
  // const target = event.currentTarget
@@ -1758,63 +1846,63 @@ function Ha() {
1758
1846
  {
1759
1847
  contentEditable: "plaintext-only",
1760
1848
  suppressContentEditableWarning: !0,
1761
- onInput: (c) => {
1762
- const r = c.currentTarget.innerText.replace(/[\n\s]+/g, " ").trim();
1763
- e(`rules.${n}.name`, r);
1849
+ onInput: (o) => {
1850
+ const l = o.currentTarget.innerText.replace(/[\n\s]+/g, " ").trim();
1851
+ e(`rules.${s}.name`, l);
1764
1852
  },
1765
- onKeyDown: (c) => {
1766
- c.key === "Enter" && (c.preventDefault(), c.currentTarget.blur());
1853
+ onKeyDown: (o) => {
1854
+ o.key === "Enter" && (o.preventDefault(), o.currentTarget.blur());
1767
1855
  },
1768
- onBlur: (c) => {
1769
- const u = c.currentTarget;
1770
- u.innerText = u.innerText.replace(/[\n\s]+/g, " ").trim();
1856
+ onBlur: (o) => {
1857
+ const c = o.currentTarget;
1858
+ c.innerText = c.innerText.replace(/[\n\s]+/g, " ").trim();
1771
1859
  },
1772
- children: s
1860
+ children: n
1773
1861
  },
1774
- n
1862
+ s
1775
1863
  );
1776
1864
  }
1777
- const K = {
1865
+ const ae = {
1778
1866
  rules: []
1779
- }, k = (e) => {
1867
+ }, A = (e) => {
1780
1868
  try {
1781
- return JSON.parse(e ?? JSON.stringify(K));
1869
+ return JSON.parse(e ?? JSON.stringify(ae));
1782
1870
  } catch {
1783
- return K;
1871
+ return ae;
1784
1872
  }
1785
- }, Qa = (e) => {
1873
+ }, ts = (e) => {
1786
1874
  try {
1787
1875
  return JSON.parse(e ?? "{}"), !0;
1788
1876
  } catch {
1789
1877
  return !1;
1790
1878
  }
1791
1879
  };
1792
- function is(e) {
1880
+ function us(e) {
1793
1881
  const {
1794
1882
  settings: { domain: a }
1795
- } = re(), [n, s] = g([]), [o, c] = g(
1796
- k(e.value ?? e.defaultValue)
1883
+ } = oe(), [s, n] = x([]), [i, o] = x(
1884
+ A(e.value ?? e.defaultValue)
1797
1885
  );
1798
1886
  return _(
1799
1887
  function() {
1800
- o.rules?.length === 0 && c(k(e.value));
1888
+ i.rules?.length === 0 && o(A(e.value));
1801
1889
  },
1802
1890
  [e.value]
1803
1891
  ), _(
1804
1892
  function() {
1805
- ja(e.schemaType, a).then((r) => {
1806
- const i = b.object({
1807
- properties: b.object({
1808
- rules: b.object({
1809
- items: b.object({
1810
- properties: b.object({
1811
- actions: b.object({
1812
- items: b.object({
1813
- anyOf: b.array(
1814
- b.object({
1815
- properties: b.object({
1816
- type: b.object({
1817
- enum: b.string().array()
1893
+ wa(e.schemaType, a).then((l) => {
1894
+ const u = g.object({
1895
+ properties: g.object({
1896
+ rules: g.object({
1897
+ items: g.object({
1898
+ properties: g.object({
1899
+ actions: g.object({
1900
+ items: g.object({
1901
+ anyOf: g.array(
1902
+ g.object({
1903
+ properties: g.object({
1904
+ type: g.object({
1905
+ enum: g.string().array()
1818
1906
  })
1819
1907
  })
1820
1908
  })
@@ -1825,49 +1913,49 @@ function is(e) {
1825
1913
  })
1826
1914
  })
1827
1915
  })
1828
- }).parse(r).properties.rules.items.properties.actions.items.anyOf.flatMap(
1916
+ }).parse(l).properties.rules.items.properties.actions.items.anyOf.flatMap(
1829
1917
  (d) => d.properties.type.enum
1830
1918
  );
1831
- s([...new Set(i)]);
1919
+ n([...new Set(u)]);
1832
1920
  });
1833
1921
  },
1834
1922
  [a]
1835
1923
  ), /* @__PURE__ */ t.jsx(
1836
- Va,
1924
+ Ia,
1837
1925
  {
1838
1926
  initialValue: {
1839
- value: { rules: o.rules },
1840
- availableActionTypes: n,
1927
+ value: { rules: i.rules },
1928
+ availableActionTypes: s,
1841
1929
  schemaType: e.schemaType
1842
1930
  },
1843
- children: /* @__PURE__ */ t.jsx(Ka, { ...e })
1931
+ children: /* @__PURE__ */ t.jsx(as, { ...e })
1844
1932
  }
1845
1933
  );
1846
1934
  }
1847
- function Ka(e) {
1935
+ function as(e) {
1848
1936
  const {
1849
- state: { value: a, selectedRuleIndex: n },
1850
- setSelectedRuleIndex: s,
1851
- setValue: o,
1852
- setPath: c
1853
- } = x(), [u, r] = g(
1937
+ state: { value: a, selectedRuleIndex: s },
1938
+ setSelectedRuleIndex: n,
1939
+ setValue: i,
1940
+ setPath: o
1941
+ } = f(), [c, l] = x(
1854
1942
  e.defaultCodeEditorVisible ?? !1
1855
- ), l = a.rules?.[n], i = O(null), [d, h] = g(0);
1943
+ ), r = a.rules?.[s], u = ue(null), [d, h] = x(0);
1856
1944
  _(
1857
1945
  function() {
1858
- Z(k(i.current?.getValue()), a) || i.current?.setValue(JSON.stringify(a, null, 2)), e.onChange?.(a);
1946
+ q(A(u.current?.getValue()), a) || u.current?.setValue(JSON.stringify(a, null, 2)), e.onChange?.(a);
1859
1947
  },
1860
1948
  [a]
1861
1949
  );
1862
- const p = C(
1950
+ const j = k(
1863
1951
  (m) => {
1864
- const f = k(m);
1865
- i.current?.hasTextFocus() && Qa(m) && !Z(f, a) && (o(f), h((V) => V + 1));
1952
+ const p = A(m);
1953
+ u.current?.hasTextFocus() && ts(m) && !q(p, a) && (i(p), h((I) => I + 1));
1866
1954
  },
1867
1955
  [a]
1868
1956
  );
1869
1957
  return /* @__PURE__ */ t.jsx(
1870
- _a,
1958
+ Ma,
1871
1959
  {
1872
1960
  hint: e.hint,
1873
1961
  feedback: e.feedback,
@@ -1876,12 +1964,12 @@ function Ka(e) {
1876
1964
  /* @__PURE__ */ t.jsxs(
1877
1965
  "div",
1878
1966
  {
1879
- className: `shrink-0 basis-3/5 overflow-x-auto relative flex flex-col ${u ? "" : "grow"}`,
1967
+ className: `shrink-0 basis-3/5 overflow-x-auto relative flex flex-col ${c ? "" : "grow"}`,
1880
1968
  children: [
1881
1969
  /* @__PURE__ */ t.jsxs("header", { className: "w-full bg-white border-b border-gray-200 px-4 flex text-[13px] gap-4 text-gray-400 font-semibold items-center", children: [
1882
1970
  /* @__PURE__ */ t.jsxs("div", { className: "flex items-center flex-wrap basis-full", children: [
1883
- a.rules?.map((m, f, V) => {
1884
- const xe = `#${(f + 1).toString().padStart(2, "0")}`;
1971
+ a.rules?.map((m, p, I) => {
1972
+ const je = `#${(p + 1).toString().padStart(2, "0")}`;
1885
1973
  return /* @__PURE__ */ t.jsxs(
1886
1974
  "div",
1887
1975
  {
@@ -1891,42 +1979,42 @@ function Ka(e) {
1891
1979
  "button",
1892
1980
  {
1893
1981
  type: "button",
1894
- className: w("font-bold mr-2", {
1895
- "text-black": n === f
1982
+ className: M("font-bold mr-2", {
1983
+ "text-black": s === p
1896
1984
  }),
1897
1985
  onClick: () => {
1898
- s(f);
1986
+ n(p);
1899
1987
  },
1900
- children: xe
1988
+ children: je
1901
1989
  }
1902
1990
  ),
1903
1991
  /* @__PURE__ */ t.jsx(
1904
- D,
1992
+ V,
1905
1993
  {
1906
- menuPosition: f === 0 ? "bottom-left" : "bottom-right",
1907
- dropdownLabel: /* @__PURE__ */ t.jsx(N, { variant: "circle", children: /* @__PURE__ */ t.jsx(j, { name: "dotsThreeVertical", size: 16 }) }),
1994
+ menuPosition: p === 0 ? "bottom-left" : "bottom-right",
1995
+ dropdownLabel: /* @__PURE__ */ t.jsx(S, { variant: "circle", children: /* @__PURE__ */ t.jsx(y, { name: "dotsThreeVertical", size: 16 }) }),
1908
1996
  dropdownItems: /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
1909
1997
  /* @__PURE__ */ t.jsx(
1910
- M,
1998
+ T,
1911
1999
  {
1912
2000
  onClick: () => {
1913
- const q = a.rules?.length ?? 0;
1914
- c(`rules.${q}`, {
2001
+ const z = a.rules?.length ?? 0;
2002
+ o(`rules.${z}`, {
1915
2003
  ...m,
1916
2004
  id: void 0,
1917
2005
  name: `${m.name} (copy)`
1918
- }), s(q);
2006
+ }), n(z);
1919
2007
  },
1920
2008
  label: "Duplicate"
1921
2009
  }
1922
2010
  ),
1923
- /* @__PURE__ */ t.jsx(ie, {}),
2011
+ /* @__PURE__ */ t.jsx(P, {}),
1924
2012
  /* @__PURE__ */ t.jsx(
1925
- M,
2013
+ T,
1926
2014
  {
1927
- disabled: V.length === 1,
2015
+ disabled: I.length === 1,
1928
2016
  onClick: () => {
1929
- c(`rules.${f}`, null), n >= f && s(n - 1);
2017
+ o(`rules.${p}`, null), s >= p && n(s - 1);
1930
2018
  },
1931
2019
  label: "Delete"
1932
2020
  }
@@ -1936,43 +2024,43 @@ function Ka(e) {
1936
2024
  )
1937
2025
  ]
1938
2026
  },
1939
- `${f}-${m.id}`
2027
+ `${p}-${m.id}`
1940
2028
  );
1941
2029
  }),
1942
2030
  /* @__PURE__ */ t.jsx("div", { className: "min-h-[49px] flex items-center", children: /* @__PURE__ */ t.jsx(
1943
- N,
2031
+ S,
1944
2032
  {
1945
2033
  variant: "circle",
1946
2034
  className: "mx-4",
1947
2035
  onClick: () => {
1948
- c(`rules.${a.rules?.length ?? 0}`, {
2036
+ o(`rules.${a.rules?.length ?? 0}`, {
1949
2037
  name: "Rule name",
1950
2038
  actions: [null],
1951
2039
  conditions: [null]
1952
- }), s(a.rules?.length ?? 0);
2040
+ }), n(a.rules?.length ?? 0);
1953
2041
  },
1954
- children: /* @__PURE__ */ t.jsx(j, { name: "plus", size: 16, className: "shrink-0" })
2042
+ children: /* @__PURE__ */ t.jsx(y, { name: "plus", size: 16, className: "shrink-0" })
1955
2043
  }
1956
2044
  ) })
1957
2045
  ] }),
1958
2046
  /* @__PURE__ */ t.jsx("div", { className: "grow flex justify-end", children: /* @__PURE__ */ t.jsx(
1959
- N,
2047
+ S,
1960
2048
  {
1961
2049
  variant: "circle",
1962
2050
  onClick: () => {
1963
- r(!u);
2051
+ l(!c);
1964
2052
  },
1965
- children: /* @__PURE__ */ t.jsx(j, { name: "sidebarSimple", size: 16 })
2053
+ children: /* @__PURE__ */ t.jsx(y, { name: "sidebarSimple", size: 16 })
1966
2054
  }
1967
2055
  ) })
1968
2056
  ] }),
1969
- /* @__PURE__ */ t.jsx(ts, { children: l && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
2057
+ /* @__PURE__ */ t.jsx(ns, { children: r && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
1970
2058
  /* @__PURE__ */ t.jsxs("div", { className: "mb-8 flex items-center gap-2", children: [
1971
- /* @__PURE__ */ t.jsx(Ha, {}),
1972
- /* @__PURE__ */ t.jsx(j, { name: "pencilSimple", size: 16, className: "shrink-0" })
2059
+ /* @__PURE__ */ t.jsx(es, {}),
2060
+ /* @__PURE__ */ t.jsx(y, { name: "pencilSimple", size: 16, className: "shrink-0" })
1973
2061
  ] }),
1974
2062
  /* @__PURE__ */ t.jsxs(
1975
- ee,
2063
+ se,
1976
2064
  {
1977
2065
  title: /* @__PURE__ */ t.jsxs("div", { children: [
1978
2066
  "If",
@@ -1981,12 +2069,12 @@ function Ka(e) {
1981
2069
  "select",
1982
2070
  {
1983
2071
  onChange: (m) => {
1984
- c(
1985
- `rules.${n}.conditions_logic`,
2072
+ o(
2073
+ `rules.${s}.conditions_logic`,
1986
2074
  m.currentTarget.value
1987
2075
  );
1988
2076
  },
1989
- value: l?.conditions_logic ?? "all",
2077
+ value: r?.conditions_logic ?? "all",
1990
2078
  className: "font-bold py-1 pl-2 pr-6 bg-position-[right_center] focus:ring-0 focus:outline-hidden appearance-none border-0 rounded-md leading-4 ml-1 mr-1.5",
1991
2079
  children: [
1992
2080
  /* @__PURE__ */ t.jsx("option", { value: "and", children: "all" }),
@@ -1999,26 +2087,26 @@ function Ka(e) {
1999
2087
  icon: "treeView",
2000
2088
  children: [
2001
2089
  /* @__PURE__ */ t.jsx(
2002
- ge,
2090
+ ve,
2003
2091
  {
2004
- item: l,
2005
- pathPrefix: `rules.${n}`
2092
+ item: r,
2093
+ pathPrefix: `rules.${s}`
2006
2094
  }
2007
2095
  ),
2008
2096
  /* @__PURE__ */ t.jsx("div", { className: "mt-6", children: /* @__PURE__ */ t.jsxs(
2009
- N,
2097
+ S,
2010
2098
  {
2011
2099
  size: "small",
2012
2100
  variant: "secondary",
2013
2101
  alignItems: "center",
2014
2102
  onClick: () => {
2015
- c(
2016
- `rules.${n}.conditions.${l?.conditions?.length ?? 0}`,
2103
+ o(
2104
+ `rules.${s}.conditions.${r?.conditions?.length ?? 0}`,
2017
2105
  void 0
2018
2106
  );
2019
2107
  },
2020
2108
  children: [
2021
- /* @__PURE__ */ t.jsx(j, { name: "plusCircle" }),
2109
+ /* @__PURE__ */ t.jsx(y, { name: "plusCircle" }),
2022
2110
  " Add condition"
2023
2111
  ]
2024
2112
  }
@@ -2026,55 +2114,55 @@ function Ka(e) {
2026
2114
  ]
2027
2115
  }
2028
2116
  ),
2029
- /* @__PURE__ */ t.jsx(es, { children: "do" }),
2030
- /* @__PURE__ */ t.jsx(ee, { title: "Actions", icon: "lightning", children: /* @__PURE__ */ t.jsx(Oa, { actions: l?.actions }) })
2117
+ /* @__PURE__ */ t.jsx(ss, { children: "do" }),
2118
+ /* @__PURE__ */ t.jsx(se, { title: "Actions", icon: "lightning", children: /* @__PURE__ */ t.jsx(za, { actions: r?.actions }) })
2031
2119
  ] }) })
2032
2120
  ]
2033
2121
  },
2034
2122
  d
2035
2123
  ),
2036
- u && /* @__PURE__ */ t.jsx("div", { className: "shrink-0 basis-2/5", children: /* @__PURE__ */ t.jsx(
2037
- Ta,
2124
+ c && /* @__PURE__ */ t.jsx("div", { className: "shrink-0 basis-2/5", children: /* @__PURE__ */ t.jsx(
2125
+ Ca,
2038
2126
  {
2039
- ref: i,
2127
+ ref: u,
2040
2128
  name: e.id ?? e.name,
2041
2129
  height: "100%",
2042
2130
  language: "json",
2043
2131
  jsonSchema: e.schemaType,
2044
2132
  defaultValue: JSON.stringify(a, null, 2),
2045
2133
  noRounding: !0,
2046
- onChange: p
2134
+ onChange: j
2047
2135
  }
2048
2136
  ) })
2049
2137
  ] })
2050
2138
  }
2051
2139
  );
2052
2140
  }
2053
- function es({ children: e }) {
2141
+ function ss({ children: e }) {
2054
2142
  return /* @__PURE__ */ t.jsxs("div", { className: "text-gray-500 flex items-center justify-center flex-col", children: [
2055
2143
  /* @__PURE__ */ t.jsx("div", { className: "h-6 w-[2px] bg-gray-200" }),
2056
2144
  /* @__PURE__ */ t.jsx("span", { className: "font-bold my-1 bg-gray-200 px-3 relative uppercase rounded h-[25px] items-center flex text-sm", children: e }),
2057
2145
  /* @__PURE__ */ t.jsx("div", { className: "h-6 w-[2px] bg-gray-200" })
2058
2146
  ] });
2059
2147
  }
2060
- function ee({
2148
+ function se({
2061
2149
  children: e,
2062
2150
  title: a,
2063
- icon: n
2151
+ icon: s
2064
2152
  }) {
2065
2153
  return /* @__PURE__ */ t.jsxs("div", { className: "rounded-md bg-white shadow-xs", children: [
2066
2154
  /* @__PURE__ */ t.jsxs("div", { className: "flex items-center space-x-4 py-4 border-b border-gray-100", children: [
2067
- /* @__PURE__ */ t.jsx("div", { className: "w-8 h-8 -ml-4 bg-white rounded-full border border-gray-200 flex items-center justify-center shadow-xs shadow-primary-200", children: /* @__PURE__ */ t.jsx(j, { name: n }) }),
2155
+ /* @__PURE__ */ t.jsx("div", { className: "w-8 h-8 -ml-4 bg-white rounded-full border border-gray-200 flex items-center justify-center shadow-xs shadow-primary-200", children: /* @__PURE__ */ t.jsx(y, { name: s }) }),
2068
2156
  /* @__PURE__ */ t.jsx("h2", { className: "font-semibold", children: a })
2069
2157
  ] }),
2070
2158
  /* @__PURE__ */ t.jsx("div", { className: "p-6", children: e })
2071
2159
  ] });
2072
2160
  }
2073
- function ts({
2161
+ function ns({
2074
2162
  children: e
2075
2163
  }) {
2076
2164
  return /* @__PURE__ */ t.jsx("div", { className: "h-full w-full bg-gray-50 p-8 bg-[radial-gradient(#d6d6d6_1px,transparent_1px)] bg-size-[16px_16px] overflow-auto", children: /* @__PURE__ */ t.jsx("div", { className: "max-w-[900px] mx-auto", children: e }) });
2077
2165
  }
2078
2166
  export {
2079
- is as RuleEngine
2167
+ us as RuleEngine
2080
2168
  };