1 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8c0c77a3-0f10-5485-bef1-d6d885e2cec3")}catch(e){}}(); 3import{o as e}from"./rolldown-runtime.DAXXjFlN.js";import{U as t,m as n,z as r}from"./TruncatedText.BX6_jYkq.js";import{D as i,E as a}from"./vendor-react.8N2OehSW.js";import{E as o,c as s}from"./Icon.FA6H_IW8.js";import{n as c}from"./queue.C-kM5kWa.js";import{t as l}from"./useComposedCallback.8Cbfg1gI.js";import{r as u}from"./iconFactory.D4B3vjUO.js";import{t as d}from"./IconButton.B3zFgZ-Q.js";var f=e(i(),1),p=o(`ClipboardButton`);function m({textToCopy:e,htmlToCopy:t,successMessage:i,failureMessage:a}){let o=r(),s=a??n(`copyToClipboardFailureMessage`,`Could not copy to clipboard`,o.ClipboardButton?.copyToClipboardFailureMessage);return{onCopy:(0,f.useCallback)(async()=>{try{let n=typeof t==`function`?await t():t;if(n)try{await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([n],{type:`text/html`}),"text/plain":new Blob([e],{type:`text/plain`})})])}catch{await navigator.clipboard.writeText(e)}else await navigator.clipboard.writeText(e);return i&&c({title:i,status:`success`}),!0}catch{return c({title:s,status:`destructive`}),!1}},[t,s,i,e])}}var h=a(),g=3e3,_=(0,f.forwardRef)((e,i)=>{let[a,o]=s(e,i,p,`ClipboardButton`),{failureMessage:c,htmlToCopy:_,icon:v=`Copy`,label:y,onPress:b,successMessage:x,successType:S=`icon`,textToCopy:C,...w}=a;u(`ClipboardButton`);let T=r(),{onCopy:E}=m({failureMessage:c,htmlToCopy:_,successMessage:S===`toast`?x:void 0,textToCopy:C}),[D,O]=(0,f.useState)(!1),[k]=t(),A=(0,f.useCallback)(()=>{O(!1)},[]),j=l(b,(0,f.useCallback)(async()=>{await E()&&S===`icon`&&(O(!0),k(A,g))},[A,E,k,S]));return(0,h.jsx)(d,{ref:o,...w,hideState:D,icon:D?{icon:`Check`,color:`$successFill`}:v,label:D?x??n(`copiedToClipboardLabel`,`Copied to clipboard`,T.ClipboardButton?.copiedToClipboardLabel):y??n(`copyToClipboardLabel`,`Copy to clipboard`,T.ClipboardButton?.copyToClipboardLabel),onPress:j,tooltip:{disableCloseOnPress:!0}})});export{m as n,_ as t}; 4//# sourceMappingURL=ClipboardButton.otHhD4Ce.js.map 5//# debugId=8c0c77a3-0f10-5485-bef1-d6d885e2cec3
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.