@e-llm-studio/citation 0.0.150 → 0.0.151
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"),o=require("../ChatCitation/components/wrappers/Modal.js");exports.default=function(r){var s=r.images,a=r.highlights,l=r.highlightColor,d=void 0===l?"rgba(255, 220, 0, 0.15)":l,c=r.highlightActiveColor,
|
|
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"),o=require("../ChatCitation/components/wrappers/Modal.js");exports.default=function(r){var s=r.images,a=r.highlights,l=r.highlightColor,d=void 0===l?"rgba(255, 220, 0, 0.15)":l,c=r.highlightActiveColor,u=void 0===c?"rgba(255, 220, 0, 0.35)":c,x=r.highlightBorderColor,g=void 0===x?"rgba(200, 160, 0, 0.4)":x,p=r.height,h=void 0===p?"700px":p,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],v=n.useState(!1),y=v[0],j=v[1],C=n.useState({}),k=C[0],w=C[1],I=n.useRef(null),R=n.useRef(null),z=n.useRef([]),M=n.useRef([]),B=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?R.current:I.current,t=(i?M:z).current[n];if(e&&t){var o=e.getBoundingClientRect(),r=t.getBoundingClientRect(),s=r.top-o.top+e.scrollTop-e.clientHeight/2+r.height/2;e.scrollTo({top:s,behavior:"smooth"})}})},[f]),S=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 B(_-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 B(_+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)}})]}))}))},q=function(n){void 0===n&&(n=!1);var t=n?M:z,o=-1;return s.map(function(n,r){var s=a.filter(function(e){return e.pageIndex===r}).flatMap(function(e,i){return e.bboxes.map(function(e,n){return o++,{bbox:e,key:"".concat(r,"-").concat(i,"-").concat(n),globalIndex:o}})});return i.jsxs("div",e.__assign({style:{marginBottom:"8px"}},{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:n,alt:"Page ".concat(r+1),style:{display:"block",width:"100%",height:"100%",objectFit:"fill"},draggable:!1,ref:function(i){i&&i.complete&&!k[r]&&w(function(i){var n;return e.__assign(e.__assign({},i),((n={})[r]=!0,n))})},onLoad:function(){return w(function(i){var n;return e.__assign(e.__assign({},i),((n={})[r]=!0,n))})}}),k[r]&&s.map(function(e){var n=e.bbox,o=e.key,r=e.globalIndex,s=_===r;return i.jsx("div",{ref:function(e){t.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:s?u:d,border:s?"1.5px solid ".concat(g):"none",borderRadius:"2px",zIndex:2}},o)})]}))}))]}),r)})},D={overflowY:"auto",border:"1px solid #ddd",borderRadius:"4px",padding:"8px",paddingBottom:0,display:"flex",flexDirection:"column",boxSizing:"border-box"};return i.jsxs(i.Fragment,{children:[i.jsxs("div",e.__assign({style:{width:"100%",maxWidth:"800px",fontFamily:"inherit",display:"flex",flexDirection:"column"}},{children:[S(!1),i.jsx("div",e.__assign({ref:I,style:e.__assign(e.__assign({},D),{maxHeight:h})},{children:q(!1)}))]})),i.jsx(o.Modal,e.__assign({isOpen:y,onClose:function(){return j(!1)}},{children:i.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"}},{children:[S(!0),i.jsx("div",e.__assign({ref:R,style:e.__assign(e.__assign({},D),{flex:1})},{children:y&&q(!0)}))]}))}))]})};
|
|
2
2
|
//# sourceMappingURL=ScannedDocCitation.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as
|
|
1
|
+
import{__assign as e}from"tslib";import{jsxs as t,Fragment as i,jsx as n}from"react/jsx-runtime";import{useState as o,useRef as r,useCallback as l}from"react";import{ChevronUp as d,ChevronDown as c,X as a,Maximize2 as p}from"lucide-react";import{Modal as s}from"../ChatCitation/components/wrappers/Modal.js";function u(u){var x=u.images,h=u.highlights,f=u.highlightColor,g=void 0===f?"rgba(255, 220, 0, 0.15)":f,m=u.highlightActiveColor,b=void 0===m?"rgba(255, 220, 0, 0.35)":m,y=u.highlightBorderColor,v=void 0===y?"rgba(200, 160, 0, 0.4)":y,k=u.height,w=void 0===k?"700px":k,C=h.flatMap(function(e,t){return e.bboxes.map(function(i,n){return{bbox:i,pageIndex:e.pageIndex,key:"".concat(t,"-").concat(n)}})}).length,I=o(0),z=I[0],B=I[1],R=o(!1),M=R[0],S=R[1],j=o({}),D=j[0],F=j[1],T=r(null),A=r(null),H=r([]),L=r([]),P=l(function(e,t){void 0===t&&(t=!1);var i=Math.max(0,Math.min(C-1,e));B(i),requestAnimationFrame(function(){var e=t?A.current:T.current,n=(t?L:H).current[i];if(e&&n){var o=e.getBoundingClientRect(),r=n.getBoundingClientRect(),l=r.top-o.top+e.scrollTop-e.clientHeight/2+r.height/2;e.scrollTo({top:l,behavior:"smooth"})}})},[C]),q=function(i){return void 0===i&&(i=!1),C>0&&n("div",e({style:{display:"flex",alignItems:"center",marginBottom:"6px"}},{children:t("div",e({style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"}},{children:[t("span",e({style:{fontSize:"12px",color:"#888"}},{children:[z+1," / ",C]})),n("button",e({onClick:function(){return P(z-1,i)},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",e({onClick:function(){return P(z+1,i)},disabled:z>=C-1,style:{padding:"2px 4px",cursor:z>=C-1?"not-allowed":"pointer",opacity:z>=C-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:n(c,{size:14,color:"#64748b"})})),n("span",{style:{width:"1px",height:"16px",background:"#e2e8f0",margin:"0 2px"}}),i?n(a,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return S(!1)}}):n(p,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return S(!0)}})]}))}))},O=function(i){void 0===i&&(i=!1);var o=i?L:H,r=-1;return x.map(function(i,l){var d=h.filter(function(e){return e.pageIndex===l}).flatMap(function(e,t){return e.bboxes.map(function(e,i){return r++,{bbox:e,key:"".concat(l,"-").concat(t,"-").concat(i),globalIndex:r}})});return t("div",e({style:{marginBottom:"8px"}},{children:[t("div",e({style:{fontSize:"12px",color:"#888",marginBottom:"4px"}},{children:["Page ",l+1]})),n("div",e({style:{position:"relative",width:"100%",paddingTop:"129%",flexShrink:0}},{children:t("div",e({style:{position:"absolute",inset:0}},{children:[n("img",{src:i,alt:"Page ".concat(l+1),style:{display:"block",width:"100%",height:"100%",objectFit:"fill"},draggable:!1,ref:function(t){t&&t.complete&&!D[l]&&F(function(t){var i;return e(e({},t),((i={})[l]=!0,i))})},onLoad:function(){return F(function(t){var i;return e(e({},t),((i={})[l]=!0,i))})}}),D[l]&&d.map(function(e){var t=e.bbox,i=e.key,r=e.globalIndex,l=z===r;return n("div",{ref:function(e){o.current[r]=e},style:{position:"absolute",left:"".concat(100*t.xmin,"%"),top:"".concat(100*t.ymin,"%"),width:"".concat(100*(t.xmax-t.xmin),"%"),height:"".concat(100*(t.ymax-t.ymin),"%"),background:l?b:g,border:l?"1.5px solid ".concat(v):"none",borderRadius:"2px",zIndex:2}},i)})]}))}))]}),l)})},W={overflowY:"auto",border:"1px solid #ddd",borderRadius:"4px",padding:"8px",paddingBottom:0,display:"flex",flexDirection:"column",boxSizing:"border-box"};return t(i,{children:[t("div",e({style:{width:"100%",maxWidth:"800px",fontFamily:"inherit",display:"flex",flexDirection:"column"}},{children:[q(!1),n("div",e({ref:T,style:e(e({},W),{maxHeight:w})},{children:O(!1)}))]})),n(s,e({isOpen:M,onClose:function(){return S(!1)}},{children:t("div",e({style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"}},{children:[q(!0),n("div",e({ref:A,style:e(e({},W),{flex:1})},{children:M&&O(!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":"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,
|
|
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,2CAyJzB"}
|