You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
paopao-ce/web/dist/assets/copy-to-clipboard-DgsYVcxl.js

2 lines
2.1 KiB

import{r as C}from"./toggle-selection-DGa8lynz.js";var x=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function v(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var d,y;function D(){if(y)return d;y=1;var r=C(),u={"text/plain":"Text","text/html":"Url",default:"Text"},m="Copy to clipboard: #{key}, Enter";function b(o){var a=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return o.replace(/#{\s*key\s*}/g,a)}function g(o,a){var l,f,p,c,n,e,s=!1;a||(a={}),l=a.debug||!1;try{p=r(),c=document.createRange(),n=document.getSelection(),e=document.createElement("span"),e.textContent=o,e.ariaHidden="true",e.style.all="unset",e.style.position="fixed",e.style.top=0,e.style.clip="rect(0, 0, 0, 0)",e.style.whiteSpace="pre",e.style.webkitUserSelect="text",e.style.MozUserSelect="text",e.style.msUserSelect="text",e.style.userSelect="text",e.addEventListener("copy",function(t){if(t.stopPropagation(),a.format)if(t.preventDefault(),typeof t.clipboardData>"u"){l&&console.warn("unable to use e.clipboardData"),l&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var i=u[a.format]||u.default;window.clipboardData.setData(i,o)}else t.clipboardData.clearData(),t.clipboardData.setData(a.format,o);a.onCopy&&(t.preventDefault(),a.onCopy(t.clipboardData))}),document.body.appendChild(e),c.selectNodeContents(e),n.addRange(c);var w=document.execCommand("copy");if(!w)throw new Error("copy command was unsuccessful");s=!0}catch(t){l&&console.error("unable to copy using execCommand: ",t),l&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(a.format||"text",o),a.onCopy&&a.onCopy(window.clipboardData),s=!0}catch(i){l&&console.error("unable to copy using clipboardData: ",i),l&&console.error("falling back to prompt"),f=b("message"in a?a.message:m),window.prompt(f,o)}}finally{n&&(typeof n.removeRange=="function"?n.removeRange(c):n.removeAllRanges()),e&&document.body.removeChild(e),p()}return s}return d=g,d}var h=D();const E=v(h);export{E as a,x as c,v as g};