import{B as e,C as t,D as n,F as r,M as i,N as a,Q as o,U as s,X as c,Z as l,b as u,m as d,q as f}from"./app-Bux8mGpp.js";var p=700,m=n({__name:`ReadingScrubber`,props:{target:{}},setup(n){let m=n,h=f(0),g=f(!1),_=f(null),v=f(!1);function y(){return m.target?Math.max(1,m.target.scrollHeight-m.target.clientHeight):Math.max(1,document.documentElement.scrollHeight-window.innerHeight)}function b(){return m.target?m.target.scrollTop:window.scrollY}function x(){let e=y();v.value=e>=p,h.value=Math.min(1,Math.max(0,b()/e))}function S(e){let t=_.value;if(!t)return;let n=t.getBoundingClientRect(),r=Math.min(1,Math.max(0,(e-n.top)/n.height))*y();m.target?m.target.scrollTo({top:r}):window.scrollTo({top:r})}function C(e){g.value=!0,e.target.setPointerCapture?.(e.pointerId),S(e.clientY)}function w(e){g.value&&S(e.clientY)}function T(){g.value=!1}let E=null;function D(){E=m.target??window,E.addEventListener(`scroll`,x,{passive:!0}),window.addEventListener(`resize`,x),x()}function O(){E?.removeEventListener(`scroll`,x),window.removeEventListener(`resize`,x)}return a(D),i(O),e(()=>m.target,()=>{O(),D()}),(e,n)=>s((r(),t(`div`,{ref_key:`track`,ref:_,class:`group fixed right-2 top-1/2 z-30 hidden h-[55vh] w-3 -translate-y-1/2 cursor-pointer md:block`,title:`Reading progress — drag to jump`,onPointerdown:C,onPointermove:w,onPointerup:T,onPointerleave:T},[n[1]||=u(`div`,{class:`absolute left-1/2 h-full w-1 -translate-x-1/2 rounded-full bg-line`},null,-1),u(`div`,{class:`absolute left-1/2 top-0 w-1 -translate-x-1/2 rounded-full bg-primary`,style:l({height:h.value*100+`%`})},null,4),u(`div`,{class:`absolute left-1/2 -translate-x-1/2 -translate-y-1/2`,style:l({top:h.value*100+`%`})},[n[0]||=u(`div`,{class:`h-3.5 w-3.5 rounded-full border-2 border-primary bg-surface shadow`},null,-1),u(`div`,{class:c([`absolute right-5 top-1/2 -translate-y-1/2 whitespace-nowrap rounded bg-ink px-1.5 py-0.5 text-[10px] font-bold text-surface transition-opacity`,g.value?`opacity-100`:`opacity-0 group-hover:opacity-100`])},o(Math.round(h.value*100))+`%`,3)],4)],544)),[[d,v.value]])}});export{m as t};