1import{i as e,t}from"./react-DB-4Zxce.js";import{C as n,k as r,m as i,n as a,r as o,t as s}from"./PageShell-C7cub8sj.js";import{s as c}from"./Icons-CCew7Sr1.js";import{t as l}from"./LoadingState-BTkgav4L.js";import{F as u,M as d,t as f}from"./use-auth-BkqngLvX.js";import{G as p,at as m,ct as h,it as g,lt as _,m as v,rt as y,st as b,ut as x}from"./index-BQOvCM2s.js";import{f as S}from"./ItemListContainer-nssvQLST.js";import{t as C}from"./BookmarksList-VCzUDNmh.js";import{t as w}from"./TypesList-DCNl6nQZ.js";import{t as T}from"./SectionStack-5Z8KD0W8.js";var E=e(t()),D=r();function O(){let{year:e}=v.useSearch(),t=p(),{bookmarks:r,loading:O}=S({year:e,localOnly:!t}),{user:k}=f(),A=typeof window<`u`?window.location.pathname:``,j=_({year:e}),M=(0,E.useCallback)(()=>{typeof window<`u`&&window.location.reload()},[]),N=(0,E.useCallback)(()=>{typeof window<`u`&&(window.location.href=`/?year=${e}`)},[e]),P=e=>{let t=e.type===`bookmark_event`||e.type===`event`,n=t?j.scheduleData?.events?.[e.slug]:j.scheduleData?.tracks?.[e.slug],r;r=n?t||d(n)?n.title:u(n)?n.name:e.slug:e.slug;let i=n?.room?n.room:j.scheduleData?`Not found in cached schedule`:`Slug: ${e.slug}`;return{kindLabel:t||n&&d(n)?`Event`:`Track`,title:r,detail:i,isEvent:t||n&&d(n)}};return(0,D.jsx)(s,{children:(0,D.jsxs)(T,{children:[(0,D.jsx)(a,{heading:t?`Connection Restored`:`You're Offline`,text:t?`You're back online! Click below to refresh the page.`:`Don't worry! You can still browse cached content and your local bookmarks.`,year:e}),(0,D.jsxs)(y,{children:[(0,D.jsx)(b,{children:(0,D.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,D.jsxs)(h,{className:`flex items-center gap-2`,children:[`Connection Status`,(0,D.jsx)(x,{variant:t?`default`:`secondary`,children:t?`Online`:`Offline`})]}),(0,D.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2`,children:[A!==`/offline`&&(0,D.jsx)(c,{size:`sm`,onClick:M,children:t?`Refresh Page`:`Try Again`}),(0,D.jsx)(c,{variant:`outline`,size:`sm`,onClick:N,children:`Go to Homepage`})]})]})}),(0,D.jsx)(g,{children:(0,D.jsx)(`p`,{className:`text-muted-foreground`,children:t?`You're connected to the internet. Refresh the page to load the latest data.`:`You're currently offline. The content below is from your browser's cache.`})})]}),j.scheduleData&&(0,D.jsxs)(y,{children:[(0,D.jsxs)(b,{children:[(0,D.jsxs)(h,{children:[i.name,` `,e,` Schedule`]}),(0,D.jsx)(m,{children:`Browse the cached conference schedule`})]}),(0,D.jsx)(g,{children:(0,D.jsx)(`div`,{className:`space-y-4`,children:j.scheduleData.types&&(0,D.jsx)(w,{types:j.scheduleData.types})})})]}),!j.scheduleData&&(0,D.jsxs)(y,{className:`mb-6`,children:[(0,D.jsxs)(b,{children:[(0,D.jsx)(h,{children:`No cached schedule yet`}),(0,D.jsx)(m,{children:`Open the schedule while online to keep it available offline.`})]}),(0,D.jsxs)(g,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`We couldn't find locally cached conference data for this year. Once you're online, visit the schedule to save it for offline use.`}),(0,D.jsx)(c,{variant:`outline`,size:`sm`,onClick:M,children:`Retry now`})]})]}),(0,D.jsxs)(y,{className:`mb-6`,children:[(0,D.jsx)(b,{children:(0,D.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsxs)(h,{className:`flex items-center gap-2`,children:[`Your Bookmarks`,!k?.id&&(0,D.jsx)(x,{variant:`outline`,children:`Local Only`})]}),(0,D.jsx)(m,{children:k?.id?`Your bookmarked events and tracks`:`Your bookmarks are saved locally on this device`})]}),(0,D.jsx)(c,{asChild:!0,variant:`outline`,size:`sm`,children:(0,D.jsx)(n,{...o(),children:`View all bookmarks`})})]})}),(0,D.jsx)(g,{children:O?(0,D.jsx)(l,{type:`spinner`,message:`Loading bookmarks...`,variant:`centered`}):r&&r.length>0?j.scheduleData?(0,D.jsx)(C,{bookmarks:r,scheduleData:j.scheduleData,year:e,loading:O,defaultViewMode:`list`,showViewMode:!1,showConflicts:!1,user:k,emptyStateTitle:`No cached bookmark details`,emptyStateMessage:`These bookmarks are saved, but their details are not in the cached schedule yet.`}):(0,D.jsxs)(`div`,{className:`space-y-3`,children:[(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Bookmark details are not in the cached schedule yet.`}),(0,D.jsx)(`div`,{className:`space-y-2`,children:r.map(t=>{let r=P(t);return(0,D.jsx)(`div`,{className:`p-3 border rounded-lg bg-muted/50`,children:(0,D.jsxs)(`div`,{className:`flex justify-between items-start gap-3`,children:[(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`p`,{className:`text-xs uppercase tracking-wide text-muted-foreground`,children:r.kindLabel}),(0,D.jsx)(n,{to:r.isEvent?`/event/$slug`:`/track/$slug`,params:{slug:t.slug},search:r.isEvent?{year:e,test:!1}:{year:e,day:void 0,view:void 0,sortFavourites:void 0},className:`font-medium no-underline hover:underline`,children:r.title}),(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r.detail})]}),(0,D.jsx)(x,{variant:`outline`,children:t.status})]})},t.id)})})]}):(0,D.jsxs)(`div`,{className:`text-center py-8`,children:[(0,D.jsx)(`p`,{className:`text-muted-foreground mb-4`,children:k?.id?`No bookmarks found`:`No bookmarks yet. When you're back online, you can bookmark events and tracks!`}),!k?.id&&(0,D.jsx)(c,{variant:`outline`,onClick:()=>{window.location.href=`/signin`},children:`Sign in to sync bookmarks`})]})})]})]})})}export{O as component}; 2//# sourceMappingURL=offline-sgKdz_Tl.js.map
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.