import { getOrCreateIcon as l, isDomMakerNeeded as c } from "../components/features/basics/Marker.js";
const m = (a) => {
  let e = null, t = null, o = null, r = null;
  return a.forEachDataPoint((s) => {
    const n = s.getPosition();
    (e === null || e > n.lat) && (e = n.lat), (t === null || t > n.lng) && (t = n.lng), (o === null || o < n.lat) && (o = n.lat), (r === null || r < n.lng) && (r = n.lng);
  }), new H.geo.Rect(
    o,
    t,
    e,
    r
  );
}, f = {
  getBoundingBoxForCluster: m
}, u = (a, e) => (t) => {
  const o = [];
  t.forEachDataPoint((g) => o.push(g.getData()));
  const r = a(o, t.getPosition());
  if (r instanceof H.map.Object)
    return r;
  const s = l(r, { cacheEnabled: e }), n = c(s) ? H.map.DomMarker : H.map.Marker, i = new n(t.getPosition(), {
    icon: s,
    // Set min/max zoom with values from the cluster, otherwise
    // clusters will be shown at all zoom levels
    min: t.getMinZoom(),
    max: t.getMaxZoom()
  });
  return i.setData(t), i;
}, p = (a, e) => (t) => {
  const o = a(t.getData(), t.getPosition());
  if (o instanceof H.map.Object)
    return o;
  const r = l(o, { cacheEnabled: e }), s = c(r) ? H.map.DomMarker : H.map.Marker, n = new s(t.getPosition(), {
    icon: r,
    // Use min zoom from a noise point to show it correctly at certain zoom levels
    min: t.getMinZoom()
  });
  return n.setData(t), n;
}, k = (a, e) => ({
  getClusterPresentation: u(a.getClusterPresentation, e),
  getNoisePresentation: p(a.getNoisePresentation, e)
});
export {
  f as ClusterUtils,
  k as wrapSimpleTheme
};
//# sourceMappingURL=clustering.js.map
