@e-llm-studio/citation 0.0.147 → 0.0.148

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"),i=require("react/jsx-runtime"),n=require("react"),t=require("lucide-react");exports.default=function(r){var o=r.images,s=r.highlights,a=r.highlightColor,l=void 0===a?"rgba(255, 220, 0, 0.15)":a,d=r.highlightActiveColor,c=void 0===d?"rgba(255, 220, 0, 0.35)":d,x=r.highlightBorderColor,u=void 0===x?"rgba(200, 160, 0, 0.4)":x,g=r.height,p=void 0===g?"700px":g,h=s.flatMap(function(e,i){return e.bboxes.map(function(n,t){return{bbox:n,pageIndex:e.pageIndex,key:"".concat(i,"-").concat(t)}})}).length,b=n.useState(0),f=b[0],_=b[1],y=n.useState(!1),v=y[0],m=y[1],j=n.useRef(null),k=n.useRef(null),w=n.useRef([]),C=n.useCallback(function(e,i){void 0===i&&(i=!1);var n=Math.max(0,Math.min(h-1,e));_(n);var t=i?k.current:j.current,r=w.current[n];if(t&&r){var o=t.getBoundingClientRect().top,s=r.getBoundingClientRect().top-o+t.scrollTop-t.clientHeight/2+r.clientHeight/2;t.scrollTo({top:s,behavior:"smooth"})}},[h]),z=function(n){return void 0===n&&(n=!1),h>0&&i.jsx("div",e.__assign({style:{display:"flex",alignItems:"center",marginBottom:"6px"}},{children:i.jsxs("div",e.__assign({style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"}},{children:[i.jsxs("span",e.__assign({style:{fontSize:"12px",color:"#888"}},{children:[f+1," / ",h]})),i.jsx("button",e.__assign({onClick:function(){return C(f-1,n)},disabled:f<=0,style:{padding:"2px 8px",fontSize:"12px",cursor:f<=0?"not-allowed":"pointer",opacity:f<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white"}},{children:"↑"})),i.jsx("button",e.__assign({onClick:function(){return C(f+1,n)},disabled:f>=h-1,style:{padding:"2px 8px",fontSize:"12px",cursor:f>=h-1?"not-allowed":"pointer",opacity:f>=h-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white"}},{children:"↓"})),i.jsx("span",{style:{width:"1px",height:"16px",background:"#e2e8f0",margin:"0 2px"}}),n?i.jsx(t.X,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return m(!1)}}):i.jsx(t.Maximize2,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return m(!0)}})]}))}))},I=function(){var n=-1;return o.map(function(t,r){var o=s.filter(function(e){return e.pageIndex===r}).flatMap(function(e,i){return e.bboxes.map(function(e,t){return n++,{bbox:e,key:"".concat(r,"-").concat(i,"-").concat(t),globalIndex:n}})});return i.jsxs("div",{children:[i.jsxs("div",e.__assign({style:{fontSize:"12px",color:"#888",marginBottom:"4px"}},{children:["Page ",r+1]})),i.jsx("div",e.__assign({style:{position:"relative",width:"100%",paddingTop:"129%",flexShrink:0}},{children:i.jsxs("div",e.__assign({style:{position:"absolute",inset:0}},{children:[i.jsx("img",{src:t,alt:"Page ".concat(r+1),style:{display:"block",width:"100%",height:"100%",objectFit:"fill"},draggable:!1}),o.map(function(e){var n=e.bbox,t=e.key,r=e.globalIndex,o=f===r;return i.jsx("div",{ref:function(e){w.current[r]=e},style:{position:"absolute",left:"".concat(100*n.xmin,"%"),top:"".concat(100*n.ymin,"%"),width:"".concat(100*(n.xmax-n.xmin),"%"),height:"".concat(100*(n.ymax-n.ymin),"%"),background:o?c:l,border:o?"1.5px solid ".concat(u):"none",borderRadius:"2px",zIndex:2}},t)})]}))}))]},r)})},R={overflowY:"auto",border:"1px solid #ddd",borderRadius:"4px",padding:"8px",display:"flex",flexDirection:"column",gap:"8px",boxSizing:"border-box"};return i.jsxs(i.Fragment,{children:[i.jsxs("div",e.__assign({style:{width:"100%",maxWidth:"600px",fontFamily:"inherit"}},{children:[z(!1),i.jsx("div",e.__assign({ref:j,style:e.__assign(e.__assign({},R),{height:p})},{children:I()}))]})),v&&i.jsx("div",e.__assign({style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center"}},{children:i.jsxs("div",e.__assign({style:{background:"white",borderRadius:"8px",padding:"16px",width:"90vw",maxWidth:"800px",height:"90vh",display:"flex",flexDirection:"column"}},{children:[z(!0),i.jsx("div",e.__assign({ref:k,style:e.__assign(e.__assign({},R),{flex:1})},{children:I()}))]}))}))]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),n=require("react"),t=require("lucide-react"),r=require("../ChatCitation/components/wrappers/Modal.js");exports.default=function(o){var s=o.images,a=o.highlights,l=o.highlightColor,d=void 0===l?"rgba(255, 220, 0, 0.15)":l,c=o.highlightActiveColor,u=void 0===c?"rgba(255, 220, 0, 0.35)":c,x=o.highlightBorderColor,p=void 0===x?"rgba(200, 160, 0, 0.4)":x,g=o.height,h=void 0===g?"700px":g,b=a.flatMap(function(e,i){return e.bboxes.map(function(n,t){return{bbox:n,pageIndex:e.pageIndex,key:"".concat(i,"-").concat(t)}})}).length,f=n.useState(0),_=f[0],m=f[1],y=n.useState(!1),v=y[0],j=y[1],k=n.useRef(null),C=n.useRef(null),w=n.useRef([]),z=n.useCallback(function(e,i){void 0===i&&(i=!1);var n=Math.max(0,Math.min(b-1,e));m(n);var t=i?C.current:k.current,r=w.current[n];if(t&&r){var o=t.getBoundingClientRect().top,s=r.getBoundingClientRect().top-o+t.scrollTop-t.clientHeight/2+r.clientHeight/2;t.scrollTo({top:s,behavior:"smooth"})}},[b]),R=function(n){return void 0===n&&(n=!1),b>0&&i.jsx("div",e.__assign({style:{display:"flex",alignItems:"center",marginBottom:"6px"}},{children:i.jsxs("div",e.__assign({style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"}},{children:[i.jsxs("span",e.__assign({style:{fontSize:"12px",color:"#888"}},{children:[_+1," / ",b]})),i.jsx("button",e.__assign({onClick:function(){return z(_-1,n)},disabled:_<=0,style:{padding:"2px 8px",fontSize:"12px",cursor:_<=0?"not-allowed":"pointer",opacity:_<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white"}},{children:"↑"})),i.jsx("button",e.__assign({onClick:function(){return z(_+1,n)},disabled:_>=b-1,style:{padding:"2px 8px",fontSize:"12px",cursor:_>=b-1?"not-allowed":"pointer",opacity:_>=b-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white"}},{children:"↓"})),i.jsx("span",{style:{width:"1px",height:"16px",background:"#e2e8f0",margin:"0 2px"}}),n?i.jsx(t.X,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return j(!1)}}):i.jsx(t.Maximize2,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return j(!0)}})]}))}))},I=function(){var n=-1;return s.map(function(t,r){var o=a.filter(function(e){return e.pageIndex===r}).flatMap(function(e,i){return e.bboxes.map(function(e,t){return n++,{bbox:e,key:"".concat(r,"-").concat(i,"-").concat(t),globalIndex:n}})});return i.jsxs("div",{children:[i.jsxs("div",e.__assign({style:{fontSize:"12px",color:"#888",marginBottom:"4px"}},{children:["Page ",r+1]})),i.jsx("div",e.__assign({style:{position:"relative",width:"100%",paddingTop:"129%",flexShrink:0}},{children:i.jsxs("div",e.__assign({style:{position:"absolute",inset:0}},{children:[i.jsx("img",{src:t,alt:"Page ".concat(r+1),style:{display:"block",width:"100%",height:"100%",objectFit:"fill"},draggable:!1}),o.map(function(e){var n=e.bbox,t=e.key,r=e.globalIndex,o=_===r;return i.jsx("div",{ref:function(e){w.current[r]=e},style:{position:"absolute",left:"".concat(100*n.xmin,"%"),top:"".concat(100*n.ymin,"%"),width:"".concat(100*(n.xmax-n.xmin),"%"),height:"".concat(100*(n.ymax-n.ymin),"%"),background:o?u:d,border:o?"1.5px solid ".concat(p):"none",borderRadius:"2px",zIndex:2}},t)})]}))}))]},r)})},M={overflowY:"auto",border:"1px solid #ddd",borderRadius:"4px",padding:"8px",display:"flex",flexDirection:"column",gap:"8px",boxSizing:"border-box"};return i.jsxs(i.Fragment,{children:[i.jsxs("div",e.__assign({style:{width:"100%",maxWidth:"600px",fontFamily:"inherit"}},{children:[R(!1),i.jsx("div",e.__assign({ref:k,style:e.__assign(e.__assign({},M),{height:h})},{children:I()}))]})),i.jsxs(r.Modal,e.__assign({isOpen:v,onClose:function(){return j(!1)}},{children:[R(!0),i.jsx("div",e.__assign({ref:C,style:e.__assign(e.__assign({},M),{flex:1})},{children:I()}))]}))]})};
2
2
  //# sourceMappingURL=ScannedDocCitation.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as i}from"tslib";import{jsxs as e,Fragment as t,jsx as n}from"react/jsx-runtime";import{useState as o,useRef as r,useCallback as l}from"react";import{X as d,Maximize2 as a}from"lucide-react";function c(c){var p=c.images,s=c.highlights,u=c.highlightColor,x=void 0===u?"rgba(255, 220, 0, 0.15)":u,h=c.highlightActiveColor,g=void 0===h?"rgba(255, 220, 0, 0.35)":h,f=c.highlightBorderColor,b=void 0===f?"rgba(200, 160, 0, 0.4)":f,m=c.height,y=void 0===m?"700px":m,v=s.flatMap(function(i,e){return i.bboxes.map(function(t,n){return{bbox:t,pageIndex:i.pageIndex,key:"".concat(e,"-").concat(n)}})}).length,k=o(0),w=k[0],C=k[1],I=o(!1),z=I[0],R=I[1],S=r(null),B=r(null),M=r([]),j=l(function(i,e){void 0===e&&(e=!1);var t=Math.max(0,Math.min(v-1,i));C(t);var n=e?B.current:S.current,o=M.current[t];if(n&&o){var r=n.getBoundingClientRect().top,l=o.getBoundingClientRect().top-r+n.scrollTop-n.clientHeight/2+o.clientHeight/2;n.scrollTo({top:l,behavior:"smooth"})}},[v]),T=function(t){return void 0===t&&(t=!1),v>0&&n("div",i({style:{display:"flex",alignItems:"center",marginBottom:"6px"}},{children:e("div",i({style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"}},{children:[e("span",i({style:{fontSize:"12px",color:"#888"}},{children:[w+1," / ",v]})),n("button",i({onClick:function(){return j(w-1,t)},disabled:w<=0,style:{padding:"2px 8px",fontSize:"12px",cursor:w<=0?"not-allowed":"pointer",opacity:w<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white"}},{children:"↑"})),n("button",i({onClick:function(){return j(w+1,t)},disabled:w>=v-1,style:{padding:"2px 8px",fontSize:"12px",cursor:w>=v-1?"not-allowed":"pointer",opacity:w>=v-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white"}},{children:"↓"})),n("span",{style:{width:"1px",height:"16px",background:"#e2e8f0",margin:"0 2px"}}),t?n(d,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return R(!1)}}):n(a,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return R(!0)}})]}))}))},D=function(){var t=-1;return p.map(function(o,r){var l=s.filter(function(i){return i.pageIndex===r}).flatMap(function(i,e){return i.bboxes.map(function(i,n){return t++,{bbox:i,key:"".concat(r,"-").concat(e,"-").concat(n),globalIndex:t}})});return e("div",{children:[e("div",i({style:{fontSize:"12px",color:"#888",marginBottom:"4px"}},{children:["Page ",r+1]})),n("div",i({style:{position:"relative",width:"100%",paddingTop:"129%",flexShrink:0}},{children:e("div",i({style:{position:"absolute",inset:0}},{children:[n("img",{src:o,alt:"Page ".concat(r+1),style:{display:"block",width:"100%",height:"100%",objectFit:"fill"},draggable:!1}),l.map(function(i){var e=i.bbox,t=i.key,o=i.globalIndex,r=w===o;return n("div",{ref:function(i){M.current[o]=i},style:{position:"absolute",left:"".concat(100*e.xmin,"%"),top:"".concat(100*e.ymin,"%"),width:"".concat(100*(e.xmax-e.xmin),"%"),height:"".concat(100*(e.ymax-e.ymin),"%"),background:r?g:x,border:r?"1.5px solid ".concat(b):"none",borderRadius:"2px",zIndex:2}},t)})]}))}))]},r)})},F={overflowY:"auto",border:"1px solid #ddd",borderRadius:"4px",padding:"8px",display:"flex",flexDirection:"column",gap:"8px",boxSizing:"border-box"};return e(t,{children:[e("div",i({style:{width:"100%",maxWidth:"600px",fontFamily:"inherit"}},{children:[T(!1),n("div",i({ref:S,style:i(i({},F),{height:y})},{children:D()}))]})),z&&n("div",i({style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center"}},{children:e("div",i({style:{background:"white",borderRadius:"8px",padding:"16px",width:"90vw",maxWidth:"800px",height:"90vh",display:"flex",flexDirection:"column"}},{children:[T(!0),n("div",i({ref:B,style:i(i({},F),{flex:1})},{children:D()}))]}))}))]})}export{c as default};
1
+ import{__assign as t}from"tslib";import{jsxs as i,Fragment as e,jsx as n}from"react/jsx-runtime";import{useState as o,useRef as r,useCallback as l}from"react";import{X as d,Maximize2 as a}from"lucide-react";import{Modal as c}from"../ChatCitation/components/wrappers/Modal.js";function p(p){var s=p.images,u=p.highlights,h=p.highlightColor,x=void 0===h?"rgba(255, 220, 0, 0.15)":h,g=p.highlightActiveColor,f=void 0===g?"rgba(255, 220, 0, 0.35)":g,b=p.highlightBorderColor,m=void 0===b?"rgba(200, 160, 0, 0.4)":b,y=p.height,v=void 0===y?"700px":y,k=u.flatMap(function(t,i){return t.bboxes.map(function(e,n){return{bbox:e,pageIndex:t.pageIndex,key:"".concat(i,"-").concat(n)}})}).length,C=o(0),w=C[0],z=C[1],I=o(!1),R=I[0],S=I[1],B=r(null),M=r(null),j=r([]),T=l(function(t,i){void 0===i&&(i=!1);var e=Math.max(0,Math.min(k-1,t));z(e);var n=i?M.current:B.current,o=j.current[e];if(n&&o){var r=n.getBoundingClientRect().top,l=o.getBoundingClientRect().top-r+n.scrollTop-n.clientHeight/2+o.clientHeight/2;n.scrollTo({top:l,behavior:"smooth"})}},[k]),F=function(e){return void 0===e&&(e=!1),k>0&&n("div",t({style:{display:"flex",alignItems:"center",marginBottom:"6px"}},{children:i("div",t({style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"}},{children:[i("span",t({style:{fontSize:"12px",color:"#888"}},{children:[w+1," / ",k]})),n("button",t({onClick:function(){return T(w-1,e)},disabled:w<=0,style:{padding:"2px 8px",fontSize:"12px",cursor:w<=0?"not-allowed":"pointer",opacity:w<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white"}},{children:"↑"})),n("button",t({onClick:function(){return T(w+1,e)},disabled:w>=k-1,style:{padding:"2px 8px",fontSize:"12px",cursor:w>=k-1?"not-allowed":"pointer",opacity:w>=k-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white"}},{children:"↓"})),n("span",{style:{width:"1px",height:"16px",background:"#e2e8f0",margin:"0 2px"}}),e?n(d,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return S(!1)}}):n(a,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return S(!0)}})]}))}))},H=function(){var e=-1;return s.map(function(o,r){var l=u.filter(function(t){return t.pageIndex===r}).flatMap(function(t,i){return t.bboxes.map(function(t,n){return e++,{bbox:t,key:"".concat(r,"-").concat(i,"-").concat(n),globalIndex:e}})});return i("div",{children:[i("div",t({style:{fontSize:"12px",color:"#888",marginBottom:"4px"}},{children:["Page ",r+1]})),n("div",t({style:{position:"relative",width:"100%",paddingTop:"129%",flexShrink:0}},{children:i("div",t({style:{position:"absolute",inset:0}},{children:[n("img",{src:o,alt:"Page ".concat(r+1),style:{display:"block",width:"100%",height:"100%",objectFit:"fill"},draggable:!1}),l.map(function(t){var i=t.bbox,e=t.key,o=t.globalIndex,r=w===o;return n("div",{ref:function(t){j.current[o]=t},style:{position:"absolute",left:"".concat(100*i.xmin,"%"),top:"".concat(100*i.ymin,"%"),width:"".concat(100*(i.xmax-i.xmin),"%"),height:"".concat(100*(i.ymax-i.ymin),"%"),background:r?f:x,border:r?"1.5px solid ".concat(m):"none",borderRadius:"2px",zIndex:2}},e)})]}))}))]},r)})},P={overflowY:"auto",border:"1px solid #ddd",borderRadius:"4px",padding:"8px",display:"flex",flexDirection:"column",gap:"8px",boxSizing:"border-box"};return i(e,{children:[i("div",t({style:{width:"100%",maxWidth:"600px",fontFamily:"inherit"}},{children:[F(!1),n("div",t({ref:B,style:t(t({},P),{height:v})},{children:H()}))]})),i(c,t({isOpen:R,onClose:function(){return S(!1)}},{children:[F(!0),n("div",t({ref:M,style:t(t({},P),{flex:1})},{children:H()}))]}))]})}export{p as default};
2
2
  //# sourceMappingURL=ScannedDocCitation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ScannedDocCitation.d.ts","sourceRoot":"","sources":["../../../../../src/features/ScannedDocCitation/ScannedDocCitation.tsx"],"names":[],"mappings":"AAGA,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,IAAI,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,MAAM,EACN,UAAU,EACV,cAA0C,EAC1C,oBAAgD,EAChD,oBAA+C,EAC/C,MAAgB,GACjB,EAAE,uBAAuB,2CA2IzB"}
1
+ {"version":3,"file":"ScannedDocCitation.d.ts","sourceRoot":"","sources":["../../../../../src/features/ScannedDocCitation/ScannedDocCitation.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,IAAI,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,MAAM,EACN,UAAU,EACV,cAA0C,EAC1C,oBAAgD,EAChD,oBAA+C,EAC/C,MAAgB,GACjB,EAAE,uBAAuB,2CA0IzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-llm-studio/citation",
3
- "version": "0.0.147",
3
+ "version": "0.0.148",
4
4
  "author": "Devesh Patel",
5
5
  "description": "",
6
6
  "license": "MIT",