1import{ad as j,p as v,Q as w,r as E,j as e,C as N,a1 as T,i as a,T as L,b as _}from"./index-xXRcupBt.js";import{u as C}from"./useLatestWatched-CHxrIqcG.js";import{u as R,V as k,T as S,a as A}from"./ViewDensityToggle-C2tB2PVl.js";import{F as D}from"./FavoriteButton-XasgyUst.js";import{f as I}from"./formatLoanDate-ATsREwHh.js";const z=function(){const{libraryId:s,i18nLanguage:o}=j.useParams(),l=v(),{data:r,isLoading:u,error:m,refetch:x,isFetching:f}=C(),{isRentalLibrary:p,data:i}=w(s),{viewDensity:n,setViewDensity:g}=R("latest-watched-view-density");E.useEffect(()=>{window.scrollTo(0,0)},[]);const b=()=>{l({to:"/$i18nLanguage/library/$libraryId/profile",params:{i18nLanguage:o,libraryId:s}})},d=t=>{t&&l({to:"/$i18nLanguage/library/$libraryId/title/$titleId",params:{i18nLanguage:o,libraryId:s,titleId:t}})},c=(r==null?void 0:r.titles)||[],h=t=>t.loan_date?t.on_loan?e.jsx("span",{className:"bg-yellow-500 text-black px-2 py-1 rounded text-xs font-semibold shadow-lg",children:a("ONGOING")}):e.jsx("span",{className:"bg-white/20 text-white px-2 py-1 rounded text-xs font-semibold shadow-lg backdrop-blur-md border border-white/30",children:I(t.loan_date)}):null;return e.jsx("div",{className:"w-full py-8",children:e.jsx(N,{children:u?e.jsx("div",{className:"py-10 text-center",children:e.jsx("div",{className:"inline-block h-8 w-8 animate-spin rounded-full border-4 border-solid border-yellow-500 border-r-transparent"})}):m?e.jsx(T,{title:a("LATEST_WATCHED_ERROR_TITLE")||"Kunde inte ladda senast sedda",message:a("LATEST_WATCHED_ERROR_MESSAGE")||"Vi kunde inte ladda dina senast sedda filmer just nu. Det kan vara ett tillfälligt problem.",onRetry:()=>x(),isRetrying:f,size:"large"}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{type:"button",onClick:b,className:"text-white hover:text-yellow-500 transition-colors duration-200","aria-label":"Go back",children:e.jsx(L,{className:"text-xl md:text-2xl"})}),e.jsx("h1",{className:"text-2xl font-bold",children:a("YOUR_LOANED_TITLES")})]}),e.jsx(k,{viewDensity:n,onChange:g})]}),c.length===0?e.jsx("div",{className:"py-10 text-center text-neutral-400",children:a("NO_WATCHED_MOVIES_MESSAGE")}):e.jsx(S,{viewDensity:n,titles:c,getItemKey:t=>t.id,renderCard:t=>{const y=_(t);return e.jsxs("div",{className:"relative group",children:[e.jsx("button",{type:"button",className:"cursor-pointer group focus:outline-none focus:ring-2 focus:ring-yellow-500 focus:ring-offset-2 focus:ring-offset-neutral-900 w-full text-left",onClick:()=>d(t.id),"aria-label":`View details for ${y||t.name}`,children:e.jsx(A,{title:t,viewDensity:n,onClick:d,interactive:!1,showFavorite:!1,favoriteButtonSize:"sm",favoriteButtonPosition:"top-right",ratingVariant:"inline",isRentalLibrary:p,libraryCurrency:i==null?void 0:i.currency_symbol,topLeftBadge:h(t)})}),t.is_favourite!==void 0?e.jsx("div",{className:"absolute top-2 right-2 opacity-0 md:group-hover:opacity-100 transition-opacity duration-300 z-10",children:e.jsx(D,{titleId:t.id,isFavorite:t.is_favourite,size:"sm"})}):null]})}})]})})})};export{z 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.