import { jsx as t, jsxs as s, Fragment as ke } from "react/jsx-runtime";
import { cva as Me } from "class-variance-authority";
import { clsx as et } from "clsx";
import { twMerge as tt } from "tailwind-merge";
import * as u from "react";
import { useState as Re, useEffect as se, useRef as Se } from "react";
import { Slot as at } from "@radix-ui/react-slot";
import * as C from "@radix-ui/react-select";
import { ChevronDown as de, Check as ne, ChevronUp as rt, X as ce, Search as Ae, Archive as W, CheckCircle2 as J, PlayCircle as Z, Clock as Q, ArrowDown as Ee, Minus as me, ArrowUp as ue, AlertCircle as Ie, FileText as fe, Tag as Pe, Calendar as ee, User as st, GitBranch as nt, ExternalLink as lt, Circle as Ce, Loader2 as pe, Plus as te, Star as Te, MoreHorizontal as ot, Sun as it, Moon as dt, TrendingUp as ct, TrendingDown as mt } from "lucide-react";
import * as O from "@radix-ui/react-popover";
import { Command as _ } from "cmdk";
import * as L from "@radix-ui/react-dialog";
import z from "dayjs";
function d(...e) {
  return tt(et(e));
}
function oa(e) {
  if (!e) return null;
  const a = e.match(/^#\s+(.+)$/m);
  return a ? a[1].trim() : null;
}
const ut = Me(
  "inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
  {
    variants: {
      variant: {
        default: "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
        secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
        destructive: "border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
        outline: "text-foreground"
      }
    },
    defaultVariants: {
      variant: "default"
    }
  }
);
function I({ className: e, variant: a, ...r }) {
  return /* @__PURE__ */ t("div", { className: d(ut({ variant: a }), e), ...r });
}
const ft = Me(
  "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
  {
    variants: {
      variant: {
        default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
        destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
        outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
        secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
        ghost: "hover:bg-accent hover:text-accent-foreground",
        link: "text-primary underline-offset-4 hover:underline"
      },
      size: {
        default: "h-9 px-4 py-2",
        sm: "h-8 rounded-md px-3 text-xs",
        lg: "h-10 rounded-md px-8",
        icon: "h-9 w-9"
      }
    },
    defaultVariants: {
      variant: "default",
      size: "default"
    }
  }
), $ = u.forwardRef(
  ({ className: e, variant: a, size: r, asChild: n = !1, ...l }, i) => /* @__PURE__ */ t(n ? at : "button", { className: d(ft({ variant: a, size: r, className: e })), ref: i, ...l })
);
$.displayName = "Button";
const A = u.forwardRef(
  ({ className: e, ...a }, r) => /* @__PURE__ */ t(
    "div",
    {
      ref: r,
      className: d(
        "rounded-xl border border-gray-200 dark:border-gray-800 bg-card text-card-foreground shadow",
        e
      ),
      ...a
    }
  )
);
A.displayName = "Card";
const B = u.forwardRef(
  ({ className: e, ...a }, r) => /* @__PURE__ */ t("div", { ref: r, className: d("flex flex-col space-y-1.5 p-6", e), ...a })
);
B.displayName = "CardHeader";
const $e = u.forwardRef(
  ({ className: e, ...a }, r) => /* @__PURE__ */ t(
    "div",
    {
      ref: r,
      className: d("font-semibold leading-none tracking-tight", e),
      ...a
    }
  )
);
$e.displayName = "CardTitle";
const pt = u.forwardRef(
  ({ className: e, ...a }, r) => /* @__PURE__ */ t("div", { ref: r, className: d("text-sm text-muted-foreground", e), ...a })
);
pt.displayName = "CardDescription";
const E = u.forwardRef(
  ({ className: e, ...a }, r) => /* @__PURE__ */ t("div", { ref: r, className: d("p-6 pt-0", e), ...a })
);
E.displayName = "CardContent";
const Ye = u.forwardRef(
  ({ className: e, ...a }, r) => /* @__PURE__ */ t("div", { ref: r, className: d("flex items-center p-6 pt-0", e), ...a })
);
Ye.displayName = "CardFooter";
const Fe = u.forwardRef(
  ({ className: e, type: a, ...r }, n) => /* @__PURE__ */ t(
    "input",
    {
      type: a,
      className: d(
        "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
        e
      ),
      ref: n,
      ...r
    }
  )
);
Fe.displayName = "Input";
function x({ className: e, ...a }) {
  return /* @__PURE__ */ t("div", { className: d("animate-pulse rounded-md bg-muted", e), ...a });
}
const ht = u.forwardRef(
  ({ className: e, orientation: a = "horizontal", decorative: r = !0, ...n }, l) => /* @__PURE__ */ t(
    "div",
    {
      ref: l,
      role: r ? "none" : "separator",
      "aria-orientation": r ? void 0 : a,
      className: d(
        "shrink-0 bg-border",
        a === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
        e
      ),
      ...n
    }
  )
);
ht.displayName = "Separator";
const gt = {
  sm: "h-6 w-6 text-[10px]",
  md: "h-8 w-8 text-xs",
  lg: "h-10 w-10 text-sm",
  xl: "h-12 w-12 text-base"
}, he = u.forwardRef(
  ({ className: e, size: a = "md", ...r }, n) => /* @__PURE__ */ t(
    "div",
    {
      ref: n,
      role: "img",
      className: d(
        "relative flex shrink-0 overflow-hidden rounded-full",
        gt[a],
        e
      ),
      ...r
    }
  )
);
he.displayName = "Avatar";
const ze = u.forwardRef(
  ({ className: e, alt: a = "", ...r }, n) => /* @__PURE__ */ t("img", { ref: n, alt: a, className: d("aspect-square h-full w-full", e), ...r })
);
ze.displayName = "AvatarImage";
const ge = u.forwardRef(
  ({ className: e, ...a }, r) => /* @__PURE__ */ t(
    "div",
    {
      ref: r,
      "aria-hidden": "true",
      className: d(
        "flex h-full w-full items-center justify-center rounded-full bg-muted",
        e
      ),
      ...a
    }
  )
);
ge.displayName = "AvatarFallback";
const Ue = C.Root, ia = C.Group, Be = C.Value, xe = u.forwardRef(({ className: e, children: a, ...r }, n) => /* @__PURE__ */ s(
  C.Trigger,
  {
    ref: n,
    className: d(
      "flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-gray-300 dark:border-gray-700 bg-background px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
      e
    ),
    ...r,
    children: [
      a,
      /* @__PURE__ */ t(C.Icon, { asChild: !0, children: /* @__PURE__ */ t(de, { className: "h-4 w-4 opacity-50" }) })
    ]
  }
));
xe.displayName = C.Trigger.displayName;
const Ve = u.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
  C.ScrollUpButton,
  {
    ref: r,
    className: d(
      "flex cursor-default items-center justify-center py-1",
      e
    ),
    ...a,
    children: /* @__PURE__ */ t(rt, { className: "h-4 w-4" })
  }
));
Ve.displayName = C.ScrollUpButton.displayName;
const He = u.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
  C.ScrollDownButton,
  {
    ref: r,
    className: d(
      "flex cursor-default items-center justify-center py-1",
      e
    ),
    ...a,
    children: /* @__PURE__ */ t(de, { className: "h-4 w-4" })
  }
));
He.displayName = C.ScrollDownButton.displayName;
const Ne = u.forwardRef(({ className: e, children: a, position: r = "popper", ...n }, l) => /* @__PURE__ */ t(C.Portal, { children: /* @__PURE__ */ s(
  C.Content,
  {
    ref: l,
    className: d(
      "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-gray-200 dark:border-gray-800 bg-background text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
      r === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
      e
    ),
    position: r,
    ...n,
    children: [
      /* @__PURE__ */ t(Ve, {}),
      /* @__PURE__ */ t(
        C.Viewport,
        {
          className: d(
            "p-1",
            r === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
          ),
          children: a
        }
      ),
      /* @__PURE__ */ t(He, {})
    ]
  }
) }));
Ne.displayName = C.Content.displayName;
const xt = u.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
  C.Label,
  {
    ref: r,
    className: d("px-2 py-1.5 text-sm font-semibold", e),
    ...a
  }
));
xt.displayName = C.Label.displayName;
const be = u.forwardRef(({ className: e, children: a, ...r }, n) => /* @__PURE__ */ s(
  C.Item,
  {
    ref: n,
    className: d(
      "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
      e
    ),
    ...r,
    children: [
      /* @__PURE__ */ t("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ t(C.ItemIndicator, { children: /* @__PURE__ */ t(ne, { className: "h-4 w-4" }) }) }),
      /* @__PURE__ */ t(C.ItemText, { children: a })
    ]
  }
));
be.displayName = C.Item.displayName;
const Nt = u.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
  C.Separator,
  {
    ref: r,
    className: d("-mx-1 my-1 h-px bg-muted", e),
    ...a
  }
));
Nt.displayName = C.Separator.displayName;
const bt = O.Root, wt = O.Trigger, Oe = u.forwardRef(({ className: e, align: a = "center", sideOffset: r = 4, ...n }, l) => /* @__PURE__ */ t(O.Portal, { children: /* @__PURE__ */ t(
  O.Content,
  {
    ref: l,
    align: a,
    sideOffset: r,
    className: d(
      "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
      e
    ),
    ...n
  }
) }));
Oe.displayName = O.Content.displayName;
const yt = L.Root, da = L.Trigger, vt = L.Portal, ca = L.Close, je = u.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
  L.Overlay,
  {
    ref: r,
    className: d(
      "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
      e
    ),
    ...a
  }
));
je.displayName = L.Overlay.displayName;
const Ge = u.forwardRef(({ className: e, children: a, ...r }, n) => /* @__PURE__ */ s(vt, { children: [
  /* @__PURE__ */ t(je, {}),
  /* @__PURE__ */ s(
    L.Content,
    {
      ref: n,
      className: d(
        "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
        e
      ),
      ...r,
      children: [
        a,
        /* @__PURE__ */ s(L.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
          /* @__PURE__ */ t(ce, { className: "h-4 w-4" }),
          /* @__PURE__ */ t("span", { className: "sr-only", children: "Close" })
        ] })
      ]
    }
  )
] }));
Ge.displayName = L.Content.displayName;
const kt = ({
  className: e,
  ...a
}) => /* @__PURE__ */ t(
  "div",
  {
    className: d(
      "flex flex-col space-y-1.5 text-center sm:text-left",
      e
    ),
    ...a
  }
);
kt.displayName = "DialogHeader";
const St = ({
  className: e,
  ...a
}) => /* @__PURE__ */ t(
  "div",
  {
    className: d(
      "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
      e
    ),
    ...a
  }
);
St.displayName = "DialogFooter";
const Ct = u.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
  L.Title,
  {
    ref: r,
    className: d(
      "text-lg font-semibold leading-none tracking-tight",
      e
    ),
    ...a
  }
));
Ct.displayName = L.Title.displayName;
const Tt = u.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
  L.Description,
  {
    ref: r,
    className: d("text-sm text-muted-foreground", e),
    ...a
  }
));
Tt.displayName = L.Description.displayName;
const we = u.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
  _,
  {
    ref: r,
    className: d(
      "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
      e
    ),
    ...a
  }
));
we.displayName = _.displayName;
const ma = ({ children: e, ...a }) => /* @__PURE__ */ t(yt, { ...a, children: /* @__PURE__ */ t(Ge, { className: "overflow-hidden p-0 shadow-lg", children: /* @__PURE__ */ t(we, { className: "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children: e }) }) }), Ke = u.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ s("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
  /* @__PURE__ */ t(Ae, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
  /* @__PURE__ */ t(
    _.Input,
    {
      ref: r,
      className: d(
        "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
        e
      ),
      ...a
    }
  )
] }));
Ke.displayName = _.Input.displayName;
const qe = u.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
  _.List,
  {
    ref: r,
    className: d("max-h-[300px] overflow-y-auto overflow-x-hidden", e),
    ...a
  }
));
qe.displayName = _.List.displayName;
const We = u.forwardRef((e, a) => /* @__PURE__ */ t(
  _.Empty,
  {
    ref: a,
    className: "py-6 text-center text-sm",
    ...e
  }
));
We.displayName = _.Empty.displayName;
const le = u.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
  _.Group,
  {
    ref: r,
    className: d(
      "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
      e
    ),
    ...a
  }
));
le.displayName = _.Group.displayName;
const _t = u.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
  _.Separator,
  {
    ref: r,
    className: d("-mx-1 h-px bg-border", e),
    ...a
  }
));
_t.displayName = _.Separator.displayName;
const G = u.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
  _.Item,
  {
    ref: r,
    className: d(
      "relative flex cursor-pointer gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
      e
    ),
    ...a
  }
));
G.displayName = _.Item.displayName;
const Lt = ({
  className: e,
  ...a
}) => /* @__PURE__ */ t(
  "span",
  {
    className: d(
      "ml-auto text-xs tracking-widest text-muted-foreground",
      e
    ),
    ...a
  }
);
Lt.displayName = "CommandShortcut";
const oe = {
  planned: {
    icon: Q,
    label: "Planned",
    className: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400"
  },
  "in-progress": {
    icon: Z,
    label: "In Progress",
    className: "bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-400"
  },
  complete: {
    icon: J,
    label: "Complete",
    className: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400"
  },
  archived: {
    icon: W,
    label: "Archived",
    className: "bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-400"
  }
};
function Je({
  status: e,
  className: a,
  iconOnly: r = !1,
  label: n,
  statusConfig: l = oe
}) {
  const i = l[e] || l.planned;
  process.env.NODE_ENV === "development" && !(e in l) && console.warn(`StatusBadge: Unknown status "${e}", falling back to "planned"`);
  const o = i.icon, c = n ?? i.label;
  return /* @__PURE__ */ s(
    I,
    {
      className: d("flex items-center w-fit", !r && "gap-1.5", i.className, a),
      children: [
        /* @__PURE__ */ t(o, { className: "h-3.5 w-3.5" }),
        !r && c
      ]
    }
  );
}
function ua(e, a = oe) {
  return (a[e] || oe.planned).label;
}
const ie = {
  critical: {
    icon: Ie,
    label: "Critical",
    className: "bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"
  },
  high: {
    icon: ue,
    label: "High",
    className: "bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-400"
  },
  medium: {
    icon: me,
    label: "Medium",
    className: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400"
  },
  low: {
    icon: Ee,
    label: "Low",
    className: "bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-400"
  }
};
function Ze({
  priority: e,
  className: a,
  iconOnly: r = !1,
  label: n,
  priorityConfig: l = ie
}) {
  const i = l[e] || l.medium;
  process.env.NODE_ENV === "development" && !(e in l) && console.warn(`PriorityBadge: Unknown priority "${e}", falling back to "medium"`);
  const o = i.icon, c = n ?? i.label;
  return /* @__PURE__ */ s(
    I,
    {
      className: d("flex items-center w-fit", !r && "gap-1.5", i.className, a),
      children: [
        /* @__PURE__ */ t(o, { className: "h-3.5 w-3.5" }),
        !r && c
      ]
    }
  );
}
function fa(e, a = ie) {
  return (a[e] || ie.medium).label;
}
function Dt(e) {
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var K = { exports: {} }, Mt = K.exports, _e;
function Rt() {
  return _e || (_e = 1, (function(e, a) {
    (function(r, n) {
      e.exports = n();
    })(Mt, (function() {
      return function(r, n, l) {
        r = r || {};
        var i = n.prototype, o = { future: "in %s", past: "%s ago", s: "a few seconds", m: "a minute", mm: "%d minutes", h: "an hour", hh: "%d hours", d: "a day", dd: "%d days", M: "a month", MM: "%d months", y: "a year", yy: "%d years" };
        function c(m, f, N, S) {
          return i.fromToBase(m, f, N, S);
        }
        l.en.relativeTime = o, i.fromToBase = function(m, f, N, S, g) {
          for (var b, y, T, h = N.$locale().relativeTime || o, w = r.thresholds || [{ l: "s", r: 44, d: "second" }, { l: "m", r: 89 }, { l: "mm", r: 44, d: "minute" }, { l: "h", r: 89 }, { l: "hh", r: 21, d: "hour" }, { l: "d", r: 35 }, { l: "dd", r: 25, d: "day" }, { l: "M", r: 45 }, { l: "MM", r: 10, d: "month" }, { l: "y", r: 17 }, { l: "yy", d: "year" }], v = w.length, D = 0; D < v; D += 1) {
            var M = w[D];
            M.d && (b = S ? l(m).diff(N, M.d, !0) : N.diff(m, M.d, !0));
            var P = (r.rounding || Math.round)(Math.abs(b));
            if (T = b > 0, P <= M.r || !M.r) {
              P <= 1 && D > 0 && (M = w[D - 1]);
              var Y = h[M.l];
              g && (P = g("" + P)), y = typeof Y == "string" ? Y.replace("%d", P) : Y(P, f, M.l, T);
              break;
            }
          }
          if (f) return y;
          var V = T ? h.future : h.past;
          return typeof V == "function" ? V(y) : V.replace("%s", y);
        }, i.to = function(m, f) {
          return c(m, f, this, !0);
        }, i.from = function(m, f) {
          return c(m, f, this);
        };
        var p = function(m) {
          return m.$u ? l.utc() : l();
        };
        i.toNow = function(m) {
          return this.to(p(this), m);
        }, i.fromNow = function(m) {
          return this.from(p(this), m);
        };
      };
    }));
  })(K)), K.exports;
}
var At = Rt();
const Et = /* @__PURE__ */ Dt(At);
var q = { exports: {} }, It = q.exports, Le;
function Pt() {
  return Le || (Le = 1, (function(e, a) {
    (function(r, n) {
      e.exports = n(z);
    })(It, (function(r) {
      function n(o) {
        return o && typeof o == "object" && "default" in o ? o : { default: o };
      }
      var l = n(r), i = { name: "zh-cn", weekdays: "星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"), weekdaysShort: "周日_周一_周二_周三_周四_周五_周六".split("_"), weekdaysMin: "日_一_二_三_四_五_六".split("_"), months: "一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"), monthsShort: "1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"), ordinal: function(o, c) {
        return c === "W" ? o + "周" : o + "日";
      }, weekStart: 1, yearStart: 4, formats: { LT: "HH:mm", LTS: "HH:mm:ss", L: "YYYY/MM/DD", LL: "YYYY年M月D日", LLL: "YYYY年M月D日Ah点mm分", LLLL: "YYYY年M月D日ddddAh点mm分", l: "YYYY/M/D", ll: "YYYY年M月D日", lll: "YYYY年M月D日 HH:mm", llll: "YYYY年M月D日dddd HH:mm" }, relativeTime: { future: "%s内", past: "%s前", s: "几秒", m: "1 分钟", mm: "%d 分钟", h: "1 小时", hh: "%d 小时", d: "1 天", dd: "%d 天", M: "1 个月", MM: "%d 个月", y: "1 年", yy: "%d 年" }, meridiem: function(o, c) {
        var p = 100 * o + c;
        return p < 600 ? "凌晨" : p < 900 ? "早上" : p < 1100 ? "上午" : p < 1300 ? "中午" : p < 1800 ? "下午" : "晚上";
      } };
      return l.default.locale(i, null, !0), i;
    }));
  })(q)), q.exports;
}
Pt();
z.extend(Et);
function j(e) {
  return e ? e.toLowerCase().startsWith("zh") : !1;
}
function ye(e) {
  return j(e) ? "zh-cn" : "en";
}
function U(e, a) {
  return e ? z(e).locale(ye(a)).fromNow() : j(a) ? "未知" : "Unknown";
}
function ae(e, a) {
  return e ? z(e).locale(ye(a)).format("MMM D, YYYY") : j(a) ? "未知" : "Unknown";
}
function pa(e, a) {
  return e ? z(e).locale(ye(a)).format("MMM D, YYYY h:mm A") : j(a) ? "未知" : "Unknown";
}
function $t(e, a, r) {
  if (!e || !a) return "";
  const n = z(e), i = z(a).diff(n);
  if (i < 0) return "";
  const o = Math.floor(i / (1e3 * 60 * 60 * 24)), c = Math.floor(i % (1e3 * 60 * 60 * 24) / (1e3 * 60 * 60)), p = Math.floor(i % (1e3 * 60 * 60) / (1e3 * 60)), m = j(r), f = m ? {
    minute: (h) => `${h} 分钟`,
    hour: (h) => `${h} 小时`,
    day: (h) => `${h} 天`,
    month: (h) => `${h} 个月`,
    year: (h) => `${h} 年`
  } : {
    minute: (h) => `${h}m`,
    hour: (h) => `${h}h`,
    day: (h) => `${h}d`,
    month: (h) => `${h}mo`,
    year: (h) => `${h}y`
  }, N = (...h) => h.filter(Boolean).join(" "), S = m ? "小于 1 分钟" : "< 1m";
  if (o === 0 && c === 0)
    return p === 0 ? S : f.minute(p);
  if (o === 0)
    return f.hour(c);
  if (o < 30)
    return c > 0 ? N(f.day(o), f.hour(c)) : f.day(o);
  const g = Math.floor(o / 30), b = o % 30;
  if (g < 12)
    return b > 0 ? N(f.month(g), f.day(b)) : f.month(g);
  const y = Math.floor(g / 12), T = g % 12;
  return T > 0 ? N(f.year(y), f.month(T)) : f.year(y);
}
function ha({
  spec: e,
  onClick: a,
  selected: r = !1,
  className: n,
  locale: l,
  maxTags: i = 3
}) {
  const o = e.title || e.specName, c = e.specNumber ? `#${String(e.specNumber).padStart(3, "0")}` : e.specName, p = e.tags || [], m = p.slice(0, i), f = p.length - i;
  return /* @__PURE__ */ s(
    A,
    {
      className: d(
        "cursor-pointer transition-all hover:shadow-md hover:border-primary/50",
        r && "border-primary ring-2 ring-primary/20",
        n
      ),
      onClick: a,
      role: "button",
      tabIndex: 0,
      onKeyDown: (N) => {
        (N.key === "Enter" || N.key === " ") && (N.preventDefault(), a == null || a());
      },
      children: [
        /* @__PURE__ */ s(B, { className: "pb-2", children: [
          /* @__PURE__ */ s("div", { className: "flex items-start justify-between gap-2", children: [
            /* @__PURE__ */ s("div", { className: "flex items-center gap-2 min-w-0", children: [
              /* @__PURE__ */ t(fe, { className: "h-4 w-4 text-muted-foreground shrink-0" }),
              /* @__PURE__ */ t("span", { className: "text-sm font-medium text-muted-foreground", children: c })
            ] }),
            /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5 shrink-0", children: [
              /* @__PURE__ */ t(Je, { status: e.status, iconOnly: !0 }),
              e.priority && /* @__PURE__ */ t(Ze, { priority: e.priority, iconOnly: !0 })
            ] })
          ] }),
          /* @__PURE__ */ t("h3", { className: "font-semibold text-base leading-tight truncate", title: o, children: o })
        ] }),
        /* @__PURE__ */ s(E, { className: "pt-0", children: [
          /* @__PURE__ */ s("div", { className: "flex flex-wrap gap-1.5 mb-2", children: [
            m.map((N) => /* @__PURE__ */ t(
              I,
              {
                variant: "secondary",
                className: "text-xs px-1.5 py-0 h-5",
                children: N
              },
              N
            )),
            f > 0 && /* @__PURE__ */ s(I, { variant: "outline", className: "text-xs px-1.5 py-0 h-5", children: [
              "+",
              f
            ] })
          ] }),
          e.updatedAt && /* @__PURE__ */ s("p", { className: "text-xs text-muted-foreground", children: [
            "Updated ",
            U(e.updatedAt, l)
          ] })
        ] })
      ]
    }
  );
}
function Yt({
  tag: e,
  className: a,
  showIcon: r = !1,
  onClick: n,
  removable: l = !1,
  onRemove: i
}) {
  return /* @__PURE__ */ s(
    I,
    {
      variant: "secondary",
      className: d(
        "flex items-center gap-1",
        n && "cursor-pointer hover:bg-secondary/80",
        a
      ),
      onClick: n,
      children: [
        r && /* @__PURE__ */ t(Pe, { className: "h-3 w-3" }),
        /* @__PURE__ */ t("span", { children: e }),
        l && /* @__PURE__ */ t(
          "button",
          {
            type: "button",
            onClick: (o) => {
              o.stopPropagation(), i == null || i();
            },
            className: "ml-0.5 rounded-full hover:bg-muted-foreground/20 p-0.5",
            "aria-label": `Remove tag ${e}`,
            children: /* @__PURE__ */ t(
              "svg",
              {
                className: "h-3 w-3",
                fill: "none",
                viewBox: "0 0 24 24",
                stroke: "currentColor",
                strokeWidth: 2,
                children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
              }
            )
          }
        )
      ]
    }
  );
}
function ga({ tags: e, maxVisible: a = 5, className: r, onTagClick: n }) {
  if (!e || e.length === 0) return null;
  const l = e.slice(0, a), i = e.length - a;
  return /* @__PURE__ */ s("div", { className: d("flex flex-wrap gap-1.5", r), children: [
    l.map((o, c) => /* @__PURE__ */ t(
      Yt,
      {
        tag: o,
        onClick: n ? () => n(o) : void 0
      },
      `${o}-${c}`
    )),
    i > 0 && /* @__PURE__ */ s(I, { variant: "outline", className: "text-xs", children: [
      "+",
      i,
      " more"
    ] })
  ] });
}
const re = [
  "#ef4444",
  // red
  "#f97316",
  // orange
  "#eab308",
  // yellow
  "#22c55e",
  // green
  "#14b8a6",
  // teal
  "#3b82f6",
  // blue
  "#6366f1",
  // indigo
  "#8b5cf6",
  // violet
  "#d946ef",
  // fuchsia
  "#ec4899",
  // pink
  "#6b7280",
  // gray
  "#78716c"
  // stone
];
function Ft(e) {
  if (!e) return re[0];
  let a = 0;
  for (let r = 0; r < e.length; r++)
    a = e.charCodeAt(r) + ((a << 5) - a);
  return re[Math.abs(a) % re.length];
}
function zt(e) {
  if (!e) return "#ffffff";
  const a = e.replace("#", ""), r = parseInt(a.substring(0, 2), 16), n = parseInt(a.substring(2, 4), 16), l = parseInt(a.substring(4, 6), 16);
  return (0.299 * r + 0.587 * n + 0.114 * l) / 255 > 0.5 ? "#000000" : "#ffffff";
}
function Qe(e) {
  if (!e) return "??";
  const a = e.trim().split(/[\s_-]+/).filter((r) => r.length > 0);
  if (a.length === 0) return "??";
  if (a.length >= 2 && a[0].length > 0 && a[1].length > 0)
    return (a[0][0] + a[1][0]).toUpperCase();
  if (a[0].length > 0) {
    const r = a[0];
    return r.length >= 2 ? (r[0] + r[1]).toUpperCase() : r[0].toUpperCase();
  }
  return "??";
}
const Ut = {
  status: "Status",
  priority: "Priority",
  created: "Created",
  updated: "Updated",
  completed: "Completed",
  assignee: "Assignee",
  tags: "Tags",
  source: "Source",
  viewOnGitHub: "View on GitHub"
};
function xa({ spec: e, className: a, locale: r, labels: n = {} }) {
  const l = { ...Ut, ...n };
  return /* @__PURE__ */ t(A, { className: d(a), children: /* @__PURE__ */ t(E, { className: "pt-6", children: /* @__PURE__ */ s("dl", { className: "grid grid-cols-2 gap-4", children: [
    /* @__PURE__ */ s("div", { children: [
      /* @__PURE__ */ t("dt", { className: "text-sm font-medium text-muted-foreground flex items-center gap-1.5 mb-1", children: l.status }),
      /* @__PURE__ */ t("dd", { children: /* @__PURE__ */ t(Je, { status: e.status || "planned" }) })
    ] }),
    /* @__PURE__ */ s("div", { children: [
      /* @__PURE__ */ t("dt", { className: "text-sm font-medium text-muted-foreground flex items-center gap-1.5 mb-1", children: l.priority }),
      /* @__PURE__ */ t("dd", { children: /* @__PURE__ */ t(Ze, { priority: e.priority || "medium" }) })
    ] }),
    /* @__PURE__ */ s("div", { children: [
      /* @__PURE__ */ s("dt", { className: "text-sm font-medium text-muted-foreground flex items-center gap-1.5 mb-1", children: [
        /* @__PURE__ */ t(ee, { className: "h-4 w-4" }),
        l.created
      ] }),
      /* @__PURE__ */ t("dd", { className: "text-sm", children: e.createdAt ? /* @__PURE__ */ s(ke, { children: [
        ae(e.createdAt, r),
        /* @__PURE__ */ s("span", { className: "text-muted-foreground ml-1", children: [
          "(",
          U(e.createdAt, r),
          ")"
        ] })
      ] }) : /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: "—" }) })
    ] }),
    /* @__PURE__ */ s("div", { children: [
      /* @__PURE__ */ s("dt", { className: "text-sm font-medium text-muted-foreground flex items-center gap-1.5 mb-1", children: [
        /* @__PURE__ */ t(ee, { className: "h-4 w-4" }),
        l.updated
      ] }),
      /* @__PURE__ */ t("dd", { className: "text-sm", children: e.updatedAt ? /* @__PURE__ */ s(ke, { children: [
        ae(e.updatedAt, r),
        /* @__PURE__ */ s("span", { className: "text-muted-foreground ml-1", children: [
          "(",
          U(e.updatedAt, r),
          ")"
        ] })
      ] }) : /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: "—" }) })
    ] }),
    e.completedAt && /* @__PURE__ */ s("div", { className: "col-span-2", children: [
      /* @__PURE__ */ s("dt", { className: "text-sm font-medium text-muted-foreground flex items-center gap-1.5 mb-1", children: [
        /* @__PURE__ */ t(ee, { className: "h-4 w-4" }),
        l.completed
      ] }),
      /* @__PURE__ */ s("dd", { className: "text-sm", children: [
        ae(e.completedAt, r),
        /* @__PURE__ */ s("span", { className: "text-muted-foreground ml-1", children: [
          "(",
          U(e.completedAt, r),
          ")"
        ] })
      ] })
    ] }),
    e.assignee && /* @__PURE__ */ s("div", { children: [
      /* @__PURE__ */ s("dt", { className: "text-sm font-medium text-muted-foreground flex items-center gap-1.5 mb-1", children: [
        /* @__PURE__ */ t(st, { className: "h-4 w-4" }),
        l.assignee
      ] }),
      /* @__PURE__ */ t("dd", { children: /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ t(he, { size: "sm", children: /* @__PURE__ */ t(ge, { className: "text-xs", children: Qe(e.assignee) }) }),
        /* @__PURE__ */ t("span", { className: "text-sm", children: e.assignee })
      ] }) })
    ] }),
    e.tags && e.tags.length > 0 && /* @__PURE__ */ s("div", { className: e.assignee ? "" : "col-span-2", children: [
      /* @__PURE__ */ s("dt", { className: "text-sm font-medium text-muted-foreground flex items-center gap-1.5 mb-1", children: [
        /* @__PURE__ */ t(Pe, { className: "h-4 w-4" }),
        l.tags
      ] }),
      /* @__PURE__ */ t("dd", { className: "flex gap-1 flex-wrap", children: e.tags.map((i, o) => /* @__PURE__ */ t(I, { variant: "outline", className: "text-xs", children: i }, `${i}-${o}`)) })
    ] }),
    e.githubUrl && /* @__PURE__ */ s("div", { className: "col-span-2", children: [
      /* @__PURE__ */ s("dt", { className: "text-sm font-medium text-muted-foreground flex items-center gap-1.5 mb-1", children: [
        /* @__PURE__ */ t(nt, { className: "h-4 w-4" }),
        l.source
      ] }),
      /* @__PURE__ */ t("dd", { children: /* @__PURE__ */ s(
        "a",
        {
          href: e.githubUrl,
          target: "_blank",
          rel: "noopener noreferrer",
          className: "text-sm text-primary hover:underline flex items-center gap-1",
          children: [
            l.viewOnGitHub,
            /* @__PURE__ */ t(lt, { className: "h-3.5 w-3.5" })
          ]
        }
      ) })
    ] })
  ] }) }) });
}
const De = {
  created: "Created",
  inProgress: "In Progress",
  complete: "Complete",
  archived: "Archived",
  awaiting: "Awaiting",
  queued: "Queued",
  pending: "Pending"
};
function Na({
  createdAt: e,
  updatedAt: a,
  completedAt: r,
  status: n,
  className: l,
  labels: i = De,
  language: o = "en"
}) {
  const c = { ...De, ...i }, p = [];
  return e && p.push({
    label: c.created,
    date: e,
    isActive: !0,
    isFuture: !1,
    icon: Q,
    color: "text-blue-600"
  }), n === "in-progress" || n === "complete" || n === "archived" ? p.push({
    label: c.inProgress,
    date: a || e,
    isActive: !0,
    isFuture: !1,
    icon: Z,
    color: "text-orange-600"
  }) : p.push({
    label: c.inProgress,
    date: null,
    isActive: !1,
    isFuture: !0,
    icon: Ce,
    color: "text-muted-foreground"
  }), n === "complete" || n === "archived" ? p.push({
    label: c.complete,
    date: r || a,
    isActive: !0,
    isFuture: !1,
    icon: J,
    color: "text-green-600"
  }) : p.push({
    label: c.complete,
    date: null,
    isActive: !1,
    isFuture: !0,
    icon: Ce,
    color: "text-muted-foreground"
  }), n === "archived" && p.push({
    label: c.archived,
    date: a,
    isActive: !0,
    isFuture: !1,
    icon: W,
    color: "text-gray-600"
  }), p.length === 0 ? null : /* @__PURE__ */ t("div", { className: d("flex items-start gap-2", l), children: p.map((m, f) => {
    const N = m.icon, S = f === p.length - 1, g = S ? null : p[f + 1], b = m.date && (g != null && g.date) && !g.isFuture ? $t(m.date, g.date, o) : "";
    return /* @__PURE__ */ s("div", { className: "flex items-center gap-2 flex-1", children: [
      /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-1 min-w-0", children: [
        /* @__PURE__ */ t(
          "div",
          {
            className: d(
              "w-8 h-8 rounded-full border-2 bg-background flex items-center justify-center shrink-0",
              m.isActive && !m.isFuture ? "border-primary" : "border-muted-foreground/40"
            ),
            children: N && /* @__PURE__ */ t(
              N,
              {
                className: d(
                  "h-4 w-4",
                  m.isActive && !m.isFuture ? "text-primary" : "text-muted-foreground/60"
                )
              }
            )
          }
        ),
        /* @__PURE__ */ t(
          "div",
          {
            className: d(
              "text-xs font-medium text-center whitespace-nowrap",
              m.isActive && !m.isFuture ? "text-foreground" : "text-muted-foreground"
            ),
            children: m.label
          }
        ),
        /* @__PURE__ */ s("div", { className: "text-[10px] text-center min-h-[14px]", children: [
          m.date && !m.isFuture && /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: U(m.date, o) }),
          !m.date && m.isFuture && /* @__PURE__ */ t("span", { className: "text-muted-foreground/70", children: c.awaiting }),
          m.date && m.isFuture && /* @__PURE__ */ t("span", { className: "text-muted-foreground/70", children: c.queued }),
          !m.date && !m.isFuture && /* @__PURE__ */ t("span", { className: "text-muted-foreground/60", children: c.pending })
        ] })
      ] }),
      !S && /* @__PURE__ */ s("div", { className: "flex flex-col items-center flex-1 min-w-4 gap-0.5", children: [
        /* @__PURE__ */ t(
          "div",
          {
            className: d(
              "h-0.5 w-full",
              m.isActive && !m.isFuture ? "bg-primary" : "bg-muted-foreground/40"
            )
          }
        ),
        b && /* @__PURE__ */ t("div", { className: "text-[10px] text-muted-foreground font-medium whitespace-nowrap", children: b })
      ] })
    ] }, f);
  }) });
}
const Bt = ["planned", "in-progress", "complete", "archived"], Vt = {
  planned: {
    icon: Q,
    label: "Planned",
    className: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400"
  },
  "in-progress": {
    icon: Z,
    label: "In Progress",
    className: "bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-400"
  },
  complete: {
    icon: J,
    label: "Complete",
    className: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400"
  },
  archived: {
    icon: W,
    label: "Archived",
    className: "bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-400"
  }
};
function ba({
  currentStatus: e,
  onStatusChange: a,
  disabled: r = !1,
  config: n,
  className: l,
  ariaLabel: i = "Change status"
}) {
  const [o, c] = u.useState(e), [p, m] = u.useState(!1), [f, N] = u.useState(null), S = u.useMemo(() => {
    const h = { ...Vt };
    if (n)
      for (const w in n) {
        const v = w;
        h[v] = { ...h[v], ...n[v] };
      }
    return h;
  }, [n]);
  u.useEffect(() => {
    c(e);
  }, [e]);
  const g = async (h) => {
    if (h === o) return;
    const w = o;
    c(h), m(!0), N(null);
    try {
      await a(h);
    } catch (v) {
      c(w);
      const D = v instanceof Error ? v.message : "Failed to update";
      N(D), console.error("Status update failed:", v);
    } finally {
      m(!1);
    }
  }, b = S[o], y = b.icon, T = b.label;
  return /* @__PURE__ */ s("div", { className: d("relative", l), children: [
    /* @__PURE__ */ s(
      Ue,
      {
        value: o,
        onValueChange: (h) => g(h),
        disabled: r || p,
        children: [
          /* @__PURE__ */ t(
            xe,
            {
              className: d(
                "h-7 w-fit min-w-[120px] border-0 px-2 text-xs font-medium",
                b.className,
                p && "opacity-70"
              ),
              "aria-label": i,
              children: /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5", children: [
                p ? /* @__PURE__ */ t(pe, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ t(y, { className: "h-3.5 w-3.5" }),
                /* @__PURE__ */ t(Be, { children: T })
              ] })
            }
          ),
          /* @__PURE__ */ t(Ne, { children: Bt.map((h) => {
            const w = S[h], v = w.icon;
            return /* @__PURE__ */ t(be, { value: h, className: "pl-2", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
              /* @__PURE__ */ t(v, { className: "h-4 w-4" }),
              /* @__PURE__ */ t("span", { children: w.label })
            ] }) }, h);
          }) })
        ]
      }
    ),
    f && /* @__PURE__ */ t("div", { className: "absolute top-full left-0 mt-1 text-xs text-destructive", children: f })
  ] });
}
const Ht = ["low", "medium", "high", "critical"], Ot = {
  critical: {
    icon: Ie,
    label: "Critical",
    className: "bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"
  },
  high: {
    icon: ue,
    label: "High",
    className: "bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-400"
  },
  medium: {
    icon: me,
    label: "Medium",
    className: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400"
  },
  low: {
    icon: Ee,
    label: "Low",
    className: "bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-400"
  }
};
function wa({
  currentPriority: e,
  onPriorityChange: a,
  disabled: r = !1,
  config: n,
  className: l,
  ariaLabel: i = "Change priority"
}) {
  const [o, c] = u.useState(e), [p, m] = u.useState(!1), [f, N] = u.useState(null), S = u.useMemo(() => {
    const h = { ...Ot };
    if (n)
      for (const w in n) {
        const v = w;
        h[v] = { ...h[v], ...n[v] };
      }
    return h;
  }, [n]);
  u.useEffect(() => {
    c(e);
  }, [e]);
  const g = async (h) => {
    if (h === o) return;
    const w = o;
    c(h), m(!0), N(null);
    try {
      await a(h);
    } catch (v) {
      c(w);
      const D = v instanceof Error ? v.message : "Failed to update";
      N(D), console.error("Priority update failed:", v);
    } finally {
      m(!1);
    }
  }, b = S[o], y = b.icon, T = b.label;
  return /* @__PURE__ */ s("div", { className: d("relative", l), children: [
    /* @__PURE__ */ s(
      Ue,
      {
        value: o,
        onValueChange: (h) => g(h),
        disabled: r || p,
        children: [
          /* @__PURE__ */ t(
            xe,
            {
              className: d(
                "h-7 w-fit min-w-[100px] border-0 px-2 text-xs font-medium",
                b.className,
                p && "opacity-70"
              ),
              "aria-label": i,
              children: /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5", children: [
                p ? /* @__PURE__ */ t(pe, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ t(y, { className: "h-3.5 w-3.5" }),
                /* @__PURE__ */ t(Be, { children: T })
              ] })
            }
          ),
          /* @__PURE__ */ t(Ne, { children: Ht.map((h) => {
            const w = S[h], v = w.icon;
            return /* @__PURE__ */ t(be, { value: h, className: "pl-2", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
              /* @__PURE__ */ t(v, { className: "h-4 w-4" }),
              /* @__PURE__ */ t("span", { children: w.label })
            ] }) }, h);
          }) })
        ]
      }
    ),
    f && /* @__PURE__ */ t("div", { className: "absolute top-full left-0 mt-1 text-xs text-destructive", children: f })
  ] });
}
const jt = {
  addTag: "Add tag",
  removeTag: "Remove tag",
  searchTag: "Search tags...",
  createTag: 'Create "{tag}"',
  noResults: "No tags found",
  existingTags: "Existing tags",
  createSection: "Create new",
  tagExists: "Tag already exists"
};
function ya({
  currentTags: e,
  availableTags: a = [],
  onTagsChange: r,
  onFetchAvailableTags: n,
  disabled: l = !1,
  className: i,
  labels: o
}) {
  const c = { ...jt, ...o }, [p, m] = u.useState(e || []), [f, N] = u.useState(a), [S, g] = u.useState(!1), [b, y] = u.useState(null), [T, h] = u.useState(!1), [w, v] = u.useState(""), [D, M] = u.useState(!1);
  u.useEffect(() => {
    m(e || []);
  }, [e]), u.useEffect(() => {
    T && f.length === 0 && n && !D && (M(!0), Promise.resolve(n()).then((k) => {
      N(k);
    }).catch((k) => {
      console.error("Failed to fetch tags:", k);
    }).finally(() => {
      M(!1);
    }));
  }, [T, f.length, n, D]);
  const P = async (k) => {
    const R = p;
    m(k), g(!0), y(null);
    try {
      await r(k);
    } catch (F) {
      m(R);
      const Xe = F instanceof Error ? F.message : "Failed to update";
      y(Xe), console.error("Tags update failed:", F);
    } finally {
      g(!1);
    }
  }, Y = (k) => {
    const R = k.trim().toLowerCase();
    if (!R) return;
    if (p.includes(R)) {
      y(c.tagExists), setTimeout(() => y(null), 3e3);
      return;
    }
    const F = [...p, R];
    P(F), v(""), h(!1);
  }, V = (k) => {
    const R = p.filter((F) => F !== k);
    P(R);
  }, X = u.useMemo(() => {
    const k = w.toLowerCase();
    return f.filter((R) => !p.includes(R)).filter((R) => !k || R.toLowerCase().includes(k));
  }, [f, p, w]), ve = w.trim() && !p.includes(w.trim().toLowerCase()) && !f.includes(w.trim().toLowerCase());
  return /* @__PURE__ */ t("div", { className: d("relative", i), children: /* @__PURE__ */ s("div", { className: "flex gap-1 flex-wrap items-center", children: [
    p.map((k) => /* @__PURE__ */ s(
      I,
      {
        variant: "outline",
        className: d(
          "text-xs pr-1 gap-1",
          l && "opacity-50"
        ),
        children: [
          k,
          !l && /* @__PURE__ */ t(
            "button",
            {
              onClick: () => V(k),
              disabled: S,
              className: "ml-1 rounded-full hover:bg-muted p-0.5 transition-colors",
              "aria-label": c.removeTag.replace("{tag}", k),
              children: /* @__PURE__ */ t(ce, { className: "h-3 w-3" })
            }
          )
        ]
      },
      k
    )),
    !l && /* @__PURE__ */ s(bt, { open: T, onOpenChange: h, children: [
      /* @__PURE__ */ t(wt, { asChild: !0, children: /* @__PURE__ */ t(
        $,
        {
          variant: "outline",
          size: "sm",
          className: "h-6 px-2 text-xs",
          disabled: S,
          "aria-label": c.addTag,
          children: S ? /* @__PURE__ */ t(pe, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ t(te, { className: "h-3 w-3" })
        }
      ) }),
      /* @__PURE__ */ s(Oe, { className: "w-56 p-0", align: "start", children: [
        /* @__PURE__ */ s(we, { children: [
          /* @__PURE__ */ t(
            Ke,
            {
              placeholder: c.searchTag,
              value: w,
              onValueChange: v
            }
          ),
          /* @__PURE__ */ s(qe, { children: [
            /* @__PURE__ */ t(We, { children: ve ? /* @__PURE__ */ s(
              G,
              {
                onSelect: () => Y(w),
                className: "cursor-pointer",
                children: [
                  /* @__PURE__ */ t(te, { className: "mr-2 h-4 w-4" }),
                  c.createTag.replace("{tag}", w.trim().toLowerCase())
                ]
              }
            ) : /* @__PURE__ */ t("span", { className: "text-muted-foreground px-2 py-1.5 text-sm", children: c.noResults }) }),
            X.length > 0 && /* @__PURE__ */ t(le, { heading: c.existingTags, children: X.slice(0, 10).map((k) => /* @__PURE__ */ t(
              G,
              {
                value: k,
                onSelect: () => Y(k),
                className: "cursor-pointer",
                children: k
              },
              k
            )) }),
            ve && X.length > 0 && /* @__PURE__ */ t(le, { heading: c.createSection, children: /* @__PURE__ */ s(
              G,
              {
                onSelect: () => Y(w),
                className: "cursor-pointer",
                children: [
                  /* @__PURE__ */ t(te, { className: "mr-2 h-4 w-4" }),
                  c.createTag.replace("{tag}", w.trim().toLowerCase())
                ]
              }
            ) })
          ] })
        ] }),
        b && /* @__PURE__ */ t("p", { className: "text-xs text-destructive px-2 pb-2", children: b })
      ] })
    ] })
  ] }) });
}
function Gt(e) {
  if (e.startsWith("/") || e.startsWith("#") || e.startsWith("."))
    return !0;
  try {
    const a = new URL(e);
    return a.protocol === "http:" || a.protocol === "https:";
  } catch {
    return !1;
  }
}
function va({ icon: e, title: a, description: r, action: n, className: l }) {
  const i = n != null && n.href && Gt(n.href) ? n.href : void 0;
  return /* @__PURE__ */ s(
    "div",
    {
      className: d(
        "flex flex-col items-center justify-center py-12 px-4 text-center",
        l
      ),
      children: [
        /* @__PURE__ */ t("div", { className: "rounded-full bg-muted p-6 mb-4", children: /* @__PURE__ */ t(e, { className: "h-12 w-12 text-muted-foreground" }) }),
        /* @__PURE__ */ t("h3", { className: "text-lg font-semibold mb-2", children: a }),
        /* @__PURE__ */ t("p", { className: "text-sm text-muted-foreground max-w-md mb-6", children: r }),
        n && /* @__PURE__ */ t($, { onClick: n.onClick, ...i ? { asChild: !0 } : {}, children: i ? /* @__PURE__ */ t("a", { href: i, rel: "noopener noreferrer", children: n.label }) : n.label })
      ]
    }
  );
}
function ka() {
  return /* @__PURE__ */ t("div", { className: "space-y-4", children: [...Array(5)].map((e, a) => /* @__PURE__ */ s(A, { children: [
    /* @__PURE__ */ t(B, { children: /* @__PURE__ */ s("div", { className: "flex items-start justify-between", children: [
      /* @__PURE__ */ s("div", { className: "space-y-2 flex-1", children: [
        /* @__PURE__ */ t(x, { className: "h-6 w-3/4" }),
        /* @__PURE__ */ t(x, { className: "h-4 w-1/2" })
      ] }),
      /* @__PURE__ */ t(x, { className: "h-6 w-20" })
    ] }) }),
    /* @__PURE__ */ t(E, { children: /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
      /* @__PURE__ */ t(x, { className: "h-5 w-16" }),
      /* @__PURE__ */ t(x, { className: "h-5 w-16" }),
      /* @__PURE__ */ t(x, { className: "h-5 w-16" })
    ] }) })
  ] }, a)) });
}
function Sa() {
  return /* @__PURE__ */ t("div", { className: "container mx-auto py-8 px-4 max-w-6xl", children: /* @__PURE__ */ s("div", { className: "space-y-6", children: [
    /* @__PURE__ */ t(x, { className: "h-5 w-48" }),
    /* @__PURE__ */ s("div", { className: "space-y-4", children: [
      /* @__PURE__ */ t(x, { className: "h-10 w-2/3" }),
      /* @__PURE__ */ t(x, { className: "h-5 w-full" })
    ] }),
    /* @__PURE__ */ t("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-4", children: [...Array(4)].map((e, a) => /* @__PURE__ */ t(A, { children: /* @__PURE__ */ s(E, { className: "p-4", children: [
      /* @__PURE__ */ t(x, { className: "h-4 w-20 mb-2" }),
      /* @__PURE__ */ t(x, { className: "h-6 w-24" })
    ] }) }, a)) }),
    /* @__PURE__ */ t(A, { children: /* @__PURE__ */ s(E, { className: "p-6 space-y-4", children: [
      /* @__PURE__ */ t(x, { className: "h-8 w-1/3" }),
      /* @__PURE__ */ t(x, { className: "h-4 w-full" }),
      /* @__PURE__ */ t(x, { className: "h-4 w-full" }),
      /* @__PURE__ */ t(x, { className: "h-4 w-4/5" }),
      /* @__PURE__ */ t("div", { className: "py-4" }),
      /* @__PURE__ */ t(x, { className: "h-8 w-1/4" }),
      /* @__PURE__ */ t(x, { className: "h-4 w-full" }),
      /* @__PURE__ */ t(x, { className: "h-4 w-full" }),
      /* @__PURE__ */ t(x, { className: "h-4 w-3/4" })
    ] }) })
  ] }) });
}
function Ca() {
  return /* @__PURE__ */ s(A, { className: "relative overflow-hidden", children: [
    /* @__PURE__ */ t(B, { className: "pb-3", children: /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
      /* @__PURE__ */ t(x, { className: "h-4 w-24" }),
      /* @__PURE__ */ t(x, { className: "h-5 w-5 rounded-full" })
    ] }) }),
    /* @__PURE__ */ s(E, { children: [
      /* @__PURE__ */ t(x, { className: "h-8 w-16 mb-2" }),
      /* @__PURE__ */ t(x, { className: "h-3 w-32" })
    ] })
  ] });
}
function Ta() {
  return /* @__PURE__ */ t("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6", children: [...Array(4)].map((e, a) => /* @__PURE__ */ s("div", { className: "space-y-4", children: [
    /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
      /* @__PURE__ */ t(x, { className: "h-6 w-32" }),
      /* @__PURE__ */ t(x, { className: "h-6 w-8" })
    ] }),
    /* @__PURE__ */ t("div", { className: "space-y-3", children: [...Array(3)].map((r, n) => /* @__PURE__ */ t(A, { children: /* @__PURE__ */ s(E, { className: "p-4 space-y-2", children: [
      /* @__PURE__ */ t(x, { className: "h-5 w-full" }),
      /* @__PURE__ */ t(x, { className: "h-4 w-3/4" }),
      /* @__PURE__ */ s("div", { className: "flex gap-2 pt-2", children: [
        /* @__PURE__ */ t(x, { className: "h-5 w-16" }),
        /* @__PURE__ */ t(x, { className: "h-5 w-16" })
      ] })
    ] }) }, n)) })
  ] }, a)) });
}
function _a() {
  return /* @__PURE__ */ t(A, { className: "overflow-hidden", children: /* @__PURE__ */ s(E, { className: "p-4", children: [
    /* @__PURE__ */ s("div", { className: "flex items-start gap-3", children: [
      /* @__PURE__ */ t(x, { className: "h-10 w-10 rounded-md" }),
      /* @__PURE__ */ s("div", { className: "flex-1 space-y-2", children: [
        /* @__PURE__ */ t(x, { className: "h-5 w-3/4" }),
        /* @__PURE__ */ t(x, { className: "h-4 w-full" })
      ] })
    ] }),
    /* @__PURE__ */ s("div", { className: "flex items-center gap-4 mt-4", children: [
      /* @__PURE__ */ t(x, { className: "h-4 w-16" }),
      /* @__PURE__ */ t(x, { className: "h-4 w-16" })
    ] })
  ] }) });
}
function La() {
  return /* @__PURE__ */ s("div", { className: "space-y-4 p-4", children: [
    /* @__PURE__ */ t(x, { className: "h-8 w-full" }),
    /* @__PURE__ */ t("div", { className: "space-y-2", children: [...Array(8)].map((e, a) => /* @__PURE__ */ t(x, { className: "h-9 w-full" }, a)) })
  ] });
}
function Da({ lines: e = 4, className: a }) {
  return /* @__PURE__ */ t("div", { className: a, children: /* @__PURE__ */ t("div", { className: "space-y-3", children: [...Array(e)].map((r, n) => /* @__PURE__ */ t(
    x,
    {
      className: "h-4",
      style: { width: `${85 + Math.random() * 15}%` }
    },
    n
  )) }) });
}
function Kt({
  name: e,
  color: a,
  icon: r,
  size: n = "md",
  className: l
}) {
  const i = Qe(e), o = a || Ft(e), c = zt(o.startsWith("#") ? o : void 0);
  return /* @__PURE__ */ s(he, { size: n, className: l, children: [
    r && /* @__PURE__ */ t(ze, { src: r, alt: e }),
    /* @__PURE__ */ t(
      ge,
      {
        className: "font-semibold border",
        style: {
          backgroundColor: o,
          color: c
        },
        children: i
      }
    )
  ] });
}
const qt = {
  specs: "specs",
  spec: "spec",
  updated: "Updated",
  noDescription: "No description",
  toggleFavorite: "Toggle favorite",
  moreOptions: "More options"
};
function Ma({
  project: e,
  onClick: a,
  onFavoriteToggle: r,
  onMoreOptions: n,
  selected: l = !1,
  className: i,
  locale: o,
  labels: c = {}
}) {
  const p = { ...qt, ...c }, m = e.specsCount === 1 ? p.spec : p.specs;
  return /* @__PURE__ */ s(
    A,
    {
      className: d(
        "cursor-pointer transition-all hover:shadow-md hover:border-primary/50",
        l && "border-primary ring-2 ring-primary/20",
        i
      ),
      onClick: a,
      role: "button",
      tabIndex: 0,
      onKeyDown: (f) => {
        (f.key === "Enter" || f.key === " ") && (f.preventDefault(), a == null || a());
      },
      children: [
        /* @__PURE__ */ t(B, { className: "pb-3", children: /* @__PURE__ */ s("div", { className: "flex items-start justify-between gap-2", children: [
          /* @__PURE__ */ s("div", { className: "flex items-center gap-3 min-w-0", children: [
            /* @__PURE__ */ t(
              Kt,
              {
                name: e.name,
                color: e.color || void 0,
                icon: e.icon || void 0,
                size: "lg"
              }
            ),
            /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
              /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
                /* @__PURE__ */ t("h3", { className: "font-semibold text-base leading-tight truncate", children: e.name }),
                e.favorite && /* @__PURE__ */ t(Te, { className: "h-4 w-4 shrink-0 fill-yellow-500 text-yellow-500" })
              ] }),
              /* @__PURE__ */ t("p", { className: "text-sm text-muted-foreground truncate mt-0.5", children: e.description || p.noDescription })
            ] })
          ] }),
          /* @__PURE__ */ s("div", { className: "flex items-center gap-1 shrink-0", children: [
            r && /* @__PURE__ */ t(
              $,
              {
                variant: "ghost",
                size: "icon",
                className: "h-8 w-8",
                onClick: (f) => {
                  f.stopPropagation(), r(!e.favorite);
                },
                "aria-label": p.toggleFavorite,
                children: /* @__PURE__ */ t(
                  Te,
                  {
                    className: d(
                      "h-4 w-4",
                      e.favorite ? "fill-yellow-500 text-yellow-500" : "text-muted-foreground"
                    )
                  }
                )
              }
            ),
            n && /* @__PURE__ */ t(
              $,
              {
                variant: "ghost",
                size: "icon",
                className: "h-8 w-8",
                onClick: (f) => {
                  f.stopPropagation(), n();
                },
                "aria-label": p.moreOptions,
                children: /* @__PURE__ */ t(ot, { className: "h-4 w-4" })
              }
            )
          ] })
        ] }) }),
        /* @__PURE__ */ t(E, { className: "pt-0 pb-3", children: e.tags && e.tags.length > 0 && /* @__PURE__ */ s("div", { className: "flex flex-wrap gap-1 mb-3", children: [
          e.tags.slice(0, 3).map((f, N) => /* @__PURE__ */ t(
            I,
            {
              variant: "secondary",
              className: "text-xs px-1.5 py-0 h-5",
              children: f
            },
            `${f}-${N}`
          )),
          e.tags.length > 3 && /* @__PURE__ */ s(I, { variant: "outline", className: "text-xs px-1.5 py-0 h-5", children: [
            "+",
            e.tags.length - 3
          ] })
        ] }) }),
        /* @__PURE__ */ t(Ye, { className: "pt-0", children: /* @__PURE__ */ s("div", { className: "flex items-center justify-between w-full text-xs text-muted-foreground", children: [
          /* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ t(fe, { className: "h-3.5 w-3.5" }),
            /* @__PURE__ */ s("span", { children: [
              e.specsCount ?? 0,
              " ",
              m
            ] })
          ] }),
          e.updatedAt && /* @__PURE__ */ s("span", { children: [
            p.updated,
            " ",
            U(e.updatedAt, o)
          ] })
        ] }) })
      ]
    }
  );
}
function Ra({
  theme: e = "light",
  onThemeChange: a,
  className: r,
  size: n = "icon"
}) {
  const l = e === "dark";
  return /* @__PURE__ */ s(
    $,
    {
      variant: "ghost",
      size: n,
      onClick: () => {
        const o = l ? "light" : "dark";
        a == null || a(o);
      },
      className: d("relative", r),
      "aria-label": `Switch to ${l ? "light" : "dark"} theme`,
      children: [
        /* @__PURE__ */ t(
          it,
          {
            className: d(
              "h-5 w-5 transition-all",
              l ? "-rotate-90 scale-0" : "rotate-0 scale-100"
            )
          }
        ),
        /* @__PURE__ */ t(
          dt,
          {
            className: d(
              "absolute h-5 w-5 transition-all",
              l ? "rotate-0 scale-100" : "rotate-90 scale-0"
            )
          }
        )
      ]
    }
  );
}
function Aa(e = "system") {
  const [a, r] = u.useState(e), [n, l] = u.useState(!1);
  u.useEffect(() => {
    l(!0);
    const o = localStorage.getItem("theme");
    if (o)
      r(o);
    else
      try {
        typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches && r("dark");
      } catch {
      }
  }, []), u.useEffect(() => {
    if (!n) return;
    const o = document.documentElement;
    if (o.classList.remove("light", "dark"), a === "system")
      try {
        const c = typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
        o.classList.add(c);
      } catch {
        o.classList.add("light");
      }
    else
      o.classList.add(a);
    localStorage.setItem("theme", a);
  }, [a, n]);
  const i = u.useCallback((o) => {
    r(o);
  }, []);
  return { theme: a, setTheme: i, mounted: n };
}
function Ea({
  threshold: e = 300,
  className: a,
  bottom: r = 24,
  right: n = 24
}) {
  const [l, i] = u.useState(!1);
  u.useEffect(() => {
    const m = () => {
      window.scrollY > e ? i(!0) : i(!1);
    };
    return window.addEventListener("scroll", m), () => window.removeEventListener("scroll", m);
  }, [e]);
  const o = () => {
    window.scrollTo({
      top: 0,
      behavior: "smooth"
    });
  };
  if (!l) return null;
  const c = typeof r == "number" ? `${r}px` : r, p = typeof n == "number" ? `${n}px` : n;
  return /* @__PURE__ */ t(
    $,
    {
      onClick: o,
      size: "icon",
      className: d(
        "fixed h-12 w-12 rounded-full shadow-lg z-40 hover:scale-110 transition-transform",
        a
      ),
      style: { bottom: c, right: p },
      "aria-label": "Back to top",
      children: /* @__PURE__ */ t(ue, { className: "h-5 w-5" })
    }
  );
}
function Ia({
  value: e = "",
  onChange: a,
  onSearch: r,
  showShortcut: n = !0,
  shortcutKey: l = "K",
  clearable: i = !0,
  className: o,
  containerClassName: c,
  placeholder: p = "Search...",
  ...m
}) {
  const f = u.useRef(null);
  u.useEffect(() => {
    if (!n) return;
    const b = (y) => {
      var T;
      y.key.toLowerCase() === l.toLowerCase() && (y.metaKey || y.ctrlKey) && (y.preventDefault(), (T = f.current) == null || T.focus());
    };
    return document.addEventListener("keydown", b), () => document.removeEventListener("keydown", b);
  }, [n, l]);
  const N = (b) => {
    a == null || a(b.target.value);
  }, S = (b) => {
    var y;
    b.key === "Enter" && (r == null || r(e)), b.key === "Escape" && (a == null || a(""), (y = f.current) == null || y.blur());
  }, g = () => {
    var b;
    a == null || a(""), (b = f.current) == null || b.focus();
  };
  return /* @__PURE__ */ s("div", { className: d("relative", c), children: [
    /* @__PURE__ */ t(Ae, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
    /* @__PURE__ */ t(
      Fe,
      {
        ref: f,
        type: "search",
        value: e,
        onChange: N,
        onKeyDown: S,
        placeholder: p,
        className: d("pl-9", i && e && "pr-16", o),
        ...m
      }
    ),
    /* @__PURE__ */ s("div", { className: "absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1", children: [
      i && e && /* @__PURE__ */ t(
        $,
        {
          type: "button",
          variant: "ghost",
          size: "icon",
          className: "h-6 w-6",
          onClick: g,
          "aria-label": "Clear search",
          children: /* @__PURE__ */ t(ce, { className: "h-3.5 w-3.5" })
        }
      ),
      n && !e && /* @__PURE__ */ s("kbd", { className: "pointer-events-none h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 hidden sm:inline-flex", children: [
        /* @__PURE__ */ t("span", { className: "text-xs", children: "⌘" }),
        l
      ] })
    ] })
  ] });
}
function Pa({
  value: e,
  options: a,
  onChange: r,
  placeholder: n = "Select...",
  className: l,
  clearable: i = !0,
  clearLabel: o = "All"
}) {
  const [c, p] = u.useState(!1), m = u.useRef(null);
  u.useEffect(() => {
    const g = (b) => {
      m.current && !m.current.contains(b.target) && p(!1);
    };
    return document.addEventListener("mousedown", g), () => document.removeEventListener("mousedown", g);
  }, []);
  const f = a.find((g) => g.value === e), N = (g) => {
    r == null || r(g), p(!1);
  }, S = () => {
    r == null || r(""), p(!1);
  };
  return /* @__PURE__ */ s("div", { ref: m, className: d("relative", l), children: [
    /* @__PURE__ */ s(
      $,
      {
        type: "button",
        variant: "outline",
        role: "combobox",
        "aria-expanded": c,
        className: "w-full justify-between",
        onClick: () => p(!c),
        children: [
          /* @__PURE__ */ s("span", { className: "flex items-center gap-2 truncate", children: [
            f == null ? void 0 : f.icon,
            (f == null ? void 0 : f.label) || n
          ] }),
          /* @__PURE__ */ t(
            de,
            {
              className: d("ml-2 h-4 w-4 shrink-0 opacity-50 transition-transform", c && "rotate-180")
            }
          )
        ]
      }
    ),
    c && /* @__PURE__ */ s("div", { className: "absolute z-50 mt-1 w-full rounded-md border bg-popover p-1 shadow-md", children: [
      i && /* @__PURE__ */ s(
        "button",
        {
          type: "button",
          className: d(
            "relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground",
            !e && "bg-accent"
          ),
          onClick: S,
          children: [
            /* @__PURE__ */ t("span", { className: "flex-1 text-left", children: o }),
            !e && /* @__PURE__ */ t(ne, { className: "h-4 w-4" })
          ]
        }
      ),
      a.map((g) => /* @__PURE__ */ s(
        "button",
        {
          type: "button",
          className: d(
            "relative flex w-full cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground",
            e === g.value && "bg-accent"
          ),
          onClick: () => N(g.value),
          children: [
            g.icon,
            /* @__PURE__ */ t("span", { className: "flex-1 text-left", children: g.label }),
            e === g.value && /* @__PURE__ */ t(ne, { className: "h-4 w-4" })
          ]
        },
        g.value
      ))
    ] })
  ] });
}
function H({
  title: e,
  value: a,
  subtitle: r,
  icon: n,
  iconColorClass: l = "text-blue-600",
  gradientClass: i = "from-blue-500/10",
  trend: o,
  trendValue: c,
  className: p
}) {
  const m = o === "up" ? ct : o === "down" ? mt : me;
  return /* @__PURE__ */ s(A, { className: d("relative overflow-hidden", p), children: [
    /* @__PURE__ */ t("div", { className: d("absolute inset-0 bg-gradient-to-br to-transparent", i) }),
    /* @__PURE__ */ t(B, { className: "relative pb-3", children: /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
      /* @__PURE__ */ t($e, { className: "text-sm font-medium text-muted-foreground", children: e }),
      n && /* @__PURE__ */ t(n, { className: d("h-5 w-5", l) })
    ] }) }),
    /* @__PURE__ */ s(E, { className: "relative", children: [
      /* @__PURE__ */ s("div", { className: "flex items-end gap-2", children: [
        /* @__PURE__ */ t("div", { className: "text-3xl font-bold", children: a }),
        o && c && /* @__PURE__ */ s(
          "div",
          {
            className: d(
              "flex items-center gap-0.5 text-sm font-medium",
              o === "up" && "text-green-600",
              o === "down" && "text-red-600",
              o === "neutral" && "text-muted-foreground"
            ),
            children: [
              /* @__PURE__ */ t(m, { className: "h-3.5 w-3.5" }),
              /* @__PURE__ */ t("span", { children: c })
            ]
          }
        )
      ] }),
      r && /* @__PURE__ */ t("p", { className: "text-xs text-muted-foreground mt-1", children: r })
    ] })
  ] });
}
const Wt = {
  total: "Total Specs",
  totalSubtitle: "All specifications",
  completed: "Completed",
  completedSubtitle: "completion rate",
  inProgress: "In Progress",
  inProgressSubtitle: "Currently active",
  planned: "Planned",
  plannedSubtitle: "Not yet started",
  archived: "Archived",
  archivedSubtitle: "No longer active",
  completionRate: "completion rate"
};
function $a({
  stats: e,
  showArchived: a = !1,
  className: r,
  labels: n = {}
}) {
  const l = { ...Wt, ...n };
  return /* @__PURE__ */ s("div", { className: d("grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4", r), children: [
    /* @__PURE__ */ t(
      H,
      {
        title: l.total,
        value: e.totalSpecs,
        subtitle: l.totalSubtitle,
        icon: fe,
        iconColorClass: "text-blue-600",
        gradientClass: "from-blue-500/10"
      }
    ),
    /* @__PURE__ */ t(
      H,
      {
        title: l.completed,
        value: e.completedSpecs,
        subtitle: `${e.completionRate}% ${l.completedSubtitle}`,
        icon: J,
        iconColorClass: "text-green-600",
        gradientClass: "from-green-500/10"
      }
    ),
    /* @__PURE__ */ t(
      H,
      {
        title: l.inProgress,
        value: e.inProgressSpecs,
        subtitle: l.inProgressSubtitle,
        icon: Z,
        iconColorClass: "text-orange-600",
        gradientClass: "from-orange-500/10"
      }
    ),
    /* @__PURE__ */ t(
      H,
      {
        title: l.planned,
        value: e.plannedSpecs,
        subtitle: l.plannedSubtitle,
        icon: Q,
        iconColorClass: "text-blue-600",
        gradientClass: "from-blue-500/10"
      }
    ),
    a && e.archivedSpecs !== void 0 && /* @__PURE__ */ t(
      H,
      {
        title: l.archived,
        value: e.archivedSpecs,
        subtitle: l.archivedSubtitle,
        icon: W,
        iconColorClass: "text-gray-600",
        gradientClass: "from-gray-500/10"
      }
    )
  ] });
}
const Jt = {
  default: "bg-primary",
  success: "bg-green-500",
  warning: "bg-orange-500",
  danger: "bg-red-500",
  info: "bg-blue-500"
}, Zt = {
  sm: "h-1.5",
  md: "h-2",
  lg: "h-3"
};
function Ya({
  value: e,
  label: a,
  showPercentage: r = !1,
  variant: n = "default",
  size: l = "md",
  className: i
}) {
  const o = Math.min(100, Math.max(0, e));
  return /* @__PURE__ */ s("div", { className: d("w-full", i), children: [
    (a || r) && /* @__PURE__ */ s("div", { className: "flex items-center justify-between mb-1", children: [
      a && /* @__PURE__ */ t("span", { className: "text-sm font-medium", children: a }),
      r && /* @__PURE__ */ s("span", { className: "text-sm text-muted-foreground", children: [
        Math.round(o),
        "%"
      ] })
    ] }),
    /* @__PURE__ */ t("div", { className: d("w-full bg-muted rounded-full overflow-hidden", Zt[l]), children: /* @__PURE__ */ t(
      "div",
      {
        className: d("h-full rounded-full transition-all duration-300", Jt[n]),
        style: { width: `${o}%` }
      }
    ) })
  ] });
}
function Fa(e, a) {
  const [r, n] = Re(() => {
    if (typeof window > "u")
      return a;
    try {
      const i = window.localStorage.getItem(e);
      return i ? JSON.parse(i) : a;
    } catch (i) {
      return console.warn(`Error reading localStorage key "${e}":`, i), a;
    }
  });
  return [r, (i) => {
    try {
      const o = i instanceof Function ? i(r) : i;
      n(o), typeof window < "u" && window.localStorage.setItem(e, JSON.stringify(o));
    } catch (o) {
      console.warn(`Error setting localStorage key "${e}":`, o);
    }
  }];
}
function za(e, a) {
  const [r, n] = Re(e);
  return se(() => {
    const l = setTimeout(() => {
      n(e);
    }, a);
    return () => {
      clearTimeout(l);
    };
  }, [e, a]), r;
}
function Ua(e, a) {
  const r = Se(void 0), n = Se(e);
  return se(() => {
    n.current = e;
  }, [e]), se(() => () => {
    r.current && clearTimeout(r.current);
  }, []), (...l) => {
    r.current && clearTimeout(r.current), r.current = setTimeout(() => {
      n.current(...l);
    }, a);
  };
}
export {
  he as Avatar,
  ge as AvatarFallback,
  ze as AvatarImage,
  Ea as BackToTop,
  I as Badge,
  $ as Button,
  A as Card,
  E as CardContent,
  pt as CardDescription,
  Ye as CardFooter,
  B as CardHeader,
  $e as CardTitle,
  we as Command,
  ma as CommandDialog,
  We as CommandEmpty,
  le as CommandGroup,
  Ke as CommandInput,
  G as CommandItem,
  qe as CommandList,
  _t as CommandSeparator,
  Lt as CommandShortcut,
  Da as ContentSkeleton,
  yt as Dialog,
  ca as DialogClose,
  Ge as DialogContent,
  Tt as DialogDescription,
  St as DialogFooter,
  kt as DialogHeader,
  je as DialogOverlay,
  vt as DialogPortal,
  Ct as DialogTitle,
  da as DialogTrigger,
  va as EmptyState,
  Pa as FilterSelect,
  Fe as Input,
  Ta as KanbanBoardSkeleton,
  re as PROJECT_COLORS,
  bt as Popover,
  Oe as PopoverContent,
  wt as PopoverTrigger,
  Ze as PriorityBadge,
  wa as PriorityEditor,
  Ya as ProgressBar,
  Kt as ProjectAvatar,
  Ma as ProjectCard,
  _a as ProjectCardSkeleton,
  Ia as SearchInput,
  Ue as Select,
  Ne as SelectContent,
  ia as SelectGroup,
  be as SelectItem,
  xt as SelectLabel,
  He as SelectScrollDownButton,
  Ve as SelectScrollUpButton,
  Nt as SelectSeparator,
  xe as SelectTrigger,
  Be as SelectValue,
  ht as Separator,
  La as SidebarSkeleton,
  x as Skeleton,
  ha as SpecCard,
  Sa as SpecDetailSkeleton,
  ka as SpecListSkeleton,
  xa as SpecMetadata,
  Na as SpecTimeline,
  H as StatsCard,
  Ca as StatsCardSkeleton,
  $a as StatsOverview,
  Je as StatusBadge,
  ba as StatusEditor,
  Yt as TagBadge,
  ga as TagList,
  ya as TagsEditor,
  Ra as ThemeToggle,
  ut as badgeVariants,
  ft as buttonVariants,
  d as cn,
  ie as defaultPriorityConfig,
  Ot as defaultPriorityEditorConfig,
  oe as defaultStatusConfig,
  Vt as defaultStatusEditorConfig,
  oa as extractH1Title,
  ae as formatDate,
  pa as formatDateTime,
  $t as formatDuration,
  U as formatRelativeTime,
  Ft as getColorFromString,
  zt as getContrastColor,
  Qe as getInitials,
  fa as getPriorityLabel,
  ua as getStatusLabel,
  za as useDebounce,
  Ua as useDebouncedCallback,
  Fa as useLocalStorage,
  Aa as useTheme
};
