@e-llm-studio/citation 0.0.230 → 0.0.232

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/README.md +47 -0
  2. package/dist/cjs/features/ChatCitation/InternalChatCitationRenderer.js +1 -1
  3. package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
  4. package/dist/cjs/hooks/useOnDemandCitationFetch.js +1 -1
  5. package/dist/cjs/service/onDemandApi.js +1 -1
  6. package/dist/features/ChatCitation/InternalChatCitationRenderer.js +1 -1
  7. package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
  8. package/dist/hooks/useOnDemandCitationFetch.js +1 -1
  9. package/dist/service/onDemandApi.js +1 -1
  10. package/dist/types/src/Spbanalysispaneltest.d.ts +3 -0
  11. package/dist/types/src/Spbanalysispaneltest.d.ts.map +1 -0
  12. package/dist/types/src/features/ChatCitation/InternalChatCitationRenderer.d.ts.map +1 -1
  13. package/dist/types/src/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts.map +1 -1
  14. package/dist/types/src/features/SPBAnalysisPanel/Cognitivereasoningpanel.d.ts +22 -0
  15. package/dist/types/src/features/SPBAnalysisPanel/Cognitivereasoningpanel.d.ts.map +1 -0
  16. package/dist/types/src/features/SPBAnalysisPanel/DependencyGraph.d.ts +37 -0
  17. package/dist/types/src/features/SPBAnalysisPanel/DependencyGraph.d.ts.map +1 -0
  18. package/dist/types/src/features/SPBAnalysisPanel/Internaleditor.d.ts +11 -0
  19. package/dist/types/src/features/SPBAnalysisPanel/Internaleditor.d.ts.map +1 -0
  20. package/dist/types/src/features/SPBAnalysisPanel/Markdownrenderer.d.ts +10 -0
  21. package/dist/types/src/features/SPBAnalysisPanel/Markdownrenderer.d.ts.map +1 -0
  22. package/dist/types/src/features/SPBAnalysisPanel/Spbanalysispanel.d.ts +39 -0
  23. package/dist/types/src/features/SPBAnalysisPanel/Spbanalysispanel.d.ts.map +1 -0
  24. package/dist/types/src/features/SPBAnalysisPanel/index.d.ts +10 -0
  25. package/dist/types/src/features/SPBAnalysisPanel/index.d.ts.map +1 -0
  26. package/dist/types/src/service/onDemandApi.d.ts.map +1 -1
  27. package/package.json +7 -2
package/README.md CHANGED
@@ -39,6 +39,7 @@
39
39
  -[ManageReminders](#ManageReminders) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/ManageRemainders/README.md)
40
40
  - [PromptemonBlockViewer](#promptemonblockviewer) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/PromptemonBlockViewer/PromptemonBlockViewerReadme.md)
41
41
  - [PromptemonViewer](#promptemonviewer) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/PromptemonViewer/PromptemonViewerReadme.md)
42
+ - [SPBAnalysisPanel](#spbanalysispanel) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/SPBAnalysisPanel/SPBAnalysisPanel.md)
42
43
  4. [Common Use Cases](#common-use-cases)
43
44
  5. [Development & Contribution](#development--contribution)
44
45
  6. [License](#license)
@@ -3222,6 +3223,52 @@ import PromptemonViewer from '@e-llm-studio/citation/PromptemonViewer'
3222
3223
  | `showEditMode` | `boolean` | ❌ | `true` | Show/hide the edit pencil icon and edit mode |
3223
3224
  | `showExtractSegments` | `boolean` | ❌ | `true` | Show/hide the Extract Segments button and Show Segments toggle |
3224
3225
 
3226
+
3227
+ ## SPBAnalysisPanel
3228
+
3229
+ ### Overview
3230
+
3231
+ A full-featured interface for reviewing the analysis of a System Prompt Block (SPB). Combines a scrollable left panel — Overview, Functionality, Applicability, Specifications, and Dependency Graph — with an optional persistent Monaco-based right panel for viewing the underlying prompt content. Consumer-controlled — all analysis/data fetching is handled by the consumer.
3232
+
3233
+ ### Features
3234
+
3235
+ - **Overview summary** — Collapsible high-level + detailed summary
3236
+ - **Functionality breakdown** — Nested accordions listing functional areas and their APB references
3237
+ - **Jump-to-code navigation** — Clicking an APB reference highlights that section in the persistent right-side editor
3238
+ - **Applicability** — Side-by-side "When to apply" / "When NOT to apply" panels
3239
+ - **Specifications** — Strict Rules / Input / Output, with automatic `<code>` block extraction in Output
3240
+ - **Dependency Graph** — Interactive, pannable/zoomable graph of APB relationships
3241
+ - **Persistent code panel (optional)** — Dark/light toggle and fullscreen expand, togglable via `showCodePanel`
3242
+ - **Markdown + cognitive decisioning** — Text fields render through a shared markdown renderer supporting citations and expandable "cognitive reasoning" panels
3243
+
3244
+ ### Usage
3245
+
3246
+ ```tsx
3247
+ import SPBAnalysisPanel from '@e-llm-studio/citation/SPBAnalysisPanel'
3248
+
3249
+ <SPBAnalysisPanel
3250
+ promptContent={mySystemPrompt}
3251
+ promptTitle="Persona & Guardrails SPB"
3252
+ isLoading={isLoading}
3253
+ overviewSummary={overviewSummary}
3254
+ functionalityOfSPB={functionalityOfSPB}
3255
+ spbAdditionalInfo={spbAdditionalInfo}
3256
+ showCodePanel={true}
3257
+ />
3258
+ ```
3259
+
3260
+ ### Props
3261
+
3262
+ | Prop Name | Type | Required | Default | Description |
3263
+ |-----------|------|----------|---------|-------------|
3264
+ | `promptContent` | `string` | ✅ | — | Full system prompt text, rendered in the persistent/fullscreen editor |
3265
+ | `promptTitle` | `string` | ❌ | `"SPB Analysis"` | Title shown in the header and code panel top bar |
3266
+ | `isLoading` | `boolean` | ❌ | `false` | Shows skeletons for any section whose data prop is still empty |
3267
+ | `overviewSummary` | `SPBOverviewSummary \| null` | ❌ | — | Overview section content |
3268
+ | `functionalityOfSPB` | `SPBFunctionalityItem[]` | ❌ | `[]` | Functional areas and their APB references |
3269
+ | `spbAdditionalInfo` | `SPBAdditionalInfo \| null` | ❌ | — | Applicability, Specifications, and Dependency Graph content |
3270
+ | `showCodePanel` | `boolean` | ❌ | `true` | Show/hide the persistent right-side editor panel |
3271
+
3225
3272
  ## EmailCitation
3226
3273
 
3227
3274
  A composable React UI component for rendering email-style citations with rich formatting, attachments, and highlight/quote handling. Part of the `@e-llm-studio/citation` package, this component is designed to display email content (subject, sender, recipients, body, attachments, timestamps) in an expandable, accessible, and customizable way.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),l=require("react/jsx-runtime"),i=require("./components/ChatCitation.js"),o=require("./utils/helpers.js"),n=require("./components/Chip.js"),t=require("./assets/message-chat-square.svg.js");require("@mui/icons-material/KeyboardArrowDown"),require("@mui/icons-material/KeyboardArrowUp"),require("@mui/icons-material/Clear");var r=require("./components/InViewNavigation.js"),d=require("./components/DetailedView.js"),s=require("./components/SummarizedView.js"),a=require("./components/RuleBook.js"),u=require("react"),v=require("./constants/renderer.js"),c=require("./components/IconContainer.js"),h=require("lucide-react"),f=require("./BigQueryTable.js");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=g(require("@mui/icons-material/CloseOutlined")),b=function(e,l,i){if(void 0===i&&(i="smooth"),l){for(var o=e.parentElement;o;){var n=window.getComputedStyle(o).overflowY;if(("auto"===n||"scroll"===n)&&o.scrollHeight>o.clientHeight)break;if(o===l){o=null;break}o=o.parentElement}var t=null!=o?o:l,r=e.getBoundingClientRect(),d=t.getBoundingClientRect(),s=t.scrollTop+r.top-d.top-(t.clientHeight-r.height)/2;t.scrollTo({top:Math.max(0,s),behavior:i})}};exports.default=function(g){var x,m,y,_,C,w,S,j,k,q,A,T,D,R,F,z,B,E,I,P,H,V,M,N,W,Y,O,K,Q,U,G,J,L,X,Z,$,ee,le,ie,oe,ne,te,re,de,se,ae,ue,ve,ce=g.rootContainer,he=g.chatContainer,fe=void 0===he?{chatData:[]}:he,ge=g.ruleBookContainer,pe=g.renderer,be=g.additionalData,xe=g.tableComponent,me=g.closePreview,ye=g.isRenderedCustomComponent,_e=void 0!==ye&&ye,Ce=g.showRootContainer,we=void 0===Ce||Ce,Se=g.reversePanels,je=void 0!==Se&&Se,ke=u.useState(0),qe=ke[0],Ae=ke[1],Te=u.useState(0),De=Te[0],Re=Te[1],Fe=u.useState(0),ze=Fe[0],Be=Fe[1],Ee=u.useState(0),Ie=Ee[0],Pe=Ee[1],He=u.useRef(null),Ve=u.useRef(null),Me=u.useRef(null),Ne=u.useMemo(function(){return e.__assign(e.__assign({},v.defaultRenderer),pe)},[pe]),We=u.useMemo(function(){return!!((null==xe?void 0:xe.rows)&&Object.keys(xe.rows).length>0)},[xe]),Ye=u.useMemo(function(){var e;return null!==(e=null==be?void 0:be.RuleBookDetailedViewVerticallyStacked)&&void 0!==e&&e},[null==be?void 0:be.RuleBookDetailedViewVerticallyStacked]);u.useEffect(function(){var e,l;if((null==ge?void 0:ge.show)&&He.current){var i=null===(e=He.current)||void 0===e?void 0:e.querySelectorAll(".rule-book-highlight");if(Ae((null==i?void 0:i.length)||0),Re(0),i&&i.length>0){var o=i[0];o.style.backgroundColor="#ffff5c",b(o,He.current)}}if((null==fe?void 0:fe.show)&&(null==Ve?void 0:Ve.current)){var n=null===(l=Ve.current)||void 0===l?void 0:l.querySelectorAll(".user-chat-highlight");if(Be((null==n?void 0:n.length)||0),Pe(0),n&&n.length>0){var t=n[0];t.style.backgroundColor="#ffff5c";var r=requestAnimationFrame(function(){b(t,Me.current)});return function(){return cancelAnimationFrame(r)}}}},[null==fe?void 0:fe.show,null==ge?void 0:ge.show,null==ge?void 0:ge.data,null==fe?void 0:fe.chatData]);var Oe=u.useCallback(function(){var e;if(De+1<qe){var l=null===(e=He.current)||void 0===e?void 0:e.querySelectorAll(".rule-book-highlight");if(!l)return;l[De].style.backgroundColor="#ffffb8";var i=De+1;Re(i);var o=l[i];o.style.backgroundColor="#ffff5c",b(o,He.current)}},[De,qe]),Ke=u.useCallback(function(){var e;if(!(De-1<0)){var l=null===(e=He.current)||void 0===e?void 0:e.querySelectorAll(".rule-book-highlight");if(l){l[De].style.backgroundColor="#ffffb8";var i=De-1,o=l[i];o.style.backgroundColor="#ffff5c",Re(i),b(o,He.current)}}},[De]),Qe=u.useCallback(function(){var e;if(Ie+1<ze){var l=null===(e=Ve.current)||void 0===e?void 0:e.querySelectorAll(".user-chat-highlight");if(!l)return;l[Ie].style.backgroundColor="#ffffb8";var i=Ie+1,o=l[i];o.style.backgroundColor="#ffff5c",Pe(i),b(o,Me.current)}},[Ie,ze]),Ue=u.useCallback(function(){var e;if(!(Ie-1<0)){var l=null===(e=Ve.current)||void 0===e?void 0:e.querySelectorAll(".user-chat-highlight");if(l){l[Ie].style.backgroundColor="#ffffb8";var i=Ie-1,o=l[i];o.style.backgroundColor="#ffff5c",Pe(i),b(o,Me.current)}}},[Ie]),Ge=o.getColorCode((null==ce?void 0:ce.relevanceScore)||0),Je=u.useMemo(function(){var i,o=l.jsxs("span",e.__assign({style:e.__assign({display:"flex",border:"1px solid",alignItems:"center",gap:"4px",borderRadius:"6px",padding:"2px 8px",fontSize:"12px",borderColor:Ge.border,backgroundColor:Ge.background,color:Ge.text},null===(i=null==ce?void 0:ce.slotStyles)||void 0===i?void 0:i.relevanceScore)},{children:[(null==ce?void 0:ce.relevanceTitle)||"Decision Strength",":"," ",(null==ce?void 0:ce.relevanceScore)||0,"%"]}),"relevance-score"),n=l.jsx("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px",borderRadius:"6px",padding:"2px 8px",fontSize:"12px",backgroundColor:"white",color:"black",cursor:"pointer"},onClick:me},{children:l.jsx(p.default,{})}),"close-preview");return _e&&!(null==be?void 0:be.isExpanded)?[o,n]:[o]},[_e,Ge.background,Ge.border,Ge.text,null==ce?void 0:ce.relevanceScore,null===(x=null==ce?void 0:ce.slotStyles)||void 0===x?void 0:x.relevanceScore,null==ce?void 0:ce.relevanceTitle]),Le=u.useMemo(function(){return[qe>0&&l.jsx(r.default,{currentItemNumber:De+1,totalItems:qe,disableNext:De+1>=qe,onNext:Oe,onPrevious:Ke,disablePrevious:De<=0},"rulebook-nav")]},[De,Oe,Ke,qe]),Xe=u.useMemo(function(){return(null==be?void 0:be.RuleBookContainerHeight)?be.RuleBookContainerHeight:!(!Ye||(null==be?void 0:be.isExpanded))&&"600px"},[null==be?void 0:be.RuleBookContainerHeight,Ye]),Ze=u.useMemo(function(){var e,i;return[(null===(i=null===(e=null==fe?void 0:fe.detailedTab)||void 0===e?void 0:e.chip)||void 0===i?void 0:i.isActive)&&ze>0&&l.jsx(r.default,{currentItemNumber:Ie+1,totalItems:ze,onNext:Qe,onPrevious:Ue,disableNext:Ie+1>=ze,disablePrevious:Ie<=0},"chat-nav")]},[null===(y=null===(m=null==fe?void 0:fe.detailedTab)||void 0===m?void 0:m.chip)||void 0===y?void 0:y.isActive,Ie,Qe,Ue,ze]),$e=l.jsxs("div",e.__assign({style:e.__assign({display:"flex",flexDirection:je?Ye?"column-reverse":"row-reverse":Ye?"column":"row",gap:[(null==fe?void 0:fe.chatData)&&fe.chatData.length>0&&(fe.show||void 0===fe.show),(null==ge?void 0:ge.data)&&(ge.show||void 0===ge.show),We].filter(Boolean).length>1?"12px":"0",height:Xe||"100%",minHeight:0},null===(_=null==ce?void 0:ce.slotStyles)||void 0===_?void 0:_.container)},{children:[We&&l.jsx("span",e.__assign({style:e.__assign({flex:"1 1 0%",minWidth:0},null===(C=null==fe?void 0:fe.slotStyles)||void 0===C?void 0:C.outerContainer)},{children:l.jsx(i.default,e.__assign({title:"Invoice Data Preview",icon:l.jsx(c.default,{children:l.jsx(h.Table,{size:16})}),slotStyles:{title:{color:"#475569",fontWeight:500}},secondaryActions:[]},{children:l.jsx("div",e.__assign({style:{height:"100%",maxHeight:(null==be?void 0:be.isExpanded)?"none":"275px",border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",backgroundColor:"#FFFFFF",position:"relative",overflow:"hidden"}},{children:(null==xe?void 0:xe.rows)&&l.jsx(f.BigQueryTable,{rows:xe.rows,columns:xe.columns||[]})}))}))})),(null==ge?void 0:ge.data)&&(ge.show||void 0===ge.show)&&l.jsx("span",e.__assign({style:e.__assign({flex:"1 1 0%",minWidth:0},null===(w=null==ge?void 0:ge.slotStyles)||void 0===w?void 0:w.outerContainer)},{children:l.jsx(i.default,e.__assign({title:null!==(S=null==ge?void 0:ge.title)&&void 0!==S?S:"Rule book",icon:null==ge?void 0:ge.ruleBookIcon,slotStyles:{title:e.__assign({color:"#475569",fontWeight:500},null===(j=null==ge?void 0:ge.slotStyles)||void 0===j?void 0:j.title),body:null===(k=null==ge?void 0:ge.slotStyles)||void 0===k?void 0:k.body},secondaryActions:(null==ge?void 0:ge.secondaryActions)?ge.secondaryActions(Le):Le},{children:l.jsx("div",e.__assign({style:e.__assign({height:"100%",maxHeight:"275px",minHeight:0,border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#F8FAFC",position:"relative",overflowY:"auto"},null===(q=null==ge?void 0:ge.slotStyles)||void 0===q?void 0:q.dataContainer)},{children:l.jsx("div",e.__assign({style:{padding:"12px",height:"100%",overflowY:"auto"},ref:He},{children:l.jsx(a.default,{data:ge.data,renderers:null!==(A=null==ge?void 0:ge.renderer)&&void 0!==A?A:Ne})}))}))}))})),(null==fe?void 0:fe.chatData)&&fe.chatData.length>0&&(fe.show||void 0===fe.show)&&l.jsx("span",e.__assign({style:e.__assign({flex:"1 1 0%",minWidth:0},null===(T=null==fe?void 0:fe.slotStyles)||void 0===T?void 0:T.outerContainer)},{children:l.jsx(i.default,e.__assign({title:null!==(D=null==fe?void 0:fe.title)&&void 0!==D?D:"Chat",icon:null==fe?void 0:fe.chatIcon,containerStyles:null===(R=null==fe?void 0:fe.slotStyles)||void 0===R?void 0:R.container,slotStyles:{title:e.__assign({color:"#475569",fontWeight:500},null===(F=null==fe?void 0:fe.slotStyles)||void 0===F?void 0:F.title),body:null===(z=null==fe?void 0:fe.slotStyles)||void 0===z?void 0:z.body},primaryActions:[((null===(E=null===(B=null==fe?void 0:fe.summarizedTab)||void 0===B?void 0:B.chip)||void 0===E?void 0:E.show)||void 0===(null===(P=null===(I=null==fe?void 0:fe.summarizedTab)||void 0===I?void 0:I.chip)||void 0===P?void 0:P.show))&&l.jsx(n.default,e.__assign({label:"Summarized"},null===(H=null==fe?void 0:fe.summarizedTab)||void 0===H?void 0:H.chip)),l.jsx(n.default,e.__assign({label:"Detailed"},null===(V=null==fe?void 0:fe.detailedTab)||void 0===V?void 0:V.chip))],secondaryActions:fe.secondaryActions?null==fe?void 0:fe.secondaryActions(Ze):Ze},{children:l.jsxs("div",e.__assign({ref:Me,style:e.__assign({height:"100%",maxHeight:"275px",border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#F8FAFC",position:"relative",overflowY:"auto"},null===(M=null==fe?void 0:fe.slotStyles)||void 0===M?void 0:M.chatDataContainer)},{children:[(null===(W=null===(N=null==fe?void 0:fe.detailedTab)||void 0===N?void 0:N.chip)||void 0===W?void 0:W.isActive)&&l.jsx("div",e.__assign({ref:Ve,style:{position:(null==be?void 0:be.isExpanded)?"absolute":"relative",inset:0,padding:"12px",overflowY:"auto"}},{children:l.jsx(d.default,{chatData:null!==(Y=fe.chatData)&&void 0!==Y?Y:[],assistantChatProps:e.__assign(e.__assign({},null===(K=null===(O=null==fe?void 0:fe.detailedTab)||void 0===O?void 0:O.view)||void 0===K?void 0:K.assistantChatProps),{renderers:null!==(G=null===(U=null===(Q=null==fe?void 0:fe.detailedTab)||void 0===Q?void 0:Q.detailedViewRenderer)||void 0===U?void 0:U.assistantText)&&void 0!==G?G:Ne}),userChatItemProps:e.__assign(e.__assign({},null===(L=null===(J=null==fe?void 0:fe.detailedTab)||void 0===J?void 0:J.view)||void 0===L?void 0:L.userChatItemProps),{renderers:null!==($=null===(Z=null===(X=null==fe?void 0:fe.detailedTab)||void 0===X?void 0:X.detailedViewRenderer)||void 0===Z?void 0:Z.userText)&&void 0!==$?$:Ne})})})),(null===(le=null===(ee=null==fe?void 0:fe.summarizedTab)||void 0===ee?void 0:ee.chip)||void 0===le?void 0:le.show)&&(null===(oe=null===(ie=null==fe?void 0:fe.summarizedTab)||void 0===ie?void 0:ie.chip)||void 0===oe?void 0:oe.isActive)&&l.jsx(s.default,e.__assign({chatData:null!==(ne=fe.chatData)&&void 0!==ne?ne:[]},null===(te=null==fe?void 0:fe.summarizedTab)||void 0===te?void 0:te.view,{renderer:null!==(de=null===(re=null==fe?void 0:fe.summarizedTab)||void 0===re?void 0:re.summarizedViewRenderer)&&void 0!==de?de:Ne}))]}))}))}))]}));return we?l.jsx(i.default,e.__assign({title:null==ce?void 0:ce.title,slotStyles:{title:null===(se=null==ce?void 0:ce.slotStyles)||void 0===se?void 0:se.title,body:null===(ae=null==ce?void 0:ce.slotStyles)||void 0===ae?void 0:ae.body},containerStyles:null===(ue=null==ce?void 0:ce.slotStyles)||void 0===ue?void 0:ue.container,icon:null!==(ve=null==ce?void 0:ce.icon)&&void 0!==ve?ve:l.jsx(c.default,{children:l.jsx("img",{src:t.default,alt:"chat icon",style:{width:16,height:16}})}),secondaryActions:(null==ce?void 0:ce.secondaryActions)?ce.secondaryActions(Je):Je},{children:$e})):$e};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),l=require("react/jsx-runtime"),i=require("./components/ChatCitation.js"),o=require("./utils/helpers.js"),n=require("./components/Chip.js"),t=require("./assets/message-chat-square.svg.js");require("@mui/icons-material/KeyboardArrowDown"),require("@mui/icons-material/KeyboardArrowUp"),require("@mui/icons-material/Clear");var r=require("./components/InViewNavigation.js"),d=require("./components/DetailedView.js"),s=require("./components/SummarizedView.js"),a=require("./components/RuleBook.js"),u=require("react"),v=require("./constants/renderer.js"),c=require("./components/IconContainer.js"),h=require("lucide-react"),f=require("./BigQueryTable.js");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=g(require("@mui/icons-material/CloseOutlined")),b=function(e,l,i){if(void 0===i&&(i="smooth"),l){for(var o=e.parentElement;o;){var n=window.getComputedStyle(o).overflowY;if(("auto"===n||"scroll"===n)&&o.scrollHeight>o.clientHeight)break;if(o===l){o=null;break}o=o.parentElement}var t=null!=o?o:l,r=e.getBoundingClientRect(),d=t.getBoundingClientRect(),s=t.scrollTop+r.top-d.top-(t.clientHeight-r.height)/2;t.scrollTo({top:Math.max(0,s),behavior:i})}},x={chatData:[]};exports.default=function(g){var m,y,_,C,w,S,j,k,q,A,T,D,R,F,z,B,E,I,P,H,V,M,N,W,Y,O,K,Q,U,G,J,L,X,Z,$,ee,le,ie,oe,ne,te,re,de,se,ae,ue,ve,ce,he=g.rootContainer,fe=g.chatContainer,ge=void 0===fe?x:fe,pe=g.ruleBookContainer,be=g.renderer,xe=g.additionalData,me=g.tableComponent,ye=g.closePreview,_e=g.isRenderedCustomComponent,Ce=void 0!==_e&&_e,we=g.showRootContainer,Se=void 0===we||we,je=g.reversePanels,ke=void 0!==je&&je,qe=u.useState(0),Ae=qe[0],Te=qe[1],De=u.useState(0),Re=De[0],Fe=De[1],ze=u.useState(0),Be=ze[0],Ee=ze[1],Ie=u.useState(0),Pe=Ie[0],He=Ie[1],Ve=u.useRef(null),Me=u.useRef(null),Ne=u.useRef(null),We=u.useMemo(function(){return e.__assign(e.__assign({},v.defaultRenderer),be)},[be]),Ye=u.useMemo(function(){return!!((null==me?void 0:me.rows)&&Object.keys(me.rows).length>0)},[me]),Oe=u.useMemo(function(){var e;return null!==(e=null==xe?void 0:xe.RuleBookDetailedViewVerticallyStacked)&&void 0!==e&&e},[null==xe?void 0:xe.RuleBookDetailedViewVerticallyStacked]);u.useEffect(function(){var e,l;if((null==pe?void 0:pe.show)&&Ve.current){var i=null===(e=Ve.current)||void 0===e?void 0:e.querySelectorAll(".rule-book-highlight");if(Te((null==i?void 0:i.length)||0),Fe(0),i&&i.length>0){var o=i[0];o.style.backgroundColor="#ffff5c",b(o,Ve.current)}}if((null==ge?void 0:ge.show)&&(null==Me?void 0:Me.current)){var n=null===(l=Me.current)||void 0===l?void 0:l.querySelectorAll(".user-chat-highlight");if(Ee((null==n?void 0:n.length)||0),He(0),n&&n.length>0){var t=n[0];t.style.backgroundColor="#ffff5c";var r=requestAnimationFrame(function(){b(t,Ne.current)});return function(){return cancelAnimationFrame(r)}}}},[null==ge?void 0:ge.show,null==pe?void 0:pe.show,null==pe?void 0:pe.data,null==ge?void 0:ge.chatData]);var Ke=u.useCallback(function(){var e;if(Re+1<Ae){var l=null===(e=Ve.current)||void 0===e?void 0:e.querySelectorAll(".rule-book-highlight");if(!l)return;l[Re].style.backgroundColor="#ffffb8";var i=Re+1;Fe(i);var o=l[i];o.style.backgroundColor="#ffff5c",b(o,Ve.current)}},[Re,Ae]),Qe=u.useCallback(function(){var e;if(!(Re-1<0)){var l=null===(e=Ve.current)||void 0===e?void 0:e.querySelectorAll(".rule-book-highlight");if(l){l[Re].style.backgroundColor="#ffffb8";var i=Re-1,o=l[i];o.style.backgroundColor="#ffff5c",Fe(i),b(o,Ve.current)}}},[Re]),Ue=u.useCallback(function(){var e;if(Pe+1<Be){var l=null===(e=Me.current)||void 0===e?void 0:e.querySelectorAll(".user-chat-highlight");if(!l)return;l[Pe].style.backgroundColor="#ffffb8";var i=Pe+1,o=l[i];o.style.backgroundColor="#ffff5c",He(i),b(o,Ne.current)}},[Pe,Be]),Ge=u.useCallback(function(){var e;if(!(Pe-1<0)){var l=null===(e=Me.current)||void 0===e?void 0:e.querySelectorAll(".user-chat-highlight");if(l){l[Pe].style.backgroundColor="#ffffb8";var i=Pe-1,o=l[i];o.style.backgroundColor="#ffff5c",He(i),b(o,Ne.current)}}},[Pe]),Je=o.getColorCode((null==he?void 0:he.relevanceScore)||0),Le=u.useMemo(function(){var i,o=l.jsxs("span",e.__assign({style:e.__assign({display:"flex",border:"1px solid",alignItems:"center",gap:"4px",borderRadius:"6px",padding:"2px 8px",fontSize:"12px",borderColor:Je.border,backgroundColor:Je.background,color:Je.text},null===(i=null==he?void 0:he.slotStyles)||void 0===i?void 0:i.relevanceScore)},{children:[(null==he?void 0:he.relevanceTitle)||"Decision Strength",":"," ",(null==he?void 0:he.relevanceScore)||0,"%"]}),"relevance-score"),n=l.jsx("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px",borderRadius:"6px",padding:"2px 8px",fontSize:"12px",backgroundColor:"white",color:"black",cursor:"pointer"},onClick:ye},{children:l.jsx(p.default,{})}),"close-preview");return Ce&&!(null==xe?void 0:xe.isExpanded)?[o,n]:[o]},[Ce,Je.background,Je.border,Je.text,null==he?void 0:he.relevanceScore,null===(m=null==he?void 0:he.slotStyles)||void 0===m?void 0:m.relevanceScore,null==he?void 0:he.relevanceTitle]),Xe=u.useMemo(function(){return[Ae>0&&l.jsx(r.default,{currentItemNumber:Re+1,totalItems:Ae,disableNext:Re+1>=Ae,onNext:Ke,onPrevious:Qe,disablePrevious:Re<=0},"rulebook-nav")]},[Re,Ke,Qe,Ae]),Ze=u.useMemo(function(){return(null==xe?void 0:xe.RuleBookContainerHeight)?xe.RuleBookContainerHeight:!(!Oe||(null==xe?void 0:xe.isExpanded))&&"600px"},[null==xe?void 0:xe.RuleBookContainerHeight,Oe]),$e=u.useMemo(function(){var e,i;return[(null===(i=null===(e=null==ge?void 0:ge.detailedTab)||void 0===e?void 0:e.chip)||void 0===i?void 0:i.isActive)&&Be>0&&l.jsx(r.default,{currentItemNumber:Pe+1,totalItems:Be,onNext:Ue,onPrevious:Ge,disableNext:Pe+1>=Be,disablePrevious:Pe<=0},"chat-nav")]},[null===(_=null===(y=null==ge?void 0:ge.detailedTab)||void 0===y?void 0:y.chip)||void 0===_?void 0:_.isActive,Pe,Ue,Ge,Be]),el=l.jsxs("div",e.__assign({style:e.__assign({display:"flex",flexDirection:ke?Oe?"column-reverse":"row-reverse":Oe?"column":"row",gap:[(null==ge?void 0:ge.chatData)&&ge.chatData.length>0&&(ge.show||void 0===ge.show),(null==pe?void 0:pe.data)&&(pe.show||void 0===pe.show),Ye].filter(Boolean).length>1?"12px":"0",height:Ze||"100%",minHeight:0},null===(C=null==he?void 0:he.slotStyles)||void 0===C?void 0:C.container)},{children:[Ye&&l.jsx("span",e.__assign({style:e.__assign({flex:"1 1 0%",minWidth:0},null===(w=null==ge?void 0:ge.slotStyles)||void 0===w?void 0:w.outerContainer)},{children:l.jsx(i.default,e.__assign({title:"Invoice Data Preview",icon:l.jsx(c.default,{children:l.jsx(h.Table,{size:16})}),slotStyles:{title:{color:"#475569",fontWeight:500}},secondaryActions:[]},{children:l.jsx("div",e.__assign({style:{height:"100%",maxHeight:(null==xe?void 0:xe.isExpanded)?"none":"275px",border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",backgroundColor:"#FFFFFF",position:"relative",overflow:"hidden"}},{children:(null==me?void 0:me.rows)&&l.jsx(f.BigQueryTable,{rows:me.rows,columns:me.columns||[]})}))}))})),(null==pe?void 0:pe.data)&&(pe.show||void 0===pe.show)&&l.jsx("span",e.__assign({style:e.__assign({flex:"1 1 0%",minWidth:0},null===(S=null==pe?void 0:pe.slotStyles)||void 0===S?void 0:S.outerContainer)},{children:l.jsx(i.default,e.__assign({title:null!==(j=null==pe?void 0:pe.title)&&void 0!==j?j:"Rule book",icon:null==pe?void 0:pe.ruleBookIcon,slotStyles:{title:e.__assign({color:"#475569",fontWeight:500},null===(k=null==pe?void 0:pe.slotStyles)||void 0===k?void 0:k.title),body:null===(q=null==pe?void 0:pe.slotStyles)||void 0===q?void 0:q.body},secondaryActions:(null==pe?void 0:pe.secondaryActions)?pe.secondaryActions(Xe):Xe},{children:l.jsx("div",e.__assign({style:e.__assign({height:"100%",maxHeight:"275px",minHeight:0,border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#F8FAFC",position:"relative",overflowY:"auto"},null===(A=null==pe?void 0:pe.slotStyles)||void 0===A?void 0:A.dataContainer)},{children:l.jsx("div",e.__assign({style:{padding:"12px",height:"100%",overflowY:"auto"},ref:Ve},{children:l.jsx(a.default,{data:pe.data,renderers:null!==(T=null==pe?void 0:pe.renderer)&&void 0!==T?T:We})}))}))}))})),(null==ge?void 0:ge.chatData)&&ge.chatData.length>0&&(ge.show||void 0===ge.show)&&l.jsx("span",e.__assign({style:e.__assign({flex:"1 1 0%",minWidth:0},null===(D=null==ge?void 0:ge.slotStyles)||void 0===D?void 0:D.outerContainer)},{children:l.jsx(i.default,e.__assign({title:null!==(R=null==ge?void 0:ge.title)&&void 0!==R?R:"Chat",icon:null==ge?void 0:ge.chatIcon,containerStyles:null===(F=null==ge?void 0:ge.slotStyles)||void 0===F?void 0:F.container,slotStyles:{title:e.__assign({color:"#475569",fontWeight:500},null===(z=null==ge?void 0:ge.slotStyles)||void 0===z?void 0:z.title),body:null===(B=null==ge?void 0:ge.slotStyles)||void 0===B?void 0:B.body},primaryActions:[((null===(I=null===(E=null==ge?void 0:ge.summarizedTab)||void 0===E?void 0:E.chip)||void 0===I?void 0:I.show)||void 0===(null===(H=null===(P=null==ge?void 0:ge.summarizedTab)||void 0===P?void 0:P.chip)||void 0===H?void 0:H.show))&&l.jsx(n.default,e.__assign({label:"Summarized"},null===(V=null==ge?void 0:ge.summarizedTab)||void 0===V?void 0:V.chip)),l.jsx(n.default,e.__assign({label:"Detailed"},null===(M=null==ge?void 0:ge.detailedTab)||void 0===M?void 0:M.chip))],secondaryActions:ge.secondaryActions?null==ge?void 0:ge.secondaryActions($e):$e},{children:l.jsxs("div",e.__assign({ref:Ne,style:e.__assign({height:"100%",maxHeight:"275px",border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#F8FAFC",position:"relative",overflowY:"auto"},null===(N=null==ge?void 0:ge.slotStyles)||void 0===N?void 0:N.chatDataContainer)},{children:[(null===(Y=null===(W=null==ge?void 0:ge.detailedTab)||void 0===W?void 0:W.chip)||void 0===Y?void 0:Y.isActive)&&l.jsx("div",e.__assign({ref:Me,style:{position:(null==xe?void 0:xe.isExpanded)?"absolute":"relative",inset:0,padding:"12px",overflowY:"auto"}},{children:l.jsx(d.default,{chatData:null!==(O=ge.chatData)&&void 0!==O?O:[],assistantChatProps:e.__assign(e.__assign({},null===(Q=null===(K=null==ge?void 0:ge.detailedTab)||void 0===K?void 0:K.view)||void 0===Q?void 0:Q.assistantChatProps),{renderers:null!==(J=null===(G=null===(U=null==ge?void 0:ge.detailedTab)||void 0===U?void 0:U.detailedViewRenderer)||void 0===G?void 0:G.assistantText)&&void 0!==J?J:We}),userChatItemProps:e.__assign(e.__assign({},null===(X=null===(L=null==ge?void 0:ge.detailedTab)||void 0===L?void 0:L.view)||void 0===X?void 0:X.userChatItemProps),{renderers:null!==(ee=null===($=null===(Z=null==ge?void 0:ge.detailedTab)||void 0===Z?void 0:Z.detailedViewRenderer)||void 0===$?void 0:$.userText)&&void 0!==ee?ee:We})})})),(null===(ie=null===(le=null==ge?void 0:ge.summarizedTab)||void 0===le?void 0:le.chip)||void 0===ie?void 0:ie.show)&&(null===(ne=null===(oe=null==ge?void 0:ge.summarizedTab)||void 0===oe?void 0:oe.chip)||void 0===ne?void 0:ne.isActive)&&l.jsx(s.default,e.__assign({chatData:null!==(te=ge.chatData)&&void 0!==te?te:[]},null===(re=null==ge?void 0:ge.summarizedTab)||void 0===re?void 0:re.view,{renderer:null!==(se=null===(de=null==ge?void 0:ge.summarizedTab)||void 0===de?void 0:de.summarizedViewRenderer)&&void 0!==se?se:We}))]}))}))}))]}));return Se?l.jsx(i.default,e.__assign({title:null==he?void 0:he.title,slotStyles:{title:null===(ae=null==he?void 0:he.slotStyles)||void 0===ae?void 0:ae.title,body:null===(ue=null==he?void 0:he.slotStyles)||void 0===ue?void 0:ue.body},containerStyles:null===(ve=null==he?void 0:he.slotStyles)||void 0===ve?void 0:ve.container,icon:null!==(ce=null==he?void 0:he.icon)&&void 0!==ce?ce:l.jsx(c.default,{children:l.jsx("img",{src:t.default,alt:"chat icon",style:{width:16,height:16}})}),secondaryActions:(null==he?void 0:he.secondaryActions)?he.secondaryActions(Le):Le},{children:el})):el};
2
2
  //# sourceMappingURL=InternalChatCitationRenderer.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("tslib"),e=require("react/jsx-runtime"),t=require("@mui/material"),r=require("react"),i=require("../CognitiveCompareConstants.js"),o=require("lucide-react"),a=require("react-markdown"),s=require("../CognitiveComparehelpers.js"),l=require("rehype-raw"),c=require("remark-gfm");function d(n){return n&&"object"==typeof n&&"default"in n?n:{default:n}}var u=d(r),g=d(a),h=d(l),p=function(n){return"function"==typeof n?n:(null==n?void 0:n.default)||n},f=[p(d(c).default)],v=[p(h.default)],x=u.default.memo(function(a){var l=a.content,c=a.overlayContent,d=a.sxStyles,h=a.deviationBadges,p=void 0===h?[]:h,x=a.highlights,m=void 0===x?[]:x;a.maintainRelativeOrder;var _=a.highlightBg,b=a.suppressHighlightBg,y=void 0!==b&&b,B=a.collisionKey,E=r.useRef(null),j=!!c,C=r.useMemo(function(){return p.reduce(function(e,t){var r;return n.__assign(n.__assign({},e),((r={})[t.id]=t,r))},{})},[p]),k=r.useRef({badgeMap:C,highlightBg:_,hideHighlightBg:j,suppressHighlightBg:y});k.current={badgeMap:C,highlightBg:_,hideHighlightBg:j,suppressHighlightBg:y};var S=function(e,t){return u.default.Children.map(e,function(e){var r;if(!u.default.isValidElement(e))return e;var i=(null===(r=e.props)||void 0===r?void 0:r.children)?S(e.props.children,t):e.props.children,o=u.default.cloneElement(e,n.__assign(n.__assign({},e.props),{children:i}));return t(o)})},F=r.useMemo(function(){return{mark:function(t){var r,i,o,a,s=t.children,l=n.__rest(t,["children"]),c=k.current,d=c.badgeMap,u=c.highlightBg,g=c.hideHighlightBg,h=c.suppressHighlightBg,p=l["data-badge-id"],f=p?d[p]:null,v=l["data-highlight-color"],x=null!==(a=null!==(i=null!=v?v:null===(r=null==f?void 0:f.style)||void 0===r?void 0:r.highlightBg)&&void 0!==i?i:null===(o=null==f?void 0:f.style)||void 0===o?void 0:o.badgeBg)&&void 0!==a?a:u,m="true"===l["data-is-suggested-deviation-fix"]||h;return e.jsx("span",n.__assign({style:n.__assign(n.__assign(n.__assign({},m?{}:{backgroundColor:x}),{borderRadius:"2px",display:"inline",boxDecorationBreak:"clone",WebkitBoxDecorationBreak:"clone",backgroundClip:"padding-box",padding:"0 1px"}),g?{color:"transparent"}:{})},{children:s}))},span:function(r){var a,s,l,c,d,u,g=r.children,h=n.__rest(r,["children"]),p=k.current.badgeMap,f=h["data-badge-id"];if(!f)return e.jsx("span",n.__assign({},h,{children:g}));var v=p[f];if(!v)return e.jsx("span",n.__assign({},h,{children:g}));var x="number"==typeof v.stackIndex?v.stackIndex:0,m="translateY(calc(-20% + ".concat(12*x,"px + var(--badge-nudge, 0px)))");return e.jsxs(t.Box,n.__assign({component:"span",sx:{position:"static",display:"inline"}},{children:[e.jsxs(t.Box,n.__assign({ref:v.badgeRef,className:"deviation-badge","data-side":v.side||"right",sx:n.__assign(n.__assign({fontStyle:"normal",position:"absolute",zIndex:30+x,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(a=v.style)||void 0===a?void 0:a.badgeBg)||"#EEF2FF",color:(null===(s=v.style)||void 0===s?void 0:s.badgeText)||i.DEFAULT_DEVIAION_COLOR,border:"1px solid ".concat((null===(l=v.style)||void 0===l?void 0:l.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden",transition:"none"},"left"===v.side?{right:"-16px",transform:"".concat(m," translateX(calc(100% + 8px))")}:{left:"-16px",transform:"".concat(m," translateX(calc(-100% - 8px))")}),v.isConnected&&v.style&&{outline:"2px solid ".concat(v.style.badgeBorder),outlineOffset:"1px"})},{children:[e.jsxs(t.Box,n.__assign({onClick:function(n){n.stopPropagation(),v.onSummaryClick&&v.onSummaryClick(n)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[e.jsx(t.Box,n.__assign({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:v.label})),("left"===v.side||v.isOrphan)&&e.jsx(t.Box,n.__assign({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(c=v.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE")}},{children:null!=v.score&&"N/A"!==v.score&&"NA"!==v.score&&0!==v.score?"".concat(v.score):"N/A"===v.score||"NA"===v.score?"N/A":"Same"}))]})),("left"===v.side||v.isOrphan)&&e.jsx(t.Box,n.__assign({onClick:function(n){n.stopPropagation(),v.onClick&&v.onClick(n)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(d=v.style)||void 0===d?void 0:d.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:e.jsx(o.EllipsisVertical,{size:12,color:(null===(u=v.style)||void 0===u?void 0:u.badgeText)||"#3730A3"})}))]})),g]}))},table:function(r){var i=r.children;return e.jsx(t.Box,n.__assign({component:"table",sx:{width:"100%",borderCollapse:"collapse",my:1,fontSize:"inherit"}},{children:i}))},thead:function(r){var i=r.children;return e.jsx(t.Box,n.__assign({component:"thead"},{children:i}))},tbody:function(r){var i=r.children;return e.jsx(t.Box,n.__assign({component:"tbody"},{children:i}))},tr:function(r){var i=r.children;return e.jsx(t.Box,n.__assign({component:"tr",sx:{borderBottom:"1px solid #E5E7EB"}},{children:i}))},th:function(r){var i=r.children;return e.jsx(t.Box,n.__assign({component:"th",sx:{border:"1px solid #E5E7EB",padding:"8px",textAlign:"left",fontWeight:600,backgroundColor:"#F9FAFB"}},{children:i}))},td:function(r){var i=r.children;return e.jsx(t.Box,n.__assign({component:"td",sx:{border:"1px solid #E5E7EB",padding:"8px",verticalAlign:"top"}},{children:i}))},code:function(t){var r=t.children;return e.jsx("span",n.__assign({style:{fontFamily:"inherit",fontSize:"inherit"}},{children:r}))},pre:function(t){var r=t.children;return e.jsx("span",n.__assign({style:{fontFamily:"inherit",fontSize:"inherit",display:"block",whiteSpace:"pre-wrap"}},{children:r}))},updated:function(n){var t=n.children;return e.jsx(e.Fragment,{children:t})},deleted:function(t){var r=t.children,i=S(r,function(n){return u.default.cloneElement(n,{"data-is-suggested-deviation-fix":"true"})});return e.jsx("span",n.__assign({style:{boxShadow:"inset 0 1px 0 #EF4444, inset 0 -1px 0 #EF4444",backgroundColor:"#FCCCCC",textDecoration:"line-through"}},{children:i}))},changed:function(t){var r=t.children,i=S(r,function(n){return u.default.cloneElement(n,{"data-is-suggested-deviation-fix":"true"})});return e.jsx("span",n.__assign({style:{boxShadow:"inset 0 1px 0 #2F59FF, inset 0 -1px 0 #2F59FF",backgroundColor:"#D5E8FF"}},{children:i}))},ul:function(r){var i=r.children,o=n.__rest(r,["children"]);return e.jsx(t.Box,n.__assign({component:"ul",sx:{mt:1,mb:1,pl:3,listStyleType:"disc"}},o,{children:i}))},ol:function(r){var i=r.children,o=n.__rest(r,["children"]);return e.jsx(t.Box,n.__assign({component:"ol",sx:{mt:1,mb:1,pl:3,listStyleType:"decimal"}},o,{children:i}))},li:function(r){var i=r.children,o=n.__rest(r,["children"]);return e.jsx(t.Box,n.__assign({component:"li",sx:{mb:.5,display:"list-item"}},o,{children:i}))}}},[]),w=function(n){if(!n||"string"!=typeof n)return"";var e=n,t=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/((?:<\/?[a-z]+[^>]*>\s*)+)([*+\-] |\d+\. )/gi,"$2$1")).replace(/\\(['"])/g,"$1").replace(/\\n/g,"\n").replace(/\\\./g,".").replace(/\r\n/g,"\n")).replace(/^(\d+\.)(\s{2,})/gm,function(n,e,t){return"".concat(e.slice(0,-1),"\\.").concat(t)})).replace(/^(\d+\.)\s*\n+(\s+)(\S)/gm,function(n,e,t,r){return"".concat(e," ").concat(r)})).replace(/([^\n])\n(#{1,6} )/g,"$1\n\n$2")).replace(/([^\n])\n([ \t]*(?:[#*+\-] |\d+\. ))/g,"$1\n\n$2")).replace(/\n{3,}/g,"\n\n")).replace(/^[ \t]+(?![ \t]*([\*\-\+] |\d+\. ))/gm,function(n){return n.replace(/ /g," ").replace(/\t/g,"    ")})).split(/(\n{2,})/);return(e=t.map(function(n){return/^\n+$/.test(n)||/\|.*\|/.test(n)&&/\|[\s:|-]+\|/.test(n)||/^#{1,6} /.test(n.trimStart())?n:n.replace(/\n(?=[^\n])/g,function(e,t){var r=n.slice(t+1);return/^[ \t]*([#>|\-*+]|\d+\.)/.test(r)?"\n":" "})}).join("")).trim()},M=function(n){return n.replace(/[\.,;:]/g," ")},A=r.useMemo(function(){return p.map(function(n){return{id:n.id,connected:n.isConnected,stackIndex:n.stackIndex,size:n.size}})},[p]),T=r.useMemo(function(){var e=w(l||""),t=y?M(e):e,r=(p||[]).map(function(n){var e,t;return{id:null==n?void 0:n.id,highlight:w((null==n?void 0:n.highlight)||""),highlightColor:(null===(e=null==n?void 0:n.style)||void 0===e?void 0:e.highlightBg)||(null===(t=null==n?void 0:n.style)||void 0===t?void 0:t.badgeBg)||_}}).filter(function(n){return n.id&&n.highlight}),i={};r.forEach(function(n){i[n.highlight]||(i[n.highlight]=[]),i[n.highlight].push(n)});var o=function(n,e,t,r){void 0===e&&(e=""),void 0===r&&(r=[]);var i=!1,o=function(n){var o=function(n,e,t){var r,i,o;void 0===e&&(e="");var a=n.match(/^(\s*)([\s\S]*?)(\s*)$/);if(!a)return n;var s=null!==(r=a[1])&&void 0!==r?r:"",l=null!==(i=a[2])&&void 0!==i?i:"",c=null!==(o=a[3])&&void 0!==o?o:"";return l?s+function(n,e){void 0===n&&(n="");var t=e?' data-highlight-color="'.concat(e,'"'):"",r=n?' data-badge-id="'.concat(n,'"'):"";return"<mark".concat(r).concat(t,">")}(e,t)+l+"</mark>"+c:n}(n,e,t),a=o;if(!i&&r.length>0){i=!0;var s="",l="";r.forEach(function(n){s+=function(n){return'<span data-badge-id="'.concat(n,'">')}(n.id),l="</span>"+l}),a=s+o+l}return"​"+a};return n.split(/(\n+)/).map(function(n){return/^\n+$/.test(n)?n:n.trim()?""===n.replace(/[|:\-\s]/g,"")&&n.includes("-")?n:n.includes("|")?n.split(/(\|)/).map(function(n){return"|"!==n&&n.trim()?o(n):n}).join(""):o(n):n}).join("")},a=[];Object.entries(i).forEach(function(n){var r=n[0],i=n[1],o=e.indexOf(r),l=!1;if(-1===o&&y){var c=M(r);-1!==(o=t.indexOf(c))&&(l=!0)}if(-1!==o){for(var d=i[0].highlightColor,u=1;u<i.length;u++)d=s.mixHexColors(d,i[u].highlightColor||"");a.push({highlight:r,start:o,end:o+r.length,badges:i,color:d,usedLooseMatch:l})}});var c=new Set(Object.keys(i));(m||[]).forEach(function(n){if(n){var r=w(n);if(r&&!c.has(r)){var i=e.indexOf(r),o=!1;if(-1===i&&y){var s=M(r);-1!==(i=t.indexOf(s))&&(o=!0)}if(-1!==i){var l=e.slice(0,i);(l.match(/</g)||[]).length===(l.match(/>/g)||[]).length&&a.push({highlight:r,start:i,end:i+r.length,badges:[],color:_||"",usedLooseMatch:o})}}}}),a.sort(function(n,e){return n.start-e.start||e.end-n.end});var d=[],u={};a.forEach(function(n,e){for(var t=n.start,r=n.end,i=0,o=d;i<o.length;i++){var a=o[i],s=a.start,l=a.end,c=t<l&&r>l&&t>=s,g=t<s&&r>s&&r<=l;if(t>=s&&r<=l){n.orphaned=!0,u[e]=a.matchIdx;break}c&&(t=l),g&&(r=s)}n.trimmedStart=t,n.trimmedEnd=r,!n.orphaned&&t<r&&d.push({start:t,end:r,matchIdx:e})});var g={};Object.entries(u).forEach(function(n){var e=n[0],t=n[1],r=Number(e);g[t]||(g[t]=[]),g[t].push(r)});var h=a.map(function(e,t){return n.__assign(n.__assign({},e),{idx:t})}).filter(function(n){return!n.orphaned}).sort(function(n,e){var t,r;return(null!==(t=e.trimmedStart)&&void 0!==t?t:e.start)-(null!==(r=n.trimmedStart)&&void 0!==r?r:n.start)});return h.forEach(function(n){var t,r,i,l,c=null!==(t=n.trimmedStart)&&void 0!==t?t:n.start,d=null!==(r=n.trimmedEnd)&&void 0!==r?r:n.end;if(!(c>=d)){var u=e.slice(c,d),h=function(n,e,t,r){if(!t.length)return n;var i=t.map(function(n){return a[n]}).sort(function(n,e){return n.start-e.start}),l="",c=0;return i.forEach(function(t){var i,a,d=Math.max(c,t.start-e),u=Math.max(d,t.end-e);if(!(d>=u)){var g=s.mixHexColors(r,t.color||"");l+=n.slice(c,d),l+=o(n.slice(d,u),(null===(a=null===(i=t.badges)||void 0===i?void 0:i[0])||void 0===a?void 0:a.id)||"",g,t.badges||[]),c=u}}),l+=n.slice(c)}(n.usedLooseMatch||c!==n.start||d!==n.end?u:n.highlight,n.start,g[n.idx]||[],n.color),p=o(h,(null===(l=null===(i=n.badges)||void 0===i?void 0:i[0])||void 0===l?void 0:l.id)||"",n.color,n.badges||[]);e=e.slice(0,c)+p+e.slice(d)}}),e},[l,p,m,_,y]),z=r.useMemo(function(){return c?w(c||""):""},[c]),O=!!c,q={"& *":{fontFamily:"inherit"},"& code, & pre, & kbd, & samp":{fontFamily:"inherit !important",fontSize:"inherit",background:"none",padding:0,border:"none",whiteSpace:"pre-wrap"},"& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"}},I=n.__assign(n.__assign(n.__assign(n.__assign({},d),q),{position:"relative",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:2}),O?{color:"transparent",userSelect:"none",pointerEvents:"none","& .deviation-badge":{pointerEvents:"auto"},"& table":{visibility:"hidden",margin:"0 !important"},"& th, & td":{padding:"0 !important",border:"none !important",backgroundColor:"transparent !important"},"& tr":{border:"none !important"},"& p:empty":{display:"none"}}:{}),P=n.__assign(n.__assign(n.__assign({},d),q),{position:"relative",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:1,pointerEvents:"auto"});return r.useLayoutEffect(function(){if(E.current){var n=function(){var n=Array.from(E.current.querySelectorAll(".deviation-badge"));if(0!==n.length){n.forEach(function(n){n.style.setProperty("--badge-nudge","0px")});var e=n.filter(function(n){return"left"===n.dataset.side}),t=n.filter(function(n){return"left"!==n.dataset.side}),r=E.current.getBoundingClientRect(),i=r.bottom-4,o=r.top+4,a=function(n){if(0!==n.length){var e=n.map(function(n){var e=n.getBoundingClientRect();return{el:n,naturalTop:e.top,height:e.height,currentTop:e.top}});e.sort(function(n,e){return n.naturalTop-e.naturalTop});var t=[],r=[];e.forEach(function(n){if(0===r.length)r.push(n);else{var e=r[r.length-1],i=e.currentTop+e.height;n.naturalTop<i+8?(n.currentTop=i+8,r.push(n)):(t.push(r),r=[n])}}),r.length>0&&t.push(r),t.forEach(function(n){var e=n[n.length-1],t=e.currentTop+e.height;if(t>i){var r=t-i,a=n[0].currentTop-o,s=Math.max(0,Math.min(r,a));n.forEach(function(n){n.currentTop-=s})}}),t.flat().forEach(function(n){var e=n.currentTop-n.naturalTop;n.el.style.setProperty("--badge-nudge","".concat(e,"px"))})}};a(e),a(t)}},e=requestAnimationFrame(function(){requestAnimationFrame(function(){n()})}),t=new ResizeObserver(function(){requestAnimationFrame(n)});return t.observe(E.current),function(){t.disconnect(),cancelAnimationFrame(e)}}},[T,B,A]),e.jsxs(t.Box,n.__assign({ref:E,sx:{position:"relative",display:"grid"}},{children:[e.jsx(t.Typography,n.__assign({component:"div",sx:n.__assign(n.__assign({},I),{padding:"3px"})},{children:e.jsx(g.default,n.__assign({components:F,remarkPlugins:f,rehypePlugins:v},{children:T.replace(/#{3}/g,"")}))})),O&&e.jsx(t.Typography,n.__assign({component:"div",sx:P},{children:e.jsx(g.default,n.__assign({components:F,remarkPlugins:f,rehypePlugins:v},{children:z}))}))]}))},s.areMarkdownPropsEqual);exports.MemoizedMarkdown=x;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("tslib"),e=require("react/jsx-runtime"),t=require("@mui/material"),i=require("react"),r=require("../CognitiveCompareConstants.js"),o=require("lucide-react"),a=require("react-markdown"),s=require("../CognitiveComparehelpers.js"),l=require("rehype-raw"),d=require("remark-gfm");function c(n){return n&&"object"==typeof n&&"default"in n?n:{default:n}}var u=c(i),h=c(a),g=c(l),p=function(n){return"function"==typeof n?n:(null==n?void 0:n.default)||n},f=[p(c(d).default)],v=[p(g.default)],x=u.default.memo(function(a){var l=a.content,d=a.overlayContent,c=a.sxStyles,g=a.deviationBadges,p=void 0===g?[]:g,x=a.highlights,m=void 0===x?[]:x;a.maintainRelativeOrder;var _=a.highlightBg,b=a.suppressHighlightBg,y=void 0!==b&&b,B=a.collisionKey,E=i.useRef(null),j=!!d,w=i.useMemo(function(){return p.reduce(function(e,t){var i;return n.__assign(n.__assign({},e),((i={})[t.id]=t,i))},{})},[p]),k=i.useRef({badgeMap:w,highlightBg:_,hideHighlightBg:j,suppressHighlightBg:y});k.current={badgeMap:w,highlightBg:_,hideHighlightBg:j,suppressHighlightBg:y};var C=function(e,t){return u.default.Children.map(e,function(e){var i;if(!u.default.isValidElement(e))return e;var r=(null===(i=e.props)||void 0===i?void 0:i.children)?C(e.props.children,t):e.props.children,o=u.default.cloneElement(e,n.__assign(n.__assign({},e.props),{children:r}));return t(o)})},S=i.useMemo(function(){return{mark:function(t){var i,r,o,a,s=t.children,l=n.__rest(t,["children"]),d=k.current,c=d.badgeMap,u=d.highlightBg,h=d.hideHighlightBg,g=d.suppressHighlightBg,p=l["data-badge-id"],f=p?c[p]:null,v=l["data-highlight-color"],x=null!==(a=null!==(r=null!=v?v:null===(i=null==f?void 0:f.style)||void 0===i?void 0:i.highlightBg)&&void 0!==r?r:null===(o=null==f?void 0:f.style)||void 0===o?void 0:o.badgeBg)&&void 0!==a?a:u,m="true"===l["data-is-suggested-deviation-fix"]||g;return e.jsx("span",n.__assign({style:n.__assign(n.__assign(n.__assign({},m?{}:{backgroundColor:x}),{borderRadius:"2px",display:"inline",boxDecorationBreak:"clone",WebkitBoxDecorationBreak:"clone",backgroundClip:"padding-box",padding:"0 1px"}),h?{color:"transparent"}:{})},{children:s}))},span:function(i){var a,s,l,d,c,u,h=i.children,g=n.__rest(i,["children"]),p=k.current.badgeMap,f=g["data-badge-id"];if(!f)return e.jsx("span",n.__assign({},g,{children:h}));var v=p[f];if(!v)return e.jsx("span",n.__assign({},g,{children:h}));var x="number"==typeof v.stackIndex?v.stackIndex:0,m="translateY(calc(-20% + ".concat(12*x,"px + var(--badge-nudge, 0px)))");return e.jsxs(t.Box,n.__assign({component:"span",sx:{position:"static",display:"inline"}},{children:[e.jsxs(t.Box,n.__assign({ref:v.badgeRef,className:"deviation-badge","data-side":v.side||"right",sx:n.__assign(n.__assign({fontStyle:"normal",position:"absolute",zIndex:30+x,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(a=v.style)||void 0===a?void 0:a.badgeBg)||"#EEF2FF",color:(null===(s=v.style)||void 0===s?void 0:s.badgeText)||r.DEFAULT_DEVIAION_COLOR,border:"1px solid ".concat((null===(l=v.style)||void 0===l?void 0:l.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden",transition:"none"},"left"===v.side?{right:"-16px",transform:"".concat(m," translateX(calc(100% + 8px))")}:{left:"-16px",transform:"".concat(m," translateX(calc(-100% - 8px))")}),v.isConnected&&v.style&&{outline:"2px solid ".concat(v.style.badgeBorder),outlineOffset:"1px"})},{children:[e.jsxs(t.Box,n.__assign({onClick:function(n){n.stopPropagation(),v.onSummaryClick&&v.onSummaryClick(n)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[e.jsx(t.Box,n.__assign({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:v.label})),("left"===v.side||v.isOrphan)&&e.jsx(t.Box,n.__assign({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(d=v.style)||void 0===d?void 0:d.badgeBorder)||"#C7D2FE")}},{children:null!=v.score&&"N/A"!==v.score&&"NA"!==v.score&&0!==v.score?"".concat(v.score):"N/A"===v.score||"NA"===v.score?"N/A":"Same"}))]})),("left"===v.side||v.isOrphan)&&e.jsx(t.Box,n.__assign({onClick:function(n){n.stopPropagation(),v.onClick&&v.onClick(n)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(c=v.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:e.jsx(o.EllipsisVertical,{size:12,color:(null===(u=v.style)||void 0===u?void 0:u.badgeText)||"#3730A3"})}))]})),h]}))},table:function(i){var r=i.children;return e.jsx(t.Box,n.__assign({sx:{display:"block",width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box",contain:"inline-size",overflowX:"auto",overflowY:"hidden",overscrollBehaviorX:"contain",WebkitOverflowScrolling:"touch",my:1}},{children:e.jsx(t.Box,n.__assign({component:"table",sx:{width:"600px",minWidth:"600px",tableLayout:"fixed",borderCollapse:"collapse",fontSize:"inherit"}},{children:r}))}))},thead:function(i){var r=i.children;return e.jsx(t.Box,n.__assign({component:"thead"},{children:r}))},tbody:function(i){var r=i.children;return e.jsx(t.Box,n.__assign({component:"tbody"},{children:r}))},tr:function(i){var r=i.children;return e.jsx(t.Box,n.__assign({component:"tr",sx:{borderBottom:"1px solid #E5E7EB"}},{children:r}))},th:function(i){var r=i.children;return e.jsx(t.Box,n.__assign({component:"th",sx:{border:"1px solid #E5E7EB",padding:"8px",textAlign:"left",verticalAlign:"top",fontWeight:600,backgroundColor:"#F9FAFB",whiteSpace:"normal",wordBreak:"break-word",overflowWrap:"anywhere"}},{children:r}))},td:function(i){var r=i.children;return e.jsx(t.Box,n.__assign({component:"td",sx:{border:"1px solid #E5E7EB",padding:"8px",verticalAlign:"top",whiteSpace:"normal",wordBreak:"break-word",overflowWrap:"anywhere"}},{children:r}))},code:function(t){var i=t.children;return e.jsx("span",n.__assign({style:{fontFamily:"inherit",fontSize:"inherit"}},{children:i}))},pre:function(t){var i=t.children;return e.jsx("span",n.__assign({style:{fontFamily:"inherit",fontSize:"inherit",display:"block",whiteSpace:"pre-wrap"}},{children:i}))},updated:function(n){var t=n.children;return e.jsx(e.Fragment,{children:t})},deleted:function(t){var i=t.children,r=C(i,function(n){return u.default.cloneElement(n,{"data-is-suggested-deviation-fix":"true"})});return e.jsx("span",n.__assign({style:{boxShadow:"inset 0 1px 0 #EF4444, inset 0 -1px 0 #EF4444",backgroundColor:"#FCCCCC",textDecoration:"line-through"}},{children:r}))},changed:function(t){var i=t.children,r=C(i,function(n){return u.default.cloneElement(n,{"data-is-suggested-deviation-fix":"true"})});return e.jsx("span",n.__assign({style:{boxShadow:"inset 0 1px 0 #2F59FF, inset 0 -1px 0 #2F59FF",backgroundColor:"#D5E8FF"}},{children:r}))},ul:function(i){var r=i.children,o=n.__rest(i,["children"]);return e.jsx(t.Box,n.__assign({component:"ul",sx:{mt:1,mb:1,pl:3,listStyleType:"disc"}},o,{children:r}))},ol:function(i){var r=i.children,o=n.__rest(i,["children"]);return e.jsx(t.Box,n.__assign({component:"ol",sx:{mt:1,mb:1,pl:3,listStyleType:"decimal"}},o,{children:r}))},li:function(i){var r=i.children,o=n.__rest(i,["children"]);return e.jsx(t.Box,n.__assign({component:"li",sx:{mb:.5,display:"list-item"}},o,{children:r}))}}},[]),F=function(n){if(!n||"string"!=typeof n)return"";var e=n,t=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/((?:<\/?[a-z]+[^>]*>\s*)+)([*+\-] |\d+\. )/gi,"$2$1")).replace(/\\(['"])/g,"$1").replace(/\\n/g,"\n").replace(/\\\./g,".").replace(/\r\n/g,"\n")).replace(/^(\d+\.)(\s{2,})/gm,function(n,e,t){return"".concat(e.slice(0,-1),"\\.").concat(t)})).replace(/^(\d+\.)\s*\n+(\s+)(\S)/gm,function(n,e,t,i){return"".concat(e," ").concat(i)})).replace(/([^\n])\n(#{1,6} )/g,"$1\n\n$2")).replace(/([^\n])\n([ \t]*(?:[#*+\-] |\d+\. ))/g,"$1\n\n$2")).replace(/\n{3,}/g,"\n\n")).replace(/^[ \t]+(?![ \t]*([\*\-\+] |\d+\. ))/gm,function(n){return n.replace(/ /g," ").replace(/\t/g,"    ")})).split(/(\n{2,})/);return(e=t.map(function(n){return/^\n+$/.test(n)||/\|.*\|/.test(n)&&/\|[\s:|-]+\|/.test(n)||/^#{1,6} /.test(n.trimStart())?n:n.replace(/\n(?=[^\n])/g,function(e,t){var i=n.slice(t+1);return/^[ \t]*([#>|\-*+]|\d+\.)/.test(i)?"\n":" "})}).join("")).trim()},z=function(n){return n.replace(/[\.,;:]/g," ")},A=i.useMemo(function(){return p.map(function(n){return{id:n.id,connected:n.isConnected,stackIndex:n.stackIndex,size:n.size}})},[p]),M=i.useMemo(function(){var e=F(l||""),t=y?z(e):e,i=(p||[]).map(function(n){var e,t;return{id:null==n?void 0:n.id,highlight:F((null==n?void 0:n.highlight)||""),highlightColor:(null===(e=null==n?void 0:n.style)||void 0===e?void 0:e.highlightBg)||(null===(t=null==n?void 0:n.style)||void 0===t?void 0:t.badgeBg)||_}}).filter(function(n){return n.id&&n.highlight}),r={};i.forEach(function(n){r[n.highlight]||(r[n.highlight]=[]),r[n.highlight].push(n)});var o=function(n,e,t,i){void 0===e&&(e=""),void 0===i&&(i=[]);var r=!1,o=function(n){var o=function(n,e,t){var i,r,o;void 0===e&&(e="");var a=n.match(/^(\s*)([\s\S]*?)(\s*)$/);if(!a)return n;var s=null!==(i=a[1])&&void 0!==i?i:"",l=null!==(r=a[2])&&void 0!==r?r:"",d=null!==(o=a[3])&&void 0!==o?o:"";return l?s+function(n,e){void 0===n&&(n="");var t=e?' data-highlight-color="'.concat(e,'"'):"",i=n?' data-badge-id="'.concat(n,'"'):"";return"<mark".concat(i).concat(t,">")}(e,t)+l+"</mark>"+d:n}(n,e,t),a=o;if(!r&&i.length>0){r=!0;var s="",l="";i.forEach(function(n){s+=function(n){return'<span data-badge-id="'.concat(n,'">')}(n.id),l="</span>"+l}),a=s+o+l}return"​"+a};return n.split(/(\n+)/).map(function(n){return/^\n+$/.test(n)?n:n.trim()?""===n.replace(/[|:\-\s]/g,"")&&n.includes("-")?n:n.includes("|")?n.split(/(\|)/).map(function(n){return"|"!==n&&n.trim()?o(n):n}).join(""):o(n):n}).join("")},a=[];Object.entries(r).forEach(function(n){var i=n[0],r=n[1],o=e.indexOf(i),l=!1;if(-1===o&&y){var d=z(i);-1!==(o=t.indexOf(d))&&(l=!0)}if(-1!==o){for(var c=r[0].highlightColor,u=1;u<r.length;u++)c=s.mixHexColors(c,r[u].highlightColor||"");a.push({highlight:i,start:o,end:o+i.length,badges:r,color:c,usedLooseMatch:l})}});var d=new Set(Object.keys(r));(m||[]).forEach(function(n){if(n){var i=F(n);if(i&&!d.has(i)){var r=e.indexOf(i),o=!1;if(-1===r&&y){var s=z(i);-1!==(r=t.indexOf(s))&&(o=!0)}if(-1!==r){var l=e.slice(0,r);(l.match(/</g)||[]).length===(l.match(/>/g)||[]).length&&a.push({highlight:i,start:r,end:r+i.length,badges:[],color:_||"",usedLooseMatch:o})}}}}),a.sort(function(n,e){return n.start-e.start||e.end-n.end});var c=[],u={};a.forEach(function(n,e){for(var t=n.start,i=n.end,r=0,o=c;r<o.length;r++){var a=o[r],s=a.start,l=a.end,d=t<l&&i>l&&t>=s,h=t<s&&i>s&&i<=l;if(t>=s&&i<=l){n.orphaned=!0,u[e]=a.matchIdx;break}d&&(t=l),h&&(i=s)}n.trimmedStart=t,n.trimmedEnd=i,!n.orphaned&&t<i&&c.push({start:t,end:i,matchIdx:e})});var h={};Object.entries(u).forEach(function(n){var e=n[0],t=n[1],i=Number(e);h[t]||(h[t]=[]),h[t].push(i)});var g=a.map(function(e,t){return n.__assign(n.__assign({},e),{idx:t})}).filter(function(n){return!n.orphaned}).sort(function(n,e){var t,i;return(null!==(t=e.trimmedStart)&&void 0!==t?t:e.start)-(null!==(i=n.trimmedStart)&&void 0!==i?i:n.start)});return g.forEach(function(n){var t,i,r,l,d=null!==(t=n.trimmedStart)&&void 0!==t?t:n.start,c=null!==(i=n.trimmedEnd)&&void 0!==i?i:n.end;if(!(d>=c)){var u=e.slice(d,c),g=function(n,e,t,i){if(!t.length)return n;var r=t.map(function(n){return a[n]}).sort(function(n,e){return n.start-e.start}),l="",d=0;return r.forEach(function(t){var r,a,c=Math.max(d,t.start-e),u=Math.max(c,t.end-e);if(!(c>=u)){var h=s.mixHexColors(i,t.color||"");l+=n.slice(d,c),l+=o(n.slice(c,u),(null===(a=null===(r=t.badges)||void 0===r?void 0:r[0])||void 0===a?void 0:a.id)||"",h,t.badges||[]),d=u}}),l+=n.slice(d)}(n.usedLooseMatch||d!==n.start||c!==n.end?u:n.highlight,n.start,h[n.idx]||[],n.color),p=o(g,(null===(l=null===(r=n.badges)||void 0===r?void 0:r[0])||void 0===l?void 0:l.id)||"",n.color,n.badges||[]);e=e.slice(0,d)+p+e.slice(c)}}),e},[l,p,m,_,y]),T=i.useMemo(function(){return d?F(d||""):""},[d]),O=!!d,W={"& *":{fontFamily:"inherit"},"& code, & pre, & kbd, & samp":{fontFamily:"inherit !important",fontSize:"inherit",background:"none",padding:0,border:"none",whiteSpace:"pre-wrap"},"& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"}},q=n.__assign(n.__assign(n.__assign(n.__assign({},c),W),{position:"relative",width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:2}),O?{color:"transparent",userSelect:"none",pointerEvents:"none","& .deviation-badge":{pointerEvents:"auto"},"& table":{visibility:"hidden",margin:"0 !important"},"& th, & td":{padding:"0 !important",border:"none !important",backgroundColor:"transparent !important"},"& tr":{border:"none !important"},"& p:empty":{display:"none"}}:{}),I=n.__assign(n.__assign(n.__assign({},c),W),{position:"relative",width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:1,pointerEvents:"auto"});return i.useLayoutEffect(function(){if(E.current){var n=function(){var n=Array.from(E.current.querySelectorAll(".deviation-badge"));if(0!==n.length){n.forEach(function(n){n.style.setProperty("--badge-nudge","0px")});var e=n.filter(function(n){return"left"===n.dataset.side}),t=n.filter(function(n){return"left"!==n.dataset.side}),i=E.current.getBoundingClientRect(),r=i.bottom-4,o=i.top+4,a=function(n){if(0!==n.length){var e=n.map(function(n){var e=n.getBoundingClientRect();return{el:n,naturalTop:e.top,height:e.height,currentTop:e.top}});e.sort(function(n,e){return n.naturalTop-e.naturalTop});var t=[],i=[];e.forEach(function(n){if(0===i.length)i.push(n);else{var e=i[i.length-1],r=e.currentTop+e.height;n.naturalTop<r+8?(n.currentTop=r+8,i.push(n)):(t.push(i),i=[n])}}),i.length>0&&t.push(i),t.forEach(function(n){var e=n[n.length-1],t=e.currentTop+e.height;if(t>r){var i=t-r,a=n[0].currentTop-o,s=Math.max(0,Math.min(i,a));n.forEach(function(n){n.currentTop-=s})}}),t.flat().forEach(function(n){var e=n.currentTop-n.naturalTop;n.el.style.setProperty("--badge-nudge","".concat(e,"px"))})}};a(e),a(t)}},e=requestAnimationFrame(function(){requestAnimationFrame(function(){n()})}),t=new ResizeObserver(function(){requestAnimationFrame(n)});return t.observe(E.current),function(){t.disconnect(),cancelAnimationFrame(e)}}},[M,B,A]),e.jsxs(t.Box,n.__assign({ref:E,sx:{position:"relative",display:"grid",gridTemplateColumns:"minmax(0, 1fr)",width:"100%",maxWidth:"100%",minWidth:0}},{children:[e.jsx(t.Typography,n.__assign({component:"div",sx:n.__assign(n.__assign({},q),{padding:"3px"})},{children:e.jsx(h.default,n.__assign({components:S,remarkPlugins:f,rehypePlugins:v},{children:M.replace(/#{3}/g,"")}))})),O&&e.jsx(t.Typography,n.__assign({component:"div",sx:I},{children:e.jsx(h.default,n.__assign({components:S,remarkPlugins:f,rehypePlugins:v},{children:T}))}))]}))},s.areMarkdownPropsEqual);exports.MemoizedMarkdown=x;
2
2
  //# sourceMappingURL=memoizedMarkdown.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("tslib"),i=require("react"),t=require("@tanstack/react-query"),o=require("../service/onDemandApi.js"),e=function(n,i,t){var o;return Array.isArray(n)?Array.isArray(i)&&0!==i.length?Number.isNaN(t)?(console.warn("[findCitation] citationNumber is NaN"),null):null!==(o=n.find(function(n){var o,e=function(n){var i,t,o,e,a;if(null==n)return console.warn("[getCitationType] received null or undefined citation"),"";var r=null!==(a=null!==(e=null!==(t=null===(i=null==n?void 0:n.customMetaData)||void 0===i?void 0:i.type)&&void 0!==t?t:null===(o=null==n?void 0:n.customMetadata)||void 0===o?void 0:o.type)&&void 0!==e?e:null==n?void 0:n.type)&&void 0!==a?a:"";return r||console.warn("[getCitationType] citation has no resolvable type field",n),r}(n);return(null===(o=function(n){var i;return null==n?(console.warn("[getCitationNumber] received null or undefined citation"),""):(null==n.citation_number&&console.warn("[getCitationNumber] citation is missing citation_number field",n),null!==(i=null==n?void 0:n.citation_number)&&void 0!==i?i:"")}(n))||void 0===o?void 0:o.toString())===t.toString()&&i.some(function(n){return null==e?void 0:e.includes(n)})}))&&void 0!==o?o:null:(console.warn("[findCitation] citationTypes is empty or falsy",i),null):(console.warn("[findCitation] citations is not an array",n),null)};exports.useOnDemandCitationFetch=function(a){var r=a.msg,l=a.citationType,u=a.citationNumber,c=a.enabled,s=void 0!==c&&c,d=a.accessToken,v=a.baseUrl,_=a.orgName,f=a.citationAssistantProcessingName,m=a.citationAgentName,h=(null==r?void 0:r.requestId)||(null==r?void 0:r.id)||"",y=i.useMemo(function(){return function(n){switch(n){case"artifact_chunks":return["artifact_chunks","scanned_doc_citation","scanned_doc_citations"];case"rai_artifact_citation":return["rai_artifact_citation","rai_artifact_citations"];case"json_chunks":return["json_chunks"];case"scanned_doc_citation":return["scanned_doc_citation","scanned_doc_citations","artifact_chunks"];case"scanned_doc_citations":return["scanned_doc_citations","scanned_doc_citation","artifact_chunks"];default:return[n]}}(l)},[l]),g=function(){switch(l){case"artifact_chunks":case"scanned_doc_citations":return"scanned_doc_citation";case"rai_artifact_citation":return"rai_artifact_citation";default:return l}}(),p=(null==r?void 0:r.isEcgPayloadActive)?i.useMemo(function(){return["onDemandCitationFetch",h,g,null==r?void 0:r.customCitationId]},[h,g,null==r?void 0:r.customCitationId]):i.useMemo(function(){return["onDemandCitationFetch",h,g,u]},[h,g,u]),C=i.useMemo(function(){return e(null==r?void 0:r.citations,y,u)},[null==r?void 0:r.citations,y,u]),b=Boolean(s&&h&&g&&v&&_&&!Number.isNaN(u)&&!C),N=d,w=!0===(null==r?void 0:r.isStreamEnd),A=t.useQuery({queryKey:p,queryFn:function(){return n.__awaiter(void 0,void 0,void 0,function(){var i,t,e,a,l,c,s,d;return n.__generator(this,function(n){switch(n.label){case 0:return[4,o.fetchOnDemandCitation(h,g,u,null!==(t=null==r?void 0:r.content)&&void 0!==t?t:"",N,v,null!=f?f:"",_,null!=m?m:"",null!==(e=null==r?void 0:r.isEcgPayloadActive)&&void 0!==e&&e,null!==(a=null==r?void 0:r.ecg_agent_name)&&void 0!==a?a:"",null!==(l=null==r?void 0:r.customCitationId)&&void 0!==l?l:"",null!==(c=null==r?void 0:r.plan_id)&&void 0!==c?c:"",null!==(s=null==r?void 0:r.ui_chat_history)&&void 0!==s?s:void 0)];case 1:if((i=n.sent()).error||!i.responseData)throw new Error((null===(d=i.error)||void 0===d?void 0:d.errorMessage)||"Failed to fetch on-demand citation");return[2,i.responseData]}})})},enabled:b&&w&&Boolean(null==r?void 0:r.content),staleTime:1/0,cacheTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:!1}),M=i.useMemo(function(){var n,i,t,o,a,l,c,s=null!==(t=null===(i=null===(n=A.data)||void 0===n?void 0:n.result)||void 0===i?void 0:i.citations)&&void 0!==t?t:[];return Array.isArray(s)&&0!==s.length?(null==r?void 0:r.customCitationId)?null!==(a=null!==(o=s.find(function(n){var i,t,o=null!==(t=null!==(i=null==n?void 0:n.title)&&void 0!==i?i:null==n?void 0:n.display_name)&&void 0!==t?t:"";return"string"==typeof o&&o.includes(r.customCitationId)}))&&void 0!==o?o:s[0])&&void 0!==a?a:null:null!==(c=null!==(l=e(s,y,u))&&void 0!==l?l:s[0])&&void 0!==c?c:null:null},[null==r?void 0:r.customCitationId,u,y,A.data]);return{citation:null!=C?C:M,isFetching:A.isFetching,isLoading:A.isLoading,isComplete:A.isSuccess,status:A.status,refetch:A.refetch}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("tslib"),i=require("react"),t=require("@tanstack/react-query"),e=require("../service/onDemandApi.js"),o=function(n,i,t){var e;return Array.isArray(n)?Array.isArray(i)&&0!==i.length?Number.isNaN(t)?(console.warn("[findCitation] citationNumber is NaN"),null):null!==(e=n.find(function(n){var e,o=function(n){var i,t,e,o,a;if(null==n)return console.warn("[getCitationType] received null or undefined citation"),"";var l=null!==(a=null!==(o=null!==(t=null===(i=null==n?void 0:n.customMetaData)||void 0===i?void 0:i.type)&&void 0!==t?t:null===(e=null==n?void 0:n.customMetadata)||void 0===e?void 0:e.type)&&void 0!==o?o:null==n?void 0:n.type)&&void 0!==a?a:"";return l||console.warn("[getCitationType] citation has no resolvable type field",n),l}(n);return(null===(e=function(n){var i;return null==n?(console.warn("[getCitationNumber] received null or undefined citation"),""):(null==n.citation_number&&console.warn("[getCitationNumber] citation is missing citation_number field",n),null!==(i=null==n?void 0:n.citation_number)&&void 0!==i?i:"")}(n))||void 0===e?void 0:e.toString())===t.toString()&&i.some(function(n){return null==o?void 0:o.includes(n)})}))&&void 0!==e?e:null:(console.warn("[findCitation] citationTypes is empty or falsy",i),null):(console.warn("[findCitation] citations is not an array",n),null)};exports.useOnDemandCitationFetch=function(a){var l=a.msg,r=a.citationType,u=a.citationNumber,c=a.enabled,s=void 0!==c&&c,d=a.accessToken,v=a.baseUrl,_=a.orgName,f=a.citationAssistantProcessingName,m=a.citationAgentName,h=(null==l?void 0:l.requestId)||(null==l?void 0:l.id)||"",y=i.useMemo(function(){return function(n){switch(n){case"artifact_chunks":return["artifact_chunks","scanned_doc_citation","scanned_doc_citations"];case"rai_artifact_citation":return["rai_artifact_citation","rai_artifact_citations"];case"json_chunks":return["json_chunks"];case"scanned_doc_citation":return["scanned_doc_citation","scanned_doc_citations","artifact_chunks"];case"scanned_doc_citations":return["scanned_doc_citations","scanned_doc_citation","artifact_chunks"];default:return[n]}}(r)},[r]),g=function(){switch(r){case"artifact_chunks":case"scanned_doc_citations":return"scanned_doc_citation";case"rai_artifact_citation":return"rai_artifact_citation";default:return r}}(),p=(null==l?void 0:l.isEcgPayloadActive)?i.useMemo(function(){return["onDemandCitationFetch",h,g,null==l?void 0:l.customCitationId,null==l?void 0:l.ecg_agent_name]},[h,g,null==l?void 0:l.customCitationId,null==l?void 0:l.ecg_agent_name]):i.useMemo(function(){return["onDemandCitationFetch",h,g,u]},[h,g,u]),C=i.useMemo(function(){return o(null==l?void 0:l.citations,y,u)},[null==l?void 0:l.citations,y,u]),b=Boolean(s&&h&&g&&v&&_&&!Number.isNaN(u)&&!C),N=d,w=!0===(null==l?void 0:l.isStreamEnd),A=t.useQuery({queryKey:p,queryFn:function(){return n.__awaiter(void 0,void 0,void 0,function(){var i,t,o,a,r,c,s,d;return n.__generator(this,function(n){switch(n.label){case 0:return[4,e.fetchOnDemandCitation(h,g,u,null!==(t=null==l?void 0:l.content)&&void 0!==t?t:"",N,v,null!=f?f:"",_,null!=m?m:"",null!==(o=null==l?void 0:l.isEcgPayloadActive)&&void 0!==o&&o,null!==(a=null==l?void 0:l.ecg_agent_name)&&void 0!==a?a:"",null!==(r=null==l?void 0:l.customCitationId)&&void 0!==r?r:"",null!==(c=null==l?void 0:l.plan_id)&&void 0!==c?c:"",null!==(s=null==l?void 0:l.ui_chat_history)&&void 0!==s?s:void 0)];case 1:if((i=n.sent()).error||!i.responseData)throw new Error((null===(d=i.error)||void 0===d?void 0:d.errorMessage)||"Failed to fetch on-demand citation");return[2,i.responseData]}})})},enabled:b&&w&&Boolean(null==l?void 0:l.content),staleTime:1/0,cacheTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:!1}),M=i.useMemo(function(){var n,i,t,e,a,r,c,s=null!==(t=null===(i=null===(n=A.data)||void 0===n?void 0:n.result)||void 0===i?void 0:i.citations)&&void 0!==t?t:[];return Array.isArray(s)&&0!==s.length?(null==l?void 0:l.customCitationId)?null!==(a=null!==(e=s.find(function(n){var i,t,e=null!==(t=null!==(i=null==n?void 0:n.title)&&void 0!==i?i:null==n?void 0:n.display_name)&&void 0!==t?t:"";return"string"==typeof e&&e.includes(l.customCitationId)}))&&void 0!==e?e:s[0])&&void 0!==a?a:null:null!==(c=null!==(r=o(s,y,u))&&void 0!==r?r:s[0])&&void 0!==c?c:null:null},[null==l?void 0:l.customCitationId,u,y,A.data]);return{citation:null!=C?C:M,isFetching:A.isFetching,isLoading:A.isLoading,isComplete:A.isSuccess,status:A.status,refetch:A.refetch}};
2
2
  //# sourceMappingURL=useOnDemandCitationFetch.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("axios"),t=require("./apicache.service.js"),n=require("../types/onDemandApi.types.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=a(r),o=72e5,i=function(e){if(e&&"object"==typeof e){var r=e;return"string"==typeof r.message?r.message:"string"==typeof r.errorMessage?r.errorMessage:"string"==typeof r.error?r.error:r.error&&"object"==typeof r.error&&"string"==typeof r.error.message?r.error.message:"string"==typeof r.details?r.details:r}},c=function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){if(s.default.isAxiosError(r)){if("ECONNABORTED"===(t=r).code)return[2,{type:n.NetworkErrorType.TIMEOUT,message:"The request took too long to complete. Please try again.",originalError:r}];if(t.message.includes("net::ERR_NETWORK_CHANGED")||t.message.includes("net::ERR_INTERNET_DISCONNECTED")||t.message.includes("net::ERR_NAME_NOT_RESOLVED"))return[2,{type:n.NetworkErrorType.INTERNET_DISCONNECTED,message:"Internet connection issue detected. Please check your network.",originalError:r}];if(t.message.includes("Network Error")||"ERR_NETWORK"===t.code||t.message.includes("net::ERR_CONNECTION_REFUSED")||t.message.includes("net::ERR_EMPTY_RESPONSE"))return[2,{type:n.NetworkErrorType.SERVER_UNREACHABLE,message:"Unable to connect to server. The service may be down or unreachable.",originalError:r}];if(t.response&&t.response.status>=500)return[2,{type:n.NetworkErrorType.SERVER_ERROR,message:"Service Unavailable. Server error (".concat(t.response.status,")."),status:t.response.status,originalError:r}];if(t.response&&t.response.status>=400&&t.response.status<500)return[2,{type:n.NetworkErrorType.SERVER_ERROR,message:i(t.response.data)||"Request failed with status code ".concat(t.response.status),status:t.response.status,originalError:r}]}return[2,{type:n.NetworkErrorType.UNKNOWN_ERROR,message:"An unexpected error occurred. Please try again later.",originalError:r}]})})},u=function(r,t){void 0===t&&(t=18e4);var n=s.default.create({baseURL:r,timeout:t});return n.interceptors.request.use(function(r){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(e){return[2,r]})})},function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){switch(e.label){case 0:return[4,c(r)];case 1:return t=e.sent(),[2,Promise.reject(t)]}})})}),n.interceptors.response.use(function(e){return e},function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){switch(e.label){case 0:return[4,c(r)];case 1:return t=e.sent(),console.error("API Request Failed:",t),[2,Promise.reject(t)]}})})}),n},p=function(e,r,t){return"".concat(e,":").concat(r,":").concat(JSON.stringify(t||{}))},l=u(),_=function(r,t,a){return e.__awaiter(void 0,void 0,void 0,function(){var s,o,i,p,_,d,E;return e.__generator(this,function(g){switch(g.label){case 0:switch(g.trys.push([0,13,,15]),s=(null==a?void 0:a.baseURL)?u(a.baseURL):l,i=(o=a||{}).data,p=o.config,_=void 0,r.toLowerCase()){case"get":return[3,1];case"post":return[3,3];case"put":return[3,5];case"patch":return[3,7];case"delete":return[3,9]}return[3,11];case 1:return[4,s.get(t,p)];case 2:case 4:case 6:case 8:case 10:return _=g.sent(),[3,12];case 3:return[4,s.post(t,i,p)];case 5:return[4,s.put(t,i,p)];case 7:return[4,s.patch(t,i,p)];case 9:return d=e.__assign(e.__assign({},p),{data:i}),[4,s.delete(t,d)];case 11:throw new Error("Unsupported method: ".concat(r));case 12:return[2,{responseData:_.data,error:null}];case 13:return(E=g.sent()).type&&Object.values(n.NetworkErrorType).includes(E.type)?[2,{responseData:null,error:E}]:[4,c(E)];case 14:return[2,{responseData:null,error:g.sent()}];case 15:return[2]}})})},d=function(r,a,s){return e.__awaiter(void 0,void 0,void 0,function(){var i,c,u,l,d,E,g,f,y,h,v,R,m,N;return e.__generator(this,function(T){switch(T.label){case 0:return c=(i=s||{}).data,u=i.params,l=i.config,d=i.errorMessage,E=i.baseURL,g=i.cacheOption,f=i.shouldCache,y=null!==(N=null==g?void 0:g.ttl)&&void 0!==N?N:o,h=(null==g?void 0:g.key)||p(r,a,u),(null==g?void 0:g.forceRefresh)||(null==g?void 0:g.skipCache)?[3,2]:[4,t.apiCache.get(h)];case 1:if(v=T.sent())return[2,{responseData:v.data,error:null,cacheMeta:{isFromCache:!0,timestamp:v.timestamp,ttl:v.ttl,cacheKey:h}}];T.label=2;case 2:return R=e.__assign(e.__assign({},l),u&&{params:u}),[4,_(r,a,{data:c,config:R,baseURL:E})];case 3:return m=T.sent(),!(null==g?void 0:g.skipCache)&&null!=m.responseData&&(!f||f(m.responseData))?[4,t.apiCache.set(h,m.responseData,y)]:[3,5];case 4:T.sent(),T.label=5;case 5:return[2,{responseData:m.responseData,error:m.error?{errorMessage:m.error.type===n.NetworkErrorType.INTERNET_DISCONNECTED||m.error.type===n.NetworkErrorType.SLOW_CONNECTION||m.error.type===n.NetworkErrorType.TIMEOUT?m.error.message:m.error.type===n.NetworkErrorType.SERVER_UNREACHABLE?"Unable to connect to server. Please try again later.":d||m.error.message,errorObjData:m.error}:null,cacheMeta:{isFromCache:!1,timestamp:Date.now(),ttl:y,cacheKey:h}}]}})})};Object.defineProperty(exports,"NetworkErrorType",{enumerable:!0,get:function(){return n.NetworkErrorType}}),exports.DEFAULT_CACHE_TTL=o,exports.createApiInstance=u,exports.fetchOnDemandCitation=function(r,t,n,a,s,o,i,c,u,p,l,_,E,g){return e.__awaiter(void 0,void 0,void 0,function(){var s,f,y,h;return e.__generator(this,function(v){return s="artifact_chunks"===t||"scanned_doc_citation"===t?"artifact_chunks":t,f=p?_:"".concat(s,"_").concat(n),[2,d(y="post",h="/api/chat/chatResponse",{baseURL:o,data:{name:i||"citationsprocessing",organizationName:c,prompt:"",useAgent:{agent_name:u||"ProcessCitationsAgent",arguments:e.__assign(e.__assign({citation_type:t,is_primary_agent_request:!1},p&&{check_possible_citation_payload:!1}),{ui_request_body:e.__assign(e.__assign(e.__assign({llm_formatted_response:a,request_id:r,max_concurrent_citations:10,citation_id:f},p&&l&&{ecg_agent_name:l}),p&&E&&{plan_id:E}),p&&g&&{ui_chat_history:g})})}},config:{headers:{"Content-Type":"application/json"},withCredentials:!0},errorMessage:"Failed to fetch on-demand citation",cacheOption:{key:"".concat(y,":").concat(h,":onDemandCitation:").concat(r,":").concat(t,":").concat(p?_:n)},shouldCache:function(e){var r;return Array.isArray(null===(r=null==e?void 0:e.result)||void 0===r?void 0:r.citations)&&Boolean(e.result.citations[0])}})]})})},exports.generateCacheKey=p,exports.makeApiRequest=_,exports.makeApiRequestWithTTLCache=d;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("axios"),t=require("./apicache.service.js"),n=require("../types/onDemandApi.types.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=a(r),o=72e5,i=function(e){if(e&&"object"==typeof e){var r=e;return"string"==typeof r.message?r.message:"string"==typeof r.errorMessage?r.errorMessage:"string"==typeof r.error?r.error:r.error&&"object"==typeof r.error&&"string"==typeof r.error.message?r.error.message:"string"==typeof r.details?r.details:r}},c=function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){if(s.default.isAxiosError(r)){if("ECONNABORTED"===(t=r).code)return[2,{type:n.NetworkErrorType.TIMEOUT,message:"The request took too long to complete. Please try again.",originalError:r}];if(t.message.includes("net::ERR_NETWORK_CHANGED")||t.message.includes("net::ERR_INTERNET_DISCONNECTED")||t.message.includes("net::ERR_NAME_NOT_RESOLVED"))return[2,{type:n.NetworkErrorType.INTERNET_DISCONNECTED,message:"Internet connection issue detected. Please check your network.",originalError:r}];if(t.message.includes("Network Error")||"ERR_NETWORK"===t.code||t.message.includes("net::ERR_CONNECTION_REFUSED")||t.message.includes("net::ERR_EMPTY_RESPONSE"))return[2,{type:n.NetworkErrorType.SERVER_UNREACHABLE,message:"Unable to connect to server. The service may be down or unreachable.",originalError:r}];if(t.response&&t.response.status>=500)return[2,{type:n.NetworkErrorType.SERVER_ERROR,message:"Service Unavailable. Server error (".concat(t.response.status,")."),status:t.response.status,originalError:r}];if(t.response&&t.response.status>=400&&t.response.status<500)return[2,{type:n.NetworkErrorType.SERVER_ERROR,message:i(t.response.data)||"Request failed with status code ".concat(t.response.status),status:t.response.status,originalError:r}]}return[2,{type:n.NetworkErrorType.UNKNOWN_ERROR,message:"An unexpected error occurred. Please try again later.",originalError:r}]})})},u=function(r,t){void 0===t&&(t=18e4);var n=s.default.create({baseURL:r,timeout:t});return n.interceptors.request.use(function(r){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(e){return[2,r]})})},function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){switch(e.label){case 0:return[4,c(r)];case 1:return t=e.sent(),[2,Promise.reject(t)]}})})}),n.interceptors.response.use(function(e){return e},function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){switch(e.label){case 0:return[4,c(r)];case 1:return t=e.sent(),console.error("API Request Failed:",t),[2,Promise.reject(t)]}})})}),n},p=function(e,r,t){return"".concat(e,":").concat(r,":").concat(JSON.stringify(t||{}))},l=u(),_=function(r,t,a){return e.__awaiter(void 0,void 0,void 0,function(){var s,o,i,p,_,d,E;return e.__generator(this,function(g){switch(g.label){case 0:switch(g.trys.push([0,13,,15]),s=(null==a?void 0:a.baseURL)?u(a.baseURL):l,i=(o=a||{}).data,p=o.config,_=void 0,r.toLowerCase()){case"get":return[3,1];case"post":return[3,3];case"put":return[3,5];case"patch":return[3,7];case"delete":return[3,9]}return[3,11];case 1:return[4,s.get(t,p)];case 2:case 4:case 6:case 8:case 10:return _=g.sent(),[3,12];case 3:return[4,s.post(t,i,p)];case 5:return[4,s.put(t,i,p)];case 7:return[4,s.patch(t,i,p)];case 9:return d=e.__assign(e.__assign({},p),{data:i}),[4,s.delete(t,d)];case 11:throw new Error("Unsupported method: ".concat(r));case 12:return[2,{responseData:_.data,error:null}];case 13:return(E=g.sent()).type&&Object.values(n.NetworkErrorType).includes(E.type)?[2,{responseData:null,error:E}]:[4,c(E)];case 14:return[2,{responseData:null,error:g.sent()}];case 15:return[2]}})})},d=function(r,a,s){return e.__awaiter(void 0,void 0,void 0,function(){var i,c,u,l,d,E,g,f,y,h,v,R,m,N;return e.__generator(this,function(T){switch(T.label){case 0:return c=(i=s||{}).data,u=i.params,l=i.config,d=i.errorMessage,E=i.baseURL,g=i.cacheOption,f=i.shouldCache,y=null!==(N=null==g?void 0:g.ttl)&&void 0!==N?N:o,h=(null==g?void 0:g.key)||p(r,a,u),(null==g?void 0:g.forceRefresh)||(null==g?void 0:g.skipCache)?[3,2]:[4,t.apiCache.get(h)];case 1:if(v=T.sent())return[2,{responseData:v.data,error:null,cacheMeta:{isFromCache:!0,timestamp:v.timestamp,ttl:v.ttl,cacheKey:h}}];T.label=2;case 2:return R=e.__assign(e.__assign({},l),u&&{params:u}),[4,_(r,a,{data:c,config:R,baseURL:E})];case 3:return m=T.sent(),!(null==g?void 0:g.skipCache)&&null!=m.responseData&&(!f||f(m.responseData))?[4,t.apiCache.set(h,m.responseData,y)]:[3,5];case 4:T.sent(),T.label=5;case 5:return[2,{responseData:m.responseData,error:m.error?{errorMessage:m.error.type===n.NetworkErrorType.INTERNET_DISCONNECTED||m.error.type===n.NetworkErrorType.SLOW_CONNECTION||m.error.type===n.NetworkErrorType.TIMEOUT?m.error.message:m.error.type===n.NetworkErrorType.SERVER_UNREACHABLE?"Unable to connect to server. Please try again later.":d||m.error.message,errorObjData:m.error}:null,cacheMeta:{isFromCache:!1,timestamp:Date.now(),ttl:y,cacheKey:h}}]}})})};Object.defineProperty(exports,"NetworkErrorType",{enumerable:!0,get:function(){return n.NetworkErrorType}}),exports.DEFAULT_CACHE_TTL=o,exports.createApiInstance=u,exports.fetchOnDemandCitation=function(r,t,n,a,s,o,i,c,u,p,l,_,E,g){return e.__awaiter(void 0,void 0,void 0,function(){var s,f,y,h;return e.__generator(this,function(v){return s="artifact_chunks"===t||"scanned_doc_citation"===t?"artifact_chunks":t,f=p?_:"".concat(s,"_").concat(n),[2,d(y="post",h="/api/chat/chatResponse",{baseURL:o,data:{name:i||"citationsprocessing",organizationName:c,prompt:"",useAgent:{agent_name:u||"ProcessCitationsAgent",arguments:e.__assign(e.__assign({citation_type:t,is_primary_agent_request:!1},p&&{check_possible_citation_payload:!1}),{ui_request_body:e.__assign(e.__assign(e.__assign({llm_formatted_response:a,request_id:r,max_concurrent_citations:10,citation_id:f},p&&l&&{ecg_agent_name:l}),p&&E&&{plan_id:E}),p&&g&&{ui_chat_history:g})})}},config:{headers:{"Content-Type":"application/json"},withCredentials:!0},errorMessage:"Failed to fetch on-demand citation",cacheOption:{key:"".concat(y,":").concat(h,":onDemandCitation:").concat(r,":").concat(t,":").concat(p?_:n,":").concat(p?l:"")},shouldCache:function(e){var r;return Array.isArray(null===(r=null==e?void 0:e.result)||void 0===r?void 0:r.citations)&&Boolean(e.result.citations[0])}})]})})},exports.generateCacheKey=p,exports.makeApiRequest=_,exports.makeApiRequestWithTTLCache=d;
2
2
  //# sourceMappingURL=onDemandApi.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as o}from"tslib";import{jsxs as l,jsx as i}from"react/jsx-runtime";import e from"./components/ChatCitation.js";import{getColorCode as n}from"./utils/helpers.js";import t from"./components/Chip.js";import r from"./assets/message-chat-square.svg.js";import"@mui/icons-material/KeyboardArrowDown";import"@mui/icons-material/KeyboardArrowUp";import"@mui/icons-material/Clear";import d from"./components/InViewNavigation.js";import a from"./components/DetailedView.js";import u from"./components/SummarizedView.js";import v from"./components/RuleBook.js";import{useState as s,useRef as c,useMemo as h,useEffect as f,useCallback as m}from"react";import{defaultRenderer as p}from"./constants/renderer.js";import g from"./components/IconContainer.js";import{Table as y}from"lucide-react";import{BigQueryTable as b}from"./BigQueryTable.js";import x from"@mui/icons-material/CloseOutlined";var w=function(o,l,i){if(void 0===i&&(i="smooth"),l){for(var e=o.parentElement;e;){var n=window.getComputedStyle(e).overflowY;if(("auto"===n||"scroll"===n)&&e.scrollHeight>e.clientHeight)break;if(e===l){e=null;break}e=e.parentElement}var t=null!=e?e:l,r=o.getBoundingClientRect(),d=t.getBoundingClientRect(),a=t.scrollTop+r.top-d.top-(t.clientHeight-r.height)/2;t.scrollTo({top:Math.max(0,a),behavior:i})}};function C(C){var S,k,A,D,T,R,F,j,z,I,B,E,H,P,V,q,N,W,Y,K,O,M,Q,U,G,J,L,X,Z,$,_,oo,lo,io,eo,no,to,ro,ao,uo,vo,so,co,ho,fo,mo,po,go,yo=C.rootContainer,bo=C.chatContainer,xo=void 0===bo?{chatData:[]}:bo,wo=C.ruleBookContainer,Co=C.renderer,So=C.additionalData,ko=C.tableComponent,Ao=C.closePreview,Do=C.isRenderedCustomComponent,To=void 0!==Do&&Do,Ro=C.showRootContainer,Fo=void 0===Ro||Ro,jo=C.reversePanels,zo=void 0!==jo&&jo,Io=s(0),Bo=Io[0],Eo=Io[1],Ho=s(0),Po=Ho[0],Vo=Ho[1],qo=s(0),No=qo[0],Wo=qo[1],Yo=s(0),Ko=Yo[0],Oo=Yo[1],Mo=c(null),Qo=c(null),Uo=c(null),Go=h(function(){return o(o({},p),Co)},[Co]),Jo=h(function(){return!!((null==ko?void 0:ko.rows)&&Object.keys(ko.rows).length>0)},[ko]),Lo=h(function(){var o;return null!==(o=null==So?void 0:So.RuleBookDetailedViewVerticallyStacked)&&void 0!==o&&o},[null==So?void 0:So.RuleBookDetailedViewVerticallyStacked]);f(function(){var o,l;if((null==wo?void 0:wo.show)&&Mo.current){var i=null===(o=Mo.current)||void 0===o?void 0:o.querySelectorAll(".rule-book-highlight");if(Eo((null==i?void 0:i.length)||0),Vo(0),i&&i.length>0){var e=i[0];e.style.backgroundColor="#ffff5c",w(e,Mo.current)}}if((null==xo?void 0:xo.show)&&(null==Qo?void 0:Qo.current)){var n=null===(l=Qo.current)||void 0===l?void 0:l.querySelectorAll(".user-chat-highlight");if(Wo((null==n?void 0:n.length)||0),Oo(0),n&&n.length>0){var t=n[0];t.style.backgroundColor="#ffff5c";var r=requestAnimationFrame(function(){w(t,Uo.current)});return function(){return cancelAnimationFrame(r)}}}},[null==xo?void 0:xo.show,null==wo?void 0:wo.show,null==wo?void 0:wo.data,null==xo?void 0:xo.chatData]);var Xo=m(function(){var o;if(Po+1<Bo){var l=null===(o=Mo.current)||void 0===o?void 0:o.querySelectorAll(".rule-book-highlight");if(!l)return;l[Po].style.backgroundColor="#ffffb8";var i=Po+1;Vo(i);var e=l[i];e.style.backgroundColor="#ffff5c",w(e,Mo.current)}},[Po,Bo]),Zo=m(function(){var o;if(!(Po-1<0)){var l=null===(o=Mo.current)||void 0===o?void 0:o.querySelectorAll(".rule-book-highlight");if(l){l[Po].style.backgroundColor="#ffffb8";var i=Po-1,e=l[i];e.style.backgroundColor="#ffff5c",Vo(i),w(e,Mo.current)}}},[Po]),$o=m(function(){var o;if(Ko+1<No){var l=null===(o=Qo.current)||void 0===o?void 0:o.querySelectorAll(".user-chat-highlight");if(!l)return;l[Ko].style.backgroundColor="#ffffb8";var i=Ko+1,e=l[i];e.style.backgroundColor="#ffff5c",Oo(i),w(e,Uo.current)}},[Ko,No]),_o=m(function(){var o;if(!(Ko-1<0)){var l=null===(o=Qo.current)||void 0===o?void 0:o.querySelectorAll(".user-chat-highlight");if(l){l[Ko].style.backgroundColor="#ffffb8";var i=Ko-1,e=l[i];e.style.backgroundColor="#ffff5c",Oo(i),w(e,Uo.current)}}},[Ko]),ol=n((null==yo?void 0:yo.relevanceScore)||0),ll=h(function(){var e,n=l("span",o({style:o({display:"flex",border:"1px solid",alignItems:"center",gap:"4px",borderRadius:"6px",padding:"2px 8px",fontSize:"12px",borderColor:ol.border,backgroundColor:ol.background,color:ol.text},null===(e=null==yo?void 0:yo.slotStyles)||void 0===e?void 0:e.relevanceScore)},{children:[(null==yo?void 0:yo.relevanceTitle)||"Decision Strength",":"," ",(null==yo?void 0:yo.relevanceScore)||0,"%"]}),"relevance-score"),t=i("span",o({style:{display:"flex",alignItems:"center",gap:"4px",borderRadius:"6px",padding:"2px 8px",fontSize:"12px",backgroundColor:"white",color:"black",cursor:"pointer"},onClick:Ao},{children:i(x,{})}),"close-preview");return To&&!(null==So?void 0:So.isExpanded)?[n,t]:[n]},[To,ol.background,ol.border,ol.text,null==yo?void 0:yo.relevanceScore,null===(S=null==yo?void 0:yo.slotStyles)||void 0===S?void 0:S.relevanceScore,null==yo?void 0:yo.relevanceTitle]),il=h(function(){return[Bo>0&&i(d,{currentItemNumber:Po+1,totalItems:Bo,disableNext:Po+1>=Bo,onNext:Xo,onPrevious:Zo,disablePrevious:Po<=0},"rulebook-nav")]},[Po,Xo,Zo,Bo]),el=h(function(){return(null==So?void 0:So.RuleBookContainerHeight)?So.RuleBookContainerHeight:!(!Lo||(null==So?void 0:So.isExpanded))&&"600px"},[null==So?void 0:So.RuleBookContainerHeight,Lo]),nl=h(function(){var o,l;return[(null===(l=null===(o=null==xo?void 0:xo.detailedTab)||void 0===o?void 0:o.chip)||void 0===l?void 0:l.isActive)&&No>0&&i(d,{currentItemNumber:Ko+1,totalItems:No,onNext:$o,onPrevious:_o,disableNext:Ko+1>=No,disablePrevious:Ko<=0},"chat-nav")]},[null===(A=null===(k=null==xo?void 0:xo.detailedTab)||void 0===k?void 0:k.chip)||void 0===A?void 0:A.isActive,Ko,$o,_o,No]),tl=l("div",o({style:o({display:"flex",flexDirection:zo?Lo?"column-reverse":"row-reverse":Lo?"column":"row",gap:[(null==xo?void 0:xo.chatData)&&xo.chatData.length>0&&(xo.show||void 0===xo.show),(null==wo?void 0:wo.data)&&(wo.show||void 0===wo.show),Jo].filter(Boolean).length>1?"12px":"0",height:el||"100%",minHeight:0},null===(D=null==yo?void 0:yo.slotStyles)||void 0===D?void 0:D.container)},{children:[Jo&&i("span",o({style:o({flex:"1 1 0%",minWidth:0},null===(T=null==xo?void 0:xo.slotStyles)||void 0===T?void 0:T.outerContainer)},{children:i(e,o({title:"Invoice Data Preview",icon:i(g,{children:i(y,{size:16})}),slotStyles:{title:{color:"#475569",fontWeight:500}},secondaryActions:[]},{children:i("div",o({style:{height:"100%",maxHeight:(null==So?void 0:So.isExpanded)?"none":"275px",border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",backgroundColor:"#FFFFFF",position:"relative",overflow:"hidden"}},{children:(null==ko?void 0:ko.rows)&&i(b,{rows:ko.rows,columns:ko.columns||[]})}))}))})),(null==wo?void 0:wo.data)&&(wo.show||void 0===wo.show)&&i("span",o({style:o({flex:"1 1 0%",minWidth:0},null===(R=null==wo?void 0:wo.slotStyles)||void 0===R?void 0:R.outerContainer)},{children:i(e,o({title:null!==(F=null==wo?void 0:wo.title)&&void 0!==F?F:"Rule book",icon:null==wo?void 0:wo.ruleBookIcon,slotStyles:{title:o({color:"#475569",fontWeight:500},null===(j=null==wo?void 0:wo.slotStyles)||void 0===j?void 0:j.title),body:null===(z=null==wo?void 0:wo.slotStyles)||void 0===z?void 0:z.body},secondaryActions:(null==wo?void 0:wo.secondaryActions)?wo.secondaryActions(il):il},{children:i("div",o({style:o({height:"100%",maxHeight:"275px",minHeight:0,border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#F8FAFC",position:"relative",overflowY:"auto"},null===(I=null==wo?void 0:wo.slotStyles)||void 0===I?void 0:I.dataContainer)},{children:i("div",o({style:{padding:"12px",height:"100%",overflowY:"auto"},ref:Mo},{children:i(v,{data:wo.data,renderers:null!==(B=null==wo?void 0:wo.renderer)&&void 0!==B?B:Go})}))}))}))})),(null==xo?void 0:xo.chatData)&&xo.chatData.length>0&&(xo.show||void 0===xo.show)&&i("span",o({style:o({flex:"1 1 0%",minWidth:0},null===(E=null==xo?void 0:xo.slotStyles)||void 0===E?void 0:E.outerContainer)},{children:i(e,o({title:null!==(H=null==xo?void 0:xo.title)&&void 0!==H?H:"Chat",icon:null==xo?void 0:xo.chatIcon,containerStyles:null===(P=null==xo?void 0:xo.slotStyles)||void 0===P?void 0:P.container,slotStyles:{title:o({color:"#475569",fontWeight:500},null===(V=null==xo?void 0:xo.slotStyles)||void 0===V?void 0:V.title),body:null===(q=null==xo?void 0:xo.slotStyles)||void 0===q?void 0:q.body},primaryActions:[((null===(W=null===(N=null==xo?void 0:xo.summarizedTab)||void 0===N?void 0:N.chip)||void 0===W?void 0:W.show)||void 0===(null===(K=null===(Y=null==xo?void 0:xo.summarizedTab)||void 0===Y?void 0:Y.chip)||void 0===K?void 0:K.show))&&i(t,o({label:"Summarized"},null===(O=null==xo?void 0:xo.summarizedTab)||void 0===O?void 0:O.chip)),i(t,o({label:"Detailed"},null===(M=null==xo?void 0:xo.detailedTab)||void 0===M?void 0:M.chip))],secondaryActions:xo.secondaryActions?null==xo?void 0:xo.secondaryActions(nl):nl},{children:l("div",o({ref:Uo,style:o({height:"100%",maxHeight:"275px",border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#F8FAFC",position:"relative",overflowY:"auto"},null===(Q=null==xo?void 0:xo.slotStyles)||void 0===Q?void 0:Q.chatDataContainer)},{children:[(null===(G=null===(U=null==xo?void 0:xo.detailedTab)||void 0===U?void 0:U.chip)||void 0===G?void 0:G.isActive)&&i("div",o({ref:Qo,style:{position:(null==So?void 0:So.isExpanded)?"absolute":"relative",inset:0,padding:"12px",overflowY:"auto"}},{children:i(a,{chatData:null!==(J=xo.chatData)&&void 0!==J?J:[],assistantChatProps:o(o({},null===(X=null===(L=null==xo?void 0:xo.detailedTab)||void 0===L?void 0:L.view)||void 0===X?void 0:X.assistantChatProps),{renderers:null!==(_=null===($=null===(Z=null==xo?void 0:xo.detailedTab)||void 0===Z?void 0:Z.detailedViewRenderer)||void 0===$?void 0:$.assistantText)&&void 0!==_?_:Go}),userChatItemProps:o(o({},null===(lo=null===(oo=null==xo?void 0:xo.detailedTab)||void 0===oo?void 0:oo.view)||void 0===lo?void 0:lo.userChatItemProps),{renderers:null!==(no=null===(eo=null===(io=null==xo?void 0:xo.detailedTab)||void 0===io?void 0:io.detailedViewRenderer)||void 0===eo?void 0:eo.userText)&&void 0!==no?no:Go})})})),(null===(ro=null===(to=null==xo?void 0:xo.summarizedTab)||void 0===to?void 0:to.chip)||void 0===ro?void 0:ro.show)&&(null===(uo=null===(ao=null==xo?void 0:xo.summarizedTab)||void 0===ao?void 0:ao.chip)||void 0===uo?void 0:uo.isActive)&&i(u,o({chatData:null!==(vo=xo.chatData)&&void 0!==vo?vo:[]},null===(so=null==xo?void 0:xo.summarizedTab)||void 0===so?void 0:so.view,{renderer:null!==(ho=null===(co=null==xo?void 0:xo.summarizedTab)||void 0===co?void 0:co.summarizedViewRenderer)&&void 0!==ho?ho:Go}))]}))}))}))]}));return Fo?i(e,o({title:null==yo?void 0:yo.title,slotStyles:{title:null===(fo=null==yo?void 0:yo.slotStyles)||void 0===fo?void 0:fo.title,body:null===(mo=null==yo?void 0:yo.slotStyles)||void 0===mo?void 0:mo.body},containerStyles:null===(po=null==yo?void 0:yo.slotStyles)||void 0===po?void 0:po.container,icon:null!==(go=null==yo?void 0:yo.icon)&&void 0!==go?go:i(g,{children:i("img",{src:r,alt:"chat icon",style:{width:16,height:16}})}),secondaryActions:(null==yo?void 0:yo.secondaryActions)?yo.secondaryActions(ll):ll},{children:tl})):tl}export{C as default};
1
+ import{__assign as o}from"tslib";import{jsxs as l,jsx as i}from"react/jsx-runtime";import e from"./components/ChatCitation.js";import{getColorCode as n}from"./utils/helpers.js";import t from"./components/Chip.js";import r from"./assets/message-chat-square.svg.js";import"@mui/icons-material/KeyboardArrowDown";import"@mui/icons-material/KeyboardArrowUp";import"@mui/icons-material/Clear";import d from"./components/InViewNavigation.js";import a from"./components/DetailedView.js";import u from"./components/SummarizedView.js";import v from"./components/RuleBook.js";import{useState as s,useRef as c,useMemo as h,useEffect as f,useCallback as m}from"react";import{defaultRenderer as p}from"./constants/renderer.js";import g from"./components/IconContainer.js";import{Table as y}from"lucide-react";import{BigQueryTable as b}from"./BigQueryTable.js";import x from"@mui/icons-material/CloseOutlined";var w=function(o,l,i){if(void 0===i&&(i="smooth"),l){for(var e=o.parentElement;e;){var n=window.getComputedStyle(e).overflowY;if(("auto"===n||"scroll"===n)&&e.scrollHeight>e.clientHeight)break;if(e===l){e=null;break}e=e.parentElement}var t=null!=e?e:l,r=o.getBoundingClientRect(),d=t.getBoundingClientRect(),a=t.scrollTop+r.top-d.top-(t.clientHeight-r.height)/2;t.scrollTo({top:Math.max(0,a),behavior:i})}},C={chatData:[]};function S(S){var k,A,D,T,R,F,j,z,I,B,E,H,P,V,q,N,W,Y,K,O,M,Q,U,G,J,L,X,Z,$,_,oo,lo,io,eo,no,to,ro,ao,uo,vo,so,co,ho,fo,mo,po,go,yo,bo=S.rootContainer,xo=S.chatContainer,wo=void 0===xo?C:xo,Co=S.ruleBookContainer,So=S.renderer,ko=S.additionalData,Ao=S.tableComponent,Do=S.closePreview,To=S.isRenderedCustomComponent,Ro=void 0!==To&&To,Fo=S.showRootContainer,jo=void 0===Fo||Fo,zo=S.reversePanels,Io=void 0!==zo&&zo,Bo=s(0),Eo=Bo[0],Ho=Bo[1],Po=s(0),Vo=Po[0],qo=Po[1],No=s(0),Wo=No[0],Yo=No[1],Ko=s(0),Oo=Ko[0],Mo=Ko[1],Qo=c(null),Uo=c(null),Go=c(null),Jo=h(function(){return o(o({},p),So)},[So]),Lo=h(function(){return!!((null==Ao?void 0:Ao.rows)&&Object.keys(Ao.rows).length>0)},[Ao]),Xo=h(function(){var o;return null!==(o=null==ko?void 0:ko.RuleBookDetailedViewVerticallyStacked)&&void 0!==o&&o},[null==ko?void 0:ko.RuleBookDetailedViewVerticallyStacked]);f(function(){var o,l;if((null==Co?void 0:Co.show)&&Qo.current){var i=null===(o=Qo.current)||void 0===o?void 0:o.querySelectorAll(".rule-book-highlight");if(Ho((null==i?void 0:i.length)||0),qo(0),i&&i.length>0){var e=i[0];e.style.backgroundColor="#ffff5c",w(e,Qo.current)}}if((null==wo?void 0:wo.show)&&(null==Uo?void 0:Uo.current)){var n=null===(l=Uo.current)||void 0===l?void 0:l.querySelectorAll(".user-chat-highlight");if(Yo((null==n?void 0:n.length)||0),Mo(0),n&&n.length>0){var t=n[0];t.style.backgroundColor="#ffff5c";var r=requestAnimationFrame(function(){w(t,Go.current)});return function(){return cancelAnimationFrame(r)}}}},[null==wo?void 0:wo.show,null==Co?void 0:Co.show,null==Co?void 0:Co.data,null==wo?void 0:wo.chatData]);var Zo=m(function(){var o;if(Vo+1<Eo){var l=null===(o=Qo.current)||void 0===o?void 0:o.querySelectorAll(".rule-book-highlight");if(!l)return;l[Vo].style.backgroundColor="#ffffb8";var i=Vo+1;qo(i);var e=l[i];e.style.backgroundColor="#ffff5c",w(e,Qo.current)}},[Vo,Eo]),$o=m(function(){var o;if(!(Vo-1<0)){var l=null===(o=Qo.current)||void 0===o?void 0:o.querySelectorAll(".rule-book-highlight");if(l){l[Vo].style.backgroundColor="#ffffb8";var i=Vo-1,e=l[i];e.style.backgroundColor="#ffff5c",qo(i),w(e,Qo.current)}}},[Vo]),_o=m(function(){var o;if(Oo+1<Wo){var l=null===(o=Uo.current)||void 0===o?void 0:o.querySelectorAll(".user-chat-highlight");if(!l)return;l[Oo].style.backgroundColor="#ffffb8";var i=Oo+1,e=l[i];e.style.backgroundColor="#ffff5c",Mo(i),w(e,Go.current)}},[Oo,Wo]),ol=m(function(){var o;if(!(Oo-1<0)){var l=null===(o=Uo.current)||void 0===o?void 0:o.querySelectorAll(".user-chat-highlight");if(l){l[Oo].style.backgroundColor="#ffffb8";var i=Oo-1,e=l[i];e.style.backgroundColor="#ffff5c",Mo(i),w(e,Go.current)}}},[Oo]),ll=n((null==bo?void 0:bo.relevanceScore)||0),il=h(function(){var e,n=l("span",o({style:o({display:"flex",border:"1px solid",alignItems:"center",gap:"4px",borderRadius:"6px",padding:"2px 8px",fontSize:"12px",borderColor:ll.border,backgroundColor:ll.background,color:ll.text},null===(e=null==bo?void 0:bo.slotStyles)||void 0===e?void 0:e.relevanceScore)},{children:[(null==bo?void 0:bo.relevanceTitle)||"Decision Strength",":"," ",(null==bo?void 0:bo.relevanceScore)||0,"%"]}),"relevance-score"),t=i("span",o({style:{display:"flex",alignItems:"center",gap:"4px",borderRadius:"6px",padding:"2px 8px",fontSize:"12px",backgroundColor:"white",color:"black",cursor:"pointer"},onClick:Do},{children:i(x,{})}),"close-preview");return Ro&&!(null==ko?void 0:ko.isExpanded)?[n,t]:[n]},[Ro,ll.background,ll.border,ll.text,null==bo?void 0:bo.relevanceScore,null===(k=null==bo?void 0:bo.slotStyles)||void 0===k?void 0:k.relevanceScore,null==bo?void 0:bo.relevanceTitle]),el=h(function(){return[Eo>0&&i(d,{currentItemNumber:Vo+1,totalItems:Eo,disableNext:Vo+1>=Eo,onNext:Zo,onPrevious:$o,disablePrevious:Vo<=0},"rulebook-nav")]},[Vo,Zo,$o,Eo]),nl=h(function(){return(null==ko?void 0:ko.RuleBookContainerHeight)?ko.RuleBookContainerHeight:!(!Xo||(null==ko?void 0:ko.isExpanded))&&"600px"},[null==ko?void 0:ko.RuleBookContainerHeight,Xo]),tl=h(function(){var o,l;return[(null===(l=null===(o=null==wo?void 0:wo.detailedTab)||void 0===o?void 0:o.chip)||void 0===l?void 0:l.isActive)&&Wo>0&&i(d,{currentItemNumber:Oo+1,totalItems:Wo,onNext:_o,onPrevious:ol,disableNext:Oo+1>=Wo,disablePrevious:Oo<=0},"chat-nav")]},[null===(D=null===(A=null==wo?void 0:wo.detailedTab)||void 0===A?void 0:A.chip)||void 0===D?void 0:D.isActive,Oo,_o,ol,Wo]),rl=l("div",o({style:o({display:"flex",flexDirection:Io?Xo?"column-reverse":"row-reverse":Xo?"column":"row",gap:[(null==wo?void 0:wo.chatData)&&wo.chatData.length>0&&(wo.show||void 0===wo.show),(null==Co?void 0:Co.data)&&(Co.show||void 0===Co.show),Lo].filter(Boolean).length>1?"12px":"0",height:nl||"100%",minHeight:0},null===(T=null==bo?void 0:bo.slotStyles)||void 0===T?void 0:T.container)},{children:[Lo&&i("span",o({style:o({flex:"1 1 0%",minWidth:0},null===(R=null==wo?void 0:wo.slotStyles)||void 0===R?void 0:R.outerContainer)},{children:i(e,o({title:"Invoice Data Preview",icon:i(g,{children:i(y,{size:16})}),slotStyles:{title:{color:"#475569",fontWeight:500}},secondaryActions:[]},{children:i("div",o({style:{height:"100%",maxHeight:(null==ko?void 0:ko.isExpanded)?"none":"275px",border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",backgroundColor:"#FFFFFF",position:"relative",overflow:"hidden"}},{children:(null==Ao?void 0:Ao.rows)&&i(b,{rows:Ao.rows,columns:Ao.columns||[]})}))}))})),(null==Co?void 0:Co.data)&&(Co.show||void 0===Co.show)&&i("span",o({style:o({flex:"1 1 0%",minWidth:0},null===(F=null==Co?void 0:Co.slotStyles)||void 0===F?void 0:F.outerContainer)},{children:i(e,o({title:null!==(j=null==Co?void 0:Co.title)&&void 0!==j?j:"Rule book",icon:null==Co?void 0:Co.ruleBookIcon,slotStyles:{title:o({color:"#475569",fontWeight:500},null===(z=null==Co?void 0:Co.slotStyles)||void 0===z?void 0:z.title),body:null===(I=null==Co?void 0:Co.slotStyles)||void 0===I?void 0:I.body},secondaryActions:(null==Co?void 0:Co.secondaryActions)?Co.secondaryActions(el):el},{children:i("div",o({style:o({height:"100%",maxHeight:"275px",minHeight:0,border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#F8FAFC",position:"relative",overflowY:"auto"},null===(B=null==Co?void 0:Co.slotStyles)||void 0===B?void 0:B.dataContainer)},{children:i("div",o({style:{padding:"12px",height:"100%",overflowY:"auto"},ref:Qo},{children:i(v,{data:Co.data,renderers:null!==(E=null==Co?void 0:Co.renderer)&&void 0!==E?E:Jo})}))}))}))})),(null==wo?void 0:wo.chatData)&&wo.chatData.length>0&&(wo.show||void 0===wo.show)&&i("span",o({style:o({flex:"1 1 0%",minWidth:0},null===(H=null==wo?void 0:wo.slotStyles)||void 0===H?void 0:H.outerContainer)},{children:i(e,o({title:null!==(P=null==wo?void 0:wo.title)&&void 0!==P?P:"Chat",icon:null==wo?void 0:wo.chatIcon,containerStyles:null===(V=null==wo?void 0:wo.slotStyles)||void 0===V?void 0:V.container,slotStyles:{title:o({color:"#475569",fontWeight:500},null===(q=null==wo?void 0:wo.slotStyles)||void 0===q?void 0:q.title),body:null===(N=null==wo?void 0:wo.slotStyles)||void 0===N?void 0:N.body},primaryActions:[((null===(Y=null===(W=null==wo?void 0:wo.summarizedTab)||void 0===W?void 0:W.chip)||void 0===Y?void 0:Y.show)||void 0===(null===(O=null===(K=null==wo?void 0:wo.summarizedTab)||void 0===K?void 0:K.chip)||void 0===O?void 0:O.show))&&i(t,o({label:"Summarized"},null===(M=null==wo?void 0:wo.summarizedTab)||void 0===M?void 0:M.chip)),i(t,o({label:"Detailed"},null===(Q=null==wo?void 0:wo.detailedTab)||void 0===Q?void 0:Q.chip))],secondaryActions:wo.secondaryActions?null==wo?void 0:wo.secondaryActions(tl):tl},{children:l("div",o({ref:Go,style:o({height:"100%",maxHeight:"275px",border:"2px solid #E2E8F0",borderRadius:"8px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#F8FAFC",position:"relative",overflowY:"auto"},null===(U=null==wo?void 0:wo.slotStyles)||void 0===U?void 0:U.chatDataContainer)},{children:[(null===(J=null===(G=null==wo?void 0:wo.detailedTab)||void 0===G?void 0:G.chip)||void 0===J?void 0:J.isActive)&&i("div",o({ref:Uo,style:{position:(null==ko?void 0:ko.isExpanded)?"absolute":"relative",inset:0,padding:"12px",overflowY:"auto"}},{children:i(a,{chatData:null!==(L=wo.chatData)&&void 0!==L?L:[],assistantChatProps:o(o({},null===(Z=null===(X=null==wo?void 0:wo.detailedTab)||void 0===X?void 0:X.view)||void 0===Z?void 0:Z.assistantChatProps),{renderers:null!==(oo=null===(_=null===($=null==wo?void 0:wo.detailedTab)||void 0===$?void 0:$.detailedViewRenderer)||void 0===_?void 0:_.assistantText)&&void 0!==oo?oo:Jo}),userChatItemProps:o(o({},null===(io=null===(lo=null==wo?void 0:wo.detailedTab)||void 0===lo?void 0:lo.view)||void 0===io?void 0:io.userChatItemProps),{renderers:null!==(to=null===(no=null===(eo=null==wo?void 0:wo.detailedTab)||void 0===eo?void 0:eo.detailedViewRenderer)||void 0===no?void 0:no.userText)&&void 0!==to?to:Jo})})})),(null===(ao=null===(ro=null==wo?void 0:wo.summarizedTab)||void 0===ro?void 0:ro.chip)||void 0===ao?void 0:ao.show)&&(null===(vo=null===(uo=null==wo?void 0:wo.summarizedTab)||void 0===uo?void 0:uo.chip)||void 0===vo?void 0:vo.isActive)&&i(u,o({chatData:null!==(so=wo.chatData)&&void 0!==so?so:[]},null===(co=null==wo?void 0:wo.summarizedTab)||void 0===co?void 0:co.view,{renderer:null!==(fo=null===(ho=null==wo?void 0:wo.summarizedTab)||void 0===ho?void 0:ho.summarizedViewRenderer)&&void 0!==fo?fo:Jo}))]}))}))}))]}));return jo?i(e,o({title:null==bo?void 0:bo.title,slotStyles:{title:null===(mo=null==bo?void 0:bo.slotStyles)||void 0===mo?void 0:mo.title,body:null===(po=null==bo?void 0:bo.slotStyles)||void 0===po?void 0:po.body},containerStyles:null===(go=null==bo?void 0:bo.slotStyles)||void 0===go?void 0:go.container,icon:null!==(yo=null==bo?void 0:bo.icon)&&void 0!==yo?yo:i(g,{children:i("img",{src:r,alt:"chat icon",style:{width:16,height:16}})}),secondaryActions:(null==bo?void 0:bo.secondaryActions)?bo.secondaryActions(il):il},{children:rl})):rl}export{S as default};
2
2
  //# sourceMappingURL=InternalChatCitationRenderer.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as n,__rest as e}from"tslib";import{jsx as t,jsxs as r,Fragment as i}from"react/jsx-runtime";import{Box as o,Typography as a}from"@mui/material";import l,{useRef as c,useMemo as d,useLayoutEffect as s}from"react";import{DEFAULT_DEVIAION_COLOR as u}from"../CognitiveCompareConstants.js";import{EllipsisVertical as h}from"lucide-react";import p from"react-markdown";import{mixHexColors as g,areMarkdownPropsEqual as f}from"../CognitiveComparehelpers.js";import v from"rehype-raw";import m from"remark-gfm";var b=function(n){return"function"==typeof n?n:(null==n?void 0:n.default)||n},x=[b(m)],y=[b(v)],E=l.memo(function(f){var v=f.content,m=f.overlayContent,b=f.sxStyles,E=f.deviationBadges,C=void 0===E?[]:E,S=f.highlights,k=void 0===S?[]:S;f.maintainRelativeOrder;var B=f.highlightBg,F=f.suppressHighlightBg,w=void 0!==F&&F,A=f.collisionKey,T=c(null),z=!!m,I=d(function(){return C.reduce(function(e,t){var r;return n(n({},e),((r={})[t.id]=t,r))},{})},[C]),O=c({badgeMap:I,highlightBg:B,hideHighlightBg:z,suppressHighlightBg:w});O.current={badgeMap:I,highlightBg:B,hideHighlightBg:z,suppressHighlightBg:w};var M=function(e,t){return l.Children.map(e,function(e){var r;if(!l.isValidElement(e))return e;var i=(null===(r=e.props)||void 0===r?void 0:r.children)?M(e.props.children,t):e.props.children,o=l.cloneElement(e,n(n({},e.props),{children:i}));return t(o)})},$=d(function(){return{mark:function(r){var i,o,a,l,c=r.children,d=e(r,["children"]),s=O.current,u=s.badgeMap,h=s.highlightBg,p=s.hideHighlightBg,g=s.suppressHighlightBg,f=d["data-badge-id"],v=f?u[f]:null,m=d["data-highlight-color"],b=null!==(l=null!==(o=null!=m?m:null===(i=null==v?void 0:v.style)||void 0===i?void 0:i.highlightBg)&&void 0!==o?o:null===(a=null==v?void 0:v.style)||void 0===a?void 0:a.badgeBg)&&void 0!==l?l:h,x="true"===d["data-is-suggested-deviation-fix"]||g;return t("span",n({style:n(n(n({},x?{}:{backgroundColor:b}),{borderRadius:"2px",display:"inline",boxDecorationBreak:"clone",WebkitBoxDecorationBreak:"clone",backgroundClip:"padding-box",padding:"0 1px"}),p?{color:"transparent"}:{})},{children:c}))},span:function(i){var a,l,c,d,s,p,g=i.children,f=e(i,["children"]),v=O.current.badgeMap,m=f["data-badge-id"];if(!m)return t("span",n({},f,{children:g}));var b=v[m];if(!b)return t("span",n({},f,{children:g}));var x="number"==typeof b.stackIndex?b.stackIndex:0,y="translateY(calc(-20% + ".concat(12*x,"px + var(--badge-nudge, 0px)))");return r(o,n({component:"span",sx:{position:"static",display:"inline"}},{children:[r(o,n({ref:b.badgeRef,className:"deviation-badge","data-side":b.side||"right",sx:n(n({fontStyle:"normal",position:"absolute",zIndex:30+x,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(a=b.style)||void 0===a?void 0:a.badgeBg)||"#EEF2FF",color:(null===(l=b.style)||void 0===l?void 0:l.badgeText)||u,border:"1px solid ".concat((null===(c=b.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden",transition:"none"},"left"===b.side?{right:"-16px",transform:"".concat(y," translateX(calc(100% + 8px))")}:{left:"-16px",transform:"".concat(y," translateX(calc(-100% - 8px))")}),b.isConnected&&b.style&&{outline:"2px solid ".concat(b.style.badgeBorder),outlineOffset:"1px"})},{children:[r(o,n({onClick:function(n){n.stopPropagation(),b.onSummaryClick&&b.onSummaryClick(n)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[t(o,n({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:b.label})),("left"===b.side||b.isOrphan)&&t(o,n({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(d=b.style)||void 0===d?void 0:d.badgeBorder)||"#C7D2FE")}},{children:null!=b.score&&"N/A"!==b.score&&"NA"!==b.score&&0!==b.score?"".concat(b.score):"N/A"===b.score||"NA"===b.score?"N/A":"Same"}))]})),("left"===b.side||b.isOrphan)&&t(o,n({onClick:function(n){n.stopPropagation(),b.onClick&&b.onClick(n)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(s=b.style)||void 0===s?void 0:s.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:t(h,{size:12,color:(null===(p=b.style)||void 0===p?void 0:p.badgeText)||"#3730A3"})}))]})),g]}))},table:function(e){var r=e.children;return t(o,n({component:"table",sx:{width:"100%",borderCollapse:"collapse",my:1,fontSize:"inherit"}},{children:r}))},thead:function(e){var r=e.children;return t(o,n({component:"thead"},{children:r}))},tbody:function(e){var r=e.children;return t(o,n({component:"tbody"},{children:r}))},tr:function(e){var r=e.children;return t(o,n({component:"tr",sx:{borderBottom:"1px solid #E5E7EB"}},{children:r}))},th:function(e){var r=e.children;return t(o,n({component:"th",sx:{border:"1px solid #E5E7EB",padding:"8px",textAlign:"left",fontWeight:600,backgroundColor:"#F9FAFB"}},{children:r}))},td:function(e){var r=e.children;return t(o,n({component:"td",sx:{border:"1px solid #E5E7EB",padding:"8px",verticalAlign:"top"}},{children:r}))},code:function(e){var r=e.children;return t("span",n({style:{fontFamily:"inherit",fontSize:"inherit"}},{children:r}))},pre:function(e){var r=e.children;return t("span",n({style:{fontFamily:"inherit",fontSize:"inherit",display:"block",whiteSpace:"pre-wrap"}},{children:r}))},updated:function(n){var e=n.children;return t(i,{children:e})},deleted:function(e){var r=e.children,i=M(r,function(n){return l.cloneElement(n,{"data-is-suggested-deviation-fix":"true"})});return t("span",n({style:{boxShadow:"inset 0 1px 0 #EF4444, inset 0 -1px 0 #EF4444",backgroundColor:"#FCCCCC",textDecoration:"line-through"}},{children:i}))},changed:function(e){var r=e.children,i=M(r,function(n){return l.cloneElement(n,{"data-is-suggested-deviation-fix":"true"})});return t("span",n({style:{boxShadow:"inset 0 1px 0 #2F59FF, inset 0 -1px 0 #2F59FF",backgroundColor:"#D5E8FF"}},{children:i}))},ul:function(r){var i=r.children,a=e(r,["children"]);return t(o,n({component:"ul",sx:{mt:1,mb:1,pl:3,listStyleType:"disc"}},a,{children:i}))},ol:function(r){var i=r.children,a=e(r,["children"]);return t(o,n({component:"ol",sx:{mt:1,mb:1,pl:3,listStyleType:"decimal"}},a,{children:i}))},li:function(r){var i=r.children,a=e(r,["children"]);return t(o,n({component:"li",sx:{mb:.5,display:"list-item"}},a,{children:i}))}}},[]),j=function(n){if(!n||"string"!=typeof n)return"";var e=n,t=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/((?:<\/?[a-z]+[^>]*>\s*)+)([*+\-] |\d+\. )/gi,"$2$1")).replace(/\\(['"])/g,"$1").replace(/\\n/g,"\n").replace(/\\\./g,".").replace(/\r\n/g,"\n")).replace(/^(\d+\.)(\s{2,})/gm,function(n,e,t){return"".concat(e.slice(0,-1),"\\.").concat(t)})).replace(/^(\d+\.)\s*\n+(\s+)(\S)/gm,function(n,e,t,r){return"".concat(e," ").concat(r)})).replace(/([^\n])\n(#{1,6} )/g,"$1\n\n$2")).replace(/([^\n])\n([ \t]*(?:[#*+\-] |\d+\. ))/g,"$1\n\n$2")).replace(/\n{3,}/g,"\n\n")).replace(/^[ \t]+(?![ \t]*([\*\-\+] |\d+\. ))/gm,function(n){return n.replace(/ /g," ").replace(/\t/g,"    ")})).split(/(\n{2,})/);return(e=t.map(function(n){return/^\n+$/.test(n)||/\|.*\|/.test(n)&&/\|[\s:|-]+\|/.test(n)||/^#{1,6} /.test(n.trimStart())?n:n.replace(/\n(?=[^\n])/g,function(e,t){var r=n.slice(t+1);return/^[ \t]*([#>|\-*+]|\d+\.)/.test(r)?"\n":" "})}).join("")).trim()},P=function(n){return n.replace(/[\.,;:]/g," ")},D=d(function(){return C.map(function(n){return{id:n.id,connected:n.isConnected,stackIndex:n.stackIndex,size:n.size}})},[C]),H=d(function(){var e=j(v||""),t=w?P(e):e,r=(C||[]).map(function(n){var e,t;return{id:null==n?void 0:n.id,highlight:j((null==n?void 0:n.highlight)||""),highlightColor:(null===(e=null==n?void 0:n.style)||void 0===e?void 0:e.highlightBg)||(null===(t=null==n?void 0:n.style)||void 0===t?void 0:t.badgeBg)||B}}).filter(function(n){return n.id&&n.highlight}),i={};r.forEach(function(n){i[n.highlight]||(i[n.highlight]=[]),i[n.highlight].push(n)});var o=function(n,e,t,r){void 0===e&&(e=""),void 0===r&&(r=[]);var i=!1,o=function(n){var o=function(n,e,t){var r,i,o;void 0===e&&(e="");var a=n.match(/^(\s*)([\s\S]*?)(\s*)$/);if(!a)return n;var l=null!==(r=a[1])&&void 0!==r?r:"",c=null!==(i=a[2])&&void 0!==i?i:"",d=null!==(o=a[3])&&void 0!==o?o:"";return c?l+function(n,e){void 0===n&&(n="");var t=e?' data-highlight-color="'.concat(e,'"'):"",r=n?' data-badge-id="'.concat(n,'"'):"";return"<mark".concat(r).concat(t,">")}(e,t)+c+"</mark>"+d:n}(n,e,t),a=o;if(!i&&r.length>0){i=!0;var l="",c="";r.forEach(function(n){l+=function(n){return'<span data-badge-id="'.concat(n,'">')}(n.id),c="</span>"+c}),a=l+o+c}return"​"+a};return n.split(/(\n+)/).map(function(n){return/^\n+$/.test(n)?n:n.trim()?""===n.replace(/[|:\-\s]/g,"")&&n.includes("-")?n:n.includes("|")?n.split(/(\|)/).map(function(n){return"|"!==n&&n.trim()?o(n):n}).join(""):o(n):n}).join("")},a=[];Object.entries(i).forEach(function(n){var r=n[0],i=n[1],o=e.indexOf(r),l=!1;if(-1===o&&w){var c=P(r);-1!==(o=t.indexOf(c))&&(l=!0)}if(-1!==o){for(var d=i[0].highlightColor,s=1;s<i.length;s++)d=g(d,i[s].highlightColor||"");a.push({highlight:r,start:o,end:o+r.length,badges:i,color:d,usedLooseMatch:l})}});var l=new Set(Object.keys(i));(k||[]).forEach(function(n){if(n){var r=j(n);if(r&&!l.has(r)){var i=e.indexOf(r),o=!1;if(-1===i&&w){var c=P(r);-1!==(i=t.indexOf(c))&&(o=!0)}if(-1!==i){var d=e.slice(0,i);(d.match(/</g)||[]).length===(d.match(/>/g)||[]).length&&a.push({highlight:r,start:i,end:i+r.length,badges:[],color:B||"",usedLooseMatch:o})}}}}),a.sort(function(n,e){return n.start-e.start||e.end-n.end});var c=[],d={};a.forEach(function(n,e){for(var t=n.start,r=n.end,i=0,o=c;i<o.length;i++){var a=o[i],l=a.start,s=a.end,u=t<s&&r>s&&t>=l,h=t<l&&r>l&&r<=s;if(t>=l&&r<=s){n.orphaned=!0,d[e]=a.matchIdx;break}u&&(t=s),h&&(r=l)}n.trimmedStart=t,n.trimmedEnd=r,!n.orphaned&&t<r&&c.push({start:t,end:r,matchIdx:e})});var s={};Object.entries(d).forEach(function(n){var e=n[0],t=n[1],r=Number(e);s[t]||(s[t]=[]),s[t].push(r)});var u=a.map(function(e,t){return n(n({},e),{idx:t})}).filter(function(n){return!n.orphaned}).sort(function(n,e){var t,r;return(null!==(t=e.trimmedStart)&&void 0!==t?t:e.start)-(null!==(r=n.trimmedStart)&&void 0!==r?r:n.start)});return u.forEach(function(n){var t,r,i,l,c=null!==(t=n.trimmedStart)&&void 0!==t?t:n.start,d=null!==(r=n.trimmedEnd)&&void 0!==r?r:n.end;if(!(c>=d)){var u=e.slice(c,d),h=function(n,e,t,r){if(!t.length)return n;var i=t.map(function(n){return a[n]}).sort(function(n,e){return n.start-e.start}),l="",c=0;return i.forEach(function(t){var i,a,d=Math.max(c,t.start-e),s=Math.max(d,t.end-e);if(!(d>=s)){var u=g(r,t.color||"");l+=n.slice(c,d),l+=o(n.slice(d,s),(null===(a=null===(i=t.badges)||void 0===i?void 0:i[0])||void 0===a?void 0:a.id)||"",u,t.badges||[]),c=s}}),l+=n.slice(c)}(n.usedLooseMatch||c!==n.start||d!==n.end?u:n.highlight,n.start,s[n.idx]||[],n.color),p=o(h,(null===(l=null===(i=n.badges)||void 0===i?void 0:i[0])||void 0===l?void 0:l.id)||"",n.color,n.badges||[]);e=e.slice(0,c)+p+e.slice(d)}}),e},[v,C,k,B,w]),N=d(function(){return m?j(m||""):""},[m]),R=!!m,L={"& *":{fontFamily:"inherit"},"& code, & pre, & kbd, & samp":{fontFamily:"inherit !important",fontSize:"inherit",background:"none",padding:0,border:"none",whiteSpace:"pre-wrap"},"& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"}},q=n(n(n(n({},b),L),{position:"relative",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:2}),R?{color:"transparent",userSelect:"none",pointerEvents:"none","& .deviation-badge":{pointerEvents:"auto"},"& table":{visibility:"hidden",margin:"0 !important"},"& th, & td":{padding:"0 !important",border:"none !important",backgroundColor:"transparent !important"},"& tr":{border:"none !important"},"& p:empty":{display:"none"}}:{}),W=n(n(n({},b),L),{position:"relative",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:1,pointerEvents:"auto"});return s(function(){if(T.current){var n=function(){var n=Array.from(T.current.querySelectorAll(".deviation-badge"));if(0!==n.length){n.forEach(function(n){n.style.setProperty("--badge-nudge","0px")});var e=n.filter(function(n){return"left"===n.dataset.side}),t=n.filter(function(n){return"left"!==n.dataset.side}),r=T.current.getBoundingClientRect(),i=r.bottom-4,o=r.top+4,a=function(n){if(0!==n.length){var e=n.map(function(n){var e=n.getBoundingClientRect();return{el:n,naturalTop:e.top,height:e.height,currentTop:e.top}});e.sort(function(n,e){return n.naturalTop-e.naturalTop});var t=[],r=[];e.forEach(function(n){if(0===r.length)r.push(n);else{var e=r[r.length-1],i=e.currentTop+e.height;n.naturalTop<i+8?(n.currentTop=i+8,r.push(n)):(t.push(r),r=[n])}}),r.length>0&&t.push(r),t.forEach(function(n){var e=n[n.length-1],t=e.currentTop+e.height;if(t>i){var r=t-i,a=n[0].currentTop-o,l=Math.max(0,Math.min(r,a));n.forEach(function(n){n.currentTop-=l})}}),t.flat().forEach(function(n){var e=n.currentTop-n.naturalTop;n.el.style.setProperty("--badge-nudge","".concat(e,"px"))})}};a(e),a(t)}},e=requestAnimationFrame(function(){requestAnimationFrame(function(){n()})}),t=new ResizeObserver(function(){requestAnimationFrame(n)});return t.observe(T.current),function(){t.disconnect(),cancelAnimationFrame(e)}}},[H,A,D]),r(o,n({ref:T,sx:{position:"relative",display:"grid"}},{children:[t(a,n({component:"div",sx:n(n({},q),{padding:"3px"})},{children:t(p,n({components:$,remarkPlugins:x,rehypePlugins:y},{children:H.replace(/#{3}/g,"")}))})),R&&t(a,n({component:"div",sx:W},{children:t(p,n({components:$,remarkPlugins:x,rehypePlugins:y},{children:N}))}))]}))},f);export{E as MemoizedMarkdown};
1
+ import{__assign as n,__rest as e}from"tslib";import{jsx as t,jsxs as r,Fragment as i}from"react/jsx-runtime";import{Box as o,Typography as a}from"@mui/material";import l,{useRef as d,useMemo as c,useLayoutEffect as s}from"react";import{DEFAULT_DEVIAION_COLOR as u}from"../CognitiveCompareConstants.js";import{EllipsisVertical as h}from"lucide-react";import p from"react-markdown";import{mixHexColors as g,areMarkdownPropsEqual as f}from"../CognitiveComparehelpers.js";import v from"rehype-raw";import m from"remark-gfm";var b=function(n){return"function"==typeof n?n:(null==n?void 0:n.default)||n},x=[b(m)],y=[b(v)],w=l.memo(function(f){var v=f.content,m=f.overlayContent,b=f.sxStyles,w=f.deviationBadges,E=void 0===w?[]:w,S=f.highlights,k=void 0===S?[]:S;f.maintainRelativeOrder;var C=f.highlightBg,B=f.suppressHighlightBg,F=void 0!==B&&B,z=f.collisionKey,A=d(null),T=!!m,W=c(function(){return E.reduce(function(e,t){var r;return n(n({},e),((r={})[t.id]=t,r))},{})},[E]),O=d({badgeMap:W,highlightBg:C,hideHighlightBg:T,suppressHighlightBg:F});O.current={badgeMap:W,highlightBg:C,hideHighlightBg:T,suppressHighlightBg:F};var I=function(e,t){return l.Children.map(e,function(e){var r;if(!l.isValidElement(e))return e;var i=(null===(r=e.props)||void 0===r?void 0:r.children)?I(e.props.children,t):e.props.children,o=l.cloneElement(e,n(n({},e.props),{children:i}));return t(o)})},M=c(function(){return{mark:function(r){var i,o,a,l,d=r.children,c=e(r,["children"]),s=O.current,u=s.badgeMap,h=s.highlightBg,p=s.hideHighlightBg,g=s.suppressHighlightBg,f=c["data-badge-id"],v=f?u[f]:null,m=c["data-highlight-color"],b=null!==(l=null!==(o=null!=m?m:null===(i=null==v?void 0:v.style)||void 0===i?void 0:i.highlightBg)&&void 0!==o?o:null===(a=null==v?void 0:v.style)||void 0===a?void 0:a.badgeBg)&&void 0!==l?l:h,x="true"===c["data-is-suggested-deviation-fix"]||g;return t("span",n({style:n(n(n({},x?{}:{backgroundColor:b}),{borderRadius:"2px",display:"inline",boxDecorationBreak:"clone",WebkitBoxDecorationBreak:"clone",backgroundClip:"padding-box",padding:"0 1px"}),p?{color:"transparent"}:{})},{children:d}))},span:function(i){var a,l,d,c,s,p,g=i.children,f=e(i,["children"]),v=O.current.badgeMap,m=f["data-badge-id"];if(!m)return t("span",n({},f,{children:g}));var b=v[m];if(!b)return t("span",n({},f,{children:g}));var x="number"==typeof b.stackIndex?b.stackIndex:0,y="translateY(calc(-20% + ".concat(12*x,"px + var(--badge-nudge, 0px)))");return r(o,n({component:"span",sx:{position:"static",display:"inline"}},{children:[r(o,n({ref:b.badgeRef,className:"deviation-badge","data-side":b.side||"right",sx:n(n({fontStyle:"normal",position:"absolute",zIndex:30+x,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(a=b.style)||void 0===a?void 0:a.badgeBg)||"#EEF2FF",color:(null===(l=b.style)||void 0===l?void 0:l.badgeText)||u,border:"1px solid ".concat((null===(d=b.style)||void 0===d?void 0:d.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden",transition:"none"},"left"===b.side?{right:"-16px",transform:"".concat(y," translateX(calc(100% + 8px))")}:{left:"-16px",transform:"".concat(y," translateX(calc(-100% - 8px))")}),b.isConnected&&b.style&&{outline:"2px solid ".concat(b.style.badgeBorder),outlineOffset:"1px"})},{children:[r(o,n({onClick:function(n){n.stopPropagation(),b.onSummaryClick&&b.onSummaryClick(n)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[t(o,n({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:b.label})),("left"===b.side||b.isOrphan)&&t(o,n({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(c=b.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE")}},{children:null!=b.score&&"N/A"!==b.score&&"NA"!==b.score&&0!==b.score?"".concat(b.score):"N/A"===b.score||"NA"===b.score?"N/A":"Same"}))]})),("left"===b.side||b.isOrphan)&&t(o,n({onClick:function(n){n.stopPropagation(),b.onClick&&b.onClick(n)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(s=b.style)||void 0===s?void 0:s.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:t(h,{size:12,color:(null===(p=b.style)||void 0===p?void 0:p.badgeText)||"#3730A3"})}))]})),g]}))},table:function(e){var r=e.children;return t(o,n({sx:{display:"block",width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box",contain:"inline-size",overflowX:"auto",overflowY:"hidden",overscrollBehaviorX:"contain",WebkitOverflowScrolling:"touch",my:1}},{children:t(o,n({component:"table",sx:{width:"600px",minWidth:"600px",tableLayout:"fixed",borderCollapse:"collapse",fontSize:"inherit"}},{children:r}))}))},thead:function(e){var r=e.children;return t(o,n({component:"thead"},{children:r}))},tbody:function(e){var r=e.children;return t(o,n({component:"tbody"},{children:r}))},tr:function(e){var r=e.children;return t(o,n({component:"tr",sx:{borderBottom:"1px solid #E5E7EB"}},{children:r}))},th:function(e){var r=e.children;return t(o,n({component:"th",sx:{border:"1px solid #E5E7EB",padding:"8px",textAlign:"left",verticalAlign:"top",fontWeight:600,backgroundColor:"#F9FAFB",whiteSpace:"normal",wordBreak:"break-word",overflowWrap:"anywhere"}},{children:r}))},td:function(e){var r=e.children;return t(o,n({component:"td",sx:{border:"1px solid #E5E7EB",padding:"8px",verticalAlign:"top",whiteSpace:"normal",wordBreak:"break-word",overflowWrap:"anywhere"}},{children:r}))},code:function(e){var r=e.children;return t("span",n({style:{fontFamily:"inherit",fontSize:"inherit"}},{children:r}))},pre:function(e){var r=e.children;return t("span",n({style:{fontFamily:"inherit",fontSize:"inherit",display:"block",whiteSpace:"pre-wrap"}},{children:r}))},updated:function(n){var e=n.children;return t(i,{children:e})},deleted:function(e){var r=e.children,i=I(r,function(n){return l.cloneElement(n,{"data-is-suggested-deviation-fix":"true"})});return t("span",n({style:{boxShadow:"inset 0 1px 0 #EF4444, inset 0 -1px 0 #EF4444",backgroundColor:"#FCCCCC",textDecoration:"line-through"}},{children:i}))},changed:function(e){var r=e.children,i=I(r,function(n){return l.cloneElement(n,{"data-is-suggested-deviation-fix":"true"})});return t("span",n({style:{boxShadow:"inset 0 1px 0 #2F59FF, inset 0 -1px 0 #2F59FF",backgroundColor:"#D5E8FF"}},{children:i}))},ul:function(r){var i=r.children,a=e(r,["children"]);return t(o,n({component:"ul",sx:{mt:1,mb:1,pl:3,listStyleType:"disc"}},a,{children:i}))},ol:function(r){var i=r.children,a=e(r,["children"]);return t(o,n({component:"ol",sx:{mt:1,mb:1,pl:3,listStyleType:"decimal"}},a,{children:i}))},li:function(r){var i=r.children,a=e(r,["children"]);return t(o,n({component:"li",sx:{mb:.5,display:"list-item"}},a,{children:i}))}}},[]),$=function(n){if(!n||"string"!=typeof n)return"";var e=n,t=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/((?:<\/?[a-z]+[^>]*>\s*)+)([*+\-] |\d+\. )/gi,"$2$1")).replace(/\\(['"])/g,"$1").replace(/\\n/g,"\n").replace(/\\\./g,".").replace(/\r\n/g,"\n")).replace(/^(\d+\.)(\s{2,})/gm,function(n,e,t){return"".concat(e.slice(0,-1),"\\.").concat(t)})).replace(/^(\d+\.)\s*\n+(\s+)(\S)/gm,function(n,e,t,r){return"".concat(e," ").concat(r)})).replace(/([^\n])\n(#{1,6} )/g,"$1\n\n$2")).replace(/([^\n])\n([ \t]*(?:[#*+\-] |\d+\. ))/g,"$1\n\n$2")).replace(/\n{3,}/g,"\n\n")).replace(/^[ \t]+(?![ \t]*([\*\-\+] |\d+\. ))/gm,function(n){return n.replace(/ /g," ").replace(/\t/g,"    ")})).split(/(\n{2,})/);return(e=t.map(function(n){return/^\n+$/.test(n)||/\|.*\|/.test(n)&&/\|[\s:|-]+\|/.test(n)||/^#{1,6} /.test(n.trimStart())?n:n.replace(/\n(?=[^\n])/g,function(e,t){var r=n.slice(t+1);return/^[ \t]*([#>|\-*+]|\d+\.)/.test(r)?"\n":" "})}).join("")).trim()},j=function(n){return n.replace(/[\.,;:]/g," ")},P=c(function(){return E.map(function(n){return{id:n.id,connected:n.isConnected,stackIndex:n.stackIndex,size:n.size}})},[E]),D=c(function(){var e=$(v||""),t=F?j(e):e,r=(E||[]).map(function(n){var e,t;return{id:null==n?void 0:n.id,highlight:$((null==n?void 0:n.highlight)||""),highlightColor:(null===(e=null==n?void 0:n.style)||void 0===e?void 0:e.highlightBg)||(null===(t=null==n?void 0:n.style)||void 0===t?void 0:t.badgeBg)||C}}).filter(function(n){return n.id&&n.highlight}),i={};r.forEach(function(n){i[n.highlight]||(i[n.highlight]=[]),i[n.highlight].push(n)});var o=function(n,e,t,r){void 0===e&&(e=""),void 0===r&&(r=[]);var i=!1,o=function(n){var o=function(n,e,t){var r,i,o;void 0===e&&(e="");var a=n.match(/^(\s*)([\s\S]*?)(\s*)$/);if(!a)return n;var l=null!==(r=a[1])&&void 0!==r?r:"",d=null!==(i=a[2])&&void 0!==i?i:"",c=null!==(o=a[3])&&void 0!==o?o:"";return d?l+function(n,e){void 0===n&&(n="");var t=e?' data-highlight-color="'.concat(e,'"'):"",r=n?' data-badge-id="'.concat(n,'"'):"";return"<mark".concat(r).concat(t,">")}(e,t)+d+"</mark>"+c:n}(n,e,t),a=o;if(!i&&r.length>0){i=!0;var l="",d="";r.forEach(function(n){l+=function(n){return'<span data-badge-id="'.concat(n,'">')}(n.id),d="</span>"+d}),a=l+o+d}return"​"+a};return n.split(/(\n+)/).map(function(n){return/^\n+$/.test(n)?n:n.trim()?""===n.replace(/[|:\-\s]/g,"")&&n.includes("-")?n:n.includes("|")?n.split(/(\|)/).map(function(n){return"|"!==n&&n.trim()?o(n):n}).join(""):o(n):n}).join("")},a=[];Object.entries(i).forEach(function(n){var r=n[0],i=n[1],o=e.indexOf(r),l=!1;if(-1===o&&F){var d=j(r);-1!==(o=t.indexOf(d))&&(l=!0)}if(-1!==o){for(var c=i[0].highlightColor,s=1;s<i.length;s++)c=g(c,i[s].highlightColor||"");a.push({highlight:r,start:o,end:o+r.length,badges:i,color:c,usedLooseMatch:l})}});var l=new Set(Object.keys(i));(k||[]).forEach(function(n){if(n){var r=$(n);if(r&&!l.has(r)){var i=e.indexOf(r),o=!1;if(-1===i&&F){var d=j(r);-1!==(i=t.indexOf(d))&&(o=!0)}if(-1!==i){var c=e.slice(0,i);(c.match(/</g)||[]).length===(c.match(/>/g)||[]).length&&a.push({highlight:r,start:i,end:i+r.length,badges:[],color:C||"",usedLooseMatch:o})}}}}),a.sort(function(n,e){return n.start-e.start||e.end-n.end});var d=[],c={};a.forEach(function(n,e){for(var t=n.start,r=n.end,i=0,o=d;i<o.length;i++){var a=o[i],l=a.start,s=a.end,u=t<s&&r>s&&t>=l,h=t<l&&r>l&&r<=s;if(t>=l&&r<=s){n.orphaned=!0,c[e]=a.matchIdx;break}u&&(t=s),h&&(r=l)}n.trimmedStart=t,n.trimmedEnd=r,!n.orphaned&&t<r&&d.push({start:t,end:r,matchIdx:e})});var s={};Object.entries(c).forEach(function(n){var e=n[0],t=n[1],r=Number(e);s[t]||(s[t]=[]),s[t].push(r)});var u=a.map(function(e,t){return n(n({},e),{idx:t})}).filter(function(n){return!n.orphaned}).sort(function(n,e){var t,r;return(null!==(t=e.trimmedStart)&&void 0!==t?t:e.start)-(null!==(r=n.trimmedStart)&&void 0!==r?r:n.start)});return u.forEach(function(n){var t,r,i,l,d=null!==(t=n.trimmedStart)&&void 0!==t?t:n.start,c=null!==(r=n.trimmedEnd)&&void 0!==r?r:n.end;if(!(d>=c)){var u=e.slice(d,c),h=function(n,e,t,r){if(!t.length)return n;var i=t.map(function(n){return a[n]}).sort(function(n,e){return n.start-e.start}),l="",d=0;return i.forEach(function(t){var i,a,c=Math.max(d,t.start-e),s=Math.max(c,t.end-e);if(!(c>=s)){var u=g(r,t.color||"");l+=n.slice(d,c),l+=o(n.slice(c,s),(null===(a=null===(i=t.badges)||void 0===i?void 0:i[0])||void 0===a?void 0:a.id)||"",u,t.badges||[]),d=s}}),l+=n.slice(d)}(n.usedLooseMatch||d!==n.start||c!==n.end?u:n.highlight,n.start,s[n.idx]||[],n.color),p=o(h,(null===(l=null===(i=n.badges)||void 0===i?void 0:i[0])||void 0===l?void 0:l.id)||"",n.color,n.badges||[]);e=e.slice(0,d)+p+e.slice(c)}}),e},[v,E,k,C,F]),H=c(function(){return m?$(m||""):""},[m]),N=!!m,R={"& *":{fontFamily:"inherit"},"& code, & pre, & kbd, & samp":{fontFamily:"inherit !important",fontSize:"inherit",background:"none",padding:0,border:"none",whiteSpace:"pre-wrap"},"& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"}},L=n(n(n(n({},b),R),{position:"relative",width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:2}),N?{color:"transparent",userSelect:"none",pointerEvents:"none","& .deviation-badge":{pointerEvents:"auto"},"& table":{visibility:"hidden",margin:"0 !important"},"& th, & td":{padding:"0 !important",border:"none !important",backgroundColor:"transparent !important"},"& tr":{border:"none !important"},"& p:empty":{display:"none"}}:{}),q=n(n(n({},b),R),{position:"relative",width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:1,pointerEvents:"auto"});return s(function(){if(A.current){var n=function(){var n=Array.from(A.current.querySelectorAll(".deviation-badge"));if(0!==n.length){n.forEach(function(n){n.style.setProperty("--badge-nudge","0px")});var e=n.filter(function(n){return"left"===n.dataset.side}),t=n.filter(function(n){return"left"!==n.dataset.side}),r=A.current.getBoundingClientRect(),i=r.bottom-4,o=r.top+4,a=function(n){if(0!==n.length){var e=n.map(function(n){var e=n.getBoundingClientRect();return{el:n,naturalTop:e.top,height:e.height,currentTop:e.top}});e.sort(function(n,e){return n.naturalTop-e.naturalTop});var t=[],r=[];e.forEach(function(n){if(0===r.length)r.push(n);else{var e=r[r.length-1],i=e.currentTop+e.height;n.naturalTop<i+8?(n.currentTop=i+8,r.push(n)):(t.push(r),r=[n])}}),r.length>0&&t.push(r),t.forEach(function(n){var e=n[n.length-1],t=e.currentTop+e.height;if(t>i){var r=t-i,a=n[0].currentTop-o,l=Math.max(0,Math.min(r,a));n.forEach(function(n){n.currentTop-=l})}}),t.flat().forEach(function(n){var e=n.currentTop-n.naturalTop;n.el.style.setProperty("--badge-nudge","".concat(e,"px"))})}};a(e),a(t)}},e=requestAnimationFrame(function(){requestAnimationFrame(function(){n()})}),t=new ResizeObserver(function(){requestAnimationFrame(n)});return t.observe(A.current),function(){t.disconnect(),cancelAnimationFrame(e)}}},[D,z,P]),r(o,n({ref:A,sx:{position:"relative",display:"grid",gridTemplateColumns:"minmax(0, 1fr)",width:"100%",maxWidth:"100%",minWidth:0}},{children:[t(a,n({component:"div",sx:n(n({},L),{padding:"3px"})},{children:t(p,n({components:M,remarkPlugins:x,rehypePlugins:y},{children:D.replace(/#{3}/g,"")}))})),N&&t(a,n({component:"div",sx:q},{children:t(p,n({components:M,remarkPlugins:x,rehypePlugins:y},{children:H}))}))]}))},f);export{w as MemoizedMarkdown};
2
2
  //# sourceMappingURL=memoizedMarkdown.js.map
@@ -1,2 +1,2 @@
1
- import{__awaiter as n,__generator as i}from"tslib";import{useMemo as t}from"react";import{useQuery as o}from"@tanstack/react-query";import{fetchOnDemandCitation as a}from"../service/onDemandApi.js";var e=function(n,i,t){var o;return Array.isArray(n)?Array.isArray(i)&&0!==i.length?Number.isNaN(t)?(console.warn("[findCitation] citationNumber is NaN"),null):null!==(o=n.find(function(n){var o,a=function(n){var i,t,o,a,e;if(null==n)return console.warn("[getCitationType] received null or undefined citation"),"";var l=null!==(e=null!==(a=null!==(t=null===(i=null==n?void 0:n.customMetaData)||void 0===i?void 0:i.type)&&void 0!==t?t:null===(o=null==n?void 0:n.customMetadata)||void 0===o?void 0:o.type)&&void 0!==a?a:null==n?void 0:n.type)&&void 0!==e?e:"";return l||console.warn("[getCitationType] citation has no resolvable type field",n),l}(n);return(null===(o=function(n){var i;return null==n?(console.warn("[getCitationNumber] received null or undefined citation"),""):(null==n.citation_number&&console.warn("[getCitationNumber] citation is missing citation_number field",n),null!==(i=null==n?void 0:n.citation_number)&&void 0!==i?i:"")}(n))||void 0===o?void 0:o.toString())===t.toString()&&i.some(function(n){return null==a?void 0:a.includes(n)})}))&&void 0!==o?o:null:(console.warn("[findCitation] citationTypes is empty or falsy",i),null):(console.warn("[findCitation] citations is not an array",n),null)},l=function(l){var r=l.msg,c=l.citationType,u=l.citationNumber,d=l.enabled,s=void 0!==d&&d,v=l.accessToken,f=l.baseUrl,_=l.orgName,m=l.citationAssistantProcessingName,h=l.citationAgentName,y=(null==r?void 0:r.requestId)||(null==r?void 0:r.id)||"",g=t(function(){return function(n){switch(n){case"artifact_chunks":return["artifact_chunks","scanned_doc_citation","scanned_doc_citations"];case"rai_artifact_citation":return["rai_artifact_citation","rai_artifact_citations"];case"json_chunks":return["json_chunks"];case"scanned_doc_citation":return["scanned_doc_citation","scanned_doc_citations","artifact_chunks"];case"scanned_doc_citations":return["scanned_doc_citations","scanned_doc_citation","artifact_chunks"];default:return[n]}}(c)},[c]),p=function(){switch(c){case"artifact_chunks":case"scanned_doc_citations":return"scanned_doc_citation";case"rai_artifact_citation":return"rai_artifact_citation";default:return c}}(),C=(null==r?void 0:r.isEcgPayloadActive)?t(function(){return["onDemandCitationFetch",y,p,null==r?void 0:r.customCitationId]},[y,p,null==r?void 0:r.customCitationId]):t(function(){return["onDemandCitationFetch",y,p,u]},[y,p,u]),b=t(function(){return e(null==r?void 0:r.citations,g,u)},[null==r?void 0:r.citations,g,u]),N=Boolean(s&&y&&p&&f&&_&&!Number.isNaN(u)&&!b),w=v,A=!0===(null==r?void 0:r.isStreamEnd),k=o({queryKey:C,queryFn:function(){return n(void 0,void 0,void 0,function(){var n,t,o,e,l,c,d,s;return i(this,function(i){switch(i.label){case 0:return[4,a(y,p,u,null!==(t=null==r?void 0:r.content)&&void 0!==t?t:"",w,f,null!=m?m:"",_,null!=h?h:"",null!==(o=null==r?void 0:r.isEcgPayloadActive)&&void 0!==o&&o,null!==(e=null==r?void 0:r.ecg_agent_name)&&void 0!==e?e:"",null!==(l=null==r?void 0:r.customCitationId)&&void 0!==l?l:"",null!==(c=null==r?void 0:r.plan_id)&&void 0!==c?c:"",null!==(d=null==r?void 0:r.ui_chat_history)&&void 0!==d?d:void 0)];case 1:if((n=i.sent()).error||!n.responseData)throw new Error((null===(s=n.error)||void 0===s?void 0:s.errorMessage)||"Failed to fetch on-demand citation");return[2,n.responseData]}})})},enabled:N&&A&&Boolean(null==r?void 0:r.content),staleTime:1/0,cacheTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:!1}),F=t(function(){var n,i,t,o,a,l,c,d=null!==(t=null===(i=null===(n=k.data)||void 0===n?void 0:n.result)||void 0===i?void 0:i.citations)&&void 0!==t?t:[];return Array.isArray(d)&&0!==d.length?(null==r?void 0:r.customCitationId)?null!==(a=null!==(o=d.find(function(n){var i,t,o=null!==(t=null!==(i=null==n?void 0:n.title)&&void 0!==i?i:null==n?void 0:n.display_name)&&void 0!==t?t:"";return"string"==typeof o&&o.includes(r.customCitationId)}))&&void 0!==o?o:d[0])&&void 0!==a?a:null:null!==(c=null!==(l=e(d,g,u))&&void 0!==l?l:d[0])&&void 0!==c?c:null:null},[null==r?void 0:r.customCitationId,u,g,k.data]);return{citation:null!=b?b:F,isFetching:k.isFetching,isLoading:k.isLoading,isComplete:k.isSuccess,status:k.status,refetch:k.refetch}};export{l as useOnDemandCitationFetch};
1
+ import{__awaiter as n,__generator as i}from"tslib";import{useMemo as t}from"react";import{useQuery as o}from"@tanstack/react-query";import{fetchOnDemandCitation as a}from"../service/onDemandApi.js";var e=function(n,i,t){var o;return Array.isArray(n)?Array.isArray(i)&&0!==i.length?Number.isNaN(t)?(console.warn("[findCitation] citationNumber is NaN"),null):null!==(o=n.find(function(n){var o,a=function(n){var i,t,o,a,e;if(null==n)return console.warn("[getCitationType] received null or undefined citation"),"";var l=null!==(e=null!==(a=null!==(t=null===(i=null==n?void 0:n.customMetaData)||void 0===i?void 0:i.type)&&void 0!==t?t:null===(o=null==n?void 0:n.customMetadata)||void 0===o?void 0:o.type)&&void 0!==a?a:null==n?void 0:n.type)&&void 0!==e?e:"";return l||console.warn("[getCitationType] citation has no resolvable type field",n),l}(n);return(null===(o=function(n){var i;return null==n?(console.warn("[getCitationNumber] received null or undefined citation"),""):(null==n.citation_number&&console.warn("[getCitationNumber] citation is missing citation_number field",n),null!==(i=null==n?void 0:n.citation_number)&&void 0!==i?i:"")}(n))||void 0===o?void 0:o.toString())===t.toString()&&i.some(function(n){return null==a?void 0:a.includes(n)})}))&&void 0!==o?o:null:(console.warn("[findCitation] citationTypes is empty or falsy",i),null):(console.warn("[findCitation] citations is not an array",n),null)},l=function(l){var r=l.msg,c=l.citationType,u=l.citationNumber,d=l.enabled,s=void 0!==d&&d,v=l.accessToken,f=l.baseUrl,_=l.orgName,m=l.citationAssistantProcessingName,g=l.citationAgentName,h=(null==r?void 0:r.requestId)||(null==r?void 0:r.id)||"",y=t(function(){return function(n){switch(n){case"artifact_chunks":return["artifact_chunks","scanned_doc_citation","scanned_doc_citations"];case"rai_artifact_citation":return["rai_artifact_citation","rai_artifact_citations"];case"json_chunks":return["json_chunks"];case"scanned_doc_citation":return["scanned_doc_citation","scanned_doc_citations","artifact_chunks"];case"scanned_doc_citations":return["scanned_doc_citations","scanned_doc_citation","artifact_chunks"];default:return[n]}}(c)},[c]),p=function(){switch(c){case"artifact_chunks":case"scanned_doc_citations":return"scanned_doc_citation";case"rai_artifact_citation":return"rai_artifact_citation";default:return c}}(),C=(null==r?void 0:r.isEcgPayloadActive)?t(function(){return["onDemandCitationFetch",h,p,null==r?void 0:r.customCitationId,null==r?void 0:r.ecg_agent_name]},[h,p,null==r?void 0:r.customCitationId,null==r?void 0:r.ecg_agent_name]):t(function(){return["onDemandCitationFetch",h,p,u]},[h,p,u]),b=t(function(){return e(null==r?void 0:r.citations,y,u)},[null==r?void 0:r.citations,y,u]),N=Boolean(s&&h&&p&&f&&_&&!Number.isNaN(u)&&!b),w=v,A=!0===(null==r?void 0:r.isStreamEnd),k=o({queryKey:C,queryFn:function(){return n(void 0,void 0,void 0,function(){var n,t,o,e,l,c,d,s;return i(this,function(i){switch(i.label){case 0:return[4,a(h,p,u,null!==(t=null==r?void 0:r.content)&&void 0!==t?t:"",w,f,null!=m?m:"",_,null!=g?g:"",null!==(o=null==r?void 0:r.isEcgPayloadActive)&&void 0!==o&&o,null!==(e=null==r?void 0:r.ecg_agent_name)&&void 0!==e?e:"",null!==(l=null==r?void 0:r.customCitationId)&&void 0!==l?l:"",null!==(c=null==r?void 0:r.plan_id)&&void 0!==c?c:"",null!==(d=null==r?void 0:r.ui_chat_history)&&void 0!==d?d:void 0)];case 1:if((n=i.sent()).error||!n.responseData)throw new Error((null===(s=n.error)||void 0===s?void 0:s.errorMessage)||"Failed to fetch on-demand citation");return[2,n.responseData]}})})},enabled:N&&A&&Boolean(null==r?void 0:r.content),staleTime:1/0,cacheTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:!1}),F=t(function(){var n,i,t,o,a,l,c,d=null!==(t=null===(i=null===(n=k.data)||void 0===n?void 0:n.result)||void 0===i?void 0:i.citations)&&void 0!==t?t:[];return Array.isArray(d)&&0!==d.length?(null==r?void 0:r.customCitationId)?null!==(a=null!==(o=d.find(function(n){var i,t,o=null!==(t=null!==(i=null==n?void 0:n.title)&&void 0!==i?i:null==n?void 0:n.display_name)&&void 0!==t?t:"";return"string"==typeof o&&o.includes(r.customCitationId)}))&&void 0!==o?o:d[0])&&void 0!==a?a:null:null!==(c=null!==(l=e(d,y,u))&&void 0!==l?l:d[0])&&void 0!==c?c:null:null},[null==r?void 0:r.customCitationId,u,y,k.data]);return{citation:null!=b?b:F,isFetching:k.isFetching,isLoading:k.isLoading,isComplete:k.isSuccess,status:k.status,refetch:k.refetch}};export{l as useOnDemandCitationFetch};
2
2
  //# sourceMappingURL=useOnDemandCitationFetch.js.map
@@ -1,2 +1,2 @@
1
- import{__awaiter as e,__generator as r,__assign as t}from"tslib";import n from"axios";import{apiCache as s}from"./apicache.service.js";import{NetworkErrorType as o}from"../types/onDemandApi.types.js";export{NetworkErrorType}from"../types/onDemandApi.types.js";var a=72e5,i=function(n,s,o,a,i,c,u,l,p,d,E,m,g,v){return e(void 0,void 0,void 0,function(){var e,i,R,h;return r(this,function(r){return e="artifact_chunks"===s||"scanned_doc_citation"===s?"artifact_chunks":s,i=d?m:"".concat(e,"_").concat(o),[2,f(R="post",h="/api/chat/chatResponse",{baseURL:c,data:{name:u||"citationsprocessing",organizationName:l,prompt:"",useAgent:{agent_name:p||"ProcessCitationsAgent",arguments:t(t({citation_type:s,is_primary_agent_request:!1},d&&{check_possible_citation_payload:!1}),{ui_request_body:t(t(t({llm_formatted_response:a,request_id:n,max_concurrent_citations:10,citation_id:i},d&&E&&{ecg_agent_name:E}),d&&g&&{plan_id:g}),d&&v&&{ui_chat_history:v})})}},config:{headers:{"Content-Type":"application/json"},withCredentials:!0},errorMessage:"Failed to fetch on-demand citation",cacheOption:{key:"".concat(R,":").concat(h,":onDemandCitation:").concat(n,":").concat(s,":").concat(d?m:o)},shouldCache:function(e){var r;return Array.isArray(null===(r=null==e?void 0:e.result)||void 0===r?void 0:r.citations)&&Boolean(e.result.citations[0])}})]})})},c=function(e){if(e&&"object"==typeof e){var r=e;return"string"==typeof r.message?r.message:"string"==typeof r.errorMessage?r.errorMessage:"string"==typeof r.error?r.error:r.error&&"object"==typeof r.error&&"string"==typeof r.error.message?r.error.message:"string"==typeof r.details?r.details:r}},u=function(t){return e(void 0,void 0,void 0,function(){var e;return r(this,function(r){if(n.isAxiosError(t)){if("ECONNABORTED"===(e=t).code)return[2,{type:o.TIMEOUT,message:"The request took too long to complete. Please try again.",originalError:t}];if(e.message.includes("net::ERR_NETWORK_CHANGED")||e.message.includes("net::ERR_INTERNET_DISCONNECTED")||e.message.includes("net::ERR_NAME_NOT_RESOLVED"))return[2,{type:o.INTERNET_DISCONNECTED,message:"Internet connection issue detected. Please check your network.",originalError:t}];if(e.message.includes("Network Error")||"ERR_NETWORK"===e.code||e.message.includes("net::ERR_CONNECTION_REFUSED")||e.message.includes("net::ERR_EMPTY_RESPONSE"))return[2,{type:o.SERVER_UNREACHABLE,message:"Unable to connect to server. The service may be down or unreachable.",originalError:t}];if(e.response&&e.response.status>=500)return[2,{type:o.SERVER_ERROR,message:"Service Unavailable. Server error (".concat(e.response.status,")."),status:e.response.status,originalError:t}];if(e.response&&e.response.status>=400&&e.response.status<500)return[2,{type:o.SERVER_ERROR,message:c(e.response.data)||"Request failed with status code ".concat(e.response.status),status:e.response.status,originalError:t}]}return[2,{type:o.UNKNOWN_ERROR,message:"An unexpected error occurred. Please try again later.",originalError:t}]})})},l=function(t,s){void 0===s&&(s=18e4);var o=n.create({baseURL:t,timeout:s});return o.interceptors.request.use(function(t){return e(void 0,void 0,void 0,function(){return r(this,function(e){return[2,t]})})},function(t){return e(void 0,void 0,void 0,function(){var e;return r(this,function(r){switch(r.label){case 0:return[4,u(t)];case 1:return e=r.sent(),[2,Promise.reject(e)]}})})}),o.interceptors.response.use(function(e){return e},function(t){return e(void 0,void 0,void 0,function(){var e;return r(this,function(r){switch(r.label){case 0:return[4,u(t)];case 1:return e=r.sent(),console.error("API Request Failed:",e),[2,Promise.reject(e)]}})})}),o},p=function(e,r,t){return"".concat(e,":").concat(r,":").concat(JSON.stringify(t||{}))},d=l(),E=function(n,s,a){return e(void 0,void 0,void 0,function(){var e,i,c,p,E,f,m;return r(this,function(r){switch(r.label){case 0:switch(r.trys.push([0,13,,15]),e=(null==a?void 0:a.baseURL)?l(a.baseURL):d,c=(i=a||{}).data,p=i.config,E=void 0,n.toLowerCase()){case"get":return[3,1];case"post":return[3,3];case"put":return[3,5];case"patch":return[3,7];case"delete":return[3,9]}return[3,11];case 1:return[4,e.get(s,p)];case 2:case 4:case 6:case 8:case 10:return E=r.sent(),[3,12];case 3:return[4,e.post(s,c,p)];case 5:return[4,e.put(s,c,p)];case 7:return[4,e.patch(s,c,p)];case 9:return f=t(t({},p),{data:c}),[4,e.delete(s,f)];case 11:throw new Error("Unsupported method: ".concat(n));case 12:return[2,{responseData:E.data,error:null}];case 13:return(m=r.sent()).type&&Object.values(o).includes(m.type)?[2,{responseData:null,error:m}]:[4,u(m)];case 14:return[2,{responseData:null,error:r.sent()}];case 15:return[2]}})})},f=function(n,i,c){return e(void 0,void 0,void 0,function(){var e,u,l,d,f,m,g,v,R,h,_,y,N,O;return r(this,function(r){switch(r.label){case 0:return u=(e=c||{}).data,l=e.params,d=e.config,f=e.errorMessage,m=e.baseURL,g=e.cacheOption,v=e.shouldCache,R=null!==(O=null==g?void 0:g.ttl)&&void 0!==O?O:a,h=(null==g?void 0:g.key)||p(n,i,l),(null==g?void 0:g.forceRefresh)||(null==g?void 0:g.skipCache)?[3,2]:[4,s.get(h)];case 1:if(_=r.sent())return[2,{responseData:_.data,error:null,cacheMeta:{isFromCache:!0,timestamp:_.timestamp,ttl:_.ttl,cacheKey:h}}];r.label=2;case 2:return y=t(t({},d),l&&{params:l}),[4,E(n,i,{data:u,config:y,baseURL:m})];case 3:return N=r.sent(),!(null==g?void 0:g.skipCache)&&null!=N.responseData&&(!v||v(N.responseData))?[4,s.set(h,N.responseData,R)]:[3,5];case 4:r.sent(),r.label=5;case 5:return[2,{responseData:N.responseData,error:N.error?{errorMessage:N.error.type===o.INTERNET_DISCONNECTED||N.error.type===o.SLOW_CONNECTION||N.error.type===o.TIMEOUT?N.error.message:N.error.type===o.SERVER_UNREACHABLE?"Unable to connect to server. Please try again later.":f||N.error.message,errorObjData:N.error}:null,cacheMeta:{isFromCache:!1,timestamp:Date.now(),ttl:R,cacheKey:h}}]}})})};export{a as DEFAULT_CACHE_TTL,l as createApiInstance,i as fetchOnDemandCitation,p as generateCacheKey,E as makeApiRequest,f as makeApiRequestWithTTLCache};
1
+ import{__awaiter as e,__generator as r,__assign as t}from"tslib";import n from"axios";import{apiCache as s}from"./apicache.service.js";import{NetworkErrorType as o}from"../types/onDemandApi.types.js";export{NetworkErrorType}from"../types/onDemandApi.types.js";var a=72e5,i=function(n,s,o,a,i,c,u,l,p,d,E,m,g,v){return e(void 0,void 0,void 0,function(){var e,i,R,h;return r(this,function(r){return e="artifact_chunks"===s||"scanned_doc_citation"===s?"artifact_chunks":s,i=d?m:"".concat(e,"_").concat(o),[2,f(R="post",h="/api/chat/chatResponse",{baseURL:c,data:{name:u||"citationsprocessing",organizationName:l,prompt:"",useAgent:{agent_name:p||"ProcessCitationsAgent",arguments:t(t({citation_type:s,is_primary_agent_request:!1},d&&{check_possible_citation_payload:!1}),{ui_request_body:t(t(t({llm_formatted_response:a,request_id:n,max_concurrent_citations:10,citation_id:i},d&&E&&{ecg_agent_name:E}),d&&g&&{plan_id:g}),d&&v&&{ui_chat_history:v})})}},config:{headers:{"Content-Type":"application/json"},withCredentials:!0},errorMessage:"Failed to fetch on-demand citation",cacheOption:{key:"".concat(R,":").concat(h,":onDemandCitation:").concat(n,":").concat(s,":").concat(d?m:o,":").concat(d?E:"")},shouldCache:function(e){var r;return Array.isArray(null===(r=null==e?void 0:e.result)||void 0===r?void 0:r.citations)&&Boolean(e.result.citations[0])}})]})})},c=function(e){if(e&&"object"==typeof e){var r=e;return"string"==typeof r.message?r.message:"string"==typeof r.errorMessage?r.errorMessage:"string"==typeof r.error?r.error:r.error&&"object"==typeof r.error&&"string"==typeof r.error.message?r.error.message:"string"==typeof r.details?r.details:r}},u=function(t){return e(void 0,void 0,void 0,function(){var e;return r(this,function(r){if(n.isAxiosError(t)){if("ECONNABORTED"===(e=t).code)return[2,{type:o.TIMEOUT,message:"The request took too long to complete. Please try again.",originalError:t}];if(e.message.includes("net::ERR_NETWORK_CHANGED")||e.message.includes("net::ERR_INTERNET_DISCONNECTED")||e.message.includes("net::ERR_NAME_NOT_RESOLVED"))return[2,{type:o.INTERNET_DISCONNECTED,message:"Internet connection issue detected. Please check your network.",originalError:t}];if(e.message.includes("Network Error")||"ERR_NETWORK"===e.code||e.message.includes("net::ERR_CONNECTION_REFUSED")||e.message.includes("net::ERR_EMPTY_RESPONSE"))return[2,{type:o.SERVER_UNREACHABLE,message:"Unable to connect to server. The service may be down or unreachable.",originalError:t}];if(e.response&&e.response.status>=500)return[2,{type:o.SERVER_ERROR,message:"Service Unavailable. Server error (".concat(e.response.status,")."),status:e.response.status,originalError:t}];if(e.response&&e.response.status>=400&&e.response.status<500)return[2,{type:o.SERVER_ERROR,message:c(e.response.data)||"Request failed with status code ".concat(e.response.status),status:e.response.status,originalError:t}]}return[2,{type:o.UNKNOWN_ERROR,message:"An unexpected error occurred. Please try again later.",originalError:t}]})})},l=function(t,s){void 0===s&&(s=18e4);var o=n.create({baseURL:t,timeout:s});return o.interceptors.request.use(function(t){return e(void 0,void 0,void 0,function(){return r(this,function(e){return[2,t]})})},function(t){return e(void 0,void 0,void 0,function(){var e;return r(this,function(r){switch(r.label){case 0:return[4,u(t)];case 1:return e=r.sent(),[2,Promise.reject(e)]}})})}),o.interceptors.response.use(function(e){return e},function(t){return e(void 0,void 0,void 0,function(){var e;return r(this,function(r){switch(r.label){case 0:return[4,u(t)];case 1:return e=r.sent(),console.error("API Request Failed:",e),[2,Promise.reject(e)]}})})}),o},p=function(e,r,t){return"".concat(e,":").concat(r,":").concat(JSON.stringify(t||{}))},d=l(),E=function(n,s,a){return e(void 0,void 0,void 0,function(){var e,i,c,p,E,f,m;return r(this,function(r){switch(r.label){case 0:switch(r.trys.push([0,13,,15]),e=(null==a?void 0:a.baseURL)?l(a.baseURL):d,c=(i=a||{}).data,p=i.config,E=void 0,n.toLowerCase()){case"get":return[3,1];case"post":return[3,3];case"put":return[3,5];case"patch":return[3,7];case"delete":return[3,9]}return[3,11];case 1:return[4,e.get(s,p)];case 2:case 4:case 6:case 8:case 10:return E=r.sent(),[3,12];case 3:return[4,e.post(s,c,p)];case 5:return[4,e.put(s,c,p)];case 7:return[4,e.patch(s,c,p)];case 9:return f=t(t({},p),{data:c}),[4,e.delete(s,f)];case 11:throw new Error("Unsupported method: ".concat(n));case 12:return[2,{responseData:E.data,error:null}];case 13:return(m=r.sent()).type&&Object.values(o).includes(m.type)?[2,{responseData:null,error:m}]:[4,u(m)];case 14:return[2,{responseData:null,error:r.sent()}];case 15:return[2]}})})},f=function(n,i,c){return e(void 0,void 0,void 0,function(){var e,u,l,d,f,m,g,v,R,h,_,y,N,O;return r(this,function(r){switch(r.label){case 0:return u=(e=c||{}).data,l=e.params,d=e.config,f=e.errorMessage,m=e.baseURL,g=e.cacheOption,v=e.shouldCache,R=null!==(O=null==g?void 0:g.ttl)&&void 0!==O?O:a,h=(null==g?void 0:g.key)||p(n,i,l),(null==g?void 0:g.forceRefresh)||(null==g?void 0:g.skipCache)?[3,2]:[4,s.get(h)];case 1:if(_=r.sent())return[2,{responseData:_.data,error:null,cacheMeta:{isFromCache:!0,timestamp:_.timestamp,ttl:_.ttl,cacheKey:h}}];r.label=2;case 2:return y=t(t({},d),l&&{params:l}),[4,E(n,i,{data:u,config:y,baseURL:m})];case 3:return N=r.sent(),!(null==g?void 0:g.skipCache)&&null!=N.responseData&&(!v||v(N.responseData))?[4,s.set(h,N.responseData,R)]:[3,5];case 4:r.sent(),r.label=5;case 5:return[2,{responseData:N.responseData,error:N.error?{errorMessage:N.error.type===o.INTERNET_DISCONNECTED||N.error.type===o.SLOW_CONNECTION||N.error.type===o.TIMEOUT?N.error.message:N.error.type===o.SERVER_UNREACHABLE?"Unable to connect to server. Please try again later.":f||N.error.message,errorObjData:N.error}:null,cacheMeta:{isFromCache:!1,timestamp:Date.now(),ttl:R,cacheKey:h}}]}})})};export{a as DEFAULT_CACHE_TTL,l as createApiInstance,i as fetchOnDemandCitation,p as generateCacheKey,E as makeApiRequest,f as makeApiRequestWithTTLCache};
2
2
  //# sourceMappingURL=onDemandApi.js.map
@@ -0,0 +1,3 @@
1
+ declare const SPBAnalysisPanelTest: () => import("react/jsx-runtime").JSX.Element;
2
+ export default SPBAnalysisPanelTest;
3
+ //# sourceMappingURL=Spbanalysispaneltest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spbanalysispaneltest.d.ts","sourceRoot":"","sources":["../../../src/Spbanalysispaneltest.tsx"],"names":[],"mappings":"AAiHA,QAAA,MAAM,oBAAoB,+CA4FzB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"InternalChatCitationRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/features/ChatCitation/InternalChatCitationRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAU5D,OAAO,qBAAqB,CAAC;AAM7B,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AA8CD,KAAK,iCAAiC,GAAG,iBAAiB,GAAG;IAC3D,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,cAAc,CAAC,EAAE,iBAAiB,CAAC;CACpC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,4BAA4B,CAAC,EACnD,aAAa,EACb,aAAgC,EAChC,iBAAiB,EACjB,QAAQ,EACR,cAAc,EACd,cAAc,EACd,YAAY,EACZ,yBAAiC,EACjC,iBAAwB,EACxB,aAAmB,EACpB,EAAE,iCAAiC,2CAsgBnC"}
1
+ {"version":3,"file":"InternalChatCitationRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/features/ChatCitation/InternalChatCitationRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAU5D,OAAO,qBAAqB,CAAC;AAM7B,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AA8CD,KAAK,iCAAiC,GAAG,iBAAiB,GAAG;IAC3D,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,cAAc,CAAC,EAAE,iBAAiB,CAAC;CACpC,CAAC;AAIF,MAAM,CAAC,OAAO,UAAU,4BAA4B,CAAC,EACnD,aAAa,EACb,aAAoC,EACpC,iBAAiB,EACjB,QAAQ,EACR,cAAc,EACd,cAAc,EACd,YAAY,EACZ,yBAAiC,EACjC,iBAAwB,EACxB,aAAmB,EACpB,EAAE,iCAAiC,2CAsgBnC"}
@@ -1 +1 @@
1
- {"version":3,"file":"memoizedMarkdown.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/hooks/memoizedMarkdown.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoE,MAAM,OAAO,CAAC;AAezF,eAAO,MAAM,gBAAgB;aAWlB,MAAM;;cAEL,GAAG;;;;iBAIA,MAAM;;;8CAwnBpB,CAAC"}
1
+ {"version":3,"file":"memoizedMarkdown.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/hooks/memoizedMarkdown.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoE,MAAM,OAAO,CAAC;AAezF,eAAO,MAAM,gBAAgB;aAWlB,MAAM;;cAEL,GAAG;;;;iBAIA,MAAM;;;8CA+pBpB,CAAC"}
@@ -0,0 +1,22 @@
1
+ export type BlockCognitiveCitation = {
2
+ citation_number: number;
3
+ title?: string;
4
+ section_ref?: string;
5
+ content?: string;
6
+ paraphrase?: string;
7
+ highlight: string | string[];
8
+ };
9
+ export type CognitiveReasoningData = {
10
+ block_cognitive_reasoning_html: string;
11
+ block_cognitive_gap_html: string;
12
+ block_cognitive_confidence: number;
13
+ block_cognitive_citations: BlockCognitiveCitation[];
14
+ };
15
+ export interface CognitiveReasoningPanelProps {
16
+ open: boolean;
17
+ onClose: () => void;
18
+ data: CognitiveReasoningData | null;
19
+ }
20
+ declare const CognitiveReasoningPanel: ({ open, onClose, data }: CognitiveReasoningPanelProps) => import("react/jsx-runtime").JSX.Element | null;
21
+ export default CognitiveReasoningPanel;
22
+ //# sourceMappingURL=Cognitivereasoningpanel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cognitivereasoningpanel.d.ts","sourceRoot":"","sources":["../../../../../src/features/SPBAnalysisPanel/Cognitivereasoningpanel.tsx"],"names":[],"mappings":"AAwBA,MAAM,MAAM,sBAAsB,GAAG;IACjC,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACjC,8BAA8B,EAAE,MAAM,CAAC;IACvC,wBAAwB,EAAE,MAAM,CAAC;IACjC,0BAA0B,EAAE,MAAM,CAAC;IACnC,yBAAyB,EAAE,sBAAsB,EAAE,CAAC;CACvD,CAAC;AAEF,MAAM,WAAW,4BAA4B;IACzC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,EAAE,sBAAsB,GAAG,IAAI,CAAC;CACvC;AAoBD,QAAA,MAAM,uBAAuB,4BAA6B,4BAA4B,mDA2KrF,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
@@ -0,0 +1,37 @@
1
+ import React from "react";
2
+ interface Cluster {
3
+ id: string;
4
+ label: string;
5
+ }
6
+ interface RawNode {
7
+ id: string;
8
+ label: string;
9
+ cluster_id: string;
10
+ x: number;
11
+ y: number;
12
+ description: string;
13
+ }
14
+ interface Edge {
15
+ id: string;
16
+ source: string;
17
+ target: string;
18
+ reasoning: string;
19
+ score: number;
20
+ gap: string;
21
+ dependency_type: string;
22
+ }
23
+ interface ApiData {
24
+ graph_id: string;
25
+ prompt_id: string;
26
+ last_analyzed_at: string;
27
+ clusters: Cluster[];
28
+ nodes: RawNode[];
29
+ edges: Edge[];
30
+ }
31
+ interface DependencyGraphProps {
32
+ data: ApiData;
33
+ }
34
+ declare function DependencyGraph({ data }: DependencyGraphProps): React.ReactElement;
35
+ declare const _default: React.MemoExoticComponent<typeof DependencyGraph>;
36
+ export default _default;
37
+ //# sourceMappingURL=DependencyGraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DependencyGraph.d.ts","sourceRoot":"","sources":["../../../../../src/features/SPBAnalysisPanel/DependencyGraph.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAKjF,UAAU,OAAO;IACf,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,OAAO;IACf,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,IAAI;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,OAAO;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,KAAK,EAAE,IAAI,EAAE,CAAC;CACf;AA8CD,UAAU,oBAAoB;IAC5B,IAAI,EAAE,OAAO,CAAC;CACf;AAmsBD,iBAAS,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE,oBAAoB,GAAG,KAAK,CAAC,YAAY,CAqC3E;;AAED,wBAA2C"}
@@ -0,0 +1,11 @@
1
+ export interface InternalEditorProps {
2
+ content: string;
3
+ selectedTag?: string;
4
+ highlightVariable?: string;
5
+ isDarkMode: boolean;
6
+ height?: number | string;
7
+ fontSize?: number;
8
+ }
9
+ export declare const InternalEditor: ({ content, selectedTag, highlightVariable, isDarkMode, height, fontSize, }: InternalEditorProps) => import("react/jsx-runtime").JSX.Element;
10
+ export default InternalEditor;
11
+ //# sourceMappingURL=Internaleditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Internaleditor.d.ts","sourceRoot":"","sources":["../../../../../src/features/SPBAnalysisPanel/Internaleditor.tsx"],"names":[],"mappings":"AAsDA,MAAM,WAAW,mBAAmB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,cAAc,+EAOxB,mBAAmB,4CAqKrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ export interface MarkdownRendererProps {
3
+ message: string | undefined;
4
+ fontSize?: React.CSSProperties["fontSize"];
5
+ /** Keyed by the id referenced in `<a data-cognitive-reasoning="key">` anchors */
6
+ extraMetaData?: Record<string, any> | null;
7
+ }
8
+ export declare const MarkdownRenderer: ({ message, fontSize, extraMetaData }: MarkdownRendererProps) => import("react/jsx-runtime").JSX.Element;
9
+ export default MarkdownRenderer;
10
+ //# sourceMappingURL=Markdownrenderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Markdownrenderer.d.ts","sourceRoot":"","sources":["../../../../../src/features/SPBAnalysisPanel/Markdownrenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAiMpE,MAAM,WAAW,qBAAqB;IAClC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAC3C,iFAAiF;IACjF,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;CAC9C;AAED,eAAO,MAAM,gBAAgB,yCAA0C,qBAAqB,4CAgO3F,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,39 @@
1
+ export interface SPBApbReference {
2
+ apb_name: string;
3
+ description?: string;
4
+ context?: string;
5
+ }
6
+ export interface SPBFunctionalityItem {
7
+ name?: string;
8
+ section_name?: string;
9
+ description?: string;
10
+ reason_for_inclusion?: string;
11
+ apb_references: (string | SPBApbReference)[];
12
+ }
13
+ export interface SPBOverviewSummary {
14
+ overallSummary: string;
15
+ detailedSummary?: string;
16
+ extraMetaData?: Record<string, any> | null;
17
+ }
18
+ export interface SPBAdditionalInfo {
19
+ when_to_apply?: string;
20
+ when_not_to_apply?: string;
21
+ constraints_and_rules?: string;
22
+ input_analysis?: string;
23
+ output_analysis?: string;
24
+ dependency_graph?: any;
25
+ }
26
+ export interface SPBAnalysisPanelProps {
27
+ /** Full text of the system prompt this SPB analysis is derived from — used for the persistent/fullscreen preview editor */
28
+ promptContent: string;
29
+ promptTitle?: string;
30
+ isLoading?: boolean;
31
+ overviewSummary?: SPBOverviewSummary | null;
32
+ functionalityOfSPB?: SPBFunctionalityItem[];
33
+ spbAdditionalInfo?: SPBAdditionalInfo | null;
34
+ /** Show the persistent right-side code editor panel. Defaults to true. */
35
+ showCodePanel?: boolean;
36
+ }
37
+ declare const SPBAnalysisPanel: ({ promptContent, promptTitle, isLoading, overviewSummary, functionalityOfSPB, spbAdditionalInfo, showCodePanel, }: SPBAnalysisPanelProps) => import("react/jsx-runtime").JSX.Element;
38
+ export default SPBAnalysisPanel;
39
+ //# sourceMappingURL=Spbanalysispanel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spbanalysispanel.d.ts","sourceRoot":"","sources":["../../../../../src/features/SPBAnalysisPanel/Spbanalysispanel.tsx"],"names":[],"mappings":"AAoBA,MAAM,WAAW,eAAe;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,CAAC,MAAM,GAAG,eAAe,CAAC,EAAE,CAAC;CAChD;AAED,MAAM,WAAW,kBAAkB;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;CAC9C;AAED,MAAM,WAAW,iBAAiB;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,GAAG,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAqB;IAClC,2HAA2H;IAC3H,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,eAAe,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAC5C,kBAAkB,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAC5C,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAE7C,0EAA0E;IAC1E,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAkGD,QAAA,MAAM,gBAAgB,sHAQnB,qBAAqB,4CAkYvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,10 @@
1
+ export { default as SPBAnalysisPanel } from "./Spbanalysispanel";
2
+ export type { SPBAnalysisPanelProps, SPBApbReference, SPBFunctionalityItem, SPBOverviewSummary, SPBAdditionalInfo, } from "./Spbanalysispanel";
3
+ export { default as MarkdownRenderer } from "./Markdownrenderer";
4
+ export type { MarkdownRendererProps } from "./Markdownrenderer";
5
+ export { default as DependencyGraph } from "./DependencyGraph";
6
+ export { default as CognitiveReasoningPanel } from "./Cognitivereasoningpanel";
7
+ export type { CognitiveReasoningData, BlockCognitiveCitation, CognitiveReasoningPanelProps } from "./Cognitivereasoningpanel";
8
+ export { default as InternalEditor } from "./Internaleditor";
9
+ export type { InternalEditorProps } from "./Internaleditor";
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/SPBAnalysisPanel/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,YAAY,EACR,qBAAqB,EACrB,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,GACpB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,YAAY,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAK9H,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"onDemandApi.d.ts","sourceRoot":"","sources":["../../../../src/service/onDemandApi.ts"],"names":[],"mappings":"AACA,OAAc,EAAc,aAAa,EAAE,kBAAkB,EAAiB,MAAM,OAAO,CAAC;AAG5F,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,gCAAgC,EACjC,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,YAAY,EACV,YAAY,EACZ,QAAQ,EACR,mBAAmB,EACnB,iBAAiB,EACjB,6BAA6B,EAC7B,gCAAgC,EAChC,YAAY,GACb,MAAM,4BAA4B,CAAC;AAEpC,eAAO,MAAM,iBAAiB,QAAqB,CAAC;AAIpD,eAAO,MAAM,qBAAqB,cACrB,MAAM,gBACH,MAAM,kBACJ,MAAM,wBACA,MAAM,SACrB,MAAM,WACL,MAAM,mCACkB,MAAM,WAC9B,MAAM,qBACI,MAAM,sBACL,OAAO,kBACX,MAAM,oBACJ,MAAM,WACf,MAAM,oBACI,GAAG,KACpB,QAAQ,kBAAkB,GAAG,CAAC,CAsDhC,CAAC;AAGF,eAAO,MAAM,mBAAmB,cACnB,MAAM,gBACH,MAAM,kBACJ,MAAM,SAChB,MAAM,WACJ,MAAM,KACb,QAAQ,gCAAgC,CAiB1C,CAAC;AAmHF,eAAO,MAAM,iBAAiB,aAAc,MAAM,YAAW,MAAM,KAAY,aAsC9E,CAAC;AAEF,eAAO,MAAM,gBAAgB,WACnB,MAAM,OACT,MAAM,WACF,GAAG,WACyC,CAAC;AAKxD,eAAO,MAAM,cAAc,cACjB,MAAM,OACT,MAAM,YACD;IACR,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;;WAGM,YAAY,GAAG,IAAI;EAuD3B,CAAC;AAEF,eAAO,MAAM,0BAA0B,0DAG7B,MAAM,OACT,MAAM;WAEF,GAAG;aACD,GAAG;;;;;kFAM+D,OAAO;yCA4ErF,CAAC"}
1
+ {"version":3,"file":"onDemandApi.d.ts","sourceRoot":"","sources":["../../../../src/service/onDemandApi.ts"],"names":[],"mappings":"AACA,OAAc,EAAc,aAAa,EAAE,kBAAkB,EAAiB,MAAM,OAAO,CAAC;AAG5F,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,gCAAgC,EACjC,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,YAAY,EACV,YAAY,EACZ,QAAQ,EACR,mBAAmB,EACnB,iBAAiB,EACjB,6BAA6B,EAC7B,gCAAgC,EAChC,YAAY,GACb,MAAM,4BAA4B,CAAC;AAEpC,eAAO,MAAM,iBAAiB,QAAqB,CAAC;AAIpD,eAAO,MAAM,qBAAqB,cACrB,MAAM,gBACH,MAAM,kBACJ,MAAM,wBACA,MAAM,SACrB,MAAM,WACL,MAAM,mCACkB,MAAM,WAC9B,MAAM,qBACI,MAAM,sBACL,OAAO,kBACX,MAAM,oBACJ,MAAM,WACf,MAAM,oBACI,GAAG,KACpB,QAAQ,kBAAkB,GAAG,CAAC,CAwDhC,CAAC;AAGF,eAAO,MAAM,mBAAmB,cACnB,MAAM,gBACH,MAAM,kBACJ,MAAM,SAChB,MAAM,WACJ,MAAM,KACb,QAAQ,gCAAgC,CAiB1C,CAAC;AAmHF,eAAO,MAAM,iBAAiB,aAAc,MAAM,YAAW,MAAM,KAAY,aAsC9E,CAAC;AAEF,eAAO,MAAM,gBAAgB,WACnB,MAAM,OACT,MAAM,WACF,GAAG,WACyC,CAAC;AAKxD,eAAO,MAAM,cAAc,cACjB,MAAM,OACT,MAAM,YACD;IACR,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;;WAGM,YAAY,GAAG,IAAI;EAuD3B,CAAC;AAEF,eAAO,MAAM,0BAA0B,0DAG7B,MAAM,OACT,MAAM;WAEF,GAAG;aACD,GAAG;;;;;kFAM+D,OAAO;yCA4ErF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-llm-studio/citation",
3
- "version": "0.0.230",
3
+ "version": "0.0.232",
4
4
  "author": "Devesh Patel",
5
5
  "description": "",
6
6
  "license": "MIT",
@@ -186,6 +186,11 @@
186
186
  "import": "./dist/features/PromptemonBlockViewer/PromptemonBlockViewer.js",
187
187
  "require": "./dist/cjs/features/PromptemonBlockViewer/PromptemonBlockViewer.js",
188
188
  "types": "./dist/types/src/features/PromptemonBlockViewer/PromptemonBlockViewer.d.ts"
189
+ },
190
+ "./SPBAnalysisPanel": {
191
+ "import": "./dist/features/SPBAnalysisPanel/Spbanalysispanel.js",
192
+ "require": "./dist/cjs/features/SPBAnalysisPanel/Spbanalysispanel.js",
193
+ "types": "./dist/types/src/features/SPBAnalysisPanel/Spbanalysispanel.d.ts"
189
194
  }
190
195
  },
191
196
  "repository": {
@@ -256,7 +261,6 @@
256
261
  "@rollup/plugin-strip": "3.0.4",
257
262
  "@rollup/plugin-url": "^8.0.2",
258
263
  "@svgr/rollup": "8.1.0",
259
- "@tanstack/react-query": "^4.44.0",
260
264
  "@types/react": "17.0.83",
261
265
  "@types/react-dom": "17.0.26",
262
266
  "@types/react-router-dom": "5.3.3",
@@ -283,6 +287,7 @@
283
287
  "rollup-plugin-visualizer": "5.12.0",
284
288
  "ts-loader": "9.5.1",
285
289
  "typescript": "4.9.5",
290
+ "@tanstack/react-query": "^4.44.0",
286
291
  "wavesurfer.js": "^7.12.1",
287
292
  "webpack-bundle-analyzer": "^4.10.2"
288
293
  },