import { independentSelectStrategy } from "./independentSelectStrategy";
const leafSelectStrategy = (single = false) => {
  const strategy = {
    select: ({ id, value, selected, children }) => {
      if (children.has(id))
        return selected;
      if (single)
        return /* @__PURE__ */ new Map([[id, value ? "on" : "off"]]);
      selected.set(id, value ? "on" : "off");
      return selected;
    },
    in: (v, children, parents) => {
      let map = /* @__PURE__ */ new Map();
      for (const id of v ?? []) {
        map = strategy.select({
          id,
          value: true,
          selected: new Map(map),
          children,
          parents
        });
      }
      return map;
    },
    out: independentSelectStrategy.out
  };
  return strategy;
};
export {
  leafSelectStrategy
};
//# sourceMappingURL=leafSelectStrategy.mjs.map
