import { jsx } from "react/jsx-runtime";
import "react";
import { isArr } from "@tachybase/schema";
import { getDefaultFormat, str2moment } from "@tego/client";
import classnames from "classnames";
import dayjs from "dayjs";
import { usePrefixCls } from "../__builtins__/index.mjs";
import { normalizeDatePickerParseOptions } from "./util.mjs";
const ReadPretty = ()=>null;
ReadPretty.DatePicker = function(props) {
    const prefixCls = usePrefixCls("description-date-picker", props);
    if (!props.value) return /*#__PURE__*/ jsx("div", {});
    const getLabels = ()=>{
        const format = getDefaultFormat(props);
        const m = str2moment(props.value, normalizeDatePickerParseOptions(props));
        const labels = dayjs.isDayjs(m) ? m.format(format) : '';
        return isArr(labels) ? labels.join('~') : labels;
    };
    return /*#__PURE__*/ jsx("div", {
        className: classnames(prefixCls, props.className),
        children: getLabels()
    });
};
ReadPretty.DateRangePicker = function(props) {
    const prefixCls = usePrefixCls("description-text", props);
    const format = getDefaultFormat(props);
    const getLabels = ()=>{
        const m = str2moment(props.value, normalizeDatePickerParseOptions(props));
        if (!m) return '';
        const labels = m.map((m)=>m.format(format));
        return isArr(labels) ? labels.join('~') : labels;
    };
    return /*#__PURE__*/ jsx("div", {
        className: classnames(prefixCls, props.className),
        style: props.style,
        children: getLabels()
    });
};
export { ReadPretty };
