PageSourceSearch

https://focusy.co/_next/static/chunks/app/layout-0c2f9cdaaea29709.js

js focusy.co collected 2026-10-02 01:20:52 UTC 13,527 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{388:(e,s,t)=>{"use strict";t.d(s,{SyncProvider:()=>d});var a=t(5155),r=t(2115),n=t(8525),i=t(8169);let l=(0,r.createContext)(void 0);function d(e){let{children:s}=e,{user:t}=(0,i.A)(),[d,o]=(0,r.useState)([]),[c,m]=(0,r.useState)(null),[u,f]=(0,r.useState)(null),[x,p]=(0,r.useState)(!0),[h,g]=(0,r.useState)(!1),j=(0,n.U)(),N=(0,r.useCallback)(async()=>{if(!t)return;let{data:e,error:s}=await j.from("library").select("*").eq("user_id",t.id).order("last_accessed",{ascending:!1});!s&&e&&o(e)},[t,j]),b=(0,r.useCallback)(async()=>{if(!t)return;let{data:e,error:s}=await j.from("settings").select("*").eq("user_id",t.id).single();!s&&e&&m(e)},[t,j]),v=(0,r.useCallback)(async()=>{if(!t)return;let{data:e,error:s}=await j.from("statistics").select("*").eq("user_id",t.id).single();!s&&e&&f(e)},[t,j]),y=(0,r.useCallback)(async()=>{g(!0),await Promise.all([N(),b(),v()]),g(!1)},[N,b,v]),_=async(e,s)=>{if(!t)return null;let a=s.split(/\s+/).filter(Boolean),{data:r,error:n}=await j.from("library").insert({user_id:t.id,title:e,content:s,total_words:a.length,last_read_index:0}).select().single();return n?(console.error("Add to library error:",n),null):(o(e=>[r,...e]),r.id)},w=async(e,s)=>{if(!t)return;let{error:a}=await j.from("library").update({last_read_index:s,last_accessed:new Date().toISOString()}).eq("id",e).eq("user_id",t.id);a||o(t=>t.map(t=>t.id===e?{...t,last_read_index:s,last_accessed:new Date().toISOString()}:t))},z=async e=>{if(!t)return;let{error:s}=await j.from("library").delete().eq("id",e).eq("user_id",t.id);s||o(s=>s.filter(s=>s.id!==e))},k=async e=>{if(!t||!c)return;let{data:s,error:a}=await j.from("settings").update(e).eq("user_id",t.id).select().single();!a&&s&&m(s)},A=async(e,s,a,r)=>{if(!t)return;let{data:n,error:i}=await j.rpc("record_reading_session",{p_user_id:t.id,p_library_item_id:r||null,p_words_read:e,p_duration_seconds:s,p_wpm:a});!i&&(null==n?void 0:n.stats)&&f(e=>e?{...e,total_words_read:n.stats.total_words_read,total_reading_time_seconds:n.stats.total_reading_time_seconds,sessions_count:n.stats.sessions_count,average_wpm:n.stats.average_wpm}:e)};return(0,r.useEffect)(()=>{if(!t){o([]),m(null),f(null),p(!1);return}p(!0),y().then(()=>p(!1));let e=j.channel("library-changes").on("postgres_changes",{event:"*",schema:"public",table:"library",filter:"user_id=eq.".concat(t.id)},()=>N()).subscribe(),s=j.channel("settings-changes").on("postgres_changes",{event:"*",schema:"public",table:"settings",filter:"user_id=eq.".concat(t.id)},()=>b()).subscribe();return()=>{j.removeChannel(e),j.removeChannel(s)}},[t,j,y,N,b]),(0,a.jsx)(l.Provider,{value:{library:d,settings:c,statistics:u,isLoading:x,isSyncing:h,syncLibrary:N,syncSettings:b,syncAll:y,addToLibrary:_,updateLibraryProgress:w,removeFromLibrary:z,updateSettings:k,recordSession:A},children:s})}},1290:()=>{},3628:(e,s,t)=>{Promise.resolve().then(t.t.bind(t,1290,23)),Promise.resolve().then(t.bind(t,8169)),Promise.resolve().then(t.bind(t,6890)),Promise.resolve().then(t.bind(t,2476)),Promise.resolve().then(t.bind(t,388)),Promise.resolve().then(t.bind(t,8124)),Promise.resolve().then(t.bind(t,8045)),Promise.resolve().then(t.t.bind(t,4587,23)),Promise.resolve().then(t.t.bind(t,4705,23))},8045:(e,s,t)=>{"use strict";t.d(s,{Header:()=>J});var a=t(5155),r=t(2619),n=t.n(r),i=t(63),l=t(8955),d=t(5379),o=t(2115),c=t(9427),m=t(7494),u=t(7003);function f(){let{resolvedTheme:e,setTheme:s}=(0,d.D)(),[t,r]=(0,o.useState)(!1);return((0,o.useEffect)(()=>{r(!0)},[]),t)?(0,a.jsxs)(u.$,{variant:"ghost",size:"icon",className:"size-9",onClick:()=>{s("light"===e?"dark":"light")},children:["light"===e?(0,a.jsx)(c.A,{className:"size-5"}):(0,a.jsx)(m.A,{className:"size-5"}),(0,a.jsx)("span",{className:"sr-only",children:"Toggle theme"})]}):(0,a.jsx)(u.$,{variant:"ghost",size:"icon",className:"size-9"})}var x=t(186),p=t(318),h=t(5917),g=t(9051),j=t(5016);let N=x.bL,b=x.l9;x.YJ,x.ZL,x.Pb,x.z6,o.forwardRef((e,s)=>{let{className:t,inset:r,children:n,...i}=e;return(0,a.jsxs)(x.ZP,{ref:s,className:(0,j.cn)("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",r&&"pl-8",t),...i,children:[n,(0,a.jsx)(p.A,{className:"ml-auto"})]})}).displayName=x.ZP.displayName,o.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(x.G5,{ref:s,className:(0,j.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
1de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",t),...r})}).displayName=x.G5.displayName;let v=o.forwardRef((e,s)=>{let{className:t,sideOffset:r=4,...n}=e;return(0,a.jsx)(x.ZL,{children:(0,a.jsx)(x.UC,{ref:s,sideOffset:r,className:(0,j.cn)("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",t),...n})})});v.displayName=x.UC.displayName;let y=o.forwardRef((e,s)=>{let{className:t,inset:r,...n}=e;return(0,a.jsx)(x.q7,{ref:s,className:(0,j.cn)("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",r&&"pl-8",t),...n})});y.displayName=x.q7.displayName,o.forwardRef((e,s)=>{let{className:t,children:r,checked:n,...i}=e;return(0,a.jsxs)(x.H_,{ref:s,className:(0,j.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...i,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(x.VF,{children:(0,a.jsx)(h.A,{className:"h-4 w-4"})})}),r]})}).displayName=x.H_.displayName,o.forwardRef((e,s)=>{let{className:t,children:r,...n}=e;return(0,a.jsxs)(x.hN,{ref:s,className:(0,j.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(x.VF,{children:(0,a.jsx)(g.A,{className:"h-2 w-2 fill-current"})})}),r]})}).displayName=x.hN.displayName,o.forwardRef((e,s)=>{let{className:t,inset:r,...n}=e;return(0,a.jsx)(x.JU,{ref:s,className:(0,j.cn)("px-2 py-1.5 text-sm font-semibold",r&&"pl-8",t),...n})}).displayName=x.JU.displayName;let _=o.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(x.wv,{ref:s,className:(0,j.cn)("-mx-1 my-1 h-px bg-muted",t),...r})});_.displayName=x.wv.displayName;var w=t(3366);let z=o.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(w.bL,{ref:s,className:(0,j.cn)("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...r})});z.displayName=w.bL.displayName;let k=o.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(w._V,{ref:s,className:(0,j.cn)("aspect-square h-full w-full",t),...r})});k.displayName=w._V.displayName;let A=o.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(w.H4,{ref:s,className:(0,j.cn)("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...r})});A.displayName=w.H4.displayName;var C=t(9068),P=t(508),S=t(6154),q=t(7937),R=t(5870),H=t(8519),U=t(4926),V=t(5664),$=t(5229),O=t(6890),L=t(2391),E=t(8169),Z=t(3365),I=t(7956);function T(e){let{size:s=28}=e;return(0,a.jsxs)("svg",{width:s,height:s,viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,a.jsx)("path",{d:"M180 260H644V356H308V452H580V548H308V724H180V260Z",className:"fill-foreground"}),(0,a.jsx)("circle",{cx:"760",cy:"492",r:"72",fill:"#EF4444"})]})}function D(){let{locale:e,setLocale:s,availableLocales:t}=(0,O.s)();return(0,a.jsxs)(N,{children:[(0,a.jsx)(b,{asChild:!0,children:(0,a.jsxs)(u.$,{variant:"ghost",size:"sm",className:"gap-1.5 px-2",children:[(0,a.jsx)(C.A,{className:"size-4"}),(0,a.jsx)("span",{className:"text-xs",children:L.L$[e]})]})}),(0,a.jsx)(v,{align:"start",children:t.map(t=>(0,a.jsx)(y,{onClick:()=>s(t),className:(0,j.cn)(e===t&&"bg-muted"),children:L.L$[t]},t))})]})}function F(){var e,s;let{user:t,profile:r,signOut:i,isLoading:l}=(0,E.A)(),{tier:d,creditsBalance:o,readsRemaining:c,isUnlimited:m}=(0,Z.R)();if(l)return(0,a.jsx)("div",{className:"h-8 w-8 rounded-full bg-muted animate-pulse"});if(!t)return(0,a.jsx)(n(),{href:"/login",children:(0,a.jsx)(u.$,{size:"default",variant:"default",className:"cursor-pointer",children:"Sign In"})});let f=(null==r||null==(e=r.display_name)?void 0:e.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2))||(null==(s=t.email)?void 0:s.slice(0,2).toUpperCase())||"U",x=I.AK[d].name;return(0,a.jsxs)(N,{children:[(0,a.jsx)(b,{asChild:!0,children:(0,a.jsx)(u.$,{variant:"ghost",size:"icon",className:"rounded-full cursor-pointer",children:(0,a.jsxs)(z,{className:"h-8 w-8",children:[(0,a.jsx)(k,{src:(null==r?void 0:r.avatar_url)||void 0}),(0,a.jsx)(A,{className:"text-xs",children:f})]})})}),(0,a.jsxs)(v,{align:"end",className:"w-56",children:[(0,a.jsxs)("div",{className:"px-2 py-1.5",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:(null==r?void 0:r.display_name)||t.email}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:t.email})]}),(0,a.jsx)(_,{}),(0,a.jsxs)("div",{className:"px-2 py-1.5 space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,a.jsxs)("span",{className:"text-muted-foreground flex items-center gap-1",children:[(0,a.jsx)(P.A,{className:"size-3"}),"Plan"]}),(0,a.jsx)("span",{className:(0,j.cn)("font-medium","free"!==d&&"text-primary"),children:x})]}),"free"!==d&&(0,a.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,a.jsxs)("span",{className:"text-muted-foreground flex items-center gap-1",children:[(0,a.jsx)(S.A,{className:"size-3"}),"AI Credits"]}),(0,a.jsx)("span",{className:"font-medium",children:o})]}),!m&&(0,a.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,a.jsxs)("span",{className:"text-muted-foreground flex items-center gap-1",children:[(0,a.jsx)(q.A,{className:"size-3"}),"Reads left"]}),(0,a.jsx)("span",{className:"font-medium",children:c})]})]}),(0,a.jsx)(_,{}),(0,a.jsx)(y,{asChild:!0,children:(0,a.jsxs)(n(),{href:"/settings",className:"cursor-pointer",children:[(0,a.jsx)(R.A,{className:"size-4 mr-2"}),"Settings"]})}),"free"===d&&(0,a.jsx)(y,{asChild:!0,children:(0,a.jsxs)(n(),{href:"/settings?tab=subscription",className:"cursor-pointer text-primary",children:[(0,a.jsx)(H.A,{className:"size-4 mr-2"}),"Upgrade"]})}),(0,a.jsx)(_,{}),(0,a.jsxs)(y,{onSelect:e=>{console.log("Sign Out clicked",e),i()},className:"cursor-pointer text-destructive focus:text-destructive",children:[(0,a.jsx)(U.A,{className:"size-4 mr-2"}),"Sign Out"]})]})]})}function J(){let e=(0,i.usePathname)(),s="/reader"===e,t=(0,l.c)("nav"),r=[{href:"/library",label:t("library"),icon:q.A},{href:"/stats",label:t("stats"),icon:V.A},{href:"/settings",label:t("settings"),icon:R.A}];return(0,a.jsx)("header",{className:(0,j.cn)("sticky top-0 z-50 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",!s&&"border-b border-border/40"),children:(0,a.jsxs)("div",{className:"container mx-auto flex h-14 items-center justify-between px-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(n(),{href:"/",className:"flex items-center",children:(0,a.jsx)(T,{size:28})}),!s&&(0,a.jsx)(D,{})]}),(0,a.jsxs)("nav",{className:"flex items-center gap-1",children:[!s&&r.map(s=>{let t=s.icon,r=e===s.href;return(0,a.jsx)(n(),{href:s.href,children:(0,a.jsxs)(u.$,{variant:"ghost",size:"sm",className:(0,j.cn)("gap-2",r&&"bg-muted"),children:[(0,a.jsx)(t,{className:"size-4"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:s.label})]})},s.href)}),s&&(0,a.jsx)(n(),{href:"/",children:(0,a.jsx)(u.$,{variant:"ghost",size:"icon",className:"size-9",children:(0,a.jsx)($.A,{className:"size-4"})})}),(0,a.jsx)(f,{}),!s&&(0,a.jsx)(F,{})]})]})})}},8124:(e,s,t)=>{"use strict";t.d(s,{ThemeProvider:()=>n});var a=t(5155),r=t(5379);function n(e){let{children:s}=e;return(0,a.jsx)(r.N,{attribute:"class",defaultTheme:"system",enableSystem:!0,disableTransitionOnChange:!0,children:s})}}},e=>{e.O(0,[3321,1680,176,5376,5890,9777,107,62,1086,6196,7468,448,6890,8441,1255,7358],()=>e(e.s=3628)),_N_E=e.O()}]);

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.