import Oe, { forwardRef as Ue, createElement as _e, createContext as wt, useContext as kt, useState as C, useRef as oe, useCallback as E, useEffect as Y, useMemo as me } from "react";
import Ct, { Handle as Te, Position as $e, useReactFlow as _t, getBezierPath as Et, BaseEdge as Rt, EdgeLabelRenderer as St, MarkerType as fe, ReactFlowProvider as Mt, applyNodeChanges as At, applyEdgeChanges as zt, addEdge as Tt, updateEdge as $t, ConnectionMode as Pt, Background as Dt, MiniMap as It, Panel as Gt } from "reactflow";
var pe = { exports: {} }, re = {};
/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var Pe;
function Lt() {
  if (Pe) return re;
  Pe = 1;
  var t = Symbol.for("react.transitional.element"), s = Symbol.for("react.fragment");
  function l(a, d, c) {
    var p = null;
    if (c !== void 0 && (p = "" + c), d.key !== void 0 && (p = "" + d.key), "key" in d) {
      c = {};
      for (var b in d)
        b !== "key" && (c[b] = d[b]);
    } else c = d;
    return d = c.ref, {
      $$typeof: t,
      type: a,
      key: p,
      ref: d !== void 0 ? d : null,
      props: c
    };
  }
  return re.Fragment = s, re.jsx = l, re.jsxs = l, re;
}
var ae = {};
/**
 * @license React
 * react-jsx-runtime.development.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var De;
function Ot() {
  return De || (De = 1, process.env.NODE_ENV !== "production" && (function() {
    function t(r) {
      if (r == null) return null;
      if (typeof r == "function")
        return r.$$typeof === J ? null : r.displayName || r.name || null;
      if (typeof r == "string") return r;
      switch (r) {
        case y:
          return "Fragment";
        case G:
          return "Profiler";
        case D:
          return "StrictMode";
        case ge:
          return "Suspense";
        case X:
          return "SuspenseList";
        case be:
          return "Activity";
      }
      if (typeof r == "object")
        switch (typeof r.tag == "number" && console.error(
          "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
        ), r.$$typeof) {
          case x:
            return "Portal";
          case $:
            return r.displayName || "Context";
          case O:
            return (r._context.displayName || "Context") + ".Consumer";
          case F:
            var j = r.render;
            return r = r.displayName, r || (r = j.displayName || j.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
          case ce:
            return j = r.displayName || null, j !== null ? j : t(r.type) || "Memo";
          case B:
            j = r._payload, r = r._init;
            try {
              return t(r(j));
            } catch {
            }
        }
      return null;
    }
    function s(r) {
      return "" + r;
    }
    function l(r) {
      try {
        s(r);
        var j = !1;
      } catch {
        j = !0;
      }
      if (j) {
        j = console;
        var k = j.error, S = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
        return k.call(
          j,
          "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
          S
        ), s(r);
      }
    }
    function a(r) {
      if (r === y) return "<>";
      if (typeof r == "object" && r !== null && r.$$typeof === B)
        return "<...>";
      try {
        var j = t(r);
        return j ? "<" + j + ">" : "<...>";
      } catch {
        return "<...>";
      }
    }
    function d() {
      var r = _.A;
      return r === null ? null : r.getOwner();
    }
    function c() {
      return Error("react-stack-top-frame");
    }
    function p(r) {
      if (de.call(r, "key")) {
        var j = Object.getOwnPropertyDescriptor(r, "key").get;
        if (j && j.isReactWarning) return !1;
      }
      return r.key !== void 0;
    }
    function b(r, j) {
      function k() {
        R || (R = !0, console.error(
          "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
          j
        ));
      }
      k.isReactWarning = !0, Object.defineProperty(r, "key", {
        get: k,
        configurable: !0
      });
    }
    function f() {
      var r = t(this.type);
      return Z[r] || (Z[r] = !0, console.error(
        "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
      )), r = this.props.ref, r !== void 0 ? r : null;
    }
    function m(r, j, k, S, V, H) {
      var M = k.ref;
      return r = {
        $$typeof: u,
        type: r,
        key: j,
        props: k,
        _owner: S
      }, (M !== void 0 ? M : null) !== null ? Object.defineProperty(r, "ref", {
        enumerable: !1,
        get: f
      }) : Object.defineProperty(r, "ref", { enumerable: !1, value: null }), r._store = {}, Object.defineProperty(r._store, "validated", {
        configurable: !1,
        enumerable: !1,
        writable: !0,
        value: 0
      }), Object.defineProperty(r, "_debugInfo", {
        configurable: !1,
        enumerable: !1,
        writable: !0,
        value: null
      }), Object.defineProperty(r, "_debugStack", {
        configurable: !1,
        enumerable: !1,
        writable: !0,
        value: V
      }), Object.defineProperty(r, "_debugTask", {
        configurable: !1,
        enumerable: !1,
        writable: !0,
        value: H
      }), Object.freeze && (Object.freeze(r.props), Object.freeze(r)), r;
    }
    function i(r, j, k, S, V, H) {
      var M = j.children;
      if (M !== void 0)
        if (S)
          if (ve(M)) {
            for (S = 0; S < M.length; S++)
              v(M[S]);
            Object.freeze && Object.freeze(M);
          } else
            console.error(
              "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
            );
        else v(M);
      if (de.call(j, "key")) {
        M = t(r);
        var L = Object.keys(j).filter(function(W) {
          return W !== "key";
        });
        S = 0 < L.length ? "{key: someKey, " + L.join(": ..., ") + ": ...}" : "{key: someKey}", te[M + S] || (L = 0 < L.length ? "{" + L.join(": ..., ") + ": ...}" : "{}", console.error(
          `A props object containing a "key" prop is being spread into JSX:
  let props = %s;
  <%s {...props} />
React keys must be passed directly to JSX without using spread:
  let props = %s;
  <%s key={someKey} {...props} />`,
          S,
          M,
          L,
          M
        ), te[M + S] = !0);
      }
      if (M = null, k !== void 0 && (l(k), M = "" + k), p(j) && (l(j.key), M = "" + j.key), "key" in j) {
        k = {};
        for (var U in j)
          U !== "key" && (k[U] = j[U]);
      } else k = j;
      return M && b(
        k,
        typeof r == "function" ? r.displayName || r.name || "Unknown" : r
      ), m(
        r,
        M,
        k,
        d(),
        V,
        H
      );
    }
    function v(r) {
      n(r) ? r._store && (r._store.validated = 1) : typeof r == "object" && r !== null && r.$$typeof === B && (r._payload.status === "fulfilled" ? n(r._payload.value) && r._payload.value._store && (r._payload.value._store.validated = 1) : r._store && (r._store.validated = 1));
    }
    function n(r) {
      return typeof r == "object" && r !== null && r.$$typeof === u;
    }
    var g = Oe, u = Symbol.for("react.transitional.element"), x = Symbol.for("react.portal"), y = Symbol.for("react.fragment"), D = Symbol.for("react.strict_mode"), G = Symbol.for("react.profiler"), O = Symbol.for("react.consumer"), $ = Symbol.for("react.context"), F = Symbol.for("react.forward_ref"), ge = Symbol.for("react.suspense"), X = Symbol.for("react.suspense_list"), ce = Symbol.for("react.memo"), B = Symbol.for("react.lazy"), be = Symbol.for("react.activity"), J = Symbol.for("react.client.reference"), _ = g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, de = Object.prototype.hasOwnProperty, ve = Array.isArray, K = console.createTask ? console.createTask : function() {
      return null;
    };
    g = {
      react_stack_bottom_frame: function(r) {
        return r();
      }
    };
    var R, Z = {}, Q = g.react_stack_bottom_frame.bind(
      g,
      c
    )(), ee = K(a(c)), te = {};
    ae.Fragment = y, ae.jsx = function(r, j, k) {
      var S = 1e4 > _.recentlyCreatedOwnerStacks++;
      return i(
        r,
        j,
        k,
        !1,
        S ? Error("react-stack-top-frame") : Q,
        S ? K(a(r)) : ee
      );
    }, ae.jsxs = function(r, j, k) {
      var S = 1e4 > _.recentlyCreatedOwnerStacks++;
      return i(
        r,
        j,
        k,
        !0,
        S ? Error("react-stack-top-frame") : Q,
        S ? K(a(r)) : ee
      );
    };
  })()), ae;
}
var Ie;
function Ut() {
  return Ie || (Ie = 1, process.env.NODE_ENV === "production" ? pe.exports = Lt() : pe.exports = Ot()), pe.exports;
}
var e = Ut();
const P = [];
for (let t = 0; t < 256; ++t)
  P.push((t + 256).toString(16).slice(1));
function Yt(t, s = 0) {
  return (P[t[s + 0]] + P[t[s + 1]] + P[t[s + 2]] + P[t[s + 3]] + "-" + P[t[s + 4]] + P[t[s + 5]] + "-" + P[t[s + 6]] + P[t[s + 7]] + "-" + P[t[s + 8]] + P[t[s + 9]] + "-" + P[t[s + 10]] + P[t[s + 11]] + P[t[s + 12]] + P[t[s + 13]] + P[t[s + 14]] + P[t[s + 15]]).toLowerCase();
}
let we;
const Vt = new Uint8Array(16);
function Ht() {
  if (!we) {
    if (typeof crypto > "u" || !crypto.getRandomValues)
      throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
    we = crypto.getRandomValues.bind(crypto);
  }
  return we(Vt);
}
const Ft = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Ge = { randomUUID: Ft };
function Bt(t, s, l) {
  var d;
  t = t || {};
  const a = t.random ?? ((d = t.rng) == null ? void 0 : d.call(t)) ?? Ht();
  if (a.length < 16)
    throw new Error("Random bytes length must be >= 16");
  return a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, Yt(a);
}
function Ye(t, s, l) {
  return Ge.randomUUID && !t ? Ge.randomUUID() : Bt(t);
}
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Wt = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), qt = (t) => t.replace(
  /^([A-Z])|[\s-_]+(\w)/g,
  (s, l, a) => a ? a.toUpperCase() : l.toLowerCase()
), Le = (t) => {
  const s = qt(t);
  return s.charAt(0).toUpperCase() + s.slice(1);
}, Ve = (...t) => t.filter((s, l, a) => !!s && s.trim() !== "" && a.indexOf(s) === l).join(" ").trim(), Xt = (t) => {
  for (const s in t)
    if (s.startsWith("aria-") || s === "role" || s === "title")
      return !0;
};
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
var Jt = {
  xmlns: "http://www.w3.org/2000/svg",
  width: 24,
  height: 24,
  viewBox: "0 0 24 24",
  fill: "none",
  stroke: "currentColor",
  strokeWidth: 2,
  strokeLinecap: "round",
  strokeLinejoin: "round"
};
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Kt = Ue(
  ({
    color: t = "currentColor",
    size: s = 24,
    strokeWidth: l = 2,
    absoluteStrokeWidth: a,
    className: d = "",
    children: c,
    iconNode: p,
    ...b
  }, f) => _e(
    "svg",
    {
      ref: f,
      ...Jt,
      width: s,
      height: s,
      stroke: t,
      strokeWidth: a ? Number(l) * 24 / Number(s) : l,
      className: Ve("lucide", d),
      ...!c && !Xt(b) && { "aria-hidden": "true" },
      ...b
    },
    [
      ...p.map(([m, i]) => _e(m, i)),
      ...Array.isArray(c) ? c : [c]
    ]
  )
);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const w = (t, s) => {
  const l = Ue(
    ({ className: a, ...d }, c) => _e(Kt, {
      ref: c,
      iconNode: s,
      className: Ve(
        `lucide-${Wt(Le(t))}`,
        `lucide-${t}`,
        a
      ),
      ...d
    })
  );
  return l.displayName = Le(t), l;
};
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Zt = [
  [
    "path",
    {
      d: "M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",
      key: "169zse"
    }
  ]
], Qt = w("activity", Zt);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const es = [
  ["path", { d: "m12 19-7-7 7-7", key: "1l729n" }],
  ["path", { d: "M19 12H5", key: "x3x0zl" }]
], ts = w("arrow-left", es);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const ss = [
  ["path", { d: "M12 10h.01", key: "1nrarc" }],
  ["path", { d: "M12 14h.01", key: "1etili" }],
  ["path", { d: "M12 6h.01", key: "1vi96p" }],
  ["path", { d: "M16 10h.01", key: "1m94wz" }],
  ["path", { d: "M16 14h.01", key: "1gbofw" }],
  ["path", { d: "M16 6h.01", key: "1x0f13" }],
  ["path", { d: "M8 10h.01", key: "19clt8" }],
  ["path", { d: "M8 14h.01", key: "6423bh" }],
  ["path", { d: "M8 6h.01", key: "1dz90k" }],
  ["path", { d: "M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3", key: "cabbwy" }],
  ["rect", { x: "4", y: "2", width: "16", height: "20", rx: "2", key: "1uxh74" }]
], ns = w("building", ss);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const rs = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]], as = w("chevron-left", rs);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const os = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]], ls = w("chevron-right", os);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const is = [
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
  ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
  ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
], cs = w("circle-alert", is);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const ds = [
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
  ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
], us = w("circle-check", ds);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const hs = [
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
  ["line", { x1: "10", x2: "10", y1: "15", y2: "9", key: "c1nkhi" }],
  ["line", { x1: "14", x2: "14", y1: "15", y2: "9", key: "h65svq" }]
], He = w("circle-pause", hs);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const xs = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]], ps = w("circle", xs);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const ms = [
  ["path", { d: "M12 15V3", key: "m9g1x1" }],
  ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
  ["path", { d: "m7 10 5 5 5-5", key: "brsn70" }]
], fs = w("download", ms);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const gs = [
  [
    "path",
    {
      d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
      key: "1oefj6"
    }
  ],
  ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }],
  ["path", { d: "M10 9H8", key: "b1mrlr" }],
  ["path", { d: "M16 13H8", key: "t4e002" }],
  ["path", { d: "M16 17H8", key: "z1uh3a" }]
], bs = w("file-text", gs);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const vs = [
  [
    "path",
    {
      d: "M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",
      key: "zw3jo"
    }
  ],
  [
    "path",
    {
      d: "M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",
      key: "1wduqc"
    }
  ],
  [
    "path",
    {
      d: "M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",
      key: "kqbvx6"
    }
  ]
], Fe = w("layers", vs);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const ys = [
  ["rect", { width: "7", height: "7", x: "3", y: "3", rx: "1", key: "1g98yp" }],
  ["rect", { width: "7", height: "7", x: "14", y: "3", rx: "1", key: "6d4xhi" }],
  ["rect", { width: "7", height: "7", x: "14", y: "14", rx: "1", key: "nxv5o0" }],
  ["rect", { width: "7", height: "7", x: "3", y: "14", rx: "1", key: "1bb6yr" }]
], js = w("layout-grid", ys);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Ns = [
  ["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
  ["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
  ["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
], Be = w("link-2", Ns);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const ws = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], ks = w("loader-circle", ws);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Cs = [
  ["path", { d: "M8 3H5a2 2 0 0 0-2 2v3", key: "1dcmit" }],
  ["path", { d: "M21 8V5a2 2 0 0 0-2-2h-3", key: "1e4gt3" }],
  ["path", { d: "M3 16v3a2 2 0 0 0 2 2h3", key: "wsl5sc" }],
  ["path", { d: "M16 21h3a2 2 0 0 0 2-2v-3", key: "18trek" }]
], _s = w("maximize", Cs);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Es = [["path", { d: "M5 12h14", key: "1ays0h" }]], Rs = w("minus", Es);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Ss = [
  ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
  ["path", { d: "M3 9h18", key: "1pudct" }],
  ["path", { d: "M9 21V9", key: "1oto5p" }]
], We = w("panels-top-left", Ss);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Ms = [
  ["path", { d: "M5 12h14", key: "1ays0h" }],
  ["path", { d: "M12 5v14", key: "s699le" }]
], qe = w("plus", Ms);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const As = [
  ["path", { d: "m15 14 5-5-5-5", key: "12vg1m" }],
  ["path", { d: "M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13", key: "6uklza" }]
], zs = w("redo-2", As);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Ts = [
  [
    "path",
    {
      d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
      key: "1c8476"
    }
  ],
  ["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
  ["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
], $s = w("save", Ts);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Ps = [
  ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
], Ee = w("search", Ps);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Ds = [
  [
    "path",
    {
      d: "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",
      key: "1i5ecw"
    }
  ],
  ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
], Is = w("settings", Ds);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Gs = [
  [
    "path",
    {
      d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
      key: "oel41y"
    }
  ]
], Ls = w("shield", Gs);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Os = [
  ["circle", { cx: "9", cy: "12", r: "3", key: "u3jwor" }],
  ["rect", { width: "20", height: "14", x: "2", y: "5", rx: "7", key: "g7kal2" }]
], ke = w("toggle-left", Os);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Us = [
  ["circle", { cx: "15", cy: "12", r: "3", key: "1afu0r" }],
  ["rect", { width: "20", height: "14", x: "2", y: "5", rx: "7", key: "g7kal2" }]
], Ce = w("toggle-right", Us);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Ys = [
  ["path", { d: "M10 11v6", key: "nco0om" }],
  ["path", { d: "M14 11v6", key: "outv1u" }],
  ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
  ["path", { d: "M3 6h18", key: "d0wm0j" }],
  ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
], Xe = w("trash-2", Ys);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Vs = [
  [
    "path",
    {
      d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
      key: "wmoenq"
    }
  ],
  ["path", { d: "M12 9v4", key: "juzpu7" }],
  ["path", { d: "M12 17h.01", key: "p32p05" }]
], Je = w("triangle-alert", Vs);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Hs = [
  ["path", { d: "M9 14 4 9l5-5", key: "102s5s" }],
  ["path", { d: "M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11", key: "f3b9sd" }]
], Fs = w("undo-2", Hs);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Bs = [
  ["path", { d: "M12 3v12", key: "1x0j5s" }],
  ["path", { d: "m17 8-5-5-5 5", key: "7q97r8" }],
  ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }]
], Ws = w("upload", Bs);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const qs = [
  ["path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2", key: "975kel" }],
  ["circle", { cx: "12", cy: "7", r: "4", key: "17ys0d" }]
], Ke = w("user", qs);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Xs = [
  ["path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2", key: "1yyitq" }],
  ["path", { d: "M16 3.128a4 4 0 0 1 0 7.744", key: "16gr8j" }],
  ["path", { d: "M22 21v-2a4 4 0 0 0-3-3.87", key: "kshegd" }],
  ["circle", { cx: "9", cy: "7", r: "4", key: "nufk8" }]
], le = w("users", Xs);
/**
 * @license lucide-react v0.562.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Js = [
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
], q = w("x", Js), Ze = {
  Building: ns,
  Users: le,
  Layout: We,
  Shield: Ls,
  User: Ke,
  Group: le
}, Qe = wt({
  iconMap: Ze
}), ie = () => kt(Qe), Ks = ({ children: t, onFetchMembers: s, iconMap: l, onRemoveEdge: a, onUpdateNode: d }) => {
  const c = { ...Ze, ...l };
  return /* @__PURE__ */ e.jsx(Qe.Provider, { value: { onFetchMembers: s, iconMap: c, onRemoveEdge: a, onUpdateNode: d }, children: t });
}, Zs = ({ id: t, data: s, selected: l }) => {
  const { iconMap: a, onUpdateNode: d } = ie(), c = a[s.iconPath] || a.Layout, [p, b] = C(!1), [f, m] = C(s.name), i = oe(null), n = s.inCycle ? {
    border: "border-red-400",
    bg: "bg-red-50",
    iconBg: "bg-red-100 text-red-600",
    badge: "bg-red-600 text-white",
    badgeText: "CYCLE ERROR",
    opacity: "opacity-100"
  } : s.isDeleted ? {
    border: "border-slate-200",
    bg: "bg-slate-100",
    iconBg: "bg-slate-200 text-slate-400",
    badge: "bg-slate-500 text-white",
    badgeText: "DELETED",
    opacity: "opacity-75 grayscale"
  } : s.isSuspended ? {
    border: "border-amber-300",
    bg: "bg-amber-50",
    iconBg: "bg-amber-100 text-amber-600",
    badge: "bg-amber-500 text-white",
    badgeText: "SUSPENDED",
    opacity: "opacity-100"
  } : s.isActive ? {
    border: l ? "border-teal-500" : "border-transparent",
    bg: s.isRootNode ? "bg-slate-50" : "bg-white",
    iconBg: s.isRootNode ? "bg-teal-100 text-teal-600" : "bg-slate-100 text-slate-500",
    badge: s.isRootNode ? "bg-teal-600 text-white" : null,
    badgeText: "ROOT GROUP",
    opacity: "opacity-100"
  } : {
    border: "border-slate-200",
    bg: "bg-slate-50",
    iconBg: "bg-slate-200 text-slate-500",
    badge: "bg-slate-200 text-slate-600",
    badgeText: "INACTIVE",
    opacity: "opacity-90"
  }, g = E((y) => {
    y == null || y.stopPropagation(), b(!0), m(s.name);
  }, [s.name]), u = E(() => {
    b(!1), f !== s.name && d && d(t, { name: f });
  }, [f, s.name, t, d]), x = (y) => {
    y.stopPropagation(), y.key === "Enter" && u();
  };
  return Y(() => {
    if (!l || p) return;
    const y = (D) => {
      (D.ctrlKey || D.metaKey) && D.key.toLowerCase() === "r" && (D.preventDefault(), g());
    };
    return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
  }, [l, p, g]), Y(() => {
    p && i.current && (i.current.focus(), i.current.select());
  }, [p]), Y(() => {
    p || m(s.name);
  }, [s.name, p]), /* @__PURE__ */ e.jsxs(
    "div",
    {
      className: `
        relative px-4 py-3 rounded-xl shadow-lg border-2 transition-all duration-300
        ${n.border}
        ${n.bg}
        ${n.opacity}
        ${l ? "ring-4 ring-teal-500/20 scale-105 z-50" : "hover:border-slate-300"}
        min-w-[220px] group font-sans
      `,
      onDoubleClick: g,
      children: [
        n.badgeText && (n.badge || s.inCycle || s.isDeleted || s.isSuspended || !s.isActive) && /* @__PURE__ */ e.jsxs("div", { className: `
          absolute -top-3 left-4 px-2 py-0.5 rounded-full text-[9px] font-bold uppercase tracking-widest shadow-sm flex items-center gap-1 z-10
          ${n.badge || "bg-slate-200 text-slate-600"}
          ${s.inCycle ? "animate-pulse" : ""}
        `, children: [
          s.isDeleted && /* @__PURE__ */ e.jsx(Xe, { size: 8 }),
          s.isSuspended && /* @__PURE__ */ e.jsx(He, { size: 8 }),
          n.badgeText
        ] }),
        /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
          /* @__PURE__ */ e.jsx("div", { className: `
          w-10 h-10 rounded-xl flex items-center justify-center transition-colors shrink-0
          ${n.iconBg}
        `, children: c && /* @__PURE__ */ e.jsx(c, { size: 20, strokeWidth: 2.5 }) }),
          /* @__PURE__ */ e.jsxs("div", { className: "flex-1 overflow-hidden min-h-[36px] flex flex-col justify-center", children: [
            p ? /* @__PURE__ */ e.jsx(
              "input",
              {
                ref: i,
                type: "text",
                value: f,
                onChange: (y) => m(y.target.value),
                onBlur: u,
                onKeyDown: x,
                className: "w-full text-sm font-bold text-slate-800 border border-teal-500 rounded px-1 py-0.5 outline-none bg-white shadow-sm nodrag",
                onClick: (y) => y.stopPropagation(),
                onMouseDown: (y) => y.stopPropagation()
              }
            ) : /* @__PURE__ */ e.jsx("h3", { className: `text-sm font-bold text-slate-800 truncate leading-tight ${s.isDeleted ? "line-through decoration-slate-400" : ""}`, children: s.name || "Unnamed Group" }),
            /* @__PURE__ */ e.jsx("p", { className: "text-[10px] text-slate-500 truncate mt-0.5 opacity-80 italic", children: s.description || "No description provided..." })
          ] })
        ] }),
        /* @__PURE__ */ e.jsxs("div", { className: "mt-3 pt-2 border-t border-slate-200/50 flex items-center justify-between gap-2", children: [
          /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1.5 bg-white/50 px-2 py-1 rounded-md border border-slate-100 text-[10px] font-mono", children: [
            /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 text-slate-400", title: "Direct Members", children: [
              /* @__PURE__ */ e.jsx(le, { size: 12, strokeWidth: 2 }),
              /* @__PURE__ */ e.jsx("span", { children: s.memberCount || 0 })
            ] }),
            /* @__PURE__ */ e.jsx("div", { className: "w-px h-3 bg-slate-300 mx-0.5" }),
            /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 text-teal-600", title: "Inclusive Members", children: [
              /* @__PURE__ */ e.jsx(Fe, { size: 12, strokeWidth: 2 }),
              /* @__PURE__ */ e.jsx("span", { children: s.inclusiveMemberCount || s.memberCount || 0 })
            ] })
          ] }),
          /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-1 text-[9px] font-bold uppercase", children: s.inCycle ? /* @__PURE__ */ e.jsxs("div", { className: "text-red-600 flex items-center gap-1", children: [
            /* @__PURE__ */ e.jsx(Je, { size: 10 }),
            "ERROR"
          ] }) : s.isActive && !s.isDeleted && !s.isSuspended ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 text-emerald-600", children: [
            /* @__PURE__ */ e.jsx(ps, { size: 8, className: "fill-emerald-500" }),
            "Active"
          ] }) : /* @__PURE__ */ e.jsx("span", { className: "text-slate-400", children: "Inactive" }) })
        ] }),
        !s.isRootNode && /* @__PURE__ */ e.jsx(
          Te,
          {
            type: "target",
            position: $e.Left,
            className: "!w-3 !h-3 !bg-slate-400 !border-2 !border-white hover:!bg-teal-500 transition-colors"
          }
        ),
        /* @__PURE__ */ e.jsx(
          Te,
          {
            type: "source",
            position: $e.Right,
            className: "!w-3 !h-3 !bg-slate-400 !border-2 !border-white hover:!bg-teal-500 transition-colors"
          }
        )
      ]
    }
  );
}, Qs = ({
  id: t,
  sourceX: s,
  sourceY: l,
  targetX: a,
  targetY: d,
  sourcePosition: c,
  targetPosition: p,
  style: b = {},
  markerEnd: f,
  data: m
}) => {
  const { setEdges: i } = _t(), { onRemoveEdge: v } = ie(), [n, g, u] = Et({
    sourceX: s,
    sourceY: l,
    sourcePosition: c,
    targetX: a,
    targetY: d,
    targetPosition: p
  }), x = (D) => {
    D.stopPropagation(), v ? v(t) : i((G) => G.filter((O) => O.id !== t));
  }, y = m == null ? void 0 : m.inCycle;
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
    /* @__PURE__ */ e.jsx(
      Rt,
      {
        path: n,
        markerEnd: f,
        style: {
          ...b,
          stroke: y ? "#ef4444" : "#94a3b8",
          strokeWidth: y ? 3 : 2,
          transition: "stroke 0.3s"
        }
      }
    ),
    /* @__PURE__ */ e.jsx(St, { children: /* @__PURE__ */ e.jsx(
      "div",
      {
        style: {
          position: "absolute",
          transform: `translate(-50%, -50%) translate(${g}px,${u}px)`,
          pointerEvents: "all",
          zIndex: 10
        },
        className: "nodrag nopan",
        children: /* @__PURE__ */ e.jsx(
          "button",
          {
            className: "w-5 h-5 bg-white border border-slate-300 rounded-full flex items-center justify-center cursor-pointer hover:bg-red-50 hover:border-red-400 hover:text-red-500 text-slate-400 shadow-sm transition-all focus:outline-none",
            onClick: x,
            "aria-label": "Delete connection",
            title: "Delete connection",
            children: /* @__PURE__ */ e.jsx(q, { size: 12, strokeWidth: 2.5 })
          }
        )
      }
    ) })
  ] });
}, en = ({ node: t, readOnly: s, onUpdateNode: l, onClose: a }) => {
  const { onFetchMembers: d } = ie(), [c, p] = C("General"), b = ["General", "Status"];
  return d && b.push("Members"), t ? /* @__PURE__ */ e.jsxs("div", { className: "w-[450px] bg-white border-l border-slate-200 flex flex-col h-full shadow-xl z-20", children: [
    /* @__PURE__ */ e.jsxs("div", { className: "p-5 pb-0 shrink-0", children: [
      /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between items-start mb-1", children: [
        /* @__PURE__ */ e.jsx("h2", { className: "text-xl font-bold text-slate-900", children: "Edit Group" }),
        /* @__PURE__ */ e.jsx("button", { onClick: a, className: "text-slate-400 hover:text-slate-600 transition-colors", children: /* @__PURE__ */ e.jsx(q, { size: 20 }) })
      ] }),
      /* @__PURE__ */ e.jsxs("div", { className: "text-[10px] text-slate-400 font-mono mb-4 truncate", children: [
        "ID: ",
        t.id
      ] }),
      /* @__PURE__ */ e.jsx("div", { className: "flex border-b border-slate-200 gap-6", children: b.map((f) => /* @__PURE__ */ e.jsxs(
        "button",
        {
          onClick: () => p(f),
          className: `pb-3 text-sm font-medium transition-all relative ${c === f ? "text-teal-600" : "text-slate-500 hover:text-slate-700"}`,
          children: [
            /* @__PURE__ */ e.jsxs("span", { className: "flex items-center gap-2", children: [
              f === "General" && /* @__PURE__ */ e.jsx(bs, { size: 14 }),
              f === "Status" && /* @__PURE__ */ e.jsx(Qt, { size: 14 }),
              f === "Members" && /* @__PURE__ */ e.jsx(le, { size: 14 }),
              f
            ] }),
            c === f && /* @__PURE__ */ e.jsx("div", { className: "absolute bottom-0 left-0 right-0 h-0.5 bg-teal-600 rounded-t-full" })
          ]
        },
        f
      )) })
    ] }),
    /* @__PURE__ */ e.jsxs("div", { className: "flex-1 overflow-hidden bg-white", children: [
      c === "General" && /* @__PURE__ */ e.jsx(tn, { node: t, readOnly: s, onUpdateNode: l }),
      c === "Status" && /* @__PURE__ */ e.jsx(sn, { node: t, readOnly: s, onUpdateNode: l }),
      c === "Members" && d && /* @__PURE__ */ e.jsx(nn, { node: t, readOnly: s })
    ] })
  ] }) : null;
}, tn = ({ node: t, readOnly: s, onUpdateNode: l }) => {
  const { iconMap: a } = ie(), d = Object.keys(a);
  if (!t) return null;
  const c = t.data, p = (m, i, v) => {
    const n = [...c.attributes];
    n[m][i] = v, l(t.id, { attributes: n });
  }, b = () => {
    l(t.id, { attributes: [...c.attributes, { role: "", value: "" }] });
  }, f = (m) => {
    const i = c.attributes.filter((v, n) => n !== m);
    l(t.id, { attributes: i });
  };
  return /* @__PURE__ */ e.jsx("div", { className: "p-5 h-full overflow-y-auto", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-6", children: [
    /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
      /* @__PURE__ */ e.jsx("label", { className: "text-xs font-bold text-slate-500 uppercase tracking-wider", children: "Group Name" }),
      /* @__PURE__ */ e.jsx(
        "input",
        {
          className: "w-full p-2.5 text-sm border border-slate-200 rounded-lg focus:ring-1 focus:ring-teal-500 focus:border-teal-500 outline-none text-slate-700 transition-all font-medium",
          value: c.name,
          onChange: (m) => l(t.id, { name: m.target.value }),
          placeholder: "Enter group name",
          readOnly: s
        }
      )
    ] }),
    /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
      /* @__PURE__ */ e.jsx("label", { className: "text-xs font-bold text-slate-500 uppercase tracking-wider", children: "Icon" }),
      /* @__PURE__ */ e.jsx("div", { className: "flex gap-2 flex-wrap", children: d.map((m) => {
        const i = a[m] || We, v = c.iconPath === m;
        return /* @__PURE__ */ e.jsx(
          "button",
          {
            onClick: () => !s && l(t.id, { iconPath: m }),
            className: `p-3 rounded-lg border transition-all flex items-center justify-center ${v ? "bg-teal-50 border-teal-500 text-teal-600 shadow-sm ring-2 ring-teal-500/20" : "border-slate-200 text-slate-400 hover:border-slate-300 hover:bg-slate-50"}`,
            title: m,
            type: "button",
            children: /* @__PURE__ */ e.jsx(i, { size: 20, strokeWidth: v ? 2.5 : 2 })
          },
          m
        );
      }) })
    ] }),
    /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
      /* @__PURE__ */ e.jsx("label", { className: "text-xs font-bold text-slate-500 uppercase tracking-wider", children: "Description" }),
      /* @__PURE__ */ e.jsx(
        "textarea",
        {
          className: "w-full p-2.5 text-sm border border-slate-200 rounded-lg focus:ring-1 focus:ring-teal-500 focus:border-teal-500 outline-none text-slate-700 min-h-[100px] resize-none",
          value: c.description,
          onChange: (m) => l(t.id, { description: m.target.value }),
          placeholder: "Enter description...",
          readOnly: s
        }
      )
    ] }),
    /* @__PURE__ */ e.jsxs("div", { className: "space-y-2 pt-2 border-t border-slate-100", children: [
      /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
        /* @__PURE__ */ e.jsx("label", { className: "text-xs font-bold text-slate-500 uppercase tracking-wider", children: "Attributes" }),
        /* @__PURE__ */ e.jsx("span", { className: "text-[10px] bg-slate-100 text-slate-500 px-1.5 py-0.5 rounded-full", children: c.attributes.length })
      ] }),
      /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
        c.attributes.map((m, i) => /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 group", children: [
          /* @__PURE__ */ e.jsx(
            "input",
            {
              className: "flex-1 p-2 text-xs border border-slate-200 rounded-md focus:border-teal-500 outline-none",
              value: m.role,
              placeholder: "Key",
              onChange: (v) => p(i, "role", v.target.value),
              readOnly: s
            }
          ),
          /* @__PURE__ */ e.jsx(
            "input",
            {
              className: "flex-1 p-2 text-xs border border-slate-200 rounded-md focus:border-teal-500 outline-none",
              value: m.value,
              placeholder: "Value",
              onChange: (v) => p(i, "value", v.target.value),
              readOnly: s
            }
          ),
          !s && /* @__PURE__ */ e.jsx("button", { onClick: () => f(i), className: "p-2 text-slate-300 hover:text-red-500 transition-colors", children: /* @__PURE__ */ e.jsx(q, { size: 14 }) })
        ] }, i)),
        !s && /* @__PURE__ */ e.jsxs(
          "button",
          {
            onClick: b,
            className: "w-full p-2 border border-slate-200 border-dashed rounded-md bg-slate-50 flex items-center justify-center gap-2 text-slate-500 hover:bg-slate-100 hover:text-teal-600 transition-colors text-xs font-medium",
            children: [
              /* @__PURE__ */ e.jsx(qe, { size: 14 }),
              "Add Attribute"
            ]
          }
        )
      ] })
    ] })
  ] }) });
}, sn = ({ node: t, readOnly: s, onUpdateNode: l }) => {
  if (!t) return null;
  const a = t.data;
  return /* @__PURE__ */ e.jsx("div", { className: "p-5 h-full overflow-y-auto", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-6", children: [
    /* @__PURE__ */ e.jsxs("div", { className: "bg-slate-50 rounded-lg p-4 border border-slate-100", children: [
      /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between mb-2", children: [
        /* @__PURE__ */ e.jsx("span", { className: "text-sm text-slate-900 font-bold", children: "Active Status" }),
        /* @__PURE__ */ e.jsx(
          "button",
          {
            disabled: s,
            onClick: () => l(t.id, { isActive: !a.isActive }),
            className: `transition-colors ${a.isActive ? "text-emerald-600" : "text-slate-300"}`,
            children: a.isActive ? /* @__PURE__ */ e.jsx(Ce, { size: 32 }) : /* @__PURE__ */ e.jsx(ke, { size: 32 })
          }
        )
      ] }),
      /* @__PURE__ */ e.jsx("p", { className: "text-xs text-slate-500 leading-relaxed", children: "Controls whether this group is currently active in the system. Inactive groups are hidden from most standard views." })
    ] }),
    /* @__PURE__ */ e.jsxs("div", { className: `rounded-lg p-4 border transition-colors ${a.isSuspended ? "bg-amber-50 border-amber-200" : "bg-slate-50 border-slate-100"}`, children: [
      /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between mb-3", children: [
        /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ e.jsx(He, { size: 18, className: a.isSuspended ? "text-amber-600" : "text-slate-400" }),
          /* @__PURE__ */ e.jsx("span", { className: `text-sm font-bold ${a.isSuspended ? "text-amber-800" : "text-slate-700"}`, children: "Suspended" })
        ] }),
        /* @__PURE__ */ e.jsx(
          "button",
          {
            disabled: s,
            onClick: () => l(t.id, { isSuspended: !a.isSuspended }),
            className: `transition-colors ${a.isSuspended ? "text-amber-600" : "text-slate-300"}`,
            children: a.isSuspended ? /* @__PURE__ */ e.jsx(Ce, { size: 32 }) : /* @__PURE__ */ e.jsx(ke, { size: 32 })
          }
        )
      ] }),
      a.isSuspended && /* @__PURE__ */ e.jsxs("div", { className: "space-y-3 animate-in fade-in slide-in-from-top-2", children: [
        /* @__PURE__ */ e.jsxs("div", { children: [
          /* @__PURE__ */ e.jsx("label", { className: "text-[10px] font-bold text-amber-700/70 uppercase tracking-wider", children: "Suspension Reason" }),
          /* @__PURE__ */ e.jsx(
            "input",
            {
              className: "w-full mt-1 p-2 text-xs border border-amber-200 rounded bg-white text-slate-700 focus:outline-none focus:ring-1 focus:ring-amber-500",
              placeholder: "e.g. Under Investigation",
              value: a.suspensionReason || "",
              onChange: (d) => l(t.id, { suspensionReason: d.target.value }),
              readOnly: s
            }
          )
        ] }),
        /* @__PURE__ */ e.jsxs("div", { children: [
          /* @__PURE__ */ e.jsx("label", { className: "text-[10px] font-bold text-amber-700/70 uppercase tracking-wider", children: "Additional Message" }),
          /* @__PURE__ */ e.jsx(
            "textarea",
            {
              className: "w-full mt-1 p-2 text-xs border border-amber-200 rounded bg-white text-slate-700 focus:outline-none focus:ring-1 focus:ring-amber-500 resize-none h-16",
              placeholder: "Details about suspension...",
              value: a.suspensionMessage || "",
              onChange: (d) => l(t.id, { suspensionMessage: d.target.value }),
              readOnly: s
            }
          )
        ] })
      ] })
    ] }),
    /* @__PURE__ */ e.jsxs("div", { className: `rounded-lg p-4 border transition-colors ${a.isDeleted ? "bg-red-50 border-red-200" : "bg-slate-50 border-slate-100"}`, children: [
      /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between mb-3", children: [
        /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ e.jsx(Xe, { size: 18, className: a.isDeleted ? "text-red-600" : "text-slate-400" }),
          /* @__PURE__ */ e.jsx("span", { className: `text-sm font-bold ${a.isDeleted ? "text-red-800" : "text-slate-700"}`, children: "Deleted (Soft)" })
        ] }),
        /* @__PURE__ */ e.jsx(
          "button",
          {
            disabled: s,
            onClick: () => l(t.id, { isDeleted: !a.isDeleted }),
            className: `transition-colors ${a.isDeleted ? "text-red-600" : "text-slate-300"}`,
            children: a.isDeleted ? /* @__PURE__ */ e.jsx(Ce, { size: 32 }) : /* @__PURE__ */ e.jsx(ke, { size: 32 })
          }
        )
      ] }),
      a.isDeleted && /* @__PURE__ */ e.jsxs("div", { className: "space-y-3 animate-in fade-in slide-in-from-top-2", children: [
        /* @__PURE__ */ e.jsxs("div", { children: [
          /* @__PURE__ */ e.jsx("label", { className: "text-[10px] font-bold text-red-700/70 uppercase tracking-wider", children: "Deletion Reason" }),
          /* @__PURE__ */ e.jsx(
            "input",
            {
              className: "w-full mt-1 p-2 text-xs border border-red-200 rounded bg-white text-slate-700 focus:outline-none focus:ring-1 focus:ring-red-500",
              placeholder: "e.g. Department Closure",
              value: a.deletionReason || "",
              onChange: (d) => l(t.id, { deletionReason: d.target.value }),
              readOnly: s
            }
          )
        ] }),
        /* @__PURE__ */ e.jsxs("div", { children: [
          /* @__PURE__ */ e.jsx("label", { className: "text-[10px] font-bold text-red-700/70 uppercase tracking-wider", children: "Additional Message" }),
          /* @__PURE__ */ e.jsx(
            "textarea",
            {
              className: "w-full mt-1 p-2 text-xs border border-red-200 rounded bg-white text-slate-700 focus:outline-none focus:ring-1 focus:ring-red-500 resize-none h-16",
              placeholder: "Details about deletion...",
              value: a.deletionMessage || "",
              onChange: (d) => l(t.id, { deletionMessage: d.target.value }),
              readOnly: s
            }
          )
        ] })
      ] })
    ] })
  ] }) });
}, nn = ({ node: t }) => {
  const { onFetchMembers: s } = ie(), [l, a] = C(!0), [d, c] = C([]), [p, b] = C(1), [f, m] = C(0), [i, v] = C(""), [n, g] = C(!1);
  return Y(() => {
    if (!t) return;
    let u = !0;
    a(!0);
    const x = setTimeout(() => {
      s ? s(t.id, t.data.name, p, i, n).then((y) => {
        u && (c(y.data), m(y.total), a(!1));
      }) : u && (a(!1), c([]), m(0));
    }, 300);
    return () => {
      u = !1, clearTimeout(x);
    };
  }, [t, p, i, n, s]), t ? /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col h-full", children: [
    /* @__PURE__ */ e.jsxs("div", { className: "p-4 border-b border-slate-100 space-y-3", children: [
      /* @__PURE__ */ e.jsxs("div", { className: "flex p-1 bg-slate-100 rounded-lg", children: [
        /* @__PURE__ */ e.jsxs(
          "button",
          {
            onClick: () => {
              g(!1), b(1);
            },
            className: `flex-1 flex items-center justify-center gap-2 py-1.5 text-xs font-bold rounded-md transition-all ${n ? "text-slate-500 hover:text-slate-700" : "bg-white text-teal-600 shadow-sm"}`,
            children: [
              /* @__PURE__ */ e.jsx(Ke, { size: 14 }),
              "Direct Members"
            ]
          }
        ),
        /* @__PURE__ */ e.jsxs(
          "button",
          {
            onClick: () => {
              g(!0), b(1);
            },
            className: `flex-1 flex items-center justify-center gap-2 py-1.5 text-xs font-bold rounded-md transition-all ${n ? "bg-white text-teal-600 shadow-sm" : "text-slate-500 hover:text-slate-700"}`,
            children: [
              /* @__PURE__ */ e.jsx(Fe, { size: 14 }),
              "Inclusive"
            ]
          }
        )
      ] }),
      /* @__PURE__ */ e.jsxs("div", { className: "relative", children: [
        /* @__PURE__ */ e.jsx(Ee, { size: 16, className: "absolute left-3 top-1/2 -translate-y-1/2 text-slate-400" }),
        /* @__PURE__ */ e.jsx(
          "input",
          {
            className: "w-full pl-9 pr-4 py-2 bg-slate-50 border border-slate-200 rounded-lg text-sm focus:outline-none focus:ring-1 focus:ring-teal-500 transition-all",
            placeholder: "Search members...",
            value: i,
            onChange: (u) => {
              v(u.target.value), b(1);
            }
          }
        )
      ] })
    ] }),
    /* @__PURE__ */ e.jsx("div", { className: "flex-1 overflow-y-auto", children: l ? /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center h-40 gap-3 text-slate-400", children: [
      /* @__PURE__ */ e.jsx(ks, { size: 24, className: "animate-spin text-teal-500" }),
      /* @__PURE__ */ e.jsx("span", { className: "text-xs font-medium", children: "Loading members..." })
    ] }) : d.length === 0 ? /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center h-40 gap-2 text-slate-400", children: [
      /* @__PURE__ */ e.jsx(le, { size: 24 }),
      /* @__PURE__ */ e.jsx("span", { className: "text-xs", children: "No members found" })
    ] }) : /* @__PURE__ */ e.jsx("div", { className: "divide-y divide-slate-100", children: d.map((u) => /* @__PURE__ */ e.jsxs("div", { className: "p-4 hover:bg-slate-50 transition-colors flex items-center justify-between group", children: [
      /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
        /* @__PURE__ */ e.jsx("div", { className: "w-8 h-8 rounded-full bg-teal-100 text-teal-700 flex items-center justify-center font-bold text-xs shrink-0", children: u.name.substring(0, 2).toUpperCase() }),
        /* @__PURE__ */ e.jsxs("div", { className: "min-w-0", children: [
          /* @__PURE__ */ e.jsx("div", { className: "text-sm font-medium text-slate-800 truncate", children: u.name }),
          /* @__PURE__ */ e.jsx("div", { className: "text-[10px] text-slate-500 truncate", children: u.email }),
          n && u.sourceGroup && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 mt-1", children: [
            /* @__PURE__ */ e.jsx("span", { className: "text-[9px] text-slate-400", children: "from" }),
            /* @__PURE__ */ e.jsx("span", { className: "text-[9px] font-medium text-slate-600 bg-slate-100 px-1.5 py-0.5 rounded border border-slate-200 truncate max-w-[200px]", title: u.sourceGroup, children: u.sourceGroup })
          ] })
        ] })
      ] }),
      /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-end gap-1 shrink-0 ml-2", children: [
        /* @__PURE__ */ e.jsx("span", { className: `text-[10px] px-1.5 py-0.5 rounded font-bold uppercase tracking-wider ${u.status === "Active" ? "bg-emerald-50 text-emerald-600" : "bg-slate-100 text-slate-500"}`, children: u.status }),
        /* @__PURE__ */ e.jsx("span", { className: "text-[10px] text-slate-400 font-mono", children: u.role })
      ] })
    ] }, u.id)) }) }),
    /* @__PURE__ */ e.jsxs("div", { className: "p-3 border-t border-slate-200 bg-slate-50 flex items-center justify-between shrink-0", children: [
      /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-slate-500", children: [
        (p - 1) * 10 + 1,
        "-",
        Math.min(p * 10, f),
        " of ",
        f
      ] }),
      /* @__PURE__ */ e.jsxs("div", { className: "flex gap-1", children: [
        /* @__PURE__ */ e.jsx(
          "button",
          {
            onClick: () => b((u) => Math.max(1, u - 1)),
            disabled: p === 1 || l,
            className: "p-1.5 hover:bg-white rounded border border-transparent hover:border-slate-200 disabled:opacity-30 disabled:hover:bg-transparent",
            children: /* @__PURE__ */ e.jsx(as, { size: 16, className: "text-slate-600" })
          }
        ),
        /* @__PURE__ */ e.jsx(
          "button",
          {
            onClick: () => b((u) => u + 1),
            disabled: p * 10 >= f || l,
            className: "p-1.5 hover:bg-white rounded border border-transparent hover:border-slate-200 disabled:opacity-30 disabled:hover:bg-transparent",
            children: /* @__PURE__ */ e.jsx(ls, { size: 16, className: "text-slate-600" })
          }
        )
      ] })
    ] })
  ] }) : null;
}, rn = ({ open: t, onClose: s, onSubmit: l, saving: a }) => {
  const [d, c] = C("Configuration Update"), [p, b] = C("");
  return t ? /* @__PURE__ */ e.jsxs("div", { className: "fixed inset-0 z-[200] flex items-center justify-center p-4", children: [
    /* @__PURE__ */ e.jsx("div", { className: "absolute inset-0 bg-slate-900/40 backdrop-blur-sm", onClick: s }),
    /* @__PURE__ */ e.jsx("div", { className: "relative bg-white rounded-2xl shadow-2xl w-full max-w-md overflow-hidden animate-in fade-in zoom-in duration-200 border border-slate-200", children: /* @__PURE__ */ e.jsxs("div", { className: "p-6", children: [
      /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between mb-6", children: [
        /* @__PURE__ */ e.jsxs("h3", { className: "text-lg font-bold text-slate-900 flex items-center gap-2", children: [
          /* @__PURE__ */ e.jsx(us, { className: "text-teal-500" }),
          "Save Group Hierarchy"
        ] }),
        /* @__PURE__ */ e.jsx("button", { onClick: s, className: "p-1 text-slate-400 hover:bg-slate-100 rounded-full transition-colors", children: /* @__PURE__ */ e.jsx(q, { size: 20 }) })
      ] }),
      /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
        /* @__PURE__ */ e.jsxs("div", { children: [
          /* @__PURE__ */ e.jsx("label", { className: "block text-[10px] font-bold text-slate-500 uppercase tracking-wider mb-1", children: "Reason for Change" }),
          /* @__PURE__ */ e.jsxs(
            "select",
            {
              className: "w-full p-2.5 text-sm border border-slate-300 rounded-lg focus:ring-1 focus:ring-teal-500/20 focus:border-teal-500 focus:outline-none bg-white text-slate-700",
              value: d,
              onChange: (f) => c(f.target.value),
              children: [
                /* @__PURE__ */ e.jsx("option", { children: "Configuration Update" }),
                /* @__PURE__ */ e.jsx("option", { children: "New Group Structure" }),
                /* @__PURE__ */ e.jsx("option", { children: "Refactor / Hierarchy Change" }),
                /* @__PURE__ */ e.jsx("option", { children: "Emergency Fix" }),
                /* @__PURE__ */ e.jsx("option", { children: "Other" })
              ]
            }
          )
        ] }),
        /* @__PURE__ */ e.jsxs("div", { children: [
          /* @__PURE__ */ e.jsx("label", { className: "block text-[10px] font-bold text-slate-500 uppercase tracking-wider mb-1", children: "Detailed Message" }),
          /* @__PURE__ */ e.jsx(
            "textarea",
            {
              className: "w-full p-2.5 text-sm border border-slate-300 rounded-lg h-32 focus:ring-1 focus:ring-teal-500/20 focus:border-teal-500 focus:outline-none resize-none text-slate-700 placeholder-slate-400",
              placeholder: "Describe the changes made to the group hierarchy...",
              value: p,
              onChange: (f) => b(f.target.value)
            }
          )
        ] })
      ] }),
      /* @__PURE__ */ e.jsxs("div", { className: "mt-8 flex gap-3", children: [
        /* @__PURE__ */ e.jsx(
          "button",
          {
            onClick: s,
            className: "flex-1 py-2.5 px-4 border border-slate-300 text-slate-600 font-bold text-sm rounded-xl hover:bg-slate-50 transition-colors",
            children: "Cancel"
          }
        ),
        /* @__PURE__ */ e.jsx(
          "button",
          {
            onClick: () => l(d, p),
            disabled: a || !d,
            className: `flex-1 py-2.5 px-4 bg-teal-600 text-white font-bold text-sm rounded-xl transition-all shadow-lg shadow-teal-600/20 ${a ? "opacity-50 cursor-not-allowed" : "hover:bg-teal-700 active:scale-95"}`,
            children: a ? "Saving..." : "Confirm Save"
          }
        )
      ] })
    ] }) })
  ] }) : null;
}, an = ({ open: t, parentNode: s, candidates: l, onClose: a, onConfirm: d }) => {
  const [c, p] = C(""), [b, f] = C(/* @__PURE__ */ new Set());
  Oe.useEffect(() => {
    t && (p(""), f(/* @__PURE__ */ new Set()));
  }, [t]);
  const { matches: m, error: i } = me(() => {
    if (!c.trim()) return { matches: [], error: null };
    let g;
    try {
      g = new RegExp(c, "i");
    } catch (u) {
      return { matches: [], error: u.message };
    }
    return {
      matches: l.filter((u) => g.test(u.data.name || "")),
      error: null
    };
  }, [c, l]);
  if (!t) return null;
  const v = m.filter((g) => !b.has(g.id)).map((g) => g.id), n = (g) => {
    f((u) => {
      const x = new Set(u);
      return x.has(g) ? x.delete(g) : x.add(g), x;
    });
  };
  return /* @__PURE__ */ e.jsxs("div", { className: "fixed inset-0 z-[200] flex items-center justify-center p-4", children: [
    /* @__PURE__ */ e.jsx("div", { className: "absolute inset-0 bg-slate-900/40 backdrop-blur-sm", onClick: a }),
    /* @__PURE__ */ e.jsxs("div", { className: "relative bg-white rounded-2xl shadow-2xl w-full max-w-lg overflow-hidden animate-in fade-in zoom-in duration-200 border border-slate-200 flex flex-col max-h-[80vh]", children: [
      /* @__PURE__ */ e.jsxs("div", { className: "p-6 pb-4 shrink-0", children: [
        /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between mb-1", children: [
          /* @__PURE__ */ e.jsxs("h3", { className: "text-lg font-bold text-slate-900 flex items-center gap-2", children: [
            /* @__PURE__ */ e.jsx(Be, { className: "text-teal-500" }),
            "Connect by Regex"
          ] }),
          /* @__PURE__ */ e.jsx("button", { onClick: a, className: "p-1 text-slate-400 hover:bg-slate-100 rounded-full transition-colors", children: /* @__PURE__ */ e.jsx(q, { size: 20 }) })
        ] }),
        /* @__PURE__ */ e.jsxs("p", { className: "text-xs text-slate-500 mb-4", children: [
          "Matching groups will be re-parented under",
          " ",
          /* @__PURE__ */ e.jsx("span", { className: "font-semibold text-slate-700", children: (s == null ? void 0 : s.data.name) || "the selected group" }),
          "."
        ] }),
        /* @__PURE__ */ e.jsxs("div", { className: "relative", children: [
          /* @__PURE__ */ e.jsx("div", { className: "absolute left-3 top-1/2 -translate-y-1/2 text-slate-400", children: /* @__PURE__ */ e.jsx(Ee, { size: 16 }) }),
          /* @__PURE__ */ e.jsx(
            "input",
            {
              autoFocus: !0,
              className: `w-full pl-9 pr-3 py-2.5 text-sm border rounded-lg focus:outline-none focus:ring-1 transition-all font-mono ${i ? "border-red-300 focus:ring-red-500/20 focus:border-red-500" : "border-slate-300 focus:ring-teal-500/20 focus:border-teal-500"}`,
              placeholder: "e.g. ^Sales|North$",
              value: c,
              onChange: (g) => p(g.target.value)
            }
          )
        ] }),
        i && /* @__PURE__ */ e.jsxs("div", { className: "mt-2 flex items-center gap-1.5 text-xs text-red-600", children: [
          /* @__PURE__ */ e.jsx(cs, { size: 13 }),
          /* @__PURE__ */ e.jsxs("span", { children: [
            "Invalid regex: ",
            i
          ] })
        ] }),
        !i && c.trim() && /* @__PURE__ */ e.jsxs("div", { className: "mt-2 text-xs text-slate-500", children: [
          /* @__PURE__ */ e.jsx("span", { className: "font-bold text-slate-700", children: v.length }),
          " of ",
          m.length,
          " matched group",
          m.length === 1 ? "" : "s",
          " selected"
        ] })
      ] }),
      /* @__PURE__ */ e.jsxs("div", { className: "flex-1 overflow-y-auto px-6 min-h-[80px]", children: [
        c.trim() && !i && m.length === 0 && /* @__PURE__ */ e.jsx("div", { className: "text-center text-sm text-slate-400 py-8", children: "No groups match this pattern." }),
        /* @__PURE__ */ e.jsx("ul", { className: "space-y-1 pb-2", children: m.map((g) => {
          const u = !b.has(g.id);
          return /* @__PURE__ */ e.jsx("li", { children: /* @__PURE__ */ e.jsxs("label", { className: "flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-slate-50 cursor-pointer", children: [
            /* @__PURE__ */ e.jsx(
              "input",
              {
                type: "checkbox",
                checked: u,
                onChange: () => n(g.id),
                className: "w-4 h-4 rounded border-slate-300 text-teal-600 focus:ring-teal-500/30"
              }
            ),
            /* @__PURE__ */ e.jsx("span", { className: `text-sm truncate ${u ? "text-slate-700" : "text-slate-400 line-through"}`, children: g.data.name || "(unnamed)" })
          ] }) }, g.id);
        }) })
      ] }),
      /* @__PURE__ */ e.jsxs("div", { className: "p-6 pt-4 flex gap-3 shrink-0 border-t border-slate-100", children: [
        /* @__PURE__ */ e.jsx(
          "button",
          {
            onClick: a,
            className: "flex-1 py-2.5 px-4 border border-slate-300 text-slate-600 font-bold text-sm rounded-xl hover:bg-slate-50 transition-colors",
            children: "Cancel"
          }
        ),
        /* @__PURE__ */ e.jsxs(
          "button",
          {
            onClick: () => d(v),
            disabled: v.length === 0,
            className: `flex-1 py-2.5 px-4 bg-teal-600 text-white font-bold text-sm rounded-xl transition-all shadow-lg shadow-teal-600/20 ${v.length === 0 ? "opacity-50 cursor-not-allowed" : "hover:bg-teal-700 active:scale-95"}`,
            children: [
              "Connect ",
              v.length > 0 ? `(${v.length})` : ""
            ]
          }
        )
      ] })
    ] })
  ] });
};
class on {
  constructor() {
    this.adj = /* @__PURE__ */ new Map();
  }
  addVertex(s) {
    this.adj.has(s) || this.adj.set(s, []);
  }
  addEdge(s, l) {
    this.addVertex(s), this.addVertex(l);
    const a = this.adj.get(s) || [];
    a.includes(l) || (a.push(l), this.adj.set(s, a));
  }
  findCycles() {
    const s = [], l = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), d = [], c = (p) => {
      l.add(p), a.add(p), d.push(p);
      const b = this.adj.get(p) || [];
      for (const f of b)
        if (!l.has(f))
          c(f);
        else if (a.has(f)) {
          const m = d.indexOf(f);
          m !== -1 && s.push(d.slice(m));
        }
      a.delete(p), d.pop();
    };
    for (const p of this.adj.keys())
      l.has(p) || c(p);
    return s;
  }
  getDeepChildren(s) {
    const l = /* @__PURE__ */ new Set(), a = [s], d = /* @__PURE__ */ new Set();
    for (; a.length > 0; ) {
      const c = a.pop();
      if (d.has(c)) continue;
      d.add(c);
      const p = this.adj.get(c) || [];
      for (const b of p)
        l.add(b), a.push(b);
    }
    return l.delete(s), Array.from(l);
  }
}
const ln = (t, s, l) => ({
  id: t || Ye(),
  type: "group",
  position: s || { x: 0, y: 0 },
  data: {
    name: "New Group",
    description: "",
    iconPath: "Layout",
    color: "#0d9488",
    // Teal-600
    isRootNode: l,
    inCycle: !1,
    isActive: !0,
    isDeleted: !1,
    isSuspended: !1,
    deletionReason: null,
    deletionMessage: null,
    suspensionReason: null,
    suspensionMessage: null,
    attributes: [],
    properties: [],
    memberCount: 0,
    inclusiveMemberCount: 0,
    descendants: []
  }
}), cn = (t, s) => {
  const l = s.filter((a) => a.source === t.id).map((a) => a.target);
  return {
    id: t.id,
    name: t.data.name,
    isActive: t.data.isActive,
    isDeleted: t.data.isDeleted,
    isSuspended: t.data.isSuspended,
    deletionReason: t.data.deletionReason,
    deletionMessage: t.data.deletionMessage,
    suspensionReason: t.data.suspensionReason,
    suspensionMessage: t.data.suspensionMessage,
    children: l,
    attributes: t.data.attributes,
    properties: t.data.properties,
    memberCount: t.data.memberCount,
    // Store diagrammatic data if the backend supports it, otherwise this might be lost on roundtrip
    // depending on the backend schema. For now, we map it back.
    description: t.data.description,
    iconPath: t.data.iconPath
  };
}, dn = (t, s, l) => {
  var g, u;
  const c = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Set();
  s.forEach((x) => {
    const y = c.get(x.source) || [];
    y.push(x.target), c.set(x.source, y), p.add(x.target);
  });
  const b = l && t.some((x) => x.id === l) ? l : ((g = t.find((x) => !p.has(x.id))) == null ? void 0 : g.id) ?? ((u = t[0]) == null ? void 0 : u.id), f = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Set(), i = { val: 0 }, v = (x, y) => {
    if (m.has(x)) return;
    m.add(x);
    const D = c.get(x) || [];
    if (D.length === 0) {
      f.set(x, { x: y * 300, y: i.val }), i.val += 180;
      return;
    }
    D.forEach(($) => v($, y + 1));
    const G = D.map(($) => {
      var F;
      return (F = f.get($)) == null ? void 0 : F.y;
    }).filter(($) => $ !== void 0), O = G.length ? (Math.min(...G) + Math.max(...G)) / 2 : i.val;
    f.set(x, { x: y * 300, y: O });
  };
  b && v(b, 0);
  let n = i.val + 180;
  return t.forEach((x) => {
    f.has(x.id) || (f.set(x.id, { x: 0, y: n }), n += 180);
  }), t.map((x) => ({ ...x, position: f.get(x.id) || x.position }));
}, fn = (t) => {
  const s = [], l = [], a = {};
  t.nodes.forEach((n) => {
    a[n.id] = { ...n, _children: [] };
  });
  let d = null;
  t.nodes.forEach((n) => {
    n.parent && a[n.parent] ? a[n.parent]._children.push(n.id) : d = n.id;
  }), !d && t.rootGroupId && (d = t.rootGroupId);
  const c = /* @__PURE__ */ new Map(), p = (n) => {
    if (c.has(n))
      return c.get(n);
    const g = a[n];
    if (!g) return 0;
    let u = g.memberCount || 0;
    const x = g._children || [];
    for (const y of x)
      u += p(y);
    return c.set(n, u), u;
  };
  t.nodes.forEach((n) => {
    p(n.id);
  });
  const b = 300, f = 180, m = (n, g, u) => {
    const x = a[n];
    if (!x) return;
    const y = u.val, D = n === d, G = x.attributes || [];
    s.push({
      id: n,
      type: "group",
      position: { x: g * b, y },
      data: {
        name: x.name,
        // Removed type injection. Description can come from JSON or be empty.
        description: x.description || "",
        iconPath: D ? "Building" : x.iconPath || "Users",
        color: "#0d9488",
        isRootNode: D,
        inCycle: !1,
        // Map Status Flags
        isActive: x.isActive !== void 0 ? x.isActive : !0,
        isDeleted: x.isDeleted || !1,
        isSuspended: x.isSuspended || !1,
        deletionReason: x.deletionReason || null,
        deletionMessage: x.deletionMessage || null,
        suspensionReason: x.suspensionReason || null,
        suspensionMessage: x.suspensionMessage || null,
        attributes: G,
        properties: [],
        memberCount: x.memberCount,
        inclusiveMemberCount: c.get(n),
        descendants: []
      }
    }), x.parent && a[x.parent] && l.push({
      id: `e-${x.parent}-${n}`,
      source: x.parent,
      target: n,
      type: "base",
      markerEnd: { type: fe.ArrowClosed }
    });
    const O = x._children || [];
    O.length > 0 ? O.forEach(($) => {
      m($, g + 1, u);
    }) : u.val += f;
  };
  d && m(d, 0, { val: 0 });
  const i = new Set(s.map((n) => n.id));
  let v = 0;
  return t.nodes.forEach((n) => {
    i.has(n.id) || (s.push({
      id: n.id,
      type: "group",
      position: { x: 0, y: v + 500 },
      // Place them below
      data: {
        name: n.name,
        description: "Detached Node",
        iconPath: "AlertTriangle",
        color: "#ef4444",
        isRootNode: !1,
        inCycle: !1,
        isActive: n.isActive !== void 0 ? n.isActive : !0,
        isDeleted: n.isDeleted || !1,
        isSuspended: n.isSuspended || !1,
        deletionReason: n.deletionReason || null,
        deletionMessage: n.deletionMessage || null,
        suspensionReason: n.suspensionReason || null,
        suspensionMessage: n.suspensionMessage || null,
        attributes: [],
        properties: [],
        memberCount: n.memberCount,
        inclusiveMemberCount: n.memberCount,
        descendants: []
      }
    }), v += f);
  }), { nodes: s, edges: l };
}, un = () => {
  const [t, s] = C([]), [l, a] = C([]), d = E((b, f) => {
    s((m) => [...m.length > 50 ? m.slice(1) : m, { nodes: b, edges: f }]), a([]);
  }, []), c = E((b, f) => {
    if (t.length === 0) return null;
    const m = t[t.length - 1], i = t.slice(0, t.length - 1);
    return s(i), a((v) => [{ nodes: b, edges: f }, ...v]), m;
  }, [t]), p = E((b, f) => {
    if (l.length === 0) return null;
    const m = l[0], i = l.slice(1);
    return a(i), s((v) => [...v, { nodes: b, edges: f }]), m;
  }, [l]);
  return { takeSnapshot: d, undo: c, redo: p, canUndo: t.length > 0, canRedo: l.length > 0 };
}, hn = ({
  groupData: t,
  nodes: s,
  edges: l = [],
  onSave: a,
  onExport: d,
  onBack: c,
  isValidated: p,
  enableForce: b = !0,
  onFetchMembers: f,
  icons: m
}) => {
  const [i, v] = C(s), [n, g] = C(l), [u, x] = C(null), [y, D] = C(!1), [G, O] = C(!1), [$, F] = C(null), [ge, X] = C(!1), [ce, B] = C(!1), [be, J] = C(!1), [_, de] = C(null), ve = me(() => ({ group: Zs }), []), K = me(() => ({ base: Qs }), []), { takeSnapshot: R, undo: Z, redo: Q, canUndo: ee, canRedo: te } = un(), [r, j] = C(""), [k, S] = C([]), [V, H] = C(0), M = oe(null), L = oe(null), U = oe(null), W = oe(!0), ye = E(() => {
    const o = Z(i, n);
    o && (v(o.nodes), g(o.edges));
  }, [Z, i, n]), ue = E(() => {
    const o = Q(i, n);
    o && (v(o.nodes), g(o.edges));
  }, [Q, i, n]);
  Y(() => {
    const o = (h) => {
      h.target instanceof HTMLInputElement || h.target instanceof HTMLTextAreaElement || ((h.ctrlKey || h.metaKey) && h.key.toLowerCase() === "z" ? (h.shiftKey ? ue() : ye(), h.preventDefault()) : (h.ctrlKey || h.metaKey) && h.key.toLowerCase() === "y" && (ue(), h.preventDefault()));
    };
    return window.addEventListener("keydown", o), () => window.removeEventListener("keydown", o);
  }, [ye, ue]);
  const et = E((o, h) => {
    const N = new on();
    o.forEach((T) => N.addVertex(T.id)), h.forEach((T) => N.addEdge(T.source, T.target));
    const z = N.findCycles(), A = new Set(z.flat()), I = z.length === 0, je = new Set(h.map((T) => T.target)), xe = o.filter((T) => !je.has(T.id)), se = xe.length === 1;
    let Ne = null;
    I ? o.length > 0 && !se && (Ne = `Graph disconnected: Found ${xe.length} root-like nodes. Ensure all groups are connected.`) : Ne = "Cycles detected in hierarchy.", F(Ne);
    const jt = o.map((T) => {
      const ne = T.id === t.id;
      return {
        ...T,
        deletable: !ne,
        data: {
          ...T.data,
          inCycle: A.has(T.id),
          descendants: I ? N.getDeepChildren(T.id) : [],
          isRootNode: ne
        }
      };
    }), Nt = h.map((T) => {
      const ne = A.has(T.source) && A.has(T.target);
      return {
        ...T,
        animated: ne,
        data: {
          ...T.data,
          inCycle: ne
        }
      };
    });
    v(jt), g(Nt);
  }, [t.id]), tt = E(
    (o) => {
      v((h) => At(o, h));
    },
    []
  ), st = E(
    (o) => {
      g((h) => zt(o, h));
    },
    []
  );
  Y(() => {
    et(i, n);
  }, [
    i.length,
    n.length,
    n.map((o) => o.source + o.target).join(",")
  ]), Y(() => {
    const o = (h) => {
      var N;
      (h.ctrlKey || h.metaKey) && h.key === "f" && (h.preventDefault(), (N = M.current) == null || N.focus());
    };
    return window.addEventListener("keydown", o), () => window.removeEventListener("keydown", o);
  }, []);
  const Re = (o) => {
    if (j(o), !o.trim()) {
      S([]), H(0);
      return;
    }
    const h = i.filter(
      (N) => N.data.name.toLowerCase().includes(o.toLowerCase()) || N.data.description.toLowerCase().includes(o.toLowerCase())
    ).map((N) => N.id);
    S(h), H(0), h.length > 0 && he(h[0]);
  }, he = (o) => {
    if (!_) return;
    const h = _.getNode(o);
    h && (x(o), _.setCenter(
      h.position.x + (h.width || 200) / 2,
      h.position.y + (h.height || 100) / 2,
      { zoom: 1.2, duration: 800 }
    ));
  }, nt = () => {
    if (k.length === 0) return;
    const o = (V + 1) % k.length;
    H(o), he(k[o]);
  }, rt = () => {
    if ($) {
      if ($.includes("Disconnected") || $.includes("disconnected")) {
        const o = new Set(n.map((N) => N.target)), h = i.filter((N) => !o.has(N.id) && N.id !== t.id);
        h.length > 0 && he(h[0].id);
      } else if ($.includes("Cycles") || $.includes("Cycle")) {
        const o = i.find((h) => h.data.inCycle);
        o && he(o.id);
      }
    }
  };
  Y(() => {
    if (u && _) {
      const o = _.getNode(u);
      o && _.setCenter(
        o.position.x + (o.width || 200) / 2,
        o.position.y + (o.height || 100) / 2,
        { zoom: 1.2, duration: 600 }
      );
    }
  }, [u, _]);
  const at = E((o) => {
    if (y) return;
    if (n.some((N) => N.target === o.target)) {
      alert("A group can only have one parent.");
      return;
    }
    R(i, n), g((N) => Tt({
      ...o,
      type: "base",
      markerEnd: { type: fe.ArrowClosed }
    }, N));
  }, [n, y, i, R]), ot = E((o, { nodeId: h }) => {
    U.current = h;
  }, []), lt = E((o) => {
    if (!U.current || y) return;
    if (o.target.classList.contains("react-flow__pane") && _ && L.current) {
      const { top: N, left: z } = L.current.getBoundingClientRect(), A = Ye(), I = _.project({
        x: o.clientX - z,
        y: o.clientY - N
      });
      R(i, n);
      const je = ln(A, I, !1), xe = {
        id: `e-${U.current}-${A}`,
        source: U.current,
        target: A,
        type: "base",
        markerEnd: { type: fe.ArrowClosed }
      };
      v((se) => se.concat(je)), g((se) => se.concat(xe)), x(A);
    }
    U.current = null;
  }, [_, y, i, n, R]), it = E((o, h) => {
    W.current = !1;
  }, []), ct = E((o, h) => {
    W.current = !0, R(i, n), g((N) => $t(o, h, N));
  }, [i, n, R]), dt = E((o, h) => {
    W.current || (R(i, n), g((N) => N.filter((z) => z.id !== h.id))), W.current = !0;
  }, [i, n, R]), ut = E((o, h) => {
    x(h.id);
  }, []), ht = E(() => {
    x(null);
  }, []), Se = (o, h) => {
    R(i, n), v((N) => N.map((z) => z.id === o ? { ...z, data: { ...z.data, ...h } } : z));
  }, xt = E((o) => {
    R(i, n), g((h) => h.filter((N) => N.id !== o));
  }, [i, n, R]), pt = E((o) => {
    o.length > 0 && R(i, n);
  }, [i, n, R]), mt = E((o) => {
    o.length > 0 && R(i, n);
  }, [i, n, R]), ft = E(() => {
    R(i, n);
  }, [i, n, R]), gt = E(() => {
    i.length !== 0 && (R(i, n), v(dn(i, n, t.id)), setTimeout(() => _ == null ? void 0 : _.fitView({ duration: 800 }), 50));
  }, [i, n, t.id, R, _]), Me = E((o) => {
    const h = /* @__PURE__ */ new Map();
    n.forEach((A) => {
      const I = h.get(A.target) || [];
      I.push(A.source), h.set(A.target, I);
    });
    const N = /* @__PURE__ */ new Set(), z = [o];
    for (; z.length; ) {
      const A = z.pop();
      for (const I of h.get(A) || [])
        N.has(I) || (N.add(I), z.push(I));
    }
    return N;
  }, [n]), bt = me(() => {
    if (!u) return [];
    const o = Me(u);
    return i.filter(
      (h) => h.id !== u && h.id !== t.id && !o.has(h.id)
    );
  }, [u, i, t.id, Me]), vt = E((o) => {
    if (!u || o.length === 0) return;
    const h = new Set(o);
    R(i, n), g((N) => {
      const z = N.filter((I) => !h.has(I.target)), A = o.map((I) => ({
        id: `e-${u}-${I}`,
        source: u,
        target: I,
        type: "base",
        markerEnd: { type: fe.ArrowClosed }
      }));
      return [...z, ...A];
    }), J(!1);
  }, [u, i, n, R]), yt = (o, h) => {
    B(!0);
    const N = i.find((A) => A.id === t.id) || i[0], z = {
      ...t,
      id: N.id,
      reason: o,
      message: h,
      nodes: i.map((A) => cn(A, n))
    };
    setTimeout(() => {
      a(z), B(!1), X(!1);
    }, 800);
  }, Ae = i.find((o) => o.id === u) || null, ze = !!$ || !p || ce;
  return /* @__PURE__ */ e.jsx("div", { className: "flex flex-col h-full bg-white text-slate-900 font-sans", children: /* @__PURE__ */ e.jsxs(
    Ks,
    {
      onFetchMembers: f,
      iconMap: m,
      onRemoveEdge: xt,
      onUpdateNode: Se,
      children: [
        /* @__PURE__ */ e.jsxs("header", { className: "h-16 border-b border-slate-200 flex items-center justify-between px-4 bg-white z-20 shadow-sm shrink-0 relative", children: [
          /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-4 flex-1", children: [
            /* @__PURE__ */ e.jsx(
              "button",
              {
                onClick: c,
                className: "p-2 hover:bg-slate-100 rounded-full text-slate-500 transition-colors",
                children: /* @__PURE__ */ e.jsx(ts, { size: 20 })
              }
            ),
            /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col min-w-[120px]", children: [
              /* @__PURE__ */ e.jsx("h1", { className: "text-lg font-bold leading-tight truncate", children: t.name || "Hierachy Editor" }),
              /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 text-xs text-slate-500", children: [
                /* @__PURE__ */ e.jsxs("span", { className: "bg-slate-100 px-1.5 py-0.5 rounded text-slate-600 font-medium", children: [
                  i.length,
                  " Groups"
                ] }),
                /* @__PURE__ */ e.jsx("span", { children: "•" }),
                /* @__PURE__ */ e.jsx("span", { children: t.type })
              ] })
            ] })
          ] }),
          /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 pl-4", children: [
            /* @__PURE__ */ e.jsx(
              "button",
              {
                onClick: ye,
                disabled: !ee,
                className: `p-2 rounded-lg transition-colors ${ee ? "text-slate-600 hover:bg-slate-100" : "text-slate-300 cursor-not-allowed"}`,
                title: "Undo (Ctrl+Z)",
                children: /* @__PURE__ */ e.jsx(Fs, { size: 18 })
              }
            ),
            /* @__PURE__ */ e.jsx(
              "button",
              {
                onClick: ue,
                disabled: !te,
                className: `p-2 mr-2 rounded-lg transition-colors ${te ? "text-slate-600 hover:bg-slate-100" : "text-slate-300 cursor-not-allowed"}`,
                title: "Redo (Ctrl+Y)",
                children: /* @__PURE__ */ e.jsx(zs, { size: 18 })
              }
            ),
            /* @__PURE__ */ e.jsx("div", { className: "h-6 w-px bg-slate-200 mx-1 hidden sm:block" }),
            /* @__PURE__ */ e.jsx(
              "button",
              {
                onClick: gt,
                className: "p-2 text-slate-400 hover:text-slate-600 hover:bg-slate-50 rounded-lg",
                title: "Auto-arrange layout",
                children: /* @__PURE__ */ e.jsx(js, { size: 18 })
              }
            ),
            /* @__PURE__ */ e.jsx(
              "button",
              {
                onClick: () => J(!0),
                disabled: !u || u === t.id,
                className: `p-2 rounded-lg transition-colors ${u && u !== t.id ? "text-slate-400 hover:text-slate-600 hover:bg-slate-50" : "text-slate-300 cursor-not-allowed"}`,
                title: u && u !== t.id ? "Connect matching groups by regex" : "Select a group first to connect matches under it",
                children: /* @__PURE__ */ e.jsx(Be, { size: 18 })
              }
            ),
            /* @__PURE__ */ e.jsx("button", { className: "p-2 text-slate-400 hover:text-slate-600 hover:bg-slate-50 rounded-lg mr-2", title: "Settings", children: /* @__PURE__ */ e.jsx(Is, { size: 18 }) }),
            /* @__PURE__ */ e.jsx("div", { className: "h-6 w-px bg-slate-200 mx-1 hidden sm:block" }),
            /* @__PURE__ */ e.jsx(
              "button",
              {
                onClick: () => alert("Upload clicked"),
                className: "p-2 text-slate-400 hover:text-slate-600 hover:bg-slate-50 rounded-lg",
                children: /* @__PURE__ */ e.jsx(Ws, { size: 18 })
              }
            ),
            /* @__PURE__ */ e.jsx(
              "button",
              {
                onClick: () => d({ id: t.id, nodes: i, edges: n }),
                className: "p-2 text-slate-400 hover:text-slate-600 hover:bg-slate-50 rounded-lg mr-4",
                children: /* @__PURE__ */ e.jsx(fs, { size: 18 })
              }
            ),
            /* @__PURE__ */ e.jsxs(
              "button",
              {
                onClick: () => X(!0),
                disabled: ze,
                className: `
              flex items-center gap-2 px-4 py-2 rounded-lg font-medium text-sm transition-all shadow-sm
              ${ze ? "bg-slate-100 text-slate-400 cursor-not-allowed border border-slate-200" : "bg-teal-700 text-white hover:bg-teal-800"}
            `,
                children: [
                  /* @__PURE__ */ e.jsx($s, { size: 16 }),
                  /* @__PURE__ */ e.jsx("span", { children: "Save" })
                ]
              }
            )
          ] })
        ] }),
        /* @__PURE__ */ e.jsxs("div", { className: "flex-1 flex overflow-hidden", children: [
          /* @__PURE__ */ e.jsxs("div", { className: "flex-1 relative bg-slate-50 transition-all duration-300", ref: L, children: [
            /* @__PURE__ */ e.jsxs("div", { className: "absolute top-4 left-4 right-4 sm:right-auto sm:w-80 z-10 flex flex-col gap-2 pointer-events-none", children: [
              /* @__PURE__ */ e.jsxs("div", { className: "relative w-full group pointer-events-auto shadow-md rounded-lg", children: [
                /* @__PURE__ */ e.jsx("div", { className: "absolute left-3 top-1/2 -translate-y-1/2 text-slate-400 group-focus-within:text-teal-500 transition-colors", children: /* @__PURE__ */ e.jsx(Ee, { size: 16 }) }),
                /* @__PURE__ */ e.jsx(
                  "input",
                  {
                    ref: M,
                    className: "w-full pl-9 pr-12 py-2.5 bg-white/95 backdrop-blur border border-slate-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-teal-500/50 focus:border-teal-500 transition-all",
                    placeholder: "Search groups (Ctrl+F)",
                    value: r,
                    onChange: (o) => Re(o.target.value),
                    onKeyDown: (o) => {
                      o.key === "Enter" && (o.preventDefault(), nt());
                    }
                  }
                ),
                k.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "absolute right-2 top-1/2 -translate-y-1/2 text-xs font-bold text-slate-400 bg-slate-100 px-1.5 py-0.5 rounded", children: [
                  V + 1,
                  "/",
                  k.length
                ] }),
                r && k.length === 0 && /* @__PURE__ */ e.jsx("div", { className: "absolute right-2 top-1/2 -translate-y-1/2 text-slate-300", children: /* @__PURE__ */ e.jsx(q, { size: 14, className: "cursor-pointer hover:text-red-500", onClick: () => Re("") }) })
              ] }),
              $ && /* @__PURE__ */ e.jsxs(
                "div",
                {
                  onClick: rt,
                  className: "pointer-events-auto cursor-pointer flex items-center gap-3 px-4 py-3 bg-red-50/95 backdrop-blur text-red-700 rounded-lg border border-red-200 shadow-md animate-in fade-in slide-in-from-top-4 hover:bg-red-100 transition-colors group",
                  role: "alert",
                  title: "Click to zoom to issue",
                  children: [
                    /* @__PURE__ */ e.jsx("div", { className: "p-2 bg-red-100 rounded-full text-red-600 group-hover:bg-white transition-colors shrink-0", children: /* @__PURE__ */ e.jsx(Je, { size: 16, className: "stroke-[2.5]" }) }),
                    /* @__PURE__ */ e.jsxs("div", { className: "flex-1 min-w-0", children: [
                      /* @__PURE__ */ e.jsx("h4", { className: "text-xs font-bold uppercase tracking-wider text-red-800 mb-0.5", children: "Validation Error" }),
                      /* @__PURE__ */ e.jsx("p", { className: "text-xs font-medium leading-tight", children: $ })
                    ] })
                  ]
                }
              )
            ] }),
            /* @__PURE__ */ e.jsxs(
              Ct,
              {
                nodes: i,
                edges: n,
                onNodesChange: tt,
                onEdgesChange: st,
                onNodesDelete: pt,
                onEdgesDelete: mt,
                onNodeDragStart: ft,
                onConnect: at,
                onConnectStart: ot,
                onConnectEnd: lt,
                onEdgeUpdate: ct,
                onEdgeUpdateStart: it,
                onEdgeUpdateEnd: dt,
                onNodeClick: ut,
                onPaneClick: ht,
                nodeTypes: ve,
                edgeTypes: K,
                onInit: de,
                connectionMode: Pt.Loose,
                fitView: !0,
                snapToGrid: !0,
                snapGrid: [15, 15],
                nodesDraggable: !G,
                nodesConnectable: !y,
                elementsSelectable: !0,
                deleteKeyCode: ["Delete", "Backspace"],
                className: "bg-slate-50",
                proOptions: { hideAttribution: !0 },
                zoomOnScroll: !0,
                panOnScroll: !1,
                children: [
                  /* @__PURE__ */ e.jsx(Dt, { color: "#cbd5e1", gap: 20 }),
                  /* @__PURE__ */ e.jsx(
                    It,
                    {
                      nodeColor: (o) => o.data.isRootNode ? "#0f766e" : "#e2e8f0",
                      maskColor: "rgba(248, 250, 252, 0.6)",
                      className: "!bottom-6 !left-auto !right-6 bg-white border border-slate-200 shadow-lg rounded-lg",
                      style: { width: 120, height: 90 }
                    }
                  ),
                  /* @__PURE__ */ e.jsxs(Gt, { position: "bottom-left", className: "m-4 ml-6 mb-6 flex flex-col gap-1 bg-white p-1 rounded-lg shadow-md border border-slate-200", children: [
                    /* @__PURE__ */ e.jsx("button", { onClick: () => _ == null ? void 0 : _.zoomIn(), className: "p-2 hover:bg-slate-100 rounded text-slate-600", children: /* @__PURE__ */ e.jsx(qe, { size: 18 }) }),
                    /* @__PURE__ */ e.jsx("button", { onClick: () => _ == null ? void 0 : _.zoomOut(), className: "p-2 hover:bg-slate-100 rounded text-slate-600", children: /* @__PURE__ */ e.jsx(Rs, { size: 18 }) }),
                    /* @__PURE__ */ e.jsx("div", { className: "h-px bg-slate-200 my-0.5 mx-2" }),
                    /* @__PURE__ */ e.jsx("button", { onClick: () => _ == null ? void 0 : _.fitView({ duration: 800 }), className: "p-2 hover:bg-slate-100 rounded text-slate-600", children: /* @__PURE__ */ e.jsx(_s, { size: 18 }) })
                  ] })
                ]
              }
            )
          ] }),
          u && /* @__PURE__ */ e.jsx("div", { className: "h-full border-l border-slate-200 bg-white shadow-xl z-20 animate-in slide-in-from-right-10 duration-200", children: /* @__PURE__ */ e.jsx(
            en,
            {
              node: Ae,
              readOnly: y,
              onUpdateNode: Se,
              onClose: () => x(null)
            }
          ) })
        ] }),
        /* @__PURE__ */ e.jsx(
          rn,
          {
            open: ge,
            onClose: () => X(!1),
            onSubmit: yt,
            saving: ce
          }
        ),
        /* @__PURE__ */ e.jsx(
          an,
          {
            open: be,
            parentNode: Ae,
            candidates: bt,
            onClose: () => J(!1),
            onConfirm: vt
          }
        )
      ]
    }
  ) });
}, gn = ({ localKey: t, onFetchMembers: s, icons: l, ...a }) => /* @__PURE__ */ e.jsx(Mt, { children: /* @__PURE__ */ e.jsx(
  hn,
  {
    ...a,
    groupData: a.groupData,
    onFetchMembers: s,
    icons: l
  }
) });
var xn = /* @__PURE__ */ ((t) => (t.EditingLocked = "Editing Locked", t.CanvasLocked = "Canvas Locked", t.TargetHasParent = "A group can only have one parent.", t.AcyclicGraph = "Graph is acyclic", t.CyclicGraph = "Warning: Cycles detected in hierarchy!", t.RootNode = "Root Group", t.SaveSuccess = "Saved Successfully", t.MemberCount = "Members", t.Attributes = "Attributes", t.Description = "Description", t.GroupIcon = "Group Icon", t.GroupName = "Group Name", t))(xn || {});
export {
  on as DiGraph,
  xn as LocalKeys,
  ln as createEmptyNode,
  gn as default,
  cn as groupFromNode,
  dn as layoutNodes,
  fn as transformJsonToGraph
};
//# sourceMappingURL=index.js.map
