"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var a=f(require("react")),b=require("carbon-components-react"),c=f(require("prop-types")),d=f(require("classnames")),e=require("react-i18next");require("../css/copier.css");function f(a){return a&&a.__esModule?a:{default:a}}var g=!1;"undefined"!=typeof document&&document.queryCommandSupported&&(g=document.queryCommandSupported("copy"));var h=function(a){return function(){var b=document.querySelector(a);if(b){var c=document.createRange();c.selectNodeContents(b);var d=window.getSelection();d.removeAllRanges(),d.addRange(c),g&&(document.execCommand("copy"),d.removeAllRanges())}}},i=function(c){var f=c.className,g=c.renderStyle,i=c.buttonText,j=c.element,k=(0,e.useTranslation)(),l=k.t,m=h(j);return"button"===g?a["default"].createElement("span",{className:(0,d["default"])("apiconnect-copier",f)},a["default"].createElement("div",{role:"button",tabIndex:0,className:"bx--btn bx--btn--secondary",onClick:m,onKeyDown:m},i)):a["default"].createElement(b.CopyButton,{onClick:m,feedback:l("copied_to_clipboard"),iconDescription:l("copy_to_clipboard"),"data-testid":"copy-button"})};i.defaultProps={renderStyle:"",className:""},i.propTypes={renderStyle:c["default"].string,className:c["default"].string,buttonText:c["default"].string,element:c["default"].string};var j=i;exports["default"]=j;