"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// packages/block-editor/src/components/color-style-selector/index.js
var color_style_selector_exports = {};
__export(color_style_selector_exports, {
  default: () => color_style_selector_default
});
module.exports = __toCommonJS(color_style_selector_exports);
var import_components = require("@wordpress/components");
var import_i18n = require("@wordpress/i18n");
var import_keycodes = require("@wordpress/keycodes");
var import_deprecated = __toESM(require("@wordpress/deprecated"));
var import_jsx_runtime = require("react/jsx-runtime");
var ColorSelectorSVGIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Path, { d: "M7.434 5l3.18 9.16H8.538l-.692-2.184H4.628l-.705 2.184H2L5.18 5h2.254zm-1.13 1.904h-.115l-1.148 3.593H7.44L6.304 6.904zM14.348 7.006c1.853 0 2.9.876 2.9 2.374v4.78h-1.79v-.914h-.114c-.362.64-1.123 1.022-2.031 1.022-1.346 0-2.292-.826-2.292-2.108 0-1.27.972-2.006 2.71-2.107l1.696-.102V9.38c0-.584-.42-.914-1.18-.914-.667 0-1.112.228-1.264.647h-1.701c.12-1.295 1.307-2.107 3.066-2.107zm1.079 4.1l-1.416.09c-.793.056-1.18.342-1.18.844 0 .52.45.837 1.091.837.857 0 1.505-.545 1.505-1.256v-.515z" }) });
var ColorSelectorIcon = ({ style, className }) => {
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "block-library-colors-selector__icon-container", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
    "div",
    {
      className: `${className} block-library-colors-selector__state-selection`,
      style,
      children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ColorSelectorSVGIcon, {})
    }
  ) });
};
var renderToggleComponent = ({ TextColor, BackgroundColor }) => ({ onToggle, isOpen }) => {
  const openOnArrowDown = (event) => {
    if (!isOpen && event.keyCode === import_keycodes.DOWN) {
      event.preventDefault();
      onToggle();
    }
  };
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
    import_components.ToolbarButton,
    {
      className: "components-toolbar__control block-library-colors-selector__toggle",
      label: (0, import_i18n.__)("Open Colors Selector"),
      onClick: onToggle,
      onKeyDown: openOnArrowDown,
      icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BackgroundColor, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextColor, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ColorSelectorIcon, {}) }) })
    }
  ) });
};
var BlockColorsStyleSelector = ({ children, ...other }) => {
  (0, import_deprecated.default)(`wp.blockEditor.BlockColorsStyleSelector`, {
    alternative: "block supports API",
    since: "6.1",
    version: "6.3"
  });
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
    import_components.Dropdown,
    {
      popoverProps: { placement: "bottom-start" },
      className: "block-library-colors-selector",
      contentClassName: "block-library-colors-selector__popover",
      renderToggle: renderToggleComponent(other),
      renderContent: () => children
    }
  );
};
var color_style_selector_default = BlockColorsStyleSelector;
//# sourceMappingURL=index.js.map
