import d from "react";
import "../../../@ant-design/cssinjs/es/extractStyle.mjs";
import M from "../../../@ant-design/cssinjs/es/hooks/useCacheToken.mjs";
import "../../../@ant-design/cssinjs/es/StyleContext.mjs";
import "../../../@ant-design/cssinjs/es/theme/createTheme.mjs";
import "../../../rc-util/es/warning.mjs";
import "../../../@ant-design/cssinjs/es/theme/ThemeCache.mjs";
import "../../../@ant-design/cssinjs/es/hooks/useCompatibleInsertionEffect.mjs";
import "../../../@ant-design/cssinjs/es/hooks/useEffectCleanupRegister.mjs";
import "../../../@ant-design/cssinjs/es/hooks/useHMR.mjs";
import "../../../@ant-design/cssinjs/es/transformers/legacyLogicalProperties.mjs";
import k from "../version/version.mjs";
import { DesignTokenContext as T, defaultTheme as v } from "./context.mjs";
import X from "./themes/seed.mjs";
import f from "./util/alias.mjs";
var l = globalThis && globalThis.__rest || function(r, n) {
  var i = {};
  for (var e in r)
    Object.prototype.hasOwnProperty.call(r, e) && n.indexOf(e) < 0 && (i[e] = r[e]);
  if (r != null && typeof Object.getOwnPropertySymbols == "function")
    for (var t = 0, e = Object.getOwnPropertySymbols(r); t < e.length; t++)
      n.indexOf(e[t]) < 0 && Object.prototype.propertyIsEnumerable.call(r, e[t]) && (i[e[t]] = r[e[t]]);
  return i;
};
const S = {
  lineHeight: !0,
  lineHeightSM: !0,
  lineHeightLG: !0,
  lineHeightHeading1: !0,
  lineHeightHeading2: !0,
  lineHeightHeading3: !0,
  lineHeightHeading4: !0,
  lineHeightHeading5: !0,
  opacityLoading: !0,
  fontWeightStrong: !0,
  zIndexPopupBase: !0,
  zIndexBase: !0
}, b = {
  size: !0,
  sizeSM: !0,
  sizeLG: !0,
  sizeMD: !0,
  sizeXS: !0,
  sizeXXS: !0,
  sizeMS: !0,
  sizeXL: !0,
  sizeXXL: !0,
  sizeUnit: !0,
  sizeStep: !0,
  motionBase: !0,
  motionUnit: !0
}, x = {
  screenXS: !0,
  screenXSMin: !0,
  screenXSMax: !0,
  screenSM: !0,
  screenSMMin: !0,
  screenSMMax: !0,
  screenMD: !0,
  screenMDMin: !0,
  screenMDMax: !0,
  screenLG: !0,
  screenLGMin: !0,
  screenLGMax: !0,
  screenXL: !0,
  screenXLMin: !0,
  screenXLMax: !0,
  screenXXL: !0,
  screenXXLMin: !0
}, h = (r, n, i) => {
  const e = i.getDerivativeToken(r), {
    override: t
  } = n, s = l(n, ["override"]);
  let o = Object.assign(Object.assign({}, e), {
    override: t
  });
  return o = f(o), s && Object.entries(s).forEach((c) => {
    let [a, u] = c;
    const {
      theme: p
    } = u, m = l(u, ["theme"]);
    let g = m;
    p && (g = h(Object.assign(Object.assign({}, o), m), {
      override: m
    }, p)), o[a] = g;
  }), o;
};
function U() {
  const {
    token: r,
    hashed: n,
    theme: i,
    override: e,
    cssVar: t
  } = d.useContext(T), s = `${k}-${n || ""}`, o = i || v, [c, a, u] = M(o, [X, r], {
    salt: s,
    override: e,
    getComputedToken: h,
    // formatToken will not be consumed after 1.15.0 with getComputedToken.
    // But token will break if @ant-design/cssinjs is under 1.15.0 without it
    formatToken: f,
    cssVar: t && {
      prefix: t.prefix,
      key: t.key,
      unitless: S,
      ignore: b,
      preserve: x
    }
  });
  return [o, u, n ? a : "", c, t];
}
export {
  U as default,
  h as getComputedToken,
  b as ignore,
  S as unitless
};
