import _defineProperty from '@babel/runtime/helpers/defineProperty';
import CodeBlock from 'react-syntax-highlighter/dist/esm/prism-light.js';
import { dracula } from 'react-syntax-highlighter/dist/esm/styles/prism';
import CopyToClipboardButton from './CopyToClipboardButton.js';
import { jsxs, jsx } from 'react/jsx-runtime';
import '@babel/runtime/helpers/slicedToArray';
import '@babel/runtime/helpers/objectWithoutProperties';
import 'react';
import 'classnames';
import '@bigbinary/neeto-commons-frontend/utils/general';
import '@bigbinary/neeto-icons/Copy';
import '@bigbinary/neeto-icons/Check';
import '@bigbinary/neetoui/Button';
import 'ramda';
import 'react-i18next';
import './inject-css-C2dztUxs.js';

function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var Codeblock = function Codeblock(_ref) {
  var code = _ref.code,
    _ref$showCopyButton = _ref.showCopyButton,
    showCopyButton = _ref$showCopyButton === void 0 ? true : _ref$showCopyButton,
    codeblockProps = _ref.codeblockProps,
    _ref$copyButtonProps = _ref.copyButtonProps,
    copyButtonProps = _ref$copyButtonProps === void 0 ? {
      label: "Copy"
    } : _ref$copyButtonProps;
  var isLargerScreen = window.innerWidth > 768;
  return /*#__PURE__*/jsxs("div", {
    className: "relative",
    children: [/*#__PURE__*/jsx(CodeBlock, _objectSpread(_objectSpread({
      wrapLines: true,
      className: "neeto-molecules-code-block p-4 pr-12 md:pr-4",
      codeTagProps: {
        "data-testid": "code-block-content"
      },
      "data-testid": "code-block",
      language: "javascript",
      style: dracula
    }, codeblockProps), {}, {
      children: code
    })), showCopyButton && /*#__PURE__*/jsx(CopyToClipboardButton, _objectSpread(_objectSpread({
      className: "absolute right-2 top-2",
      "data-testid": "copy-to-clipboard-button",
      size: "small",
      style: "secondary",
      value: code
    }, copyButtonProps), {}, {
      label: isLargerScreen ? copyButtonProps.label : ""
    }))]
  });
};

export { Codeblock as default };
//# sourceMappingURL=Codeblock.js.map
