import { reactive as p } from "vue";
function D(t) {
  return p(t);
}
function P(t) {
  return p(t);
}
const $ = (t) => JSON.parse(JSON.stringify(t));
function w(t) {
  function g(n, s, r, i) {
    let e = "", c = 0;
    for (let o = n.length - 1; o >= 0; o -= 4) {
      const a = n.slice(Math.max(0, o - 3), o + 1);
      let f = I(a, s, r);
      f && (f += i[c]), e = f + e, c++;
    }
    return e = e || "零", e += "元", e;
  }
  function h(n, s) {
    let r = "";
    const [i, e] = n.split("");
    return i !== "0" && (r += `${s[parseInt(i)]}角`), e !== "0" && (r += `${s[parseInt(e)]}分`), r || (r = "整"), r;
  }
  function I(n, s, r) {
    let i = "", e = !1;
    for (let c = 0; c < n.length; c++) {
      const o = parseInt(n[c]), a = r[n.length - 1 - c];
      o === 0 ? e = !0 : (e && (i += "零"), i += s[o] + a, e = !1);
    }
    return i;
  }
  function m(n) {
    return n.replace(/零+/g, "零").replace(/零([万亿])/g, "$1").replace(/零元/, "元").replace(/^元/, "零元");
  }
  if (typeof t != "number" || isNaN(t) || t < 0 || t >= 1e9)
    throw new Error("输入必须是介于0到999,999,999之间的数字");
  const u = ["零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"], v = ["", "拾", "佰", "仟"], d = ["", "万", "亿"], [x, b] = t.toFixed(2).split("."), N = g(x, u, v, d), S = h(b, u);
  let l = N + S;
  return l = m(l), l;
}
export {
  $ as clone,
  P as editReactive,
  w as numberToChineseCurrency,
  D as tableReactive
};
