@react-pdf-kit/viewer 2.6.0-beta.2 → 2.6.0-rc.0

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 (343) hide show
  1. package/dist/AnnotationLayer-D6BfL976.js +113 -0
  2. package/dist/Button-jStpvb3T.js +21 -0
  3. package/dist/Checkbox-Brta-YKG.js +195 -0
  4. package/dist/Combination-DqNkTtir.js +695 -0
  5. package/dist/Container-DTWaZzc7.js +16 -0
  6. package/dist/CustomThumbnailElement-C2quEICO.js +19 -0
  7. package/dist/DarkPdfIcon-B5ehd9CV.js +9 -0
  8. package/dist/DocumentDialog-DHAWcYIz.js +324 -0
  9. package/dist/DropDown-DikL-krI.js +33 -0
  10. package/dist/Input-Bb_-ljl1.js +31 -0
  11. package/dist/LightPdfIcon-DL8MYtWQ.js +9 -0
  12. package/dist/LoaderIcon-D9YjinGf.js +14 -0
  13. package/dist/LoadingIndicator-MWrbKa6X.js +45 -0
  14. package/dist/MenuItem-BJDWfzAw.js +15 -0
  15. package/dist/MenuSeparator-D1H5l8Ej.js +6 -0
  16. package/dist/MostPageTool.module-BRVv-sGz.js +4 -0
  17. package/dist/OtherTool.module-BQY9Nfqz.js +4 -0
  18. package/dist/Paginate.module-B0GMw-MB.js +8 -0
  19. package/dist/PaginationContext--n91mIJ4.js +232 -0
  20. package/dist/PasswordModal-BDHdSpxf.js +76 -0
  21. package/dist/PropertyItem-evJWWmWZ.js +18 -0
  22. package/dist/RPDropFileZone-BunRfzst.js +35 -0
  23. package/dist/RPLayout.module-Vc3h4xxS.js +14 -0
  24. package/dist/RPPage-BuSGUFzw.js +91 -0
  25. package/dist/RPPages-V5CNUXFD.js +1007 -0
  26. package/dist/RPSplitter-C63X9M8w.js +121 -0
  27. package/dist/RPToolbar.module-BwqWLviy.js +10 -0
  28. package/dist/RPTooltip-ZZoFqP7C.js +381 -0
  29. package/dist/RotateTool.module-DH5yWbvM.js +4 -0
  30. package/dist/SearchTool.module-DUkVXfOn.js +16 -0
  31. package/dist/SkipLink-Bvbn3miT.js +18 -0
  32. package/dist/TextHighlightLayer-BSVgBxR3.js +157 -0
  33. package/dist/TextLayer-DWGFN9SF.js +125 -0
  34. package/dist/Thumbnail-Dwo2-4Ki.js +97 -0
  35. package/dist/Thumbnails-ComClyJJ.js +52 -0
  36. package/dist/ToolbarLayout.module-Zo715dbb.js +12 -0
  37. package/dist/WrapperLayout-Dcd9l9xH.js +13 -0
  38. package/dist/ZoomTool.module-BrIPy8pO.js +11 -0
  39. package/dist/assets/AnnotationLayer.css +1 -0
  40. package/dist/assets/Button.css +1 -0
  41. package/dist/assets/Checkbox.css +1 -0
  42. package/dist/assets/Container.css +1 -0
  43. package/dist/assets/CustomThumbnailElement.css +1 -0
  44. package/dist/assets/DocumentDialog.css +1 -0
  45. package/dist/assets/DropDown.css +1 -0
  46. package/dist/assets/Input.css +1 -0
  47. package/dist/assets/LoaderIcon.css +1 -0
  48. package/dist/assets/LoadingIndicator.css +1 -0
  49. package/dist/assets/MenuItem.css +1 -0
  50. package/dist/assets/MenuSeparator.css +1 -0
  51. package/dist/assets/MostPageTool.css +1 -0
  52. package/dist/assets/OtherTool.css +1 -0
  53. package/dist/assets/Paginate.css +1 -0
  54. package/dist/assets/PasswordModal.css +1 -0
  55. package/dist/assets/PropertyItem.css +1 -0
  56. package/dist/assets/RPDropFileZone.css +1 -0
  57. package/dist/assets/RPLayout.css +1 -0
  58. package/dist/assets/RPPage.css +1 -0
  59. package/dist/assets/RPPages.css +1 -0
  60. package/dist/assets/RPSplitter.css +1 -0
  61. package/dist/assets/RPToolbar.css +1 -0
  62. package/dist/assets/RPTooltip.css +1 -0
  63. package/dist/assets/RotateTool.css +1 -0
  64. package/dist/assets/SearchTool.css +1 -0
  65. package/dist/assets/SkipLink.css +1 -0
  66. package/dist/assets/TextHighlightLayer.css +1 -0
  67. package/dist/assets/TextLayer.css +1 -0
  68. package/dist/assets/Thumbnail.css +1 -0
  69. package/dist/assets/Thumbnails.css +1 -0
  70. package/dist/assets/ToolbarLayout.css +1 -0
  71. package/dist/assets/WrapperLayout.css +1 -0
  72. package/dist/assets/ZoomTool.css +1 -0
  73. package/dist/assets/style.js +2 -77
  74. package/dist/chunk-C_CI6nMA.js +13 -0
  75. package/dist/clsx-B7LyVm5O.js +16 -0
  76. package/dist/components/RPConfig.js +24 -26
  77. package/dist/components/RPController.js +85 -135
  78. package/dist/components/RPDropFileZone.js +3 -61
  79. package/dist/components/RPPages.js +3 -1115
  80. package/dist/components/RPProvider.js +50 -131
  81. package/dist/components/RPTheme.js +20 -21
  82. package/dist/components/icons/CheckIcon.js +16 -22
  83. package/dist/components/icons/ChevronDownIcon.js +17 -23
  84. package/dist/components/icons/ChevronUpIcon.js +16 -22
  85. package/dist/components/icons/ClearIcon.js +26 -25
  86. package/dist/components/icons/ClockwiseIcon.js +16 -22
  87. package/dist/components/icons/CloseIcon.js +16 -22
  88. package/dist/components/icons/DarkPdfIcon.js +2 -15
  89. package/dist/components/icons/DualPageIcon.js +16 -22
  90. package/dist/components/icons/DualPageWithCoverIcon.js +16 -22
  91. package/dist/components/icons/FileDownloadDefaultIcon.js +20 -23
  92. package/dist/components/icons/FileUploadDefaultIcon.js +20 -23
  93. package/dist/components/icons/FullScreenIcon.js +16 -22
  94. package/dist/components/icons/GoToDownIcon.js +16 -22
  95. package/dist/components/icons/HandModeDefaultIcon.js +16 -22
  96. package/dist/components/icons/HorizontalScrollingIcon.js +18 -24
  97. package/dist/components/icons/InfoIcon.js +16 -22
  98. package/dist/components/icons/LightPdfIcon.js +2 -15
  99. package/dist/components/icons/LoaderIcon.js +2 -17
  100. package/dist/components/icons/MoonIcon.js +16 -22
  101. package/dist/components/icons/PageScrollingIcon.js +18 -24
  102. package/dist/components/icons/PrintDefaultIcon.js +20 -23
  103. package/dist/components/icons/SearchIcon.js +16 -22
  104. package/dist/components/icons/SinglePageIcon.js +15 -21
  105. package/dist/components/icons/SunIcon.js +26 -25
  106. package/dist/components/icons/TextSelectionDefaultIcon.js +20 -23
  107. package/dist/components/icons/ThreeDotIcon.js +16 -22
  108. package/dist/components/icons/Thumbnail.js +39 -54
  109. package/dist/components/icons/VerticalScrollingIcon.js +18 -24
  110. package/dist/components/icons/WrappedScrollingIcon.js +18 -24
  111. package/dist/components/icons/ZoomInIcon.js +16 -22
  112. package/dist/components/icons/ZoomOutIcon.js +16 -22
  113. package/dist/components/layout/Container.js +2 -21
  114. package/dist/components/layout/LayoutContainer.js +23 -34
  115. package/dist/components/layout/LayoutWrapper.js +14 -10
  116. package/dist/components/layout/RPDefaultLayout.js +99 -244
  117. package/dist/components/layout/RPLayout.js +70 -220
  118. package/dist/components/layout/SkipLink.js +3 -29
  119. package/dist/components/layout/WrapperLayout.js +2 -27
  120. package/dist/components/layout/sidebar/CustomThumbnailElement.js +2 -68
  121. package/dist/components/layout/sidebar/RPSidebar.js +61 -112
  122. package/dist/components/layout/sidebar/RPSplitter.js +2 -9
  123. package/dist/components/layout/sidebar/Thumbnail.js +3 -155
  124. package/dist/components/layout/sidebar/Thumbnails.js +2 -82
  125. package/dist/components/layout/toolbar/DarkModeTool.js +44 -36
  126. package/dist/components/layout/toolbar/DocumentDialog.js +2 -322
  127. package/dist/components/layout/toolbar/DocumentProperties.js +30 -39
  128. package/dist/components/layout/toolbar/FileDownloadTool.js +54 -50
  129. package/dist/components/layout/toolbar/FileUploadTool.js +54 -49
  130. package/dist/components/layout/toolbar/FullScreenTool.js +62 -72
  131. package/dist/components/layout/toolbar/MenuItem.js +2 -19
  132. package/dist/components/layout/toolbar/MenuSeparator.js +2 -15
  133. package/dist/components/layout/toolbar/MostPageTool.js +62 -81
  134. package/dist/components/layout/toolbar/OtherTool.js +97 -198
  135. package/dist/components/layout/toolbar/Paginate.js +111 -145
  136. package/dist/components/layout/toolbar/PrintTool.js +70 -72
  137. package/dist/components/layout/toolbar/PropertyItem.js +2 -12
  138. package/dist/components/layout/toolbar/RPMenuItem.js +22 -31
  139. package/dist/components/layout/toolbar/RPMoreOptions.js +140 -220
  140. package/dist/components/layout/toolbar/RPToolbar.js +45 -151
  141. package/dist/components/layout/toolbar/RPToolbarEnd.js +23 -121
  142. package/dist/components/layout/toolbar/RotateTool.js +49 -60
  143. package/dist/components/layout/toolbar/ScrollModeTool.js +79 -67
  144. package/dist/components/layout/toolbar/SearchCloseButton.js +23 -31
  145. package/dist/components/layout/toolbar/SearchResultNavigator.js +39 -100
  146. package/dist/components/layout/toolbar/SearchTool.js +226 -267
  147. package/dist/components/layout/toolbar/SelectionModeTool.js +59 -51
  148. package/dist/components/layout/toolbar/ThumbnailTool.js +30 -39
  149. package/dist/components/layout/toolbar/ToolbarCustom.js +56 -113
  150. package/dist/components/layout/toolbar/ToolbarDefault.js +58 -196
  151. package/dist/components/layout/toolbar/ToolbarLayout.js +12 -158
  152. package/dist/components/layout/toolbar/ViewModeTool.js +82 -62
  153. package/dist/components/layout/toolbar/ZoomTool.js +139 -150
  154. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +24 -54
  155. package/dist/components/layout/toolbar/tools/DualPageTool.js +23 -25
  156. package/dist/components/layout/toolbar/tools/DualPageWithCoverTool.js +2 -206
  157. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +23 -35
  158. package/dist/components/layout/toolbar/tools/FileUploadTool.js +23 -34
  159. package/dist/components/layout/toolbar/tools/FirstPageTool.js +2 -201
  160. package/dist/components/layout/toolbar/tools/FullScreenTool.js +25 -33
  161. package/dist/components/layout/toolbar/tools/HorizontalScrollingTool.js +24 -36
  162. package/dist/components/layout/toolbar/tools/InputPageTool.js +51 -92
  163. package/dist/components/layout/toolbar/tools/LastPageTool.js +2 -201
  164. package/dist/components/layout/toolbar/tools/NextPageTool.js +32 -61
  165. package/dist/components/layout/toolbar/tools/PageScrollingTool.js +24 -36
  166. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +21 -62
  167. package/dist/components/layout/toolbar/tools/PrintTool.js +23 -35
  168. package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +23 -47
  169. package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +26 -47
  170. package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +29 -38
  171. package/dist/components/layout/toolbar/tools/SinglePageTool.js +22 -24
  172. package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +24 -35
  173. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +24 -46
  174. package/dist/components/layout/toolbar/tools/VerticalScrollingTool.js +24 -36
  175. package/dist/components/layout/toolbar/tools/ZoomInTool.js +29 -58
  176. package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +26 -26
  177. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +94 -133
  178. package/dist/components/layout/toolbar/tools/ZoomOutTool.js +29 -58
  179. package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +60 -148
  180. package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +31 -42
  181. package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +23 -28
  182. package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +25 -52
  183. package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +25 -51
  184. package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +26 -42
  185. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +57 -87
  186. package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +25 -52
  187. package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +44 -64
  188. package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +80 -71
  189. package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +59 -57
  190. package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +79 -66
  191. package/dist/components/page/AnnotationLayer.js +2 -146
  192. package/dist/components/page/CanvasLayer.js +47 -71
  193. package/dist/components/page/CustomElement.js +18 -53
  194. package/dist/components/page/DualPage.js +43 -98
  195. package/dist/components/page/DualPageWithCover.js +66 -130
  196. package/dist/components/page/RPPage.js +2 -143
  197. package/dist/components/page/SinglePage.js +27 -88
  198. package/dist/components/page/TextHighlightLayer.js +2 -198
  199. package/dist/components/page/TextLayer.js +2 -202
  200. package/dist/components/page/searchHighlight.js +32 -37
  201. package/dist/components/ui/Button.js +2 -25
  202. package/dist/components/ui/Checkbox.js +2 -273
  203. package/dist/components/ui/DropDown.js +2 -36
  204. package/dist/components/ui/Input.js +2 -28
  205. package/dist/components/ui/LoadingIndicator.js +2 -59
  206. package/dist/components/ui/PasswordModal.js +2 -75
  207. package/dist/components/ui/RPTooltip.js +2 -357
  208. package/dist/contexts/ConfigContext.js +13 -12
  209. package/dist/contexts/DarkModeContext.js +26 -27
  210. package/dist/contexts/DimensionPagesContext.js +49 -60
  211. package/dist/contexts/DocumentPasswordContext.js +37 -35
  212. package/dist/contexts/DownloadContext.js +13 -21
  213. package/dist/contexts/DropFileZoneContext.js +35 -62
  214. package/dist/contexts/ElementPageContext.js +114 -139
  215. package/dist/contexts/ElementThumbnailContext.js +132 -195
  216. package/dist/contexts/EventCallbackContext.js +19 -34
  217. package/dist/contexts/FileInputContext.js +30 -49
  218. package/dist/contexts/FullScreenContext.js +31 -24
  219. package/dist/contexts/GlobalCurrentPage.js +21 -18
  220. package/dist/contexts/HighlightContext.js +22 -31
  221. package/dist/contexts/IconContext.js +9 -11
  222. package/dist/contexts/IconToolContext.js +14 -11
  223. package/dist/contexts/InitialStateContext.js +9 -11
  224. package/dist/contexts/LayerContext.js +9 -8
  225. package/dist/contexts/LayoutContainerContext.js +12 -16
  226. package/dist/contexts/LayoutDropFileZoneContext.js +8 -11
  227. package/dist/contexts/LicenseContext.js +12 -17
  228. package/dist/contexts/LoaderContext.js +14 -27
  229. package/dist/contexts/LocalizationContext.js +22 -33
  230. package/dist/contexts/OtherToolContext.js +17 -17
  231. package/dist/contexts/PageViewportContext.js +9 -8
  232. package/dist/contexts/PagesRotateContext.js +42 -43
  233. package/dist/contexts/PaginationContext.js +2 -40
  234. package/dist/contexts/PrintContext.js +67 -78
  235. package/dist/contexts/RPDocumentContext.js +60 -73
  236. package/dist/contexts/RenderQueueProvider.js +43 -72
  237. package/dist/contexts/RenderedPagesCache.js +17 -13
  238. package/dist/contexts/RotationContext.js +27 -38
  239. package/dist/contexts/ScrollModeContext.js +22 -20
  240. package/dist/contexts/SearchContext.js +39 -97
  241. package/dist/contexts/SelectionModeContext.js +22 -23
  242. package/dist/contexts/SmoothScrollContext.js +18 -16
  243. package/dist/contexts/ThemeContext.js +5 -7
  244. package/dist/contexts/ThumbnailsContext.js +26 -43
  245. package/dist/contexts/ToolComponentContext.js +54 -51
  246. package/dist/contexts/ToolbarComponentContext.js +48 -47
  247. package/dist/contexts/ViewModeContext.js +34 -31
  248. package/dist/contexts/ViewportContext.js +91 -85
  249. package/dist/contexts/VirtualGridContext.js +17 -14
  250. package/dist/contexts/VirtualScrollContext.js +42 -52
  251. package/dist/contexts/ZoomContext.js +95 -107
  252. package/dist/de_DE--0LF-SJR.js +483 -0
  253. package/dist/dist-7FA4Do6I.js +1286 -0
  254. package/dist/dist-BRVqFn7R.js +144 -0
  255. package/dist/dist-C3WNMuW2.js +29 -0
  256. package/dist/dist-CKteKPPA.js +947 -0
  257. package/dist/dist-bK-AHWLF.js +314 -0
  258. package/dist/lib-BiapEtK1.js +10261 -0
  259. package/dist/libInjectCss.js +7 -8
  260. package/dist/main-CHO5p1qM.js +60 -0
  261. package/dist/main.js +53 -296
  262. package/dist/style-9n_QpMZt.js +5 -0
  263. package/dist/useWatermark-CvAAf66v.js +67 -0
  264. package/dist/utils/Queue.js +40 -46
  265. package/dist/utils/annotations.js +227 -261
  266. package/dist/utils/appConsole.js +24 -42
  267. package/dist/utils/approximateFragtion.js +16 -21
  268. package/dist/utils/calculatePage.js +29 -20
  269. package/dist/utils/charators.js +39 -48
  270. package/dist/utils/const.js +8 -11
  271. package/dist/utils/constants.js +4 -8
  272. package/dist/utils/convertPdfDate.js +20 -24
  273. package/dist/utils/dateFormatter.js +7 -7
  274. package/dist/utils/elementPagePosition.js +10 -10
  275. package/dist/utils/formatFileSize.js +17 -8
  276. package/dist/utils/getElementPositionInPage.js +44 -82
  277. package/dist/utils/getScrollDistance.js +4 -4
  278. package/dist/utils/getThumbnailViewport.js +12 -6
  279. package/dist/utils/getWordPositionInPage.js +24 -24
  280. package/dist/utils/getZoomLevel.js +16 -23
  281. package/dist/utils/highlight.js +195 -212
  282. package/dist/utils/hooks/useCopyText.js +23 -33
  283. package/dist/utils/hooks/useDarkMode.js +10 -10
  284. package/dist/utils/hooks/useDarkModeProps.js +9 -10
  285. package/dist/utils/hooks/useDebounce.js +22 -18
  286. package/dist/utils/hooks/useDropFileZone.js +13 -11
  287. package/dist/utils/hooks/useElementSize.js +24 -20
  288. package/dist/utils/hooks/useFileDownload.js +16 -33
  289. package/dist/utils/hooks/useFlickerSelectText.js +19 -24
  290. package/dist/utils/hooks/useFullScreen.js +31 -28
  291. package/dist/utils/hooks/useGrabScroll.js +52 -51
  292. package/dist/utils/hooks/useHighlight.js +92 -92
  293. package/dist/utils/hooks/useInfiniteScroll.js +17 -18
  294. package/dist/utils/hooks/useLicense.js +113 -135
  295. package/dist/utils/hooks/useLoadPdf.js +107 -100
  296. package/dist/utils/hooks/useLoadWorker.js +13 -15
  297. package/dist/utils/hooks/useLocalization.js +25 -25
  298. package/dist/utils/hooks/useMousePressed.js +25 -19
  299. package/dist/utils/hooks/usePageRotateContext.js +25 -41
  300. package/dist/utils/hooks/usePaginate.js +2 -38
  301. package/dist/utils/hooks/usePdfProperties.js +38 -36
  302. package/dist/utils/hooks/usePinch.js +65 -100
  303. package/dist/utils/hooks/usePresentPage.js +69 -92
  304. package/dist/utils/hooks/usePrint.js +167 -178
  305. package/dist/utils/hooks/useRequestAnimationFrame.js +16 -16
  306. package/dist/utils/hooks/useResizeObserver.js +18 -21
  307. package/dist/utils/hooks/useRotate.js +15 -27
  308. package/dist/utils/hooks/useScrollToPage.js +2 -38
  309. package/dist/utils/hooks/useSearch.js +125 -163
  310. package/dist/utils/hooks/useTextSelection.js +69 -75
  311. package/dist/utils/hooks/useThumbnail.js +42 -59
  312. package/dist/utils/hooks/useVirtualReactWindow.js +85 -96
  313. package/dist/utils/hooks/useWatermark.js +2 -78
  314. package/dist/utils/injectPrintCSS.js +6 -21
  315. package/dist/utils/link_service.js +59 -137
  316. package/dist/utils/renderPage.js +20 -19
  317. package/dist/utils/sanitizeExternalUrl.js +12 -15
  318. package/dist/utils/smoothScrollTo.js +8 -5
  319. package/dist/utils/types.js +29 -21
  320. package/dist/utils/withRef.js +7 -7
  321. package/dist/utils/zoom.js +5 -6
  322. package/package.json +7 -7
  323. package/dist/Combination-17ab8af1.js +0 -698
  324. package/dist/MostPageTool.module-13578ad6.js +0 -6
  325. package/dist/OtherTool.module-a4be5f1f.js +0 -6
  326. package/dist/Paginate.module-4eef00aa.js +0 -8
  327. package/dist/PaginationContext-87f832f2.js +0 -233
  328. package/dist/RPLayout.module-92fa19f7.js +0 -14
  329. package/dist/RPSplitter-b62772f9.js +0 -122
  330. package/dist/RPToolbar.module-27d7fe77.js +0 -10
  331. package/dist/RotateTool.module-67946714.js +0 -6
  332. package/dist/SearchTool.module-99f60dc7.js +0 -16
  333. package/dist/ToolbarLayout.module-6e339802.js +0 -12
  334. package/dist/ZoomTool.module-7082af8c.js +0 -12
  335. package/dist/assets/style.css +0 -1
  336. package/dist/clsx-0c6e471a.js +0 -22
  337. package/dist/de_DE-8145915f.js +0 -489
  338. package/dist/index-113053cf.js +0 -309
  339. package/dist/index-11f3cd64.js +0 -983
  340. package/dist/index-23911b43.js +0 -150
  341. package/dist/index-ada501c4.js +0 -27
  342. package/dist/index-d0f0aa9a.js +0 -1542
  343. package/dist/index-e04c91b1.js +0 -11671
@@ -1,141 +1,119 @@
1
- import { useState as E, useCallback as y, useEffect as b } from "react";
2
- import { LicenseType as L } from "../types.js";
3
- import { appConsole as c } from "../appConsole.js";
4
- import "../../de_DE-8145915f.js";
5
- const A = /* @__PURE__ */ new Date("2026-05-11T06:37:10.798Z"), v = `-----BEGIN PUBLIC KEY-----
6
- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvIokvErJ0Fctu0jduSAx
7
- gr+5Har/VSuZLlOunS28hnlqqA+OF1apHL7RYkjBosS15yvviYdLrVWYHpHnoY4b
8
- HLQ9I6YX6FMB9T/VbB4xLdVdKvfi8r49aTScl5EKuSpgpPgz2VSJTfvVGcRuth/Y
9
- Bm7PPGYdL2l2gvKDxchmmsHFPukGki9L4JOUeIVX0GXAxabENckaEH/iC1NZhX+W
10
- vXnpHeHuIIKlZ16LSivXNgo6BH2Z3GFdg4G3cAaXr6qNP8fsacYNqv2SpTW1viFD
11
- vzcGRabN25gpJAp9/syeScefWH3OiJY1lmw88oTiJbjIoiq6AkPhfn3G9mF54nvR
12
- kwIDAQAB
13
- -----END PUBLIC KEY-----`, f = "Please visit https://app.react-pdf-kit.dev to generate a new license key.", o = {
14
- invalidLicense: `You are currently using without a valid license. ${f}`,
15
- mismatchedDomain: `Your license key is not valid for the current domain / IP. ${f}`,
16
- expired: `Your license key has expired. ${f}`,
17
- exceededVersion: "Your license does not support the current version of React PDF. The library version you are using exceeds the supported range of your license.",
18
- invalidSignature: "Invalid license key: Signature mismatch"
1
+ import { n as e } from "../../chunk-C_CI6nMA.js";
2
+ import { LicenseType as t } from "../types.js";
3
+ import { appConsole as n } from "../appConsole.js";
4
+ import { useCallback as r, useEffect as i, useState as a } from "react";
5
+ //#region lib/utils/hooks/useLicense.ts
6
+ var o = /* @__PURE__ */ new Date("2026-05-14T05:10:23.147Z"), s = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvIokvErJ0Fctu0jduSAx\ngr+5Har/VSuZLlOunS28hnlqqA+OF1apHL7RYkjBosS15yvviYdLrVWYHpHnoY4b\nHLQ9I6YX6FMB9T/VbB4xLdVdKvfi8r49aTScl5EKuSpgpPgz2VSJTfvVGcRuth/Y\nBm7PPGYdL2l2gvKDxchmmsHFPukGki9L4JOUeIVX0GXAxabENckaEH/iC1NZhX+W\nvXnpHeHuIIKlZ16LSivXNgo6BH2Z3GFdg4G3cAaXr6qNP8fsacYNqv2SpTW1viFD\nvzcGRabN25gpJAp9/syeScefWH3OiJY1lmw88oTiJbjIoiq6AkPhfn3G9mF54nvR\nkwIDAQAB\n-----END PUBLIC KEY-----", c = "Please visit https://app.react-pdf-kit.dev to generate a new license key.", l = {
7
+ invalidLicense: `You are currently using without a valid license. ${c}`,
8
+ mismatchedDomain: `Your license key is not valid for the current domain / IP. ${c}`,
9
+ expired: `Your license key has expired. ${c}`,
10
+ exceededVersion: "Your license does not support the current version of React PDF. The library version you are using exceeds the supported range of your license.",
11
+ invalidSignature: "Invalid license key: Signature mismatch"
19
12
  };
20
- function S(a) {
21
- const i = a.replace(/-----BEGIN PUBLIC KEY-----/, "").replace(/-----END PUBLIC KEY-----/, "").replace(/\s+/g, ""), e = atob(i), t = new Uint8Array(e.length);
22
- for (let r = 0; r < e.length; r++)
23
- t[r] = e.charCodeAt(r);
24
- return t.buffer;
13
+ function u(e) {
14
+ let t = e.replace(/-----BEGIN PUBLIC KEY-----/, "").replace(/-----END PUBLIC KEY-----/, "").replace(/\s+/g, ""), n = atob(t), r = new Uint8Array(n.length);
15
+ for (let e = 0; e < n.length; e++) r[e] = n.charCodeAt(e);
16
+ return r.buffer;
25
17
  }
26
- function I(a) {
27
- const i = atob(a), e = new Uint8Array(i.length);
28
- for (let t = 0; t < i.length; t++)
29
- e[t] = i.charCodeAt(t);
30
- return e.buffer;
18
+ function d(e) {
19
+ let t = atob(e), n = new Uint8Array(t.length);
20
+ for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
21
+ return n.buffer;
31
22
  }
32
- async function T(a) {
33
- try {
34
- const i = await import("../../index-e04c91b1.js").then((u) => u.i), e = (i == null ? void 0 : i.default) ?? i, t = e.pki.publicKeyFromPem(v), r = atob(a.data), n = e.util.decode64(a.signature), s = e.md.sha256.create();
35
- s.update(r, "utf8");
36
- const d = e.pss.create({
37
- md: e.md.sha256.create(),
38
- mgf: e.mgf.mgf1.create(e.md.sha256.create()),
39
- saltLength: 32
40
- });
41
- return t.verify(s.digest().bytes(), n, d);
42
- } catch (i) {
43
- return c.debug("[License] node-forge verify failed:", i), !1;
44
- }
23
+ async function f(t) {
24
+ try {
25
+ let n = await import("../../lib-BiapEtK1.js").then((t) => /* @__PURE__ */ e(t.default, 1)), r = n?.default ?? n, i = r.pki.publicKeyFromPem(s), a = atob(t.data), o = r.util.decode64(t.signature), c = r.md.sha256.create();
26
+ c.update(a, "utf8");
27
+ let l = r.pss.create({
28
+ md: r.md.sha256.create(),
29
+ mgf: r.mgf.mgf1.create(r.md.sha256.create()),
30
+ saltLength: 32
31
+ });
32
+ return i.verify(c.digest().bytes(), o, l);
33
+ } catch (e) {
34
+ return n.debug("[License] node-forge verify failed:", e), !1;
35
+ }
45
36
  }
46
- async function B(a, i = "SHA-256") {
47
- var e;
48
- try {
49
- const t = JSON.parse(atob(a));
50
- let r = !1;
51
- try {
52
- if ((e = window.crypto) != null && e.subtle) {
53
- const n = S(v), s = await window.crypto.subtle.importKey(
54
- "spki",
55
- n,
56
- { name: "RSA-PSS", hash: i },
57
- !0,
58
- ["verify"]
59
- );
60
- r = await window.crypto.subtle.verify(
61
- { name: "RSA-PSS", saltLength: 32 },
62
- s,
63
- I(t.signature),
64
- new TextEncoder().encode(atob(t.data))
65
- );
66
- }
67
- } catch (n) {
68
- c.debug("[License] crypto.subtle verify failed, trying node-forge fallback:", n);
69
- }
70
- if (r || (r = await T(t)), !r)
71
- throw new Error(o.invalidSignature);
72
- return JSON.parse(atob(t.data));
73
- } catch (t) {
74
- throw t instanceof Error && t.message === o.invalidSignature ? t : new Error(o.invalidLicense);
75
- }
37
+ async function p(e, t = "SHA-256") {
38
+ try {
39
+ let r = JSON.parse(atob(e)), i = !1;
40
+ try {
41
+ if (window.crypto?.subtle) {
42
+ let e = u(s), n = await window.crypto.subtle.importKey("spki", e, {
43
+ name: "RSA-PSS",
44
+ hash: t
45
+ }, !0, ["verify"]);
46
+ i = await window.crypto.subtle.verify({
47
+ name: "RSA-PSS",
48
+ saltLength: 32
49
+ }, n, d(r.signature), new TextEncoder().encode(atob(r.data)));
50
+ }
51
+ } catch (e) {
52
+ n.debug("[License] crypto.subtle verify failed, trying node-forge fallback:", e);
53
+ }
54
+ if (i ||= await f(r), !i) throw Error(l.invalidSignature);
55
+ return JSON.parse(atob(r.data));
56
+ } catch (e) {
57
+ throw e instanceof Error && e.message === l.invalidSignature ? e : Error(l.invalidLicense);
58
+ }
76
59
  }
77
- const N = (a, i) => {
78
- switch (a) {
79
- case "specific":
80
- return i === window.location.host;
81
- case "wildcard":
82
- return i ? window.location.host.includes(i) : !1;
83
- }
84
- }, m = {
85
- isValid: !0,
86
- invalidatedMessage: o.invalidLicense,
87
- type: void 0
88
- }, V = (a) => {
89
- const [i, e] = E(m), t = y(async () => {
90
- if (e((l) => ({ ...l, validating: !0 })), !a)
91
- throw e({ ...m, validating: !1 }), new Error(o.invalidLicense);
92
- let r;
93
- try {
94
- r = await B(a);
95
- } catch (l) {
96
- throw c.warn(l.message), new Error(l.message);
97
- }
98
- c.debug(">>> validatedLicense", r);
99
- const { avu: n, exp: s, dmt: d, dm: u, t: p } = r;
100
- if (!s)
101
- throw new Error("License is missing expiration timestamp");
102
- if (s > Number.MAX_SAFE_INTEGER / 1e3)
103
- throw new Error("Invalid expiration timestamp: value too large");
104
- const w = new Date(s * 1e3), h = (/* @__PURE__ */ new Date()).getTime();
105
- if (w.getTime() < h)
106
- throw new Error(o.expired);
107
- if (!n)
108
- throw new Error("License is missing available until version timestamp");
109
- if (n > Number.MAX_SAFE_INTEGER / 1e3)
110
- throw new Error("Invalid available until version timestamp: value too large");
111
- const g = new Date(n * 1e3);
112
- if (c.debug("availableUntilTimestamp", g), g.getTime() < A.getTime())
113
- throw new Error(o.exceededVersion);
114
- if (p !== L.Custom && !N(d, u))
115
- throw new Error(o.mismatchedDomain);
116
- return {
117
- isValid: !0,
118
- type: p,
119
- invalidatedMessage: void 0
120
- };
121
- }, [a]);
122
- return b(() => {
123
- t().then(({ isValid: r, type: n, invalidatedMessage: s }) => {
124
- e({
125
- isValid: r,
126
- type: n,
127
- invalidatedMessage: s,
128
- validating: !1
129
- });
130
- }).catch((r) => {
131
- e({
132
- ...m,
133
- isValid: !1,
134
- validating: !1
135
- }), c.warn(r.message);
136
- });
137
- }, [t]), i;
138
- };
139
- export {
140
- V as useLicense
60
+ var m = (e, t) => {
61
+ switch (e) {
62
+ case "specific": return t === window.location.host;
63
+ case "wildcard": return t ? window.location.host.includes(t) : !1;
64
+ }
65
+ }, h = {
66
+ isValid: !0,
67
+ invalidatedMessage: l.invalidLicense,
68
+ type: void 0
69
+ }, g = (e) => {
70
+ let [s, c] = a(h), u = r(async () => {
71
+ if (c((e) => ({
72
+ ...e,
73
+ validating: !0
74
+ })), !e) throw c({
75
+ ...h,
76
+ validating: !1
77
+ }), Error(l.invalidLicense);
78
+ let r;
79
+ try {
80
+ r = await p(e);
81
+ } catch (e) {
82
+ throw n.warn(e.message), Error(e.message);
83
+ }
84
+ n.debug(">>> validatedLicense", r);
85
+ let { avu: i, exp: a, dmt: s, dm: u, t: d } = r;
86
+ if (!a) throw Error("License is missing expiration timestamp");
87
+ if (a > (2 ** 53 - 1) / 1e3) throw Error("Invalid expiration timestamp: value too large");
88
+ let f = /* @__PURE__ */ new Date(a * 1e3), g = (/* @__PURE__ */ new Date()).getTime();
89
+ if (f.getTime() < g) throw Error(l.expired);
90
+ if (!i) throw Error("License is missing available until version timestamp");
91
+ if (i > (2 ** 53 - 1) / 1e3) throw Error("Invalid available until version timestamp: value too large");
92
+ let _ = /* @__PURE__ */ new Date(i * 1e3);
93
+ if (n.debug("availableUntilTimestamp", _), _.getTime() < o.getTime()) throw Error(l.exceededVersion);
94
+ if (d !== t.Custom && !m(s, u)) throw Error(l.mismatchedDomain);
95
+ return {
96
+ isValid: !0,
97
+ type: d,
98
+ invalidatedMessage: void 0
99
+ };
100
+ }, [e]);
101
+ return i(() => {
102
+ u().then(({ isValid: e, type: t, invalidatedMessage: n }) => {
103
+ c({
104
+ isValid: e,
105
+ type: t,
106
+ invalidatedMessage: n,
107
+ validating: !1
108
+ });
109
+ }).catch((e) => {
110
+ c({
111
+ ...h,
112
+ isValid: !1,
113
+ validating: !1
114
+ }), n.warn(e.message);
115
+ });
116
+ }, [u]), s;
141
117
  };
118
+ //#endregion
119
+ export { g as useLicense };
@@ -1,103 +1,110 @@
1
- import { useState as u, useRef as W, useEffect as C } from "react";
2
- import * as T from "pdfjs-dist";
3
- import { ErrorType as b } from "../types.js";
4
- import { getThumbnailViewport as j } from "../getThumbnailViewport.js";
5
- import { useConfigContext as z } from "../../contexts/ConfigContext.js";
6
- import { useDocumentPasswordContext as H } from "../../contexts/DocumentPasswordContext.js";
7
- import { INVALID_OR_CORRUPTED_PDF_MESSAGE as J, BROWSER_NOT_SUPPORTED_MESSAGE as K } from "../const.js";
8
- import "../../de_DE-8145915f.js";
9
- import "react/jsx-runtime";
10
- import "../appConsole.js";
11
- function F(n) {
12
- const o = new Error(J);
13
- return o.cause = n, o;
1
+ "use client";
2
+ import { ErrorType as e } from "../types.js";
3
+ import { getThumbnailViewport as t } from "../getThumbnailViewport.js";
4
+ import { useConfigContext as n } from "../../contexts/ConfigContext.js";
5
+ import { useDocumentPasswordContext as r } from "../../contexts/DocumentPasswordContext.js";
6
+ import { BROWSER_NOT_SUPPORTED_MESSAGE as i, INVALID_OR_CORRUPTED_PDF_MESSAGE as a } from "../const.js";
7
+ import { useEffect as o, useRef as s, useState as c } from "react";
8
+ import * as l from "pdfjs-dist";
9
+ //#region lib/utils/hooks/useLoadPdf.ts
10
+ function u(e) {
11
+ let t = Error(a);
12
+ return t.cause = e, t;
14
13
  }
15
- function Q(n) {
16
- const o = new Error(K);
17
- return o.cause = n, o;
14
+ function d(e) {
15
+ let t = Error(i);
16
+ return t.cause = e, t;
18
17
  }
19
- const re = (n, o, L = {}) => {
20
- const [d, p] = u(), { workerUrlAdded: N, wasmUrl: g } = z(), [q, A] = u(/* @__PURE__ */ new Map()), l = W(), [w, R] = u(0), [E, U] = u(!1), [B, c] = u(), { password: f, passwordError: G, setPasswordError: m, passwordRequired: D, setPasswordRequired: O } = H(), { onLoadError: t, onLoaded: S, onLoadProgress: _, disableAutoFetch: V, disableStream: x, rangeChunkSize: y, withCredentials: h, httpHeaders: k } = L;
21
- return C(() => {
22
- _ && _(w);
23
- }, [w, _]), C(() => {
24
- if (!N || !n)
25
- return;
26
- R(0), c(void 0), l.current = Date.now();
27
- const i = l.current, v = {
28
- url: n,
29
- cMapPacked: (o == null ? void 0 : o.isCompressed) ?? !0,
30
- ...(o == null ? void 0 : o.url) && { cMapUrl: o.url },
31
- ...f && { password: f },
32
- ...V !== void 0 && { disableAutoFetch: V },
33
- ...x !== void 0 && { disableStream: x },
34
- ...y !== void 0 && { rangeChunkSize: y },
35
- ...h !== void 0 && { withCredentials: h },
36
- ...k !== void 0 && { httpHeaders: k },
37
- ...g && { wasmUrl: g },
38
- verbosity: T.VerbosityLevel.ERRORS
39
- };
40
- try {
41
- const r = T.getDocument(v);
42
- r.onProgress = (e) => {
43
- if (i === l.current) {
44
- const { loaded: a, total: P } = e, I = P ? Math.min(100, Math.round(a / P * 100)) : 0;
45
- R(I);
46
- }
47
- }, U(!0), p(void 0);
48
- const s = r.promise.then((e) => (i === l.current && (p(e), R(100)), S && S(e), O(!1), m(""), e)).catch((e) => {
49
- if (e instanceof Error && e.name === "PasswordException") {
50
- const a = e.code;
51
- O(!0), a === T.PasswordResponses.INCORRECT_PASSWORD ? m("Incorrect password") : m(void 0);
52
- } else
53
- e instanceof Error && e.name === "InvalidPDFException" && f ? (O(!0), m("Incorrect password")) : e instanceof Error && e.name === "InvalidPDFException" ? (c(b.INVALID_OR_CORRUPTED_PDF), t == null || t(F(e))) : t && t(e);
54
- }).finally(() => {
55
- U(!1);
56
- });
57
- return () => {
58
- s.finally(() => {
59
- r.destroy();
60
- });
61
- };
62
- } catch (r) {
63
- c(b.NOT_SUPPORTED), t == null || t(Q(r));
64
- }
65
- }, [n, N, g, f, t, S]), C(() => {
66
- if (D)
67
- return;
68
- const i = /* @__PURE__ */ new Map();
69
- if (!d || E) {
70
- A(i);
71
- return;
72
- }
73
- const v = d.numPages, r = [];
74
- for (let s = 1; s <= v; s++) {
75
- const e = d.getPage(s);
76
- r.push(e);
77
- }
78
- Promise.all(r).then((s) => {
79
- s.map((e) => {
80
- const { thumbnailViewport: a, scale: P } = j(e), I = e.getViewport();
81
- i.set(e.pageNumber, {
82
- page: e,
83
- thumbnailViewport: a,
84
- thumbnailScale: P,
85
- defaultRotation: I.rotation
86
- });
87
- }), A(i);
88
- }).catch((s) => {
89
- p(void 0), c(b.INVALID_OR_CORRUPTED_PDF), t == null || t(F(s));
90
- });
91
- }, [d, E, D, t]), {
92
- pdf: d,
93
- pages: q,
94
- loading: E,
95
- error: B,
96
- loadingProgress: w,
97
- passwordRequired: D,
98
- passwordError: G
99
- };
100
- };
101
- export {
102
- re as useLoadPdf
18
+ var f = (i, a, f = {}) => {
19
+ let [p, m] = c(), { workerUrlAdded: h, wasmUrl: g } = n(), [_, v] = c(/* @__PURE__ */ new Map()), y = s(), [b, x] = c(0), [S, C] = c(!1), [w, T] = c(), { password: E, passwordError: D, setPasswordError: O, passwordRequired: k, setPasswordRequired: A } = r(), { onLoadError: j, onLoaded: M, onLoadProgress: N, disableAutoFetch: P, disableStream: F, rangeChunkSize: I, withCredentials: L, httpHeaders: R } = f;
20
+ return o(() => {
21
+ N && N(b);
22
+ }, [b, N]), o(() => {
23
+ if (!h || !i) return;
24
+ x(0), T(void 0), y.current = Date.now();
25
+ let t = y.current, n = {
26
+ url: i,
27
+ cMapPacked: a?.isCompressed ?? !0,
28
+ ...a?.url && { cMapUrl: a.url },
29
+ ...E && { password: E },
30
+ ...P !== void 0 && { disableAutoFetch: P },
31
+ ...F !== void 0 && { disableStream: F },
32
+ ...I !== void 0 && { rangeChunkSize: I },
33
+ ...L !== void 0 && { withCredentials: L },
34
+ ...R !== void 0 && { httpHeaders: R },
35
+ ...g && { wasmUrl: g },
36
+ verbosity: l.VerbosityLevel.ERRORS
37
+ };
38
+ try {
39
+ let r = l.getDocument(n);
40
+ r.onProgress = (e) => {
41
+ if (t === y.current) {
42
+ let { loaded: t, total: n } = e;
43
+ x(n ? Math.min(100, Math.round(t / n * 100)) : 0);
44
+ }
45
+ }, C(!0), m(void 0);
46
+ let i = r.promise.then((e) => (t === y.current && (m(e), x(100)), M && M(e), A(!1), O(""), e)).catch((t) => {
47
+ if (t instanceof Error && t.name === "PasswordException") {
48
+ let e = t.code;
49
+ A(!0), e === l.PasswordResponses.INCORRECT_PASSWORD ? O("Incorrect password") : O(void 0);
50
+ } else t instanceof Error && t.name === "InvalidPDFException" && E ? (A(!0), O("Incorrect password")) : t instanceof Error && t.name === "InvalidPDFException" ? (T(e.INVALID_OR_CORRUPTED_PDF), j?.(u(t))) : j && j(t);
51
+ }).finally(() => {
52
+ C(!1);
53
+ });
54
+ return () => {
55
+ i.finally(() => {
56
+ r.destroy();
57
+ });
58
+ };
59
+ } catch (t) {
60
+ T(e.NOT_SUPPORTED), j?.(d(t));
61
+ }
62
+ }, [
63
+ i,
64
+ h,
65
+ g,
66
+ E,
67
+ j,
68
+ M
69
+ ]), o(() => {
70
+ if (k) return;
71
+ let n = /* @__PURE__ */ new Map();
72
+ if (!p || S) {
73
+ v(n);
74
+ return;
75
+ }
76
+ let r = p.numPages, i = [];
77
+ for (let e = 1; e <= r; e++) {
78
+ let t = p.getPage(e);
79
+ i.push(t);
80
+ }
81
+ Promise.all(i).then((e) => {
82
+ e.map((e) => {
83
+ let { thumbnailViewport: r, scale: i } = t(e), a = e.getViewport();
84
+ n.set(e.pageNumber, {
85
+ page: e,
86
+ thumbnailViewport: r,
87
+ thumbnailScale: i,
88
+ defaultRotation: a.rotation
89
+ });
90
+ }), v(n);
91
+ }).catch((t) => {
92
+ m(void 0), T(e.INVALID_OR_CORRUPTED_PDF), j?.(u(t));
93
+ });
94
+ }, [
95
+ p,
96
+ S,
97
+ k,
98
+ j
99
+ ]), {
100
+ pdf: p,
101
+ pages: _,
102
+ loading: S,
103
+ error: w,
104
+ loadingProgress: b,
105
+ passwordRequired: k,
106
+ passwordError: D
107
+ };
103
108
  };
109
+ //#endregion
110
+ export { f as useLoadPdf };