"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _i18n = require("@wordpress/i18n");
var _components = require("@wordpress/components");
var _jsxRuntime = require("react/jsx-runtime");
/**
 * WordPress dependencies
 */

const noop = () => {};
const LinkControlSettings = ({
  value,
  onChange = noop,
  settings
}) => {
  if (!settings || !settings.length) {
    return null;
  }
  const handleSettingChange = setting => newValue => {
    onChange({
      ...value,
      [setting.id]: newValue
    });
  };
  const theSettings = settings.map(setting => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CheckboxControl, {
    __nextHasNoMarginBottom: true,
    className: "block-editor-link-control__setting",
    label: setting.title,
    onChange: handleSettingChange(setting),
    checked: value ? !!value[setting.id] : false,
    help: setting?.help
  }, setting.id));
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("fieldset", {
    className: "block-editor-link-control__settings",
    children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.VisuallyHidden, {
      as: "legend",
      children: (0, _i18n.__)('Currently selected link settings')
    }), theSettings]
  });
};
var _default = exports.default = LinkControlSettings;
//# sourceMappingURL=settings.js.map