import { s as __toESM } from "./chunk-BNovOVIE.js";
import { _ as Logger, g as cn, r as cva } from "./button-Dj4BTre0.js";
import { t as require_react } from "./react-DA-nE2FX.js";
import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
import { u as createLucideIcon } from "./dist-D3ZI9nhS.js";
import { t as require_jsx_runtime } from "./jsx-runtime-COBk7ree.js";
import { _ as useSetAtom, y as atom } from "./useTheme-DykuNHR2.js";
var Calendar = createLucideIcon("calendar", [
  ["path", {
    d: "M8 2v4",
    key: "1cmpym"
  }],
  ["path", {
    d: "M16 2v4",
    key: "4m81vk"
  }],
  ["rect", {
    width: "18",
    height: "18",
    x: "3",
    y: "4",
    rx: "2",
    key: "1hopcy"
  }],
  ["path", {
    d: "M3 10h18",
    key: "8toen8"
  }]
]), Hash = createLucideIcon("hash", [
  ["line", {
    x1: "4",
    x2: "20",
    y1: "9",
    y2: "9",
    key: "4lhtct"
  }],
  ["line", {
    x1: "4",
    x2: "20",
    y1: "15",
    y2: "15",
    key: "vyu0kd"
  }],
  ["line", {
    x1: "10",
    x2: "8",
    y1: "3",
    y2: "21",
    key: "1ggp8o"
  }],
  ["line", {
    x1: "16",
    x2: "14",
    y1: "3",
    y2: "21",
    key: "weycgp"
  }]
]), ToggleLeft = createLucideIcon("toggle-left", [["circle", {
  cx: "9",
  cy: "12",
  r: "3",
  key: "u3jwor"
}], ["rect", {
  width: "20",
  height: "14",
  x: "2",
  y: "5",
  rx: "7",
  key: "g7kal2"
}]]), Type = createLucideIcon("type", [
  ["path", {
    d: "M12 4v16",
    key: "1654pz"
  }],
  ["path", {
    d: "M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",
    key: "e0r10z"
  }],
  ["path", {
    d: "M9 20h6",
    key: "s66wpe"
  }]
]), import_compiler_runtime$2 = require_compiler_runtime();
function createReducer(e, h) {
  return {
    reducer: (g, _) => (g || (g = e()), _.type in h ? h[_.type](g, _.payload) : (Logger.error(`Action type ${_.type} is not defined in reducers.`), g)),
    createActions: (e2) => {
      let m = {};
      for (let g in h) m[g] = (m2) => {
        e2({
          type: g,
          payload: m2
        });
      };
      return m;
    }
  };
}
function createReducerAndAtoms(e, h, g) {
  let _ = [...g ?? []], v = (e2) => {
    _.push(e2);
  }, { reducer: y, createActions: b } = createReducer(e, h), x = (e2, h2) => {
    try {
      let g2 = y(e2, h2);
      for (let v2 of _) try {
        v2(e2, g2, h2);
      } catch (e3) {
        Logger.error(`Error in middleware for action ${h2.type}:`, e3);
      }
      return g2;
    } catch (g2) {
      return Logger.error(`Error in reducer for action ${h2.type}:`, g2), e2;
    }
  }, S = atom(e()), C = /* @__PURE__ */ new WeakMap();
  function w(e2) {
    let m = (0, import_compiler_runtime$2.c)(4), h2 = e2 === void 0 ? {} : e2, g2 = useSetAtom(S);
    if (h2.skipMiddleware === true) {
      let e3;
      return m[0] === g2 ? e3 = m[1] : (e3 = b((e4) => {
        g2((m2) => y(m2, e4));
      }), m[0] = g2, m[1] = e3), e3;
    }
    C.has(g2) || C.set(g2, b((e3) => {
      g2((m2) => x(m2, e3));
    }));
    let _2;
    return m[2] === g2 ? _2 = m[3] : (_2 = C.get(g2), m[2] = g2, m[3] = _2), _2;
  }
  return {
    reducer: x,
    addMiddleware: v,
    createActions: b,
    valueAtom: S,
    useActions: w
  };
}
var import_compiler_runtime$1 = require_compiler_runtime(), import_react = /* @__PURE__ */ __toESM(require_react(), 1), import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime(), 1), badgeVariants = cva("inline-flex items-center border rounded-full px-2 py-0.5 text-xs font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2", {
  variants: { variant: {
    default: "bg-primary hover:bg-primary/60 border-transparent text-primary-foreground",
    defaultOutline: "bg-(--blue-2) border-(--blue-8) text-(--blue-11)",
    secondary: "bg-secondary hover:bg-secondary/80 border-transparent text-secondary-foreground",
    destructive: "bg-(--red-2) border-(--red-6) text-(--red-9) hover:bg-(--red-3)",
    success: "bg-(--grass-2) border-(--grass-5) text-(--grass-9) hover:bg-(--grass-3)",
    outline: "text-foreground"
  } },
  defaultVariants: { variant: "default" }
}), Badge = (e) => {
  let m = (0, import_compiler_runtime$1.c)(10), g, _, v;
  m[0] === e ? (g = m[1], _ = m[2], v = m[3]) : ({ className: g, variant: v, ..._ } = e, m[0] = e, m[1] = g, m[2] = _, m[3] = v);
  let y;
  m[4] !== g || m[5] !== v ? (y = cn(badgeVariants({ variant: v }), g), m[4] = g, m[5] = v, m[6] = y) : y = m[6];
  let b;
  return m[7] !== _ || m[8] !== y ? (b = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
    className: y,
    ..._
  }), m[7] = _, m[8] = y, m[9] = b) : b = m[9], b;
}, import_compiler_runtime = require_compiler_runtime();
function useOnMount(e) {
  let m = (0, import_compiler_runtime.c)(1), h;
  m[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (h = [], m[0] = h) : h = m[0], (0, import_react.useEffect)(e, h);
}
function useOnUnmount(e) {
  let m = (0, import_compiler_runtime.c)(3), h;
  m[0] === e ? h = m[1] : (h = () => e(), m[0] = e, m[1] = h);
  let g;
  m[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (g = [], m[2] = g) : g = m[2], (0, import_react.useEffect)(h, g);
}
export {
  Type as a,
  Calendar as c,
  createReducerAndAtoms as i,
  useOnUnmount as n,
  ToggleLeft as o,
  Badge as r,
  Hash as s,
  useOnMount as t
};
