import { i as c } from "./utils-BjwmJovq.js"; import { ref as s, isRef as l, isReactive as h, watch as p } from "vue"; import { a as i, c as f } from "./vendor-BuMp2M9h.js"; const n = (e) => { i(e) || console.error("Uncaught TypeError: ", `options expected Array but got ${Object.prototype.toString.call(e).slice(8, -1)}`); }, a = (e) => e.map((r) => { const o = { ...r, text: r.label || r.text // 确保当前节点有text属性 }; return r.children && r.children.length > 0 && (o.children = a(r.children)), o; }), w = (e) => { const r = s([]), o = s(!1); if (!e) r.value = [], o.value = !0; else if (l(e) || h(e) || i(e)) p(e, (t) => { const u = l(t) ? t.value : t; r.value = a(u), o.value = !0; }, { immediate: !0, deep: !0 }); else if (f(e)) { const t = e(); c(t) ? t.then((u) => { r.value = a(u), o.value = !0, n(r.value); }).catch((u) => { throw u; }) : (r.value = a(t), o.value = !0); } else c(e) ? e.then((t) => { r.value = a(t), o.value = !0, n(r.value); }).catch((t) => { throw t; }) : (o.value = !0, n(e)); return { options: r, isReady: o }; }; export { w as u };