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