import { createVNode as f } from "vue";
import { TypographyParagraph as d } from "@aplus-frontend/antdv";
import { getTimeFormatToZone as g, toThousand as h } from "@aplus-frontend/utils";
import { isBoolean as Y, merge as p, get as c, debounce as A } from "lodash-unified";
import { toDecimalMark as b } from "../../../utils/format.mjs";
import { formatString as M } from "./utils.mjs";
function S({
  value: t
}, n) {
  if (!n?.ellipsis)
    return t;
  const o = {
    ...n,
    content: t,
    ellipsis: n.ellipsis ? Y(n.ellipsis) ? {
      tooltip: t,
      rows: 1
    } : {
      ...n.ellipsis,
      tooltip: t
    } : !1
  };
  return f(d, o, null);
}
function D({
  value: t
}, n) {
  const {
    joinSymbol: o
  } = p({
    joinSymbol: " "
  }, n);
  return t?.join?.(o);
}
function u({
  value: t
}, n) {
  const {
    zoneAlias: o,
    format: i
  } = p({
    zoneAlias: "LA",
    format: "YYYY-MM-DD HH:mm:ss"
  }, n);
  return g(t, o, i);
}
function y({
  value: t,
  record: n
}, o) {
  const {
    fieldList: i,
    templateString: r = "{0}",
    formatter: e
  } = o, s = i?.map((a, l) => {
    const m = c(n, a);
    return e ? e(m, l) : m;
  }) || [];
  return s.length === 0 && s.push(t), M(r, s);
}
function L({
  value: t,
  record: n
}, o) {
  const {
    fieldList: i,
    format: r = "YYYY-MM-DD HH:mm:ss",
    joinSymbol: e = "~",
    zoneAlias: s = "LA"
  } = o, a = Array.isArray(r) ? r : [r, r];
  return y({
    value: t,
    record: n
  }, {
    fieldList: i,
    templateString: `{0} ${e} {1}`,
    formatter(l, m) {
      return u({
        value: l,
        record: n
      }, {
        format: a[m],
        zoneAlias: s
      });
    }
  });
}
function j({
  record: t
}, n) {
  const {
    urlPath: o = "url",
    namePath: i = "name",
    style: r,
    downloadFile: e,
    className: s
  } = n, a = c(t, i), l = c(t, o), m = A(() => {
    e?.(l, a);
  }, 500);
  return f("span", {
    style: r,
    class: [s, "ap-descriptions-item-content__link "],
    onClick: m
  }, [a]);
}
function k({
  value: t
}, n) {
  const {
    style: o = {},
    precision: i,
    isFixed: r = !0
  } = n;
  let e = "";
  try {
    r ? e = h(t, i || 0, "fixed") : e = b(t, i);
  } catch {
    e = t;
  }
  return f("span", {
    style: o,
    class: "ap-descriptions-item-content__number"
  }, [e]);
}
const C = {
  text: S,
  array: D,
  date: u,
  dateRange: L,
  template: y,
  number: k,
  attachment: j
};
export {
  D as array,
  j as attachment,
  u as date,
  L as dateRange,
  C as formatterMap,
  k as number,
  y as template,
  S as text
};
