import{a as w}from"/build/_shared/chunk-NF7BQEED.js";import{B as T,a as u,g as f,w as b}from"/build/_shared/chunk-XIQ3C74K.js";import{b as x,d}from"/build/_shared/chunk-G5WX4PPA.js";var S=x((se,L)=>{L.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,r=[],o=0;o<e.rangeCount;o++)r.push(e.getRangeAt(o));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null;break}return e.removeAllRanges(),function(){e.type==="Caret"&&e.removeAllRanges(),e.rangeCount||r.forEach(function(a){e.addRange(a)}),t&&t.focus()}}});var R=x((ie,D)=>{"use strict";var _=S(),h={"text/plain":"Text","text/html":"Url",default:"Text"},q="Copy to clipboard: #{key}, Enter";function J(e){var t=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function X(e,t){var r,o,a,s,i,n,p=!1;t||(t={}),r=t.debug||!1;try{a=_(),s=document.createRange(),i=document.getSelection(),n=document.createElement("span"),n.textContent=e,n.ariaHidden="true",n.style.all="unset",n.style.position="fixed",n.style.top=0,n.style.clip="rect(0, 0, 0, 0)",n.style.whiteSpace="pre",n.style.webkitUserSelect="text",n.style.MozUserSelect="text",n.style.msUserSelect="text",n.style.userSelect="text",n.addEventListener("copy",function(c){if(c.stopPropagation(),t.format)if(c.preventDefault(),typeof c.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var y=h[t.format]||h.default;window.clipboardData.setData(y,e)}else c.clipboardData.clearData(),c.clipboardData.setData(t.format,e);t.onCopy&&(c.preventDefault(),t.onCopy(c.clipboardData))}),document.body.appendChild(n),s.selectNodeContents(n),i.addRange(s);var g=document.execCommand("copy");if(!g)throw new Error("copy command was unsuccessful");p=!0}catch(c){r&&console.error("unable to copy using execCommand: ",c),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),p=!0}catch(y){r&&console.error("unable to copy using clipboardData: ",y),r&&console.error("falling back to prompt"),o=J("message"in t?t.message:q),window.prompt(o,e)}}finally{i&&(typeof i.removeRange=="function"?i.removeRange(s):i.removeAllRanges()),n&&document.body.removeChild(n),a()}return p}D.exports=X});var z=e=>{w(()=>{e()})};T();var C=d(u(),1),V=()=>{let{revalidate:e}=f();(0,C.useEffect)(()=>(window.addEventListener("online",e),()=>{window.removeEventListener("online",e)}),[e])};T();var E=d(u(),1),B=()=>{let{revalidate:e}=f();(0,E.useEffect)(()=>(window.addEventListener("focus",e),()=>{window.removeEventListener("focus",e)}),[e]),(0,E.useEffect)(()=>{let t=()=>{document.visibilityState==="visible"&&e()};return window.addEventListener("visibilitychange",t),()=>{window.removeEventListener("visibilitychange",t)}},[e])};var F=d(R(),1),K=d(u(),1);var l=d(u(),1),U=()=>{let e=(0,l.useRef)(!1),t=(0,l.useCallback)(()=>e.current,[]);return(0,l.useEffect)(()=>(e.current=!0,()=>{e.current=!1}),[]),t};var m=d(u(),1),P=(e={})=>{let[t,r]=(0,m.useState)(e),o=(0,m.useCallback)(a=>{r(s=>Object.assign({},s,a instanceof Function?a(s):a))},[]);return[t,o]};var $=()=>{let e=U(),[t,r]=P({value:void 0,error:void 0,noUserInteraction:!0}),o=(0,K.useCallback)(a=>{if(!e())return;let s,i;try{if(typeof a!="string"&&typeof a!="number"){let n=new Error(`Cannot copy typeof ${typeof a} to clipboard, must be a string`);r({value:a,error:n,noUserInteraction:!0});return}else if(a===""){let n=new Error("Cannot copy empty string to clipboard.");r({value:a,error:n,noUserInteraction:!0});return}i=a.toString(),s=(0,F.default)(i),r({value:i,error:void 0,noUserInteraction:s})}catch(n){r({value:i,error:n,noUserInteraction:s})}},[]);return[t,o]};T();var v=d(u(),1);function G(e){let t=b(e),[r,o]=(0,v.useState)(t.data);return(0,v.useEffect)(()=>{t.state==="idle"&&o(t.data)},[t.state,t.data]),{...t,data:r,reset:()=>o(void 0)}}var N=d(u(),1);var H=d(u(),1);function O(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}function M(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}var A=typeof window<"u";var Q=A?window:null,k=e=>!!e.addEventListener,W=e=>!!e.on,Y=(e,t,r=Q,o)=>{(0,H.useEffect)(()=>{if(t&&r)return k(r)?O(r,e,t,o):W(r)&&r.on(e,t,o),()=>{k(r)?M(r,e,t,o):W(r)&&r.off(e,t,o)}},[e,t,r,JSON.stringify(o)])},I=Y;var Z=e=>typeof e=="function"?e:typeof e=="string"?t=>t.key===e:e?()=>!0:()=>!1,j=(e,t=()=>{},r={},o=[e])=>{let{event:a="keydown",target:s,options:i}=r,n=(0,N.useMemo)(()=>{let p=Z(e);return c=>{if(p(c))return t(c)}},o);I(a,n,s,i)};export{$ as a,G as b,j as c,z as d,V as e,B as f};
