@pdf-viewer/react 0.4.0-beta.1

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.
Files changed (306) hide show
  1. package/README.md +3 -0
  2. package/dist/Container.module-cb7b45b9.js +14 -0
  3. package/dist/RPSplitter.module-13d612c4.js +7 -0
  4. package/dist/RPTheme.module-f756e5cd.js +7 -0
  5. package/dist/Thumbnails-06fa1aa5.js +2657 -0
  6. package/dist/WrapperLayout.module-147bc943.js +6 -0
  7. package/dist/assets/Button.css +1 -0
  8. package/dist/assets/Checkbox.css +1 -0
  9. package/dist/assets/Container.css +1 -0
  10. package/dist/assets/DropDown.css +1 -0
  11. package/dist/assets/Input.css +1 -0
  12. package/dist/assets/LoaderIcon.css +1 -0
  13. package/dist/assets/MenuItem.css +1 -0
  14. package/dist/assets/MenuSeparator.css +1 -0
  15. package/dist/assets/PropertyItem.css +1 -0
  16. package/dist/assets/RPSplitter.css +1 -0
  17. package/dist/assets/RPTheme.css +1 -0
  18. package/dist/assets/RotateTool.css +1 -0
  19. package/dist/assets/Thumbnails.css +1 -0
  20. package/dist/assets/WrapperLayout.css +1 -0
  21. package/dist/clsx-0c6e471a.js +22 -0
  22. package/dist/components/RPConfig.js +1347 -0
  23. package/dist/components/RPController.js +49 -0
  24. package/dist/components/RPDocument.js +9 -0
  25. package/dist/components/RPDropFileZone.js +33 -0
  26. package/dist/components/RPTheme.js +21 -0
  27. package/dist/components/RPViewer.js +37 -0
  28. package/dist/components/icons/CheckIcon.js +22 -0
  29. package/dist/components/icons/ChevronUpIcon.js +22 -0
  30. package/dist/components/icons/ClearIcon.js +25 -0
  31. package/dist/components/icons/ClockwiseIcon.js +22 -0
  32. package/dist/components/icons/CloseIcon.js +22 -0
  33. package/dist/components/icons/DarkPdfIcon.js +15 -0
  34. package/dist/components/icons/DualPageIcon.js +22 -0
  35. package/dist/components/icons/FileDownloadDefaultIcon.js +23 -0
  36. package/dist/components/icons/FileUploadDefaultIcon.js +23 -0
  37. package/dist/components/icons/FullScreenIcon.js +22 -0
  38. package/dist/components/icons/GoToDownIcon.js +22 -0
  39. package/dist/components/icons/HandModeDefaultIcon.js +22 -0
  40. package/dist/components/icons/HorizontalScrollingIcon.js +24 -0
  41. package/dist/components/icons/InfoIcon.js +22 -0
  42. package/dist/components/icons/LightPdfIcon.js +15 -0
  43. package/dist/components/icons/LoaderIcon.js +17 -0
  44. package/dist/components/icons/MoonIcon.js +22 -0
  45. package/dist/components/icons/PageScrollingIcon.js +24 -0
  46. package/dist/components/icons/PrintDefaultIcon.js +23 -0
  47. package/dist/components/icons/SearchIcon.js +22 -0
  48. package/dist/components/icons/SinglePageIcon.js +22 -0
  49. package/dist/components/icons/SunIcon.js +25 -0
  50. package/dist/components/icons/TextSelectionDefaultIcon.js +23 -0
  51. package/dist/components/icons/ThreeDotIcon.js +22 -0
  52. package/dist/components/icons/Thumbnail.js +54 -0
  53. package/dist/components/icons/VerticalScrollingIcon.js +24 -0
  54. package/dist/components/icons/WrappedScrollingIcon.js +24 -0
  55. package/dist/components/icons/ZoomInIcon.js +22 -0
  56. package/dist/components/icons/ZoomOutIcon.js +22 -0
  57. package/dist/components/layout/Container.js +28 -0
  58. package/dist/components/layout/RPLayout.js +59 -0
  59. package/dist/components/layout/WrapperLayout.js +11 -0
  60. package/dist/components/layout/sidebar/RPSidebar.js +34 -0
  61. package/dist/components/layout/sidebar/RPSplitter.js +10 -0
  62. package/dist/components/layout/sidebar/Thumbnail.js +8 -0
  63. package/dist/components/layout/sidebar/Thumbnails.js +7 -0
  64. package/dist/components/layout/toolbar/DarkModeTool.js +23 -0
  65. package/dist/components/layout/toolbar/DocumentDialog.js +36 -0
  66. package/dist/components/layout/toolbar/DocumentProperties.js +19 -0
  67. package/dist/components/layout/toolbar/FileDownloadTool.js +11 -0
  68. package/dist/components/layout/toolbar/FileUploadTool.js +21 -0
  69. package/dist/components/layout/toolbar/FullScreenTool.js +46 -0
  70. package/dist/components/layout/toolbar/MenuItem.js +12 -0
  71. package/dist/components/layout/toolbar/MenuSeparator.js +8 -0
  72. package/dist/components/layout/toolbar/MostPageTool.js +36 -0
  73. package/dist/components/layout/toolbar/OtherTool.js +21 -0
  74. package/dist/components/layout/toolbar/Paginate.js +12 -0
  75. package/dist/components/layout/toolbar/PrintTool.js +11 -0
  76. package/dist/components/layout/toolbar/PropertyItem.js +12 -0
  77. package/dist/components/layout/toolbar/RPToolbar.js +8 -0
  78. package/dist/components/layout/toolbar/RPToolbarEnd.js +9 -0
  79. package/dist/components/layout/toolbar/RotateTool.js +33 -0
  80. package/dist/components/layout/toolbar/ScrollModeTool.js +54 -0
  81. package/dist/components/layout/toolbar/SearchTool.js +40 -0
  82. package/dist/components/layout/toolbar/SelectionModeTool.js +36 -0
  83. package/dist/components/layout/toolbar/ViewModeTool.js +31 -0
  84. package/dist/components/layout/toolbar/ZoomTool.js +41 -0
  85. package/dist/components/page/AnnotationLayer.js +37 -0
  86. package/dist/components/page/CanvasLayer.js +33 -0
  87. package/dist/components/page/DualPage.js +6 -0
  88. package/dist/components/page/RPPage.js +33 -0
  89. package/dist/components/page/SinglePage.js +6 -0
  90. package/dist/components/page/TextLayer.js +34 -0
  91. package/dist/components/ui/Button.js +22 -0
  92. package/dist/components/ui/Checkbox.js +301 -0
  93. package/dist/components/ui/DropDown.js +29 -0
  94. package/dist/components/ui/Input.js +26 -0
  95. package/dist/components/ui/LoadingIndicator.js +6 -0
  96. package/dist/contexts/ConfigContext.js +13 -0
  97. package/dist/contexts/DarkModeContext.js +28 -0
  98. package/dist/contexts/DropFileZoneContext.js +50 -0
  99. package/dist/contexts/FileInputContext.js +38 -0
  100. package/dist/contexts/FullScreenContext.js +18 -0
  101. package/dist/contexts/IconContext.js +11 -0
  102. package/dist/contexts/InitialStateContext.js +11 -0
  103. package/dist/contexts/LayerContext.js +8 -0
  104. package/dist/contexts/LayoutContainerContext.js +10 -0
  105. package/dist/contexts/LicenseContext.js +15 -0
  106. package/dist/contexts/OtherToolContext.js +18 -0
  107. package/dist/contexts/PageViewportContext.js +8 -0
  108. package/dist/contexts/PaginateContext.js +11 -0
  109. package/dist/contexts/PrintContext.js +8 -0
  110. package/dist/contexts/RPDocumentContext.js +49 -0
  111. package/dist/contexts/RenderedPagesCache.js +14 -0
  112. package/dist/contexts/RotateContext.js +23 -0
  113. package/dist/contexts/ScrollModeContext.js +21 -0
  114. package/dist/contexts/ScrollStateContext.js +13 -0
  115. package/dist/contexts/SearchContext.js +8 -0
  116. package/dist/contexts/SelectionModeContext.js +23 -0
  117. package/dist/contexts/ThemeContext.js +7 -0
  118. package/dist/contexts/ThumbnailsContext.js +8 -0
  119. package/dist/contexts/ToolbarComponentContext.js +41 -0
  120. package/dist/contexts/ViewModeContext.js +28 -0
  121. package/dist/contexts/ViewportContext.js +62 -0
  122. package/dist/contexts/VirtualGridContext.js +15 -0
  123. package/dist/contexts/VirtualScrollContext.js +53 -0
  124. package/dist/contexts/ZoomContext.js +46 -0
  125. package/dist/index-3459164c.js +3609 -0
  126. package/dist/index-743c36f0.js +139 -0
  127. package/dist/main.js +37 -0
  128. package/dist/types/components/RPConfig.d.ts +3 -0
  129. package/dist/types/components/RPController.d.ts +3 -0
  130. package/dist/types/components/RPDocument.d.ts +3 -0
  131. package/dist/types/components/RPDropFileZone.d.ts +2 -0
  132. package/dist/types/components/RPTheme.d.ts +3 -0
  133. package/dist/types/components/RPViewer.d.ts +2 -0
  134. package/dist/types/components/icons/CheckIcon.d.ts +2 -0
  135. package/dist/types/components/icons/ChevronUpIcon.d.ts +2 -0
  136. package/dist/types/components/icons/ClearIcon.d.ts +2 -0
  137. package/dist/types/components/icons/ClockwiseIcon.d.ts +2 -0
  138. package/dist/types/components/icons/CloseIcon.d.ts +2 -0
  139. package/dist/types/components/icons/DarkPdfIcon.d.ts +2 -0
  140. package/dist/types/components/icons/DualPageIcon.d.ts +2 -0
  141. package/dist/types/components/icons/FileDownloadDefaultIcon.d.ts +2 -0
  142. package/dist/types/components/icons/FileUploadDefaultIcon.d.ts +2 -0
  143. package/dist/types/components/icons/FullScreenIcon.d.ts +2 -0
  144. package/dist/types/components/icons/GoToDownIcon.d.ts +2 -0
  145. package/dist/types/components/icons/HandModeDefaultIcon.d.ts +2 -0
  146. package/dist/types/components/icons/HorizontalScrollingIcon.d.ts +2 -0
  147. package/dist/types/components/icons/InfoIcon.d.ts +2 -0
  148. package/dist/types/components/icons/LightPdfIcon.d.ts +2 -0
  149. package/dist/types/components/icons/LoaderIcon.d.ts +2 -0
  150. package/dist/types/components/icons/MoonIcon.d.ts +2 -0
  151. package/dist/types/components/icons/PageScrollingIcon.d.ts +2 -0
  152. package/dist/types/components/icons/PrintDefaultIcon.d.ts +2 -0
  153. package/dist/types/components/icons/SearchIcon.d.ts +2 -0
  154. package/dist/types/components/icons/SinglePageIcon.d.ts +2 -0
  155. package/dist/types/components/icons/SunIcon.d.ts +2 -0
  156. package/dist/types/components/icons/TextSelectionDefaultIcon.d.ts +2 -0
  157. package/dist/types/components/icons/ThreeDotIcon.d.ts +2 -0
  158. package/dist/types/components/icons/Thumbnail.d.ts +2 -0
  159. package/dist/types/components/icons/VerticalScrollingIcon.d.ts +2 -0
  160. package/dist/types/components/icons/WrappedScrollingIcon.d.ts +2 -0
  161. package/dist/types/components/icons/ZoomInIcon.d.ts +2 -0
  162. package/dist/types/components/icons/ZoomOutIcon.d.ts +2 -0
  163. package/dist/types/components/layout/Container.d.ts +9 -0
  164. package/dist/types/components/layout/RPLayout.d.ts +3 -0
  165. package/dist/types/components/layout/WrapperLayout.d.ts +2 -0
  166. package/dist/types/components/layout/sidebar/RPSidebar.d.ts +1 -0
  167. package/dist/types/components/layout/sidebar/RPSplitter.d.ts +7 -0
  168. package/dist/types/components/layout/sidebar/Thumbnail.d.ts +11 -0
  169. package/dist/types/components/layout/sidebar/Thumbnails.d.ts +5 -0
  170. package/dist/types/components/layout/toolbar/DarkModeTool.d.ts +1 -0
  171. package/dist/types/components/layout/toolbar/DocumentDialog.d.ts +2 -0
  172. package/dist/types/components/layout/toolbar/DocumentProperties.d.ts +1 -0
  173. package/dist/types/components/layout/toolbar/FileDownloadTool.d.ts +2 -0
  174. package/dist/types/components/layout/toolbar/FileUploadTool.d.ts +2 -0
  175. package/dist/types/components/layout/toolbar/FullScreenTool.d.ts +1 -0
  176. package/dist/types/components/layout/toolbar/MenuItem.d.ts +6 -0
  177. package/dist/types/components/layout/toolbar/MenuSeparator.d.ts +1 -0
  178. package/dist/types/components/layout/toolbar/MostPageTool.d.ts +1 -0
  179. package/dist/types/components/layout/toolbar/OtherTool.d.ts +1 -0
  180. package/dist/types/components/layout/toolbar/Paginate.d.ts +1 -0
  181. package/dist/types/components/layout/toolbar/PrintTool.d.ts +1 -0
  182. package/dist/types/components/layout/toolbar/PropertyItem.d.ts +7 -0
  183. package/dist/types/components/layout/toolbar/RPToolbar.d.ts +1 -0
  184. package/dist/types/components/layout/toolbar/RPToolbarEnd.d.ts +1 -0
  185. package/dist/types/components/layout/toolbar/RotateTool.d.ts +1 -0
  186. package/dist/types/components/layout/toolbar/ScrollModeTool.d.ts +1 -0
  187. package/dist/types/components/layout/toolbar/SearchTool.d.ts +2 -0
  188. package/dist/types/components/layout/toolbar/SelectionModeTool.d.ts +1 -0
  189. package/dist/types/components/layout/toolbar/ViewModeTool.d.ts +1 -0
  190. package/dist/types/components/layout/toolbar/ZoomTool.d.ts +1 -0
  191. package/dist/types/components/page/AnnotationLayer.d.ts +6 -0
  192. package/dist/types/components/page/CanvasLayer.d.ts +8 -0
  193. package/dist/types/components/page/DualPage.d.ts +5 -0
  194. package/dist/types/components/page/RPPage.d.ts +6 -0
  195. package/dist/types/components/page/SinglePage.d.ts +5 -0
  196. package/dist/types/components/page/TextLayer.d.ts +6 -0
  197. package/dist/types/components/ui/Button.d.ts +6 -0
  198. package/dist/types/components/ui/Checkbox.d.ts +8 -0
  199. package/dist/types/components/ui/DropDown.d.ts +9 -0
  200. package/dist/types/components/ui/Input.d.ts +6 -0
  201. package/dist/types/components/ui/LoadingIndicator.d.ts +6 -0
  202. package/dist/types/contexts/ConfigContext.d.ts +5 -0
  203. package/dist/types/contexts/DarkModeContext.d.ts +5 -0
  204. package/dist/types/contexts/DropFileZoneContext.d.ts +5 -0
  205. package/dist/types/contexts/FileInputContext.d.ts +7 -0
  206. package/dist/types/contexts/FullScreenContext.d.ts +7 -0
  207. package/dist/types/contexts/IconContext.d.ts +7 -0
  208. package/dist/types/contexts/InitialStateContext.d.ts +5 -0
  209. package/dist/types/contexts/LayerContext.d.ts +5 -0
  210. package/dist/types/contexts/LayoutContainerContext.d.ts +8 -0
  211. package/dist/types/contexts/LicenseContext.d.ts +7 -0
  212. package/dist/types/contexts/OtherToolContext.d.ts +9 -0
  213. package/dist/types/contexts/PageViewportContext.d.ts +4 -0
  214. package/dist/types/contexts/PaginateContext.d.ts +5 -0
  215. package/dist/types/contexts/PrintContext.d.ts +7 -0
  216. package/dist/types/contexts/RPDocumentContext.d.ts +10 -0
  217. package/dist/types/contexts/RenderedPagesCache.d.ts +10 -0
  218. package/dist/types/contexts/RotateContext.d.ts +5 -0
  219. package/dist/types/contexts/ScrollModeContext.d.ts +5 -0
  220. package/dist/types/contexts/ScrollStateContext.d.ts +8 -0
  221. package/dist/types/contexts/SearchContext.d.ts +7 -0
  222. package/dist/types/contexts/SelectionModeContext.d.ts +5 -0
  223. package/dist/types/contexts/ThemeContext.d.ts +4 -0
  224. package/dist/types/contexts/ThumbnailsContext.d.ts +7 -0
  225. package/dist/types/contexts/ToolbarComponentContext.d.ts +9 -0
  226. package/dist/types/contexts/ViewModeContext.d.ts +5 -0
  227. package/dist/types/contexts/ViewportContext.d.ts +28 -0
  228. package/dist/types/contexts/VirtualGridContext.d.ts +9 -0
  229. package/dist/types/contexts/VirtualScrollContext.d.ts +30 -0
  230. package/dist/types/contexts/ZoomContext.d.ts +5 -0
  231. package/dist/types/main.d.ts +20 -0
  232. package/dist/types/utils/appConsole.d.ts +24 -0
  233. package/dist/types/utils/charators.d.ts +12 -0
  234. package/dist/types/utils/constants.d.ts +2 -0
  235. package/dist/types/utils/convertPdfDate.d.ts +1 -0
  236. package/dist/types/utils/dateFormatter.d.ts +1 -0
  237. package/dist/types/utils/formatFileSize.d.ts +1 -0
  238. package/dist/types/utils/getThumbnailViewport.d.ts +5 -0
  239. package/dist/types/utils/getZoomLevel.d.ts +2 -0
  240. package/dist/types/utils/highlight.d.ts +8 -0
  241. package/dist/types/utils/hooks/useDarkMode.d.ts +2 -0
  242. package/dist/types/utils/hooks/useDarkModeProps.d.ts +2 -0
  243. package/dist/types/utils/hooks/useDebounce.d.ts +1 -0
  244. package/dist/types/utils/hooks/useElementSize.d.ts +8 -0
  245. package/dist/types/utils/hooks/useFileDownload.d.ts +3 -0
  246. package/dist/types/utils/hooks/useFullScreen.d.ts +6 -0
  247. package/dist/types/utils/hooks/useGrabScroll.d.ts +10 -0
  248. package/dist/types/utils/hooks/useInfiniteScroll.d.ts +6 -0
  249. package/dist/types/utils/hooks/useLicense.d.ts +2 -0
  250. package/dist/types/utils/hooks/useLoadPdf.d.ts +7 -0
  251. package/dist/types/utils/hooks/useLoadWorker.d.ts +3 -0
  252. package/dist/types/utils/hooks/useMousePressed.d.ts +7 -0
  253. package/dist/types/utils/hooks/usePageDimension.d.ts +4 -0
  254. package/dist/types/utils/hooks/usePaginate.d.ts +2 -0
  255. package/dist/types/utils/hooks/usePdfProperties.d.ts +9 -0
  256. package/dist/types/utils/hooks/usePrint.d.ts +11 -0
  257. package/dist/types/utils/hooks/useRequestAnimationFrame.d.ts +5 -0
  258. package/dist/types/utils/hooks/useResizeObserver.d.ts +6 -0
  259. package/dist/types/utils/hooks/useRotate.d.ts +4 -0
  260. package/dist/types/utils/hooks/useScrollToPage.d.ts +4 -0
  261. package/dist/types/utils/hooks/useSearch.d.ts +14 -0
  262. package/dist/types/utils/hooks/useThumbnail.d.ts +7 -0
  263. package/dist/types/utils/hooks/useVirtualReactWindow.d.ts +12 -0
  264. package/dist/types/utils/hooks/useWatermark.d.ts +4 -0
  265. package/dist/types/utils/link_service.d.ts +71 -0
  266. package/dist/types/utils/renderPage.d.ts +2 -0
  267. package/dist/types/utils/sanitizeExternalUrl.d.ts +1 -0
  268. package/dist/types/utils/types.d.ts +562 -0
  269. package/dist/utils/appConsole.js +42 -0
  270. package/dist/utils/charators.js +48 -0
  271. package/dist/utils/constants.js +5 -0
  272. package/dist/utils/convertPdfDate.js +25 -0
  273. package/dist/utils/dateFormatter.js +7 -0
  274. package/dist/utils/formatFileSize.js +9 -0
  275. package/dist/utils/getThumbnailViewport.js +7 -0
  276. package/dist/utils/getZoomLevel.js +18 -0
  277. package/dist/utils/highlight.js +145 -0
  278. package/dist/utils/hooks/useDarkMode.js +11 -0
  279. package/dist/utils/hooks/useDarkModeProps.js +12 -0
  280. package/dist/utils/hooks/useDebounce.js +15 -0
  281. package/dist/utils/hooks/useElementSize.js +21 -0
  282. package/dist/utils/hooks/useFileDownload.js +32 -0
  283. package/dist/utils/hooks/useFullScreen.js +29 -0
  284. package/dist/utils/hooks/useGrabScroll.js +45 -0
  285. package/dist/utils/hooks/useInfiniteScroll.js +19 -0
  286. package/dist/utils/hooks/useLicense.js +102 -0
  287. package/dist/utils/hooks/useLoadPdf.js +50 -0
  288. package/dist/utils/hooks/useLoadWorker.js +13 -0
  289. package/dist/utils/hooks/useMousePressed.js +20 -0
  290. package/dist/utils/hooks/usePageDimension.js +24 -0
  291. package/dist/utils/hooks/usePaginate.js +33 -0
  292. package/dist/utils/hooks/usePdfProperties.js +40 -0
  293. package/dist/utils/hooks/usePrint.js +33 -0
  294. package/dist/utils/hooks/useRequestAnimationFrame.js +17 -0
  295. package/dist/utils/hooks/useResizeObserver.js +22 -0
  296. package/dist/utils/hooks/useRotate.js +13 -0
  297. package/dist/utils/hooks/useScrollToPage.js +34 -0
  298. package/dist/utils/hooks/useSearch.js +33 -0
  299. package/dist/utils/hooks/useThumbnail.js +34 -0
  300. package/dist/utils/hooks/useVirtualReactWindow.js +34 -0
  301. package/dist/utils/hooks/useWatermark.js +62 -0
  302. package/dist/utils/link_service.js +98 -0
  303. package/dist/utils/renderPage.js +15 -0
  304. package/dist/utils/sanitizeExternalUrl.js +16 -0
  305. package/dist/utils/types.js +10 -0
  306. package/package.json +90 -0
@@ -0,0 +1,18 @@
1
+ import { ZoomLevel as m } from "./types.js";
2
+ const Z = (o, r, s, e, t) => {
3
+ if (typeof o == "number")
4
+ return o;
5
+ switch (o) {
6
+ case m.ACTUAL:
7
+ return 100;
8
+ case m.PAGE_FIT:
9
+ let n = 0;
10
+ const f = r > s;
11
+ return t > e && f ? n = s / t : n = r / e, Math.floor(n * 100);
12
+ case m.PAGE_WIDTH:
13
+ return Math.floor(r / e * 100);
14
+ }
15
+ };
16
+ export {
17
+ Z as getZoomLevel
18
+ };
@@ -0,0 +1,145 @@
1
+ import { getCharacterType as E } from "./charators.js";
2
+ function I(r, o, d, s) {
3
+ const e = [];
4
+ for (const t of r) {
5
+ const i = M(o, t, s);
6
+ e.push(...w(i, o, d));
7
+ }
8
+ return e;
9
+ }
10
+ const C = (r, o) => {
11
+ const d = ["g"];
12
+ o.matchCase || d.push("i");
13
+ let e = r.replace(/[.^$*+?()[{|\\]/g, (t) => `\\${t}`).trim();
14
+ return new RegExp(e, d.join(""));
15
+ };
16
+ function M(r, o, d) {
17
+ const s = [];
18
+ for (const c of r.items)
19
+ if (c.hasEOL)
20
+ if (c.str.endsWith("-")) {
21
+ const h = c.str.lastIndexOf("-");
22
+ s.push(c.str.substring(0, h));
23
+ } else
24
+ s.push(c.str, `
25
+ `);
26
+ else
27
+ s.push(c.str);
28
+ const e = s.join("").replace(/\n/g, " ");
29
+ let t;
30
+ o instanceof RegExp ? t = o.flags.indexOf("g") === -1 ? new RegExp(o, `${o.flags}g`) : o : t = C(o, d);
31
+ const i = [];
32
+ let n;
33
+ for (; (n = t.exec(e)) !== null; )
34
+ d.wholeWords && !R(e, n.index, n[0].length) || i.push([n.index, n[0].length, n[0]]);
35
+ return i;
36
+ }
37
+ function w(r, o, d) {
38
+ function s(h) {
39
+ return h.hasEOL ? h.str.endsWith("-") ? -1 : 1 : 0;
40
+ }
41
+ let e = 0, t = 0;
42
+ const i = o.items, n = i.length - 1, c = [];
43
+ for (let h = 0; h < r.length; h++) {
44
+ let a = r[h][0];
45
+ for (; e !== n && a >= t + i[e].str.length; ) {
46
+ const p = i[e];
47
+ t += p.str.length + s(p), e++;
48
+ }
49
+ const g = {
50
+ idx: e,
51
+ offset: a - t
52
+ };
53
+ for (a += r[h][1]; e !== n && a > t + i[e].str.length; ) {
54
+ const p = i[e];
55
+ t += p.str.length + s(p), e++;
56
+ }
57
+ const f = {
58
+ idx: e,
59
+ offset: a - t
60
+ };
61
+ c.push({
62
+ start: g,
63
+ end: f,
64
+ str: r[h][2],
65
+ oIndex: r[h][0],
66
+ pageIndex: d
67
+ });
68
+ }
69
+ return c;
70
+ }
71
+ function R(r, o, d) {
72
+ let s = r.slice(0, o).match(/([^\p{M}])\p{M}*$/u);
73
+ if (s) {
74
+ const e = r.charCodeAt(o), t = s[1].charCodeAt(0);
75
+ if (E(e) === E(t))
76
+ return !1;
77
+ }
78
+ if (s = r.slice(o + d).match(/^\p{M}*([^\p{M}])/u), s) {
79
+ const e = r.charCodeAt(o + d - 1), t = s[1].charCodeAt(0);
80
+ if (E(e) === E(t))
81
+ return !1;
82
+ }
83
+ return !0;
84
+ }
85
+ function $(r, o, d) {
86
+ const s = [];
87
+ function e(t, i, n = -1, c = -1, h = "") {
88
+ const a = o.items[t], g = [];
89
+ let f = "", p = "", v = "", u = d[t];
90
+ if (!u)
91
+ return;
92
+ if (u.nodeType === Node.TEXT_NODE) {
93
+ const l = document.createElement("span");
94
+ u.before(l), l.append(u), d[t] = l, u = l;
95
+ }
96
+ n >= 0 && c >= 0 ? f = a.str.substring(n, c) : n < 0 && c < 0 ? f = a.str : n >= 0 ? f = a.str.substring(n) : c >= 0 && (f = a.str.substring(0, c));
97
+ const b = document.createTextNode(f), m = document.createElement("span");
98
+ if (m.className = "highlight appended " + h, m.setAttribute("data-match-index", `${i}`), m.append(b), g.push(m), s.push({ element: m, index: i }), n > 0)
99
+ if (u.childNodes.length === 1 && u.childNodes[0].nodeType === Node.TEXT_NODE) {
100
+ p = a.str.substring(0, n);
101
+ const l = document.createTextNode(p);
102
+ g.unshift(l);
103
+ } else {
104
+ let l = 0;
105
+ const T = [];
106
+ for (const x of u.childNodes) {
107
+ const N = x.nodeType === Node.TEXT_NODE ? x.nodeValue : x.firstChild.nodeValue;
108
+ l += N.length, l <= n ? T.push(x) : n >= l - N.length && c <= l && T.push(
109
+ document.createTextNode(
110
+ N.substring(0, n - (l - N.length))
111
+ )
112
+ );
113
+ }
114
+ g.unshift(...T);
115
+ }
116
+ if (c > 0) {
117
+ v = a.str.substring(c);
118
+ const l = document.createTextNode(v);
119
+ g.push(l);
120
+ }
121
+ u.replaceChildren(...g);
122
+ }
123
+ for (const [t, i] of r.entries())
124
+ if (i.start.idx === i.end.idx)
125
+ e(i.start.idx, t, i.start.offset, i.end.offset);
126
+ else
127
+ for (let n = i.start.idx, c = i.end.idx; n <= c; n++)
128
+ n === i.start.idx ? e(n, t, i.start.offset, -1, "begin") : n === i.end.idx ? e(n, t, -1, i.end.offset, "end") : e(n, t, -1, -1, "middle");
129
+ return s;
130
+ }
131
+ function y(r, o) {
132
+ const d = r.items.map((s) => s.str);
133
+ for (let s = 0; s < o.length; s++) {
134
+ const e = o[s];
135
+ if (e && e.nodeType !== Node.TEXT_NODE) {
136
+ const t = document.createTextNode(d[s]);
137
+ e.replaceChildren(t);
138
+ }
139
+ }
140
+ }
141
+ export {
142
+ I as findMatches,
143
+ $ as highlightMatches,
144
+ y as resetDivs
145
+ };
@@ -0,0 +1,11 @@
1
+ import { useState as t } from "react";
2
+ const a = (e = !1) => {
3
+ const [o, r] = t(e);
4
+ return {
5
+ darkMode: o,
6
+ setDarkMode: r
7
+ };
8
+ };
9
+ export {
10
+ a as useDarkMode
11
+ };
@@ -0,0 +1,12 @@
1
+ import { useDarkMode as r } from "./useDarkMode.js";
2
+ const d = () => {
3
+ const { darkMode: e, setDarkMode: o } = r();
4
+ return {
5
+ darkMode: e,
6
+ onDarkModeChange: o,
7
+ setDarkMode: o
8
+ };
9
+ };
10
+ export {
11
+ d as useDarkModeProps
12
+ };
@@ -0,0 +1,15 @@
1
+ import { useState as r, useEffect as c } from "react";
2
+ function f(e, t) {
3
+ const [o, u] = r(e);
4
+ return c(() => {
5
+ const n = setTimeout(() => {
6
+ u(e);
7
+ }, t);
8
+ return () => {
9
+ clearTimeout(n);
10
+ };
11
+ }, [e, t]), o;
12
+ }
13
+ export {
14
+ f as useDebounce
15
+ };
@@ -0,0 +1,21 @@
1
+ import { useState as a } from "react";
2
+ import d from "./useResizeObserver.js";
3
+ const S = (c) => {
4
+ const [h, u] = a({ width: 0, height: 0 });
5
+ return d(c, (z) => {
6
+ const e = z[0];
7
+ if (e) {
8
+ const t = e.contentBoxSize;
9
+ let i = 0, o = 0;
10
+ if (t) {
11
+ const n = Array.isArray(t) ? t : [t];
12
+ i = n.reduce((r, { inlineSize: s }) => r + s, 0), o = n.reduce((r, { blockSize: s }) => r + s, 0);
13
+ } else
14
+ i = e.contentRect.width, o = e.contentRect.height;
15
+ u({ width: i, height: o });
16
+ }
17
+ }), { size: h };
18
+ };
19
+ export {
20
+ S as default
21
+ };
@@ -0,0 +1,32 @@
1
+ import "react/jsx-runtime";
2
+ import "../../contexts/RPDocumentContext.js";
3
+ import { a as C } from "../../Thumbnails-06fa1aa5.js";
4
+ import "../../components/RPConfig.js";
5
+ import "react";
6
+ import "../../components/ui/Button.js";
7
+ import "../../RPSplitter.module-13d612c4.js";
8
+ import "../../contexts/ToolbarComponentContext.js";
9
+ import "../../contexts/IconContext.js";
10
+ import "../../Container.module-cb7b45b9.js";
11
+ import "../../contexts/LayoutContainerContext.js";
12
+ import "../../contexts/DarkModeContext.js";
13
+ import "../../contexts/RotateContext.js";
14
+ import "../../contexts/LayerContext.js";
15
+ import "../../contexts/ZoomContext.js";
16
+ import "../../contexts/ViewModeContext.js";
17
+ import "../../contexts/ScrollModeContext.js";
18
+ import "../../contexts/VirtualScrollContext.js";
19
+ import "../../contexts/VirtualGridContext.js";
20
+ import "../../contexts/ScrollStateContext.js";
21
+ import "../../contexts/ViewportContext.js";
22
+ import "../../contexts/SelectionModeContext.js";
23
+ import "../../contexts/InitialStateContext.js";
24
+ import "../../contexts/ThemeContext.js";
25
+ import "../../contexts/FullScreenContext.js";
26
+ import "../../WrapperLayout.module-147bc943.js";
27
+ import "../../contexts/DropFileZoneContext.js";
28
+ import "../../RPTheme.module-f756e5cd.js";
29
+ import "../../contexts/FileInputContext.js";
30
+ export {
31
+ C as useFileDownload
32
+ };
@@ -0,0 +1,29 @@
1
+ import { useState as s, useCallback as n, useEffect as a } from "react";
2
+ const m = () => {
3
+ const [t, r] = s(!1), l = typeof document < "u" && (document.fullscreenEnabled || document.webkitFullscreenEnabled), c = n(async (e) => {
4
+ if (!document.fullscreenElement)
5
+ try {
6
+ await e.requestFullscreen();
7
+ } catch (o) {
8
+ console.error("Error attempting to enter fullscreen:", o);
9
+ }
10
+ }, []), u = n(async () => {
11
+ if (document.fullscreenElement)
12
+ try {
13
+ await document.exitFullscreen();
14
+ } catch (e) {
15
+ console.error("Error attempting to exit fullscreen:", e);
16
+ }
17
+ }, []);
18
+ return a(() => {
19
+ const e = () => {
20
+ r(!!document.fullscreenElement);
21
+ };
22
+ return document.addEventListener("fullscreenchange", e), () => {
23
+ document.removeEventListener("fullscreenchange", e);
24
+ };
25
+ }, []), { isFullScreen: t, enterFullScreen: c, exitFullScreen: u, isSupported: l };
26
+ };
27
+ export {
28
+ m as useFullScreen
29
+ };
@@ -0,0 +1,45 @@
1
+ import { useState as w, useRef as p, useCallback as a, useEffect as X } from "react";
2
+ const g = ({
3
+ isPressed: l,
4
+ scrollSpeed: i = 2
5
+ }) => {
6
+ const [L, v] = w("unset"), t = p(null), f = p({
7
+ startY: 0,
8
+ startX: 0,
9
+ startScrollTop: 0,
10
+ startScrollLeft: 0
11
+ }), o = a((r) => {
12
+ t.current && (f.current = {
13
+ startY: r.pageY,
14
+ startX: r.pageX,
15
+ startScrollTop: t.current.scrollTop,
16
+ startScrollLeft: t.current.scrollLeft
17
+ });
18
+ }, []), s = a(() => {
19
+ v("smooth");
20
+ }, []), e = a(
21
+ (r) => {
22
+ if (!l || !t.current)
23
+ return;
24
+ r.preventDefault(), v("unset");
25
+ const { startX: u, startY: n, startScrollTop: c, startScrollLeft: d } = f.current, S = (r.pageX - u) * i, h = (r.pageY - n) * i;
26
+ t.current.scrollTop = c - h, t.current.scrollLeft = d - S;
27
+ },
28
+ [l, i, t]
29
+ ), E = a(
30
+ (r) => {
31
+ var u, n, c;
32
+ t.current && ((u = t.current) == null || u.removeEventListener("mousedown", o), (n = t.current) == null || n.removeEventListener("mouseup", s), (c = t.current) == null || c.removeEventListener("mousemove", e)), t.current = r, r && (r == null || r.addEventListener("mousedown", o, { capture: !0 }), r == null || r.addEventListener("mouseup", s), r == null || r.addEventListener("mousemove", e));
33
+ },
34
+ [o, s, e]
35
+ );
36
+ return X(() => () => {
37
+ t.current && (t.current.removeEventListener("mousedown", o), t.current.removeEventListener("mouseup", s), t.current.removeEventListener("mousemove", e));
38
+ }, [o, s, e]), {
39
+ initializeGrabScroll: E,
40
+ scrollBehavior: L
41
+ };
42
+ };
43
+ export {
44
+ g as useGrabScroll
45
+ };
@@ -0,0 +1,19 @@
1
+ import { useCallback as l, useEffect as f } from "react";
2
+ const v = (s, c, h = {}) => {
3
+ const { distance: i = 10, loadFirst: t = !1 } = h, o = l(
4
+ (u) => {
5
+ if (!s)
6
+ return;
7
+ s.scrollHeight - s.clientHeight - s.scrollTop < i && c();
8
+ },
9
+ [c, s, i]
10
+ );
11
+ f(() => {
12
+ t && c();
13
+ }, [t]), f(() => (s == null || s.addEventListener("scroll", o), () => {
14
+ s == null || s.removeEventListener("scroll", o);
15
+ }), [o, s]);
16
+ };
17
+ export {
18
+ v as useInfiniteScroll
19
+ };
@@ -0,0 +1,102 @@
1
+ import { useState as g, useCallback as h, useEffect as v } from "react";
2
+ import { appConsole as l } from "../appConsole.js";
3
+ const b = /* @__PURE__ */ new Date("2025-02-06T05:13:29.146Z"), d = "Please visit https://www.react-pdf.dev/license-management/ to generate a new license key.", o = {
4
+ invalidLicense: `You are currently using without a valid license. ${d}`,
5
+ mismatchedDomain: `Your license key is not valid for the current domain / IP. ${d}`,
6
+ expired: `Your license key has expired. ${d}`,
7
+ exceededVersion: "Your license does not support the current version of Vue PDF Viewer. The library version you are using exceeds the supported range of your license.",
8
+ invalidSignature: "Invalid license key: Signature mismatch"
9
+ };
10
+ function y(r) {
11
+ const n = r.replace(/-----BEGIN PUBLIC KEY-----/, "").replace(/-----END PUBLIC KEY-----/, "").replace(/\s+/g, ""), t = atob(n), i = new Uint8Array(t.length);
12
+ for (let e = 0; e < t.length; e++)
13
+ i[e] = t.charCodeAt(e);
14
+ return i.buffer;
15
+ }
16
+ function A(r) {
17
+ const n = atob(r), t = new Uint8Array(n.length);
18
+ for (let i = 0; i < n.length; i++)
19
+ t[i] = n.charCodeAt(i);
20
+ return t.buffer;
21
+ }
22
+ async function I(r, n = "SHA-256") {
23
+ try {
24
+ const { data: t, signature: i } = JSON.parse(atob(r)), e = y(`-----BEGIN PUBLIC KEY-----
25
+ MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyrIi83Zr5AKaWO6zbZmX
26
+ qv3McVhtnPOnWCiFgf5xeaglLzEwMiXo3gALaPoBp5Q0WPOSBE9GTqwOyQUgpDNS
27
+ BuQ0cjOzQdFM3GPnKSqQThZJfjUmD9egMZDmfhcpFGPybUoicoIEFQOdX2vMFUfn
28
+ 6yjRsyvbK6UPTombYl785V8dXNnnIHa4tQC1JSaSe/bhG3e/6kbQCy9VJ23242q9
29
+ WJpx9c2sZ+bmyI0r9Zx0PfqcDJzDfKn45v96EtxGhV16OZhqkbj4ljiJ/mfqfCkx
30
+ ybkm9nvxz0hAwcEftQaxl/0cZ1RxtsRcL+V3msLsmGcs9nPqAuXecbfg9QVCi/+m
31
+ iwIDAQAB
32
+ -----END PUBLIC KEY-----`), a = await window.crypto.subtle.importKey(
33
+ "spki",
34
+ // str2ab(publicKeyContent), // Convert PEM string to ArrayBuffer
35
+ e,
36
+ { name: "RSA-PSS", hash: n },
37
+ !0,
38
+ ["verify"]
39
+ );
40
+ if (!await window.crypto.subtle.verify(
41
+ { name: "RSA-PSS", saltLength: 32 },
42
+ a,
43
+ A(i),
44
+ // Convert signature to ArrayBuffer
45
+ new TextEncoder().encode(atob(t))
46
+ ))
47
+ throw new Error(o.invalidSignature);
48
+ return JSON.parse(atob(t));
49
+ } catch {
50
+ throw new Error(o.invalidLicense);
51
+ }
52
+ }
53
+ const L = (r, n) => r === "specific" ? n === window.location.host : window.location.host.includes(n), c = {
54
+ isValid: !1,
55
+ invalidatedMessage: o.invalidLicense,
56
+ type: void 0
57
+ }, T = (r) => {
58
+ const [n, t] = g(c), i = h(async () => {
59
+ if (!r)
60
+ return t(c), c;
61
+ try {
62
+ const e = await I(r);
63
+ l.debug(">>> validatedLicense", e);
64
+ const { avu: a, exp: s, dmt: m, dm: f, t: w } = e;
65
+ if (!s)
66
+ throw new Error("License is missing expiration timestamp");
67
+ if (s > Number.MAX_SAFE_INTEGER / 1e3)
68
+ throw new Error("Invalid expiration timestamp: value too large");
69
+ const p = new Date(s * 1e3), E = (/* @__PURE__ */ new Date()).getTime();
70
+ if (p.getTime() < E)
71
+ throw new Error(o.expired);
72
+ if (!a)
73
+ throw new Error("License is missing available until version timestamp");
74
+ if (a > Number.MAX_SAFE_INTEGER / 1e3)
75
+ throw new Error("Invalid available until version timestamp: value too large");
76
+ const u = new Date(a * 1e3);
77
+ if (l.debug("availableUntilTimestamp", u), u.getTime() < b.getTime())
78
+ throw new Error(o.exceededVersion);
79
+ if (!L(m, f))
80
+ throw new Error(o.mismatchedDomain);
81
+ return {
82
+ isValid: !0,
83
+ type: w,
84
+ invalidatedMessage: void 0
85
+ };
86
+ } catch (e) {
87
+ return l.warn(e.message), { ...c, invalidatedMessage: e.message };
88
+ }
89
+ }, [r]);
90
+ return v(() => {
91
+ i().then(({ isValid: e, type: a, invalidatedMessage: s }) => {
92
+ t({
93
+ isValid: e,
94
+ type: a,
95
+ invalidatedMessage: s
96
+ });
97
+ });
98
+ }, [i]), n;
99
+ };
100
+ export {
101
+ T as useLicense
102
+ };
@@ -0,0 +1,50 @@
1
+ import { useState as f, useRef as y, useEffect as a } from "react";
2
+ import * as p from "pdfjs-dist";
3
+ import { getThumbnailViewport as C } from "../getThumbnailViewport.js";
4
+ import { useConfigContext as T } from "../../contexts/ConfigContext.js";
5
+ const L = (r, o) => {
6
+ const [t, c] = f(), { workerUrlAdded: d } = T(), [w, g] = f(/* @__PURE__ */ new Map()), l = y(), [u, P] = f(!1);
7
+ return a(() => {
8
+ if (!d || (console.log("pdf version", p.version), !r))
9
+ return;
10
+ l.current = Date.now();
11
+ const n = l.current, m = {
12
+ url: r,
13
+ cMapPacked: (o == null ? void 0 : o.isCompressed) ?? !0,
14
+ ...(o == null ? void 0 : o.url) && { cMapUrl: o.url }
15
+ }, i = p.getDocument(m);
16
+ P(!0);
17
+ const s = i.promise.then((e) => (n === l.current && c(e), e)).catch((e) => {
18
+ console.log(e);
19
+ }).finally(() => P(!1));
20
+ return () => {
21
+ s.finally(() => {
22
+ i.destroy();
23
+ });
24
+ };
25
+ }, [r, d]), a(() => {
26
+ const n = /* @__PURE__ */ new Map();
27
+ if (!t || u) {
28
+ g(n);
29
+ return;
30
+ }
31
+ const m = t.numPages, i = [];
32
+ for (let s = 1; s <= m; s++) {
33
+ const e = t.getPage(s);
34
+ i.push(e);
35
+ }
36
+ Promise.all(i).then((s) => {
37
+ s.map((e) => {
38
+ const { thumbnailViewport: b, scale: k } = C(e);
39
+ n.set(e.pageNumber, { page: e, thumbnailViewport: b, thumbnailScale: k });
40
+ }), g(n);
41
+ });
42
+ }, [t, u]), {
43
+ pdf: t,
44
+ pages: w,
45
+ loading: u
46
+ };
47
+ };
48
+ export {
49
+ L as useLoadPdf
50
+ };