import{w as c,F as l}from"./chunk-EPOLDU6W-BCLmut3y.js";import{j as e}from"./jsx-runtime-C5WNSv3b.js";import{f as n}from"./format-CZ5n8p10.js";import{e as x,c as m}from"./misc-W4055b-0.js";import"./index-CqIc3cxq.js";function a({children:o,confirmLabel:s="Confirm",className:d,...t}){const{doubleCheck:r,getButtonProps:i}=x();return e.jsx("button",{...i(t),className:m("border-border bg-background text-foreground focus:ring-ring inline-flex min-w-[120px] items-center justify-center gap-2 rounded-md border px-3 py-1 text-sm font-medium transition-colors focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none disabled:opacity-50",r?"border-destructive bg-destructive text-destructive-foreground hover:bg-destructive/90 hover:text-destructive-foreground":"hover:bg-muted hover:text-foreground",d),children:e.jsxs("span",{className:"grid items-center justify-center",children:[e.jsx("span",{"aria-hidden":!0,className:"col-start-1 row-start-1 opacity-0",children:o}),e.jsx("span",{"aria-hidden":!0,className:"col-start-1 row-start-1 opacity-0",children:s}),e.jsx("span",{className:"col-start-1 row-start-1",children:r?s:o})]})})}const j=c(function({loaderData:s}){const{summary:d}=s;return d.workshops.length===0?e.jsx("p",{className:"text-muted-foreground text-sm",children:"No offline videos are downloaded yet."}):e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Downloads"}),e.jsx(l,{method:"post",children:e.jsx(a,{type:"submit",name:"intent",value:"delete-all",children:"Delete all downloads"})})]}),d.workshops.map(t=>e.jsxs("section",{className:"border-border rounded border p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:t.title}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("span",{className:"text-muted-foreground text-sm",children:[t.videos.length," video",t.videos.length===1?"":"s"," ·"," ",n(t.totalBytes)]}),e.jsxs(l,{method:"post",children:[e.jsx("input",{type:"hidden",name:"workshopId",value:t.id}),e.jsx(a,{type:"submit",name:"intent",value:"delete-workshop",children:"Delete workshop downloads"})]})]})]}),e.jsx("div",{className:"mt-3 overflow-x-auto",children:e.jsxs("table",{className:"border-border w-full border text-sm",children:[e.jsx("thead",{className:"bg-muted text-foreground",children:e.jsxs("tr",{children:[e.jsx("th",{className:"border-border border px-3 py-2 text-left",children:"Title"}),e.jsx("th",{className:"border-border border px-3 py-2 text-left",children:"Status"}),e.jsx("th",{className:"border-border border px-3 py-2 text-left",children:"Size"}),e.jsx("th",{className:"border-border border px-3 py-2 text-left",children:"Updated"}),e.jsx("th",{className:"border-border w-[140px] border px-3 py-2 text-left",children:"Actions"})]})}),e.jsx("tbody",{children:t.videos.map(r=>e.jsxs("tr",{children:[e.jsx("td",{className:"border-border max-w-[360px] border px-3 py-2",children:e.jsx("a",{href:r.url,target:"_blank",rel:"noreferrer",className:"block truncate underline-offset-4 hover:underline",children:r.title})}),e.jsx("td",{className:"border-border border px-3 py-2",children:r.status}),e.jsx("td",{className:"border-border border px-3 py-2",children:r.size?n(r.size):"—"}),e.jsx("td",{className:"border-border border px-3 py-2",children:new Date(r.updatedAt).toLocaleString()}),e.jsx("td",{className:"border-border w-[140px] border px-3 py-2",children:e.jsxs(l,{method:"post",children:[e.jsx("input",{type:"hidden",name:"playbackId",value:r.playbackId}),e.jsx(a,{type:"submit",name:"intent",value:"delete-video",className:"w-full",children:"Delete"})]})})]},`${t.id}-${r.playbackId}`))})]})})]},t.id))]})});export{j as default};
//# sourceMappingURL=offline-videos-DAsuWMco.js.map
