import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{m as t}from"./vendor-dnd-C1cICjTT.js";import{s as n}from"./vendor-markdown-Db1-9wH7.js";import{n as r}from"./axisEvents-Dhd0R1o7.js";import{ProjectRail as i}from"./ProjectRail-BsF8d8MZ.js";var a=e(t(),1),o=n();function s(){let[e,t]=(0,a.useState)(!1),n=(0,a.useRef)(e);n.current=e,(0,a.useEffect)(()=>{let e=null,i=r(`mc:navigate-project`,()=>{n.current&&(e!==null&&window.clearTimeout(e),e=window.setTimeout(()=>{e=null,n.current&&t(!1)},340))});return()=>{e!==null&&window.clearTimeout(e),i()}},[]),(0,a.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t(!1)};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e]);let s=(0,a.useCallback)(()=>t(e=>!e),[]),c=(0,a.useCallback)(()=>t(!1),[]);return(0,a.useEffect)(()=>{if(e)return;let n=null,r=null,i=!1,a=e=>{if(e.pointerType===`mouse`)return;let t=window.innerWidth||document.documentElement.clientWidth||0;t<=0||e.clientX<t-18||(n=e.clientX,r=e.clientY,i=!0)},o=e=>{if(!i||n==null||r==null)return;let a=e.clientX-n,o=Math.abs(e.clientY-r);if(o>Math.abs(a)&&o>12){i=!1;return}a<-36&&(i=!1,t(!0))},s=()=>{i=!1,n=null,r=null};return window.addEventListener(`pointerdown`,a,{passive:!0}),window.addEventListener(`pointermove`,o,{passive:!0}),window.addEventListener(`pointerup`,s,{passive:!0}),window.addEventListener(`pointercancel`,s,{passive:!0}),()=>{window.removeEventListener(`pointerdown`,a),window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,s)}},[e]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`button`,{type:`button`,onClick:s,"aria-label":e?`Close project dock`:`Open project dock`,className:`fixed right-0 top-1/2 -translate-y-1/2 z-[90] w-4 h-24 flex items-center justify-center bg-terminal-surface/90 border-y border-l border-terminal-border/60 rounded-l-md shadow-lg backdrop-blur-sm active:bg-terminal-surface`,style:{touchAction:`manipulation`},"data-testid":`mobile-project-dock-handle`,children:(0,o.jsx)(`svg`,{width:`8`,height:`14`,viewBox:`0 0 8 14`,fill:`none`,className:`text-terminal-muted transition-transform duration-200 ${e?``:`rotate-180`}`,children:(0,o.jsx)(`path`,{d:`M1 1L6 7L1 13`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}),(0,o.jsxs)(`div`,{className:`fixed inset-0 z-[100] transition-opacity duration-200 ${e?`opacity-100 pointer-events-auto`:`opacity-0 pointer-events-none`}`,"aria-hidden":!e,children:[(0,o.jsx)(`div`,{className:`absolute inset-0 mc-scrim`,onClick:c,"data-testid":`mobile-project-dock-backdrop`}),(0,o.jsx)(`div`,{className:`absolute right-0 border-l border-terminal-border/60 shadow-2xl shadow-black/45 backdrop-blur-xl transition-transform duration-200 ease-out ${e?`translate-x-0`:`translate-x-full`}`,style:{top:`max(env(safe-area-inset-top, 0px), 44px)`,bottom:`max(env(safe-area-inset-bottom, 0px), 12px)`,width:`60px`,background:`linear-gradient(180deg, rgb(var(--mc-surface-sidebar, var(--terminal-surface)) / 0.98), rgb(var(--mc-surface-app, var(--terminal-bg)) / 0.96))`},"data-testid":`mobile-project-dock-drawer`,children:(0,o.jsx)(`div`,{className:`flex h-full justify-center bg-terminal-surface/70`,children:(0,o.jsx)(i,{})})})]})]})}export{s as MobileProjectDock};