import { jsx as p } from "react/jsx-runtime";
import { useContext as f, useState as a, useEffect as m } from "react";
import { MapContext as n } from "../../MapContext.js";
const V = (u) => {
  const {
    minZoom: c = Number.NEGATIVE_INFINITY,
    maxZoom: d = Number.POSITIVE_INFINITY,
    isVisible: i = !0,
    children: l
  } = u, o = f(n), t = o.api, [r, I] = a(), [s, b] = a();
  return m(() => {
    const e = new H.map.Group({
      min: c,
      max: d
    });
    return e.setVisibility(i), t.map?.addObject(e), I(e), b({
      ...o,
      api: {
        ...t,
        group: e
      }
    }), () => {
      t.map?.getObjects().includes(e) && t.map?.removeObject(e), e.dispose();
    };
  }, [t.map]), m(() => {
    r && r.setVisibility(i);
  }, [i]), /* @__PURE__ */ p("div", { className: "MapLayerGroup", children: s && /* @__PURE__ */ p(n.Provider, { value: s, children: l }) });
};
export {
  V as default
};
//# sourceMappingURL=MapLayerGroup.js.map
