import { jsx as f, jsxs as w, Fragment as vr } from "react/jsx-runtime";
import fo, { createContext as hh, useContext as ph, forwardRef as vh, createElement as oo, useState as K, useRef as Pe, useMemo as we, useEffect as he, useCallback as de } from "react";
import T0, { useReactFlow as ho, Handle as Oo, Position as mr, useNodesState as O0, useEdgesState as M0, MarkerType as Mo, addEdge as P0, ConnectionMode as L0, Background as j0, Controls as D0 } from "reactflow";
var oe = /* @__PURE__ */ ((e) => (e.Single = "Single", e.Collection = "Collection", e.Fixed = "Fixed", e))(oe || {}), ve = /* @__PURE__ */ ((e) => (e[e.BottomUp = 0] = "BottomUp", e[e.TopDown = 1] = "TopDown", e))(ve || {}), Ye = /* @__PURE__ */ ((e) => (e.Room = "Room", e.Area = "Area", e.Global = "Global", e))(Ye || {});
const Po = [
  { name: "Standard", color: "slate" },
  { name: "Emergency", color: "red", icon: "AlertTriangle" },
  { name: "VIP", color: "purple", icon: "Crown" },
  { name: "Temporary", color: "amber", icon: "Clock" },
  { name: "Night Shift", color: "indigo", icon: "Moon" },
  { name: "Restricted", color: "orange", icon: "ShieldAlert" },
  { name: "Maintenance", color: "blue", icon: "Wrench" }
], mh = hh({
  groups: [],
  addGroup: () => {
  },
  updateGroup: () => {
  }
}), F0 = ({
  children: e,
  groups: r,
  onAddGroup: t,
  onUpdateGroup: a
}) => /* @__PURE__ */ f(mh.Provider, { value: { groups: r, addGroup: t, updateGroup: a }, children: e }), bh = () => ph(mh);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const G0 = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), z0 = (e) => e.replace(
  /^([A-Z])|[\s-_]+(\w)/g,
  (r, t, a) => a ? a.toUpperCase() : t.toLowerCase()
), Lo = (e) => {
  const r = z0(e);
  return r.charAt(0).toUpperCase() + r.slice(1);
}, gh = (...e) => e.filter((r, t, a) => !!r && r.trim() !== "" && a.indexOf(r) === t).join(" ").trim(), B0 = (e) => {
  for (const r in e)
    if (r.startsWith("aria-") || r === "role" || r === "title")
      return !0;
};
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
var U0 = {
  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.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const $0 = vh(
  ({
    color: e = "currentColor",
    size: r = 24,
    strokeWidth: t = 2,
    absoluteStrokeWidth: a,
    className: n = "",
    children: i,
    iconNode: o,
    ...s
  }, u) => oo(
    "svg",
    {
      ref: u,
      ...U0,
      width: r,
      height: r,
      stroke: e,
      strokeWidth: a ? Number(t) * 24 / Number(r) : t,
      className: gh("lucide", n),
      ...!i && !B0(s) && { "aria-hidden": "true" },
      ...s
    },
    [
      ...o.map(([c, l]) => oo(c, l)),
      ...Array.isArray(i) ? i : [i]
    ]
  )
);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const z = (e, r) => {
  const t = vh(
    ({ className: a, ...n }, i) => oo($0, {
      ref: i,
      iconNode: r,
      className: gh(
        `lucide-${G0(Lo(e))}`,
        `lucide-${e}`,
        a
      ),
      ...n
    })
  );
  return t.displayName = Lo(e), t;
};
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const K0 = [
  ["path", { d: "m12 19-7-7 7-7", key: "1l729n" }],
  ["path", { d: "M19 12H5", key: "x3x0zl" }]
], H0 = z("arrow-left", K0);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const V0 = [
  ["path", { d: "M5 12h14", key: "1ays0h" }],
  ["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
], W0 = z("arrow-right", V0);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Y0 = [
  [
    "path",
    {
      d: "M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",
      key: "hh9hay"
    }
  ],
  ["path", { d: "m3.3 7 8.7 5 8.7-5", key: "g66t2b" }],
  ["path", { d: "M12 22V12", key: "d0xqtd" }]
], rr = z("box", Y0);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const J0 = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], yh = z("check", J0);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Z0 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], X0 = z("chevron-down", Z0);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Q0 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]], ep = z("chevron-right", Q0);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const rp = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]], xh = z("chevron-left", rp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const tp = [
  ["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" }]
], np = z("circle-alert", tp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const ap = [
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
  ["path", { d: "M12 8v8", key: "napkw2" }],
  ["path", { d: "m8 12 4 4 4-4", key: "k98ssh" }]
], _h = z("circle-arrow-down", ap);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const ip = [
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
  ["path", { d: "m16 12-4-4-4 4", key: "177agl" }],
  ["path", { d: "M12 16V8", key: "1sbj14" }]
], wh = z("circle-arrow-up", ip);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const sp = [
  ["path", { d: "M21.801 10A10 10 0 1 1 17 3.335", key: "yps3ct" }],
  ["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }]
], op = z("circle-check-big", sp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const up = [
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
  ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
], cp = z("circle-check", up);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const lp = [
  ["path", { d: "M12 6v6l4 2", key: "mmk7yg" }],
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]
], sr = z("clock", lp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const dp = [
  [
    "path",
    {
      d: "M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",
      key: "1vdc57"
    }
  ],
  ["path", { d: "M5 21h14", key: "11awu3" }]
], Nh = z("crown", dp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const fp = [
  ["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" }]
], hp = z("download", fp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const pp = [
  [
    "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" }]
], po = z("file-text", pp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const vp = [
  [
    "path",
    {
      d: "M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",
      key: "sc7q7i"
    }
  ]
], qh = z("funnel", vp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const mp = [
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
  ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
  ["path", { d: "M2 12h20", key: "9i4pu4" }]
], bp = z("globe", mp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const gp = [
  [
    "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"
    }
  ]
], yp = z("layers", gp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const xp = [
  ["rect", { width: "7", height: "9", x: "3", y: "3", rx: "1", key: "10lvy0" }],
  ["rect", { width: "7", height: "5", x: "14", y: "3", rx: "1", key: "16une8" }],
  ["rect", { width: "7", height: "9", x: "14", y: "12", rx: "1", key: "1hutg5" }],
  ["rect", { width: "7", height: "5", x: "3", y: "16", rx: "1", key: "ldoo1y" }]
], _p = z("layout-dashboard", xp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const wp = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], Np = z("loader-circle", wp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const qp = [
  ["path", { d: "m16 17 5-5-5-5", key: "1bji2h" }],
  ["path", { d: "M21 12H9", key: "dn1m92" }],
  ["path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4", key: "1uf3rs" }]
], Ip = z("log-out", qp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Cp = [
  [
    "path",
    {
      d: "M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",
      key: "1r0f0z"
    }
  ],
  ["circle", { cx: "12", cy: "10", r: "3", key: "ilqhr7" }]
], Rp = z("map-pin", Cp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Sp = [
  [
    "path",
    {
      d: "M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",
      key: "kfwtm"
    }
  ]
], Ih = z("moon", Sp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Ep = [
  ["rect", { x: "16", y: "16", width: "6", height: "6", rx: "1", key: "4q2zg0" }],
  ["rect", { x: "2", y: "16", width: "6", height: "6", rx: "1", key: "8cvhb9" }],
  ["rect", { x: "9", y: "2", width: "6", height: "6", rx: "1", key: "1egb70" }],
  ["path", { d: "M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3", key: "1jsf9p" }],
  ["path", { d: "M12 12V8", key: "2874zd" }]
], kp = z("network", Ep);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Ap = [
  ["path", { d: "M5 12h14", key: "1ays0h" }],
  ["path", { d: "M12 5v14", key: "s699le" }]
], xr = z("plus", Ap);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Tp = [
  ["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" }]
], Op = z("redo-2", Tp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Mp = [
  [
    "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" }]
], Ch = z("save", Mp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Pp = [
  ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
], br = z("search", Pp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Lp = [
  [
    "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" }]
], _r = z("settings", Lp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const jp = [
  ["circle", { cx: "18", cy: "5", r: "3", key: "gq8acd" }],
  ["circle", { cx: "6", cy: "12", r: "3", key: "w7nqdw" }],
  ["circle", { cx: "18", cy: "19", r: "3", key: "1xt0gg" }],
  ["line", { x1: "8.59", x2: "15.42", y1: "13.51", y2: "17.49", key: "47mynk" }],
  ["line", { x1: "15.41", x2: "8.59", y1: "6.51", y2: "10.49", key: "1n3mei" }]
], Rh = z("share-2", jp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Dp = [
  [
    "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"
    }
  ],
  ["path", { d: "M12 8v4", key: "1got3b" }],
  ["path", { d: "M12 16h.01", key: "1drbdi" }]
], Sh = z("shield-alert", Dp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Fp = [
  [
    "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"
    }
  ],
  ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
], Gp = z("shield-check", Fp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const zp = [
  [
    "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"
    }
  ]
], Bp = z("shield", zp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Up = [
  ["line", { x1: "10", x2: "14", y1: "2", y2: "2", key: "14vaq8" }],
  ["line", { x1: "12", x2: "15", y1: "14", y2: "11", key: "17fdiu" }],
  ["circle", { cx: "12", cy: "14", r: "8", key: "1e1u0o" }]
], $p = z("timer", Up);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Kp = [
  ["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" }]
], tr = z("trash-2", Kp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Hp = [
  [
    "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" }]
], or = z("triangle-alert", Hp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Vp = [
  ["path", { d: "M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978", key: "1n3hpd" }],
  ["path", { d: "M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978", key: "rfe1zi" }],
  ["path", { d: "M18 9h1.5a1 1 0 0 0 0-5H18", key: "7xy6bh" }],
  ["path", { d: "M4 22h16", key: "57wxv0" }],
  ["path", { d: "M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z", key: "1mhfuq" }],
  ["path", { d: "M6 9H4.5a1 1 0 0 1 0-5H6", key: "tex48p" }]
], Wp = z("trophy", Vp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Yp = [
  ["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" }]
], Jp = z("undo-2", Yp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Zp = [
  ["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" }]
], Xp = z("upload", Zp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const Qp = [
  [
    "path",
    {
      d: "M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",
      key: "1ngwbx"
    }
  ]
], Eh = z("wrench", Qp);
/**
 * @license lucide-react v0.555.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const ev = [
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
], Te = z("x", ev), kh = {
  slate: { bg: "bg-slate-50", border: "border-slate-100", text: "text-slate-500" },
  red: { bg: "bg-red-50", border: "border-red-100", text: "text-red-700" },
  purple: { bg: "bg-purple-50", border: "border-purple-100", text: "text-purple-700" },
  amber: { bg: "bg-amber-50", border: "border-amber-100", text: "text-amber-700" },
  indigo: { bg: "bg-indigo-50", border: "border-indigo-100", text: "text-indigo-700" },
  orange: { bg: "bg-orange-50", border: "border-orange-100", text: "text-orange-700" },
  blue: { bg: "bg-blue-50", border: "border-blue-100", text: "text-blue-700" },
  emerald: { bg: "bg-emerald-50", border: "border-emerald-100", text: "text-emerald-700" },
  teal: { bg: "bg-teal-50", border: "border-teal-100", text: "text-teal-700" },
  pink: { bg: "bg-pink-50", border: "border-pink-100", text: "text-pink-700" }
}, rv = kh.slate, tv = {
  AlertTriangle: or,
  Crown: Nh,
  Clock: sr,
  Moon: Ih,
  ShieldAlert: Sh,
  Wrench: Eh
}, nv = ({ id: e, data: r, selected: t }) => {
  var b, _;
  const { setNodes: a } = ho(), { groups: n } = bh(), [i, o] = K(!1), [s, u] = K(r.name), c = Pe(null), l = r.isActive, d = we(
    () => n.find((x) => x.name === r.group),
    [n, r.group]
  ), h = (d == null ? void 0 : d.color) && kh[d.color] || rv, p = d != null && d.icon ? tv[d.icon] : void 0;
  he(() => {
    u(r.name);
  }, [r.name]);
  const N = (x) => {
    x == null || x.stopPropagation(), o(!0), u(r.name);
  }, y = () => {
    o(!1), u(r.name);
  }, g = () => {
    s.trim() && s !== r.name && a((x) => x.map((q) => q.id === e ? { ...q, data: { ...q.data, name: s } } : q)), o(!1);
  }, m = (x) => {
    x.key === "Enter" && (x.preventDefault(), x.stopPropagation(), g()), x.key === "Escape" && (x.preventDefault(), x.stopPropagation(), y());
  };
  he(() => {
    i && c.current && (c.current.focus(), c.current.select());
  }, [i]), he(() => {
    if (!t) return;
    const x = (q) => {
      (q.ctrlKey || q.metaKey) && q.key === "r" && (q.preventDefault(), N());
    };
    return window.addEventListener("keydown", x), () => window.removeEventListener("keydown", x);
  }, [t]);
  const v = we(() => {
    const x = r._inheritedResources || [], q = r.resources, C = /* @__PURE__ */ new Map();
    return q.forEach((R) => {
      C.set(R.resourceId, r.priority);
    }), x.forEach((R) => {
      const I = C.get(R.resourceId);
      (I === void 0 || R.sourceNodePriority > I) && C.set(R.resourceId, R.sourceNodePriority);
    }), C.size;
  }, [r.resources, r._inheritedResources, r.priority]);
  return /* @__PURE__ */ w(
    "div",
    {
      className: `relative w-[280px] shadow-sm rounded-xl border-2 transition-all duration-200 bg-white
      ${t ? "border-teal-500 ring-2 ring-teal-100" : "border-slate-200"}
      ${l ? "" : "opacity-70 grayscale"}
      `,
      children: [
        /* @__PURE__ */ f(Oo, { type: "target", position: mr.Top, className: "!bg-slate-400 !w-3 !h-3" }),
        /* @__PURE__ */ w("div", { className: `px-4 py-2 rounded-t-xl flex items-center justify-between border-b ${h.bg} ${h.border}`, children: [
          /* @__PURE__ */ w("span", { className: `text-xs font-bold uppercase tracking-wider flex items-center gap-1 ${h.text}`, children: [
            p && /* @__PURE__ */ f(p, { size: 12 }),
            r.group
          ] }),
          /* @__PURE__ */ w("div", { className: "flex gap-2 items-center", children: [
            r.direction === ve.BottomUp && /* @__PURE__ */ f("span", { title: "Inherits from Parents", className: "flex items-center", children: /* @__PURE__ */ f(wh, { size: 14, className: "text-slate-400" }) }),
            r.direction === ve.TopDown && /* @__PURE__ */ f("span", { title: "Inherits from Children", className: "flex items-center", children: /* @__PURE__ */ f(_h, { size: 14, className: "text-slate-400" }) }),
            /* @__PURE__ */ w("span", { className: "text-xs bg-white border border-slate-200 px-2 py-0.5 rounded-full text-slate-600 font-mono", children: [
              "P",
              r.priority
            ] })
          ] })
        ] }),
        /* @__PURE__ */ w("div", { className: "p-4", children: [
          i ? /* @__PURE__ */ f("div", { className: "mb-3", children: /* @__PURE__ */ f(
            "input",
            {
              ref: c,
              type: "text",
              value: s,
              onChange: (x) => u(x.target.value),
              onKeyDown: m,
              onBlur: g,
              className: "w-full text-sm font-semibold text-slate-800 border-2 border-teal-500 rounded p-1 focus:outline-none",
              onClick: (x) => x.stopPropagation()
            }
          ) }) : /* @__PURE__ */ w(
            "div",
            {
              className: "font-semibold text-slate-800 text-sm mb-3 truncate flex items-center gap-2 cursor-text hover:bg-slate-50 rounded -ml-1 pl-1 py-0.5",
              title: `${r.name} (Double-click to edit)`,
              onDoubleClick: N,
              children: [
                /* @__PURE__ */ f(Bp, { size: 16, className: "text-teal-600 flex-shrink-0" }),
                r.name
              ]
            }
          ),
          /* @__PURE__ */ w("div", { className: "space-y-2", children: [
            /* @__PURE__ */ w("div", { className: "flex items-center text-xs text-slate-600 gap-2", children: [
              /* @__PURE__ */ f(sr, { size: 14, className: "text-slate-400" }),
              /* @__PURE__ */ f("span", { className: "bg-slate-100 px-1.5 py-0.5 rounded text-slate-700 font-mono", children: r.time })
            ] }),
            /* @__PURE__ */ w("div", { className: "flex items-center text-xs text-slate-600 gap-2", title: "Purpose", children: [
              /* @__PURE__ */ f(po, { size: 14, className: "text-slate-400" }),
              /* @__PURE__ */ f("span", { className: "truncate max-w-[180px]", children: r.purpose })
            ] }),
            /* @__PURE__ */ w("div", { className: "flex items-center justify-between pt-2 border-t border-slate-100 mt-2", children: [
              /* @__PURE__ */ w("div", { className: "flex items-center text-xs text-slate-500 gap-1.5", title: "Effective Resources (After Priority Resolution)", children: [
                /* @__PURE__ */ f(rr, { size: 14, className: "text-teal-600" }),
                /* @__PURE__ */ f("span", { className: "font-bold text-slate-700 font-mono", children: v }),
                /* @__PURE__ */ f("span", { className: "text-[10px] text-slate-400 font-normal", children: "effective" })
              ] }),
              ((_ = (b = r.configuration) == null ? void 0 : b.workflow) == null ? void 0 : _.type) && /* @__PURE__ */ w("div", { className: "flex items-center text-xs text-slate-400 gap-1", title: "Workflow Type", children: [
                /* @__PURE__ */ f(yp, { size: 14 }),
                /* @__PURE__ */ w("span", { children: [
                  "Type ",
                  r.configuration.workflow.type
                ] })
              ] })
            ] })
          ] })
        ] }),
        /* @__PURE__ */ f(Oo, { type: "source", position: mr.Bottom, className: "!bg-slate-400 !w-3 !h-3" })
      ]
    }
  );
}, av = fo.memo(nv), Ah = hh(null), Yg = ({
  children: e,
  repositories: r
}) => /* @__PURE__ */ f(Ah.Provider, { value: r, children: e }), iv = () => {
  const e = ph(Ah);
  if (!e)
    throw new Error("useRepositories must be used within RepositoryProvider");
  return e;
}, uo = ({ tags: e, onChange: r, placeholder: t = "Add tag...", colorClass: a = "bg-slate-100 text-slate-700 border-slate-200", id: n }) => {
  const [i, o] = K(""), s = (c) => {
    c.key === "Enter" && i.trim() && (c.preventDefault(), e.includes(i.trim()) || r([...e, i.trim()]), o(""));
  }, u = (c) => {
    r(e.filter((l) => l !== c));
  };
  return /* @__PURE__ */ w("div", { className: "space-y-2", children: [
    /* @__PURE__ */ f("div", { className: "flex flex-wrap gap-2 mb-2", children: e.map((c) => /* @__PURE__ */ w(
      "span",
      {
        className: `inline-flex items-center px-2 py-1 rounded text-xs font-medium border ${a}`,
        children: [
          c,
          /* @__PURE__ */ f(
            "button",
            {
              onClick: () => u(c),
              className: "ml-1.5 p-0.5 hover:bg-black/10 rounded-full transition-colors",
              children: /* @__PURE__ */ f(Te, { size: 10 })
            }
          )
        ]
      },
      c
    )) }),
    /* @__PURE__ */ w("div", { className: "relative", children: [
      /* @__PURE__ */ f(
        "input",
        {
          id: n,
          type: "text",
          value: i,
          onChange: (c) => o(c.target.value),
          onKeyDown: s,
          placeholder: t,
          className: "w-full pl-3 pr-8 py-2 bg-white text-slate-900 border border-slate-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-teal-500/20 focus:border-teal-500 transition-all placeholder:text-slate-400"
        }
      ),
      /* @__PURE__ */ f(
        "button",
        {
          onClick: () => {
            i.trim() && (e.includes(i.trim()) || r([...e, i.trim()]), o(""));
          },
          className: "absolute right-2 top-1/2 -translate-y-1/2 text-slate-400 hover:text-teal-600",
          children: /* @__PURE__ */ f(xr, { size: 16 })
        }
      )
    ] })
  ] });
};
function co({
  items: e,
  height: r,
  itemHeight: t,
  renderItem: a,
  className: n = "",
  overscan: i = 5
}) {
  const [o, s] = K(0), u = Pe(null), c = e.length * t, { startIndex: l, endIndex: d } = we(() => {
    var v;
    let y = 0;
    typeof r == "number" ? y = r : y = ((v = u.current) == null ? void 0 : v.clientHeight) || 500;
    const g = Math.floor(o / t), m = Math.ceil((o + y) / t);
    return {
      startIndex: Math.max(0, g - i),
      endIndex: Math.min(e.length, m + i)
    };
  }, [o, e.length, t, r, i]), h = e.slice(l, d), p = l * t, N = (y) => {
    s(y.currentTarget.scrollTop);
  };
  return he(() => {
    const y = () => {
      u.current;
    };
    return window.addEventListener("resize", y), () => window.removeEventListener("resize", y);
  }, []), /* @__PURE__ */ f(
    "div",
    {
      ref: u,
      className: `overflow-y-auto relative ${n}`,
      style: { height: r },
      onScroll: N,
      children: /* @__PURE__ */ f("div", { style: { height: c, position: "relative" }, children: /* @__PURE__ */ f(
        "div",
        {
          style: {
            position: "absolute",
            top: 0,
            left: 0,
            width: "100%",
            transform: `translateY(${p}px)`
          },
          children: h.map((y, g) => a(y, l + g))
        }
      ) })
    }
  );
}
const jo = (e) => e.isOpen ? /* @__PURE__ */ f(sv, { ...e }) : null, sv = ({
  onClose: e,
  onSelect: r,
  schedules: t,
  title: a = "Select Schedule",
  excludeId: n
}) => {
  const [i, o] = K(""), s = we(() => {
    const u = i.toLowerCase();
    return t.filter((c) => !n || c.scheduleId !== n).filter(
      (c) => c.name.toLowerCase().includes(u) || c.scheduleId.toLowerCase().includes(u) || c.group.toLowerCase().includes(u)
    );
  }, [t, i, n]);
  return /* @__PURE__ */ f("div", { className: "fixed inset-0 z-[100] flex items-center justify-center bg-slate-900/50 backdrop-blur-sm p-4 animate-in fade-in duration-200", children: /* @__PURE__ */ w("div", { className: "bg-white rounded-xl shadow-2xl w-full max-w-2xl h-[70vh] flex flex-col overflow-hidden border border-slate-200", children: [
    /* @__PURE__ */ w("div", { className: "px-6 py-4 border-b border-slate-100 flex items-center justify-between bg-slate-50", children: [
      /* @__PURE__ */ f("h2", { className: "text-lg font-bold text-slate-900", children: a }),
      /* @__PURE__ */ f("button", { onClick: e, className: "p-2 hover:bg-slate-200 rounded-full text-slate-400 transition-colors", children: /* @__PURE__ */ f(Te, { size: 20 }) })
    ] }),
    /* @__PURE__ */ w("div", { className: "p-4 border-b border-slate-100 flex gap-4 bg-white flex-shrink-0", children: [
      /* @__PURE__ */ w("div", { className: "relative flex-1", children: [
        /* @__PURE__ */ f(br, { className: "absolute left-3 top-1/2 -translate-y-1/2 text-slate-400", size: 18 }),
        /* @__PURE__ */ f(
          "input",
          {
            type: "text",
            placeholder: "Search by name, ID or group...",
            className: "w-full pl-10 pr-4 py-2 bg-white text-slate-900 border border-slate-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-teal-500/20 focus:border-teal-500 transition-all placeholder:text-slate-400",
            value: i,
            onChange: (u) => o(u.target.value)
          }
        )
      ] }),
      /* @__PURE__ */ w("div", { className: "flex items-center gap-2 px-3 py-2 bg-slate-50 rounded-lg border border-slate-200 text-slate-600 text-sm", children: [
        /* @__PURE__ */ f(qh, { size: 16 }),
        /* @__PURE__ */ f("span", { className: "font-medium", children: s.length })
      ] })
    ] }),
    /* @__PURE__ */ f("div", { className: "flex-1 overflow-hidden bg-slate-50 p-2 relative", children: s.length === 0 ? /* @__PURE__ */ f("div", { className: "p-8 text-center text-slate-400", children: "No schedules found." }) : /* @__PURE__ */ f(
      co,
      {
        items: s,
        height: "100%",
        itemHeight: 64,
        renderItem: (u) => /* @__PURE__ */ f("div", { className: "pb-1", children: /* @__PURE__ */ w(
          "button",
          {
            onClick: () => {
              r(u.scheduleId), e();
            },
            className: "w-full text-left p-3 rounded-lg border border-transparent hover:border-teal-200 hover:bg-teal-50 hover:shadow-sm bg-white transition-all group flex items-center justify-between h-[60px]",
            children: [
              /* @__PURE__ */ w("div", { children: [
                /* @__PURE__ */ f("div", { className: "font-semibold text-slate-800 text-sm truncate", children: u.name }),
                /* @__PURE__ */ w("div", { className: "flex items-center gap-2 mt-1", children: [
                  /* @__PURE__ */ f("span", { className: "text-[10px] bg-slate-100 text-slate-500 px-1.5 py-0.5 rounded border border-slate-200 uppercase font-bold", children: u.group }),
                  /* @__PURE__ */ f("span", { className: "text-[10px] font-mono text-slate-400 truncate max-w-[150px]", children: u.scheduleId })
                ] })
              ] }),
              /* @__PURE__ */ f("div", { className: "opacity-0 group-hover:opacity-100 text-teal-600 transition-opacity", children: /* @__PURE__ */ f(yh, { size: 18 }) })
            ]
          }
        ) }, u.scheduleId)
      }
    ) })
  ] }) });
}, ov = ["slate", "red", "purple", "amber", "indigo", "orange", "blue", "emerald", "teal", "pink"], uv = [
  { name: "", label: "None" },
  { name: "AlertTriangle", label: "Alert" },
  { name: "Crown", label: "Crown" },
  { name: "Clock", label: "Clock" },
  { name: "Moon", label: "Moon" },
  { name: "ShieldAlert", label: "Shield" },
  { name: "Wrench", label: "Wrench" }
], zr = {
  slate: "bg-slate-400",
  red: "bg-red-500",
  purple: "bg-purple-500",
  amber: "bg-amber-500",
  indigo: "bg-indigo-500",
  orange: "bg-orange-500",
  blue: "bg-blue-500",
  emerald: "bg-emerald-500",
  teal: "bg-teal-500",
  pink: "bg-pink-500"
}, Do = {
  AlertTriangle: or,
  Crown: Nh,
  Clock: sr,
  Moon: Ih,
  ShieldAlert: Sh,
  Wrench: Eh
}, cv = ({ node: e, handleUpdate: r, allNodes: t, getScheduleName: a }) => {
  const [n, i] = K(!1), [o, s] = K(!1), { groups: u, addGroup: c, updateGroup: l } = bh(), [d, h] = K(!1), [p, N] = K(""), y = Pe(null), [g, m] = K(null);
  he(() => {
    const I = (S) => {
      y.current && !y.current.contains(S.target) && h(!1);
    };
    return document.addEventListener("mousedown", I), () => document.removeEventListener("mousedown", I);
  }, []);
  const v = we(
    () => u.filter((I) => I.name.toLowerCase().includes(p.toLowerCase())),
    [u, p]
  ), b = (I) => {
    r("group", I), N(""), h(!1);
  }, _ = (I) => {
    N(I), r("group", I), d || h(!0);
  }, x = () => {
    e.group && !u.some((I) => I.name === e.group) && c(e.group);
  }, q = (I) => {
    I ? r("followUp", "") : r("followUp", null);
  }, C = (I, S) => {
    !e.phaseOut && S ? r("phaseOut", { scheduleId: S, duration: "30d" }) : e.phaseOut && r("phaseOut", { ...e.phaseOut, [I]: S });
  }, R = (I) => {
    I ? r("phaseOut", { scheduleId: "", duration: "30d" }) : r("phaseOut", null);
  };
  return /* @__PURE__ */ w("div", { className: "space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-300", children: [
    /* @__PURE__ */ w("div", { className: "flex items-center justify-between bg-slate-50 p-3 rounded-lg border border-slate-200", children: [
      /* @__PURE__ */ w("div", { className: "flex items-center gap-3", children: [
        /* @__PURE__ */ f("div", { className: `p-2 rounded-full ${e.isActive ? "bg-emerald-100 text-emerald-600" : "bg-slate-200 text-slate-500"}`, children: e.isActive ? /* @__PURE__ */ f(op, { size: 20 }) : /* @__PURE__ */ f(or, { size: 20 }) }),
        /* @__PURE__ */ w("div", { children: [
          /* @__PURE__ */ f("div", { className: "font-semibold text-sm text-slate-900", children: "Schedule Status" }),
          /* @__PURE__ */ f("div", { className: "text-xs text-slate-500", children: e.isActive ? "Active & Enforced" : "Inactive & Ignored" })
        ] })
      ] }),
      /* @__PURE__ */ w("label", { "aria-label": "Toggle schedule status", className: "relative inline-flex items-center cursor-pointer", children: [
        /* @__PURE__ */ f("input", { type: "checkbox", className: "sr-only peer", checked: e.isActive, onChange: (I) => r("isActive", I.target.checked) }),
        /* @__PURE__ */ f("div", { className: "w-11 h-6 bg-slate-200 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-teal-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-teal-600" })
      ] })
    ] }),
    /* @__PURE__ */ w("div", { className: "space-y-4", children: [
      /* @__PURE__ */ f("h3", { className: "text-xs font-bold text-slate-900 uppercase tracking-wider border-b border-slate-100 pb-2", children: "Basic Information" }),
      /* @__PURE__ */ w("div", { children: [
        /* @__PURE__ */ f("label", { htmlFor: "gen-name", className: "text-xs font-semibold text-slate-500 mb-1 block", children: "Name" }),
        /* @__PURE__ */ f(
          "input",
          {
            id: "gen-name",
            type: "text",
            value: e.name,
            onChange: (I) => r("name", I.target.value),
            className: "w-full p-2 bg-white text-slate-900 border border-slate-300 rounded-lg text-sm focus:outline-none focus:border-teal-500 focus:ring-2 focus:ring-teal-500/20 transition-all"
          }
        )
      ] }),
      /* @__PURE__ */ w("div", { className: "grid grid-cols-2 gap-4", children: [
        /* @__PURE__ */ w("div", { ref: y, className: "relative", children: [
          /* @__PURE__ */ f("label", { htmlFor: "gen-group", className: "text-xs font-semibold text-slate-500 mb-1 block", children: "Group" }),
          /* @__PURE__ */ w("div", { className: "relative", children: [
            /* @__PURE__ */ f(
              "input",
              {
                id: "gen-group",
                type: "text",
                value: d && p || e.group,
                onChange: (I) => _(I.target.value),
                onFocus: () => {
                  h(!0), N("");
                },
                onBlur: x,
                className: "w-full p-2 pr-8 bg-white text-slate-900 border border-slate-300 rounded-lg text-sm focus:outline-none focus:border-teal-500",
                placeholder: "Select or type..."
              }
            ),
            /* @__PURE__ */ f(
              "button",
              {
                type: "button",
                tabIndex: -1,
                onClick: () => h(!d),
                className: "absolute right-2 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600",
                children: /* @__PURE__ */ f(X0, { size: 14 })
              }
            )
          ] }),
          d && /* @__PURE__ */ w("div", { className: "absolute z-50 mt-1 w-full bg-white border border-slate-200 rounded-lg shadow-lg max-h-48 overflow-y-auto", children: [
            v.map((I) => {
              const S = I.icon ? Do[I.icon] : void 0, A = zr[I.color || "slate"] || zr.slate;
              return /* @__PURE__ */ w(
                "div",
                {
                  className: `flex items-center hover:bg-slate-50 transition-colors ${e.group === I.name ? "bg-teal-50 text-teal-700" : "text-slate-700"}`,
                  children: [
                    /* @__PURE__ */ w(
                      "button",
                      {
                        type: "button",
                        onMouseDown: (M) => {
                          M.preventDefault(), b(I.name);
                        },
                        className: "flex-1 flex items-center gap-2 px-3 py-2 text-sm text-left",
                        children: [
                          /* @__PURE__ */ f("span", { className: `w-2.5 h-2.5 rounded-full flex-shrink-0 ${A}` }),
                          S && /* @__PURE__ */ f(S, { size: 13, className: "text-slate-400 flex-shrink-0" }),
                          /* @__PURE__ */ f("span", { children: I.name })
                        ]
                      }
                    ),
                    /* @__PURE__ */ f(
                      "button",
                      {
                        type: "button",
                        onMouseDown: (M) => {
                          M.preventDefault(), M.stopPropagation(), m(I.name), h(!1);
                        },
                        className: "px-2 py-2 text-slate-300 hover:text-slate-600 transition-colors",
                        title: `Edit ${I.name} group`,
                        children: /* @__PURE__ */ f(_r, { size: 12 })
                      }
                    )
                  ]
                },
                I.name
              );
            }),
            v.length === 0 && p && /* @__PURE__ */ w("div", { className: "px-3 py-2 text-xs text-slate-400 italic", children: [
              'Press Tab to add "',
              p,
              '" as custom group'
            ] })
          ] })
        ] }),
        /* @__PURE__ */ w("div", { children: [
          /* @__PURE__ */ f("label", { htmlFor: "gen-purpose", className: "text-xs font-semibold text-slate-500 mb-1 block", children: "Purpose" }),
          /* @__PURE__ */ f(
            "input",
            {
              id: "gen-purpose",
              type: "text",
              value: e.purpose,
              onChange: (I) => r("purpose", I.target.value),
              className: "w-full p-2 bg-white text-slate-900 border border-slate-300 rounded-lg text-sm focus:outline-none focus:border-teal-500"
            }
          )
        ] })
      ] }),
      /* @__PURE__ */ w("div", { children: [
        /* @__PURE__ */ w("label", { htmlFor: "gen-tags", className: "text-xs font-semibold text-slate-500 mb-1 block", children: [
          "Tags ",
          /* @__PURE__ */ f("span", { className: "text-[10px] font-normal text-slate-400 opacity-80", children: "(Search)" })
        ] }),
        /* @__PURE__ */ f(
          uo,
          {
            id: "gen-tags",
            tags: e.tags || [],
            onChange: (I) => r("tags", I)
          }
        )
      ] }),
      /* @__PURE__ */ w("div", { children: [
        /* @__PURE__ */ w("label", { htmlFor: "gen-attributes", className: "text-xs font-semibold text-slate-500 mb-1 block", children: [
          "Attributes ",
          /* @__PURE__ */ f("span", { className: "text-[10px] font-normal text-slate-400 opacity-80", children: "(Workflow Logic)" })
        ] }),
        /* @__PURE__ */ f(
          uo,
          {
            id: "gen-attributes",
            tags: e.attributes || [],
            onChange: (I) => r("attributes", I),
            placeholder: "Add attribute...",
            colorClass: "bg-indigo-50 text-indigo-700 border-indigo-200"
          }
        )
      ] })
    ] }),
    /* @__PURE__ */ w("div", { className: "space-y-4", children: [
      /* @__PURE__ */ f("h3", { className: "text-xs font-bold text-slate-900 uppercase tracking-wider border-b border-slate-100 pb-2", children: "Lifecycle" }),
      /* @__PURE__ */ w("div", { className: `p-3 border rounded-lg transition-colors ${e.followUp !== null ? "bg-indigo-50 border-indigo-200" : "bg-slate-50 border-slate-200"}`, children: [
        /* @__PURE__ */ w("div", { className: "flex items-center justify-between mb-2", children: [
          /* @__PURE__ */ w("div", { className: "flex items-center gap-3", children: [
            /* @__PURE__ */ f(Rh, { size: 16, className: e.followUp !== null ? "text-indigo-500" : "text-slate-400" }),
            /* @__PURE__ */ f("div", { children: /* @__PURE__ */ f("div", { className: "text-sm font-medium text-slate-900", children: "Follow Up Schedule" }) })
          ] }),
          /* @__PURE__ */ w("label", { "aria-label": "Toggle follow up schedule", className: "relative inline-flex items-center cursor-pointer", children: [
            /* @__PURE__ */ f(
              "input",
              {
                type: "checkbox",
                className: "sr-only peer",
                checked: e.followUp !== null,
                onChange: (I) => q(I.target.checked)
              }
            ),
            /* @__PURE__ */ f("div", { className: "w-9 h-5 bg-slate-200 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-indigo-500" })
          ] })
        ] }),
        e.followUp !== null && /* @__PURE__ */ f("div", { className: "mt-3 space-y-3 pl-2 border-l-2 border-indigo-200", children: /* @__PURE__ */ w("div", { children: [
          /* @__PURE__ */ f("span", { className: "text-xs text-slate-500 mb-1 block", children: "Target Schedule" }),
          /* @__PURE__ */ w("div", { className: "flex gap-2", children: [
            /* @__PURE__ */ f("div", { className: "flex-1 text-sm p-2 bg-white border border-indigo-200 rounded text-slate-700 flex items-center justify-between", children: /* @__PURE__ */ f("span", { className: e.followUp ? "" : "text-slate-400 italic", children: e.followUp ? a(e.followUp) : "None configured" }) }),
            /* @__PURE__ */ f(
              "button",
              {
                onClick: () => i(!0),
                className: "px-3 py-1 bg-white border border-indigo-200 text-indigo-700 text-xs rounded hover:bg-indigo-100 transition-colors",
                children: "Select"
              }
            ),
            e.followUp && /* @__PURE__ */ f(
              "button",
              {
                onClick: () => r("followUp", ""),
                className: "p-2 bg-white border border-indigo-200 text-indigo-700 rounded hover:bg-red-50 hover:text-red-600 hover:border-red-200 transition-colors",
                title: "Remove Follow Up",
                children: /* @__PURE__ */ f(tr, { size: 14 })
              }
            )
          ] })
        ] }) })
      ] }),
      /* @__PURE__ */ w("div", { className: `p-3 border rounded-lg transition-colors ${e.phaseOut ? "bg-amber-50 border-amber-200" : "bg-slate-50 border-slate-200"}`, children: [
        /* @__PURE__ */ w("div", { className: "flex items-center justify-between mb-2", children: [
          /* @__PURE__ */ w("div", { className: "flex items-center gap-3", children: [
            /* @__PURE__ */ f($p, { size: 16, className: e.phaseOut ? "text-amber-500" : "text-slate-400" }),
            /* @__PURE__ */ f("div", { children: /* @__PURE__ */ f("div", { className: "text-sm font-medium text-slate-900", children: "Phase Out Logic" }) })
          ] }),
          /* @__PURE__ */ w("label", { "aria-label": "Toggle phase out logic", className: "relative inline-flex items-center cursor-pointer", children: [
            /* @__PURE__ */ f(
              "input",
              {
                type: "checkbox",
                className: "sr-only peer",
                checked: !!e.phaseOut,
                onChange: (I) => R(I.target.checked)
              }
            ),
            /* @__PURE__ */ f("div", { className: "w-9 h-5 bg-slate-200 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-amber-500" })
          ] })
        ] }),
        e.phaseOut && /* @__PURE__ */ w("div", { className: "mt-3 space-y-3 pl-2 border-l-2 border-amber-200", children: [
          /* @__PURE__ */ w("div", { children: [
            /* @__PURE__ */ f("span", { className: "text-xs text-slate-500 mb-1 block", children: "Replacement Schedule" }),
            /* @__PURE__ */ w("div", { className: "flex gap-2", children: [
              /* @__PURE__ */ f("div", { className: "flex-1 text-sm p-2 bg-white border border-amber-200 rounded text-slate-700 flex items-center justify-between", children: /* @__PURE__ */ f("span", { className: e.phaseOut.scheduleId ? "" : "text-slate-400 italic", children: a(e.phaseOut.scheduleId) || "None configured" }) }),
              /* @__PURE__ */ f(
                "button",
                {
                  onClick: () => s(!0),
                  className: "px-3 py-1 bg-white border border-amber-200 text-amber-700 text-xs rounded hover:bg-amber-100 transition-colors",
                  children: "Select"
                }
              ),
              e.phaseOut.scheduleId && /* @__PURE__ */ f(
                "button",
                {
                  onClick: () => C("scheduleId", ""),
                  className: "p-2 bg-white border border-amber-200 text-amber-700 rounded hover:bg-red-50 hover:text-red-600 hover:border-red-200 transition-colors",
                  title: "Remove Replacement",
                  children: /* @__PURE__ */ f(tr, { size: 14 })
                }
              )
            ] })
          ] }),
          /* @__PURE__ */ w("div", { children: [
            /* @__PURE__ */ f("label", { htmlFor: "gen-phaseout-duration", className: "text-xs text-slate-500 mb-1 block", children: "Duration" }),
            /* @__PURE__ */ f(
              "input",
              {
                id: "gen-phaseout-duration",
                type: "text",
                value: e.phaseOut.duration,
                onChange: (I) => C("duration", I.target.value),
                className: "w-full p-2 bg-white text-slate-900 border border-amber-200 rounded text-sm focus:outline-none focus:border-amber-400"
              }
            )
          ] })
        ] })
      ] })
    ] }),
    /* @__PURE__ */ f(
      jo,
      {
        isOpen: n,
        onClose: () => i(!1),
        schedules: t,
        onSelect: (I) => r("followUp", I),
        title: "Select Follow Up Schedule",
        excludeId: e.scheduleId
      }
    ),
    /* @__PURE__ */ f(
      jo,
      {
        isOpen: o,
        onClose: () => s(!1),
        schedules: t,
        onSelect: (I) => C("scheduleId", I),
        title: "Select Replacement Schedule",
        excludeId: e.scheduleId
      }
    ),
    g && (() => {
      const I = u.find((S) => S.name === g);
      return I ? /* @__PURE__ */ f("div", { role: "presentation", className: "fixed inset-0 z-[100] flex items-center justify-center bg-black/30", onMouseDown: () => m(null), children: /* @__PURE__ */ w("div", { role: "dialog", "aria-label": `Edit Group: ${I.name}`, className: "bg-white rounded-xl shadow-xl w-80 p-5", onMouseDown: (S) => S.stopPropagation(), children: [
        /* @__PURE__ */ w("div", { className: "flex items-center justify-between mb-4", children: [
          /* @__PURE__ */ w("h3", { className: "text-sm font-bold text-slate-900", children: [
            "Edit Group: ",
            I.name
          ] }),
          /* @__PURE__ */ f("button", { onClick: () => m(null), className: "text-slate-400 hover:text-slate-600", children: /* @__PURE__ */ f(Te, { size: 16 }) })
        ] }),
        /* @__PURE__ */ w("div", { className: "space-y-4", children: [
          /* @__PURE__ */ w("div", { children: [
            /* @__PURE__ */ f("span", { className: "text-xs font-semibold text-slate-500 mb-2 block", children: "Color" }),
            /* @__PURE__ */ f("div", { className: "flex flex-wrap gap-2", children: ov.map((S) => /* @__PURE__ */ f(
              "button",
              {
                type: "button",
                onClick: () => l(I.name, { color: S }),
                className: `w-7 h-7 rounded-full border-2 transition-all ${zr[S]} ${(I.color || "slate") === S ? "border-slate-800 scale-110" : "border-transparent hover:border-slate-300"}`,
                title: S
              },
              S
            )) })
          ] }),
          /* @__PURE__ */ w("div", { children: [
            /* @__PURE__ */ f("span", { className: "text-xs font-semibold text-slate-500 mb-2 block", children: "Icon" }),
            /* @__PURE__ */ f("div", { className: "flex flex-wrap gap-1.5", children: uv.map((S) => {
              const A = S.name ? Do[S.name] : void 0, M = (I.icon || "") === S.name;
              return /* @__PURE__ */ w(
                "button",
                {
                  type: "button",
                  onClick: () => l(I.name, { icon: S.name || void 0 }),
                  className: `flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg border text-xs transition-all ${M ? "border-teal-500 bg-teal-50 text-teal-700" : "border-slate-200 text-slate-600 hover:border-slate-300"}`,
                  children: [
                    A ? /* @__PURE__ */ f(A, { size: 13 }) : /* @__PURE__ */ f("span", { className: "text-slate-400", children: "--" }),
                    /* @__PURE__ */ f("span", { children: S.label })
                  ]
                },
                S.name
              );
            }) })
          ] })
        ] }),
        /* @__PURE__ */ f(
          "button",
          {
            onClick: () => m(null),
            className: "mt-4 w-full py-2 bg-teal-600 hover:bg-teal-700 text-white text-sm font-medium rounded-lg transition-colors",
            children: "Done"
          }
        )
      ] }) }) : null;
    })()
  ] });
}, lv = ({ node: e, handleUpdate: r, availableLocations: t, availableApprovalGroups: a }) => {
  const n = (u) => {
    const [c, l] = u.split("|");
    c && l && r("locationGroup", { groupId: c, nodeId: l });
  }, i = () => {
    const u = a[0], c = {
      groupId: u ? u.groupId : "",
      nodeId: u ? u.id : "",
      type: Ye.Room
    };
    r("approvalGroups", [...e.approvalGroups || [], c]);
  }, o = (u) => {
    const c = (e.approvalGroups || []).filter((l, d) => d !== u);
    r("approvalGroups", c);
  }, s = (u, c, l) => {
    const d = [...e.approvalGroups || []];
    if (c === "combined") {
      const [h, p] = l.split("|");
      d[u] = { ...d[u], groupId: h, nodeId: p };
    } else
      d[u] = { ...d[u], [c]: l };
    r("approvalGroups", d);
  };
  return /* @__PURE__ */ w("div", { className: "space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-300", children: [
    /* @__PURE__ */ w("div", { children: [
      /* @__PURE__ */ f("h3", { className: "text-xs font-bold text-slate-900 uppercase tracking-wider border-b border-slate-100 pb-2 mb-4", children: "Evaluation Logic" }),
      /* @__PURE__ */ w("div", { className: "flex items-center justify-between p-4 bg-white border border-slate-200 rounded-xl shadow-sm", children: [
        /* @__PURE__ */ w("div", { children: [
          /* @__PURE__ */ f("div", { className: "text-xs text-slate-500 font-bold uppercase tracking-wider mb-1", children: "Priority Level" }),
          /* @__PURE__ */ w("div", { className: "text-3xl font-mono font-bold text-slate-900", children: [
            "P",
            e.priority
          ] })
        ] }),
        /* @__PURE__ */ w("div", { className: "flex gap-1", children: [
          /* @__PURE__ */ f(
            "button",
            {
              onClick: () => r("priority", Math.max(0, e.priority - 1)),
              className: "w-8 h-8 rounded bg-slate-100 hover:bg-slate-200 border border-slate-200 text-slate-600 flex items-center justify-center transition-colors",
              children: "-"
            }
          ),
          /* @__PURE__ */ f(
            "button",
            {
              onClick: () => r("priority", e.priority + 1),
              className: "w-8 h-8 rounded bg-slate-100 hover:bg-slate-200 border border-slate-200 text-slate-600 flex items-center justify-center transition-colors",
              children: "+"
            }
          )
        ] })
      ] }),
      /* @__PURE__ */ f("p", { className: "text-xs text-slate-500 mt-2", children: "Higher priority schedules override conflicting resources from lower priority schedules (inherited or direct)." })
    ] }),
    /* @__PURE__ */ w("div", { className: "grid grid-cols-2 gap-4", children: [
      /* @__PURE__ */ w("div", { children: [
        /* @__PURE__ */ f("label", { htmlFor: "logic-time", className: "text-xs font-semibold text-slate-500 mb-1 block", children: "Time Schedule" }),
        /* @__PURE__ */ w("div", { className: "relative", children: [
          /* @__PURE__ */ f(sr, { className: "absolute left-3 top-1/2 -translate-y-1/2 text-slate-400", size: 14 }),
          /* @__PURE__ */ f(
            "input",
            {
              id: "logic-time",
              type: "text",
              value: e.time,
              onChange: (u) => r("time", u.target.value),
              className: "w-full pl-9 pr-3 py-2 bg-white text-slate-900 border border-slate-300 rounded-lg text-sm focus:outline-none focus:border-teal-500"
            }
          )
        ] })
      ] }),
      /* @__PURE__ */ w("div", { children: [
        /* @__PURE__ */ f("span", { className: "text-xs font-semibold text-slate-500 mb-1 block", children: "Inheritance Direction" }),
        /* @__PURE__ */ w("div", { className: "flex bg-slate-100 p-1 rounded-lg", children: [
          /* @__PURE__ */ w(
            "button",
            {
              onClick: () => r("direction", ve.BottomUp),
              className: `flex-1 text-xs py-1.5 rounded-md flex items-center justify-center gap-1 transition-all ${e.direction === ve.BottomUp ? "bg-white text-teal-700 shadow-sm font-medium" : "text-slate-500 hover:text-slate-700"}`,
              children: [
                /* @__PURE__ */ f(wh, { size: 12 }),
                " Bottom Up"
              ]
            }
          ),
          /* @__PURE__ */ w(
            "button",
            {
              onClick: () => r("direction", ve.TopDown),
              className: `flex-1 text-xs py-1.5 rounded-md flex items-center justify-center gap-1 transition-all ${e.direction === ve.TopDown ? "bg-white text-teal-700 shadow-sm font-medium" : "text-slate-500 hover:text-slate-700"}`,
              children: [
                /* @__PURE__ */ f(_h, { size: 12 }),
                " Top Down"
              ]
            }
          )
        ] })
      ] })
    ] }),
    /* @__PURE__ */ w("div", { children: [
      /* @__PURE__ */ f("label", { htmlFor: "logic-location", className: "text-xs font-semibold text-slate-500 mb-1 block", children: "Location Context" }),
      /* @__PURE__ */ w("div", { className: "relative", children: [
        /* @__PURE__ */ f(Rp, { className: "absolute left-3 top-1/2 -translate-y-1/2 text-slate-400", size: 14 }),
        /* @__PURE__ */ w(
          "select",
          {
            id: "logic-location",
            value: `${e.locationGroup.groupId}|${e.locationGroup.nodeId}`,
            onChange: (u) => n(u.target.value),
            className: "w-full pl-9 pr-8 py-2 bg-white text-slate-900 border border-slate-300 rounded-lg text-sm focus:outline-none focus:border-teal-500 appearance-none",
            children: [
              /* @__PURE__ */ f("option", { value: "", children: "Select Location..." }),
              t.map((u) => /* @__PURE__ */ f("option", { value: `${u.groupId}|${u.id}`, children: u.name }, u.id))
            ]
          }
        )
      ] })
    ] }),
    /* @__PURE__ */ w("div", { children: [
      /* @__PURE__ */ w("div", { className: "flex items-center justify-between mb-2", children: [
        /* @__PURE__ */ f("span", { className: "text-xs font-semibold text-slate-500 block", children: "Approval Groups" }),
        /* @__PURE__ */ w(
          "button",
          {
            onClick: i,
            className: "text-xs text-teal-600 hover:text-teal-700 font-medium flex items-center gap-1",
            children: [
              /* @__PURE__ */ f(xr, { size: 12 }),
              " Add"
            ]
          }
        )
      ] }),
      /* @__PURE__ */ w("div", { className: "space-y-2", children: [
        (e.approvalGroups || []).map((u, c) => /* @__PURE__ */ w("div", { className: "flex gap-2 items-start", children: [
          /* @__PURE__ */ f(
            "select",
            {
              value: `${u.groupId}|${u.nodeId}`,
              onChange: (l) => s(c, "combined", l.target.value),
              className: "flex-1 p-2 text-xs bg-white text-slate-900 border border-slate-300 rounded-lg focus:outline-none focus:border-teal-500",
              children: a.map((l) => /* @__PURE__ */ f("option", { value: `${l.groupId}|${l.id}`, children: l.name }, l.id))
            }
          ),
          /* @__PURE__ */ w(
            "select",
            {
              value: u.type,
              onChange: (l) => s(c, "type", l.target.value),
              className: "w-24 p-2 text-xs bg-white text-slate-900 border border-slate-300 rounded-lg focus:outline-none focus:border-teal-500",
              children: [
                /* @__PURE__ */ f("option", { value: Ye.Room, children: "Room" }),
                /* @__PURE__ */ f("option", { value: Ye.Area, children: "Area" }),
                /* @__PURE__ */ f("option", { value: Ye.Global, children: "Global" })
              ]
            }
          ),
          /* @__PURE__ */ f(
            "button",
            {
              onClick: () => o(c),
              className: "p-2 text-slate-400 hover:text-red-500 transition-colors",
              children: /* @__PURE__ */ f(Te, { size: 14 })
            }
          )
        ] }, `${u.groupId}-${u.nodeId}-${u.type}`)),
        (!e.approvalGroups || e.approvalGroups.length === 0) && /* @__PURE__ */ f("div", { className: "text-center py-4 bg-slate-50 border border-dashed border-slate-200 rounded-lg text-xs text-slate-400", children: "No approval groups defined" })
      ] })
    ] })
  ] });
}, dv = ({
  node: e,
  handleUpdate: r,
  inheritedResources: t,
  resourceStatusMap: a,
  resourceMap: n,
  systemMap: i,
  planMap: o,
  loading: s,
  onAddResourceRequest: u
}) => {
  const c = (p) => {
    const N = e.resources.filter((y, g) => g !== p);
    r("resources", N);
  }, l = (p) => n.get(p), d = (p) => i.get(p), h = (p) => p ? o.get(p) : void 0;
  return /* @__PURE__ */ w("div", { className: "space-y-6 animate-in fade-in slide-in-from-bottom-2 duration-300", children: [
    /* @__PURE__ */ w("div", { className: "grid grid-cols-2 gap-3", children: [
      /* @__PURE__ */ w("div", { className: "p-3 bg-teal-50 border border-teal-100 rounded-xl", children: [
        /* @__PURE__ */ f("div", { className: "text-2xl font-bold text-teal-700", children: e.resources.length }),
        /* @__PURE__ */ f("div", { className: "text-xs text-teal-600 font-medium", children: "Direct Resources" })
      ] }),
      /* @__PURE__ */ w("div", { className: "p-3 bg-indigo-50 border border-indigo-100 rounded-xl", children: [
        /* @__PURE__ */ f("div", { className: "text-2xl font-bold text-indigo-700", children: t.length }),
        /* @__PURE__ */ f("div", { className: "text-xs text-indigo-600 font-medium", children: "Inherited" })
      ] })
    ] }),
    /* @__PURE__ */ w("div", { children: [
      /* @__PURE__ */ w("div", { className: "flex items-center justify-between mb-3", children: [
        /* @__PURE__ */ f("h3", { className: "text-xs font-bold text-slate-900 uppercase tracking-wider", children: "Direct Resources" }),
        /* @__PURE__ */ w(
          "button",
          {
            onClick: u,
            className: "text-xs bg-teal-600 hover:bg-teal-700 text-white px-3 py-1.5 rounded-lg flex items-center gap-2 transition-colors",
            children: [
              /* @__PURE__ */ f(xr, { size: 12 }),
              " Add Resource"
            ]
          }
        )
      ] }),
      /* @__PURE__ */ w("div", { className: "space-y-2", children: [
        e.resources.map((p, N) => {
          const y = a.get(p.resourceId), g = (y == null ? void 0 : y.priority) === e.priority, m = l(p.resourceId), v = d(p.systemId), b = h(p.resourcePlanId);
          return /* @__PURE__ */ w("div", { className: `p-3 rounded-lg border flex flex-col group transition-all ${g ? "bg-white border-slate-200 shadow-sm" : "bg-slate-50 border-slate-100 opacity-60"}`, children: [
            /* @__PURE__ */ w("div", { className: "flex items-center justify-between mb-1", children: [
              /* @__PURE__ */ w("div", { className: "flex items-center gap-2", children: [
                /* @__PURE__ */ f("span", { className: "font-semibold text-sm text-slate-900 truncate", title: p.resourceId, children: s ? "Loading..." : (m == null ? void 0 : m.name) || p.resourceId }),
                m && /* @__PURE__ */ f("span", { className: "text-[10px] bg-slate-100 text-slate-500 px-1 rounded border border-slate-200", children: m.resourceKind }),
                g && /* @__PURE__ */ f("span", { title: "Active (Winning Priority)", children: /* @__PURE__ */ f(Gp, { size: 14, className: "text-teal-500" }) })
              ] }),
              /* @__PURE__ */ f(
                "button",
                {
                  onClick: () => c(N),
                  className: "opacity-0 group-hover:opacity-100 p-1.5 text-slate-400 hover:text-red-600 hover:bg-red-50 rounded transition-all",
                  children: /* @__PURE__ */ f(tr, { size: 14 })
                }
              )
            ] }),
            (m == null ? void 0 : m.description) && /* @__PURE__ */ f("div", { className: "text-xs text-slate-500 mb-2 italic", children: m.description }),
            /* @__PURE__ */ w("div", { className: "grid grid-cols-2 gap-2 mt-1", children: [
              /* @__PURE__ */ w("div", { className: "flex items-center gap-1.5 text-[10px] text-slate-500 p-1.5 bg-slate-50 rounded border border-slate-100", children: [
                /* @__PURE__ */ f(rr, { size: 10, className: "text-slate-400" }),
                /* @__PURE__ */ f("span", { className: "truncate", children: s ? "..." : (v == null ? void 0 : v.name) || p.systemId })
              ] }),
              /* @__PURE__ */ w("div", { className: "flex items-center gap-1.5 text-[10px] text-slate-500 p-1.5 bg-slate-50 rounded border border-slate-100", children: [
                /* @__PURE__ */ f(sr, { size: 10, className: "text-slate-400" }),
                /* @__PURE__ */ f("span", { className: "truncate", children: p.resourcePlanId ? s ? "..." : (b == null ? void 0 : b.name) || p.resourcePlanId : /* @__PURE__ */ f("span", { className: "italic text-slate-400", children: "Fixed / No Plan" }) })
              ] })
            ] })
          ] }, p.resourceId);
        }),
        e.resources.length === 0 && /* @__PURE__ */ f("div", { className: "text-center py-8 bg-slate-50 border border-dashed border-slate-200 rounded-xl text-slate-400 text-sm", children: "No direct resources assigned." })
      ] })
    ] }),
    t.length > 0 && /* @__PURE__ */ w("div", { children: [
      /* @__PURE__ */ w("h3", { className: "text-xs font-bold text-slate-900 uppercase tracking-wider mb-3 flex items-center gap-2", children: [
        "Inherited Resources",
        /* @__PURE__ */ f("span", { className: "bg-slate-100 text-slate-600 px-1.5 py-0.5 rounded text-[10px]", children: t.length })
      ] }),
      /* @__PURE__ */ f("div", { className: "space-y-2 opacity-80", children: t.map((p, N) => {
        const y = a.get(p.resourceId), g = (y == null ? void 0 : y.priority) === p.sourceNodePriority, m = l(p.resourceId);
        return /* @__PURE__ */ f("div", { className: `p-3 rounded-lg border border-slate-100 flex items-center justify-between ${g ? "bg-indigo-50/50" : "bg-slate-50 opacity-60"}`, children: /* @__PURE__ */ w("div", { className: "flex-1 min-w-0", children: [
          /* @__PURE__ */ w("div", { className: "flex items-center gap-2 mb-0.5", children: [
            /* @__PURE__ */ f("span", { className: "font-medium text-sm text-slate-700 truncate", children: s ? "Loading..." : (m == null ? void 0 : m.name) || p.resourceId }),
            g ? /* @__PURE__ */ f("span", { title: "Winning Inherited Resource", children: /* @__PURE__ */ f(Wp, { size: 12, className: "text-indigo-500" }) }) : /* @__PURE__ */ f("span", { title: "Overridden by higher priority", children: /* @__PURE__ */ f(np, { size: 12, className: "text-slate-300" }) })
          ] }),
          /* @__PURE__ */ w("div", { className: "text-xs text-indigo-400 flex items-center gap-1", children: [
            /* @__PURE__ */ f(Rh, { size: 10 }),
            "Inherited from: ",
            /* @__PURE__ */ f("span", { className: "font-semibold", children: p.sourceNodeName }),
            " (P",
            p.sourceNodePriority,
            ")"
          ] })
        ] }) }, `inh-${p.resourceId}`);
      }) })
    ] })
  ] });
}, fv = ({ node: e, handleUpdate: r }) => {
  const [t, a] = K(null), [n, i] = K("");
  he(() => {
    i(JSON.stringify(e.configuration, null, 2)), a(null);
  }, [e.configuration]);
  const o = (s) => {
    i(s);
    try {
      const u = JSON.parse(s);
      r("configuration", u), a(null);
    } catch {
      a("Invalid JSON");
    }
  };
  return /* @__PURE__ */ w("div", { className: "h-full flex flex-col animate-in fade-in slide-in-from-bottom-2 duration-300", children: [
    /* @__PURE__ */ w("div", { className: "mb-4", children: [
      /* @__PURE__ */ f("h3", { className: "text-xs font-bold text-slate-900 uppercase tracking-wider mb-2", children: "Raw JSON Configuration" }),
      /* @__PURE__ */ f("p", { className: "text-xs text-slate-500", children: "Edit the advanced configuration object for this schedule directly." })
    ] }),
    /* @__PURE__ */ w("div", { className: "flex-1 relative", children: [
      /* @__PURE__ */ f(
        "textarea",
        {
          value: n,
          onChange: (s) => o(s.target.value),
          className: `w-full h-96 p-4 font-mono text-xs border rounded-xl focus:outline-none focus:ring-2 focus:ring-teal-500/20 resize-none text-slate-900 ${t ? "border-red-500 focus:border-red-500 bg-red-50" : "border-slate-300 focus:border-teal-500 bg-slate-50"}`
        }
      ),
      t && /* @__PURE__ */ w("div", { className: "absolute bottom-4 right-4 bg-red-100 text-red-700 px-3 py-1.5 rounded-lg text-xs font-medium border border-red-200 shadow-sm flex items-center gap-2", children: [
        /* @__PURE__ */ f(or, { size: 14 }),
        t
      ] })
    ] })
  ] });
}, hr = ({ id: e, label: r, icon: t, activeTab: a, onSelect: n }) => /* @__PURE__ */ w(
  "button",
  {
    onClick: () => n(e),
    className: `flex items-center gap-2 py-3 px-1 border-b-2 transition-colors text-sm font-medium ${a === e ? "border-teal-600 text-teal-700" : "border-transparent text-slate-500 hover:text-slate-700 hover:border-slate-300"}`,
    children: [
      t,
      r
    ]
  }
), hv = ({ node: e, allNodes: r, onClose: t, onUpdate: a, onAddResourceRequest: n }) => {
  const i = iv(), [o, s] = K("general"), [u, c] = K([]), [l, d] = K([]), [h, p] = K({
    resourceMap: /* @__PURE__ */ new Map(),
    systemMap: /* @__PURE__ */ new Map(),
    planMap: /* @__PURE__ */ new Map(),
    loading: !1
  });
  he(() => {
    (async () => {
      try {
        const [v, b] = await Promise.all([
          i.getLocations({ pageSize: 100 }),
          i.getApprovalGroups({ pageSize: 100 })
        ]);
        c(v.items), d(b.items);
      } catch (v) {
        console.error("Failed to load options", v);
      }
    })();
  }, [i]), he(() => {
    e && (async () => {
      p((x) => ({ ...x, loading: !0 }));
      const v = /* @__PURE__ */ new Set(), b = /* @__PURE__ */ new Set(), _ = /* @__PURE__ */ new Set();
      if ([...e.resources, ...e._inheritedResources || []].forEach((x) => {
        v.add(x.resourceId), x.systemId && b.add(x.systemId), x.resourcePlanId && _.add(x.resourcePlanId);
      }), v.size > 0 || b.size > 0 || _.size > 0) {
        const [x, q, C] = await Promise.all([
          i.resolveResources(Array.from(v)),
          i.resolveSystems(Array.from(b)),
          i.resolvePlans(Array.from(_))
        ]);
        p({ resourceMap: x, systemMap: q, planMap: C, loading: !1 });
      } else
        p((x) => ({ ...x, loading: !1 }));
    })();
  }, [e == null ? void 0 : e.scheduleId, e == null ? void 0 : e.resources, e == null ? void 0 : e._inheritedResources, i]);
  const N = we(() => {
    if (!e) return /* @__PURE__ */ new Map();
    const m = /* @__PURE__ */ new Map();
    return e.resources.forEach((v) => {
      m.set(v.resourceId, {
        priority: e.priority,
        sourceName: "This Schedule",
        isDirect: !0
      });
    }), (e._inheritedResources || []).forEach((v) => {
      const b = m.get(v.resourceId);
      (!b || v.sourceNodePriority > b.priority) && m.set(v.resourceId, {
        priority: v.sourceNodePriority,
        sourceName: v.sourceNodeName,
        isDirect: !1
      });
    }), m;
  }, [e == null ? void 0 : e.resources, e == null ? void 0 : e._inheritedResources, e == null ? void 0 : e.priority]);
  if (!e) return null;
  const y = (m, v) => {
    a(e.scheduleId, m, v);
  }, g = (m) => {
    if (!m) return "";
    const v = r.find((b) => b.scheduleId === m);
    return v ? v.name : m;
  };
  return /* @__PURE__ */ f(vr, { children: /* @__PURE__ */ w("div", { className: "absolute top-0 right-0 h-full w-[500px] bg-white shadow-2xl border-l border-slate-200 transform transition-transform duration-300 ease-in-out z-50 flex flex-col", children: [
    /* @__PURE__ */ w("div", { className: "p-6 pb-0 flex-none", children: [
      /* @__PURE__ */ w("div", { className: "flex items-center justify-between mb-4", children: [
        /* @__PURE__ */ w("div", { children: [
          /* @__PURE__ */ f("h2", { className: "text-xl font-bold text-slate-900", children: "Edit Schedule" }),
          /* @__PURE__ */ w("div", { className: "flex items-center gap-2 text-xs text-slate-400 font-mono mt-1", children: [
            /* @__PURE__ */ f("span", { children: "ID:" }),
            /* @__PURE__ */ f("span", { className: "truncate max-w-[200px]", children: e.scheduleId })
          ] })
        ] }),
        /* @__PURE__ */ f("button", { onClick: t, className: "p-2 hover:bg-slate-100 rounded-full text-slate-500 hover:text-teal-600 transition-colors", children: /* @__PURE__ */ f(Te, { size: 20 }) })
      ] }),
      /* @__PURE__ */ w("div", { className: "flex gap-6 border-b border-slate-200", children: [
        /* @__PURE__ */ f(hr, { id: "general", label: "General", icon: /* @__PURE__ */ f(po, { size: 14 }), activeTab: o, onSelect: s }),
        /* @__PURE__ */ f(hr, { id: "logic", label: "Logic", icon: /* @__PURE__ */ f(kp, { size: 14 }), activeTab: o, onSelect: s }),
        /* @__PURE__ */ f(hr, { id: "resources", label: "Resources", icon: /* @__PURE__ */ f(rr, { size: 14 }), activeTab: o, onSelect: s }),
        /* @__PURE__ */ f(hr, { id: "config", label: "Config", icon: /* @__PURE__ */ f(_r, { size: 14 }), activeTab: o, onSelect: s })
      ] })
    ] }),
    /* @__PURE__ */ w("div", { className: "flex-1 overflow-y-auto p-6 space-y-8", children: [
      o === "general" && /* @__PURE__ */ f(
        cv,
        {
          node: e,
          handleUpdate: y,
          allNodes: r,
          getScheduleName: g
        }
      ),
      o === "logic" && /* @__PURE__ */ f(
        lv,
        {
          node: e,
          handleUpdate: y,
          availableLocations: u,
          availableApprovalGroups: l
        }
      ),
      o === "resources" && /* @__PURE__ */ f(
        dv,
        {
          node: e,
          handleUpdate: y,
          inheritedResources: e._inheritedResources || [],
          resourceStatusMap: N,
          resourceMap: h.resourceMap,
          systemMap: h.systemMap,
          planMap: h.planMap,
          loading: h.loading,
          onAddResourceRequest: n
        }
      ),
      o === "config" && /* @__PURE__ */ f(
        fv,
        {
          node: e,
          handleUpdate: y
        }
      )
    ] })
  ] }) });
}, pv = ({ isOpen: e, onClose: r, onConfirm: t, count: a }) => e ? /* @__PURE__ */ f("div", { className: "fixed inset-0 z-[100] flex items-center justify-center bg-slate-900/50 backdrop-blur-sm p-4 animate-in fade-in duration-200", children: /* @__PURE__ */ f("div", { className: "bg-white rounded-xl shadow-2xl w-full max-w-md overflow-hidden border border-slate-200 transform scale-100", children: /* @__PURE__ */ w("div", { className: "p-6 text-center", children: [
  /* @__PURE__ */ f("div", { className: "w-12 h-12 bg-red-100 rounded-full flex items-center justify-center mx-auto mb-4 text-red-600", children: /* @__PURE__ */ f(or, { size: 24 }) }),
  /* @__PURE__ */ w("h3", { className: "text-lg font-bold text-slate-900 mb-2", children: [
    "Delete ",
    a,
    " Selected Node",
    a !== 1 ? "s" : "",
    "?"
  ] }),
  /* @__PURE__ */ w("p", { className: "text-sm text-slate-500 mb-6", children: [
    "This action cannot be undone. Any connections to ",
    a !== 1 ? "these nodes" : "this node",
    " will also be removed."
  ] }),
  /* @__PURE__ */ w("div", { className: "flex gap-3 justify-center", children: [
    /* @__PURE__ */ f(
      "button",
      {
        onClick: r,
        className: "px-4 py-2 bg-white border border-slate-300 rounded-lg text-slate-700 text-sm font-medium hover:bg-slate-50 transition-colors",
        children: "Cancel"
      }
    ),
    /* @__PURE__ */ w(
      "button",
      {
        onClick: t,
        className: "px-4 py-2 bg-red-600 rounded-lg text-white text-sm font-medium hover:bg-red-700 transition-colors flex items-center gap-2 shadow-sm shadow-red-600/20",
        children: [
          /* @__PURE__ */ f(tr, { size: 16 }),
          " Delete"
        ]
      }
    )
  ] })
] }) }) }) : null, vv = (e) => e.isOpen ? /* @__PURE__ */ f(mv, { ...e }) : null, mv = ({ onClose: e, data: r, onSave: t }) => {
  const [a, n] = K(() => ({ ...r })), [i, o] = K(null), [s, u] = K(() => JSON.stringify(r.configuration, null, 2)), c = (d) => {
    u(d);
    try {
      const h = JSON.parse(d);
      n((p) => ({ ...p, configuration: h })), o(null);
    } catch {
      o("Invalid JSON format");
    }
  }, l = () => {
    i || (t(a), e());
  };
  return /* @__PURE__ */ f("div", { className: "fixed inset-0 z-[100] flex items-center justify-center bg-slate-900/50 backdrop-blur-sm p-4 animate-in fade-in duration-200", children: /* @__PURE__ */ w("div", { className: "bg-white rounded-xl shadow-2xl w-full max-w-lg overflow-hidden border border-slate-200", children: [
    /* @__PURE__ */ w("div", { className: "flex items-center justify-between px-6 py-4 border-b border-slate-100 bg-slate-50", children: [
      /* @__PURE__ */ w("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ f("div", { className: "bg-teal-100 p-1.5 rounded-lg text-teal-700", children: /* @__PURE__ */ f(bp, { size: 18 }) }),
        /* @__PURE__ */ f("h2", { className: "text-lg font-bold text-slate-900", children: "Global Settings" })
      ] }),
      /* @__PURE__ */ f("button", { onClick: e, className: "p-2 hover:bg-slate-200 rounded-full text-slate-400 transition-colors", children: /* @__PURE__ */ f(Te, { size: 20 }) })
    ] }),
    /* @__PURE__ */ w("div", { className: "p-6 space-y-5 max-h-[70vh] overflow-y-auto", children: [
      /* @__PURE__ */ w("div", { children: [
        /* @__PURE__ */ f("label", { htmlFor: "gs-name", className: "block text-xs font-bold text-slate-500 uppercase tracking-wider mb-1.5", children: "Entitlement Name" }),
        /* @__PURE__ */ f(
          "input",
          {
            id: "gs-name",
            type: "text",
            value: a.name,
            onChange: (d) => n({ ...a, name: d.target.value }),
            className: "w-full p-2 bg-white text-slate-900 border border-slate-300 rounded-lg text-sm focus:outline-none focus:border-teal-500 focus:ring-2 focus:ring-teal-500/20"
          }
        )
      ] }),
      /* @__PURE__ */ w("div", { children: [
        /* @__PURE__ */ f("label", { htmlFor: "gs-tags", className: "block text-xs font-bold text-slate-500 uppercase tracking-wider mb-1.5", children: "Global Tags" }),
        /* @__PURE__ */ f(
          uo,
          {
            id: "gs-tags",
            tags: a.tags,
            onChange: (d) => n({ ...a, tags: d }),
            colorClass: "bg-teal-50 text-teal-700 border-teal-200"
          }
        )
      ] }),
      /* @__PURE__ */ w("div", { children: [
        /* @__PURE__ */ f("label", { htmlFor: "gs-config", className: "block text-xs font-bold text-slate-500 uppercase tracking-wider mb-1.5", children: "Configuration (JSON)" }),
        /* @__PURE__ */ f(
          "textarea",
          {
            id: "gs-config",
            value: s,
            onChange: (d) => c(d.target.value),
            className: `w-full h-40 p-3 font-mono text-xs border rounded-lg focus:outline-none focus:ring-2 focus:ring-teal-500/20 bg-white text-slate-900 ${i ? "border-red-500 focus:border-red-500" : "border-slate-300 focus:border-teal-500"}`
          }
        ),
        i && /* @__PURE__ */ f("p", { className: "text-red-500 text-xs mt-1", children: i })
      ] })
    ] }),
    /* @__PURE__ */ w("div", { className: "px-6 py-4 border-t border-slate-100 bg-slate-50 flex justify-end gap-3", children: [
      /* @__PURE__ */ f("button", { onClick: e, className: "px-4 py-2 text-slate-600 font-medium text-sm hover:bg-slate-100 rounded-lg", children: "Cancel" }),
      /* @__PURE__ */ w(
        "button",
        {
          onClick: l,
          disabled: !!i,
          className: "px-4 py-2 bg-teal-600 text-white font-medium text-sm rounded-lg hover:bg-teal-700 disabled:opacity-50 flex items-center gap-2",
          children: [
            /* @__PURE__ */ f(Ch, { size: 16 }),
            " Save Changes"
          ]
        }
      )
    ] })
  ] }) });
}, bv = (e) => e.isOpen ? /* @__PURE__ */ f(gv, { ...e }) : null, gv = ({ onClose: e, onConfirm: r, repositories: t }) => {
  const [a, n] = K(1), [i, o] = K(/* @__PURE__ */ new Set()), [s, u] = K(""), [c, l] = K({}), [d, h] = K(""), [p, N] = K([]), [y, g] = K([]), [m, v] = K(/* @__PURE__ */ new Map()), [b, _] = K(!1), x = Pe(null);
  he(() => {
    q(), C("");
  }, []);
  const q = async () => {
    try {
      const O = await t.getPlans({ pageSize: 100 });
      g(O.items);
    } catch (O) {
      console.error("Failed to fetch plans", O);
    }
  }, C = async (O) => {
    _(!0);
    try {
      const j = await t.getResources({
        filter: O,
        pageSize: 1e3
        // Increase page size now that we have virtualization
      });
      N(j.items);
      const L = /* @__PURE__ */ new Set();
      if (j.items.forEach((U) => {
        U.systemId && L.add(U.systemId);
      }), L.size > 0) {
        const U = await t.resolveSystems(Array.from(L));
        v((ie) => new Map([...ie, ...U]));
      }
    } catch (j) {
      console.error("Failed to fetch resources", j);
    } finally {
      _(!1);
    }
  }, R = (O) => {
    const j = O.target.value;
    u(j), x.current && clearTimeout(x.current), x.current = setTimeout(() => {
      C(j);
    }, 300);
  }, I = (O) => {
    const j = new Set(i);
    if (j.has(O)) {
      j.delete(O);
      const L = { ...c };
      delete L[O], l(L);
    } else
      j.add(O), l((L) => ({
        ...L,
        [O]: { planId: "" }
        // Initialize empty config
      }));
    o(j);
  }, S = (O, j, L) => {
    l((U) => ({
      ...U,
      [O]: {
        ...U[O],
        [j]: L
      }
    }));
  }, A = (O) => {
    if (h(O), !O) return;
    const j = y.find((L) => L.id === O);
    j && l((L) => {
      const U = { ...L };
      return i.forEach((ie) => {
        const le = p.find((te) => te.id === ie);
        le && le.systemId === j.systemId && le.resourceKind !== oe.Fixed && U[ie] && (U[ie] = { ...U[ie], planId: O });
      }), U;
    });
  }, M = (O) => {
    const j = new Set(i);
    j.delete(O), o(j);
    const L = { ...c };
    delete L[O], l(L), j.size === 0 && n(1);
  }, D = () => {
    const O = [];
    i.forEach((j) => {
      const L = c[j], U = p.find((ie) => ie.id === j);
      U && U.systemId && (U.resourceKind === oe.Fixed ? O.push({
        systemId: U.systemId,
        resourceId: j,
        resourcePlanId: null
        // Fixed resources do not need a plan
      }) : L && L.planId && O.push({
        systemId: U.systemId,
        resourceId: j,
        resourcePlanId: L.planId
      }));
    }), r(O), e();
  }, B = () => Array.from(i).every((O) => {
    const j = p.find((U) => U.id === O);
    if ((j == null ? void 0 : j.resourceKind) === oe.Fixed) return !0;
    const L = c[O];
    return L && L.planId;
  }), $ = (O) => {
    if (!O) return "Unknown";
    const j = m.get(O);
    return j ? j.name : O;
  }, X = we(() => {
    const O = /* @__PURE__ */ new Map();
    return y.forEach((j) => {
      var U;
      const L = j.systemId;
      O.has(L) || O.set(L, []), (U = O.get(L)) == null || U.push(j);
    }), O;
  }, [y]);
  return /* @__PURE__ */ f("div", { className: "fixed inset-0 z-[100] flex items-center justify-center bg-slate-900/50 backdrop-blur-sm p-4 animate-in fade-in duration-200", children: /* @__PURE__ */ w("div", { className: "bg-white rounded-xl shadow-2xl w-full max-w-5xl h-[85vh] flex flex-col overflow-hidden border border-slate-200", children: [
    /* @__PURE__ */ w("div", { className: "px-6 py-4 border-b border-slate-100 flex items-center justify-between bg-slate-50/50", children: [
      /* @__PURE__ */ w("div", { children: [
        /* @__PURE__ */ f("h2", { className: "text-lg font-bold text-slate-900", children: "Add Resources" }),
        /* @__PURE__ */ w("div", { className: "flex items-center gap-2 text-xs text-slate-500 mt-1", children: [
          /* @__PURE__ */ f("span", { className: a === 1 ? "text-teal-600 font-semibold" : "", children: "1. Select Resources" }),
          /* @__PURE__ */ f("span", { className: "text-slate-300", children: "/" }),
          /* @__PURE__ */ f("span", { className: a === 2 ? "text-teal-600 font-semibold" : "", children: "2. Assign Plans" })
        ] })
      ] }),
      /* @__PURE__ */ f("button", { onClick: e, className: "p-2 hover:bg-slate-200 rounded-full text-slate-400 transition-colors", children: /* @__PURE__ */ f(Te, { size: 20 }) })
    ] }),
    /* @__PURE__ */ w("div", { className: "flex-1 overflow-hidden relative flex flex-col", children: [
      a === 1 && /* @__PURE__ */ w(vr, { children: [
        /* @__PURE__ */ w("div", { className: "p-4 border-b border-slate-100 flex gap-4 bg-white flex-shrink-0", children: [
          /* @__PURE__ */ w("div", { className: "relative flex-1", children: [
            /* @__PURE__ */ f(br, { className: "absolute left-3 top-1/2 -translate-y-1/2 text-slate-400", size: 18 }),
            /* @__PURE__ */ f(
              "input",
              {
                type: "text",
                placeholder: "Search resources by name, ID or description...",
                className: "w-full pl-10 pr-4 py-2 bg-slate-50 border border-slate-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-teal-500/20 focus:border-teal-500 transition-all",
                value: s,
                onChange: R
              }
            )
          ] }),
          /* @__PURE__ */ f("div", { className: "flex items-center gap-2 px-3 py-2 bg-slate-50 rounded-lg border border-slate-200 text-slate-600 text-sm min-w-[100px] justify-center", children: b ? /* @__PURE__ */ f(Np, { size: 16, className: "animate-spin text-teal-600" }) : /* @__PURE__ */ w(vr, { children: [
            /* @__PURE__ */ f(qh, { size: 16 }),
            /* @__PURE__ */ w("span", { className: "font-medium", children: [
              p.length,
              " Found"
            ] })
          ] }) })
        ] }),
        /* @__PURE__ */ f("div", { className: "bg-white border-b border-slate-200 shadow-sm z-10 flex-shrink-0", children: /* @__PURE__ */ w("div", { className: "flex text-left text-sm", children: [
          /* @__PURE__ */ f("div", { className: "px-4 py-3 font-semibold text-slate-600 text-xs uppercase tracking-wider w-[60px] text-center", children: /* @__PURE__ */ f("div", { className: "w-4 h-4 mx-auto border-2 border-slate-300 rounded" }) }),
          /* @__PURE__ */ f("div", { className: "px-4 py-3 font-semibold text-slate-600 text-xs uppercase tracking-wider flex-1", children: "Resource" }),
          /* @__PURE__ */ f("div", { className: "px-4 py-3 font-semibold text-slate-600 text-xs uppercase tracking-wider w-[25%] hidden md:block", children: "Description" }),
          /* @__PURE__ */ f("div", { className: "px-4 py-3 font-semibold text-slate-600 text-xs uppercase tracking-wider w-[15%]", children: "Type" }),
          /* @__PURE__ */ f("div", { className: "px-4 py-3 font-semibold text-slate-600 text-xs uppercase tracking-wider w-[20%]", children: "System" })
        ] }) }),
        /* @__PURE__ */ w("div", { className: "flex-1 overflow-hidden bg-slate-50 relative", children: [
          p.length === 0 && !b && /* @__PURE__ */ w("div", { className: "absolute inset-0 flex flex-col items-center justify-center text-slate-400", children: [
            /* @__PURE__ */ f(br, { size: 32, className: "mx-auto mb-2 opacity-20" }),
            'No resources found matching "',
            s,
            '"'
          ] }),
          /* @__PURE__ */ f(
            co,
            {
              items: p,
              height: "100%",
              itemHeight: 64,
              renderItem: (O, j) => {
                const L = i.has(O.id);
                return /* @__PURE__ */ w(
                  "div",
                  {
                    role: "button",
                    tabIndex: 0,
                    onClick: () => I(O.id),
                    onKeyDown: (U) => {
                      (U.key === "Enter" || U.key === " ") && (U.preventDefault(), I(O.id));
                    },
                    className: `
                                            flex items-center text-sm border-b border-slate-100 cursor-pointer transition-colors h-[64px]
                                            ${L ? "bg-teal-50 hover:bg-teal-100" : "bg-white hover:bg-slate-50"}
                                        `,
                    children: [
                      /* @__PURE__ */ f("div", { className: "px-4 w-[60px] text-center flex-shrink-0", children: /* @__PURE__ */ f("div", { className: `
                                                w-4 h-4 mx-auto rounded border flex items-center justify-center transition-all
                                                ${L ? "bg-teal-500 border-teal-500 text-white" : "border-slate-300 bg-white"}
                                            `, children: L && /* @__PURE__ */ f(yh, { size: 10, strokeWidth: 4 }) }) }),
                      /* @__PURE__ */ w("div", { className: "px-4 flex-1 min-w-0", children: [
                        /* @__PURE__ */ f("div", { className: `font-medium truncate ${L ? "text-teal-900" : "text-slate-900"}`, children: O.name }),
                        /* @__PURE__ */ w("div", { className: "flex gap-2 text-[10px] mt-1", children: [
                          /* @__PURE__ */ f("span", { className: "font-mono text-slate-400", children: O.id }),
                          /* @__PURE__ */ f("span", { className: "bg-slate-100 px-1 rounded text-slate-500 border border-slate-200", children: O.resourceKind })
                        ] })
                      ] }),
                      /* @__PURE__ */ f("div", { className: "px-4 w-[25%] hidden md:block text-slate-500 truncate", children: O.description || /* @__PURE__ */ f("span", { className: "text-slate-300 italic", children: "No description" }) }),
                      /* @__PURE__ */ f("div", { className: "px-4 w-[15%] text-slate-500 truncate", children: O.resourceType }),
                      /* @__PURE__ */ w("div", { className: "px-4 w-[20%] flex items-center gap-1.5 text-slate-600 truncate", children: [
                        /* @__PURE__ */ f(rr, { size: 14, className: "text-slate-400 flex-shrink-0" }),
                        /* @__PURE__ */ f("span", { className: "truncate", children: $(O.systemId) })
                      ] })
                    ]
                  },
                  O.id
                );
              }
            }
          )
        ] })
      ] }),
      a === 2 && /* @__PURE__ */ w("div", { className: "h-full flex flex-col bg-slate-50", children: [
        /* @__PURE__ */ f("div", { className: "p-4 bg-white border-b border-slate-200 shadow-sm z-10 flex-shrink-0", children: /* @__PURE__ */ w("div", { className: "flex items-center gap-4", children: [
          /* @__PURE__ */ w("div", { className: "text-xs font-bold text-slate-500 uppercase tracking-wider whitespace-nowrap", children: [
            "Apply to all ",
            i.size,
            " items:"
          ] }),
          /* @__PURE__ */ f("div", { className: "flex-1 max-w-md", children: /* @__PURE__ */ w("div", { className: "relative", children: [
            /* @__PURE__ */ f(_r, { className: "absolute left-3 top-1/2 -translate-y-1/2 text-slate-400", size: 14 }),
            /* @__PURE__ */ w(
              "select",
              {
                className: "w-full pl-9 pr-3 py-1.5 text-xs border border-slate-300 rounded-lg focus:outline-none focus:border-teal-500 bg-slate-50",
                value: d,
                onChange: (O) => A(O.target.value),
                children: [
                  /* @__PURE__ */ f("option", { value: "", children: "Select Plan..." }),
                  Array.from(X.keys()).map((O) => {
                    const j = $(O), L = X.get(O) || [];
                    return /* @__PURE__ */ f("optgroup", { label: j, children: L.map((U) => /* @__PURE__ */ f("option", { value: U.id, children: U.name }, U.id)) }, O);
                  })
                ]
              }
            )
          ] }) })
        ] }) }),
        /* @__PURE__ */ f("div", { className: "flex-1 overflow-y-auto p-4 relative", children: /* @__PURE__ */ w("div", { className: "bg-white rounded-xl border border-slate-200 shadow-sm overflow-hidden h-full flex flex-col", children: [
          /* @__PURE__ */ w("div", { className: "flex text-left text-sm bg-slate-50 border-b border-slate-200 flex-shrink-0", children: [
            /* @__PURE__ */ f("div", { className: "px-4 py-3 font-semibold text-slate-600 text-xs uppercase tracking-wider w-[40%]", children: "Resource" }),
            /* @__PURE__ */ f("div", { className: "px-4 py-3 font-semibold text-slate-600 text-xs uppercase tracking-wider w-[25%]", children: "System" }),
            /* @__PURE__ */ f("div", { className: "px-4 py-3 font-semibold text-slate-600 text-xs uppercase tracking-wider w-[30%]", children: "Plan" }),
            /* @__PURE__ */ f("div", { className: "px-4 py-3 w-10" })
          ] }),
          /* @__PURE__ */ f("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ f(
            co,
            {
              items: Array.from(i),
              height: "100%",
              itemHeight: 64,
              renderItem: (O, j) => {
                const L = p.find((te) => te.id === O), U = c[O] || { planId: "" }, ie = (L == null ? void 0 : L.resourceKind) === oe.Fixed, le = y.filter((te) => te.systemId === (L == null ? void 0 : L.systemId));
                return /* @__PURE__ */ w("div", { className: "flex items-center text-sm border-b border-slate-100 h-[64px] bg-white group hover:bg-slate-50", children: [
                  /* @__PURE__ */ w("div", { className: "px-4 w-[40%]", children: [
                    /* @__PURE__ */ f("div", { className: "font-medium text-slate-900 truncate", children: (L == null ? void 0 : L.name) || O }),
                    /* @__PURE__ */ w("div", { className: "flex gap-2 text-[10px] mt-0.5", children: [
                      /* @__PURE__ */ f("span", { className: "text-slate-400 font-mono", children: O }),
                      /* @__PURE__ */ f("span", { className: "bg-slate-100 px-1 rounded text-slate-500 border border-slate-200", children: L == null ? void 0 : L.resourceKind })
                    ] })
                  ] }),
                  /* @__PURE__ */ f("div", { className: "px-4 w-[25%]", children: /* @__PURE__ */ w("div", { className: "flex items-center gap-1.5 text-slate-500 text-xs truncate", children: [
                    /* @__PURE__ */ f(rr, { size: 12, className: "text-slate-400 flex-shrink-0" }),
                    /* @__PURE__ */ f("span", { className: "truncate", children: $(L == null ? void 0 : L.systemId) })
                  ] }) }),
                  /* @__PURE__ */ f("div", { className: "px-4 w-[30%]", children: ie ? /* @__PURE__ */ w("div", { className: "flex items-center gap-2 text-slate-400 text-xs italic bg-slate-100 px-2 py-1.5 rounded border border-slate-200 w-fit", children: [
                    /* @__PURE__ */ f("div", { className: "w-1.5 h-1.5 rounded-full bg-slate-400" }),
                    "Included in Resource"
                  ] }) : /* @__PURE__ */ w(
                    "select",
                    {
                      className: `w-full p-2 border rounded-lg text-xs focus:outline-none focus:border-teal-500 transition-colors ${U.planId ? "border-slate-200" : "border-red-200 bg-red-50 text-red-800"}`,
                      value: U.planId,
                      onChange: (te) => S(O, "planId", te.target.value),
                      disabled: le.length === 0,
                      children: [
                        /* @__PURE__ */ f("option", { value: "", children: le.length === 0 ? "No plans" : "Select Plan..." }),
                        le.map((te) => /* @__PURE__ */ w("option", { value: te.id, children: [
                          te.name,
                          " (P",
                          te.priority,
                          ")"
                        ] }, te.id))
                      ]
                    }
                  ) }),
                  /* @__PURE__ */ f("div", { className: "px-4 flex-1 text-right", children: /* @__PURE__ */ f(
                    "button",
                    {
                      onClick: () => M(O),
                      className: "p-2 text-slate-400 hover:text-red-600 hover:bg-red-50 rounded-lg transition-colors",
                      title: "Remove",
                      children: /* @__PURE__ */ f(tr, { size: 16 })
                    }
                  ) })
                ] }, O);
              }
            }
          ) })
        ] }) })
      ] })
    ] }),
    /* @__PURE__ */ w("div", { className: "px-6 py-4 border-t border-slate-200 bg-white flex justify-between items-center flex-shrink-0", children: [
      /* @__PURE__ */ f("div", { className: "text-sm text-slate-500", children: i.size > 0 && /* @__PURE__ */ w("span", { className: "font-medium text-slate-900", children: [
        i.size,
        " resources selected"
      ] }) }),
      /* @__PURE__ */ w("div", { className: "flex gap-3", children: [
        a === 2 && /* @__PURE__ */ w(
          "button",
          {
            onClick: () => n(1),
            className: "px-4 py-2 text-slate-600 font-medium text-sm hover:bg-slate-100 rounded-lg flex items-center gap-2",
            children: [
              /* @__PURE__ */ f(xh, { size: 16 }),
              " Back"
            ]
          }
        ),
        a === 1 ? /* @__PURE__ */ w(
          "button",
          {
            onClick: () => n(2),
            disabled: i.size === 0,
            className: "bg-slate-900 hover:bg-slate-800 disabled:bg-slate-200 disabled:text-slate-400 text-white px-5 py-2 rounded-lg text-sm font-medium flex items-center gap-2 transition-colors shadow-sm",
            children: [
              "Next: Configuration ",
              /* @__PURE__ */ f(W0, { size: 16 })
            ]
          }
        ) : /* @__PURE__ */ w(
          "button",
          {
            onClick: D,
            disabled: !B(),
            className: "bg-teal-600 hover:bg-teal-700 disabled:bg-slate-200 disabled:text-slate-400 text-white px-6 py-2 rounded-lg text-sm font-medium flex items-center gap-2 transition-colors shadow-sm shadow-teal-600/20",
            children: [
              /* @__PURE__ */ f(cp, { size: 18 }),
              " Confirm & Add Resources"
            ]
          }
        )
      ] })
    ] })
  ] }) });
}, yv = ({ x: e, y: r, items: t, onClose: a }) => {
  const n = Pe(null);
  return he(() => {
    const i = (o) => {
      n.current && !n.current.contains(o.target) && a();
    };
    return document.addEventListener("mousedown", i), () => document.removeEventListener("mousedown", i);
  }, [a]), /* @__PURE__ */ f(
    "div",
    {
      ref: n,
      className: "fixed z-[1000] bg-white rounded-lg shadow-xl border border-slate-200 min-w-[180px] py-1.5 animate-in fade-in zoom-in-95 duration-100",
      style: { top: r, left: e },
      children: t.map((i) => /* @__PURE__ */ f(fo.Fragment, { children: /* @__PURE__ */ w(
        "button",
        {
          onClick: () => {
            i.disabled || (i.onClick(), a());
          },
          disabled: i.disabled,
          className: `w-full text-left px-3 py-2 text-xs font-medium flex items-center gap-2 transition-colors
              ${i.danger ? "text-red-600 hover:bg-red-50" : "text-slate-700 hover:bg-slate-100"}
              ${i.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}
            `,
          children: [
            i.icon && /* @__PURE__ */ f("span", { className: "w-4 h-4 flex items-center justify-center", children: i.icon }),
            i.label
          ]
        }
      ) }, i.label))
    }
  );
}, xv = ({ nodes: e, onSelectNode: r }) => {
  const [t, a] = K(""), [n, i] = K(0), [o, s] = K(!0), u = Pe(null), { setCenter: c, setNodes: l } = ho(), d = we(() => {
    if (!t.trim()) return [];
    const m = t.toLowerCase();
    return e.filter((v) => {
      const b = v.data;
      return b.name.toLowerCase().includes(m) || b.purpose.toLowerCase().includes(m) || b.group.toLowerCase().includes(m);
    });
  }, [e, t]);
  he(() => {
    const m = (v) => {
      var b;
      (v.ctrlKey || v.metaKey) && v.key === "f" && (v.preventDefault(), s(!0), (b = u.current) == null || b.focus());
    };
    return window.addEventListener("keydown", m), () => window.removeEventListener("keydown", m);
  }, []);
  const h = (m, v = !1) => {
    const b = d[m];
    if (!b) return;
    r(b.data), l(
      (q) => q.map((C) => ({
        ...C,
        selected: C.id === b.id
      }))
    );
    const _ = b.position.x + 140, x = b.position.y + 60;
    c(_, x, {
      zoom: 1.2,
      duration: v ? 800 : 600
    });
  }, p = (m) => {
    const v = m.target.value;
    a(v), i(0);
  };
  he(() => {
    d.length > 0 && t && h(n, !0);
  }, [t]);
  const N = (m) => {
    if (m == null || m.preventDefault(), d.length === 0) return;
    const v = (n + 1) % d.length;
    i(v), h(v, !1);
  }, y = (m) => {
    if (m == null || m.preventDefault(), d.length === 0) return;
    const v = (n - 1 + d.length) % d.length;
    i(v), h(v, !1);
  }, g = (m) => {
    var v;
    m.key === "Enter" && N(), m.key === "Escape" && (a(""), (v = u.current) == null || v.blur());
  };
  return o ? /* @__PURE__ */ f("div", { className: "absolute top-4 left-4 z-[60] w-full px-4 md:px-0 md:w-80 animate-in fade-in slide-in-from-top-2 duration-300", children: /* @__PURE__ */ w("div", { className: "bg-white/95 backdrop-blur shadow-xl rounded-xl border border-slate-200/50 flex items-center p-1.5 focus-within:ring-2 focus-within:ring-teal-500/30 transition-all", children: [
    /* @__PURE__ */ f("div", { className: "pl-2 text-slate-400", children: /* @__PURE__ */ f(br, { size: 18 }) }),
    /* @__PURE__ */ f(
      "input",
      {
        ref: u,
        type: "text",
        value: t,
        onChange: p,
        onKeyDown: g,
        placeholder: "Search schedules (Cmd+F)...",
        className: "flex-1 bg-transparent border-none outline-none px-2 py-1.5 text-sm text-slate-900 placeholder:text-slate-400"
      }
    ),
    t && /* @__PURE__ */ w("div", { className: "flex items-center gap-1 pr-1 border-l border-slate-100 ml-1 pl-2", children: [
      /* @__PURE__ */ f("span", { className: "text-[10px] font-bold text-slate-500 min-w-[32px] text-center", children: d.length > 0 ? `${n + 1}/${d.length}` : "0/0" }),
      /* @__PURE__ */ w("div", { className: "flex", children: [
        /* @__PURE__ */ f(
          "button",
          {
            onClick: y,
            disabled: d.length <= 1,
            className: "p-1 text-slate-400 hover:text-teal-600 disabled:opacity-30 rounded transition-colors",
            children: /* @__PURE__ */ f(xh, { size: 14 })
          }
        ),
        /* @__PURE__ */ f(
          "button",
          {
            onClick: N,
            disabled: d.length <= 1,
            className: "p-1 text-slate-400 hover:text-teal-600 disabled:opacity-30 rounded transition-colors",
            children: /* @__PURE__ */ f(ep, { size: 14 })
          }
        )
      ] }),
      /* @__PURE__ */ f(
        "button",
        {
          onClick: () => a(""),
          className: "p-1 text-slate-400 hover:text-red-500 rounded transition-colors",
          children: /* @__PURE__ */ f(Te, { size: 14 })
        }
      )
    ] })
  ] }) }) : null;
};
var pr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function _v(e) {
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
function vo(e) {
  throw new Error('Could not dynamically require "' + e + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
}
var Br, Fo;
function wv() {
  if (Fo) return Br;
  Fo = 1;
  function e() {
    this.__data__ = [], this.size = 0;
  }
  return Br = e, Br;
}
var Ur, Go;
function Ue() {
  if (Go) return Ur;
  Go = 1;
  function e(r, t) {
    return r === t || r !== r && t !== t;
  }
  return Ur = e, Ur;
}
var $r, zo;
function wr() {
  if (zo) return $r;
  zo = 1;
  var e = Ue();
  function r(t, a) {
    for (var n = t.length; n--; )
      if (e(t[n][0], a))
        return n;
    return -1;
  }
  return $r = r, $r;
}
var Kr, Bo;
function Nv() {
  if (Bo) return Kr;
  Bo = 1;
  var e = wr(), r = Array.prototype, t = r.splice;
  function a(n) {
    var i = this.__data__, o = e(i, n);
    if (o < 0)
      return !1;
    var s = i.length - 1;
    return o == s ? i.pop() : t.call(i, o, 1), --this.size, !0;
  }
  return Kr = a, Kr;
}
var Hr, Uo;
function qv() {
  if (Uo) return Hr;
  Uo = 1;
  var e = wr();
  function r(t) {
    var a = this.__data__, n = e(a, t);
    return n < 0 ? void 0 : a[n][1];
  }
  return Hr = r, Hr;
}
var Vr, $o;
function Iv() {
  if ($o) return Vr;
  $o = 1;
  var e = wr();
  function r(t) {
    return e(this.__data__, t) > -1;
  }
  return Vr = r, Vr;
}
var Wr, Ko;
function Cv() {
  if (Ko) return Wr;
  Ko = 1;
  var e = wr();
  function r(t, a) {
    var n = this.__data__, i = e(n, t);
    return i < 0 ? (++this.size, n.push([t, a])) : n[i][1] = a, this;
  }
  return Wr = r, Wr;
}
var Yr, Ho;
function Nr() {
  if (Ho) return Yr;
  Ho = 1;
  var e = wv(), r = Nv(), t = qv(), a = Iv(), n = Cv();
  function i(o) {
    var s = -1, u = o == null ? 0 : o.length;
    for (this.clear(); ++s < u; ) {
      var c = o[s];
      this.set(c[0], c[1]);
    }
  }
  return i.prototype.clear = e, i.prototype.delete = r, i.prototype.get = t, i.prototype.has = a, i.prototype.set = n, Yr = i, Yr;
}
var Jr, Vo;
function Rv() {
  if (Vo) return Jr;
  Vo = 1;
  var e = Nr();
  function r() {
    this.__data__ = new e(), this.size = 0;
  }
  return Jr = r, Jr;
}
var Zr, Wo;
function Sv() {
  if (Wo) return Zr;
  Wo = 1;
  function e(r) {
    var t = this.__data__, a = t.delete(r);
    return this.size = t.size, a;
  }
  return Zr = e, Zr;
}
var Xr, Yo;
function Ev() {
  if (Yo) return Xr;
  Yo = 1;
  function e(r) {
    return this.__data__.get(r);
  }
  return Xr = e, Xr;
}
var Qr, Jo;
function kv() {
  if (Jo) return Qr;
  Jo = 1;
  function e(r) {
    return this.__data__.has(r);
  }
  return Qr = e, Qr;
}
var et, Zo;
function Th() {
  if (Zo) return et;
  Zo = 1;
  var e = typeof pr == "object" && pr && pr.Object === Object && pr;
  return et = e, et;
}
var rt, Xo;
function _e() {
  if (Xo) return rt;
  Xo = 1;
  var e = Th(), r = typeof self == "object" && self && self.Object === Object && self, t = e || r || Function("return this")();
  return rt = t, rt;
}
var tt, Qo;
function $e() {
  if (Qo) return tt;
  Qo = 1;
  var e = _e(), r = e.Symbol;
  return tt = r, tt;
}
var nt, eu;
function Av() {
  if (eu) return nt;
  eu = 1;
  var e = $e(), r = Object.prototype, t = r.hasOwnProperty, a = r.toString, n = e ? e.toStringTag : void 0;
  function i(o) {
    var s = t.call(o, n), u = o[n];
    try {
      o[n] = void 0;
      var c = !0;
    } catch {
    }
    var l = a.call(o);
    return c && (s ? o[n] = u : delete o[n]), l;
  }
  return nt = i, nt;
}
var at, ru;
function Tv() {
  if (ru) return at;
  ru = 1;
  var e = Object.prototype, r = e.toString;
  function t(a) {
    return r.call(a);
  }
  return at = t, at;
}
var it, tu;
function Le() {
  if (tu) return it;
  tu = 1;
  var e = $e(), r = Av(), t = Tv(), a = "[object Null]", n = "[object Undefined]", i = e ? e.toStringTag : void 0;
  function o(s) {
    return s == null ? s === void 0 ? n : a : i && i in Object(s) ? r(s) : t(s);
  }
  return it = o, it;
}
var st, nu;
function me() {
  if (nu) return st;
  nu = 1;
  function e(r) {
    var t = typeof r;
    return r != null && (t == "object" || t == "function");
  }
  return st = e, st;
}
var ot, au;
function ur() {
  if (au) return ot;
  au = 1;
  var e = Le(), r = me(), t = "[object AsyncFunction]", a = "[object Function]", n = "[object GeneratorFunction]", i = "[object Proxy]";
  function o(s) {
    if (!r(s))
      return !1;
    var u = e(s);
    return u == a || u == n || u == t || u == i;
  }
  return ot = o, ot;
}
var ut, iu;
function Ov() {
  if (iu) return ut;
  iu = 1;
  var e = _e(), r = e["__core-js_shared__"];
  return ut = r, ut;
}
var ct, su;
function Mv() {
  if (su) return ct;
  su = 1;
  var e = Ov(), r = (function() {
    var a = /[^.]+$/.exec(e && e.keys && e.keys.IE_PROTO || "");
    return a ? "Symbol(src)_1." + a : "";
  })();
  function t(a) {
    return !!r && r in a;
  }
  return ct = t, ct;
}
var lt, ou;
function Oh() {
  if (ou) return lt;
  ou = 1;
  var e = Function.prototype, r = e.toString;
  function t(a) {
    if (a != null) {
      try {
        return r.call(a);
      } catch {
      }
      try {
        return a + "";
      } catch {
      }
    }
    return "";
  }
  return lt = t, lt;
}
var dt, uu;
function Pv() {
  if (uu) return dt;
  uu = 1;
  var e = ur(), r = Mv(), t = me(), a = Oh(), n = /[\\^$.*+?()[\]{}|]/g, i = /^\[object .+?Constructor\]$/, o = Function.prototype, s = Object.prototype, u = o.toString, c = s.hasOwnProperty, l = RegExp(
    "^" + u.call(c).replace(n, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
  );
  function d(h) {
    if (!t(h) || r(h))
      return !1;
    var p = e(h) ? l : i;
    return p.test(a(h));
  }
  return dt = d, dt;
}
var ft, cu;
function Lv() {
  if (cu) return ft;
  cu = 1;
  function e(r, t) {
    return r == null ? void 0 : r[t];
  }
  return ft = e, ft;
}
var ht, lu;
function je() {
  if (lu) return ht;
  lu = 1;
  var e = Pv(), r = Lv();
  function t(a, n) {
    var i = r(a, n);
    return e(i) ? i : void 0;
  }
  return ht = t, ht;
}
var pt, du;
function mo() {
  if (du) return pt;
  du = 1;
  var e = je(), r = _e(), t = e(r, "Map");
  return pt = t, pt;
}
var vt, fu;
function qr() {
  if (fu) return vt;
  fu = 1;
  var e = je(), r = e(Object, "create");
  return vt = r, vt;
}
var mt, hu;
function jv() {
  if (hu) return mt;
  hu = 1;
  var e = qr();
  function r() {
    this.__data__ = e ? e(null) : {}, this.size = 0;
  }
  return mt = r, mt;
}
var bt, pu;
function Dv() {
  if (pu) return bt;
  pu = 1;
  function e(r) {
    var t = this.has(r) && delete this.__data__[r];
    return this.size -= t ? 1 : 0, t;
  }
  return bt = e, bt;
}
var gt, vu;
function Fv() {
  if (vu) return gt;
  vu = 1;
  var e = qr(), r = "__lodash_hash_undefined__", t = Object.prototype, a = t.hasOwnProperty;
  function n(i) {
    var o = this.__data__;
    if (e) {
      var s = o[i];
      return s === r ? void 0 : s;
    }
    return a.call(o, i) ? o[i] : void 0;
  }
  return gt = n, gt;
}
var yt, mu;
function Gv() {
  if (mu) return yt;
  mu = 1;
  var e = qr(), r = Object.prototype, t = r.hasOwnProperty;
  function a(n) {
    var i = this.__data__;
    return e ? i[n] !== void 0 : t.call(i, n);
  }
  return yt = a, yt;
}
var xt, bu;
function zv() {
  if (bu) return xt;
  bu = 1;
  var e = qr(), r = "__lodash_hash_undefined__";
  function t(a, n) {
    var i = this.__data__;
    return this.size += this.has(a) ? 0 : 1, i[a] = e && n === void 0 ? r : n, this;
  }
  return xt = t, xt;
}
var _t, gu;
function Bv() {
  if (gu) return _t;
  gu = 1;
  var e = jv(), r = Dv(), t = Fv(), a = Gv(), n = zv();
  function i(o) {
    var s = -1, u = o == null ? 0 : o.length;
    for (this.clear(); ++s < u; ) {
      var c = o[s];
      this.set(c[0], c[1]);
    }
  }
  return i.prototype.clear = e, i.prototype.delete = r, i.prototype.get = t, i.prototype.has = a, i.prototype.set = n, _t = i, _t;
}
var wt, yu;
function Uv() {
  if (yu) return wt;
  yu = 1;
  var e = Bv(), r = Nr(), t = mo();
  function a() {
    this.size = 0, this.__data__ = {
      hash: new e(),
      map: new (t || r)(),
      string: new e()
    };
  }
  return wt = a, wt;
}
var Nt, xu;
function $v() {
  if (xu) return Nt;
  xu = 1;
  function e(r) {
    var t = typeof r;
    return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? r !== "__proto__" : r === null;
  }
  return Nt = e, Nt;
}
var qt, _u;
function Ir() {
  if (_u) return qt;
  _u = 1;
  var e = $v();
  function r(t, a) {
    var n = t.__data__;
    return e(a) ? n[typeof a == "string" ? "string" : "hash"] : n.map;
  }
  return qt = r, qt;
}
var It, wu;
function Kv() {
  if (wu) return It;
  wu = 1;
  var e = Ir();
  function r(t) {
    var a = e(this, t).delete(t);
    return this.size -= a ? 1 : 0, a;
  }
  return It = r, It;
}
var Ct, Nu;
function Hv() {
  if (Nu) return Ct;
  Nu = 1;
  var e = Ir();
  function r(t) {
    return e(this, t).get(t);
  }
  return Ct = r, Ct;
}
var Rt, qu;
function Vv() {
  if (qu) return Rt;
  qu = 1;
  var e = Ir();
  function r(t) {
    return e(this, t).has(t);
  }
  return Rt = r, Rt;
}
var St, Iu;
function Wv() {
  if (Iu) return St;
  Iu = 1;
  var e = Ir();
  function r(t, a) {
    var n = e(this, t), i = n.size;
    return n.set(t, a), this.size += n.size == i ? 0 : 1, this;
  }
  return St = r, St;
}
var Et, Cu;
function bo() {
  if (Cu) return Et;
  Cu = 1;
  var e = Uv(), r = Kv(), t = Hv(), a = Vv(), n = Wv();
  function i(o) {
    var s = -1, u = o == null ? 0 : o.length;
    for (this.clear(); ++s < u; ) {
      var c = o[s];
      this.set(c[0], c[1]);
    }
  }
  return i.prototype.clear = e, i.prototype.delete = r, i.prototype.get = t, i.prototype.has = a, i.prototype.set = n, Et = i, Et;
}
var kt, Ru;
function Yv() {
  if (Ru) return kt;
  Ru = 1;
  var e = Nr(), r = mo(), t = bo(), a = 200;
  function n(i, o) {
    var s = this.__data__;
    if (s instanceof e) {
      var u = s.__data__;
      if (!r || u.length < a - 1)
        return u.push([i, o]), this.size = ++s.size, this;
      s = this.__data__ = new t(u);
    }
    return s.set(i, o), this.size = s.size, this;
  }
  return kt = n, kt;
}
var At, Su;
function Cr() {
  if (Su) return At;
  Su = 1;
  var e = Nr(), r = Rv(), t = Sv(), a = Ev(), n = kv(), i = Yv();
  function o(s) {
    var u = this.__data__ = new e(s);
    this.size = u.size;
  }
  return o.prototype.clear = r, o.prototype.delete = t, o.prototype.get = a, o.prototype.has = n, o.prototype.set = i, At = o, At;
}
var Tt, Eu;
function go() {
  if (Eu) return Tt;
  Eu = 1;
  function e(r, t) {
    for (var a = -1, n = r == null ? 0 : r.length; ++a < n && t(r[a], a, r) !== !1; )
      ;
    return r;
  }
  return Tt = e, Tt;
}
var Ot, ku;
function Mh() {
  if (ku) return Ot;
  ku = 1;
  var e = je(), r = (function() {
    try {
      var t = e(Object, "defineProperty");
      return t({}, "", {}), t;
    } catch {
    }
  })();
  return Ot = r, Ot;
}
var Mt, Au;
function Rr() {
  if (Au) return Mt;
  Au = 1;
  var e = Mh();
  function r(t, a, n) {
    a == "__proto__" && e ? e(t, a, {
      configurable: !0,
      enumerable: !0,
      value: n,
      writable: !0
    }) : t[a] = n;
  }
  return Mt = r, Mt;
}
var Pt, Tu;
function Sr() {
  if (Tu) return Pt;
  Tu = 1;
  var e = Rr(), r = Ue(), t = Object.prototype, a = t.hasOwnProperty;
  function n(i, o, s) {
    var u = i[o];
    (!(a.call(i, o) && r(u, s)) || s === void 0 && !(o in i)) && e(i, o, s);
  }
  return Pt = n, Pt;
}
var Lt, Ou;
function cr() {
  if (Ou) return Lt;
  Ou = 1;
  var e = Sr(), r = Rr();
  function t(a, n, i, o) {
    var s = !i;
    i || (i = {});
    for (var u = -1, c = n.length; ++u < c; ) {
      var l = n[u], d = o ? o(i[l], a[l], l, i, a) : void 0;
      d === void 0 && (d = a[l]), s ? r(i, l, d) : e(i, l, d);
    }
    return i;
  }
  return Lt = t, Lt;
}
var jt, Mu;
function Jv() {
  if (Mu) return jt;
  Mu = 1;
  function e(r, t) {
    for (var a = -1, n = Array(r); ++a < r; )
      n[a] = t(a);
    return n;
  }
  return jt = e, jt;
}
var Dt, Pu;
function Ne() {
  if (Pu) return Dt;
  Pu = 1;
  function e(r) {
    return r != null && typeof r == "object";
  }
  return Dt = e, Dt;
}
var Ft, Lu;
function Zv() {
  if (Lu) return Ft;
  Lu = 1;
  var e = Le(), r = Ne(), t = "[object Arguments]";
  function a(n) {
    return r(n) && e(n) == t;
  }
  return Ft = a, Ft;
}
var Gt, ju;
function lr() {
  if (ju) return Gt;
  ju = 1;
  var e = Zv(), r = Ne(), t = Object.prototype, a = t.hasOwnProperty, n = t.propertyIsEnumerable, i = e(/* @__PURE__ */ (function() {
    return arguments;
  })()) ? e : function(o) {
    return r(o) && a.call(o, "callee") && !n.call(o, "callee");
  };
  return Gt = i, Gt;
}
var zt, Du;
function ne() {
  if (Du) return zt;
  Du = 1;
  var e = Array.isArray;
  return zt = e, zt;
}
var Je = { exports: {} }, Bt, Fu;
function Xv() {
  if (Fu) return Bt;
  Fu = 1;
  function e() {
    return !1;
  }
  return Bt = e, Bt;
}
Je.exports;
var Gu;
function Ke() {
  return Gu || (Gu = 1, (function(e, r) {
    var t = _e(), a = Xv(), n = r && !r.nodeType && r, i = n && !0 && e && !e.nodeType && e, o = i && i.exports === n, s = o ? t.Buffer : void 0, u = s ? s.isBuffer : void 0, c = u || a;
    e.exports = c;
  })(Je, Je.exports)), Je.exports;
}
var Ut, zu;
function Er() {
  if (zu) return Ut;
  zu = 1;
  var e = 9007199254740991, r = /^(?:0|[1-9]\d*)$/;
  function t(a, n) {
    var i = typeof a;
    return n = n ?? e, !!n && (i == "number" || i != "symbol" && r.test(a)) && a > -1 && a % 1 == 0 && a < n;
  }
  return Ut = t, Ut;
}
var $t, Bu;
function yo() {
  if (Bu) return $t;
  Bu = 1;
  var e = 9007199254740991;
  function r(t) {
    return typeof t == "number" && t > -1 && t % 1 == 0 && t <= e;
  }
  return $t = r, $t;
}
var Kt, Uu;
function Qv() {
  if (Uu) return Kt;
  Uu = 1;
  var e = Le(), r = yo(), t = Ne(), a = "[object Arguments]", n = "[object Array]", i = "[object Boolean]", o = "[object Date]", s = "[object Error]", u = "[object Function]", c = "[object Map]", l = "[object Number]", d = "[object Object]", h = "[object RegExp]", p = "[object Set]", N = "[object String]", y = "[object WeakMap]", g = "[object ArrayBuffer]", m = "[object DataView]", v = "[object Float32Array]", b = "[object Float64Array]", _ = "[object Int8Array]", x = "[object Int16Array]", q = "[object Int32Array]", C = "[object Uint8Array]", R = "[object Uint8ClampedArray]", I = "[object Uint16Array]", S = "[object Uint32Array]", A = {};
  A[v] = A[b] = A[_] = A[x] = A[q] = A[C] = A[R] = A[I] = A[S] = !0, A[a] = A[n] = A[g] = A[i] = A[m] = A[o] = A[s] = A[u] = A[c] = A[l] = A[d] = A[h] = A[p] = A[N] = A[y] = !1;
  function M(D) {
    return t(D) && r(D.length) && !!A[e(D)];
  }
  return Kt = M, Kt;
}
var Ht, $u;
function kr() {
  if ($u) return Ht;
  $u = 1;
  function e(r) {
    return function(t) {
      return r(t);
    };
  }
  return Ht = e, Ht;
}
var Ze = { exports: {} };
Ze.exports;
var Ku;
function xo() {
  return Ku || (Ku = 1, (function(e, r) {
    var t = Th(), a = r && !r.nodeType && r, n = a && !0 && e && !e.nodeType && e, i = n && n.exports === a, o = i && t.process, s = (function() {
      try {
        var u = n && n.require && n.require("util").types;
        return u || o && o.binding && o.binding("util");
      } catch {
      }
    })();
    e.exports = s;
  })(Ze, Ze.exports)), Ze.exports;
}
var Vt, Hu;
function dr() {
  if (Hu) return Vt;
  Hu = 1;
  var e = Qv(), r = kr(), t = xo(), a = t && t.isTypedArray, n = a ? r(a) : e;
  return Vt = n, Vt;
}
var Wt, Vu;
function Ph() {
  if (Vu) return Wt;
  Vu = 1;
  var e = Jv(), r = lr(), t = ne(), a = Ke(), n = Er(), i = dr(), o = Object.prototype, s = o.hasOwnProperty;
  function u(c, l) {
    var d = t(c), h = !d && r(c), p = !d && !h && a(c), N = !d && !h && !p && i(c), y = d || h || p || N, g = y ? e(c.length, String) : [], m = g.length;
    for (var v in c)
      (l || s.call(c, v)) && !(y && // Safari 9 has enumerable `arguments.length` in strict mode.
      (v == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
      p && (v == "offset" || v == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
      N && (v == "buffer" || v == "byteLength" || v == "byteOffset") || // Skip index properties.
      n(v, m))) && g.push(v);
    return g;
  }
  return Wt = u, Wt;
}
var Yt, Wu;
function Ar() {
  if (Wu) return Yt;
  Wu = 1;
  var e = Object.prototype;
  function r(t) {
    var a = t && t.constructor, n = typeof a == "function" && a.prototype || e;
    return t === n;
  }
  return Yt = r, Yt;
}
var Jt, Yu;
function Lh() {
  if (Yu) return Jt;
  Yu = 1;
  function e(r, t) {
    return function(a) {
      return r(t(a));
    };
  }
  return Jt = e, Jt;
}
var Zt, Ju;
function em() {
  if (Ju) return Zt;
  Ju = 1;
  var e = Lh(), r = e(Object.keys, Object);
  return Zt = r, Zt;
}
var Xt, Zu;
function _o() {
  if (Zu) return Xt;
  Zu = 1;
  var e = Ar(), r = em(), t = Object.prototype, a = t.hasOwnProperty;
  function n(i) {
    if (!e(i))
      return r(i);
    var o = [];
    for (var s in Object(i))
      a.call(i, s) && s != "constructor" && o.push(s);
    return o;
  }
  return Xt = n, Xt;
}
var Qt, Xu;
function Re() {
  if (Xu) return Qt;
  Xu = 1;
  var e = ur(), r = yo();
  function t(a) {
    return a != null && r(a.length) && !e(a);
  }
  return Qt = t, Qt;
}
var en, Qu;
function Oe() {
  if (Qu) return en;
  Qu = 1;
  var e = Ph(), r = _o(), t = Re();
  function a(n) {
    return t(n) ? e(n) : r(n);
  }
  return en = a, en;
}
var rn, ec;
function rm() {
  if (ec) return rn;
  ec = 1;
  var e = cr(), r = Oe();
  function t(a, n) {
    return a && e(n, r(n), a);
  }
  return rn = t, rn;
}
var tn, rc;
function tm() {
  if (rc) return tn;
  rc = 1;
  function e(r) {
    var t = [];
    if (r != null)
      for (var a in Object(r))
        t.push(a);
    return t;
  }
  return tn = e, tn;
}
var nn, tc;
function nm() {
  if (tc) return nn;
  tc = 1;
  var e = me(), r = Ar(), t = tm(), a = Object.prototype, n = a.hasOwnProperty;
  function i(o) {
    if (!e(o))
      return t(o);
    var s = r(o), u = [];
    for (var c in o)
      c == "constructor" && (s || !n.call(o, c)) || u.push(c);
    return u;
  }
  return nn = i, nn;
}
var an, nc;
function De() {
  if (nc) return an;
  nc = 1;
  var e = Ph(), r = nm(), t = Re();
  function a(n) {
    return t(n) ? e(n, !0) : r(n);
  }
  return an = a, an;
}
var sn, ac;
function am() {
  if (ac) return sn;
  ac = 1;
  var e = cr(), r = De();
  function t(a, n) {
    return a && e(n, r(n), a);
  }
  return sn = t, sn;
}
var Xe = { exports: {} };
Xe.exports;
var ic;
function jh() {
  return ic || (ic = 1, (function(e, r) {
    var t = _e(), a = r && !r.nodeType && r, n = a && !0 && e && !e.nodeType && e, i = n && n.exports === a, o = i ? t.Buffer : void 0, s = o ? o.allocUnsafe : void 0;
    function u(c, l) {
      if (l)
        return c.slice();
      var d = c.length, h = s ? s(d) : new c.constructor(d);
      return c.copy(h), h;
    }
    e.exports = u;
  })(Xe, Xe.exports)), Xe.exports;
}
var on, sc;
function Dh() {
  if (sc) return on;
  sc = 1;
  function e(r, t) {
    var a = -1, n = r.length;
    for (t || (t = Array(n)); ++a < n; )
      t[a] = r[a];
    return t;
  }
  return on = e, on;
}
var un, oc;
function Fh() {
  if (oc) return un;
  oc = 1;
  function e(r, t) {
    for (var a = -1, n = r == null ? 0 : r.length, i = 0, o = []; ++a < n; ) {
      var s = r[a];
      t(s, a, r) && (o[i++] = s);
    }
    return o;
  }
  return un = e, un;
}
var cn, uc;
function Gh() {
  if (uc) return cn;
  uc = 1;
  function e() {
    return [];
  }
  return cn = e, cn;
}
var ln, cc;
function wo() {
  if (cc) return ln;
  cc = 1;
  var e = Fh(), r = Gh(), t = Object.prototype, a = t.propertyIsEnumerable, n = Object.getOwnPropertySymbols, i = n ? function(o) {
    return o == null ? [] : (o = Object(o), e(n(o), function(s) {
      return a.call(o, s);
    }));
  } : r;
  return ln = i, ln;
}
var dn, lc;
function im() {
  if (lc) return dn;
  lc = 1;
  var e = cr(), r = wo();
  function t(a, n) {
    return e(a, r(a), n);
  }
  return dn = t, dn;
}
var fn, dc;
function No() {
  if (dc) return fn;
  dc = 1;
  function e(r, t) {
    for (var a = -1, n = t.length, i = r.length; ++a < n; )
      r[i + a] = t[a];
    return r;
  }
  return fn = e, fn;
}
var hn, fc;
function Tr() {
  if (fc) return hn;
  fc = 1;
  var e = Lh(), r = e(Object.getPrototypeOf, Object);
  return hn = r, hn;
}
var pn, hc;
function zh() {
  if (hc) return pn;
  hc = 1;
  var e = No(), r = Tr(), t = wo(), a = Gh(), n = Object.getOwnPropertySymbols, i = n ? function(o) {
    for (var s = []; o; )
      e(s, t(o)), o = r(o);
    return s;
  } : a;
  return pn = i, pn;
}
var vn, pc;
function sm() {
  if (pc) return vn;
  pc = 1;
  var e = cr(), r = zh();
  function t(a, n) {
    return e(a, r(a), n);
  }
  return vn = t, vn;
}
var mn, vc;
function Bh() {
  if (vc) return mn;
  vc = 1;
  var e = No(), r = ne();
  function t(a, n, i) {
    var o = n(a);
    return r(a) ? o : e(o, i(a));
  }
  return mn = t, mn;
}
var bn, mc;
function Uh() {
  if (mc) return bn;
  mc = 1;
  var e = Bh(), r = wo(), t = Oe();
  function a(n) {
    return e(n, t, r);
  }
  return bn = a, bn;
}
var gn, bc;
function om() {
  if (bc) return gn;
  bc = 1;
  var e = Bh(), r = zh(), t = De();
  function a(n) {
    return e(n, t, r);
  }
  return gn = a, gn;
}
var yn, gc;
function um() {
  if (gc) return yn;
  gc = 1;
  var e = je(), r = _e(), t = e(r, "DataView");
  return yn = t, yn;
}
var xn, yc;
function cm() {
  if (yc) return xn;
  yc = 1;
  var e = je(), r = _e(), t = e(r, "Promise");
  return xn = t, xn;
}
var _n, xc;
function $h() {
  if (xc) return _n;
  xc = 1;
  var e = je(), r = _e(), t = e(r, "Set");
  return _n = t, _n;
}
var wn, _c;
function lm() {
  if (_c) return wn;
  _c = 1;
  var e = je(), r = _e(), t = e(r, "WeakMap");
  return wn = t, wn;
}
var Nn, wc;
function He() {
  if (wc) return Nn;
  wc = 1;
  var e = um(), r = mo(), t = cm(), a = $h(), n = lm(), i = Le(), o = Oh(), s = "[object Map]", u = "[object Object]", c = "[object Promise]", l = "[object Set]", d = "[object WeakMap]", h = "[object DataView]", p = o(e), N = o(r), y = o(t), g = o(a), m = o(n), v = i;
  return (e && v(new e(new ArrayBuffer(1))) != h || r && v(new r()) != s || t && v(t.resolve()) != c || a && v(new a()) != l || n && v(new n()) != d) && (v = function(b) {
    var _ = i(b), x = _ == u ? b.constructor : void 0, q = x ? o(x) : "";
    if (q)
      switch (q) {
        case p:
          return h;
        case N:
          return s;
        case y:
          return c;
        case g:
          return l;
        case m:
          return d;
      }
    return _;
  }), Nn = v, Nn;
}
var qn, Nc;
function dm() {
  if (Nc) return qn;
  Nc = 1;
  var e = Object.prototype, r = e.hasOwnProperty;
  function t(a) {
    var n = a.length, i = new a.constructor(n);
    return n && typeof a[0] == "string" && r.call(a, "index") && (i.index = a.index, i.input = a.input), i;
  }
  return qn = t, qn;
}
var In, qc;
function Kh() {
  if (qc) return In;
  qc = 1;
  var e = _e(), r = e.Uint8Array;
  return In = r, In;
}
var Cn, Ic;
function qo() {
  if (Ic) return Cn;
  Ic = 1;
  var e = Kh();
  function r(t) {
    var a = new t.constructor(t.byteLength);
    return new e(a).set(new e(t)), a;
  }
  return Cn = r, Cn;
}
var Rn, Cc;
function fm() {
  if (Cc) return Rn;
  Cc = 1;
  var e = qo();
  function r(t, a) {
    var n = a ? e(t.buffer) : t.buffer;
    return new t.constructor(n, t.byteOffset, t.byteLength);
  }
  return Rn = r, Rn;
}
var Sn, Rc;
function hm() {
  if (Rc) return Sn;
  Rc = 1;
  var e = /\w*$/;
  function r(t) {
    var a = new t.constructor(t.source, e.exec(t));
    return a.lastIndex = t.lastIndex, a;
  }
  return Sn = r, Sn;
}
var En, Sc;
function pm() {
  if (Sc) return En;
  Sc = 1;
  var e = $e(), r = e ? e.prototype : void 0, t = r ? r.valueOf : void 0;
  function a(n) {
    return t ? Object(t.call(n)) : {};
  }
  return En = a, En;
}
var kn, Ec;
function Hh() {
  if (Ec) return kn;
  Ec = 1;
  var e = qo();
  function r(t, a) {
    var n = a ? e(t.buffer) : t.buffer;
    return new t.constructor(n, t.byteOffset, t.length);
  }
  return kn = r, kn;
}
var An, kc;
function vm() {
  if (kc) return An;
  kc = 1;
  var e = qo(), r = fm(), t = hm(), a = pm(), n = Hh(), i = "[object Boolean]", o = "[object Date]", s = "[object Map]", u = "[object Number]", c = "[object RegExp]", l = "[object Set]", d = "[object String]", h = "[object Symbol]", p = "[object ArrayBuffer]", N = "[object DataView]", y = "[object Float32Array]", g = "[object Float64Array]", m = "[object Int8Array]", v = "[object Int16Array]", b = "[object Int32Array]", _ = "[object Uint8Array]", x = "[object Uint8ClampedArray]", q = "[object Uint16Array]", C = "[object Uint32Array]";
  function R(I, S, A) {
    var M = I.constructor;
    switch (S) {
      case p:
        return e(I);
      case i:
      case o:
        return new M(+I);
      case N:
        return r(I, A);
      case y:
      case g:
      case m:
      case v:
      case b:
      case _:
      case x:
      case q:
      case C:
        return n(I, A);
      case s:
        return new M();
      case u:
      case d:
        return new M(I);
      case c:
        return t(I);
      case l:
        return new M();
      case h:
        return a(I);
    }
  }
  return An = R, An;
}
var Tn, Ac;
function Vh() {
  if (Ac) return Tn;
  Ac = 1;
  var e = me(), r = Object.create, t = /* @__PURE__ */ (function() {
    function a() {
    }
    return function(n) {
      if (!e(n))
        return {};
      if (r)
        return r(n);
      a.prototype = n;
      var i = new a();
      return a.prototype = void 0, i;
    };
  })();
  return Tn = t, Tn;
}
var On, Tc;
function Wh() {
  if (Tc) return On;
  Tc = 1;
  var e = Vh(), r = Tr(), t = Ar();
  function a(n) {
    return typeof n.constructor == "function" && !t(n) ? e(r(n)) : {};
  }
  return On = a, On;
}
var Mn, Oc;
function mm() {
  if (Oc) return Mn;
  Oc = 1;
  var e = He(), r = Ne(), t = "[object Map]";
  function a(n) {
    return r(n) && e(n) == t;
  }
  return Mn = a, Mn;
}
var Pn, Mc;
function bm() {
  if (Mc) return Pn;
  Mc = 1;
  var e = mm(), r = kr(), t = xo(), a = t && t.isMap, n = a ? r(a) : e;
  return Pn = n, Pn;
}
var Ln, Pc;
function gm() {
  if (Pc) return Ln;
  Pc = 1;
  var e = He(), r = Ne(), t = "[object Set]";
  function a(n) {
    return r(n) && e(n) == t;
  }
  return Ln = a, Ln;
}
var jn, Lc;
function ym() {
  if (Lc) return jn;
  Lc = 1;
  var e = gm(), r = kr(), t = xo(), a = t && t.isSet, n = a ? r(a) : e;
  return jn = n, jn;
}
var Dn, jc;
function Yh() {
  if (jc) return Dn;
  jc = 1;
  var e = Cr(), r = go(), t = Sr(), a = rm(), n = am(), i = jh(), o = Dh(), s = im(), u = sm(), c = Uh(), l = om(), d = He(), h = dm(), p = vm(), N = Wh(), y = ne(), g = Ke(), m = bm(), v = me(), b = ym(), _ = Oe(), x = De(), q = 1, C = 2, R = 4, I = "[object Arguments]", S = "[object Array]", A = "[object Boolean]", M = "[object Date]", D = "[object Error]", B = "[object Function]", $ = "[object GeneratorFunction]", X = "[object Map]", O = "[object Number]", j = "[object Object]", L = "[object RegExp]", U = "[object Set]", ie = "[object String]", le = "[object Symbol]", te = "[object WeakMap]", E = "[object ArrayBuffer]", k = "[object DataView]", T = "[object Float32Array]", P = "[object Float64Array]", H = "[object Int8Array]", Z = "[object Int16Array]", ee = "[object Int32Array]", ue = "[object Uint8Array]", Ge = "[object Uint8ClampedArray]", ce = "[object Uint16Array]", se = "[object Uint32Array]", V = {};
  V[I] = V[S] = V[E] = V[k] = V[A] = V[M] = V[T] = V[P] = V[H] = V[Z] = V[ee] = V[X] = V[O] = V[j] = V[L] = V[U] = V[ie] = V[le] = V[ue] = V[Ge] = V[ce] = V[se] = !0, V[D] = V[B] = V[te] = !1;
  function qe(W, Ee, ke, Fr, ze, F) {
    var G, J = Ee & q, Y = Ee & C, re = Ee & R;
    if (ke && (G = ze ? ke(W, Fr, ze, F) : ke(W)), G !== void 0)
      return G;
    if (!v(W))
      return W;
    var ge = y(W);
    if (ge) {
      if (G = h(W), !J)
        return o(W, G);
    } else {
      var Ie = d(W), Be = Ie == B || Ie == $;
      if (g(W))
        return i(W, J);
      if (Ie == j || Ie == I || Be && !ze) {
        if (G = Y || Be ? {} : N(W), !J)
          return Y ? u(W, n(G, W)) : s(W, a(G, W));
      } else {
        if (!V[Ie])
          return ze ? W : {};
        G = p(W, Ie, J);
      }
    }
    F || (F = new e());
    var ye = F.get(W);
    if (ye)
      return ye;
    F.set(W, G), b(W) ? W.forEach(function(ae) {
      G.add(qe(ae, Ee, ke, ae, W, F));
    }) : m(W) && W.forEach(function(ae, Me) {
      G.set(Me, qe(ae, Ee, ke, Me, W, F));
    });
    var Gr = re ? Y ? l : c : Y ? x : _, Ae = ge ? void 0 : Gr(W);
    return r(Ae || W, function(ae, Me) {
      Ae && (Me = ae, ae = W[Me]), t(G, Me, qe(ae, Ee, ke, Me, W, F));
    }), G;
  }
  return Dn = qe, Dn;
}
var Fn, Dc;
function xm() {
  if (Dc) return Fn;
  Dc = 1;
  var e = Yh(), r = 4;
  function t(a) {
    return e(a, r);
  }
  return Fn = t, Fn;
}
var Gn, Fc;
function Io() {
  if (Fc) return Gn;
  Fc = 1;
  function e(r) {
    return function() {
      return r;
    };
  }
  return Gn = e, Gn;
}
var zn, Gc;
function _m() {
  if (Gc) return zn;
  Gc = 1;
  function e(r) {
    return function(t, a, n) {
      for (var i = -1, o = Object(t), s = n(t), u = s.length; u--; ) {
        var c = s[r ? u : ++i];
        if (a(o[c], c, o) === !1)
          break;
      }
      return t;
    };
  }
  return zn = e, zn;
}
var Bn, zc;
function Co() {
  if (zc) return Bn;
  zc = 1;
  var e = _m(), r = e();
  return Bn = r, Bn;
}
var Un, Bc;
function Ro() {
  if (Bc) return Un;
  Bc = 1;
  var e = Co(), r = Oe();
  function t(a, n) {
    return a && e(a, n, r);
  }
  return Un = t, Un;
}
var $n, Uc;
function wm() {
  if (Uc) return $n;
  Uc = 1;
  var e = Re();
  function r(t, a) {
    return function(n, i) {
      if (n == null)
        return n;
      if (!e(n))
        return t(n, i);
      for (var o = n.length, s = a ? o : -1, u = Object(n); (a ? s-- : ++s < o) && i(u[s], s, u) !== !1; )
        ;
      return n;
    };
  }
  return $n = r, $n;
}
var Kn, $c;
function Or() {
  if ($c) return Kn;
  $c = 1;
  var e = Ro(), r = wm(), t = r(e);
  return Kn = t, Kn;
}
var Hn, Kc;
function Fe() {
  if (Kc) return Hn;
  Kc = 1;
  function e(r) {
    return r;
  }
  return Hn = e, Hn;
}
var Vn, Hc;
function Jh() {
  if (Hc) return Vn;
  Hc = 1;
  var e = Fe();
  function r(t) {
    return typeof t == "function" ? t : e;
  }
  return Vn = r, Vn;
}
var Wn, Vc;
function Zh() {
  if (Vc) return Wn;
  Vc = 1;
  var e = go(), r = Or(), t = Jh(), a = ne();
  function n(i, o) {
    var s = a(i) ? e : r;
    return s(i, t(o));
  }
  return Wn = n, Wn;
}
var Yn, Wc;
function Xh() {
  return Wc || (Wc = 1, Yn = Zh()), Yn;
}
var Jn, Yc;
function Nm() {
  if (Yc) return Jn;
  Yc = 1;
  var e = Or();
  function r(t, a) {
    var n = [];
    return e(t, function(i, o, s) {
      a(i, o, s) && n.push(i);
    }), n;
  }
  return Jn = r, Jn;
}
var Zn, Jc;
function qm() {
  if (Jc) return Zn;
  Jc = 1;
  var e = "__lodash_hash_undefined__";
  function r(t) {
    return this.__data__.set(t, e), this;
  }
  return Zn = r, Zn;
}
var Xn, Zc;
function Im() {
  if (Zc) return Xn;
  Zc = 1;
  function e(r) {
    return this.__data__.has(r);
  }
  return Xn = e, Xn;
}
var Qn, Xc;
function Qh() {
  if (Xc) return Qn;
  Xc = 1;
  var e = bo(), r = qm(), t = Im();
  function a(n) {
    var i = -1, o = n == null ? 0 : n.length;
    for (this.__data__ = new e(); ++i < o; )
      this.add(n[i]);
  }
  return a.prototype.add = a.prototype.push = r, a.prototype.has = t, Qn = a, Qn;
}
var ea, Qc;
function Cm() {
  if (Qc) return ea;
  Qc = 1;
  function e(r, t) {
    for (var a = -1, n = r == null ? 0 : r.length; ++a < n; )
      if (t(r[a], a, r))
        return !0;
    return !1;
  }
  return ea = e, ea;
}
var ra, el;
function e0() {
  if (el) return ra;
  el = 1;
  function e(r, t) {
    return r.has(t);
  }
  return ra = e, ra;
}
var ta, rl;
function r0() {
  if (rl) return ta;
  rl = 1;
  var e = Qh(), r = Cm(), t = e0(), a = 1, n = 2;
  function i(o, s, u, c, l, d) {
    var h = u & a, p = o.length, N = s.length;
    if (p != N && !(h && N > p))
      return !1;
    var y = d.get(o), g = d.get(s);
    if (y && g)
      return y == s && g == o;
    var m = -1, v = !0, b = u & n ? new e() : void 0;
    for (d.set(o, s), d.set(s, o); ++m < p; ) {
      var _ = o[m], x = s[m];
      if (c)
        var q = h ? c(x, _, m, s, o, d) : c(_, x, m, o, s, d);
      if (q !== void 0) {
        if (q)
          continue;
        v = !1;
        break;
      }
      if (b) {
        if (!r(s, function(C, R) {
          if (!t(b, R) && (_ === C || l(_, C, u, c, d)))
            return b.push(R);
        })) {
          v = !1;
          break;
        }
      } else if (!(_ === x || l(_, x, u, c, d))) {
        v = !1;
        break;
      }
    }
    return d.delete(o), d.delete(s), v;
  }
  return ta = i, ta;
}
var na, tl;
function Rm() {
  if (tl) return na;
  tl = 1;
  function e(r) {
    var t = -1, a = Array(r.size);
    return r.forEach(function(n, i) {
      a[++t] = [i, n];
    }), a;
  }
  return na = e, na;
}
var aa, nl;
function So() {
  if (nl) return aa;
  nl = 1;
  function e(r) {
    var t = -1, a = Array(r.size);
    return r.forEach(function(n) {
      a[++t] = n;
    }), a;
  }
  return aa = e, aa;
}
var ia, al;
function Sm() {
  if (al) return ia;
  al = 1;
  var e = $e(), r = Kh(), t = Ue(), a = r0(), n = Rm(), i = So(), o = 1, s = 2, u = "[object Boolean]", c = "[object Date]", l = "[object Error]", d = "[object Map]", h = "[object Number]", p = "[object RegExp]", N = "[object Set]", y = "[object String]", g = "[object Symbol]", m = "[object ArrayBuffer]", v = "[object DataView]", b = e ? e.prototype : void 0, _ = b ? b.valueOf : void 0;
  function x(q, C, R, I, S, A, M) {
    switch (R) {
      case v:
        if (q.byteLength != C.byteLength || q.byteOffset != C.byteOffset)
          return !1;
        q = q.buffer, C = C.buffer;
      case m:
        return !(q.byteLength != C.byteLength || !A(new r(q), new r(C)));
      case u:
      case c:
      case h:
        return t(+q, +C);
      case l:
        return q.name == C.name && q.message == C.message;
      case p:
      case y:
        return q == C + "";
      case d:
        var D = n;
      case N:
        var B = I & o;
        if (D || (D = i), q.size != C.size && !B)
          return !1;
        var $ = M.get(q);
        if ($)
          return $ == C;
        I |= s, M.set(q, C);
        var X = a(D(q), D(C), I, S, A, M);
        return M.delete(q), X;
      case g:
        if (_)
          return _.call(q) == _.call(C);
    }
    return !1;
  }
  return ia = x, ia;
}
var sa, il;
function Em() {
  if (il) return sa;
  il = 1;
  var e = Uh(), r = 1, t = Object.prototype, a = t.hasOwnProperty;
  function n(i, o, s, u, c, l) {
    var d = s & r, h = e(i), p = h.length, N = e(o), y = N.length;
    if (p != y && !d)
      return !1;
    for (var g = p; g--; ) {
      var m = h[g];
      if (!(d ? m in o : a.call(o, m)))
        return !1;
    }
    var v = l.get(i), b = l.get(o);
    if (v && b)
      return v == o && b == i;
    var _ = !0;
    l.set(i, o), l.set(o, i);
    for (var x = d; ++g < p; ) {
      m = h[g];
      var q = i[m], C = o[m];
      if (u)
        var R = d ? u(C, q, m, o, i, l) : u(q, C, m, i, o, l);
      if (!(R === void 0 ? q === C || c(q, C, s, u, l) : R)) {
        _ = !1;
        break;
      }
      x || (x = m == "constructor");
    }
    if (_ && !x) {
      var I = i.constructor, S = o.constructor;
      I != S && "constructor" in i && "constructor" in o && !(typeof I == "function" && I instanceof I && typeof S == "function" && S instanceof S) && (_ = !1);
    }
    return l.delete(i), l.delete(o), _;
  }
  return sa = n, sa;
}
var oa, sl;
function km() {
  if (sl) return oa;
  sl = 1;
  var e = Cr(), r = r0(), t = Sm(), a = Em(), n = He(), i = ne(), o = Ke(), s = dr(), u = 1, c = "[object Arguments]", l = "[object Array]", d = "[object Object]", h = Object.prototype, p = h.hasOwnProperty;
  function N(y, g, m, v, b, _) {
    var x = i(y), q = i(g), C = x ? l : n(y), R = q ? l : n(g);
    C = C == c ? d : C, R = R == c ? d : R;
    var I = C == d, S = R == d, A = C == R;
    if (A && o(y)) {
      if (!o(g))
        return !1;
      x = !0, I = !1;
    }
    if (A && !I)
      return _ || (_ = new e()), x || s(y) ? r(y, g, m, v, b, _) : t(y, g, C, m, v, b, _);
    if (!(m & u)) {
      var M = I && p.call(y, "__wrapped__"), D = S && p.call(g, "__wrapped__");
      if (M || D) {
        var B = M ? y.value() : y, $ = D ? g.value() : g;
        return _ || (_ = new e()), b(B, $, m, v, _);
      }
    }
    return A ? (_ || (_ = new e()), a(y, g, m, v, b, _)) : !1;
  }
  return oa = N, oa;
}
var ua, ol;
function t0() {
  if (ol) return ua;
  ol = 1;
  var e = km(), r = Ne();
  function t(a, n, i, o, s) {
    return a === n ? !0 : a == null || n == null || !r(a) && !r(n) ? a !== a && n !== n : e(a, n, i, o, t, s);
  }
  return ua = t, ua;
}
var ca, ul;
function Am() {
  if (ul) return ca;
  ul = 1;
  var e = Cr(), r = t0(), t = 1, a = 2;
  function n(i, o, s, u) {
    var c = s.length, l = c, d = !u;
    if (i == null)
      return !l;
    for (i = Object(i); c--; ) {
      var h = s[c];
      if (d && h[2] ? h[1] !== i[h[0]] : !(h[0] in i))
        return !1;
    }
    for (; ++c < l; ) {
      h = s[c];
      var p = h[0], N = i[p], y = h[1];
      if (d && h[2]) {
        if (N === void 0 && !(p in i))
          return !1;
      } else {
        var g = new e();
        if (u)
          var m = u(N, y, p, i, o, g);
        if (!(m === void 0 ? r(y, N, t | a, u, g) : m))
          return !1;
      }
    }
    return !0;
  }
  return ca = n, ca;
}
var la, cl;
function n0() {
  if (cl) return la;
  cl = 1;
  var e = me();
  function r(t) {
    return t === t && !e(t);
  }
  return la = r, la;
}
var da, ll;
function Tm() {
  if (ll) return da;
  ll = 1;
  var e = n0(), r = Oe();
  function t(a) {
    for (var n = r(a), i = n.length; i--; ) {
      var o = n[i], s = a[o];
      n[i] = [o, s, e(s)];
    }
    return n;
  }
  return da = t, da;
}
var fa, dl;
function a0() {
  if (dl) return fa;
  dl = 1;
  function e(r, t) {
    return function(a) {
      return a == null ? !1 : a[r] === t && (t !== void 0 || r in Object(a));
    };
  }
  return fa = e, fa;
}
var ha, fl;
function Om() {
  if (fl) return ha;
  fl = 1;
  var e = Am(), r = Tm(), t = a0();
  function a(n) {
    var i = r(n);
    return i.length == 1 && i[0][2] ? t(i[0][0], i[0][1]) : function(o) {
      return o === n || e(o, n, i);
    };
  }
  return ha = a, ha;
}
var pa, hl;
function Ve() {
  if (hl) return pa;
  hl = 1;
  var e = Le(), r = Ne(), t = "[object Symbol]";
  function a(n) {
    return typeof n == "symbol" || r(n) && e(n) == t;
  }
  return pa = a, pa;
}
var va, pl;
function Eo() {
  if (pl) return va;
  pl = 1;
  var e = ne(), r = Ve(), t = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, a = /^\w*$/;
  function n(i, o) {
    if (e(i))
      return !1;
    var s = typeof i;
    return s == "number" || s == "symbol" || s == "boolean" || i == null || r(i) ? !0 : a.test(i) || !t.test(i) || o != null && i in Object(o);
  }
  return va = n, va;
}
var ma, vl;
function Mm() {
  if (vl) return ma;
  vl = 1;
  var e = bo(), r = "Expected a function";
  function t(a, n) {
    if (typeof a != "function" || n != null && typeof n != "function")
      throw new TypeError(r);
    var i = function() {
      var o = arguments, s = n ? n.apply(this, o) : o[0], u = i.cache;
      if (u.has(s))
        return u.get(s);
      var c = a.apply(this, o);
      return i.cache = u.set(s, c) || u, c;
    };
    return i.cache = new (t.Cache || e)(), i;
  }
  return t.Cache = e, ma = t, ma;
}
var ba, ml;
function Pm() {
  if (ml) return ba;
  ml = 1;
  var e = Mm(), r = 500;
  function t(a) {
    var n = e(a, function(o) {
      return i.size === r && i.clear(), o;
    }), i = n.cache;
    return n;
  }
  return ba = t, ba;
}
var ga, bl;
function Lm() {
  if (bl) return ga;
  bl = 1;
  var e = Pm(), r = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, t = /\\(\\)?/g, a = e(function(n) {
    var i = [];
    return n.charCodeAt(0) === 46 && i.push(""), n.replace(r, function(o, s, u, c) {
      i.push(u ? c.replace(t, "$1") : s || o);
    }), i;
  });
  return ga = a, ga;
}
var ya, gl;
function Mr() {
  if (gl) return ya;
  gl = 1;
  function e(r, t) {
    for (var a = -1, n = r == null ? 0 : r.length, i = Array(n); ++a < n; )
      i[a] = t(r[a], a, r);
    return i;
  }
  return ya = e, ya;
}
var xa, yl;
function jm() {
  if (yl) return xa;
  yl = 1;
  var e = $e(), r = Mr(), t = ne(), a = Ve(), n = e ? e.prototype : void 0, i = n ? n.toString : void 0;
  function o(s) {
    if (typeof s == "string")
      return s;
    if (t(s))
      return r(s, o) + "";
    if (a(s))
      return i ? i.call(s) : "";
    var u = s + "";
    return u == "0" && 1 / s == -1 / 0 ? "-0" : u;
  }
  return xa = o, xa;
}
var _a, xl;
function i0() {
  if (xl) return _a;
  xl = 1;
  var e = jm();
  function r(t) {
    return t == null ? "" : e(t);
  }
  return _a = r, _a;
}
var wa, _l;
function Pr() {
  if (_l) return wa;
  _l = 1;
  var e = ne(), r = Eo(), t = Lm(), a = i0();
  function n(i, o) {
    return e(i) ? i : r(i, o) ? [i] : t(a(i));
  }
  return wa = n, wa;
}
var Na, wl;
function fr() {
  if (wl) return Na;
  wl = 1;
  var e = Ve();
  function r(t) {
    if (typeof t == "string" || e(t))
      return t;
    var a = t + "";
    return a == "0" && 1 / t == -1 / 0 ? "-0" : a;
  }
  return Na = r, Na;
}
var qa, Nl;
function Lr() {
  if (Nl) return qa;
  Nl = 1;
  var e = Pr(), r = fr();
  function t(a, n) {
    n = e(n, a);
    for (var i = 0, o = n.length; a != null && i < o; )
      a = a[r(n[i++])];
    return i && i == o ? a : void 0;
  }
  return qa = t, qa;
}
var Ia, ql;
function Dm() {
  if (ql) return Ia;
  ql = 1;
  var e = Lr();
  function r(t, a, n) {
    var i = t == null ? void 0 : e(t, a);
    return i === void 0 ? n : i;
  }
  return Ia = r, Ia;
}
var Ca, Il;
function Fm() {
  if (Il) return Ca;
  Il = 1;
  function e(r, t) {
    return r != null && t in Object(r);
  }
  return Ca = e, Ca;
}
var Ra, Cl;
function s0() {
  if (Cl) return Ra;
  Cl = 1;
  var e = Pr(), r = lr(), t = ne(), a = Er(), n = yo(), i = fr();
  function o(s, u, c) {
    u = e(u, s);
    for (var l = -1, d = u.length, h = !1; ++l < d; ) {
      var p = i(u[l]);
      if (!(h = s != null && c(s, p)))
        break;
      s = s[p];
    }
    return h || ++l != d ? h : (d = s == null ? 0 : s.length, !!d && n(d) && a(p, d) && (t(s) || r(s)));
  }
  return Ra = o, Ra;
}
var Sa, Rl;
function o0() {
  if (Rl) return Sa;
  Rl = 1;
  var e = Fm(), r = s0();
  function t(a, n) {
    return a != null && r(a, n, e);
  }
  return Sa = t, Sa;
}
var Ea, Sl;
function Gm() {
  if (Sl) return Ea;
  Sl = 1;
  var e = t0(), r = Dm(), t = o0(), a = Eo(), n = n0(), i = a0(), o = fr(), s = 1, u = 2;
  function c(l, d) {
    return a(l) && n(d) ? i(o(l), d) : function(h) {
      var p = r(h, l);
      return p === void 0 && p === d ? t(h, l) : e(d, p, s | u);
    };
  }
  return Ea = c, Ea;
}
var ka, El;
function u0() {
  if (El) return ka;
  El = 1;
  function e(r) {
    return function(t) {
      return t == null ? void 0 : t[r];
    };
  }
  return ka = e, ka;
}
var Aa, kl;
function zm() {
  if (kl) return Aa;
  kl = 1;
  var e = Lr();
  function r(t) {
    return function(a) {
      return e(a, t);
    };
  }
  return Aa = r, Aa;
}
var Ta, Al;
function Bm() {
  if (Al) return Ta;
  Al = 1;
  var e = u0(), r = zm(), t = Eo(), a = fr();
  function n(i) {
    return t(i) ? e(a(i)) : r(i);
  }
  return Ta = n, Ta;
}
var Oa, Tl;
function Se() {
  if (Tl) return Oa;
  Tl = 1;
  var e = Om(), r = Gm(), t = Fe(), a = ne(), n = Bm();
  function i(o) {
    return typeof o == "function" ? o : o == null ? t : typeof o == "object" ? a(o) ? r(o[0], o[1]) : e(o) : n(o);
  }
  return Oa = i, Oa;
}
var Ma, Ol;
function c0() {
  if (Ol) return Ma;
  Ol = 1;
  var e = Fh(), r = Nm(), t = Se(), a = ne();
  function n(i, o) {
    var s = a(i) ? e : r;
    return s(i, t(o, 3));
  }
  return Ma = n, Ma;
}
var Pa, Ml;
function Um() {
  if (Ml) return Pa;
  Ml = 1;
  var e = Object.prototype, r = e.hasOwnProperty;
  function t(a, n) {
    return a != null && r.call(a, n);
  }
  return Pa = t, Pa;
}
var La, Pl;
function l0() {
  if (Pl) return La;
  Pl = 1;
  var e = Um(), r = s0();
  function t(a, n) {
    return a != null && r(a, n, e);
  }
  return La = t, La;
}
var ja, Ll;
function $m() {
  if (Ll) return ja;
  Ll = 1;
  var e = _o(), r = He(), t = lr(), a = ne(), n = Re(), i = Ke(), o = Ar(), s = dr(), u = "[object Map]", c = "[object Set]", l = Object.prototype, d = l.hasOwnProperty;
  function h(p) {
    if (p == null)
      return !0;
    if (n(p) && (a(p) || typeof p == "string" || typeof p.splice == "function" || i(p) || s(p) || t(p)))
      return !p.length;
    var N = r(p);
    if (N == u || N == c)
      return !p.size;
    if (o(p))
      return !e(p).length;
    for (var y in p)
      if (d.call(p, y))
        return !1;
    return !0;
  }
  return ja = h, ja;
}
var Da, jl;
function d0() {
  if (jl) return Da;
  jl = 1;
  function e(r) {
    return r === void 0;
  }
  return Da = e, Da;
}
var Fa, Dl;
function f0() {
  if (Dl) return Fa;
  Dl = 1;
  var e = Or(), r = Re();
  function t(a, n) {
    var i = -1, o = r(a) ? Array(a.length) : [];
    return e(a, function(s, u, c) {
      o[++i] = n(s, u, c);
    }), o;
  }
  return Fa = t, Fa;
}
var Ga, Fl;
function h0() {
  if (Fl) return Ga;
  Fl = 1;
  var e = Mr(), r = Se(), t = f0(), a = ne();
  function n(i, o) {
    var s = a(i) ? e : t;
    return s(i, r(o, 3));
  }
  return Ga = n, Ga;
}
var za, Gl;
function Km() {
  if (Gl) return za;
  Gl = 1;
  function e(r, t, a, n) {
    var i = -1, o = r == null ? 0 : r.length;
    for (n && o && (a = r[++i]); ++i < o; )
      a = t(a, r[i], i, r);
    return a;
  }
  return za = e, za;
}
var Ba, zl;
function Hm() {
  if (zl) return Ba;
  zl = 1;
  function e(r, t, a, n, i) {
    return i(r, function(o, s, u) {
      a = n ? (n = !1, o) : t(a, o, s, u);
    }), a;
  }
  return Ba = e, Ba;
}
var Ua, Bl;
function p0() {
  if (Bl) return Ua;
  Bl = 1;
  var e = Km(), r = Or(), t = Se(), a = Hm(), n = ne();
  function i(o, s, u) {
    var c = n(o) ? e : a, l = arguments.length < 3;
    return c(o, t(s, 4), u, l, r);
  }
  return Ua = i, Ua;
}
var $a, Ul;
function Vm() {
  if (Ul) return $a;
  Ul = 1;
  var e = Le(), r = ne(), t = Ne(), a = "[object String]";
  function n(i) {
    return typeof i == "string" || !r(i) && t(i) && e(i) == a;
  }
  return $a = n, $a;
}
var Ka, $l;
function Wm() {
  if ($l) return Ka;
  $l = 1;
  var e = u0(), r = e("length");
  return Ka = r, Ka;
}
var Ha, Kl;
function Ym() {
  if (Kl) return Ha;
  Kl = 1;
  var e = "\\ud800-\\udfff", r = "\\u0300-\\u036f", t = "\\ufe20-\\ufe2f", a = "\\u20d0-\\u20ff", n = r + t + a, i = "\\ufe0e\\ufe0f", o = "\\u200d", s = RegExp("[" + o + e + n + i + "]");
  function u(c) {
    return s.test(c);
  }
  return Ha = u, Ha;
}
var Va, Hl;
function Jm() {
  if (Hl) return Va;
  Hl = 1;
  var e = "\\ud800-\\udfff", r = "\\u0300-\\u036f", t = "\\ufe20-\\ufe2f", a = "\\u20d0-\\u20ff", n = r + t + a, i = "\\ufe0e\\ufe0f", o = "[" + e + "]", s = "[" + n + "]", u = "\\ud83c[\\udffb-\\udfff]", c = "(?:" + s + "|" + u + ")", l = "[^" + e + "]", d = "(?:\\ud83c[\\udde6-\\uddff]){2}", h = "[\\ud800-\\udbff][\\udc00-\\udfff]", p = "\\u200d", N = c + "?", y = "[" + i + "]?", g = "(?:" + p + "(?:" + [l, d, h].join("|") + ")" + y + N + ")*", m = y + N + g, v = "(?:" + [l + s + "?", s, d, h, o].join("|") + ")", b = RegExp(u + "(?=" + u + ")|" + v + m, "g");
  function _(x) {
    for (var q = b.lastIndex = 0; b.test(x); )
      ++q;
    return q;
  }
  return Va = _, Va;
}
var Wa, Vl;
function Zm() {
  if (Vl) return Wa;
  Vl = 1;
  var e = Wm(), r = Ym(), t = Jm();
  function a(n) {
    return r(n) ? t(n) : e(n);
  }
  return Wa = a, Wa;
}
var Ya, Wl;
function Xm() {
  if (Wl) return Ya;
  Wl = 1;
  var e = _o(), r = He(), t = Re(), a = Vm(), n = Zm(), i = "[object Map]", o = "[object Set]";
  function s(u) {
    if (u == null)
      return 0;
    if (t(u))
      return a(u) ? n(u) : u.length;
    var c = r(u);
    return c == i || c == o ? u.size : e(u).length;
  }
  return Ya = s, Ya;
}
var Ja, Yl;
function Qm() {
  if (Yl) return Ja;
  Yl = 1;
  var e = go(), r = Vh(), t = Ro(), a = Se(), n = Tr(), i = ne(), o = Ke(), s = ur(), u = me(), c = dr();
  function l(d, h, p) {
    var N = i(d), y = N || o(d) || c(d);
    if (h = a(h, 4), p == null) {
      var g = d && d.constructor;
      y ? p = N ? new g() : [] : u(d) ? p = s(g) ? r(n(d)) : {} : p = {};
    }
    return (y ? e : t)(d, function(m, v, b) {
      return h(p, m, v, b);
    }), p;
  }
  return Ja = l, Ja;
}
var Za, Jl;
function eb() {
  if (Jl) return Za;
  Jl = 1;
  var e = $e(), r = lr(), t = ne(), a = e ? e.isConcatSpreadable : void 0;
  function n(i) {
    return t(i) || r(i) || !!(a && i && i[a]);
  }
  return Za = n, Za;
}
var Xa, Zl;
function ko() {
  if (Zl) return Xa;
  Zl = 1;
  var e = No(), r = eb();
  function t(a, n, i, o, s) {
    var u = -1, c = a.length;
    for (i || (i = r), s || (s = []); ++u < c; ) {
      var l = a[u];
      n > 0 && i(l) ? n > 1 ? t(l, n - 1, i, o, s) : e(s, l) : o || (s[s.length] = l);
    }
    return s;
  }
  return Xa = t, Xa;
}
var Qa, Xl;
function rb() {
  if (Xl) return Qa;
  Xl = 1;
  function e(r, t, a) {
    switch (a.length) {
      case 0:
        return r.call(t);
      case 1:
        return r.call(t, a[0]);
      case 2:
        return r.call(t, a[0], a[1]);
      case 3:
        return r.call(t, a[0], a[1], a[2]);
    }
    return r.apply(t, a);
  }
  return Qa = e, Qa;
}
var ei, Ql;
function v0() {
  if (Ql) return ei;
  Ql = 1;
  var e = rb(), r = Math.max;
  function t(a, n, i) {
    return n = r(n === void 0 ? a.length - 1 : n, 0), function() {
      for (var o = arguments, s = -1, u = r(o.length - n, 0), c = Array(u); ++s < u; )
        c[s] = o[n + s];
      s = -1;
      for (var l = Array(n + 1); ++s < n; )
        l[s] = o[s];
      return l[n] = i(c), e(a, this, l);
    };
  }
  return ei = t, ei;
}
var ri, ed;
function tb() {
  if (ed) return ri;
  ed = 1;
  var e = Io(), r = Mh(), t = Fe(), a = r ? function(n, i) {
    return r(n, "toString", {
      configurable: !0,
      enumerable: !1,
      value: e(i),
      writable: !0
    });
  } : t;
  return ri = a, ri;
}
var ti, rd;
function nb() {
  if (rd) return ti;
  rd = 1;
  var e = 800, r = 16, t = Date.now;
  function a(n) {
    var i = 0, o = 0;
    return function() {
      var s = t(), u = r - (s - o);
      if (o = s, u > 0) {
        if (++i >= e)
          return arguments[0];
      } else
        i = 0;
      return n.apply(void 0, arguments);
    };
  }
  return ti = a, ti;
}
var ni, td;
function m0() {
  if (td) return ni;
  td = 1;
  var e = tb(), r = nb(), t = r(e);
  return ni = t, ni;
}
var ai, nd;
function jr() {
  if (nd) return ai;
  nd = 1;
  var e = Fe(), r = v0(), t = m0();
  function a(n, i) {
    return t(r(n, i, e), n + "");
  }
  return ai = a, ai;
}
var ii, ad;
function b0() {
  if (ad) return ii;
  ad = 1;
  function e(r, t, a, n) {
    for (var i = r.length, o = a + (n ? 1 : -1); n ? o-- : ++o < i; )
      if (t(r[o], o, r))
        return o;
    return -1;
  }
  return ii = e, ii;
}
var si, id;
function ab() {
  if (id) return si;
  id = 1;
  function e(r) {
    return r !== r;
  }
  return si = e, si;
}
var oi, sd;
function ib() {
  if (sd) return oi;
  sd = 1;
  function e(r, t, a) {
    for (var n = a - 1, i = r.length; ++n < i; )
      if (r[n] === t)
        return n;
    return -1;
  }
  return oi = e, oi;
}
var ui, od;
function sb() {
  if (od) return ui;
  od = 1;
  var e = b0(), r = ab(), t = ib();
  function a(n, i, o) {
    return i === i ? t(n, i, o) : e(n, r, o);
  }
  return ui = a, ui;
}
var ci, ud;
function ob() {
  if (ud) return ci;
  ud = 1;
  var e = sb();
  function r(t, a) {
    var n = t == null ? 0 : t.length;
    return !!n && e(t, a, 0) > -1;
  }
  return ci = r, ci;
}
var li, cd;
function ub() {
  if (cd) return li;
  cd = 1;
  function e(r, t, a) {
    for (var n = -1, i = r == null ? 0 : r.length; ++n < i; )
      if (a(t, r[n]))
        return !0;
    return !1;
  }
  return li = e, li;
}
var di, ld;
function cb() {
  if (ld) return di;
  ld = 1;
  function e() {
  }
  return di = e, di;
}
var fi, dd;
function lb() {
  if (dd) return fi;
  dd = 1;
  var e = $h(), r = cb(), t = So(), a = 1 / 0, n = e && 1 / t(new e([, -0]))[1] == a ? function(i) {
    return new e(i);
  } : r;
  return fi = n, fi;
}
var hi, fd;
function db() {
  if (fd) return hi;
  fd = 1;
  var e = Qh(), r = ob(), t = ub(), a = e0(), n = lb(), i = So(), o = 200;
  function s(u, c, l) {
    var d = -1, h = r, p = u.length, N = !0, y = [], g = y;
    if (l)
      N = !1, h = t;
    else if (p >= o) {
      var m = c ? null : n(u);
      if (m)
        return i(m);
      N = !1, h = a, g = new e();
    } else
      g = c ? [] : y;
    e:
      for (; ++d < p; ) {
        var v = u[d], b = c ? c(v) : v;
        if (v = l || v !== 0 ? v : 0, N && b === b) {
          for (var _ = g.length; _--; )
            if (g[_] === b)
              continue e;
          c && g.push(b), y.push(v);
        } else h(g, b, l) || (g !== y && g.push(b), y.push(v));
      }
    return y;
  }
  return hi = s, hi;
}
var pi, hd;
function g0() {
  if (hd) return pi;
  hd = 1;
  var e = Re(), r = Ne();
  function t(a) {
    return r(a) && e(a);
  }
  return pi = t, pi;
}
var vi, pd;
function fb() {
  if (pd) return vi;
  pd = 1;
  var e = ko(), r = jr(), t = db(), a = g0(), n = r(function(i) {
    return t(e(i, 1, a, !0));
  });
  return vi = n, vi;
}
var mi, vd;
function hb() {
  if (vd) return mi;
  vd = 1;
  var e = Mr();
  function r(t, a) {
    return e(a, function(n) {
      return t[n];
    });
  }
  return mi = r, mi;
}
var bi, md;
function y0() {
  if (md) return bi;
  md = 1;
  var e = hb(), r = Oe();
  function t(a) {
    return a == null ? [] : e(a, r(a));
  }
  return bi = t, bi;
}
var gi, bd;
function be() {
  if (bd) return gi;
  bd = 1;
  var e;
  if (typeof vo == "function")
    try {
      e = {
        clone: xm(),
        constant: Io(),
        each: Xh(),
        filter: c0(),
        has: l0(),
        isArray: ne(),
        isEmpty: $m(),
        isFunction: ur(),
        isUndefined: d0(),
        keys: Oe(),
        map: h0(),
        reduce: p0(),
        size: Xm(),
        transform: Qm(),
        union: fb(),
        values: y0()
      };
    } catch {
    }
  return e || (e = window._), gi = e, gi;
}
var yi, gd;
function Ao() {
  if (gd) return yi;
  gd = 1;
  var e = be();
  yi = n;
  var r = "\0", t = "\0", a = "";
  function n(l) {
    this._isDirected = e.has(l, "directed") ? l.directed : !0, this._isMultigraph = e.has(l, "multigraph") ? l.multigraph : !1, this._isCompound = e.has(l, "compound") ? l.compound : !1, this._label = void 0, this._defaultNodeLabelFn = e.constant(void 0), this._defaultEdgeLabelFn = e.constant(void 0), this._nodes = {}, this._isCompound && (this._parent = {}, this._children = {}, this._children[t] = {}), this._in = {}, this._preds = {}, this._out = {}, this._sucs = {}, this._edgeObjs = {}, this._edgeLabels = {};
  }
  n.prototype._nodeCount = 0, n.prototype._edgeCount = 0, n.prototype.isDirected = function() {
    return this._isDirected;
  }, n.prototype.isMultigraph = function() {
    return this._isMultigraph;
  }, n.prototype.isCompound = function() {
    return this._isCompound;
  }, n.prototype.setGraph = function(l) {
    return this._label = l, this;
  }, n.prototype.graph = function() {
    return this._label;
  }, n.prototype.setDefaultNodeLabel = function(l) {
    return e.isFunction(l) || (l = e.constant(l)), this._defaultNodeLabelFn = l, this;
  }, n.prototype.nodeCount = function() {
    return this._nodeCount;
  }, n.prototype.nodes = function() {
    return e.keys(this._nodes);
  }, n.prototype.sources = function() {
    var l = this;
    return e.filter(this.nodes(), function(d) {
      return e.isEmpty(l._in[d]);
    });
  }, n.prototype.sinks = function() {
    var l = this;
    return e.filter(this.nodes(), function(d) {
      return e.isEmpty(l._out[d]);
    });
  }, n.prototype.setNodes = function(l, d) {
    var h = arguments, p = this;
    return e.each(l, function(N) {
      h.length > 1 ? p.setNode(N, d) : p.setNode(N);
    }), this;
  }, n.prototype.setNode = function(l, d) {
    return e.has(this._nodes, l) ? (arguments.length > 1 && (this._nodes[l] = d), this) : (this._nodes[l] = arguments.length > 1 ? d : this._defaultNodeLabelFn(l), this._isCompound && (this._parent[l] = t, this._children[l] = {}, this._children[t][l] = !0), this._in[l] = {}, this._preds[l] = {}, this._out[l] = {}, this._sucs[l] = {}, ++this._nodeCount, this);
  }, n.prototype.node = function(l) {
    return this._nodes[l];
  }, n.prototype.hasNode = function(l) {
    return e.has(this._nodes, l);
  }, n.prototype.removeNode = function(l) {
    var d = this;
    if (e.has(this._nodes, l)) {
      var h = function(p) {
        d.removeEdge(d._edgeObjs[p]);
      };
      delete this._nodes[l], this._isCompound && (this._removeFromParentsChildList(l), delete this._parent[l], e.each(this.children(l), function(p) {
        d.setParent(p);
      }), delete this._children[l]), e.each(e.keys(this._in[l]), h), delete this._in[l], delete this._preds[l], e.each(e.keys(this._out[l]), h), delete this._out[l], delete this._sucs[l], --this._nodeCount;
    }
    return this;
  }, n.prototype.setParent = function(l, d) {
    if (!this._isCompound)
      throw new Error("Cannot set parent in a non-compound graph");
    if (e.isUndefined(d))
      d = t;
    else {
      d += "";
      for (var h = d; !e.isUndefined(h); h = this.parent(h))
        if (h === l)
          throw new Error("Setting " + d + " as parent of " + l + " would create a cycle");
      this.setNode(d);
    }
    return this.setNode(l), this._removeFromParentsChildList(l), this._parent[l] = d, this._children[d][l] = !0, this;
  }, n.prototype._removeFromParentsChildList = function(l) {
    delete this._children[this._parent[l]][l];
  }, n.prototype.parent = function(l) {
    if (this._isCompound) {
      var d = this._parent[l];
      if (d !== t)
        return d;
    }
  }, n.prototype.children = function(l) {
    if (e.isUndefined(l) && (l = t), this._isCompound) {
      var d = this._children[l];
      if (d)
        return e.keys(d);
    } else {
      if (l === t)
        return this.nodes();
      if (this.hasNode(l))
        return [];
    }
  }, n.prototype.predecessors = function(l) {
    var d = this._preds[l];
    if (d)
      return e.keys(d);
  }, n.prototype.successors = function(l) {
    var d = this._sucs[l];
    if (d)
      return e.keys(d);
  }, n.prototype.neighbors = function(l) {
    var d = this.predecessors(l);
    if (d)
      return e.union(d, this.successors(l));
  }, n.prototype.isLeaf = function(l) {
    var d;
    return this.isDirected() ? d = this.successors(l) : d = this.neighbors(l), d.length === 0;
  }, n.prototype.filterNodes = function(l) {
    var d = new this.constructor({
      directed: this._isDirected,
      multigraph: this._isMultigraph,
      compound: this._isCompound
    });
    d.setGraph(this.graph());
    var h = this;
    e.each(this._nodes, function(y, g) {
      l(g) && d.setNode(g, y);
    }), e.each(this._edgeObjs, function(y) {
      d.hasNode(y.v) && d.hasNode(y.w) && d.setEdge(y, h.edge(y));
    });
    var p = {};
    function N(y) {
      var g = h.parent(y);
      return g === void 0 || d.hasNode(g) ? (p[y] = g, g) : g in p ? p[g] : N(g);
    }
    return this._isCompound && e.each(d.nodes(), function(y) {
      d.setParent(y, N(y));
    }), d;
  }, n.prototype.setDefaultEdgeLabel = function(l) {
    return e.isFunction(l) || (l = e.constant(l)), this._defaultEdgeLabelFn = l, this;
  }, n.prototype.edgeCount = function() {
    return this._edgeCount;
  }, n.prototype.edges = function() {
    return e.values(this._edgeObjs);
  }, n.prototype.setPath = function(l, d) {
    var h = this, p = arguments;
    return e.reduce(l, function(N, y) {
      return p.length > 1 ? h.setEdge(N, y, d) : h.setEdge(N, y), y;
    }), this;
  }, n.prototype.setEdge = function() {
    var l, d, h, p, N = !1, y = arguments[0];
    typeof y == "object" && y !== null && "v" in y ? (l = y.v, d = y.w, h = y.name, arguments.length === 2 && (p = arguments[1], N = !0)) : (l = y, d = arguments[1], h = arguments[3], arguments.length > 2 && (p = arguments[2], N = !0)), l = "" + l, d = "" + d, e.isUndefined(h) || (h = "" + h);
    var g = s(this._isDirected, l, d, h);
    if (e.has(this._edgeLabels, g))
      return N && (this._edgeLabels[g] = p), this;
    if (!e.isUndefined(h) && !this._isMultigraph)
      throw new Error("Cannot set a named edge when isMultigraph = false");
    this.setNode(l), this.setNode(d), this._edgeLabels[g] = N ? p : this._defaultEdgeLabelFn(l, d, h);
    var m = u(this._isDirected, l, d, h);
    return l = m.v, d = m.w, Object.freeze(m), this._edgeObjs[g] = m, i(this._preds[d], l), i(this._sucs[l], d), this._in[d][g] = m, this._out[l][g] = m, this._edgeCount++, this;
  }, n.prototype.edge = function(l, d, h) {
    var p = arguments.length === 1 ? c(this._isDirected, arguments[0]) : s(this._isDirected, l, d, h);
    return this._edgeLabels[p];
  }, n.prototype.hasEdge = function(l, d, h) {
    var p = arguments.length === 1 ? c(this._isDirected, arguments[0]) : s(this._isDirected, l, d, h);
    return e.has(this._edgeLabels, p);
  }, n.prototype.removeEdge = function(l, d, h) {
    var p = arguments.length === 1 ? c(this._isDirected, arguments[0]) : s(this._isDirected, l, d, h), N = this._edgeObjs[p];
    return N && (l = N.v, d = N.w, delete this._edgeLabels[p], delete this._edgeObjs[p], o(this._preds[d], l), o(this._sucs[l], d), delete this._in[d][p], delete this._out[l][p], this._edgeCount--), this;
  }, n.prototype.inEdges = function(l, d) {
    var h = this._in[l];
    if (h) {
      var p = e.values(h);
      return d ? e.filter(p, function(N) {
        return N.v === d;
      }) : p;
    }
  }, n.prototype.outEdges = function(l, d) {
    var h = this._out[l];
    if (h) {
      var p = e.values(h);
      return d ? e.filter(p, function(N) {
        return N.w === d;
      }) : p;
    }
  }, n.prototype.nodeEdges = function(l, d) {
    var h = this.inEdges(l, d);
    if (h)
      return h.concat(this.outEdges(l, d));
  };
  function i(l, d) {
    l[d] ? l[d]++ : l[d] = 1;
  }
  function o(l, d) {
    --l[d] || delete l[d];
  }
  function s(l, d, h, p) {
    var N = "" + d, y = "" + h;
    if (!l && N > y) {
      var g = N;
      N = y, y = g;
    }
    return N + a + y + a + (e.isUndefined(p) ? r : p);
  }
  function u(l, d, h, p) {
    var N = "" + d, y = "" + h;
    if (!l && N > y) {
      var g = N;
      N = y, y = g;
    }
    var m = { v: N, w: y };
    return p && (m.name = p), m;
  }
  function c(l, d) {
    return s(l, d.v, d.w, d.name);
  }
  return yi;
}
var xi, yd;
function pb() {
  return yd || (yd = 1, xi = "2.1.8"), xi;
}
var _i, xd;
function vb() {
  return xd || (xd = 1, _i = {
    Graph: Ao(),
    version: pb()
  }), _i;
}
var wi, _d;
function mb() {
  if (_d) return wi;
  _d = 1;
  var e = be(), r = Ao();
  wi = {
    write: t,
    read: i
  };
  function t(o) {
    var s = {
      options: {
        directed: o.isDirected(),
        multigraph: o.isMultigraph(),
        compound: o.isCompound()
      },
      nodes: a(o),
      edges: n(o)
    };
    return e.isUndefined(o.graph()) || (s.value = e.clone(o.graph())), s;
  }
  function a(o) {
    return e.map(o.nodes(), function(s) {
      var u = o.node(s), c = o.parent(s), l = { v: s };
      return e.isUndefined(u) || (l.value = u), e.isUndefined(c) || (l.parent = c), l;
    });
  }
  function n(o) {
    return e.map(o.edges(), function(s) {
      var u = o.edge(s), c = { v: s.v, w: s.w };
      return e.isUndefined(s.name) || (c.name = s.name), e.isUndefined(u) || (c.value = u), c;
    });
  }
  function i(o) {
    var s = new r(o.options).setGraph(o.value);
    return e.each(o.nodes, function(u) {
      s.setNode(u.v, u.value), u.parent && s.setParent(u.v, u.parent);
    }), e.each(o.edges, function(u) {
      s.setEdge({ v: u.v, w: u.w, name: u.name }, u.value);
    }), s;
  }
  return wi;
}
var Ni, wd;
function bb() {
  if (wd) return Ni;
  wd = 1;
  var e = be();
  Ni = r;
  function r(t) {
    var a = {}, n = [], i;
    function o(s) {
      e.has(a, s) || (a[s] = !0, i.push(s), e.each(t.successors(s), o), e.each(t.predecessors(s), o));
    }
    return e.each(t.nodes(), function(s) {
      i = [], o(s), i.length && n.push(i);
    }), n;
  }
  return Ni;
}
var qi, Nd;
function x0() {
  if (Nd) return qi;
  Nd = 1;
  var e = be();
  qi = r;
  function r() {
    this._arr = [], this._keyIndices = {};
  }
  return r.prototype.size = function() {
    return this._arr.length;
  }, r.prototype.keys = function() {
    return this._arr.map(function(t) {
      return t.key;
    });
  }, r.prototype.has = function(t) {
    return e.has(this._keyIndices, t);
  }, r.prototype.priority = function(t) {
    var a = this._keyIndices[t];
    if (a !== void 0)
      return this._arr[a].priority;
  }, r.prototype.min = function() {
    if (this.size() === 0)
      throw new Error("Queue underflow");
    return this._arr[0].key;
  }, r.prototype.add = function(t, a) {
    var n = this._keyIndices;
    if (t = String(t), !e.has(n, t)) {
      var i = this._arr, o = i.length;
      return n[t] = o, i.push({ key: t, priority: a }), this._decrease(o), !0;
    }
    return !1;
  }, r.prototype.removeMin = function() {
    this._swap(0, this._arr.length - 1);
    var t = this._arr.pop();
    return delete this._keyIndices[t.key], this._heapify(0), t.key;
  }, r.prototype.decrease = function(t, a) {
    var n = this._keyIndices[t];
    if (a > this._arr[n].priority)
      throw new Error("New priority is greater than current priority. Key: " + t + " Old: " + this._arr[n].priority + " New: " + a);
    this._arr[n].priority = a, this._decrease(n);
  }, r.prototype._heapify = function(t) {
    var a = this._arr, n = 2 * t, i = n + 1, o = t;
    n < a.length && (o = a[n].priority < a[o].priority ? n : o, i < a.length && (o = a[i].priority < a[o].priority ? i : o), o !== t && (this._swap(t, o), this._heapify(o)));
  }, r.prototype._decrease = function(t) {
    for (var a = this._arr, n = a[t].priority, i; t !== 0 && (i = t >> 1, !(a[i].priority < n)); )
      this._swap(t, i), t = i;
  }, r.prototype._swap = function(t, a) {
    var n = this._arr, i = this._keyIndices, o = n[t], s = n[a];
    n[t] = s, n[a] = o, i[s.key] = t, i[o.key] = a;
  }, qi;
}
var Ii, qd;
function _0() {
  if (qd) return Ii;
  qd = 1;
  var e = be(), r = x0();
  Ii = a;
  var t = e.constant(1);
  function a(i, o, s, u) {
    return n(
      i,
      String(o),
      s || t,
      u || function(c) {
        return i.outEdges(c);
      }
    );
  }
  function n(i, o, s, u) {
    var c = {}, l = new r(), d, h, p = function(N) {
      var y = N.v !== d ? N.v : N.w, g = c[y], m = s(N), v = h.distance + m;
      if (m < 0)
        throw new Error("dijkstra does not allow negative edge weights. Bad edge: " + N + " Weight: " + m);
      v < g.distance && (g.distance = v, g.predecessor = d, l.decrease(y, v));
    };
    for (i.nodes().forEach(function(N) {
      var y = N === o ? 0 : Number.POSITIVE_INFINITY;
      c[N] = { distance: y }, l.add(N, y);
    }); l.size() > 0 && (d = l.removeMin(), h = c[d], h.distance !== Number.POSITIVE_INFINITY); )
      u(d).forEach(p);
    return c;
  }
  return Ii;
}
var Ci, Id;
function gb() {
  if (Id) return Ci;
  Id = 1;
  var e = _0(), r = be();
  Ci = t;
  function t(a, n, i) {
    return r.transform(a.nodes(), function(o, s) {
      o[s] = e(a, s, n, i);
    }, {});
  }
  return Ci;
}
var Ri, Cd;
function w0() {
  if (Cd) return Ri;
  Cd = 1;
  var e = be();
  Ri = r;
  function r(t) {
    var a = 0, n = [], i = {}, o = [];
    function s(u) {
      var c = i[u] = {
        onStack: !0,
        lowlink: a,
        index: a++
      };
      if (n.push(u), t.successors(u).forEach(function(h) {
        e.has(i, h) ? i[h].onStack && (c.lowlink = Math.min(c.lowlink, i[h].index)) : (s(h), c.lowlink = Math.min(c.lowlink, i[h].lowlink));
      }), c.lowlink === c.index) {
        var l = [], d;
        do
          d = n.pop(), i[d].onStack = !1, l.push(d);
        while (u !== d);
        o.push(l);
      }
    }
    return t.nodes().forEach(function(u) {
      e.has(i, u) || s(u);
    }), o;
  }
  return Ri;
}
var Si, Rd;
function yb() {
  if (Rd) return Si;
  Rd = 1;
  var e = be(), r = w0();
  Si = t;
  function t(a) {
    return e.filter(r(a), function(n) {
      return n.length > 1 || n.length === 1 && a.hasEdge(n[0], n[0]);
    });
  }
  return Si;
}
var Ei, Sd;
function xb() {
  if (Sd) return Ei;
  Sd = 1;
  var e = be();
  Ei = t;
  var r = e.constant(1);
  function t(n, i, o) {
    return a(
      n,
      i || r,
      o || function(s) {
        return n.outEdges(s);
      }
    );
  }
  function a(n, i, o) {
    var s = {}, u = n.nodes();
    return u.forEach(function(c) {
      s[c] = {}, s[c][c] = { distance: 0 }, u.forEach(function(l) {
        c !== l && (s[c][l] = { distance: Number.POSITIVE_INFINITY });
      }), o(c).forEach(function(l) {
        var d = l.v === c ? l.w : l.v, h = i(l);
        s[c][d] = { distance: h, predecessor: c };
      });
    }), u.forEach(function(c) {
      var l = s[c];
      u.forEach(function(d) {
        var h = s[d];
        u.forEach(function(p) {
          var N = h[c], y = l[p], g = h[p], m = N.distance + y.distance;
          m < g.distance && (g.distance = m, g.predecessor = y.predecessor);
        });
      });
    }), s;
  }
  return Ei;
}
var ki, Ed;
function N0() {
  if (Ed) return ki;
  Ed = 1;
  var e = be();
  ki = r, r.CycleException = t;
  function r(a) {
    var n = {}, i = {}, o = [];
    function s(u) {
      if (e.has(i, u))
        throw new t();
      e.has(n, u) || (i[u] = !0, n[u] = !0, e.each(a.predecessors(u), s), delete i[u], o.push(u));
    }
    if (e.each(a.sinks(), s), e.size(n) !== a.nodeCount())
      throw new t();
    return o;
  }
  function t() {
  }
  return t.prototype = new Error(), ki;
}
var Ai, kd;
function _b() {
  if (kd) return Ai;
  kd = 1;
  var e = N0();
  Ai = r;
  function r(t) {
    try {
      e(t);
    } catch (a) {
      if (a instanceof e.CycleException)
        return !1;
      throw a;
    }
    return !0;
  }
  return Ai;
}
var Ti, Ad;
function q0() {
  if (Ad) return Ti;
  Ad = 1;
  var e = be();
  Ti = r;
  function r(a, n, i) {
    e.isArray(n) || (n = [n]);
    var o = (a.isDirected() ? a.successors : a.neighbors).bind(a), s = [], u = {};
    return e.each(n, function(c) {
      if (!a.hasNode(c))
        throw new Error("Graph does not have node: " + c);
      t(a, c, i === "post", u, o, s);
    }), s;
  }
  function t(a, n, i, o, s, u) {
    e.has(o, n) || (o[n] = !0, i || u.push(n), e.each(s(n), function(c) {
      t(a, c, i, o, s, u);
    }), i && u.push(n));
  }
  return Ti;
}
var Oi, Td;
function wb() {
  if (Td) return Oi;
  Td = 1;
  var e = q0();
  Oi = r;
  function r(t, a) {
    return e(t, a, "post");
  }
  return Oi;
}
var Mi, Od;
function Nb() {
  if (Od) return Mi;
  Od = 1;
  var e = q0();
  Mi = r;
  function r(t, a) {
    return e(t, a, "pre");
  }
  return Mi;
}
var Pi, Md;
function qb() {
  if (Md) return Pi;
  Md = 1;
  var e = be(), r = Ao(), t = x0();
  Pi = a;
  function a(n, i) {
    var o = new r(), s = {}, u = new t(), c;
    function l(h) {
      var p = h.v === c ? h.w : h.v, N = u.priority(p);
      if (N !== void 0) {
        var y = i(h);
        y < N && (s[p] = c, u.decrease(p, y));
      }
    }
    if (n.nodeCount() === 0)
      return o;
    e.each(n.nodes(), function(h) {
      u.add(h, Number.POSITIVE_INFINITY), o.setNode(h);
    }), u.decrease(n.nodes()[0], 0);
    for (var d = !1; u.size() > 0; ) {
      if (c = u.removeMin(), e.has(s, c))
        o.setEdge(c, s[c]);
      else {
        if (d)
          throw new Error("Input graph is not connected: " + n);
        d = !0;
      }
      n.nodeEdges(c).forEach(l);
    }
    return o;
  }
  return Pi;
}
var Li, Pd;
function Ib() {
  return Pd || (Pd = 1, Li = {
    components: bb(),
    dijkstra: _0(),
    dijkstraAll: gb(),
    findCycles: yb(),
    floydWarshall: xb(),
    isAcyclic: _b(),
    postorder: wb(),
    preorder: Nb(),
    prim: qb(),
    tarjan: w0(),
    topsort: N0()
  }), Li;
}
var ji, Ld;
function Cb() {
  if (Ld) return ji;
  Ld = 1;
  var e = vb();
  return ji = {
    Graph: e.Graph,
    json: mb(),
    alg: Ib(),
    version: e.version
  }, ji;
}
var Di, jd;
function xe() {
  if (jd) return Di;
  jd = 1;
  var e;
  if (typeof vo == "function")
    try {
      e = Cb();
    } catch {
    }
  return e || (e = window.graphlib), Di = e, Di;
}
var Fi, Dd;
function Rb() {
  if (Dd) return Fi;
  Dd = 1;
  var e = Yh(), r = 1, t = 4;
  function a(n) {
    return e(n, r | t);
  }
  return Fi = a, Fi;
}
var Gi, Fd;
function Dr() {
  if (Fd) return Gi;
  Fd = 1;
  var e = Ue(), r = Re(), t = Er(), a = me();
  function n(i, o, s) {
    if (!a(s))
      return !1;
    var u = typeof o;
    return (u == "number" ? r(s) && t(o, s.length) : u == "string" && o in s) ? e(s[o], i) : !1;
  }
  return Gi = n, Gi;
}
var zi, Gd;
function Sb() {
  if (Gd) return zi;
  Gd = 1;
  var e = jr(), r = Ue(), t = Dr(), a = De(), n = Object.prototype, i = n.hasOwnProperty, o = e(function(s, u) {
    s = Object(s);
    var c = -1, l = u.length, d = l > 2 ? u[2] : void 0;
    for (d && t(u[0], u[1], d) && (l = 1); ++c < l; )
      for (var h = u[c], p = a(h), N = -1, y = p.length; ++N < y; ) {
        var g = p[N], m = s[g];
        (m === void 0 || r(m, n[g]) && !i.call(s, g)) && (s[g] = h[g]);
      }
    return s;
  });
  return zi = o, zi;
}
var Bi, zd;
function Eb() {
  if (zd) return Bi;
  zd = 1;
  var e = Se(), r = Re(), t = Oe();
  function a(n) {
    return function(i, o, s) {
      var u = Object(i);
      if (!r(i)) {
        var c = e(o, 3);
        i = t(i), o = function(d) {
          return c(u[d], d, u);
        };
      }
      var l = n(i, o, s);
      return l > -1 ? u[c ? i[l] : l] : void 0;
    };
  }
  return Bi = a, Bi;
}
var Ui, Bd;
function kb() {
  if (Bd) return Ui;
  Bd = 1;
  var e = /\s/;
  function r(t) {
    for (var a = t.length; a-- && e.test(t.charAt(a)); )
      ;
    return a;
  }
  return Ui = r, Ui;
}
var $i, Ud;
function Ab() {
  if (Ud) return $i;
  Ud = 1;
  var e = kb(), r = /^\s+/;
  function t(a) {
    return a && a.slice(0, e(a) + 1).replace(r, "");
  }
  return $i = t, $i;
}
var Ki, $d;
function Tb() {
  if ($d) return Ki;
  $d = 1;
  var e = Ab(), r = me(), t = Ve(), a = NaN, n = /^[-+]0x[0-9a-f]+$/i, i = /^0b[01]+$/i, o = /^0o[0-7]+$/i, s = parseInt;
  function u(c) {
    if (typeof c == "number")
      return c;
    if (t(c))
      return a;
    if (r(c)) {
      var l = typeof c.valueOf == "function" ? c.valueOf() : c;
      c = r(l) ? l + "" : l;
    }
    if (typeof c != "string")
      return c === 0 ? c : +c;
    c = e(c);
    var d = i.test(c);
    return d || o.test(c) ? s(c.slice(2), d ? 2 : 8) : n.test(c) ? a : +c;
  }
  return Ki = u, Ki;
}
var Hi, Kd;
function I0() {
  if (Kd) return Hi;
  Kd = 1;
  var e = Tb(), r = 1 / 0, t = 17976931348623157e292;
  function a(n) {
    if (!n)
      return n === 0 ? n : 0;
    if (n = e(n), n === r || n === -r) {
      var i = n < 0 ? -1 : 1;
      return i * t;
    }
    return n === n ? n : 0;
  }
  return Hi = a, Hi;
}
var Vi, Hd;
function Ob() {
  if (Hd) return Vi;
  Hd = 1;
  var e = I0();
  function r(t) {
    var a = e(t), n = a % 1;
    return a === a ? n ? a - n : a : 0;
  }
  return Vi = r, Vi;
}
var Wi, Vd;
function Mb() {
  if (Vd) return Wi;
  Vd = 1;
  var e = b0(), r = Se(), t = Ob(), a = Math.max;
  function n(i, o, s) {
    var u = i == null ? 0 : i.length;
    if (!u)
      return -1;
    var c = s == null ? 0 : t(s);
    return c < 0 && (c = a(u + c, 0)), e(i, r(o, 3), c);
  }
  return Wi = n, Wi;
}
var Yi, Wd;
function Pb() {
  if (Wd) return Yi;
  Wd = 1;
  var e = Eb(), r = Mb(), t = e(r);
  return Yi = t, Yi;
}
var Ji, Yd;
function C0() {
  if (Yd) return Ji;
  Yd = 1;
  var e = ko();
  function r(t) {
    var a = t == null ? 0 : t.length;
    return a ? e(t, 1) : [];
  }
  return Ji = r, Ji;
}
var Zi, Jd;
function Lb() {
  if (Jd) return Zi;
  Jd = 1;
  var e = Co(), r = Jh(), t = De();
  function a(n, i) {
    return n == null ? n : e(n, r(i), t);
  }
  return Zi = a, Zi;
}
var Xi, Zd;
function jb() {
  if (Zd) return Xi;
  Zd = 1;
  function e(r) {
    var t = r == null ? 0 : r.length;
    return t ? r[t - 1] : void 0;
  }
  return Xi = e, Xi;
}
var Qi, Xd;
function Db() {
  if (Xd) return Qi;
  Xd = 1;
  var e = Rr(), r = Ro(), t = Se();
  function a(n, i) {
    var o = {};
    return i = t(i, 3), r(n, function(s, u, c) {
      e(o, u, i(s, u, c));
    }), o;
  }
  return Qi = a, Qi;
}
var es, Qd;
function To() {
  if (Qd) return es;
  Qd = 1;
  var e = Ve();
  function r(t, a, n) {
    for (var i = -1, o = t.length; ++i < o; ) {
      var s = t[i], u = a(s);
      if (u != null && (c === void 0 ? u === u && !e(u) : n(u, c)))
        var c = u, l = s;
    }
    return l;
  }
  return es = r, es;
}
var rs, ef;
function Fb() {
  if (ef) return rs;
  ef = 1;
  function e(r, t) {
    return r > t;
  }
  return rs = e, rs;
}
var ts, rf;
function Gb() {
  if (rf) return ts;
  rf = 1;
  var e = To(), r = Fb(), t = Fe();
  function a(n) {
    return n && n.length ? e(n, t, r) : void 0;
  }
  return ts = a, ts;
}
var ns, tf;
function R0() {
  if (tf) return ns;
  tf = 1;
  var e = Rr(), r = Ue();
  function t(a, n, i) {
    (i !== void 0 && !r(a[n], i) || i === void 0 && !(n in a)) && e(a, n, i);
  }
  return ns = t, ns;
}
var as, nf;
function zb() {
  if (nf) return as;
  nf = 1;
  var e = Le(), r = Tr(), t = Ne(), a = "[object Object]", n = Function.prototype, i = Object.prototype, o = n.toString, s = i.hasOwnProperty, u = o.call(Object);
  function c(l) {
    if (!t(l) || e(l) != a)
      return !1;
    var d = r(l);
    if (d === null)
      return !0;
    var h = s.call(d, "constructor") && d.constructor;
    return typeof h == "function" && h instanceof h && o.call(h) == u;
  }
  return as = c, as;
}
var is, af;
function S0() {
  if (af) return is;
  af = 1;
  function e(r, t) {
    if (!(t === "constructor" && typeof r[t] == "function") && t != "__proto__")
      return r[t];
  }
  return is = e, is;
}
var ss, sf;
function Bb() {
  if (sf) return ss;
  sf = 1;
  var e = cr(), r = De();
  function t(a) {
    return e(a, r(a));
  }
  return ss = t, ss;
}
var os, of;
function Ub() {
  if (of) return os;
  of = 1;
  var e = R0(), r = jh(), t = Hh(), a = Dh(), n = Wh(), i = lr(), o = ne(), s = g0(), u = Ke(), c = ur(), l = me(), d = zb(), h = dr(), p = S0(), N = Bb();
  function y(g, m, v, b, _, x, q) {
    var C = p(g, v), R = p(m, v), I = q.get(R);
    if (I) {
      e(g, v, I);
      return;
    }
    var S = x ? x(C, R, v + "", g, m, q) : void 0, A = S === void 0;
    if (A) {
      var M = o(R), D = !M && u(R), B = !M && !D && h(R);
      S = R, M || D || B ? o(C) ? S = C : s(C) ? S = a(C) : D ? (A = !1, S = r(R, !0)) : B ? (A = !1, S = t(R, !0)) : S = [] : d(R) || i(R) ? (S = C, i(C) ? S = N(C) : (!l(C) || c(C)) && (S = n(R))) : A = !1;
    }
    A && (q.set(R, S), _(S, R, b, x, q), q.delete(R)), e(g, v, S);
  }
  return os = y, os;
}
var us, uf;
function $b() {
  if (uf) return us;
  uf = 1;
  var e = Cr(), r = R0(), t = Co(), a = Ub(), n = me(), i = De(), o = S0();
  function s(u, c, l, d, h) {
    u !== c && t(c, function(p, N) {
      if (h || (h = new e()), n(p))
        a(u, c, N, l, s, d, h);
      else {
        var y = d ? d(o(u, N), p, N + "", u, c, h) : void 0;
        y === void 0 && (y = p), r(u, N, y);
      }
    }, i);
  }
  return us = s, us;
}
var cs, cf;
function Kb() {
  if (cf) return cs;
  cf = 1;
  var e = jr(), r = Dr();
  function t(a) {
    return e(function(n, i) {
      var o = -1, s = i.length, u = s > 1 ? i[s - 1] : void 0, c = s > 2 ? i[2] : void 0;
      for (u = a.length > 3 && typeof u == "function" ? (s--, u) : void 0, c && r(i[0], i[1], c) && (u = s < 3 ? void 0 : u, s = 1), n = Object(n); ++o < s; ) {
        var l = i[o];
        l && a(n, l, o, u);
      }
      return n;
    });
  }
  return cs = t, cs;
}
var ls, lf;
function Hb() {
  if (lf) return ls;
  lf = 1;
  var e = $b(), r = Kb(), t = r(function(a, n, i) {
    e(a, n, i);
  });
  return ls = t, ls;
}
var ds, df;
function E0() {
  if (df) return ds;
  df = 1;
  function e(r, t) {
    return r < t;
  }
  return ds = e, ds;
}
var fs, ff;
function Vb() {
  if (ff) return fs;
  ff = 1;
  var e = To(), r = E0(), t = Fe();
  function a(n) {
    return n && n.length ? e(n, t, r) : void 0;
  }
  return fs = a, fs;
}
var hs, hf;
function Wb() {
  if (hf) return hs;
  hf = 1;
  var e = To(), r = Se(), t = E0();
  function a(n, i) {
    return n && n.length ? e(n, r(i, 2), t) : void 0;
  }
  return hs = a, hs;
}
var ps, pf;
function Yb() {
  if (pf) return ps;
  pf = 1;
  var e = _e(), r = function() {
    return e.Date.now();
  };
  return ps = r, ps;
}
var vs, vf;
function Jb() {
  if (vf) return vs;
  vf = 1;
  var e = Sr(), r = Pr(), t = Er(), a = me(), n = fr();
  function i(o, s, u, c) {
    if (!a(o))
      return o;
    s = r(s, o);
    for (var l = -1, d = s.length, h = d - 1, p = o; p != null && ++l < d; ) {
      var N = n(s[l]), y = u;
      if (N === "__proto__" || N === "constructor" || N === "prototype")
        return o;
      if (l != h) {
        var g = p[N];
        y = c ? c(g, N, p) : void 0, y === void 0 && (y = a(g) ? g : t(s[l + 1]) ? [] : {});
      }
      e(p, N, y), p = p[N];
    }
    return o;
  }
  return vs = i, vs;
}
var ms, mf;
function Zb() {
  if (mf) return ms;
  mf = 1;
  var e = Lr(), r = Jb(), t = Pr();
  function a(n, i, o) {
    for (var s = -1, u = i.length, c = {}; ++s < u; ) {
      var l = i[s], d = e(n, l);
      o(d, l) && r(c, t(l, n), d);
    }
    return c;
  }
  return ms = a, ms;
}
var bs, bf;
function Xb() {
  if (bf) return bs;
  bf = 1;
  var e = Zb(), r = o0();
  function t(a, n) {
    return e(a, n, function(i, o) {
      return r(a, o);
    });
  }
  return bs = t, bs;
}
var gs, gf;
function Qb() {
  if (gf) return gs;
  gf = 1;
  var e = C0(), r = v0(), t = m0();
  function a(n) {
    return t(r(n, void 0, e), n + "");
  }
  return gs = a, gs;
}
var ys, yf;
function eg() {
  if (yf) return ys;
  yf = 1;
  var e = Xb(), r = Qb(), t = r(function(a, n) {
    return a == null ? {} : e(a, n);
  });
  return ys = t, ys;
}
var xs, xf;
function rg() {
  if (xf) return xs;
  xf = 1;
  var e = Math.ceil, r = Math.max;
  function t(a, n, i, o) {
    for (var s = -1, u = r(e((n - a) / (i || 1)), 0), c = Array(u); u--; )
      c[o ? u : ++s] = a, a += i;
    return c;
  }
  return xs = t, xs;
}
var _s, _f;
function tg() {
  if (_f) return _s;
  _f = 1;
  var e = rg(), r = Dr(), t = I0();
  function a(n) {
    return function(i, o, s) {
      return s && typeof s != "number" && r(i, o, s) && (o = s = void 0), i = t(i), o === void 0 ? (o = i, i = 0) : o = t(o), s = s === void 0 ? i < o ? 1 : -1 : t(s), e(i, o, s, n);
    };
  }
  return _s = a, _s;
}
var ws, wf;
function ng() {
  if (wf) return ws;
  wf = 1;
  var e = tg(), r = e();
  return ws = r, ws;
}
var Ns, Nf;
function ag() {
  if (Nf) return Ns;
  Nf = 1;
  function e(r, t) {
    var a = r.length;
    for (r.sort(t); a--; )
      r[a] = r[a].value;
    return r;
  }
  return Ns = e, Ns;
}
var qs, qf;
function ig() {
  if (qf) return qs;
  qf = 1;
  var e = Ve();
  function r(t, a) {
    if (t !== a) {
      var n = t !== void 0, i = t === null, o = t === t, s = e(t), u = a !== void 0, c = a === null, l = a === a, d = e(a);
      if (!c && !d && !s && t > a || s && u && l && !c && !d || i && u && l || !n && l || !o)
        return 1;
      if (!i && !s && !d && t < a || d && n && o && !i && !s || c && n && o || !u && o || !l)
        return -1;
    }
    return 0;
  }
  return qs = r, qs;
}
var Is, If;
function sg() {
  if (If) return Is;
  If = 1;
  var e = ig();
  function r(t, a, n) {
    for (var i = -1, o = t.criteria, s = a.criteria, u = o.length, c = n.length; ++i < u; ) {
      var l = e(o[i], s[i]);
      if (l) {
        if (i >= c)
          return l;
        var d = n[i];
        return l * (d == "desc" ? -1 : 1);
      }
    }
    return t.index - a.index;
  }
  return Is = r, Is;
}
var Cs, Cf;
function og() {
  if (Cf) return Cs;
  Cf = 1;
  var e = Mr(), r = Lr(), t = Se(), a = f0(), n = ag(), i = kr(), o = sg(), s = Fe(), u = ne();
  function c(l, d, h) {
    d.length ? d = e(d, function(y) {
      return u(y) ? function(g) {
        return r(g, y.length === 1 ? y[0] : y);
      } : y;
    }) : d = [s];
    var p = -1;
    d = e(d, i(t));
    var N = a(l, function(y, g, m) {
      var v = e(d, function(b) {
        return b(y);
      });
      return { criteria: v, index: ++p, value: y };
    });
    return n(N, function(y, g) {
      return o(y, g, h);
    });
  }
  return Cs = c, Cs;
}
var Rs, Rf;
function ug() {
  if (Rf) return Rs;
  Rf = 1;
  var e = ko(), r = og(), t = jr(), a = Dr(), n = t(function(i, o) {
    if (i == null)
      return [];
    var s = o.length;
    return s > 1 && a(i, o[0], o[1]) ? o = [] : s > 2 && a(o[0], o[1], o[2]) && (o = [o[0]]), r(i, e(o, 1), []);
  });
  return Rs = n, Rs;
}
var Ss, Sf;
function cg() {
  if (Sf) return Ss;
  Sf = 1;
  var e = i0(), r = 0;
  function t(a) {
    var n = ++r;
    return e(a) + n;
  }
  return Ss = t, Ss;
}
var Es, Ef;
function lg() {
  if (Ef) return Es;
  Ef = 1;
  function e(r, t, a) {
    for (var n = -1, i = r.length, o = t.length, s = {}; ++n < i; ) {
      var u = n < o ? t[n] : void 0;
      a(s, r[n], u);
    }
    return s;
  }
  return Es = e, Es;
}
var ks, kf;
function dg() {
  if (kf) return ks;
  kf = 1;
  var e = Sr(), r = lg();
  function t(a, n) {
    return r(a || [], n || [], e);
  }
  return ks = t, ks;
}
var As, Af;
function Q() {
  if (Af) return As;
  Af = 1;
  var e;
  if (typeof vo == "function")
    try {
      e = {
        cloneDeep: Rb(),
        constant: Io(),
        defaults: Sb(),
        each: Xh(),
        filter: c0(),
        find: Pb(),
        flatten: C0(),
        forEach: Zh(),
        forIn: Lb(),
        has: l0(),
        isUndefined: d0(),
        last: jb(),
        map: h0(),
        mapValues: Db(),
        max: Gb(),
        merge: Hb(),
        min: Vb(),
        minBy: Wb(),
        now: Yb(),
        pick: eg(),
        range: ng(),
        reduce: p0(),
        sortBy: ug(),
        uniqueId: cg(),
        values: y0(),
        zipObject: dg()
      };
    } catch {
    }
  return e || (e = window._), As = e, As;
}
var Ts, Tf;
function fg() {
  if (Tf) return Ts;
  Tf = 1, Ts = e;
  function e() {
    var a = {};
    a._next = a._prev = a, this._sentinel = a;
  }
  e.prototype.dequeue = function() {
    var a = this._sentinel, n = a._prev;
    if (n !== a)
      return r(n), n;
  }, e.prototype.enqueue = function(a) {
    var n = this._sentinel;
    a._prev && a._next && r(a), a._next = n._next, n._next._prev = a, n._next = a, a._prev = n;
  }, e.prototype.toString = function() {
    for (var a = [], n = this._sentinel, i = n._prev; i !== n; )
      a.push(JSON.stringify(i, t)), i = i._prev;
    return "[" + a.join(", ") + "]";
  };
  function r(a) {
    a._prev._next = a._next, a._next._prev = a._prev, delete a._next, delete a._prev;
  }
  function t(a, n) {
    if (a !== "_next" && a !== "_prev")
      return n;
  }
  return Ts;
}
var Os, Of;
function hg() {
  if (Of) return Os;
  Of = 1;
  var e = Q(), r = xe().Graph, t = fg();
  Os = n;
  var a = e.constant(1);
  function n(c, l) {
    if (c.nodeCount() <= 1)
      return [];
    var d = s(c, l || a), h = i(d.graph, d.buckets, d.zeroIdx);
    return e.flatten(e.map(h, function(p) {
      return c.outEdges(p.v, p.w);
    }), !0);
  }
  function i(c, l, d) {
    for (var h = [], p = l[l.length - 1], N = l[0], y; c.nodeCount(); ) {
      for (; y = N.dequeue(); )
        o(c, l, d, y);
      for (; y = p.dequeue(); )
        o(c, l, d, y);
      if (c.nodeCount()) {
        for (var g = l.length - 2; g > 0; --g)
          if (y = l[g].dequeue(), y) {
            h = h.concat(o(c, l, d, y, !0));
            break;
          }
      }
    }
    return h;
  }
  function o(c, l, d, h, p) {
    var N = p ? [] : void 0;
    return e.forEach(c.inEdges(h.v), function(y) {
      var g = c.edge(y), m = c.node(y.v);
      p && N.push({ v: y.v, w: y.w }), m.out -= g, u(l, d, m);
    }), e.forEach(c.outEdges(h.v), function(y) {
      var g = c.edge(y), m = y.w, v = c.node(m);
      v.in -= g, u(l, d, v);
    }), c.removeNode(h.v), N;
  }
  function s(c, l) {
    var d = new r(), h = 0, p = 0;
    e.forEach(c.nodes(), function(g) {
      d.setNode(g, { v: g, in: 0, out: 0 });
    }), e.forEach(c.edges(), function(g) {
      var m = d.edge(g.v, g.w) || 0, v = l(g), b = m + v;
      d.setEdge(g.v, g.w, b), p = Math.max(p, d.node(g.v).out += v), h = Math.max(h, d.node(g.w).in += v);
    });
    var N = e.range(p + h + 3).map(function() {
      return new t();
    }), y = h + 1;
    return e.forEach(d.nodes(), function(g) {
      u(N, y, d.node(g));
    }), { graph: d, buckets: N, zeroIdx: y };
  }
  function u(c, l, d) {
    d.out ? d.in ? c[d.out - d.in + l].enqueue(d) : c[c.length - 1].enqueue(d) : c[0].enqueue(d);
  }
  return Os;
}
var Ms, Mf;
function pg() {
  if (Mf) return Ms;
  Mf = 1;
  var e = Q(), r = hg();
  Ms = {
    run: t,
    undo: n
  };
  function t(i) {
    var o = i.graph().acyclicer === "greedy" ? r(i, s(i)) : a(i);
    e.forEach(o, function(u) {
      var c = i.edge(u);
      i.removeEdge(u), c.forwardName = u.name, c.reversed = !0, i.setEdge(u.w, u.v, c, e.uniqueId("rev"));
    });
    function s(u) {
      return function(c) {
        return u.edge(c).weight;
      };
    }
  }
  function a(i) {
    var o = [], s = {}, u = {};
    function c(l) {
      e.has(u, l) || (u[l] = !0, s[l] = !0, e.forEach(i.outEdges(l), function(d) {
        e.has(s, d.w) ? o.push(d) : c(d.w);
      }), delete s[l]);
    }
    return e.forEach(i.nodes(), c), o;
  }
  function n(i) {
    e.forEach(i.edges(), function(o) {
      var s = i.edge(o);
      if (s.reversed) {
        i.removeEdge(o);
        var u = s.forwardName;
        delete s.reversed, delete s.forwardName, i.setEdge(o.w, o.v, s, u);
      }
    });
  }
  return Ms;
}
var Ps, Pf;
function pe() {
  if (Pf) return Ps;
  Pf = 1;
  var e = Q(), r = xe().Graph;
  Ps = {
    addDummyNode: t,
    simplify: a,
    asNonCompoundGraph: n,
    successorWeights: i,
    predecessorWeights: o,
    intersectRect: s,
    buildLayerMatrix: u,
    normalizeRanks: c,
    removeEmptyRanks: l,
    addBorderNode: d,
    maxRank: h,
    partition: p,
    time: N,
    notime: y
  };
  function t(g, m, v, b) {
    var _;
    do
      _ = e.uniqueId(b);
    while (g.hasNode(_));
    return v.dummy = m, g.setNode(_, v), _;
  }
  function a(g) {
    var m = new r().setGraph(g.graph());
    return e.forEach(g.nodes(), function(v) {
      m.setNode(v, g.node(v));
    }), e.forEach(g.edges(), function(v) {
      var b = m.edge(v.v, v.w) || { weight: 0, minlen: 1 }, _ = g.edge(v);
      m.setEdge(v.v, v.w, {
        weight: b.weight + _.weight,
        minlen: Math.max(b.minlen, _.minlen)
      });
    }), m;
  }
  function n(g) {
    var m = new r({ multigraph: g.isMultigraph() }).setGraph(g.graph());
    return e.forEach(g.nodes(), function(v) {
      g.children(v).length || m.setNode(v, g.node(v));
    }), e.forEach(g.edges(), function(v) {
      m.setEdge(v, g.edge(v));
    }), m;
  }
  function i(g) {
    var m = e.map(g.nodes(), function(v) {
      var b = {};
      return e.forEach(g.outEdges(v), function(_) {
        b[_.w] = (b[_.w] || 0) + g.edge(_).weight;
      }), b;
    });
    return e.zipObject(g.nodes(), m);
  }
  function o(g) {
    var m = e.map(g.nodes(), function(v) {
      var b = {};
      return e.forEach(g.inEdges(v), function(_) {
        b[_.v] = (b[_.v] || 0) + g.edge(_).weight;
      }), b;
    });
    return e.zipObject(g.nodes(), m);
  }
  function s(g, m) {
    var v = g.x, b = g.y, _ = m.x - v, x = m.y - b, q = g.width / 2, C = g.height / 2;
    if (!_ && !x)
      throw new Error("Not possible to find intersection inside of the rectangle");
    var R, I;
    return Math.abs(x) * q > Math.abs(_) * C ? (x < 0 && (C = -C), R = C * _ / x, I = C) : (_ < 0 && (q = -q), R = q, I = q * x / _), { x: v + R, y: b + I };
  }
  function u(g) {
    var m = e.map(e.range(h(g) + 1), function() {
      return [];
    });
    return e.forEach(g.nodes(), function(v) {
      var b = g.node(v), _ = b.rank;
      e.isUndefined(_) || (m[_][b.order] = v);
    }), m;
  }
  function c(g) {
    var m = e.min(e.map(g.nodes(), function(v) {
      return g.node(v).rank;
    }));
    e.forEach(g.nodes(), function(v) {
      var b = g.node(v);
      e.has(b, "rank") && (b.rank -= m);
    });
  }
  function l(g) {
    var m = e.min(e.map(g.nodes(), function(x) {
      return g.node(x).rank;
    })), v = [];
    e.forEach(g.nodes(), function(x) {
      var q = g.node(x).rank - m;
      v[q] || (v[q] = []), v[q].push(x);
    });
    var b = 0, _ = g.graph().nodeRankFactor;
    e.forEach(v, function(x, q) {
      e.isUndefined(x) && q % _ !== 0 ? --b : b && e.forEach(x, function(C) {
        g.node(C).rank += b;
      });
    });
  }
  function d(g, m, v, b) {
    var _ = {
      width: 0,
      height: 0
    };
    return arguments.length >= 4 && (_.rank = v, _.order = b), t(g, "border", _, m);
  }
  function h(g) {
    return e.max(e.map(g.nodes(), function(m) {
      var v = g.node(m).rank;
      if (!e.isUndefined(v))
        return v;
    }));
  }
  function p(g, m) {
    var v = { lhs: [], rhs: [] };
    return e.forEach(g, function(b) {
      m(b) ? v.lhs.push(b) : v.rhs.push(b);
    }), v;
  }
  function N(g, m) {
    var v = e.now();
    try {
      return m();
    } finally {
      console.log(g + " time: " + (e.now() - v) + "ms");
    }
  }
  function y(g, m) {
    return m();
  }
  return Ps;
}
var Ls, Lf;
function vg() {
  if (Lf) return Ls;
  Lf = 1;
  var e = Q(), r = pe();
  Ls = {
    run: t,
    undo: n
  };
  function t(i) {
    i.graph().dummyChains = [], e.forEach(i.edges(), function(o) {
      a(i, o);
    });
  }
  function a(i, o) {
    var s = o.v, u = i.node(s).rank, c = o.w, l = i.node(c).rank, d = o.name, h = i.edge(o), p = h.labelRank;
    if (l !== u + 1) {
      i.removeEdge(o);
      var N, y, g;
      for (g = 0, ++u; u < l; ++g, ++u)
        h.points = [], y = {
          width: 0,
          height: 0,
          edgeLabel: h,
          edgeObj: o,
          rank: u
        }, N = r.addDummyNode(i, "edge", y, "_d"), u === p && (y.width = h.width, y.height = h.height, y.dummy = "edge-label", y.labelpos = h.labelpos), i.setEdge(s, N, { weight: h.weight }, d), g === 0 && i.graph().dummyChains.push(N), s = N;
      i.setEdge(s, c, { weight: h.weight }, d);
    }
  }
  function n(i) {
    e.forEach(i.graph().dummyChains, function(o) {
      var s = i.node(o), u = s.edgeLabel, c;
      for (i.setEdge(s.edgeObj, u); s.dummy; )
        c = i.successors(o)[0], i.removeNode(o), u.points.push({ x: s.x, y: s.y }), s.dummy === "edge-label" && (u.x = s.x, u.y = s.y, u.width = s.width, u.height = s.height), o = c, s = i.node(o);
    });
  }
  return Ls;
}
var js, jf;
function gr() {
  if (jf) return js;
  jf = 1;
  var e = Q();
  js = {
    longestPath: r,
    slack: t
  };
  function r(a) {
    var n = {};
    function i(o) {
      var s = a.node(o);
      if (e.has(n, o))
        return s.rank;
      n[o] = !0;
      var u = e.min(e.map(a.outEdges(o), function(c) {
        return i(c.w) - a.edge(c).minlen;
      }));
      return (u === Number.POSITIVE_INFINITY || // return value of _.map([]) for Lodash 3
      u === void 0 || // return value of _.map([]) for Lodash 4
      u === null) && (u = 0), s.rank = u;
    }
    e.forEach(a.sources(), i);
  }
  function t(a, n) {
    return a.node(n.w).rank - a.node(n.v).rank - a.edge(n).minlen;
  }
  return js;
}
var Ds, Df;
function k0() {
  if (Df) return Ds;
  Df = 1;
  var e = Q(), r = xe().Graph, t = gr().slack;
  Ds = a;
  function a(s) {
    var u = new r({ directed: !1 }), c = s.nodes()[0], l = s.nodeCount();
    u.setNode(c, {});
    for (var d, h; n(u, s) < l; )
      d = i(u, s), h = u.hasNode(d.v) ? t(s, d) : -t(s, d), o(u, s, h);
    return u;
  }
  function n(s, u) {
    function c(l) {
      e.forEach(u.nodeEdges(l), function(d) {
        var h = d.v, p = l === h ? d.w : h;
        !s.hasNode(p) && !t(u, d) && (s.setNode(p, {}), s.setEdge(l, p, {}), c(p));
      });
    }
    return e.forEach(s.nodes(), c), s.nodeCount();
  }
  function i(s, u) {
    return e.minBy(u.edges(), function(c) {
      if (s.hasNode(c.v) !== s.hasNode(c.w))
        return t(u, c);
    });
  }
  function o(s, u, c) {
    e.forEach(s.nodes(), function(l) {
      u.node(l).rank += c;
    });
  }
  return Ds;
}
var Fs, Ff;
function mg() {
  if (Ff) return Fs;
  Ff = 1;
  var e = Q(), r = k0(), t = gr().slack, a = gr().longestPath, n = xe().alg.preorder, i = xe().alg.postorder, o = pe().simplify;
  Fs = s, s.initLowLimValues = d, s.initCutValues = u, s.calcCutValue = l, s.leaveEdge = p, s.enterEdge = N, s.exchangeEdges = y;
  function s(b) {
    b = o(b), a(b);
    var _ = r(b);
    d(_), u(_, b);
    for (var x, q; x = p(_); )
      q = N(_, b, x), y(_, b, x, q);
  }
  function u(b, _) {
    var x = i(b, b.nodes());
    x = x.slice(0, x.length - 1), e.forEach(x, function(q) {
      c(b, _, q);
    });
  }
  function c(b, _, x) {
    var q = b.node(x), C = q.parent;
    b.edge(x, C).cutvalue = l(b, _, x);
  }
  function l(b, _, x) {
    var q = b.node(x), C = q.parent, R = !0, I = _.edge(x, C), S = 0;
    return I || (R = !1, I = _.edge(C, x)), S = I.weight, e.forEach(_.nodeEdges(x), function(A) {
      var M = A.v === x, D = M ? A.w : A.v;
      if (D !== C) {
        var B = M === R, $ = _.edge(A).weight;
        if (S += B ? $ : -$, m(b, x, D)) {
          var X = b.edge(x, D).cutvalue;
          S += B ? -X : X;
        }
      }
    }), S;
  }
  function d(b, _) {
    arguments.length < 2 && (_ = b.nodes()[0]), h(b, {}, 1, _);
  }
  function h(b, _, x, q, C) {
    var R = x, I = b.node(q);
    return _[q] = !0, e.forEach(b.neighbors(q), function(S) {
      e.has(_, S) || (x = h(b, _, x, S, q));
    }), I.low = R, I.lim = x++, C ? I.parent = C : delete I.parent, x;
  }
  function p(b) {
    return e.find(b.edges(), function(_) {
      return b.edge(_).cutvalue < 0;
    });
  }
  function N(b, _, x) {
    var q = x.v, C = x.w;
    _.hasEdge(q, C) || (q = x.w, C = x.v);
    var R = b.node(q), I = b.node(C), S = R, A = !1;
    R.lim > I.lim && (S = I, A = !0);
    var M = e.filter(_.edges(), function(D) {
      return A === v(b, b.node(D.v), S) && A !== v(b, b.node(D.w), S);
    });
    return e.minBy(M, function(D) {
      return t(_, D);
    });
  }
  function y(b, _, x, q) {
    var C = x.v, R = x.w;
    b.removeEdge(C, R), b.setEdge(q.v, q.w, {}), d(b), u(b, _), g(b, _);
  }
  function g(b, _) {
    var x = e.find(b.nodes(), function(C) {
      return !_.node(C).parent;
    }), q = n(b, x);
    q = q.slice(1), e.forEach(q, function(C) {
      var R = b.node(C).parent, I = _.edge(C, R), S = !1;
      I || (I = _.edge(R, C), S = !0), _.node(C).rank = _.node(R).rank + (S ? I.minlen : -I.minlen);
    });
  }
  function m(b, _, x) {
    return b.hasEdge(_, x);
  }
  function v(b, _, x) {
    return x.low <= _.lim && _.lim <= x.lim;
  }
  return Fs;
}
var Gs, Gf;
function bg() {
  if (Gf) return Gs;
  Gf = 1;
  var e = gr(), r = e.longestPath, t = k0(), a = mg();
  Gs = n;
  function n(u) {
    switch (u.graph().ranker) {
      case "network-simplex":
        s(u);
        break;
      case "tight-tree":
        o(u);
        break;
      case "longest-path":
        i(u);
        break;
      default:
        s(u);
    }
  }
  var i = r;
  function o(u) {
    r(u), t(u);
  }
  function s(u) {
    a(u);
  }
  return Gs;
}
var zs, zf;
function gg() {
  if (zf) return zs;
  zf = 1;
  var e = Q();
  zs = r;
  function r(n) {
    var i = a(n);
    e.forEach(n.graph().dummyChains, function(o) {
      for (var s = n.node(o), u = s.edgeObj, c = t(n, i, u.v, u.w), l = c.path, d = c.lca, h = 0, p = l[h], N = !0; o !== u.w; ) {
        if (s = n.node(o), N) {
          for (; (p = l[h]) !== d && n.node(p).maxRank < s.rank; )
            h++;
          p === d && (N = !1);
        }
        if (!N) {
          for (; h < l.length - 1 && n.node(p = l[h + 1]).minRank <= s.rank; )
            h++;
          p = l[h];
        }
        n.setParent(o, p), o = n.successors(o)[0];
      }
    });
  }
  function t(n, i, o, s) {
    var u = [], c = [], l = Math.min(i[o].low, i[s].low), d = Math.max(i[o].lim, i[s].lim), h, p;
    h = o;
    do
      h = n.parent(h), u.push(h);
    while (h && (i[h].low > l || d > i[h].lim));
    for (p = h, h = s; (h = n.parent(h)) !== p; )
      c.push(h);
    return { path: u.concat(c.reverse()), lca: p };
  }
  function a(n) {
    var i = {}, o = 0;
    function s(u) {
      var c = o;
      e.forEach(n.children(u), s), i[u] = { low: c, lim: o++ };
    }
    return e.forEach(n.children(), s), i;
  }
  return zs;
}
var Bs, Bf;
function yg() {
  if (Bf) return Bs;
  Bf = 1;
  var e = Q(), r = pe();
  Bs = {
    run: t,
    cleanup: o
  };
  function t(s) {
    var u = r.addDummyNode(s, "root", {}, "_root"), c = n(s), l = e.max(e.values(c)) - 1, d = 2 * l + 1;
    s.graph().nestingRoot = u, e.forEach(s.edges(), function(p) {
      s.edge(p).minlen *= d;
    });
    var h = i(s) + 1;
    e.forEach(s.children(), function(p) {
      a(s, u, d, h, l, c, p);
    }), s.graph().nodeRankFactor = d;
  }
  function a(s, u, c, l, d, h, p) {
    var N = s.children(p);
    if (!N.length) {
      p !== u && s.setEdge(u, p, { weight: 0, minlen: c });
      return;
    }
    var y = r.addBorderNode(s, "_bt"), g = r.addBorderNode(s, "_bb"), m = s.node(p);
    s.setParent(y, p), m.borderTop = y, s.setParent(g, p), m.borderBottom = g, e.forEach(N, function(v) {
      a(s, u, c, l, d, h, v);
      var b = s.node(v), _ = b.borderTop ? b.borderTop : v, x = b.borderBottom ? b.borderBottom : v, q = b.borderTop ? l : 2 * l, C = _ !== x ? 1 : d - h[p] + 1;
      s.setEdge(y, _, {
        weight: q,
        minlen: C,
        nestingEdge: !0
      }), s.setEdge(x, g, {
        weight: q,
        minlen: C,
        nestingEdge: !0
      });
    }), s.parent(p) || s.setEdge(u, y, { weight: 0, minlen: d + h[p] });
  }
  function n(s) {
    var u = {};
    function c(l, d) {
      var h = s.children(l);
      h && h.length && e.forEach(h, function(p) {
        c(p, d + 1);
      }), u[l] = d;
    }
    return e.forEach(s.children(), function(l) {
      c(l, 1);
    }), u;
  }
  function i(s) {
    return e.reduce(s.edges(), function(u, c) {
      return u + s.edge(c).weight;
    }, 0);
  }
  function o(s) {
    var u = s.graph();
    s.removeNode(u.nestingRoot), delete u.nestingRoot, e.forEach(s.edges(), function(c) {
      var l = s.edge(c);
      l.nestingEdge && s.removeEdge(c);
    });
  }
  return Bs;
}
var Us, Uf;
function xg() {
  if (Uf) return Us;
  Uf = 1;
  var e = Q(), r = pe();
  Us = t;
  function t(n) {
    function i(o) {
      var s = n.children(o), u = n.node(o);
      if (s.length && e.forEach(s, i), e.has(u, "minRank")) {
        u.borderLeft = [], u.borderRight = [];
        for (var c = u.minRank, l = u.maxRank + 1; c < l; ++c)
          a(n, "borderLeft", "_bl", o, u, c), a(n, "borderRight", "_br", o, u, c);
      }
    }
    e.forEach(n.children(), i);
  }
  function a(n, i, o, s, u, c) {
    var l = { width: 0, height: 0, rank: c, borderType: i }, d = u[i][c - 1], h = r.addDummyNode(n, "border", l, o);
    u[i][c] = h, n.setParent(h, s), d && n.setEdge(d, h, { weight: 1 });
  }
  return Us;
}
var $s, $f;
function _g() {
  if ($f) return $s;
  $f = 1;
  var e = Q();
  $s = {
    adjust: r,
    undo: t
  };
  function r(c) {
    var l = c.graph().rankdir.toLowerCase();
    (l === "lr" || l === "rl") && a(c);
  }
  function t(c) {
    var l = c.graph().rankdir.toLowerCase();
    (l === "bt" || l === "rl") && i(c), (l === "lr" || l === "rl") && (s(c), a(c));
  }
  function a(c) {
    e.forEach(c.nodes(), function(l) {
      n(c.node(l));
    }), e.forEach(c.edges(), function(l) {
      n(c.edge(l));
    });
  }
  function n(c) {
    var l = c.width;
    c.width = c.height, c.height = l;
  }
  function i(c) {
    e.forEach(c.nodes(), function(l) {
      o(c.node(l));
    }), e.forEach(c.edges(), function(l) {
      var d = c.edge(l);
      e.forEach(d.points, o), e.has(d, "y") && o(d);
    });
  }
  function o(c) {
    c.y = -c.y;
  }
  function s(c) {
    e.forEach(c.nodes(), function(l) {
      u(c.node(l));
    }), e.forEach(c.edges(), function(l) {
      var d = c.edge(l);
      e.forEach(d.points, u), e.has(d, "x") && u(d);
    });
  }
  function u(c) {
    var l = c.x;
    c.x = c.y, c.y = l;
  }
  return $s;
}
var Ks, Kf;
function wg() {
  if (Kf) return Ks;
  Kf = 1;
  var e = Q();
  Ks = r;
  function r(t) {
    var a = {}, n = e.filter(t.nodes(), function(c) {
      return !t.children(c).length;
    }), i = e.max(e.map(n, function(c) {
      return t.node(c).rank;
    })), o = e.map(e.range(i + 1), function() {
      return [];
    });
    function s(c) {
      if (!e.has(a, c)) {
        a[c] = !0;
        var l = t.node(c);
        o[l.rank].push(c), e.forEach(t.successors(c), s);
      }
    }
    var u = e.sortBy(n, function(c) {
      return t.node(c).rank;
    });
    return e.forEach(u, s), o;
  }
  return Ks;
}
var Hs, Hf;
function Ng() {
  if (Hf) return Hs;
  Hf = 1;
  var e = Q();
  Hs = r;
  function r(a, n) {
    for (var i = 0, o = 1; o < n.length; ++o)
      i += t(a, n[o - 1], n[o]);
    return i;
  }
  function t(a, n, i) {
    for (var o = e.zipObject(
      i,
      e.map(i, function(h, p) {
        return p;
      })
    ), s = e.flatten(e.map(n, function(h) {
      return e.sortBy(e.map(a.outEdges(h), function(p) {
        return { pos: o[p.w], weight: a.edge(p).weight };
      }), "pos");
    }), !0), u = 1; u < i.length; ) u <<= 1;
    var c = 2 * u - 1;
    u -= 1;
    var l = e.map(new Array(c), function() {
      return 0;
    }), d = 0;
    return e.forEach(s.forEach(function(h) {
      var p = h.pos + u;
      l[p] += h.weight;
      for (var N = 0; p > 0; )
        p % 2 && (N += l[p + 1]), p = p - 1 >> 1, l[p] += h.weight;
      d += h.weight * N;
    })), d;
  }
  return Hs;
}
var Vs, Vf;
function qg() {
  if (Vf) return Vs;
  Vf = 1;
  var e = Q();
  Vs = r;
  function r(t, a) {
    return e.map(a, function(n) {
      var i = t.inEdges(n);
      if (i.length) {
        var o = e.reduce(i, function(s, u) {
          var c = t.edge(u), l = t.node(u.v);
          return {
            sum: s.sum + c.weight * l.order,
            weight: s.weight + c.weight
          };
        }, { sum: 0, weight: 0 });
        return {
          v: n,
          barycenter: o.sum / o.weight,
          weight: o.weight
        };
      } else
        return { v: n };
    });
  }
  return Vs;
}
var Ws, Wf;
function Ig() {
  if (Wf) return Ws;
  Wf = 1;
  var e = Q();
  Ws = r;
  function r(n, i) {
    var o = {};
    e.forEach(n, function(u, c) {
      var l = o[u.v] = {
        indegree: 0,
        in: [],
        out: [],
        vs: [u.v],
        i: c
      };
      e.isUndefined(u.barycenter) || (l.barycenter = u.barycenter, l.weight = u.weight);
    }), e.forEach(i.edges(), function(u) {
      var c = o[u.v], l = o[u.w];
      !e.isUndefined(c) && !e.isUndefined(l) && (l.indegree++, c.out.push(o[u.w]));
    });
    var s = e.filter(o, function(u) {
      return !u.indegree;
    });
    return t(s);
  }
  function t(n) {
    var i = [];
    function o(c) {
      return function(l) {
        l.merged || (e.isUndefined(l.barycenter) || e.isUndefined(c.barycenter) || l.barycenter >= c.barycenter) && a(c, l);
      };
    }
    function s(c) {
      return function(l) {
        l.in.push(c), --l.indegree === 0 && n.push(l);
      };
    }
    for (; n.length; ) {
      var u = n.pop();
      i.push(u), e.forEach(u.in.reverse(), o(u)), e.forEach(u.out, s(u));
    }
    return e.map(
      e.filter(i, function(c) {
        return !c.merged;
      }),
      function(c) {
        return e.pick(c, ["vs", "i", "barycenter", "weight"]);
      }
    );
  }
  function a(n, i) {
    var o = 0, s = 0;
    n.weight && (o += n.barycenter * n.weight, s += n.weight), i.weight && (o += i.barycenter * i.weight, s += i.weight), n.vs = i.vs.concat(n.vs), n.barycenter = o / s, n.weight = s, n.i = Math.min(i.i, n.i), i.merged = !0;
  }
  return Ws;
}
var Ys, Yf;
function Cg() {
  if (Yf) return Ys;
  Yf = 1;
  var e = Q(), r = pe();
  Ys = t;
  function t(i, o) {
    var s = r.partition(i, function(y) {
      return e.has(y, "barycenter");
    }), u = s.lhs, c = e.sortBy(s.rhs, function(y) {
      return -y.i;
    }), l = [], d = 0, h = 0, p = 0;
    u.sort(n(!!o)), p = a(l, c, p), e.forEach(u, function(y) {
      p += y.vs.length, l.push(y.vs), d += y.barycenter * y.weight, h += y.weight, p = a(l, c, p);
    });
    var N = { vs: e.flatten(l, !0) };
    return h && (N.barycenter = d / h, N.weight = h), N;
  }
  function a(i, o, s) {
    for (var u; o.length && (u = e.last(o)).i <= s; )
      o.pop(), i.push(u.vs), s++;
    return s;
  }
  function n(i) {
    return function(o, s) {
      return o.barycenter < s.barycenter ? -1 : o.barycenter > s.barycenter ? 1 : i ? s.i - o.i : o.i - s.i;
    };
  }
  return Ys;
}
var Js, Jf;
function Rg() {
  if (Jf) return Js;
  Jf = 1;
  var e = Q(), r = qg(), t = Ig(), a = Cg();
  Js = n;
  function n(s, u, c, l) {
    var d = s.children(u), h = s.node(u), p = h ? h.borderLeft : void 0, N = h ? h.borderRight : void 0, y = {};
    p && (d = e.filter(d, function(x) {
      return x !== p && x !== N;
    }));
    var g = r(s, d);
    e.forEach(g, function(x) {
      if (s.children(x.v).length) {
        var q = n(s, x.v, c, l);
        y[x.v] = q, e.has(q, "barycenter") && o(x, q);
      }
    });
    var m = t(g, c);
    i(m, y);
    var v = a(m, l);
    if (p && (v.vs = e.flatten([p, v.vs, N], !0), s.predecessors(p).length)) {
      var b = s.node(s.predecessors(p)[0]), _ = s.node(s.predecessors(N)[0]);
      e.has(v, "barycenter") || (v.barycenter = 0, v.weight = 0), v.barycenter = (v.barycenter * v.weight + b.order + _.order) / (v.weight + 2), v.weight += 2;
    }
    return v;
  }
  function i(s, u) {
    e.forEach(s, function(c) {
      c.vs = e.flatten(c.vs.map(function(l) {
        return u[l] ? u[l].vs : l;
      }), !0);
    });
  }
  function o(s, u) {
    e.isUndefined(s.barycenter) ? (s.barycenter = u.barycenter, s.weight = u.weight) : (s.barycenter = (s.barycenter * s.weight + u.barycenter * u.weight) / (s.weight + u.weight), s.weight += u.weight);
  }
  return Js;
}
var Zs, Zf;
function Sg() {
  if (Zf) return Zs;
  Zf = 1;
  var e = Q(), r = xe().Graph;
  Zs = t;
  function t(n, i, o) {
    var s = a(n), u = new r({ compound: !0 }).setGraph({ root: s }).setDefaultNodeLabel(function(c) {
      return n.node(c);
    });
    return e.forEach(n.nodes(), function(c) {
      var l = n.node(c), d = n.parent(c);
      (l.rank === i || l.minRank <= i && i <= l.maxRank) && (u.setNode(c), u.setParent(c, d || s), e.forEach(n[o](c), function(h) {
        var p = h.v === c ? h.w : h.v, N = u.edge(p, c), y = e.isUndefined(N) ? 0 : N.weight;
        u.setEdge(p, c, { weight: n.edge(h).weight + y });
      }), e.has(l, "minRank") && u.setNode(c, {
        borderLeft: l.borderLeft[i],
        borderRight: l.borderRight[i]
      }));
    }), u;
  }
  function a(n) {
    for (var i; n.hasNode(i = e.uniqueId("_root")); ) ;
    return i;
  }
  return Zs;
}
var Xs, Xf;
function Eg() {
  if (Xf) return Xs;
  Xf = 1;
  var e = Q();
  Xs = r;
  function r(t, a, n) {
    var i = {}, o;
    e.forEach(n, function(s) {
      for (var u = t.parent(s), c, l; u; ) {
        if (c = t.parent(u), c ? (l = i[c], i[c] = u) : (l = o, o = u), l && l !== u) {
          a.setEdge(l, u);
          return;
        }
        u = c;
      }
    });
  }
  return Xs;
}
var Qs, Qf;
function kg() {
  if (Qf) return Qs;
  Qf = 1;
  var e = Q(), r = wg(), t = Ng(), a = Rg(), n = Sg(), i = Eg(), o = xe().Graph, s = pe();
  Qs = u;
  function u(h) {
    var p = s.maxRank(h), N = c(h, e.range(1, p + 1), "inEdges"), y = c(h, e.range(p - 1, -1, -1), "outEdges"), g = r(h);
    d(h, g);
    for (var m = Number.POSITIVE_INFINITY, v, b = 0, _ = 0; _ < 4; ++b, ++_) {
      l(b % 2 ? N : y, b % 4 >= 2), g = s.buildLayerMatrix(h);
      var x = t(h, g);
      x < m && (_ = 0, v = e.cloneDeep(g), m = x);
    }
    d(h, v);
  }
  function c(h, p, N) {
    return e.map(p, function(y) {
      return n(h, y, N);
    });
  }
  function l(h, p) {
    var N = new o();
    e.forEach(h, function(y) {
      var g = y.graph().root, m = a(y, g, N, p);
      e.forEach(m.vs, function(v, b) {
        y.node(v).order = b;
      }), i(y, N, m.vs);
    });
  }
  function d(h, p) {
    e.forEach(p, function(N) {
      e.forEach(N, function(y, g) {
        h.node(y).order = g;
      });
    });
  }
  return Qs;
}
var eo, eh;
function Ag() {
  if (eh) return eo;
  eh = 1;
  var e = Q(), r = xe().Graph, t = pe();
  eo = {
    positionX: N,
    findType1Conflicts: a,
    findType2Conflicts: n,
    addConflict: o,
    hasConflict: s,
    verticalAlignment: u,
    horizontalCompaction: c,
    alignCoordinates: h,
    findSmallestWidthAlignment: d,
    balance: p
  };
  function a(m, v) {
    var b = {};
    function _(x, q) {
      var C = 0, R = 0, I = x.length, S = e.last(q);
      return e.forEach(q, function(A, M) {
        var D = i(m, A), B = D ? m.node(D).order : I;
        (D || A === S) && (e.forEach(q.slice(R, M + 1), function($) {
          e.forEach(m.predecessors($), function(X) {
            var O = m.node(X), j = O.order;
            (j < C || B < j) && !(O.dummy && m.node($).dummy) && o(b, X, $);
          });
        }), R = M + 1, C = B);
      }), q;
    }
    return e.reduce(v, _), b;
  }
  function n(m, v) {
    var b = {};
    function _(q, C, R, I, S) {
      var A;
      e.forEach(e.range(C, R), function(M) {
        A = q[M], m.node(A).dummy && e.forEach(m.predecessors(A), function(D) {
          var B = m.node(D);
          B.dummy && (B.order < I || B.order > S) && o(b, D, A);
        });
      });
    }
    function x(q, C) {
      var R = -1, I, S = 0;
      return e.forEach(C, function(A, M) {
        if (m.node(A).dummy === "border") {
          var D = m.predecessors(A);
          D.length && (I = m.node(D[0]).order, _(C, S, M, R, I), S = M, R = I);
        }
        _(C, S, C.length, I, q.length);
      }), C;
    }
    return e.reduce(v, x), b;
  }
  function i(m, v) {
    if (m.node(v).dummy)
      return e.find(m.predecessors(v), function(b) {
        return m.node(b).dummy;
      });
  }
  function o(m, v, b) {
    if (v > b) {
      var _ = v;
      v = b, b = _;
    }
    var x = m[v];
    x || (m[v] = x = {}), x[b] = !0;
  }
  function s(m, v, b) {
    if (v > b) {
      var _ = v;
      v = b, b = _;
    }
    return e.has(m[v], b);
  }
  function u(m, v, b, _) {
    var x = {}, q = {}, C = {};
    return e.forEach(v, function(R) {
      e.forEach(R, function(I, S) {
        x[I] = I, q[I] = I, C[I] = S;
      });
    }), e.forEach(v, function(R) {
      var I = -1;
      e.forEach(R, function(S) {
        var A = _(S);
        if (A.length) {
          A = e.sortBy(A, function(X) {
            return C[X];
          });
          for (var M = (A.length - 1) / 2, D = Math.floor(M), B = Math.ceil(M); D <= B; ++D) {
            var $ = A[D];
            q[S] === S && I < C[$] && !s(b, S, $) && (q[$] = S, q[S] = x[S] = x[$], I = C[$]);
          }
        }
      });
    }), { root: x, align: q };
  }
  function c(m, v, b, _, x) {
    var q = {}, C = l(m, v, b, x), R = x ? "borderLeft" : "borderRight";
    function I(M, D) {
      for (var B = C.nodes(), $ = B.pop(), X = {}; $; )
        X[$] ? M($) : (X[$] = !0, B.push($), B = B.concat(D($))), $ = B.pop();
    }
    function S(M) {
      q[M] = C.inEdges(M).reduce(function(D, B) {
        return Math.max(D, q[B.v] + C.edge(B));
      }, 0);
    }
    function A(M) {
      var D = C.outEdges(M).reduce(function($, X) {
        return Math.min($, q[X.w] - C.edge(X));
      }, Number.POSITIVE_INFINITY), B = m.node(M);
      D !== Number.POSITIVE_INFINITY && B.borderType !== R && (q[M] = Math.max(q[M], D));
    }
    return I(S, C.predecessors.bind(C)), I(A, C.successors.bind(C)), e.forEach(_, function(M) {
      q[M] = q[b[M]];
    }), q;
  }
  function l(m, v, b, _) {
    var x = new r(), q = m.graph(), C = y(q.nodesep, q.edgesep, _);
    return e.forEach(v, function(R) {
      var I;
      e.forEach(R, function(S) {
        var A = b[S];
        if (x.setNode(A), I) {
          var M = b[I], D = x.edge(M, A);
          x.setEdge(M, A, Math.max(C(m, S, I), D || 0));
        }
        I = S;
      });
    }), x;
  }
  function d(m, v) {
    return e.minBy(e.values(v), function(b) {
      var _ = Number.NEGATIVE_INFINITY, x = Number.POSITIVE_INFINITY;
      return e.forIn(b, function(q, C) {
        var R = g(m, C) / 2;
        _ = Math.max(q + R, _), x = Math.min(q - R, x);
      }), _ - x;
    });
  }
  function h(m, v) {
    var b = e.values(v), _ = e.min(b), x = e.max(b);
    e.forEach(["u", "d"], function(q) {
      e.forEach(["l", "r"], function(C) {
        var R = q + C, I = m[R], S;
        if (I !== v) {
          var A = e.values(I);
          S = C === "l" ? _ - e.min(A) : x - e.max(A), S && (m[R] = e.mapValues(I, function(M) {
            return M + S;
          }));
        }
      });
    });
  }
  function p(m, v) {
    return e.mapValues(m.ul, function(b, _) {
      if (v)
        return m[v.toLowerCase()][_];
      var x = e.sortBy(e.map(m, _));
      return (x[1] + x[2]) / 2;
    });
  }
  function N(m) {
    var v = t.buildLayerMatrix(m), b = e.merge(
      a(m, v),
      n(m, v)
    ), _ = {}, x;
    e.forEach(["u", "d"], function(C) {
      x = C === "u" ? v : e.values(v).reverse(), e.forEach(["l", "r"], function(R) {
        R === "r" && (x = e.map(x, function(M) {
          return e.values(M).reverse();
        }));
        var I = (C === "u" ? m.predecessors : m.successors).bind(m), S = u(m, x, b, I), A = c(
          m,
          x,
          S.root,
          S.align,
          R === "r"
        );
        R === "r" && (A = e.mapValues(A, function(M) {
          return -M;
        })), _[C + R] = A;
      });
    });
    var q = d(m, _);
    return h(_, q), p(_, m.graph().align);
  }
  function y(m, v, b) {
    return function(_, x, q) {
      var C = _.node(x), R = _.node(q), I = 0, S;
      if (I += C.width / 2, e.has(C, "labelpos"))
        switch (C.labelpos.toLowerCase()) {
          case "l":
            S = -C.width / 2;
            break;
          case "r":
            S = C.width / 2;
            break;
        }
      if (S && (I += b ? S : -S), S = 0, I += (C.dummy ? v : m) / 2, I += (R.dummy ? v : m) / 2, I += R.width / 2, e.has(R, "labelpos"))
        switch (R.labelpos.toLowerCase()) {
          case "l":
            S = R.width / 2;
            break;
          case "r":
            S = -R.width / 2;
            break;
        }
      return S && (I += b ? S : -S), S = 0, I;
    };
  }
  function g(m, v) {
    return m.node(v).width;
  }
  return eo;
}
var ro, rh;
function Tg() {
  if (rh) return ro;
  rh = 1;
  var e = Q(), r = pe(), t = Ag().positionX;
  ro = a;
  function a(i) {
    i = r.asNonCompoundGraph(i), n(i), e.forEach(t(i), function(o, s) {
      i.node(s).x = o;
    });
  }
  function n(i) {
    var o = r.buildLayerMatrix(i), s = i.graph().ranksep, u = 0;
    e.forEach(o, function(c) {
      var l = e.max(e.map(c, function(d) {
        return i.node(d).height;
      }));
      e.forEach(c, function(d) {
        i.node(d).y = u + l / 2;
      }), u += l + s;
    });
  }
  return ro;
}
var to, th;
function Og() {
  if (th) return to;
  th = 1;
  var e = Q(), r = pg(), t = vg(), a = bg(), n = pe().normalizeRanks, i = gg(), o = pe().removeEmptyRanks, s = yg(), u = xg(), c = _g(), l = kg(), d = Tg(), h = pe(), p = xe().Graph;
  to = N;
  function N(E, k) {
    var T = k && k.debugTiming ? h.time : h.notime;
    T("layout", function() {
      var P = T("  buildLayoutGraph", function() {
        return I(E);
      });
      T("  runLayout", function() {
        y(P, T);
      }), T("  updateInputGraph", function() {
        g(E, P);
      });
    });
  }
  function y(E, k) {
    k("    makeSpaceForEdgeLabels", function() {
      S(E);
    }), k("    removeSelfEdges", function() {
      L(E);
    }), k("    acyclic", function() {
      r.run(E);
    }), k("    nestingGraph.run", function() {
      s.run(E);
    }), k("    rank", function() {
      a(h.asNonCompoundGraph(E));
    }), k("    injectEdgeLabelProxies", function() {
      A(E);
    }), k("    removeEmptyRanks", function() {
      o(E);
    }), k("    nestingGraph.cleanup", function() {
      s.cleanup(E);
    }), k("    normalizeRanks", function() {
      n(E);
    }), k("    assignRankMinMax", function() {
      M(E);
    }), k("    removeEdgeLabelProxies", function() {
      D(E);
    }), k("    normalize.run", function() {
      t.run(E);
    }), k("    parentDummyChains", function() {
      i(E);
    }), k("    addBorderSegments", function() {
      u(E);
    }), k("    order", function() {
      l(E);
    }), k("    insertSelfEdges", function() {
      U(E);
    }), k("    adjustCoordinateSystem", function() {
      c.adjust(E);
    }), k("    position", function() {
      d(E);
    }), k("    positionSelfEdges", function() {
      ie(E);
    }), k("    removeBorderNodes", function() {
      j(E);
    }), k("    normalize.undo", function() {
      t.undo(E);
    }), k("    fixupEdgeLabelCoords", function() {
      X(E);
    }), k("    undoCoordinateSystem", function() {
      c.undo(E);
    }), k("    translateGraph", function() {
      B(E);
    }), k("    assignNodeIntersects", function() {
      $(E);
    }), k("    reversePoints", function() {
      O(E);
    }), k("    acyclic.undo", function() {
      r.undo(E);
    });
  }
  function g(E, k) {
    e.forEach(E.nodes(), function(T) {
      var P = E.node(T), H = k.node(T);
      P && (P.x = H.x, P.y = H.y, k.children(T).length && (P.width = H.width, P.height = H.height));
    }), e.forEach(E.edges(), function(T) {
      var P = E.edge(T), H = k.edge(T);
      P.points = H.points, e.has(H, "x") && (P.x = H.x, P.y = H.y);
    }), E.graph().width = k.graph().width, E.graph().height = k.graph().height;
  }
  var m = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"], v = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" }, b = ["acyclicer", "ranker", "rankdir", "align"], _ = ["width", "height"], x = { width: 0, height: 0 }, q = ["minlen", "weight", "width", "height", "labeloffset"], C = {
    minlen: 1,
    weight: 1,
    width: 0,
    height: 0,
    labeloffset: 10,
    labelpos: "r"
  }, R = ["labelpos"];
  function I(E) {
    var k = new p({ multigraph: !0, compound: !0 }), T = te(E.graph());
    return k.setGraph(e.merge(
      {},
      v,
      le(T, m),
      e.pick(T, b)
    )), e.forEach(E.nodes(), function(P) {
      var H = te(E.node(P));
      k.setNode(P, e.defaults(le(H, _), x)), k.setParent(P, E.parent(P));
    }), e.forEach(E.edges(), function(P) {
      var H = te(E.edge(P));
      k.setEdge(P, e.merge(
        {},
        C,
        le(H, q),
        e.pick(H, R)
      ));
    }), k;
  }
  function S(E) {
    var k = E.graph();
    k.ranksep /= 2, e.forEach(E.edges(), function(T) {
      var P = E.edge(T);
      P.minlen *= 2, P.labelpos.toLowerCase() !== "c" && (k.rankdir === "TB" || k.rankdir === "BT" ? P.width += P.labeloffset : P.height += P.labeloffset);
    });
  }
  function A(E) {
    e.forEach(E.edges(), function(k) {
      var T = E.edge(k);
      if (T.width && T.height) {
        var P = E.node(k.v), H = E.node(k.w), Z = { rank: (H.rank - P.rank) / 2 + P.rank, e: k };
        h.addDummyNode(E, "edge-proxy", Z, "_ep");
      }
    });
  }
  function M(E) {
    var k = 0;
    e.forEach(E.nodes(), function(T) {
      var P = E.node(T);
      P.borderTop && (P.minRank = E.node(P.borderTop).rank, P.maxRank = E.node(P.borderBottom).rank, k = e.max(k, P.maxRank));
    }), E.graph().maxRank = k;
  }
  function D(E) {
    e.forEach(E.nodes(), function(k) {
      var T = E.node(k);
      T.dummy === "edge-proxy" && (E.edge(T.e).labelRank = T.rank, E.removeNode(k));
    });
  }
  function B(E) {
    var k = Number.POSITIVE_INFINITY, T = 0, P = Number.POSITIVE_INFINITY, H = 0, Z = E.graph(), ee = Z.marginx || 0, ue = Z.marginy || 0;
    function Ge(ce) {
      var se = ce.x, V = ce.y, qe = ce.width, W = ce.height;
      k = Math.min(k, se - qe / 2), T = Math.max(T, se + qe / 2), P = Math.min(P, V - W / 2), H = Math.max(H, V + W / 2);
    }
    e.forEach(E.nodes(), function(ce) {
      Ge(E.node(ce));
    }), e.forEach(E.edges(), function(ce) {
      var se = E.edge(ce);
      e.has(se, "x") && Ge(se);
    }), k -= ee, P -= ue, e.forEach(E.nodes(), function(ce) {
      var se = E.node(ce);
      se.x -= k, se.y -= P;
    }), e.forEach(E.edges(), function(ce) {
      var se = E.edge(ce);
      e.forEach(se.points, function(V) {
        V.x -= k, V.y -= P;
      }), e.has(se, "x") && (se.x -= k), e.has(se, "y") && (se.y -= P);
    }), Z.width = T - k + ee, Z.height = H - P + ue;
  }
  function $(E) {
    e.forEach(E.edges(), function(k) {
      var T = E.edge(k), P = E.node(k.v), H = E.node(k.w), Z, ee;
      T.points ? (Z = T.points[0], ee = T.points[T.points.length - 1]) : (T.points = [], Z = H, ee = P), T.points.unshift(h.intersectRect(P, Z)), T.points.push(h.intersectRect(H, ee));
    });
  }
  function X(E) {
    e.forEach(E.edges(), function(k) {
      var T = E.edge(k);
      if (e.has(T, "x"))
        switch ((T.labelpos === "l" || T.labelpos === "r") && (T.width -= T.labeloffset), T.labelpos) {
          case "l":
            T.x -= T.width / 2 + T.labeloffset;
            break;
          case "r":
            T.x += T.width / 2 + T.labeloffset;
            break;
        }
    });
  }
  function O(E) {
    e.forEach(E.edges(), function(k) {
      var T = E.edge(k);
      T.reversed && T.points.reverse();
    });
  }
  function j(E) {
    e.forEach(E.nodes(), function(k) {
      if (E.children(k).length) {
        var T = E.node(k), P = E.node(T.borderTop), H = E.node(T.borderBottom), Z = E.node(e.last(T.borderLeft)), ee = E.node(e.last(T.borderRight));
        T.width = Math.abs(ee.x - Z.x), T.height = Math.abs(H.y - P.y), T.x = Z.x + T.width / 2, T.y = P.y + T.height / 2;
      }
    }), e.forEach(E.nodes(), function(k) {
      E.node(k).dummy === "border" && E.removeNode(k);
    });
  }
  function L(E) {
    e.forEach(E.edges(), function(k) {
      if (k.v === k.w) {
        var T = E.node(k.v);
        T.selfEdges || (T.selfEdges = []), T.selfEdges.push({ e: k, label: E.edge(k) }), E.removeEdge(k);
      }
    });
  }
  function U(E) {
    var k = h.buildLayerMatrix(E);
    e.forEach(k, function(T) {
      var P = 0;
      e.forEach(T, function(H, Z) {
        var ee = E.node(H);
        ee.order = Z + P, e.forEach(ee.selfEdges, function(ue) {
          h.addDummyNode(E, "selfedge", {
            width: ue.label.width,
            height: ue.label.height,
            rank: ee.rank,
            order: Z + ++P,
            e: ue.e,
            label: ue.label
          }, "_se");
        }), delete ee.selfEdges;
      });
    });
  }
  function ie(E) {
    e.forEach(E.nodes(), function(k) {
      var T = E.node(k);
      if (T.dummy === "selfedge") {
        var P = E.node(T.e.v), H = P.x + P.width / 2, Z = P.y, ee = T.x - H, ue = P.height / 2;
        E.setEdge(T.e, T.label), E.removeNode(k), T.label.points = [
          { x: H + 2 * ee / 3, y: Z - ue },
          { x: H + 5 * ee / 6, y: Z - ue },
          { x: H + ee, y: Z },
          { x: H + 5 * ee / 6, y: Z + ue },
          { x: H + 2 * ee / 3, y: Z + ue }
        ], T.label.x = T.x, T.label.y = T.y;
      }
    });
  }
  function le(E, k) {
    return e.mapValues(e.pick(E, k), Number);
  }
  function te(E) {
    var k = {};
    return e.forEach(E, function(T, P) {
      k[P.toLowerCase()] = T;
    }), k;
  }
  return to;
}
var no, nh;
function Mg() {
  if (nh) return no;
  nh = 1;
  var e = Q(), r = pe(), t = xe().Graph;
  no = {
    debugOrdering: a
  };
  function a(n) {
    var i = r.buildLayerMatrix(n), o = new t({ compound: !0, multigraph: !0 }).setGraph({});
    return e.forEach(n.nodes(), function(s) {
      o.setNode(s, { label: s }), o.setParent(s, "layer" + n.node(s).rank);
    }), e.forEach(n.edges(), function(s) {
      o.setEdge(s.v, s.w, {}, s.name);
    }), e.forEach(i, function(s, u) {
      var c = "layer" + u;
      o.setNode(c, { rank: "same" }), e.reduce(s, function(l, d) {
        return o.setEdge(l, d, { style: "invis" }), d;
      });
    }), o;
  }
  return no;
}
var ao, ah;
function Pg() {
  return ah || (ah = 1, ao = "0.8.5"), ao;
}
var io, ih;
function Lg() {
  return ih || (ih = 1, io = {
    graphlib: xe(),
    layout: Og(),
    debug: Mg(),
    util: {
      time: pe().time,
      notime: pe().notime
    },
    version: Pg()
  }), io;
}
var jg = Lg();
const sh = /* @__PURE__ */ _v(jg), oh = 280, uh = 120, ch = (e, r, t = "TB") => {
  const a = new sh.graphlib.Graph();
  return a.setDefaultEdgeLabel(() => ({})), a.setGraph({
    rankdir: t,
    ranksep: 140,
    // Increased vertical spacing (was default ~50, prev 100)
    nodesep: 140
    // Increased horizontal spacing (was default ~50, prev 80)
  }), e.forEach((i) => {
    a.setNode(i.id, { width: oh, height: uh });
  }), r.forEach((i) => {
    a.setEdge(i.source, i.target);
  }), sh.layout(a), { nodes: e.map((i) => {
    const o = a.node(i.id);
    return {
      ...i,
      targetPosition: mr.Top,
      sourcePosition: mr.Bottom,
      position: {
        x: o.x - oh / 2,
        y: o.y - uh / 2
      }
    };
  }), edges: r };
}, lh = (e) => {
  const r = new Map(e.map((a) => [a.scheduleId, a])), t = /* @__PURE__ */ new Map();
  return e.forEach((a) => {
    const n = [], i = /* @__PURE__ */ new Set();
    i.add(a.scheduleId);
    const o = a.direction === ve.TopDown ? [...a.children] : [...a.parents];
    for (; o.length > 0; ) {
      const s = o.shift();
      if (i.has(s)) continue;
      i.add(s);
      const u = r.get(s);
      u && (u.resources.forEach((c) => {
        n.push({
          ...c,
          sourceNodeId: u.scheduleId,
          sourceNodeName: u.name,
          sourceNodePriority: u.priority,
          isInherited: !0
        });
      }), a.direction === ve.TopDown ? o.push(...u.children) : o.push(...u.parents));
    }
    t.set(a.scheduleId, n);
  }), t;
}, Dg = (e, r) => {
  const t = r.target, a = r.source;
  if (!t || !a || t === a) return !0;
  const n = /* @__PURE__ */ new Map();
  e.forEach((s) => {
    var u;
    n.has(s.source) || n.set(s.source, []), (u = n.get(s.source)) == null || u.push(s.target);
  });
  const i = /* @__PURE__ */ new Set(), o = [t];
  for (; o.length > 0; ) {
    const s = o.pop();
    if (s === a) return !0;
    if (!i.has(s)) {
      i.add(s);
      const u = n.get(s) || [];
      for (const c of u)
        i.has(c) || o.push(c);
    }
  }
  return !1;
};
function Fg() {
  if (typeof crypto < "u" && typeof crypto.randomUUID == "function")
    return crypto.randomUUID();
  if (typeof crypto < "u" && typeof crypto.getRandomValues == "function") {
    const e = new Uint8Array(16);
    crypto.getRandomValues(e), e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128;
    const r = [];
    for (let t = 0; t < 256; t++)
      r.push((t + 256).toString(16).slice(1));
    return r[e[0]] + r[e[1]] + r[e[2]] + r[e[3]] + "-" + r[e[4]] + r[e[5]] + "-" + r[e[6]] + r[e[7]] + "-" + r[e[8]] + r[e[9]] + "-" + r[e[10]] + r[e[11]] + r[e[12]] + r[e[13]] + r[e[14]] + r[e[15]];
  }
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
    const r = Math.random() * 16 | 0;
    return (e === "x" ? r : r & 3 | 8).toString(16);
  });
}
const Gg = (e) => {
  const [r, t, a] = O0([]), [n, i, o] = M0([]), [s, u] = K({ past: [], future: [] }), c = de(() => {
    u((v) => ({
      past: [...v.past, JSON.stringify({ nodes: r, edges: n })].slice(-50),
      future: []
    }));
  }, [r, n]), l = de(() => {
    if (s.past.length === 0) return;
    const v = s.past[s.past.length - 1], b = s.past.slice(0, -1), _ = JSON.stringify({ nodes: r, edges: n }), { nodes: x, edges: q } = JSON.parse(v);
    t(x), i(q), u({
      past: b,
      future: [_, ...s.future]
    });
  }, [s, r, n, t, i]), d = de(() => {
    if (s.future.length === 0) return;
    const v = s.future[0], b = s.future.slice(1), _ = JSON.stringify({ nodes: r, edges: n }), { nodes: x, edges: q } = JSON.parse(v);
    t(x), i(q), u({
      past: [...s.past, _],
      future: b
    });
  }, [s, r, n, t, i]), h = de((v) => {
    const b = (v.schedules || []).map((R) => {
      let I = ve.BottomUp;
      (R.direction === ve.TopDown || R.direction === 1 || R.direction === "TopDown") && (I = ve.TopDown);
      const S = {
        ...R,
        direction: I,
        // Ensure defaults
        isActive: R.isActive ?? !0,
        priority: typeof R.priority == "number" ? R.priority : 1,
        locationGroup: R.locationGroup || { groupId: "", nodeId: "" },
        approvalGroups: Array.isArray(R.approvalGroups) ? R.approvalGroups : [],
        resources: Array.isArray(R.resources) ? R.resources : [],
        children: Array.isArray(R.children) ? R.children : [],
        parents: Array.isArray(R.parents) ? R.parents : []
      };
      return {
        id: S.scheduleId,
        position: { x: 0, y: 0 },
        data: S,
        type: "scheduleNode"
      };
    }), _ = [], x = new Set(b.map((R) => R.id));
    (v.schedules || []).forEach((R) => {
      if (!R.scheduleId) return;
      (R.children || []).forEach((S) => {
        x.has(S) && x.has(R.scheduleId) && _.push({
          id: `${R.scheduleId}-${S}`,
          source: R.scheduleId,
          target: S,
          type: "smoothstep",
          animated: !1,
          markerEnd: { type: Mo.ArrowClosed, width: 20, height: 20, color: "#94a3b8" },
          style: { stroke: "#94a3b8", strokeWidth: 2 }
        });
      });
    });
    const { nodes: q, edges: C } = ch(b, _, "TB");
    t(q), i(C), u({ past: [], future: [] });
  }, [t, i]);
  he(() => {
    h(e);
  }, [e, h]);
  const p = we(() => r.map((v) => v.data.name).join("|"), [r]);
  he(() => {
    r.length !== 0 && t((v) => {
      const b = new Map(
        v.map((q) => [q.id, { ...q.data, parents: [], children: [] }])
      );
      n.forEach((q) => {
        const C = b.get(q.source), R = b.get(q.target);
        C && R && (C.children.push(q.target), R.parents.push(q.source));
      });
      const _ = Array.from(b.values()), x = lh(_);
      return v.map((q) => {
        const C = b.get(q.id);
        return C ? (C._inheritedResources = x.get(q.id) || [], { ...q, data: C }) : q;
      });
    });
  }, [n.length, n, p, t]);
  const N = de((v) => {
    if (Dg(n, v)) {
      alert("Cannot connect: This connection would create a cycle (loop) in the graph.");
      return;
    }
    c(), i((b) => P0({
      ...v,
      type: "smoothstep",
      animated: !1,
      markerEnd: { type: Mo.ArrowClosed, width: 20, height: 20, color: "#94a3b8" },
      style: { stroke: "#94a3b8", strokeWidth: 2 }
    }, b));
  }, [n, i, c]), y = de((v, b, _) => {
    c(), t((x) => {
      const q = x.map((I) => {
        if (I.id === v) {
          const S = { ...I.data, [b]: _ };
          return { ...I, data: S };
        }
        return I;
      }), C = q.map((I) => I.data), R = lh(C);
      return q.map((I) => {
        const S = R.get(I.id) || [];
        return {
          ...I,
          data: {
            ...I.data,
            _inheritedResources: S
          }
        };
      });
    });
  }, [t, c]), g = de(() => {
    c();
    const { nodes: v, edges: b } = ch(r, n, "TB");
    t([...v]), i([...b]);
  }, [r, n, t, i, c]), m = de((v) => {
    c();
    const b = Fg(), _ = {
      x: (-v.x + window.innerWidth / 2) / v.zoom,
      y: (-v.y + window.innerHeight / 2) / v.zoom
    }, x = {
      id: b,
      position: { x: _.x + Math.random() * 50, y: _.y + Math.random() * 50 },
      type: "scheduleNode",
      data: {
        scheduleId: b,
        isActive: !0,
        name: "New Schedule",
        time: "24/7",
        group: "Draft",
        purpose: "General",
        priority: 1,
        locationGroup: { groupId: "", nodeId: "" },
        approvalGroups: [],
        direction: ve.BottomUp,
        tags: [],
        attributes: [],
        configuration: {},
        resources: [],
        children: [],
        parents: [],
        requirements: [],
        followUp: null,
        phaseOut: null
      }
    };
    t((q) => [...q, x]);
  }, [t, c]);
  return {
    nodes: r,
    edges: n,
    onNodesChange: a,
    onEdgesChange: o,
    onConnect: N,
    handleUpdateNode: y,
    handleLayout: g,
    handleAddNode: m,
    setNodes: t,
    setEdges: i,
    undo: l,
    redo: d,
    takeSnapshot: c,
    loadData: h,
    // Exposed for external updates (e.g. Import)
    canUndo: s.past.length > 0,
    canRedo: s.future.length > 0
  };
}, zg = {
  scheduleNode: av
}, Bg = ({
  initialData: e,
  onSave: r,
  onSaveAndReturn: t,
  onBack: a,
  additionalCanvasMenuItems: n,
  additionalNodeMenuItems: i,
  repositories: o
}) => {
  const {
    nodes: s,
    edges: u,
    onNodesChange: c,
    onEdgesChange: l,
    onConnect: d,
    handleUpdateNode: h,
    handleLayout: p,
    handleAddNode: N,
    setNodes: y,
    undo: g,
    redo: m,
    canUndo: v,
    canRedo: b,
    takeSnapshot: _,
    loadData: x
  } = Gg(e), [q, C] = K(null), [R, I] = K(!1), [S, A] = K(!1), [M, D] = K(0), [B, $] = K(null), [X, O] = K(!1), [j, L] = K({
    name: e.name,
    tags: e.tags,
    configuration: e.configuration
  }), [U, ie] = K(() => {
    var J;
    const F = ((J = e.configuration) == null ? void 0 : J.scheduleGroups) || [], G = /* @__PURE__ */ new Map();
    return Po.forEach((Y) => G.set(Y.name, Y)), F.forEach((Y) => G.set(Y.name, Y)), (e.schedules || []).forEach((Y) => {
      Y.group && !G.has(Y.group) && G.set(Y.group, { name: Y.group, color: "slate" });
    }), Array.from(G.values());
  }), le = de((F) => {
    ie((G) => {
      if (G.some((Y) => Y.name === F)) return G;
      const J = [...G, { name: F, color: "slate" }];
      return L((Y) => ({
        ...Y,
        configuration: { ...Y.configuration, scheduleGroups: J }
      })), J;
    });
  }, []), te = de((F, G) => {
    ie((J) => {
      const Y = J.map((re) => re.name === F ? { ...re, ...G, name: F } : re);
      return L((re) => ({
        ...re,
        configuration: { ...re.configuration, scheduleGroups: Y }
      })), Y;
    });
  }, []), { getViewport: E, deleteElements: k, getNodes: T, getEdges: P } = ho(), H = Pe(null), Z = de((F, G) => {
    C(G.data);
  }, []), ee = de(() => {
    C(null), $(null);
  }, []), ue = de(() => {
    _();
  }, [_]), Ge = () => {
    C(null), y((F) => F.map((G) => ({ ...G, selected: !1 })));
  }, ce = () => {
    _();
    const F = T().filter((J) => J.selected), G = P().filter((J) => J.selected);
    k({ nodes: F, edges: G }), I(!1), q && F.some((J) => J.id === q.scheduleId) && C(null);
  }, se = (F) => {
    if (q) {
      const G = [...q.resources || [], ...F];
      h(q.scheduleId, "resources", G);
    }
  }, V = () => ({
    ...e,
    // Keep original ObjectType etc
    name: j.name,
    tags: j.tags,
    configuration: { ...j.configuration, scheduleGroups: U },
    schedules: s.map((F) => F.data)
  }), qe = () => {
    var F;
    (F = H.current) == null || F.click();
  }, W = (F) => {
    var Y;
    const G = (Y = F.target.files) == null ? void 0 : Y[0];
    if (!G) return;
    const J = new FileReader();
    J.onload = (re) => {
      var ge, Ie;
      try {
        const Be = (ge = re.target) == null ? void 0 : ge.result, ye = JSON.parse(Be);
        if (!ye.schedules || !Array.isArray(ye.schedules)) {
          alert("Invalid file format: Missing Schedules array.");
          return;
        }
        L({
          name: ye.name || "",
          tags: ye.tags || [],
          configuration: ye.configuration || {}
        });
        const Gr = ((Ie = ye.configuration) == null ? void 0 : Ie.scheduleGroups) || [], Ae = /* @__PURE__ */ new Map();
        Po.forEach((ae) => Ae.set(ae.name, ae)), Gr.forEach((ae) => Ae.set(ae.name, ae)), (ye.schedules || []).forEach((ae) => {
          ae.group && !Ae.has(ae.group) && Ae.set(ae.group, { name: ae.group, color: "slate" });
        }), ie(Array.from(Ae.values())), x(ye);
      } catch (Be) {
        console.error(Be), alert("Failed to load file.");
      }
    }, J.readAsText(G), F.target.value = "";
  }, Ee = () => {
    var ge;
    const F = V(), G = JSON.stringify(F, null, 2), J = new Blob([G], { type: "application/json" }), Y = URL.createObjectURL(J), re = document.createElement("a");
    re.href = Y, re.download = `${((ge = F.name) == null ? void 0 : ge.replace(/\s+/g, "_")) || "Entitlement"}.json`, document.body.appendChild(re), re.click(), document.body.removeChild(re), URL.revokeObjectURL(Y);
  }, ke = de((F, G) => {
    F.preventDefault();
    const J = i ? i(G.data) : [], Y = J.length > 0;
    $({
      x: F.clientX,
      y: F.clientY,
      items: [
        ...J,
        ...Y ? [{ label: "Separator", disabled: !0, onClick: () => {
        }, icon: /* @__PURE__ */ f("div", { className: "h-px w-full bg-slate-200 my-1" }) }] : [],
        {
          label: "Delete Node",
          icon: /* @__PURE__ */ f(po, { size: 14 }),
          onClick: () => {
            D(1), y((re) => re.map((ge) => ({ ...ge, selected: ge.id === G.id }))), I(!0);
          },
          danger: !0
        }
      ].filter((re) => re.label !== "Separator" || re.icon)
    });
  }, [y, i]), Fr = de((F) => {
    F.preventDefault();
    const G = n || [], J = G.length > 0;
    $({
      x: F.clientX,
      y: F.clientY,
      items: [
        {
          label: "Add New Node Here",
          icon: /* @__PURE__ */ f(xr, { size: 14 }),
          onClick: () => {
            N(E());
          }
        },
        ...J ? [{ label: "Separator", disabled: !0, onClick: () => {
        }, icon: /* @__PURE__ */ f("div", { className: "h-px w-full bg-slate-200 my-1" }) }] : [],
        ...G
      ]
    });
  }, [N, E, n]);
  fo.useEffect(() => {
    if (q) {
      const F = s.find((G) => G.id === q.scheduleId);
      F && C(F.data);
    }
  }, [s]);
  const ze = we(() => s.map((F) => F.data), [s]);
  return /* @__PURE__ */ f(F0, { groups: U, onAddGroup: le, onUpdateGroup: te, children: /* @__PURE__ */ w("div", { className: "flex flex-col h-full w-full bg-slate-50 overflow-hidden", children: [
    /* @__PURE__ */ f(
      "input",
      {
        type: "file",
        ref: H,
        onChange: W,
        accept: ".json",
        className: "hidden"
      }
    ),
    /* @__PURE__ */ w("header", { className: "h-16 bg-white border-b border-slate-200 flex items-center justify-between px-2 md:px-6 shrink-0 z-50 shadow-sm relative gap-2", children: [
      /* @__PURE__ */ w("div", { className: "flex items-center gap-2 md:gap-4 overflow-hidden z-20 min-w-0", children: [
        a && /* @__PURE__ */ w(vr, { children: [
          /* @__PURE__ */ f(
            "button",
            {
              onClick: a,
              className: "p-1.5 md:p-2 -ml-2 text-slate-500 hover:text-slate-900 hover:bg-slate-100 rounded-lg transition-colors",
              children: /* @__PURE__ */ f(H0, { size: 20 })
            }
          ),
          /* @__PURE__ */ f("div", { className: "h-6 w-px bg-slate-200 mx-1 md:mx-2 hidden md:block" })
        ] }),
        /* @__PURE__ */ w("div", { className: "flex flex-col", children: [
          /* @__PURE__ */ f("h1", { className: "text-sm md:text-lg font-bold text-slate-900 truncate flex items-center gap-2", children: j.name || "Untitled Entitlement" }),
          /* @__PURE__ */ w("div", { className: "flex items-center gap-2 text-[10px] md:text-xs text-slate-500", children: [
            /* @__PURE__ */ w("span", { className: "bg-slate-100 px-1.5 py-0.5 rounded border border-slate-200 font-mono", children: [
              s.length,
              " Schedules"
            ] }),
            j.tags.length > 0 && /* @__PURE__ */ w("span", { className: "hidden md:inline-flex items-center gap-1", children: [
              /* @__PURE__ */ f("span", { className: "w-1 h-1 rounded-full bg-slate-300" }),
              j.tags.join(", ")
            ] })
          ] })
        ] })
      ] }),
      /* @__PURE__ */ w("div", { className: "flex items-center gap-1 md:gap-2", children: [
        /* @__PURE__ */ w("div", { className: "hidden md:flex items-center gap-1 mr-2 border-r border-slate-200 pr-2", children: [
          /* @__PURE__ */ f("button", { onClick: g, disabled: !v, className: "p-2 text-slate-400 hover:text-slate-700 disabled:opacity-30 rounded-lg", title: "Undo", children: /* @__PURE__ */ f(Jp, { size: 18 }) }),
          /* @__PURE__ */ f("button", { onClick: m, disabled: !b, className: "p-2 text-slate-400 hover:text-slate-700 disabled:opacity-30 rounded-lg", title: "Redo", children: /* @__PURE__ */ f(Op, { size: 18 }) })
        ] }),
        /* @__PURE__ */ f("button", { onClick: p, className: "p-2 text-slate-500 hover:text-teal-600 hover:bg-teal-50 rounded-lg transition-colors hidden sm:flex", title: "Auto Layout", children: /* @__PURE__ */ f(_p, { size: 18 }) }),
        /* @__PURE__ */ f("button", { onClick: () => O(!0), className: "p-2 text-slate-500 hover:text-teal-600 hover:bg-teal-50 rounded-lg transition-colors", title: "Settings", children: /* @__PURE__ */ f(_r, { size: 18 }) }),
        /* @__PURE__ */ f("div", { className: "h-6 w-px bg-slate-200 mx-1" }),
        /* @__PURE__ */ w("div", { className: "flex items-center gap-1", children: [
          /* @__PURE__ */ f("button", { onClick: qe, className: "p-2 text-slate-500 hover:text-indigo-600 hover:bg-indigo-50 rounded-lg transition-colors", title: "Import JSON", children: /* @__PURE__ */ f(Xp, { size: 18 }) }),
          /* @__PURE__ */ f("button", { onClick: Ee, className: "p-2 text-slate-500 hover:text-indigo-600 hover:bg-indigo-50 rounded-lg transition-colors", title: "Export JSON", children: /* @__PURE__ */ f(hp, { size: 18 }) })
        ] }),
        /* @__PURE__ */ w(
          "button",
          {
            onClick: () => {
              r && r(V());
            },
            className: "ml-2 bg-teal-600 hover:bg-teal-700 text-white px-3 md:px-4 py-2 rounded-lg text-sm font-medium flex items-center gap-2 shadow-sm shadow-teal-600/20 transition-all",
            children: [
              /* @__PURE__ */ f(Ch, { size: 16 }),
              /* @__PURE__ */ f("span", { className: "hidden md:inline", children: "Save" })
            ]
          }
        ),
        t && /* @__PURE__ */ f(
          "button",
          {
            onClick: () => t(V()),
            className: "ml-1 p-2 text-teal-600 hover:bg-teal-50 rounded-lg",
            title: "Save & Return",
            children: /* @__PURE__ */ f(Ip, { size: 18 })
          }
        )
      ] })
    ] }),
    /* @__PURE__ */ w("div", { className: "flex-1 relative bg-slate-50", children: [
      /* @__PURE__ */ f(xv, { nodes: s, onSelectNode: C }),
      /* @__PURE__ */ w(
        T0,
        {
          nodes: s,
          edges: u,
          onNodesChange: c,
          onEdgesChange: l,
          onConnect: d,
          nodeTypes: zg,
          onNodeClick: Z,
          onPaneClick: ee,
          onNodeDragStart: ue,
          onNodeContextMenu: ke,
          onPaneContextMenu: Fr,
          fitView: !0,
          minZoom: 0.1,
          maxZoom: 1.5,
          connectionMode: L0.Loose,
          defaultEdgeOptions: {
            type: "smoothstep",
            animated: !1,
            style: { stroke: "#94a3b8", strokeWidth: 2 }
          },
          children: [
            /* @__PURE__ */ f(j0, { color: "#e2e8f0", gap: 20 }),
            /* @__PURE__ */ f(D0, { className: "!bg-white !shadow-sm !border !border-slate-200 !m-4" })
          ]
        }
      ),
      B && /* @__PURE__ */ f(
        yv,
        {
          x: B.x,
          y: B.y,
          items: B.items,
          onClose: () => $(null)
        }
      ),
      q && /* @__PURE__ */ f(
        hv,
        {
          node: q,
          allNodes: ze,
          onClose: Ge,
          onUpdate: h,
          onAddResourceRequest: () => A(!0)
        }
      )
    ] }),
    /* @__PURE__ */ f(
      pv,
      {
        isOpen: R,
        onClose: () => I(!1),
        onConfirm: ce,
        count: M
      }
    ),
    /* @__PURE__ */ f(
      vv,
      {
        isOpen: X,
        onClose: () => O(!1),
        data: j,
        onSave: (F) => {
          L(F);
        }
      }
    ),
    /* @__PURE__ */ f(
      bv,
      {
        isOpen: S,
        onClose: () => A(!1),
        onConfirm: se,
        repositories: o
      }
    )
  ] }) });
}, nr = [
  { groupName: "GlobalAdmins", nodeName: "Root", role: "Owner" },
  { groupName: "LocalOps", nodeName: "Berlin", role: "Operator" }
], fe = {
  paramA: "value1",
  syncEnabled: !0
}, ar = "7a2e0fa0-d84f-81c8-387c-cba962518d94", Qe = "10000000-0000-0000-0000-000000000001", A0 = "10000000-0000-0000-0000-000000000002", ir = "10000000-0000-0000-0000-000000000003", er = "10000000-0000-0000-0000-000000000004", yr = [
  {
    id: ar,
    name: "Main Access Control",
    memberships: nr,
    resources: [],
    resourcePlans: []
  },
  {
    id: Qe,
    name: "Internal Systems",
    memberships: [],
    resources: [],
    resourcePlans: []
  },
  {
    id: A0,
    name: "IoT Devices",
    memberships: [],
    resources: [],
    resourcePlans: []
  },
  {
    id: ir,
    name: "Legacy Controller A",
    memberships: [],
    resources: [],
    resourcePlans: []
  },
  {
    id: er,
    name: "Cloud Access Manager",
    memberships: nr,
    resources: [],
    resourcePlans: []
  }
], lo = [
  // Existing Resources (Preserving IDs from INITIAL_DATA where possible)
  { id: "fabd7570-34c7-141c-4aac-ffcf1e4e5bbe", name: "Main Entrance Lobby", description: "Primary public entrance", referenceId: "EXT-001", resourceKind: oe.Single, resourceType: "Door", memberships: [], configuration: fe, systemId: ar },
  { id: "fabd7570-34c7-141c-4aac-ffcf1e4e5bbf", name: "Side Entrance Staff", description: "Staff only entrance", referenceId: "EXT-002", resourceKind: oe.Single, resourceType: "Door", memberships: [], configuration: fe, systemId: ar },
  // Mapped to Internal
  { id: "fabd7570-34c7-141c-4aac-ffcf1e4e5bbb", name: "Office 101 (North)", description: "Open space area north", referenceId: "INT-101", resourceKind: oe.Collection, resourceType: "Zone", memberships: nr, configuration: fe, systemId: Qe },
  { id: "fabd7570-34c7-141c-4aac-ffcf1e4e5bbc", name: "Office 102 (North)", description: "Meeting rooms north", referenceId: "INT-102", resourceKind: oe.Collection, resourceType: "Zone", memberships: [], configuration: fe, systemId: Qe },
  { id: "fabd7570-34c7-141c-4aac-ffcf1e4e5bbd", name: "Office 103 (East)", description: "Quiet zone east", referenceId: "INT-103", resourceKind: oe.Collection, resourceType: "Zone", memberships: [], configuration: fe, systemId: Qe },
  // Mapped to Cloud
  { id: "899d0c8b-9ec8-aa62-3956-b770f75dd7ea", name: "Executive Suite", description: "High security area", referenceId: "SEC-900", resourceKind: oe.Fixed, resourceType: "SecureZone", memberships: nr, configuration: fe, systemId: er },
  { id: "30000000-0000-0000-0000-000000000001", name: "Conference Room A", description: "Large conference room", referenceId: "CONF-A", resourceKind: oe.Single, resourceType: "Room", memberships: [], configuration: fe, systemId: er },
  { id: "30000000-0000-0000-0000-000000000002", name: "Conference Room B", description: "Small meeting room", referenceId: "CONF-B", resourceKind: oe.Single, resourceType: "Room", memberships: [], configuration: fe, systemId: er },
  // Mapped to Legacy
  { id: "a118c70c-0944-dc75-db81-26665a7ff674", name: "Server Room Rack A", description: "Main server rack access", referenceId: "SRV-A", resourceKind: oe.Single, resourceType: "Cabinet", memberships: [], configuration: fe, systemId: ir },
  { id: "30000000-0000-0000-0000-000000000003", name: "Cafeteria Turnstile", description: "Lunch area access", referenceId: "CAF-01", resourceKind: oe.Single, resourceType: "Turnstile", memberships: [], configuration: fe, systemId: ir },
  // Mapped to IoT
  { id: "fabd7570-34c7-141c-4aac-ffcf1e4e5bba", name: "Printer Room", description: "Common service area", referenceId: "SVC-001", resourceKind: oe.Single, resourceType: "Room", memberships: [], configuration: fe, systemId: A0 }
];
for (let e = 1; e <= 60; e++) {
  const r = Math.floor((e - 1) / 15) + 1, t = yr[e % yr.length], a = `50000000-0000-0000-0000-${(1e11 + e).toString()}`;
  lo.push({
    id: a,
    name: `Floor ${r} - Desk ${e}`,
    description: `Hot desk on floor ${r}`,
    referenceId: `DSK-${r}-${e}`,
    resourceKind: oe.Single,
    resourceType: "Desk",
    memberships: [],
    configuration: {},
    systemId: t.id
  });
}
const dh = [
  // Moved to Main Access Control to fix missing plans issue
  { id: "3430d084-b147-a576-0018-3a3726ecb4d7", name: "Standard Access Plan", description: "9-5 Access", referenceId: "PLN-STD", priority: 10, memberships: [], configuration: fe, systemId: ar },
  { id: "20000000-0000-0000-0000-000000000005", name: "Emergency Access", description: "Override all locks", referenceId: "PLN-EMG", priority: 100, memberships: [], configuration: fe, systemId: ar },
  // Cloud Plans
  { id: "20000000-0000-0000-0000-000000000001", name: "24/7 Unlimited", description: "All hours access", referenceId: "PLN-ALL", priority: 99, memberships: nr, configuration: fe, systemId: er },
  // Internal Plans
  { id: "20000000-0000-0000-0000-000000000002", name: "Working Hours (08:00 - 18:00)", description: "Standard business hours", referenceId: "PLN-BIZ", priority: 5, memberships: [], configuration: {}, systemId: Qe },
  // Legacy Plans
  { id: "20000000-0000-0000-0000-000000000003", name: "Visitor Restricted", description: "Escort required", referenceId: "PLN-VIS", priority: 0, memberships: [], configuration: {}, systemId: ir },
  { id: "20000000-0000-0000-0000-000000000004", name: "Maintenance Access (Weekends)", description: "Weekend only", referenceId: "PLN-MNT", priority: 50, memberships: [], configuration: {}, systemId: ir }
], fh = [
  { id: "10000000-0000-0000-0000-100000000002", groupId: "10000000-0000-0000-0000-100000000001", name: "Erfurt Office (HQ)", type: "Location" },
  { id: "40000000-0000-0000-0000-000000000001", groupId: "10000000-0000-0000-0000-100000000001", name: "Berlin Branch", type: "Location" },
  { id: "40000000-0000-0000-0000-000000000002", groupId: "10000000-0000-0000-0000-100000000001", name: "Munich Hub", type: "Location" },
  { id: "40000000-0000-0000-0000-000000000003", groupId: "10000000-0000-0000-0000-100000000001", name: "London Office", type: "Location" },
  { id: "40000000-0000-0000-0000-000000000004", groupId: "10000000-0000-0000-0000-100000000001", name: "US East (NY)", type: "Location" }
], Ug = [
  { id: "10000000-0000-0000-0000-200000000002", groupId: "10000000-0000-0000-0000-200000000001", name: "Facility Management", type: "Approval" },
  { id: "60000000-0000-0000-0000-000000000001", groupId: "10000000-0000-0000-0000-200000000001", name: "Security Team", type: "Approval" },
  { id: "60000000-0000-0000-0000-000000000002", groupId: "10000000-0000-0000-0000-200000000001", name: "Human Resources", type: "Approval" },
  { id: "60000000-0000-0000-0000-000000000003", groupId: "10000000-0000-0000-0000-200000000001", name: "IT Operations", type: "Approval" },
  { id: "60000000-0000-0000-0000-000000000004", groupId: "10000000-0000-0000-0000-200000000001", name: "Executive Board", type: "Approval" }
], $g = 300, Ce = (e) => new Promise((r) => setTimeout(() => r(e), $g)), We = (e, r) => {
  let t = [...e];
  if (r != null && r.filter) {
    const n = r.filter.toLowerCase();
    t = t.filter((i) => (i.name || "").toLowerCase().includes(n) || i.id.toLowerCase().includes(n));
  }
  r != null && r.sortBy && t.sort((n, i) => {
    const o = n.name || "", s = i.name || "";
    return o.localeCompare(s);
  });
  const a = t.length;
  if ((r == null ? void 0 : r.page) !== void 0 && (r == null ? void 0 : r.pageSize) !== void 0) {
    const n = (r.page - 1) * r.pageSize;
    t = t.slice(n, n + r.pageSize);
  }
  return { items: t, total: a };
}, so = (e, r) => {
  const t = /* @__PURE__ */ new Map(), a = new Set(r), n = new Map(e.map((i) => [i.id, i]));
  return a.forEach((i) => {
    const o = n.get(i);
    o && t.set(i, o);
  }), t;
}, Kg = (e, r) => {
  const t = /* @__PURE__ */ new Map(), a = new Set(r);
  return e.forEach((n) => {
    a.has(n.id) && t.set(n.id, n.name);
  }), a.forEach((n) => {
    t.has(n) || t.set(n, n);
  }), t;
}, Jg = {
  getSystems: (e) => Ce(We(yr, e)),
  getResources: (e) => Ce(We(lo, e)),
  getPlans: (e) => Ce(We(dh, e)),
  getLocations: (e) => Ce(We(fh, e)),
  getApprovalGroups: (e) => Ce(We(Ug, e)),
  resolveSystems: (e) => Ce(so(yr, e)),
  resolveResources: (e) => Ce(so(lo, e)),
  resolvePlans: (e) => Ce(so(dh, e)),
  resolveLocations: (e) => Ce(Kg(fh, e))
}, Zg = ({
  initialData: e,
  onSave: r,
  onSaveAndReturn: t,
  onBack: a,
  onLoadRequest: n,
  additionalCanvasMenuItems: i,
  additionalNodeMenuItems: o
}) => /* @__PURE__ */ f(
  Bg,
  {
    initialData: e,
    onSave: r,
    onSaveAndReturn: t,
    onBack: a,
    additionalCanvasMenuItems: i,
    additionalNodeMenuItems: o
  },
  e.name
);
export {
  Ye as ApprovalGroupType,
  Po as DEFAULT_SCHEDULE_GROUPS,
  ve as Direction,
  Bg as EntitlementEditor,
  Zg as EntitlementEditorWrapper,
  Jg as MockRepository,
  Yg as RepositoryProvider,
  oe as ResourceKind,
  F0 as ScheduleGroupProvider,
  Bg as default,
  iv as useRepositories,
  bh as useScheduleGroups
};
//# sourceMappingURL=index.js.map
