1import{c as j,j as e}from"./vendor-1kUQ7zn2.js";import{bh as z,g as B,bi as C,bj as k,S as M,Q as K,bf as E,R as P,T as G,c as l,bk as N,B as b,bl as q,bm as L,bn as U}from"./index--kdl1ae9.js";import{S as D}from"./scroll-area-Domx4w8f.js";import{A as w,a as R}from"./vendor-motion-BX-jsy7E.js";import"./vendor-date-en1IyhsK.js";import"./vendor-supabase-Dh2gyaRa.js";const T={overdue:"text-rose-600 dark:text-rose-300 bg-rose-500/10 ring-rose-500/15",today:"text-amber-700 dark:text-amber-200 bg-amber-400/10 ring-amber-500/15",tomorrow:"text-sky-700 dark:text-sky-200 bg-sky-500/10 ring-sky-500/15",soon:"text-muted-foreground bg-muted/60 ring-border/60"},_={overdue:"bg-rose-500",today:"bg-amber-500",tomorrow:"bg-sky-500",soon:"bg-muted-foreground/50"};function W({tasks:u}){const{entries:d,reviewOpen:h,closeReview:i,keep:g,revert:a,keepAll:o,revertAll:f}=z(),c=B(),[s,m]=j.useState(null),{groups:x,total:y}=j.useMemo(()=>{const t=new Map;for(const r of u)r?.id&&t.set(r.id,r.title??"");const n={overdue:[],today:[],tomorrow:[],soon:[]};for(const r of d.values()){const p=C(r.reason);n[p].push({entry:r,title:t.get(r.task_id)||"Untitled task",group:p})}for(const r of k)n[r].sort((p,A)=>A.entry.prioritized_at>p.entry.prioritized_at?1:-1);return{groups:n,total:d.size}},[d,u]),S=async()=>{if(!s){m("keep");try{await o()}finally{m(null)}}},O=async()=>{if(!s){m("revert");try{await f()}finally{m(null)}}},v=k.filter(t=>x[t].length>0);return e.jsx(M,{open:h,onOpenChange:t=>t?null:i(),children:e.jsxs(K,{side:c?"bottom":"right",className:l("flex flex-col gap-0 p-0 border-l-border/60",c?"h-[90vh] rounded-t-2xl":"w-full sm:max-w-[460px]"),children:[e.jsxs(E,{className:l("px-6 pt-6 pb-4 text-left space-y-3 border-b border-border/40","bg-gradient-to-b from-background to-background/95"),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:[e.jsx("span",{"aria-hidden":!0,className:"block h-1 w-1 rounded-full bg-amber-500 dark:bg-amber-300"}),"Auto-prioritize"]}),e.jsx(P,{className:"text-xl font-semibold tracking-tight",children:"Moved to Do First"}),e.jsx(G,{className:"text-sm text-muted-foreground",children:"Promoted here based on their due dates. Keep them, or send any back."})]}),y>0&&e.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:v.map(t=>e.jsxs("span",{className:l("inline-flex items-center gap-1.5 rounded-full","px-2.5 py-1 text-[11px] font-medium","ring-1 ring-inset",T[t]),children:[e.jsx("span",{"aria-hidden":!0,className:l("h-1.5 w-1.5 rounded-full",_[t])}),x[t].length," ",N[t].toLowerCase()]},t))})]}),y===0?e.jsx("div",{className:"flex-1 grid place-items-center px-6 py-12",children:e.jsxs("div",{className:"text-center max-w-[260px]",children:[e.jsx("div",{className:"mx-auto mb-3 h-10 w-10 rounded-full bg-muted/60 grid place-items-center",children:e.jsx("span",{className:"block h-1.5 w-1.5 rounded-full bg-muted-foreground/50"})}),e.jsx("p",{className:"text-sm font-medium",children:"You're all caught up."}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Nothing else has been moved recently."})]})}):e.jsx(D,{className:"flex-1",children:e.jsx("div",{className:"px-5 py-3 space-y-5",children:e.jsx(w,{initial:!1,children:v.map(t=>e.jsxs(R.section,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.18,ease:"easeOut"},children:[e.jsxs("div",{className:"flex items-center gap-2 px-1 mb-2",children:[e.jsx("span",{"aria-hidden":!0,className:l("h-1.5 w-1.5 rounded-full",_[t])}),e.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground",children:N[t]}),e.jsxs("span",{className:"text-[11px] tabular-nums text-muted-foreground/70",children:["· ",x[t].length]})]}),e.jsx("ul",{className:"space-y-2",children:e.jsx(w,{initial:!1,children:x[t].map(n=>e.jsx(R.li,{layout:!0,initial:{opacity:0,y:6,scale:.99},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.985,transition:{duration:.16}},transition:{duration:.18,ease:"easeOut"},children:e.jsx(F,{row:n,onKeep:()=>g(n.entry.task_id),onRevert:()=>a(n.entry.task_id)})},n.entry.id))})})]},t))})})}),y>0&&e.jsxs("div",{className:l("border-t border-border/50 bg-background/95 backdrop-blur-sm","px-5 py-3 flex items-center gap-2",c&&"pb-[max(env(safe-area-inset-bottom),0.75rem)]"),children:[e.jsx(b,{type:"button",variant:"ghost",size:"sm",className:"flex-1",onClick:S,disabled:s!==null,children:s==="keep"?"Keepingâ¦":"Keep all"}),e.jsx(b,{type:"button",variant:"secondary",size:"sm",className:"flex-1",onClick:O,disabled:s!==null,children:s==="revert"?"Moving backâ¦":"Move all back"})]})]})})}function F({row:u,onKeep:d,onRevert:h}){const{entry:i,title:g}=u,[a,o]=j.useState(null),f=async()=>
1{if(!a){o("keep");try{await d()}finally{o(null)}}},c=async()=>{if(!a){o("revert");try{await h()}finally{o(null)}}},s=i.original_quadrant&&i.original_quadrant!=="unassigned"?q(i.original_quadrant):null;return e.jsx("div",{className:l("group/row rounded-xl bg-card/60 ring-1 ring-border/50","hover:bg-card hover:ring-border/80 transition-colors","px-3.5 py-3"),children:e.jsxs("div",{className:"flex flex-col gap-2.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium leading-snug line-clamp-2 break-words",children:g}),e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{children:L(i.reason)}),s&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":!0,className:"opacity-50",children:"·"}),e.jsxs("span",{children:["From ",s]})]})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{type:"button",variant:"ghost",size:"sm",className:"h-8 flex-1 text-xs",onClick:f,disabled:a!==null,children:a==="keep"?"Keepingâ¦":"Keep here"}),e.jsx(b,{type:"button",variant:"secondary",size:"sm",className:"h-8 flex-1 text-xs",onClick:c,disabled:a!==null,children:a==="revert"?"Movingâ¦":U(i.original_quadrant)})]})]})})}export{W as MovedHereReviewSheet};
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.