import { defineComponent as v, computed as r, openBlock as l, createElementBlock as i, Fragment as m, createTextVNode as u, toDisplayString as p, createBlock as b, resolveDynamicComponent as h } from "vue";
import { getTimeFormatToZone as c } from "@aplus-frontend/utils";
import y from "dayjs";
import { isNil as g } from "lodash-unified";
import { ApFieldDatePresetFormats as w, PRESET_FORMAT_MAP as C } from "../date/constant.mjs";
import { useDateTimezone as O } from "../hooks/use-date-timezone.mjs";
const D = /* @__PURE__ */ v({
  name: "ApFieldDateRangeRead",
  __name: "read",
  props: {
    mode: {},
    class: {},
    style: {},
    emptyText: { default: "--" },
    customReadMode: {},
    id: {},
    defaultPickerValue: {},
    placeholder: {},
    disabled: { type: [Boolean, Array] },
    disabledTime: {},
    ranges: {},
    separator: { type: [Object, String, Number, Boolean, null, Array] },
    allowEmpty: {},
    onCalendarChange: {},
    onFocus: {},
    onBlur: {},
    onMousedown: {},
    onMouseup: {},
    onMouseenter: {},
    onMouseleave: {},
    onClick: {},
    direction: {},
    autocomplete: {},
    activePickerIndex: {},
    dateRender: {},
    panelRender: {},
    dropdownClassName: {},
    dropdownAlign: {},
    popupStyle: {},
    transitionName: {},
    allowClear: { type: Boolean },
    autofocus: { type: Boolean },
    tabindex: {},
    open: { type: Boolean },
    defaultOpen: { type: Boolean },
    inputReadOnly: { type: Boolean },
    suffixIcon: { type: [Object, String, Number, Boolean, null, Array] },
    clearIcon: { type: [Object, String, Number, Boolean, null, Array] },
    getPopupContainer: {},
    inputRender: {},
    onOpenChange: {},
    onContextmenu: {},
    onKeydown: {},
    role: {},
    name: {},
    picker: {},
    prefixCls: {},
    disabledDate: {},
    showWeek: { type: Boolean },
    monthCellRender: {},
    locale: {},
    size: {},
    bordered: { type: Boolean },
    variant: {},
    showTime: { type: [Boolean, Object] },
    showNow: { type: Boolean },
    order: { type: Boolean },
    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: {},
    timezone: {},
    readModeSeparator: {},
    presets: { type: [Array, Boolean, Object] }
  },
  setup(a) {
    const e = a, { currentTimezone: t } = O(e), n = r(() => {
      const o = e.value;
      if (g(o) || !o?.length)
        return o;
      const s = t.value ? c(
        e.value[0],
        t.value
      ) : e.value?.[0], B = e.timezone ? c(
        e.value[1],
        t.value
      ) : e.value?.[1];
      return [y(s), y(B)];
    }), f = r(
      () => w.indexOf(e.format) > -1
    ), d = r(
      () => f.value ? C[e.format] : e.format
    );
    return (o, s) => n.value ? (l(), i(m, { key: 0 }, [
      u(p(n.value[0]?.format(d.value)) + " ", 1),
      (l(), b(h(a.readModeSeparator))),
      u(" " + p(n.value[1]?.format(d.value)), 1)
    ], 64)) : (l(), i(m, { key: 1 }, [
      u(p(a.emptyText), 1)
    ], 64));
  }
});
export {
  D as default
};
