import { g as We, p as l, $ as Ke, l as P, B as u, i as n, j as e, k as Je, m as Ie, q as ge, c as h, a0 as jt, r as g, s as R, I as $e, X as yt, bS as Xt, u as se, A as p, v as Kt, az as Zt, t as ye, a as Ve, d as _, cc as Lt, n as Ae, S as xt, b as Ue, e as je, T as Et, a2 as Tt, a1 as ea, w as Ge, z as y, H as ae, f as ee, cb as Wt, Y as De, aN as ta, y as Ot, cJ as aa, Z as la, o as It, _ as Bt, x as He, cK as ra, aC as wt, a3 as ot, a4 as it, E as vt, ap as kt, U as Nt, cL as Gt, a7 as ut, aQ as qt, bJ as na, cA as sa, D as oa, G as ia, aJ as Xe, bs as Rt, cM as gt, aw as Ut, af as ft, b0 as k, cN as ua, bi as zt, a$ as da, h as Ft, cO as Mt, ae as ca, cC as va, cd as pt, F as ga, bh as fa, cP as pa, co as ha, C as ba, at as ma, ad as _a, cQ as ya, cR as Oa } from "./index-G5Vdjjso.js";
import { D as wa } from "./DatePicker-D8XxnXNO.js";
import { M as Aa } from "./Multiselect-BC4w84bl.js";
import xa from "./Button-RzM8s-A-.js";
var Ea = ee('<li role="option" aria-selected="true" tabindex="0"><span class="spectrum-Menu-itemLabel svelte-1mzui26"> </span> <div class="check svelte-1mzui26"><!></div></li>'), Ta = ee('<li class="spectrum-Menu-item empty svelte-1mzui26">No results</li>'), Fa = ee('<div><ul class="spectrum-Menu" role="listbox"><!></ul></div>'), Ra = ee('<div><div><input type="text" class="spectrum-Textfield-input spectrum-InputGroup-input svelte-1mzui26"/></div> <button class="spectrum-Picker spectrum-Picker--sizeM spectrum-InputGroup-button" tabindex="-1" aria-haspopup="true"><!></button></div> <!>', 1);
function Pa(te, t) {
  We(t, !1);
  const c = y();
  let b = l(t, "value", 24, () => {
  }), G = l(t, "id", 24, () => {
  }), f = l(t, "placeholder", 8, "Choose an option or type"), w = l(t, "disabled", 8, !1), r = l(t, "readonly", 8, !1), B = l(t, "options", 24, () => []), E = l(t, "getOptionLabel", 8, (o) => `${o}`), C = l(t, "getOptionValue", 8, (o) => `${o}`), V = l(t, "popoverAutoWidth", 8, !1), j = l(t, "wrapText", 8, !1);
  const D = Ke();
  let m = y(!1), A = y(!1), X = y(), x = y("");
  const $ = (o) => o == null ? "" : String(o).toLowerCase(), ue = (o, d = !0) => {
    D("change", o), u(m, !d);
  }, q = (o) => {
    const d = o.currentTarget.value;
    D("type", d), ue(d, !1);
  }, i = (o) => {
    D("pick", o), ue(o);
  };
  P(() => n(b()), () => {
    u(x, b() || "");
  }), P(
    () => (e(x), n(B()), n(E()), n(C())),
    () => {
      u(c, !e(x).trim() || !B()?.length ? B() : B().filter((o) => {
        const d = $(E()(o)), W = $(C()(o)), H = $(e(x));
        return d.includes(H) || W.includes(H);
      }));
    }
  ), Je(), Ie();
  var T = Ra(), S = ge(T);
  let L;
  var U = h(S);
  let fe;
  var N = h(U);
  jt(N), g(U);
  var z = R(U, 2), M = h(z);
  $e(M, { name: "caret-down", size: "S" }), g(z), g(S), yt(S, (o) => u(X, o), () => e(X));
  var _e = R(S, 2);
  {
    let o = ae(() => V() ? "min-to-anchor" : "fixed-to-anchor"), d = ae(() => V() ? 400 : void 0);
    Xt(_e, {
      get anchor() {
        return e(X);
      },
      get open() {
        return e(m);
      },
      get align() {
        return n(Lt), p(() => Lt.Left);
      },
      get widthMode() {
        return e(o);
      },
      get maxWidth() {
        return e(d);
      },
      closeOnScroll: !0,
      $$events: { close: () => u(m, !1) },
      children: (W, H) => {
        var F = Fa();
        let le;
        var pe = h(F), xe = h(pe);
        {
          var Ee = (re) => {
            var oe = Ae(), Te = ge(oe);
            xt(Te, 1, () => e(c), Et, (s, v) => {
              var a = Ea();
              let O;
              var I = h(a), Q = h(I, !0);
              g(I);
              var he = R(I, 2), K = h(he);
              $e(K, { name: "check", size: "S" }), g(he), g(a), ye(
                (J, ie) => {
                  O = Ve(a, 1, "spectrum-Menu-item svelte-1mzui26", null, O, J), Ue(Q, ie);
                },
                [
                  () => ({ "is-selected": C()(e(v)) === b() }),
                  () => (n(E()), e(v), p(() => E()(e(v))))
                ]
              ), je("click", a, () => i(C()(e(v)))), _(s, a);
            }), _(re, oe);
          }, Se = (re) => {
            var oe = Ta();
            _(re, oe);
          };
          se(xe, (re) => {
            e(c), p(() => e(c) && Array.isArray(e(c)) && e(c).length) ? re(Ee) : re(Se, !1);
          });
        }
        g(pe), g(F), Kt(F, (re, oe) => Zt?.(re, oe), () => () => {
          u(m, !1);
        }), ye((re) => le = Ve(F, 1, "popover-content svelte-1mzui26", null, le, re), [
          () => ({ "auto-width": V(), "wrap-text": j() })
        ]), _(W, F);
      },
      $$slots: { default: !0 }
    });
  }
  ye(
    (o, d) => {
      L = Ve(S, 1, "spectrum-InputGroup svelte-1mzui26", null, L, o), fe = Ve(U, 1, "spectrum-Textfield spectrum-InputGroup-textfield svelte-1mzui26", null, fe, d), Tt(N, "id", G()), ea(N, b() || ""), Tt(N, "placeholder", f() || ""), N.disabled = w(), N.readOnly = r(), z.disabled = w();
    },
    [
      () => ({
        "is-focused": e(m) || e(A),
        "is-disabled": w()
      }),
      () => ({
        "is-disabled": w(),
        "is-focused": e(m) || e(A)
      })
    ]
  ), je("focus", N, () => u(A, !0)), je("blur", N, () => {
    u(A, !1), D("blur");
  }), je("input", N, q), je("click", z, () => u(m, !e(m))), _(te, T), Ge();
}
function Dt(te, t) {
  We(t, !1);
  let c = l(t, "value", 28, () => {
  }), b = l(t, "label", 24, () => {
  }), G = l(t, "disabled", 8, !1), f = l(t, "readonly", 8, !1), w = l(t, "labelPosition", 8, "above"), r = l(t, "error", 24, () => {
  }), B = l(t, "placeholder", 8, "Choose an option or type"), E = l(t, "options", 24, () => []), C = l(t, "helpText", 24, () => {
  }), V = l(t, "required", 8, !1), j = l(t, "popoverAutoWidth", 8, !1), D = l(t, "wrapText", 8, !1);
  const m = (i, T) => {
    if (i && typeof i == "object" && T in i) {
      const L = i[T];
      return typeof L == "string" ? L : typeof L == "number" || typeof L == "boolean" ? String(L) : "";
    }
    return i == null ? "" : String(i);
  }, A = (i) => m(i, "label"), X = (i) => m(i, "value");
  let x = l(t, "getOptionLabel", 8, A), $ = l(t, "getOptionValue", 8, X);
  const ue = Ke(), q = (i) => {
    c(i.detail), ue("change", i.detail);
  };
  Ie(), Wt(te, {
    get helpText() {
      return C();
    },
    get label() {
      return b();
    },
    get labelPosition() {
      return w();
    },
    get error() {
      return r();
    },
    get required() {
      return V();
    },
    children: (i, T) => {
      Pa(i, {
        get disabled() {
          return G();
        },
        get value() {
          return c();
        },
        get options() {
          return E();
        },
        get placeholder() {
          return B();
        },
        get readonly() {
          return f();
        },
        get getOptionLabel() {
          return x();
        },
        get getOptionValue() {
          return $();
        },
        get popoverAutoWidth() {
          return j();
        },
        get wrapText() {
          return D();
        },
        $$events: {
          change: q,
          pick(S) {
            De.call(this, t, S);
          },
          type(S) {
            De.call(this, t, S);
          },
          blur(S) {
            De.call(this, t, S);
          }
        }
      });
    },
    $$slots: { default: !0 }
  }), Ge();
}
function Ht(te, t) {
  We(t, !1);
  const c = y();
  let b = l(t, "value", 28, () => []), G = l(t, "label", 24, () => {
  }), f = l(t, "disabled", 8, !1), w = l(t, "readonly", 8, !1), r = l(t, "labelPosition", 8, "above"), B = l(t, "error", 24, () => {
  }), E = l(t, "placeholder", 24, () => {
  }), C = l(t, "options", 24, () => []), V = l(t, "getOptionLabel", 8, (U) => U), j = l(t, "getOptionValue", 8, (U) => U), D = l(t, "sort", 8, !1), m = l(t, "autoWidth", 8, !1), A = l(t, "popoverAutoWidth", 8, !1), X = l(t, "autocomplete", 8, !1), x = l(t, "searchTerm", 28, () => {
  }), $ = l(t, "customPopoverHeight", 24, () => {
  }), ue = l(t, "helpText", 24, () => {
  }), q = l(t, "onOptionMouseenter", 8, () => {
  }), i = l(t, "onOptionMouseleave", 8, () => {
  }), T = l(t, "searchPlaceholder", 24, () => {
  });
  const S = Ke(), L = (U) => {
    b(U.detail), S("change", U.detail);
  };
  P(() => n(b()), () => {
    u(c, b() && !Array.isArray(b()) ? [b()] : b());
  }), Je(), Ie(), Wt(te, {
    get helpText() {
      return ue();
    },
    get label() {
      return G();
    },
    get labelPosition() {
      return r();
    },
    get error() {
      return B();
    },
    children: (U, fe) => {
      Aa(U, {
        get disabled() {
          return f();
        },
        get readonly() {
          return w();
        },
        get options() {
          return C();
        },
        get placeholder() {
          return E();
        },
        get sort() {
          return D();
        },
        get getOptionLabel() {
          return V();
        },
        get getOptionValue() {
          return j();
        },
        get autoWidth() {
          return m();
        },
        get popoverAutoWidth() {
          return A();
        },
        get autocomplete() {
          return X();
        },
        get customPopoverHeight() {
          return $();
        },
        get onOptionMouseenter() {
          return q();
        },
        get onOptionMouseleave() {
          return i();
        },
        get searchPlaceholder() {
          return T();
        },
        get value() {
          return e(c);
        },
        set value(N) {
          u(c, N);
        },
        get searchTerm() {
          return x();
        },
        set searchTerm(N) {
          x(N);
        },
        $$events: {
          change: L,
          click(N) {
            De.call(this, t, N);
          }
        },
        $$legacy: !0
      });
    },
    $$slots: { default: !0 }
  }), Ge();
}
const Ca = "drawer-container", ht = ut([]), nt = ut(!1), bt = ut(!0), mt = ut(null), _t = ut(null);
let st;
const Va = () => {
  const te = document.getElementsByClassName(Ca)[0];
  if (st || !te)
    return;
  st = new ResizeObserver((c) => {
    if (!c?.[0])
      return;
    const b = c[0].target.getBoundingClientRect();
    mt.set(b.left), _t.set(b.width);
  }), st.observe(te);
  const t = te.getBoundingClientRect();
  mt.set(t.left), _t.set(t.width);
}, Sa = () => {
  qt(ht).length || (st?.disconnect(), st = null, nt.set(!1), bt.set(!0), mt.set(null), _t.set(null));
};
var La = ee('<div class="text svelte-1189ub1"> </div>'), Ba = ee('<div class="drawer-wrapper"><div></div> <div><header class="svelte-1189ub1"><!> <div class="buttons svelte-1189ub1"><!> <!> <!></div></header> <!> <div></div></div></div>');
function $t(te, t) {
  const c = ta(t);
  We(t, !1);
  const b = () => He(ht, "$openDrawers", B), G = () => He(mt, "$drawerLeft", B), f = () => He(_t, "$drawerWidth", B), w = () => He(nt, "$modal", B), r = () => He(bt, "$resizable", B), [B, E] = Ot(), C = y(), V = y();
  let j = l(t, "title", 8, ""), D = l(t, "forceModal", 8, !1), m = l(t, "zIndex", 8, void 0);
  const A = Ke(), X = 11;
  let x = y(!1), $ = aa.generate();
  const ue = (o, d, W, H, F) => {
    let le = `
      --scale-factor: ${U(o)};
      --spacing: ${X}px;
      ${F != null ? `z-index: ${F};` : ""}
    `;
    return H || d == null || W == null ? le : `
      ${le}
      left: ${d + X}px;
      width: ${W - 2 * X}px;
    `;
  };
  function q() {
    e(x) || (D() && (nt.set(!0), bt.set(!1)), Va(), u(x, !0), A("drawerShow", $), ht.update((o) => [...o, $]));
  }
  function i() {
    e(x) && (u(x, !1), A("drawerHide", $), ht.update((o) => o.filter((d) => d !== $)), Sa());
  }
  la("drawer", { hide: i, show: q, modal: nt, resizable: bt });
  const T = (o) => o < 0.5 ? 2 * o * o : 1 - Math.pow(-2 * o + 2, 2) / 2, S = () => ({
    duration: 260,
    css: (o) => {
      const d = T(o);
      return `
          transform: translateY(calc(${(1 - d) * 200}px - 800px * (1 - var(--scale-factor))));
          opacity: ${d};
        `;
    }
  }), L = () => ({
    duration: 260,
    css: (o) => `opacity: ${T(o)};`
  }), U = (o) => 1 - (1 - 1 / (o * o + 1)) * 0.1;
  It(() => {
    e(x) && i();
  }), P(() => b(), () => {
    u(C, b().length - b().indexOf($) - 1);
  }), P(
    () => (e(C), G(), f(), w(), n(m())),
    () => {
      u(V, ue(e(C), G(), f(), w(), m()));
    }
  ), Je();
  var fe = { show: q, hide: i };
  Ie();
  var N = Ae(), z = ge(N);
  {
    var M = (o) => {
      ra(o, {
        target: ".modal-container",
        children: (d, W) => {
          var H = Ba(), F = h(H);
          let le;
          var pe = R(F, 2);
          let xe;
          var Ee = h(pe), Se = h(Ee);
          {
            var re = (K) => {
              var J = Ae(), ie = ge(J);
              vt(ie, t, "title", {}, null), _(K, J);
            }, oe = (K) => {
              var J = La(), ie = h(J, !0);
              g(J), ye(() => Ue(ie, j() || "Bindings")), _(K, J);
            };
            se(Se, (K) => {
              p(() => c.title) ? K(re) : K(oe, !1);
            });
          }
          var Te = R(Se, 2), s = h(Te);
          wt(s, {
            secondary: !0,
            quiet: !0,
            $$events: { click: i },
            children: (K, J) => {
              ot();
              var ie = it("Cancel");
              _(K, ie);
            },
            $$slots: { default: !0 }
          });
          var v = R(s, 2);
          vt(v, t, "buttons", {}, null);
          var a = R(v, 2);
          {
            var O = (K) => {
              Gt(K, {
                size: "M",
                quiet: !0,
                get selected() {
                  return w();
                },
                $$events: { click: () => nt.set(!w()) },
                children: (J, ie) => {
                  {
                    let be = ae(() => w() ? "arrows-in-simple" : "arrows-out-simple");
                    $e(J, {
                      get name() {
                        return e(be);
                      },
                      size: "S"
                    });
                  }
                },
                $$slots: { default: !0 }
              });
            };
            se(a, (K) => {
              r() && K(O);
            });
          }
          g(Te), g(Ee);
          var I = R(Ee, 2);
          vt(I, t, "body", {}, null);
          var Q = R(I, 2);
          let he;
          g(pe), g(H), ye(
            (K, J, ie) => {
              le = Ve(F, 1, "underlay svelte-1189ub1", null, le, K), kt(F, m() != null ? `z-index: ${m() - 1}` : void 0), xe = Ve(pe, 1, "drawer svelte-1189ub1", null, xe, J), kt(pe, e(V)), he = Ve(Q, 1, "overlay svelte-1189ub1", null, he, ie);
            },
            [
              () => ({ hidden: !w() }),
              () => ({ stacked: e(C) > 0, modal: w() }),
              () => ({ hidden: w() || e(C) === 0 })
            ]
          ), Nt(3, F, () => L), Nt(3, pe, () => S), _(d, H);
        },
        $$slots: { default: !0 }
      });
    };
    se(z, (o) => {
      e(x) && o(M);
    });
  }
  _(te, N), Bt(t, "show", q), Bt(t, "hide", i);
  var _e = Ge(fe);
  return E(), _e;
}
var ka = ee('<div class="user-control"><!></div>');
function Na(te, t) {
  We(t, !1);
  const c = () => He(e(f), "$fetch", b), [b, G] = Ot(), f = y(), w = y(), r = y();
  let B = l(t, "API", 24, na), E = l(t, "value", 8, null), C = l(t, "disabled", 8), V = l(t, "multiselect", 8, !1);
  const j = sa("picker");
  P(() => n(B()), () => {
    oa(
      u(f, ia({
        API: B(),
        datasource: { type: "user" },
        options: { limit: 100 }
      })),
      "$fetch",
      b
    );
  }), P(() => c(), () => {
    u(w, c().rows);
  }), P(() => (n(V()), Xe), () => {
    u(r, V() ? Ht : Xe);
  }), Je(), Ie();
  var D = ka(), m = h(D);
  Rt(m, () => e(r), (A, X) => {
    X(A, {
      get value() {
        return E();
      },
      autocomplete: !0,
      get options() {
        return e(w);
      },
      getOptionLabel: (x) => x.email,
      getOptionValue: (x) => x._id,
      get disabled() {
        return C();
      },
      get searchPlaceholder() {
        return p(() => j.searchPlaceholder);
      },
      popoverAutoWidth: !0,
      $$events: {
        change(x) {
          De.call(this, t, x);
        }
      }
    });
  }), g(D), _(te, D), Ge(), G();
}
var za = ee("<div><!></div>"), Ma = ee("<div><!></div>"), Da = ee('<div><!> <div><div class="field svelte-1alme8h"><!></div> <div class="binding-control svelte-1alme8h"><!></div></div></div>');
function Wa(te, t) {
  We(t, !1);
  const c = y(), b = y(), G = y(), f = y(), w = y();
  let r = l(t, "filter", 8), B = l(t, "disabled", 8, !1), E = l(t, "bindings", 24, () => []), C = l(t, "allowBindings", 8, !1), V = l(t, "schemaFields", 8), j = l(t, "panel", 8), D = l(t, "drawerTitle", 8), m = l(t, "toReadable", 8), A = l(t, "toRuntime", 8), X = l(t, "evaluationContext", 24, () => ({}));
  const x = Ke(), { OperatorOptions: $, FilterValueType: ue } = Ut;
  let q = y();
  const i = (s) => V().find((a) => a.name === s)?.constraints?.inclusion || [], T = (s) => V().find((v) => v.name === s.field), S = (s) => {
    u(G, s.detail);
  }, L = (s) => {
    u(c, s.detail), x("change", {
      value: A() ? A()(E(), e(c)) : e(c)
    });
  }, U = () => {
    x("change", {
      value: A() ? A()(E(), e(G)) : e(G),
      valueType: e(G) ? ue.BINDING : ue.VALUE
    });
  }, fe = (s) => !s || !isNaN(new Date(s).valueOf()), N = (s) => {
    let v = [];
    if (Array.isArray(s))
      v = s;
    else if (s && typeof s == "string")
      v = s.split(",");
    else
      return !s;
    return v.every((a) => T(r())?.constraints?.inclusion?.includes(a));
  }, z = (s) => s === "false" || s === "true" || s == "", M = (s) => {
    let v = [];
    if (Array.isArray(s))
      v = s;
    else if (s && typeof s == "string")
      v = s.split(",");
    else
      return !s;
    return v.every((a) => a.startsWith("ro_"));
  }, _e = {
    date: fe,
    datetime: fe,
    bb_reference: M,
    bb_reference_single: M,
    array: N,
    longform: (s) => !gt(s),
    options: (s) => !gt(s) && !ua(s)?.length,
    boolean: z
  }, o = (s) => {
    const v = _e[r().type];
    return v ? v(s) : !0;
  }, d = (s) => (Array.isArray(s) ? s.join(",") : e(b)) ?? "";
  P(() => n(r()), () => {
    u(c, r()?.value);
  }), P(
    () => (n(m()), n(E()), e(c)),
    () => {
      u(b, m() ? m()(E(), e(c)) : e(c));
    }
  ), P(() => e(c), () => {
    u(G, d(e(c)));
  }), P(() => e(c), () => {
    u(f, gt(e(c)));
  }), P(() => e(c), () => {
    u(w, o(e(c)));
  }), Je(), Ie();
  var W = Da(), H = h(W);
  {
    let s = ae(() => (n(D()), n(r()), p(() => D() || r().field)));
    yt(
      $t(H, {
        get title() {
          return e(s);
        },
        forceModal: !0,
        $$events: {
          drawerHide(v) {
            De.call(this, t, v);
          },
          drawerShow(v) {
            De.call(this, t, v);
          }
        },
        $$slots: {
          buttons: (v, a) => {
            wt(v, {
              cta: !0,
              slot: "buttons",
              $$events: {
                click: () => {
                  U(), e(q).hide();
                }
              },
              children: (O, I) => {
                ot();
                var Q = it("Confirm");
                _(O, Q);
              },
              $$slots: { default: !0 }
            });
          },
          body: (v, a) => {
            var O = Ae(), I = ge(O);
            Rt(I, j, (Q, he) => {
              he(Q, {
                slot: "body",
                get value() {
                  return e(G);
                },
                allowJS: !0,
                allowHelpers: !0,
                allowHBS: !0,
                get bindings() {
                  return E();
                },
                get context() {
                  return X();
                },
                $$events: { change: S }
              });
            }), _(v, O);
          }
        },
        $$legacy: !0
      }),
      (v) => u(q, v),
      () => e(q)
    );
  }
  var F = R(H, 2);
  let le;
  var pe = h(F), xe = h(pe);
  {
    var Ee = (s) => {
      {
        let v = ae(() => e(f) ? "(JavaScript function)" : e(b));
        ft(s, {
          get disabled() {
            return n(r()), p(() => r().noValue);
          },
          get readonly() {
            return e(f);
          },
          get value() {
            return e(v);
          },
          $$events: { change: L }
        });
      }
    }, Se = (s) => {
      var v = za(), a = h(v);
      {
        var O = (Q) => {
          ft(Q, {
            get disabled() {
              return n(r()), p(() => r().noValue);
            },
            get value() {
              return e(b);
            },
            $$events: { change: L }
          });
        }, I = (Q) => {
          var he = Ae(), K = ge(he);
          {
            var J = (be) => {
              {
                let Oe = ae(() => (n(r()), p(() => i(r().field))));
                Ht(be, {
                  get disabled() {
                    return n(r()), p(() => r().noValue);
                  },
                  get options() {
                    return e(Oe);
                  },
                  get value() {
                    return e(b);
                  },
                  popoverAutoWidth: !0,
                  $$events: { change: L }
                });
              }
            }, ie = (be) => {
              var Oe = Ae(), Ze = ge(Oe);
              {
                var ne = (Le) => {
                  {
                    let et = ae(() => (n(r()), p(() => i(r().field))));
                    Dt(Le, {
                      get disabled() {
                        return n(r()), p(() => r().noValue);
                      },
                      get options() {
                        return e(et);
                      },
                      get value() {
                        return e(b);
                      },
                      popoverAutoWidth: !0,
                      wrapText: !0,
                      $$events: { change: L }
                    });
                  }
                }, Fe = (Le) => {
                  var et = Ae(), Re = ge(et);
                  {
                    var Be = (ve) => {
                      Dt(ve, {
                        get disabled() {
                          return n(r()), p(() => r().noValue);
                        },
                        options: [
                          { label: "True", value: "true" },
                          { label: "False", value: "false" }
                        ],
                        get value() {
                          return e(b);
                        },
                        popoverAutoWidth: !0,
                        $$events: { change: L }
                      });
                    }, ke = (ve) => {
                      var de = Ae(), Ne = ge(de);
                      {
                        var Pe = (me) => {
                          {
                            let Z = ae(() => (n(r()), p(() => !T(r())?.dateOnly))), ce = ae(() => (n(r()), p(() => T(r())?.timeOnly)));
                            wa(me, {
                              get disabled() {
                                return n(r()), p(() => r().noValue);
                              },
                              get enableTime() {
                                return e(Z);
                              },
                              get timeOnly() {
                                return e(ce);
                              },
                              get value() {
                                return e(b);
                              },
                              $$events: { change: L }
                            });
                          }
                        }, Me = (me) => {
                          var Z = Ae(), ce = ge(Z);
                          {
                            var we = (Ce) => {
                              {
                                let at = ae(() => (n(r()), p(() => [$.In.value, $.ContainsAny.value].includes(r().operator))));
                                Na(Ce, {
                                  get multiselect() {
                                    return e(at);
                                  },
                                  get disabled() {
                                    return n(r()), p(() => r().noValue);
                                  },
                                  get value() {
                                    return e(b);
                                  },
                                  $$events: { change: L }
                                });
                              }
                            }, tt = (Ce) => {
                              ft(Ce, { disabled: !0 });
                            };
                            se(
                              ce,
                              (Ce) => {
                                n(k), n(r()), p(() => [k.BB_REFERENCE, k.BB_REFERENCE_SINGLE].includes(r().type)) ? Ce(we) : Ce(tt, !1);
                              },
                              !0
                            );
                          }
                          _(me, Z);
                        };
                        se(
                          Ne,
                          (me) => {
                            n(r()), n(k), p(() => r().type === k.DATETIME) ? me(Pe) : me(Me, !1);
                          },
                          !0
                        );
                      }
                      _(ve, de);
                    };
                    se(
                      Re,
                      (ve) => {
                        n(r()), n(k), p(() => r().type === k.BOOLEAN) ? ve(Be) : ve(ke, !1);
                      },
                      !0
                    );
                  }
                  _(Le, et);
                };
                se(
                  Ze,
                  (Le) => {
                    n(r()), n(k), p(() => r().type === k.OPTIONS) ? Le(ne) : Le(Fe, !1);
                  },
                  !0
                );
              }
              _(be, Oe);
            };
            se(
              K,
              (be) => {
                n(r()), n(k), n(zt), p(() => r().type === k.ARRAY || r().type === k.OPTIONS && r().operator === zt.ONE_OF) ? be(J) : be(ie, !1);
              },
              !0
            );
          }
          _(Q, he);
        };
        se(a, (Q) => {
          n(k), n(r()), p(() => [
            k.STRING,
            k.LONGFORM,
            k.NUMBER,
            k.BIGINT,
            k.FORMULA,
            k.AI,
            k.BARCODEQR
          ].includes(r().type)) ? Q(O) : Q(I, !1);
        });
      }
      g(v), _(s, v);
    };
    se(xe, (s) => {
      n(r()), p(() => r().valueType === ue.BINDING) ? s(Ee) : s(Se, !1);
    });
  }
  g(pe);
  var re = R(pe, 2), oe = h(re);
  {
    var Te = (s) => {
      var v = Ma();
      let a;
      var O = h(v);
      $e(O, { size: "S", weight: "fill", name: "lightning" }), g(v), ye((I) => a = Ve(v, 1, "icon svelte-1alme8h", null, a, I), [() => ({ binding: r().valueType === "Binding" })]), je("click", v, () => {
        e(q).show();
      }), _(s, v);
    };
    se(oe, (s) => {
      n(B()), n(C()), n(r()), p(() => !B() && C() && !r().noValue) && s(Te);
    });
  }
  g(re), g(F), g(W), ye((s) => le = Ve(F, 1, "field-wrap svelte-1alme8h", null, le, s), [
    () => ({ bindings: C(), valid: e(w) })
  ]), _(te, W), Ge();
}
var Ia = ee('<div class="icon binding svelte-z4ihso"><!></div>'), Ga = ee('<div><!> <div><div class="field svelte-z4ihso"><!></div> <div class="binding-control svelte-z4ihso"><!></div></div></div>');
function qa(te, t) {
  We(t, !1);
  const c = y(), b = y(), G = y();
  let f = l(t, "filter", 8), w = l(t, "disabled", 8, !1), r = l(t, "bindings", 24, () => []), B = l(t, "panel", 8), E = l(t, "drawerTitle", 8), C = l(t, "toReadable", 8), V = l(t, "toRuntime", 8), j = l(t, "evaluationContext", 24, () => ({}));
  const D = Ke();
  let m = y(), A = y();
  const X = (z) => {
    u(b, z.detail);
  }, x = (z) => {
    u(A, z.detail), D("change", {
      field: V() ? V()(r(), e(A)) : e(A)
    });
  }, $ = () => {
    D("change", {
      field: V() ? V()(r(), e(b)) : e(b)
    });
  }, ue = (z) => Array.isArray(z) ? z.join(",") : e(c);
  P(() => n(f()), () => {
    u(A, f()?.field);
  }), P(
    () => (n(C()), n(r()), e(A)),
    () => {
      u(c, C() ? C()(r(), e(A)) : e(A));
    }
  ), P(() => e(A), () => {
    u(b, ue(e(A)));
  }), P(() => e(A), () => {
    u(G, gt(e(A)));
  }), Je(), Ie();
  var q = Ga(), i = h(q);
  {
    let z = ae(() => E() || "");
    yt(
      $t(i, {
        get title() {
          return e(z);
        },
        forceModal: !0,
        $$events: {
          drawerHide(M) {
            De.call(this, t, M);
          },
          drawerShow(M) {
            De.call(this, t, M);
          }
        },
        $$slots: {
          buttons: (M, _e) => {
            wt(M, {
              cta: !0,
              slot: "buttons",
              $$events: {
                click: () => {
                  $(), e(m).hide();
                }
              },
              children: (o, d) => {
                ot();
                var W = it("Confirm");
                _(o, W);
              },
              $$slots: { default: !0 }
            });
          },
          body: (M, _e) => {
            var o = Ae(), d = ge(o);
            Rt(d, B, (W, H) => {
              H(W, {
                slot: "body",
                get value() {
                  return e(b);
                },
                allowJS: !0,
                allowHelpers: !0,
                allowHBS: !0,
                get bindings() {
                  return r();
                },
                get context() {
                  return j();
                },
                $$events: { change: X }
              });
            }), _(M, o);
          }
        },
        $$legacy: !0
      }),
      (M) => u(m, M),
      () => e(m)
    );
  }
  var T = R(i, 2);
  Ve(T, 1, "field-wrap svelte-z4ihso", null, {}, { bindings: !0 });
  var S = h(T), L = h(S);
  {
    let z = ae(() => e(G) ? "(JavaScript function)" : e(c));
    ft(L, {
      get disabled() {
        return n(f()), p(() => f().noValue);
      },
      get readonly() {
        return e(G);
      },
      get value() {
        return e(z);
      },
      $$events: { change: x }
    });
  }
  g(S);
  var U = R(S, 2), fe = h(U);
  {
    var N = (z) => {
      var M = Ia(), _e = h(M);
      $e(_e, { size: "S", weight: "fill", name: "lightning" }), g(M), je("click", M, () => {
        e(m).show();
      }), _(z, M);
    };
    se(fe, (z) => {
      w() || z(N);
    });
  }
  g(U), g(T), g(q), _(te, q), Ge();
}
var Ua = ee('<div class="global-filter-header svelte-1bn7luf"><span> </span> <span class="operator-picker svelte-1bn7luf"><!></span> <span> </span></div>'), Ha = ee('<div class="filter svelte-1bn7luf"><!> <!> <!> <!></div>'), $a = ee('<div class="group svelte-1bn7luf"><div class="group-header svelte-1bn7luf"><div class="group-options svelte-1bn7luf"><span> </span> <span class="operator-picker svelte-1bn7luf"><!></span> <span> </span></div> <div class="group-actions svelte-1bn7luf"><!> <!></div></div> <div class="filters svelte-1bn7luf"></div></div>'), Ja = ee('<div class="filter-groups svelte-1bn7luf"></div>'), Qa = ee('<div class="empty-filter svelte-1bn7luf"><span>Return</span> <span class="empty-filter-picker svelte-1bn7luf"><!></span> <span> </span></div>'), Ya = ee('<a target="_blank"><!></a>'), ja = ee('<!> <div class="add-group svelte-1bn7luf"><!> <!></div>', 1), Xa = ee('<!> <!> <!> <div class="filters-footer svelte-1bn7luf"><!></div>', 1), Ka = ee("<div><!></div>");
function Za(te, t) {
  We(t, !1);
  const c = () => He(d, "$context", b), [b, G] = Ot(), f = y(), w = y(), r = y(), B = Ke(), {
    OperatorOptions: E,
    DEFAULT_BB_DATASOURCE_ID: C,
    FilterOperator: V,
    OnEmptyFilter: j,
    FilterValueType: D
  } = Ut;
  let m = l(t, "schemaFields", 12), A = l(t, "filters", 8), X = l(t, "tables", 24, () => []), x = l(t, "datasource", 8), $ = l(t, "behaviourFilters", 8, !1), ue = l(t, "allowBindings", 8, !1), q = l(t, "allowOnEmpty", 8, !0), i = l(t, "builderType", 8, "filter"), T = l(t, "docsURL", 8, "https://docs.budibase.com/docs/searchfilter-data"), S = l(t, "bindings", 8), L = l(t, "panel", 8), U = l(t, "toReadable", 8), fe = l(t, "toRuntime", 8), N = l(t, "evaluationContext", 24, () => ({}));
  const z = (a) => Array.isArray(a) ? va(a) : pt(a), M = Object.values(V).map((a) => ({ value: a, label: da(a) })), _e = {
    [j.RETURN_ALL]: "All rows",
    [j.RETURN_NONE]: "No rows"
  }, o = Object.values(j).map((a) => ({ value: a, label: _e[a] })), d = Ft("context"), W = (a) => {
    const O = a.type;
    pe(a), xe(a), Ee(a, O);
  }, H = (a) => {
    xe(a), Ee(a, a.type);
  }, F = (a) => m().find((O) => O.name === a.field), le = (a) => i() === "condition" ? [E.Equals, E.NotEquals] : !a?.field && !a?.name ? [] : ha(a, a.field || a.name, x()), pe = (a) => {
    const O = m().find((I) => I.name === a.field);
    a.type = O?.type, a.subtype = O?.subtype, a.formulaType = O?.formulaType, a.constraints = O?.constraints, a.externalType = F(a)?.externalType;
  }, xe = (a) => {
    const O = le(a).map((Q) => Q.value);
    O.includes(a.operator) || (a.operator = O[0] ?? E.Equals.value);
    const I = [E.Empty.value, E.NotEmpty.value];
    a.noValue = I.includes(a.operator);
  }, Ee = (a, O) => {
    if (a.noValue) {
      a.value = null;
      return;
    }
    Array.isArray(a.value) ? (a.valueType !== "Value" || a.type !== k.ARRAY) && (a.value = null) : a.type === k.ARRAY && a.valueType === "Value" ? a.value = [] : O !== a.type && (O === k.BB_REFERENCE || a.type === k.BB_REFERENCE) && (a.value = a.type === k.ARRAY ? [] : null);
  }, Se = (a) => a == 0 ? "When" : { [V.ANY]: "or", [V.ALL]: "and" }[e(f).logicalOperator], re = (a, O, I) => {
    const Q = pt(a);
    oe({ groupIdx: O, filterIdx: I, filter: { ...Q } });
  }, oe = (a) => {
    const {
      groupIdx: O,
      filterIdx: I,
      filter: Q,
      group: he,
      addFilter: K,
      addGroup: J,
      deleteGroup: ie,
      deleteFilter: be,
      logicalOperator: Oe,
      onEmptyFilter: Ze
    } = a;
    let ne = pt(e(f)), Fe = ne?.groups?.[O];
    Fe?.filters?.[I] ? be ? (Fe.filters.splice(I, 1), Fe.filters.length === 0 && ne.groups.splice(O, 1)) : Q && (Fe.filters[I] = Q) : Fe ? ie ? ne.groups.splice(O, 1) : K ? Fe.filters.push({
      valueType: D.VALUE,
      ...i() === "condition" ? {
        operator: E.Equals.value,
        type: k.STRING
      } : {}
    }) : he && (ne.groups[O] = { ...Fe, ...he }) : J ? (ne?.groups?.length || (ne = {
      logicalOperator: fa.ALL,
      onEmptyFilter: ga.RETURN_NONE,
      groups: []
    }), ne.groups.push({
      logicalOperator: pa.ANY,
      filters: [
        {
          valueType: D.VALUE,
          ...i() === "condition" ? { operator: E.Equals.value } : {}
        }
      ]
    })) : Oe ? ne = { ...ne, logicalOperator: Oe } : Ze && (ne = { ...ne, onEmptyFilter: Ze }), ne = ne.groups.length ? ne : null, B("change", ne);
  };
  P(() => n(A()), () => {
    u(f, z(A()));
  }), P(
    () => (n(X()), n(x()), n(m())),
    () => {
      X().find((a) => a._id === x()?.tableId && a.sourceId === C) && !m().some((a) => a.name === "_id") && m([...m(), { name: "_id", type: "string" }]);
    }
  ), P(() => n(i()), () => {
    u(w, i() === "filter" ? "Show data which matches" : "Run branch when matching");
  }), P(() => n(m()), () => {
    u(r, (m() || []).filter((a) => !a.calculationType).map((a) => ({ label: a.displayName || a.name, value: a.name })));
  }), Je(), Ie();
  var Te = Ka();
  let s;
  var v = h(Te);
  Mt(v, {
    noPadding: !0,
    children: (a, O) => {
      var I = Ae(), Q = ge(I);
      {
        var he = (J) => {
          var ie = Xa(), be = ge(ie);
          vt(be, t, "filtering-hero-content", {}, null);
          var Oe = R(be, 2);
          {
            var Ze = (Re) => {
              var Be = Ua(), ke = h(Be), ve = h(ke, !0);
              g(ke);
              var de = R(ke, 2), Ne = h(de);
              {
                let me = ae(() => (e(f), p(() => e(f)?.logicalOperator)));
                Xe(Ne, {
                  get value() {
                    return e(me);
                  },
                  get options() {
                    return M;
                  },
                  getOptionLabel: (Z) => Z.label,
                  getOptionValue: (Z) => Z.value,
                  placeholder: !1,
                  popoverAutoWidth: !0,
                  $$events: {
                    change: (Z) => {
                      oe({ logicalOperator: Z.detail });
                    }
                  }
                });
              }
              g(de);
              var Pe = R(de, 2), Me = h(Pe);
              g(Pe), g(Be), ye(() => {
                Ue(ve, e(w)), Ue(Me, `of the following ${i() ?? ""} groups:`);
              }), _(Re, Be);
            };
            se(Oe, (Re) => {
              e(f), p(() => e(f)?.groups?.length) && Re(Ze);
            });
          }
          var ne = R(Oe, 2);
          {
            var Fe = (Re) => {
              var Be = Ja();
              xt(
                Be,
                5,
                () => (e(f), p(() => e(f)?.groups)),
                Et,
                (ke, ve, de) => {
                  var Ne = $a(), Pe = h(Ne), Me = h(Pe), me = h(Me), Z = h(me, !0);
                  g(me);
                  var ce = R(me, 2), we = h(ce);
                  {
                    let lt = ae(() => (e(ve), p(() => e(ve)?.logicalOperator)));
                    Xe(we, {
                      get value() {
                        return e(lt);
                      },
                      get options() {
                        return M;
                      },
                      getOptionLabel: (Y) => Y.label,
                      getOptionValue: (Y) => Y.value,
                      placeholder: !1,
                      popoverAutoWidth: !0,
                      $$events: {
                        change: (Y) => {
                          oe({ groupIdx: de, group: { logicalOperator: Y.detail } });
                        }
                      }
                    });
                  }
                  g(ce);
                  var tt = R(ce, 2), Ce = h(tt);
                  g(tt), g(Me);
                  var at = R(Me, 2), dt = h(at);
                  $e(dt, {
                    name: "plus",
                    hoverable: !0,
                    hoverColor: "var(--ink)",
                    $$events: {
                      click: () => {
                        oe({ groupIdx: de, addFilter: !0 });
                      }
                    }
                  });
                  var Qe = R(dt, 2);
                  $e(Qe, {
                    name: "trash",
                    hoverable: !0,
                    hoverColor: "var(--ink)",
                    $$events: {
                      click: () => {
                        oe({ groupIdx: de, deleteGroup: !0 });
                      }
                    }
                  }), g(at), g(Pe);
                  var Pt = R(Pe, 2);
                  xt(Pt, 5, () => (e(ve), p(() => e(ve).filters)), Et, (lt, Y, rt) => {
                    var At = Ha(), Ct = h(At);
                    {
                      var Jt = (ze) => {
                        Xe(ze, {
                          get value() {
                            return e(Y), p(() => e(Y).field);
                          },
                          get options() {
                            return e(r);
                          },
                          placeholder: "Column",
                          popoverAutoWidth: !0,
                          $$events: {
                            change: (Ye) => {
                              const qe = { ...e(Y), field: Ye.detail };
                              W(qe), re(qe, de, rt);
                            }
                          }
                        });
                      }, Qt = (ze) => {
                        qa(ze, {
                          placeholder: "Value",
                          get filter() {
                            return e(Y);
                          },
                          drawerTitle: "Edit Binding",
                          get bindings() {
                            return S();
                          },
                          get panel() {
                            return L();
                          },
                          get toReadable() {
                            return U();
                          },
                          get toRuntime() {
                            return fe();
                          },
                          get evaluationContext() {
                            return N();
                          },
                          $$events: {
                            change: (Ye) => {
                              const qe = { ...e(Y), field: Ye.detail.field };
                              re(qe, de, rt);
                            }
                          }
                        });
                      };
                      se(Ct, (ze) => {
                        i() === "filter" ? ze(Jt) : ze(Qt, !1);
                      });
                    }
                    var Vt = R(Ct, 2);
                    {
                      let ze = ae(() => (e(Y), n(i()), p(() => !e(Y).field && i() === "filter"))), Ye = ae(() => (e(Y), p(() => le(e(Y)))));
                      Xe(Vt, {
                        get value() {
                          return e(Y), p(() => e(Y).operator);
                        },
                        get disabled() {
                          return e(ze);
                        },
                        get options() {
                          return e(Ye);
                        },
                        placeholder: !1,
                        popoverAutoWidth: !0,
                        $$events: {
                          change: (qe) => {
                            const ct = { ...e(Y), operator: qe.detail };
                            H(ct), re(ct, de, rt);
                          }
                        }
                      });
                    }
                    var St = R(Vt, 2);
                    {
                      let ze = ae(() => (e(Y), n(i()), p(() => !e(Y).field && i() === "filter"))), Ye = ae(() => i() === "condition" ? "Edit binding" : null), qe = ae(() => (e(Y), n(i()), n(k), p(() => ({
                        ...e(Y),
                        ...i() === "condition" ? { type: k.STRING } : {}
                      }))));
                      Wa(St, {
                        placeholder: "Value",
                        get disabled() {
                          return e(ze);
                        },
                        get drawerTitle() {
                          return e(Ye);
                        },
                        get allowBindings() {
                          return ue();
                        },
                        get filter() {
                          return e(qe);
                        },
                        get schemaFields() {
                          return m();
                        },
                        get bindings() {
                          return S();
                        },
                        get panel() {
                          return L();
                        },
                        get toReadable() {
                          return U();
                        },
                        get toRuntime() {
                          return fe();
                        },
                        get evaluationContext() {
                          return N();
                        },
                        $$events: {
                          change: (ct) => {
                            re({ ...e(Y), ...ct.detail }, de, rt);
                          }
                        }
                      });
                    }
                    var Yt = R(St, 2);
                    Gt(Yt, {
                      size: "M",
                      icon: "trash",
                      $$events: {
                        click: () => {
                          oe({ groupIdx: de, filterIdx: rt, deleteFilter: !0 });
                        }
                      }
                    }), g(At), _(lt, At);
                  }), g(Pt), g(Ne), ye(
                    (lt) => {
                      Ue(Z, lt), Ue(Ce, `of the following ${i() ?? ""}s are matched:`);
                    },
                    [
                      () => (e(f), p(() => Se(de, e(f).logicalOperator)))
                    ]
                  ), _(ke, Ne);
                }
              ), g(Be), _(Re, Be);
            };
            se(ne, (Re) => {
              e(f), p(() => e(f)?.groups?.length) && Re(Fe);
            });
          }
          var Le = R(ne, 2), et = h(Le);
          Mt(et, {
            noPadding: !0,
            children: (Re, Be) => {
              var ke = ja(), ve = ge(ke);
              {
                var de = (Z) => {
                  var ce = Qa(), we = R(h(ce), 2), tt = h(we);
                  {
                    let dt = ae(() => (e(f), p(() => e(f)?.onEmptyFilter)));
                    Xe(tt, {
                      get value() {
                        return e(dt);
                      },
                      get options() {
                        return o;
                      },
                      getOptionLabel: (Qe) => Qe.label,
                      getOptionValue: (Qe) => Qe.value,
                      placeholder: !1,
                      popoverAutoWidth: !0,
                      $$events: {
                        change: (Qe) => {
                          oe({ onEmptyFilter: Qe.detail });
                        }
                      }
                    });
                  }
                  g(we);
                  var Ce = R(we, 2), at = h(Ce);
                  g(Ce), g(ce), ye(() => Ue(at, `when all ${i() ?? ""}s are empty`)), _(Z, ce);
                };
                se(ve, (Z) => {
                  n($()), n(q()), e(f), p(() => $() && q() && e(f)?.groups?.length) && Z(de);
                });
              }
              var Ne = R(ve, 2), Pe = h(Ne);
              wt(Pe, {
                icon: "plus-circle",
                size: "M",
                secondary: !0,
                $$events: {
                  click: () => {
                    oe({ addGroup: !0 });
                  }
                },
                children: (Z, ce) => {
                  ot();
                  var we = it();
                  ye(() => Ue(we, `Add ${i() ?? ""} group`)), _(Z, we);
                },
                $$slots: { default: !0 }
              });
              var Me = R(Pe, 2);
              {
                var me = (Z) => {
                  var ce = Ya(), we = h(ce);
                  $e(we, {
                    name: "question",
                    color: "var(--spectrum-global-color-gray-600)"
                  }), g(ce), ye(() => Tt(ce, "href", T())), _(Z, ce);
                };
                se(Me, (Z) => {
                  T() && Z(me);
                });
              }
              g(Ne), _(Re, ke);
            },
            $$slots: { default: !0 }
          }), g(Le), _(J, ie);
        }, K = (J) => {
          ca(J, {
            size: "S",
            children: (ie, be) => {
              ot();
              var Oe = it("None of the table column can be used for filtering.");
              _(ie, Oe);
            },
            $$slots: { default: !0 }
          });
        };
        se(Q, (J) => {
          e(r), p(() => e(r)?.length) ? J(he) : J(K, !1);
        });
      }
      _(a, I);
    },
    $$slots: { default: !0 }
  }), g(Te), ye((a) => s = Ve(Te, 1, "container svelte-1bn7luf", null, s, a), [() => ({ mobile: c()?.device?.mobile })]), _(te, Te), Ge(), G();
}
var el = ee("<!> <!>", 1);
function nl(te, t) {
  We(t, !1);
  const c = () => He(A, "$component", b), [b, G] = Ot(), f = y(), w = y(), r = y(), B = y(), E = y(), C = y(), V = y();
  let j = l(t, "dataProvider", 8), D = l(t, "allowedFields", 8), m = l(t, "size", 8, "M");
  const A = Ft("component"), { builderStore: X, ActionTypes: x, getAction: $, fetchDatasourceSchema: ue } = Ft("sdk");
  let q = y(), i = y(), T = y(), S = y(!1), L = y();
  async function U(d) {
    d && u(L, await ue(d, { enrichRelationships: !0 })), u(S, !0);
  }
  function fe(d, W) {
    if (!e(S))
      return {};
    let H = {};
    return W?.length ? W?.forEach((F) => {
      d?.[F.name] ? (H[F.name] = d[F.name], H[F.name].displayName = F.displayName) : d?.[F] && (H[F] = d[F]);
    }) : H = d || {}, Object.values(H || {}).filter((F) => !ya.includes(F.type)).concat(e(r) ? [{ name: "_id", type: "string" }] : []);
  }
  const N = () => {
    qt(X).inBuilder || (u(i, e(T) ? pt(e(T)) : null), e(q).show());
  }, z = () => {
    u(T, Oa(e(i)));
  };
  It(() => {
    e(E)?.(c().id);
  }), P(() => n(j()), () => {
    u(f, j()?.id);
  }), P(() => n(j()), () => {
    u(w, j()?.datasource);
  }), P(() => e(w), () => {
    u(r, ["table", "link", "viewV2"].includes(e(w)?.type));
  }), P(() => e(f), () => {
    u(B, $(e(f), x.AddDataProviderQueryExtension));
  }), P(() => e(f), () => {
    u(E, $(e(f), x.RemoveDataProviderQueryExtension));
  }), P(() => e(w), () => {
    U(e(w));
  }), P(() => (e(L), n(D())), () => {
    u(C, fe(e(L), D()));
  }), P(() => e(T), () => {
    u(V, e(T)?.groups?.reduce(
      (d, W) => (d += W?.filters?.length || 0, d),
      0
    ));
  }), P(
    () => (e(V), e(T), e(B), c(), e(E)),
    () => {
      if (e(V)) {
        const d = ba(e(T));
        delete d.onEmptyFilter, e(B)?.(c().id, d);
      } else
        e(E)?.(c().id);
    }
  ), Je(), Ie();
  var M = Ae(), _e = ge(M);
  {
    var o = (d) => {
      var W = el(), H = ge(W);
      {
        let le = ae(() => (e(T), p(() => e(T)?.groups?.length > 0)));
        xa(H, {
          onClick: N,
          icon: "ri-filter-3-line",
          text: "Filter",
          get size() {
            return m();
          },
          type: "secondary",
          quiet: !0,
          get active() {
            return e(le);
          }
        });
      }
      var F = R(H, 2);
      yt(
        ma(F, {
          children: (le, pe) => {
            _a(le, {
              title: "Edit filters",
              size: "XL",
              onConfirm: z,
              children: (xe, Ee) => {
                Za(xe, {
                  get filters() {
                    return e(i);
                  },
                  get schemaFields() {
                    return e(C);
                  },
                  get datasource() {
                    return e(w);
                  },
                  filtersLabel: null,
                  $$events: {
                    change: (Se) => {
                      u(i, Se.detail);
                    }
                  }
                });
              },
              $$slots: { default: !0 }
            });
          },
          $$slots: { default: !0 },
          $$legacy: !0
        }),
        (le) => u(q, le),
        () => e(q)
      ), _(d, W);
    };
    se(_e, (d) => {
      e(S) && d(o);
    });
  }
  _(te, M), Ge(), G();
}
export {
  nl as default
};
