1import{r as n,j as e,L as x,N as f,h as p}from"./index-0pyO0dqw.js";import{L as v}from"./LoadingIndicator-Br7rzK0q.js";import{i as d,m as u}from"./metadataService-OfZs_ozc.js";import{B as c,T as b,u as y}from"./TermLink-1zablNZn.js";import{m as g}from"./metadataClient-BAflpM2N.js";import{B as m}from"./button-ddvT0kPN.js";import"./db-C1-VNlwc.js";function N(s){const[t,a]=n.useState(null);return n.useEffect(()=>{async function l(){const i=await g.getEpisodeById(s);a(i)}l()},[s]),t&&t.episode_id!==Number(s)?null:t}function h({episode:s,size:t}){const[a,l]=n.useState(null),i=d.getImageUrl({episode:s,size:t});if(n.useEffect(()=>{(async()=>{const j=await d.imageExists(i);l(j)})()},[i]),!a)return null;const o=t==="large"?"View High Quality Image":"View Best Quality Image";return e.jsx("div",{className:"text-center font-medium mb-4",children:e.jsx(m,{variant:"ghost",asChild:!0,children:e.jsx("a",{href:i,children:o})})})}function r({label:s,children:t}){return e.jsxs("div",{className:"flex p-4 border-b border-black",children:[e.jsx("div",{className:"w-1/4 text-center font-semibold",children:s}),e.jsx("div",{className:"flex-1",children:t})]})}function E({episode:s}){return e.jsxs("div",{className:"mx-auto w-1/2 border-black border bg-white pt-4",children:[e.jsx("div",{className:"text-center border-b border-black",children:e.jsx("h3",{children:"Metadata"})}),e.jsx(r,{label:"Title",children:e.jsx(c,{query:{title:s.title_id},label:s.title})}),e.jsx(r,{label:"Author",children:e.jsx(c,{query:{author:s.author_id},label:s.author})}),e.jsxs(r,{label:"Date Published",children:[u.getDisplayDate(s.date)," -Â ",u.getDayOfTheWeek(s.date)]}),s.episode_title&&e.jsx(r,{label:"Episode Title",children:s.episode_title}),s.summary&&e.jsx(r,{label:"Summary",children:s.summary}),s.characters.length?e.jsx(r,{label:"Characters",children:s.characters.map((t,a)=>e.jsxs(n.Fragment,{children:[e.jsx(c,{query:{character:t.character_id},label:t.name}),a<s.characters.length-1?", ":""]},t.character_id))}):null,s.terms.length?e.jsx(r,{label:"Contents",children:s.terms.map((t,a)=>e.jsxs(n.Fragment,{children:[e.jsx(b,{term:t}),a<s.terms.length-1?", ":""]},t.term_id))}):null,s.notes&&e.jsx(r,{label:"Notes",children:e.jsx("div",{className:"metadata-notes",dangerouslySetInnerHTML:{__html:s.notes}})}),s.transcript&&e.jsx(r,{label:"Transcript",children:e.jsx("pre",{className:"whitespace-pre-wrap",children:s.transcript})})]})}function I(s){const[t,a]=n.useState(null);return n.useEffect(()=>{(async()=>{const{next:i,previous:o}=await g.getNextAndPreviousEpisodeIds(s);a({next:i,previous:o})})()},[s]),{next:t?.next||null,previous:t?.previous||null}}function w({episode:s}){const t=I(s);return e.jsxs("div",{className:"flex my-4 justify-center",children:[t.previous&&e.jsx(m,{variant:"ghost",asChild:!0,children:e.jsx(x,{to:"/display/$id",params:{id:String(t.previous)},children:"â Previous"})}),t.next&&e.jsx(m,{variant:"ghost",asChild:!0,children:e.jsx(x,{to:"/display/$id",params:{id:String(t.next)},children:"Next â"})})]})}function P({id:s}){const t=N(s),{dimensions:a,isLoading:l}=y({episodes:t?[t]:void 0,size:"small"}),i=t===null||l;return e.jsxs("div",{className:"mx-auto",children:[i&&e.jsx(v,{delay:0}),t===!1&&e.jsx(f,{message:"Requested comic episode not found"}),t&&!i&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"h-12 flex justify-center",children:[e.jsx(h,{episode:t,size:"large"}),e.jsx(h,{episode:t,size:"archival"})]}),e.jsx("img",{className:"mx-auto",src:d.getImageUrl({episode:t,size:"small"}),width:a[Number(s)]?.width,height:a[Number(s)]?.height,alt:`Scan of ${t.title} published on ${u.getDisplayDate(t.date)}`}),e.jsx(w,{episode:t}),e.jsx(E,{episode:t})]})]})}function C(){const s=p.useParams().id;return e.jsx(P,{id:s})}export{C as component};
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.