import { d as $bdb11010cef70236$export$f680877a34711e37, a as $64fa3d84918910a7$export$29f1550f4b0d4415, h as $64fa3d84918910a7$export$4d86445c2cf5e3, b as $3ef42575df84b30b$export$9d1611c77c2fe928 } from "./utils-cvK1vxO7.js";
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "./filterDOMProps-D2C6R0DK.js";
import React__default, { useMemo, forwardRef, createContext } from "react";
import { $ as $799cddbef784668f$export$6e865ea70d7724f, a as $3493a52097159720$exports } from "./Color-WxFE7lQB.js";
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "./context-DMOmz986.js";
import { $ as $fca6afa0e843324b$export$f12b703ca79dfbb1 } from "./useLocalizedStringFormatter-eaZiN2tE.js";
function $parcel$interopDefault(a) {
  return a && a.__esModule ? a.default : a;
}
function $2993fcad7650b98d$export$9060ae606178d849(props) {
  let { color: value, colorName } = props;
  let nonNullValue = value || "#fff0";
  let color = useMemo(() => typeof nonNullValue === "string" ? $799cddbef784668f$export$6e865ea70d7724f(nonNullValue) : nonNullValue, [
    nonNullValue
  ]);
  let { locale } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
  let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
    labelable: true
  });
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1($parcel$interopDefault($3493a52097159720$exports), "@react-aria/color");
  let id = $bdb11010cef70236$export$f680877a34711e37(props.id);
  if (!colorName) colorName = color.getChannelValue("alpha") === 0 ? stringFormatter.format("transparent") : color.getColorName(locale);
  return {
    colorSwatchProps: {
      ...DOMProps,
      role: "img",
      "aria-roledescription": stringFormatter.format("colorSwatch"),
      "aria-label": [
        colorName,
        props["aria-label"] || ""
      ].filter(Boolean).join(", "),
      "aria-labelledby": props["aria-labelledby"] ? `${id} ${props["aria-labelledby"]}` : void 0,
      id,
      style: {
        backgroundColor: color.toString("css"),
        // @ts-ignore
        forcedColorAdjust: "none"
      }
    },
    color: color || null
  };
}
const $251c695a52d94a8d$export$83cc445538396800 = /* @__PURE__ */ createContext(null);
const $251c695a52d94a8d$export$cae13e90592f246a = /* @__PURE__ */ forwardRef(function ColorSwatch(props, ref) {
  [props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $251c695a52d94a8d$export$83cc445538396800);
  let { colorSwatchProps, color } = $2993fcad7650b98d$export$9060ae606178d849(props);
  let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
    ...props,
    defaultClassName: "react-aria-ColorSwatch",
    defaultStyle: colorSwatchProps.style,
    values: {
      color
    }
  });
  let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
    global: true
  });
  return /* @__PURE__ */ React__default.createElement("div", {
    ...$3ef42575df84b30b$export$9d1611c77c2fe928(DOMProps, colorSwatchProps, renderProps),
    slot: props.slot || void 0,
    ref
  });
});
export {
  $251c695a52d94a8d$export$cae13e90592f246a as $
};
