import { eE as b, fW as c, fX as m, O as l, bI as h, Y as r, F as d, a6 as x, a7 as C, G as D, ac as i, bL as v, ff as n } from "./603b75d9.js";
import { useEffect as w } from "react";
import { formDataChildren as V, FormDataPropertyView as g } from "./f9847c56.js";
import { SelectInputValidationChildren as y, SelectInputInvalidConfig as k } from "./00d44232.js";
import { defaultTreeData as S, treeDataTooltip as E } from "./7030eb81.js";
import "react-dom";
function u(e, t) {
  return n(e, ["string", "number"], t);
}
function f(e, t) {
  return n(e, ["array", "undefined"], t, (a, o) => (n(a, ["object"], o), n(a.label, ["string"], "label"), u(a.value, "value"), n(a.disabled, ["boolean", "undefined"], "disabled"), n(a.selectable, ["boolean", "undefined"], "selectable"), n(a.checkable, ["boolean", "undefined"], "checkable"), n(a.disableCheckbox, ["boolean", "undefined"], "disableCheckbox"), n(a.isLeaf, ["boolean", "undefined"], "isLeaf"), f(a.children, "children"), a));
}
function j(e) {
  return e === "" ? [] : f(e) ?? [];
}
function s(e) {
  return e === "" ? [] : n(e, ["array"], void 0, u);
}
function p(e, t) {
  if (e) {
    for (const a of e)
      if (t(a) === !1 || !p(a.children, t))
        return !1;
  }
  return !0;
}
function N(e) {
  const t = [];
  return p(e, (a) => {
    a.children && a.children.length > 0 && t.push(a.value);
  }), t;
}
const B = {
  // TODO: support loading mode
  treeData: b(j, S),
  defaultValue: c("value", s, []),
  value: c("value", s, []),
  expanded: m(s, []),
  defaultExpandAll: l,
  showLine: l,
  showLeafIcon: l,
  disabled: h,
  ...y,
  ...V
};
function G(e) {
  const {
    treeData: t,
    expanded: a,
    defaultExpandAll: o
  } = e;
  w(() => {
    o ? a.onChange(N(t)) : a.reset();
  }, [o, t]);
}
const O = (e) => e.treeData.propertyView({
  label: r("tree.treeData"),
  tooltip: E
}), W = (e) => e.defaultValue.propertyView({
  label: r("tree.value")
}), X = (e) => /* @__PURE__ */ d(g, {
  ...e
}), Y = (e, t) => /* @__PURE__ */ x(C, {
  name: r("prop.expand"),
  children: [e.expanded.propertyView({
    label: r("tree.expanded")
  }), e.defaultExpandAll.propertyView({
    label: r("tree.defaultExpandAll")
  }), t]
}), q = (e, t) => /* @__PURE__ */ d(D, {}), z = [
  // TODO: more data
  new i("value", r("tree.valueDesc")),
  new i("treeData", r("tree.treeDataDesc")),
  new i("expanded", r("tree.expandedDesc")),
  k,
  ...v
];
export {
  z as TreeNameConfigs,
  q as advancedSection,
  Y as expandSection,
  X as formSection,
  B as treeCommonChildren,
  O as treeDataPropertyView,
  G as useTree,
  W as valuePropertyView
};
