1"use strict";(self.webpackChunksyllabyte_app=self.webpackChunksyllabyte_app||[]).push([[5803],{75803:(e,s,n)=>{n.r(s),n.d(s,{AlignmentResultDisplay:()=>f});var t=n(61421),o=n(80376),i=n(15917),l=n(84596),a=n(95243),c=n(80004),d=n(47070),r=n(99893),m=n(86850),u=n(51341),h=n(90393);const p=e=>{const{alignment:s,hideConfidence:n,hideJustification:t,focusMode:o,onAddAlignment:i,onDeleteAlignment:a}=e;return(0,h.jsxs)("div",{className:"mb-4 p-4 bg-white rounded-lg shadow border border-gray-200",children:[s.outcome&&(0,h.jsx)(u.L$,{hideBottomBorder:!0,focusMode:o,outcome:s.outcome}),(0,h.jsx)("hr",{className:"mt-2 mb-4"}),(0,h.jsxs)("div",{className:(0,r.$)("flex flex-row items-start",t?"":"mt-4"),children:[!n&&void 0!==s.confidence&&(0,h.jsx)(m._,{confidence:s.confidence,isControversial:s.isControversial,size:"md",className:"mr-2"}),(0,h.jsx)("p",{className:"px-2 flex-1",children:!t&&(0,h.jsx)("span",{className:"",children:s.justification})}),(0,h.jsxs)("div",{children:[i&&(0,h.jsx)(l.$,{variant:"round",onClick:()=>i(s),children:(0,h.jsx)(c.A,{className:"h-5 w-5"})}),a&&(0,h.jsx)(l.$,{variant:"round",onClick:()=>a(s),children:(0,h.jsx)(d.A,{className:"h-5 w-5"})})]})]})]})};var x=n(45692);const f=e=>{var s,n,c;let{data:d,serviceKey:r,serviceLabel:m,resultConfig:u}=e;const[f,v]=(0,i.useState)(!1),[y,g]=(0,i.useState)(0),j=e=>e?Array.isArray(e)?e.filter(e=>null!=e&&"object"===typeof e):"object"!==typeof e||!e.outcome&&void 0===e.confidence?"object"===typeof e&&Array.isArray(e.alignments)?e.alignments.filter(e=>null!=e&&"object"===typeof e):"object"===typeof e&&e.data?j(e.data):[]:[e]:[],b=j(d).filter(e=>"align"===e.suggestionType);const N=b.filter(e=>(e.confidence||0)>=y);return b&&0!==b.length?(0,h.jsxs)("div",{className:"space-y-4",children:[(0,h.jsxs)("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 p-4",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,h.jsxs)("div",{children:[(0,h.jsxs)("h3",{className:"text-lg font-semibold text-syllabyte-navy",children:[m," Results"]}),(0,h.jsxs)("p",{className:"text-sm text-gray-600 mt-1",children:[N.length," of ",b.length," ",1===b.length?"alignment":"alignments"," ",y>0&&`(threshold: ${y.toFixed(2)})`]})]}),(0,h.jsxs)("div",{className:"flex gap-2",children:[(null===u||void 0===u||null===(s=u.downloadFormats)||void 0===s?void 0:s.includes("json"))&&(0,h.jsxs)(l.$,{variant:"greyOutline",onClick:()=>{v(!0);try{const e=JSON.stringify(N,null,2),s=new Blob([e],{type:"application/json;charset=utf-8"});(0,o.saveAs)(s,`syllabyte_${r}_alignments_${Date.now()}.json`)}finally{v(!1)}},disabled:f,className:"flex items-center gap-2",children:[(0,h.jsx)(t.A,{className:"w-4 h-4"}),"Download JSON"]}),(null===u||void 0===u||null===(n=u.downloadFormats)||void 0===n?void 0:n.includes("csv"))&&(0,h.jsxs)(l.$,{variant:"greyOutline",onClick:()=>{v(!0);try{const e=["Confidence","Outcome Code","Outcome Description","Provider","Syllabus","Justification"],s=N.map(e=>{var s,n,t,o,i;return[(null===(s=e.confidence)||void 0===s?void 0:s.toFixed(2))||"0.00",(null===(n=e.outcome)||void 0===n?void 0:n.code)||"",(null===(t=e.outcome)||void 0===t?void 0:t.description)||"",(null===(o=e.outcome)||void 0===o?void 0:o.provider)||"",(null===(i=e.outcome)||void 0===i?void 0:i.syllabus)||"",e.justification||""].map(e=>`"${String(e).replace(/"/g,'""')}"`)}),n=[e.join(","),...s.map(e=>e.join(","))].join("\n"),t=new Blob([n],{type:"text/csv;charset=utf-8"});(0,o.saveAs)(t,`syllabyte_${r}_alignments_${Date.now()}.csv`)}finally{v(!1)}},disabled:f,className:"flex items-center gap-2",children:[(0,h.jsx)(t.A,{className:"w-4 h-4"}),"Download CSV"]}),(null===u||void 0===u||null===(c=u.downloadFormats)||void 0===c?void 0:c.includes("pdf"))&&(0,h.jsxs)(l.$,{variant:"greyOutline",onClick:()=>{v(!0);try{const e=N.map((e,s)=>{const n=[];return void 0!==e.confidence&&n.push(`Confidence: ${Math.round(100*e.confidence)}%`),e.outcome&&(e.outcome.code&&n.push(`Code: ${e.outcome.code}`),e.outcome.description&&n.push(`Description: ${e.outcome.description}`),e.outcome.provider&&n.push(`Provider: ${e.outcome.provider}`),e.outcome.syllabus&&n.push(`Syllabus: ${e.outcome.syllabus}`)),e.justification&&n.push(`Justification: ${e.justification}`),{title:`Alignment ${s+1}`,content:n,headingLevel:"HEADING_2"}});(0,x.a8)(`${m} Alignments`,e,`syllabyte_${r}_alignments`)}finally{v(!1)}},disabled:f,className:"flex items-center gap-2",children:[(0,h.jsx)(t.A,{className:"w-4 h-4"}),"Download Word"]})]})]}),(0,h.jsxs)("div",{className:"flex items-center gap-4",children:[(0,h.jsx)("label",{htmlFor:"confidence-threshold",className:"text-sm font-medium text-gray-700 whitespace-nowrap",children:"Confidence Threshold:"}),(0,h.jsx)("input",{id:"confidence-threshold",type:"range",min:"0",max:"1",step:"0.05",value:y,onChange:e=>g(parseFloat(e.target.value)),className:"flex-1 h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-syllabyte-navy"}),(0,h.jsx)("span",{className:"text-sm font-semibold text-syllabyte-navy min-w-[60px] text-right",children:y.toFixed(2)})]})]}),0===N.length?(0,h.jsx)("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 p-8",children:(0,h.jsx)(a.r,{text:"No alignments meet threshold",description:`No alignments found with confidence >= ${y.toFixed(2)}. Lower the threshold to see more results.`})}):(0,h.jsx)("div",{className:"space-y-4",children:N.map((e,s)=>(0,h.jsx)(p,{alignment:e,focusMode:!0,hideConfidence:!1,hideJustification:!1},e.id||s))})]}):(0,h.jsx)("div",{className:"mt-8",children:(0,h.jsx)(a.r,{text:"No alignments found",description:"The service did not return any outcome alignments. Try adjusting your input or configuration."})})}}}]); 2//# sourceMappingURL=5803.995868b6.chunk.js.map
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.