1import{j as e}from"./vendor-query-skQMsM6X.js";import{r as n,a as ke}from"./vendor-react-DyYvSSk1.js";import{T as w,p as c,B as F,c as re,I as ye,a6 as Ce,a8 as Se,a9 as _e,aq as me,aL as ce,r as $e,v as Ie,x as De,y as Fe,z as J,ak as Pe}from"./index-BGwtrXIa.js";import"./Card-CFJOMB8b.js";import"./educationStore-CjIKFVAs.js";import"./sidebar-O1Kfw91w.js";import"./progress-DewcR8Rb.js";import"./educationNavItems-brNLRoOX.js";import{u as ue}from"./useEducationAccess-KFfyVG_H.js";import{S as ze,a as Ve,b as Ae,c as Le,d as Be}from"./sheet-CWjm8Huq.js";import"./useUserAchievements-DfYIthg1.js";import"./sessionTelemetry-X-Vnv8Qs.js";import{E as Me}from"./EducationPageHeader-DaegdZX0.js";import{e as _,t as B,A as P,a as Te,u as We,b as qe}from"./useCadernos-0O4TZUpr.js";import{C as Z}from"./CapaCaderno-Bc0sAzDE.js";import{q as K,C as ge,F as $,bw as M,bb as Ee,h as I,I as je,cx as U,D as L,L as Re,cP as de,Y as xe,c0 as Oe,a5 as S,cQ as Ge,cR as Xe,cS as he,bg as He}from"./vendor-ui-CCmu0bzQ.js";import"./vendor-supabase-BfoV2C50.js";import"./use-mobile-DzwrM5_H.js";import"./upgradeBridge-DxSiXl64.js";import"./learningPathsConfig-FXX-qurp.js";const Qe=["","I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII"];function T(s){return Qe[s]??String(s)}function ee(s){if(!s)return!1;const u=(Date.now()-new Date(s).getTime())/864e5;return u>=0&&u<=30}function pe({caderno:s,onClick:u,locked:f=!1}){const j=s.cor_capa||"var(--mono-text)",b=ee(s.publicado_em),h=s.tipo==="guia",p=_(s),x=B(s),m=(s.anos??[]).filter(Boolean).sort((i,d)=>i-d),v=m.length===0?null:m.length===1?String(m[0]):`${m[0]}â${m[m.length-1]}`,t=[...(s.modalidades??[]).slice(0,4),...v?[v]:[]];return e.jsxs("button",{type:"button",onClick:u,"aria-label":h?[s.titulo,s.edicao].filter(Boolean).join(", "):p?`${s.titulo}, volume ${s.volume}, ${P} casos com imagem real`:`${s.especialidade}, volume ${s.volume}, ${s.n_questoes} questões`,className:w("mono-card-surface text-left flex flex-col group relative overflow-hidden","transition-colors duration-200 hover:bg-[color:var(--mono-elevated)]","focus:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--mono-hairline-strong)]"),children:[e.jsxs(Z,{caderno:s,className:"w-full",children:[!h&&e.jsxs("span",{className:"absolute top-2 left-2 px-2 py-0.5 text-[11px] font-semibold uppercase tracking-[0.14em] bg-black/60 text-white rounded-sm",children:["Vol. ",T(s.volume)]}),f&&e.jsxs("span",{className:"absolute top-2 right-2 inline-flex items-center gap-1 px-2 py-0.5 text-[11px] font-semibold uppercase tracking-[0.14em] bg-black/70 text-white rounded-sm",children:[e.jsx(K,{className:"h-2.5 w-2.5",strokeWidth:2,"aria-hidden":!0})," Pro"]}),!f&&s.is_amostra&&e.jsx("span",{className:"absolute top-2 right-2 px-2 py-0.5 text-[11px] font-semibold uppercase tracking-[0.14em] bg-white text-black rounded-sm",children:"Amostra grátis"}),!f&&!s.is_amostra&&(b||s.versao>1)&&e.jsx("span",{className:"absolute top-2 right-2 px-2 py-0.5 text-[11px] font-semibold uppercase tracking-[0.14em] bg-white text-black rounded-sm",children:b?"Novo":`v${s.versao}`}),s.ja_baixei&&e.jsx("span",{className:"absolute bottom-2 right-2 h-6 w-6 rounded-full bg-black/60 flex items-center justify-center",children:e.jsx(ge,{className:"h-3.5 w-3.5 text-white",strokeWidth:1.8,"aria-hidden":!0})})]}),e.jsxs("div",{className:"border-t-2 p-4 flex flex-col gap-2 flex-1",style:{borderTopColor:j},children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-mono-muted",children:h?s.edicao??"Guia de bolso":s.especialidade}),e.jsx("h3",{className:"font-display text-base text-mono leading-tight mt-0.5",children:h||p?s.titulo:`Volume ${T(s.volume)}`})]}),e.jsx("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-mono-muted tabular-nums",children:p?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx($,{className:"h-3 w-3",strokeWidth:1.6,"aria-hidden":!0}),s.paginas??56," páginas"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(M,{className:"h-3 w-3",strokeWidth:1.6,"aria-hidden":!0}),P," casos com imagem real"]})]}):h?e.jsxs(e.Fragment,{children:[s.paginas!=null&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx($,{className:"h-3 w-3",strokeWidth:1.6,"aria-hidden":!0}),s.paginas," páginas"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Ee,{className:"h-3 w-3",strokeWidth:1.6,"aria-hidden":!0}),"Consulta rápida"]})]}):x?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(I,{className:"h-3 w-3",strokeWidth:1.6,"aria-hidden":!0}),s.n_questoes," questões"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(M,{className:"h-3 w-3",strokeWidth:1.6,"aria-hidden":!0}),s.n_com_imagem," com imagem"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(je,{className:"h-3 w-3",strokeWidth:1.6,"aria-hidden":!0}),s.n_flashcards," flashcards"]})]}):null}),t.length>0&&e.jsx("div",{className:"mt-auto flex flex-wrap items-center gap-1.5 pt-1",children:t.map(i=>e.jsx("span",{className:"chip-mono !text-[11px] !py-0.5",children:i},i))})]})]})}
1function Je({caderno:s,locked:u=!1,onClick:f}){const j=s.tipo==="guia",h=_(s)?`${s.paginas??56} páginas · ${P} casos com imagem real`:j?`${s.paginas??"â"} páginas · Consulta rápida`:`${s.n_questoes} questões · ${s.n_flashcards} flashcards`;return e.jsxs(c,{type:"button",variant:"ghost",onClick:f,className:"group h-auto w-full justify-start gap-4 rounded-sm border-b border-[color:var(--mono-hairline)] px-2 py-3 text-left hover:bg-[color:var(--mono-elevated)]",children:[e.jsx(Z,{caderno:s,className:"w-14 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-[11px] uppercase tracking-[0.14em] text-mono-muted",children:j?s.edicao??"Guia de bolso":`${s.especialidade} · Volume ${T(s.volume)}`}),e.jsx("span",{className:"mt-1 block truncate font-display text-base text-mono",children:s.titulo}),e.jsxs("span",{className:"mt-1 flex items-center gap-1.5 text-xs font-normal text-mono-muted",children:[B(s)?e.jsx(I,{className:"h-3 w-3","aria-hidden":!0}):e.jsx($,{className:"h-3 w-3","aria-hidden":!0}),h]})]}),e.jsxs("span",{className:"flex shrink-0 items-center gap-2 text-[11px] font-normal text-mono-muted",children:[ee(s.publicado_em)&&e.jsx("span",{className:"chip-mono",children:"Novo"}),s.ja_baixei&&e.jsx(ge,{className:"h-4 w-4","aria-label":"Já baixado"}),u&&e.jsx(K,{className:"h-4 w-4","aria-label":"Plano Pro"})]})]})}function Y(s){return s?`${(s/1048576).toLocaleString("pt-BR",{maximumFractionDigits:1})} MB`:"â"}function Ue({caderno:s,onOpenChange:u,locked:f=!1}){var v;const j=Te(),{openPlans:b}=ue();s!=null&&s.cor_capa;const h=async()=>{if(s)try{const{url:t}=await j.mutateAsync(s.id),i=document.createElement("a");i.href=t,i.target="_blank",i.rel="noopener,noreferrer",document.body.appendChild(i),i.click(),i.remove(),re.success("Download liberado",{description:s.titulo})}catch(t){re.error("Não foi possÃvel baixar",{description:t instanceof Error?t.message:"Erro desconhecido."})}},p=((s==null?void 0:s.anos)??[]).filter(Boolean).sort((t,i)=>t-i),x=(s==null?void 0:s.tipo)==="guia",m=s?_(s):!1;return e.jsx(ze,{open:!!s,onOpenChange:u,children:e.jsx(Ve,{className:"landing-mono surface-mono w-full sm:max-w-md overflow-y-auto pb-24 border-l border-[color:var(--mono-hairline)]",children:s&&e.jsxs(e.Fragment,{children:[e.jsx(Ae,{className:"text-left",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(Z,{caderno:s,className:"w-[132px] shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(Le,{className:"font-display text-xl text-mono leading-tight",children:x||m?s.titulo:s.especialidade}),e.jsx("div",{className:"font-display text-mono-muted",children:x?s.edicao??"Guia de bolso":`Volume ${T(s.volume)}`}),e.jsxs(Be,{className:"text-mono-muted text-xs mt-1",children:[x?`Consulta rápida · Versão ${s.versao}`:m?`PDF 16:9 para tela · Versão ${s.versao}`:`${s.edicao?`${s.edicao} · `:""}Versão ${s.versao}`,ee(s.publicado_em)?" · Novo":""]}),!x&&(((v=s.modalidades)==null?void 0:v.length)||p.length>0)&&e.jsxs("div",{className:"mt-3 flex flex-wrap gap-1.5",children:[(s.modalidades??[]).map(t=>e.jsx("span",{className:"chip-mono !text-[11px]",children:t},t)),p.length>0&&e.jsxs("span",{className:"chip-mono !text-[11px]",children:[p[0],p.length>1?`â${p[p.length-1]}`:""]})]})]})]})}),e.jsx("dl",{className:"mt-6 grid grid-cols-2 gap-px bg-[color:var(--mono-hairline)] border hairline text-xs",children:(m?[{icon:$,label:"Páginas",value:s.paginas??56},{icon:M,label:"Casos com imagem",value:P},{icon:U,label:"Tamanho",value:Y(s.bytes)},{icon:I,label:"Formato",value:"PDF 16:9"},{icon:L,label:"Downloads",value:s.downloads}]:x?[{icon:$,label:"Páginas",value:s.paginas??"â"},{icon:U,label:"Tamanho",value:Y(s.bytes)},{icon:L,label:"Downloads",value:s.downloads},{icon:I,label:"Formato",value:"PDF A5"}]:[{icon:I,label:"Questões",value:s.n_questoes},{icon:M,label:"Com imagem",value:s.n_com_imagem},{icon:je,label:"Flashcards",value:s.n_flashcards},{icon:$,label:"Páginas",value:s.paginas??"â"},{icon:U,label:"Tamanho",value:Y(s.bytes)},{icon:L,label:"Downloads",value:s.downloads}]).map(({icon:t,label:i,value:d})=>e.jsxs("div",{className:"mono-card-surface p-3",children:[e.jsxs("dt",{className:"flex items-center gap-1.5 text-[11px] uppercase tracking-[0.12em] text-mono-muted",children:[e.jsx(t,{className:"h-3 w-3",strokeWidth:1.6,"aria-hidden":!0}),i]}),e.jsx("dd",{className:"mt-1 text-mono tabular-nums",children:d})]},i))}),!x&&s.topicos&&s.topicos.length>0&&e.jsxs("div",{className:"mt-5",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-mono-muted mb-2",children:"Tópicos"}),e.jsx("ul",{className:"text-xs text-mono-muted space-y-1",children:s.topicos.map(t=>e.jsx("li",{className:"hairline-b pb-1",children:t},t))})]}),e.jsxs("div",{className:"mt-6 sticky bottom-0 pt-4 pb-2 bg-[color:var(--mono-bg)]",children:[f?e.jsxs(e.Fragment,{children:[e.jsxs(F,{variant:"primary",onClick:()=>b("cadernos_full"),className:"w-full justify-center",children:[e.jsx(K,{className:"h-4 w-4 mr-2"})," Desbloquear com um plano"]}),e.jsx("p",{className:"mt-2 text-[11px] text-mono-muted text-center",children:"Materiais marcados como amostra grátis seguem disponÃveis no plano gratuito."})]}):e.jsx(F,{variant:"primary",onClick:h,disabled:j.isPending,className:"w-full justify-center",children:j.isPending?e.jsxs(e.Fragment,{children:[e.jsx(Re,{className:"h-4 w-4 mr-2 animate-spin"})," Gerando linkâ¦"]}):e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"h-4 w-4 mr-2"})," Baixar PDF"]})}),s.ja_baixei&&e.jsx("p",{className:"mt-2 text-[11px] text-mono-muted text-center",children:"Você já baixou este material antes."})]})]})})})}function js(){const{cadernos:s,taxonomia:u,isLoading:f,error:j,refetch:b}=We(),h=qe(s,u),{can:p}
1=ue(),x=p("cadernos_full"),[m,v]=n.useState(""),[t,i]=n.useState([]),[d,W]=n.useState([]),[k,q]=n.useState(!1),[y,E]=n.useState(!1),[z,fe]=n.useState("recentes"),[R,be]=n.useState(()=>{try{return localStorage.getItem("cadernos-view-mode")==="lista"?"lista":"capas"}catch{return"capas"}}),[O,D]=n.useState(null),[se,ve]=ke(),r=se.get("colecao")==="imagem",g=n.useMemo(()=>s.filter(a=>r?_(a):!_(a)),[s,r]),ae=n.useMemo(()=>s.filter(B).length,[s]),te=n.useMemo(()=>s.filter(_).length,[s]),G=se.get("esp"),X=n.useRef(!1);n.useEffect(()=>{if(X.current||r||!G||g.length===0)return;const a=Array.from(new Set(g.filter(l=>l.code===G).map(l=>l.especialidade)));X.current=!0,a.length>0&&i(a)},[G,g,r]);const Ne=n.useMemo(()=>{const a=new Map;return g.forEach(l=>{a.has(l.especialidade)||a.set(l.especialidade,l.cor_capa||"var(--mono-text)")}),Array.from(a.entries()).map(([l,o])=>({nome:l,cor:o}))},[g]),le=n.useMemo(()=>{const a=new Set;return g.forEach(l=>(l.modalidades??[]).forEach(o=>o&&a.add(o))),Array.from(a).sort()},[g]),C=n.useMemo(()=>{const a=m.trim().toLowerCase();return g.filter(o=>!(t.length>0&&!t.includes(o.especialidade)||d.length>0&&!(o.modalidades??[]).some(N=>d.includes(N))||k&&B(o)&&!(o.n_questoes>0&&o.n_com_imagem===o.n_questoes)||y&&o.ja_baixei||a&&![o.especialidade,o.titulo,o.edicao??"",...o.modalidades??[],...o.topicos??[]].join(" ").toLowerCase().includes(a))).sort((o,N)=>z==="baixados"?N.downloads-o.downloads:z==="az"?o.titulo.localeCompare(N.titulo,"pt-BR"):new Date(N.publicado_em??0).getTime()-new Date(o.publicado_em??0).getTime())},[g,t,d,k,y,m,z]),V=(a,l,o)=>l(a.includes(o)?a.filter(N=>N!==o):[...a,o]),H=!!m||t.length>0||d.length>0||k||y,oe=t.length+d.length+Number(k)+Number(y),we=n.useMemo(()=>h.map(a=>({...a,itens:C.filter(l=>l.code===a.code)})).filter(a=>a.itens.length>0),[h,C]),ie=a=>{be(a);try{localStorage.setItem("cadernos-view-mode",a)}catch{}},A=()=>{v(""),i([]),W([]),q(!1),E(!1)},ne=a=>{A(),D(null),X.current=!1,ve(a?{colecao:"imagem"}:{},{replace:!0})},Q=r?"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3":"grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6";return e.jsxs("div",{className:"landing-mono edu-page-min surface-mono",children:[e.jsxs("main",{className:"container mx-auto px-4 md:px-6 py-10 md:py-14 edu-shell",children:[e.jsx(Me,{backTo:"/educacao",kicker:"biblioteca · materiais de estudo",title:e.jsxs(e.Fragment,{children:["Seus ",e.jsx("span",{className:"text-mono-emph",children:"materiais"})]}),subtitle:"Cadernos para imprimir e apostilas de imagem para estudar na tela.",className:"mb-6"}),e.jsxs("nav",{"aria-label":"Linha editorial",className:"mb-8 grid grid-cols-1 gap-3 sm:grid-cols-2",children:[e.jsx(c,{type:"button",variant:"outline","aria-current":r?void 0:"page",onClick:()=>ne(!1),className:w("h-auto min-h-32 items-start justify-start rounded-sm border p-5 text-left transition-colors",r?"border-[color:var(--mono-hairline)] bg-transparent text-mono hover:bg-[color:var(--mono-elevated)]":"border-[color:var(--mono-text)] bg-[color:var(--mono-text)] text-invert-mono hover:bg-[color:var(--mono-text)]"),children:e.jsxs("span",{className:"flex w-full gap-4",children:[e.jsx(I,{className:"mt-0.5 h-5 w-5 shrink-0",strokeWidth:1.5,"aria-hidden":!0}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsxs("span",{className:"flex items-start justify-between gap-3",children:[e.jsx("span",{className:"font-display text-xl leading-tight",children:"Cadernos de Estudo"}),!r&&e.jsx("span",{className:"text-[10px] uppercase tracking-[0.14em] opacity-70",children:"Selecionado"})]}),e.jsxs("span",{className:"mt-2 block text-xs opacity-75",children:[ae," ",ae===1?"volume":"volumes"," · PDF A5 para imprimir"]}),e.jsx("span",{className:"mt-1 block text-sm",children:"8 questões do CBR comentadas"})]})]})}),e.jsx(c,{type:"button",variant:"outline","aria-current":r?"page":void 0,onClick:()=>ne(!0),className:w("h-auto min-h-32 items-start justify-start rounded-sm border p-5 text-left transition-colors",r?"border-[color:var(--mono-text)] bg-[color:var(--mono-text)] text-invert-mono hover:bg-[color:var(--mono-text)]":"border-[color:var(--mono-h
1airline)] bg-transparent text-mono hover:bg-[color:var(--mono-elevated)]"),children:e.jsxs("span",{className:"flex w-full gap-4",children:[e.jsx(de,{className:"mt-0.5 h-5 w-5 shrink-0",strokeWidth:1.5,"aria-hidden":!0}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsxs("span",{className:"flex items-start justify-between gap-3",children:[e.jsx("span",{className:"font-display text-xl leading-tight",children:"Apostilas de Imagem"}),r&&e.jsx("span",{className:"text-[10px] uppercase tracking-[0.14em] opacity-70",children:"Selecionada"})]}),e.jsxs("span",{className:"mt-2 block text-xs opacity-75",children:[te," ",te===1?"volume":"volumes"," · PDF 16:9 para tela"]}),e.jsxs("span",{className:"mt-1 block text-sm",children:[P," casos com imagem real"]})]})]})})]}),g.length>0&&e.jsxs("div",{className:"sticky top-0 z-20 -mx-4 mb-8 border-y border-[color:var(--mono-hairline)] bg-[color:var(--mono-bg)]/95 px-4 py-3 backdrop-blur md:mx-0 md:px-0",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(xe,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-mono-muted",strokeWidth:1.5}),e.jsx(ye,{value:m,onChange:a=>v(a.target.value),placeholder:"Buscar por especialidade ou tópico...",className:"pl-9 h-9 rounded-sm bg-transparent border-[color:var(--mono-hairline)]"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Ce,{children:[e.jsx(Se,{asChild:!0,children:e.jsxs(c,{variant:"outline",size:"sm",className:"h-9 rounded-sm border-[color:var(--mono-hairline)] bg-transparent text-mono",children:[e.jsx(Oe,{className:"mr-2 h-4 w-4"})," Filtros",oe>0&&e.jsx("span",{className:"ml-2 chip-mono",children:oe})]})}),e.jsx(_e,{align:"end",className:"landing-mono surface-mono w-[min(22rem,calc(100vw-2rem))] rounded-sm border-[color:var(--mono-hairline)] p-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"mb-2 text-[11px] uppercase tracking-[0.14em] text-mono-muted",children:"Especialidades"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:Ne.map(({nome:a,cor:l})=>e.jsxs(c,{type:"button",variant:"outline",size:"sm",onClick:()=>V(t,i,a),className:w("h-7 rounded-sm px-2 text-[11px]",t.includes(a)&&"border-[color:var(--mono-text)]"),children:[e.jsx("span",{className:"mr-1.5 h-2 w-2 rounded-full",style:{backgroundColor:l}}),a]},a))})]}),le.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"mb-2 text-[11px] uppercase tracking-[0.14em] text-mono-muted",children:"Modalidades"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:le.map(a=>e.jsx(c,{type:"button",variant:"outline",size:"sm",onClick:()=>V(d,W,a),className:w("h-7 rounded-sm px-2 text-[11px]",d.includes(a)&&"border-[color:var(--mono-text)]"),children:a},a))})]}),e.jsxs("div",{className:"space-y-3 border-t border-[color:var(--mono-hairline)] pt-3",children:[!r&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(me,{htmlFor:"so-imagem",className:"text-xs text-mono-muted",children:"Só com imagem"}),e.jsx(ce,{id:"so-imagem",checked:k,onCheckedChange:q})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(me,{htmlFor:"nao-baixados",className:"text-xs text-mono-muted",children:"Não baixados"}),e.jsx(ce,{id:"nao-baixados",checked:y,onCheckedChange:E})]})]}),H&&e.jsxs(c,{variant:"ghost",size:"sm",onClick:A,className:"w-full rounded-sm",children:[e.jsx(S,{className:"mr-2 h-3.5 w-3.5"})," Limpar tudo"]})]})})]}),e.jsxs($e,{value:z,onValueChange:a=>fe(a),children:[e.jsx(Ie,{className:"h-9 w-[132px] rounded-sm border-[color:var(--mono-hairline)] bg-transparent text-xs",children:e.jsx(De,{})}),e.jsxs(Fe,{children:[e.jsx(J,{value:"recentes",children:"Recentes"}),e.jsx(J,{value:"baixados",children:"Mais baixados"}),e.jsx(J,{value:"az",children:"AâZ"})]})]}),e.jsxs("div",{className:"flex h-9 items-center border border-[color:var(--mono-hairline)] rounded-sm",children:[e.jsx(c,{variant:"ghost",size:"icon","aria-label":"Visualização em capas",onClick:()=>ie("capas"),className:w("h-8 w-8 rounded-none",R==="capas"&&"bg-[color:var(--mono-elevated)]"),children:e.jsx(Ge,{className:"h-4 w-4"})}),e.jsx(c,{variant:"ghost",size:"icon","aria-label":"Visualização em lista",onClick:()=>ie("lista"),className:w("h-8 w-8 rounded-none",R==="lista"&&"bg-[color:var(--mono-elevated)]"),children:e.jsx(Xe,{className:"h-4 w-4"})})]})]})]}),(t.length>0||d.length>0||k||y)&&e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[t.map(a=>e.jsxs(c,{variant:"outline",size:"sm",onClick:()=>V(t,i,a),className:"h-7 rounded-sm px-2 text-[11px]","aria-label":`Remover filtro ${a}`,children:[a," ",e.jsx(S,{className:"ml-1.5 h-3 w-3"})]},`esp-${a}`)),d.map(a=>e.jsxs(c,{variant:"outline",size:"sm",onClick:()=>V(d,W,a),className:"h-7 rounded-sm px-2 text-[11px]","aria-label":`Remover filtro ${a}`,children:[a," ",e.jsx(S,{className:"ml-1.5 h-3 w-3"})]},`mod-${a}
1`)),k&&e.jsxs(c,{variant:"outline",size:"sm",onClick:()=>q(!1),className:"h-7 rounded-sm px-2 text-[11px]","aria-label":"Remover filtro só com imagem",children:["Só com imagem ",e.jsx(S,{className:"ml-1.5 h-3 w-3"})]}),y&&e.jsxs(c,{variant:"outline",size:"sm",onClick:()=>E(!1),className:"h-7 rounded-sm px-2 text-[11px]","aria-label":"Remover filtro não baixados",children:["Não baixados ",e.jsx(S,{className:"ml-1.5 h-3 w-3"})]})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between text-xs text-mono-muted",children:[e.jsxs("span",{"aria-live":"polite",children:[C.length," ",C.length===1?"resultado":"resultados"]}),H&&e.jsxs(c,{variant:"ghost",size:"sm",onClick:A,className:"h-7 rounded-sm px-2",children:[e.jsx(S,{className:"mr-1 h-3.5 w-3.5"})," Limpar"]})]})]}),j?e.jsxs("div",{className:"border hairline rounded-sm py-16 px-6 text-center",children:[e.jsx(he,{className:"h-8 w-8 mx-auto text-mono-muted",strokeWidth:1.3,"aria-hidden":!0}),e.jsx("h2",{className:"font-display text-lg text-mono mt-4",children:"Não foi possÃvel carregar os cadernos"}),e.jsx("p",{className:"text-sm text-mono-muted mt-2",children:"Verifique sua conexão e tente novamente."}),e.jsx(F,{variant:"outline",onClick:()=>b(),className:"mt-4",children:"Tentar de novo"})]}):f?e.jsx("div",{className:Q,children:Array.from({length:12}).map((a,l)=>e.jsx(Pe,{className:w(r?"aspect-video":"aspect-[148/210]","w-full rounded-sm")},l))}):g.length===0?e.jsxs("div",{className:"border hairline rounded-sm py-16 px-6 text-center",children:[r?e.jsx(de,{className:"h-8 w-8 mx-auto text-mono-muted",strokeWidth:1.3,"aria-hidden":!0}):e.jsx(he,{className:"h-8 w-8 mx-auto text-mono-muted",strokeWidth:1.3,"aria-hidden":!0}),e.jsx("h2",{className:"font-display text-lg text-mono mt-4",children:r?"Nenhuma apostila disponÃvel agora":"Nenhum caderno disponÃvel agora"}),e.jsx("p",{className:"text-sm text-mono-muted mt-2 max-w-md mx-auto",children:"Se você acabou de receber a novidade, atualize a lista para buscar os tÃtulos mais recentes."}),e.jsx(F,{variant:"outline",onClick:()=>b(),className:"mt-4",children:"Atualizar lista"})]}):C.length===0?e.jsxs("div",{className:"border hairline rounded-sm py-16 px-6 text-center",children:[e.jsx(xe,{className:"h-8 w-8 mx-auto text-mono-muted",strokeWidth:1.3,"aria-hidden":!0}),e.jsx("h2",{className:"font-display text-lg text-mono mt-4",children:"Nada encontrado"}),e.jsx("p",{className:"text-sm text-mono-muted mt-2",children:"Ajuste os filtros para ver mais cadernos."}),e.jsx(F,{variant:"outline",onClick:A,className:"mt-4",children:"Limpar filtros"})]}):R==="lista"?e.jsx("div",{className:"border-y border-[color:var(--mono-hairline)]",children:C.map(a=>e.jsx(Je,{caderno:a,locked:!x&&!a.is_amostra,onClick:()=>D(a)},a.id))}):!H&&!r?e.jsx("div",{className:"space-y-10",children:we.map(a=>e.jsxs("section",{"aria-labelledby":`estante-${a.code}`,children:[e.jsxs("div",{className:"mb-3 flex items-end justify-between border-b border-[color:var(--mono-hairline)] pb-2",children:[e.jsxs("div",{children:[e.jsx("h2",{id:`estante-${a.code}`,className:"font-display text-xl text-mono",children:a.nome}),e.jsxs("p",{className:"mt-0.5 text-xs text-mono-muted",children:[a.baixados," de ",a.total," baixados"]})]}),e.jsxs(c,{variant:"ghost",size:"sm","aria-label":`Ver todos os cadernos de ${a.nome}`,onClick:()=>{i([a.nome]),window.scrollTo({top:0,behavior:"smooth"})},className:"rounded-sm text-xs",children:["Ver todos ",e.jsx(He,{className:"ml-1 h-3.5 w-3.5"})]})]}),e.jsx("div",{className:Q,children:a.itens.slice(0,6).map(l=>e.jsx(pe,{caderno:l,locked:!x&&!l.is_amostra,onClick:()=>D(l)},l.id))})]},a.code))}):e.jsx("div",{className:Q,children:C.map(a=>e.jsx(pe,{caderno:a,locked:!x&&!a.is_amostra,onClick:()=>D(a)},a.id))})]}),e.jsx(Ue,{caderno:O,locked:!!O&&!x&&!O.is_amostra,onOpenChange:a=>!a&&D(null)})]})}export{js 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.