import { UPDATE_MODEL_EVENT } from "../../../constants/event.mjs";
import { isUndefined } from "../../../utils/types.mjs";
import { useNamespace } from "../../../hooks/use-namespace/index.mjs";
import { PICKER_BASE_INJECTION_KEY, ROOT_COMMON_PICKER_INJECTION_KEY } from "../../time-picker/src/constants.mjs";
import { useCommonPicker } from "../../time-picker/src/composables/use-common-picker.mjs";
import { datePickerPanelProps } from "./props/date-picker-panel.mjs";
import { ROOT_PICKER_INJECTION_KEY } from "./constants.mjs";
import { getPanel } from "./panel-utils.mjs";
import { defineComponent, inject, provide, reactive, toRefs, createVNode, mergeProps, isVNode } from "vue";
import dayjs from "../../../../../../_virtual/dayjs.min.mjs";
import customParseFormat from "../../../../../../_virtual/customParseFormat.mjs";
import localeData from "../../../../../../_virtual/localeData.mjs";
import advancedFormat from "../../../../../../_virtual/advancedFormat.mjs";
import weekOfYear from "../../../../../../_virtual/weekOfYear.mjs";
import weekYear from "../../../../../../_virtual/weekYear.mjs";
import dayOfYear from "../../../../../../_virtual/dayOfYear.mjs";
import isSameOrAfter from "../../../../../../_virtual/isSameOrAfter.mjs";
import isSameOrBefore from "../../../../../../_virtual/isSameOrBefore.mjs";
import omit from "../../../../../lodash-es/omit.mjs";
function _isSlot(s) {
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
}
dayjs.extend(localeData);
dayjs.extend(advancedFormat);
dayjs.extend(customParseFormat);
dayjs.extend(weekOfYear);
dayjs.extend(weekYear);
dayjs.extend(dayOfYear);
dayjs.extend(isSameOrAfter);
dayjs.extend(isSameOrBefore);
var date_picker_panel_default = /* @__PURE__ */ defineComponent({
  name: "ElDatePickerPanel",
  install: null,
  inheritAttrs: false,
  props: datePickerPanelProps,
  emits: [
    UPDATE_MODEL_EVENT,
    "calendar-change",
    "panel-change",
    "visible-change",
    "clear"
  ],
  setup(props, { slots, emit, attrs }) {
    const ns = useNamespace("picker-panel");
    if (isUndefined(inject(PICKER_BASE_INJECTION_KEY, void 0))) provide(PICKER_BASE_INJECTION_KEY, { props: reactive({ ...toRefs(props) }) });
    provide(ROOT_PICKER_INJECTION_KEY, {
      slots,
      pickerNs: ns
    });
    const { parsedValue, onCalendarChange, onPanelChange, onSetPickerOption, onPick } = inject(ROOT_COMMON_PICKER_INJECTION_KEY, () => useCommonPicker(props, emit), true);
    return () => {
      return createVNode(getPanel(props.type), mergeProps(omit(attrs, "onPick"), props, {
        "parsedValue": parsedValue.value,
        "onSet-picker-option": onSetPickerOption,
        "onCalendar-change": onCalendarChange,
        "onPanel-change": onPanelChange,
        "onClear": () => emit("clear"),
        "onPick": onPick
      }), _isSlot(slots) ? slots : { default: () => [slots] });
    };
  }
});
export {
  date_picker_panel_default as default
};
