1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-B_rs4EbN.js","assets/vendor-DG5Dz7Ik.js","assets/vendor-D7xgM-_k.css","assets/RigorLevelSelector-Dgu3Ne0H.js","assets/consensusService-B6FnfUxf.js","assets/view-analytics-BkPD6vG9.js","assets/pdf-vendor-BQyayL6K.js","assets/socket-vendor-DENoLIvz.js","assets/auth-vendor-CeReGQmr.js"])))=>i.map(i=>d[i]); 2import{j as e,r as a,R as A}from"./vendor-DG5Dz7Ik.js";import{_ as G}from"./pdf-vendor-BQyayL6K.js";import{l as I,d as q}from"./consensusService-B6FnfUxf.js";import"./view-analytics-BkPD6vG9.js";import"./socket-vendor-DENoLIvz.js";import"./auth-vendor-CeReGQmr.js";const H=[{value:"",label:"All task types"},{value:"content_generation",label:"Content Generation"},{value:"reasoning",label:"Reasoning"},{value:"analytics_narration",label:"Analytics Narration"},{value:"chat",label:"Chat"},{value:"code_generation",label:"Code Generation"},{value:"summarization",label:"Summarization"}];function K({values:t,onChange:n,onSearch:o,onClear:i}){function l(r,c){n({...t,[r]:c})}function d(r){r.key==="Enter"&&o()}return e.jsxs("div",{className:"flex flex-wrap items-center gap-3 bg-gray-800 rounded-lg p-3",children:[e.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[e.jsx("label",{className:"text-xs text-gray-400 font-medium",htmlFor:"ch-date-from",children:"From"}),e.jsx("input",{id:"ch-date-from",type:"date",value:t.dateFrom,onChange:r=>l("dateFrom",r.target.value),className:"bg-gray-700 border border-gray-600 text-white text-sm rounded px-2 py-1.5 focus:outline-none focus:border-indigo-500 transition"})]}),e.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[e.jsx("label",{className:"text-xs text-gray-400 font-medium",htmlFor:"ch-date-to",children:"To"}),e.jsx("input",{id:"ch-date-to",type:"date",value:t.dateTo,onChange:r=>l("dateTo",r.target.value),className:"bg-gray-700 border border-gray-600 text-white text-sm rounded px-2 py-1.5 focus:outline-none focus:border-indigo-500 transition"})]}),e.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[e.jsx("label",{className:"text-xs text-gray-400 font-medium",htmlFor:"ch-task-type",children:"Task type"}),e.jsx("select",{id:"ch-task-type",value:t.taskType,onChange:r=>l("taskType",r.target.value),className:"bg-gray-700 border border-gray-600 text-white text-sm rounded px-2 py-1.5 focus:outline-none focus:border-indigo-500 transition",children:H.map(r=>e.jsx("option",{value:r.value,children:r.label},r.value))})]}),e.jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-40",children:[e.jsx("label",{className:"text-xs text-gray-400 font-medium",htmlFor:"ch-keyword",children:"Keyword"}),e.jsx("input",{id:"ch-keyword",type:"text",placeholder:"Search prompt textâ¦",value:t.keyword,onChange:r=>l("keyword",r.target.value),onKeyDown:d,className:"bg-gray-700 border border-gray-600 text-white text-sm rounded px-2 py-1.5 focus:outline-none focus:border-indigo-500 transition placeholder-gray-500"})]}),e.jsxs("div",{className:"flex items-end gap-2 pb-0.5",children:[e.jsx("button",{onClick:o,className:"px-3 py-1.5 bg-indigo-600 hover:bg-indigo-500 text-white text-sm font-medium rounded transition",children:"Search"}),e.jsx("button",{onClick:i,className:"px-3 py-1.5 bg-gray-700 hover:bg-gray-600 text-gray-300 text-sm font-medium rounded transition",children:"Clear"})]})]})}const O={approved:"bg-green-900/50 text-green-300 border border-green-700/50",rejected:"bg-red-900/50 text-red-300 border border-red-700/50",revised:"bg-yellow-900/50 text-yellow-300 border border-yellow-700/50",modified:"bg-yellow-900/50 text-yellow-300 border border-yellow-700/50",deadlocked:"bg-orange-900/50 text-orange-300 border border-orange-700/50"},U={quick:"bg-blue-900/40 text-blue-300",standard:"bg-purple-900/40 text-purple-300",tribunal:"bg-red-900/40 text-red-300"};function z(t){return t.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function Y(t){return{google:"Gemini",anthropic:"Claude",openai:"GPT",xai:"Grok",openrouter:"OpenRouter"}[t.toLowerCase()]??t}function $({decision:t,onClick:n}){const o=t.judgeRuling,i=o?o.charAt(0).toUpperCase()+o.slice(1):t.status==="in_progress"?"In Progress":t.status==="pending"?"Pending":"Unknown",l=o!=null?O[o]??"bg-gray-700 text-gray-300":"bg-gray-700 text-gray-400",d=U[t.rigorLevel]??"bg-gray-700 text-gray-300",r=new Date(t.createdAt).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});return e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>n(t.id),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&n(t.id)},className:"bg-gray-800 rounded-lg border border-gray-700 p-4 cursor-pointer hover:border-gray-500 transition-colors",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:[e.jsx("span",{className:"px-2 py-0.5 text-xs font-medium rounded bg-gray-700 text-gray-200",children:z(t.taskType)}),e.jsx("span",{className:`px-2 py-0.5 text-xs font-medium rounded ${d}`,children:t.rigorLevel.charAt(0).toUpperCase()+t.rigorLevel.slice(1)}),e.jsx("span",{className:`ml-auto px-2.5 py-0.5 text-xs font-semibold rounded-full ${l}`,children:i})]}),e.jsx("p",{className:"text-sm text-gray-300 line-clamp-2 mb-3 leading-snug",children:t.prompt}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-gray-500",children:[e.jsx("span",{children:r}),e.jsx("span",{children:"·"}),e.jsx("span",{children:Y(t.generatorProvider)}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[t.rounds," round",t.rounds!==1?"s":""]}),t.deadlocked&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{className:"text-orange-400 font-medium",children:"Deadlock"})]})]})]})}const B=A.lazy(()=>G(()=>import("./index-B_rs4EbN.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(t=>({default:t.ConsensusDebatePanel}))),g={dateFrom:"",dateTo:"",taskType:"",keyword:""},M=20;function te({projectId:t}){return e.jsx(V,{projectId:t},t??"workspace")}function V({projectId:t}
2){const[n,o]=a.useState(g),[i,l]=a.useState(g),[d,r]=a.useState([]),[c,k]=a.useState(0),[N,C]=a.useState(!1),[v,T]=a.useState(null),[S,y]=a.useState(null),[D,p]=a.useState(null),[L,_]=a.useState(!1),h=a.useRef(0),u=a.useRef(0),w=a.useCallback(async(s,x=0)=>{const f=++h.current;++u.current,r([]),k(0),y(null),p(null),C(!0),T(null);try{const E=await I({...t?{projectId:t}:{},...s.taskType?{taskType:s.taskType}:{},limit:M,offset:x});if(f!==h.current)return;let m=E.items;if(s.keyword.trim()){const b=s.keyword.trim().toLowerCase();m=m.filter(j=>j.prompt.toLowerCase().includes(b))}if(s.dateFrom){const b=new Date(s.dateFrom).getTime();m=m.filter(j=>new Date(j.createdAt).getTime()>=b)}if(s.dateTo){const b=new Date(s.dateTo).getTime()+864e5;m=m.filter(j=>new Date(j.createdAt).getTime()<=b)}r(m),k(E.total)}catch{f===h.current&&T("Failed to load consensus history.")}finally{f===h.current&&C(!1)}},[t]);a.useEffect(()=>(w(g),()=>{++h.current,++u.current}),[w]);function F(){l(n),w(n)}function R(){o(g),l(g),w(g)}async function P(s){const x=++u.current;if(S===s){y(null),p(null);return}y(s),p(null),_(!0);try{const f=await q(s);if(x!==u.current)return;p(f)}catch{x===u.current&&y(null)}finally{x===u.current&&_(!1)}}return e.jsxs("div",{className:"p-6 space-y-4","data-tour":"consensus-history",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("h2",{className:"text-lg font-semibold text-white",children:["Consensus History",c>0&&e.jsxs("span",{className:"ml-2 text-sm font-normal text-gray-400",children:["(",c,")"]})]})}),e.jsx(K,{values:n,onChange:o,onSearch:F,onClear:R}),v!=null&&e.jsx("div",{className:"rounded-lg bg-red-900/30 border border-red-700/50 p-3 text-sm text-red-300",children:v}),N&&e.jsx("div",{className:"text-sm text-gray-400 py-4",children:"Loading decisionsâ¦"}),!N&&!v&&d.length===0&&e.jsxs("div",{className:"text-center py-16 text-gray-500",children:[e.jsx("p",{className:"text-base mb-1",children:"No consensus decisions found."}),e.jsx("p",{className:"text-sm",children:i.keyword||i.taskType||i.dateFrom||i.dateTo?"Try adjusting your filters.":"Run your first evaluation to see history here."})]}),!N&&!v&&d.length>0&&e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3",children:d.map(s=>e.jsx($,{decision:s,onClick:x=>{P(x)}},s.id))}),S!=null&&e.jsxs("div",{className:"mt-4 rounded-xl border border-gray-700 bg-gray-900/60 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-white",children:"Decision Transcript"}),e.jsx("button",{onClick:()=>{++u.current,y(null),p(null)},className:"text-xs text-gray-400 hover:text-white transition",children:"Close â"})]}),L&&e.jsx("div",{className:"text-sm text-gray-400 py-4",children:"Loading transcriptâ¦"}),!L&&D!=null&&e.jsx(a.Suspense,{fallback:e.jsx("div",{className:"text-sm text-gray-400 py-4",children:"Loading debate panelâ¦"}),children:e.jsx(B,{decision:D})})]})]})}export{$ as ConsensusHistoryCard,K as ConsensusHistoryFilters,te as ConsensusHistoryPage};
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.