import t from "react";
import { Tree as s } from "../../node_modules/@frontify/fondue/dist/components/Tree/Tree.es.es.js";
import { updateTreeNodes as T } from "../../service/Tree/Tree.es.js";
import { useUploaderStore as a } from "../../state/uploaderStore.es.js";
const g = ({ initialLibrary: e, onNodeSelection: n }) => {
  const { token: d, addToTree: m, tree: c } = a((o) => ({
    token: o.token,
    addToTree: o.addToTree,
    tree: o.tree
  })), p = async (o) => {
    const r = JSON.parse(o[0]);
    n(r), await T(r, m, c, d);
  };
  return e && e.length > 0 ? /* @__PURE__ */ t.createElement(s, {
    onSelect: p,
    activeNodeIds: [!!e[1] && e[1].id],
    nodes: e
  }) : /* @__PURE__ */ t.createElement(t.Fragment, null);
};
export {
  g as TreeNavigation
};
//# sourceMappingURL=TreeNavigation.es.js.map
