import { l0 as T, l1 as A, k_ as B, l2 as F, l3 as K, l4 as U, l5 as J, l6 as Q, l7 as Y, l8 as Z, l9 as k } from "./684d2f28.js";
import ee from "react";
var y = {}, I;
function te() {
  if (I)
    return y;
  I = 1;
  var t = T.default;
  Object.defineProperty(y, "__esModule", {
    value: !0
  }), y.default = o;
  var r = t(A());
  function o(n, l) {
    var c = (0, r.default)({}, n);
    return Array.isArray(l) && l.forEach(function(u) {
      delete c[u];
    }), c;
  }
  return y;
}
var z = {};
const ie = /* @__PURE__ */ B(F);
var m = {}, P;
function ne() {
  if (P)
    return m;
  P = 1, Object.defineProperty(m, "__esModule", {
    value: !0
  }), m.prepareComponentToken = m.default = void 0;
  var t = J, r = K(), o = U();
  const n = new t.Keyframes("antSpinMove", {
    to: {
      opacity: 1
    }
  }), l = new t.Keyframes("antRotate", {
    to: {
      transform: "rotate(405deg)"
    }
  }), c = (e) => {
    const {
      componentCls: i,
      calc: a
    } = e;
    return {
      [`${i}`]: Object.assign(Object.assign({}, (0, r.resetComponent)(e)), {
        position: "absolute",
        display: "none",
        color: e.colorPrimary,
        fontSize: 0,
        textAlign: "center",
        verticalAlign: "middle",
        opacity: 0,
        transition: `transform ${e.motionDurationSlow} ${e.motionEaseInOutCirc}`,
        "&-spinning": {
          position: "static",
          display: "inline-block",
          opacity: 1
        },
        [`${i}-text`]: {
          fontSize: e.fontSize,
          paddingTop: a(a(e.dotSize).sub(e.fontSize)).div(2).add(2).equal()
        },
        "&-fullscreen": {
          position: "fixed",
          width: "100vw",
          height: "100vh",
          backgroundColor: e.colorBgMask,
          zIndex: e.zIndexPopupBase,
          inset: 0,
          display: "flex",
          alignItems: "center",
          flexDirection: "column",
          justifyContent: "center",
          opacity: 0,
          visibility: "hidden",
          transition: `all ${e.motionDurationMid}`,
          "&-show": {
            opacity: 1,
            visibility: "visible"
          },
          [`${i}-dot ${i}-dot-item`]: {
            backgroundColor: e.colorWhite
          },
          [`${i}-text`]: {
            color: e.colorTextLightSolid
          }
        },
        "&-nested-loading": {
          position: "relative",
          [`> div > ${i}`]: {
            position: "absolute",
            top: 0,
            insetInlineStart: 0,
            zIndex: 4,
            display: "block",
            width: "100%",
            height: "100%",
            maxHeight: e.contentHeight,
            [`${i}-dot`]: {
              position: "absolute",
              top: "50%",
              insetInlineStart: "50%",
              margin: a(e.dotSize).mul(-1).div(2).equal()
            },
            [`${i}-text`]: {
              position: "absolute",
              top: "50%",
              width: "100%",
              textShadow: `0 1px 2px ${e.colorBgContainer}`
              // FIXME: shadow
            },
            [`&${i}-show-text ${i}-dot`]: {
              marginTop: a(e.dotSize).div(2).mul(-1).sub(10).equal()
            },
            "&-sm": {
              [`${i}-dot`]: {
                margin: a(e.dotSizeSM).mul(-1).div(2).equal()
              },
              [`${i}-text`]: {
                paddingTop: a(a(e.dotSizeSM).sub(e.fontSize)).div(2).add(2).equal()
              },
              [`&${i}-show-text ${i}-dot`]: {
                marginTop: a(e.dotSizeSM).div(2).mul(-1).sub(10).equal()
              }
            },
            "&-lg": {
              [`${i}-dot`]: {
                margin: a(e.dotSizeLG).mul(-1).div(2).equal()
              },
              [`${i}-text`]: {
                paddingTop: a(a(e.dotSizeLG).sub(e.fontSize)).div(2).add(2).equal()
              },
              [`&${i}-show-text ${i}-dot`]: {
                marginTop: a(e.dotSizeLG).div(2).mul(-1).sub(10).equal()
              }
            }
          },
          [`${i}-container`]: {
            position: "relative",
            transition: `opacity ${e.motionDurationSlow}`,
            "&::after": {
              position: "absolute",
              top: 0,
              insetInlineEnd: 0,
              bottom: 0,
              insetInlineStart: 0,
              zIndex: 10,
              width: "100%",
              height: "100%",
              background: e.colorBgContainer,
              opacity: 0,
              transition: `all ${e.motionDurationSlow}`,
              content: '""',
              pointerEvents: "none"
            }
          },
          [`${i}-blur`]: {
            clear: "both",
            opacity: 0.5,
            userSelect: "none",
            pointerEvents: "none",
            "&::after": {
              opacity: 0.4,
              pointerEvents: "auto"
            }
          }
        },
        // tip
        // ------------------------------
        "&-tip": {
          color: e.spinDotDefault
        },
        // dots
        // ------------------------------
        [`${i}-dot`]: {
          position: "relative",
          display: "inline-block",
          fontSize: e.dotSize,
          width: "1em",
          height: "1em",
          "&-item": {
            position: "absolute",
            display: "block",
            width: a(e.dotSize).sub(a(e.marginXXS).div(2)).div(2).equal(),
            height: a(e.dotSize).sub(a(e.marginXXS).div(2)).div(2).equal(),
            backgroundColor: e.colorPrimary,
            borderRadius: "100%",
            transform: "scale(0.75)",
            transformOrigin: "50% 50%",
            opacity: 0.3,
            animationName: n,
            animationDuration: "1s",
            animationIterationCount: "infinite",
            animationTimingFunction: "linear",
            animationDirection: "alternate",
            "&:nth-child(1)": {
              top: 0,
              insetInlineStart: 0,
              animationDelay: "0s"
            },
            "&:nth-child(2)": {
              top: 0,
              insetInlineEnd: 0,
              animationDelay: "0.4s"
            },
            "&:nth-child(3)": {
              insetInlineEnd: 0,
              bottom: 0,
              animationDelay: "0.8s"
            },
            "&:nth-child(4)": {
              bottom: 0,
              insetInlineStart: 0,
              animationDelay: "1.2s"
            }
          },
          "&-spin": {
            transform: "rotate(45deg)",
            animationName: l,
            animationDuration: "1.2s",
            animationIterationCount: "infinite",
            animationTimingFunction: "linear"
          }
        },
        // small
        [`&-sm ${i}-dot`]: {
          fontSize: e.dotSizeSM,
          i: {
            width: a(a(e.dotSizeSM).sub(a(e.marginXXS).div(2))).div(2).equal(),
            height: a(a(e.dotSizeSM).sub(a(e.marginXXS).div(2))).div(2).equal()
          }
        },
        // large
        [`&-lg ${i}-dot`]: {
          fontSize: e.dotSizeLG,
          i: {
            width: a(a(e.dotSizeLG).sub(e.marginXXS)).div(2).equal(),
            height: a(a(e.dotSizeLG).sub(e.marginXXS)).div(2).equal()
          }
        },
        [`&${i}-show-text ${i}-text`]: {
          display: "block"
        }
      })
    };
  }, u = (e) => {
    const {
      controlHeightLG: i,
      controlHeight: a
    } = e;
    return {
      contentHeight: 400,
      dotSize: i / 2,
      dotSizeSM: i * 0.35,
      dotSizeLG: a
    };
  };
  return m.prepareComponentToken = u, m.default = (0, o.genStyleHooks)("Spin", (e) => {
    const i = (0, o.mergeToken)(e, {
      spinDotDefault: e.colorTextDescription
    });
    return [c(i)];
  }, u), m;
}
var _ = T;
Object.defineProperty(z, "__esModule", {
  value: !0
});
var ae = z.default = void 0, s = de(ee), v = _(Q), oe = _(te()), re = ie, b = Y(), le = Z(), M = k(), se = _(ne());
function R(t) {
  if (typeof WeakMap != "function")
    return null;
  var r = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap();
  return (R = function(n) {
    return n ? o : r;
  })(t);
}
function de(t, r) {
  if (!r && t && t.__esModule)
    return t;
  if (t === null || typeof t != "object" && typeof t != "function")
    return { default: t };
  var o = R(r);
  if (o && o.has(t))
    return o.get(t);
  var n = { __proto__: null }, l = Object.defineProperty && Object.getOwnPropertyDescriptor;
  for (var c in t)
    if (c !== "default" && Object.prototype.hasOwnProperty.call(t, c)) {
      var u = l ? Object.getOwnPropertyDescriptor(t, c) : null;
      u && (u.get || u.set) ? Object.defineProperty(n, c, u) : n[c] = t[c];
    }
  return n.default = t, o && o.set(t, n), n;
}
var ce = function(t, r) {
  var o = {};
  for (var n in t)
    Object.prototype.hasOwnProperty.call(t, n) && r.indexOf(n) < 0 && (o[n] = t[n]);
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
    for (var l = 0, n = Object.getOwnPropertySymbols(t); l < n.length; l++)
      r.indexOf(n[l]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[l]) && (o[n[l]] = t[n[l]]);
  return o;
};
let h = null;
function ue(t, r) {
  const {
    indicator: o
  } = r, n = `${t}-dot`;
  return o === null ? null : (0, b.isValidElement)(o) ? (0, b.cloneElement)(o, {
    className: (0, v.default)(o.props.className, n)
  }) : (0, b.isValidElement)(h) ? (0, b.cloneElement)(h, {
    className: (0, v.default)(h.props.className, n)
  }) : /* @__PURE__ */ s.createElement("span", {
    className: (0, v.default)(n, `${t}-dot-spin`)
  }, /* @__PURE__ */ s.createElement("i", {
    className: `${t}-dot-item`,
    key: 1
  }), /* @__PURE__ */ s.createElement("i", {
    className: `${t}-dot-item`,
    key: 2
  }), /* @__PURE__ */ s.createElement("i", {
    className: `${t}-dot-item`,
    key: 3
  }), /* @__PURE__ */ s.createElement("i", {
    className: `${t}-dot-item`,
    key: 4
  }));
}
function pe(t, r) {
  return !!t && !!r && !isNaN(Number(r));
}
const x = (t) => {
  const {
    prefixCls: r,
    spinning: o = !0,
    delay: n = 0,
    className: l,
    rootClassName: c,
    size: u = "default",
    tip: e,
    wrapperClassName: i,
    style: a,
    children: $,
    fullscreen: g
  } = t, X = ce(t, ["prefixCls", "spinning", "delay", "className", "rootClassName", "size", "tip", "wrapperClassName", "style", "children", "fullscreen"]), {
    getPrefixCls: L
  } = s.useContext(M.ConfigContext), d = L("spin", r), [O, E, q] = (0, se.default)(d), [S, C] = s.useState(() => o && !pe(o, n));
  s.useEffect(() => {
    if (o) {
      const p = (0, re.debounce)(n, () => {
        C(!0);
      });
      return p(), () => {
        var w;
        (w = p == null ? void 0 : p.cancel) === null || w === void 0 || w.call(p);
      };
    }
    C(!1);
  }, [n, o]);
  const N = s.useMemo(() => typeof $ < "u" && !g, [$, g]);
  if (process.env.NODE_ENV !== "production") {
    const p = (0, le.devUseWarning)("Spin");
    process.env.NODE_ENV !== "production" && p(!e || N, "usage", "`tip` only work in nest pattern.");
  }
  const {
    direction: G,
    spin: f
  } = s.useContext(M.ConfigContext), W = (0, v.default)(d, f == null ? void 0 : f.className, {
    [`${d}-sm`]: u === "small",
    [`${d}-lg`]: u === "large",
    [`${d}-spinning`]: S,
    [`${d}-show-text`]: !!e,
    [`${d}-fullscreen`]: g,
    [`${d}-fullscreen-show`]: g && S,
    [`${d}-rtl`]: G === "rtl"
  }, l, c, E, q), V = (0, v.default)(`${d}-container`, {
    [`${d}-blur`]: S
  }), D = (0, oe.default)(X, ["indicator"]), H = Object.assign(Object.assign({}, f == null ? void 0 : f.style), a), j = /* @__PURE__ */ s.createElement("div", Object.assign({}, D, {
    style: H,
    className: W,
    "aria-live": "polite",
    "aria-busy": S
  }), ue(d, t), e && (N || g) ? /* @__PURE__ */ s.createElement("div", {
    className: `${d}-text`
  }, e) : null);
  return O(N ? /* @__PURE__ */ s.createElement("div", Object.assign({}, D, {
    className: (0, v.default)(`${d}-nested-loading`, i, E, q)
  }), S && /* @__PURE__ */ s.createElement("div", {
    key: "loading"
  }, j), /* @__PURE__ */ s.createElement("div", {
    className: V,
    key: "container"
  }, $)) : j);
};
x.setDefaultIndicator = (t) => {
  h = t;
};
process.env.NODE_ENV !== "production" && (x.displayName = "Spin");
ae = z.default = x;
export {
  ae as d,
  te as r,
  z as s
};
