pdf-tsx 0.17.8 → 0.17.9

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 +1 @@
1
- const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../context/PDFViewerContext.cjs`),n=require(`../hooks/useScrollTracking.cjs`),r=require(`../hooks/useKeyboardShortcuts.cjs`),i=require(`../hooks/useTextLayer.cjs`),a=require(`../utils/url.cjs`),ee=require(`../hooks/useAnnotationLayer.cjs`),te=require(`../hooks/usePDFLoader.cjs`),o=require(`../hooks/usePDFRenderer.cjs`),ne=require(`../hooks/useOverlayRects.cjs`),re=require(`../hooks/usePinchZoom.cjs`),s=require(`../utils/pdfFit.cjs`),ie=require(`../context/ThemeContext.cjs`),ae=require(`../context/LabelsContext.cjs`),c=require(`../hooks/useLabels.cjs`),l=require(`./PDFViewer.module.cjs`);let u=require(`react`);u=e.__toESM(u,1);let d=require(`pdfjs-dist`);d=e.__toESM(d,1);let f=require(`react/jsx-runtime`);var oe=`"getOrInsertComputed" in Map.prototype || (Map.prototype.getOrInsertComputed = function(k,f){if(!this.has(k))this.set(k,f(k));return this.get(k);});`,p=2;function se({hasRead:e}){let t=c.useLabels();return(0,f.jsxs)(`div`,{className:`${l.default.requireReadBanner} ${e?l.default.requireReadDone:``}`,children:[e?(0,f.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,f.jsx)(`path`,{d:`M3 8l3.5 3.5L13 4.5`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})}):(0,f.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,f.jsx)(`path`,{d:`M8 3v10M4 9l4 4 4-4`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,f.jsx)(`span`,{children:e?t.requireReadDone:t.requireReadPending})]})}var m=({file:e,workerSrc:c,sidebar:m,toolbar:h,onChangeFile:g,themeOverrides:ce,defaultTheme:le,defaultFit:_,language:ue,className:v,style:de,requireRead:y,onDocumentRead:b})=>{`getOrInsertComputed`in Map.prototype||(Map.prototype.getOrInsertComputed=function(e,t){let n=this;return n.has(e)||n.set(e,t(e)),n.get(e)}),(0,u.useEffect)(()=>{let e=new URL(c,location.href).href,t=new Blob([`${oe}\nimport(${JSON.stringify(e)});`],{type:`application/javascript`}),n=URL.createObjectURL(t);return d.GlobalWorkerOptions.workerSrc=n,()=>URL.revokeObjectURL(n)},[c]);let[x,S]=(0,u.useState)(1),[C,w]=(0,u.useState)(0),[T,E]=(0,u.useState)(null),[D,fe]=(0,u.useState)([]),[O,pe]=(0,u.useState)(!1),[k,A]=(0,u.useState)(_??null),[j,M]=(0,u.useState)(null),[N,P]=(0,u.useState)(!1),F=(0,u.useRef)(!1),I=(0,u.useRef)(null),L=(0,u.useRef)([]),R=(0,u.useRef)([]),z=(0,u.useRef)(C);(0,u.useEffect)(()=>{z.current=C},[C]);let[B,me]=(0,u.useState)(null);B!==e&&(me(e),E(null),P(!1)),(0,u.useEffect)(()=>{F.current=!1},[e]);let{pdf:V,numPages:H,loading:he}=te.usePDFLoader(e);(0,u.useEffect)(()=>{V&&(L.current=Array(V.numPages).fill(null),R.current=Array(V.numPages).fill(null))},[V]),(0,u.useEffect)(()=>{!V||!_||!I.current||s.computeFit(_,V,I.current,z.current).then(S)},[V,_]);let U=(0,u.useRef)(k);(0,u.useEffect)(()=>{U.current=k},[k]),(0,u.useEffect)(()=>{if(!V||!I.current)return;let e=I.current,t=new ResizeObserver(()=>{U.current&&s.computeFit(U.current,V,e,z.current).then(S)});return t.observe(e),()=>t.disconnect()},[V]);let{currentPage:W,goToPage:G}=n.useScrollTracking({numPages:H,containerRef:I,pageRefs:L});(0,u.useEffect)(()=>{H===0||W<H||(y&&!N&&P(!0),F.current||(F.current=!0,b?.()))},[W,H,y,N,b]);let K=(0,u.useMemo)(()=>{if(H===0)return[];let e=new Set,t=Math.max(W-p,1),n=Math.min(W+p,H);for(let r=t;r<=n;r++)e.add(r);T&&e.add(T.page);for(let t of D)e.add(t.page);return Array.from(e).sort((e,t)=>e-t)},[W,H,T,D]),{pageSizes:ge,renderedPages:q}=o.usePDFRenderer({pdf:V,zoom:x,rotation:C,visiblePages:K,canvasRefs:R}),J=(0,u.useMemo)(()=>{let e=new Set(K);for(let t of q)e.add(t);return Array.from(e).sort((e,t)=>e-t)},[K,q]);r.useKeyboardShortcuts({pdf:V,currentPage:W,goToPage:G,setRotation:w}),re.usePinchZoom(I,x,S,A);let _e=i.useTextLayer({pdf:V,zoom:x,rotation:C,mountedPages:J,canvasRefs:R}),{linkOverlays:ve,noteOverlays:ye}=ee.useAnnotationLayer({pdf:V,zoom:x,rotation:C,mountedPages:J,goToPage:G});(0,u.useEffect)(()=>{if(!j)return;let e=()=>M(null),t=e=>{e.key===`Escape`&&M(null)};return document.addEventListener(`click`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`click`,e),document.removeEventListener(`keydown`,t)}},[j]);let{overlayRect:Y,searchOverlays:be}=ne.useOverlayRects({pdf:V,highlight:T,searchMatches:D,zoom:x,rotation:C}),xe=(0,u.useCallback)((e,t)=>{(!e.url||!a.isSafeUrl(e.url))&&(t.preventDefault(),e.url||e._handleClick())},[]),X=(0,u.useRef)(null),Z=(0,u.useCallback)((e,t)=>{X.current&&clearTimeout(X.current);let n=t.clientY>window.innerHeight*.6;M({x:Math.min(t.clientX,window.innerWidth-304),y:n?window.innerHeight-t.clientY+8:t.clientY+12,above:n,contents:e.contents,title:e.title})},[]),Q=(0,u.useCallback)(()=>{X.current=setTimeout(()=>M(null),200)},[]),$=(0,u.useCallback)(e=>{E({page:e.page,pdfRect:e.pdfRect}),G(e.page)},[E,G]),Se=(0,u.useMemo)(()=>({pdf:V,numPages:H,zoom:x,setZoom:S,rotation:C,setRotation:w,currentPage:W,goToPage:G,containerRef:I,canvasRefs:R,file:e,highlight:T,setHighlight:E,searchMatches:D,setSearchMatches:fe,onChangeFile:g,sidebarCollapsed:O,setSidebarCollapsed:pe,fitMode:k,setFitMode:A,navigationLocked:!!y&&!N}),[V,H,x,C,W,G,e,T,D,g,O,k,y,N]);return(0,f.jsx)(ie.ThemeProvider,{themeOverrides:ce,defaultTheme:le,children:(0,f.jsx)(ae.LabelsProvider,{language:ue,children:(0,f.jsxs)(t.PDFViewerContext.Provider,{value:Se,children:[(0,f.jsxs)(`div`,{className:`${l.default.appLayout}${v?` ${v}`:``}`,style:de,children:[h&&(0,f.jsx)(`div`,{className:l.default.toolbar,children:h}),(0,f.jsxs)(`div`,{className:l.default.body,children:[m,(0,f.jsxs)(`div`,{className:l.default.scrollContainer,ref:I,children:[he&&(0,f.jsx)(`div`,{className:l.default.documentLoading}),Array.from({length:H},(e,t)=>{let n=q.has(t+1),r=ge[t],i=J.includes(t+1);return(0,f.jsxs)(`div`,{className:l.default.pageWrapper,ref:e=>{L.current[t]=e},style:r?{width:r.width,height:r.height}:void 0,children:[r&&!n&&(0,f.jsx)(`div`,{className:l.default.pageSkeleton,style:{width:r.width,height:r.height}}),i&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`canvas`,{className:l.default.pageCanvas,ref:e=>{R.current[t]=e},style:{display:n?`block`:`none`}}),(0,f.jsx)(`div`,{className:`textLayer ${l.default.textLayer}`,ref:e=>{_e.current[t]=e}})]}),ve.filter(e=>e.page===t+1).map((e,t)=>(0,f.jsx)(`a`,{className:l.default.linkOverlay,href:e.url&&a.isSafeUrl(e.url)?e.url:`#`,target:`_blank`,rel:`noopener noreferrer`,style:{left:e.x,top:e.y,width:e.width,height:e.height},onClick:t=>xe(e,t)},t)),ye.filter(e=>e.page===t+1).map((e,t)=>e.subtype===`Text`?(0,f.jsx)(`div`,{className:l.default.noteIconOverlay,style:{left:e.x,top:e.y,width:Math.max(e.width,26),height:Math.max(e.height,26)},onMouseEnter:t=>Z(e,t),onMouseLeave:Q,onClick:()=>$(e),children:(0,f.jsxs)(`svg`,{width:`22`,height:`22`,viewBox:`0 0 12 12`,fill:`none`,"aria-hidden":`true`,children:[(0,f.jsx)(`rect`,{x:`0.5`,y:`0.5`,width:`9`,height:`8`,rx:`1`,fill:`rgba(255,210,0,0.9)`,stroke:`rgba(160,120,0,0.7)`,strokeWidth:`1`}),(0,f.jsx)(`path`,{d:`M9.5 5.5v3l2.5-3z`,fill:`rgba(255,210,0,0.9)`,stroke:`rgba(160,120,0,0.7)`,strokeWidth:`1`}),(0,f.jsx)(`line`,{x1:`2`,y1:`3`,x2:`8`,y2:`3`,stroke:`rgba(90,60,0,0.8)`,strokeWidth:`1`,strokeLinecap:`round`}),(0,f.jsx)(`line`,{x1:`2`,y1:`5.5`,x2:`7`,y2:`5.5`,stroke:`rgba(90,60,0,0.8)`,strokeWidth:`1`,strokeLinecap:`round`})]})},t):(0,f.jsx)(`div`,{className:l.default.noteOverlay,style:{left:e.x,top:e.y,width:e.width,height:e.height},onMouseEnter:t=>Z(e,t),onMouseLeave:Q,onClick:()=>$(e)},t)),be.filter(e=>e.page===t+1).map((e,t)=>(0,f.jsx)(`div`,{className:l.default.searchMatchOverlay,style:{left:e.x,top:e.y,width:e.width,height:e.height}},t)),T&&Y?.page===t+1&&(0,f.jsx)(`div`,{className:l.default.highlightOverlay,style:{left:Y.x,top:Y.y,width:Y.width,height:Y.height}})]},`${t}-${C}`)}),y&&(0,f.jsx)(se,{hasRead:N})]})]})]}),j&&(0,f.jsxs)(`div`,{className:l.default.notePopover,style:j.above?{left:j.x,bottom:j.y}:{left:j.x,top:j.y},onMouseEnter:()=>{X.current&&clearTimeout(X.current)},onMouseLeave:Q,onClick:e=>e.stopPropagation(),children:[j.title&&(0,f.jsx)(`div`,{className:l.default.notePopoverTitle,children:j.title}),(0,f.jsx)(`p`,{className:l.default.notePopoverContent,children:j.contents})]})]})})})};exports.default=m;
1
+ const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../context/PDFViewerContext.cjs`),n=require(`../hooks/useScrollTracking.cjs`),r=require(`../hooks/useKeyboardShortcuts.cjs`),i=require(`../hooks/useTextLayer.cjs`),a=require(`../utils/url.cjs`),ee=require(`../hooks/useAnnotationLayer.cjs`),te=require(`../hooks/usePDFLoader.cjs`),ne=require(`../hooks/usePDFRenderer.cjs`),re=require(`../hooks/useOverlayRects.cjs`),ie=require(`../hooks/usePinchZoom.cjs`),o=require(`../utils/pdfjsPolyfill.cjs`),s=require(`../utils/pdfFit.cjs`),ae=require(`../context/ThemeContext.cjs`),oe=require(`../context/LabelsContext.cjs`),c=require(`../hooks/useLabels.cjs`),l=require(`./PDFViewer.module.cjs`);let u=require(`react`);u=e.__toESM(u,1);let d=require(`pdfjs-dist`);d=e.__toESM(d,1);let f=require(`react/jsx-runtime`);o.applyPdfjsPolyfill();var p=2;function se({hasRead:e}){let t=c.useLabels();return(0,f.jsxs)(`div`,{className:`${l.default.requireReadBanner} ${e?l.default.requireReadDone:``}`,children:[e?(0,f.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,f.jsx)(`path`,{d:`M3 8l3.5 3.5L13 4.5`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})}):(0,f.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,f.jsx)(`path`,{d:`M8 3v10M4 9l4 4 4-4`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,f.jsx)(`span`,{children:e?t.requireReadDone:t.requireReadPending})]})}var m=({file:e,workerSrc:c,sidebar:m,toolbar:h,onChangeFile:g,themeOverrides:ce,defaultTheme:le,defaultFit:_,language:ue,className:v,style:de,requireRead:y,onDocumentRead:b})=>{(0,u.useEffect)(()=>{let e=new URL(c,location.href).href,t=new Blob([`${o.PDFJS_POLYFILL}\nimport(${JSON.stringify(e)});`],{type:`application/javascript`}),n=URL.createObjectURL(t);return d.GlobalWorkerOptions.workerSrc=n,()=>URL.revokeObjectURL(n)},[c]);let[x,S]=(0,u.useState)(1),[C,w]=(0,u.useState)(0),[T,E]=(0,u.useState)(null),[D,fe]=(0,u.useState)([]),[O,pe]=(0,u.useState)(!1),[k,A]=(0,u.useState)(_??null),[j,M]=(0,u.useState)(null),[N,P]=(0,u.useState)(!1),F=(0,u.useRef)(!1),I=(0,u.useRef)(null),L=(0,u.useRef)([]),R=(0,u.useRef)([]),z=(0,u.useRef)(C);(0,u.useEffect)(()=>{z.current=C},[C]);let[B,me]=(0,u.useState)(null);B!==e&&(me(e),E(null),P(!1)),(0,u.useEffect)(()=>{F.current=!1},[e]);let{pdf:V,numPages:H,loading:he}=te.usePDFLoader(e);(0,u.useEffect)(()=>{V&&(L.current=Array(V.numPages).fill(null),R.current=Array(V.numPages).fill(null))},[V]),(0,u.useEffect)(()=>{!V||!_||!I.current||s.computeFit(_,V,I.current,z.current).then(S)},[V,_]);let U=(0,u.useRef)(k);(0,u.useEffect)(()=>{U.current=k},[k]),(0,u.useEffect)(()=>{if(!V||!I.current)return;let e=I.current,t=new ResizeObserver(()=>{U.current&&s.computeFit(U.current,V,e,z.current).then(S)});return t.observe(e),()=>t.disconnect()},[V]);let{currentPage:W,goToPage:G}=n.useScrollTracking({numPages:H,containerRef:I,pageRefs:L});(0,u.useEffect)(()=>{H===0||W<H||(y&&!N&&P(!0),F.current||(F.current=!0,b?.()))},[W,H,y,N,b]);let K=(0,u.useMemo)(()=>{if(H===0)return[];let e=new Set,t=Math.max(W-p,1),n=Math.min(W+p,H);for(let r=t;r<=n;r++)e.add(r);T&&e.add(T.page);for(let t of D)e.add(t.page);return Array.from(e).sort((e,t)=>e-t)},[W,H,T,D]),{pageSizes:ge,renderedPages:q}=ne.usePDFRenderer({pdf:V,zoom:x,rotation:C,visiblePages:K,canvasRefs:R}),J=(0,u.useMemo)(()=>{let e=new Set(K);for(let t of q)e.add(t);return Array.from(e).sort((e,t)=>e-t)},[K,q]);r.useKeyboardShortcuts({pdf:V,currentPage:W,goToPage:G,setRotation:w}),ie.usePinchZoom(I,x,S,A);let _e=i.useTextLayer({pdf:V,zoom:x,rotation:C,mountedPages:J,canvasRefs:R}),{linkOverlays:ve,noteOverlays:ye}=ee.useAnnotationLayer({pdf:V,zoom:x,rotation:C,mountedPages:J,goToPage:G});(0,u.useEffect)(()=>{if(!j)return;let e=()=>M(null),t=e=>{e.key===`Escape`&&M(null)};return document.addEventListener(`click`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`click`,e),document.removeEventListener(`keydown`,t)}},[j]);let{overlayRect:Y,searchOverlays:be}=re.useOverlayRects({pdf:V,highlight:T,searchMatches:D,zoom:x,rotation:C}),xe=(0,u.useCallback)((e,t)=>{(!e.url||!a.isSafeUrl(e.url))&&(t.preventDefault(),e.url||e._handleClick())},[]),X=(0,u.useRef)(null),Z=(0,u.useCallback)((e,t)=>{X.current&&clearTimeout(X.current);let n=t.clientY>window.innerHeight*.6;M({x:Math.min(t.clientX,window.innerWidth-304),y:n?window.innerHeight-t.clientY+8:t.clientY+12,above:n,contents:e.contents,title:e.title})},[]),Q=(0,u.useCallback)(()=>{X.current=setTimeout(()=>M(null),200)},[]),$=(0,u.useCallback)(e=>{E({page:e.page,pdfRect:e.pdfRect}),G(e.page)},[E,G]),Se=(0,u.useMemo)(()=>({pdf:V,numPages:H,zoom:x,setZoom:S,rotation:C,setRotation:w,currentPage:W,goToPage:G,containerRef:I,canvasRefs:R,file:e,highlight:T,setHighlight:E,searchMatches:D,setSearchMatches:fe,onChangeFile:g,sidebarCollapsed:O,setSidebarCollapsed:pe,fitMode:k,setFitMode:A,navigationLocked:!!y&&!N}),[V,H,x,C,W,G,e,T,D,g,O,k,y,N]);return(0,f.jsx)(ae.ThemeProvider,{themeOverrides:ce,defaultTheme:le,children:(0,f.jsx)(oe.LabelsProvider,{language:ue,children:(0,f.jsxs)(t.PDFViewerContext.Provider,{value:Se,children:[(0,f.jsxs)(`div`,{className:`${l.default.appLayout}${v?` ${v}`:``}`,style:de,children:[h&&(0,f.jsx)(`div`,{className:l.default.toolbar,children:h}),(0,f.jsxs)(`div`,{className:l.default.body,children:[m,(0,f.jsxs)(`div`,{className:l.default.scrollContainer,ref:I,children:[he&&(0,f.jsx)(`div`,{className:l.default.documentLoading}),Array.from({length:H},(e,t)=>{let n=q.has(t+1),r=ge[t],i=J.includes(t+1);return(0,f.jsxs)(`div`,{className:l.default.pageWrapper,ref:e=>{L.current[t]=e},style:r?{width:r.width,height:r.height}:void 0,children:[r&&!n&&(0,f.jsx)(`div`,{className:l.default.pageSkeleton,style:{width:r.width,height:r.height}}),i&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`canvas`,{className:l.default.pageCanvas,ref:e=>{R.current[t]=e},style:{display:n?`block`:`none`}}),(0,f.jsx)(`div`,{className:`textLayer ${l.default.textLayer}`,ref:e=>{_e.current[t]=e}})]}),ve.filter(e=>e.page===t+1).map((e,t)=>(0,f.jsx)(`a`,{className:l.default.linkOverlay,href:e.url&&a.isSafeUrl(e.url)?e.url:`#`,target:`_blank`,rel:`noopener noreferrer`,style:{left:e.x,top:e.y,width:e.width,height:e.height},onClick:t=>xe(e,t)},t)),ye.filter(e=>e.page===t+1).map((e,t)=>e.subtype===`Text`?(0,f.jsx)(`div`,{className:l.default.noteIconOverlay,style:{left:e.x,top:e.y,width:Math.max(e.width,26),height:Math.max(e.height,26)},onMouseEnter:t=>Z(e,t),onMouseLeave:Q,onClick:()=>$(e),children:(0,f.jsxs)(`svg`,{width:`22`,height:`22`,viewBox:`0 0 12 12`,fill:`none`,"aria-hidden":`true`,children:[(0,f.jsx)(`rect`,{x:`0.5`,y:`0.5`,width:`9`,height:`8`,rx:`1`,fill:`rgba(255,210,0,0.9)`,stroke:`rgba(160,120,0,0.7)`,strokeWidth:`1`}),(0,f.jsx)(`path`,{d:`M9.5 5.5v3l2.5-3z`,fill:`rgba(255,210,0,0.9)`,stroke:`rgba(160,120,0,0.7)`,strokeWidth:`1`}),(0,f.jsx)(`line`,{x1:`2`,y1:`3`,x2:`8`,y2:`3`,stroke:`rgba(90,60,0,0.8)`,strokeWidth:`1`,strokeLinecap:`round`}),(0,f.jsx)(`line`,{x1:`2`,y1:`5.5`,x2:`7`,y2:`5.5`,stroke:`rgba(90,60,0,0.8)`,strokeWidth:`1`,strokeLinecap:`round`})]})},t):(0,f.jsx)(`div`,{className:l.default.noteOverlay,style:{left:e.x,top:e.y,width:e.width,height:e.height},onMouseEnter:t=>Z(e,t),onMouseLeave:Q,onClick:()=>$(e)},t)),be.filter(e=>e.page===t+1).map((e,t)=>(0,f.jsx)(`div`,{className:l.default.searchMatchOverlay,style:{left:e.x,top:e.y,width:e.width,height:e.height}},t)),T&&Y?.page===t+1&&(0,f.jsx)(`div`,{className:l.default.highlightOverlay,style:{left:Y.x,top:Y.y,width:Y.width,height:Y.height}})]},`${t}-${C}`)}),y&&(0,f.jsx)(se,{hasRead:N})]})]})]}),j&&(0,f.jsxs)(`div`,{className:l.default.notePopover,style:j.above?{left:j.x,bottom:j.y}:{left:j.x,top:j.y},onMouseEnter:()=>{X.current&&clearTimeout(X.current)},onMouseLeave:Q,onClick:e=>e.stopPropagation(),children:[j.title&&(0,f.jsx)(`div`,{className:l.default.notePopoverTitle,children:j.title}),(0,f.jsx)(`p`,{className:l.default.notePopoverContent,children:j.contents})]})]})})})};exports.default=m;
@@ -0,0 +1 @@
1
+ var e=`(function(){function g(k,f){if(!this.has(k))this.set(k,f(k));return this.get(k);}if(typeof Map!=="undefined"&&!("getOrInsertComputed" in Map.prototype))Map.prototype.getOrInsertComputed=g;if(typeof WeakMap!=="undefined"&&!("getOrInsertComputed" in WeakMap.prototype))WeakMap.prototype.getOrInsertComputed=g;})();`;function t(){let e=function(e,t){return this.has(e)||this.set(e,t(e)),this.get(e)};`getOrInsertComputed`in Map.prototype||(Map.prototype.getOrInsertComputed=e),`getOrInsertComputed`in WeakMap.prototype||(WeakMap.prototype.getOrInsertComputed=e)}exports.PDFJS_POLYFILL=e,exports.applyPdfjsPolyfill=t;
@@ -8,262 +8,261 @@ import { usePDFLoader as ee } from "../hooks/usePDFLoader.js";
8
8
  import { usePDFRenderer as te } from "../hooks/usePDFRenderer.js";
9
9
  import { useOverlayRects as ne } from "../hooks/useOverlayRects.js";
10
10
  import { usePinchZoom as re } from "../hooks/usePinchZoom.js";
11
- import { computeFit as o } from "../utils/pdfFit.js";
12
- import { ThemeProvider as ie } from "../context/ThemeContext.js";
13
- import { LabelsProvider as ae } from "../context/LabelsContext.js";
14
- import { useLabels as s } from "../hooks/useLabels.js";
15
- import c from "./PDFViewer.module.js";
16
- import { useCallback as l, useEffect as u, useMemo as d, useRef as f, useState as p } from "react";
17
- import * as oe from "pdfjs-dist";
18
- import { Fragment as se, jsx as m, jsxs as h } from "react/jsx-runtime";
11
+ import { PDFJS_POLYFILL as ie, applyPdfjsPolyfill as o } from "../utils/pdfjsPolyfill.js";
12
+ import { computeFit as s } from "../utils/pdfFit.js";
13
+ import { ThemeProvider as ae } from "../context/ThemeContext.js";
14
+ import { LabelsProvider as oe } from "../context/LabelsContext.js";
15
+ import { useLabels as c } from "../hooks/useLabels.js";
16
+ import l from "./PDFViewer.module.js";
17
+ import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
18
+ import * as se from "pdfjs-dist";
19
+ import { Fragment as ce, jsx as h, jsxs as g } from "react/jsx-runtime";
19
20
  //#region src/components/PDFViewer.tsx
20
- var ce = "\"getOrInsertComputed\" in Map.prototype || (Map.prototype.getOrInsertComputed = function(k,f){if(!this.has(k))this.set(k,f(k));return this.get(k);});", g = 2;
21
+ o();
22
+ var _ = 2;
21
23
  function le({ hasRead: e }) {
22
- let t = s();
23
- return /* @__PURE__ */ h("div", {
24
- className: `${c.requireReadBanner} ${e ? c.requireReadDone : ""}`,
25
- children: [e ? /* @__PURE__ */ m("svg", {
24
+ let t = c();
25
+ return /* @__PURE__ */ g("div", {
26
+ className: `${l.requireReadBanner} ${e ? l.requireReadDone : ""}`,
27
+ children: [e ? /* @__PURE__ */ h("svg", {
26
28
  width: "16",
27
29
  height: "16",
28
30
  viewBox: "0 0 16 16",
29
31
  fill: "none",
30
32
  "aria-hidden": "true",
31
- children: /* @__PURE__ */ m("path", {
33
+ children: /* @__PURE__ */ h("path", {
32
34
  d: "M3 8l3.5 3.5L13 4.5",
33
35
  stroke: "currentColor",
34
36
  strokeWidth: "2",
35
37
  strokeLinecap: "round",
36
38
  strokeLinejoin: "round"
37
39
  })
38
- }) : /* @__PURE__ */ m("svg", {
40
+ }) : /* @__PURE__ */ h("svg", {
39
41
  width: "16",
40
42
  height: "16",
41
43
  viewBox: "0 0 16 16",
42
44
  fill: "none",
43
45
  "aria-hidden": "true",
44
- children: /* @__PURE__ */ m("path", {
46
+ children: /* @__PURE__ */ h("path", {
45
47
  d: "M8 3v10M4 9l4 4 4-4",
46
48
  stroke: "currentColor",
47
49
  strokeWidth: "2",
48
50
  strokeLinecap: "round",
49
51
  strokeLinejoin: "round"
50
52
  })
51
- }), /* @__PURE__ */ m("span", { children: e ? t.requireReadDone : t.requireReadPending })]
53
+ }), /* @__PURE__ */ h("span", { children: e ? t.requireReadDone : t.requireReadPending })]
52
54
  });
53
55
  }
54
- var _ = ({ file: s, workerSrc: _, sidebar: ue, toolbar: v, onChangeFile: y, themeOverrides: de, defaultTheme: fe, defaultFit: b, language: pe, className: x, style: me, requireRead: S, onDocumentRead: C }) => {
55
- "getOrInsertComputed" in Map.prototype || (Map.prototype.getOrInsertComputed = function(e, t) {
56
- let n = this;
57
- return n.has(e) || n.set(e, t(e)), n.get(e);
58
- }), u(() => {
59
- let e = new URL(_, location.href).href, t = new Blob([`${ce}\nimport(${JSON.stringify(e)});`], { type: "application/javascript" }), n = URL.createObjectURL(t);
60
- return oe.GlobalWorkerOptions.workerSrc = n, () => URL.revokeObjectURL(n);
61
- }, [_]);
62
- let [w, T] = p(1), [E, he] = p(0), [D, O] = p(null), [k, ge] = p([]), [A, _e] = p(!1), [j, M] = p(b ?? null), [N, P] = p(null), [F, I] = p(!1), L = f(!1), R = f(null), z = f([]), B = f([]), V = f(E);
63
- u(() => {
64
- V.current = E;
65
- }, [E]);
66
- let [ve, ye] = p(null);
67
- ve !== s && (ye(s), O(null), I(!1)), u(() => {
68
- L.current = !1;
69
- }, [s]);
70
- let { pdf: H, numPages: U, loading: be } = ee(s);
71
- u(() => {
72
- H && (z.current = Array(H.numPages).fill(null), B.current = Array(H.numPages).fill(null));
73
- }, [H]), u(() => {
74
- !H || !b || !R.current || o(b, H, R.current, V.current).then(T);
75
- }, [H, b]);
76
- let W = f(j);
77
- u(() => {
78
- W.current = j;
79
- }, [j]), u(() => {
80
- if (!H || !R.current) return;
81
- let e = R.current, t = new ResizeObserver(() => {
82
- W.current && o(W.current, H, e, V.current).then(T);
56
+ var v = ({ file: o, workerSrc: c, sidebar: v, toolbar: y, onChangeFile: b, themeOverrides: ue, defaultTheme: de, defaultFit: x, language: fe, className: S, style: pe, requireRead: C, onDocumentRead: w }) => {
57
+ d(() => {
58
+ let e = new URL(c, location.href).href, t = new Blob([`${ie}\nimport(${JSON.stringify(e)});`], { type: "application/javascript" }), n = URL.createObjectURL(t);
59
+ return se.GlobalWorkerOptions.workerSrc = n, () => URL.revokeObjectURL(n);
60
+ }, [c]);
61
+ let [T, E] = m(1), [D, me] = m(0), [O, k] = m(null), [A, he] = m([]), [j, ge] = m(!1), [M, N] = m(x ?? null), [P, F] = m(null), [I, L] = m(!1), R = p(!1), z = p(null), B = p([]), V = p([]), H = p(D);
62
+ d(() => {
63
+ H.current = D;
64
+ }, [D]);
65
+ let [_e, ve] = m(null);
66
+ _e !== o && (ve(o), k(null), L(!1)), d(() => {
67
+ R.current = !1;
68
+ }, [o]);
69
+ let { pdf: U, numPages: W, loading: ye } = ee(o);
70
+ d(() => {
71
+ U && (B.current = Array(U.numPages).fill(null), V.current = Array(U.numPages).fill(null));
72
+ }, [U]), d(() => {
73
+ !U || !x || !z.current || s(x, U, z.current, H.current).then(E);
74
+ }, [U, x]);
75
+ let G = p(M);
76
+ d(() => {
77
+ G.current = M;
78
+ }, [M]), d(() => {
79
+ if (!U || !z.current) return;
80
+ let e = z.current, t = new ResizeObserver(() => {
81
+ G.current && s(G.current, U, e, H.current).then(E);
83
82
  });
84
83
  return t.observe(e), () => t.disconnect();
85
- }, [H]);
86
- let { currentPage: G, goToPage: K } = t({
87
- numPages: U,
88
- containerRef: R,
89
- pageRefs: z
84
+ }, [U]);
85
+ let { currentPage: K, goToPage: q } = t({
86
+ numPages: W,
87
+ containerRef: z,
88
+ pageRefs: B
90
89
  });
91
- u(() => {
92
- U === 0 || G < U || (S && !F && I(!0), L.current || (L.current = !0, C?.()));
90
+ d(() => {
91
+ W === 0 || K < W || (C && !I && L(!0), R.current || (R.current = !0, w?.()));
93
92
  }, [
94
- G,
95
- U,
96
- S,
97
- F,
98
- C
93
+ K,
94
+ W,
95
+ C,
96
+ I,
97
+ w
99
98
  ]);
100
- let q = d(() => {
101
- if (U === 0) return [];
102
- let e = /* @__PURE__ */ new Set(), t = Math.max(G - g, 1), n = Math.min(G + g, U);
99
+ let J = f(() => {
100
+ if (W === 0) return [];
101
+ let e = /* @__PURE__ */ new Set(), t = Math.max(K - _, 1), n = Math.min(K + _, W);
103
102
  for (let r = t; r <= n; r++) e.add(r);
104
- D && e.add(D.page);
105
- for (let t of k) e.add(t.page);
103
+ O && e.add(O.page);
104
+ for (let t of A) e.add(t.page);
106
105
  return Array.from(e).sort((e, t) => e - t);
107
106
  }, [
108
- G,
109
- U,
110
- D,
111
- k
112
- ]), { pageSizes: xe, renderedPages: J } = te({
113
- pdf: H,
114
- zoom: w,
115
- rotation: E,
116
- visiblePages: q,
117
- canvasRefs: B
118
- }), Y = d(() => {
119
- let e = new Set(q);
120
- for (let t of J) e.add(t);
107
+ K,
108
+ W,
109
+ O,
110
+ A
111
+ ]), { pageSizes: be, renderedPages: Y } = te({
112
+ pdf: U,
113
+ zoom: T,
114
+ rotation: D,
115
+ visiblePages: J,
116
+ canvasRefs: V
117
+ }), X = f(() => {
118
+ let e = new Set(J);
119
+ for (let t of Y) e.add(t);
121
120
  return Array.from(e).sort((e, t) => e - t);
122
- }, [q, J]);
121
+ }, [J, Y]);
123
122
  n({
124
- pdf: H,
125
- currentPage: G,
126
- goToPage: K,
127
- setRotation: he
128
- }), re(R, w, T, M);
129
- let Se = r({
130
- pdf: H,
131
- zoom: w,
132
- rotation: E,
133
- mountedPages: Y,
134
- canvasRefs: B
135
- }), { linkOverlays: Ce, noteOverlays: we } = a({
136
- pdf: H,
137
- zoom: w,
138
- rotation: E,
139
- mountedPages: Y,
140
- goToPage: K
123
+ pdf: U,
124
+ currentPage: K,
125
+ goToPage: q,
126
+ setRotation: me
127
+ }), re(z, T, E, N);
128
+ let xe = r({
129
+ pdf: U,
130
+ zoom: T,
131
+ rotation: D,
132
+ mountedPages: X,
133
+ canvasRefs: V
134
+ }), { linkOverlays: Se, noteOverlays: Ce } = a({
135
+ pdf: U,
136
+ zoom: T,
137
+ rotation: D,
138
+ mountedPages: X,
139
+ goToPage: q
141
140
  });
142
- u(() => {
143
- if (!N) return;
144
- let e = () => P(null), t = (e) => {
145
- e.key === "Escape" && P(null);
141
+ d(() => {
142
+ if (!P) return;
143
+ let e = () => F(null), t = (e) => {
144
+ e.key === "Escape" && F(null);
146
145
  };
147
146
  return document.addEventListener("click", e), document.addEventListener("keydown", t), () => {
148
147
  document.removeEventListener("click", e), document.removeEventListener("keydown", t);
149
148
  };
150
- }, [N]);
151
- let { overlayRect: X, searchOverlays: Te } = ne({
152
- pdf: H,
153
- highlight: D,
154
- searchMatches: k,
155
- zoom: w,
156
- rotation: E
157
- }), Ee = l((e, t) => {
149
+ }, [P]);
150
+ let { overlayRect: Z, searchOverlays: we } = ne({
151
+ pdf: U,
152
+ highlight: O,
153
+ searchMatches: A,
154
+ zoom: T,
155
+ rotation: D
156
+ }), Te = u((e, t) => {
158
157
  (!e.url || !i(e.url)) && (t.preventDefault(), e.url || e._handleClick());
159
- }, []), Z = f(null), De = l((e, t) => {
160
- Z.current && clearTimeout(Z.current);
158
+ }, []), Q = p(null), Ee = u((e, t) => {
159
+ Q.current && clearTimeout(Q.current);
161
160
  let n = t.clientY > window.innerHeight * .6;
162
- P({
161
+ F({
163
162
  x: Math.min(t.clientX, window.innerWidth - 304),
164
163
  y: n ? window.innerHeight - t.clientY + 8 : t.clientY + 12,
165
164
  above: n,
166
165
  contents: e.contents,
167
166
  title: e.title
168
167
  });
169
- }, []), Q = l(() => {
170
- Z.current = setTimeout(() => P(null), 200);
171
- }, []), $ = l((e) => {
172
- O({
168
+ }, []), $ = u(() => {
169
+ Q.current = setTimeout(() => F(null), 200);
170
+ }, []), De = u((e) => {
171
+ k({
173
172
  page: e.page,
174
173
  pdfRect: e.pdfRect
175
- }), K(e.page);
176
- }, [O, K]), Oe = d(() => ({
177
- pdf: H,
178
- numPages: U,
179
- zoom: w,
180
- setZoom: T,
181
- rotation: E,
182
- setRotation: he,
183
- currentPage: G,
184
- goToPage: K,
185
- containerRef: R,
186
- canvasRefs: B,
187
- file: s,
188
- highlight: D,
189
- setHighlight: O,
190
- searchMatches: k,
191
- setSearchMatches: ge,
192
- onChangeFile: y,
193
- sidebarCollapsed: A,
194
- setSidebarCollapsed: _e,
195
- fitMode: j,
196
- setFitMode: M,
197
- navigationLocked: !!S && !F
174
+ }), q(e.page);
175
+ }, [k, q]), Oe = f(() => ({
176
+ pdf: U,
177
+ numPages: W,
178
+ zoom: T,
179
+ setZoom: E,
180
+ rotation: D,
181
+ setRotation: me,
182
+ currentPage: K,
183
+ goToPage: q,
184
+ containerRef: z,
185
+ canvasRefs: V,
186
+ file: o,
187
+ highlight: O,
188
+ setHighlight: k,
189
+ searchMatches: A,
190
+ setSearchMatches: he,
191
+ onChangeFile: b,
192
+ sidebarCollapsed: j,
193
+ setSidebarCollapsed: ge,
194
+ fitMode: M,
195
+ setFitMode: N,
196
+ navigationLocked: !!C && !I
198
197
  }), [
199
- H,
200
198
  U,
201
- w,
202
- E,
203
- G,
204
- K,
205
- s,
199
+ W,
200
+ T,
206
201
  D,
207
- k,
208
- y,
202
+ K,
203
+ q,
204
+ o,
205
+ O,
209
206
  A,
207
+ b,
210
208
  j,
211
- S,
212
- F
209
+ M,
210
+ C,
211
+ I
213
212
  ]);
214
- return /* @__PURE__ */ m(ie, {
215
- themeOverrides: de,
216
- defaultTheme: fe,
217
- children: /* @__PURE__ */ m(ae, {
218
- language: pe,
219
- children: /* @__PURE__ */ h(e.Provider, {
213
+ return /* @__PURE__ */ h(ae, {
214
+ themeOverrides: ue,
215
+ defaultTheme: de,
216
+ children: /* @__PURE__ */ h(oe, {
217
+ language: fe,
218
+ children: /* @__PURE__ */ g(e.Provider, {
220
219
  value: Oe,
221
- children: [/* @__PURE__ */ h("div", {
222
- className: `${c.appLayout}${x ? ` ${x}` : ""}`,
223
- style: me,
224
- children: [v && /* @__PURE__ */ m("div", {
225
- className: c.toolbar,
226
- children: v
227
- }), /* @__PURE__ */ h("div", {
228
- className: c.body,
229
- children: [ue, /* @__PURE__ */ h("div", {
230
- className: c.scrollContainer,
231
- ref: R,
220
+ children: [/* @__PURE__ */ g("div", {
221
+ className: `${l.appLayout}${S ? ` ${S}` : ""}`,
222
+ style: pe,
223
+ children: [y && /* @__PURE__ */ h("div", {
224
+ className: l.toolbar,
225
+ children: y
226
+ }), /* @__PURE__ */ g("div", {
227
+ className: l.body,
228
+ children: [v, /* @__PURE__ */ g("div", {
229
+ className: l.scrollContainer,
230
+ ref: z,
232
231
  children: [
233
- be && /* @__PURE__ */ m("div", { className: c.documentLoading }),
234
- Array.from({ length: U }, (e, t) => {
235
- let n = J.has(t + 1), r = xe[t], a = Y.includes(t + 1);
236
- return /* @__PURE__ */ h("div", {
237
- className: c.pageWrapper,
232
+ ye && /* @__PURE__ */ h("div", { className: l.documentLoading }),
233
+ Array.from({ length: W }, (e, t) => {
234
+ let n = Y.has(t + 1), r = be[t], a = X.includes(t + 1);
235
+ return /* @__PURE__ */ g("div", {
236
+ className: l.pageWrapper,
238
237
  ref: (e) => {
239
- z.current[t] = e;
238
+ B.current[t] = e;
240
239
  },
241
240
  style: r ? {
242
241
  width: r.width,
243
242
  height: r.height
244
243
  } : void 0,
245
244
  children: [
246
- r && !n && /* @__PURE__ */ m("div", {
247
- className: c.pageSkeleton,
245
+ r && !n && /* @__PURE__ */ h("div", {
246
+ className: l.pageSkeleton,
248
247
  style: {
249
248
  width: r.width,
250
249
  height: r.height
251
250
  }
252
251
  }),
253
- a && /* @__PURE__ */ h(se, { children: [/* @__PURE__ */ m("canvas", {
254
- className: c.pageCanvas,
252
+ a && /* @__PURE__ */ g(ce, { children: [/* @__PURE__ */ h("canvas", {
253
+ className: l.pageCanvas,
255
254
  ref: (e) => {
256
- B.current[t] = e;
255
+ V.current[t] = e;
257
256
  },
258
257
  style: { display: n ? "block" : "none" }
259
- }), /* @__PURE__ */ m("div", {
260
- className: `textLayer ${c.textLayer}`,
258
+ }), /* @__PURE__ */ h("div", {
259
+ className: `textLayer ${l.textLayer}`,
261
260
  ref: (e) => {
262
- Se.current[t] = e;
261
+ xe.current[t] = e;
263
262
  }
264
263
  })] }),
265
- Ce.filter((e) => e.page === t + 1).map((e, t) => /* @__PURE__ */ m("a", {
266
- className: c.linkOverlay,
264
+ Se.filter((e) => e.page === t + 1).map((e, t) => /* @__PURE__ */ h("a", {
265
+ className: l.linkOverlay,
267
266
  href: e.url && i(e.url) ? e.url : "#",
268
267
  target: "_blank",
269
268
  rel: "noopener noreferrer",
@@ -273,27 +272,27 @@ var _ = ({ file: s, workerSrc: _, sidebar: ue, toolbar: v, onChangeFile: y, them
273
272
  width: e.width,
274
273
  height: e.height
275
274
  },
276
- onClick: (t) => Ee(e, t)
275
+ onClick: (t) => Te(e, t)
277
276
  }, t)),
278
- we.filter((e) => e.page === t + 1).map((e, t) => e.subtype === "Text" ? /* @__PURE__ */ m("div", {
279
- className: c.noteIconOverlay,
277
+ Ce.filter((e) => e.page === t + 1).map((e, t) => e.subtype === "Text" ? /* @__PURE__ */ h("div", {
278
+ className: l.noteIconOverlay,
280
279
  style: {
281
280
  left: e.x,
282
281
  top: e.y,
283
282
  width: Math.max(e.width, 26),
284
283
  height: Math.max(e.height, 26)
285
284
  },
286
- onMouseEnter: (t) => De(e, t),
287
- onMouseLeave: Q,
288
- onClick: () => $(e),
289
- children: /* @__PURE__ */ h("svg", {
285
+ onMouseEnter: (t) => Ee(e, t),
286
+ onMouseLeave: $,
287
+ onClick: () => De(e),
288
+ children: /* @__PURE__ */ g("svg", {
290
289
  width: "22",
291
290
  height: "22",
292
291
  viewBox: "0 0 12 12",
293
292
  fill: "none",
294
293
  "aria-hidden": "true",
295
294
  children: [
296
- /* @__PURE__ */ m("rect", {
295
+ /* @__PURE__ */ h("rect", {
297
296
  x: "0.5",
298
297
  y: "0.5",
299
298
  width: "9",
@@ -303,13 +302,13 @@ var _ = ({ file: s, workerSrc: _, sidebar: ue, toolbar: v, onChangeFile: y, them
303
302
  stroke: "rgba(160,120,0,0.7)",
304
303
  strokeWidth: "1"
305
304
  }),
306
- /* @__PURE__ */ m("path", {
305
+ /* @__PURE__ */ h("path", {
307
306
  d: "M9.5 5.5v3l2.5-3z",
308
307
  fill: "rgba(255,210,0,0.9)",
309
308
  stroke: "rgba(160,120,0,0.7)",
310
309
  strokeWidth: "1"
311
310
  }),
312
- /* @__PURE__ */ m("line", {
311
+ /* @__PURE__ */ h("line", {
313
312
  x1: "2",
314
313
  y1: "3",
315
314
  x2: "8",
@@ -318,7 +317,7 @@ var _ = ({ file: s, workerSrc: _, sidebar: ue, toolbar: v, onChangeFile: y, them
318
317
  strokeWidth: "1",
319
318
  strokeLinecap: "round"
320
319
  }),
321
- /* @__PURE__ */ m("line", {
320
+ /* @__PURE__ */ h("line", {
322
321
  x1: "2",
323
322
  y1: "5.5",
324
323
  x2: "7",
@@ -329,20 +328,20 @@ var _ = ({ file: s, workerSrc: _, sidebar: ue, toolbar: v, onChangeFile: y, them
329
328
  })
330
329
  ]
331
330
  })
332
- }, t) : /* @__PURE__ */ m("div", {
333
- className: c.noteOverlay,
331
+ }, t) : /* @__PURE__ */ h("div", {
332
+ className: l.noteOverlay,
334
333
  style: {
335
334
  left: e.x,
336
335
  top: e.y,
337
336
  width: e.width,
338
337
  height: e.height
339
338
  },
340
- onMouseEnter: (t) => De(e, t),
341
- onMouseLeave: Q,
342
- onClick: () => $(e)
339
+ onMouseEnter: (t) => Ee(e, t),
340
+ onMouseLeave: $,
341
+ onClick: () => De(e)
343
342
  }, t)),
344
- Te.filter((e) => e.page === t + 1).map((e, t) => /* @__PURE__ */ m("div", {
345
- className: c.searchMatchOverlay,
343
+ we.filter((e) => e.page === t + 1).map((e, t) => /* @__PURE__ */ h("div", {
344
+ className: l.searchMatchOverlay,
346
345
  style: {
347
346
  left: e.x,
348
347
  top: e.y,
@@ -350,42 +349,42 @@ var _ = ({ file: s, workerSrc: _, sidebar: ue, toolbar: v, onChangeFile: y, them
350
349
  height: e.height
351
350
  }
352
351
  }, t)),
353
- D && X?.page === t + 1 && /* @__PURE__ */ m("div", {
354
- className: c.highlightOverlay,
352
+ O && Z?.page === t + 1 && /* @__PURE__ */ h("div", {
353
+ className: l.highlightOverlay,
355
354
  style: {
356
- left: X.x,
357
- top: X.y,
358
- width: X.width,
359
- height: X.height
355
+ left: Z.x,
356
+ top: Z.y,
357
+ width: Z.width,
358
+ height: Z.height
360
359
  }
361
360
  })
362
361
  ]
363
- }, `${t}-${E}`);
362
+ }, `${t}-${D}`);
364
363
  }),
365
- S && /* @__PURE__ */ m(le, { hasRead: F })
364
+ C && /* @__PURE__ */ h(le, { hasRead: I })
366
365
  ]
367
366
  })]
368
367
  })]
369
- }), N && /* @__PURE__ */ h("div", {
370
- className: c.notePopover,
371
- style: N.above ? {
372
- left: N.x,
373
- bottom: N.y
368
+ }), P && /* @__PURE__ */ g("div", {
369
+ className: l.notePopover,
370
+ style: P.above ? {
371
+ left: P.x,
372
+ bottom: P.y
374
373
  } : {
375
- left: N.x,
376
- top: N.y
374
+ left: P.x,
375
+ top: P.y
377
376
  },
378
377
  onMouseEnter: () => {
379
- Z.current && clearTimeout(Z.current);
378
+ Q.current && clearTimeout(Q.current);
380
379
  },
381
- onMouseLeave: Q,
380
+ onMouseLeave: $,
382
381
  onClick: (e) => e.stopPropagation(),
383
- children: [N.title && /* @__PURE__ */ m("div", {
384
- className: c.notePopoverTitle,
385
- children: N.title
386
- }), /* @__PURE__ */ m("p", {
387
- className: c.notePopoverContent,
388
- children: N.contents
382
+ children: [P.title && /* @__PURE__ */ h("div", {
383
+ className: l.notePopoverTitle,
384
+ children: P.title
385
+ }), /* @__PURE__ */ h("p", {
386
+ className: l.notePopoverContent,
387
+ children: P.contents
389
388
  })]
390
389
  })]
391
390
  })
@@ -393,4 +392,4 @@ var _ = ({ file: s, workerSrc: _, sidebar: ue, toolbar: v, onChangeFile: y, them
393
392
  });
394
393
  };
395
394
  //#endregion
396
- export { _ as default };
395
+ export { v as default };
@@ -0,0 +1,10 @@
1
+ //#region src/utils/pdfjsPolyfill.ts
2
+ var e = "(function(){function g(k,f){if(!this.has(k))this.set(k,f(k));return this.get(k);}if(typeof Map!==\"undefined\"&&!(\"getOrInsertComputed\" in Map.prototype))Map.prototype.getOrInsertComputed=g;if(typeof WeakMap!==\"undefined\"&&!(\"getOrInsertComputed\" in WeakMap.prototype))WeakMap.prototype.getOrInsertComputed=g;})();";
3
+ function t() {
4
+ let e = function(e, t) {
5
+ return this.has(e) || this.set(e, t(e)), this.get(e);
6
+ };
7
+ "getOrInsertComputed" in Map.prototype || (Map.prototype.getOrInsertComputed = e), "getOrInsertComputed" in WeakMap.prototype || (WeakMap.prototype.getOrInsertComputed = e);
8
+ }
9
+ //#endregion
10
+ export { e as PDFJS_POLYFILL, t as applyPdfjsPolyfill };
@@ -0,0 +1,2 @@
1
+ export declare const PDFJS_POLYFILL: string;
2
+ export declare function applyPdfjsPolyfill(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pdf-tsx",
3
- "version": "0.17.8",
3
+ "version": "0.17.9",
4
4
  "description": "A fully-featured, composable PDF viewer component for React",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.cjs",