1import{a as p,u as c,b as x,j as a}from"./vendor-query-skQMsM6X.js";import{r as q}from"./vendor-react-DyYvSSk1.js";import{p as r,ak as f,b as i,c as d}from"./index-BGwtrXIa.js";import"./vendor-supabase-BfoV2C50.js";import"./vendor-ui-CCmu0bzQ.js";function _(){const l=p(),[s,n]=q.useState(null),m=c({queryKey:["autoral-bloqueadas-resumo"],queryFn:async()=>{const{data:e,error:o}=await i.rpc("cbr_autoral_bloqueadas_resumo");if(o)throw o;return e||[]}}),t=c({queryKey:["autoral-bloqueadas",s],queryFn:async()=>{const{data:e,error:o}=await i.rpc("cbr_autoral_bloqueadas",{p_motivo:s,p_limit:50});if(o)throw o;return e||[]}}),u=x({mutationFn:async e=>{const{error:o}=await i.rpc("cbr_autoral_refresh_parent",{p_parent:e});if(o)throw o},onSuccess:()=>{d.success("Bloco reprocessado"),l.invalidateQueries({queryKey:["autoral-bloqueadas"]}),l.invalidateQueries({queryKey:["autoral-bloqueadas-resumo"]})},onError:e=>d.error((e==null?void 0:e.message)??"Falha ao reprocessar")});return a.jsxs("section",{className:"space-y-4",children:[a.jsxs("header",{children:[a.jsx("h2",{className:"text-lg font-bold font-mono",children:"Banco autoral â itens bloqueados"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Questões geradas que não entram para o aluno, com o motivo. Reprocessar recria o bloco inteiro daquela questão de prova."})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsx(r,{size:"sm",variant:s===null?"default":"outline",onClick:()=>n(null),children:"todos"}),(m.data??[]).map(e=>a.jsxs(r,{size:"sm",variant:s===e.motivo_bloqueio?"default":"outline",onClick:()=>n(e.motivo_bloqueio),children:[e.motivo_bloqueio," · ",e.total]},e.motivo_bloqueio))]}),t.isLoading?a.jsx(f,{className:"h-40 w-full"}):a.jsxs("ul",{className:"divide-y rounded-md border",children:[(t.data??[]).map(e=>a.jsxs("li",{className:"flex items-start justify-between gap-4 p-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"text-xs font-mono text-muted-foreground",children:[e.motivo_bloqueio," · item ",e.ordem+1," · ",e.subcategoria??"sem tema"]}),a.jsx("p",{className:"mt-1 line-clamp-2 text-sm",children:e.enunciado||"(sem enunciado)"})]}),a.jsx(r,{size:"sm",variant:"outline",disabled:u.isPending,onClick:()=>u.mutate(e.parent_question_id),children:"reprocessar"})]},e.id)),(t.data??[]).length===0&&a.jsx("li",{className:"p-3 text-sm text-muted-foreground",children:"Nada bloqueado com esse filtro."})]})]})}export{_ 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.