import{w as c,F as a}from"./chunk-EVOBXE3Y-Bmgys8-c.js";import{j as e}from"./jsx-runtime-hUI6LOBV.js";import{f as l}from"./format-C6HW_OzJ.js";import{e as x,c as b}from"./misc-BNcbB3dR.js";import"./index-CFdT0RIo.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"66e9b849450b819e11683314a547a341cb57f7d0"};var d=new t.Error().stack;d&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[d]="c5b27020-dc63-4a9f-9efa-1cecd415e024",t._sentryDebugIdIdentifier="sentry-dbid-c5b27020-dc63-4a9f-9efa-1cecd415e024")}catch{}})();function n({children:t,confirmLabel:d="Confirm",className:o,...s}){const{doubleCheck:r,getButtonProps:i}=x();return e.jsx("button",{...i(s),className:b("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",o),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:t}),e.jsx("span",{"aria-hidden":!0,className:"col-start-1 row-start-1 opacity-0",children:d}),e.jsx("span",{className:"col-start-1 row-start-1",children:r?d:t})]})})}const j=c(function({loaderData:d}){const{summary:o}=d;return o.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(a,{method:"post",children:e.jsx(n,{type:"submit",name:"intent",value:"delete-all",children:"Delete all downloads"})})]}),o.workshops.map(s=>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:s.title}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("span",{className:"text-muted-foreground text-sm",children:[s.videos.length," video",s.videos.length===1?"":"s"," ·"," ",l(s.totalBytes)]}),e.jsxs(a,{method:"post",children:[e.jsx("input",{type:"hidden",name:"workshopId",value:s.id}),e.jsx(n,{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:s.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?l(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(a,{method:"post",children:[e.jsx("input",{type:"hidden",name:"playbackId",value:r.playbackId}),e.jsx(n,{type:"submit",name:"intent",value:"delete-video",className:"w-full",children:"Delete"})]})})]},`${s.id}-${r.playbackId}`))})]})})]},s.id))]})});export{j as default};
//# sourceMappingURL=offline-videos-C628-CDe.js.map
