@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,2657 @@
1
+ import { jsx as c, jsxs as D, Fragment as Oe } from "react/jsx-runtime";
2
+ import * as V from "react";
3
+ import { useRef as $, useEffect as A, useCallback as y, useState as k, useMemo as O, createContext as Fe, useContext as ke, forwardRef as ct, useImperativeHandle as Vt, createElement as Me, PureComponent as Mn, Component as En, memo as Ln } from "react";
4
+ import { c as X } from "./clsx-0c6e471a.js";
5
+ import { LoaderIcon as lt } from "./components/icons/LoaderIcon.js";
6
+ import { useScrollModeContext as be } from "./contexts/ScrollModeContext.js";
7
+ import { useDocumentContext as J } from "./contexts/RPDocumentContext.js";
8
+ import "./components/RPConfig.js";
9
+ import { ChevronUpIcon as ye } from "./components/icons/ChevronUpIcon.js";
10
+ import { UIButton as B } from "./components/ui/Button.js";
11
+ import { UIInput as Gt } from "./components/ui/Input.js";
12
+ import { useIconContext as ae } from "./contexts/IconContext.js";
13
+ import { useToolbarComponentContext as ce } from "./contexts/ToolbarComponentContext.js";
14
+ import { useViewportContext as fe } from "./contexts/ViewportContext.js";
15
+ import { FileUploadTool as Ut } from "./components/layout/toolbar/FileUploadTool.js";
16
+ import { DarkModeTool as Nn } from "./components/layout/toolbar/DarkModeTool.js";
17
+ import { useLayoutContainer as We } from "./contexts/LayoutContainerContext.js";
18
+ import { ThreeDotIcon as On } from "./components/icons/ThreeDotIcon.js";
19
+ import { UIDropDown as ut } from "./components/ui/DropDown.js";
20
+ import { u as dt, a as Re, c as xe, b as pt, d as Dn, e as zn, h as An, f as Fn, F as kn, D as Wn, g as qe, i as Hn, G as De } from "./index-3459164c.js";
21
+ import { c as $n, e as Vn, a as Gn } from "./index-743c36f0.js";
22
+ import { CloseIcon as qt } from "./components/icons/CloseIcon.js";
23
+ import { dateFormatter as et } from "./utils/dateFormatter.js";
24
+ import { renderPage as tt } from "./utils/renderPage.js";
25
+ import "./RPSplitter.module-13d612c4.js";
26
+ import "./Container.module-cb7b45b9.js";
27
+ import "./contexts/DarkModeContext.js";
28
+ import { useRotateContext as He } from "./contexts/RotateContext.js";
29
+ import { useLayerContext as Un } from "./contexts/LayerContext.js";
30
+ import { useZoomContext as ht } from "./contexts/ZoomContext.js";
31
+ import { useViewModeContext as $e } from "./contexts/ViewModeContext.js";
32
+ import { useVirtualScrollContext as Ve } from "./contexts/VirtualScrollContext.js";
33
+ import { useVirtualGridContext as Zt } from "./contexts/VirtualGridContext.js";
34
+ import { useScrollStateContext as jt } from "./contexts/ScrollStateContext.js";
35
+ import { useSelectionModeContext as qn } from "./contexts/SelectionModeContext.js";
36
+ import { useInitialStateContext as Zn } from "./contexts/InitialStateContext.js";
37
+ import "./contexts/ThemeContext.js";
38
+ import { useFullScreenContext as jn } from "./contexts/FullScreenContext.js";
39
+ import "./WrapperLayout.module-147bc943.js";
40
+ import "./contexts/DropFileZoneContext.js";
41
+ import "./RPTheme.module-f756e5cd.js";
42
+ import "./contexts/FileInputContext.js";
43
+ import { findMatches as Bn, resetDivs as Kn, highlightMatches as Jn } from "./utils/highlight.js";
44
+ import * as Xn from "pdfjs-dist";
45
+ import { AnnotationLayer as Yn, PixelsPerInch as Qn, AnnotationMode as er, RenderingCancelledException as tr } from "pdfjs-dist";
46
+ import { getThumbnailViewport as St } from "./utils/getThumbnailViewport.js";
47
+ import { useInfiniteScroll as nr } from "./utils/hooks/useInfiniteScroll.js";
48
+ import { PropertyItem as rr } from "./components/layout/toolbar/PropertyItem.js";
49
+ import { useOtherToolContext as or, OtherToolProvider as ar } from "./contexts/OtherToolContext.js";
50
+ import { DocumentProperties as sr } from "./components/layout/toolbar/DocumentProperties.js";
51
+ import { RotateTool as ir } from "./components/layout/toolbar/RotateTool.js";
52
+ import { ScrollModeTool as cr } from "./components/layout/toolbar/ScrollModeTool.js";
53
+ import { MenuSeparator as ft } from "./components/layout/toolbar/MenuSeparator.js";
54
+ import { FileDownloadDefaultIcon as lr } from "./components/icons/FileDownloadDefaultIcon.js";
55
+ import { MenuItem as ie } from "./components/layout/toolbar/MenuItem.js";
56
+ import { PrintDefaultTool as ur } from "./components/icons/PrintDefaultIcon.js";
57
+ import { FullScreenTool as Bt } from "./components/layout/toolbar/FullScreenTool.js";
58
+ import { GoToDownIcon as Kt } from "./components/icons/GoToDownIcon.js";
59
+ import { SelectionModeTool as dr } from "./components/layout/toolbar/SelectionModeTool.js";
60
+ import { ZoomInIcon as pr } from "./components/icons/ZoomInIcon.js";
61
+ import { ZoomOutIcon as hr } from "./components/icons/ZoomOutIcon.js";
62
+ import { ViewMode as ze, ScrollMode as ee, AnnotationSubType as nt, SelectionMode as fr, ZoomLevel as ve } from "./utils/types.js";
63
+ import { PAGE_PADDING as Tt } from "./utils/constants.js";
64
+ import { SearchIcon as mr } from "./components/icons/SearchIcon.js";
65
+ import { UICheckbox as Pt } from "./components/ui/Checkbox.js";
66
+ import { ClearIcon as gr } from "./components/icons/ClearIcon.js";
67
+ import { SimpleLinkService as vr } from "./utils/link_service.js";
68
+ import { sanitizeExternalUrl as _r } from "./utils/sanitizeExternalUrl.js";
69
+ import { useWatermark as wr } from "./utils/hooks/useWatermark.js";
70
+ import { usePageDimension as Jt } from "./utils/hooks/usePageDimension.js";
71
+ import { useMousePressed as br } from "./utils/hooks/useMousePressed.js";
72
+ import { useGrabScroll as Cr } from "./utils/hooks/useGrabScroll.js";
73
+ import { useDebounce as Sr } from "./utils/hooks/useDebounce.js";
74
+ import { appConsole as Tr } from "./utils/appConsole.js";
75
+ import './assets/Thumbnails.css';const re = {
76
+ "rp-pages": "_rp-pages_92c86_1",
77
+ "rp-pages-horizontal-scroll": "_rp-pages-horizontal-scroll_92c86_7",
78
+ "rp-pages-container": "_rp-pages-container_92c86_11",
79
+ "rp-page-scrolling-wrapper": "_rp-page-scrolling-wrapper_92c86_17",
80
+ "rp-viewer": "_rp-viewer_92c86_22",
81
+ "rp-cursor-grab": "_rp-cursor-grab_92c86_27",
82
+ "rp-cursor-grabbing": "_rp-cursor-grabbing_92c86_31"
83
+ }, Ze = {
84
+ "rp-page-wrapper": "_rp-page-wrapper_h7a2q_1",
85
+ "rp-page": "_rp-page_h7a2q_1",
86
+ "rp-loader-wrapper": "_rp-loader-wrapper_h7a2q_14"
87
+ }, Pr = (t) => {
88
+ const { pageNumber: e, onLoaded: n, onLoading: r } = t, o = $(null), { pages: a } = J(), { rotate: i } = He(), s = $(), { currentZoom: l } = ht();
89
+ return A(() => {
90
+ if (!a || l === 0)
91
+ return;
92
+ const h = a.get(e);
93
+ if (o.current && h) {
94
+ const p = o.current;
95
+ p.hidden = !0;
96
+ const m = s.current;
97
+ m && m.cancel(), r && r(), s.current = tt(h.page, p, l, i), s.current.promise.then(() => {
98
+ p.hidden = !1;
99
+ }).catch((u) => {
100
+ }).finally(() => {
101
+ n && n();
102
+ });
103
+ }
104
+ }, [a, e, i, l, r, n]), /* @__PURE__ */ c("canvas", { "data-rp": `page-${e}-canvas`, ref: o });
105
+ }, je = {
106
+ "rp-text-layer": "_rp-text-layer_1mgyz_1",
107
+ "rp-text-layer-text": "_rp-text-layer-text_1mgyz_9"
108
+ }, mt = () => {
109
+ const { viewMode: t } = $e(), { scrollMode: e } = be(), { virtualScrollRef: n, pageScrollElementRef: r } = Ve(), { setFocusedPage: o } = te(), a = $(), { columnCount: i } = Zt(), s = Jt(), l = $(e), h = $(t);
110
+ A(() => {
111
+ n != null && n.scrollToItem && (a.current = n);
112
+ }, [n]);
113
+ const p = y(
114
+ (u) => {
115
+ if (!r)
116
+ return;
117
+ const f = Math.ceil(u / 2) * 2 - 1;
118
+ u === f + 1 ? r.scrollTo({ left: s.widths[f], top: 0 }) : r.scrollTo({ left: 0, top: 0 });
119
+ },
120
+ [r, s]
121
+ );
122
+ return A(() => {
123
+ l.current = e, h.current = t;
124
+ }, [e, t]), { scrollToPage: y(
125
+ (u, f = "start") => {
126
+ const v = u - 1;
127
+ if (h.current === ze.DUAL_PAGE && l.current === ee.PAGE_SCROLLING) {
128
+ p(u);
129
+ return;
130
+ }
131
+ if (l.current === ee.PAGE_SCROLLING) {
132
+ o(u);
133
+ return;
134
+ }
135
+ if (a.current)
136
+ if (l.current === ee.HORIZONTAL_SCROLLING)
137
+ a.current.scrollToItem({ columnIndex: v, align: f });
138
+ else if (h.current === ze.DUAL_PAGE) {
139
+ const g = v % 2, S = Math.floor(v / 2);
140
+ a.current.scrollToItem({ columnIndex: g, rowIndex: S, align: f });
141
+ } else
142
+ a.current.scrollToItem({ rowIndex: v, align: f });
143
+ },
144
+ [i, p, o]
145
+ ) };
146
+ }, Ir = (t = {}, e = "") => {
147
+ const [n, r] = k(e), [o, a] = k(!1), { pdf: i } = J(), s = $(!n), [l, h] = k([]), [p, m] = k(0), { scrollToPage: u } = mt(), { virtualScrollRef: f, pageScrollElementRef: v, virtualScrollableElementRef: _ } = Ve(), { scrollMode: g } = be(), [S, x] = k(null), w = O(() => p === 0 ? null : l[p - 1], [p, l]), P = O(() => l.length, [l]);
148
+ A(() => {
149
+ if (!w || (u(w.page), !S || !S.classList.contains("selected")))
150
+ return;
151
+ const C = _ || v;
152
+ if (!C)
153
+ return;
154
+ const L = S.getBoundingClientRect(), I = C.clientHeight / 2, M = C.clientWidth / 2, E = C.scrollTop + L.top - I, R = C.scrollLeft + L.left - M;
155
+ C.scrollTo({
156
+ top: E,
157
+ left: R
158
+ });
159
+ }, [
160
+ w,
161
+ u,
162
+ f,
163
+ S,
164
+ g,
165
+ _,
166
+ v
167
+ ]);
168
+ const d = y(() => {
169
+ m((C) => P ? C + 1 > P ? 1 : C + 1 : 0);
170
+ }, [P]), T = y(() => {
171
+ m((C) => P ? C - 1 <= 0 ? P : C - 1 : 0);
172
+ }, [P]), b = y(async (C) => {
173
+ if (!C)
174
+ return {};
175
+ const L = C.numPages, I = {};
176
+ for (let M = 1; M <= L; M++) {
177
+ if (s.current)
178
+ throw "close pop over";
179
+ const E = await C.getPage(M);
180
+ I[M.toString()] = await E.getTextContent();
181
+ }
182
+ return I;
183
+ }, []);
184
+ return A(() => {
185
+ if (!n) {
186
+ s.current = !0, h([]), m(0);
187
+ return;
188
+ }
189
+ s.current = !1, a(!0), h([]), m(0), b(i).then((C) => {
190
+ const I = Object.keys(C).reduce((M, E) => {
191
+ const R = Bn(
192
+ [n],
193
+ C[E],
194
+ Number(E) - 1,
195
+ t
196
+ ).map((N, z) => ({ ...N, page: Number(E), pageMatchIdx: z }));
197
+ return [...M, ...R];
198
+ }, []);
199
+ h(I), m(I.length ? 1 : 0);
200
+ }).catch(() => {
201
+ h([]), m(0);
202
+ }).finally(() => a(!1));
203
+ }, [n, b, i, t]), {
204
+ search: n,
205
+ setSearch: r,
206
+ loading: o,
207
+ matches: l,
208
+ totalMatches: P,
209
+ currentMatchPosition: p,
210
+ currentMatch: w,
211
+ nextMatch: d,
212
+ prevMatch: T,
213
+ currentMatchElement: S,
214
+ setCurrentMatchElement: x
215
+ };
216
+ }, Xt = Fe({
217
+ search: "",
218
+ setSearch: (t) => {
219
+ },
220
+ loading: !1,
221
+ matches: [],
222
+ totalMatches: 0,
223
+ currentMatchPosition: 0,
224
+ currentMatch: null,
225
+ nextMatch: () => {
226
+ },
227
+ prevMatch: () => {
228
+ },
229
+ searchOptions: {},
230
+ setSearchOptions: (t) => t,
231
+ currentMatchElement: null,
232
+ setCurrentMatchElement: (t) => {
233
+ }
234
+ }), gs = ({
235
+ children: t,
236
+ initialSearch: e
237
+ }) => {
238
+ const [n, r] = k({}), {
239
+ loading: o,
240
+ setSearch: a,
241
+ totalMatches: i,
242
+ currentMatchPosition: s,
243
+ currentMatch: l,
244
+ search: h,
245
+ matches: p,
246
+ nextMatch: m,
247
+ prevMatch: u,
248
+ currentMatchElement: f,
249
+ setCurrentMatchElement: v
250
+ } = Ir(n, e);
251
+ return /* @__PURE__ */ c(
252
+ Xt.Provider,
253
+ {
254
+ value: {
255
+ searchOptions: n,
256
+ setSearchOptions: r,
257
+ loading: o,
258
+ setSearch: a,
259
+ totalMatches: i,
260
+ currentMatchPosition: s,
261
+ currentMatch: l,
262
+ nextMatch: m,
263
+ prevMatch: u,
264
+ search: h,
265
+ matches: p,
266
+ currentMatchElement: f,
267
+ setCurrentMatchElement: v
268
+ },
269
+ children: t
270
+ }
271
+ );
272
+ }, Yt = () => ke(Xt), xr = (t) => {
273
+ const { pageNumber: e } = t, { pages: n } = J(), r = $(null), { matches: o, currentMatch: a, setCurrentMatchElement: i } = Yt(), [s, l] = k(
274
+ []
275
+ ), h = $(), p = $(), m = $(), u = O(() => o.filter((v) => v.pageIndex === e - 1), [o, e]), f = y(
276
+ (v, _, g = !1) => {
277
+ if (g && Kn(v, _), !u.length) {
278
+ m.current = void 0, l([]);
279
+ return;
280
+ }
281
+ const S = Jn(u, v, _);
282
+ l(S);
283
+ },
284
+ [u]
285
+ );
286
+ return A(() => {
287
+ var g;
288
+ if ((g = m.current) == null || g.classList.remove("selected"), !s.length || !a || a.pageIndex !== e - 1)
289
+ return;
290
+ const v = u.findIndex(
291
+ (S) => JSON.stringify(S) === JSON.stringify(a)
292
+ );
293
+ if (v === -1)
294
+ return;
295
+ const _ = s.find((S) => S.index === v);
296
+ _ && (m.current = _.element, i(_.element), _.element.classList.add("selected"));
297
+ }, [a, s, u]), A(() => {
298
+ const v = n.get(e);
299
+ if (!(!v || !r.current))
300
+ return h.current && h.current.cancel(), v.page.getTextContent().then((_) => {
301
+ const g = v.page.getViewport({ scale: 1 });
302
+ return h.current = new Xn.TextLayer({
303
+ viewport: g,
304
+ textContentSource: _,
305
+ container: r.current
306
+ }), p.current = _, r.current && (r.current.innerText = ""), h.current.render();
307
+ }).then(() => {
308
+ var S;
309
+ [].slice.call(r.current.children).forEach((x) => {
310
+ x.classList.add(je["rp-text-layer-text"]);
311
+ });
312
+ const g = (S = h.current) == null ? void 0 : S.textDivs;
313
+ g && p.current && f(p.current, g);
314
+ }).catch(() => {
315
+ }), () => {
316
+ var _;
317
+ (_ = h.current) == null || _.cancel();
318
+ };
319
+ }, [n, e]), A(() => {
320
+ var g;
321
+ [].slice.call(r.current.children).forEach((S) => {
322
+ S.classList.add(je["rp-text-layer-text"]);
323
+ });
324
+ const _ = (g = h.current) == null ? void 0 : g.textDivs;
325
+ _ && p.current && f(p.current, _, !0);
326
+ }, [f]), /* @__PURE__ */ c(
327
+ "div",
328
+ {
329
+ "data-rp": `page-${e}-textLayer`,
330
+ className: je["rp-text-layer"],
331
+ ref: r
332
+ }
333
+ );
334
+ }, yr = {
335
+ "rp-annotation-layer": "_rp-annotation-layer_o0ksd_1"
336
+ }, Qt = ["click", "dblclick", "mouseover", "input", "change"];
337
+ let Rr = "https://unpkg.com/pdfjs-dist@4.4.168/web/images/";
338
+ const rt = /* @__PURE__ */ new Map(), en = (t, e) => `${t.loadingTask.docId}___${e.num}R${e.gen === 0 ? "" : e.gen}`;
339
+ function Mr(t, e) {
340
+ const n = en(t, e);
341
+ return rt.has(n) ? rt.get(n) ?? null : null;
342
+ }
343
+ const Er = (t, e, n) => {
344
+ rt.set(en(t, e), n);
345
+ }, It = (t, e) => {
346
+ switch (e[1].name) {
347
+ case "XYZ":
348
+ return {
349
+ bottomOffset: (n, r) => e[3] === null ? r : e[3],
350
+ leftOffset: (n, r) => e[2] === null ? 0 : e[2],
351
+ pageIndex: t,
352
+ scaleTo: e[4]
353
+ };
354
+ case "Fit":
355
+ case "FitB":
356
+ return {
357
+ bottomOffset: 0,
358
+ leftOffset: 0,
359
+ pageIndex: t,
360
+ scaleTo: 1
361
+ };
362
+ case "FitH":
363
+ case "FitBH":
364
+ return {
365
+ bottomOffset: e[2],
366
+ leftOffset: 0,
367
+ pageIndex: t,
368
+ scaleTo: 1
369
+ };
370
+ default:
371
+ return {
372
+ bottomOffset: 0,
373
+ leftOffset: 0,
374
+ pageIndex: t,
375
+ scaleTo: 1
376
+ };
377
+ }
378
+ };
379
+ async function tn(t, e) {
380
+ if (e && typeof e[0] == "object" && e[0] !== null) {
381
+ const n = e[0], r = Mr(t, n);
382
+ if (r === null) {
383
+ const o = await t.getPageIndex(n);
384
+ return Er(t, n, o), await tn(t, e);
385
+ } else
386
+ return It(r, e);
387
+ } else
388
+ return It(e[0], e);
389
+ }
390
+ function Lr(t) {
391
+ const { id: e, url: n, unsafeUrl: r } = t, o = new MutationObserver((a) => {
392
+ const i = document.querySelector(`[data-annotation-id="${e}"]`);
393
+ if (i) {
394
+ const s = i.querySelector("a"), l = _r((n || r) ?? "", "");
395
+ s && (s.setAttribute("target", "_blank"), s.setAttribute("href", l), s.setAttribute("rel", "noopener noreferrer")), o.disconnect();
396
+ }
397
+ });
398
+ o.observe(document.body, { childList: !0, subtree: !0 });
399
+ }
400
+ const Nr = (t) => {
401
+ const n = t.target.parentNode;
402
+ if (!n)
403
+ return;
404
+ const r = new MutationObserver((o) => {
405
+ o.forEach(() => {
406
+ n.querySelectorAll(
407
+ '[data-l10n-id="pdfjs-annotation-date-time-string"]'
408
+ ).forEach((i) => {
409
+ const s = i.getAttribute("data-l10n-args");
410
+ if (s)
411
+ try {
412
+ const { dateObj: l } = JSON.parse(s);
413
+ i.textContent = et(l);
414
+ } catch {
415
+ }
416
+ });
417
+ });
418
+ });
419
+ return r.observe(n, {
420
+ childList: !0,
421
+ // Watch for changes to child elements
422
+ subtree: !0,
423
+ // Watch all descendants, not just direct children
424
+ attributes: !0
425
+ // Watch for changes to attributes
426
+ }), () => r.disconnect();
427
+ }, xt = (t, e, n, r) => {
428
+ if (t.type !== "click")
429
+ return;
430
+ const o = t.target, a = o.getAttribute("data-element-id");
431
+ if (o.getAttribute("href"))
432
+ return;
433
+ const s = e.find((l) => l.id === a);
434
+ !s || s.annotationType !== nt.Link || tn(n, s.dest).then((l) => {
435
+ r(l);
436
+ });
437
+ };
438
+ function Or(t, e) {
439
+ for (const n of Qt)
440
+ t.addEventListener(n, e);
441
+ }
442
+ function Dr(t, e) {
443
+ for (const n of Qt)
444
+ t.removeEventListener(n, e);
445
+ }
446
+ const zr = (t) => {
447
+ const { pageNumber: e } = t, n = $(null), { pages: r, pdf: o } = J(), a = $(), [i, s] = k(), [l, h] = k(null), [p, m] = k(), { setFocusedPage: u, goToPage: f } = te(), { scrollMode: v } = be(), _ = O(() => r.get(e), [r, e]), g = O(() => _ == null ? void 0 : _.page.getViewport(), [_]);
448
+ A(() => {
449
+ o == null || o.hasJSActions().then((w) => {
450
+ s(w);
451
+ }), o == null || o.getFieldObjects().then((w) => {
452
+ h(w);
453
+ }), a.current && (a.current.div.replaceChildren(), a.current = void 0);
454
+ }, [o]);
455
+ const S = O(() => o == null ? void 0 : o.annotationStorage, [o]);
456
+ A(() => {
457
+ _ && _.page.getAnnotations().then((w) => {
458
+ a.current = void 0, m(w), n.current && (n.current.innerText = "");
459
+ });
460
+ }, [_]);
461
+ const x = y(
462
+ (w) => {
463
+ Nr(w), !(!p || !o) && (v === ee.PAGE_SCROLLING ? xt(w, p, o, (P) => u(P.pageIndex + 1)) : xt(w, p, o, (P) => f(P.pageIndex + 1)));
464
+ },
465
+ [o, p, f, u, v]
466
+ );
467
+ return A(() => {
468
+ if (!_ || !p)
469
+ return;
470
+ const w = _.page.getViewport();
471
+ if (a.current) {
472
+ a.current.update({
473
+ viewport: w.clone({ dontFlip: !0 })
474
+ });
475
+ return;
476
+ }
477
+ for (const P of p) {
478
+ const { annotationType: d } = P;
479
+ switch (d) {
480
+ case nt.Link:
481
+ Lr(P);
482
+ break;
483
+ case nt.Widget:
484
+ break;
485
+ }
486
+ }
487
+ a.current = new Yn({
488
+ div: n.current,
489
+ accessibilityManager: void 0,
490
+ annotationCanvasMap: void 0,
491
+ annotationEditorUIManager: void 0,
492
+ structTreeLayer: void 0,
493
+ page: _.page,
494
+ viewport: w.clone({ dontFlip: !0 })
495
+ }), n.current && Dr(n.current, x), a.current.render({
496
+ annotations: p,
497
+ annotationStorage: S,
498
+ hasJSActions: i,
499
+ fieldObjects: l,
500
+ div: n.current,
501
+ viewport: w.clone({ dontFlip: !0 }),
502
+ page: _.page,
503
+ imageResourcesPath: Rr,
504
+ renderForms: !1,
505
+ linkService: new vr(),
506
+ downloadManager: null,
507
+ enableScripting: !1
508
+ }).then(() => {
509
+ n.current && Or(n.current, x);
510
+ });
511
+ }, [p, i, l, x]), /* @__PURE__ */ c(
512
+ "div",
513
+ {
514
+ "data-rp": `page-${e}-annotationLayer`,
515
+ style: { width: `${g == null ? void 0 : g.width}px`, height: `${g == null ? void 0 : g.height}px` },
516
+ className: yr["rp-annotation-layer"],
517
+ ref: n
518
+ }
519
+ );
520
+ }, Ar = Array.from({ length: 21 }, (t, e) => Number((e * 0.05).toFixed(2))), gt = ct((t, e) => {
521
+ const { pageNumber: n, style: r, onIntersectRatioChange: o, ...a } = t, { pages: i } = J(), { rotate: s } = He(), { textLayer: l } = Un(), { currentZoom: h } = ht(), p = $(i.get(n)), [m, u] = k(!1), f = $(null), [v, _] = k({
522
+ width: 0,
523
+ height: 0
524
+ });
525
+ Vt(e, () => f.current), A(() => {
526
+ if (i && (p.current = i.get(n), p.current)) {
527
+ const w = p.current.page.getViewport({ scale: h, rotation: s });
528
+ _(w);
529
+ }
530
+ }, [i, n, s, h]);
531
+ const g = O(() => {
532
+ switch (s) {
533
+ case 90:
534
+ return `${v.width / 2}px ${v.width / 2}px`;
535
+ case -90:
536
+ case 270:
537
+ return `${v.height / 2}px ${v.height / 2}px`;
538
+ default:
539
+ return "center";
540
+ }
541
+ }, [s, v]), S = y(() => {
542
+ u(!0);
543
+ }, []), x = y(() => {
544
+ u(!1);
545
+ }, []);
546
+ return A(() => {
547
+ const w = new IntersectionObserver(
548
+ (P) => {
549
+ o && o(n, P[0].intersectionRatio);
550
+ },
551
+ { threshold: Ar }
552
+ );
553
+ return f.current && w.observe(f.current), () => {
554
+ w.disconnect(), o && o(n, -1);
555
+ };
556
+ }, [o, n, s]), /* @__PURE__ */ c(
557
+ "div",
558
+ {
559
+ ref: f,
560
+ id: `page-${n}`,
561
+ "data-rp": `page-${n}`,
562
+ ...a,
563
+ style: {
564
+ ...r,
565
+ "--rp-rotate": `${s}deg`,
566
+ "--rp-page-rotate-translate": `${g}`,
567
+ "--scale-factor": h
568
+ },
569
+ className: Ze["rp-page-wrapper"],
570
+ children: /* @__PURE__ */ D(
571
+ "div",
572
+ {
573
+ style: {
574
+ width: `${v.width}px`,
575
+ height: `${v.height}px`
576
+ },
577
+ className: Ze["rp-page"],
578
+ children: [
579
+ /* @__PURE__ */ c(Pr, { onLoading: S, onLoaded: x, pageNumber: n }),
580
+ m && /* @__PURE__ */ c("div", { className: Ze["rp-loader-wrapper"], children: /* @__PURE__ */ c(lt, {}) }),
581
+ l && /* @__PURE__ */ c(xr, { pageNumber: n }),
582
+ /* @__PURE__ */ c(zr, { pageNumber: n })
583
+ ]
584
+ }
585
+ )
586
+ }
587
+ );
588
+ });
589
+ function ot() {
590
+ return ot = Object.assign ? Object.assign.bind() : function(t) {
591
+ for (var e = 1; e < arguments.length; e++) {
592
+ var n = arguments[e];
593
+ for (var r in n)
594
+ ({}).hasOwnProperty.call(n, r) && (t[r] = n[r]);
595
+ }
596
+ return t;
597
+ }, ot.apply(null, arguments);
598
+ }
599
+ function yt(t) {
600
+ if (t === void 0)
601
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
602
+ return t;
603
+ }
604
+ function at(t, e) {
605
+ return at = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, r) {
606
+ return n.__proto__ = r, n;
607
+ }, at(t, e);
608
+ }
609
+ function Fr(t, e) {
610
+ t.prototype = Object.create(e.prototype), t.prototype.constructor = t, at(t, e);
611
+ }
612
+ var Rt = Number.isNaN || function(e) {
613
+ return typeof e == "number" && e !== e;
614
+ };
615
+ function kr(t, e) {
616
+ return !!(t === e || Rt(t) && Rt(e));
617
+ }
618
+ function Wr(t, e) {
619
+ if (t.length !== e.length)
620
+ return !1;
621
+ for (var n = 0; n < t.length; n++)
622
+ if (!kr(t[n], e[n]))
623
+ return !1;
624
+ return !0;
625
+ }
626
+ function Be(t, e) {
627
+ e === void 0 && (e = Wr);
628
+ var n, r = [], o, a = !1;
629
+ function i() {
630
+ for (var s = [], l = 0; l < arguments.length; l++)
631
+ s[l] = arguments[l];
632
+ return a && n === this && e(s, r) || (o = t.apply(this, s), a = !0, n = this, r = s), o;
633
+ }
634
+ return i;
635
+ }
636
+ function Mt(t, e) {
637
+ if (t == null)
638
+ return {};
639
+ var n = {};
640
+ for (var r in t)
641
+ if ({}.hasOwnProperty.call(t, r)) {
642
+ if (e.includes(r))
643
+ continue;
644
+ n[r] = t[r];
645
+ }
646
+ return n;
647
+ }
648
+ var Hr = typeof performance == "object" && typeof performance.now == "function", Et = Hr ? function() {
649
+ return performance.now();
650
+ } : function() {
651
+ return Date.now();
652
+ };
653
+ function Lt(t) {
654
+ cancelAnimationFrame(t.id);
655
+ }
656
+ function $r(t, e) {
657
+ var n = Et();
658
+ function r() {
659
+ Et() - n >= e ? t.call(null) : o.id = requestAnimationFrame(r);
660
+ }
661
+ var o = {
662
+ id: requestAnimationFrame(r)
663
+ };
664
+ return o;
665
+ }
666
+ var Ke = -1;
667
+ function Vr(t) {
668
+ if (t === void 0 && (t = !1), Ke === -1 || t) {
669
+ var e = document.createElement("div"), n = e.style;
670
+ n.width = "50px", n.height = "50px", n.overflow = "scroll", document.body.appendChild(e), Ke = e.offsetWidth - e.clientWidth, document.body.removeChild(e);
671
+ }
672
+ return Ke;
673
+ }
674
+ var _e = null;
675
+ function Nt(t) {
676
+ if (t === void 0 && (t = !1), _e === null || t) {
677
+ var e = document.createElement("div"), n = e.style;
678
+ n.width = "50px", n.height = "50px", n.overflow = "scroll", n.direction = "rtl";
679
+ var r = document.createElement("div"), o = r.style;
680
+ return o.width = "100px", o.height = "100px", e.appendChild(r), document.body.appendChild(e), e.scrollLeft > 0 ? _e = "positive-descending" : (e.scrollLeft = 1, e.scrollLeft === 0 ? _e = "negative" : _e = "positive-ascending"), document.body.removeChild(e), _e;
681
+ }
682
+ return _e;
683
+ }
684
+ var Gr = 150, Ur = function(e) {
685
+ var n = e.columnIndex;
686
+ e.data;
687
+ var r = e.rowIndex;
688
+ return r + ":" + n;
689
+ }, Ee = null, Le = null, Ne = null;
690
+ process.env.NODE_ENV !== "production" && typeof window < "u" && typeof window.WeakSet < "u" && (Ee = /* @__PURE__ */ new WeakSet(), Le = /* @__PURE__ */ new WeakSet(), Ne = /* @__PURE__ */ new WeakSet());
691
+ function qr(t) {
692
+ var e, n = t.getColumnOffset, r = t.getColumnStartIndexForOffset, o = t.getColumnStopIndexForStartIndex, a = t.getColumnWidth, i = t.getEstimatedTotalHeight, s = t.getEstimatedTotalWidth, l = t.getOffsetForColumnAndAlignment, h = t.getOffsetForRowAndAlignment, p = t.getRowHeight, m = t.getRowOffset, u = t.getRowStartIndexForOffset, f = t.getRowStopIndexForStartIndex, v = t.initInstanceProps, _ = t.shouldResetStyleCacheOnItemSizeChange, g = t.validateProps;
693
+ return e = /* @__PURE__ */ function(S) {
694
+ Fr(x, S);
695
+ function x(P) {
696
+ var d;
697
+ return d = S.call(this, P) || this, d._instanceProps = v(d.props, yt(d)), d._resetIsScrollingTimeoutId = null, d._outerRef = void 0, d.state = {
698
+ instance: yt(d),
699
+ isScrolling: !1,
700
+ horizontalScrollDirection: "forward",
701
+ scrollLeft: typeof d.props.initialScrollLeft == "number" ? d.props.initialScrollLeft : 0,
702
+ scrollTop: typeof d.props.initialScrollTop == "number" ? d.props.initialScrollTop : 0,
703
+ scrollUpdateWasRequested: !1,
704
+ verticalScrollDirection: "forward"
705
+ }, d._callOnItemsRendered = void 0, d._callOnItemsRendered = Be(function(T, b, C, L, I, M, E, R) {
706
+ return d.props.onItemsRendered({
707
+ overscanColumnStartIndex: T,
708
+ overscanColumnStopIndex: b,
709
+ overscanRowStartIndex: C,
710
+ overscanRowStopIndex: L,
711
+ visibleColumnStartIndex: I,
712
+ visibleColumnStopIndex: M,
713
+ visibleRowStartIndex: E,
714
+ visibleRowStopIndex: R
715
+ });
716
+ }), d._callOnScroll = void 0, d._callOnScroll = Be(function(T, b, C, L, I) {
717
+ return d.props.onScroll({
718
+ horizontalScrollDirection: C,
719
+ scrollLeft: T,
720
+ scrollTop: b,
721
+ verticalScrollDirection: L,
722
+ scrollUpdateWasRequested: I
723
+ });
724
+ }), d._getItemStyle = void 0, d._getItemStyle = function(T, b) {
725
+ var C = d.props, L = C.columnWidth, I = C.direction, M = C.rowHeight, E = d._getItemStyleCache(_ && L, _ && I, _ && M), R = T + ":" + b, N;
726
+ if (E.hasOwnProperty(R))
727
+ N = E[R];
728
+ else {
729
+ var z = n(d.props, b, d._instanceProps), W = I === "rtl";
730
+ E[R] = N = {
731
+ position: "absolute",
732
+ left: W ? void 0 : z,
733
+ right: W ? z : void 0,
734
+ top: m(d.props, T, d._instanceProps),
735
+ height: p(d.props, T, d._instanceProps),
736
+ width: a(d.props, b, d._instanceProps)
737
+ };
738
+ }
739
+ return N;
740
+ }, d._getItemStyleCache = void 0, d._getItemStyleCache = Be(function(T, b, C) {
741
+ return {};
742
+ }), d._onScroll = function(T) {
743
+ var b = T.currentTarget, C = b.clientHeight, L = b.clientWidth, I = b.scrollLeft, M = b.scrollTop, E = b.scrollHeight, R = b.scrollWidth;
744
+ d.setState(function(N) {
745
+ if (N.scrollLeft === I && N.scrollTop === M)
746
+ return null;
747
+ var z = d.props.direction, W = I;
748
+ if (z === "rtl")
749
+ switch (Nt()) {
750
+ case "negative":
751
+ W = -I;
752
+ break;
753
+ case "positive-descending":
754
+ W = R - L - I;
755
+ break;
756
+ }
757
+ W = Math.max(0, Math.min(W, R - L));
758
+ var G = Math.max(0, Math.min(M, E - C));
759
+ return {
760
+ isScrolling: !0,
761
+ horizontalScrollDirection: N.scrollLeft < I ? "forward" : "backward",
762
+ scrollLeft: W,
763
+ scrollTop: G,
764
+ verticalScrollDirection: N.scrollTop < M ? "forward" : "backward",
765
+ scrollUpdateWasRequested: !1
766
+ };
767
+ }, d._resetIsScrollingDebounced);
768
+ }, d._outerRefSetter = function(T) {
769
+ var b = d.props.outerRef;
770
+ d._outerRef = T, typeof b == "function" ? b(T) : b != null && typeof b == "object" && b.hasOwnProperty("current") && (b.current = T);
771
+ }, d._resetIsScrollingDebounced = function() {
772
+ d._resetIsScrollingTimeoutId !== null && Lt(d._resetIsScrollingTimeoutId), d._resetIsScrollingTimeoutId = $r(d._resetIsScrolling, Gr);
773
+ }, d._resetIsScrolling = function() {
774
+ d._resetIsScrollingTimeoutId = null, d.setState({
775
+ isScrolling: !1
776
+ }, function() {
777
+ d._getItemStyleCache(-1);
778
+ });
779
+ }, d;
780
+ }
781
+ x.getDerivedStateFromProps = function(d, T) {
782
+ return Zr(d, T), g(d), null;
783
+ };
784
+ var w = x.prototype;
785
+ return w.scrollTo = function(d) {
786
+ var T = d.scrollLeft, b = d.scrollTop;
787
+ T !== void 0 && (T = Math.max(0, T)), b !== void 0 && (b = Math.max(0, b)), this.setState(function(C) {
788
+ return T === void 0 && (T = C.scrollLeft), b === void 0 && (b = C.scrollTop), C.scrollLeft === T && C.scrollTop === b ? null : {
789
+ horizontalScrollDirection: C.scrollLeft < T ? "forward" : "backward",
790
+ scrollLeft: T,
791
+ scrollTop: b,
792
+ scrollUpdateWasRequested: !0,
793
+ verticalScrollDirection: C.scrollTop < b ? "forward" : "backward"
794
+ };
795
+ }, this._resetIsScrollingDebounced);
796
+ }, w.scrollToItem = function(d) {
797
+ var T = d.align, b = T === void 0 ? "auto" : T, C = d.columnIndex, L = d.rowIndex, I = this.props, M = I.columnCount, E = I.height, R = I.rowCount, N = I.width, z = this.state, W = z.scrollLeft, G = z.scrollTop, Z = Vr();
798
+ C !== void 0 && (C = Math.max(0, Math.min(C, M - 1))), L !== void 0 && (L = Math.max(0, Math.min(L, R - 1)));
799
+ var U = i(this.props, this._instanceProps), j = s(this.props, this._instanceProps), le = j > N ? Z : 0, ne = U > E ? Z : 0;
800
+ this.scrollTo({
801
+ scrollLeft: C !== void 0 ? l(this.props, C, b, W, this._instanceProps, ne) : W,
802
+ scrollTop: L !== void 0 ? h(this.props, L, b, G, this._instanceProps, le) : G
803
+ });
804
+ }, w.componentDidMount = function() {
805
+ var d = this.props, T = d.initialScrollLeft, b = d.initialScrollTop;
806
+ if (this._outerRef != null) {
807
+ var C = this._outerRef;
808
+ typeof T == "number" && (C.scrollLeft = T), typeof b == "number" && (C.scrollTop = b);
809
+ }
810
+ this._callPropsCallbacks();
811
+ }, w.componentDidUpdate = function() {
812
+ var d = this.props.direction, T = this.state, b = T.scrollLeft, C = T.scrollTop, L = T.scrollUpdateWasRequested;
813
+ if (L && this._outerRef != null) {
814
+ var I = this._outerRef;
815
+ if (d === "rtl")
816
+ switch (Nt()) {
817
+ case "negative":
818
+ I.scrollLeft = -b;
819
+ break;
820
+ case "positive-ascending":
821
+ I.scrollLeft = b;
822
+ break;
823
+ default:
824
+ var M = I.clientWidth, E = I.scrollWidth;
825
+ I.scrollLeft = E - M - b;
826
+ break;
827
+ }
828
+ else
829
+ I.scrollLeft = Math.max(0, b);
830
+ I.scrollTop = Math.max(0, C);
831
+ }
832
+ this._callPropsCallbacks();
833
+ }, w.componentWillUnmount = function() {
834
+ this._resetIsScrollingTimeoutId !== null && Lt(this._resetIsScrollingTimeoutId);
835
+ }, w.render = function() {
836
+ var d = this.props, T = d.children, b = d.className, C = d.columnCount, L = d.direction, I = d.height, M = d.innerRef, E = d.innerElementType, R = d.innerTagName, N = d.itemData, z = d.itemKey, W = z === void 0 ? Ur : z, G = d.outerElementType, Z = d.outerTagName, U = d.rowCount, j = d.style, le = d.useIsScrolling, ne = d.width, me = this.state.isScrolling, ge = this._getHorizontalRangeToRender(), Ce = ge[0], F = ge[1], H = this._getVerticalRangeToRender(), q = H[0], se = H[1], Se = [];
837
+ if (C > 0 && U)
838
+ for (var ue = q; ue <= se; ue++)
839
+ for (var de = Ce; de <= F; de++)
840
+ Se.push(Me(T, {
841
+ columnIndex: de,
842
+ data: N,
843
+ isScrolling: le ? me : void 0,
844
+ key: W({
845
+ columnIndex: de,
846
+ data: N,
847
+ rowIndex: ue
848
+ }),
849
+ rowIndex: ue,
850
+ style: this._getItemStyle(ue, de)
851
+ }));
852
+ var Ge = i(this.props, this._instanceProps), Ue = s(this.props, this._instanceProps);
853
+ return Me(G || Z || "div", {
854
+ className: b,
855
+ onScroll: this._onScroll,
856
+ ref: this._outerRefSetter,
857
+ style: ot({
858
+ position: "relative",
859
+ height: I,
860
+ width: ne,
861
+ overflow: "auto",
862
+ WebkitOverflowScrolling: "touch",
863
+ willChange: "transform",
864
+ direction: L
865
+ }, j)
866
+ }, Me(E || R || "div", {
867
+ children: Se,
868
+ ref: M,
869
+ style: {
870
+ height: Ge,
871
+ pointerEvents: me ? "none" : void 0,
872
+ width: Ue
873
+ }
874
+ }));
875
+ }, w._callPropsCallbacks = function() {
876
+ var d = this.props, T = d.columnCount, b = d.onItemsRendered, C = d.onScroll, L = d.rowCount;
877
+ if (typeof b == "function" && T > 0 && L > 0) {
878
+ var I = this._getHorizontalRangeToRender(), M = I[0], E = I[1], R = I[2], N = I[3], z = this._getVerticalRangeToRender(), W = z[0], G = z[1], Z = z[2], U = z[3];
879
+ this._callOnItemsRendered(M, E, W, G, R, N, Z, U);
880
+ }
881
+ if (typeof C == "function") {
882
+ var j = this.state, le = j.horizontalScrollDirection, ne = j.scrollLeft, me = j.scrollTop, ge = j.scrollUpdateWasRequested, Ce = j.verticalScrollDirection;
883
+ this._callOnScroll(ne, me, le, Ce, ge);
884
+ }
885
+ }, w._getHorizontalRangeToRender = function() {
886
+ var d = this.props, T = d.columnCount, b = d.overscanColumnCount, C = d.overscanColumnsCount, L = d.overscanCount, I = d.rowCount, M = this.state, E = M.horizontalScrollDirection, R = M.isScrolling, N = M.scrollLeft, z = b || C || L || 1;
887
+ if (T === 0 || I === 0)
888
+ return [0, 0, 0, 0];
889
+ var W = r(this.props, N, this._instanceProps), G = o(this.props, W, N, this._instanceProps), Z = !R || E === "backward" ? Math.max(1, z) : 1, U = !R || E === "forward" ? Math.max(1, z) : 1;
890
+ return [Math.max(0, W - Z), Math.max(0, Math.min(T - 1, G + U)), W, G];
891
+ }, w._getVerticalRangeToRender = function() {
892
+ var d = this.props, T = d.columnCount, b = d.overscanCount, C = d.overscanRowCount, L = d.overscanRowsCount, I = d.rowCount, M = this.state, E = M.isScrolling, R = M.verticalScrollDirection, N = M.scrollTop, z = C || L || b || 1;
893
+ if (T === 0 || I === 0)
894
+ return [0, 0, 0, 0];
895
+ var W = u(this.props, N, this._instanceProps), G = f(this.props, W, N, this._instanceProps), Z = !E || R === "backward" ? Math.max(1, z) : 1, U = !E || R === "forward" ? Math.max(1, z) : 1;
896
+ return [Math.max(0, W - Z), Math.max(0, Math.min(I - 1, G + U)), W, G];
897
+ }, x;
898
+ }(Mn), e.defaultProps = {
899
+ direction: "ltr",
900
+ itemData: void 0,
901
+ useIsScrolling: !1
902
+ }, e;
903
+ }
904
+ var Zr = function(e, n) {
905
+ var r = e.children, o = e.direction, a = e.height, i = e.innerTagName, s = e.outerTagName, l = e.overscanColumnsCount, h = e.overscanCount, p = e.overscanRowsCount, m = e.width, u = n.instance;
906
+ if (process.env.NODE_ENV !== "production") {
907
+ if (typeof h == "number" && Ee && !Ee.has(u) && (Ee.add(u), console.warn("The overscanCount prop has been deprecated. Please use the overscanColumnCount and overscanRowCount props instead.")), (typeof l == "number" || typeof p == "number") && Le && !Le.has(u) && (Le.add(u), console.warn("The overscanColumnsCount and overscanRowsCount props have been deprecated. Please use the overscanColumnCount and overscanRowCount props instead.")), (i != null || s != null) && Ne && !Ne.has(u) && (Ne.add(u), console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead.")), r == null)
908
+ throw Error('An invalid "children" prop has been specified. Value should be a React component. ' + ('"' + (r === null ? "null" : typeof r) + '" was specified.'));
909
+ switch (o) {
910
+ case "ltr":
911
+ case "rtl":
912
+ break;
913
+ default:
914
+ throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". ' + ('"' + o + '" was specified.'));
915
+ }
916
+ if (typeof m != "number")
917
+ throw Error('An invalid "width" prop has been specified. Grids must specify a number for width. ' + ('"' + (m === null ? "null" : typeof m) + '" was specified.'));
918
+ if (typeof a != "number")
919
+ throw Error('An invalid "height" prop has been specified. Grids must specify a number for height. ' + ('"' + (a === null ? "null" : typeof a) + '" was specified.'));
920
+ }
921
+ }, Ot = 50, nn = function(e, n) {
922
+ var r = e.rowCount, o = n.rowMetadataMap, a = n.estimatedRowHeight, i = n.lastMeasuredRowIndex, s = 0;
923
+ if (i >= r && (i = r - 1), i >= 0) {
924
+ var l = o[i];
925
+ s = l.offset + l.size;
926
+ }
927
+ var h = r - i - 1, p = h * a;
928
+ return s + p;
929
+ }, rn = function(e, n) {
930
+ var r = e.columnCount, o = n.columnMetadataMap, a = n.estimatedColumnWidth, i = n.lastMeasuredColumnIndex, s = 0;
931
+ if (i >= r && (i = r - 1), i >= 0) {
932
+ var l = o[i];
933
+ s = l.offset + l.size;
934
+ }
935
+ var h = r - i - 1, p = h * a;
936
+ return s + p;
937
+ }, oe = function(e, n, r, o) {
938
+ var a, i, s;
939
+ if (e === "column" ? (a = o.columnMetadataMap, i = n.columnWidth, s = o.lastMeasuredColumnIndex) : (a = o.rowMetadataMap, i = n.rowHeight, s = o.lastMeasuredRowIndex), r > s) {
940
+ var l = 0;
941
+ if (s >= 0) {
942
+ var h = a[s];
943
+ l = h.offset + h.size;
944
+ }
945
+ for (var p = s + 1; p <= r; p++) {
946
+ var m = i(p);
947
+ a[p] = {
948
+ offset: l,
949
+ size: m
950
+ }, l += m;
951
+ }
952
+ e === "column" ? o.lastMeasuredColumnIndex = r : o.lastMeasuredRowIndex = r;
953
+ }
954
+ return a[r];
955
+ }, Dt = function(e, n, r, o) {
956
+ var a, i;
957
+ e === "column" ? (a = r.columnMetadataMap, i = r.lastMeasuredColumnIndex) : (a = r.rowMetadataMap, i = r.lastMeasuredRowIndex);
958
+ var s = i > 0 ? a[i].offset : 0;
959
+ return s >= o ? on(e, n, r, i, 0, o) : jr(e, n, r, Math.max(0, i), o);
960
+ }, on = function(e, n, r, o, a, i) {
961
+ for (; a <= o; ) {
962
+ var s = a + Math.floor((o - a) / 2), l = oe(e, n, s, r).offset;
963
+ if (l === i)
964
+ return s;
965
+ l < i ? a = s + 1 : l > i && (o = s - 1);
966
+ }
967
+ return a > 0 ? a - 1 : 0;
968
+ }, jr = function(e, n, r, o, a) {
969
+ for (var i = e === "column" ? n.columnCount : n.rowCount, s = 1; o < i && oe(e, n, o, r).offset < a; )
970
+ o += s, s *= 2;
971
+ return on(e, n, r, Math.min(o, i - 1), Math.floor(o / 2), a);
972
+ }, zt = function(e, n, r, o, a, i, s) {
973
+ var l = e === "column" ? n.width : n.height, h = oe(e, n, r, i), p = e === "column" ? rn(n, i) : nn(n, i), m = Math.max(0, Math.min(p - l, h.offset)), u = Math.max(0, h.offset - l + s + h.size);
974
+ switch (o === "smart" && (a >= u - l && a <= m + l ? o = "auto" : o = "center"), o) {
975
+ case "start":
976
+ return m;
977
+ case "end":
978
+ return u;
979
+ case "center":
980
+ return Math.round(u + (m - u) / 2);
981
+ case "auto":
982
+ default:
983
+ return a >= u && a <= m ? a : u > m || a < u ? u : m;
984
+ }
985
+ }, Br = /* @__PURE__ */ qr({
986
+ getColumnOffset: function(e, n, r) {
987
+ return oe("column", e, n, r).offset;
988
+ },
989
+ getColumnStartIndexForOffset: function(e, n, r) {
990
+ return Dt("column", e, r, n);
991
+ },
992
+ getColumnStopIndexForStartIndex: function(e, n, r, o) {
993
+ for (var a = e.columnCount, i = e.width, s = oe("column", e, n, o), l = r + i, h = s.offset + s.size, p = n; p < a - 1 && h < l; )
994
+ p++, h += oe("column", e, p, o).size;
995
+ return p;
996
+ },
997
+ getColumnWidth: function(e, n, r) {
998
+ return r.columnMetadataMap[n].size;
999
+ },
1000
+ getEstimatedTotalHeight: nn,
1001
+ getEstimatedTotalWidth: rn,
1002
+ getOffsetForColumnAndAlignment: function(e, n, r, o, a, i) {
1003
+ return zt("column", e, n, r, o, a, i);
1004
+ },
1005
+ getOffsetForRowAndAlignment: function(e, n, r, o, a, i) {
1006
+ return zt("row", e, n, r, o, a, i);
1007
+ },
1008
+ getRowOffset: function(e, n, r) {
1009
+ return oe("row", e, n, r).offset;
1010
+ },
1011
+ getRowHeight: function(e, n, r) {
1012
+ return r.rowMetadataMap[n].size;
1013
+ },
1014
+ getRowStartIndexForOffset: function(e, n, r) {
1015
+ return Dt("row", e, r, n);
1016
+ },
1017
+ getRowStopIndexForStartIndex: function(e, n, r, o) {
1018
+ for (var a = e.rowCount, i = e.height, s = oe("row", e, n, o), l = r + i, h = s.offset + s.size, p = n; p < a - 1 && h < l; )
1019
+ p++, h += oe("row", e, p, o).size;
1020
+ return p;
1021
+ },
1022
+ initInstanceProps: function(e, n) {
1023
+ var r = e, o = r.estimatedColumnWidth, a = r.estimatedRowHeight, i = {
1024
+ columnMetadataMap: {},
1025
+ estimatedColumnWidth: o || Ot,
1026
+ estimatedRowHeight: a || Ot,
1027
+ lastMeasuredColumnIndex: -1,
1028
+ lastMeasuredRowIndex: -1,
1029
+ rowMetadataMap: {}
1030
+ };
1031
+ return n.resetAfterColumnIndex = function(s, l) {
1032
+ l === void 0 && (l = !0), n.resetAfterIndices({
1033
+ columnIndex: s,
1034
+ shouldForceUpdate: l
1035
+ });
1036
+ }, n.resetAfterRowIndex = function(s, l) {
1037
+ l === void 0 && (l = !0), n.resetAfterIndices({
1038
+ rowIndex: s,
1039
+ shouldForceUpdate: l
1040
+ });
1041
+ }, n.resetAfterIndices = function(s) {
1042
+ var l = s.columnIndex, h = s.rowIndex, p = s.shouldForceUpdate, m = p === void 0 ? !0 : p;
1043
+ typeof l == "number" && (i.lastMeasuredColumnIndex = Math.min(i.lastMeasuredColumnIndex, l - 1)), typeof h == "number" && (i.lastMeasuredRowIndex = Math.min(i.lastMeasuredRowIndex, h - 1)), n._getItemStyleCache(-1), m && n.forceUpdate();
1044
+ }, i;
1045
+ },
1046
+ shouldResetStyleCacheOnItemSizeChange: !1,
1047
+ validateProps: function(e) {
1048
+ var n = e.columnWidth, r = e.rowHeight;
1049
+ if (process.env.NODE_ENV !== "production") {
1050
+ if (typeof n != "function")
1051
+ throw Error('An invalid "columnWidth" prop has been specified. Value should be a function. ' + ('"' + (n === null ? "null" : typeof n) + '" was specified.'));
1052
+ if (typeof r != "function")
1053
+ throw Error('An invalid "rowHeight" prop has been specified. Value should be a function. ' + ('"' + (r === null ? "null" : typeof r) + '" was specified.'));
1054
+ }
1055
+ }
1056
+ });
1057
+ process.env.NODE_ENV;
1058
+ function At(t, e) {
1059
+ for (var n in t)
1060
+ if (!(n in e))
1061
+ return !0;
1062
+ for (var r in e)
1063
+ if (t[r] !== e[r])
1064
+ return !0;
1065
+ return !1;
1066
+ }
1067
+ var Kr = ["style"], Jr = ["style"];
1068
+ function Xr(t, e) {
1069
+ var n = t.style, r = Mt(t, Kr), o = e.style, a = Mt(e, Jr);
1070
+ return !At(n, o) && !At(r, a);
1071
+ }
1072
+ const Yr = () => {
1073
+ const { viewMode: t } = $e(), { scrollMode: e } = be(), { setColumnCount: n } = Zt(), { virtualScrollableElementRef: r } = Ve(), o = Jt(), a = y(
1074
+ (f) => o.widths[f] || 0,
1075
+ [o]
1076
+ ), i = y(
1077
+ (f) => o.heights[f] || 0,
1078
+ [o]
1079
+ ), s = O(() => o.heights.length, [o]), l = O(() => Math.max(...o.widths), [o]), h = O(() => e === ee.HORIZONTAL_SCROLLING ? s : t === ze.DUAL_PAGE ? 2 : 1, [t, e, e, s, r, l]);
1080
+ A(() => {
1081
+ n(h);
1082
+ }, [h, n]);
1083
+ const p = O(() => e === ee.HORIZONTAL_SCROLLING || e === ee.PAGE_SCROLLING ? 1 : Math.round(s / h), [h, s, e]), m = O(() => o.heights.reduce((f, v) => f + v, 0) / o.heights.length || 0, [o]), u = O(() => o.widths.reduce((f, v) => f + v, 0) / o.heights.length || 0, [o]);
1084
+ return {
1085
+ rowCount: p,
1086
+ rowHeight: i,
1087
+ columnCount: h,
1088
+ columnWidth: a,
1089
+ pageDimension: o,
1090
+ estimatedRowHeight: m,
1091
+ estimatedColumnWidth: u
1092
+ };
1093
+ };
1094
+ let K;
1095
+ typeof window < "u" ? K = window : typeof self < "u" ? K = self : K = global;
1096
+ let st = null, it = null;
1097
+ const Ft = 20, Je = K.clearTimeout, kt = K.setTimeout, Xe = K.cancelAnimationFrame || K.mozCancelAnimationFrame || K.webkitCancelAnimationFrame, Wt = K.requestAnimationFrame || K.mozRequestAnimationFrame || K.webkitRequestAnimationFrame;
1098
+ Xe == null || Wt == null ? (st = Je, it = function(e) {
1099
+ return kt(e, Ft);
1100
+ }) : (st = function([e, n]) {
1101
+ Xe(e), Je(n);
1102
+ }, it = function(e) {
1103
+ const n = Wt(function() {
1104
+ Je(r), e();
1105
+ }), r = kt(function() {
1106
+ Xe(n), e();
1107
+ }, Ft);
1108
+ return [n, r];
1109
+ });
1110
+ function Qr(t) {
1111
+ let e, n, r, o, a, i, s;
1112
+ const l = typeof document < "u" && document.attachEvent;
1113
+ if (!l) {
1114
+ i = function(S) {
1115
+ const x = S.__resizeTriggers__, w = x.firstElementChild, P = x.lastElementChild, d = w.firstElementChild;
1116
+ P.scrollLeft = P.scrollWidth, P.scrollTop = P.scrollHeight, d.style.width = w.offsetWidth + 1 + "px", d.style.height = w.offsetHeight + 1 + "px", w.scrollLeft = w.scrollWidth, w.scrollTop = w.scrollHeight;
1117
+ }, a = function(S) {
1118
+ return S.offsetWidth !== S.__resizeLast__.width || S.offsetHeight !== S.__resizeLast__.height;
1119
+ }, s = function(S) {
1120
+ if (S.target.className && typeof S.target.className.indexOf == "function" && S.target.className.indexOf("contract-trigger") < 0 && S.target.className.indexOf("expand-trigger") < 0)
1121
+ return;
1122
+ const x = this;
1123
+ i(this), this.__resizeRAF__ && st(this.__resizeRAF__), this.__resizeRAF__ = it(function() {
1124
+ a(x) && (x.__resizeLast__.width = x.offsetWidth, x.__resizeLast__.height = x.offsetHeight, x.__resizeListeners__.forEach(function(d) {
1125
+ d.call(x, S);
1126
+ }));
1127
+ });
1128
+ };
1129
+ let u = !1, f = "";
1130
+ r = "animationstart";
1131
+ const v = "Webkit Moz O ms".split(" ");
1132
+ let _ = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "), g = "";
1133
+ {
1134
+ const S = document.createElement("fakeelement");
1135
+ if (S.style.animationName !== void 0 && (u = !0), u === !1) {
1136
+ for (let x = 0; x < v.length; x++)
1137
+ if (S.style[v[x] + "AnimationName"] !== void 0) {
1138
+ g = v[x], f = "-" + g.toLowerCase() + "-", r = _[x], u = !0;
1139
+ break;
1140
+ }
1141
+ }
1142
+ }
1143
+ n = "resizeanim", e = "@" + f + "keyframes " + n + " { from { opacity: 0; } to { opacity: 0; } } ", o = f + "animation: 1ms " + n + "; ";
1144
+ }
1145
+ const h = function(u) {
1146
+ if (!u.getElementById("detectElementResize")) {
1147
+ const f = (e || "") + ".resize-triggers { " + (o || "") + 'visibility: hidden; opacity: 0; } .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }', v = u.head || u.getElementsByTagName("head")[0], _ = u.createElement("style");
1148
+ _.id = "detectElementResize", _.type = "text/css", t != null && _.setAttribute("nonce", t), _.styleSheet ? _.styleSheet.cssText = f : _.appendChild(u.createTextNode(f)), v.appendChild(_);
1149
+ }
1150
+ };
1151
+ return {
1152
+ addResizeListener: function(u, f) {
1153
+ if (l)
1154
+ u.attachEvent("onresize", f);
1155
+ else {
1156
+ if (!u.__resizeTriggers__) {
1157
+ const v = u.ownerDocument, _ = K.getComputedStyle(u);
1158
+ _ && _.position === "static" && (u.style.position = "relative"), h(v), u.__resizeLast__ = {}, u.__resizeListeners__ = [], (u.__resizeTriggers__ = v.createElement("div")).className = "resize-triggers";
1159
+ const g = v.createElement("div");
1160
+ g.className = "expand-trigger", g.appendChild(v.createElement("div"));
1161
+ const S = v.createElement("div");
1162
+ S.className = "contract-trigger", u.__resizeTriggers__.appendChild(g), u.__resizeTriggers__.appendChild(S), u.appendChild(u.__resizeTriggers__), i(u), u.addEventListener("scroll", s, !0), r && (u.__resizeTriggers__.__animationListener__ = function(w) {
1163
+ w.animationName === n && i(u);
1164
+ }, u.__resizeTriggers__.addEventListener(r, u.__resizeTriggers__.__animationListener__));
1165
+ }
1166
+ u.__resizeListeners__.push(f);
1167
+ }
1168
+ },
1169
+ removeResizeListener: function(u, f) {
1170
+ if (l)
1171
+ u.detachEvent("onresize", f);
1172
+ else if (u.__resizeListeners__.splice(u.__resizeListeners__.indexOf(f), 1), !u.__resizeListeners__.length) {
1173
+ u.removeEventListener("scroll", s, !0), u.__resizeTriggers__.__animationListener__ && (u.__resizeTriggers__.removeEventListener(r, u.__resizeTriggers__.__animationListener__), u.__resizeTriggers__.__animationListener__ = null);
1174
+ try {
1175
+ u.__resizeTriggers__ = !u.removeChild(u.__resizeTriggers__);
1176
+ } catch {
1177
+ }
1178
+ }
1179
+ }
1180
+ };
1181
+ }
1182
+ class eo extends En {
1183
+ constructor(...e) {
1184
+ super(...e), this.state = {
1185
+ height: this.props.defaultHeight || 0,
1186
+ scaledHeight: this.props.defaultHeight || 0,
1187
+ scaledWidth: this.props.defaultWidth || 0,
1188
+ width: this.props.defaultWidth || 0
1189
+ }, this._autoSizer = null, this._detectElementResize = null, this._parentNode = null, this._resizeObserver = null, this._timeoutId = null, this._onResize = () => {
1190
+ this._timeoutId = null;
1191
+ const {
1192
+ disableHeight: n,
1193
+ disableWidth: r,
1194
+ onResize: o
1195
+ } = this.props;
1196
+ if (this._parentNode) {
1197
+ const a = window.getComputedStyle(this._parentNode) || {}, i = parseFloat(a.paddingLeft || "0"), s = parseFloat(a.paddingRight || "0"), l = parseFloat(a.paddingTop || "0"), h = parseFloat(a.paddingBottom || "0"), p = this._parentNode.getBoundingClientRect(), m = p.height - l - h, u = p.width - i - s, f = this._parentNode.offsetHeight - l - h, v = this._parentNode.offsetWidth - i - s;
1198
+ (!n && (this.state.height !== f || this.state.scaledHeight !== m) || !r && (this.state.width !== v || this.state.scaledWidth !== u)) && (this.setState({
1199
+ height: f,
1200
+ width: v,
1201
+ scaledHeight: m,
1202
+ scaledWidth: u
1203
+ }), typeof o == "function" && o({
1204
+ height: f,
1205
+ scaledHeight: m,
1206
+ scaledWidth: u,
1207
+ width: v
1208
+ }));
1209
+ }
1210
+ }, this._setRef = (n) => {
1211
+ this._autoSizer = n;
1212
+ };
1213
+ }
1214
+ componentDidMount() {
1215
+ const {
1216
+ nonce: e
1217
+ } = this.props, n = this._autoSizer ? this._autoSizer.parentNode : null;
1218
+ if (n != null && n.ownerDocument && n.ownerDocument.defaultView && n instanceof n.ownerDocument.defaultView.HTMLElement) {
1219
+ this._parentNode = n;
1220
+ const r = n.ownerDocument.defaultView.ResizeObserver;
1221
+ r != null ? (this._resizeObserver = new r(() => {
1222
+ this._timeoutId = setTimeout(this._onResize, 0);
1223
+ }), this._resizeObserver.observe(n)) : (this._detectElementResize = Qr(e), this._detectElementResize.addResizeListener(n, this._onResize)), this._onResize();
1224
+ }
1225
+ }
1226
+ componentWillUnmount() {
1227
+ this._parentNode && (this._detectElementResize && this._detectElementResize.removeResizeListener(this._parentNode, this._onResize), this._timeoutId !== null && clearTimeout(this._timeoutId), this._resizeObserver && this._resizeObserver.disconnect());
1228
+ }
1229
+ render() {
1230
+ const {
1231
+ children: e,
1232
+ defaultHeight: n,
1233
+ defaultWidth: r,
1234
+ disableHeight: o = !1,
1235
+ disableWidth: a = !1,
1236
+ doNotBailOutOnEmptyChildren: i = !1,
1237
+ nonce: s,
1238
+ onResize: l,
1239
+ style: h = {},
1240
+ tagName: p = "div",
1241
+ ...m
1242
+ } = this.props, {
1243
+ height: u,
1244
+ scaledHeight: f,
1245
+ scaledWidth: v,
1246
+ width: _
1247
+ } = this.state, g = {
1248
+ overflow: "visible"
1249
+ }, S = {};
1250
+ let x = !1;
1251
+ return o || (u === 0 && (x = !0), g.height = 0, S.height = u, S.scaledHeight = f), a || (_ === 0 && (x = !0), g.width = 0, S.width = _, S.scaledWidth = v), i && (x = !1), Me(p, {
1252
+ ref: this._setRef,
1253
+ style: {
1254
+ ...g,
1255
+ ...h
1256
+ },
1257
+ ...m
1258
+ }, !x && e(S));
1259
+ }
1260
+ }
1261
+ const to = (t = 1) => {
1262
+ const [e, n] = k(t), [r, o] = k(0), { scrollToPage: a } = mt(), i = $(1), { isScrolling: s } = jt(), { viewMode: l } = $e(), { scrollMode: h } = be(), p = Sr(e, 100), m = y(
1263
+ (g) => {
1264
+ if (!/^[0-9]*$/g.test(g.toString()) || !g)
1265
+ return { success: !1, currentPage: i.current };
1266
+ const x = +g;
1267
+ return x < 0 || x > r ? { success: !1, currentPage: i.current } : (n(x), i.current = x, { success: !0, currentPage: +g });
1268
+ },
1269
+ [r]
1270
+ ), u = y(m, [m]), f = y(
1271
+ (g) => {
1272
+ const S = m(g);
1273
+ return S.success && (s.current = !0, a(S.currentPage)), S;
1274
+ },
1275
+ [m, a]
1276
+ ), v = y(() => {
1277
+ let g = e - 1;
1278
+ f(g);
1279
+ }, [f, e, l, h]), _ = y(() => {
1280
+ let g = e + 1;
1281
+ f(g);
1282
+ }, [f, e, l, h]);
1283
+ return {
1284
+ focusedPage: p,
1285
+ totalPages: r,
1286
+ setFocusedPage: u,
1287
+ setTotalPages: o,
1288
+ nextPage: _,
1289
+ prevPage: v,
1290
+ goToPage: f
1291
+ };
1292
+ }, an = Fe({
1293
+ focusedPage: 0,
1294
+ setFocusedPage: (t) => {
1295
+ },
1296
+ goToPage: (t) => ({ success: !!t, currentPage: +t }),
1297
+ totalPages: 0,
1298
+ setTotalPages: (t) => {
1299
+ },
1300
+ prevPage: () => {
1301
+ },
1302
+ nextPage: () => {
1303
+ }
1304
+ }), te = () => {
1305
+ const t = ke(an);
1306
+ return typeof (t == null ? void 0 : t.focusedPage) > "u" && Tr.error("Please use this hooks inside children component of RPController or RPLayout"), t;
1307
+ }, vs = ({ children: t }) => {
1308
+ const { initialPage: e = 1 } = Zn(), { pdf: n } = J(), { focusedPage: r, totalPages: o, setFocusedPage: a, setTotalPages: i, goToPage: s, nextPage: l, prevPage: h } = to(e);
1309
+ return A(() => {
1310
+ n != null && n.numPages && i(n.numPages);
1311
+ }, [n, i, o, e]), A(() => {
1312
+ requestAnimationFrame(() => {
1313
+ s(e);
1314
+ });
1315
+ }, [s, e]), /* @__PURE__ */ c(
1316
+ an.Provider,
1317
+ {
1318
+ value: {
1319
+ focusedPage: r,
1320
+ totalPages: o,
1321
+ setFocusedPage: a,
1322
+ setTotalPages: i,
1323
+ nextPage: l,
1324
+ prevPage: h,
1325
+ goToPage: s
1326
+ },
1327
+ children: t
1328
+ }
1329
+ );
1330
+ }, no = ({ widths: t, heights: e }) => {
1331
+ const { focusedPage: n, totalPages: r } = te(), o = O(() => {
1332
+ const s = [], l = Math.ceil(n / 2) * 2 - 1;
1333
+ if (s.push(l), l + 1 < r) {
1334
+ const h = l + 1;
1335
+ s.push(h);
1336
+ }
1337
+ return s;
1338
+ }, [n, r]), a = O(() => [
1339
+ {
1340
+ position: "absolute",
1341
+ left: 0,
1342
+ width: t(n - 1),
1343
+ height: e(n - 1)
1344
+ },
1345
+ {
1346
+ position: "absolute",
1347
+ left: t(n),
1348
+ top: 0,
1349
+ width: t(n),
1350
+ height: e(n)
1351
+ }
1352
+ ], [t, e, o]), i = O(() => a.reduce((s, l) => s + Number(l.width || 0), 0), [a]);
1353
+ return /* @__PURE__ */ c("div", { style: { width: i, position: "relative" }, children: o.map((s, l) => /* @__PURE__ */ c(gt, { style: a[l], pageNumber: s }, s)) });
1354
+ }, ro = ({ widths: t, heights: e }) => {
1355
+ const { focusedPage: n } = te(), r = O(() => ({
1356
+ position: "absolute",
1357
+ width: t(n - 1),
1358
+ height: e(n - 1)
1359
+ }), [t, e, n]), o = O(() => t(n - 1), [t]);
1360
+ return /* @__PURE__ */ c(
1361
+ "div",
1362
+ {
1363
+ style: {
1364
+ width: o,
1365
+ position: "relative"
1366
+ },
1367
+ children: /* @__PURE__ */ c(gt, { style: r, pageNumber: n }, n)
1368
+ }
1369
+ );
1370
+ }, oo = Ln(({ columnIndex: t, rowIndex: e, data: n, style: r }) => {
1371
+ const o = O(() => t + 1 + e * n.columnCount, [t, e, n]);
1372
+ return /* @__PURE__ */ c(
1373
+ gt,
1374
+ {
1375
+ style: r,
1376
+ onIntersectRatioChange: n.handleIntersectRatioChange,
1377
+ pageNumber: o
1378
+ },
1379
+ o
1380
+ );
1381
+ }, Xr), _s = () => {
1382
+ const { getContainer: t, container: e } = wr(), { scrollToPage: n } = mt(), {
1383
+ virtualScrollRef: r,
1384
+ getVirtualScrollRef: o,
1385
+ getPageScrollElementRef: a,
1386
+ getVirtualScrollableElementRef: i,
1387
+ setTotalInnerDimensions: s,
1388
+ totalInnerDimensions: l
1389
+ } = Ve(), { nextPage: h, prevPage: p, setFocusedPage: m, focusedPage: u } = te(), { scrollMode: f } = be(), { viewMode: v } = $e(), _ = $(null), g = $({
1390
+ height: 0,
1391
+ width: 0
1392
+ }), S = $({
1393
+ viewMode: v,
1394
+ scrollMode: f
1395
+ }), { isFullScreen: x } = jn(), {
1396
+ pageDimension: w,
1397
+ rowCount: P,
1398
+ rowHeight: d,
1399
+ columnCount: T,
1400
+ columnWidth: b,
1401
+ estimatedColumnWidth: C,
1402
+ estimatedRowHeight: L
1403
+ } = Yr(), [I, M] = k({}), { isScrolling: E } = jt(), R = $(), N = $({
1404
+ scrollTop: 0,
1405
+ scrollLeft: 0
1406
+ }), { isPressed: z } = br(), { selectionMode: W } = qn(), { initializeGrabScroll: G, scrollBehavior: Z } = Cr({
1407
+ isPressed: z
1408
+ }), U = O(() => W === fr.HAND, [W]), j = y((F, H) => {
1409
+ M((q) => ({ ...q, [F]: Math.round(H * 100) }));
1410
+ }, []), le = O(() => ({
1411
+ columnCount: T,
1412
+ handleIntersectRatioChange: j
1413
+ }), [T, j]), ne = y(
1414
+ (F) => {
1415
+ const H = document.activeElement !== e;
1416
+ !x && H || (["ArrowUp", "ArrowLeft"].includes(F.key) ? (F.preventDefault(), p()) : ["ArrowDown", "ArrowRight"].includes(F.key) && (F.preventDefault(), h()));
1417
+ },
1418
+ [h, p, x, f]
1419
+ ), me = y((F) => {
1420
+ N.current = {
1421
+ scrollTop: F.scrollTop,
1422
+ scrollLeft: F.scrollLeft
1423
+ };
1424
+ }, []);
1425
+ A(() => (window.addEventListener("keydown", ne), () => {
1426
+ window.removeEventListener("keydown", ne);
1427
+ }), [ne]), A(() => {
1428
+ if (_.current && (_.current.style.position = "relative"), !!r) {
1429
+ g.current = l, s({
1430
+ height: Array.from({ length: P }).reduce(
1431
+ (F, H, q) => F + d(q),
1432
+ 0
1433
+ ),
1434
+ width: Array.from({ length: T }).reduce(
1435
+ (F, H, q) => F + b(q),
1436
+ 0
1437
+ )
1438
+ });
1439
+ for (let F = 0; F < P; F++)
1440
+ for (let H = 0; H < T; H++)
1441
+ r.resetAfterIndices({
1442
+ columnIndex: H,
1443
+ rowIndex: F,
1444
+ shouldForceUpdate: !0
1445
+ });
1446
+ }
1447
+ }, [P, T, w, r, n]), A(() => {
1448
+ if (E.current)
1449
+ return;
1450
+ if (S.current.viewMode !== v || S.current.scrollMode !== f) {
1451
+ R.current && clearTimeout(R.current), M({}), n(u), f === ee.HORIZONTAL_SCROLLING && (r == null || r.scrollTo({
1452
+ scrollTop: 0
1453
+ })), R.current = setTimeout(() => {
1454
+ requestAnimationFrame(() => {
1455
+ S.current = { viewMode: v, scrollMode: f };
1456
+ });
1457
+ }, 100);
1458
+ return;
1459
+ }
1460
+ const H = N.current.scrollTop, q = N.current.scrollLeft;
1461
+ if (l.height !== 0 && l.width !== 0) {
1462
+ const { height: se, width: Se } = l, { height: ue, width: de } = g.current, Ge = H / ue * se, Ue = q / de * Se, yn = Math.min(Ge, se) || 0, Rn = Math.min(Ue, Se) || 0;
1463
+ r == null || r.scrollTo({
1464
+ scrollTop: yn,
1465
+ scrollLeft: Rn
1466
+ });
1467
+ }
1468
+ }, [l, v, f]), A(() => {
1469
+ const F = Object.entries(I);
1470
+ if (E.current) {
1471
+ E.current && (E.current = !1);
1472
+ return;
1473
+ }
1474
+ let H = 0, q = -1;
1475
+ F.forEach((se) => {
1476
+ q < se[1] && (H = Number(se[0]), q = se[1]);
1477
+ }), H && m(H);
1478
+ }, [I, m]), A(() => () => {
1479
+ R.current && clearTimeout(R.current);
1480
+ }, []);
1481
+ const ge = O(() => X(re["rp-pages-container"], {
1482
+ [re["rp-cursor-grab"]]: U,
1483
+ [re["rp-cursor-grabbing"]]: z && U
1484
+ }), [U, z]), Ce = y(
1485
+ (F) => {
1486
+ if (U && F) {
1487
+ const H = X(re["rp-pages"]), q = document.querySelector(`.${H}`);
1488
+ G(q);
1489
+ }
1490
+ },
1491
+ [U, G, re]
1492
+ );
1493
+ return /* @__PURE__ */ c("div", { ref: t, tabIndex: -1, className: ge, children: /* @__PURE__ */ c(eo, { children: ({ width: F, height: H }) => /* @__PURE__ */ c(
1494
+ "div",
1495
+ {
1496
+ "data-rp": "pagesWrapper",
1497
+ ref: Ce,
1498
+ style: { width: F, height: H, scrollBehavior: Z },
1499
+ children: f === ee.PAGE_SCROLLING ? /* @__PURE__ */ c(
1500
+ "div",
1501
+ {
1502
+ ref: a,
1503
+ style: { width: F, height: H },
1504
+ className: X(re["rp-pages"], re["rp-page-scrolling-wrapper"]),
1505
+ children: v === ze.DUAL_PAGE ? /* @__PURE__ */ c(no, { widths: b, heights: d }) : /* @__PURE__ */ c(ro, { widths: b, heights: d })
1506
+ }
1507
+ ) : C ? /* @__PURE__ */ c(
1508
+ Br,
1509
+ {
1510
+ ref: o,
1511
+ itemData: le,
1512
+ outerRef: i,
1513
+ innerRef: _,
1514
+ onScroll: me,
1515
+ columnCount: T,
1516
+ columnWidth: b,
1517
+ rowHeight: d,
1518
+ height: H,
1519
+ width: F,
1520
+ estimatedColumnWidth: C,
1521
+ estimatedRowHeight: L,
1522
+ rowCount: P,
1523
+ className: X(
1524
+ re["rp-pages"],
1525
+ f === ee.HORIZONTAL_SCROLLING ? re["rp-pages-horizontal-scroll"] : ""
1526
+ ),
1527
+ style: { scrollBehavior: Z },
1528
+ children: oo
1529
+ }
1530
+ ) : null
1531
+ }
1532
+ ) }) });
1533
+ }, Te = {
1534
+ "rp-toolbar-content": "_rp-toolbar-content_16hg5_1",
1535
+ "rp-toolbar-wrapper": "_rp-toolbar-wrapper_16hg5_9",
1536
+ "rp-toolbar-start": "_rp-toolbar-start_16hg5_17",
1537
+ "rp-toolbar-middle": "_rp-toolbar-middle_16hg5_23",
1538
+ "rp-toolbar-end": "_rp-toolbar-end_16hg5_30"
1539
+ }, Ye = {
1540
+ "rp-paginate": "_rp-paginate_1vu6o_1",
1541
+ "rp-page-input": "_rp-page-input_1vu6o_6",
1542
+ "rp-total-page": "_rp-total-page_1vu6o_12"
1543
+ }, ao = () => {
1544
+ const { prevIcon: t } = ae();
1545
+ return t || /* @__PURE__ */ c(ye, {});
1546
+ }, so = () => {
1547
+ const { nextIcon: t } = ae();
1548
+ return t || /* @__PURE__ */ c(ye, { style: { transform: "rotate(180deg" } });
1549
+ }, io = () => {
1550
+ const { focusedPage: t, totalPages: e, setFocusedPage: n, nextPage: r, prevPage: o, goToPage: a } = te(), [i, s] = k(t.toString()), { pageNavigationTool: l = !0 } = ce(), { isSmallScreen: h } = fe();
1551
+ A(() => {
1552
+ s(t.toString());
1553
+ }, [t]);
1554
+ const p = y((v) => {
1555
+ const _ = v.target.value;
1556
+ s(_);
1557
+ }, []), m = y(() => {
1558
+ const v = a(i);
1559
+ v.success || s(v.currentPage.toString());
1560
+ }, [a, i, e]), u = y(() => {
1561
+ s(t.toString());
1562
+ }, [t]), f = y(
1563
+ (v) => {
1564
+ v.key === "Enter" && m();
1565
+ },
1566
+ [m]
1567
+ );
1568
+ return typeof l != "boolean" ? /* @__PURE__ */ c(
1569
+ l,
1570
+ {
1571
+ total: e,
1572
+ current: t,
1573
+ nextPage: r,
1574
+ prevPage: o,
1575
+ goToPage: a,
1576
+ changePage: n
1577
+ }
1578
+ ) : l ? /* @__PURE__ */ D("div", { className: Ye["rp-paginate"], children: [
1579
+ !h && /* @__PURE__ */ c(B, { onClick: o, disabled: t === 1, children: /* @__PURE__ */ c(ao, {}) }),
1580
+ /* @__PURE__ */ c(
1581
+ Gt,
1582
+ {
1583
+ onKeyDown: f,
1584
+ onBlur: u,
1585
+ onChange: p,
1586
+ value: i,
1587
+ className: Ye["rp-page-input"]
1588
+ }
1589
+ ),
1590
+ /* @__PURE__ */ D("span", { className: Ye["rp-total-page"], children: [
1591
+ "/",
1592
+ e
1593
+ ] }),
1594
+ !h && /* @__PURE__ */ c(B, { onClick: r, disabled: t === e, children: /* @__PURE__ */ c(so, {}) })
1595
+ ] }) : null;
1596
+ };
1597
+ var vt = "Dialog", [sn, ws] = $n(vt), [co, Y] = sn(vt), cn = (t) => {
1598
+ const {
1599
+ __scopeDialog: e,
1600
+ children: n,
1601
+ open: r,
1602
+ defaultOpen: o,
1603
+ onOpenChange: a,
1604
+ modal: i = !0
1605
+ } = t, s = V.useRef(null), l = V.useRef(null), [h = !1, p] = Gn({
1606
+ prop: r,
1607
+ defaultProp: o,
1608
+ onChange: a
1609
+ });
1610
+ return /* @__PURE__ */ c(
1611
+ co,
1612
+ {
1613
+ scope: e,
1614
+ triggerRef: s,
1615
+ contentRef: l,
1616
+ contentId: qe(),
1617
+ titleId: qe(),
1618
+ descriptionId: qe(),
1619
+ open: h,
1620
+ onOpenChange: p,
1621
+ onOpenToggle: V.useCallback(() => p((m) => !m), [p]),
1622
+ modal: i,
1623
+ children: n
1624
+ }
1625
+ );
1626
+ };
1627
+ cn.displayName = vt;
1628
+ var ln = "DialogTrigger", lo = V.forwardRef(
1629
+ (t, e) => {
1630
+ const { __scopeDialog: n, ...r } = t, o = Y(ln, n), a = dt(e, o.triggerRef);
1631
+ return /* @__PURE__ */ c(
1632
+ Re.button,
1633
+ {
1634
+ type: "button",
1635
+ "aria-haspopup": "dialog",
1636
+ "aria-expanded": o.open,
1637
+ "aria-controls": o.contentId,
1638
+ "data-state": bt(o.open),
1639
+ ...r,
1640
+ ref: a,
1641
+ onClick: xe(t.onClick, o.onOpenToggle)
1642
+ }
1643
+ );
1644
+ }
1645
+ );
1646
+ lo.displayName = ln;
1647
+ var _t = "DialogPortal", [uo, un] = sn(_t, {
1648
+ forceMount: void 0
1649
+ }), dn = (t) => {
1650
+ const { __scopeDialog: e, forceMount: n, children: r, container: o } = t, a = Y(_t, e);
1651
+ return /* @__PURE__ */ c(uo, { scope: e, forceMount: n, children: V.Children.map(r, (i) => /* @__PURE__ */ c(pt, { present: n || a.open, children: /* @__PURE__ */ c(Hn, { asChild: !0, container: o, children: i }) })) });
1652
+ };
1653
+ dn.displayName = _t;
1654
+ var Ae = "DialogOverlay", pn = V.forwardRef(
1655
+ (t, e) => {
1656
+ const n = un(Ae, t.__scopeDialog), { forceMount: r = n.forceMount, ...o } = t, a = Y(Ae, t.__scopeDialog);
1657
+ return a.modal ? /* @__PURE__ */ c(pt, { present: r || a.open, children: /* @__PURE__ */ c(po, { ...o, ref: e }) }) : null;
1658
+ }
1659
+ );
1660
+ pn.displayName = Ae;
1661
+ var po = V.forwardRef(
1662
+ (t, e) => {
1663
+ const { __scopeDialog: n, ...r } = t, o = Y(Ae, n);
1664
+ return (
1665
+ // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
1666
+ // ie. when `Overlay` and `Content` are siblings
1667
+ /* @__PURE__ */ c(Dn, { as: zn, allowPinchZoom: !0, shards: [o.contentRef], children: /* @__PURE__ */ c(
1668
+ Re.div,
1669
+ {
1670
+ "data-state": bt(o.open),
1671
+ ...r,
1672
+ ref: e,
1673
+ style: { pointerEvents: "auto", ...r.style }
1674
+ }
1675
+ ) })
1676
+ );
1677
+ }
1678
+ ), he = "DialogContent", hn = V.forwardRef(
1679
+ (t, e) => {
1680
+ const n = un(he, t.__scopeDialog), { forceMount: r = n.forceMount, ...o } = t, a = Y(he, t.__scopeDialog);
1681
+ return /* @__PURE__ */ c(pt, { present: r || a.open, children: a.modal ? /* @__PURE__ */ c(ho, { ...o, ref: e }) : /* @__PURE__ */ c(fo, { ...o, ref: e }) });
1682
+ }
1683
+ );
1684
+ hn.displayName = he;
1685
+ var ho = V.forwardRef(
1686
+ (t, e) => {
1687
+ const n = Y(he, t.__scopeDialog), r = V.useRef(null), o = dt(e, n.contentRef, r);
1688
+ return V.useEffect(() => {
1689
+ const a = r.current;
1690
+ if (a)
1691
+ return An(a);
1692
+ }, []), /* @__PURE__ */ c(
1693
+ fn,
1694
+ {
1695
+ ...t,
1696
+ ref: o,
1697
+ trapFocus: n.open,
1698
+ disableOutsidePointerEvents: !0,
1699
+ onCloseAutoFocus: xe(t.onCloseAutoFocus, (a) => {
1700
+ var i;
1701
+ a.preventDefault(), (i = n.triggerRef.current) == null || i.focus();
1702
+ }),
1703
+ onPointerDownOutside: xe(t.onPointerDownOutside, (a) => {
1704
+ const i = a.detail.originalEvent, s = i.button === 0 && i.ctrlKey === !0;
1705
+ (i.button === 2 || s) && a.preventDefault();
1706
+ }),
1707
+ onFocusOutside: xe(
1708
+ t.onFocusOutside,
1709
+ (a) => a.preventDefault()
1710
+ )
1711
+ }
1712
+ );
1713
+ }
1714
+ ), fo = V.forwardRef(
1715
+ (t, e) => {
1716
+ const n = Y(he, t.__scopeDialog), r = V.useRef(!1), o = V.useRef(!1);
1717
+ return /* @__PURE__ */ c(
1718
+ fn,
1719
+ {
1720
+ ...t,
1721
+ ref: e,
1722
+ trapFocus: !1,
1723
+ disableOutsidePointerEvents: !1,
1724
+ onCloseAutoFocus: (a) => {
1725
+ var i, s;
1726
+ (i = t.onCloseAutoFocus) == null || i.call(t, a), a.defaultPrevented || (r.current || (s = n.triggerRef.current) == null || s.focus(), a.preventDefault()), r.current = !1, o.current = !1;
1727
+ },
1728
+ onInteractOutside: (a) => {
1729
+ var l, h;
1730
+ (l = t.onInteractOutside) == null || l.call(t, a), a.defaultPrevented || (r.current = !0, a.detail.originalEvent.type === "pointerdown" && (o.current = !0));
1731
+ const i = a.target;
1732
+ ((h = n.triggerRef.current) == null ? void 0 : h.contains(i)) && a.preventDefault(), a.detail.originalEvent.type === "focusin" && o.current && a.preventDefault();
1733
+ }
1734
+ }
1735
+ );
1736
+ }
1737
+ ), fn = V.forwardRef(
1738
+ (t, e) => {
1739
+ const { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: o, onCloseAutoFocus: a, ...i } = t, s = Y(he, n), l = V.useRef(null), h = dt(e, l);
1740
+ return Fn(), /* @__PURE__ */ D(Oe, { children: [
1741
+ /* @__PURE__ */ c(
1742
+ kn,
1743
+ {
1744
+ asChild: !0,
1745
+ loop: !0,
1746
+ trapped: r,
1747
+ onMountAutoFocus: o,
1748
+ onUnmountAutoFocus: a,
1749
+ children: /* @__PURE__ */ c(
1750
+ Wn,
1751
+ {
1752
+ role: "dialog",
1753
+ id: s.contentId,
1754
+ "aria-describedby": s.descriptionId,
1755
+ "aria-labelledby": s.titleId,
1756
+ "data-state": bt(s.open),
1757
+ ...i,
1758
+ ref: h,
1759
+ onDismiss: () => s.onOpenChange(!1)
1760
+ }
1761
+ )
1762
+ }
1763
+ ),
1764
+ /* @__PURE__ */ D(Oe, { children: [
1765
+ /* @__PURE__ */ c(go, { titleId: s.titleId }),
1766
+ /* @__PURE__ */ c(_o, { contentRef: l, descriptionId: s.descriptionId })
1767
+ ] })
1768
+ ] });
1769
+ }
1770
+ ), wt = "DialogTitle", mn = V.forwardRef(
1771
+ (t, e) => {
1772
+ const { __scopeDialog: n, ...r } = t, o = Y(wt, n);
1773
+ return /* @__PURE__ */ c(Re.h2, { id: o.titleId, ...r, ref: e });
1774
+ }
1775
+ );
1776
+ mn.displayName = wt;
1777
+ var gn = "DialogDescription", mo = V.forwardRef(
1778
+ (t, e) => {
1779
+ const { __scopeDialog: n, ...r } = t, o = Y(gn, n);
1780
+ return /* @__PURE__ */ c(Re.p, { id: o.descriptionId, ...r, ref: e });
1781
+ }
1782
+ );
1783
+ mo.displayName = gn;
1784
+ var vn = "DialogClose", _n = V.forwardRef(
1785
+ (t, e) => {
1786
+ const { __scopeDialog: n, ...r } = t, o = Y(vn, n);
1787
+ return /* @__PURE__ */ c(
1788
+ Re.button,
1789
+ {
1790
+ type: "button",
1791
+ ...r,
1792
+ ref: e,
1793
+ onClick: xe(t.onClick, () => o.onOpenChange(!1))
1794
+ }
1795
+ );
1796
+ }
1797
+ );
1798
+ _n.displayName = vn;
1799
+ function bt(t) {
1800
+ return t ? "open" : "closed";
1801
+ }
1802
+ var wn = "DialogTitleWarning", [bs, bn] = Vn(wn, {
1803
+ contentName: he,
1804
+ titleName: wt,
1805
+ docsSlug: "dialog"
1806
+ }), go = ({ titleId: t }) => {
1807
+ const e = bn(wn), n = `\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
1808
+
1809
+ If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
1810
+
1811
+ For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;
1812
+ return V.useEffect(() => {
1813
+ t && (document.getElementById(t) || console.error(n));
1814
+ }, [n, t]), null;
1815
+ }, vo = "DialogDescriptionWarning", _o = ({ contentRef: t, descriptionId: e }) => {
1816
+ const r = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${bn(vo).contentName}}.`;
1817
+ return V.useEffect(() => {
1818
+ var a;
1819
+ const o = (a = t.current) == null ? void 0 : a.getAttribute("aria-describedby");
1820
+ e && o && (document.getElementById(e) || console.warn(r));
1821
+ }, [r, t, e]), null;
1822
+ }, wo = cn, bo = dn, Co = pn, So = hn, To = mn, Po = _n;
1823
+ const pe = {
1824
+ "rp-dialog-wrapper": "_rp-dialog-wrapper_slqo7_1",
1825
+ "rp-dialog-overlay": "_rp-dialog-overlay_slqo7_7",
1826
+ "rp-document-dialog": "_rp-document-dialog_slqo7_13",
1827
+ "rp-document-properties": "_rp-document-properties_slqo7_35",
1828
+ "rp-dialog-title": "_rp-dialog-title_slqo7_39",
1829
+ "rp-dialog-close": "_rp-dialog-close_slqo7_47",
1830
+ "rp-properties-divider": "_rp-properties-divider_slqo7_55"
1831
+ }, Io = () => {
1832
+ const { pdfProperties: t } = J(), { container: e } = We(), { activeDocumentProperties: n, setActiveDocumentProperties: r } = or(), o = O(() => {
1833
+ if (!t)
1834
+ return [];
1835
+ const {
1836
+ fileSize: a,
1837
+ filename: i,
1838
+ title: s,
1839
+ author: l,
1840
+ subject: h,
1841
+ createdOn: p,
1842
+ creator: m,
1843
+ keywords: u,
1844
+ modifierOn: f,
1845
+ pdfProducer: v,
1846
+ pdfVersion: _,
1847
+ pageCount: g
1848
+ } = t;
1849
+ return [
1850
+ { label: "File name", value: i },
1851
+ { label: "File size", value: a },
1852
+ { separate: !0 },
1853
+ { label: "Title", value: s },
1854
+ { label: "Author", value: l },
1855
+ { label: "Subject", value: h },
1856
+ { label: "Keywords", value: u },
1857
+ { label: "Creator", value: m },
1858
+ {
1859
+ label: "Created on",
1860
+ value: p ? et(p) : ""
1861
+ },
1862
+ {
1863
+ label: "Modified on",
1864
+ value: f ? et(f) : ""
1865
+ },
1866
+ { separate: !0 },
1867
+ { label: "PDF producer", value: v },
1868
+ { label: "PDF version", value: _ },
1869
+ { label: "Page count", value: g }
1870
+ ];
1871
+ }, [t]);
1872
+ return /* @__PURE__ */ c(wo, { open: n, onOpenChange: r, children: /* @__PURE__ */ c(bo, { container: e, children: /* @__PURE__ */ D("div", { className: pe["rp-dialog-wrapper"], children: [
1873
+ /* @__PURE__ */ c(Co, { className: pe["rp-dialog-overlay"] }),
1874
+ /* @__PURE__ */ D(So, { className: pe["rp-document-dialog"], children: [
1875
+ /* @__PURE__ */ c(To, { className: pe["rp-dialog-title"], children: "Document Properties" }),
1876
+ /* @__PURE__ */ c("div", { className: pe["rp-document-properties"], children: o.map((a, i) => /* @__PURE__ */ c("div", { children: a.separate ? /* @__PURE__ */ c("div", { className: pe["rp-properties-divider"] }) : /* @__PURE__ */ c(rr, { label: a.label, value: a.value }) }, i)) }),
1877
+ /* @__PURE__ */ c(Po, { asChild: !0, className: pe["rp-dialog-close"], children: /* @__PURE__ */ c(qt, {}) })
1878
+ ] })
1879
+ ] }) }) });
1880
+ }, xo = {
1881
+ "rp-other-tool-content": "_rp-other-tool-content_su718_1"
1882
+ }, yo = () => {
1883
+ const { filename: t, pdfSrc: e } = J();
1884
+ return { downloadFile: () => {
1885
+ if (!t)
1886
+ return;
1887
+ const r = document.createElement("a");
1888
+ r.href = e, r.download = t, document.body.appendChild(r), r.click(), document.body.removeChild(r);
1889
+ } };
1890
+ }, Cn = () => {
1891
+ const { downloadIcon: t } = ae();
1892
+ return t || /* @__PURE__ */ c(lr, {});
1893
+ }, Ro = ({ downloadFile: t }) => /* @__PURE__ */ c(B, { onClick: t, children: /* @__PURE__ */ c(Cn, {}) }), Mo = ({ downloadFile: t }) => /* @__PURE__ */ D(ie, { onClick: t, children: [
1894
+ /* @__PURE__ */ c("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ c(Cn, {}) }),
1895
+ "Download file"
1896
+ ] }), Sn = () => {
1897
+ const { downloadFile: t } = yo(), { downloadTool: e = !0 } = ce(), { isSmallScreen: n } = fe();
1898
+ return e ? n ? /* @__PURE__ */ c(Mo, { downloadFile: t }) : typeof e == "function" ? /* @__PURE__ */ c(e, { downloadFile: t }) : e ? /* @__PURE__ */ c(Ro, { downloadFile: t }) : null : null;
1899
+ };
1900
+ const Eo = () => {
1901
+ const { pdf: t, pages: e } = J(), [n, r] = k({
1902
+ loadedPages: 0,
1903
+ totalPages: 0,
1904
+ percentage: 0
1905
+ }), [o, a] = k(!1), [i, s] = k(!1), [l, h] = k(null), p = $(!1);
1906
+ A(() => {
1907
+ p.current;
1908
+ }, [p]);
1909
+ const m = y(() => {
1910
+ document.documentElement.classList.remove("rp-print-html-printing"), document.body.classList.remove("rp-print-body-printing");
1911
+ const w = document.querySelector(".rp-print-zone");
1912
+ w && w.remove();
1913
+ }, []), u = y(() => {
1914
+ p.current = !1, a(!1), s(!1), h(null), r({
1915
+ loadedPages: 0,
1916
+ totalPages: 0,
1917
+ percentage: 0
1918
+ });
1919
+ }, []), f = () => {
1920
+ p.current = !0;
1921
+ }, v = async ({
1922
+ scratchCanvas: w,
1923
+ pdfDocument: P,
1924
+ pageNumber: d,
1925
+ viewerPdfPage: T,
1926
+ printResolution: b,
1927
+ optionalContentConfigPromise: C,
1928
+ printAnnotationStoragePromise: L
1929
+ }) => {
1930
+ if (p.current) {
1931
+ u();
1932
+ return;
1933
+ }
1934
+ const I = b / Qn.PDF;
1935
+ w.width = Math.floor(T.width * I), w.height = Math.floor(T.height * I);
1936
+ const M = w.getContext("2d");
1937
+ M.save(), M.fillStyle = "rgb(255, 255, 255)", M.fillRect(0, 0, w.width, w.height), M.restore();
1938
+ const [E, R] = await Promise.all([
1939
+ P.getPage(d),
1940
+ L
1941
+ ]);
1942
+ if (p.current) {
1943
+ u();
1944
+ return;
1945
+ }
1946
+ const N = {
1947
+ canvasContext: M,
1948
+ transform: [I, 0, 0, I, 0, 0],
1949
+ viewport: E.getViewport({ scale: 1, rotation: T.rotation }),
1950
+ intent: "print",
1951
+ annotationMode: er.ENABLE_STORAGE,
1952
+ optionalContentConfigPromise: C,
1953
+ printAnnotationStorage: R
1954
+ };
1955
+ try {
1956
+ return E.render(N).promise;
1957
+ } catch (z) {
1958
+ throw z instanceof tr || console.error(z), z;
1959
+ }
1960
+ }, _ = y(() => {
1961
+ const w = window.print;
1962
+ return new Promise((P) => {
1963
+ const d = (C) => {
1964
+ setTimeout(() => {
1965
+ w.call(window), setTimeout(() => C(), 20);
1966
+ }, 0);
1967
+ };
1968
+ if (document.querySelector(".rp-print-zone")) {
1969
+ d(P);
1970
+ return;
1971
+ }
1972
+ const b = new MutationObserver(() => {
1973
+ document.querySelector(".rp-print-zone") && (d(P), b.disconnect());
1974
+ });
1975
+ b.observe(document.body, { childList: !0, subtree: !0 });
1976
+ });
1977
+ }, []), g = async (w) => {
1978
+ const P = document.createElement("img"), d = document.createElement("div");
1979
+ return d.classList.add("rp-print-page"), await new Promise((T, b) => {
1980
+ w.toBlob((C) => {
1981
+ C ? (P.src = URL.createObjectURL(C), P.onload = () => {
1982
+ URL.revokeObjectURL(P.src), T();
1983
+ }, P.onerror = b) : b(new Error("Failed to create blob"));
1984
+ });
1985
+ }).catch(() => {
1986
+ }), d.appendChild(P), d;
1987
+ }, S = (w, P) => {
1988
+ const d = document.createElement("div");
1989
+ d.classList.add("rp-print-zone");
1990
+ const T = document.createElement("style"), b = P.get(1);
1991
+ if (b) {
1992
+ const { width: C, height: L } = b == null ? void 0 : b.page.getViewport({ scale: 1 });
1993
+ T.innerHTML = `@page { size: ${C}px ${L}px }`;
1994
+ }
1995
+ return d.appendChild(T), d.append(...w), d;
1996
+ }, x = y(async () => {
1997
+ if (!t)
1998
+ return;
1999
+ u();
2000
+ const w = document.createElement("canvas"), P = [];
2001
+ try {
2002
+ t.isPureXfa && console.warn("[rp] XFA Form is not supported at the moment.");
2003
+ const T = t.getOptionalContentConfig({ intent: "print" }), b = Promise.resolve(
2004
+ t.annotationStorage.print ?? void 0
2005
+ ), C = e.size;
2006
+ for (const [I, M] of e) {
2007
+ if (p.current) {
2008
+ u();
2009
+ return;
2010
+ }
2011
+ const E = M.page.getViewport({ scale: 1 });
2012
+ if (await v({
2013
+ scratchCanvas: w,
2014
+ pdfDocument: t,
2015
+ pageNumber: I,
2016
+ viewerPdfPage: E,
2017
+ printResolution: 150,
2018
+ optionalContentConfigPromise: T,
2019
+ printAnnotationStoragePromise: b
2020
+ }), p.current) {
2021
+ u();
2022
+ return;
2023
+ }
2024
+ const R = await g(w);
2025
+ P.push(R);
2026
+ const N = parseFloat((P.length / C * 100).toFixed(2));
2027
+ r({
2028
+ loadedPages: I,
2029
+ totalPages: C,
2030
+ percentage: N
2031
+ });
2032
+ }
2033
+ if (p.current) {
2034
+ u();
2035
+ return;
2036
+ }
2037
+ const L = S(P, e);
2038
+ document.body.appendChild(L), document.documentElement.classList.add("rp-print-html-printing"), document.body.classList.add("rp-print-body-printing"), a(!0), await _();
2039
+ } catch (d) {
2040
+ s(!0), d instanceof Error && h(d);
2041
+ } finally {
2042
+ w.height = 0, w.width = 0;
2043
+ }
2044
+ }, [t, e, p]);
2045
+ return A(() => {
2046
+ const w = () => {
2047
+ u(), m();
2048
+ };
2049
+ return window.addEventListener("afterprint", w, !0), () => {
2050
+ window.removeEventListener("afterprint", w, !0);
2051
+ };
2052
+ }, [m, u]), {
2053
+ print: x,
2054
+ cancel: f,
2055
+ progress: n,
2056
+ isComplete: o,
2057
+ isError: i,
2058
+ error: l
2059
+ };
2060
+ }, Tn = Fe({
2061
+ print: () => {
2062
+ },
2063
+ cancel: () => {
2064
+ },
2065
+ setOnProgress: (t) => {
2066
+ },
2067
+ progress: {},
2068
+ setOnComplete: (t) => t(),
2069
+ setOnError: (t) => {
2070
+ try {
2071
+ const e = new Error("Print error occurred");
2072
+ t(e);
2073
+ } catch (e) {
2074
+ console.error("Error in setOnError callback:", e);
2075
+ }
2076
+ }
2077
+ }), Cs = ({ children: t }) => {
2078
+ const [e, n] = k(null), [r, o] = k(null), { print: a, cancel: i, progress: s, isComplete: l, isError: h, error: p } = Eo(), m = y((g) => {
2079
+ g && typeof g == "function" && o(() => g);
2080
+ }, []), u = (g) => {
2081
+ p && g(p);
2082
+ }, f = y(
2083
+ (g) => {
2084
+ n(() => g);
2085
+ },
2086
+ [s, e]
2087
+ );
2088
+ A(() => {
2089
+ l && r && v();
2090
+ }, [l, r]), A(() => {
2091
+ h && u((g) => {
2092
+ console.error(g);
2093
+ });
2094
+ }, [h]), A(() => {
2095
+ s && e && e(s);
2096
+ }, [s, e]);
2097
+ const v = () => {
2098
+ r && (r(), o(null));
2099
+ }, _ = {
2100
+ print: a,
2101
+ cancel: i,
2102
+ setOnProgress: f,
2103
+ setOnComplete: m,
2104
+ setOnError: u,
2105
+ progress: s
2106
+ };
2107
+ return /* @__PURE__ */ c(Tn.Provider, { value: _, children: t });
2108
+ }, Ct = () => {
2109
+ const t = ke(Tn);
2110
+ if (!t)
2111
+ throw new Error("usePrintContext must be used within a PrintProvider");
2112
+ return t;
2113
+ }, Pn = () => {
2114
+ const { printIcon: t } = ae();
2115
+ return t || /* @__PURE__ */ c(ur, {});
2116
+ }, Lo = ({ print: t }) => /* @__PURE__ */ c(B, { onClick: t, children: /* @__PURE__ */ c(Pn, {}) }), No = ({ print: t }) => /* @__PURE__ */ D(ie, { onClick: t, children: [
2117
+ /* @__PURE__ */ c("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ c(Pn, {}) }),
2118
+ "Print"
2119
+ ] }), In = () => {
2120
+ const { print: t, cancel: e, setOnProgress: n, setOnComplete: r, setOnError: o, progress: a } = Ct(), { printTool: i = !0 } = ce(), { isSmallScreen: s } = fe();
2121
+ return i ? s ? /* @__PURE__ */ c(No, { print: t }) : typeof i == "function" ? /* @__PURE__ */ c(
2122
+ i,
2123
+ {
2124
+ print: t,
2125
+ cancel: e,
2126
+ setOnProgress: n,
2127
+ setOnError: o,
2128
+ setOnComplete: r,
2129
+ progress: a
2130
+ }
2131
+ ) : i ? /* @__PURE__ */ c(Lo, { print: t }) : null : null;
2132
+ }, Oo = {
2133
+ "rp-go-to-Top": "_rp-go-to-Top_4e0yd_1"
2134
+ }, Do = () => {
2135
+ const { goToFirstPageIcon: t } = ae();
2136
+ return t || /* @__PURE__ */ c(Kt, { className: Oo["rp-go-to-Top"] });
2137
+ }, zo = () => {
2138
+ const { goToLastPageIcon: t } = ae();
2139
+ return t || /* @__PURE__ */ c(Kt, {});
2140
+ }, Ao = () => {
2141
+ const { goToPage: t, totalPages: e, focusedPage: n } = te(), { jumpNavigationTool: r } = ce(), o = O(() => n === 1, [n]), a = O(() => n === e, [n, e]), i = y(() => {
2142
+ t(1);
2143
+ }, [t]), s = y(() => {
2144
+ t(e);
2145
+ }, [t, e]);
2146
+ return r ? /* @__PURE__ */ D(De, { children: [
2147
+ /* @__PURE__ */ D(ie, { disabled: o, onClick: i, children: [
2148
+ /* @__PURE__ */ c("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ c(Do, {}) }),
2149
+ "First page"
2150
+ ] }),
2151
+ /* @__PURE__ */ D(ie, { disabled: a, onClick: s, children: [
2152
+ /* @__PURE__ */ c("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ c(zo, {}) }),
2153
+ "Last page"
2154
+ ] }),
2155
+ /* @__PURE__ */ c(ft, {})
2156
+ ] }) : null;
2157
+ }, Fo = () => {
2158
+ const { container: t } = We(), { isSmallScreen: e } = fe(), {
2159
+ openFileTool: n,
2160
+ downloadTool: r,
2161
+ documentProperties: o,
2162
+ scrollModeTool: a,
2163
+ rotateTool: i,
2164
+ selectionModeTool: s,
2165
+ jumpNavigationTool: l,
2166
+ printTool: h,
2167
+ fullscreenTool: p
2168
+ } = ce();
2169
+ return O(() => {
2170
+ const u = l || i || s || a || o;
2171
+ let f = !1;
2172
+ return e && (f = !(!n && !r && !h && !p)), u || f;
2173
+ }, [
2174
+ n,
2175
+ r,
2176
+ o,
2177
+ a,
2178
+ i,
2179
+ s,
2180
+ l
2181
+ ]) ? /* @__PURE__ */ D(ar, { children: [
2182
+ /* @__PURE__ */ c(
2183
+ ut,
2184
+ {
2185
+ container: t,
2186
+ triggerComponent: /* @__PURE__ */ c(B, { children: /* @__PURE__ */ c(On, {}) }),
2187
+ children: /* @__PURE__ */ D("div", { className: xo["rp-other-tool-content"], children: [
2188
+ e && /* @__PURE__ */ D(De, { children: [
2189
+ /* @__PURE__ */ c(Ut, {}),
2190
+ /* @__PURE__ */ c(Sn, {}),
2191
+ /* @__PURE__ */ c(In, {}),
2192
+ /* @__PURE__ */ c(Bt, {}),
2193
+ /* @__PURE__ */ c(ft, {})
2194
+ ] }),
2195
+ /* @__PURE__ */ c(Ao, {}),
2196
+ /* @__PURE__ */ c(ir, {}),
2197
+ /* @__PURE__ */ c(dr, {}),
2198
+ /* @__PURE__ */ c(cr, {}),
2199
+ /* @__PURE__ */ c(sr, {})
2200
+ ] })
2201
+ }
2202
+ ),
2203
+ /* @__PURE__ */ c(Io, {})
2204
+ ] }) : null;
2205
+ }, ko = () => {
2206
+ const { isSmallScreen: t } = fe();
2207
+ return /* @__PURE__ */ D(Oe, { children: [
2208
+ /* @__PURE__ */ c(Nn, {}),
2209
+ !t && /* @__PURE__ */ D(Oe, { children: [
2210
+ /* @__PURE__ */ c(Ut, {}),
2211
+ /* @__PURE__ */ c(Sn, {}),
2212
+ /* @__PURE__ */ c(In, {}),
2213
+ /* @__PURE__ */ c(Bt, {})
2214
+ ] }),
2215
+ /* @__PURE__ */ c(Fo, {})
2216
+ ] });
2217
+ }, Pe = {
2218
+ "rp-zoom-wrapper": "_rp-zoom-wrapper_163s9_1",
2219
+ "rp-current-zoom-wrapper": "_rp-current-zoom-wrapper_163s9_6",
2220
+ "rp-current-zoom-icon": "_rp-current-zoom-icon_163s9_11",
2221
+ "rp-current-zoom": "_rp-current-zoom_163s9_6",
2222
+ "rp-zoom-dropdown-content": "_rp-zoom-dropdown-content_163s9_20"
2223
+ }, Wo = 25, Qe = 1e3, Ho = [50, 75, 100, 125, 150, 200, 300, 400], $o = () => {
2224
+ const { zoomInIcon: t } = ae();
2225
+ return t || /* @__PURE__ */ c(pr, {});
2226
+ }, Vo = () => {
2227
+ const { zoomOutIcon: t } = ae();
2228
+ return t || /* @__PURE__ */ c(hr, {});
2229
+ }, Go = () => {
2230
+ const { zoomLevel: t, setZoomLevel: e } = ht(), { container: n, contentRef: r } = We(), { zoomTool: o = !0 } = ce(), { focusedPage: a } = te(), { rotate: i } = He(), { pages: s } = J(), { isSmallScreen: l } = fe(), h = y(() => {
2231
+ e((g) => {
2232
+ const S = Math.floor(g / 25) * 25;
2233
+ return Math.min(S + 25, Qe);
2234
+ });
2235
+ }, [e]), p = y(() => {
2236
+ e((g) => {
2237
+ const S = Math.ceil(g / 25) * 25;
2238
+ return Math.min(S - 25, Qe);
2239
+ });
2240
+ }, [e]), m = O(() => t === Wo, [t]), u = O(() => t === Qe, [t]), f = O(() => {
2241
+ var g;
2242
+ return (g = s.get(a)) == null ? void 0 : g.page.getViewport({ scale: 1, rotation: i });
2243
+ }, [s, a, i]), v = y(
2244
+ (g) => {
2245
+ const S = ((f == null ? void 0 : f.width) || 0) + 2 * Tt, x = ((f == null ? void 0 : f.height) || 0) + 2 * Tt, w = (r == null ? void 0 : r.clientWidth) || 0, P = (r == null ? void 0 : r.clientHeight) || 0;
2246
+ switch (g) {
2247
+ case ve.ACTUAL:
2248
+ e(100);
2249
+ break;
2250
+ case ve.PAGE_FIT:
2251
+ let d = 0;
2252
+ const T = w > P;
2253
+ x > S && T ? d = P / x : d = w / S;
2254
+ const b = Math.floor(d * 100);
2255
+ e(b);
2256
+ break;
2257
+ case ve.PAGE_WIDTH:
2258
+ e(Math.floor(w / S * 100));
2259
+ break;
2260
+ }
2261
+ },
2262
+ [e, f]
2263
+ ), _ = y(
2264
+ (g) => {
2265
+ typeof g == "number" ? e(g) : v(g);
2266
+ },
2267
+ [e, v]
2268
+ );
2269
+ return typeof o != "boolean" ? /* @__PURE__ */ c(o, { zoomLevel: t, setZoomLevel: e }) : o ? /* @__PURE__ */ D("div", { className: Pe["rp-zoom-wrapper"], children: [
2270
+ /* @__PURE__ */ c(B, { disabled: m, onClick: p, children: /* @__PURE__ */ c(Vo, {}) }),
2271
+ !l && /* @__PURE__ */ c(
2272
+ ut,
2273
+ {
2274
+ container: n,
2275
+ triggerComponent: /* @__PURE__ */ D(B, { className: Pe["rp-current-zoom-wrapper"], children: [
2276
+ /* @__PURE__ */ D("span", { className: Pe["rp-current-zoom"], children: [
2277
+ t,
2278
+ " %"
2279
+ ] }),
2280
+ /* @__PURE__ */ c(ye, { className: Pe["rp-current-zoom-icon"] })
2281
+ ] }),
2282
+ style: { minWidth: "200px" },
2283
+ align: "center",
2284
+ children: /* @__PURE__ */ D("div", { className: Pe["rp-zoom-dropdown-content"], children: [
2285
+ /* @__PURE__ */ D(De, { children: [
2286
+ /* @__PURE__ */ c(ie, { onClick: () => _(ve.ACTUAL), children: "Actual size" }),
2287
+ /* @__PURE__ */ c(ie, { onClick: () => _(ve.PAGE_FIT), children: "Page fit" }),
2288
+ /* @__PURE__ */ c(ie, { onClick: () => _(ve.PAGE_WIDTH), children: "Page width" })
2289
+ ] }),
2290
+ /* @__PURE__ */ c(ft, {}),
2291
+ /* @__PURE__ */ c(De, { children: Ho.map((g) => /* @__PURE__ */ D(ie, { onClick: () => _(g), children: [
2292
+ g,
2293
+ " %"
2294
+ ] }, g)) })
2295
+ ] })
2296
+ }
2297
+ ),
2298
+ /* @__PURE__ */ c(B, { disabled: u, onClick: h, children: /* @__PURE__ */ c($o, {}) })
2299
+ ] }) : null;
2300
+ }, Q = {
2301
+ "rp-search-tool-content": "_rp-search-tool-content_1vxow_1",
2302
+ "rp-search-tool-input": "_rp-search-tool-input_1vxow_6",
2303
+ "rp-search-tool-input-icon": "_rp-search-tool-input-icon_1vxow_12",
2304
+ "rp-search-tool-controls": "_rp-search-tool-controls_1vxow_16",
2305
+ "rp-search-tool-input-wrapper": "_rp-search-tool-input-wrapper_1vxow_24",
2306
+ "rp-search-tool-input-checkboxes": "_rp-search-tool-input-checkboxes_1vxow_30",
2307
+ "rp-search-tool-input-clear": "_rp-search-tool-input-clear_1vxow_35",
2308
+ "rp-search-input": "_rp-search-input_1vxow_49"
2309
+ }, Ht = () => {
2310
+ const { searchIcon: t } = ae();
2311
+ return t || /* @__PURE__ */ c(mr, {});
2312
+ }, Uo = () => {
2313
+ const { container: t } = We(), [e, n] = k(!1), { pdf: r } = J(), [o, a] = k(null), {
2314
+ searchOptions: i,
2315
+ setSearchOptions: s,
2316
+ loading: l,
2317
+ setSearch: h,
2318
+ totalMatches: p,
2319
+ currentMatchPosition: m,
2320
+ nextMatch: u,
2321
+ prevMatch: f,
2322
+ search: v
2323
+ } = Yt(), { searchTool: _ } = ce(), [g, S] = k(v), x = y(() => {
2324
+ n(!0);
2325
+ }, []), w = y(() => {
2326
+ h(""), S(""), n(!1);
2327
+ }, [h]), P = y(
2328
+ (R) => {
2329
+ R.key === "Escape" && e && w();
2330
+ },
2331
+ [e]
2332
+ ), d = y(
2333
+ (R) => {
2334
+ R.shiftKey && R.key === "Enter" ? f() : R.key === "Enter" && h((N) => (g === N && u(), g));
2335
+ },
2336
+ [g, f, u, h]
2337
+ );
2338
+ A(() => (window.addEventListener("keydown", P), () => {
2339
+ window.removeEventListener("keydown", P);
2340
+ }), [P]), A(() => {
2341
+ o && o.focus();
2342
+ }, [o]);
2343
+ const T = y((R) => {
2344
+ S(R.target.value);
2345
+ }, []), b = y(() => {
2346
+ S(""), h("");
2347
+ }, [h]), C = O(() => `${m} / ${p}`, [m, p]), { wholeWords: L, matchCase: I } = O(() => i, [i]), M = y(
2348
+ (R) => {
2349
+ s((N) => ({ ...N, matchCase: R }));
2350
+ },
2351
+ [s]
2352
+ ), E = y(
2353
+ (R) => {
2354
+ s((N) => ({ ...N, wholeWords: R }));
2355
+ },
2356
+ [s]
2357
+ );
2358
+ return A(() => {
2359
+ w();
2360
+ }, [r, w]), _ ? /* @__PURE__ */ c(
2361
+ ut,
2362
+ {
2363
+ open: e,
2364
+ container: t,
2365
+ align: "start",
2366
+ triggerComponent: /* @__PURE__ */ c(B, { onClick: x, children: /* @__PURE__ */ c(Ht, {}) }),
2367
+ children: /* @__PURE__ */ D("div", { className: Q["rp-search-tool-content"], children: [
2368
+ /* @__PURE__ */ D("div", { className: Q["rp-search-tool-input-wrapper"], children: [
2369
+ /* @__PURE__ */ D("div", { className: Q["rp-search-tool-input"], children: [
2370
+ /* @__PURE__ */ c(
2371
+ Gt,
2372
+ {
2373
+ value: g,
2374
+ onKeyDown: d,
2375
+ onChange: T,
2376
+ icon: /* @__PURE__ */ c(Ht, {}),
2377
+ placeholder: "Enter to Search",
2378
+ className: Q["rp-search-input"],
2379
+ ref: a,
2380
+ children: !!g && /* @__PURE__ */ c("span", { className: Q["rp-search-tool-input-clear"], onClick: b, children: /* @__PURE__ */ c(gr, {}) })
2381
+ }
2382
+ ),
2383
+ l ? /* @__PURE__ */ c("span", { children: /* @__PURE__ */ c(lt, {}) }) : /* @__PURE__ */ c("span", { children: C })
2384
+ ] }),
2385
+ /* @__PURE__ */ D("div", { className: Q["rp-search-tool-input-checkboxes"], children: [
2386
+ /* @__PURE__ */ c(Pt, { name: "matchCase", value: I, onChange: M, children: "Match Case" }),
2387
+ /* @__PURE__ */ c(Pt, { name: "wholeWord", value: L, onChange: E, children: "Whole Word" })
2388
+ ] })
2389
+ ] }),
2390
+ /* @__PURE__ */ D("div", { className: Q["rp-search-tool-controls"], children: [
2391
+ /* @__PURE__ */ c(B, { onClick: f, children: /* @__PURE__ */ c(ye, { className: Q["rp-search-tool-input-icon"] }) }),
2392
+ /* @__PURE__ */ c(B, { onClick: u, children: /* @__PURE__ */ c(
2393
+ ye,
2394
+ {
2395
+ style: { transform: "rotate(180deg" },
2396
+ className: Q["rp-search-tool-input-icon"]
2397
+ }
2398
+ ) }),
2399
+ /* @__PURE__ */ c(B, { children: /* @__PURE__ */ c(qt, { onClick: w, className: Q["rp-search-tool-input-icon"] }) })
2400
+ ] })
2401
+ ] })
2402
+ }
2403
+ ) : null;
2404
+ }, qo = "_loading_1snj5_1", we = {
2405
+ "rp-loading-overlay": "_rp-loading-overlay_1snj5_1",
2406
+ "rp-loading-modal": "_rp-loading-modal_1snj5_14",
2407
+ "rp-loading-title": "_rp-loading-title_1snj5_27",
2408
+ "rp-loading-progress-bar": "_rp-loading-progress-bar_1snj5_35",
2409
+ "rp-loading-progress": "_rp-loading-progress_1snj5_35",
2410
+ "rp-loading-cancel-button": "_rp-loading-cancel-button_1snj5_52",
2411
+ loading: qo
2412
+ }, Zo = ({ percentage: t }) => {
2413
+ const { cancel: e } = Ct();
2414
+ return t < 1 ? null : /* @__PURE__ */ c("div", { className: X(we["rp-loading-overlay"]), children: /* @__PURE__ */ D("div", { className: X(we["rp-loading-modal"]), children: [
2415
+ /* @__PURE__ */ c("div", { className: X(we["rp-loading-title"]), children: "Preparing document..." }),
2416
+ /* @__PURE__ */ c("div", { className: X(we["rp-loading-progress-bar"]), children: /* @__PURE__ */ c(
2417
+ "div",
2418
+ {
2419
+ className: X(we["rp-loading-progress"]),
2420
+ style: { width: `${t}%` }
2421
+ }
2422
+ ) }),
2423
+ /* @__PURE__ */ c("button", { className: X(we["rp-loading-cancel-button"]), onClick: e, children: "Cancel" })
2424
+ ] }) });
2425
+ }, Ss = ct((t, e) => {
2426
+ const { showPrintProgress: n } = ce(), { progress: r } = Ct(), { isSmallScreen: o } = fe(), { percentage: a } = r || {}, i = () => o ? { gridTemplateColumns: "25% 60% 15%" } : void 0;
2427
+ return /* @__PURE__ */ D("div", { children: [
2428
+ /* @__PURE__ */ c("div", { "data-rp": "topBarWrapper", ref: e, className: Te["rp-toolbar-content"], children: /* @__PURE__ */ D("div", { "data-rp": "topBar", className: Te["rp-toolbar-wrapper"], style: i(), children: [
2429
+ /* @__PURE__ */ D("div", { "data-rp": "topBarStart", className: Te["rp-toolbar-start"], children: [
2430
+ /* @__PURE__ */ c(Uo, {}),
2431
+ /* @__PURE__ */ c(io, {})
2432
+ ] }),
2433
+ /* @__PURE__ */ c("div", { "data-rp": "topBarMiddle", className: Te["rp-toolbar-middle"], children: /* @__PURE__ */ c(Go, {}) }),
2434
+ /* @__PURE__ */ c("div", { "data-rp": "topBarEnd", className: Te["rp-toolbar-end"], children: /* @__PURE__ */ c(ko, {}) })
2435
+ ] }) }),
2436
+ n && a ? /* @__PURE__ */ c(Zo, { percentage: a }) : null
2437
+ ] });
2438
+ }), Ts = {
2439
+ "rp-sidebar-content-wrapper": "_rp-sidebar-content-wrapper_p2vax_1",
2440
+ "rp-sidebar-content": "_rp-sidebar-content_p2vax_1",
2441
+ "rp-thumbnails-wrapper": "_rp-thumbnails-wrapper_p2vax_16",
2442
+ "rp-thumbnail-dragging": "_rp-thumbnail-dragging_p2vax_21"
2443
+ }, Ie = {
2444
+ "rp-thumbnail-wrapper": "_rp-thumbnail-wrapper_3fenb_1",
2445
+ "rp-thumbnail-text": "_rp-thumbnail-text_3fenb_10",
2446
+ "rp-thumbnail": "_rp-thumbnail_3fenb_1",
2447
+ "rp-thumbnail-active": "_rp-thumbnail-active_3fenb_22",
2448
+ "rp-thumbnail-loader": "_rp-thumbnail-loader_3fenb_31"
2449
+ }, jo = (t) => {
2450
+ const { thumbnailSrc: e, pageNumber: n, isFocused: r, viewport: o } = t, { goToPage: a } = te(), i = O(() => r ? Ie["rp-thumbnail-active"] : "", [r]), s = O(() => ({
2451
+ width: Math.round(o.width),
2452
+ height: Math.round(o.height)
2453
+ }), [o]), l = y(() => {
2454
+ n && a(n);
2455
+ }, [a, n]);
2456
+ return /* @__PURE__ */ D(
2457
+ "div",
2458
+ {
2459
+ onClick: l,
2460
+ id: `page-${n}`,
2461
+ className: Ie["rp-thumbnail-wrapper"],
2462
+ children: [
2463
+ /* @__PURE__ */ c("div", { className: X(i, Ie["rp-thumbnail"]), children: e ? /* @__PURE__ */ c(
2464
+ "img",
2465
+ {
2466
+ src: e,
2467
+ width: s.width,
2468
+ height: s.height,
2469
+ alt: "thumbnail"
2470
+ }
2471
+ ) : /* @__PURE__ */ c(
2472
+ "div",
2473
+ {
2474
+ className: Ie["rp-thumbnail-loader"],
2475
+ style: {
2476
+ width: `${s.width}px`,
2477
+ height: `${s.height}px`
2478
+ },
2479
+ children: /* @__PURE__ */ c(lt, {})
2480
+ }
2481
+ ) }),
2482
+ /* @__PURE__ */ c("div", { className: Ie["rp-thumbnail-text"], children: n })
2483
+ ]
2484
+ }
2485
+ );
2486
+ }, $t = {
2487
+ "rp-thumbnails-container": "_rp-thumbnails-container_16vqr_1",
2488
+ "rp-thumbnails": "_rp-thumbnails_16vqr_1"
2489
+ }, Bo = () => {
2490
+ const [t, e] = k({}), { pages: n } = J(), { rotate: r } = He(), o = O(() => Object.keys(t).length, [t]), a = y(
2491
+ (s) => {
2492
+ if (!n.size)
2493
+ return;
2494
+ const l = Array.from(n.values()).slice(0, s).map((m) => {
2495
+ const { thumbnailViewport: u, scale: f } = St(m.page, r);
2496
+ return {
2497
+ scale: f,
2498
+ page: m.page,
2499
+ loading: !0,
2500
+ viewport: u
2501
+ };
2502
+ }), h = l.reduce((m, u) => (m[u.page.pageNumber] = u, m), {});
2503
+ e(h);
2504
+ const p = [];
2505
+ for (const m of l) {
2506
+ const u = document.createElement("canvas"), f = tt(
2507
+ m.page,
2508
+ u,
2509
+ m.scale,
2510
+ r
2511
+ ).promise.then(() => {
2512
+ const v = u.toDataURL();
2513
+ return {
2514
+ ...m,
2515
+ thumbnailSrc: v,
2516
+ loading: !1
2517
+ };
2518
+ });
2519
+ p.push(f);
2520
+ }
2521
+ Promise.all(p).then((m) => {
2522
+ const u = m.reduce(
2523
+ (f, v) => (f[v.page.pageNumber] = v, f),
2524
+ {}
2525
+ );
2526
+ e((f) => ({ ...f, ...u }));
2527
+ });
2528
+ },
2529
+ [n, r]
2530
+ );
2531
+ A(() => {
2532
+ a(10);
2533
+ }, [a]);
2534
+ const i = y(
2535
+ (s) => {
2536
+ if (!n)
2537
+ return;
2538
+ const l = n.get(s);
2539
+ if (!l)
2540
+ return;
2541
+ e((p) => ({
2542
+ ...p,
2543
+ [s]: {
2544
+ loading: !0,
2545
+ page: l.page,
2546
+ viewport: l.thumbnailViewport,
2547
+ scale: l.thumbnailScale
2548
+ }
2549
+ }));
2550
+ const h = document.createElement("canvas");
2551
+ tt(l.page, h, l.thumbnailScale, r).promise.then(() => {
2552
+ const p = h.toDataURL(), { thumbnailViewport: m, scale: u } = St(l.page, r);
2553
+ return {
2554
+ scale: u,
2555
+ thumbnailSrc: p,
2556
+ page: l.page,
2557
+ loading: !1,
2558
+ viewport: m
2559
+ };
2560
+ }).then((p) => {
2561
+ e((m) => ({ ...m, [s]: p }));
2562
+ });
2563
+ },
2564
+ [n, r]
2565
+ );
2566
+ return { thumbnailPages: t, addPage: i, addToPage: a, thumbnailLength: o };
2567
+ }, xn = Fe({
2568
+ thumbnailPages: {},
2569
+ addPage: (t) => {
2570
+ },
2571
+ addToPage: (t) => {
2572
+ },
2573
+ thumbnailLength: 0,
2574
+ setActive: (t) => {
2575
+ },
2576
+ active: !1
2577
+ }), Ko = () => ke(xn), Ps = ({
2578
+ children: t,
2579
+ initialThumbnailsVisible: e
2580
+ }) => {
2581
+ const { thumbnailPages: n, addPage: r, addToPage: o, thumbnailLength: a } = Bo(), [i, s] = k(e);
2582
+ return /* @__PURE__ */ c(
2583
+ xn.Provider,
2584
+ {
2585
+ value: { thumbnailPages: n, addPage: r, addToPage: o, thumbnailLength: a, active: i, setActive: s },
2586
+ children: t
2587
+ }
2588
+ );
2589
+ }, Jo = 16, Xo = (t, e) => {
2590
+ const n = t == null ? void 0 : t.querySelector(`#page-${e}`);
2591
+ t && (n != null && n.offsetTop) && (t.scrollTop = (n == null ? void 0 : n.offsetTop) - Jo);
2592
+ }, Is = ct((t, e) => {
2593
+ const { show: n } = t, { focusedPage: r, totalPages: o } = te(), { thumbnailPages: a, addPage: i, thumbnailLength: s, addToPage: l } = Ko(), h = $(null), p = $(1);
2594
+ Vt(e, () => h.current);
2595
+ const m = O(() => Object.values(a), [a]), u = y(() => {
2596
+ const f = s + 1;
2597
+ f <= o && i(f);
2598
+ }, [i, o, s]);
2599
+ return A(() => {
2600
+ r > s ? l(r) : n && p.current !== r && (Xo(h.current, r), p.current = r);
2601
+ }, [r, s, l, n, m]), nr(h.current, u), /* @__PURE__ */ c("div", { ref: h, className: $t["rp-thumbnails-container"], children: /* @__PURE__ */ c("div", { className: $t["rp-thumbnails"], children: n ? m.map((f, v) => {
2602
+ var _, g;
2603
+ return /* @__PURE__ */ c(
2604
+ jo,
2605
+ {
2606
+ isFocused: r === ((_ = f.page) == null ? void 0 : _.pageNumber),
2607
+ pageNumber: (g = f.page) == null ? void 0 : g.pageNumber,
2608
+ thumbnailSrc: f.thumbnailSrc,
2609
+ loading: f.loading,
2610
+ viewport: f.viewport
2611
+ },
2612
+ v
2613
+ );
2614
+ }) : null }) });
2615
+ });
2616
+ export {
2617
+ zr as A,
2618
+ Bo as B,
2619
+ Pr as C,
2620
+ no as D,
2621
+ xn as E,
2622
+ Sn as F,
2623
+ Zo as L,
2624
+ Ao as M,
2625
+ Fo as O,
2626
+ Cs as P,
2627
+ _s as R,
2628
+ gs as S,
2629
+ Ps as T,
2630
+ Go as Z,
2631
+ yo as a,
2632
+ Ct as b,
2633
+ Yt as c,
2634
+ Ss as d,
2635
+ Ko as e,
2636
+ Ts as f,
2637
+ Is as g,
2638
+ vs as h,
2639
+ mt as i,
2640
+ Ir as j,
2641
+ Xt as k,
2642
+ xr as l,
2643
+ gt as m,
2644
+ Yr as n,
2645
+ to as o,
2646
+ an as p,
2647
+ ro as q,
2648
+ io as r,
2649
+ Io as s,
2650
+ Eo as t,
2651
+ te as u,
2652
+ Tn as v,
2653
+ In as w,
2654
+ ko as x,
2655
+ Uo as y,
2656
+ jo as z
2657
+ };