/* Copyright © 2020 Splunk Inc.
SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
in part without a valid written license from Splunk Inc. is PROHIBITED. */
import {
  markPrefix
} from "./chunk-6N4JNZ5S.js";
import {
  react_default,
  react_exports
} from "./chunk-V3S5WUKN.js";
import {
  __spreadValues
} from "./chunk-XC4WXK3L.js";

// src/Marks.tsx
var defocusedMarkOpacity = 0.3;
var MarksContainer = ({ plotUtilities, marks, selectedMark }) => {
  if (!plotUtilities || !marks) {
    return null;
  }
  return /* @__PURE__ */ react_default.createElement(react_default.Fragment, null, marks.map((mark) => {
    const markScale = mark.scale || "y";
    const isMarkScaleY = markScale !== "x";
    const markPosByScale = plotUtilities.valToPos(mark.value, markScale);
    const boundary = plotUtilities.dimensions.over[isMarkScaleY ? "height" : "width"];
    if (markPosByScale > boundary) {
      return null;
    }
    let opacity = 1;
    if (selectedMark) {
      if (`${markPrefix}${mark.legendLabel}` === selectedMark) {
        opacity = 1;
      } else {
        opacity = defocusedMarkOpacity;
      }
    }
    const markStyleObj = __spreadValues({
      position: "absolute"
    }, isMarkScaleY ? {
      top: markPosByScale,
      width: "100%",
      borderTopWidth: mark.width || 1,
      borderTopColor: mark.color || "#666",
      borderTopStyle: mark.style || "solid",
      opacity
    } : {
      left: markPosByScale,
      height: "100%",
      borderLeftWidth: mark.width || 1,
      borderLeftColor: mark.color || "#666",
      borderLeftStyle: mark.style || "solid",
      opacity
    });
    return /* @__PURE__ */ react_default.createElement("div", { key: mark.value, "data-test": `viz-mark-value-${mark.value}` }, /* @__PURE__ */ react_default.createElement("div", { style: markStyleObj }));
  }));
};

export {
  MarksContainer
};
//# sourceMappingURL=chunk-VCBGETN3.js.map
