1import{aF as T,aH as q,af as n,ax as v,a7 as e,d as K}from"./index-Cu8N4w3J.js";import{a as X}from"./materials-Dfii1vaj.js";import{g as H}from"./flashcards-B88Izb7M.js";import{f as o}from"./format-CDzFj4FA.js";import{s as j,B as I}from"./BarChart-9AqejiVP.js";import{P as k}from"./plus-64L_OZ4L.js";import{R as w}from"./rotate-ccw-CMLIq2mn.js";import{C as N}from"./circle-check-DzlrvDg-.js";import{A as h}from"./arrow-right-Ce8QAPVf.js";import{F as O}from"./flame-KDW2G0gt.js";import{C as G}from"./calendar-days-B3wVf8EH.js";import{F as M}from"./file-text-CEst4RkX.js";import{B as J}from"./bar-chart-3-DHY5RSa1.js";import{R as Q,X as U,d as V,B as W}from"./generateCategoricalChart-DYdPAxoY.js";import{r as _}from"./ru-BwYLSBg0.js";function be(){var p,y,g;const{user:s}=T(),r=q(),[l,C]=n.useState([]),[x,D]=n.useState([]),[u,S]=n.useState([]),[m,E]=n.useState([]),[B,F]=n.useState(!0);n.useEffect(()=>{s!=null&&s.id&&Promise.all([X(s.id),H(s.id),v.from("subjects").select("*").eq("user_id",s.id),v.from("study_sessions").select("*").eq("user_id",s.id).order("date",{ascending:!1}).limit(30)]).then(([t,a,i,c])=>{C(t),D(a),S(i.data||[]),E(c.data||[])}).catch(console.error).finally(()=>F(!1))},[s==null?void 0:s.id]);const R=n.useMemo(()=>{const t=new Set(m.map(c=>c.date));let a=0,i=new Date;for(;t.has(o(i,"yyyy-MM-dd"));)a+=1,i=j(i,1);return a},[m]),z=n.useMemo(()=>{const t={};return m.forEach(a=>{t[a.date]=a.cards_reviewed||0}),Array.from({length:14},(a,i)=>{const c=j(new Date,13-i),L=o(c,"yyyy-MM-dd");return{day:o(c,"dd.MM"),reviewed:t[L]||0}})},[m]),b=n.useMemo(()=>{const t=o(new Date,"yyyy-MM-dd");return u.filter(a=>a.exam_date&&a.exam_date>=t).sort((a,i)=>a.exam_date.localeCompare(i.exam_date))[0]||null},[u]),A=((p=m.find(t=>t.date===o(new Date,"yyyy-MM-dd")))==null?void 0:p.cards_reviewed)||0,P=((g=(y=s==null?void 0:s.user_metadata)==null?void 0:y.full_name)==null?void 0:g.split(" ")[0])||"СÑÑденÑ",d=l.length===0?{eyebrow:"ÐеÑвÑй Ñаг",title:"ÐобавÑÑе ÑÑебнÑй маÑеÑиал",description:"ÐагÑÑзиÑе лекÑиÑ, конÑÐ¿ÐµÐºÑ Ð¸Ð»Ð¸ запиÑÑ. StudyForge подгоÑÐ¾Ð²Ð¸Ñ ÐºÐ¾Ð½ÑпекÑ, каÑÑоÑки и ÑеÑÑ.",label:"ÐобавиÑÑ Ð¼Ð°ÑеÑиал",route:"/analyze",icon:k}:x.length>0?{eyebrow:"Ðа ÑегоднÑ",title:`ÐовÑоÑиÑÑ ${x.length} ${Y(x.length)}`,description:"ÐаÑниÑе Ñ ÐºÐ°ÑÑоÑек, ÑÑок коÑоÑÑÑ
Ñже наÑÑÑпил. ÐÑо займÑÑ Ð½ÐµÑколÑко минÑÑ.",label:"ÐаÑаÑÑ Ð¿Ð¾Ð²ÑоÑение",route:"/review",icon:w}:{eyebrow:"Ðа ÑÐµÐ³Ð¾Ð´Ð½Ñ Ð²ÑÑ",title:"ÐаÑÑоÑки повÑоÑенÑ",description:"Ðожно оÑкÑÑÑÑ Ð¿Ð¾Ñледний маÑеÑиал или добавиÑÑ Ð½Ð¾Ð²ÑÑ Ð»ÐµÐºÑиÑ.",label:"ÐÑкÑÑÑÑ Ð±Ð¸Ð±Ð»Ð¸Ð¾ÑекÑ",route:"/library",icon:N};if(B)return e.jsx("div",{className:"flex min-h-[60vh] items-center justify-center",role:"status","aria-label":"ÐагÑÑзка",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-cyan-300 border-t-transparent"})});const $=d.icon;return e.jsxs("main",{className:"mx-auto w-full max-w-6xl px-4 py-6 sm:px-6 md:py-10",children:[e.jsxs("header",{className:"flex flex-col gap-5 border-b border-slate-200 pb-7 dark:border-slate-800 md:flex-row md:items-end md:justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"mb-2 text-xs font-semibold uppercase tracking-[0.12em] text-[var(--sf-accent)]",children:"СегоднÑ"}),e.jsxs("h1",{className:"text-3xl font-semibold tracking-tight text-slate-950 dark:text-slate-50 md:text-4xl",children:[P,", ÑÑо повÑоÑим?"]}),e.jsx("p",{className:"mt-2 text-sm capitalize text-slate-500 dark:text-slate-400",children:o(new Date,"EEEE, d MMMM",{locale:_})})]}),e.jsxs("button",{type:"button",onClick:()=>r("/analyze"),className:"inline-flex min-h-11 items-center justify-center gap-2 rounded-lg bg-cyan-300 px-4 py-2.5 text-sm font-semibold text-slate-950 transition-colors hover:bg-cyan-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300",children:[e.jsx(k,{className:"h-4 w-4"})," ÐобавиÑÑ Ð¼Ð°ÑеÑиал"]})]}),e.jsxs("section",{className:"grid gap-8 py-8 lg:grid-cols-[minmax(0,1.45fr)_minmax(280px,.75fr)]",children:[e.jsx("button",{type:"button",onClick:()=>r(d.route),className:"group relative min-h-64 overflow-hidden rounded-xl border border-[var(--sf-line)] bg-[var(--sf-surface)] p-6 text-left text-[var(--sf-ink)] transition-colors hover:border-[var(--sf-accent)] focu
1s-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--sf-accent)] sm:p-8",children:e.jsxs("div",{className:"relative flex h-full min-h-48 flex-col justify-between gap-8",children:[e.jsxs("div",{children:[e.jsx("div",{className:"mb-6 flex h-10 w-10 items-center justify-center rounded-md border border-[var(--sf-line)] bg-[var(--sf-accent-soft)]",children:e.jsx($,{className:"h-5 w-5 text-[var(--sf-accent)]"})}),e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-[var(--sf-accent)]",children:d.eyebrow}),e.jsx("h2",{className:"mt-2 max-w-xl text-2xl font-semibold tracking-tight sm:text-3xl",children:d.title}),e.jsx("p",{className:"mt-3 max-w-xl text-sm leading-6 text-[var(--sf-muted)] sm:text-base",children:d.description})]}),e.jsxs("span",{className:"inline-flex min-h-11 w-fit items-center gap-2 rounded-full bg-[var(--sf-accent)] px-5 text-sm font-semibold text-white shadow-[0_3px_0_color-mix(in_srgb,var(--sf-accent)_72%,#111)] transition group-hover:-translate-y-px group-hover:bg-[var(--sf-accent-hover)] group-active:translate-y-px group-active:shadow-none",children:[d.label,e.jsx(h,{className:"h-4 w-4 transition-transform group-hover:translate-x-1"})]})]})}),e.jsxs("div",{className:"divide-y divide-slate-200 border-y border-slate-200 dark:divide-slate-800 dark:border-slate-800",children:[e.jsx(f,{label:"ÐаÑÑоÑек на ÑегоднÑ",value:x.length,icon:w}),e.jsx(f,{label:"ÐовÑоÑено ÑегоднÑ",value:A,icon:N}),e.jsx(f,{label:"Ðней подÑÑд",value:R,icon:O}),e.jsx(f,{label:"ÐаÑеÑиалов",value:l.length,icon:K})]})]}),b&&e.jsxs("button",{type:"button",onClick:()=>r("/courses"),className:"mb-8 flex w-full items-center gap-4 border-y border-amber-300/40 bg-amber-50/60 px-1 py-4 text-left transition-colors hover:bg-amber-50 dark:border-amber-800/40 dark:bg-amber-950/15 dark:hover:bg-amber-950/25",children:[e.jsx(G,{className:"h-5 w-5 shrink-0 text-amber-600 dark:text-amber-400"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.08em] text-amber-700 dark:text-amber-400",children:"ÐлижайÑий Ñкзамен"}),e.jsx("p",{className:"mt-1 truncate text-sm font-semibold text-slate-900 dark:text-slate-100",children:b.name})]}),e.jsx("span",{className:"shrink-0 text-sm text-slate-500 dark:text-slate-400",children:o(new Date(b.exam_date),"d MMMM",{locale:_})}),e.jsx(h,{className:"h-4 w-4 shrink-0 text-slate-400"})]}),e.jsxs("section",{className:"grid gap-10 lg:grid-cols-[minmax(0,1fr)_minmax(320px,.8fr)]",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"mb-4 flex items-end justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.1em] text-slate-400",children:"ÐиблиоÑека"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold text-slate-950 dark:text-slate-50",children:"ÐоÑледние маÑеÑиалÑ"})]}),e.jsx("button",{type:"button",onClick:()=>r("/library"),className:"text-sm font-medium text-[var(--sf-accent)] hover:opacity-80",children:"ÐÑкÑÑÑÑ Ð²Ñе"})]}),l.length===0?e.jsxs("div",{className:"border-y border-dashed border-slate-300 py-10 text-center dark:border-slate-700",children:[e.jsx(M,{className:"mx-auto h-6 w-6 text-slate-400"}),e.jsx("p",{className:"mt-3 text-sm text-slate-600 dark:text-slate-300",children:"РбиблиоÑеке пока Ð½ÐµÑ Ð¼Ð°ÑеÑиалов."})]}):e.jsx("div",{className:"divide-y divide-slate-200 border-y border-slate-200 dark:divide-slate-800 dark:border-slate-800",children:l.slice(0,5).map(t=>e.jsxs("button",{type:"button",onClick:()=>r(`/library/${t.id}`),className:"group flex w-full items-center gap-3 py-4 text-left",children:[e.jsx(M,{className:"h-4 w-4 shrink-0 text-slate-400"}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-slate-800 group-hover:text-cyan-700 dark:text-slate-200 dark:group-hover:text-cyan-300",children:t.title}),e.jsx("span",{className:"shrink-0 text-xs tabular-nums text-slate-400",children:o(new Date(t.created_at),"dd.MM.yy")}),e.jsx(h,{className:"h-4 w-4 shrink-0 text-slate-300 transition-transform group-hover:translate-x-1 dar
1k:text-slate-600"})]},t.id))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-4 flex items-end justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.1em] text-slate-400",children:"14 дней"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold text-slate-950 dark:text-slate-50",children:"ÐовÑоÑÑннÑе каÑÑоÑки"})]}),e.jsx("button",{type:"button",onClick:()=>r("/analytics"),"aria-label":"ÐÑкÑÑÑÑ Ð¿ÑогÑеÑÑ",className:"text-slate-400 hover:text-cyan-600 dark:hover:text-cyan-300",children:e.jsx(J,{className:"h-5 w-5"})})]}),e.jsx("div",{className:"h-60 border-y border-slate-200 py-5 dark:border-slate-800",children:e.jsx(Q,{width:"100%",height:"100%",children:e.jsxs(I,{data:z,margin:{top:8,right:0,left:0,bottom:0},children:[e.jsx(U,{dataKey:"day",axisLine:!1,tickLine:!1,interval:3,tick:{fill:"#64748b",fontSize:11}}),e.jsx(V,{cursor:{fill:"rgba(34,211,238,.06)"},contentStyle:{background:"#091827",border:"1px solid rgba(103,232,249,.25)",borderRadius:8,color:"#fff",fontSize:12},formatter:t=>[t,"ÐаÑÑоÑек"],labelFormatter:t=>`ÐаÑа: ${t}`}),e.jsx(W,{dataKey:"reviewed",fill:"#67e8f9",radius:[3,3,0,0]})]})})})]})]})]})}function f({label:s,value:r,icon:l}){return e.jsxs("div",{className:"flex items-center gap-3 py-4 first:pt-0 last:pb-0 lg:first:pt-4 lg:last:pb-4",children:[e.jsx(l,{className:"h-4 w-4 shrink-0 text-cyan-600 dark:text-cyan-300"}),e.jsx("span",{className:"min-w-0 flex-1 text-sm text-slate-500 dark:text-slate-400",children:s}),e.jsx("strong",{className:"text-xl font-semibold tabular-nums text-slate-950 dark:text-slate-50",children:r})]})}function Y(s){const r=s%10,l=s%100;return r===1&&l!==11?"каÑÑоÑкÑ":r>=2&&r<=4&&(l<12||l>14)?"каÑÑоÑки":"каÑÑоÑек"}export{be as default};
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.