import React from "react";
import { _ChartTooltip as ChartTooltip } from "@dynatrace/strato-components-preview/charts";
import { getDefaultActions } from "./utils/get-default-actions.js";
import { handleCopyToClipboard } from "./utils/handle-copy-to-clipboard.js";
import { isConnection, isRegion } from "../../functions/tooltip-type-guards.js";
const DefaultTooltip = (props) => {
  const { closestPoint, layerData } = props;
  let locations;
  if (isRegion(closestPoint)) {
    return /* @__PURE__ */ React.createElement(ChartTooltip.Body, { "data-testid": "default-tooltip-template" }, /* @__PURE__ */ React.createElement(
      ChartTooltip.SeriesItem,
      {
        color: closestPoint.color,
        name: closestPoint.name,
        value: closestPoint.data.value && closestPoint.data.value.toString() ? closestPoint.data.value.toString() : void 0
      }
    ));
  }
  if (isConnection(closestPoint)) {
    locations = closestPoint.data.path;
  } else {
    locations = layerData === void 0 || layerData === null || layerData.length === 0 ? [closestPoint.data] : layerData.map(
      (point) => point.data
    );
  }
  return /* @__PURE__ */ React.createElement(
    ChartTooltip.Body,
    {
      "data-testid": "default-tooltip-template",
      virtualization: false
    },
    locations.map((location) => /* @__PURE__ */ React.createElement(
      ChartTooltip.GeoItem,
      {
        key: `${location.latitude}-${location.longitude}`,
        latitude: location.latitude,
        longitude: location.longitude,
        actions: () => getDefaultActions(() => handleCopyToClipboard(location))
      }
    ))
  );
};
DefaultTooltip["displayName"] = "DefaultTooltip";
export {
  DefaultTooltip
};
//# sourceMappingURL=DefaultTooltip.js.map
