@e-llm-studio/citation 0.0.147 → 0.0.149

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,x=void 0===c?"rgba(255, 220, 0, 0.35)":c,u=o.highlightBorderColor,p=void 0===u?"rgba(200, 160, 0, 0.4)":u,g=o.height,h=void 0===g?"700px":g,f=a.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),_=b[0],m=b[1],y=n.useState(!1),v=y[0],j=y[1],k=n.useRef(null),w=n.useRef(null),C=n.useRef([]),I=n.useRef([]),z=n.useCallback(function(e,i){void 0===i&&(i=!1);var n=Math.max(0,Math.min(f-1,e));m(n),requestAnimationFrame(function(){var e=(i?I:C).current[n];e&&e.scrollIntoView({behavior:"smooth",block:"center"})})},[f]),M=function(n){return void 0===n&&(n=!1),f>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," / ",f]})),i.jsx("button",e.__assign({onClick:function(){return z(_-1,n)},disabled:_<=0,style:{padding:"2px 4px",cursor:_<=0?"not-allowed":"pointer",opacity:_<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:i.jsx(t.ChevronUp,{size:14,color:"#64748b"})})),i.jsx("button",e.__assign({onClick:function(){return z(_+1,n)},disabled:_>=f-1,style:{padding:"2px 4px",cursor:_>=f-1?"not-allowed":"pointer",opacity:_>=f-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:i.jsx(t.ChevronDown,{size:14,color:"#64748b"})})),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)}})]}))}))},R=function(n){void 0===n&&(n=!1);var t=n?I:C,r=-1;return s.map(function(n,o){var s=a.filter(function(e){return e.pageIndex===o}).flatMap(function(e,i){return e.bboxes.map(function(e,n){return r++,{bbox:e,key:"".concat(o,"-").concat(i,"-").concat(n),globalIndex:r}})});return i.jsxs("div",{children:[i.jsxs("div",e.__assign({style:{fontSize:"12px",color:"#888",marginBottom:"4px"}},{children:["Page ",o+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:n,alt:"Page ".concat(o+1),style:{display:"block",width:"100%",height:"100%",objectFit:"fill"},draggable:!1}),s.map(function(e){var n=e.bbox,r=e.key,o=e.globalIndex,s=_===o;return i.jsx("div",{ref:function(e){t.current[o]=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:s?x:d,border:s?"1.5px solid ".concat(p):"none",borderRadius:"2px",zIndex:2}},r)})]}))}))]},o)})},q={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:[M(!1),i.jsx("div",e.__assign({ref:k,style:e.__assign(e.__assign({},q),{height:h})},{children:R(!1)}))]})),i.jsx(r.Modal,e.__assign({isOpen:v,onClose:function(){return j(!1)}},{children:i.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"}},{children:[M(!0),i.jsx("div",e.__assign({ref:w,style:e.__assign(e.__assign({},q),{flex:1})},{children:v&&R(!0)}))]}))}))]})};
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 i}from"tslib";import{jsxs as e,Fragment as o,jsx as n}from"react/jsx-runtime";import{useState as t,useRef as r,useCallback as l}from"react";import{ChevronUp as d,ChevronDown as a,X as c,Maximize2 as s}from"lucide-react";import{Modal as p}from"../ChatCitation/components/wrappers/Modal.js";function u(u){var h=u.images,x=u.highlights,f=u.highlightColor,g=void 0===f?"rgba(255, 220, 0, 0.15)":f,b=u.highlightActiveColor,m=void 0===b?"rgba(255, 220, 0, 0.35)":b,y=u.highlightBorderColor,v=void 0===y?"rgba(200, 160, 0, 0.4)":y,k=u.height,w=void 0===k?"700px":k,I=x.flatMap(function(i,e){return i.bboxes.map(function(o,n){return{bbox:o,pageIndex:i.pageIndex,key:"".concat(e,"-").concat(n)}})}).length,C=t(0),z=C[0],M=C[1],R=t(!1),S=R[0],j=R[1],B=r(null),F=r(null),A=r([]),D=r([]),P=l(function(i,e){void 0===e&&(e=!1);var o=Math.max(0,Math.min(I-1,i));M(o),requestAnimationFrame(function(){var i=(e?D:A).current[o];i&&i.scrollIntoView({behavior:"smooth",block:"center"})})},[I]),q=function(o){return void 0===o&&(o=!1),I>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:[z+1," / ",I]})),n("button",i({onClick:function(){return P(z-1,o)},disabled:z<=0,style:{padding:"2px 4px",cursor:z<=0?"not-allowed":"pointer",opacity:z<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:n(d,{size:14,color:"#64748b"})})),n("button",i({onClick:function(){return P(z+1,o)},disabled:z>=I-1,style:{padding:"2px 4px",cursor:z>=I-1?"not-allowed":"pointer",opacity:z>=I-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:n(a,{size:14,color:"#64748b"})})),n("span",{style:{width:"1px",height:"16px",background:"#e2e8f0",margin:"0 2px"}}),o?n(c,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return j(!1)}}):n(s,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return j(!0)}})]}))}))},L=function(o){void 0===o&&(o=!1);var t=o?D:A,r=-1;return h.map(function(o,l){var d=x.filter(function(i){return i.pageIndex===l}).flatMap(function(i,e){return i.bboxes.map(function(i,o){return r++,{bbox:i,key:"".concat(l,"-").concat(e,"-").concat(o),globalIndex:r}})});return e("div",{children:[e("div",i({style:{fontSize:"12px",color:"#888",marginBottom:"4px"}},{children:["Page ",l+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(l+1),style:{display:"block",width:"100%",height:"100%",objectFit:"fill"},draggable:!1}),d.map(function(i){var e=i.bbox,o=i.key,r=i.globalIndex,l=z===r;return n("div",{ref:function(i){t.current[r]=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:l?m:g,border:l?"1.5px solid ".concat(v):"none",borderRadius:"2px",zIndex:2}},o)})]}))}))]},l)})},O={overflowY:"auto",border:"1px solid #ddd",borderRadius:"4px",padding:"8px",display:"flex",flexDirection:"column",gap:"8px",boxSizing:"border-box"};return e(o,{children:[e("div",i({style:{width:"100%",maxWidth:"600px",fontFamily:"inherit"}},{children:[q(!1),n("div",i({ref:B,style:i(i({},O),{height:w})},{children:L(!1)}))]})),n(p,i({isOpen:S,onClose:function(){return j(!1)}},{children:e("div",i({style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"}},{children:[q(!0),n("div",i({ref:F,style:i(i({},O),{flex:1})},{children:S&&L(!0)}))]}))}))]})}export{u 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,2CA6IzB"}
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.149",
4
4
  "author": "Devesh Patel",
5
5
  "description": "",
6
6
  "license": "MIT",