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