@e-llm-studio/citation 0.0.192 → 0.0.193

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("lucide-react"),r=require("./TextualGuidelines.module.css.js"),s=require("../CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js"),a=function(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")},o=function(e,n){var t=e.map(a).filter(Boolean),i=n.map(a).filter(Boolean);if(0===t.length||0===i.length)return 0;var r=new Set(t),s=new Set(i),o=0;return r.forEach(function(e){s.has(e)&&o++}),2*o/(r.size+s.size)},l=function(t){var i=0;return t.split(/(\*\*.*?\*\*|__.*?__)/g).map(function(t){var s="bold-".concat(i);return i+=t.length,t.startsWith("**")&&t.endsWith("**")||t.startsWith("__")&&t.endsWith("__")?n.jsx("strong",e.__assign({className:r.default.boldText},{children:t.slice(2,-2)}),s):t})};exports.default=function(a){a.index;var d=a.TextualGuideLines,h=a.HighlightedWords,c=a.InternalGptReasoningData,u=a.headerTitle,g=void 0===u?"Textual Guidelines":u,x=a.useVariantHighlight,f=void 0!==x&&x,p=a.fuzzyThreshold,v=void 0===p?.8:p,m=t.useState(0),I=m[0],_=m[1],b=t.useState(new Set),j=b[0],y=b[1],w=t.useRef([]),C=[];h.forEach(function(e){(function(e,n,t){void 0===t&&(t=.8);var i=n.trim().split(/\s+/).filter(Boolean);if(0===i.length)return[];for(var r,s=[],a=/\S+/g;null!==(r=a.exec(e));)s.push({word:r[0],start:r.index,end:r.index+r[0].length});for(var l=i.length,d=[],h=Math.max(1,l-1);h<=l+2;h++)for(var c=0;c<=s.length-h;c++){var u=s.slice(c,c+h),g=o(i,u.map(function(e){return e.word}));g>=t&&d.push({startIndex:u[0].start,endIndex:u[u.length-1].end,score:g})}if(0===d.length)return[];d.sort(function(e,n){return n.score-e.score});for(var x=[],f=function(e){x.some(function(n){return e.startIndex<n.endIndex&&e.endIndex>n.startIndex})||x.push(e)},p=0,v=d;p<v.length;p++)f(v[p]);return x})(d,e,v).forEach(function(e){return C.push(e)})}),C.sort(function(e,n){return e.startIndex-n.startIndex});for(var k=[],T=0,z=C;T<z.length;T++){var N=z[T],S=k.at(-1);(!S||N.startIndex>=S.endIndex)&&k.push(N)}var D=k.map(function(e,n){return{text:d.substring(e.startIndex,e.endIndex),startIndex:e.startIndex,endIndex:e.endIndex,highlightIndex:n}}),L=D.length;t.useEffect(function(){L>0&&(_(0),setTimeout(function(){var e;null===(e=w.current[0])||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50))},[L]);var E,M,q,G,R=function(e){y(function(n){var t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t})};return n.jsxs("div",e.__assign({className:r.default.expandedContainer,style:{marginLeft:"1rem",display:"flex",flexDirection:"column",height:"100%",border:"none"}},{children:[n.jsxs("div",e.__assign({className:r.default.expandedHeader,style:{backgroundColor:"white",border:"none"}},{children:[n.jsx("span",e.__assign({className:r.default.headerTitle,style:{backgroundColor:"white"}},{children:g})),n.jsx("div",e.__assign({className:r.default.headerActions},{children:L>1&&n.jsxs(n.Fragment,{children:[n.jsxs("span",e.__assign({style:{fontSize:"12px",color:"#888"}},{children:[I+1," / ",L]})),n.jsx("button",e.__assign({onClick:function(){if(0!==L){var e=I>0?I-1:L-1;_(e),setTimeout(function(){var n;null===(n=w.current[e])||void 0===n||n.scrollIntoView({behavior:"smooth",block:"center"})},50)}},disabled:I<=0,style:{padding:"2px 4px",cursor:I<=0?"not-allowed":"pointer",opacity:I<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:n.jsx(i.ChevronUp,{size:14,color:"#64748b"})})),n.jsx("button",e.__assign({onClick:function(){if(0!==L){var e=I<L-1?I+1:0;_(e),setTimeout(function(){var n;null===(n=w.current[e])||void 0===n||n.scrollIntoView({behavior:"smooth",block:"center"})},50)}},disabled:I>=L-1,style:{padding:"2px 4px",cursor:I>=L-1?"not-allowed":"pointer",opacity:I>=L-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:n.jsx(i.ChevronDown,{size:14,color:"#64748b"})}))]})}))]})),n.jsx("div",e.__assign({className:r.default.contentArea,style:{flex:1,maxHeight:"none",height:"auto",overflowY:"auto",border:"1px solid #eee",borderRadius:"4px",padding:"1rem"}},{children:n.jsx("div",e.__assign({className:r.default.contentInner},{children:(E=d.split("\n"),M=0,q=0,G=[],E.forEach(function(t){var a=M,o=M+t.length;M+=t.length+1;var h=/^(\s*)(-|\*|\d+\.)\s+/.exec(t),u=/^(Title|Description|Training-basis):\s*/i.exec(t);u&&(q=0),h&&(q+=1);var g,x=!!h,p=!!u,v=h?h[0].length:0,m=a+v,_=D.filter(function(e){return e.startIndex<o&&e.endIndex>m}),b="line-".concat(a);if(0===_.length)g=l(t.substring(v));else{g=[];for(var y=m,C=function(t){var s=Math.max(t.startIndex,m),a=Math.min(t.endIndex,o);if(s>=a)return"continue";if(s>y){var h=d.substring(y,s);g.push(n.jsx("span",{children:l(h)},"t-".concat(y)))}var c=t.highlightIndex===I,u=f?c?"".concat(r.default.highlight," ").concat(r.default.highlightActiveVariant):r.default.highlightVariant:c?"".concat(r.default.highlight," ").concat(r.default.highlightActive):r.default.highlight,x=j.has(t.highlightIndex);g.push(n.jsxs("span",e.__assign({ref:function(e){w.current[t.highlightIndex]=e},className:u,role:"button",tabIndex:0,onClick:function(){return R(t.highlightIndex)},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||R(t.highlightIndex)},style:{display:"inline-flex",alignItems:"center",gap:"2px",cursor:"pointer"}},{children:[d.substring(s,a),x?n.jsx(i.ChevronUp,{size:12,style:{flexShrink:0}}):n.jsx(i.ChevronDown,{size:12,style:{flexShrink:0}})]}),"h-".concat(t.highlightIndex))),y=a},k=0,T=_;k<T.length;k++)C(T[k]);y<o&&g.push(n.jsx("span",{children:l(d.substring(y,o))},"t-end-".concat(o)))}p?G.push(n.jsx("span",e.__assign({className:r.default.headerLine},{children:g}),b)):x?G.push(n.jsxs("span",e.__assign({className:r.default.listItemLine,style:{paddingLeft:h[1]?"1rem":"0"}},{children:[n.jsxs("span",e.__assign({className:r.default.listCounter},{children:[q,"."]})),n.jsx("span",{children:g})]}),b)):G.push(n.jsx("span",e.__assign({className:r.default.blockLine},{children:g}),b)),_.filter(function(e){return j.has(e.highlightIndex)&&c[e.highlightIndex]}).forEach(function(t){G.push(n.jsx("div",e.__assign({style:{marginTop:"0.5rem",marginBottom:"0.5rem"}},{children:n.jsx(s.default,{item:e.__assign(e.__assign({},c[t.highlightIndex]),{confidence_score:void 0}),headerTitle:"GPT - Gemini 3.1 Flash Lite",iconsConfig:{ChevronDownIcon:i.ChevronDown,ChevronUpIcon:i.ChevronUp,MaximizeIcon:i.Maximize2,CloseIcon:i.X},bodyHeight:"100%",disableMaximize:!0,index:t.highlightIndex})}),"expanded-".concat(t.highlightIndex)))})}),G)}))}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("lucide-react"),r=require("./TextualGuidelines.module.css.js"),s=require("../CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js"),a=function(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")},o=function(e,n){var t=e.map(a).filter(Boolean),i=n.map(a).filter(Boolean);if(0===t.length||0===i.length)return 0;var r=new Set(t),s=new Set(i),o=0;return r.forEach(function(e){s.has(e)&&o++}),2*o/(r.size+s.size)},l=function(t){var i=0;return t.split(/(\*\*.*?\*\*|__.*?__)/g).map(function(t){var s="bold-".concat(i);return i+=t.length,t.startsWith("**")&&t.endsWith("**")||t.startsWith("__")&&t.endsWith("__")?n.jsx("strong",e.__assign({className:r.default.boldText},{children:t.slice(2,-2)}),s):t})};exports.default=function(a){a.index;var d=a.TextualGuideLines,c=a.HighlightedWords,h=a.InternalGptReasoningData,u=a.headerTitle,g=void 0===u?"Textual Guidelines":u,x=a.useVariantHighlight,f=void 0!==x&&x,p=a.fuzzyThreshold,v=void 0===p?.8:p,m=t.useState(0),I=m[0],_=m[1],b=t.useState(new Set),j=b[0],y=b[1],w=t.useRef([]),C=[];c.forEach(function(e){(function(e,n,t){void 0===t&&(t=.8);var i=n.trim().split(/\s+/).filter(Boolean);if(0===i.length)return[];for(var r,s=[],a=/\S+/g;null!==(r=a.exec(e));)s.push({word:r[0],start:r.index,end:r.index+r[0].length});for(var l=i.length,d=[],c=Math.max(1,l-1);c<=l+2;c++)for(var h=0;h<=s.length-c;h++){var u=s.slice(h,h+c),g=o(i,u.map(function(e){return e.word}));g>=t&&d.push({startIndex:u[0].start,endIndex:u[u.length-1].end,score:g})}if(0===d.length)return[];d.sort(function(e,n){return n.score-e.score});for(var x=[],f=function(e){x.some(function(n){return e.startIndex<n.endIndex&&e.endIndex>n.startIndex})||x.push(e)},p=0,v=d;p<v.length;p++)f(v[p]);return x})(d,e,v).forEach(function(e){return C.push(e)})}),C.sort(function(e,n){return e.startIndex-n.startIndex});for(var k=[],T=0,z=C;T<z.length;T++){var N=z[T],S=k.at(-1);(!S||N.startIndex>=S.endIndex)&&k.push(N)}var D=k.map(function(e,n){return{text:d.substring(e.startIndex,e.endIndex),startIndex:e.startIndex,endIndex:e.endIndex,highlightIndex:n}}),L=D.length;t.useEffect(function(){L>0&&(_(0),setTimeout(function(){var e;null===(e=w.current[0])||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50))},[L]);var M,q,E,G,R=function(e){y(function(n){var t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t})};return n.jsxs("div",e.__assign({className:r.default.expandedContainer,style:{marginLeft:"1rem",display:"flex",flexDirection:"column",height:"100%",border:"none"}},{children:[n.jsxs("div",e.__assign({className:r.default.expandedHeader,style:{backgroundColor:"white",border:"none"}},{children:[n.jsx("span",e.__assign({className:r.default.headerTitle,style:{backgroundColor:"white"}},{children:g})),n.jsx("div",e.__assign({className:r.default.headerActions},{children:L>=1&&n.jsxs(n.Fragment,{children:[n.jsxs("span",e.__assign({style:{fontSize:"12px",color:"#888"}},{children:[I+1," / ",L]})),n.jsx("button",e.__assign({onClick:function(){if(0!==L){var e=I>0?I-1:L-1;_(e),setTimeout(function(){var n;null===(n=w.current[e])||void 0===n||n.scrollIntoView({behavior:"smooth",block:"center"})},50)}},disabled:I<=0,style:{padding:"2px 4px",cursor:I<=0?"not-allowed":"pointer",opacity:I<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:n.jsx(i.ChevronUp,{size:14,color:"#64748b"})})),n.jsx("button",e.__assign({onClick:function(){if(0!==L){var e=I<L-1?I+1:0;_(e),setTimeout(function(){var n;null===(n=w.current[e])||void 0===n||n.scrollIntoView({behavior:"smooth",block:"center"})},50)}},disabled:I>=L-1,style:{padding:"2px 4px",cursor:I>=L-1?"not-allowed":"pointer",opacity:I>=L-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:n.jsx(i.ChevronDown,{size:14,color:"#64748b"})}))]})}))]})),n.jsx("div",e.__assign({className:r.default.contentArea,style:{flex:1,maxHeight:"none",height:"auto",overflowY:"auto",border:"1px solid #eee",borderRadius:"4px",padding:"1rem"}},{children:n.jsx("div",e.__assign({className:r.default.contentInner},{children:(M=d.split("\n"),q=0,E=0,G=[],M.forEach(function(t){var a=q,o=q+t.length;q+=t.length+1;var c=/^(\s*)(-|\*|\d+\.)\s+/.exec(t),u=/^(Title|Description|Training-basis):\s*/i.exec(t);u&&(E=0),c&&(E+=1);var g=!!c,x=!!u,p=c?c[0].length:0,v=a+p,m=D.filter(function(e){return e.startIndex<o&&e.endIndex>v}),_="line-".concat(a),b=function(t,i,s){x?G.push(n.jsx("span",e.__assign({className:r.default.headerLine},{children:t}),i)):g?G.push(n.jsxs("span",e.__assign({className:r.default.listItemLine,style:{paddingLeft:c[1]?"1rem":"0"}},{children:[s&&n.jsxs("span",e.__assign({className:r.default.listCounter},{children:[E,"."]})),n.jsx("span",{children:t})]}),i)):G.push(n.jsx("span",e.__assign({className:r.default.blockLine},{children:t}),i))};if(0===m.length)b(l(t.substring(p)),_,!0);else{for(var y=v,C=[],k=!0,T=function(t){var a=Math.max(t.startIndex,v),c=Math.min(t.endIndex,o);if(a>=c)return"continue";if(a>y){var u=d.substring(y,a);C.push(n.jsx("span",{children:l(u)},"t-".concat(y)))}var g=t.highlightIndex===I,x=f?g?"".concat(r.default.highlight," ").concat(r.default.highlightActiveVariant):r.default.highlightVariant:g?"".concat(r.default.highlight," ").concat(r.default.highlightActive):r.default.highlight,p=j.has(t.highlightIndex);if(C.push(n.jsxs("span",e.__assign({ref:function(e){w.current[t.highlightIndex]=e},className:x,role:"button",tabIndex:0,onClick:function(){return R(t.highlightIndex)},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||R(t.highlightIndex)},style:{display:"inline-flex",alignItems:"center",gap:"2px",cursor:"pointer"}},{children:[d.substring(a,c),p?n.jsx(i.ChevronUp,{size:12,style:{flexShrink:0}}):n.jsx(i.ChevronDown,{size:12,style:{flexShrink:0}})]}),"h-".concat(t.highlightIndex))),y=c,p&&h[t.highlightIndex]){var m=k?_:"".concat(_,"-chunk-").concat(a);b(C,m,k),k=!1,C=[],G.push(n.jsx("div",e.__assign({style:{marginTop:"0.5rem",marginBottom:"0.5rem"}},{children:n.jsx(s.default,{item:e.__assign(e.__assign({},h[t.highlightIndex]),{confidence_score:void 0}),headerTitle:"GPT - Gemini 3.1 Flash Lite",iconsConfig:{ChevronDownIcon:i.ChevronDown,ChevronUpIcon:i.ChevronUp,MaximizeIcon:i.Maximize2,CloseIcon:i.X},bodyHeight:"100%",disableMaximize:!0,index:t.highlightIndex})}),"expanded-".concat(t.highlightIndex)))}},z=0,N=m;z<N.length;z++)T(N[z]);if(y<o&&C.push(n.jsx("span",{children:l(d.substring(y,o))},"t-end-".concat(o))),C.length>0||k){var S=k?_:"".concat(_,"-tail");b(C,S,k)}}}),G)}))}))]}))};
2
2
  //# sourceMappingURL=TextualGuideLinesComponent.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsxs as n,jsx as t,Fragment as i}from"react/jsx-runtime";import{useState as r,useRef as o,useEffect as a}from"react";import{ChevronUp as l,ChevronDown as s,Maximize2 as d,X as c}from"lucide-react";import h from"./TextualGuidelines.module.css.js";import u from"../CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js";var g=function(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")},f=function(e,n){var t=e.map(g).filter(Boolean),i=n.map(g).filter(Boolean);if(0===t.length||0===i.length)return 0;var r=new Set(t),o=new Set(i),a=0;return r.forEach(function(e){o.has(e)&&a++}),2*a/(r.size+o.size)},p=function(n){var i=0;return n.split(/(\*\*.*?\*\*|__.*?__)/g).map(function(n){var r="bold-".concat(i);return i+=n.length,n.startsWith("**")&&n.endsWith("**")||n.startsWith("__")&&n.endsWith("__")?t("strong",e({className:h.boldText},{children:n.slice(2,-2)}),r):n})},x=function(g){g.index;var x=g.TextualGuideLines,m=g.HighlightedWords,v=g.InternalGptReasoningData,I=g.headerTitle,b=void 0===I?"Textual Guidelines":I,y=g.useVariantHighlight,w=void 0!==y&&y,C=g.fuzzyThreshold,T=void 0===C?.8:C,k=r(0),N=k[0],z=k[1],_=r(new Set),L=_[0],S=_[1],E=o([]),G=[];m.forEach(function(e){(function(e,n,t){void 0===t&&(t=.8);var i=n.trim().split(/\s+/).filter(Boolean);if(0===i.length)return[];for(var r,o=[],a=/\S+/g;null!==(r=a.exec(e));)o.push({word:r[0],start:r.index,end:r.index+r[0].length});for(var l=i.length,s=[],d=Math.max(1,l-1);d<=l+2;d++)for(var c=0;c<=o.length-d;c++){var h=o.slice(c,c+d),u=f(i,h.map(function(e){return e.word}));u>=t&&s.push({startIndex:h[0].start,endIndex:h[h.length-1].end,score:u})}if(0===s.length)return[];s.sort(function(e,n){return n.score-e.score});for(var g=[],p=function(e){g.some(function(n){return e.startIndex<n.endIndex&&e.endIndex>n.startIndex})||g.push(e)},x=0,m=s;x<m.length;x++)p(m[x]);return g})(x,e,T).forEach(function(e){return G.push(e)})}),G.sort(function(e,n){return e.startIndex-n.startIndex});for(var V=[],D=0,H=G;D<H.length;D++){var M=H[D],R=V.at(-1);(!R||M.startIndex>=R.endIndex)&&V.push(M)}var W=V.map(function(e,n){return{text:x.substring(e.startIndex,e.endIndex),startIndex:e.startIndex,endIndex:e.endIndex,highlightIndex:n}}),A=W.length;a(function(){A>0&&(z(0),setTimeout(function(){var e;null===(e=E.current[0])||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50))},[A]);var B,j,F,K,P=function(e){S(function(n){var t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t})};return n("div",e({className:h.expandedContainer,style:{marginLeft:"1rem",display:"flex",flexDirection:"column",height:"100%",border:"none"}},{children:[n("div",e({className:h.expandedHeader,style:{backgroundColor:"white",border:"none"}},{children:[t("span",e({className:h.headerTitle,style:{backgroundColor:"white"}},{children:b})),t("div",e({className:h.headerActions},{children:A>1&&n(i,{children:[n("span",e({style:{fontSize:"12px",color:"#888"}},{children:[N+1," / ",A]})),t("button",e({onClick:function(){if(0!==A){var e=N>0?N-1:A-1;z(e),setTimeout(function(){var n;null===(n=E.current[e])||void 0===n||n.scrollIntoView({behavior:"smooth",block:"center"})},50)}},disabled:N<=0,style:{padding:"2px 4px",cursor:N<=0?"not-allowed":"pointer",opacity:N<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:t(l,{size:14,color:"#64748b"})})),t("button",e({onClick:function(){if(0!==A){var e=N<A-1?N+1:0;z(e),setTimeout(function(){var n;null===(n=E.current[e])||void 0===n||n.scrollIntoView({behavior:"smooth",block:"center"})},50)}},disabled:N>=A-1,style:{padding:"2px 4px",cursor:N>=A-1?"not-allowed":"pointer",opacity:N>=A-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:t(s,{size:14,color:"#64748b"})}))]})}))]})),t("div",e({className:h.contentArea,style:{flex:1,maxHeight:"none",height:"auto",overflowY:"auto",border:"1px solid #eee",borderRadius:"4px",padding:"1rem"}},{children:t("div",e({className:h.contentInner},{children:(B=x.split("\n"),j=0,F=0,K=[],B.forEach(function(i){var r=j,o=j+i.length;j+=i.length+1;var a=/^(\s*)(-|\*|\d+\.)\s+/.exec(i),g=/^(Title|Description|Training-basis):\s*/i.exec(i);g&&(F=0),a&&(F+=1);var f,m=!!a,I=!!g,b=a?a[0].length:0,y=r+b,C=W.filter(function(e){return e.startIndex<o&&e.endIndex>y}),T="line-".concat(r);if(0===C.length)f=p(i.substring(b));else{f=[];for(var k=y,z=function(i){var r=Math.max(i.startIndex,y),a=Math.min(i.endIndex,o);if(r>=a)return"continue";if(r>k){var d=x.substring(k,r);f.push(t("span",{children:p(d)},"t-".concat(k)))}var c=i.highlightIndex===N,u=w?c?"".concat(h.highlight," ").concat(h.highlightActiveVariant):h.highlightVariant:c?"".concat(h.highlight," ").concat(h.highlightActive):h.highlight,g=L.has(i.highlightIndex);f.push(n("span",e({ref:function(e){E.current[i.highlightIndex]=e},className:u,role:"button",tabIndex:0,onClick:function(){return P(i.highlightIndex)},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||P(i.highlightIndex)},style:{display:"inline-flex",alignItems:"center",gap:"2px",cursor:"pointer"}},{children:[x.substring(r,a),t(g?l:s,{size:12,style:{flexShrink:0}})]}),"h-".concat(i.highlightIndex))),k=a},_=0,S=C;_<S.length;_++)z(S[_]);k<o&&f.push(t("span",{children:p(x.substring(k,o))},"t-end-".concat(o)))}I?K.push(t("span",e({className:h.headerLine},{children:f}),T)):m?K.push(n("span",e({className:h.listItemLine,style:{paddingLeft:a[1]?"1rem":"0"}},{children:[n("span",e({className:h.listCounter},{children:[F,"."]})),t("span",{children:f})]}),T)):K.push(t("span",e({className:h.blockLine},{children:f}),T)),C.filter(function(e){return L.has(e.highlightIndex)&&v[e.highlightIndex]}).forEach(function(n){K.push(t("div",e({style:{marginTop:"0.5rem",marginBottom:"0.5rem"}},{children:t(u,{item:e(e({},v[n.highlightIndex]),{confidence_score:void 0}),headerTitle:"GPT - Gemini 3.1 Flash Lite",iconsConfig:{ChevronDownIcon:s,ChevronUpIcon:l,MaximizeIcon:d,CloseIcon:c},bodyHeight:"100%",disableMaximize:!0,index:n.highlightIndex})}),"expanded-".concat(n.highlightIndex)))})}),K)}))}))]}))};export{x as default};
1
+ import{__assign as e}from"tslib";import{jsxs as n,jsx as t,Fragment as i}from"react/jsx-runtime";import{useState as r,useRef as o,useEffect as a}from"react";import{ChevronUp as l,ChevronDown as s,Maximize2 as d,X as c}from"lucide-react";import h from"./TextualGuidelines.module.css.js";import u from"../CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js";var g=function(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")},f=function(e,n){var t=e.map(g).filter(Boolean),i=n.map(g).filter(Boolean);if(0===t.length||0===i.length)return 0;var r=new Set(t),o=new Set(i),a=0;return r.forEach(function(e){o.has(e)&&a++}),2*a/(r.size+o.size)},p=function(n){var i=0;return n.split(/(\*\*.*?\*\*|__.*?__)/g).map(function(n){var r="bold-".concat(i);return i+=n.length,n.startsWith("**")&&n.endsWith("**")||n.startsWith("__")&&n.endsWith("__")?t("strong",e({className:h.boldText},{children:n.slice(2,-2)}),r):n})},x=function(g){g.index;var x=g.TextualGuideLines,m=g.HighlightedWords,v=g.InternalGptReasoningData,I=g.headerTitle,b=void 0===I?"Textual Guidelines":I,y=g.useVariantHighlight,w=void 0!==y&&y,C=g.fuzzyThreshold,k=void 0===C?.8:C,T=r(0),N=T[0],z=T[1],_=r(new Set),L=_[0],S=_[1],G=o([]),V=[];m.forEach(function(e){(function(e,n,t){void 0===t&&(t=.8);var i=n.trim().split(/\s+/).filter(Boolean);if(0===i.length)return[];for(var r,o=[],a=/\S+/g;null!==(r=a.exec(e));)o.push({word:r[0],start:r.index,end:r.index+r[0].length});for(var l=i.length,s=[],d=Math.max(1,l-1);d<=l+2;d++)for(var c=0;c<=o.length-d;c++){var h=o.slice(c,c+d),u=f(i,h.map(function(e){return e.word}));u>=t&&s.push({startIndex:h[0].start,endIndex:h[h.length-1].end,score:u})}if(0===s.length)return[];s.sort(function(e,n){return n.score-e.score});for(var g=[],p=function(e){g.some(function(n){return e.startIndex<n.endIndex&&e.endIndex>n.startIndex})||g.push(e)},x=0,m=s;x<m.length;x++)p(m[x]);return g})(x,e,k).forEach(function(e){return V.push(e)})}),V.sort(function(e,n){return e.startIndex-n.startIndex});for(var D=[],E=0,H=V;E<H.length;E++){var M=H[E],R=D.at(-1);(!R||M.startIndex>=R.endIndex)&&D.push(M)}var W=D.map(function(e,n){return{text:x.substring(e.startIndex,e.endIndex),startIndex:e.startIndex,endIndex:e.endIndex,highlightIndex:n}}),A=W.length;a(function(){A>0&&(z(0),setTimeout(function(){var e;null===(e=G.current[0])||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50))},[A]);var B,j,F,K,P=function(e){S(function(n){var t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t})};return n("div",e({className:h.expandedContainer,style:{marginLeft:"1rem",display:"flex",flexDirection:"column",height:"100%",border:"none"}},{children:[n("div",e({className:h.expandedHeader,style:{backgroundColor:"white",border:"none"}},{children:[t("span",e({className:h.headerTitle,style:{backgroundColor:"white"}},{children:b})),t("div",e({className:h.headerActions},{children:A>=1&&n(i,{children:[n("span",e({style:{fontSize:"12px",color:"#888"}},{children:[N+1," / ",A]})),t("button",e({onClick:function(){if(0!==A){var e=N>0?N-1:A-1;z(e),setTimeout(function(){var n;null===(n=G.current[e])||void 0===n||n.scrollIntoView({behavior:"smooth",block:"center"})},50)}},disabled:N<=0,style:{padding:"2px 4px",cursor:N<=0?"not-allowed":"pointer",opacity:N<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:t(l,{size:14,color:"#64748b"})})),t("button",e({onClick:function(){if(0!==A){var e=N<A-1?N+1:0;z(e),setTimeout(function(){var n;null===(n=G.current[e])||void 0===n||n.scrollIntoView({behavior:"smooth",block:"center"})},50)}},disabled:N>=A-1,style:{padding:"2px 4px",cursor:N>=A-1?"not-allowed":"pointer",opacity:N>=A-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:t(s,{size:14,color:"#64748b"})}))]})}))]})),t("div",e({className:h.contentArea,style:{flex:1,maxHeight:"none",height:"auto",overflowY:"auto",border:"1px solid #eee",borderRadius:"4px",padding:"1rem"}},{children:t("div",e({className:h.contentInner},{children:(B=x.split("\n"),j=0,F=0,K=[],B.forEach(function(i){var r=j,o=j+i.length;j+=i.length+1;var a=/^(\s*)(-|\*|\d+\.)\s+/.exec(i),g=/^(Title|Description|Training-basis):\s*/i.exec(i);g&&(F=0),a&&(F+=1);var f=!!a,m=!!g,I=a?a[0].length:0,b=r+I,y=W.filter(function(e){return e.startIndex<o&&e.endIndex>b}),C="line-".concat(r),k=function(i,r,o){m?K.push(t("span",e({className:h.headerLine},{children:i}),r)):f?K.push(n("span",e({className:h.listItemLine,style:{paddingLeft:a[1]?"1rem":"0"}},{children:[o&&n("span",e({className:h.listCounter},{children:[F,"."]})),t("span",{children:i})]}),r)):K.push(t("span",e({className:h.blockLine},{children:i}),r))};if(0===y.length)k(p(i.substring(I)),C,!0);else{for(var T=b,z=[],_=!0,S=function(i){var r=Math.max(i.startIndex,b),a=Math.min(i.endIndex,o);if(r>=a)return"continue";if(r>T){var g=x.substring(T,r);z.push(t("span",{children:p(g)},"t-".concat(T)))}var f=i.highlightIndex===N,m=w?f?"".concat(h.highlight," ").concat(h.highlightActiveVariant):h.highlightVariant:f?"".concat(h.highlight," ").concat(h.highlightActive):h.highlight,I=L.has(i.highlightIndex);if(z.push(n("span",e({ref:function(e){G.current[i.highlightIndex]=e},className:m,role:"button",tabIndex:0,onClick:function(){return P(i.highlightIndex)},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||P(i.highlightIndex)},style:{display:"inline-flex",alignItems:"center",gap:"2px",cursor:"pointer"}},{children:[x.substring(r,a),t(I?l:s,{size:12,style:{flexShrink:0}})]}),"h-".concat(i.highlightIndex))),T=a,I&&v[i.highlightIndex]){var y=_?C:"".concat(C,"-chunk-").concat(r);k(z,y,_),_=!1,z=[],K.push(t("div",e({style:{marginTop:"0.5rem",marginBottom:"0.5rem"}},{children:t(u,{item:e(e({},v[i.highlightIndex]),{confidence_score:void 0}),headerTitle:"GPT - Gemini 3.1 Flash Lite",iconsConfig:{ChevronDownIcon:s,ChevronUpIcon:l,MaximizeIcon:d,CloseIcon:c},bodyHeight:"100%",disableMaximize:!0,index:i.highlightIndex})}),"expanded-".concat(i.highlightIndex)))}},V=0,D=y;V<D.length;V++)S(D[V]);if(T<o&&z.push(t("span",{children:p(x.substring(T,o))},"t-end-".concat(o))),z.length>0||_){var E=_?C:"".concat(C,"-tail");k(z,E,_)}}}),K)}))}))]}))};export{x as default};
2
2
  //# sourceMappingURL=TextualGuideLinesComponent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextualGudelinesTest.d.ts","sourceRoot":"","sources":["../../../../../src/features/TextualGuidelines/TextualGudelinesTest.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yEAAyE,CAAC;AAS9G,eAAO,MAAM,wBAAwB,EAAE,mBAAmB,EAiBzD,CAAC;AAOF,QAAA,MAAM,8BAA8B,+CAMnC,CAAC;AAEF,eAAe,8BAA8B,CAAC"}
1
+ {"version":3,"file":"TextualGudelinesTest.d.ts","sourceRoot":"","sources":["../../../../../src/features/TextualGuidelines/TextualGudelinesTest.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yEAAyE,CAAC;AAS9G,eAAO,MAAM,wBAAwB,EAAE,mBAAmB,EAiBzD,CAAC;AAMF,QAAA,MAAM,8BAA8B,+CAMnC,CAAC;AAEF,eAAe,8BAA8B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TextualGuideLinesComponent.d.ts","sourceRoot":"","sources":["../../../../../src/features/TextualGuidelines/TextualGuideLinesComponent.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yEAAyE,CAAC;AAG9G,UAAU,gCAAgC;IACxC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,wBAAwB,EAAE,mBAAmB,EAAE,CAAC;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAsFA,QAAA,MAAM,0BAA0B,gIAQ9B,gCAAgC,4CAqOlC,CAAC;AACF,eAAe,0BAA0B,CAAC"}
1
+ {"version":3,"file":"TextualGuideLinesComponent.d.ts","sourceRoot":"","sources":["../../../../../src/features/TextualGuidelines/TextualGuideLinesComponent.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yEAAyE,CAAC;AAG9G,UAAU,gCAAgC;IACxC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,wBAAwB,EAAE,mBAAmB,EAAE,CAAC;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAsFA,QAAA,MAAM,0BAA0B,gIAQ9B,gCAAgC,4CA+OlC,CAAC;AACF,eAAe,0BAA0B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-llm-studio/citation",
3
- "version": "0.0.192",
3
+ "version": "0.0.193",
4
4
  "author": "Devesh Patel",
5
5
  "description": "",
6
6
  "license": "MIT",