import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{An as t,Nn as n,Pn as r,bi as i,kn as a,ri as o,yi as s}from"./vendor-DU4C2Mru.js";import{vt as c}from"./index-B7s3VjPV.js";import{r as l}from"./FilterBar-vmNBx3Ut.js";var u=e(i(),1),d=`glicko:sidebar-mode`;function f(e=1100){let t=l(`(max-width: ${e-1}px)`),[n,r]=(0,u.useState)(()=>{if(typeof window>`u`)return null;let e=window.localStorage.getItem(d);return e===`compact`||e===`full`?e:null});(0,u.useEffect)(()=>{let e=e=>{e.key===d&&r(e.newValue===`compact`||e.newValue===`full`?e.newValue:null)};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]);let i=(0,u.useCallback)(()=>{r(e=>{if(e!==null)return window.localStorage.removeItem(d),null;let n=(t?`compact`:`full`)==`compact`?`full`:`compact`;return window.localStorage.setItem(d,n),n})},[t]);return{variant:n??(t?`compact`:`full`),isPinned:n!==null,togglePin:i}}var p=o();function m({title:e,onBack:t,actions:n,children:r,width:i=`w-72`,className:a,contentClassName:o,scrollRef:s}){return(0,p.jsxs)(`div`,{className:c(`flex h-full flex-shrink-0 flex-col overflow-hidden border-r border-zinc-200/80 dark:border-zinc-800/60 transition-[width] duration-200`,i,a),children:[(0,p.jsxs)(`div`,{className:`flex h-12 flex-shrink-0 items-center justify-between border-b border-zinc-200/80 px-3 dark:border-zinc-800/60`,children:[(0,p.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[t&&(0,p.jsx)(`button`,{onClick:t,className:`flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-md text-zinc-400 transition-colors hover:bg-zinc-100 hover:text-zinc-600 dark:hover:bg-zinc-800 dark:hover:text-zinc-300`,"aria-label":`Go back`,children:`‹`}),(0,p.jsx)(`span`,{className:`min-w-0 truncate text-sm font-semibold text-zinc-900 dark:text-zinc-100`,children:e})]}),n&&(0,p.jsx)(`div`,{className:`flex flex-shrink-0 items-center gap-2`,children:n})]}),(0,p.jsx)(`div`,{ref:s,className:c(`flex-1 overflow-y-auto p-2`,o),children:r})]})}function h({label:e,isPinned:r,onExpand:i,filters:a,children:o}){return(0,p.jsxs)(`div`,{className:`flex h-full w-14 flex-shrink-0 flex-col overflow-hidden border-r border-zinc-200/80 transition-[width] duration-200 dark:border-zinc-800/60`,children:[(0,p.jsx)(`div`,{className:`flex h-12 flex-shrink-0 items-center justify-center border-b border-zinc-200/80 dark:border-zinc-800/60`,children:(0,p.jsx)(`button`,{type:`button`,onClick:i,title:r?`Unpin sidebar`:`Expand sidebar`,"aria-label":r?`Unpin sidebar`:`Expand sidebar`,className:`flex h-8 w-8 items-center justify-center rounded-md text-zinc-400 transition-colors hover:bg-zinc-100 hover:text-zinc-700 dark:hover:bg-zinc-800 dark:hover:text-zinc-300`,children:r?(0,p.jsx)(t,{size:14,strokeWidth:2.2}):(0,p.jsx)(n,{size:14,strokeWidth:2.2})})}),(0,p.jsx)(`div`,{className:`flex items-center justify-center border-b border-zinc-200/60 py-2 dark:border-zinc-800/40`,children:(0,p.jsx)(`span`,{className:`glk-eyebrow`,children:e})}),a&&(0,p.jsx)(`div`,{className:`flex-shrink-0 border-b border-zinc-200/60 px-1 py-1.5 dark:border-zinc-800/40`,children:a}),(0,p.jsx)(`div`,{className:`flex-1 overflow-y-auto overflow-x-visible px-1 py-1.5`,children:o})]})}function g({selected:e,onClick:t,rank:n,main:r,onPeek:i,onPeekEnd:a,peek:o}){return(0,p.jsxs)(`button`,{type:`button`,onClick:t,onMouseEnter:e=>i(e.currentTarget),onMouseLeave:a,onFocus:e=>i(e.currentTarget),onBlur:a,"data-peek":typeof o==`string`?o:void 0,className:c(`group relative flex w-full flex-col items-center justify-center gap-0.5 rounded-lg px-1 py-1.5 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--glk-brand)]/40`,e?`bg-[var(--glk-brand)]/10 text-[var(--glk-brand)]`:`hover:bg-zinc-100 dark:hover:bg-zinc-800/60`),children:[n!=null&&(0,p.jsx)(`span`,{className:c(`text-[9px] font-bold leading-none tabular-nums`,e?`text-[var(--glk-brand)]`:`text-zinc-400 dark:text-zinc-500`),children:n}),(0,p.jsx)(`span`,{className:`flex items-center justify-center`,children:r}),e&&(0,p.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-0 top-1/2 h-8 w-0.5 -translate-y-1/2 rounded-r bg-[var(--glk-brand)]`})]})}function _({isPinned:e,variant:t,onClick:i}){let o=e?`Unpin sidebar`:t===`full`?`Collapse sidebar`:`Expand sidebar`;return(0,p.jsx)(`button`,{type:`button`,onClick:i,title:o,"aria-label":o,"aria-pressed":e,className:`flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-md text-zinc-400 transition-colors hover:bg-zinc-100 hover:text-zinc-700 dark:hover:bg-zinc-800 dark:hover:text-zinc-300`,children:e?(0,p.jsx)(a,{size:13,strokeWidth:2.2}):t===`full`?(0,p.jsx)(r,{size:13,strokeWidth:2.2}):(0,p.jsx)(n,{size:13,strokeWidth:2.2})})}var v=e(s(),1);function y(){let[e,t]=(0,u.useState)(null),n=(0,u.useCallback)((e,n)=>{t({content:e,rect:n.getBoundingClientRect()})},[]),r=(0,u.useCallback)(()=>t(null),[]);return(0,u.useEffect)(()=>{if(!e)return;let n=()=>t(null);return window.addEventListener(`resize`,n),()=>window.removeEventListener(`resize`,n)},[e]),{show:n,hide:r,portal:e?(0,v.createPortal)((0,p.jsx)(b,{rect:e.rect,children:e.content}),document.body):null}}function b({rect:e,children:t}){return(0,p.jsxs)(`div`,{role:`tooltip`,className:`pointer-events-none fixed z-50 min-w-[220px] max-w-[280px] rounded-xl border border-zinc-200 bg-white/95 p-3 shadow-xl shadow-zinc-950/20 backdrop-blur-sm dark:border-white/[0.08] dark:bg-zinc-900/95 dark:shadow-[0_12px_32px_-8px_rgba(0,0,0,0.6)]`,style:{top:Math.max(8,Math.min(e.top,window.innerHeight-200)),left:e.right+10,animation:`railPeekIn 160ms cubic-bezier(0.16, 1, 0.3, 1)`},children:[(0,p.jsx)(`div`,{className:`absolute left-[-5px] top-3 h-2.5 w-2.5 rotate-45 border-b border-l border-zinc-200 bg-white dark:border-white/[0.08] dark:bg-zinc-900`}),t]})}export{m as a,_ as i,h as n,f as o,g as r,y as t};