@react-pdf-kit/viewer 2.6.0-beta.1 → 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 -1082
  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 -39
  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 -96
  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,277 +1,243 @@
1
- import { sanitizeExternalUrl as x } from "./sanitizeExternalUrl.js";
2
- import { AnnotationType as l } from "./types.js";
3
- import { dateFormatter as T } from "./dateFormatter.js";
4
- import "../de_DE-8145915f.js";
5
- const p = ["click", "dblclick", "input", "change", "mouseover"], b = /* @__PURE__ */ new Map(), h = (e, s) => `${e.loadingTask.docId}___${s.num}R${s.gen === 0 ? "" : s.gen}`;
6
- function y(e, s) {
7
- const t = h(e, s);
8
- return b.has(t) ? b.get(t) ?? null : null;
1
+ import { AnnotationType as e } from "./types.js";
2
+ import { sanitizeExternalUrl as t } from "./sanitizeExternalUrl.js";
3
+ import { dateFormatter as n } from "./dateFormatter.js";
4
+ //#region lib/utils/annotations.ts
5
+ var r = [
6
+ "click",
7
+ "dblclick",
8
+ "input",
9
+ "change",
10
+ "mouseover"
11
+ ], i = /* @__PURE__ */ new Map(), a = (e, t) => `${e.loadingTask.docId}___${t.num}R${t.gen === 0 ? "" : t.gen}`;
12
+ function o(e, t) {
13
+ let n = a(e, t);
14
+ return i.has(n) ? i.get(n) ?? null : null;
9
15
  }
10
- const O = (e, s, t) => {
11
- b.set(h(e, s), t);
12
- }, g = (e, s) => {
13
- switch (s[1].name) {
14
- case "XYZ":
15
- return {
16
- bottomOffset: (t, n) => s[3] === null ? n : s[3],
17
- leftOffset: (t, n) => s[2] === null ? 0 : s[2],
18
- pageIndex: e,
19
- scaleTo: s[4]
20
- };
21
- case "Fit":
22
- case "FitB":
23
- return {
24
- bottomOffset: 0,
25
- leftOffset: 0,
26
- pageIndex: e,
27
- scaleTo: 1
28
- };
29
- case "FitH":
30
- case "FitBH":
31
- return {
32
- bottomOffset: s[2],
33
- leftOffset: 0,
34
- pageIndex: e,
35
- scaleTo: 1
36
- };
37
- default:
38
- return {
39
- bottomOffset: 0,
40
- leftOffset: 0,
41
- pageIndex: e,
42
- scaleTo: 1
43
- };
44
- }
45
- }, E = (e) => {
46
- e && (() => {
47
- const t = e == null ? void 0 : e.querySelectorAll(
48
- '[data-l10n-id="pdfjs-annotation-date-time-string"]'
49
- );
50
- t == null || t.forEach((n) => {
51
- const { date: o, time: a, dateObj: i } = JSON.parse(n.dataset.l10nArgs ?? "{}");
52
- o && a ? n.textContent = `${o}, ${a}` : i && (n.textContent = T(i));
53
- });
54
- })();
16
+ var s = (e, t, n) => {
17
+ i.set(a(e, t), n);
18
+ }, c = (e, t) => {
19
+ switch (t[1].name) {
20
+ case "XYZ": return {
21
+ bottomOffset: (e, n) => t[3] === null ? n : t[3],
22
+ leftOffset: (e, n) => t[2] === null ? 0 : t[2],
23
+ pageIndex: e,
24
+ scaleTo: t[4]
25
+ };
26
+ case "Fit":
27
+ case "FitB": return {
28
+ bottomOffset: 0,
29
+ leftOffset: 0,
30
+ pageIndex: e,
31
+ scaleTo: 1
32
+ };
33
+ case "FitH":
34
+ case "FitBH": return {
35
+ bottomOffset: t[2],
36
+ leftOffset: 0,
37
+ pageIndex: e,
38
+ scaleTo: 1
39
+ };
40
+ default: return {
41
+ bottomOffset: 0,
42
+ leftOffset: 0,
43
+ pageIndex: e,
44
+ scaleTo: 1
45
+ };
46
+ }
47
+ }, l = (e) => {
48
+ e && (e?.querySelectorAll("[data-l10n-id=\"pdfjs-annotation-date-time-string\"]"))?.forEach((e) => {
49
+ let { date: t, time: r, dateObj: i } = JSON.parse(e.dataset.l10nArgs ?? "{}");
50
+ t && r ? e.textContent = `${t}, ${r}` : i && (e.textContent = n(i));
51
+ });
55
52
  };
56
- async function N(e, s) {
57
- let t;
58
- if (typeof s == "string" ? t = await e.getDestination(s) : t = s, t && typeof t[0] == "object" && t[0] !== null) {
59
- const n = t[0], o = y(e, n);
60
- if (o === null) {
61
- const a = await e.getPageIndex(n);
62
- return O(e, n, a), await N(e, t);
63
- } else
64
- return g(o, t);
65
- } else
66
- return g(t[0], t);
53
+ async function u(e, t) {
54
+ let n;
55
+ if (n = typeof t == "string" ? await e.getDestination(t) : t, n && typeof n[0] == "object" && n[0] !== null) {
56
+ let t = n[0], r = o(e, t);
57
+ return r === null ? (s(e, t, await e.getPageIndex(t)), await u(e, n)) : c(r, n);
58
+ } else return c(n[0], n);
67
59
  }
68
- function L(e, s) {
69
- for (const t of p)
70
- e.addEventListener(t, s);
60
+ function d(e, t) {
61
+ for (let n of r) e.addEventListener(n, t);
71
62
  }
72
- function C(e, s) {
73
- for (const t of p)
74
- e.removeEventListener(t, s);
63
+ function f(e, t) {
64
+ for (let n of r) e.removeEventListener(n, t);
75
65
  }
76
- function R(e) {
77
- const { id: s, url: t, unsafeUrl: n } = e;
78
- new MutationObserver((a, i) => {
79
- const c = document.querySelector(`[data-annotation-id="${s}"]`);
80
- if (c) {
81
- const r = c.querySelector("a"), A = x((t || n) ?? "", "");
82
- r && (r == null || r.setAttribute("target", "_blank"), r == null || r.setAttribute("href", A), r == null || r.setAttribute("rel", "noopener noreferrer")), i.disconnect();
83
- }
84
- }).observe(document.body, { childList: !0, subtree: !0 });
66
+ function p(e) {
67
+ let { id: n, url: r, unsafeUrl: i } = e;
68
+ new MutationObserver((e, a) => {
69
+ let o = document.querySelector(`[data-annotation-id="${n}"]`);
70
+ if (o) {
71
+ let e = o.querySelector("a"), n = t((r || i) ?? "", "");
72
+ e && (e?.setAttribute("target", "_blank"), e?.setAttribute("href", n), e?.setAttribute("rel", "noopener noreferrer")), a.disconnect();
73
+ }
74
+ }).observe(document.body, {
75
+ childList: !0,
76
+ subtree: !0
77
+ });
85
78
  }
86
- function F(e, s, t) {
87
- const { rotation: n, scale: o } = s, a = n % 180 === 0;
88
- if (e.fieldType === "Btn" && e.pushButton) {
89
- const i = e.rect[2] - e.rect[0], c = e.rect[3] - e.rect[1], r = document.createElement("canvas");
90
- r.setAttribute("width", ((a ? i : c) * o).toString()), r.setAttribute("height", ((a ? c : i) * o).toString()), t.set(e.id, r);
91
- }
79
+ function m(e, t, n) {
80
+ let { rotation: r, scale: i } = t, a = r % 180 == 0;
81
+ if (e.fieldType === "Btn" && e.pushButton) {
82
+ let t = e.rect[2] - e.rect[0], r = e.rect[3] - e.rect[1], o = document.createElement("canvas");
83
+ o.setAttribute("width", ((a ? t : r) * i).toString()), o.setAttribute("height", ((a ? r : t) * i).toString()), n.set(e.id, o);
84
+ }
92
85
  }
93
- function S(e) {
94
- e.querySelectorAll("[tabindex]").forEach((t) => {
95
- const n = t.getAttribute("tabindex");
96
- n && parseInt(n, 10) > 0 && (t.tagName === "A" || t.tagName === "BUTTON" || t.getAttribute("role") === "button" || t.getAttribute("role") === "link" || t.classList.contains("linkAnnotation") ? t.setAttribute("tabindex", "0") : t.removeAttribute("tabindex"));
97
- });
86
+ function h(e) {
87
+ e.querySelectorAll("[tabindex]").forEach((e) => {
88
+ let t = e.getAttribute("tabindex");
89
+ t && parseInt(t, 10) > 0 && (e.tagName === "A" || e.tagName === "BUTTON" || e.getAttribute("role") === "button" || e.getAttribute("role") === "link" || e.classList.contains("linkAnnotation") ? e.setAttribute("tabindex", "0") : e.removeAttribute("tabindex"));
90
+ });
98
91
  }
99
- function U(e) {
100
- e.querySelectorAll("a").forEach((t) => {
101
- const n = t.textContent && t.textContent.trim().length > 0, o = t.getAttribute("aria-label");
102
- if (!n && !o) {
103
- const a = t.getAttribute("href") || "";
104
- let i;
105
- if (!a || a.startsWith("#") || a.startsWith("javascript:"))
106
- i = "Link to page in document";
107
- else
108
- try {
109
- i = `External link to ${new URL(a, window.location.href).hostname.replace("www.", "")}`;
110
- } catch {
111
- i = "External link";
112
- }
113
- t.setAttribute("aria-label", i);
114
- }
115
- });
92
+ function g(e) {
93
+ e.querySelectorAll("a").forEach((e) => {
94
+ let t = e.textContent && e.textContent.trim().length > 0, n = e.getAttribute("aria-label");
95
+ if (!t && !n) {
96
+ let t = e.getAttribute("href") || "", n;
97
+ if (!t || t.startsWith("#") || t.startsWith("javascript:")) n = "Link to page in document";
98
+ else try {
99
+ n = `External link to ${new URL(t, window.location.href).hostname.replace("www.", "")}`;
100
+ } catch {
101
+ n = "External link";
102
+ }
103
+ e.setAttribute("aria-label", n);
104
+ }
105
+ });
116
106
  }
117
- function d(e, s, t) {
118
- const n = [];
119
- if (t)
120
- for (const o of t)
121
- o[e] === s && n.push(o);
122
- return n;
107
+ function _(e, t, n) {
108
+ let r = [];
109
+ if (n) for (let i of n) i[e] === t && r.push(i);
110
+ return r;
123
111
  }
124
- function u(e, s) {
125
- return { type: e, data: s };
112
+ function v(e, t) {
113
+ return {
114
+ type: e,
115
+ data: t
116
+ };
126
117
  }
127
- async function I(e, s) {
128
- if (e.dest)
129
- if (typeof e.dest == "string") {
130
- const t = await N(s, e.dest);
131
- return u(l.INTERNAL_LINK, {
132
- referencedPage: t.pageIndex,
133
- offset: null
134
- });
135
- } else {
136
- const t = await s.getPageIndex(e.dest[0]);
137
- return u(l.INTERNAL_LINK, {
138
- referencedPage: t,
139
- offset: {
140
- left: e.dest[2],
141
- bottom: e.dest[3]
142
- }
143
- });
144
- }
145
- else if (e.url || e.unsafeUrl)
146
- return u(l.LINK, {
147
- url: e.url ?? e.unsafeUrl,
148
- unsafeUrl: e.unsafeUrl
149
- });
118
+ async function y(t, n) {
119
+ if (t.dest) if (typeof t.dest == "string") {
120
+ let r = await u(n, t.dest);
121
+ return v(e.INTERNAL_LINK, {
122
+ referencedPage: r.pageIndex,
123
+ offset: null
124
+ });
125
+ } else {
126
+ let r = await n.getPageIndex(t.dest[0]);
127
+ return v(e.INTERNAL_LINK, {
128
+ referencedPage: r,
129
+ offset: {
130
+ left: t.dest[2],
131
+ bottom: t.dest[3]
132
+ }
133
+ });
134
+ }
135
+ else if (t.url || t.unsafeUrl) return v(e.LINK, {
136
+ url: t.url ?? t.unsafeUrl,
137
+ unsafeUrl: t.unsafeUrl
138
+ });
150
139
  }
151
- function m(e) {
152
- for (const s of e.getElementsByTagName("span")) {
153
- let t = s.textContent;
154
- const n = JSON.parse(s.dataset.l10nArgs ?? "{}");
155
- if (t)
156
- for (const o in n)
157
- t = t.replace(`{{${o}}}`, n[o]);
158
- s.textContent = t;
159
- }
140
+ function b(e) {
141
+ for (let t of e.getElementsByTagName("span")) {
142
+ let e = t.textContent, n = JSON.parse(t.dataset.l10nArgs ?? "{}");
143
+ if (e) for (let t in n) e = e.replace(`{{${t}}}`, n[t]);
144
+ t.textContent = e;
145
+ }
160
146
  }
161
- function v(e) {
162
- return u(l.FILE_ATTACHMENT, e.file);
147
+ function x(t) {
148
+ return v(e.FILE_ATTACHMENT, t.file);
163
149
  }
164
- function f(e, s) {
165
- switch (e.type) {
166
- case "textarea":
167
- case "text":
168
- return u(l.FORM_TEXT, {
169
- fieldName: e.name,
170
- value: e.value
171
- });
172
- case "select-one":
173
- case "select-multiple":
174
- const t = [];
175
- for (const o of e.options)
176
- t.push({
177
- value: o.value,
178
- label: o.label
179
- });
180
- const n = [];
181
- for (const o of e.selectedOptions)
182
- n.push({
183
- value: o.value,
184
- label: o.label
185
- });
186
- return u(l.FORM_SELECT, {
187
- fieldName: e.name,
188
- value: n,
189
- options: t
190
- });
191
- case "checkbox":
192
- return u(l.FORM_CHECKBOX, {
193
- fieldName: e.name,
194
- checked: e.checked
195
- });
196
- case "radio":
197
- return u(l.FORM_RADIO, {
198
- fieldName: e.name,
199
- ...s
200
- });
201
- case "button":
202
- return u(l.FORM_BUTTON, {
203
- fieldName: e.name,
204
- ...s
205
- });
206
- }
150
+ function S(t, n) {
151
+ switch (t.type) {
152
+ case "textarea":
153
+ case "text": return v(e.FORM_TEXT, {
154
+ fieldName: t.name,
155
+ value: t.value
156
+ });
157
+ case "select-one":
158
+ case "select-multiple":
159
+ let r = [];
160
+ for (let e of t.options) r.push({
161
+ value: e.value,
162
+ label: e.label
163
+ });
164
+ let i = [];
165
+ for (let e of t.selectedOptions) i.push({
166
+ value: e.value,
167
+ label: e.label
168
+ });
169
+ return v(e.FORM_SELECT, {
170
+ fieldName: t.name,
171
+ value: i,
172
+ options: r
173
+ });
174
+ case "checkbox": return v(e.FORM_CHECKBOX, {
175
+ fieldName: t.name,
176
+ checked: t.checked
177
+ });
178
+ case "radio": return v(e.FORM_RADIO, {
179
+ fieldName: t.name,
180
+ ...n
181
+ });
182
+ case "button": return v(e.FORM_BUTTON, {
183
+ fieldName: t.name,
184
+ ...n
185
+ });
186
+ }
207
187
  }
208
- async function W(e, s, t) {
209
- var o;
210
- let n = e.target.parentNode;
211
- if (n.tagName === "DIV" && (n = n.firstChild), typeof n.className != "object")
212
- if (n.className === "linkAnnotation" && e.type === "click") {
213
- const a = (o = n.dataset) == null ? void 0 : o.annotationId;
214
- if (a) {
215
- const i = d("id", a, t);
216
- if (i.length)
217
- return await I(i[0], s);
218
- }
219
- } else if (
220
- /* annotation.className.includes('popupAnnotation') || */
221
- n.className.includes("textAnnotation")
222
- )
223
- m(n);
224
- else if (n.className.includes("fileAttachmentAnnotation")) {
225
- m(n);
226
- const a = n.dataset.annotationId;
227
- if (a && e.type === "dblclick")
228
- return v(d("id", a, t)[0]);
229
- } else if (n.className.includes("textWidgetAnnotation") && e.type === "input") {
230
- let a = n.getElementsByTagName("input")[0];
231
- return a || (a = n.getElementsByTagName("textarea")[0]), f(a);
232
- } else {
233
- if (n.className.includes("choiceWidgetAnnotation") && e.type === "input")
234
- return f(n.getElementsByTagName("select")[0]);
235
- if (n.className.includes("buttonWidgetAnnotation checkBox") && e.type === "change")
236
- return f(n.getElementsByTagName("input")[0]);
237
- if (n.className.includes("buttonWidgetAnnotation radioButton") && e.type === "change") {
238
- const a = n.dataset.annotationId;
239
- if (a) {
240
- const i = d("id", a, t)[0], c = [];
241
- for (const r of d(
242
- "fieldName",
243
- i.fieldName,
244
- t
245
- ))
246
- r.buttonValue && c.push(r.buttonValue);
247
- return f(n.getElementsByTagName("input")[0], {
248
- value: i.buttonValue,
249
- defaultValue: i.fieldValue,
250
- options: c
251
- });
252
- }
253
- } else if (n.className.includes("buttonWidgetAnnotation pushButton") && e.type === "click") {
254
- const a = n.dataset.annotationId;
255
- if (a) {
256
- const i = d("id", a, t)[0], { action: c } = i;
257
- return c && ["Print", "SaveAs"].includes(c) ? { type: l.BUTTON, data: i } : i.resetForm ? f(
258
- { name: i.fieldName, type: "button" },
259
- { actions: i.actions, reset: !0 }
260
- ) : f(
261
- { name: i.fieldName, type: "button" },
262
- { actions: i.actions, reset: !1 }
263
- );
264
- }
265
- }
266
- }
188
+ async function C(t, n, r) {
189
+ let i = t.target.parentNode;
190
+ if (i.tagName === "DIV" && (i = i.firstChild), typeof i.className != "object") {
191
+ if (i.className === "linkAnnotation" && t.type === "click") {
192
+ let e = i.dataset?.annotationId;
193
+ if (e) {
194
+ let t = _("id", e, r);
195
+ if (t.length) return await y(t[0], n);
196
+ }
197
+ } else if (i.className.includes("textAnnotation")) b(i);
198
+ else if (i.className.includes("fileAttachmentAnnotation")) {
199
+ b(i);
200
+ let e = i.dataset.annotationId;
201
+ if (e && t.type === "dblclick") return x(_("id", e, r)[0]);
202
+ } else if (i.className.includes("textWidgetAnnotation") && t.type === "input") {
203
+ let e = i.getElementsByTagName("input")[0];
204
+ return e ||= i.getElementsByTagName("textarea")[0], S(e);
205
+ } else if (i.className.includes("choiceWidgetAnnotation") && t.type === "input") return S(i.getElementsByTagName("select")[0]);
206
+ else if (i.className.includes("buttonWidgetAnnotation checkBox") && t.type === "change") return S(i.getElementsByTagName("input")[0]);
207
+ else if (i.className.includes("buttonWidgetAnnotation radioButton") && t.type === "change") {
208
+ let e = i.dataset.annotationId;
209
+ if (e) {
210
+ let t = _("id", e, r)[0], n = [];
211
+ for (let e of _("fieldName", t.fieldName, r)) e.buttonValue && n.push(e.buttonValue);
212
+ return S(i.getElementsByTagName("input")[0], {
213
+ value: t.buttonValue,
214
+ defaultValue: t.fieldValue,
215
+ options: n
216
+ });
217
+ }
218
+ } else if (i.className.includes("buttonWidgetAnnotation pushButton") && t.type === "click") {
219
+ let t = i.dataset.annotationId;
220
+ if (t) {
221
+ let n = _("id", t, r)[0], { action: i } = n;
222
+ return i && ["Print", "SaveAs"].includes(i) ? {
223
+ type: e.BUTTON,
224
+ data: n
225
+ } : n.resetForm ? S({
226
+ name: n.fieldName,
227
+ type: "button"
228
+ }, {
229
+ actions: n.actions,
230
+ reset: !0
231
+ }) : S({
232
+ name: n.fieldName,
233
+ type: "button"
234
+ }, {
235
+ actions: n.actions,
236
+ reset: !1
237
+ });
238
+ }
239
+ }
240
+ }
267
241
  }
268
- export {
269
- W as annotationEventsHandler,
270
- L as bindLayerEvents,
271
- U as enhanceLinkAccessibility,
272
- S as fixTabIndexAccessibility,
273
- R as handleAnnotationLink,
274
- F as handleAnnotationWidget,
275
- E as insertDateText,
276
- C as unbindLayerEvents
277
- };
242
+ //#endregion
243
+ export { C as annotationEventsHandler, d as bindLayerEvents, g as enhanceLinkAccessibility, h as fixTabIndexAccessibility, p as handleAnnotationLink, m as handleAnnotationWidget, l as insertDateText, f as unbindLayerEvents };
@@ -1,42 +1,24 @@
1
- var s = Object.defineProperty;
2
- var i = (e, n, c) => n in e ? s(e, n, { enumerable: !0, configurable: !0, writable: !0, value: c }) : e[n] = c;
3
- var o = (e, n, c) => (i(e, typeof n != "symbol" ? n + "" : n, c), c);
4
- const t = class t {
5
- constructor() {
6
- o(this, "isProduction");
7
- this.isProduction = !0;
8
- }
9
- static getInstance() {
10
- return t.instance || (t.instance = new t()), t.instance;
11
- }
12
- /**
13
- * Debug level logging - stripped in production
14
- */
15
- debug(...n) {
16
- this.isProduction || console.debug("[React PDF Debug]:", ...n);
17
- }
18
- /**
19
- * Info level logging - kept in production
20
- */
21
- info(...n) {
22
- console.info("[React PDF Info]:", ...n);
23
- }
24
- /**
25
- * Warning level logging - kept in production
26
- */
27
- warn(...n) {
28
- console.warn("[React PDF Warning]:", ...n);
29
- }
30
- /**
31
- * Error level logging - kept in production
32
- */
33
- error(...n) {
34
- console.error("[React PDF Error]:", ...n);
35
- }
36
- };
37
- o(t, "instance");
38
- let r = t;
39
- const u = r.getInstance();
40
- export {
41
- u as appConsole
42
- };
1
+ var e = class e {
2
+ static instance;
3
+ isProduction;
4
+ constructor() {
5
+ this.isProduction = !0;
6
+ }
7
+ static getInstance() {
8
+ return e.instance ||= new e(), e.instance;
9
+ }
10
+ debug(...e) {
11
+ this.isProduction || console.debug("[React PDF Debug]:", ...e);
12
+ }
13
+ info(...e) {
14
+ console.info("[React PDF Info]:", ...e);
15
+ }
16
+ warn(...e) {
17
+ console.warn("[React PDF Warning]:", ...e);
18
+ }
19
+ error(...e) {
20
+ console.error("[React PDF Error]:", ...e);
21
+ }
22
+ }.getInstance();
23
+ //#endregion
24
+ export { e as appConsole };
@@ -1,22 +1,17 @@
1
- function u(t) {
2
- if (Math.floor(t) === t)
3
- return [t, 1];
4
- const e = 1 / t, s = 8;
5
- if (e > s)
6
- return [1, s];
7
- if (Math.floor(e) === e)
8
- return [1, e];
9
- const r = t > 1 ? e : t;
10
- let i = 0, n = 1, o = 1, l = 1;
11
- for (; ; ) {
12
- const c = i + o, f = n + l;
13
- if (f > s)
14
- break;
15
- r <= c / f ? (o = c, l = f) : (i = c, n = f);
16
- }
17
- let a;
18
- return r - i / n < o / l - r ? a = r === t ? [i, n] : [n, i] : a = r === t ? [o, l] : [l, o], a;
1
+ //#region lib/utils/approximateFragtion.ts
2
+ function e(e) {
3
+ if (Math.floor(e) === e) return [e, 1];
4
+ let t = 1 / e;
5
+ if (t > 8) return [1, 8];
6
+ if (Math.floor(t) === t) return [1, t];
7
+ let n = e > 1 ? t : e, r = 0, i = 1, a = 1, o = 1;
8
+ for (;;) {
9
+ let e = r + a, t = i + o;
10
+ if (t > 8) break;
11
+ n <= e / t ? (a = e, o = t) : (r = e, i = t);
12
+ }
13
+ let s;
14
+ return s = n - r / i < a / o - n ? n === e ? [r, i] : [i, r] : n === e ? [a, o] : [o, a], s;
19
15
  }
20
- export {
21
- u as approximateFraction
22
- };
16
+ //#endregion
17
+ export { e as approximateFraction };