PageSourceSearch

https://anyserv.eu/_astro/ScrollToTopButton.9KepwpiE.js

js anyserv.eu collected 2026-10-02 01:02:13 UTC 2,654 bytes, 1 lines download raw bytes

1import{j as w}from"./jsx-runtime.u17CrQMm.js";import{r}from"./index.uFOh2Gdi.js";import{r as y}from"./index.CP6JyP3E.js";import{m as S}from"./proxy.DqjQWaU4.js";var A=y();const T={en:"Back to top",pl:"Wróć na górę",de:"Nach oben",fr:"Retour en haut",es:"Volver arriba"};function B(o){return T[o]??T.en}const k="(min-width: 769px)",v=16,O=20,j=44,L=[.22,1,.36,1];function D(o){const e=document.querySelector(".anyserv-footer");if(!e)return 0;const t=e.getBoundingClientRect().top,s=o-O-j;return t>=s+v?0:Math.max(0,s+v-t)}function F(o,e,t,s){const u=(o.hideBeforeRatio??.35)*t;if(o.type==="viewport"){const l=o.showAfterRatio*t;return e>=l?!0:e<=u?!1:s}const m=document.querySelector(o.selector);if(!m){const l=.75*t;return e>=l?!0:e<=u?!1:s}const f=m.getBoundingClientRect(),h=o.when??"enter",c=(o.edge??"top")==="bottom"?f.bottom:f.top,E=(o.atRatio??.88)*t,p=(o.atRatio??.12)*t,d=160;return h==="enter"?c<=E&&e>d?!0:e<=u||c>t*.98&&e<t*.6?!1:s:c<=p&&e>d?!0:e<=u||c>t*.95&&e<t*.5?!1:s}function _({locale:o="en",label:e,trigger:t}){const s=e??B(o),[u,m]=r.useState(!1),[f,h]=r.useState(!1),[i,c]=r.useState(!1),[E,p]=r.useState(0),d=r.useRef(null);r.useEffect(()=>{m(!0)},[]),r.useEffect(()=>{i||d.current?.blur()},[i]),r.useEffect(()=>{const a=window.matchMedia(k),n=()=>h(a.matches);return n(),a.addEventListener("change",n),()=>a.removeEventListener("change",n)},[]),r.useEffect(()=>{if(!f){c(!1),p(0);return}let a=0;const n=()=>{cancelAnimationFrame(a),a=requestAnimationFrame(()=>{const R=window.scrollY,b=window.innerHeight;c(x=>F(t,R,b,x)),p(D(b))})};return window.addEventListener("scroll",n,{passive:!0}),window.addEventListener("resize",n,{passive:!0}),document.addEventListener("astro:page-load",n),n(),()=>{window.removeEventListener("scroll",n),window.removeEventListener("resize",n),document.removeEventListener("astro:page-load",n),cancelAnimationFrame(a)}},[f,t]);const l=r.useCallback(()=>{const a=window.matchMedia("(prefers-reduced-motion: reduce)").matches;window.scrollTo({top:0,behavior:a?"auto":"smooth"})},[]);return!u||!f?null:A.createPortal(w.jsx(S.button,{ref:d,type:"button",className:"scroll-top-btn",onClick:l,"aria-label":s,tabIndex:i?0:-1,inert:i?void 0:!0,initial:!1,animate:{opacity:i?1:0,scale:i?1:.92},style:{y:-E,pointerEvents:i?"auto":"none"},transition:{opacity:{duration:.28,ease:L},scale:{duration:.28,ease:L}},children:w.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.25",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[w.jsx("path",{d:"M12 19V5"}),w.jsx("path",{d:"m5 12 7-7 7 7"})]})}),document.body)}export{_ as default};

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.