/**
 * Minified by jsDelivr using Terser v5.37.0.
 * Original file: /npm/copy-to-clipboard@3.3.3/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";var deselectCurrent=require("toggle-selection"),clipboardToIE11Formatting={"text/plain":"Text","text/html":"Url",default:"Text"},defaultMessage="Copy to clipboard: #{key}, Enter";function format(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function copy(e,t){var o,a,r,n,c,l,s=!1;t||(t={}),o=t.debug||!1;try{if(r=deselectCurrent(),n=document.createRange(),c=document.getSelection(),(l=document.createElement("span")).textContent=e,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",(function(a){if(a.stopPropagation(),t.format)if(a.preventDefault(),void 0===a.clipboardData){o&&console.warn("unable to use e.clipboardData"),o&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var r=clipboardToIE11Formatting[t.format]||clipboardToIE11Formatting.default;window.clipboardData.setData(r,e)}else a.clipboardData.clearData(),a.clipboardData.setData(t.format,e);t.onCopy&&(a.preventDefault(),t.onCopy(a.clipboardData))})),document.body.appendChild(l),n.selectNodeContents(l),c.addRange(n),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");s=!0}catch(r){o&&console.error("unable to copy using execCommand: ",r),o&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),s=!0}catch(r){o&&console.error("unable to copy using clipboardData: ",r),o&&console.error("falling back to prompt"),a=format("message"in t?t.message:defaultMessage),window.prompt(a,e)}}finally{c&&("function"==typeof c.removeRange?c.removeRange(n):c.removeAllRanges()),l&&document.body.removeChild(l),r()}return s}module.exports=copy;
//# sourceMappingURL=/sm/059461823843d329e487c864f61795f7a3b18c11a98a9e93b54355e13e493bdd.map