import * as e from "react";
import { forwardRef as te, useContext as y, useImperativeHandle as oe } from "react";
import re from "../../../../@ant-design/icons/es/icons/CalendarOutlined.mjs";
import ae from "../../../../@ant-design/icons/es/icons/ClockCircleOutlined.mjs";
import ne from "../../../../@ant-design/icons/es/icons/CloseCircleFilled.mjs";
import se from "../../../../@ant-design/icons/es/icons/SwapRightOutlined.mjs";
import j from "../../../../classnames/index.mjs";
import "../../../../rc-util/es/hooks/useLayoutEffect.mjs";
import "../../../../rc-util/es/warning.mjs";
import "../../../../rc-util/es/raf.mjs";
import "../../../../rc-picker/es/panels/DatetimePanel/index.mjs";
import "../../../../@rc-component/trigger/es/index.mjs";
import le from "../../../../rc-picker/es/RangePicker.mjs";
import { getStatusClassNames as ie, getMergedStatus as ce } from "../../_util/statusUtils.mjs";
import { devUseWarning as me } from "../../_util/warning.mjs";
import "../../config-provider/index.mjs";
import pe from "../../config-provider/DisabledContext.mjs";
import ue from "../../config-provider/hooks/useSize.mjs";
import { FormItemInputContext as de } from "../../form/context.mjs";
import { useCompactItemContext as fe } from "../../space/Compact.mjs";
import ge from "../locale/en_US.mjs";
import Ce from "../style/index.mjs";
import { getTimeProps as E, transPlacement2DropdownAlign as be, getRangePlaceholder as ve, mergeAllowClear as xe } from "../util.mjs";
import Ne from "./Components.mjs";
import { useZIndex as Oe } from "../../_util/hooks/useZIndex.mjs";
import Pe from "../../config-provider/hooks/useCSSVarCls.mjs";
import { ConfigContext as Se } from "../../config-provider/context.mjs";
import we from "../../locale/useLocale.mjs";
var Ie = globalThis && globalThis.__rest || function(s, i) {
  var r = {};
  for (var t in s)
    Object.prototype.hasOwnProperty.call(s, t) && i.indexOf(t) < 0 && (r[t] = s[t]);
  if (s != null && typeof Object.getOwnPropertySymbols == "function")
    for (var a = 0, t = Object.getOwnPropertySymbols(s); a < t.length; a++)
      i.indexOf(t[a]) < 0 && Object.prototype.propertyIsEnumerable.call(s, t[a]) && (r[t[a]] = s[t[a]]);
  return r;
};
function Ye(s) {
  const i = /* @__PURE__ */ te((r, t) => {
    var a;
    const {
      prefixCls: h,
      getPopupContainer: k,
      className: R,
      style: z,
      placement: _,
      size: m,
      disabled: p,
      bordered: $ = !0,
      placeholder: D,
      popupClassName: V,
      dropdownClassName: C,
      status: F,
      clearIcon: T,
      allowClear: A,
      rootClassName: b
    } = r, L = Ie(r, ["prefixCls", "getPopupContainer", "className", "style", "placement", "size", "disabled", "bordered", "placeholder", "popupClassName", "dropdownClassName", "status", "clearIcon", "allowClear", "rootClassName"]), u = e.useRef(null), {
      getPrefixCls: v,
      direction: d,
      getPopupContainer: U,
      rangePicker: l
    } = y(Se), o = v("picker", h), {
      compactSize: G,
      compactItemClassnames: H
    } = fe(o, d), {
      format: x,
      showTime: N,
      picker: c
    } = r, M = v(), f = Pe(o), [W, O, P] = Ce(o, f), Z = Object.assign(Object.assign({}, N ? E(Object.assign({
      format: x,
      picker: c
    }, N)) : {}), c === "time" ? E(Object.assign(Object.assign({
      format: x
    }, r), {
      picker: c
    })) : {});
    process.env.NODE_ENV !== "production" && me("DatePicker.RangePicker").deprecated(!C, "dropdownClassName", "popupClassName");
    const S = ue((n) => {
      var g;
      return (g = m ?? G) !== null && g !== void 0 ? g : n;
    }), q = e.useContext(pe), B = p ?? q, J = y(de), {
      hasFeedback: w,
      status: K,
      feedbackIcon: Q
    } = J, X = /* @__PURE__ */ e.createElement(e.Fragment, null, c === "time" ? /* @__PURE__ */ e.createElement(ae, null) : /* @__PURE__ */ e.createElement(re, null), w && Q);
    oe(t, () => ({
      focus: () => {
        var n;
        return (n = u.current) === null || n === void 0 ? void 0 : n.focus();
      },
      blur: () => {
        var n;
        return (n = u.current) === null || n === void 0 ? void 0 : n.blur();
      }
    }));
    const [Y] = we("Calendar", ge), I = Object.assign(Object.assign({}, Y), r.locale), [ee] = Oe("DatePicker", (a = r.popupStyle) === null || a === void 0 ? void 0 : a.zIndex);
    return W(/* @__PURE__ */ e.createElement(le, Object.assign({
      separator: /* @__PURE__ */ e.createElement("span", {
        "aria-label": "to",
        className: `${o}-separator`
      }, /* @__PURE__ */ e.createElement(se, null)),
      disabled: B,
      ref: u,
      dropdownAlign: be(d, _),
      placeholder: ve(I, c, D),
      suffixIcon: X,
      prevIcon: /* @__PURE__ */ e.createElement("span", {
        className: `${o}-prev-icon`
      }),
      nextIcon: /* @__PURE__ */ e.createElement("span", {
        className: `${o}-next-icon`
      }),
      superPrevIcon: /* @__PURE__ */ e.createElement("span", {
        className: `${o}-super-prev-icon`
      }),
      superNextIcon: /* @__PURE__ */ e.createElement("span", {
        className: `${o}-super-next-icon`
      }),
      transitionName: `${M}-slide-up`
    }, L, Z, {
      className: j({
        [`${o}-${S}`]: S,
        [`${o}-borderless`]: !$
      }, ie(o, ce(K, F), w), O, H, R, l == null ? void 0 : l.className, P, f, b),
      style: Object.assign(Object.assign({}, l == null ? void 0 : l.style), z),
      locale: I.lang,
      prefixCls: o,
      getPopupContainer: k || U,
      generateConfig: s,
      components: Ne,
      direction: d,
      dropdownClassName: j(O, V || C, P, f, b),
      popupStyle: Object.assign(Object.assign({}, r.popupStyle), {
        zIndex: ee
      }),
      allowClear: xe(A, T, /* @__PURE__ */ e.createElement(ne, null))
    })));
  });
  return process.env.NODE_ENV !== "production" && (i.displayName = "RangePicker"), i;
}
export {
  Ye as default
};
