@react-pdf-kit/viewer 2.0.0-beta.9 → 2.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/dist/Combination-136ff99c.js +698 -0
  2. package/dist/MostPageTool.module-13578ad6.js +6 -0
  3. package/dist/OtherTool.module-a4be5f1f.js +6 -0
  4. package/dist/Paginate.module-4eef00aa.js +8 -0
  5. package/dist/PaginationContext-9217cab4.js +201 -0
  6. package/dist/RPLayout.module-b4b23e29.js +14 -0
  7. package/dist/RPSplitter-f6acf13b.js +71 -0
  8. package/dist/RPToolbar.module-27d7fe77.js +10 -0
  9. package/dist/SearchTool.module-99f60dc7.js +16 -0
  10. package/dist/ToolbarLayout.module-6e339802.js +12 -0
  11. package/dist/ZoomTool.module-7082af8c.js +12 -0
  12. package/dist/assets/style.css +1 -1
  13. package/dist/assets/style.js +32 -30
  14. package/dist/components/RPController.js +81 -152
  15. package/dist/components/RPDropFileZone.js +1 -1
  16. package/dist/components/RPPages.js +1028 -122
  17. package/dist/components/RPProvider.js +57 -113
  18. package/dist/components/icons/DualPageWithCoverIcon.js +22 -0
  19. package/dist/components/layout/LayoutContainer.js +31 -136
  20. package/dist/components/layout/LayoutWrapper.js +8 -4
  21. package/dist/components/layout/RPDefaultLayout.js +184 -86
  22. package/dist/components/layout/RPLayout.js +123 -105
  23. package/dist/components/layout/SkipLink.js +29 -0
  24. package/dist/components/layout/WrapperLayout.js +1 -1
  25. package/dist/components/layout/sidebar/RPSidebar.js +79 -112
  26. package/dist/components/layout/sidebar/RPSplitter.js +6 -59
  27. package/dist/components/layout/sidebar/Thumbnail.js +130 -125
  28. package/dist/components/layout/sidebar/Thumbnails.js +56 -119
  29. package/dist/components/layout/toolbar/DarkModeTool.js +7 -5
  30. package/dist/components/layout/toolbar/DocumentDialog.js +305 -131
  31. package/dist/components/layout/toolbar/DocumentProperties.js +13 -10
  32. package/dist/components/layout/toolbar/FileDownloadTool.js +34 -124
  33. package/dist/components/layout/toolbar/FileUploadTool.js +9 -6
  34. package/dist/components/layout/toolbar/FullScreenTool.js +17 -14
  35. package/dist/components/layout/toolbar/MenuItem.js +11 -8
  36. package/dist/components/layout/toolbar/MenuSeparator.js +8 -5
  37. package/dist/components/layout/toolbar/MostPageTool.js +66 -125
  38. package/dist/components/layout/toolbar/OtherTool.js +171 -112
  39. package/dist/components/layout/toolbar/Paginate.js +121 -116
  40. package/dist/components/layout/toolbar/PrintTool.js +55 -123
  41. package/dist/components/layout/toolbar/RPMenuItem.js +14 -11
  42. package/dist/components/layout/toolbar/RPMoreOptions.js +102 -154
  43. package/dist/components/layout/toolbar/RPToolbar.js +90 -79
  44. package/dist/components/layout/toolbar/RPToolbarEnd.js +69 -88
  45. package/dist/components/layout/toolbar/RotateTool.js +13 -10
  46. package/dist/components/layout/toolbar/ScrollModeTool.js +42 -39
  47. package/dist/components/layout/toolbar/SearchCloseButton.js +24 -10
  48. package/dist/components/layout/toolbar/SearchResultNavigator.js +74 -105
  49. package/dist/components/layout/toolbar/SearchTool.js +245 -121
  50. package/dist/components/layout/toolbar/SelectionModeTool.js +9 -6
  51. package/dist/components/layout/toolbar/ThumbnailTool.js +15 -122
  52. package/dist/components/layout/toolbar/ToolbarCustom.js +75 -143
  53. package/dist/components/layout/toolbar/ToolbarDefault.js +135 -122
  54. package/dist/components/layout/toolbar/ToolbarLayout.js +86 -81
  55. package/dist/components/layout/toolbar/ViewModeTool.js +47 -35
  56. package/dist/components/layout/toolbar/ZoomTool.js +129 -119
  57. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +18 -122
  58. package/dist/components/layout/toolbar/tools/DualPageTool.js +11 -129
  59. package/dist/components/layout/toolbar/tools/DualPageWithCoverTool.js +202 -0
  60. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +14 -123
  61. package/dist/components/layout/toolbar/tools/FileUploadTool.js +10 -8
  62. package/dist/components/layout/toolbar/tools/FirstPageTool.js +197 -0
  63. package/dist/components/layout/toolbar/tools/FullScreenTool.js +21 -18
  64. package/dist/components/layout/toolbar/tools/HorizontalScrollingTool.js +37 -0
  65. package/dist/components/layout/toolbar/tools/InputPageTool.js +52 -136
  66. package/dist/components/layout/toolbar/tools/LastPageTool.js +197 -0
  67. package/dist/components/layout/toolbar/tools/NextPageTool.js +39 -129
  68. package/dist/components/layout/toolbar/tools/PageScrollingTool.js +37 -0
  69. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +28 -118
  70. package/dist/components/layout/toolbar/tools/PrintTool.js +14 -123
  71. package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +18 -9
  72. package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +15 -13
  73. package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +24 -14
  74. package/dist/components/layout/toolbar/tools/SinglePageTool.js +11 -129
  75. package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +16 -6
  76. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +23 -131
  77. package/dist/components/layout/toolbar/tools/VerticalScrollingTool.js +37 -0
  78. package/dist/components/layout/toolbar/tools/ZoomInTool.js +21 -18
  79. package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +23 -136
  80. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +80 -141
  81. package/dist/components/layout/toolbar/tools/ZoomOutTool.js +18 -15
  82. package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +98 -105
  83. package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +16 -123
  84. package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +17 -14
  85. package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +29 -127
  86. package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +31 -130
  87. package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +28 -17
  88. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +63 -134
  89. package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +33 -131
  90. package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +41 -24
  91. package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +58 -37
  92. package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +44 -25
  93. package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +56 -30
  94. package/dist/components/page/AnnotationLayer.js +130 -125
  95. package/dist/components/page/CanvasLayer.js +57 -126
  96. package/dist/components/page/CustomElement.js +1 -1
  97. package/dist/components/page/DualPage.js +69 -110
  98. package/dist/components/page/DualPageWithCover.js +131 -0
  99. package/dist/components/page/RPPage.js +126 -123
  100. package/dist/components/page/SinglePage.js +59 -110
  101. package/dist/components/page/TextHighlightLayer.js +187 -129
  102. package/dist/components/page/TextLayer.js +186 -125
  103. package/dist/components/ui/Button.js +14 -12
  104. package/dist/components/ui/Checkbox.js +78 -70
  105. package/dist/components/ui/DropDown.js +11 -8
  106. package/dist/components/ui/Input.js +12 -11
  107. package/dist/components/ui/LoadingIndicator.js +34 -127
  108. package/dist/components/ui/PasswordModal.js +44 -30
  109. package/dist/components/ui/RPTooltip.js +121 -135
  110. package/dist/contexts/DimensionPagesContext.js +1 -1
  111. package/dist/contexts/DropFileZoneContext.js +1 -1
  112. package/dist/contexts/ElementPageContext.js +1 -1
  113. package/dist/contexts/EventCallbackContext.js +12 -8
  114. package/dist/contexts/FileInputContext.js +1 -1
  115. package/dist/contexts/HighlightContext.js +1 -1
  116. package/dist/contexts/LocalizationContext.js +1 -1
  117. package/dist/contexts/PagesRotateContext.js +1 -1
  118. package/dist/contexts/PaginationContext.js +15 -118
  119. package/dist/contexts/PrintContext.js +67 -131
  120. package/dist/contexts/RPDocumentContext.js +1 -1
  121. package/dist/contexts/RenderQueueProvider.js +48 -118
  122. package/dist/contexts/RotationContext.js +1 -1
  123. package/dist/contexts/ScrollModeContext.js +1 -1
  124. package/dist/contexts/SearchContext.js +66 -112
  125. package/dist/contexts/SelectionModeContext.js +1 -1
  126. package/dist/contexts/ThumbnailsContext.js +32 -131
  127. package/dist/contexts/ViewModeContext.js +19 -15
  128. package/dist/contexts/ZoomContext.js +1 -1
  129. package/dist/de_DE-a553b162.js +489 -0
  130. package/dist/floating-ui.react-dom-5ec29bd6.js +1327 -0
  131. package/dist/index-61f59539.js +1198 -0
  132. package/dist/index-655864a7.js +27 -0
  133. package/dist/{index-c9a2990a.js → index-c0faa594.js} +64 -87
  134. package/dist/index-e3ee9457.js +150 -0
  135. package/dist/main.js +193 -130
  136. package/dist/types/components/icons/DualPageWithCoverIcon.d.ts +2 -0
  137. package/dist/types/components/layout/LayoutContainer.d.ts +1 -5
  138. package/dist/types/components/layout/LayoutWrapper.d.ts +1 -5
  139. package/dist/types/components/layout/SkipLink.d.ts +7 -0
  140. package/dist/types/components/layout/sidebar/Thumbnails.d.ts +1 -3
  141. package/dist/types/components/layout/toolbar/RPToolbar.d.ts +1 -3
  142. package/dist/types/components/layout/toolbar/tools/DualPageWithCoverTool.d.ts +3 -0
  143. package/dist/types/components/layout/toolbar/tools/FirstPageTool.d.ts +3 -0
  144. package/dist/types/components/layout/toolbar/tools/HorizontalScrollingTool.d.ts +3 -0
  145. package/dist/types/components/layout/toolbar/tools/LastPageTool.d.ts +3 -0
  146. package/dist/types/components/layout/toolbar/tools/PageScrollingTool.d.ts +3 -0
  147. package/dist/types/components/layout/toolbar/tools/VerticalScrollingTool.d.ts +3 -0
  148. package/dist/types/components/page/DualPageWithCover.d.ts +5 -0
  149. package/dist/types/components/page/RPPage.d.ts +1 -3
  150. package/dist/types/components/ui/Button.d.ts +1 -3
  151. package/dist/types/components/ui/Checkbox.d.ts +1 -0
  152. package/dist/types/components/ui/Input.d.ts +1 -3
  153. package/dist/types/components/ui/RPTooltip.d.ts +1 -3
  154. package/dist/types/locales/de_DE.json.d.ts +83 -0
  155. package/dist/types/locales/en_US.json.d.ts +2 -0
  156. package/dist/types/locales/it_IT.json.d.ts +2 -0
  157. package/dist/types/locales/pt_PT.json.d.ts +2 -0
  158. package/dist/types/locales/th_TH.json.d.ts +2 -0
  159. package/dist/types/locales/zh_CN.json.d.ts +2 -0
  160. package/dist/types/main.d.ts +8 -2
  161. package/dist/types/utils/annotations.d.ts +10 -1
  162. package/dist/types/utils/calculatePage.d.ts +3 -3
  163. package/dist/types/utils/hooks/usePresentPage.d.ts +2 -1
  164. package/dist/types/utils/hooks/useTextSelection.d.ts +7 -0
  165. package/dist/types/utils/types.d.ts +34 -3
  166. package/dist/types/utils/withRef.d.ts +5 -4
  167. package/dist/utils/annotations.js +145 -150
  168. package/dist/utils/calculatePage.js +17 -11
  169. package/dist/utils/getZoomLevel.js +9 -9
  170. package/dist/utils/highlight.js +139 -139
  171. package/dist/utils/hooks/useFileDownload.js +23 -130
  172. package/dist/utils/hooks/useLicense.js +1 -1
  173. package/dist/utils/hooks/useLoadPdf.js +1 -1
  174. package/dist/utils/hooks/useLocalization.js +12 -11
  175. package/dist/utils/hooks/usePageRotateContext.js +1 -1
  176. package/dist/utils/hooks/usePaginate.js +23 -126
  177. package/dist/utils/hooks/usePinch.js +1 -1
  178. package/dist/utils/hooks/usePresentPage.js +79 -129
  179. package/dist/utils/hooks/usePrint.js +175 -130
  180. package/dist/utils/hooks/useRotate.js +1 -1
  181. package/dist/utils/hooks/useScrollToPage.js +18 -121
  182. package/dist/utils/hooks/useSearch.js +149 -127
  183. package/dist/utils/hooks/useTextSelection.js +76 -0
  184. package/dist/utils/hooks/useThumbnail.js +50 -131
  185. package/dist/utils/hooks/useVirtualReactWindow.js +84 -128
  186. package/dist/utils/types.js +14 -13
  187. package/dist/utils/withRef.js +5 -5
  188. package/package.json +5 -4
  189. package/dist/LayoutWrapper-6224491f.js +0 -19
  190. package/dist/SearchCloseButton-08d57275.js +0 -33
  191. package/dist/ToolbarLayout.module-8d56d12b.js +0 -3560
  192. package/dist/floating-ui.react-dom-d22a10b4.js +0 -1474
  193. package/dist/index-3bf64864.js +0 -1886
  194. package/dist/th_TH-d627cd51.js +0 -398
@@ -1,3560 +0,0 @@
1
- import { jsx as i, Fragment as pe, jsxs as W } from "react/jsx-runtime";
2
- import * as X from "react";
3
- import { useRef as M, useEffect as z, useCallback as N, useState as H, useMemo as F, createContext as Ve, useContext as Be, useImperativeHandle as pn, createElement as Ke, PureComponent as lo, Component as uo, memo as hn, Fragment as po, forwardRef as ho } from "react";
4
- import { ChevronUpIcon as Ue } from "./components/icons/ChevronUpIcon.js";
5
- import { UIButton as ce } from "./components/ui/Button.js";
6
- import { UIInput as fn } from "./components/ui/Input.js";
7
- import { ViewMode as Oe, ScrollMode as re, AnnotationSubType as fo, SelectionMode as mo, ErrorType as go, ZoomLevel as Me } from "./utils/types.js";
8
- import { useScrollModeContext as ze } from "./contexts/ScrollModeContext.js";
9
- import { useDocumentContext as oe } from "./contexts/RPDocumentContext.js";
10
- import { useDocumentPasswordContext as vo } from "./contexts/DocumentPasswordContext.js";
11
- import { useDarkModeContext as wo } from "./contexts/DarkModeContext.js";
12
- import "./contexts/RotationContext.js";
13
- import { useLayerContext as _o } from "./contexts/LayerContext.js";
14
- import { useZoomContext as tt } from "./contexts/ZoomContext.js";
15
- import { useViewModeContext as He } from "./contexts/ViewModeContext.js";
16
- import { useVirtualScrollContext as nt } from "./contexts/VirtualScrollContext.js";
17
- import { useVirtualGridContext as mn } from "./contexts/VirtualGridContext.js";
18
- import { useSelectionModeContext as bo } from "./contexts/SelectionModeContext.js";
19
- import { useInitialStateContext as yt } from "./contexts/InitialStateContext.js";
20
- import { useFullScreenContext as To } from "./contexts/FullScreenContext.js";
21
- import "./contexts/FileInputContext.js";
22
- import "./contexts/DropFileZoneContext.js";
23
- import { findMatches as Co, resetDivs as Po, highlightMatches as yo, isMatchEntireWord as Io } from "./utils/highlight.js";
24
- import { useLayoutContainer as be } from "./contexts/LayoutContainerContext.js";
25
- import { useDimensionPagesContext as je } from "./contexts/DimensionPagesContext.js";
26
- import { useLocalizationContext as de } from "./contexts/LocalizationContext.js";
27
- import { useHighlightContext as So } from "./contexts/HighlightContext.js";
28
- import "./contexts/LicenseContext.js";
29
- import { useDownloadContext as xo } from "./contexts/DownloadContext.js";
30
- import { useSmoothScrollContext as gn } from "./contexts/SmoothScrollContext.js";
31
- import "./contexts/ElementPageContext.js";
32
- import { usePagesRotateContext as ot } from "./contexts/PagesRotateContext.js";
33
- import { Queue as Ro } from "./utils/Queue.js";
34
- import { renderPage as Lo } from "./utils/renderPage.js";
35
- import { useGlobalCurrentPage as Eo } from "./contexts/GlobalCurrentPage.js";
36
- import { useLoaderContext as It } from "./contexts/LoaderContext.js";
37
- import { useToolComponentContext as ye } from "./contexts/ToolComponentContext.js";
38
- import { useIconToolContext as me } from "./contexts/IconToolContext.js";
39
- import { useOtherToolContext as No } from "./contexts/OtherToolContext.js";
40
- import { useEventCallbackContext as Oo } from "./contexts/EventCallbackContext.js";
41
- import { useThemeContext as Do } from "./contexts/ThemeContext.js";
42
- import "./contexts/ConfigContext.js";
43
- import * as zo from "pdfjs-dist";
44
- import { PixelsPerInch as Ao, AnnotationMode as Fo, RenderingCancelledException as ko, AnnotationLayer as Wo, OutputScale as Mo } from "pdfjs-dist";
45
- import { ThumbnailIcon as Ho } from "./components/icons/Thumbnail.js";
46
- import { c as ae } from "./clsx-0c6e471a.js";
47
- import { LoaderIcon as vn } from "./components/icons/LoaderIcon.js";
48
- import { Container as $o } from "./components/layout/Container.js";
49
- import { useViewportContext as Ie, ViewportProvider as qo } from "./contexts/ViewportContext.js";
50
- import { useToolbarComponentContext as Te, ToolbarComponentProvider as Go } from "./contexts/ToolbarComponentContext.js";
51
- import { RPSplitter as Uo } from "./components/layout/sidebar/RPSplitter.js";
52
- import { WrapperLayout as Vo } from "./components/layout/WrapperLayout.js";
53
- import { RPDropFileZone as Bo } from "./components/RPDropFileZone.js";
54
- import { c as Ce, L as jo } from "./LayoutWrapper-6224491f.js";
55
- import { c as ne, S as Ht } from "./SearchCloseButton-08d57275.js";
56
- import { UICheckbox as $t } from "./components/ui/Checkbox.js";
57
- import { useIconContext as ge, IconProvider as Zo } from "./contexts/IconContext.js";
58
- import K from "./components/ui/RPTooltip.js";
59
- import { UIDropDown as St } from "./components/ui/DropDown.js";
60
- import { MenuItem as Pe } from "./components/layout/toolbar/MenuItem.js";
61
- import { MenuSeparator as xt } from "./components/layout/toolbar/MenuSeparator.js";
62
- import { dateFormatter as qt } from "./utils/dateFormatter.js";
63
- import { PropertyItem as Ko } from "./components/layout/toolbar/PropertyItem.js";
64
- import "./RotateTool.module-67946714.js";
65
- import { withRef as rt } from "./utils/withRef.js";
66
- import { useInfiniteScroll as Xo } from "./utils/hooks/useInfiniteScroll.js";
67
- import { MAX_ZOOM_SCALE as Gt, THUMBNAIL_MIN_WIDTH as Qo } from "./utils/constants.js";
68
- import { SimpleLinkService as Ut } from "./utils/link_service.js";
69
- import { insertDateText as Yo, annotationEventsHandler as Jo, handleAnnotationWidget as er, bindLayerEvents as tr, unbindLayerEvents as Vt } from "./utils/annotations.js";
70
- import { normalizeSingleKeyword as nr, sortHighlightPosition as or, unwrap as rr } from "./components/page/searchHighlight.js";
71
- import { CustomElement as ir } from "./components/page/CustomElement.js";
72
- import { getGridDimension as Rt, getPositionFromPage as ar, getPageFromPosition as sr } from "./utils/calculatePage.js";
73
- import { useMousePressed as cr } from "./utils/hooks/useMousePressed.js";
74
- import { useGrabScroll as lr } from "./utils/hooks/useGrabScroll.js";
75
- import { usePinch as dr } from "./utils/hooks/usePinch.js";
76
- import { useDebounce as Lt } from "./utils/hooks/useDebounce.js";
77
- import ur from "./components/ui/PasswordModal.js";
78
- import { approximateFraction as Bt } from "./utils/approximateFragtion.js";
79
- import { useCopyText as pr } from "./utils/hooks/useCopyText.js";
80
- import { getScrollDistance as We } from "./utils/getScrollDistance.js";
81
- import { getWordPositionInPage as hr } from "./utils/getWordPositionInPage.js";
82
- import { getThumbnailViewport as fr } from "./utils/getThumbnailViewport.js";
83
- import { smoothScrollTo as ut } from "./utils/smoothScrollTo.js";
84
- import { appConsole as mr } from "./utils/appConsole.js";
85
- import { FileUploadTool as wn } from "./components/layout/toolbar/FileUploadTool.js";
86
- import { DarkModeTool as gr } from "./components/layout/toolbar/DarkModeTool.js";
87
- import { ThreeDotIcon as vr } from "./components/icons/ThreeDotIcon.js";
88
- import { c as wr, u as Et, P as Ze, a as Ge, b as Nt, k as _r, e as br, i as Tr } from "./index-c9a2990a.js";
89
- import { D as Cr, d as pt } from "./floating-ui.react-dom-d22a10b4.js";
90
- import { a as Pr, h as yr, u as Ir, F as Sr, b as xr, G as Je } from "./index-3bf64864.js";
91
- import { CloseIcon as Rr } from "./components/icons/CloseIcon.js";
92
- import { DocumentProperties as Lr } from "./components/layout/toolbar/DocumentProperties.js";
93
- import { RotateTool as Er } from "./components/layout/toolbar/RotateTool.js";
94
- import { ViewModeTool as Nr } from "./components/layout/toolbar/ViewModeTool.js";
95
- import { ScrollModeTool as Or } from "./components/layout/toolbar/ScrollModeTool.js";
96
- import { FileDownloadDefaultIcon as Dr } from "./components/icons/FileDownloadDefaultIcon.js";
97
- import { PrintDefaultTool as zr } from "./components/icons/PrintDefaultIcon.js";
98
- import { FullScreenTool as _n } from "./components/layout/toolbar/FullScreenTool.js";
99
- import { GoToDownIcon as bn } from "./components/icons/GoToDownIcon.js";
100
- import { SelectionModeTool as Ar } from "./components/layout/toolbar/SelectionModeTool.js";
101
- import { ZoomInIcon as Fr } from "./components/icons/ZoomInIcon.js";
102
- import { ZoomOutIcon as kr } from "./components/icons/ZoomOutIcon.js";
103
- import { isZoomOutDisabled as Wr, isZoomInDisabled as Mr } from "./utils/zoom.js";
104
- import { SearchIcon as Tn } from "./components/icons/SearchIcon.js";
105
- import { ClearIcon as Hr } from "./components/icons/ClearIcon.js";
106
- import { InfoIcon as jt } from "./components/icons/InfoIcon.js";
107
- const Cn = () => {
108
- const { viewMode: t } = He(), { scrollMode: e } = ze(), { virtualScrollRef: n, virtualScrollableElementRef: r, pageScrollElementRef: o } = nt(), { setFocusedPage: a } = ue(), c = M(), { columnCount: d } = mn(), { widths: s, heights: m } = je(), g = M(e), C = M(t), u = M(d), { targetScrollPage: v } = gn();
109
- z(() => {
110
- n != null && n.scrollToItem && (c.current = n);
111
- }, [n]), z(() => {
112
- g.current = e, C.current = t;
113
- }, [e, t]);
114
- const P = N(
115
- (b, y) => {
116
- if (!o)
117
- return;
118
- const p = Math.ceil(b / 2) * 2 - 1;
119
- if (b === p + 1) {
120
- const f = {
121
- left: s[p],
122
- top: 0
123
- };
124
- return new Promise(
125
- (l) => ut(o, f, l)
126
- );
127
- }
128
- const h = {
129
- left: 0,
130
- top: 0
131
- };
132
- return o == null ? void 0 : o.scrollTo({
133
- ...h,
134
- behavior: y
135
- });
136
- },
137
- [o, s, ut]
138
- );
139
- return z(() => {
140
- g.current = e, C.current = t;
141
- }, [e, t]), z(() => {
142
- u.current = d;
143
- }, [d]), { scrollToPage: N(
144
- (b, y = "smooth") => {
145
- a(b);
146
- const p = b - 1;
147
- let h = p, f = 0;
148
- if (C.current === Oe.DUAL_PAGE && g.current === re.PAGE_SCROLLING) {
149
- P(b, y);
150
- return;
151
- }
152
- if (g.current === re.PAGE_SCROLLING) {
153
- a(b);
154
- return;
155
- }
156
- if (!c.current || !r)
157
- return;
158
- const l = r;
159
- y === "smooth" && (v.current = b);
160
- const { columnsWidth: w, rowsHeight: _ } = Rt(
161
- { widths: s, heights: m },
162
- d
163
- );
164
- if (g.current === re.HORIZONTAL_SCROLLING) {
165
- f = p;
166
- const S = We(w, f), L = {
167
- left: Math.floor(S),
168
- top: 0
169
- };
170
- return l.scrollTo({
171
- ...L,
172
- behavior: y
173
- });
174
- }
175
- if (C.current === Oe.DUAL_PAGE) {
176
- f = p % 2, h = Math.floor(p / 2);
177
- const L = We(w, f), O = We(_, h), D = {
178
- left: Math.floor(L),
179
- top: Math.floor(O)
180
- };
181
- return l.scrollTo({
182
- ...D,
183
- behavior: y
184
- });
185
- }
186
- const I = We(_, h), x = {
187
- left: 0,
188
- top: Math.floor(I)
189
- };
190
- return l.scrollTo({
191
- ...x,
192
- behavior: y
193
- });
194
- },
195
- [
196
- r,
197
- d,
198
- P,
199
- a,
200
- ut,
201
- m,
202
- s
203
- ]
204
- ) };
205
- }, $r = (t = 1) => {
206
- const [e, n] = H(t), [r, o] = H(0), { scrollToPage: a } = Cn(), c = M(1), { viewMode: d } = He(), { scrollMode: s } = ze(), { widths: m } = je(), { pagesRef: g } = be(), C = Lt(e, 100), u = N(
207
- (h) => {
208
- if (!/^[0-9]*$/g.test(h.toString()) || !h)
209
- return { success: !1, currentPage: c.current };
210
- const l = +h;
211
- return l < 0 || l > r ? { success: !1, currentPage: c.current } : (n(l), c.current = l, { success: !0, currentPage: +h });
212
- },
213
- [r]
214
- ), v = N(u, [u]), P = N(
215
- (h) => {
216
- const f = u(h);
217
- return f.success && a(f.currentPage), f;
218
- },
219
- [u, a]
220
- ), T = N((h) => {
221
- const f = h % 2 === 1;
222
- if (!g || f)
223
- return !1;
224
- const l = f ? m[h] : m[h - 1], w = f ? m[h + 1] : m[h];
225
- return d === Oe.DUAL_PAGE && l + w < g.clientWidth;
226
- }, [d, m, g, r]), b = N(() => {
227
- let h = e - 1;
228
- T(h) && (h = e - 2), P(h);
229
- }, [P, e, d, s, T]), y = F(() => d === Oe.DUAL_PAGE && s === re.PAGE_SCROLLING ? e === r - 1 : e === r, [e, r, d, s]), p = N(() => {
230
- if (y)
231
- return;
232
- let h = e + 1;
233
- T(h) && (h = e + 2), P(h);
234
- }, [P, e, T, d, s, y]);
235
- return {
236
- focusedPage: C,
237
- totalPages: r,
238
- setFocusedPage: v,
239
- setTotalPages: o,
240
- nextPage: p,
241
- prevPage: b,
242
- goToPage: P
243
- };
244
- }, Pn = Ve({
245
- focusedPage: 0,
246
- setFocusedPage: (t) => {
247
- },
248
- goToPage: (t) => ({ success: !!t, currentPage: +t }),
249
- totalPages: 0,
250
- setTotalPages: (t) => {
251
- },
252
- prevPage: () => {
253
- },
254
- nextPage: () => {
255
- }
256
- }), ue = () => {
257
- const t = Be(Pn);
258
- return typeof (t == null ? void 0 : t.focusedPage) > "u" && mr.error("Please use this hooks inside children component of RPProvider"), t;
259
- }, gc = ({ children: t }) => {
260
- const { pdf: e } = oe(), { setCurrentPage: n } = Eo(), { focusedPage: r, totalPages: o, setFocusedPage: a, setTotalPages: c, goToPage: d, nextPage: s, prevPage: m } = $r();
261
- return z(() => {
262
- e != null && e.numPages && (c(e.numPages), a(1));
263
- }, [e, c, a]), z(() => {
264
- n(r);
265
- }, [r, n]), /* @__PURE__ */ i(
266
- Pn.Provider,
267
- {
268
- value: {
269
- focusedPage: r,
270
- totalPages: o,
271
- setFocusedPage: a,
272
- setTotalPages: c,
273
- nextPage: s,
274
- prevPage: m,
275
- goToPage: d
276
- },
277
- children: t
278
- }
279
- );
280
- }, qr = () => {
281
- const { pdf: t, pages: e } = oe(), [n, r] = H({
282
- loadedPages: 0,
283
- totalPages: 0,
284
- percentage: 0
285
- }), [o, a] = H(!1), [c, d] = H(!1), [s, m] = H(null), [g, C] = H(void 0), u = M(!1);
286
- z(() => {
287
- u.current;
288
- }, [u]);
289
- const v = N(() => {
290
- document.documentElement.classList.remove("rp-print-html-printing"), document.body.classList.remove("rp-print-body-printing");
291
- const l = document.querySelector(".rp-print-zone");
292
- l && l.remove();
293
- }, []), P = N(() => {
294
- u.current = !1, a(!1), d(!1), m(null), C(void 0), r({
295
- loadedPages: 0,
296
- totalPages: 0,
297
- percentage: 0
298
- });
299
- }, []), T = () => {
300
- u.current = !0;
301
- }, b = async ({
302
- scratchCanvas: l,
303
- pdfDocument: w,
304
- pageNumber: _,
305
- viewerPdfPage: I,
306
- printResolution: x,
307
- optionalContentConfigPromise: S,
308
- printAnnotationStoragePromise: L
309
- }) => {
310
- if (u.current) {
311
- P();
312
- return;
313
- }
314
- const O = x / Ao.PDF;
315
- l.width = Math.floor(I.width * O), l.height = Math.floor(I.height * O);
316
- const D = l.getContext("2d");
317
- D.save(), D.fillStyle = "rgb(255, 255, 255)", D.fillRect(0, 0, l.width, l.height), D.restore();
318
- const [A, E] = await Promise.all([
319
- w.getPage(_),
320
- L
321
- ]);
322
- if (u.current) {
323
- P();
324
- return;
325
- }
326
- const R = {
327
- canvas: l,
328
- canvasContext: D,
329
- transform: [O, 0, 0, O, 0, 0],
330
- viewport: A.getViewport({ scale: 1, rotation: I.rotation }),
331
- intent: "print",
332
- annotationMode: Fo.ENABLE_STORAGE,
333
- optionalContentConfigPromise: S,
334
- printAnnotationStorage: E
335
- };
336
- try {
337
- return A.render(R).promise;
338
- } catch (k) {
339
- throw k instanceof ko || console.error(k), k;
340
- }
341
- }, y = N(() => {
342
- const l = window.print;
343
- return new Promise((w) => {
344
- const _ = (S) => {
345
- setTimeout(() => {
346
- l.call(window), setTimeout(() => S(), 20);
347
- }, 0);
348
- };
349
- if (document.querySelector(".rp-print-zone")) {
350
- _(w);
351
- return;
352
- }
353
- const x = new MutationObserver(() => {
354
- document.querySelector(".rp-print-zone") && (_(w), x.disconnect());
355
- });
356
- x.observe(document.body, { childList: !0, subtree: !0 });
357
- });
358
- }, []), p = async (l) => {
359
- const w = document.createElement("img"), _ = document.createElement("div");
360
- return _.classList.add("rp-print-page"), await new Promise((I, x) => {
361
- l.toBlob((S) => {
362
- S ? (w.src = URL.createObjectURL(S), w.onload = () => {
363
- URL.revokeObjectURL(w.src), I();
364
- }, w.onerror = x) : x(new Error("Failed to create blob"));
365
- });
366
- }).catch(() => {
367
- }), _.appendChild(w), _;
368
- }, h = (l, w) => {
369
- const _ = document.createElement("div");
370
- _.classList.add("rp-print-zone");
371
- const I = document.createElement("style"), x = w.get(1);
372
- if (x) {
373
- const { width: S, height: L } = x == null ? void 0 : x.page.getViewport({ scale: 1 });
374
- I.innerHTML = `@page { size: ${S}px ${L}px }`;
375
- }
376
- return _.appendChild(I), _.append(...l), _;
377
- }, f = N(
378
- async (l) => {
379
- if (!t)
380
- return;
381
- P();
382
- const w = l && "visibleDefaultProgress" in l ? l : void 0;
383
- (w == null ? void 0 : w.visibleDefaultProgress) !== void 0 ? C(w.visibleDefaultProgress) : C(!0);
384
- const _ = document.createElement("canvas"), I = [];
385
- try {
386
- t.isPureXfa && console.warn("[rp] XFA Form is not supported at the moment.");
387
- const S = t.getOptionalContentConfig({ intent: "print" }), L = Promise.resolve(
388
- t.annotationStorage.print ?? void 0
389
- ), O = e.size;
390
- for (const [A, E] of e) {
391
- if (u.current) {
392
- P();
393
- return;
394
- }
395
- const R = E.page.getViewport({ scale: 1 });
396
- if (await b({
397
- scratchCanvas: _,
398
- pdfDocument: t,
399
- pageNumber: A,
400
- viewerPdfPage: R,
401
- printResolution: 150,
402
- optionalContentConfigPromise: S,
403
- printAnnotationStoragePromise: L
404
- }), u.current) {
405
- P();
406
- return;
407
- }
408
- const k = await p(_);
409
- I.push(k);
410
- const $ = parseFloat((I.length / O * 100).toFixed(2));
411
- r({
412
- loadedPages: A,
413
- totalPages: O,
414
- percentage: $
415
- });
416
- }
417
- if (u.current) {
418
- P();
419
- return;
420
- }
421
- const D = h(I, e);
422
- document.body.appendChild(D), document.documentElement.classList.add("rp-print-html-printing"), document.body.classList.add("rp-print-body-printing"), a(!0), await y();
423
- } catch (x) {
424
- d(!0), x instanceof Error && m(x);
425
- } finally {
426
- _.height = 0, _.width = 0;
427
- }
428
- },
429
- [t, e, u, P, h, y]
430
- );
431
- return z(() => {
432
- const l = () => {
433
- P(), v();
434
- };
435
- return window.addEventListener("afterprint", l, !0), () => {
436
- window.removeEventListener("afterprint", l, !0);
437
- };
438
- }, [v, P]), {
439
- print: f,
440
- cancel: T,
441
- progress: n,
442
- isComplete: o,
443
- isError: c,
444
- error: s,
445
- showDefaultProgress: g
446
- };
447
- }, yn = Ve({
448
- print: async () => {
449
- },
450
- cancel: () => {
451
- },
452
- setOnProgress: (t) => {
453
- },
454
- progress: {},
455
- setOnComplete: (t) => t(),
456
- setOnError: (t) => {
457
- try {
458
- const e = new Error("Print error occurred");
459
- t(e);
460
- } catch (e) {
461
- console.error("Error in setOnError callback:", e);
462
- }
463
- }
464
- }), vc = ({ children: t }) => {
465
- const [e, n] = H(null), [r, o] = H(null), { print: a, cancel: c, progress: d, isComplete: s, isError: m, error: g, showDefaultProgress: C } = qr(), u = N((y) => {
466
- y && typeof y == "function" && o(() => y);
467
- }, []), v = N(
468
- (y) => {
469
- g && y(g);
470
- },
471
- [g]
472
- ), P = N((y) => {
473
- n(() => y);
474
- }, []), T = N(() => {
475
- r && (r(), o(null));
476
- }, [r]);
477
- z(() => {
478
- s && r && T();
479
- }, [s, r, T]), z(() => {
480
- m && v((y) => {
481
- console.error(y);
482
- });
483
- }, [m]), z(() => {
484
- d && e && e(d);
485
- }, [d, e]);
486
- const b = F(
487
- () => ({
488
- print: a,
489
- cancel: c,
490
- setOnProgress: P,
491
- setOnComplete: u,
492
- setOnError: v,
493
- progress: d,
494
- showDefaultProgress: C
495
- }),
496
- [a, c, P, u, v, d, C]
497
- );
498
- return /* @__PURE__ */ i(yn.Provider, { value: b, children: t });
499
- }, it = () => {
500
- const t = Be(yn);
501
- if (!t)
502
- throw new Error("usePrintContext must be used within a PrintProvider");
503
- return t;
504
- }, Gr = () => {
505
- const [t, e] = H({}), { pages: n } = oe(), r = F(() => Object.keys(t).length, [t]), o = N(
506
- (c) => {
507
- if (!n.size)
508
- return;
509
- const d = c > n.size ? n.size : c, m = Array.from(n.values()).slice(0, d).map((g) => {
510
- const { thumbnailViewport: C, scale: u } = fr(g.page, g.defaultRotation);
511
- return {
512
- scale: u,
513
- page: g.page,
514
- loading: !0,
515
- viewport: C,
516
- defaultRotation: g.defaultRotation
517
- };
518
- }).reduce((g, C) => (g[C.page.pageNumber] = C, g), {});
519
- e(m);
520
- },
521
- [n]
522
- );
523
- z(() => {
524
- o(10);
525
- }, [o]);
526
- const a = N(
527
- (c) => {
528
- if (!n)
529
- return;
530
- const d = n.get(c);
531
- d && e((s) => ({
532
- ...s,
533
- [c]: {
534
- loading: !0,
535
- page: d.page,
536
- viewport: d.thumbnailViewport,
537
- scale: d.thumbnailScale,
538
- defaultRotation: d.defaultRotation
539
- }
540
- }));
541
- },
542
- [n]
543
- );
544
- return { thumbnailPages: t, addPage: a, addToPage: o, thumbnailLength: r };
545
- }, In = Ve({
546
- thumbnailPages: {},
547
- addPage: (t) => {
548
- },
549
- addToPage: (t) => {
550
- },
551
- thumbnailLength: 0,
552
- setActive: (t) => {
553
- },
554
- active: !1
555
- }), Sn = () => Be(In), wc = ({
556
- children: t,
557
- initialThumbnailsVisible: e
558
- }) => {
559
- const { thumbnailPages: n, addPage: r, addToPage: o, thumbnailLength: a } = Gr(), [c, d] = H(e);
560
- return /* @__PURE__ */ i(
561
- In.Provider,
562
- {
563
- value: { thumbnailPages: n, addPage: r, addToPage: o, thumbnailLength: a, active: c, setActive: d },
564
- children: t
565
- }
566
- );
567
- }, Ur = (t = {}, e = "") => {
568
- const [n, r] = H(e), [o, a] = H(!1), { pdf: c, pages: d } = oe(), { widths: s, heights: m } = je(), g = M(!n), { currentZoom: C } = tt(), [u, v] = H([]), { setFocusedPage: P } = ue(), { columnCount: T } = He(), { pageRotate: b } = ot(), [y, p] = H(0), { pageScrollElementRef: h, virtualScrollableElementRef: f } = nt(), { scrollMode: l } = ze(), { pagesRef: w } = be(), _ = M({}), I = M(0), x = F(() => y === 0 ? null : u[y - 1], [y, u]), S = F(() => u.length, [u]), L = N(
569
- (E) => {
570
- if (E === 0)
571
- return;
572
- const R = u[E - 1];
573
- if (!R || !d)
574
- return;
575
- const k = f || h;
576
- if (!k || !w)
577
- return;
578
- const $ = d.get(R.page);
579
- if (l === re.PAGE_SCROLLING && P(R.page), !$)
580
- return;
581
- let q = 0, G = 0;
582
- if (l === re.VERTICAL_SCROLLING) {
583
- const ee = R.page - 1, Y = T, ve = ee % Y, fe = Math.floor(ee / Y);
584
- q = We(m, fe), G = We(s, ve);
585
- }
586
- l === re.HORIZONTAL_SCROLLING && (G = s.slice(0, R.page - 1).reduce((ee, Y) => ee + Y, 0));
587
- const j = {
588
- height: m[R.page - 1],
589
- width: s[R.page - 1]
590
- }, V = b[R.page], { leftInPage: ie, topInPage: U } = hr(
591
- j,
592
- w,
593
- R.rect,
594
- C,
595
- V
596
- ), Q = G + ie, J = q + U, te = {
597
- left: Math.max(Q, 0),
598
- top: Math.max(J, 0)
599
- };
600
- k.scrollTo({
601
- ...te,
602
- behavior: "smooth"
603
- });
604
- },
605
- [
606
- d,
607
- P,
608
- s,
609
- m,
610
- l,
611
- f,
612
- h,
613
- w,
614
- u
615
- ]
616
- );
617
- z(() => {
618
- y && L(y);
619
- }, [y]);
620
- const O = N(() => {
621
- p((E) => {
622
- let R;
623
- return S ? E + 1 > S ? R = 1 : R = E + 1 : R = 0, I.current = R, R;
624
- }), I.current === 1 && L(I.current);
625
- }, [S, L]), D = N(() => {
626
- p((E) => {
627
- let R;
628
- return S ? E - 1 <= 0 ? R = S : R = E - 1 : R = 0, I.current = R, R;
629
- }), I.current === 1 && L(I.current);
630
- }, [S, L]), A = N(async (E) => {
631
- if (!E)
632
- return {};
633
- const R = E.numPages, k = {};
634
- for (let $ = 1; $ <= R; $++) {
635
- if (g.current)
636
- throw "close pop over";
637
- const q = await E.getPage($);
638
- k[$.toString()] = await q.getTextContent();
639
- }
640
- return k;
641
- }, []);
642
- return z(() => {
643
- if (!n) {
644
- g.current = !0, v([]), p(0);
645
- return;
646
- }
647
- g.current = !1, a(!0), v([]), p(0), A(c).then((E) => {
648
- _.current = E;
649
- const k = Object.keys(E).reduce(($, q) => {
650
- const G = Co(
651
- [n],
652
- E[q],
653
- Number(q) - 1,
654
- t
655
- ).map((j, V) => ({ ...j, page: Number(q), pageMatchIdx: V }));
656
- return [...$, ...G];
657
- }, []);
658
- v(k), p(k.length ? 1 : 0);
659
- }).catch(() => {
660
- v([]), p(0);
661
- }).finally(() => a(!1));
662
- }, [n, A, c, t]), {
663
- search: n,
664
- setSearch: r,
665
- loading: o,
666
- matches: u,
667
- totalMatches: S,
668
- currentMatchPosition: y,
669
- currentMatch: x,
670
- nextMatch: O,
671
- prevMatch: D,
672
- setCurrentMatchPosition: p
673
- };
674
- }, xn = Ve({
675
- search: "",
676
- setSearch: (t) => {
677
- },
678
- loading: !1,
679
- matches: [],
680
- totalMatches: 0,
681
- currentMatchPosition: 0,
682
- currentMatch: null,
683
- nextMatch: () => {
684
- },
685
- prevMatch: () => {
686
- },
687
- searchOptions: {},
688
- setSearchOptions: (t) => t,
689
- setCurrentMatchPosition: (t) => t
690
- }), _c = ({
691
- children: t,
692
- initialSearch: e
693
- }) => {
694
- const [n, r] = H({}), {
695
- loading: o,
696
- setSearch: a,
697
- totalMatches: c,
698
- currentMatchPosition: d,
699
- currentMatch: s,
700
- search: m,
701
- matches: g,
702
- nextMatch: C,
703
- prevMatch: u,
704
- setCurrentMatchPosition: v
705
- } = Ur(n, e);
706
- return /* @__PURE__ */ i(
707
- xn.Provider,
708
- {
709
- value: {
710
- searchOptions: n,
711
- setSearchOptions: r,
712
- loading: o,
713
- setSearch: a,
714
- totalMatches: c,
715
- currentMatchPosition: d,
716
- currentMatch: s,
717
- nextMatch: C,
718
- prevMatch: u,
719
- search: m,
720
- matches: g,
721
- setCurrentMatchPosition: v
722
- },
723
- children: t
724
- }
725
- );
726
- }, Ot = () => Be(xn), Rn = Ve(null), bc = ({ children: t }) => {
727
- const e = M(!1), [n, r] = H([]), o = N((s) => {
728
- r((m) => [...m, { id: s.page.pageNumber.toString(), data: s, priority: 0 }]);
729
- }, []), a = F(() => new Ro(o), [o]), { focusedPage: c } = ue(), d = N((s) => (e.current = !0, Lo(
730
- s.data.page,
731
- s.data.canvasElem,
732
- s.data.options
733
- ).promise.then(() => {
734
- s.data.canvasElem.hidden = !1;
735
- }).finally(() => {
736
- s.data.onLoaded && s.data.onLoaded();
737
- })), []);
738
- return z(() => {
739
- c && (a.changePagePriority(`^page-${c}`, 0), a.changePagePriority(`^thumbnail-${c}`, 1));
740
- }, [c]), z(() => {
741
- if (a.isEmpty() || e.current)
742
- return;
743
- const s = () => {
744
- const m = a.dequeue();
745
- m ? d(m).finally(() => {
746
- s();
747
- }) : (e.current = !1, r(a.peekAll()));
748
- };
749
- s();
750
- }, [a, d, n]), /* @__PURE__ */ i(Rn.Provider, { value: a, children: t });
751
- }, Ln = () => {
752
- const t = Be(Rn);
753
- if (!t)
754
- throw new Error("RenderQueue not found");
755
- return t;
756
- }, se = {
757
- "rp-pages": "_rp-pages_u7m2r_1",
758
- "rp-page-scrolling-wrapper": "_rp-page-scrolling-wrapper_u7m2r_6",
759
- "rp-pages-horizontal-scroll": "_rp-pages-horizontal-scroll_u7m2r_11",
760
- "rp-pages-container": "_rp-pages-container_u7m2r_15",
761
- "rp-viewer": "_rp-viewer_u7m2r_57",
762
- "rp-cursor-grab": "_rp-cursor-grab_u7m2r_62",
763
- "rp-cursor-grabbing": "_rp-cursor-grabbing_u7m2r_70",
764
- "rp-loader": "_rp-loader_u7m2r_78",
765
- "rp-not-supported": "_rp-not-supported_u7m2r_86",
766
- "rp-not-supported-content": "_rp-not-supported-content_u7m2r_102"
767
- }, ht = {
768
- "rp-page-wrapper": "_rp-page-wrapper_ii91u_1",
769
- "rp-page": "_rp-page_ii91u_1",
770
- "rp-loader-wrapper": "_rp-loader-wrapper_ii91u_15"
771
- }, Vr = (t) => {
772
- const { pageNumber: e, onLoaded: n, onLoading: r } = t, o = M(null), { pages: a } = oe(), { pageRotate: c } = ot(), d = M(), { currentZoom: s } = tt(), { interactiveForm: m } = yt(), g = Ln(), C = M(`page-${e}`);
773
- return z(() => {
774
- if (!a || s === 0)
775
- return;
776
- const u = a.get(e);
777
- if (o.current && u) {
778
- const v = o.current;
779
- v.hidden = !0;
780
- const P = d.current;
781
- P && P.cancel(), r && r(), g.enqueue(
782
- C.current,
783
- {
784
- page: u.page,
785
- canvasElem: v,
786
- options: {
787
- scale: s,
788
- rotate: c[e],
789
- renderForms: !0,
790
- interactiveForm: m
791
- },
792
- onLoaded: n
793
- },
794
- 3
795
- );
796
- }
797
- return () => {
798
- g.removeQueue(C.current);
799
- };
800
- }, [a, e, c, s, r, n, g, m]), /* @__PURE__ */ i("canvas", { "data-rp": `page-${e}-canvas`, ref: o });
801
- }, Br = "_selecting_1553j_14", jr = "_markedContent_1553j_37", we = {
802
- "rp-text-layer": "_rp-text-layer_1553j_1",
803
- selecting: Br,
804
- markedContent: jr,
805
- "rp-text-layer-text": "_rp-text-layer-text_1553j_61"
806
- }, Zr = (t) => {
807
- const { pageNumber: e } = t, { pages: n } = oe(), r = M(null), { matches: o, currentMatch: a } = Ot(), [c, d] = H(
808
- []
809
- ), s = M(), m = M(), g = M([]), C = F(() => o.filter((p) => p.pageIndex === e - 1), [o, e]), u = N(
810
- (p, h, f = !1) => {
811
- if (f && Po(p, h), !C.length) {
812
- g.current = [], d([]);
813
- return;
814
- }
815
- const l = yo(C, p, h);
816
- d(l);
817
- },
818
- [C]
819
- ), v = M(), P = M(!1), T = N(() => Array.from(document.querySelectorAll('[data-rp$="-textLayer"]')), []);
820
- z(() => ((() => {
821
- if (v.current)
822
- return;
823
- v.current = new AbortController();
824
- const { signal: h } = v.current, f = () => {
825
- T().forEach((w) => {
826
- const _ = w.querySelector(".endOfContent");
827
- _ && (w.appendChild(_), _.style.width = "", _.style.height = "", w.classList.remove(we.selecting));
828
- });
829
- };
830
- document.addEventListener(
831
- "pointerdown",
832
- () => {
833
- P.current = !0;
834
- },
835
- { signal: h }
836
- ), document.addEventListener(
837
- "pointerup",
838
- () => {
839
- P.current = !1, f();
840
- },
841
- { signal: h }
842
- ), window.addEventListener(
843
- "blur",
844
- () => {
845
- P.current = !1, f();
846
- },
847
- { signal: h }
848
- ), document.addEventListener(
849
- "keyup",
850
- () => {
851
- P.current || f();
852
- },
853
- { signal: h }
854
- );
855
- let l = null;
856
- document.addEventListener(
857
- "selectionchange",
858
- () => {
859
- var D, A;
860
- const w = document.getSelection();
861
- if (!w)
862
- return;
863
- if (w.rangeCount === 0) {
864
- f();
865
- return;
866
- }
867
- const _ = /* @__PURE__ */ new Set();
868
- for (let E = 0; E < w.rangeCount; E++) {
869
- const R = w.getRangeAt(E);
870
- T().forEach((k) => {
871
- R.intersectsNode(k) && !_.has(k) && _.add(k);
872
- });
873
- }
874
- T().forEach((E) => {
875
- if (_.has(E))
876
- E.classList.add(we.selecting);
877
- else {
878
- const R = E.querySelector(".endOfContent");
879
- R && (E.appendChild(R), R.style.width = "", R.style.height = "", E.classList.remove(we.selecting));
880
- }
881
- });
882
- const I = w.getRangeAt(0);
883
- let S = l && (I.compareBoundaryPoints(Range.END_TO_END, l) === 0 || I.compareBoundaryPoints(Range.START_TO_END, l) === 0) ? I.startContainer : I.endContainer;
884
- S.nodeType === Node.TEXT_NODE && (S = S.parentNode);
885
- const L = (D = S.parentElement) == null ? void 0 : D.closest(
886
- we["rp-text-layer"]
887
- ), O = L == null ? void 0 : L.querySelector(".endOfContent");
888
- O && L && (O.style.width = L.style.width, O.style.height = L.style.height, (A = S.parentElement) == null || A.insertBefore(O, S.nextSibling)), l = I.cloneRange();
889
- },
890
- { signal: h }
891
- );
892
- })(), () => {
893
- var h;
894
- (h = v.current) == null || h.abort(), v.current = void 0;
895
- }), [T]);
896
- const b = N(() => {
897
- r.current && r.current.classList.add(we.selecting);
898
- }, []), y = N(() => {
899
- r.current && r.current.classList.remove(we.selecting);
900
- }, []);
901
- return z(() => {
902
- if (g.current.forEach((f) => {
903
- f.classList.remove("selected");
904
- }), !c.length || !a || a.pageIndex !== e - 1)
905
- return;
906
- const p = C.findIndex(
907
- (f) => JSON.stringify(f) === JSON.stringify(a)
908
- );
909
- if (p === -1)
910
- return;
911
- const h = c.filter((f) => f.index === p);
912
- h.length && (g.current = h.map((f) => f.element), h.forEach((f) => {
913
- f.element.classList.add("selected");
914
- }));
915
- }, [a, c, C]), z(() => {
916
- const p = n.get(e);
917
- if (!p || !r.current)
918
- return;
919
- const h = r.current;
920
- return s.current && s.current.cancel(), p.page.getTextContent().then((f) => {
921
- const l = p.page.getViewport({ scale: 1 });
922
- return s.current = new zo.TextLayer({
923
- viewport: l,
924
- textContentSource: f,
925
- container: h
926
- }), m.current = f, h && (h.innerText = ""), s.current.render();
927
- }).then(() => {
928
- var _, I;
929
- [].slice.call(h.children).forEach((x) => {
930
- x.classList.add(we["rp-text-layer-text"]), x.setAttribute("data-rp", "rp-text-layer-text");
931
- });
932
- const l = (_ = s.current) == null ? void 0 : _.textDivs;
933
- l && m.current && u(m.current, l);
934
- const w = document.createElement("div");
935
- w.className = "endOfContent", (I = r.current) == null || I.appendChild(w);
936
- }).catch(() => {
937
- }), () => {
938
- var f;
939
- (f = s.current) == null || f.cancel();
940
- };
941
- }, [n, e]), z(() => {
942
- var f;
943
- [].slice.call(r.current.children).forEach((l) => {
944
- l.classList.add(we["rp-text-layer-text"]);
945
- });
946
- const h = (f = s.current) == null ? void 0 : f.textDivs;
947
- h && m.current && u(m.current, h, !0);
948
- }, [u]), /* @__PURE__ */ i(
949
- "div",
950
- {
951
- "data-rp-text-layer": !0,
952
- "data-rp": `page-${e}-textLayer`,
953
- className: we["rp-text-layer"],
954
- ref: r,
955
- onMouseDown: b,
956
- onMouseUp: y
957
- }
958
- );
959
- }, Kr = {
960
- "rp-annotation-layer": "_rp-annotation-layer_rwxfx_1"
961
- };
962
- let Xr = "https://unpkg.com/pdfjs-dist@4.4.168/web/images/";
963
- const Qr = (t) => {
964
- const { pageNumber: e } = t, n = M(null), { pages: r, pdf: o } = oe(), { interactiveForm: a } = yt(), c = M(), [d, s] = H(), { goToPage: m } = ue(), { scrollMode: g } = ze(), { print: C } = it(), { download: u } = Zn(), v = F(() => r.get(e), [r, e]), P = F(() => v == null ? void 0 : v.page.getViewport(), [v]);
965
- z(() => {
966
- c.current && (c.current.div.replaceChildren(), c.current = void 0);
967
- }, [o]), z(() => {
968
- v && v.page.getAnnotations().then((b) => {
969
- c.current = void 0, s(b), n.current && (n.current.innerText = "");
970
- });
971
- }, [v]);
972
- const T = N(
973
- (b) => {
974
- !d || !o || (Yo(n.current), Jo(b, o, d).then((y) => {
975
- var p, h;
976
- ((p = y == null ? void 0 : y.data) == null ? void 0 : p.action) === "Print" ? C() : ((h = y == null ? void 0 : y.data) == null ? void 0 : h.action) === "SaveAs" && u();
977
- }));
978
- },
979
- [o, d, g, C, u]
980
- );
981
- return z(() => {
982
- if (!v || !d)
983
- return;
984
- const b = v.page.getViewport();
985
- if (c.current) {
986
- c.current.update({
987
- viewport: b.clone({ dontFlip: !0 })
988
- });
989
- return;
990
- }
991
- const y = /* @__PURE__ */ new Map([]);
992
- for (const f of d) {
993
- const { annotationType: l } = f;
994
- switch (l) {
995
- case fo.Widget:
996
- er(f, b, y);
997
- break;
998
- }
999
- }
1000
- const p = new AbortController();
1001
- return (async () => {
1002
- var w;
1003
- c.current && (c.current.div.replaceChildren(), c.current = void 0), n.current && (n.current.innerText = ""), c.current = new Wo({
1004
- div: n.current,
1005
- accessibilityManager: void 0,
1006
- annotationCanvasMap: void 0,
1007
- annotationEditorUIManager: void 0,
1008
- structTreeLayer: null,
1009
- page: v.page,
1010
- viewport: b.clone({ dontFlip: !0 }),
1011
- commentManager: void 0,
1012
- linkService: new Ut(o, m),
1013
- annotationStorage: o == null ? void 0 : o.annotationStorage
1014
- }), n.current && Vt(n.current, T);
1015
- const f = await (o == null ? void 0 : o.hasJSActions()), l = await (o == null ? void 0 : o.getFieldObjects());
1016
- if (p.signal.aborted)
1017
- throw "abort";
1018
- return (w = c.current) == null ? void 0 : w.render({
1019
- annotations: d,
1020
- annotationStorage: o == null ? void 0 : o.annotationStorage,
1021
- hasJSActions: f,
1022
- fieldObjects: l,
1023
- div: n.current,
1024
- viewport: b.clone({ dontFlip: !0 }),
1025
- page: v.page,
1026
- imageResourcesPath: Xr,
1027
- renderForms: a ?? !0,
1028
- linkService: new Ut(o, m),
1029
- downloadManager: null,
1030
- enableScripting: !1
1031
- });
1032
- })().then(() => {
1033
- n.current && tr(n.current, T);
1034
- }).catch((f) => {
1035
- if (f !== "abort")
1036
- throw f;
1037
- }).finally(() => {
1038
- c.current = void 0;
1039
- }), () => {
1040
- p.abort("clear"), n.current && Vt(n.current, T);
1041
- };
1042
- }, [o, d, T, m]), /* @__PURE__ */ i(
1043
- "div",
1044
- {
1045
- "data-rp": `page-${e}-annotationLayer`,
1046
- style: { width: `${P == null ? void 0 : P.width}px`, height: `${P == null ? void 0 : P.height}px` },
1047
- className: Kr["rp-annotation-layer"],
1048
- ref: n
1049
- }
1050
- );
1051
- }, Yr = {
1052
- "rp-text-highlight": "_rp-text-highlight_jdkf8_1"
1053
- }, Jr = ({ pageNumber: t, viewport: e }) => {
1054
- const [n, r] = H(), { pages: o } = oe(), { highlightKeywords: a } = So(), c = !0, d = M(null), [s, m] = H(null), [g, C] = H([]);
1055
- z(() => {
1056
- d.current && m(d.current.parentElement);
1057
- }, [d]), z(() => {
1058
- (async () => {
1059
- const h = o.get(t);
1060
- if (!h || !d.current)
1061
- return;
1062
- const f = await h.page.getTextContent();
1063
- r(f);
1064
- })();
1065
- }, [o, t]);
1066
- const u = F(() => a ? a.map((p) => {
1067
- var h, f;
1068
- return {
1069
- ...nr(p.keyword, (h = p.options) == null ? void 0 : h.matchCase, (f = p.options) == null ? void 0 : f.wholeWords),
1070
- color: p.highlightColor
1071
- };
1072
- }) : [], [a]);
1073
- function v(p, h) {
1074
- if (!p)
1075
- return;
1076
- const f = `[data-rp="page-${h}-textLayer"]`;
1077
- return new Promise((l) => {
1078
- const w = p.querySelector(f);
1079
- if (w) {
1080
- l(w);
1081
- return;
1082
- }
1083
- new MutationObserver((I, x) => {
1084
- const S = p.querySelector(f);
1085
- S && (l(S), x.disconnect());
1086
- }).observe(p, { childList: !0, subtree: !0 });
1087
- });
1088
- }
1089
- function P(p) {
1090
- return new Promise((h) => {
1091
- const f = p.querySelectorAll(
1092
- '[data-rp="rp-text-layer-text"]'
1093
- );
1094
- if (f.length) {
1095
- h(Array.from(f));
1096
- return;
1097
- }
1098
- new MutationObserver((w, _) => {
1099
- const I = p.querySelectorAll(
1100
- ".rp-text-layer-text"
1101
- );
1102
- I.length && (h(Array.from(I)), _.disconnect());
1103
- }).observe(p, { childList: !0, subtree: !0 });
1104
- });
1105
- }
1106
- const T = (p, h, f, l) => {
1107
- var G;
1108
- const w = document.createRange(), _ = f.firstChild;
1109
- if (!_ || _.nodeType !== Node.TEXT_NODE)
1110
- return null;
1111
- const I = ((G = _.textContent) == null ? void 0 : G.length) ?? 0, x = l[0].charIdxInSpan, S = l.length === 1 ? x : l[l.length - 1].charIdxInSpan;
1112
- if (x > I || S + 1 > I)
1113
- return null;
1114
- w.setStart(_, x), w.setEnd(_, S + 1);
1115
- const L = document.createElement("span");
1116
- L.style.width = "auto", w.surroundContents(L);
1117
- const O = L.getBoundingClientRect(), D = p.getBoundingClientRect(), A = D.height, E = D.width, R = 100 * (O.left - D.left) / E, k = 100 * (O.top - D.top) / A, $ = 100 * O.height / A, q = 100 * O.width / E;
1118
- return rr(L), {
1119
- keywordStr: h,
1120
- left: R,
1121
- top: k,
1122
- height: $,
1123
- width: q,
1124
- pageHeight: A,
1125
- pageWidth: E
1126
- };
1127
- };
1128
- async function b(p, h) {
1129
- const f = await v(s, p);
1130
- if (!f)
1131
- return;
1132
- const l = await P(f);
1133
- if (l.length) {
1134
- const w = l.map((I) => I.tagName === "BR" ? " " : I.textContent).reduce(
1135
- (I, x, S) => I.concat(
1136
- x.split("").map((L, O) => ({
1137
- char: L,
1138
- charIdxInSpan: O,
1139
- spanIdx: S
1140
- }))
1141
- ),
1142
- [
1143
- {
1144
- char: "",
1145
- charIdxInSpan: 0,
1146
- spanIdx: 0
1147
- }
1148
- ]
1149
- ).slice(1), _ = y(f, h, l, w);
1150
- C(_);
1151
- }
1152
- }
1153
- const y = (p, h, f, l) => {
1154
- const w = h.length;
1155
- if (!l.length || !w)
1156
- return [];
1157
- const _ = [], I = l.map((x) => x.char).join("");
1158
- return u.forEach((x) => {
1159
- const { keyword: S, regExp: L, wholeWords: O, color: D } = x, A = S;
1160
- if (!A.trim())
1161
- return;
1162
- const E = L.flags.indexOf("g") === -1 ? new RegExp(L, `${L.flags}g`) : L;
1163
- let R;
1164
- const k = [];
1165
- for (; (R = E.exec(I)) !== null; )
1166
- O && !Io(I, R.index, R[0].length) || k.push({
1167
- keyword: E,
1168
- startIndex: R.index,
1169
- endIndex: E.lastIndex
1170
- });
1171
- const $ = k.map((q) => ({
1172
- keyword: q.keyword,
1173
- indexes: l.slice(q.startIndex, q.endIndex),
1174
- color: D
1175
- }));
1176
- for (const q of $) {
1177
- const G = q.indexes.reduce(
1178
- (j, V) => (j[V.spanIdx] = (j[V.spanIdx] || []).concat([V]), j),
1179
- {}
1180
- );
1181
- for (const j of Object.values(G))
1182
- if (j.length !== 1 || j[0].char.trim() !== "") {
1183
- const V = j, ie = f[V[0].spanIdx], U = T(
1184
- p,
1185
- A,
1186
- ie,
1187
- V
1188
- );
1189
- if (U) {
1190
- const { left: Q, top: J } = U;
1191
- if (_.find((ee) => ee.left === Q && ee.top === J))
1192
- continue;
1193
- _.push({ ...U, highlightColor: q.color });
1194
- }
1195
- }
1196
- }
1197
- }), _.sort(or), _;
1198
- };
1199
- return z(() => {
1200
- (async () => {
1201
- if (!a || a.length === 0) {
1202
- C([]);
1203
- return;
1204
- }
1205
- try {
1206
- await b(t, a);
1207
- } catch (h) {
1208
- console.error(h);
1209
- }
1210
- })();
1211
- }, [c, a, t, n, e]), /* @__PURE__ */ i(pe, { children: /* @__PURE__ */ i("div", { ref: d, "data-rp": `page-${t}-textHighlightLayer`, children: g.map((p, h) => /* @__PURE__ */ i(
1212
- "div",
1213
- {
1214
- className: Yr["rp-text-highlight"],
1215
- style: {
1216
- top: `${p.top}%`,
1217
- left: `${p.left}%`,
1218
- width: `${p.width}%`,
1219
- height: `${p.height}%`,
1220
- backgroundColor: p.highlightColor
1221
- }
1222
- },
1223
- h
1224
- )) }) });
1225
- }, Dt = rt((t, e) => {
1226
- const { pageNumber: n, style: r, ...o } = t, { pages: a } = oe(), { pageRotate: c } = ot(), { textLayer: d } = _o(), { currentZoom: s } = tt(), { LoaderImageComponent: m } = It(), g = M(a.get(n)), [C, u] = H(!1), v = M(null), [P, T] = H({
1227
- width: 0,
1228
- height: 0
1229
- });
1230
- pn(e, () => v.current);
1231
- const b = F(() => g.current ? c[n] : 0, [n, c]);
1232
- z(() => {
1233
- if (a && (g.current = a.get(n), g.current)) {
1234
- const f = g.current.page.getViewport({
1235
- scale: s,
1236
- rotation: b
1237
- });
1238
- T(f);
1239
- }
1240
- }, [a, n, b, s]);
1241
- const y = F(() => {
1242
- switch (b) {
1243
- case 90:
1244
- return `${P.width / 2}px ${P.width / 2}px`;
1245
- case -90:
1246
- case 270:
1247
- return `${P.height / 2}px ${P.height / 2}px`;
1248
- default:
1249
- return "center";
1250
- }
1251
- }, [b, P]), p = N(() => {
1252
- u(!0);
1253
- }, []), h = N(() => {
1254
- u(!1);
1255
- }, []);
1256
- return /* @__PURE__ */ i(
1257
- "div",
1258
- {
1259
- ref: v,
1260
- id: `page-${n}`,
1261
- "data-rp": `page-${n}`,
1262
- ...o,
1263
- style: {
1264
- ...r,
1265
- "--rp-rotate": `${b}deg`,
1266
- "--rp-page-rotate-translate": `${y}`,
1267
- "--user-unit": P.userUnit || 1,
1268
- "--scale-factor": s,
1269
- "--total-scale-factor": "calc(var(--scale-factor) * var(--user-unit))"
1270
- },
1271
- className: ht["rp-page-wrapper"],
1272
- children: /* @__PURE__ */ W(
1273
- "div",
1274
- {
1275
- style: {
1276
- width: `${P.width}px`,
1277
- height: `${P.height}px`
1278
- },
1279
- className: ht["rp-page"],
1280
- children: [
1281
- /* @__PURE__ */ i(Vr, { onLoading: p, onLoaded: h, pageNumber: n }),
1282
- C && m && /* @__PURE__ */ i("div", { className: ht["rp-loader-wrapper"], children: /* @__PURE__ */ i(m, {}) }),
1283
- /* @__PURE__ */ i(ir, { pageNumber: n }),
1284
- d && /* @__PURE__ */ i(Zr, { pageNumber: n }),
1285
- /* @__PURE__ */ i(Jr, { pageNumber: n, viewport: P }),
1286
- /* @__PURE__ */ i(Qr, { pageNumber: n })
1287
- ]
1288
- }
1289
- )
1290
- }
1291
- );
1292
- });
1293
- function bt() {
1294
- return bt = Object.assign ? Object.assign.bind() : function(t) {
1295
- for (var e = 1; e < arguments.length; e++) {
1296
- var n = arguments[e];
1297
- for (var r in n)
1298
- ({}).hasOwnProperty.call(n, r) && (t[r] = n[r]);
1299
- }
1300
- return t;
1301
- }, bt.apply(null, arguments);
1302
- }
1303
- function Zt(t) {
1304
- if (t === void 0)
1305
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1306
- return t;
1307
- }
1308
- function Tt(t, e) {
1309
- return Tt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, r) {
1310
- return n.__proto__ = r, n;
1311
- }, Tt(t, e);
1312
- }
1313
- function ei(t, e) {
1314
- t.prototype = Object.create(e.prototype), t.prototype.constructor = t, Tt(t, e);
1315
- }
1316
- var Kt = Number.isNaN || function(e) {
1317
- return typeof e == "number" && e !== e;
1318
- };
1319
- function ti(t, e) {
1320
- return !!(t === e || Kt(t) && Kt(e));
1321
- }
1322
- function ni(t, e) {
1323
- if (t.length !== e.length)
1324
- return !1;
1325
- for (var n = 0; n < t.length; n++)
1326
- if (!ti(t[n], e[n]))
1327
- return !1;
1328
- return !0;
1329
- }
1330
- function ft(t, e) {
1331
- e === void 0 && (e = ni);
1332
- var n, r = [], o, a = !1;
1333
- function c() {
1334
- for (var d = [], s = 0; s < arguments.length; s++)
1335
- d[s] = arguments[s];
1336
- return a && n === this && e(d, r) || (o = t.apply(this, d), a = !0, n = this, r = d), o;
1337
- }
1338
- return c;
1339
- }
1340
- function Xt(t, e) {
1341
- if (t == null)
1342
- return {};
1343
- var n = {};
1344
- for (var r in t)
1345
- if ({}.hasOwnProperty.call(t, r)) {
1346
- if (e.indexOf(r) !== -1)
1347
- continue;
1348
- n[r] = t[r];
1349
- }
1350
- return n;
1351
- }
1352
- var oi = typeof performance == "object" && typeof performance.now == "function", Qt = oi ? function() {
1353
- return performance.now();
1354
- } : function() {
1355
- return Date.now();
1356
- };
1357
- function Yt(t) {
1358
- cancelAnimationFrame(t.id);
1359
- }
1360
- function ri(t, e) {
1361
- var n = Qt();
1362
- function r() {
1363
- Qt() - n >= e ? t.call(null) : o.id = requestAnimationFrame(r);
1364
- }
1365
- var o = {
1366
- id: requestAnimationFrame(r)
1367
- };
1368
- return o;
1369
- }
1370
- var mt = -1;
1371
- function ii(t) {
1372
- if (t === void 0 && (t = !1), mt === -1 || t) {
1373
- var e = document.createElement("div"), n = e.style;
1374
- n.width = "50px", n.height = "50px", n.overflow = "scroll", document.body.appendChild(e), mt = e.offsetWidth - e.clientWidth, document.body.removeChild(e);
1375
- }
1376
- return mt;
1377
- }
1378
- var Ae = null;
1379
- function Jt(t) {
1380
- if (t === void 0 && (t = !1), Ae === null || t) {
1381
- var e = document.createElement("div"), n = e.style;
1382
- n.width = "50px", n.height = "50px", n.overflow = "scroll", n.direction = "rtl";
1383
- var r = document.createElement("div"), o = r.style;
1384
- return o.width = "100px", o.height = "100px", e.appendChild(r), document.body.appendChild(e), e.scrollLeft > 0 ? Ae = "positive-descending" : (e.scrollLeft = 1, e.scrollLeft === 0 ? Ae = "negative" : Ae = "positive-ascending"), document.body.removeChild(e), Ae;
1385
- }
1386
- return Ae;
1387
- }
1388
- var ai = 150, si = function(e) {
1389
- var n = e.columnIndex;
1390
- e.data;
1391
- var r = e.rowIndex;
1392
- return r + ":" + n;
1393
- }, Xe = null, Qe = null, Ye = null;
1394
- process.env.NODE_ENV !== "production" && typeof window < "u" && typeof window.WeakSet < "u" && (Xe = /* @__PURE__ */ new WeakSet(), Qe = /* @__PURE__ */ new WeakSet(), Ye = /* @__PURE__ */ new WeakSet());
1395
- function ci(t) {
1396
- var e, n = t.getColumnOffset, r = t.getColumnStartIndexForOffset, o = t.getColumnStopIndexForStartIndex, a = t.getColumnWidth, c = t.getEstimatedTotalHeight, d = t.getEstimatedTotalWidth, s = t.getOffsetForColumnAndAlignment, m = t.getOffsetForRowAndAlignment, g = t.getRowHeight, C = t.getRowOffset, u = t.getRowStartIndexForOffset, v = t.getRowStopIndexForStartIndex, P = t.initInstanceProps, T = t.shouldResetStyleCacheOnItemSizeChange, b = t.validateProps;
1397
- return e = /* @__PURE__ */ function(y) {
1398
- ei(p, y);
1399
- function p(f) {
1400
- var l;
1401
- return l = y.call(this, f) || this, l._instanceProps = P(l.props, Zt(l)), l._resetIsScrollingTimeoutId = null, l._outerRef = void 0, l.state = {
1402
- instance: Zt(l),
1403
- isScrolling: !1,
1404
- horizontalScrollDirection: "forward",
1405
- scrollLeft: typeof l.props.initialScrollLeft == "number" ? l.props.initialScrollLeft : 0,
1406
- scrollTop: typeof l.props.initialScrollTop == "number" ? l.props.initialScrollTop : 0,
1407
- scrollUpdateWasRequested: !1,
1408
- verticalScrollDirection: "forward"
1409
- }, l._callOnItemsRendered = void 0, l._callOnItemsRendered = ft(function(w, _, I, x, S, L, O, D) {
1410
- return l.props.onItemsRendered({
1411
- overscanColumnStartIndex: w,
1412
- overscanColumnStopIndex: _,
1413
- overscanRowStartIndex: I,
1414
- overscanRowStopIndex: x,
1415
- visibleColumnStartIndex: S,
1416
- visibleColumnStopIndex: L,
1417
- visibleRowStartIndex: O,
1418
- visibleRowStopIndex: D
1419
- });
1420
- }), l._callOnScroll = void 0, l._callOnScroll = ft(function(w, _, I, x, S) {
1421
- return l.props.onScroll({
1422
- horizontalScrollDirection: I,
1423
- scrollLeft: w,
1424
- scrollTop: _,
1425
- verticalScrollDirection: x,
1426
- scrollUpdateWasRequested: S
1427
- });
1428
- }), l._getItemStyle = void 0, l._getItemStyle = function(w, _) {
1429
- var I = l.props, x = I.columnWidth, S = I.direction, L = I.rowHeight, O = l._getItemStyleCache(T && x, T && S, T && L), D = w + ":" + _, A;
1430
- if (O.hasOwnProperty(D))
1431
- A = O[D];
1432
- else {
1433
- var E = n(l.props, _, l._instanceProps), R = S === "rtl";
1434
- O[D] = A = {
1435
- position: "absolute",
1436
- left: R ? void 0 : E,
1437
- right: R ? E : void 0,
1438
- top: C(l.props, w, l._instanceProps),
1439
- height: g(l.props, w, l._instanceProps),
1440
- width: a(l.props, _, l._instanceProps)
1441
- };
1442
- }
1443
- return A;
1444
- }, l._getItemStyleCache = void 0, l._getItemStyleCache = ft(function(w, _, I) {
1445
- return {};
1446
- }), l._onScroll = function(w) {
1447
- var _ = w.currentTarget, I = _.clientHeight, x = _.clientWidth, S = _.scrollLeft, L = _.scrollTop, O = _.scrollHeight, D = _.scrollWidth;
1448
- l.setState(function(A) {
1449
- if (A.scrollLeft === S && A.scrollTop === L)
1450
- return null;
1451
- var E = l.props.direction, R = S;
1452
- if (E === "rtl")
1453
- switch (Jt()) {
1454
- case "negative":
1455
- R = -S;
1456
- break;
1457
- case "positive-descending":
1458
- R = D - x - S;
1459
- break;
1460
- }
1461
- R = Math.max(0, Math.min(R, D - x));
1462
- var k = Math.max(0, Math.min(L, O - I));
1463
- return {
1464
- isScrolling: !0,
1465
- horizontalScrollDirection: A.scrollLeft < S ? "forward" : "backward",
1466
- scrollLeft: R,
1467
- scrollTop: k,
1468
- verticalScrollDirection: A.scrollTop < L ? "forward" : "backward",
1469
- scrollUpdateWasRequested: !1
1470
- };
1471
- }, l._resetIsScrollingDebounced);
1472
- }, l._outerRefSetter = function(w) {
1473
- var _ = l.props.outerRef;
1474
- l._outerRef = w, typeof _ == "function" ? _(w) : _ != null && typeof _ == "object" && _.hasOwnProperty("current") && (_.current = w);
1475
- }, l._resetIsScrollingDebounced = function() {
1476
- l._resetIsScrollingTimeoutId !== null && Yt(l._resetIsScrollingTimeoutId), l._resetIsScrollingTimeoutId = ri(l._resetIsScrolling, ai);
1477
- }, l._resetIsScrolling = function() {
1478
- l._resetIsScrollingTimeoutId = null, l.setState({
1479
- isScrolling: !1
1480
- }, function() {
1481
- l._getItemStyleCache(-1);
1482
- });
1483
- }, l;
1484
- }
1485
- p.getDerivedStateFromProps = function(l, w) {
1486
- return li(l, w), b(l), null;
1487
- };
1488
- var h = p.prototype;
1489
- return h.scrollTo = function(l) {
1490
- var w = l.scrollLeft, _ = l.scrollTop;
1491
- w !== void 0 && (w = Math.max(0, w)), _ !== void 0 && (_ = Math.max(0, _)), this.setState(function(I) {
1492
- return w === void 0 && (w = I.scrollLeft), _ === void 0 && (_ = I.scrollTop), I.scrollLeft === w && I.scrollTop === _ ? null : {
1493
- horizontalScrollDirection: I.scrollLeft < w ? "forward" : "backward",
1494
- scrollLeft: w,
1495
- scrollTop: _,
1496
- scrollUpdateWasRequested: !0,
1497
- verticalScrollDirection: I.scrollTop < _ ? "forward" : "backward"
1498
- };
1499
- }, this._resetIsScrollingDebounced);
1500
- }, h.scrollToItem = function(l) {
1501
- var w = l.align, _ = w === void 0 ? "auto" : w, I = l.columnIndex, x = l.rowIndex, S = this.props, L = S.columnCount, O = S.height, D = S.rowCount, A = S.width, E = this.state, R = E.scrollLeft, k = E.scrollTop, $ = ii();
1502
- I !== void 0 && (I = Math.max(0, Math.min(I, L - 1))), x !== void 0 && (x = Math.max(0, Math.min(x, D - 1)));
1503
- var q = c(this.props, this._instanceProps), G = d(this.props, this._instanceProps), j = G > A ? $ : 0, V = q > O ? $ : 0;
1504
- this.scrollTo({
1505
- scrollLeft: I !== void 0 ? s(this.props, I, _, R, this._instanceProps, V) : R,
1506
- scrollTop: x !== void 0 ? m(this.props, x, _, k, this._instanceProps, j) : k
1507
- });
1508
- }, h.componentDidMount = function() {
1509
- var l = this.props, w = l.initialScrollLeft, _ = l.initialScrollTop;
1510
- if (this._outerRef != null) {
1511
- var I = this._outerRef;
1512
- typeof w == "number" && (I.scrollLeft = w), typeof _ == "number" && (I.scrollTop = _);
1513
- }
1514
- this._callPropsCallbacks();
1515
- }, h.componentDidUpdate = function() {
1516
- var l = this.props.direction, w = this.state, _ = w.scrollLeft, I = w.scrollTop, x = w.scrollUpdateWasRequested;
1517
- if (x && this._outerRef != null) {
1518
- var S = this._outerRef;
1519
- if (l === "rtl")
1520
- switch (Jt()) {
1521
- case "negative":
1522
- S.scrollLeft = -_;
1523
- break;
1524
- case "positive-ascending":
1525
- S.scrollLeft = _;
1526
- break;
1527
- default:
1528
- var L = S.clientWidth, O = S.scrollWidth;
1529
- S.scrollLeft = O - L - _;
1530
- break;
1531
- }
1532
- else
1533
- S.scrollLeft = Math.max(0, _);
1534
- S.scrollTop = Math.max(0, I);
1535
- }
1536
- this._callPropsCallbacks();
1537
- }, h.componentWillUnmount = function() {
1538
- this._resetIsScrollingTimeoutId !== null && Yt(this._resetIsScrollingTimeoutId);
1539
- }, h.render = function() {
1540
- var l = this.props, w = l.children, _ = l.className, I = l.columnCount, x = l.direction, S = l.height, L = l.innerRef, O = l.innerElementType, D = l.innerTagName, A = l.itemData, E = l.itemKey, R = E === void 0 ? si : E, k = l.outerElementType, $ = l.outerTagName, q = l.rowCount, G = l.style, j = l.useIsScrolling, V = l.width, ie = this.state.isScrolling, U = this._getHorizontalRangeToRender(), Q = U[0], J = U[1], te = this._getVerticalRangeToRender(), ee = te[0], Y = te[1], ve = [];
1541
- if (I > 0 && q)
1542
- for (var fe = ee; fe <= Y; fe++)
1543
- for (var Se = Q; Se <= J; Se++)
1544
- ve.push(Ke(w, {
1545
- columnIndex: Se,
1546
- data: A,
1547
- isScrolling: j ? ie : void 0,
1548
- key: R({
1549
- columnIndex: Se,
1550
- data: A,
1551
- rowIndex: fe
1552
- }),
1553
- rowIndex: fe,
1554
- style: this._getItemStyle(fe, Se)
1555
- }));
1556
- var xe = c(this.props, this._instanceProps), st = d(this.props, this._instanceProps);
1557
- return Ke(k || $ || "div", {
1558
- className: _,
1559
- onScroll: this._onScroll,
1560
- ref: this._outerRefSetter,
1561
- style: bt({
1562
- position: "relative",
1563
- height: S,
1564
- width: V,
1565
- overflow: "auto",
1566
- WebkitOverflowScrolling: "touch",
1567
- willChange: "transform",
1568
- direction: x
1569
- }, G)
1570
- }, Ke(O || D || "div", {
1571
- children: ve,
1572
- ref: L,
1573
- style: {
1574
- height: xe,
1575
- pointerEvents: ie ? "none" : void 0,
1576
- width: st
1577
- }
1578
- }));
1579
- }, h._callPropsCallbacks = function() {
1580
- var l = this.props, w = l.columnCount, _ = l.onItemsRendered, I = l.onScroll, x = l.rowCount;
1581
- if (typeof _ == "function" && w > 0 && x > 0) {
1582
- var S = this._getHorizontalRangeToRender(), L = S[0], O = S[1], D = S[2], A = S[3], E = this._getVerticalRangeToRender(), R = E[0], k = E[1], $ = E[2], q = E[3];
1583
- this._callOnItemsRendered(L, O, R, k, D, A, $, q);
1584
- }
1585
- if (typeof I == "function") {
1586
- var G = this.state, j = G.horizontalScrollDirection, V = G.scrollLeft, ie = G.scrollTop, U = G.scrollUpdateWasRequested, Q = G.verticalScrollDirection;
1587
- this._callOnScroll(V, ie, j, Q, U);
1588
- }
1589
- }, h._getHorizontalRangeToRender = function() {
1590
- var l = this.props, w = l.columnCount, _ = l.overscanColumnCount, I = l.overscanColumnsCount, x = l.overscanCount, S = l.rowCount, L = this.state, O = L.horizontalScrollDirection, D = L.isScrolling, A = L.scrollLeft, E = _ || I || x || 1;
1591
- if (w === 0 || S === 0)
1592
- return [0, 0, 0, 0];
1593
- var R = r(this.props, A, this._instanceProps), k = o(this.props, R, A, this._instanceProps), $ = !D || O === "backward" ? Math.max(1, E) : 1, q = !D || O === "forward" ? Math.max(1, E) : 1;
1594
- return [Math.max(0, R - $), Math.max(0, Math.min(w - 1, k + q)), R, k];
1595
- }, h._getVerticalRangeToRender = function() {
1596
- var l = this.props, w = l.columnCount, _ = l.overscanCount, I = l.overscanRowCount, x = l.overscanRowsCount, S = l.rowCount, L = this.state, O = L.isScrolling, D = L.verticalScrollDirection, A = L.scrollTop, E = I || x || _ || 1;
1597
- if (w === 0 || S === 0)
1598
- return [0, 0, 0, 0];
1599
- var R = u(this.props, A, this._instanceProps), k = v(this.props, R, A, this._instanceProps), $ = !O || D === "backward" ? Math.max(1, E) : 1, q = !O || D === "forward" ? Math.max(1, E) : 1;
1600
- return [Math.max(0, R - $), Math.max(0, Math.min(S - 1, k + q)), R, k];
1601
- }, p;
1602
- }(lo), e.defaultProps = {
1603
- direction: "ltr",
1604
- itemData: void 0,
1605
- useIsScrolling: !1
1606
- }, e;
1607
- }
1608
- var li = function(e, n) {
1609
- var r = e.children, o = e.direction, a = e.height, c = e.innerTagName, d = e.outerTagName, s = e.overscanColumnsCount, m = e.overscanCount, g = e.overscanRowsCount, C = e.width, u = n.instance;
1610
- if (process.env.NODE_ENV !== "production") {
1611
- if (typeof m == "number" && Xe && !Xe.has(u) && (Xe.add(u), console.warn("The overscanCount prop has been deprecated. Please use the overscanColumnCount and overscanRowCount props instead.")), (typeof s == "number" || typeof g == "number") && Qe && !Qe.has(u) && (Qe.add(u), console.warn("The overscanColumnsCount and overscanRowsCount props have been deprecated. Please use the overscanColumnCount and overscanRowCount props instead.")), (c != null || d != null) && Ye && !Ye.has(u) && (Ye.add(u), console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead.")), r == null)
1612
- throw Error('An invalid "children" prop has been specified. Value should be a React component. ' + ('"' + (r === null ? "null" : typeof r) + '" was specified.'));
1613
- switch (o) {
1614
- case "ltr":
1615
- case "rtl":
1616
- break;
1617
- default:
1618
- throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". ' + ('"' + o + '" was specified.'));
1619
- }
1620
- if (typeof C != "number")
1621
- throw Error('An invalid "width" prop has been specified. Grids must specify a number for width. ' + ('"' + (C === null ? "null" : typeof C) + '" was specified.'));
1622
- if (typeof a != "number")
1623
- throw Error('An invalid "height" prop has been specified. Grids must specify a number for height. ' + ('"' + (a === null ? "null" : typeof a) + '" was specified.'));
1624
- }
1625
- }, en = 50, En = function(e, n) {
1626
- var r = e.rowCount, o = n.rowMetadataMap, a = n.estimatedRowHeight, c = n.lastMeasuredRowIndex, d = 0;
1627
- if (c >= r && (c = r - 1), c >= 0) {
1628
- var s = o[c];
1629
- d = s.offset + s.size;
1630
- }
1631
- var m = r - c - 1, g = m * a;
1632
- return d + g;
1633
- }, Nn = function(e, n) {
1634
- var r = e.columnCount, o = n.columnMetadataMap, a = n.estimatedColumnWidth, c = n.lastMeasuredColumnIndex, d = 0;
1635
- if (c >= r && (c = r - 1), c >= 0) {
1636
- var s = o[c];
1637
- d = s.offset + s.size;
1638
- }
1639
- var m = r - c - 1, g = m * a;
1640
- return d + g;
1641
- }, _e = function(e, n, r, o) {
1642
- var a, c, d;
1643
- if (e === "column" ? (a = o.columnMetadataMap, c = n.columnWidth, d = o.lastMeasuredColumnIndex) : (a = o.rowMetadataMap, c = n.rowHeight, d = o.lastMeasuredRowIndex), r > d) {
1644
- var s = 0;
1645
- if (d >= 0) {
1646
- var m = a[d];
1647
- s = m.offset + m.size;
1648
- }
1649
- for (var g = d + 1; g <= r; g++) {
1650
- var C = c(g);
1651
- a[g] = {
1652
- offset: s,
1653
- size: C
1654
- }, s += C;
1655
- }
1656
- e === "column" ? o.lastMeasuredColumnIndex = r : o.lastMeasuredRowIndex = r;
1657
- }
1658
- return a[r];
1659
- }, tn = function(e, n, r, o) {
1660
- var a, c;
1661
- e === "column" ? (a = r.columnMetadataMap, c = r.lastMeasuredColumnIndex) : (a = r.rowMetadataMap, c = r.lastMeasuredRowIndex);
1662
- var d = c > 0 ? a[c].offset : 0;
1663
- return d >= o ? On(e, n, r, c, 0, o) : di(e, n, r, Math.max(0, c), o);
1664
- }, On = function(e, n, r, o, a, c) {
1665
- for (; a <= o; ) {
1666
- var d = a + Math.floor((o - a) / 2), s = _e(e, n, d, r).offset;
1667
- if (s === c)
1668
- return d;
1669
- s < c ? a = d + 1 : s > c && (o = d - 1);
1670
- }
1671
- return a > 0 ? a - 1 : 0;
1672
- }, di = function(e, n, r, o, a) {
1673
- for (var c = e === "column" ? n.columnCount : n.rowCount, d = 1; o < c && _e(e, n, o, r).offset < a; )
1674
- o += d, d *= 2;
1675
- return On(e, n, r, Math.min(o, c - 1), Math.floor(o / 2), a);
1676
- }, nn = function(e, n, r, o, a, c, d) {
1677
- var s = e === "column" ? n.width : n.height, m = _e(e, n, r, c), g = e === "column" ? Nn(n, c) : En(n, c), C = Math.max(0, Math.min(g - s, m.offset)), u = Math.max(0, m.offset - s + d + m.size);
1678
- switch (o === "smart" && (a >= u - s && a <= C + s ? o = "auto" : o = "center"), o) {
1679
- case "start":
1680
- return C;
1681
- case "end":
1682
- return u;
1683
- case "center":
1684
- return Math.round(u + (C - u) / 2);
1685
- case "auto":
1686
- default:
1687
- return a >= u && a <= C ? a : u > C || a < u ? u : C;
1688
- }
1689
- }, ui = /* @__PURE__ */ ci({
1690
- getColumnOffset: function(e, n, r) {
1691
- return _e("column", e, n, r).offset;
1692
- },
1693
- getColumnStartIndexForOffset: function(e, n, r) {
1694
- return tn("column", e, r, n);
1695
- },
1696
- getColumnStopIndexForStartIndex: function(e, n, r, o) {
1697
- for (var a = e.columnCount, c = e.width, d = _e("column", e, n, o), s = r + c, m = d.offset + d.size, g = n; g < a - 1 && m < s; )
1698
- g++, m += _e("column", e, g, o).size;
1699
- return g;
1700
- },
1701
- getColumnWidth: function(e, n, r) {
1702
- return r.columnMetadataMap[n].size;
1703
- },
1704
- getEstimatedTotalHeight: En,
1705
- getEstimatedTotalWidth: Nn,
1706
- getOffsetForColumnAndAlignment: function(e, n, r, o, a, c) {
1707
- return nn("column", e, n, r, o, a, c);
1708
- },
1709
- getOffsetForRowAndAlignment: function(e, n, r, o, a, c) {
1710
- return nn("row", e, n, r, o, a, c);
1711
- },
1712
- getRowOffset: function(e, n, r) {
1713
- return _e("row", e, n, r).offset;
1714
- },
1715
- getRowHeight: function(e, n, r) {
1716
- return r.rowMetadataMap[n].size;
1717
- },
1718
- getRowStartIndexForOffset: function(e, n, r) {
1719
- return tn("row", e, r, n);
1720
- },
1721
- getRowStopIndexForStartIndex: function(e, n, r, o) {
1722
- for (var a = e.rowCount, c = e.height, d = _e("row", e, n, o), s = r + c, m = d.offset + d.size, g = n; g < a - 1 && m < s; )
1723
- g++, m += _e("row", e, g, o).size;
1724
- return g;
1725
- },
1726
- initInstanceProps: function(e, n) {
1727
- var r = e, o = r.estimatedColumnWidth, a = r.estimatedRowHeight, c = {
1728
- columnMetadataMap: {},
1729
- estimatedColumnWidth: o || en,
1730
- estimatedRowHeight: a || en,
1731
- lastMeasuredColumnIndex: -1,
1732
- lastMeasuredRowIndex: -1,
1733
- rowMetadataMap: {}
1734
- };
1735
- return n.resetAfterColumnIndex = function(d, s) {
1736
- s === void 0 && (s = !0), n.resetAfterIndices({
1737
- columnIndex: d,
1738
- shouldForceUpdate: s
1739
- });
1740
- }, n.resetAfterRowIndex = function(d, s) {
1741
- s === void 0 && (s = !0), n.resetAfterIndices({
1742
- rowIndex: d,
1743
- shouldForceUpdate: s
1744
- });
1745
- }, n.resetAfterIndices = function(d) {
1746
- var s = d.columnIndex, m = d.rowIndex, g = d.shouldForceUpdate, C = g === void 0 ? !0 : g;
1747
- typeof s == "number" && (c.lastMeasuredColumnIndex = Math.min(c.lastMeasuredColumnIndex, s - 1)), typeof m == "number" && (c.lastMeasuredRowIndex = Math.min(c.lastMeasuredRowIndex, m - 1)), n._getItemStyleCache(-1), C && n.forceUpdate();
1748
- }, c;
1749
- },
1750
- shouldResetStyleCacheOnItemSizeChange: !1,
1751
- validateProps: function(e) {
1752
- var n = e.columnWidth, r = e.rowHeight;
1753
- if (process.env.NODE_ENV !== "production") {
1754
- if (typeof n != "function")
1755
- throw Error('An invalid "columnWidth" prop has been specified. Value should be a function. ' + ('"' + (n === null ? "null" : typeof n) + '" was specified.'));
1756
- if (typeof r != "function")
1757
- throw Error('An invalid "rowHeight" prop has been specified. Value should be a function. ' + ('"' + (r === null ? "null" : typeof r) + '" was specified.'));
1758
- }
1759
- }
1760
- });
1761
- process.env.NODE_ENV;
1762
- function on(t, e) {
1763
- for (var n in t)
1764
- if (!(n in e))
1765
- return !0;
1766
- for (var r in e)
1767
- if (t[r] !== e[r])
1768
- return !0;
1769
- return !1;
1770
- }
1771
- var pi = ["style"], hi = ["style"];
1772
- function fi(t, e) {
1773
- var n = t.style, r = Xt(t, pi), o = e.style, a = Xt(e, hi);
1774
- return !on(n, o) && !on(r, a);
1775
- }
1776
- const mi = () => {
1777
- const { viewMode: t } = He(), { scrollMode: e } = ze(), { setColumnCount: n } = mn(), { virtualScrollableElementRef: r } = nt(), o = je(), a = F(() => o.heights.length, [o.heights]), c = F(() => e === re.HORIZONTAL_SCROLLING ? a : t === Oe.DUAL_PAGE ? 2 : 1, [t, e, e, a, r]), d = F(() => o.widths.reduce((b, y, p) => {
1778
- const h = p % c;
1779
- return (!b[h] || y > b[h]) && (b[h] = y), b;
1780
- }, []), [o.widths, c]), s = N(
1781
- (T) => {
1782
- const b = T % d.length;
1783
- return d[b] || 0;
1784
- },
1785
- [d]
1786
- ), m = N(
1787
- (T) => {
1788
- const b = Array.from({ length: c }, (y, p) => {
1789
- const h = T * c + p;
1790
- return o.heights[h] || 0;
1791
- });
1792
- return Math.max(...b);
1793
- },
1794
- [o.heights, c]
1795
- );
1796
- z(() => {
1797
- n(c);
1798
- }, [c, n]);
1799
- const g = F(() => e === re.HORIZONTAL_SCROLLING || e === re.PAGE_SCROLLING ? 1 : Math.round(a / c), [c, a, e]), C = F(() => o.heights.reduce((T, b) => T + b, 0) / o.heights.length || 0, [o]), u = F(() => o.widths.reduce((T, b) => T + b, 0) / o.widths.length || 0, [o]), v = F(() => {
1800
- const { rowsHeight: T, columnsWidth: b } = Rt(o, c);
1801
- return {
1802
- rowsHeight: T,
1803
- columnsWidth: b
1804
- };
1805
- }, [o, c]), P = F(() => ({
1806
- width: v.columnsWidth.reduce((T, b) => T + b, 0),
1807
- height: v.rowsHeight.reduce((T, b) => T + b, 0)
1808
- }), [v]);
1809
- return {
1810
- rowCount: g,
1811
- rowHeight: m,
1812
- columnCount: c,
1813
- columnWidth: s,
1814
- pageDimension: o,
1815
- estimatedRowHeight: C,
1816
- estimatedColumnWidth: u,
1817
- gridDimension: v,
1818
- totalDimension: P
1819
- };
1820
- };
1821
- let le;
1822
- typeof window < "u" ? le = window : typeof self < "u" ? le = self : le = global;
1823
- let Ct = null, Pt = null;
1824
- const rn = 20, gt = le.clearTimeout, an = le.setTimeout, vt = le.cancelAnimationFrame || le.mozCancelAnimationFrame || le.webkitCancelAnimationFrame, sn = le.requestAnimationFrame || le.mozRequestAnimationFrame || le.webkitRequestAnimationFrame;
1825
- vt == null || sn == null ? (Ct = gt, Pt = function(e) {
1826
- return an(e, rn);
1827
- }) : (Ct = function([e, n]) {
1828
- vt(e), gt(n);
1829
- }, Pt = function(e) {
1830
- const n = sn(function() {
1831
- gt(r), e();
1832
- }), r = an(function() {
1833
- vt(n), e();
1834
- }, rn);
1835
- return [n, r];
1836
- });
1837
- function gi(t) {
1838
- let e, n, r, o, a, c, d;
1839
- const s = typeof document < "u" && document.attachEvent;
1840
- if (!s) {
1841
- c = function(y) {
1842
- const p = y.__resizeTriggers__, h = p.firstElementChild, f = p.lastElementChild, l = h.firstElementChild;
1843
- f.scrollLeft = f.scrollWidth, f.scrollTop = f.scrollHeight, l.style.width = h.offsetWidth + 1 + "px", l.style.height = h.offsetHeight + 1 + "px", h.scrollLeft = h.scrollWidth, h.scrollTop = h.scrollHeight;
1844
- }, a = function(y) {
1845
- return y.offsetWidth !== y.__resizeLast__.width || y.offsetHeight !== y.__resizeLast__.height;
1846
- }, d = function(y) {
1847
- if (y.target.className && typeof y.target.className.indexOf == "function" && y.target.className.indexOf("contract-trigger") < 0 && y.target.className.indexOf("expand-trigger") < 0)
1848
- return;
1849
- const p = this;
1850
- c(this), this.__resizeRAF__ && Ct(this.__resizeRAF__), this.__resizeRAF__ = Pt(function() {
1851
- a(p) && (p.__resizeLast__.width = p.offsetWidth, p.__resizeLast__.height = p.offsetHeight, p.__resizeListeners__.forEach(function(l) {
1852
- l.call(p, y);
1853
- }));
1854
- });
1855
- };
1856
- let u = !1, v = "";
1857
- r = "animationstart";
1858
- const P = "Webkit Moz O ms".split(" ");
1859
- let T = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "), b = "";
1860
- {
1861
- const y = document.createElement("fakeelement");
1862
- if (y.style.animationName !== void 0 && (u = !0), u === !1) {
1863
- for (let p = 0; p < P.length; p++)
1864
- if (y.style[P[p] + "AnimationName"] !== void 0) {
1865
- b = P[p], v = "-" + b.toLowerCase() + "-", r = T[p], u = !0;
1866
- break;
1867
- }
1868
- }
1869
- }
1870
- n = "resizeanim", e = "@" + v + "keyframes " + n + " { from { opacity: 0; } to { opacity: 0; } } ", o = v + "animation: 1ms " + n + "; ";
1871
- }
1872
- const m = function(u) {
1873
- if (!u.getElementById("detectElementResize")) {
1874
- const v = (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%; }', P = u.head || u.getElementsByTagName("head")[0], T = u.createElement("style");
1875
- T.id = "detectElementResize", T.type = "text/css", t != null && T.setAttribute("nonce", t), T.styleSheet ? T.styleSheet.cssText = v : T.appendChild(u.createTextNode(v)), P.appendChild(T);
1876
- }
1877
- };
1878
- return {
1879
- addResizeListener: function(u, v) {
1880
- if (s)
1881
- u.attachEvent("onresize", v);
1882
- else {
1883
- if (!u.__resizeTriggers__) {
1884
- const P = u.ownerDocument, T = le.getComputedStyle(u);
1885
- T && T.position === "static" && (u.style.position = "relative"), m(P), u.__resizeLast__ = {}, u.__resizeListeners__ = [], (u.__resizeTriggers__ = P.createElement("div")).className = "resize-triggers";
1886
- const b = P.createElement("div");
1887
- b.className = "expand-trigger", b.appendChild(P.createElement("div"));
1888
- const y = P.createElement("div");
1889
- y.className = "contract-trigger", u.__resizeTriggers__.appendChild(b), u.__resizeTriggers__.appendChild(y), u.appendChild(u.__resizeTriggers__), c(u), u.addEventListener("scroll", d, !0), r && (u.__resizeTriggers__.__animationListener__ = function(h) {
1890
- h.animationName === n && c(u);
1891
- }, u.__resizeTriggers__.addEventListener(r, u.__resizeTriggers__.__animationListener__));
1892
- }
1893
- u.__resizeListeners__.push(v);
1894
- }
1895
- },
1896
- removeResizeListener: function(u, v) {
1897
- if (s)
1898
- u.detachEvent("onresize", v);
1899
- else if (u.__resizeListeners__.splice(u.__resizeListeners__.indexOf(v), 1), !u.__resizeListeners__.length) {
1900
- u.removeEventListener("scroll", d, !0), u.__resizeTriggers__.__animationListener__ && (u.__resizeTriggers__.removeEventListener(r, u.__resizeTriggers__.__animationListener__), u.__resizeTriggers__.__animationListener__ = null);
1901
- try {
1902
- u.__resizeTriggers__ = !u.removeChild(u.__resizeTriggers__);
1903
- } catch {
1904
- }
1905
- }
1906
- }
1907
- };
1908
- }
1909
- class vi extends uo {
1910
- constructor(...e) {
1911
- super(...e), this.state = {
1912
- height: this.props.defaultHeight || 0,
1913
- width: this.props.defaultWidth || 0
1914
- }, this._autoSizer = null, this._detectElementResize = null, this._didLogDeprecationWarning = !1, this._parentNode = null, this._resizeObserver = null, this._timeoutId = null, this._onResize = () => {
1915
- this._timeoutId = null;
1916
- const {
1917
- disableHeight: n,
1918
- disableWidth: r,
1919
- onResize: o
1920
- } = this.props;
1921
- if (this._parentNode) {
1922
- const a = window.getComputedStyle(this._parentNode) || {}, c = parseFloat(a.paddingLeft || "0"), d = parseFloat(a.paddingRight || "0"), s = parseFloat(a.paddingTop || "0"), m = parseFloat(a.paddingBottom || "0"), g = this._parentNode.getBoundingClientRect(), C = g.height - s - m, u = g.width - c - d;
1923
- if (!n && this.state.height !== C || !r && this.state.width !== u) {
1924
- this.setState({
1925
- height: C,
1926
- width: u
1927
- });
1928
- const v = () => {
1929
- this._didLogDeprecationWarning || (this._didLogDeprecationWarning = !0, console.warn("scaledWidth and scaledHeight parameters have been deprecated; use width and height instead"));
1930
- };
1931
- typeof o == "function" && o({
1932
- height: C,
1933
- width: u,
1934
- // TODO Remove these params in the next major release
1935
- get scaledHeight() {
1936
- return v(), C;
1937
- },
1938
- get scaledWidth() {
1939
- return v(), u;
1940
- }
1941
- });
1942
- }
1943
- }
1944
- }, this._setRef = (n) => {
1945
- this._autoSizer = n;
1946
- };
1947
- }
1948
- componentDidMount() {
1949
- const {
1950
- nonce: e
1951
- } = this.props, n = this._autoSizer ? this._autoSizer.parentNode : null;
1952
- if (n != null && n.ownerDocument && n.ownerDocument.defaultView && n instanceof n.ownerDocument.defaultView.HTMLElement) {
1953
- this._parentNode = n;
1954
- const r = n.ownerDocument.defaultView.ResizeObserver;
1955
- r != null ? (this._resizeObserver = new r(() => {
1956
- this._timeoutId = setTimeout(this._onResize, 0);
1957
- }), this._resizeObserver.observe(n)) : (this._detectElementResize = gi(e), this._detectElementResize.addResizeListener(n, this._onResize)), this._onResize();
1958
- }
1959
- }
1960
- componentWillUnmount() {
1961
- this._parentNode && (this._detectElementResize && this._detectElementResize.removeResizeListener(this._parentNode, this._onResize), this._timeoutId !== null && clearTimeout(this._timeoutId), this._resizeObserver && this._resizeObserver.disconnect());
1962
- }
1963
- render() {
1964
- const {
1965
- children: e,
1966
- defaultHeight: n,
1967
- defaultWidth: r,
1968
- disableHeight: o = !1,
1969
- disableWidth: a = !1,
1970
- doNotBailOutOnEmptyChildren: c = !1,
1971
- nonce: d,
1972
- onResize: s,
1973
- style: m = {},
1974
- tagName: g = "div",
1975
- ...C
1976
- } = this.props, {
1977
- height: u,
1978
- width: v
1979
- } = this.state, P = {
1980
- overflow: "visible"
1981
- }, T = {};
1982
- let b = !1;
1983
- return o || (u === 0 && (b = !0), P.height = 0, T.height = u, T.scaledHeight = u), a || (v === 0 && (b = !0), P.width = 0, T.width = v, T.scaledWidth = v), c && (b = !1), Ke(g, {
1984
- ref: this._setRef,
1985
- style: {
1986
- ...P,
1987
- ...m
1988
- },
1989
- ...C
1990
- }, !b && e(T));
1991
- }
1992
- }
1993
- const wi = hn(({ widths: t, heights: e }) => {
1994
- const { focusedPage: n, totalPages: r } = ue(), o = F(() => {
1995
- const d = [], s = Math.ceil(n / 2) * 2 - 1;
1996
- if (d.push(s), s + 1 <= r) {
1997
- const m = s + 1;
1998
- d.push(m);
1999
- }
2000
- return d;
2001
- }, [n, r]), a = F(() => {
2002
- const d = n % 2 === 1 ? n - 1 : n - 2, s = Math.floor(d / 2), m = e(s), g = t(d), C = t(d + 1);
2003
- return [
2004
- {
2005
- position: "absolute",
2006
- left: 0,
2007
- width: g,
2008
- height: m
2009
- },
2010
- {
2011
- position: "absolute",
2012
- left: g,
2013
- width: C,
2014
- height: m
2015
- }
2016
- ];
2017
- }, [t, e, o]), c = F(() => a.reduce((d, s) => d + Number(s.width || 0), 0), [a]);
2018
- return /* @__PURE__ */ i("div", { style: { width: c, position: "relative" }, children: o.map((d, s) => /* @__PURE__ */ i(Dt, { style: a[s], pageNumber: d }, d)) });
2019
- }), _i = ({ widths: t, heights: e }) => {
2020
- const { focusedPage: n } = ue(), r = F(() => ({
2021
- position: "absolute",
2022
- width: t(n - 1),
2023
- height: e(n - 1)
2024
- }), [t, e, n]), o = F(() => t(n - 1), [t]);
2025
- return /* @__PURE__ */ i(
2026
- "div",
2027
- {
2028
- style: {
2029
- width: o,
2030
- position: "relative"
2031
- },
2032
- children: /* @__PURE__ */ i(Dt, { style: r, pageNumber: n }, n)
2033
- }
2034
- );
2035
- }, bi = (t, e, n) => {
2036
- const r = M(), { contentRef: o } = be(), { heights: a, widths: c } = je(), { setFocusedPage: d } = ue(), [s, m] = H([]), { targetScrollPage: g } = gn(), C = Lt(s, 0, 500), u = F(() => {
2037
- const { rowsHeight: P, columnsWidth: T } = Rt({ heights: a, widths: c }, t);
2038
- return a.map((b, y) => {
2039
- const p = c[y], h = ar(y + 1, t), f = T.slice(0, h.columnIndex).reduce((I, x) => I + x, 0), l = P.slice(0, h.rowIndex).reduce((I, x) => I + x, 0), w = f + p, _ = l + b;
2040
- return {
2041
- pageNumber: y + 1,
2042
- ...h,
2043
- width: p,
2044
- height: b,
2045
- startX: f,
2046
- startY: l,
2047
- endX: w,
2048
- endY: _
2049
- };
2050
- });
2051
- }, [a, c, t, e]);
2052
- z(() => {
2053
- var T;
2054
- C.length > 0 && !g.current && d(C[0].pageNumber), ((T = C[0]) == null ? void 0 : T.ratio) && C.some((b) => b.pageNumber === g.current) && setTimeout(() => {
2055
- g.current = void 0;
2056
- }, 500);
2057
- }, [C, d]);
2058
- const v = N(
2059
- (P) => {
2060
- r.current && cancelAnimationFrame(r.current), r.current = requestAnimationFrame(() => {
2061
- const T = P.target, b = {
2062
- startTop: T.scrollTop,
2063
- startLeft: T.scrollLeft,
2064
- endTop: T.scrollTop + T.clientHeight,
2065
- endLeft: T.scrollLeft + T.clientWidth
2066
- }, y = u.filter((p) => {
2067
- const h = p.endX >= b.startLeft && p.endY >= b.startTop, f = p.startX <= b.endLeft && p.startY <= b.endTop;
2068
- return h && f;
2069
- }).map((p) => {
2070
- const h = b.startLeft > p.startX ? b.startLeft : p.startX, f = b.startTop > p.startY ? b.startTop : p.startY, l = b.endLeft < p.endX ? b.endLeft : p.endX, w = b.endTop < p.endY ? b.endTop : p.endY, _ = l - h, I = w - f, S = +(_ * I / (p.width * p.height) * 100).toFixed(2);
2071
- return {
2072
- pageNumber: p.pageNumber,
2073
- ratio: S
2074
- };
2075
- }).sort((p, h) => h.ratio - p.ratio);
2076
- m(y);
2077
- });
2078
- },
2079
- [o, u]
2080
- );
2081
- z(() => {
2082
- if (n)
2083
- return n == null || n.addEventListener("scroll", v), () => {
2084
- n == null || n.removeEventListener("scroll", v);
2085
- };
2086
- }, [n, v]);
2087
- }, Dn = rt((t, e) => {
2088
- const { children: n, toolbarRef: r, style: o, className: a, ...c } = t, { customVariables: d, customDarkVariables: s } = Do(), { darkMode: m } = wo();
2089
- return /* @__PURE__ */ i(
2090
- "div",
2091
- {
2092
- ref: e,
2093
- ...c,
2094
- className: ae(
2095
- Ce["rp-theme-variables"],
2096
- Ce["rp-container"],
2097
- m ? Ce["rp-dark-mode"] : "",
2098
- a
2099
- ),
2100
- style: {
2101
- "--rp-toolbar-height": `${(r == null ? void 0 : r.clientHeight) || 48}px`,
2102
- ...d,
2103
- ...m ? s : {},
2104
- ...o
2105
- },
2106
- children: n
2107
- }
2108
- );
2109
- }), Ti = hn(({ columnIndex: t, rowIndex: e, data: n, style: r }) => {
2110
- const o = sr(e, t, n.columnCount);
2111
- return /* @__PURE__ */ i(Dt, { style: r, pageNumber: o }, o);
2112
- }, fi), Tc = () => {
2113
- const t = M(new Mo()), { initialPage: e = 1, initialScrollMode: n, instanceId: r } = yt(), { pagesRef: o, setPagesRef: a, setContentRef: c } = be(), { scrollToPage: d } = Cn();
2114
- pr(o);
2115
- const {
2116
- virtualScrollRef: s,
2117
- getVirtualScrollRef: m,
2118
- getPageScrollElementRef: g,
2119
- getVirtualScrollableElementRef: C,
2120
- setTotalInnerDimensions: u,
2121
- virtualScrollableElementRef: v,
2122
- totalInnerDimensions: P,
2123
- pageScrollElementRef: T
2124
- } = nt(), b = M(!0), { nextPage: y, prevPage: p, setFocusedPage: h, focusedPage: f } = ue(), { scrollMode: l } = ze(), { viewMode: w } = He(), _ = M(null), { loading: I, error: x } = oe(), { passwordRequired: S } = vo(), { LoaderImageComponent: L } = It(), O = M(
2125
- P
2126
- ), D = M({
2127
- viewMode: w,
2128
- scrollMode: l
2129
- }), A = M(!1), E = M(), { isFullScreen: R } = To(), {
2130
- pageDimension: k,
2131
- rowCount: $,
2132
- rowHeight: q,
2133
- columnCount: G,
2134
- columnWidth: j,
2135
- estimatedColumnWidth: V,
2136
- estimatedRowHeight: ie,
2137
- totalDimension: U
2138
- } = mi(), Q = Lt(P, 100), { onScroll: J } = Oo(), te = M();
2139
- bi(G, $, v);
2140
- const ee = M({
2141
- scrollTop: 0,
2142
- scrollLeft: 0
2143
- });
2144
- dr(o);
2145
- const { isPressed: Y } = cr(), { selectionMode: ve } = bo(), { initializeGrabScroll: fe, resetGrabState: Se } = lr({
2146
- isPressed: Y
2147
- }), xe = F(() => ve === mo.HAND, [ve]), st = F(() => ({
2148
- columnCount: G
2149
- }), [G]), ct = N(
2150
- (B) => {
2151
- const Z = document.activeElement !== o;
2152
- !R && Z || (["ArrowUp", "ArrowLeft"].includes(B.key) ? (B.preventDefault(), p()) : ["ArrowDown", "ArrowRight"].includes(B.key) && (B.preventDefault(), y()));
2153
- },
2154
- [y, p, R, l]
2155
- );
2156
- z(() => (window.addEventListener("keydown", ct), () => {
2157
- window.removeEventListener("keydown", ct);
2158
- }), [ct]), z(() => {
2159
- if (_.current && (_.current.style.position = "relative"), !!s)
2160
- for (let B = 0; B < $; B++)
2161
- for (let Z = 0; Z < G; Z++)
2162
- s.resetAfterIndices({
2163
- columnIndex: Z,
2164
- rowIndex: B,
2165
- shouldForceUpdate: !0
2166
- });
2167
- }, [$, G, k, s]);
2168
- const to = N(
2169
- (B, Z) => {
2170
- if (!v)
2171
- return { scrollTop: 0, scrollLeft: 0 };
2172
- const Re = ee.current.scrollTop > Z, Le = ee.current.scrollLeft > B;
2173
- return Re || Le ? ee.current : {
2174
- scrollTop: v.scrollTop,
2175
- scrollLeft: v.scrollLeft
2176
- };
2177
- },
2178
- [v]
2179
- ), kt = N(
2180
- (B, Z) => {
2181
- if (D.current.viewMode !== w || D.current.scrollMode !== l) {
2182
- te.current && clearTimeout(te.current), A.current = !0, d(f, "auto"), te.current = setTimeout(() => {
2183
- requestAnimationFrame(() => {
2184
- D.current = { viewMode: w, scrollMode: l };
2185
- });
2186
- }, 100);
2187
- return;
2188
- }
2189
- const Le = B.scrollTop, lt = B.scrollLeft;
2190
- if (!Z.height || !Z.width)
2191
- return;
2192
- A.current = !0;
2193
- const { height: Ee, width: dt } = Z, { height: Wt, width: Mt } = O.current;
2194
- if (Wt === Ee && Mt === dt)
2195
- return;
2196
- const io = Le / Wt * Ee, ao = lt / Mt * dt, so = Math.round(Math.min(io, Ee)) || 0, co = Math.round(Math.min(ao, dt)) || 0;
2197
- E.current = setTimeout(() => {
2198
- requestAnimationFrame(() => {
2199
- v == null || v.scrollTo({
2200
- top: so,
2201
- left: co,
2202
- behavior: "auto"
2203
- });
2204
- });
2205
- }, 0), O.current = {
2206
- height: Z.height,
2207
- width: Z.width
2208
- };
2209
- },
2210
- [v, w, l, d]
2211
- );
2212
- z(() => {
2213
- clearTimeout(E.current);
2214
- const B = Array.from({ length: $ }).reduce(
2215
- (Le, lt, Ee) => Le + q(Ee),
2216
- 0
2217
- ), Z = Array.from({ length: G }).reduce(
2218
- (Le, lt, Ee) => Le + j(Ee),
2219
- 0
2220
- ), Re = to(Z, B);
2221
- ee.current = Re, kt(Re, { height: B, width: Z }), u({
2222
- height: B,
2223
- width: Z
2224
- });
2225
- }, [k, $, G, kt]);
2226
- const no = N(
2227
- (B) => {
2228
- ee.current = {
2229
- scrollTop: B.scrollTop,
2230
- scrollLeft: B.scrollLeft
2231
- };
2232
- },
2233
- [v]
2234
- );
2235
- z(() => {
2236
- if (J)
2237
- return T && T.addEventListener("scroll", J), v && v.addEventListener("scroll", J), () => {
2238
- T == null || T.removeEventListener("scroll", J), v == null || v.removeEventListener("scroll", J);
2239
- };
2240
- }, [v, T, J]), z(() => () => {
2241
- te.current && clearTimeout(te.current);
2242
- }, []);
2243
- const oo = F(() => ae(se["rp-pages-container"], {
2244
- [se["rp-cursor-grab"]]: xe && !Y,
2245
- [se["rp-cursor-grabbing"]]: xe && Y
2246
- }), [xe, Y]), ro = N(
2247
- (B) => {
2248
- if (xe && B) {
2249
- const Z = ae(se["rp-pages"]), Re = document.querySelector(`.${Z}`);
2250
- fe(Re);
2251
- }
2252
- },
2253
- [xe, fe, se]
2254
- );
2255
- return z(() => {
2256
- I && Se();
2257
- }, [I]), z(() => {
2258
- if (!(Q.height === 0 || !b.current)) {
2259
- if (n === re.PAGE_SCROLLING) {
2260
- e !== f && T && h(e), b.current = !1;
2261
- return;
2262
- }
2263
- d(e, "auto"), h(e), b.current = !1;
2264
- }
2265
- }, [
2266
- d,
2267
- n,
2268
- T,
2269
- h,
2270
- Q
2271
- ]), /* @__PURE__ */ W(pe, { children: [
2272
- /* @__PURE__ */ i(jo, { ref: c, children: /* @__PURE__ */ i(
2273
- Dn,
2274
- {
2275
- id: r,
2276
- ref: a,
2277
- tabIndex: -1,
2278
- className: oo,
2279
- style: {
2280
- "--scale-round-x": `${Bt(t.current.sx)[1]}px`,
2281
- "--scale-round-y": `${Bt(t.current.sy)[1]}px`
2282
- },
2283
- children: /* @__PURE__ */ i(vi, { style: { minHeight: "50px" }, children: ({ width: B, height: Z }) => /* @__PURE__ */ i("div", { "data-rp": "pages", ref: ro, style: { width: B, height: Z }, children: l === re.PAGE_SCROLLING ? /* @__PURE__ */ i(
2284
- "div",
2285
- {
2286
- ref: g,
2287
- style: { width: B, height: Z },
2288
- className: ae(se["rp-pages"], se["rp-page-scrolling-wrapper"]),
2289
- children: w === Oe.DUAL_PAGE ? /* @__PURE__ */ i(wi, { widths: j, heights: q }) : /* @__PURE__ */ i(_i, { widths: j, heights: q })
2290
- }
2291
- ) : ie ? /* @__PURE__ */ i(
2292
- ui,
2293
- {
2294
- ref: m,
2295
- itemData: st,
2296
- outerRef: C,
2297
- innerRef: _,
2298
- onScroll: no,
2299
- columnCount: G,
2300
- columnWidth: j,
2301
- rowHeight: q,
2302
- height: Z,
2303
- width: B,
2304
- estimatedColumnWidth: V,
2305
- estimatedRowHeight: ie,
2306
- rowCount: $,
2307
- className: ae(
2308
- se["rp-pages"],
2309
- l === re.HORIZONTAL_SCROLLING ? se["rp-pages-horizontal-scroll"] : ""
2310
- ),
2311
- style: {
2312
- "--rp-pages-height": `${U.height}px`,
2313
- "--rp-pages-width": `${U.width}px`,
2314
- "--rp-row-count": `${$}`,
2315
- "--rp-column-count": `${G}`
2316
- },
2317
- children: Ti
2318
- }
2319
- ) : !I && !x ? /* @__PURE__ */ i(
2320
- "div",
2321
- {
2322
- className: se["rp-loader"],
2323
- style: {
2324
- display: "flex",
2325
- justifyContent: "center",
2326
- alignItems: "center",
2327
- height: "100%",
2328
- width: "100%"
2329
- },
2330
- children: L && /* @__PURE__ */ i(L, {})
2331
- }
2332
- ) : x === go.NOT_SUPPORTED ? /* @__PURE__ */ i("div", { className: se["rp-not-supported"], children: /* @__PURE__ */ W("div", { className: se["rp-not-supported-content"], children: [
2333
- "React PDF is unable to render on this browser. Please use the supported browsers from the list below:",
2334
- /* @__PURE__ */ i("div", { children: /* @__PURE__ */ W("ul", { children: [
2335
- /* @__PURE__ */ i("li", { children: "Chrome 119+" }),
2336
- /* @__PURE__ */ i("li", { children: "Edge 115+" }),
2337
- /* @__PURE__ */ i("li", { children: "Firefox 115+" }),
2338
- /* @__PURE__ */ i("li", { children: "Safari 17.4+" }),
2339
- /* @__PURE__ */ i("li", { children: "Safari iOS 17.4+" }),
2340
- /* @__PURE__ */ i("li", { children: "Chrome Android 126+" })
2341
- ] }) })
2342
- ] }) }) : null }) })
2343
- }
2344
- ) }),
2345
- S && /* @__PURE__ */ i(ur, {})
2346
- ] });
2347
- }, $e = {
2348
- "rp-toolbar-content": "_rp-toolbar-content_sz31z_1",
2349
- "rp-toolbar-wrapper": "_rp-toolbar-wrapper_sz31z_10",
2350
- "rp-toolbar-start": "_rp-toolbar-start_sz31z_33",
2351
- "rp-toolbar-middle": "_rp-toolbar-middle_sz31z_39",
2352
- "rp-toolbar-end": "_rp-toolbar-end_sz31z_46"
2353
- }, wt = {
2354
- "rp-paginate": "_rp-paginate_1gck0_1",
2355
- "rp-page-input": "_rp-page-input_1gck0_6",
2356
- "rp-total-page": "_rp-total-page_1gck0_18"
2357
- }, Ci = () => {
2358
- const { prevIcon: t } = ge(), { prevIcon: e } = me();
2359
- return t || e || /* @__PURE__ */ i(Ue, {});
2360
- }, Pi = () => {
2361
- const { nextIcon: t } = ge(), { nextIcon: e } = me();
2362
- return t || e || /* @__PURE__ */ i(Ue, { style: { transform: "rotate(180deg" } });
2363
- }, yi = () => {
2364
- const { focusedPage: t, totalPages: e, setFocusedPage: n, nextPage: r, prevPage: o, goToPage: a } = ue(), [c, d] = H(t.toString()), { pageNavigationTool: s = !0 } = Te(), { pageNavigationTool: m = !0 } = ye(), { isSmallScreen: g } = Ie(), { viewMode: C } = He(), { scrollMode: u } = ze(), { localeMessages: v } = de();
2365
- z(() => {
2366
- d(t.toString());
2367
- }, [t]);
2368
- const P = N((h) => {
2369
- const f = h.target.value;
2370
- d(f);
2371
- }, []), T = N(async () => {
2372
- const h = a(c);
2373
- h.success || d(h.currentPage.toString());
2374
- }, [a, c, e]), b = N(() => {
2375
- d(t.toString());
2376
- }, [t]), y = N(
2377
- (h) => {
2378
- h.key === "Enter" && T();
2379
- },
2380
- [T]
2381
- ), p = F(() => C === Oe.DUAL_PAGE && u === re.PAGE_SCROLLING && t === e - 1 || t === e, [t, e, C, u]);
2382
- return !s || !m ? null : typeof s != "boolean" ? /* @__PURE__ */ i(
2383
- s,
2384
- {
2385
- total: e,
2386
- current: t,
2387
- nextPage: r,
2388
- prevPage: o,
2389
- goToPage: a,
2390
- changePage: n
2391
- }
2392
- ) : typeof m != "boolean" ? /* @__PURE__ */ i(
2393
- m,
2394
- {
2395
- total: e,
2396
- current: t,
2397
- nextPage: r,
2398
- prevPage: o,
2399
- goToPage: a,
2400
- changePage: n
2401
- }
2402
- ) : /* @__PURE__ */ W("div", { className: wt["rp-paginate"], children: [
2403
- !g && /* @__PURE__ */ i(K, { content: v == null ? void 0 : v.previousPageTooltip, children: /* @__PURE__ */ i(
2404
- ce,
2405
- {
2406
- onClick: o,
2407
- "aria-label": v == null ? void 0 : v.previousPageTooltip,
2408
- "aria-disabled": t === 1,
2409
- children: /* @__PURE__ */ i(Ci, {})
2410
- }
2411
- ) }),
2412
- /* @__PURE__ */ i(K, { content: v == null ? void 0 : v.currentPageTooltip, children: /* @__PURE__ */ i(
2413
- fn,
2414
- {
2415
- onKeyDown: y,
2416
- onBlur: b,
2417
- onChange: P,
2418
- value: c,
2419
- className: wt["rp-page-input"],
2420
- id: "page-input",
2421
- name: "page-input"
2422
- }
2423
- ) }),
2424
- /* @__PURE__ */ W("span", { className: wt["rp-total-page"], children: [
2425
- "/",
2426
- e
2427
- ] }),
2428
- !g && /* @__PURE__ */ i(K, { content: v == null ? void 0 : v.nextPageTooltip, children: /* @__PURE__ */ i(
2429
- ce,
2430
- {
2431
- onClick: r,
2432
- "aria-label": v == null ? void 0 : v.nextPageTooltip,
2433
- "aria-disabled": p,
2434
- children: /* @__PURE__ */ i(Pi, {})
2435
- }
2436
- ) })
2437
- ] });
2438
- };
2439
- var at = "Dialog", [zn, Cc] = wr(at), [Ii, he] = zn(at), An = (t) => {
2440
- const {
2441
- __scopeDialog: e,
2442
- children: n,
2443
- open: r,
2444
- defaultOpen: o,
2445
- onOpenChange: a,
2446
- modal: c = !0
2447
- } = t, d = X.useRef(null), s = X.useRef(null), [m, g] = br({
2448
- prop: r,
2449
- defaultProp: o ?? !1,
2450
- onChange: a,
2451
- caller: at
2452
- });
2453
- return /* @__PURE__ */ i(
2454
- Ii,
2455
- {
2456
- scope: e,
2457
- triggerRef: d,
2458
- contentRef: s,
2459
- contentId: pt(),
2460
- titleId: pt(),
2461
- descriptionId: pt(),
2462
- open: m,
2463
- onOpenChange: g,
2464
- onOpenToggle: X.useCallback(() => g((C) => !C), [g]),
2465
- modal: c,
2466
- children: n
2467
- }
2468
- );
2469
- };
2470
- An.displayName = at;
2471
- var Fn = "DialogTrigger", Si = X.forwardRef(
2472
- (t, e) => {
2473
- const { __scopeDialog: n, ...r } = t, o = he(Fn, n), a = Et(e, o.triggerRef);
2474
- return /* @__PURE__ */ i(
2475
- Ze.button,
2476
- {
2477
- type: "button",
2478
- "aria-haspopup": "dialog",
2479
- "aria-expanded": o.open,
2480
- "aria-controls": o.contentId,
2481
- "data-state": Ft(o.open),
2482
- ...r,
2483
- ref: a,
2484
- onClick: Ge(t.onClick, o.onOpenToggle)
2485
- }
2486
- );
2487
- }
2488
- );
2489
- Si.displayName = Fn;
2490
- var zt = "DialogPortal", [xi, kn] = zn(zt, {
2491
- forceMount: void 0
2492
- }), Wn = (t) => {
2493
- const { __scopeDialog: e, forceMount: n, children: r, container: o } = t, a = he(zt, e);
2494
- return /* @__PURE__ */ i(xi, { scope: e, forceMount: n, children: X.Children.map(r, (c) => /* @__PURE__ */ i(Nt, { present: n || a.open, children: /* @__PURE__ */ i(xr, { asChild: !0, container: o, children: c }) })) });
2495
- };
2496
- Wn.displayName = zt;
2497
- var et = "DialogOverlay", Mn = X.forwardRef(
2498
- (t, e) => {
2499
- const n = kn(et, t.__scopeDialog), { forceMount: r = n.forceMount, ...o } = t, a = he(et, t.__scopeDialog);
2500
- return a.modal ? /* @__PURE__ */ i(Nt, { present: r || a.open, children: /* @__PURE__ */ i(Li, { ...o, ref: e }) }) : null;
2501
- }
2502
- );
2503
- Mn.displayName = et;
2504
- var Ri = Tr("DialogOverlay.RemoveScroll"), Li = X.forwardRef(
2505
- (t, e) => {
2506
- const { __scopeDialog: n, ...r } = t, o = he(et, n);
2507
- return (
2508
- // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
2509
- // ie. when `Overlay` and `Content` are siblings
2510
- /* @__PURE__ */ i(Pr, { as: Ri, allowPinchZoom: !0, shards: [o.contentRef], children: /* @__PURE__ */ i(
2511
- Ze.div,
2512
- {
2513
- "data-state": Ft(o.open),
2514
- ...r,
2515
- ref: e,
2516
- style: { pointerEvents: "auto", ...r.style }
2517
- }
2518
- ) })
2519
- );
2520
- }
2521
- ), De = "DialogContent", Hn = X.forwardRef(
2522
- (t, e) => {
2523
- const n = kn(De, t.__scopeDialog), { forceMount: r = n.forceMount, ...o } = t, a = he(De, t.__scopeDialog);
2524
- return /* @__PURE__ */ i(Nt, { present: r || a.open, children: a.modal ? /* @__PURE__ */ i(Ei, { ...o, ref: e }) : /* @__PURE__ */ i(Ni, { ...o, ref: e }) });
2525
- }
2526
- );
2527
- Hn.displayName = De;
2528
- var Ei = X.forwardRef(
2529
- (t, e) => {
2530
- const n = he(De, t.__scopeDialog), r = X.useRef(null), o = Et(e, n.contentRef, r);
2531
- return X.useEffect(() => {
2532
- const a = r.current;
2533
- if (a)
2534
- return yr(a);
2535
- }, []), /* @__PURE__ */ i(
2536
- $n,
2537
- {
2538
- ...t,
2539
- ref: o,
2540
- trapFocus: n.open,
2541
- disableOutsidePointerEvents: !0,
2542
- onCloseAutoFocus: Ge(t.onCloseAutoFocus, (a) => {
2543
- var c;
2544
- a.preventDefault(), (c = n.triggerRef.current) == null || c.focus();
2545
- }),
2546
- onPointerDownOutside: Ge(t.onPointerDownOutside, (a) => {
2547
- const c = a.detail.originalEvent, d = c.button === 0 && c.ctrlKey === !0;
2548
- (c.button === 2 || d) && a.preventDefault();
2549
- }),
2550
- onFocusOutside: Ge(
2551
- t.onFocusOutside,
2552
- (a) => a.preventDefault()
2553
- )
2554
- }
2555
- );
2556
- }
2557
- ), Ni = X.forwardRef(
2558
- (t, e) => {
2559
- const n = he(De, t.__scopeDialog), r = X.useRef(!1), o = X.useRef(!1);
2560
- return /* @__PURE__ */ i(
2561
- $n,
2562
- {
2563
- ...t,
2564
- ref: e,
2565
- trapFocus: !1,
2566
- disableOutsidePointerEvents: !1,
2567
- onCloseAutoFocus: (a) => {
2568
- var c, d;
2569
- (c = t.onCloseAutoFocus) == null || c.call(t, a), a.defaultPrevented || (r.current || (d = n.triggerRef.current) == null || d.focus(), a.preventDefault()), r.current = !1, o.current = !1;
2570
- },
2571
- onInteractOutside: (a) => {
2572
- var s, m;
2573
- (s = t.onInteractOutside) == null || s.call(t, a), a.defaultPrevented || (r.current = !0, a.detail.originalEvent.type === "pointerdown" && (o.current = !0));
2574
- const c = a.target;
2575
- ((m = n.triggerRef.current) == null ? void 0 : m.contains(c)) && a.preventDefault(), a.detail.originalEvent.type === "focusin" && o.current && a.preventDefault();
2576
- }
2577
- }
2578
- );
2579
- }
2580
- ), $n = X.forwardRef(
2581
- (t, e) => {
2582
- const { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: o, onCloseAutoFocus: a, ...c } = t, d = he(De, n), s = X.useRef(null), m = Et(e, s);
2583
- return Ir(), /* @__PURE__ */ W(pe, { children: [
2584
- /* @__PURE__ */ i(
2585
- Sr,
2586
- {
2587
- asChild: !0,
2588
- loop: !0,
2589
- trapped: r,
2590
- onMountAutoFocus: o,
2591
- onUnmountAutoFocus: a,
2592
- children: /* @__PURE__ */ i(
2593
- Cr,
2594
- {
2595
- role: "dialog",
2596
- id: d.contentId,
2597
- "aria-describedby": d.descriptionId,
2598
- "aria-labelledby": d.titleId,
2599
- "data-state": Ft(d.open),
2600
- ...c,
2601
- ref: m,
2602
- onDismiss: () => d.onOpenChange(!1)
2603
- }
2604
- )
2605
- }
2606
- ),
2607
- /* @__PURE__ */ W(pe, { children: [
2608
- /* @__PURE__ */ i(Di, { titleId: d.titleId }),
2609
- /* @__PURE__ */ i(Ai, { contentRef: s, descriptionId: d.descriptionId })
2610
- ] })
2611
- ] });
2612
- }
2613
- ), At = "DialogTitle", qn = X.forwardRef(
2614
- (t, e) => {
2615
- const { __scopeDialog: n, ...r } = t, o = he(At, n);
2616
- return /* @__PURE__ */ i(Ze.h2, { id: o.titleId, ...r, ref: e });
2617
- }
2618
- );
2619
- qn.displayName = At;
2620
- var Gn = "DialogDescription", Oi = X.forwardRef(
2621
- (t, e) => {
2622
- const { __scopeDialog: n, ...r } = t, o = he(Gn, n);
2623
- return /* @__PURE__ */ i(Ze.p, { id: o.descriptionId, ...r, ref: e });
2624
- }
2625
- );
2626
- Oi.displayName = Gn;
2627
- var Un = "DialogClose", Vn = X.forwardRef(
2628
- (t, e) => {
2629
- const { __scopeDialog: n, ...r } = t, o = he(Un, n);
2630
- return /* @__PURE__ */ i(
2631
- Ze.button,
2632
- {
2633
- type: "button",
2634
- ...r,
2635
- ref: e,
2636
- onClick: Ge(t.onClick, () => o.onOpenChange(!1))
2637
- }
2638
- );
2639
- }
2640
- );
2641
- Vn.displayName = Un;
2642
- function Ft(t) {
2643
- return t ? "open" : "closed";
2644
- }
2645
- var Bn = "DialogTitleWarning", [Pc, jn] = _r(Bn, {
2646
- contentName: De,
2647
- titleName: At,
2648
- docsSlug: "dialog"
2649
- }), Di = ({ titleId: t }) => {
2650
- const e = jn(Bn), n = `\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
2651
-
2652
- If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
2653
-
2654
- For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;
2655
- return X.useEffect(() => {
2656
- t && (document.getElementById(t) || console.error(n));
2657
- }, [n, t]), null;
2658
- }, zi = "DialogDescriptionWarning", Ai = ({ contentRef: t, descriptionId: e }) => {
2659
- const r = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${jn(zi).contentName}}.`;
2660
- return X.useEffect(() => {
2661
- var a;
2662
- const o = (a = t.current) == null ? void 0 : a.getAttribute("aria-describedby");
2663
- e && o && (document.getElementById(e) || console.warn(r));
2664
- }, [r, t, e]), null;
2665
- }, Fi = An, ki = Wn, Wi = Mn, Mi = Hn, Hi = qn, $i = Vn;
2666
- const Ne = {
2667
- "rp-dialog-wrapper": "_rp-dialog-wrapper_slqo7_1",
2668
- "rp-dialog-overlay": "_rp-dialog-overlay_slqo7_7",
2669
- "rp-document-dialog": "_rp-document-dialog_slqo7_13",
2670
- "rp-document-properties": "_rp-document-properties_slqo7_35",
2671
- "rp-dialog-title": "_rp-dialog-title_slqo7_39",
2672
- "rp-dialog-close": "_rp-dialog-close_slqo7_47",
2673
- "rp-properties-divider": "_rp-properties-divider_slqo7_55"
2674
- }, qi = () => {
2675
- const { pdfProperties: t } = oe(), { container: e } = be(), { activeDocumentProperties: n, setActiveDocumentProperties: r } = No(), { localeMessages: o } = de(), a = F(() => {
2676
- if (!t)
2677
- return [];
2678
- const {
2679
- fileSize: c,
2680
- filename: d,
2681
- title: s,
2682
- author: m,
2683
- subject: g,
2684
- createdOn: C,
2685
- creator: u,
2686
- keywords: v,
2687
- modifiedOn: P,
2688
- pdfProducer: T,
2689
- pdfVersion: b,
2690
- pageCount: y
2691
- } = t;
2692
- return [
2693
- { label: o == null ? void 0 : o.propertiesFilenameLabel, value: d },
2694
- { label: o == null ? void 0 : o.propertiesFileSizeLabel, value: c },
2695
- { separate: !0 },
2696
- { label: o == null ? void 0 : o.propertiesTitleLabel, value: s },
2697
- { label: o == null ? void 0 : o.propertiesAuthorLabel, value: m },
2698
- { label: o == null ? void 0 : o.propertiesSubjectLabel, value: g },
2699
- { label: o == null ? void 0 : o.propertiesKeywordLabel, value: v },
2700
- { label: o == null ? void 0 : o.propertiesCreatorLabel, value: u },
2701
- {
2702
- label: o == null ? void 0 : o.propertiesCreateOnLabel,
2703
- value: C ? qt(C) : ""
2704
- },
2705
- {
2706
- label: o == null ? void 0 : o.propertiesModifiedOnLabel,
2707
- value: P ? qt(P) : ""
2708
- },
2709
- { separate: !0 },
2710
- { label: o == null ? void 0 : o.propertiesPDFProducerLabel, value: T },
2711
- { label: o == null ? void 0 : o.propertiesPDFVersionLabel, value: b },
2712
- { label: o == null ? void 0 : o.propertiesPageCountLabel, value: y }
2713
- ];
2714
- }, [t, o]);
2715
- return /* @__PURE__ */ i(Fi, { open: n, onOpenChange: r, children: /* @__PURE__ */ i(ki, { container: e, children: /* @__PURE__ */ W("div", { className: Ne["rp-dialog-wrapper"], children: [
2716
- /* @__PURE__ */ i(Wi, { className: Ne["rp-dialog-overlay"] }),
2717
- /* @__PURE__ */ W(Mi, { className: Ne["rp-document-dialog"], children: [
2718
- /* @__PURE__ */ i(Hi, { className: Ne["rp-dialog-title"], children: o == null ? void 0 : o.documentPropertiesLabel }),
2719
- /* @__PURE__ */ i("div", { className: Ne["rp-document-properties"], children: a.map((c, d) => /* @__PURE__ */ i("div", { children: c.separate ? /* @__PURE__ */ i("div", { className: Ne["rp-properties-divider"] }) : /* @__PURE__ */ i(Ko, { label: c.label, value: c.value }) }, d)) }),
2720
- /* @__PURE__ */ i($i, { asChild: !0, className: Ne["rp-dialog-close"], children: /* @__PURE__ */ i(Rr, {}) })
2721
- ] })
2722
- ] }) }) });
2723
- }, Gi = {
2724
- "rp-other-tool-content": "_rp-other-tool-content_su718_1"
2725
- }, cn = ".pdf", Ui = (t) => URL.createObjectURL(t), Vi = async (t) => {
2726
- const n = await (await fetch(t)).blob();
2727
- return Ui(n);
2728
- }, Zn = () => {
2729
- const { filename: t, pdfSrc: e } = oe(), { downloadFilename: n } = xo(), r = (a) => {
2730
- const c = n || a;
2731
- return c.endsWith(cn) ? c : `${c}${cn}`;
2732
- };
2733
- return { download: N(async () => {
2734
- if (!t || !e)
2735
- throw new Error("There is no PDF source to download");
2736
- const a = document.createElement("a");
2737
- a.href = await Vi(e), a.download = r(t), document.body.appendChild(a), a.click(), document.body.removeChild(a);
2738
- }, [t, e]) };
2739
- }, Kn = () => {
2740
- const { downloadIcon: t } = ge(), { downloadIcon: e } = me();
2741
- return t || e || /* @__PURE__ */ i(Dr, {});
2742
- }, Xn = ({ children: t, className: e, localeMessages: n }) => /* @__PURE__ */ i(K, { className: e, content: n == null ? void 0 : n.downloadFileTooltip, children: t }), Bi = ({ download: t, localeMessages: e }) => /* @__PURE__ */ i(Xn, { localeMessages: e, children: /* @__PURE__ */ i(ce, { onClick: t, "aria-label": e == null ? void 0 : e.downloadFileTooltip, children: /* @__PURE__ */ i(Kn, {}) }) }), ji = ({ download: t, localeMessages: e }) => /* @__PURE__ */ i(Pe, { onClick: t, children: /* @__PURE__ */ W(Xn, { className: "rp-menu-item", localeMessages: e, children: [
2743
- /* @__PURE__ */ i("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ i(Kn, {}) }),
2744
- e == null ? void 0 : e.downloadFileLabel
2745
- ] }) }), Qn = () => {
2746
- const { download: t } = Zn(), { downloadTool: e = !0 } = Te(), { downloadTool: n = !0 } = ye(), { isSmallScreen: r } = Ie(), { localeMessages: o } = de(), a = o == null ? void 0 : o.downloadFileTooltip;
2747
- return !e || !n ? null : r ? /* @__PURE__ */ i(ji, { download: t, localeMessages: o }) : typeof e == "function" ? /* @__PURE__ */ i(K, { content: a, children: /* @__PURE__ */ i(e, { download: t }) }) : typeof n == "function" ? /* @__PURE__ */ i(K, { content: a, children: /* @__PURE__ */ i(n, { download: t }) }) : /* @__PURE__ */ i(Bi, { download: t, localeMessages: o });
2748
- }, Yn = () => {
2749
- const { printIcon: t } = ge(), { printIcon: e } = me();
2750
- return t || e || /* @__PURE__ */ i(zr, {});
2751
- }, Jn = ({ children: t, className: e, localeMessages: n }) => /* @__PURE__ */ i(K, { className: e, content: n == null ? void 0 : n.printTooltip, children: t }), Zi = ({ print: t, localeMessages: e }) => /* @__PURE__ */ i(Jn, { localeMessages: e, children: /* @__PURE__ */ i(ce, { onClick: t, "aria-label": e == null ? void 0 : e.printTooltip, children: /* @__PURE__ */ i(Yn, {}) }) }), Ki = ({ print: t, localeMessages: e }) => /* @__PURE__ */ i(Pe, { onClick: t, children: /* @__PURE__ */ W(Jn, { className: "rp-menu-item", localeMessages: e, children: [
2752
- /* @__PURE__ */ i("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ i(Yn, {}) }),
2753
- e == null ? void 0 : e.printLabel
2754
- ] }) }), eo = () => {
2755
- const { print: t, cancel: e, setOnProgress: n, setOnComplete: r, setOnError: o, progress: a, showDefaultProgress: c } = it(), { printTool: d = !0 } = Te(), { printTool: s = !0 } = ye(), { isSmallScreen: m } = Ie(), { localeMessages: g } = de(), C = g == null ? void 0 : g.printTooltip;
2756
- return !d || !s ? null : m ? /* @__PURE__ */ i(Ki, { print: t, localeMessages: g }) : typeof d == "function" ? /* @__PURE__ */ i(K, { content: C, children: /* @__PURE__ */ i(
2757
- d,
2758
- {
2759
- print: t,
2760
- cancel: e,
2761
- setOnProgress: n,
2762
- setOnError: o,
2763
- setOnComplete: r,
2764
- progress: a,
2765
- showDefaultProgress: c
2766
- }
2767
- ) }) : typeof s == "function" ? /* @__PURE__ */ i(K, { content: C, children: /* @__PURE__ */ i(
2768
- s,
2769
- {
2770
- print: t,
2771
- cancel: e,
2772
- setOnProgress: n,
2773
- setOnError: o,
2774
- setOnComplete: r,
2775
- progress: a,
2776
- showDefaultProgress: c
2777
- }
2778
- ) }) : /* @__PURE__ */ i(Zi, { print: t, localeMessages: g });
2779
- }, Xi = {
2780
- "rp-go-to-Top": "_rp-go-to-Top_4e0yd_1"
2781
- }, Qi = () => {
2782
- const { goToFirstPageIcon: t } = ge(), { goToFirstPageIcon: e } = me();
2783
- return t || e || /* @__PURE__ */ i(bn, { className: Xi["rp-go-to-Top"] });
2784
- }, Yi = () => {
2785
- const { goToLastPageIcon: t } = ge(), { goToLastPageIcon: e } = me();
2786
- return t || e || /* @__PURE__ */ i(bn, {});
2787
- }, ln = { width: "100%" }, Ji = () => {
2788
- const { goToPage: t, totalPages: e, focusedPage: n } = ue(), { jumpNavigationTool: r = !0 } = Te(), { jumpNavigationTool: o = !0 } = ye(), { localeMessages: a } = de(), c = F(() => n === 1, [n]), d = F(() => n === e, [n, e]), s = N(() => {
2789
- t(1);
2790
- }, [t]), m = N(() => {
2791
- t(e);
2792
- }, [t, e]);
2793
- return !r || !o ? null : /* @__PURE__ */ W(Je, { children: [
2794
- /* @__PURE__ */ i(Pe, { onClick: s, children: /* @__PURE__ */ i(K, { content: a == null ? void 0 : a.firstPageTooltip, style: ln, children: /* @__PURE__ */ W("div", { className: "rp-menu-item", "aria-disabled": c, children: [
2795
- /* @__PURE__ */ i("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ i(Qi, {}) }),
2796
- /* @__PURE__ */ i("span", { children: a == null ? void 0 : a.firstPageLabel })
2797
- ] }) }) }),
2798
- /* @__PURE__ */ i(Pe, { onClick: m, children: /* @__PURE__ */ i(K, { content: a == null ? void 0 : a.lastPageTooltip, style: ln, children: /* @__PURE__ */ W("div", { className: "rp-menu-item", "aria-disabled": d, children: [
2799
- /* @__PURE__ */ i("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ i(Yi, {}) }),
2800
- /* @__PURE__ */ i("span", { children: a == null ? void 0 : a.lastPageLabel })
2801
- ] }) }) }),
2802
- /* @__PURE__ */ i(xt, {})
2803
- ] });
2804
- }, ea = () => {
2805
- const [t, e] = H(!1), { container: n, pagesRef: r } = be(), { isSmallScreen: o } = Ie(), {
2806
- openFileTool: a,
2807
- downloadTool: c,
2808
- documentProperties: d,
2809
- scrollModeTool: s,
2810
- rotateTool: m,
2811
- selectionModeTool: g,
2812
- jumpNavigationTool: C,
2813
- printTool: u,
2814
- fullscreenTool: v,
2815
- viewModeTool: P
2816
- } = Te(), {
2817
- openFileTool: T,
2818
- downloadTool: b,
2819
- documentProperties: y,
2820
- scrollModeTool: p,
2821
- rotateTool: h,
2822
- selectionModeTool: f,
2823
- jumpNavigationTool: l,
2824
- printTool: w,
2825
- fullscreenTool: _,
2826
- viewModeTool: I
2827
- } = ye(), { localeMessages: x } = de(), [S, L] = H(0), O = M(
2828
- new ResizeObserver((E) => {
2829
- L(E[0].contentRect.height);
2830
- })
2831
- ), D = F(() => C || m || g || s || d || P || o && (a || c || u || v), [
2832
- a,
2833
- c,
2834
- u,
2835
- v,
2836
- d,
2837
- s,
2838
- m,
2839
- g,
2840
- C,
2841
- o
2842
- ]), A = F(() => l || h || f || p || y || I || o && (T || b || w || _), [
2843
- T,
2844
- b,
2845
- w,
2846
- _,
2847
- y,
2848
- p,
2849
- h,
2850
- f,
2851
- l,
2852
- o
2853
- ]);
2854
- return z(() => (r && O.current.observe(r), () => {
2855
- O.current.disconnect();
2856
- }), [r]), !D || !A ? null : /* @__PURE__ */ W(pe, { children: [
2857
- /* @__PURE__ */ i(
2858
- St,
2859
- {
2860
- container: n,
2861
- onOpenChange: e,
2862
- triggerComponent: /* @__PURE__ */ i("div", { role: "button", children: /* @__PURE__ */ i(K, { content: x == null ? void 0 : x.moreOptionTooltip, children: /* @__PURE__ */ i(ce, { active: t, "aria-label": x == null ? void 0 : x.moreOptionTooltip, children: /* @__PURE__ */ i(vr, {}) }) }) }),
2863
- side: "bottom",
2864
- avoidCollisions: !1,
2865
- children: /* @__PURE__ */ W(
2866
- "div",
2867
- {
2868
- style: { maxHeight: `${S}px`, overflow: "auto" },
2869
- className: Gi["rp-other-tool-content"],
2870
- "data-rp": "moreOptionsDropdown",
2871
- children: [
2872
- o && /* @__PURE__ */ W(Je, { children: [
2873
- /* @__PURE__ */ i(wn, {}),
2874
- /* @__PURE__ */ i(Qn, {}),
2875
- /* @__PURE__ */ i(eo, {}),
2876
- /* @__PURE__ */ i(_n, {}),
2877
- /* @__PURE__ */ i(xt, {})
2878
- ] }),
2879
- /* @__PURE__ */ i(Ji, {}),
2880
- /* @__PURE__ */ i(Er, {}),
2881
- /* @__PURE__ */ i(Ar, {}),
2882
- /* @__PURE__ */ i(Nr, {}),
2883
- /* @__PURE__ */ i(Or, {}),
2884
- /* @__PURE__ */ i(Lr, {})
2885
- ]
2886
- }
2887
- )
2888
- }
2889
- ),
2890
- /* @__PURE__ */ i(qi, {})
2891
- ] });
2892
- }, ta = () => {
2893
- const { isSmallScreen: t } = Ie();
2894
- return /* @__PURE__ */ W(pe, { children: [
2895
- /* @__PURE__ */ i(gr, {}),
2896
- !t && /* @__PURE__ */ W(pe, { children: [
2897
- /* @__PURE__ */ i(wn, {}),
2898
- /* @__PURE__ */ i(Qn, {}),
2899
- /* @__PURE__ */ i(eo, {}),
2900
- /* @__PURE__ */ i(_n, {})
2901
- ] }),
2902
- /* @__PURE__ */ i(ea, {})
2903
- ] });
2904
- }, na = "_active_1yldl_11", Fe = {
2905
- "rp-zoom-wrapper": "_rp-zoom-wrapper_1yldl_1",
2906
- "rp-current-zoom-wrapper": "_rp-current-zoom-wrapper_1yldl_6",
2907
- active: na,
2908
- "rp-current-zoom-icon": "_rp-current-zoom-icon_1yldl_15",
2909
- "rp-zoom-level-icon": "_rp-zoom-level-icon_1yldl_20",
2910
- "rp-current-zoom-text": "_rp-current-zoom-text_1yldl_24",
2911
- "rp-zoom-dropdown-content": "_rp-zoom-dropdown-content_1yldl_28"
2912
- }, oa = ({ zoomLevel: t, className: e }) => {
2913
- const { localeMessages: n } = de(), r = F(() => {
2914
- switch (t) {
2915
- case Me.ACTUAL:
2916
- return n == null ? void 0 : n.zoomActualSize;
2917
- case Me.PAGE_FIT:
2918
- return n == null ? void 0 : n.zoomPageFit;
2919
- case Me.PAGE_WIDTH:
2920
- return n == null ? void 0 : n.zoomPageWidth;
2921
- }
2922
- return t.toString();
2923
- }, [t, n]);
2924
- return /* @__PURE__ */ i(pe, { children: typeof t == "number" ? /* @__PURE__ */ W(po, { children: [
2925
- /* @__PURE__ */ i("span", { className: e, children: t }),
2926
- /* @__PURE__ */ i("span", { className: e, children: "%" })
2927
- ] }) : /* @__PURE__ */ i("span", { className: e, children: r }) });
2928
- }, ra = [50, 75, 100, 125, 150, 200, 300, 400], ia = () => {
2929
- const { zoomInIcon: t } = ge(), { zoomInIcon: e } = me();
2930
- return t || e || /* @__PURE__ */ i(Fr, {});
2931
- }, aa = () => {
2932
- const { zoomOutIcon: t } = ge(), { zoomOutIcon: e } = me();
2933
- return t || e || /* @__PURE__ */ i(kr, {});
2934
- }, sa = () => {
2935
- const { zoomLevel: t, setZoomLevel: e, currentZoom: n } = tt(), { container: r, pagesRef: o } = be(), { zoomTool: a = !0 } = Te(), { zoomTool: c = !0 } = ye(), { isSmallScreen: d } = Ie(), { localeMessages: s } = de(), [m, g] = H(0), [C, u] = H(!1), v = M(
2936
- new ResizeObserver((p) => {
2937
- g(p[0].contentRect.height);
2938
- })
2939
- ), P = N(() => {
2940
- e(() => {
2941
- const p = Math.floor(n * 100 / 25) * 25;
2942
- return Math.min(p + 25, Gt);
2943
- });
2944
- }, [e, n]), T = N(() => {
2945
- e(() => {
2946
- const p = Math.ceil(n * 100 / 25) * 25;
2947
- return Math.min(p - 25, Gt);
2948
- });
2949
- }, [e, n]), b = F(() => Wr(n), [n]), y = F(() => Mr(n), [n]);
2950
- return z(() => (o && v.current.observe(o), () => {
2951
- v.current.disconnect();
2952
- }), [o]), !a || !c ? null : typeof a == "function" ? /* @__PURE__ */ i(a, { zoomLevel: t, setZoomLevel: e }) : typeof c == "function" ? /* @__PURE__ */ i(c, { zoomLevel: t, setZoomLevel: e }) : /* @__PURE__ */ W("div", { className: Fe["rp-zoom-wrapper"], children: [
2953
- /* @__PURE__ */ i(K, { content: s == null ? void 0 : s.zoomOutTooltip, children: /* @__PURE__ */ i(
2954
- ce,
2955
- {
2956
- disabled: b,
2957
- onClick: T,
2958
- "aria-label": s == null ? void 0 : s.zoomOutTooltip,
2959
- children: /* @__PURE__ */ i(aa, {})
2960
- }
2961
- ) }),
2962
- !d && /* @__PURE__ */ i(
2963
- St,
2964
- {
2965
- container: r,
2966
- open: C,
2967
- onOpenChange: u,
2968
- triggerComponent: /* @__PURE__ */ i("div", { role: "button", children: /* @__PURE__ */ i(K, { content: s == null ? void 0 : s.zoomSelectTooltip, children: /* @__PURE__ */ W(
2969
- ce,
2970
- {
2971
- className: ae(
2972
- Fe["rp-current-zoom-wrapper"],
2973
- C && Fe.active
2974
- ),
2975
- "aria-label": s == null ? void 0 : s.zoomSelectTooltip,
2976
- children: [
2977
- /* @__PURE__ */ i(
2978
- oa,
2979
- {
2980
- zoomLevel: t,
2981
- className: Fe["rp-current-zoom-text"]
2982
- }
2983
- ),
2984
- /* @__PURE__ */ i(Ue, { className: Fe["rp-current-zoom-icon"] })
2985
- ]
2986
- }
2987
- ) }) }),
2988
- style: { minWidth: "200px" },
2989
- align: "center",
2990
- side: "bottom",
2991
- avoidCollisions: !1,
2992
- children: /* @__PURE__ */ W(
2993
- "div",
2994
- {
2995
- style: { maxHeight: `${m}px`, overflow: "auto" },
2996
- className: Fe["rp-zoom-dropdown-content"],
2997
- children: [
2998
- /* @__PURE__ */ W(Je, { children: [
2999
- /* @__PURE__ */ i(Pe, { onClick: () => e(Me.ACTUAL), children: s == null ? void 0 : s.zoomActualSize }),
3000
- /* @__PURE__ */ i(Pe, { onClick: () => e(Me.PAGE_FIT), children: s == null ? void 0 : s.zoomPageFit }),
3001
- /* @__PURE__ */ i(Pe, { onClick: () => e(Me.PAGE_WIDTH), children: s == null ? void 0 : s.zoomPageWidth })
3002
- ] }),
3003
- /* @__PURE__ */ i(xt, {}),
3004
- /* @__PURE__ */ i(Je, { children: ra.map((p) => /* @__PURE__ */ W(Pe, { onClick: () => e(p), children: [
3005
- p,
3006
- " %"
3007
- ] }, p)) })
3008
- ]
3009
- }
3010
- )
3011
- }
3012
- ),
3013
- /* @__PURE__ */ i(K, { content: s == null ? void 0 : s.zoomInTooltip, children: /* @__PURE__ */ i(
3014
- ce,
3015
- {
3016
- disabled: y,
3017
- onClick: P,
3018
- "aria-label": s == null ? void 0 : s.zoomInTooltip,
3019
- children: /* @__PURE__ */ i(ia, {})
3020
- }
3021
- ) })
3022
- ] });
3023
- }, dn = () => {
3024
- const { totalMatches: t, nextMatch: e, prevMatch: n } = Ot(), { localeMessages: r } = de();
3025
- return /* @__PURE__ */ W(pe, { children: [
3026
- /* @__PURE__ */ i(
3027
- K,
3028
- {
3029
- content: r == null ? void 0 : r.searchPrevTooltip,
3030
- className: ne["rp-search-tool-result-navigator"],
3031
- children: /* @__PURE__ */ i(ce, { tabIndex: 0, onClick: n, "aria-label": r == null ? void 0 : r.searchPrevTooltip, children: /* @__PURE__ */ i(
3032
- Ue,
3033
- {
3034
- className: ne["rp-search-tool-input-icon"],
3035
- "aria-disabled": !t
3036
- }
3037
- ) })
3038
- }
3039
- ),
3040
- /* @__PURE__ */ i(
3041
- K,
3042
- {
3043
- content: r == null ? void 0 : r.searchNextTooltip,
3044
- className: ne["rp-search-tool-result-navigator"],
3045
- children: /* @__PURE__ */ i(ce, { tabIndex: 0, onClick: e, "aria-label": r == null ? void 0 : r.searchNextTooltip, children: /* @__PURE__ */ i(
3046
- Ue,
3047
- {
3048
- style: { transform: "rotate(180deg" },
3049
- className: ne["rp-search-tool-input-icon"],
3050
- "aria-disabled": !t
3051
- }
3052
- ) })
3053
- }
3054
- )
3055
- ] });
3056
- }, ca = () => {
3057
- const { searchIcon: t } = ge(), { searchIcon: e } = me();
3058
- return t || e || /* @__PURE__ */ i(Tn, {});
3059
- }, la = ({ icon: t }) => {
3060
- const { container: e } = be(), [n, r] = H(!1), { pdf: o } = oe(), [a, c] = H(null), {
3061
- searchOptions: d,
3062
- setSearchOptions: s,
3063
- loading: m,
3064
- setSearch: g,
3065
- totalMatches: C,
3066
- currentMatchPosition: u,
3067
- nextMatch: v,
3068
- prevMatch: P,
3069
- search: T
3070
- } = Ot(), { searchTool: b = !0 } = Te(), { searchTool: y = !0 } = ye(), [p, h] = H(T), { localeMessages: f } = de(), { isSmallScreen: l } = Ie(), [w, _] = H(null), [I, x] = H(!1), S = N(() => {
3071
- r(!0);
3072
- }, []), L = N(() => {
3073
- g(""), h(""), r(!1);
3074
- }, [g]), O = (U) => {
3075
- const Q = U.key === "Enter", J = U.key === " ";
3076
- (Q || J) && L();
3077
- }, D = N(
3078
- (U) => {
3079
- U.key === "Escape" && n && L();
3080
- },
3081
- [n]
3082
- ), A = N(
3083
- (U) => {
3084
- U.shiftKey && U.key === "Enter" ? P() : U.key === "Enter" && T !== p ? g(p) : U.key === "Enter" && v();
3085
- },
3086
- [p, P, v, g, T]
3087
- );
3088
- z(() => {
3089
- h(T);
3090
- }, [T]), z(() => {
3091
- T && o && x(!0);
3092
- }, [T, o]), z(() => {
3093
- T && T.trim() !== "" && (h(T), g(T));
3094
- }, []), z(() => (window.addEventListener("keydown", D), () => {
3095
- window.removeEventListener("keydown", D);
3096
- }), [D]), z(() => {
3097
- a && setTimeout(() => {
3098
- a.focus();
3099
- }, 0);
3100
- }, [a]);
3101
- const E = N((U) => {
3102
- h(U.target.value);
3103
- }, []), R = N(() => {
3104
- h(""), g("");
3105
- }, [g]), k = F(() => `${u} / ${C}`, [u, C]), { wholeWords: $, matchCase: q } = F(() => d, [d]), G = N(
3106
- (U) => {
3107
- s((Q) => ({ ...Q, matchCase: U }));
3108
- },
3109
- [s]
3110
- ), j = N(
3111
- (U) => {
3112
- s((Q) => ({ ...Q, wholeWords: U }));
3113
- },
3114
- [s]
3115
- );
3116
- z(() => {
3117
- o && I && L();
3118
- }, [o, L]);
3119
- const V = F(() => (w == null ? void 0 : w.querySelectorAll('[tabindex]:not([tabindex="-1"])')) || [], [w]), ie = N(
3120
- (U) => {
3121
- if (U.key === "Tab") {
3122
- const Q = document.activeElement;
3123
- let J = 0;
3124
- V.forEach((Y, ve) => {
3125
- Y === Q && (J = ve);
3126
- });
3127
- let te = J + 1;
3128
- U.shiftKey && (te = J - 1);
3129
- const ee = V[te];
3130
- if (ee)
3131
- ee.focus();
3132
- else if (te > V.length - 1) {
3133
- const Y = V[0];
3134
- Y && Y.focus();
3135
- } else {
3136
- const Y = V[V.length - 1];
3137
- Y && Y.focus();
3138
- }
3139
- }
3140
- },
3141
- [V]
3142
- );
3143
- return !b || !y ? null : /* @__PURE__ */ i(pe, { children: /* @__PURE__ */ i(
3144
- St,
3145
- {
3146
- open: n,
3147
- container: e,
3148
- side: "bottom",
3149
- align: "start",
3150
- tabIndex: 0,
3151
- avoidCollisions: !1,
3152
- triggerComponent: /* @__PURE__ */ i(K, { content: f == null ? void 0 : f.searchButtonTooltip, children: /* @__PURE__ */ i(
3153
- ce,
3154
- {
3155
- active: n,
3156
- onClick: S,
3157
- "aria-label": f == null ? void 0 : f.searchButtonTooltip,
3158
- children: t || /* @__PURE__ */ i(ca, {})
3159
- }
3160
- ) }),
3161
- children: /* @__PURE__ */ W(
3162
- "div",
3163
- {
3164
- ref: _,
3165
- className: ne["rp-search-tool-content"],
3166
- tabIndex: 0,
3167
- onKeyDown: ie,
3168
- children: [
3169
- /* @__PURE__ */ W("div", { className: ne["rp-search-tool-input-wrapper"], children: [
3170
- /* @__PURE__ */ W("div", { className: ne["rp-search-tool-input"], children: [
3171
- /* @__PURE__ */ i(K, { content: f == null ? void 0 : f.searchInputTooltip, children: /* @__PURE__ */ i(
3172
- fn,
3173
- {
3174
- value: p,
3175
- onKeyDown: A,
3176
- onChange: E,
3177
- icon: /* @__PURE__ */ i(Tn, {}),
3178
- placeholder: f == null ? void 0 : f.searchInputPlaceholder,
3179
- className: ne["rp-search-input"],
3180
- ref: c,
3181
- id: "search-input",
3182
- name: "search-input",
3183
- tabIndex: 0,
3184
- children: !!p && /* @__PURE__ */ i("span", { className: ne["rp-search-tool-input-clear"], onClick: R, children: /* @__PURE__ */ i(Hr, {}) })
3185
- }
3186
- ) }),
3187
- m ? /* @__PURE__ */ i("span", { children: /* @__PURE__ */ i(vn, { className: ne["rp-search-loader-icon"] }) }) : /* @__PURE__ */ i("span", { children: k }),
3188
- l && /* @__PURE__ */ i("div", { className: ne["rp-search-tool-controls"], children: /* @__PURE__ */ i(Ht, { onKeyPress: O, handleClose: L }) })
3189
- ] }),
3190
- /* @__PURE__ */ W("div", { className: ne["rp-search-tool-input-checkboxes"], children: [
3191
- l && /* @__PURE__ */ i(dn, {}),
3192
- /* @__PURE__ */ i(
3193
- $t,
3194
- {
3195
- tabIndex: 0,
3196
- name: "matchCase",
3197
- value: q,
3198
- onChange: G,
3199
- children: f == null ? void 0 : f.searchMatchCaseLabel
3200
- }
3201
- ),
3202
- !l && /* @__PURE__ */ i(K, { content: f == null ? void 0 : f.searchMatchCaseTooltip, children: /* @__PURE__ */ i("div", { className: ne["rp-search-icon-info"], tabIndex: 0, children: /* @__PURE__ */ i(jt, {}) }) }),
3203
- /* @__PURE__ */ i(
3204
- $t,
3205
- {
3206
- tabIndex: 0,
3207
- name: "wholeWord",
3208
- value: $,
3209
- onChange: j,
3210
- children: f == null ? void 0 : f.searchWholeWordsLabel
3211
- }
3212
- ),
3213
- !l && /* @__PURE__ */ i(K, { content: f == null ? void 0 : f.searchWholeWordsTooltip, children: /* @__PURE__ */ i("div", { tabIndex: 0, className: ne["rp-search-icon-info"], children: /* @__PURE__ */ i(jt, {}) }) })
3214
- ] })
3215
- ] }),
3216
- !l && /* @__PURE__ */ W("div", { className: ne["rp-search-tool-controls"], children: [
3217
- /* @__PURE__ */ i(dn, {}),
3218
- /* @__PURE__ */ i(Ht, { onKeyPress: O, handleClose: L })
3219
- ] })
3220
- ]
3221
- }
3222
- )
3223
- }
3224
- ) });
3225
- }, da = "_loading_wazy2_1", ke = {
3226
- "rp-loading-overlay": "_rp-loading-overlay_wazy2_1",
3227
- "rp-loading-modal": "_rp-loading-modal_wazy2_14",
3228
- "rp-loading-title": "_rp-loading-title_wazy2_27",
3229
- "rp-loading-progress-bar": "_rp-loading-progress-bar_wazy2_35",
3230
- "rp-loading-progress": "_rp-loading-progress_wazy2_35",
3231
- "rp-loading-cancel-button": "_rp-loading-cancel-button_wazy2_55",
3232
- loading: da
3233
- }, ua = ({ percentage: t }) => {
3234
- const { cancel: e } = it(), { localeMessages: n } = de();
3235
- return t < 1 ? null : /* @__PURE__ */ i("div", { className: ae(ke["rp-loading-overlay"]), children: /* @__PURE__ */ W("div", { className: ae(ke["rp-loading-modal"]), children: [
3236
- /* @__PURE__ */ W("div", { className: ae(ke["rp-loading-title"]), children: [
3237
- n == null ? void 0 : n.printLoadingMessage,
3238
- "..."
3239
- ] }),
3240
- /* @__PURE__ */ i("div", { className: ae(ke["rp-loading-progress-bar"]), children: /* @__PURE__ */ i(
3241
- "div",
3242
- {
3243
- className: ae(ke["rp-loading-progress"]),
3244
- style: { width: `${t}%` }
3245
- }
3246
- ) }),
3247
- /* @__PURE__ */ i("button", { className: ae(ke["rp-loading-cancel-button"]), onClick: e, children: n == null ? void 0 : n.printCancelLabel })
3248
- ] }) });
3249
- }, pa = rt((t, e) => {
3250
- const { showPrintProgress: n = !0 } = Te(), { showPrintProgress: r = !0 } = ye(), { progress: o, showDefaultProgress: a } = it(), { isSmallScreen: c } = Ie(), { percentage: d } = o || {}, s = () => c ? { gridTemplateColumns: "25% 60% 15%" } : void 0, m = () => {
3251
- if (!(!(a ?? (n && r)) || !d))
3252
- return /* @__PURE__ */ i(ua, { percentage: d });
3253
- };
3254
- return /* @__PURE__ */ W("div", { children: [
3255
- /* @__PURE__ */ i("div", { "data-rp": "topBar", ref: e, className: $e["rp-toolbar-content"], children: /* @__PURE__ */ W("div", { className: $e["rp-toolbar-wrapper"], style: s(), children: [
3256
- /* @__PURE__ */ W("div", { "data-rp": "topBarLeft", className: $e["rp-toolbar-start"], children: [
3257
- /* @__PURE__ */ i(la, {}),
3258
- /* @__PURE__ */ i(yi, {})
3259
- ] }),
3260
- /* @__PURE__ */ i("div", { "data-rp": "topBarCenter", className: $e["rp-toolbar-middle"], children: /* @__PURE__ */ i(sa, {}) }),
3261
- /* @__PURE__ */ i("div", { "data-rp": "topBarRight", className: $e["rp-toolbar-end"], children: /* @__PURE__ */ i(ta, {}) })
3262
- ] }) }),
3263
- /* @__PURE__ */ i(m, {})
3264
- ] });
3265
- }), _t = {
3266
- "rp-sidebar-content-wrapper": "_rp-sidebar-content-wrapper_1bqgz_1",
3267
- "rp-sidebar-content": "_rp-sidebar-content_1bqgz_1",
3268
- "rp-thumbnails-wrapper": "_rp-thumbnails-wrapper_1bqgz_16"
3269
- }, qe = {
3270
- "rp-thumbnail-wrapper": "_rp-thumbnail-wrapper_3fenb_1",
3271
- "rp-thumbnail-text": "_rp-thumbnail-text_3fenb_10",
3272
- "rp-thumbnail": "_rp-thumbnail_3fenb_1",
3273
- "rp-thumbnail-active": "_rp-thumbnail-active_3fenb_22",
3274
- "rp-thumbnail-loader": "_rp-thumbnail-loader_3fenb_31"
3275
- }, ha = (t) => {
3276
- const { pageNumber: e, isFocused: n, viewport: r } = t, { goToPage: o } = ue(), { pageRotate: a } = ot(), c = M(null), d = Ln(), { pages: s } = oe(), [m, g] = H(null), C = M(!1), u = M(), v = F(() => n ? qe["rp-thumbnail-active"] : "", [n]), P = F(() => ({
3277
- width: Math.round(r.width),
3278
- height: Math.round(r.height)
3279
- }), [r]), T = N(() => {
3280
- e && o(e);
3281
- }, [o, e]);
3282
- return z(() => {
3283
- const b = s.get(e);
3284
- u.current === b || (g(null), u.current = b);
3285
- }, [s, e]), z(() => {
3286
- const b = s.get(e);
3287
- if (!c.current || !e || !b || m)
3288
- return;
3289
- const y = new IntersectionObserver((p) => {
3290
- p.forEach((h) => {
3291
- if (C.current) {
3292
- C.current = !1, d.removeQueue(`thumbnail-${e}`);
3293
- return;
3294
- }
3295
- if (h.isIntersecting) {
3296
- const f = document.createElement("canvas");
3297
- C.current = !0, d.enqueue(
3298
- `thumbnail-${e}`,
3299
- {
3300
- page: b.page,
3301
- canvasElem: f,
3302
- options: {
3303
- scale: 1
3304
- },
3305
- onLoaded: () => {
3306
- f.toBlob((l) => {
3307
- if (!l)
3308
- return;
3309
- const w = URL.createObjectURL(l);
3310
- g(w);
3311
- });
3312
- }
3313
- },
3314
- 2
3315
- );
3316
- }
3317
- });
3318
- });
3319
- return c.current && y.observe(c.current), () => {
3320
- y.disconnect(), d.removeQueue(`thumbnail-${e}`);
3321
- };
3322
- }, [d, e, s, m]), /* @__PURE__ */ W(
3323
- "div",
3324
- {
3325
- onClick: T,
3326
- id: `page-${e}`,
3327
- className: qe["rp-thumbnail-wrapper"],
3328
- ref: c,
3329
- children: [
3330
- /* @__PURE__ */ i(
3331
- "div",
3332
- {
3333
- style: {
3334
- transform: `rotate(${a[e || 0]}deg)`
3335
- },
3336
- className: ae(v, qe["rp-thumbnail"]),
3337
- children: m ? /* @__PURE__ */ i(
3338
- "img",
3339
- {
3340
- src: m,
3341
- width: P.width,
3342
- height: P.height,
3343
- alt: "thumbnail"
3344
- }
3345
- ) : /* @__PURE__ */ i(
3346
- "div",
3347
- {
3348
- className: qe["rp-thumbnail-loader"],
3349
- style: {
3350
- width: `${P.width}px`,
3351
- height: `${P.height}px`
3352
- },
3353
- children: /* @__PURE__ */ i(vn, {})
3354
- }
3355
- )
3356
- }
3357
- ),
3358
- /* @__PURE__ */ i("div", { className: qe["rp-thumbnail-text"], children: e })
3359
- ]
3360
- }
3361
- );
3362
- }, un = {
3363
- "rp-thumbnails-container": "_rp-thumbnails-container_16vqr_1",
3364
- "rp-thumbnails": "_rp-thumbnails_16vqr_1"
3365
- }, fa = 16, ma = (t, e) => {
3366
- const n = t == null ? void 0 : t.querySelector(`#page-${e}`);
3367
- t && (n != null && n.offsetTop) && (t.scrollTop = (n == null ? void 0 : n.offsetTop) - fa);
3368
- }, ga = rt((t, e) => {
3369
- const { show: n, width: r } = t, { focusedPage: o, totalPages: a } = ue(), { thumbnailPages: c, addPage: d, thumbnailLength: s, addToPage: m } = Sn(), g = M(null), C = M(1);
3370
- pn(e, () => g.current);
3371
- const u = F(() => Object.values(c), [c]), v = N(() => {
3372
- const P = s + 1;
3373
- P <= a && d(P);
3374
- }, [d, a, s]);
3375
- return z(() => {
3376
- o > s && a > s ? m(o) : n && C.current !== o && (ma(g.current, o), C.current = o);
3377
- }, [o, s, m, n, u]), Xo(g.current, v), /* @__PURE__ */ i("div", { ref: g, className: un["rp-thumbnails-container"], style: { width: r }, children: /* @__PURE__ */ i("div", { className: un["rp-thumbnails"], children: n ? u.map((P, T) => {
3378
- var b, y;
3379
- return /* @__PURE__ */ i(
3380
- ha,
3381
- {
3382
- isFocused: o === ((b = P.page) == null ? void 0 : b.pageNumber),
3383
- pageNumber: (y = P.page) == null ? void 0 : y.pageNumber,
3384
- loading: P.loading,
3385
- viewport: P.viewport,
3386
- defaultRotation: P.defaultRotation
3387
- },
3388
- T
3389
- );
3390
- }) : null }) });
3391
- }), va = () => {
3392
- const { thumbnailIcon: t } = ge(), { thumbnailIcon: e } = me();
3393
- return t || e || /* @__PURE__ */ i(Ho, {});
3394
- }, wa = () => {
3395
- const { active: t, setActive: e } = Sn(), [n, r] = H(Qo), o = M(null), a = M(null), { thumbnailTool: c, sidebarEnable: d } = Te(), { localeMessages: s } = de(), m = N(() => {
3396
- e((C) => !C);
3397
- }, []), g = F(() => typeof c != "boolean" && c ? /* @__PURE__ */ i(c, { onClick: m, active: t }) : c ? /* @__PURE__ */ i(K, { content: s == null ? void 0 : s.thumbnailTooltip, children: /* @__PURE__ */ i(
3398
- ce,
3399
- {
3400
- onClick: m,
3401
- active: t,
3402
- "aria-label": s == null ? void 0 : s.thumbnailTooltip,
3403
- children: /* @__PURE__ */ i(va, {})
3404
- }
3405
- ) }) : null, [c, t, m, s]);
3406
- return /* @__PURE__ */ i(pe, { children: d && /* @__PURE__ */ W(
3407
- "div",
3408
- {
3409
- style: { "--rp-thumbnail-width": `${n}px` },
3410
- className: _t["rp-sidebar-content-wrapper"],
3411
- "data-rp": "sidebar",
3412
- children: [
3413
- /* @__PURE__ */ i("div", { ref: a, className: _t["rp-sidebar-content"], children: g }),
3414
- /* @__PURE__ */ W(
3415
- "div",
3416
- {
3417
- "data-rp": "thumbnailSidebar",
3418
- hidden: !t,
3419
- className: _t["rp-thumbnails-wrapper"],
3420
- children: [
3421
- /* @__PURE__ */ i(ga, { show: t, ref: o }),
3422
- /* @__PURE__ */ i(
3423
- Uo,
3424
- {
3425
- onWidthChange: r,
3426
- thumbnailRef: o,
3427
- leftSidebarRef: a
3428
- }
3429
- )
3430
- ]
3431
- }
3432
- )
3433
- ]
3434
- }
3435
- ) });
3436
- }, yc = ho((t, e) => {
3437
- const {
3438
- children: n,
3439
- slots: r,
3440
- icons: o,
3441
- style: a,
3442
- className: c,
3443
- mobileWidth: d,
3444
- onLoaded: s,
3445
- cleanupOnLoaded: m,
3446
- onLayoutWidthChange: g
3447
- } = t, [C, u] = H(null), { setContainer: v, setContentRef: P } = be(), { loading: T } = oe(), { LoaderImageComponent: b } = It();
3448
- return z(() => (s && s(), () => {
3449
- m && m();
3450
- }), [s, m]), // TODO: deprecated in v2.0.0, remove later ~
3451
- /* @__PURE__ */ i(Dn, { toolbarRef: C, ref: e, children: /* @__PURE__ */ i(qo, { mobileWidth: d, onLayoutWidthChange: g, children: /* @__PURE__ */ i(Go, { slots: r, children: /* @__PURE__ */ i(Zo, { icons: o, children: /* @__PURE__ */ W($o, { getContainerRef: v, style: a, className: c, children: [
3452
- /* @__PURE__ */ W(Vo, { children: [
3453
- /* @__PURE__ */ W("div", { className: Ce["rp-layout"], children: [
3454
- /* @__PURE__ */ i(
3455
- pa,
3456
- {
3457
- ref: u
3458
- }
3459
- ),
3460
- /* @__PURE__ */ W("div", { className: Ce["rp-content"], children: [
3461
- /* @__PURE__ */ i("div", { className: Ce["rp-sidebar"], children: /* @__PURE__ */ i(wa, {}) }),
3462
- /* @__PURE__ */ i("div", { ref: P, className: Ce["rp-pages"], children: n })
3463
- ] })
3464
- ] }),
3465
- /* @__PURE__ */ i(Bo, {})
3466
- ] }),
3467
- T ? /* @__PURE__ */ i(
3468
- "div",
3469
- {
3470
- className: Ce["rp-loader"],
3471
- style: {
3472
- position: "absolute",
3473
- top: 0,
3474
- left: 0,
3475
- right: 0,
3476
- bottom: 0,
3477
- width: "100%",
3478
- height: "100%"
3479
- },
3480
- children: /* @__PURE__ */ i(
3481
- "div",
3482
- {
3483
- style: {
3484
- display: "flex",
3485
- justifyContent: "center",
3486
- alignItems: "center",
3487
- height: "100%",
3488
- width: "100%"
3489
- },
3490
- children: b && /* @__PURE__ */ i(b, {})
3491
- }
3492
- )
3493
- }
3494
- ) : null
3495
- ] }) }) }) }) });
3496
- }), Ic = {
3497
- "rp-toolbar-layout": "_rp-toolbar-layout_vwobs_1",
3498
- "rp-content": "_rp-content_vwobs_7",
3499
- "rp-topbar-content": "_rp-topbar-content_vwobs_13",
3500
- "rp-sidebar-content": "_rp-sidebar-content_vwobs_22",
3501
- "rp-pages": "_rp-pages_vwobs_32",
3502
- "rp-thumbnails-wrapper": "_rp-thumbnails-wrapper_vwobs_37"
3503
- };
3504
- export {
3505
- ha as $,
3506
- In as A,
3507
- Ur as B,
3508
- xn as C,
3509
- qi as D,
3510
- Rn as E,
3511
- Ln as F,
3512
- Vr as G,
3513
- Zr as H,
3514
- Qr as I,
3515
- Jr as J,
3516
- Dt as K,
3517
- Dn as L,
3518
- mi as M,
3519
- wi as N,
3520
- _i as O,
3521
- yi as P,
3522
- bi as Q,
3523
- Tc as R,
3524
- la as S,
3525
- wc as T,
3526
- Qn as U,
3527
- eo as V,
3528
- Ji as W,
3529
- ea as X,
3530
- dn as Y,
3531
- oa as Z,
3532
- pa as _,
3533
- yc as a,
3534
- wa as a0,
3535
- Zn as b,
3536
- it as c,
3537
- Ot as d,
3538
- Sn as e,
3539
- wt as f,
3540
- Fe as g,
3541
- $e as h,
3542
- sa as i,
3543
- ta as j,
3544
- gc as k,
3545
- _c as l,
3546
- bc as m,
3547
- vc as n,
3548
- Ic as o,
3549
- ga as p,
3550
- ua as q,
3551
- Gi as r,
3552
- Xi as s,
3553
- Cn as t,
3554
- ue as u,
3555
- $r as v,
3556
- Pn as w,
3557
- qr as x,
3558
- yn as y,
3559
- Gr as z
3560
- };