import { jsx as p, Fragment as k, jsxs as T } from "react/jsx-runtime";
import { createTheme as d, ThemeProvider as b, CssBaseline as S, useColorScheme as f } from "@mui/material";
import { useMemo as F, createContext as R, useEffect as y, useContext as z } from "react";
import { createTheme as B } from "@mui/material/styles";
const r = B(), s = {
  50: "hsl(210, 100%, 95%)",
  100: "hsl(210, 100%, 92%)",
  200: "hsl(210, 100%, 80%)",
  300: "hsl(210, 100%, 65%)",
  400: "hsl(210, 98%, 48%)",
  500: "hsl(210, 98%, 42%)",
  600: "hsl(210, 98%, 55%)",
  700: "hsl(210, 100%, 35%)",
  800: "hsl(210, 100%, 16%)",
  900: "hsl(210, 100%, 21%)"
}, m = {
  50: "#ECF0F6",
  // --ov-scale-gray-13
  100: "#CBD5E1",
  // --ov-scale-gray-12
  200: "#ABB8CC",
  // --ov-scale-gray-11
  300: "#8B9BB5",
  // --ov-scale-gray-10
  400: "#6B7D96",
  // --ov-scale-gray-9
  500: "#3E4F66",
  // --ov-scale-gray-8
  600: "#2D3D52",
  // --ov-scale-gray-6
  700: "#1F2937",
  // --ov-scale-gray-4
  800: "#151B23",
  // --ov-scale-gray-2
  900: "#0D1117"
  // --ov-scale-gray-0
}, n = {
  50: "hsl(120, 80%, 98%)",
  100: "hsl(120, 75%, 94%)",
  200: "hsl(120, 75%, 87%)",
  300: "hsl(120, 61%, 77%)",
  400: "hsl(120, 44%, 53%)",
  500: "hsl(120, 59%, 30%)",
  600: "hsl(120, 70%, 25%)",
  700: "hsl(120, 75%, 16%)",
  800: "hsl(120, 84%, 10%)",
  900: "hsl(120, 87%, 6%)"
}, l = {
  50: "hsl(45, 100%, 97%)",
  100: "hsl(45, 92%, 90%)",
  200: "hsl(45, 94%, 80%)",
  300: "hsl(45, 90%, 65%)",
  400: "hsl(45, 90%, 40%)",
  500: "hsl(45, 90%, 35%)",
  600: "hsl(45, 91%, 25%)",
  700: "hsl(45, 94%, 20%)",
  800: "hsl(45, 95%, 16%)",
  900: "hsl(45, 93%, 12%)"
}, i = {
  50: "hsl(0, 100%, 97%)",
  100: "hsl(0, 92%, 90%)",
  200: "hsl(0, 94%, 80%)",
  300: "hsl(0, 90%, 65%)",
  400: "hsl(0, 90%, 40%)",
  500: "hsl(0, 90%, 30%)",
  600: "hsl(0, 91%, 25%)",
  700: "hsl(0, 94%, 18%)",
  800: "hsl(0, 95%, 12%)",
  900: "hsl(0, 93%, 6%)"
}, o = {
  50: "hsl(270, 100%, 97%)",
  100: "hsl(270, 92%, 90%)",
  200: "hsl(270, 80%, 80%)",
  300: "hsl(270, 70%, 65%)",
  400: "hsl(270, 70%, 50%)",
  500: "hsl(270, 70%, 42%)",
  600: "hsl(270, 70%, 35%)",
  700: "hsl(270, 75%, 25%)",
  800: "hsl(270, 80%, 16%)",
  900: "hsl(270, 85%, 10%)"
}, j = (e) => ({
  palette: {
    mode: e,
    primary: {
      light: s[200],
      main: s[400],
      dark: s[700],
      contrastText: s[50],
      ...e === "dark" && {
        contrastText: s[50],
        light: s[300],
        main: s[400],
        dark: s[700]
      }
    },
    info: {
      light: s[100],
      main: s[300],
      dark: s[600],
      contrastText: m[50],
      ...e === "dark" && {
        contrastText: s[300],
        light: s[500],
        main: s[700],
        dark: s[900]
      }
    },
    warning: {
      light: l[300],
      main: l[400],
      dark: l[800],
      ...e === "dark" && {
        light: l[400],
        main: l[500],
        dark: l[700]
      }
    },
    error: {
      light: i[300],
      main: i[400],
      dark: i[800],
      ...e === "dark" && {
        light: i[400],
        main: i[500],
        dark: i[700]
      }
    },
    success: {
      light: n[300],
      main: n[400],
      dark: n[800],
      ...e === "dark" && {
        light: n[400],
        main: n[500],
        dark: n[700]
      }
    },
    secondary: {
      light: o[300],
      main: o[400],
      dark: o[700],
      contrastText: o[50],
      ...e === "dark" && {
        light: o[300],
        main: o[400],
        dark: o[800]
      }
    },
    grey: m,
    // Matches --ov-border-default / --ov-border-muted
    divider: e === "dark" ? "rgba(62, 79, 102, 0.6)" : "rgba(208, 215, 222, 0.6)",
    // alpha(--ov-border-default light, 0.6)
    background: {
      // Matches --ov-bg-base / --ov-bg-surface
      default: e === "dark" ? "#0D1117" : "#FFFFFF",
      paper: e === "dark" ? "#151B23" : "#F6F8FA"
    },
    text: {
      // Matches --ov-fg-default / --ov-fg-muted
      primary: e === "dark" ? "rgba(236, 240, 246, 0.92)" : "rgba(31, 35, 40, 0.92)",
      secondary: e === "dark" ? "rgba(236, 240, 246, 0.64)" : "rgba(31, 35, 40, 0.64)"
    },
    action: {
      // Matches --ov-state-hover / --ov-state-selected
      hover: e === "dark" ? "rgba(255, 255, 255, 0.04)" : "rgba(31, 35, 40, 0.04)",
      selected: e === "dark" ? "rgba(88, 166, 255, 0.10)" : "rgba(9, 105, 218, 0.10)"
    },
    baseShadow: e === "dark" ? "0 4px 12px rgba(0, 0, 0, 0.35), 0 2px 4px rgba(0, 0, 0, 0.25)" : "0 4px 12px rgba(31, 35, 40, 0.12), 0 2px 4px rgba(31, 35, 40, 0.08)"
  }
}), C = {
  fontFamily: [
    "-apple-system",
    "BlinkMacSystemFont",
    '"Segoe UI"',
    '"Noto Sans"',
    "Helvetica",
    "Arial",
    "sans-serif"
  ].join(","),
  h1: { fontSize: r.typography.pxToRem(48), fontWeight: 600, lineHeight: 1.2, letterSpacing: -0.5 },
  h2: { fontSize: r.typography.pxToRem(36), fontWeight: 600, lineHeight: 1.2 },
  h3: { fontSize: r.typography.pxToRem(30), fontWeight: 600, lineHeight: 1.2 },
  h4: { fontSize: r.typography.pxToRem(24), fontWeight: 600, lineHeight: 1.5 },
  h5: { fontSize: r.typography.pxToRem(20), fontWeight: 600 },
  h6: { fontSize: r.typography.pxToRem(18), fontWeight: 600 },
  subtitle1: { fontSize: r.typography.pxToRem(18) },
  subtitle2: { fontSize: r.typography.pxToRem(14), fontWeight: 500 },
  body1: { fontSize: r.typography.pxToRem(14) },
  body2: { fontSize: r.typography.pxToRem(14), fontWeight: 400 },
  caption: { fontSize: r.typography.pxToRem(12), fontWeight: 400 },
  button: { textTransform: "none", fontWeight: 600 },
  overline: {
    fontSize: r.typography.pxToRem(12),
    fontWeight: 600,
    textTransform: "uppercase",
    letterSpacing: "0.08em"
  }
}, W = { borderRadius: 8 }, P = (e) => {
  const t = e === "dark" ? "0 4px 12px rgba(0, 0, 0, 0.35), 0 2px 4px rgba(0, 0, 0, 0.25)" : "0 4px 12px rgba(31, 35, 40, 0.12), 0 2px 4px rgba(31, 35, 40, 0.08)", a = [...r.shadows];
  return a[1] = t, a;
};
class w {
  themes = /* @__PURE__ */ new Map();
  register(t, a) {
    this.themes.set(t, a);
  }
  get(t) {
    return this.themes.get(t) ?? this.themes.get("default");
  }
  getVariants() {
    return Array.from(this.themes.keys());
  }
}
const D = new w(), u = R({
  variant: "default",
  colorMode: "dark"
});
function $() {
  return z(u);
}
function M({ mode: e }) {
  const { setMode: t } = f();
  return y(() => {
    t && t(e);
  }, [e, t]), null;
}
function v({ variant: e }) {
  const { mode: t, systemMode: a } = f();
  return y(() => {
    const g = t === "system" ? a ?? "dark" : t ?? "dark", h = e === "default" ? g : `${e}-${g}`;
    document.documentElement.setAttribute("data-ov-theme", h);
  }, [e, t, a]), null;
}
function O({
  children: e,
  disableCustomTheme: t,
  themeComponents: a,
  defaultMode: g = "dark",
  variant: h = "default"
}) {
  const x = F(() => {
    if (t)
      return d();
    const c = D.get(h);
    return d({
      cssVariables: {
        colorSchemeSelector: "data-mui-color-scheme",
        cssVarPrefix: "ov-mui"
      },
      colorSchemes: {
        light: { palette: c.getDesignTokens("light").palette },
        dark: { palette: c.getDesignTokens("dark").palette }
      },
      typography: C,
      shape: W,
      shadows: c.getShadows("light"),
      components: {
        MuiCssBaseline: {
          styleOverrides: {
            html: { height: "100%" },
            body: { height: "100%" }
          }
        },
        ...c.getCustomizations(),
        ...a
      }
    });
  }, [t, a, h]);
  return t ? /* @__PURE__ */ p(k, { children: e }) : /* @__PURE__ */ p(u.Provider, { value: { variant: h, colorMode: g }, children: /* @__PURE__ */ T(b, { theme: x, children: [
    /* @__PURE__ */ p(S, { enableColorScheme: !0 }),
    /* @__PURE__ */ p(M, { mode: g }),
    /* @__PURE__ */ p(v, { variant: h }),
    e
  ] }) });
}
export {
  O as A,
  D as T,
  n as a,
  s as b,
  P as c,
  j as d,
  u as e,
  m as g,
  l as o,
  o as p,
  i as r,
  W as s,
  C as t,
  $ as u
};
