import { defineComponent as s, computed as t, toDisplayString as i, unref as d } from "vue";
import { getTimeFormatToZone as m } from "@aplus-frontend/utils";
import n from "dayjs";
import { isNil as c } from "lodash-unified";
import { useDateTimezone as f } from "../hooks/use-date-timezone.mjs";
import { ApFieldDatePresetFormats as y, PRESET_FORMAT_MAP as B } from "./constant.mjs";
const S = /* @__PURE__ */ s({
  name: "ApFieldDateRead",
  __name: "read",
  props: {
    mode: {},
    class: {},
    style: {},
    emptyText: { default: "--" },
    customReadMode: {},
    dropdownClassName: {},
    dropdownAlign: {},
    popupStyle: {},
    transitionName: {},
    placeholder: {},
    allowClear: { type: Boolean },
    autofocus: { type: Boolean },
    disabled: { type: Boolean },
    tabindex: {},
    open: { type: Boolean },
    defaultOpen: { type: Boolean },
    inputReadOnly: { type: Boolean },
    id: {},
    presets: {},
    suffixIcon: { type: [Object, String, Number, Boolean, null, Array] },
    clearIcon: { type: [Object, String, Number, Boolean, null, Array] },
    getPopupContainer: {},
    panelRender: {},
    inputRender: {},
    onOpenChange: {},
    onPanelChange: {},
    onFocus: {},
    onBlur: {},
    onMousedown: {},
    onMouseup: {},
    onMouseenter: {},
    onMouseleave: {},
    onClick: {},
    onContextmenu: {},
    onKeydown: {},
    role: {},
    name: {},
    autocomplete: {},
    direction: {},
    showToday: { type: Boolean },
    showTime: { type: [Boolean, Object] },
    picker: {},
    prefixCls: {},
    defaultPickerValue: {},
    disabledDate: {},
    showWeek: { type: Boolean },
    dateRender: {},
    monthCellRender: {},
    renderExtraFooter: {},
    onSelect: {},
    locale: {},
    size: {},
    bordered: { type: Boolean },
    variant: {},
    showNow: { type: Boolean },
    disabledTime: {},
    defaultOpenValue: {},
    showHour: { type: Boolean },
    showMinute: { type: Boolean },
    showSecond: { type: Boolean },
    use12Hours: { type: Boolean },
    hourStep: {},
    minuteStep: {},
    secondStep: {},
    hideDisabledOptions: { type: Boolean },
    disabledHours: {},
    disabledMinutes: {},
    disabledSeconds: {},
    valueFormat: {},
    value: {},
    defaultValue: {},
    "onUpdate:value": {},
    onChange: {},
    onOk: {},
    format: { default: "Y-D" },
    shownFormat: {},
    formatBegins: { type: Boolean },
    timezone: {}
  },
  setup(a) {
    const e = a, { currentTimezone: r } = f(e), p = t(
      () => y.indexOf(e.format) > -1
    ), u = t(
      () => p.value ? B[e.format] : e.format
    ), l = t(() => {
      if (c(e.value))
        return;
      let o = n(e.value);
      return e.timezone && (o = n(m(e.value, r.value))), o;
    });
    return (o, h) => i(l.value ? d(n)(l.value).format(u.value) : a.emptyText);
  }
});
export {
  S as default
};
