@epam/ai-dial-react-pdf-highlighter 0.2.0-dev.27 → 0.2.0-dev.29

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
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("@epam/ai-dial-ui-kit"),F=require("@epam/pdf-highlighter-kit"),t=require("react"),z=require("@tabler/icons-react"),R="auto",L="page-fit",V=[{value:R,label:"Auto"},{value:L,label:"Page Fit"},{value:"0.5",label:"50%"},{value:"0.75",label:"75%"},{value:"1",label:"100%"},{value:"1.25",label:"125%"},{value:"1.5",label:"150%"},{value:"2",label:"200%"},{value:"3",label:"300%"}],X={maxWidth:104,format:"image/jpeg",quality:.85},$=15,le="application/pdf",oe=".pdf",Y=({pdf:s,highlights:r,selectedHighlightId:u,autoFocusFirstHighlight:l=!1,selectedPageNumber:m,zoom:i,containerClassName:h,onTotalPagesChange:b,onViewerReady:N,selectedPages:d,viewerOptions:w})=>{const f=t.useRef(null),n=t.useRef(null),[v,E]=t.useState(!1),[y,S]=t.useState(!1),T=t.useRef(b),D=t.useRef(N),I=t.useRef(w);t.useEffect(()=>{T.current=b},[b]),t.useEffect(()=>{D.current=N},[N]),t.useEffect(()=>{I.current=w},[w]);const j=t.useCallback(a=>n.current?.goToHighlight(a),[]);return t.useEffect(()=>{if(!f.current)return;E(!1),S(!1),n.current&&(n.current.destroy(),n.current=null);let a=null,x=!0;const p=()=>{x&&S(!0)};return(async()=>{try{if(a=new F.PDFHighlightViewer,await a.init(f.current,{enableTextSelection:!0,enableVirtualScrolling:!0,bboxOrigin:"top-left",...I.current}),!x){a.destroy();return}if(a.addEventListener("zoomChanged",p),await a.loadPDF(s,{selectedPages:d}),!x){a.destroy();return}const C=a.getTotalPages?.();typeof C=="number"&&C>0&&T.current?.(C),x&&(n.current=a,E(!0))}catch(C){if(!x)return;console.error("Error in initViewer:",C)}})(),()=>{x=!1,a&&(a.removeEventListener("zoomChanged",p),a.destroy())}},[s,d]),t.useEffect(()=>{!v||!n.current||(n.current.loadHighlights(r),l&&r&&r[0]&&j(r[0].id))},[l,j,r,v]),t.useEffect(()=>{v&&y&&u&&j(u)},[j,v,y,u]),t.useEffect(()=>{if(!(!v||!i))if(i===R)n.current?.setZoom?.(F.ZoomMode.AUTO);else if(i===L)n.current?.setZoom?.(F.ZoomMode.PAGE_FIT);else{const a=parseFloat(i);!Number.isNaN(a)&&a>0&&n.current?.setZoom?.(a)}},[v,i]),t.useEffect(()=>{v&&m&&n.current?.setPage?.(m)},[v,m]),t.useEffect(()=>{if(!v||!n.current)return;const a=n.current;D.current?.({getThumbnailsDataUrl:(x,p)=>a.getThumbnailsDataUrl(x,p),zoomIn:()=>a.zoomIn(),zoomOut:()=>a.zoomOut(),getZoom:()=>a.getZoom(),navigateToPage:x=>a.setPage?.(x),setPageDisplayRotation:(x,p,O)=>a.setPageDisplayRotation(x,p,O),getPageDisplayRotation:x=>a.getPageDisplayRotation(x)})},[v]),e.jsx("div",{ref:f,className:c.mergeClasses("grow min-w-0 overflow-auto bg-layer-3",h)})},P="h-4 rounded-[120px] bg-gradient-to-r from-layer-4 via-layer-3 to-layer-4 bg-[length:200%_100%] animate-skeleton-wave",J=({className:s,ariaLabel:r="pdf preview loading"})=>e.jsx("div",{role:"status","aria-label":r,"aria-live":"polite",className:c.mergeClasses("h-full w-full bg-layer-3",s),children:e.jsxs("div",{className:"flex h-full w-full flex-col gap-10 px-[60px] pt-10",children:[e.jsx("div",{className:"mx-auto h-4 w-[208px] max-w-[40%] rounded-[120px] bg-gradient-to-r from-layer-4 via-layer-3 to-layer-4 bg-[length:200%_100%] animate-skeleton-wave"}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:P}),e.jsx("div",{className:P}),e.jsx("div",{className:P}),e.jsx("div",{className:P}),e.jsx("div",{className:c.mergeClasses(P,"w-[28%] max-w-[320px]")})]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:P}),e.jsx("div",{className:P}),e.jsx("div",{className:P}),e.jsx("div",{className:P}),e.jsx("div",{className:c.mergeClasses(P,"w-[58%] max-w-[520px]")})]})]})}),Q=t.createContext(null),ee=()=>t.useContext(Q),_=V.filter(({value:s})=>{const r=Number.parseFloat(s);return!Number.isNaN(r)&&r>0}),ie=[..._].reverse(),te=(s,r,u)=>{if(_.length===0)return s;const l=Number.parseFloat(s),m=!Number.isNaN(l)&&l>0?l:u,i=typeof m=="number"&&m>0?m:Number.parseFloat(_[0].value);return r===1?(_.find(({value:h})=>Number.parseFloat(h)>i)??_[_.length-1]).value:(ie.find(({value:h})=>Number.parseFloat(h)<i)??_[0]).value};function q(s,r){const u=(s??"").toLowerCase();return(r??"").toLowerCase()===le||u.endsWith(oe)}const W=V.map(s=>({value:s.value,label:s.label})),se=({fileUrl:s,fileName:r,loadFileCb:u,highlights:l,selectedPageNumber:m,onTotalPagesChange:i,thumbnailPageNumbers:h,onThumbnailsLoaded:b,onViewerReady:N,showLoaderOverlay:d=!1,selectedPages:w})=>{const f=ee(),n=t.useRef(null),[v,E]=t.useState(!1),[y,S]=t.useState(0),[T,D]=t.useState(!1),[I,j]=t.useState(null),[a,x]=t.useState(null),[p,O]=t.useState(R),C=t.useMemo(()=>{if(r)return q(r.toLowerCase());let o;try{o=new URL(s).pathname}catch{o=s.split("?")[0].split("#")[0]}const g=o.split("/").pop()??"";return!g.includes(".")||q(g.toLowerCase())},[r,s]),B=t.useCallback(o=>{S((y+o+l.length)%l.length)},[y,l.length]),U=t.useCallback(o=>{const g=n.current;!g?.getZoom||!o||O(te(p,o,g.getZoom()))},[p]),k=t.useMemo(()=>{if(!(p===R||p===L||V.some(g=>g.value===p))){const g=parseFloat(p);if(!Number.isNaN(g)&&g>0)return[...W,{value:p,label:`${Math.round(g*100)}%`}]}return W},[p]);t.useEffect(()=>{let o=!1;if(j(!0),D(!1),x(null),E(!1),n.current=null,!C){D(!0),j(!1);return}return(async()=>{try{const Z=await(f?f.getFile(s,()=>u(s)):u(s));o||x(Z)}catch{o||(D(!0),x(null))}finally{o||j(!1)}})(),()=>{o=!0}},[s,f,u,C]);const M=t.useCallback(o=>{n.current=o,E(!0),N?.(o)},[N]);return t.useEffect(()=>{const o=h??[],g=n.current?.getThumbnailsDataUrl;if(!o.length||!g||!a||!b||!v)return;let Z=!1;return(async()=>{const K=new Map;for(let A=0;A<o.length&&!Z;A+=$){const ae=o.slice(A,A+$);try{const H=await g(ae,X);if(Z)break;H.forEach((re,ne)=>K.set(ne,re)),b(new Map(K))}catch(H){console.warn("Thumbnail batch load failed:",H);break}}})(),()=>{Z=!0}},[h,a,b,v]),{file:a,isLoading:I,isError:T,isSupportedFile:C,activeHighlightIndex:y,zoom:p,setZoom:O,zoomSelectOptions:k,viewerApiRef:n,showLoader:!T&&(!!I||d),changeIndex:B,handleZoomChange:U,handleViewerReady:M}},ce=({fileUrl:s,fileName:r,errorLabel:u,occurrencesLabel:l,unsupportedLabel:m,highlights:i,loadFileCb:h,showOccurrences:b=!0,selectedPageNumber:N,containerClassName:d,pdfViewerClassName:w,onTotalPagesChange:f,title:n,thumbnailPageNumbers:v,onThumbnailsLoaded:E,onViewerReady:y,showLoaderOverlay:S=!1,selectedPages:T,selectedHighlightId:D,viewerOptions:I})=>{const{file:j,isError:a,isSupportedFile:x,activeHighlightIndex:p,zoom:O,setZoom:C,zoomSelectOptions:B,showLoader:U,changeIndex:k,handleZoomChange:M,handleViewerReady:G}=se({fileUrl:s,fileName:r,loadFileCb:h,highlights:i,selectedPageNumber:N,onTotalPagesChange:f,thumbnailPageNumbers:v,onThumbnailsLoaded:E,onViewerReady:y,showLoaderOverlay:S,selectedPages:T});return e.jsxs("div",{className:c.mergeClasses("flex flex-col self-center gap-4 py-3 px-6 h-full w-full bg-layer-2",d),children:[r&&e.jsx("div",{className:"shrink-0 min-h-0 w-full",children:e.jsx(c.DialEllipsisTooltip,{className:"dial-tiny-text text-secondary",text:r})}),e.jsxs("div",{className:c.mergeClasses("flex w-full justify-between items-center",b&&n?"gap-2":""),children:[e.jsx("div",{children:b?e.jsxs("div",{className:"flex gap-1 py-0.5 px-1.5 min-h-[26px] items-center bg-layer-4 rounded w-fit",children:[e.jsxs("span",{className:"dial-small-text",children:[l??"Occurrences",":",e.jsx("span",{className:"pl-0.5 min-w-3 inline-block text-right",children:i.length>0?`${p+1}/${i.length}`:"0"})]}),i.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(c.DialButton,{className:"p-0 text-primary !h-6.5",size:c.ElementSize.Small,iconAfter:e.jsx(z.IconChevronDown,{size:16}),"aria-label":"Next occurrence",onClick:()=>k(1)}),e.jsx(c.DialButton,{className:"p-0 text-primary !h-6.5",size:c.ElementSize.Small,iconAfter:e.jsx(z.IconChevronUp,{size:16}),"aria-label":"Previous occurrence",onClick:()=>k(-1)})]})]}):e.jsx("div",{})}),e.jsxs("div",{className:c.mergeClasses("flex flex-1 items-center gap-4 min-w-0",n!=null&&n!==""?"justify-between":"justify-end"),children:[n!=null&&n!==""&&e.jsx(c.DialEllipsisTooltip,{text:n,className:"dial-body-semi-text text-primary min-w-0"}),e.jsxs("div",{className:"flex gap-0.5 items-center shrink-0",children:[e.jsx("div",{className:"h-6",children:e.jsx(c.DialSelect,{size:c.SelectSize.Sm,className:"bg-layer-4 !py-0 h-6 min-h-6 dial-small-text max-h-full border-transparent hover:border-hover rounded",options:B,value:O,onChange:o=>C(o)})}),e.jsx(c.DialButton,{className:"py-0 flex items-center justify-center rounded text-primary bg-layer-4 border border-transparent hover:border-hover",iconAfter:e.jsx(z.IconMinus,{size:16}),"aria-label":"Zoom out",size:c.ElementSize.Small,onClick:()=>M(-1)}),e.jsx(c.DialButton,{className:"py-0 flex items-center justify-center rounded text-primary bg-layer-4 border border-transparent hover:border-hover",iconAfter:e.jsx(z.IconPlus,{size:16}),"aria-label":"Zoom in",size:c.ElementSize.Small,onClick:()=>M(1)})]})]})]}),e.jsxs("div",{className:"relative flex min-h-0 flex-1",children:[j&&e.jsx(Y,{pdf:j,highlights:i,selectedHighlightId:b?i[p]?.id:D,selectedPageNumber:N,zoom:O,onTotalPagesChange:f,onViewerReady:G,containerClassName:w,selectedPages:T,viewerOptions:I}),U&&e.jsx(J,{className:"absolute inset-0 z-10"}),a&&e.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-layer-3",children:e.jsxs("div",{className:"flex flex-col items-center gap-6 p-10",children:[e.jsx(z.IconAlertTriangle,{size:60,stroke:2,className:"text-secondary"}),e.jsx("div",{className:"text-center dial-small-text whitespace-pre-wrap",children:!x&&m?m:u??"Failed to load document."})]})})]})]})},ue=1200*1e3,me=20,de=({children:s,ttlMs:r=ue,maxEntries:u=me})=>{const l=t.useRef(new Map),m=t.useCallback((d,w)=>{l.current.delete(d),l.current.set(d,w)},[]),i=t.useCallback(()=>{const d=Date.now();for(const[w,f]of l.current.entries())f.file&&d-f.timestamp>r&&l.current.delete(w)},[r]),h=t.useCallback(()=>{for(;l.current.size>u;){const d=l.current.keys().next().value;d&&l.current.delete(d)}},[u]),b=t.useCallback(()=>{l.current.clear()},[]),N=t.useCallback(async(d,w)=>{i();const f=l.current.get(d);if(f){if(m(d,{...f,timestamp:Date.now()}),f.file)return f.file;if(f.promise)return f.promise}const n=Date.now(),v=w().then(y=>{const S={file:y,timestamp:Date.now()};return m(d,S),h(),y}).catch(y=>{throw l.current.delete(d),y});return m(d,{promise:v,timestamp:n}),h(),v},[h,i,m]);return t.useEffect(()=>()=>b(),[b]),e.jsx(Q.Provider,{value:{getFile:N,clearCache:b},children:s})},fe=({pageNum:s,onSelectPage:r,isSelected:u,isLoading:l,isMultiselect:m,thumbnailUrl:i,className:h})=>e.jsxs("button",{type:"button","aria-label":`Page ${s}`,"aria-pressed":u,onClick:b=>{m&&b.target.closest("[data-checkbox-wrapper]")||r(s)},className:c.mergeClasses("flex flex-col gap-2 p-2 h-[186px] w-[120px] items-center justify-center cursor-pointer transition-colors hover:bg-layer-4 rounded-sm",u&&(m?"border border-accent-primary bg-accent-primary-alpha":"border border-primary"),h),children:[e.jsxs("div",{className:"relative w-[104px] h-[146px] bg-model-icon rounded-sm overflow-hidden",children:[i?e.jsx("img",{src:i,alt:`Page ${s} thumbnail`,className:"w-full h-full object-cover rounded-sm"}):null,m&&e.jsx("div",{className:"absolute left-1 top-1 z-10","data-checkbox-wrapper":!0,children:e.jsx(c.Checkbox,{id:`page-thumbnail-${s}`,isSelected:u,onChange:()=>r(s),"aria-label":`Select page ${s}`})}),l&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-blackout rounded-sm",children:e.jsx(c.Spinner,{size:24,fullWidth:!1,ariaLabel:`Loading page ${s}`})})]}),e.jsx("span",{className:"dial-tiny-text text-primary",children:s})]});Object.defineProperty(exports,"RotationDirection",{enumerable:!0,get:()=>F.RotationDirection});exports.AUTO_ZOOM_ID=R;exports.DocumentPreview=ce;exports.DocumentPreviewCacheProvider=de;exports.FIT_ZOOM_ID=L;exports.PDFViewer=Y;exports.PageThumbnail=fe;exports.PdfPreviewLoader=J;exports.THUMBNAIL_BATCH_SIZE=$;exports.THUMBNAIL_IMAGE_OPTIONS=X;exports.ZOOM_OPTIONS=V;exports.getStepZoomOptionValue=te;exports.isPdfFile=q;exports.useDocumentPreview=se;exports.useDocumentPreviewCache=ee;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("@epam/ai-dial-ui-kit"),L=require("@epam/pdf-highlighter-kit"),t=require("react"),k=require("@tabler/icons-react"),z="auto",A="page-fit",V=[{value:z,label:"Auto"},{value:A,label:"Page Fit"},{value:"0.5",label:"50%"},{value:"0.75",label:"75%"},{value:"1",label:"100%"},{value:"1.25",label:"125%"},{value:"1.5",label:"150%"},{value:"2",label:"200%"},{value:"3",label:"300%"}],X={maxWidth:104,format:"image/jpeg",quality:.85},$=15,le="application/pdf",oe=".pdf",Y=({pdf:a,highlights:r,selectedHighlightId:u,autoFocusFirstHighlight:l=!1,selectedPageNumber:d,zoom:c,containerClassName:v,onTotalPagesChange:b,onViewerReady:N,selectedPages:m,viewerOptions:y})=>{const f=t.useRef(null),n=t.useRef(null),[h,E]=t.useState(!1),[w,I]=t.useState(!1),T=t.useRef(b),O=t.useRef(N),_=t.useRef(y);t.useEffect(()=>{T.current=b},[b]),t.useEffect(()=>{O.current=N},[N]),t.useEffect(()=>{_.current=y},[y]);const j=t.useCallback(s=>n.current?.goToHighlight(s),[]);return t.useEffect(()=>{if(!f.current)return;E(!1),I(!1),n.current&&(n.current.destroy(),n.current=null);let s=null,x=!0;const p=()=>{x&&I(!0)};return(async()=>{try{if(s=new L.PDFHighlightViewer,await s.init(f.current,{enableTextSelection:!0,enableVirtualScrolling:!0,bboxOrigin:"top-left",..._.current}),!x){s.destroy();return}if(s.addEventListener("zoomChanged",p),await s.loadPDF(a,{selectedPages:m}),!x){s.destroy();return}const C=s.getTotalPages?.();typeof C=="number"&&C>0&&T.current?.(C),x&&(n.current=s,E(!0))}catch(C){if(!x)return;console.error("Error in initViewer:",C)}})(),()=>{x=!1,s&&(s.removeEventListener("zoomChanged",p),s.destroy())}},[a,m]),t.useEffect(()=>{!h||!n.current||(n.current.loadHighlights(r),l&&r&&r[0]&&j(r[0].id))},[l,j,r,h]),t.useEffect(()=>{h&&w&&u&&j(u)},[j,h,w,u]),t.useEffect(()=>{if(!(!h||!c))if(c===z)n.current?.setZoom?.(L.ZoomMode.AUTO);else if(c===A)n.current?.setZoom?.(L.ZoomMode.PAGE_FIT);else{const s=parseFloat(c);!Number.isNaN(s)&&s>0&&n.current?.setZoom?.(s)}},[h,c]),t.useEffect(()=>{h&&d&&n.current?.setPage?.(d)},[h,d]),t.useEffect(()=>{if(!h||!n.current)return;const s=n.current;O.current?.({getThumbnailsDataUrl:(x,p)=>s.getThumbnailsDataUrl(x,p),zoomIn:()=>s.zoomIn(),zoomOut:()=>s.zoomOut(),getZoom:()=>s.getZoom(),navigateToPage:x=>s.setPage?.(x),setPageDisplayRotation:(x,p,S)=>s.setPageDisplayRotation(x,p,S),getPageDisplayRotation:x=>s.getPageDisplayRotation(x)})},[h]),e.jsx("div",{ref:f,className:i.mergeClasses("grow min-w-0 overflow-auto bg-layer-raised",v)})},P="h-4 rounded-[120px] bg-gradient-to-r from-layer-sunken via-layer-raised to-layer-sunken bg-[length:200%_100%] animate-skeleton-wave",J=({className:a,ariaLabel:r="pdf preview loading"})=>e.jsx("div",{role:"status","aria-label":r,"aria-live":"polite",className:i.mergeClasses("h-full w-full bg-layer-raised",a),children:e.jsxs("div",{className:"flex h-full w-full flex-col gap-10 px-[60px] pt-10",children:[e.jsx("div",{className:"mx-auto h-4 w-[208px] max-w-[40%] rounded-[120px] bg-gradient-to-r from-layer-sunken via-layer-raised to-layer-sunken bg-[length:200%_100%] animate-skeleton-wave"}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:P}),e.jsx("div",{className:P}),e.jsx("div",{className:P}),e.jsx("div",{className:P}),e.jsx("div",{className:i.mergeClasses(P,"w-[28%] max-w-[320px]")})]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:P}),e.jsx("div",{className:P}),e.jsx("div",{className:P}),e.jsx("div",{className:P}),e.jsx("div",{className:i.mergeClasses(P,"w-[58%] max-w-[520px]")})]})]})}),Q=t.createContext(null),ee=()=>t.useContext(Q),D=V.filter(({value:a})=>{const r=Number.parseFloat(a);return!Number.isNaN(r)&&r>0}),ce=[...D].reverse(),te=(a,r,u)=>{if(D.length===0)return a;const l=Number.parseFloat(a),d=!Number.isNaN(l)&&l>0?l:u,c=typeof d=="number"&&d>0?d:Number.parseFloat(D[0].value);return r===1?(D.find(({value:v})=>Number.parseFloat(v)>c)??D[D.length-1]).value:(ce.find(({value:v})=>Number.parseFloat(v)<c)??D[0]).value};function q(a,r){const u=(a??"").toLowerCase();return(r??"").toLowerCase()===le||u.endsWith(oe)}const W=V.map(a=>({value:a.value,label:a.label})),ae=({fileUrl:a,fileName:r,loadFileCb:u,highlights:l,selectedPageNumber:d,onTotalPagesChange:c,thumbnailPageNumbers:v,onThumbnailsLoaded:b,onViewerReady:N,showLoaderOverlay:m=!1,selectedPages:y})=>{const f=ee(),n=t.useRef(null),[h,E]=t.useState(!1),[w,I]=t.useState(0),[T,O]=t.useState(!1),[_,j]=t.useState(null),[s,x]=t.useState(null),[p,S]=t.useState(z),C=t.useMemo(()=>{if(r)return q(r.toLowerCase());let o;try{o=new URL(a).pathname}catch{o=a.split("?")[0].split("#")[0]}const g=o.split("/").pop()??"";return!g.includes(".")||q(g.toLowerCase())},[r,a]),B=t.useCallback(o=>{I((w+o+l.length)%l.length)},[w,l.length]),U=t.useCallback(o=>{const g=n.current;!g?.getZoom||!o||S(te(p,o,g.getZoom()))},[p]),R=t.useMemo(()=>{if(!(p===z||p===A||V.some(g=>g.value===p))){const g=parseFloat(p);if(!Number.isNaN(g)&&g>0)return[...W,{value:p,label:`${Math.round(g*100)}%`}]}return W},[p]);t.useEffect(()=>{let o=!1;if(j(!0),O(!1),x(null),E(!1),n.current=null,!C){O(!0),j(!1);return}return(async()=>{try{const Z=await(f?f.getFile(a,()=>u(a)):u(a));o||x(Z)}catch{o||(O(!0),x(null))}finally{o||j(!1)}})(),()=>{o=!0}},[a,f,u,C]);const M=t.useCallback(o=>{n.current=o,E(!0),N?.(o)},[N]);return t.useEffect(()=>{const o=v??[],g=n.current?.getThumbnailsDataUrl;if(!o.length||!g||!s||!b||!h)return;let Z=!1;return(async()=>{const K=new Map;for(let F=0;F<o.length&&!Z;F+=$){const se=o.slice(F,F+$);try{const H=await g(se,X);if(Z)break;H.forEach((re,ne)=>K.set(ne,re)),b(new Map(K))}catch(H){console.warn("Thumbnail batch load failed:",H);break}}})(),()=>{Z=!0}},[v,s,b,h]),{file:s,isLoading:_,isError:T,isSupportedFile:C,activeHighlightIndex:w,zoom:p,setZoom:S,zoomSelectOptions:R,viewerApiRef:n,showLoader:!T&&(!!_||m),changeIndex:B,handleZoomChange:U,handleViewerReady:M}},ie=({fileUrl:a,fileName:r,errorLabel:u,occurrencesLabel:l,unsupportedLabel:d,highlights:c,loadFileCb:v,showOccurrences:b=!0,selectedPageNumber:N,containerClassName:m,pdfViewerClassName:y,onTotalPagesChange:f,title:n,thumbnailPageNumbers:h,onThumbnailsLoaded:E,onViewerReady:w,showLoaderOverlay:I=!1,selectedPages:T,selectedHighlightId:O,viewerOptions:_})=>{const{file:j,isError:s,isSupportedFile:x,activeHighlightIndex:p,zoom:S,setZoom:C,zoomSelectOptions:B,showLoader:U,changeIndex:R,handleZoomChange:M,handleViewerReady:G}=ae({fileUrl:a,fileName:r,loadFileCb:v,highlights:c,selectedPageNumber:N,onTotalPagesChange:f,thumbnailPageNumbers:h,onThumbnailsLoaded:E,onViewerReady:w,showLoaderOverlay:I,selectedPages:T});return e.jsxs("div",{className:i.mergeClasses("flex flex-col self-center gap-4 py-3 px-6 h-full w-full bg-layer-sunken",m),children:[r&&e.jsx("div",{className:"shrink-0 min-h-0 w-full",children:e.jsx(i.EllipsisTooltip,{className:"dial-tiny-text text-secondary",text:r})}),e.jsxs("div",{className:i.mergeClasses("flex w-full justify-between items-center",b&&n?"gap-2":""),children:[e.jsx("div",{children:b?e.jsxs("div",{className:"flex gap-1 py-0.5 px-1.5 min-h-[26px] items-center bg-layer-raised rounded w-fit",children:[e.jsxs("span",{className:"dial-small-text",children:[l??"Occurrences",":",e.jsx("span",{className:"pl-0.5 min-w-3 inline-block text-right",children:c.length>0?`${p+1}/${c.length}`:"0"})]}),c.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(i.IconButton,{className:"p-0 text-primary !h-6.5",size:i.ElementSize.Small,icon:e.jsx(k.IconChevronDown,{size:16}),"aria-label":"Next occurrence",onClick:()=>R(1)}),e.jsx(i.IconButton,{className:"p-0 text-primary !h-6.5",size:i.ElementSize.Small,icon:e.jsx(k.IconChevronUp,{size:16}),"aria-label":"Previous occurrence",onClick:()=>R(-1)})]})]}):e.jsx("div",{})}),e.jsxs("div",{className:i.mergeClasses("flex flex-1 items-center gap-4 min-w-0",n!=null&&n!==""?"justify-between":"justify-end"),children:[n!=null&&n!==""&&e.jsx(i.EllipsisTooltip,{text:n,className:"dial-body-semi-text text-primary min-w-0"}),e.jsxs("div",{className:"flex gap-0.5 items-center shrink-0",children:[e.jsx("div",{className:"h-6",children:e.jsx(i.Select,{size:i.ElementSize.Small,ariaLabel:"Zoom",fieldClassName:"bg-control-neutral !py-0 h-6 min-h-6 dial-small-text max-h-full border-transparent hover:border-accent-alpha rounded",options:B,value:S,onChange:o=>C(o)})}),e.jsx(i.IconButton,{className:"py-0 rounded text-primary bg-control-neutral border border-transparent hover:border-accent-alpha",icon:e.jsx(k.IconMinus,{size:16}),"aria-label":"Zoom out",size:i.ElementSize.Small,onClick:()=>M(-1)}),e.jsx(i.IconButton,{className:"py-0 rounded text-primary bg-control-neutral border border-transparent hover:border-accent-alpha",icon:e.jsx(k.IconPlus,{size:16}),"aria-label":"Zoom in",size:i.ElementSize.Small,onClick:()=>M(1)})]})]})]}),e.jsxs("div",{className:"relative flex min-h-0 flex-1",children:[j&&e.jsx(Y,{pdf:j,highlights:c,selectedHighlightId:b?c[p]?.id:O,selectedPageNumber:N,zoom:S,onTotalPagesChange:f,onViewerReady:G,containerClassName:y,selectedPages:T,viewerOptions:_}),U&&e.jsx(J,{className:"absolute inset-0 z-10"}),s&&e.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-layer-raised",children:e.jsxs("div",{className:"flex flex-col items-center gap-6 p-10",children:[e.jsx(k.IconAlertTriangle,{size:60,stroke:2,className:"text-secondary"}),e.jsx("div",{className:"text-center dial-small-text whitespace-pre-wrap",children:!x&&d?d:u??"Failed to load document."})]})})]})]})},ue=1200*1e3,de=20,me=({children:a,ttlMs:r=ue,maxEntries:u=de})=>{const l=t.useRef(new Map),d=t.useCallback((m,y)=>{l.current.delete(m),l.current.set(m,y)},[]),c=t.useCallback(()=>{const m=Date.now();for(const[y,f]of l.current.entries())f.file&&m-f.timestamp>r&&l.current.delete(y)},[r]),v=t.useCallback(()=>{for(;l.current.size>u;){const m=l.current.keys().next().value;m&&l.current.delete(m)}},[u]),b=t.useCallback(()=>{l.current.clear()},[]),N=t.useCallback(async(m,y)=>{c();const f=l.current.get(m);if(f){if(d(m,{...f,timestamp:Date.now()}),f.file)return f.file;if(f.promise)return f.promise}const n=Date.now(),h=y().then(w=>{const I={file:w,timestamp:Date.now()};return d(m,I),v(),w}).catch(w=>{throw l.current.delete(m),w});return d(m,{promise:h,timestamp:n}),v(),h},[v,c,d]);return t.useEffect(()=>()=>b(),[b]),e.jsx(Q.Provider,{value:{getFile:N,clearCache:b},children:a})},fe=({pageNum:a,onSelectPage:r,isSelected:u,isLoading:l,isMultiselect:d,thumbnailUrl:c,className:v})=>e.jsxs("button",{type:"button","aria-label":`Page ${a}`,"aria-pressed":u,onClick:b=>{d&&b.target.closest("[data-checkbox-wrapper]")||r(a)},className:i.mergeClasses("flex flex-col gap-2 p-2 h-[186px] w-[120px] items-center justify-center cursor-pointer transition-colors hover:bg-control-accent-alpha-hover rounded-sm",u&&(d?"border border-accent bg-control-accent-alpha":"border border-primary"),v),children:[e.jsxs("div",{className:"relative w-[104px] h-[146px] bg-layer-raised rounded-sm overflow-hidden",children:[c?e.jsx("img",{src:c,alt:`Page ${a} thumbnail`,className:"w-full h-full object-cover rounded-sm"}):null,d&&e.jsx("div",{className:"absolute left-1 top-1 z-10","data-checkbox-wrapper":!0,children:e.jsx(i.Checkbox,{id:`page-thumbnail-${a}`,isSelected:u,onChange:()=>r(a),"aria-label":`Select page ${a}`})}),l&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-backdrop rounded-sm",children:e.jsx(i.Spinner,{size:24,fullWidth:!1,ariaLabel:`Loading page ${a}`})})]}),e.jsx("span",{className:"dial-tiny-text text-primary",children:a})]});Object.defineProperty(exports,"RotationDirection",{enumerable:!0,get:()=>L.RotationDirection});exports.AUTO_ZOOM_ID=z;exports.DocumentPreview=ie;exports.DocumentPreviewCacheProvider=me;exports.FIT_ZOOM_ID=A;exports.PDFViewer=Y;exports.PageThumbnail=fe;exports.PdfPreviewLoader=J;exports.THUMBNAIL_BATCH_SIZE=$;exports.THUMBNAIL_IMAGE_OPTIONS=X;exports.ZOOM_OPTIONS=V;exports.getStepZoomOptionValue=te;exports.isPdfFile=q;exports.useDocumentPreview=ae;exports.useDocumentPreviewCache=ee;
@@ -1,9 +1,9 @@
1
1
  import { jsx as e, jsxs as x, Fragment as se } from "react/jsx-runtime";
2
- import { mergeClasses as Z, DialEllipsisTooltip as Y, DialButton as j, ElementSize as B, DialSelect as ie, SelectSize as ce, Checkbox as ue, Spinner as me } from "@epam/ai-dial-ui-kit";
2
+ import { mergeClasses as S, EllipsisTooltip as Y, IconButton as B, ElementSize as M, Select as ce, Checkbox as ie, Spinner as ue } from "@epam/ai-dial-ui-kit";
3
3
  import { ZoomMode as J, PDFHighlightViewer as de } from "@epam/pdf-highlighter-kit";
4
- import { RotationDirection as Be } from "@epam/pdf-highlighter-kit";
5
- import { useRef as L, useState as S, useEffect as w, useCallback as I, createContext as fe, useContext as pe, useMemo as Q } from "react";
6
- import { IconChevronDown as ve, IconChevronUp as he, IconMinus as be, IconPlus as xe, IconAlertTriangle as ge } from "@tabler/icons-react";
4
+ import { RotationDirection as je } from "@epam/pdf-highlighter-kit";
5
+ import { useRef as F, useState as Z, useEffect as y, useCallback as I, createContext as me, useContext as fe, useMemo as Q } from "react";
6
+ import { IconChevronDown as pe, IconChevronUp as he, IconMinus as ve, IconPlus as be, IconAlertTriangle as xe } from "@tabler/icons-react";
7
7
  const $ = "auto", G = "page-fit", X = [
8
8
  { value: $, label: "Auto" },
9
9
  { value: G, label: "Page Fit" },
@@ -14,117 +14,117 @@ const $ = "auto", G = "page-fit", X = [
14
14
  { value: "1.5", label: "150%" },
15
15
  { value: "2", label: "200%" },
16
16
  { value: "3", label: "300%" }
17
- ], ye = {
17
+ ], ge = {
18
18
  maxWidth: 104,
19
19
  format: "image/jpeg",
20
20
  quality: 0.85
21
- }, ee = 15, we = "application/pdf", Ne = ".pdf", Ce = ({
21
+ }, ee = 15, we = "application/pdf", ye = ".pdf", Ne = ({
22
22
  pdf: t,
23
- highlights: a,
24
- selectedHighlightId: i,
23
+ highlights: r,
24
+ selectedHighlightId: c,
25
25
  autoFocusFirstHighlight: o = !1,
26
- selectedPageNumber: c,
26
+ selectedPageNumber: i,
27
27
  zoom: s,
28
- containerClassName: h,
29
- onTotalPagesChange: v,
28
+ containerClassName: v,
29
+ onTotalPagesChange: h,
30
30
  onViewerReady: N,
31
31
  selectedPages: u,
32
- viewerOptions: y
32
+ viewerOptions: w
33
33
  }) => {
34
- const m = L(null), n = L(null), [p, D] = S(!1), [g, _] = S(!1), E = L(v), O = L(N), R = L(y);
35
- w(() => {
36
- E.current = v;
37
- }, [v]), w(() => {
38
- O.current = N;
39
- }, [N]), w(() => {
40
- R.current = y;
41
- }, [y]);
34
+ const d = F(null), n = F(null), [p, _] = Z(!1), [g, E] = Z(!1), O = F(h), D = F(N), k = F(w);
35
+ y(() => {
36
+ O.current = h;
37
+ }, [h]), y(() => {
38
+ D.current = N;
39
+ }, [N]), y(() => {
40
+ k.current = w;
41
+ }, [w]);
42
42
  const C = I(
43
- (r) => n.current?.goToHighlight(r),
43
+ (a) => n.current?.goToHighlight(a),
44
44
  []
45
45
  );
46
- return w(() => {
47
- if (!m.current) return;
48
- D(!1), _(!1), n.current && (n.current.destroy(), n.current = null);
49
- let r = null, d = !0;
46
+ return y(() => {
47
+ if (!d.current) return;
48
+ _(!1), E(!1), n.current && (n.current.destroy(), n.current = null);
49
+ let a = null, m = !0;
50
50
  const f = () => {
51
- d && _(!0);
51
+ m && E(!0);
52
52
  };
53
53
  return (async () => {
54
54
  try {
55
- if (r = new de(), await r.init(m.current, {
55
+ if (a = new de(), await a.init(d.current, {
56
56
  enableTextSelection: !0,
57
57
  enableVirtualScrolling: !0,
58
58
  bboxOrigin: "top-left",
59
- ...R.current
60
- }), !d) {
61
- r.destroy();
59
+ ...k.current
60
+ }), !m) {
61
+ a.destroy();
62
62
  return;
63
63
  }
64
- if (r.addEventListener("zoomChanged", f), await r.loadPDF(t, { selectedPages: u }), !d) {
65
- r.destroy();
64
+ if (a.addEventListener("zoomChanged", f), await a.loadPDF(t, { selectedPages: u }), !m) {
65
+ a.destroy();
66
66
  return;
67
67
  }
68
- const P = r.getTotalPages?.();
69
- typeof P == "number" && P > 0 && E.current?.(P), d && (n.current = r, D(!0));
68
+ const P = a.getTotalPages?.();
69
+ typeof P == "number" && P > 0 && O.current?.(P), m && (n.current = a, _(!0));
70
70
  } catch (P) {
71
- if (!d)
71
+ if (!m)
72
72
  return;
73
73
  console.error("Error in initViewer:", P);
74
74
  }
75
75
  })(), () => {
76
- d = !1, r && (r.removeEventListener("zoomChanged", f), r.destroy());
76
+ m = !1, a && (a.removeEventListener("zoomChanged", f), a.destroy());
77
77
  };
78
- }, [t, u]), w(() => {
79
- !p || !n.current || (n.current.loadHighlights(a), o && a && a[0] && C(a[0].id));
80
- }, [o, C, a, p]), w(() => {
81
- p && g && i && C(i);
82
- }, [C, p, g, i]), w(() => {
78
+ }, [t, u]), y(() => {
79
+ !p || !n.current || (n.current.loadHighlights(r), o && r && r[0] && C(r[0].id));
80
+ }, [o, C, r, p]), y(() => {
81
+ p && g && c && C(c);
82
+ }, [C, p, g, c]), y(() => {
83
83
  if (!(!p || !s))
84
84
  if (s === $)
85
85
  n.current?.setZoom?.(J.AUTO);
86
86
  else if (s === G)
87
87
  n.current?.setZoom?.(J.PAGE_FIT);
88
88
  else {
89
- const r = parseFloat(s);
90
- !Number.isNaN(r) && r > 0 && n.current?.setZoom?.(r);
89
+ const a = parseFloat(s);
90
+ !Number.isNaN(a) && a > 0 && n.current?.setZoom?.(a);
91
91
  }
92
- }, [p, s]), w(() => {
93
- p && c && n.current?.setPage?.(c);
94
- }, [p, c]), w(() => {
92
+ }, [p, s]), y(() => {
93
+ p && i && n.current?.setPage?.(i);
94
+ }, [p, i]), y(() => {
95
95
  if (!p || !n.current) return;
96
- const r = n.current;
97
- O.current?.({
98
- getThumbnailsDataUrl: (d, f) => r.getThumbnailsDataUrl(d, f),
99
- zoomIn: () => r.zoomIn(),
100
- zoomOut: () => r.zoomOut(),
101
- getZoom: () => r.getZoom(),
102
- navigateToPage: (d) => r.setPage?.(d),
103
- setPageDisplayRotation: (d, f, z) => r.setPageDisplayRotation(d, f, z),
104
- getPageDisplayRotation: (d) => r.getPageDisplayRotation(d)
96
+ const a = n.current;
97
+ D.current?.({
98
+ getThumbnailsDataUrl: (m, f) => a.getThumbnailsDataUrl(m, f),
99
+ zoomIn: () => a.zoomIn(),
100
+ zoomOut: () => a.zoomOut(),
101
+ getZoom: () => a.getZoom(),
102
+ navigateToPage: (m) => a.setPage?.(m),
103
+ setPageDisplayRotation: (m, f, z) => a.setPageDisplayRotation(m, f, z),
104
+ getPageDisplayRotation: (m) => a.getPageDisplayRotation(m)
105
105
  });
106
106
  }, [p]), /* @__PURE__ */ e(
107
107
  "div",
108
108
  {
109
- ref: m,
110
- className: Z(
111
- "grow min-w-0 overflow-auto bg-layer-3",
112
- h
109
+ ref: d,
110
+ className: S(
111
+ "grow min-w-0 overflow-auto bg-layer-raised",
112
+ v
113
113
  )
114
114
  }
115
115
  );
116
- }, T = "h-4 rounded-[120px] bg-gradient-to-r from-layer-4 via-layer-3 to-layer-4 bg-[length:200%_100%] animate-skeleton-wave", Pe = ({
116
+ }, T = "h-4 rounded-[120px] bg-gradient-to-r from-layer-sunken via-layer-raised to-layer-sunken bg-[length:200%_100%] animate-skeleton-wave", Ce = ({
117
117
  className: t,
118
- ariaLabel: a = "pdf preview loading"
118
+ ariaLabel: r = "pdf preview loading"
119
119
  }) => /* @__PURE__ */ e(
120
120
  "div",
121
121
  {
122
122
  role: "status",
123
- "aria-label": a,
123
+ "aria-label": r,
124
124
  "aria-live": "polite",
125
- className: Z("h-full w-full bg-layer-3", t),
125
+ className: S("h-full w-full bg-layer-raised", t),
126
126
  children: /* @__PURE__ */ x("div", { className: "flex h-full w-full flex-col gap-10 px-[60px] pt-10", children: [
127
- /* @__PURE__ */ e("div", { className: "mx-auto h-4 w-[208px] max-w-[40%] rounded-[120px] bg-gradient-to-r from-layer-4 via-layer-3 to-layer-4 bg-[length:200%_100%] animate-skeleton-wave" }),
127
+ /* @__PURE__ */ e("div", { className: "mx-auto h-4 w-[208px] max-w-[40%] rounded-[120px] bg-gradient-to-r from-layer-sunken via-layer-raised to-layer-sunken bg-[length:200%_100%] animate-skeleton-wave" }),
128
128
  /* @__PURE__ */ x("div", { className: "flex flex-col gap-4", children: [
129
129
  /* @__PURE__ */ e("div", { className: T }),
130
130
  /* @__PURE__ */ e("div", { className: T }),
@@ -133,7 +133,7 @@ const $ = "auto", G = "page-fit", X = [
133
133
  /* @__PURE__ */ e(
134
134
  "div",
135
135
  {
136
- className: Z(
136
+ className: S(
137
137
  T,
138
138
  "w-[28%] max-w-[320px]"
139
139
  )
@@ -148,7 +148,7 @@ const $ = "auto", G = "page-fit", X = [
148
148
  /* @__PURE__ */ e(
149
149
  "div",
150
150
  {
151
- className: Z(
151
+ className: S(
152
152
  T,
153
153
  "w-[58%] max-w-[520px]"
154
154
  )
@@ -157,42 +157,42 @@ const $ = "auto", G = "page-fit", X = [
157
157
  ] })
158
158
  ] })
159
159
  }
160
- ), ae = fe(null), Te = () => pe(ae), F = X.filter(({ value: t }) => {
161
- const a = Number.parseFloat(t);
162
- return !Number.isNaN(a) && a > 0;
163
- }), Ie = [...F].reverse(), De = (t, a, i) => {
164
- if (F.length === 0)
160
+ ), re = me(null), Pe = () => fe(re), R = X.filter(({ value: t }) => {
161
+ const r = Number.parseFloat(t);
162
+ return !Number.isNaN(r) && r > 0;
163
+ }), Te = [...R].reverse(), Ie = (t, r, c) => {
164
+ if (R.length === 0)
165
165
  return t;
166
- const o = Number.parseFloat(t), c = !Number.isNaN(o) && o > 0 ? o : i, s = typeof c == "number" && c > 0 ? c : Number.parseFloat(F[0].value);
167
- return a === 1 ? (F.find(
168
- ({ value: h }) => Number.parseFloat(h) > s
169
- ) ?? F[F.length - 1]).value : (Ie.find(
170
- ({ value: h }) => Number.parseFloat(h) < s
171
- ) ?? F[0]).value;
166
+ const o = Number.parseFloat(t), i = !Number.isNaN(o) && o > 0 ? o : c, s = typeof i == "number" && i > 0 ? i : Number.parseFloat(R[0].value);
167
+ return r === 1 ? (R.find(
168
+ ({ value: v }) => Number.parseFloat(v) > s
169
+ ) ?? R[R.length - 1]).value : (Te.find(
170
+ ({ value: v }) => Number.parseFloat(v) < s
171
+ ) ?? R[0]).value;
172
172
  };
173
- function te(t, a) {
174
- const i = (t ?? "").toLowerCase();
175
- return (a ?? "").toLowerCase() === we || i.endsWith(Ne);
173
+ function te(t, r) {
174
+ const c = (t ?? "").toLowerCase();
175
+ return (r ?? "").toLowerCase() === we || c.endsWith(ye);
176
176
  }
177
- const re = X.map((t) => ({
177
+ const ae = X.map((t) => ({
178
178
  value: t.value,
179
179
  label: t.label
180
180
  })), _e = ({
181
181
  fileUrl: t,
182
- fileName: a,
183
- loadFileCb: i,
182
+ fileName: r,
183
+ loadFileCb: c,
184
184
  highlights: o,
185
- selectedPageNumber: c,
185
+ selectedPageNumber: i,
186
186
  onTotalPagesChange: s,
187
- thumbnailPageNumbers: h,
188
- onThumbnailsLoaded: v,
187
+ thumbnailPageNumbers: v,
188
+ onThumbnailsLoaded: h,
189
189
  onViewerReady: N,
190
190
  showLoaderOverlay: u = !1,
191
- selectedPages: y
191
+ selectedPages: w
192
192
  }) => {
193
- const m = Te(), n = L(null), [p, D] = S(!1), [g, _] = S(0), [E, O] = S(!1), [R, C] = S(null), [r, d] = S(null), [f, z] = S($), P = Q(() => {
194
- if (a)
195
- return te(a.toLowerCase());
193
+ const d = Pe(), n = F(null), [p, _] = Z(!1), [g, E] = Z(0), [O, D] = Z(!1), [k, C] = Z(null), [a, m] = Z(null), [f, z] = Z($), P = Q(() => {
194
+ if (r)
195
+ return te(r.toLowerCase());
196
196
  let l;
197
197
  try {
198
198
  l = new URL(t).pathname;
@@ -201,9 +201,9 @@ const re = X.map((t) => ({
201
201
  }
202
202
  const b = l.split("/").pop() ?? "";
203
203
  return !b.includes(".") || te(b.toLowerCase());
204
- }, [a, t]), U = I(
204
+ }, [r, t]), U = I(
205
205
  (l) => {
206
- _(
206
+ E(
207
207
  (g + l + o.length) % o.length
208
208
  );
209
209
  },
@@ -211,7 +211,7 @@ const re = X.map((t) => ({
211
211
  ), H = I(
212
212
  (l) => {
213
213
  const b = n.current;
214
- !b?.getZoom || !l || z(De(f, l, b.getZoom()));
214
+ !b?.getZoom || !l || z(Ie(f, l, b.getZoom()));
215
215
  },
216
216
  [f]
217
217
  ), A = Q(() => {
@@ -219,144 +219,144 @@ const re = X.map((t) => ({
219
219
  const b = parseFloat(f);
220
220
  if (!Number.isNaN(b) && b > 0)
221
221
  return [
222
- ...re,
222
+ ...ae,
223
223
  { value: f, label: `${Math.round(b * 100)}%` }
224
224
  ];
225
225
  }
226
- return re;
226
+ return ae;
227
227
  }, [f]);
228
- w(() => {
228
+ y(() => {
229
229
  let l = !1;
230
- if (C(!0), O(!1), d(null), D(!1), n.current = null, !P) {
231
- O(!0), C(!1);
230
+ if (C(!0), D(!1), m(null), _(!1), n.current = null, !P) {
231
+ D(!0), C(!1);
232
232
  return;
233
233
  }
234
234
  return (async () => {
235
235
  try {
236
- const k = await (m ? m.getFile(t, () => i(t)) : i(t));
237
- l || d(k);
236
+ const L = await (d ? d.getFile(t, () => c(t)) : c(t));
237
+ l || m(L);
238
238
  } catch {
239
- l || (O(!0), d(null));
239
+ l || (D(!0), m(null));
240
240
  } finally {
241
241
  l || C(!1);
242
242
  }
243
243
  })(), () => {
244
244
  l = !0;
245
245
  };
246
- }, [t, m, i, P]);
247
- const M = I(
246
+ }, [t, d, c, P]);
247
+ const V = I(
248
248
  (l) => {
249
- n.current = l, D(!0), N?.(l);
249
+ n.current = l, _(!0), N?.(l);
250
250
  },
251
251
  [N]
252
252
  );
253
- return w(() => {
254
- const l = h ?? [], b = n.current?.getThumbnailsDataUrl;
255
- if (!l.length || !b || !r || !v || !p)
253
+ return y(() => {
254
+ const l = v ?? [], b = n.current?.getThumbnailsDataUrl;
255
+ if (!l.length || !b || !a || !h || !p)
256
256
  return;
257
- let k = !1;
257
+ let L = !1;
258
258
  return (async () => {
259
259
  const K = /* @__PURE__ */ new Map();
260
- for (let V = 0; V < l.length && !k; V += ee) {
261
- const ne = l.slice(V, V + ee);
260
+ for (let j = 0; j < l.length && !L; j += ee) {
261
+ const ne = l.slice(j, j + ee);
262
262
  try {
263
- const W = await b(ne, ye);
264
- if (k) break;
265
- W.forEach((oe, le) => K.set(le, oe)), v(new Map(K));
263
+ const W = await b(ne, ge);
264
+ if (L) break;
265
+ W.forEach((oe, le) => K.set(le, oe)), h(new Map(K));
266
266
  } catch (W) {
267
267
  console.warn("Thumbnail batch load failed:", W);
268
268
  break;
269
269
  }
270
270
  }
271
271
  })(), () => {
272
- k = !0;
272
+ L = !0;
273
273
  };
274
- }, [h, r, v, p]), {
275
- file: r,
276
- isLoading: R,
277
- isError: E,
274
+ }, [v, a, h, p]), {
275
+ file: a,
276
+ isLoading: k,
277
+ isError: O,
278
278
  isSupportedFile: P,
279
279
  activeHighlightIndex: g,
280
280
  zoom: f,
281
281
  setZoom: z,
282
282
  zoomSelectOptions: A,
283
283
  viewerApiRef: n,
284
- showLoader: !E && (!!R || u),
284
+ showLoader: !O && (!!k || u),
285
285
  changeIndex: U,
286
286
  handleZoomChange: H,
287
- handleViewerReady: M
287
+ handleViewerReady: V
288
288
  };
289
- }, ke = ({
289
+ }, Fe = ({
290
290
  fileUrl: t,
291
- fileName: a,
292
- errorLabel: i,
291
+ fileName: r,
292
+ errorLabel: c,
293
293
  occurrencesLabel: o,
294
- unsupportedLabel: c,
294
+ unsupportedLabel: i,
295
295
  highlights: s,
296
- loadFileCb: h,
297
- showOccurrences: v = !0,
296
+ loadFileCb: v,
297
+ showOccurrences: h = !0,
298
298
  selectedPageNumber: N,
299
299
  containerClassName: u,
300
- pdfViewerClassName: y,
301
- onTotalPagesChange: m,
300
+ pdfViewerClassName: w,
301
+ onTotalPagesChange: d,
302
302
  title: n,
303
303
  thumbnailPageNumbers: p,
304
- onThumbnailsLoaded: D,
304
+ onThumbnailsLoaded: _,
305
305
  onViewerReady: g,
306
- showLoaderOverlay: _ = !1,
307
- selectedPages: E,
308
- selectedHighlightId: O,
309
- viewerOptions: R
306
+ showLoaderOverlay: E = !1,
307
+ selectedPages: O,
308
+ selectedHighlightId: D,
309
+ viewerOptions: k
310
310
  }) => {
311
311
  const {
312
312
  file: C,
313
- isError: r,
314
- isSupportedFile: d,
313
+ isError: a,
314
+ isSupportedFile: m,
315
315
  activeHighlightIndex: f,
316
316
  zoom: z,
317
317
  setZoom: P,
318
318
  zoomSelectOptions: U,
319
319
  showLoader: H,
320
320
  changeIndex: A,
321
- handleZoomChange: M,
321
+ handleZoomChange: V,
322
322
  handleViewerReady: q
323
323
  } = _e({
324
324
  fileUrl: t,
325
- fileName: a,
326
- loadFileCb: h,
325
+ fileName: r,
326
+ loadFileCb: v,
327
327
  highlights: s,
328
328
  selectedPageNumber: N,
329
- onTotalPagesChange: m,
329
+ onTotalPagesChange: d,
330
330
  thumbnailPageNumbers: p,
331
- onThumbnailsLoaded: D,
331
+ onThumbnailsLoaded: _,
332
332
  onViewerReady: g,
333
- showLoaderOverlay: _,
334
- selectedPages: E
333
+ showLoaderOverlay: E,
334
+ selectedPages: O
335
335
  });
336
336
  return /* @__PURE__ */ x(
337
337
  "div",
338
338
  {
339
- className: Z(
340
- "flex flex-col self-center gap-4 py-3 px-6 h-full w-full bg-layer-2",
339
+ className: S(
340
+ "flex flex-col self-center gap-4 py-3 px-6 h-full w-full bg-layer-sunken",
341
341
  u
342
342
  ),
343
343
  children: [
344
- a && /* @__PURE__ */ e("div", { className: "shrink-0 min-h-0 w-full", children: /* @__PURE__ */ e(
344
+ r && /* @__PURE__ */ e("div", { className: "shrink-0 min-h-0 w-full", children: /* @__PURE__ */ e(
345
345
  Y,
346
346
  {
347
347
  className: "dial-tiny-text text-secondary",
348
- text: a
348
+ text: r
349
349
  }
350
350
  ) }),
351
351
  /* @__PURE__ */ x(
352
352
  "div",
353
353
  {
354
- className: Z(
354
+ className: S(
355
355
  "flex w-full justify-between items-center",
356
- v && n ? "gap-2" : ""
356
+ h && n ? "gap-2" : ""
357
357
  ),
358
358
  children: [
359
- /* @__PURE__ */ e("div", { children: v ? /* @__PURE__ */ x("div", { className: "flex gap-1 py-0.5 px-1.5 min-h-[26px] items-center bg-layer-4 rounded w-fit", children: [
359
+ /* @__PURE__ */ e("div", { children: h ? /* @__PURE__ */ x("div", { className: "flex gap-1 py-0.5 px-1.5 min-h-[26px] items-center bg-layer-raised rounded w-fit", children: [
360
360
  /* @__PURE__ */ x("span", { className: "dial-small-text", children: [
361
361
  o ?? "Occurrences",
362
362
  ":",
@@ -364,21 +364,21 @@ const re = X.map((t) => ({
364
364
  ] }),
365
365
  s.length > 0 && /* @__PURE__ */ x(se, { children: [
366
366
  /* @__PURE__ */ e(
367
- j,
367
+ B,
368
368
  {
369
369
  className: "p-0 text-primary !h-6.5",
370
- size: B.Small,
371
- iconAfter: /* @__PURE__ */ e(ve, { size: 16 }),
370
+ size: M.Small,
371
+ icon: /* @__PURE__ */ e(pe, { size: 16 }),
372
372
  "aria-label": "Next occurrence",
373
373
  onClick: () => A(1)
374
374
  }
375
375
  ),
376
376
  /* @__PURE__ */ e(
377
- j,
377
+ B,
378
378
  {
379
379
  className: "p-0 text-primary !h-6.5",
380
- size: B.Small,
381
- iconAfter: /* @__PURE__ */ e(he, { size: 16 }),
380
+ size: M.Small,
381
+ icon: /* @__PURE__ */ e(he, { size: 16 }),
382
382
  "aria-label": "Previous occurrence",
383
383
  onClick: () => A(-1)
384
384
  }
@@ -388,7 +388,7 @@ const re = X.map((t) => ({
388
388
  /* @__PURE__ */ x(
389
389
  "div",
390
390
  {
391
- className: Z(
391
+ className: S(
392
392
  "flex flex-1 items-center gap-4 min-w-0",
393
393
  n != null && n !== "" ? "justify-between" : "justify-end"
394
394
  ),
@@ -402,33 +402,34 @@ const re = X.map((t) => ({
402
402
  ),
403
403
  /* @__PURE__ */ x("div", { className: "flex gap-0.5 items-center shrink-0", children: [
404
404
  /* @__PURE__ */ e("div", { className: "h-6", children: /* @__PURE__ */ e(
405
- ie,
405
+ ce,
406
406
  {
407
- size: ce.Sm,
408
- className: "bg-layer-4 !py-0 h-6 min-h-6 dial-small-text max-h-full border-transparent hover:border-hover rounded",
407
+ size: M.Small,
408
+ ariaLabel: "Zoom",
409
+ fieldClassName: "bg-control-neutral !py-0 h-6 min-h-6 dial-small-text max-h-full border-transparent hover:border-accent-alpha rounded",
409
410
  options: U,
410
411
  value: z,
411
412
  onChange: (l) => P(l)
412
413
  }
413
414
  ) }),
414
415
  /* @__PURE__ */ e(
415
- j,
416
+ B,
416
417
  {
417
- className: "py-0 flex items-center justify-center rounded text-primary bg-layer-4 border border-transparent hover:border-hover",
418
- iconAfter: /* @__PURE__ */ e(be, { size: 16 }),
418
+ className: "py-0 rounded text-primary bg-control-neutral border border-transparent hover:border-accent-alpha",
419
+ icon: /* @__PURE__ */ e(ve, { size: 16 }),
419
420
  "aria-label": "Zoom out",
420
- size: B.Small,
421
- onClick: () => M(-1)
421
+ size: M.Small,
422
+ onClick: () => V(-1)
422
423
  }
423
424
  ),
424
425
  /* @__PURE__ */ e(
425
- j,
426
+ B,
426
427
  {
427
- className: "py-0 flex items-center justify-center rounded text-primary bg-layer-4 border border-transparent hover:border-hover",
428
- iconAfter: /* @__PURE__ */ e(xe, { size: 16 }),
428
+ className: "py-0 rounded text-primary bg-control-neutral border border-transparent hover:border-accent-alpha",
429
+ icon: /* @__PURE__ */ e(be, { size: 16 }),
429
430
  "aria-label": "Zoom in",
430
- size: B.Small,
431
- onClick: () => M(1)
431
+ size: M.Small,
432
+ onClick: () => V(1)
432
433
  }
433
434
  )
434
435
  ] })
@@ -440,99 +441,99 @@ const re = X.map((t) => ({
440
441
  ),
441
442
  /* @__PURE__ */ x("div", { className: "relative flex min-h-0 flex-1", children: [
442
443
  C && /* @__PURE__ */ e(
443
- Ce,
444
+ Ne,
444
445
  {
445
446
  pdf: C,
446
447
  highlights: s,
447
- selectedHighlightId: v ? s[f]?.id : O,
448
+ selectedHighlightId: h ? s[f]?.id : D,
448
449
  selectedPageNumber: N,
449
450
  zoom: z,
450
- onTotalPagesChange: m,
451
+ onTotalPagesChange: d,
451
452
  onViewerReady: q,
452
- containerClassName: y,
453
- selectedPages: E,
454
- viewerOptions: R
453
+ containerClassName: w,
454
+ selectedPages: O,
455
+ viewerOptions: k
455
456
  }
456
457
  ),
457
- H && /* @__PURE__ */ e(Pe, { className: "absolute inset-0 z-10" }),
458
- r && /* @__PURE__ */ e("div", { className: "absolute inset-0 z-20 flex items-center justify-center bg-layer-3", children: /* @__PURE__ */ x("div", { className: "flex flex-col items-center gap-6 p-10", children: [
458
+ H && /* @__PURE__ */ e(Ce, { className: "absolute inset-0 z-10" }),
459
+ a && /* @__PURE__ */ e("div", { className: "absolute inset-0 z-20 flex items-center justify-center bg-layer-raised", children: /* @__PURE__ */ x("div", { className: "flex flex-col items-center gap-6 p-10", children: [
459
460
  /* @__PURE__ */ e(
460
- ge,
461
+ xe,
461
462
  {
462
463
  size: 60,
463
464
  stroke: 2,
464
465
  className: "text-secondary"
465
466
  }
466
467
  ),
467
- /* @__PURE__ */ e("div", { className: "text-center dial-small-text whitespace-pre-wrap", children: !d && c ? c : i ?? "Failed to load document." })
468
+ /* @__PURE__ */ e("div", { className: "text-center dial-small-text whitespace-pre-wrap", children: !m && i ? i : c ?? "Failed to load document." })
468
469
  ] }) })
469
470
  ] })
470
471
  ]
471
472
  }
472
473
  );
473
- }, Ee = 1200 * 1e3, Oe = 20, Ae = ({
474
+ }, Ee = 1200 * 1e3, Oe = 20, Le = ({
474
475
  children: t,
475
- ttlMs: a = Ee,
476
- maxEntries: i = Oe
476
+ ttlMs: r = Ee,
477
+ maxEntries: c = Oe
477
478
  }) => {
478
- const o = L(/* @__PURE__ */ new Map()), c = I((u, y) => {
479
- o.current.delete(u), o.current.set(u, y);
479
+ const o = F(/* @__PURE__ */ new Map()), i = I((u, w) => {
480
+ o.current.delete(u), o.current.set(u, w);
480
481
  }, []), s = I(() => {
481
482
  const u = Date.now();
482
- for (const [y, m] of o.current.entries())
483
- m.file && u - m.timestamp > a && o.current.delete(y);
484
- }, [a]), h = I(() => {
485
- for (; o.current.size > i; ) {
483
+ for (const [w, d] of o.current.entries())
484
+ d.file && u - d.timestamp > r && o.current.delete(w);
485
+ }, [r]), v = I(() => {
486
+ for (; o.current.size > c; ) {
486
487
  const u = o.current.keys().next().value;
487
488
  u && o.current.delete(u);
488
489
  }
489
- }, [i]), v = I(() => {
490
+ }, [c]), h = I(() => {
490
491
  o.current.clear();
491
492
  }, []), N = I(
492
- async (u, y) => {
493
+ async (u, w) => {
493
494
  s();
494
- const m = o.current.get(u);
495
- if (m) {
496
- if (c(u, { ...m, timestamp: Date.now() }), m.file)
497
- return m.file;
498
- if (m.promise)
499
- return m.promise;
495
+ const d = o.current.get(u);
496
+ if (d) {
497
+ if (i(u, { ...d, timestamp: Date.now() }), d.file)
498
+ return d.file;
499
+ if (d.promise)
500
+ return d.promise;
500
501
  }
501
- const n = Date.now(), p = y().then((g) => {
502
- const _ = { file: g, timestamp: Date.now() };
503
- return c(u, _), h(), g;
502
+ const n = Date.now(), p = w().then((g) => {
503
+ const E = { file: g, timestamp: Date.now() };
504
+ return i(u, E), v(), g;
504
505
  }).catch((g) => {
505
506
  throw o.current.delete(u), g;
506
507
  });
507
- return c(u, { promise: p, timestamp: n }), h(), p;
508
+ return i(u, { promise: p, timestamp: n }), v(), p;
508
509
  },
509
- [h, s, c]
510
+ [v, s, i]
510
511
  );
511
- return w(() => () => v(), [v]), /* @__PURE__ */ e(ae.Provider, { value: { getFile: N, clearCache: v }, children: t });
512
+ return y(() => () => h(), [h]), /* @__PURE__ */ e(re.Provider, { value: { getFile: N, clearCache: h }, children: t });
512
513
  }, Me = ({
513
514
  pageNum: t,
514
- onSelectPage: a,
515
- isSelected: i,
515
+ onSelectPage: r,
516
+ isSelected: c,
516
517
  isLoading: o,
517
- isMultiselect: c,
518
+ isMultiselect: i,
518
519
  thumbnailUrl: s,
519
- className: h
520
+ className: v
520
521
  }) => /* @__PURE__ */ x(
521
522
  "button",
522
523
  {
523
524
  type: "button",
524
525
  "aria-label": `Page ${t}`,
525
- "aria-pressed": i,
526
- onClick: (v) => {
527
- c && v.target.closest("[data-checkbox-wrapper]") || a(t);
526
+ "aria-pressed": c,
527
+ onClick: (h) => {
528
+ i && h.target.closest("[data-checkbox-wrapper]") || r(t);
528
529
  },
529
- className: Z(
530
- "flex flex-col gap-2 p-2 h-[186px] w-[120px] items-center justify-center cursor-pointer transition-colors hover:bg-layer-4 rounded-sm",
531
- i && (c ? "border border-accent-primary bg-accent-primary-alpha" : "border border-primary"),
532
- h
530
+ className: S(
531
+ "flex flex-col gap-2 p-2 h-[186px] w-[120px] items-center justify-center cursor-pointer transition-colors hover:bg-control-accent-alpha-hover rounded-sm",
532
+ c && (i ? "border border-accent bg-control-accent-alpha" : "border border-primary"),
533
+ v
533
534
  ),
534
535
  children: [
535
- /* @__PURE__ */ x("div", { className: "relative w-[104px] h-[146px] bg-model-icon rounded-sm overflow-hidden", children: [
536
+ /* @__PURE__ */ x("div", { className: "relative w-[104px] h-[146px] bg-layer-raised rounded-sm overflow-hidden", children: [
536
537
  s ? /* @__PURE__ */ e(
537
538
  "img",
538
539
  {
@@ -541,17 +542,17 @@ const re = X.map((t) => ({
541
542
  className: "w-full h-full object-cover rounded-sm"
542
543
  }
543
544
  ) : null,
544
- c && /* @__PURE__ */ e("div", { className: "absolute left-1 top-1 z-10", "data-checkbox-wrapper": !0, children: /* @__PURE__ */ e(
545
- ue,
545
+ i && /* @__PURE__ */ e("div", { className: "absolute left-1 top-1 z-10", "data-checkbox-wrapper": !0, children: /* @__PURE__ */ e(
546
+ ie,
546
547
  {
547
548
  id: `page-thumbnail-${t}`,
548
- isSelected: i,
549
- onChange: () => a(t),
549
+ isSelected: c,
550
+ onChange: () => r(t),
550
551
  "aria-label": `Select page ${t}`
551
552
  }
552
553
  ) }),
553
- o && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-blackout rounded-sm", children: /* @__PURE__ */ e(
554
- me,
554
+ o && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-backdrop rounded-sm", children: /* @__PURE__ */ e(
555
+ ue,
555
556
  {
556
557
  size: 24,
557
558
  fullWidth: !1,
@@ -565,18 +566,18 @@ const re = X.map((t) => ({
565
566
  );
566
567
  export {
567
568
  $ as AUTO_ZOOM_ID,
568
- ke as DocumentPreview,
569
- Ae as DocumentPreviewCacheProvider,
569
+ Fe as DocumentPreview,
570
+ Le as DocumentPreviewCacheProvider,
570
571
  G as FIT_ZOOM_ID,
571
- Ce as PDFViewer,
572
+ Ne as PDFViewer,
572
573
  Me as PageThumbnail,
573
- Pe as PdfPreviewLoader,
574
- Be as RotationDirection,
574
+ Ce as PdfPreviewLoader,
575
+ je as RotationDirection,
575
576
  ee as THUMBNAIL_BATCH_SIZE,
576
- ye as THUMBNAIL_IMAGE_OPTIONS,
577
+ ge as THUMBNAIL_IMAGE_OPTIONS,
577
578
  X as ZOOM_OPTIONS,
578
- De as getStepZoomOptionValue,
579
+ Ie as getStepZoomOptionValue,
579
580
  te as isPdfFile,
580
581
  _e as useDocumentPreview,
581
- Te as useDocumentPreviewCache
582
+ Pe as useDocumentPreviewCache
582
583
  };
package/dist/index.css CHANGED
@@ -1 +1 @@
1
- *,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.visible{visibility:visible}.static{position:static}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.left-1{left:.25rem}.top-1{top:.25rem}.z-10{z-index:10}.z-20{z-index:20}.mx-auto{margin-left:auto;margin-right:auto}.inline-block{display:inline-block}.flex{display:flex}.table{display:table}.hidden{display:none}.h-4{height:1rem}.h-6{height:1.5rem}.h-\[146px\]{height:146px}.h-\[186px\]{height:186px}.h-\[600px\]{height:600px}.h-\[700px\]{height:700px}.h-full{height:100%}.max-h-full{max-height:100%}.min-h-0{min-height:0}.min-h-6{min-height:1.5rem}.min-h-\[26px\]{min-height:26px}.w-64{width:16rem}.w-\[104px\]{width:104px}.w-\[120px\]{width:120px}.w-\[208px\]{width:208px}.w-\[28\%\]{width:28%}.w-\[500px\]{width:500px}.w-\[58\%\]{width:58%}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.min-w-0{min-width:0}.min-w-3{min-width:.75rem}.max-w-\[320px\]{max-width:320px}.max-w-\[40\%\]{max-width:40%}.max-w-\[520px\]{max-width:520px}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}@keyframes skeleton-wave{0%{background-position:200% 0}to{background-position:-200% 0}}.animate-skeleton-wave{animation:skeleton-wave 3.5s ease-in-out infinite}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.\!justify-start{justify-content:flex-start!important}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-10{gap:2.5rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.self-center{align-self:center}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.whitespace-pre-wrap{white-space:pre-wrap}.rounded{border-radius:4px}.rounded-\[120px\]{border-radius:120px}.rounded-sm{border-radius:.125rem}.border{border-width:1px}.border-r{border-right-width:1px}.border-accent-primary{border-color:var(--stroke-accent-primary,#7da4ff)}.border-primary{border-color:var(--stroke-primary,#696e7c)}.border-transparent{border-color:transparent}.bg-accent-primary-alpha{background-color:var(--bg-accent-primary-alpha,#7da4ff26)}.bg-blackout{background-color:var(--bg-blackout,#0c101db3)}.bg-layer-1{background-color:var(--bg-layer-1,#0c101d)}.bg-layer-2{background-color:var(--bg-layer-2,#161b2d)}.bg-layer-3{background-color:var(--bg-layer-3,#1d2439)}.bg-layer-4{background-color:var(--bg-layer-4,#242c42)}.bg-model-icon{background-color:var(--bg-model-icon,#fff)}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-layer-4{--tw-gradient-from:var(--bg-layer-4,#242c42) var(--tw-gradient-from-position);--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.via-layer-3{--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--bg-layer-3,#1d2439) var(--tw-gradient-via-position),var(--tw-gradient-to)}.to-layer-4{--tw-gradient-to:var(--bg-layer-4,#242c42) var(--tw-gradient-to-position)}.bg-\[length\:200\%_100\%\]{background-size:200% 100%}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-10{padding:2.5rem}.p-2{padding:.5rem}.p-4{padding:1rem}.\!py-0{padding-top:0!important;padding-bottom:0!important}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-\[60px\]{padding-left:60px;padding-right:60px}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.pl-0\.5{padding-left:.125rem}.pt-10{padding-top:2.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.text-xs{font-size:.75rem;line-height:1rem}.uppercase{text-transform:uppercase}.tracking-wide{letter-spacing:.025em}.text-accent-primary{color:var(--text-accent-primary,#7da4ff)}.text-primary{color:var(--text-primary,#eef1f7)}.text-secondary{color:var(--text-secondary,#9fa6bd)}.outline{outline-style:solid}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.hover\:border-hover:hover{border-color:var(--stroke-hover,#eef1f7)}.hover\:bg-layer-4:hover{background-color:var(--bg-layer-4,#242c42)}
1
+ *,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:769px){.container{max-width:769px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.visible{visibility:visible}.static{position:static}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.left-1{left:.25rem}.top-1{top:.25rem}.z-10{z-index:10}.z-20{z-index:20}.mx-auto{margin-left:auto;margin-right:auto}.inline-block{display:inline-block}.flex{display:flex}.table{display:table}.hidden{display:none}.h-4{height:1rem}.h-6{height:1.5rem}.h-\[146px\]{height:146px}.h-\[186px\]{height:186px}.h-\[600px\]{height:600px}.h-\[700px\]{height:700px}.h-full{height:100%}.max-h-full{max-height:100%}.min-h-0{min-height:0}.min-h-6{min-height:1.5rem}.min-h-\[26px\]{min-height:26px}.w-64{width:16rem}.w-\[104px\]{width:104px}.w-\[120px\]{width:120px}.w-\[208px\]{width:208px}.w-\[28\%\]{width:28%}.w-\[500px\]{width:500px}.w-\[58\%\]{width:58%}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.min-w-0{min-width:0}.min-w-3{min-width:.75rem}.max-w-\[320px\]{max-width:320px}.max-w-\[40\%\]{max-width:40%}.max-w-\[520px\]{max-width:520px}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}@keyframes skeleton-wave{0%{background-position:200% 0}to{background-position:-200% 0}}.animate-skeleton-wave{animation:skeleton-wave 3.5s ease-in-out infinite}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.\!justify-start{justify-content:flex-start!important}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-10{gap:2.5rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.self-center{align-self:center}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.whitespace-pre-wrap{white-space:pre-wrap}.rounded{border-radius:4px}.rounded-\[120px\]{border-radius:120px}.rounded-sm{border-radius:.125rem}.border{border-width:1px}.border-r{border-right-width:1px}.border-accent{border-color:var(--stroke-accent,#1d4ed8)}.border-primary{border-color:var(--stroke-primary,#57647a)}.border-tertiary{border-color:var(--stroke-tertiary,#e0e6f0)}.border-transparent{border-color:transparent}.bg-backdrop{background-color:var(--bg-backdrop,#161b2d4d)}.bg-control-accent-alpha{background-color:var(--bg-control-accent-alpha,#2764d90f)}.bg-control-neutral{background-color:var(--bg-control-neutral,#fcfcfc)}.bg-layer-base{background-color:var(--bg-layer-base,#f5f7fa)}.bg-layer-raised{background-color:var(--bg-layer-raised,#fcfcfc)}.bg-layer-sunken{background-color:var(--bg-layer-sunken,#eef1f7)}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-layer-sunken{--tw-gradient-from:var(--bg-layer-sunken,#eef1f7) var(--tw-gradient-from-position);--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.via-layer-raised{--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--bg-layer-raised,#fcfcfc) var(--tw-gradient-via-position),var(--tw-gradient-to)}.to-layer-sunken{--tw-gradient-to:var(--bg-layer-sunken,#eef1f7) var(--tw-gradient-to-position)}.bg-\[length\:200\%_100\%\]{background-size:200% 100%}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-10{padding:2.5rem}.p-2{padding:.5rem}.p-4{padding:1rem}.\!py-0{padding-top:0!important;padding-bottom:0!important}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-\[60px\]{padding-left:60px;padding-right:60px}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.pl-0\.5{padding-left:.125rem}.pt-10{padding-top:2.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.text-xs{font-size:.75rem;line-height:1rem}.uppercase{text-transform:uppercase}.tracking-wide{letter-spacing:.025em}.text-accent{color:var(--text-accent,#1d4ed8)}.text-primary{color:var(--text-primary,#161b2d)}.text-secondary{color:var(--text-secondary,#57647a)}.outline{outline-style:solid;outline-width:1px}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.hover\:border-accent-alpha:hover{border-color:var(--stroke-accent-alpha,#2764d933)}.hover\:bg-control-accent-alpha-hover:hover{background-color:var(--bg-control-accent-alpha-hover,#2764d924)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-react-pdf-highlighter",
3
- "version": "0.2.0-dev.27",
3
+ "version": "0.2.0-dev.29",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "React components for PDF viewing and highlighting, built on @epam/pdf-highlighter-kit",