@e-llm-studio/instant-learning 1.3.0-alpha.23 → 1.3.0-alpha.24
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.
- package/dist/cjs/features/IL-OTJ/_components/CitationLink.js +1 -1
- package/dist/cjs/features/IL-OTJ/_components/MarkdownRenderer.js +2 -0
- package/dist/cjs/features/IL-OTJ/_components/MarkdownRenderer.js.map +1 -0
- package/dist/cjs/features/IL-OTJ/_components/MarkdownRenderer.module.css.js +2 -0
- package/dist/cjs/features/IL-OTJ/_components/MarkdownRenderer.module.css.js.map +1 -0
- package/dist/features/IL-OTJ/_components/CitationLink.js +1 -1
- package/dist/features/IL-OTJ/_components/MarkdownRenderer.js +2 -0
- package/dist/features/IL-OTJ/_components/MarkdownRenderer.js.map +1 -0
- package/dist/features/IL-OTJ/_components/MarkdownRenderer.module.css.js +2 -0
- package/dist/features/IL-OTJ/_components/MarkdownRenderer.module.css.js.map +1 -0
- package/dist/types/src/features/IL-OTJ/_components/CitationLink.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/MarkdownRenderer.d.ts +25 -0
- package/dist/types/src/features/IL-OTJ/_components/MarkdownRenderer.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),t=require("@e-llm-studio/citation"),n=require("react"),o=require("./_svg/ChevronDown.js"),r=require("./_svg/ChevronUp.js"),a=require("./_svg/BookIcon.js"),s=require("./_svg/CitationLinkSparkleIcon.js");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),t=require("@e-llm-studio/citation"),n=require("react"),o=require("./_svg/ChevronDown.js"),r=require("./_svg/ChevronUp.js"),a=require("./_svg/BookIcon.js"),s=require("./_svg/CitationLinkSparkleIcon.js"),l=require("./MarkdownRenderer.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=d(n),p=c.default.memo(function(t){var n=t.text,o=t.highlights;if(!o||0===o.length||!n)return i.jsx("span",{children:n});var r=o.map(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}),a=new RegExp("(".concat(r.join("|"),")"),"gi"),s=n.split(a);return i.jsx("span",{children:s.map(function(t,n){return o.some(function(e){return e.toLowerCase()===t.toLowerCase()})?i.jsx("span",e.__assign({style:{backgroundColor:"#fef08a",color:"#000"}},{children:t}),n):i.jsx("span",{children:t},n)})})}),x=c.default.memo(function(t){var n,o,r=t.citation,d=t.headerTitle,c=t.score,x=t.footerText,f=t.userPreferences,u=t.hasUserPreferences;return i.jsxs("div",e.__assign({className:"citation-card-layout",style:{display:"flex",flexDirection:"column",gap:"8px",padding:"10px",height:"auto",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"hidden",backgroundColor:"#fbfaff"}},{children:[c&&i.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",borderRadius:"9999px",border:"1.5px solid #c4b6fc",backgroundColor:"#FFF",padding:"4px 8px",fontSize:"12px",fontWeight:600,color:"#1E293B",gap:"4px",cursor:"pointer",width:"fit-content"}},{children:[i.jsx(s.CitationLinkSparkleIcon,{width:13,height:13}),i.jsxs("span",{children:["Citation Relevance ",c,"%"]})]})),i.jsxs("div",e.__assign({style:{flex:"1 1 auto",display:"flex",gap:u?"12px":"0px",overflow:"hidden",alignItems:"stretch",width:"100%",flexWrap:"wrap"}},{children:[i.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",flex:u?"1 1 170px":"1 1 100%",minWidth:u?"100px":"100%",width:u?"auto":"100%",border:"1px solid #E3E6EA",borderRadius:"8px"}},{children:[i.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px",borderBottom:"1px solid #E5E7EB",backgroundColor:"#F7F8FA",padding:"12px",fontSize:"14px",fontWeight:"500",color:"#19213D",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}},{children:[i.jsx(a.default,{})," ",d]})),i.jsx("div",e.__assign({className:"citation-markdown-wrapper",style:{flex:u?"1 1 60%":"1 1 auto",overflowY:"auto",backgroundColor:"#fff",minWidth:"0"}},{children:i.jsx(l.default,{value:(null===(n=r.customMetaData)||void 0===n?void 0:n.content)||"",highlightedText:null===(o=r.customMetaData)||void 0===o?void 0:o.highlighted_text,styles:{mainCard:{border:"none",padding:"8px"},list:{fontSize:"13px"}}})})),i.jsx("div",e.__assign({style:{display:"flex",backgroundColor:"#ffffffff",padding:"12px",justifyContent:"flex-end",borderTop:"1px solid #E6DDFE",fontSize:"12px",fontStyle:"italic",color:"#666F8D",fontWeight:"400",textTransform:"capitalize",whiteSpace:"nowrap",borderBottomLeftRadius:"8px",borderBottomRightRadius:"8px"}},{children:x}))]})),u&&i.jsxs("div",e.__assign({style:{flex:"1 1 170px",minWidth:"100px",display:"flex",flexDirection:"column",borderRadius:"8px",border:"1px solid #E5E7EB",backgroundColor:"#fff",overflowY:"visible",boxShadow:"0 1px 3px rgba(0,0,0,0.1)"}},{children:[i.jsx("div",e.__assign({style:{backgroundColor:"#fff"}},{children:i.jsx("div",e.__assign({style:{padding:"12px",backgroundColor:"#F7F8FA",borderBottom:"1px solid #E5E7EB"}},{children:i.jsx("h3",e.__assign({style:{margin:0,fontSize:"14px",fontWeight:"700",color:"#19213D"}},{children:"Your Preference"}))}))})),i.jsx("div",e.__assign({style:{padding:"16px",display:"flex",flexDirection:"column",gap:"6px"}},{children:f.slice(0,3).map(function(t,n){return i.jsx("div",e.__assign({style:{fontSize:"13px",lineHeight:"1.5",color:"#374151"}},{children:i.jsxs("div",e.__assign({style:{display:"flex",alignItems:"flex-start",gap:"4px"}},{children:[i.jsxs("div",e.__assign({style:{minWidth:"18px",fontSize:"13px",fontWeight:"600",color:"#374151",flexShrink:0}},{children:[n+1,"."]})),i.jsxs("div",e.__assign({style:{fontSize:"13px"}},{children:[i.jsx("span",{children:t.question}),i.jsx("span",e.__assign({style:{fontWeight:"600",margin:"0 4px"}},{children:":"})),i.jsx("br",{}),i.jsxs("span",e.__assign({style:{fontWeight:"700",color:"#111827"}},{children:['"',i.jsx(p,{text:t.answer,highlights:t.highlighted_text}),'"']}))]}))]}))}),n)})}))]}))]})),i.jsx("style",{children:"\n .citation-markdown-wrapper p:last-child { margin-bottom: 0 !important; }\n .citation-markdown-wrapper hr { display: none; }\n .citation-markdown-wrapper::-webkit-scrollbar, .citation-card-layout div::-webkit-scrollbar { width: 4px; }\n .citation-markdown-wrapper::-webkit-scrollbar-thumb, .citation-card-layout div::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 4px; }\n "})]}))});exports.default=function(a){var s,l,d,c,p=a.citation,f=a.linkTitle,u=a.isOpen,g=a.onToggle,h=a.fontSize,m=n.useRef(null),b=n.useCallback(function(){g&&g()},[g]);n.useEffect(function(){u&&m.current&&setTimeout(function(){var e;null===(e=m.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50)},[u]);var v=(null===(s=p.customMetaData)||void 0===s?void 0:s.citation_title)||"",_=(null===(l=p.customMetaData)||void 0===l?void 0:l.citation_relevance_score)||null,y="Referenced from ".concat(null===(d=p.customMetaData)||void 0===d?void 0:d.citation_reference)||"",j=(null===(c=p.customMetaData)||void 0===c?void 0:c.user_preference)||[],w=j.length>0;return i.jsxs("span",e.__assign({className:"citation-container",ref:m,onClick:function(e){return e.stopPropagation()}},{children:[i.jsx(t.CitationRenderer,{inLineCitation:!0,citationTitle:f,citationComponent:i.jsx(x,{citation:p,headerTitle:v,score:_,footerText:y,userPreferences:j,hasUserPreferences:w}),chevronDownComponent:i.jsx(o.default,{}),chevronUpComponent:i.jsx(r.default,{}),additionalCallbackForPillButton:b,isOpen:u,onToggle:g,styles:{citationWrapper:{maxHeight:"none",overflow:"visible",display:"flex",justifyContent:"center",marginBottom:"4px"},pillButton:{fontFamily:'"Inter", sans-serif',background:"transparent",padding:"2px 6px",margin:0,fontSize:h?"".concat(h,"px"):"1rem",fontWeight:500,color:"rgb(109, 40, 217)",cursor:"pointer",whiteSpace:"nowrap",border:u?"1px solid #A78BFA":"none",borderRadius:"6px",marginBottom:"3px",display:"inline-flex",alignItems:"center",gap:"2px",verticalAlign:"middle"},citationContent:{backgroundColor:"#F5F3FF66",border:"1px solid #A78BFA",borderRadius:"6px",padding:"0rem",fontFamily:'"Inter", sans-serif',fontSize:"12px",textAlign:"justify",textJustify:"inter-word",hyphens:"auto",fontWeight:400,lineHeight:"140%",color:"#1e293b",boxShadow:"none",width:"100%",minHeight:"auto",height:"auto",overflowY:"auto",scrollbarWidth:"none",msOverflowStyle:"none"}}}),i.jsx("style",{children:"\n .citation-container ::-webkit-scrollbar {\n display: none !important;\n }\n "})]}))};
|
|
2
2
|
//# sourceMappingURL=CitationLink.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),r=require("react"),n=require("react-markdown"),i=require("rehype-raw"),a=require("remark-gfm"),l=require("unist-util-visit"),s=require("./MarkdownRenderer.module.css.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=u(r),c=u(n),d=u(i),p=u(a);function f(){return function(t){l.visit(t,"text",function(t,r,n){var i;if(n&&"string"==typeof t.value&&t.value.includes("✓")){for(var a=t.value.split("✓"),l=[],u=0;u<a.length;u++){var o=a[u];o&&l.push({type:"text",value:o}),u<a.length-1&&l.push({type:"element",tagName:"span",properties:{"data-green-check":"true",className:[s.default.checkGreen]},children:[{type:"text",value:"✓"}]})}return(i=n.children).splice.apply(i,e.__spreadArray([r,1],l,!1)),r+l.length}})}}function m(){return function(e){l.visit(e,"element",function(e,t,r){if(r&&"p"===e.tagName)return e.children&&1===e.children.length&&"element"===e.children[0].type&&"details"===e.children[0].tagName?(r.children.splice(t,1,e.children[0]),t):void 0})}}var v=function(e){var t;return"text"===(null==e?void 0:e.type)&&/^\s*$/.test(null!==(t=e.value)&&void 0!==t?t:"")};function g(){return function(e){l.visit(e,"element",function(e){var t,r;if("details"===e.tagName&&"data-target"in(e.properties||{})){var n=e.children||[],i=0;"element"===(null===(t=n[0])||void 0===t?void 0:t.type)&&"summary"===(null===(r=n[0])||void 0===r?void 0:r.tagName)&&(i=1);var a=n.slice(i),l=a.filter(function(e){return!v(e)});if((1!==l.length||"element"!==l[0].type||!l[0].properties||!("data-popup"in l[0].properties)&&void 0===l[0].properties["data-popup"])&&!l.some(function(e){return"element"===(null==e?void 0:e.type)&&(null==e?void 0:e.properties)&&("data-popup"in e.properties||void 0!==e.properties["data-popup"])})){var s={type:"element",tagName:"div",properties:{"data-popup":""},children:a};e.children=n.slice(0,i).concat([s])}}})}}function h(){return function(e){l.visit(e,"element",function(e){var t,r;if("details"===e.tagName){var n=e.properties||{};if(!("data-inline"in n)&&!("data-target"in n)){var i=e.children||[],a=0;"element"===(null===(t=i[0])||void 0===t?void 0:t.type)&&"summary"===(null===(r=i[0])||void 0===r?void 0:r.tagName)&&(a=1);var l=i.slice(a),s=l.filter(function(e){return!v(e)});if((1!==s.length||"element"!==s[0].type||!s[0].properties||!("data-popup"in s[0].properties)&&void 0===s[0].properties["data-popup"])&&!s.some(function(e){return"element"===(null==e?void 0:e.type)&&(null==e?void 0:e.properties)&&("data-popup"in e.properties||void 0!==e.properties["data-popup"])})){var u={type:"element",tagName:"div",properties:{"data-popup":""},children:l};e.children=i.slice(0,a).concat([u])}}}})}}var y=function(r,n,i){if(!n||!n.trim())return r;var a=new RegExp("(".concat(n.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&"),")"),"gi");return r.split(a).map(function(r,n){return a.test(r)?t.jsx("mark",e.__assign({className:s.default.customHighlight,id:"customHighlight",style:i},{children:r}),n):r})};exports.default=function(n){var i=n.value,a=n.highlightedText,l=n.scrollTo,u=n.styles,v=void 0===u?{}:u,_=o.default.useRef(null),x=o.default.useRef(null);r.useEffect(function(){if(a){var e=setTimeout(function(){if(x.current){var e=x.current.querySelector("#customHighlight");e&&e.scrollIntoView({behavior:"smooth",block:l||"center"})}},225);return function(){return clearTimeout(e)}}},[a,i]);return t.jsx("div",e.__assign({ref:_,className:s.default.containerWrapper,style:v.containerWrapper},{children:t.jsx("div",e.__assign({className:s.default.mainCard,style:v.mainCard},{children:t.jsx("div",e.__assign({ref:x,className:s.default.scrollArea,style:v.scrollArea},{children:t.jsx(c.default,e.__assign({remarkPlugins:[p.default],rehypePlugins:[d.default,m,f,g,h],components:{details:function(r){r.node;var n=e.__rest(r,["node"]),i=!!n["data-inline"],a=!!n["data-target"],l=s.default.detailsBlock,u=v.detailsBlock;return i&&(l=s.default.detailsInline,u=v.detailsInline),a&&(l=s.default.detailsTarget,u=v.detailsTarget),t.jsxs("details",e.__assign({},n,{className:l,style:e.__assign(e.__assign({},u),n.style),onToggle:function(e){e.stopPropagation(),i&&function(e){var t=e.currentTarget,r=t.getAttribute("data-inline");if(r&&_.current){var n=_.current.querySelector('details[data-target="'.concat(r,'"]'));n&&(n.open=t.open)}}(e)}},{children:[a&&t.jsx("summary",{className:s.default.targetDummySummary,"aria-hidden":"true"}),n.children]}))},summary:function(r){r.node;var n=e.__rest(r,["node"]);return t.jsx("summary",e.__assign({className:s.default.summary,style:v.summary,onClick:function(e){return e.stopPropagation()}},n,{children:n.children}))},ul:function(r){return t.jsx("ul",e.__assign({className:s.default.list,style:v.list},r))},ol:function(r){return t.jsx("ol",e.__assign({className:s.default.list,style:v.list},r))},div:function(r){var n=r.node,i=e.__rest(r,["node"]),a=(null==n?void 0:n.properties)&&"data-popup"in n.properties;return t.jsx("div",e.__assign({},i,{className:a?s.default.popup:i.className,style:a?v.popup:i.style}))},span:function(r){var n,i=r.node,a=e.__rest(r,["node"]);return"true"===(null===(n=null==i?void 0:i.properties)||void 0===n?void 0:n["data-green-check"])?t.jsx("span",e.__assign({},a,{style:v.checkGreen})):t.jsx("span",e.__assign({},a))},p:function(e){var r=e.children,n=Array.isArray(r)?r:[r];return t.jsx("p",{children:n.map(function(e,r){return"string"==typeof e?y(e,a,v.customHighlight):t.jsx(o.default.Fragment,{children:e},r)})})},li:function(r){var n=r.children;try{var i=null==n?[]:Array.isArray(n)?n:[n];return t.jsx("li",e.__assign({style:{marginBottom:"4px"}},{children:null==i?void 0:i.map(function(e,r){return"string"==typeof e?y(e,a,v.customHighlight):t.jsx(o.default.Fragment,{children:e},r)})}))}catch(e){return console.error("Error rendering <li>:",e),t.jsx("li",{children:n})}},code:function(r){var n=r.children,i=e.__rest(r,["children"]);return t.jsx("code",e.__assign({},i,{children:n.map(function(e){return"string"==typeof e?y(e,a,v.customHighlight):e})}))}}},{children:i}))}))}))}))};
|
|
2
|
+
//# sourceMappingURL=MarkdownRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownRenderer.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});require("../../../node_modules/style-inject/dist/style-inject.es.js").default(".MarkdownRenderer-module_containerWrapper__XUtML{display:flex;gap:16px;height:42vh!important}.MarkdownRenderer-module_mainCard__BcSV-{background-color:#fff;border:1px solid #e5e7eb;border-radius:12px;box-shadow:0 1px 2px 0 #0000000d;flex:1;height:42vh;padding:20px}.MarkdownRenderer-module_scrollArea__oTyxO{height:100%;overflow-y:auto;padding-right:8px}.MarkdownRenderer-module_checkGreen__fc8ex{color:#16a34a!important;display:inline-block;font-weight:500;margin-right:4px;vertical-align:middle}.MarkdownRenderer-module_list__UqrN9{list-style-type:decimal;margin:4px 0;padding-left:20px}.MarkdownRenderer-module_customHighlight__KSBCr{background-color:#fef08a;border-radius:4px;color:#374151;padding:2px 4px}.MarkdownRenderer-module_detailsInline__Lqlyi{border-radius:8px;display:inline-block;margin:4px 0;position:relative;vertical-align:middle}.MarkdownRenderer-module_detailsInline__Lqlyi>:not(summary){display:none!important}.MarkdownRenderer-module_detailsTarget__MQk1n{display:block;margin:8px 0}.MarkdownRenderer-module_detailsBlock__iHvXn{border-radius:8px;margin:4px 0;position:relative;width:100%}.MarkdownRenderer-module_summary__2-IHg{align-items:center;color:#19213d;cursor:pointer;display:inline-flex;font-weight:500;gap:4px;padding:4px 0;user-select:none}.MarkdownRenderer-module_summary__2-IHg:hover{opacity:.9}.MarkdownRenderer-module_detailsBlock__iHvXn summary::-webkit-details-marker,.MarkdownRenderer-module_detailsInline__Lqlyi summary::-webkit-details-marker,.MarkdownRenderer-module_detailsTarget__MQk1n summary::-webkit-details-marker{display:none}.MarkdownRenderer-module_targetDummySummary__1L590{display:none!important}.MarkdownRenderer-module_popup__QuC1y{background:#6d28d91a;border:1px solid #6d28d9;border-radius:10px;box-shadow:0 8px 24px #0000000f;color:#6d28d9;display:block;font-size:12px;line-height:1.35;margin-top:6px;padding:12px;transition:opacity .2s ease,transform .2s ease}.MarkdownRenderer-module_detailsTarget__MQk1n .MarkdownRenderer-module_popup__QuC1y{opacity:0;transform:translateY(-4px)}.MarkdownRenderer-module_detailsTarget__MQk1n[open] .MarkdownRenderer-module_popup__QuC1y{opacity:1;transform:translateY(0)}.MarkdownRenderer-module_popup__QuC1y .MarkdownRenderer-module_popup__QuC1y{background:#0000!important;border:none!important;box-shadow:none!important;color:inherit!important;padding:0!important}"),exports.default={containerWrapper:"MarkdownRenderer-module_containerWrapper__XUtML",mainCard:"MarkdownRenderer-module_mainCard__BcSV-",scrollArea:"MarkdownRenderer-module_scrollArea__oTyxO",checkGreen:"MarkdownRenderer-module_checkGreen__fc8ex",list:"MarkdownRenderer-module_list__UqrN9",customHighlight:"MarkdownRenderer-module_customHighlight__KSBCr",detailsInline:"MarkdownRenderer-module_detailsInline__Lqlyi",detailsTarget:"MarkdownRenderer-module_detailsTarget__MQk1n",detailsBlock:"MarkdownRenderer-module_detailsBlock__iHvXn",summary:"MarkdownRenderer-module_summary__2-IHg",targetDummySummary:"MarkdownRenderer-module_targetDummySummary__1L590",popup:"MarkdownRenderer-module_popup__QuC1y"};
|
|
2
|
+
//# sourceMappingURL=MarkdownRenderer.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownRenderer.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsx as o,jsxs as t}from"react/jsx-runtime";import{
|
|
1
|
+
import{__assign as e}from"tslib";import{jsx as o,jsxs as t}from"react/jsx-runtime";import{CitationRenderer as i}from"@e-llm-studio/citation";import n,{useRef as r,useCallback as l,useEffect as a}from"react";import d from"./_svg/ChevronDown.js";import c from"./_svg/ChevronUp.js";import s from"./_svg/BookIcon.js";import{CitationLinkSparkleIcon as p}from"./_svg/CitationLinkSparkleIcon.js";import f from"./MarkdownRenderer.js";var h=n.memo(function(t){var i=t.text,n=t.highlights;if(!n||0===n.length||!i)return o("span",{children:i});var r=n.map(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}),l=new RegExp("(".concat(r.join("|"),")"),"gi"),a=i.split(l);return o("span",{children:a.map(function(t,i){var r=n.some(function(e){return e.toLowerCase()===t.toLowerCase()});return o("span",r?e({style:{backgroundColor:"#fef08a",color:"#000"}},{children:t}):{children:t},i)})})}),x=n.memo(function(i){var n,r,l=i.citation,a=i.headerTitle,d=i.score,c=i.footerText,x=i.userPreferences,u=i.hasUserPreferences;return t("div",e({className:"citation-card-layout",style:{display:"flex",flexDirection:"column",gap:"8px",padding:"10px",height:"auto",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"hidden",backgroundColor:"#fbfaff"}},{children:[d&&t("div",e({style:{display:"flex",alignItems:"center",borderRadius:"9999px",border:"1.5px solid #c4b6fc",backgroundColor:"#FFF",padding:"4px 8px",fontSize:"12px",fontWeight:600,color:"#1E293B",gap:"4px",cursor:"pointer",width:"fit-content"}},{children:[o(p,{width:13,height:13}),t("span",{children:["Citation Relevance ",d,"%"]})]})),t("div",e({style:{flex:"1 1 auto",display:"flex",gap:u?"12px":"0px",overflow:"hidden",alignItems:"stretch",width:"100%",flexWrap:"wrap"}},{children:[t("div",e({style:{display:"flex",flexDirection:"column",flex:u?"1 1 170px":"1 1 100%",minWidth:u?"100px":"100%",width:u?"auto":"100%",border:"1px solid #E3E6EA",borderRadius:"8px"}},{children:[t("div",e({style:{display:"flex",alignItems:"center",gap:"4px",borderBottom:"1px solid #E5E7EB",backgroundColor:"#F7F8FA",padding:"12px",fontSize:"14px",fontWeight:"500",color:"#19213D",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}},{children:[o(s,{})," ",a]})),o("div",e({className:"citation-markdown-wrapper",style:{flex:u?"1 1 60%":"1 1 auto",overflowY:"auto",backgroundColor:"#fff",minWidth:"0"}},{children:o(f,{value:(null===(n=l.customMetaData)||void 0===n?void 0:n.content)||"",highlightedText:null===(r=l.customMetaData)||void 0===r?void 0:r.highlighted_text,styles:{mainCard:{border:"none",padding:"8px"},list:{fontSize:"13px"}}})})),o("div",e({style:{display:"flex",backgroundColor:"#ffffffff",padding:"12px",justifyContent:"flex-end",borderTop:"1px solid #E6DDFE",fontSize:"12px",fontStyle:"italic",color:"#666F8D",fontWeight:"400",textTransform:"capitalize",whiteSpace:"nowrap",borderBottomLeftRadius:"8px",borderBottomRightRadius:"8px"}},{children:c}))]})),u&&t("div",e({style:{flex:"1 1 170px",minWidth:"100px",display:"flex",flexDirection:"column",borderRadius:"8px",border:"1px solid #E5E7EB",backgroundColor:"#fff",overflowY:"visible",boxShadow:"0 1px 3px rgba(0,0,0,0.1)"}},{children:[o("div",e({style:{backgroundColor:"#fff"}},{children:o("div",e({style:{padding:"12px",backgroundColor:"#F7F8FA",borderBottom:"1px solid #E5E7EB"}},{children:o("h3",e({style:{margin:0,fontSize:"14px",fontWeight:"700",color:"#19213D"}},{children:"Your Preference"}))}))})),o("div",e({style:{padding:"16px",display:"flex",flexDirection:"column",gap:"6px"}},{children:x.slice(0,3).map(function(i,n){return o("div",e({style:{fontSize:"13px",lineHeight:"1.5",color:"#374151"}},{children:t("div",e({style:{display:"flex",alignItems:"flex-start",gap:"4px"}},{children:[t("div",e({style:{minWidth:"18px",fontSize:"13px",fontWeight:"600",color:"#374151",flexShrink:0}},{children:[n+1,"."]})),t("div",e({style:{fontSize:"13px"}},{children:[o("span",{children:i.question}),o("span",e({style:{fontWeight:"600",margin:"0 4px"}},{children:":"})),o("br",{}),t("span",e({style:{fontWeight:"700",color:"#111827"}},{children:['"',o(h,{text:i.answer,highlights:i.highlighted_text}),'"']}))]}))]}))}),n)})}))]}))]})),o("style",{children:"\n .citation-markdown-wrapper p:last-child { margin-bottom: 0 !important; }\n .citation-markdown-wrapper hr { display: none; }\n .citation-markdown-wrapper::-webkit-scrollbar, .citation-card-layout div::-webkit-scrollbar { width: 4px; }\n .citation-markdown-wrapper::-webkit-scrollbar-thumb, .citation-card-layout div::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 4px; }\n "})]}))}),u=function(n){var s,p,f,h,u=n.citation,m=n.linkTitle,g=n.isOpen,v=n.onToggle,b=n.fontSize,y=r(null),w=l(function(){v&&v()},[v]);a(function(){g&&y.current&&setTimeout(function(){var e;null===(e=y.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50)},[g]);var k=(null===(s=u.customMetaData)||void 0===s?void 0:s.citation_title)||"",C=(null===(p=u.customMetaData)||void 0===p?void 0:p.citation_relevance_score)||null,F="Referenced from ".concat(null===(f=u.customMetaData)||void 0===f?void 0:f.citation_reference)||"",S=(null===(h=u.customMetaData)||void 0===h?void 0:h.user_preference)||[],D=S.length>0;return t("span",e({className:"citation-container",ref:y,onClick:function(e){return e.stopPropagation()}},{children:[o(i,{inLineCitation:!0,citationTitle:m,citationComponent:o(x,{citation:u,headerTitle:k,score:C,footerText:F,userPreferences:S,hasUserPreferences:D}),chevronDownComponent:o(d,{}),chevronUpComponent:o(c,{}),additionalCallbackForPillButton:w,isOpen:g,onToggle:v,styles:{citationWrapper:{maxHeight:"none",overflow:"visible",display:"flex",justifyContent:"center",marginBottom:"4px"},pillButton:{fontFamily:'"Inter", sans-serif',background:"transparent",padding:"2px 6px",margin:0,fontSize:b?"".concat(b,"px"):"1rem",fontWeight:500,color:"rgb(109, 40, 217)",cursor:"pointer",whiteSpace:"nowrap",border:g?"1px solid #A78BFA":"none",borderRadius:"6px",marginBottom:"3px",display:"inline-flex",alignItems:"center",gap:"2px",verticalAlign:"middle"},citationContent:{backgroundColor:"#F5F3FF66",border:"1px solid #A78BFA",borderRadius:"6px",padding:"0rem",fontFamily:'"Inter", sans-serif',fontSize:"12px",textAlign:"justify",textJustify:"inter-word",hyphens:"auto",fontWeight:400,lineHeight:"140%",color:"#1e293b",boxShadow:"none",width:"100%",minHeight:"auto",height:"auto",overflowY:"auto",scrollbarWidth:"none",msOverflowStyle:"none"}}}),o("style",{children:"\n .citation-container ::-webkit-scrollbar {\n display: none !important;\n }\n "})]}))};export{u as default};
|
|
2
2
|
//# sourceMappingURL=CitationLink.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as e,__rest as t,__spreadArray as r}from"tslib";import{jsx as n,jsxs as i}from"react/jsx-runtime";import a,{useEffect as l}from"react";import o from"react-markdown";import u from"rehype-raw";import c from"remark-gfm";import{visit as p}from"unist-util-visit";import s from"./MarkdownRenderer.module.css.js";function d(){return function(e){p(e,"text",function(e,t,n){var i;if(n&&"string"==typeof e.value&&e.value.includes("✓")){for(var a=e.value.split("✓"),l=[],o=0;o<a.length;o++){var u=a[o];u&&l.push({type:"text",value:u}),o<a.length-1&&l.push({type:"element",tagName:"span",properties:{"data-green-check":"true",className:[s.checkGreen]},children:[{type:"text",value:"✓"}]})}return(i=n.children).splice.apply(i,r([t,1],l,!1)),t+l.length}})}}function m(){return function(e){p(e,"element",function(e,t,r){if(r&&"p"===e.tagName)return e.children&&1===e.children.length&&"element"===e.children[0].type&&"details"===e.children[0].tagName?(r.children.splice(t,1,e.children[0]),t):void 0})}}var f=function(e){var t;return"text"===(null==e?void 0:e.type)&&/^\s*$/.test(null!==(t=e.value)&&void 0!==t?t:"")};function v(){return function(e){p(e,"element",function(e){var t,r;if("details"===e.tagName&&"data-target"in(e.properties||{})){var n=e.children||[],i=0;"element"===(null===(t=n[0])||void 0===t?void 0:t.type)&&"summary"===(null===(r=n[0])||void 0===r?void 0:r.tagName)&&(i=1);var a=n.slice(i),l=a.filter(function(e){return!f(e)});if((1!==l.length||"element"!==l[0].type||!l[0].properties||!("data-popup"in l[0].properties)&&void 0===l[0].properties["data-popup"])&&!l.some(function(e){return"element"===(null==e?void 0:e.type)&&(null==e?void 0:e.properties)&&("data-popup"in e.properties||void 0!==e.properties["data-popup"])})){var o={type:"element",tagName:"div",properties:{"data-popup":""},children:a};e.children=n.slice(0,i).concat([o])}}})}}function h(){return function(e){p(e,"element",function(e){var t,r;if("details"===e.tagName){var n=e.properties||{};if(!("data-inline"in n)&&!("data-target"in n)){var i=e.children||[],a=0;"element"===(null===(t=i[0])||void 0===t?void 0:t.type)&&"summary"===(null===(r=i[0])||void 0===r?void 0:r.tagName)&&(a=1);var l=i.slice(a),o=l.filter(function(e){return!f(e)});if((1!==o.length||"element"!==o[0].type||!o[0].properties||!("data-popup"in o[0].properties)&&void 0===o[0].properties["data-popup"])&&!o.some(function(e){return"element"===(null==e?void 0:e.type)&&(null==e?void 0:e.properties)&&("data-popup"in e.properties||void 0!==e.properties["data-popup"])})){var u={type:"element",tagName:"div",properties:{"data-popup":""},children:l};e.children=i.slice(0,a).concat([u])}}}})}}var g=function(t,r,i){if(!r||!r.trim())return t;var a=new RegExp("(".concat(r.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&"),")"),"gi");return t.split(a).map(function(t,r){return a.test(t)?n("mark",e({className:s.customHighlight,id:"customHighlight",style:i},{children:t}),r):t})},y=function(r){var p=r.value,f=r.highlightedText,y=r.scrollTo,N=r.styles,k=void 0===N?{}:N,x=a.useRef(null),T=a.useRef(null);l(function(){if(f){var e=setTimeout(function(){if(T.current){var e=T.current.querySelector("#customHighlight");e&&e.scrollIntoView({behavior:"smooth",block:y||"center"})}},225);return function(){return clearTimeout(e)}}},[f,p]);return n("div",e({ref:x,className:s.containerWrapper,style:k.containerWrapper},{children:n("div",e({className:s.mainCard,style:k.mainCard},{children:n("div",e({ref:T,className:s.scrollArea,style:k.scrollArea},{children:n(o,e({remarkPlugins:[c],rehypePlugins:[u,m,d,v,h],components:{details:function(r){r.node;var a=t(r,["node"]),l=!!a["data-inline"],o=!!a["data-target"],u=s.detailsBlock,c=k.detailsBlock;return l&&(u=s.detailsInline,c=k.detailsInline),o&&(u=s.detailsTarget,c=k.detailsTarget),i("details",e({},a,{className:u,style:e(e({},c),a.style),onToggle:function(e){e.stopPropagation(),l&&function(e){var t=e.currentTarget,r=t.getAttribute("data-inline");if(r&&x.current){var n=x.current.querySelector('details[data-target="'.concat(r,'"]'));n&&(n.open=t.open)}}(e)}},{children:[o&&n("summary",{className:s.targetDummySummary,"aria-hidden":"true"}),a.children]}))},summary:function(r){r.node;var i=t(r,["node"]);return n("summary",e({className:s.summary,style:k.summary,onClick:function(e){return e.stopPropagation()}},i,{children:i.children}))},ul:function(t){return n("ul",e({className:s.list,style:k.list},t))},ol:function(t){return n("ol",e({className:s.list,style:k.list},t))},div:function(r){var i=r.node,a=t(r,["node"]),l=(null==i?void 0:i.properties)&&"data-popup"in i.properties;return n("div",e({},a,{className:l?s.popup:a.className,style:l?k.popup:a.style}))},span:function(r){var i,a=r.node,l=t(r,["node"]),o="true"===(null===(i=null==a?void 0:a.properties)||void 0===i?void 0:i["data-green-check"]);return n("span",o?e({},l,{style:k.checkGreen}):e({},l))},p:function(e){var t=e.children,r=Array.isArray(t)?t:[t];return n("p",{children:r.map(function(e,t){return"string"==typeof e?g(e,f,k.customHighlight):n(a.Fragment,{children:e},t)})})},li:function(t){var r=t.children;try{var i=null==r?[]:Array.isArray(r)?r:[r];return n("li",e({style:{marginBottom:"4px"}},{children:null==i?void 0:i.map(function(e,t){return"string"==typeof e?g(e,f,k.customHighlight):n(a.Fragment,{children:e},t)})}))}catch(e){return console.error("Error rendering <li>:",e),n("li",{children:r})}},code:function(r){var i=r.children,a=t(r,["children"]);return n("code",e({},a,{children:i.map(function(e){return"string"==typeof e?g(e,f,k.customHighlight):e})}))}}},{children:p}))}))}))}))};export{y as default};
|
|
2
|
+
//# sourceMappingURL=MarkdownRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownRenderer.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e from"../../../node_modules/style-inject/dist/style-inject.es.js";var r={containerWrapper:"MarkdownRenderer-module_containerWrapper__XUtML",mainCard:"MarkdownRenderer-module_mainCard__BcSV-",scrollArea:"MarkdownRenderer-module_scrollArea__oTyxO",checkGreen:"MarkdownRenderer-module_checkGreen__fc8ex",list:"MarkdownRenderer-module_list__UqrN9",customHighlight:"MarkdownRenderer-module_customHighlight__KSBCr",detailsInline:"MarkdownRenderer-module_detailsInline__Lqlyi",detailsTarget:"MarkdownRenderer-module_detailsTarget__MQk1n",detailsBlock:"MarkdownRenderer-module_detailsBlock__iHvXn",summary:"MarkdownRenderer-module_summary__2-IHg",targetDummySummary:"MarkdownRenderer-module_targetDummySummary__1L590",popup:"MarkdownRenderer-module_popup__QuC1y"};e(".MarkdownRenderer-module_containerWrapper__XUtML{display:flex;gap:16px;height:42vh!important}.MarkdownRenderer-module_mainCard__BcSV-{background-color:#fff;border:1px solid #e5e7eb;border-radius:12px;box-shadow:0 1px 2px 0 #0000000d;flex:1;height:42vh;padding:20px}.MarkdownRenderer-module_scrollArea__oTyxO{height:100%;overflow-y:auto;padding-right:8px}.MarkdownRenderer-module_checkGreen__fc8ex{color:#16a34a!important;display:inline-block;font-weight:500;margin-right:4px;vertical-align:middle}.MarkdownRenderer-module_list__UqrN9{list-style-type:decimal;margin:4px 0;padding-left:20px}.MarkdownRenderer-module_customHighlight__KSBCr{background-color:#fef08a;border-radius:4px;color:#374151;padding:2px 4px}.MarkdownRenderer-module_detailsInline__Lqlyi{border-radius:8px;display:inline-block;margin:4px 0;position:relative;vertical-align:middle}.MarkdownRenderer-module_detailsInline__Lqlyi>:not(summary){display:none!important}.MarkdownRenderer-module_detailsTarget__MQk1n{display:block;margin:8px 0}.MarkdownRenderer-module_detailsBlock__iHvXn{border-radius:8px;margin:4px 0;position:relative;width:100%}.MarkdownRenderer-module_summary__2-IHg{align-items:center;color:#19213d;cursor:pointer;display:inline-flex;font-weight:500;gap:4px;padding:4px 0;user-select:none}.MarkdownRenderer-module_summary__2-IHg:hover{opacity:.9}.MarkdownRenderer-module_detailsBlock__iHvXn summary::-webkit-details-marker,.MarkdownRenderer-module_detailsInline__Lqlyi summary::-webkit-details-marker,.MarkdownRenderer-module_detailsTarget__MQk1n summary::-webkit-details-marker{display:none}.MarkdownRenderer-module_targetDummySummary__1L590{display:none!important}.MarkdownRenderer-module_popup__QuC1y{background:#6d28d91a;border:1px solid #6d28d9;border-radius:10px;box-shadow:0 8px 24px #0000000f;color:#6d28d9;display:block;font-size:12px;line-height:1.35;margin-top:6px;padding:12px;transition:opacity .2s ease,transform .2s ease}.MarkdownRenderer-module_detailsTarget__MQk1n .MarkdownRenderer-module_popup__QuC1y{opacity:0;transform:translateY(-4px)}.MarkdownRenderer-module_detailsTarget__MQk1n[open] .MarkdownRenderer-module_popup__QuC1y{opacity:1;transform:translateY(0)}.MarkdownRenderer-module_popup__QuC1y .MarkdownRenderer-module_popup__QuC1y{background:#0000!important;border:none!important;box-shadow:none!important;color:inherit!important;padding:0!important}");export{r as default};
|
|
2
|
+
//# sourceMappingURL=MarkdownRenderer.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownRenderer.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CitationLink.d.ts","sourceRoot":"","sources":["../../../../../../src/features/IL-OTJ/_components/CitationLink.tsx"],"names":[],"mappings":"AACA,OAAO,KAAyC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CitationLink.d.ts","sourceRoot":"","sources":["../../../../../../src/features/IL-OTJ/_components/CitationLink.tsx"],"names":[],"mappings":"AACA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAO9D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,GAAG,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAyOF,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAwG7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
|
+
export interface MarkdownRendererStyles {
|
|
4
|
+
containerWrapper?: CSSProperties;
|
|
5
|
+
mainCard?: CSSProperties;
|
|
6
|
+
scrollArea?: CSSProperties;
|
|
7
|
+
customHighlight?: CSSProperties;
|
|
8
|
+
popup?: CSSProperties;
|
|
9
|
+
summary?: CSSProperties;
|
|
10
|
+
list?: CSSProperties;
|
|
11
|
+
detailsBlock?: CSSProperties;
|
|
12
|
+
detailsInline?: CSSProperties;
|
|
13
|
+
detailsTarget?: CSSProperties;
|
|
14
|
+
checkGreen?: CSSProperties;
|
|
15
|
+
}
|
|
16
|
+
type Props = {
|
|
17
|
+
value: string;
|
|
18
|
+
highlightedText?: string;
|
|
19
|
+
highlightKeys?: any[];
|
|
20
|
+
scrollTo?: 'center' | 'start' | 'end';
|
|
21
|
+
styles?: MarkdownRendererStyles;
|
|
22
|
+
};
|
|
23
|
+
declare const MarkdownRenderer: React.FC<Props>;
|
|
24
|
+
export default MarkdownRenderer;
|
|
25
|
+
//# sourceMappingURL=MarkdownRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/features/IL-OTJ/_components/MarkdownRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAOtC,MAAM,WAAW,sBAAsB;IACrC,gBAAgB,CAAC,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,eAAe,CAAC,EAAE,aAAa,CAAC;IAChC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,UAAU,CAAC,EAAE,aAAa,CAAC;CAC5B;AAED,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,GAAG,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;IACtC,MAAM,CAAC,EAAE,sBAAsB,CAAC;CACjC,CAAC;AAkLF,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAuLrC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|