@react-pdf-kit/viewer 2.0.0-beta.8 → 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 (196) 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/FullScreenContext.js +17 -10
  116. package/dist/contexts/HighlightContext.js +1 -1
  117. package/dist/contexts/LocalizationContext.js +25 -30
  118. package/dist/contexts/PagesRotateContext.js +1 -1
  119. package/dist/contexts/PaginationContext.js +15 -118
  120. package/dist/contexts/PrintContext.js +67 -131
  121. package/dist/contexts/RPDocumentContext.js +8 -8
  122. package/dist/contexts/RenderQueueProvider.js +48 -118
  123. package/dist/contexts/RotationContext.js +1 -1
  124. package/dist/contexts/ScrollModeContext.js +1 -1
  125. package/dist/contexts/SearchContext.js +66 -112
  126. package/dist/contexts/SelectionModeContext.js +1 -1
  127. package/dist/contexts/ThumbnailsContext.js +32 -131
  128. package/dist/contexts/ViewModeContext.js +19 -15
  129. package/dist/contexts/ZoomContext.js +23 -23
  130. package/dist/de_DE-a553b162.js +489 -0
  131. package/dist/floating-ui.react-dom-5ec29bd6.js +1327 -0
  132. package/dist/index-61f59539.js +1198 -0
  133. package/dist/index-655864a7.js +27 -0
  134. package/dist/{index-c9a2990a.js → index-c0faa594.js} +64 -87
  135. package/dist/index-e3ee9457.js +150 -0
  136. package/dist/main.js +193 -130
  137. package/dist/types/components/icons/DualPageWithCoverIcon.d.ts +2 -0
  138. package/dist/types/components/layout/LayoutContainer.d.ts +1 -5
  139. package/dist/types/components/layout/LayoutWrapper.d.ts +1 -5
  140. package/dist/types/components/layout/SkipLink.d.ts +7 -0
  141. package/dist/types/components/layout/sidebar/Thumbnails.d.ts +1 -3
  142. package/dist/types/components/layout/toolbar/RPToolbar.d.ts +1 -3
  143. package/dist/types/components/layout/toolbar/tools/DualPageWithCoverTool.d.ts +3 -0
  144. package/dist/types/components/layout/toolbar/tools/FirstPageTool.d.ts +3 -0
  145. package/dist/types/components/layout/toolbar/tools/HorizontalScrollingTool.d.ts +3 -0
  146. package/dist/types/components/layout/toolbar/tools/LastPageTool.d.ts +3 -0
  147. package/dist/types/components/layout/toolbar/tools/PageScrollingTool.d.ts +3 -0
  148. package/dist/types/components/layout/toolbar/tools/VerticalScrollingTool.d.ts +3 -0
  149. package/dist/types/components/page/DualPageWithCover.d.ts +5 -0
  150. package/dist/types/components/page/RPPage.d.ts +1 -3
  151. package/dist/types/components/ui/Button.d.ts +1 -3
  152. package/dist/types/components/ui/Checkbox.d.ts +1 -0
  153. package/dist/types/components/ui/Input.d.ts +1 -3
  154. package/dist/types/components/ui/RPTooltip.d.ts +1 -3
  155. package/dist/types/locales/de_DE.json.d.ts +83 -0
  156. package/dist/types/locales/en_US.json.d.ts +2 -0
  157. package/dist/types/locales/it_IT.json.d.ts +2 -0
  158. package/dist/types/locales/pt_PT.json.d.ts +2 -0
  159. package/dist/types/locales/th_TH.json.d.ts +2 -0
  160. package/dist/types/locales/zh_CN.json.d.ts +2 -0
  161. package/dist/types/main.d.ts +8 -2
  162. package/dist/types/utils/annotations.d.ts +10 -1
  163. package/dist/types/utils/calculatePage.d.ts +3 -3
  164. package/dist/types/utils/hooks/usePresentPage.d.ts +2 -1
  165. package/dist/types/utils/hooks/useTextSelection.d.ts +7 -0
  166. package/dist/types/utils/types.d.ts +34 -3
  167. package/dist/types/utils/withRef.d.ts +5 -4
  168. package/dist/utils/annotations.js +145 -150
  169. package/dist/utils/calculatePage.js +17 -11
  170. package/dist/utils/getZoomLevel.js +9 -9
  171. package/dist/utils/highlight.js +139 -139
  172. package/dist/utils/hooks/useFileDownload.js +23 -130
  173. package/dist/utils/hooks/useHighlight.js +28 -28
  174. package/dist/utils/hooks/useLicense.js +1 -1
  175. package/dist/utils/hooks/useLoadPdf.js +1 -1
  176. package/dist/utils/hooks/useLocalization.js +17 -16
  177. package/dist/utils/hooks/usePageRotateContext.js +1 -1
  178. package/dist/utils/hooks/usePaginate.js +23 -126
  179. package/dist/utils/hooks/usePinch.js +1 -1
  180. package/dist/utils/hooks/usePresentPage.js +79 -129
  181. package/dist/utils/hooks/usePrint.js +175 -130
  182. package/dist/utils/hooks/useRotate.js +1 -1
  183. package/dist/utils/hooks/useScrollToPage.js +18 -121
  184. package/dist/utils/hooks/useSearch.js +149 -127
  185. package/dist/utils/hooks/useTextSelection.js +76 -0
  186. package/dist/utils/hooks/useThumbnail.js +50 -131
  187. package/dist/utils/hooks/useVirtualReactWindow.js +84 -128
  188. package/dist/utils/types.js +14 -13
  189. package/dist/utils/withRef.js +5 -5
  190. package/package.json +5 -4
  191. package/dist/LayoutWrapper-6224491f.js +0 -19
  192. package/dist/SearchCloseButton-08d57275.js +0 -33
  193. package/dist/ToolbarLayout.module-0aa7a2aa.js +0 -3557
  194. package/dist/floating-ui.react-dom-d22a10b4.js +0 -1474
  195. package/dist/index-3bf64864.js +0 -1886
  196. package/dist/th_TH-d627cd51.js +0 -398
@@ -1,22 +1,22 @@
1
- import { sanitizeExternalUrl as I } from "./sanitizeExternalUrl.js";
1
+ import { sanitizeExternalUrl as x } from "./sanitizeExternalUrl.js";
2
2
  import { AnnotationType as l } from "./types.js";
3
- import { dateFormatter as B } from "./dateFormatter.js";
4
- import "../th_TH-d627cd51.js";
5
- const v = ["click", "dblclick", "input", "change", "mouseover"], g = /* @__PURE__ */ new Map(), x = (e, t) => `${e.loadingTask.docId}___${t.num}R${t.gen === 0 ? "" : t.gen}`;
6
- function C(e, t) {
7
- const n = x(e, t);
8
- return g.has(n) ? g.get(n) ?? null : null;
3
+ import { dateFormatter as T } from "./dateFormatter.js";
4
+ import "../de_DE-a553b162.js";
5
+ const p = ["click", "dblclick", "input", "change", "mouseover"], b = /* @__PURE__ */ new Map(), h = (e, s) => `${e.loadingTask.docId}___${s.num}R${s.gen === 0 ? "" : s.gen}`;
6
+ function y(e, s) {
7
+ const t = h(e, s);
8
+ return b.has(t) ? b.get(t) ?? null : null;
9
9
  }
10
- const S = (e, t, n) => {
11
- g.set(x(e, t), n);
12
- }, T = (e, t) => {
13
- switch (t[1].name) {
10
+ const O = (e, s, t) => {
11
+ b.set(h(e, s), t);
12
+ }, g = (e, s) => {
13
+ switch (s[1].name) {
14
14
  case "XYZ":
15
15
  return {
16
- bottomOffset: (n, s) => t[3] === null ? s : t[3],
17
- leftOffset: (n, s) => t[2] === null ? 0 : t[2],
16
+ bottomOffset: (t, n) => s[3] === null ? n : s[3],
17
+ leftOffset: (t, n) => s[2] === null ? 0 : s[2],
18
18
  pageIndex: e,
19
- scaleTo: t[4]
19
+ scaleTo: s[4]
20
20
  };
21
21
  case "Fit":
22
22
  case "FitB":
@@ -29,7 +29,7 @@ const S = (e, t, n) => {
29
29
  case "FitH":
30
30
  case "FitBH":
31
31
  return {
32
- bottomOffset: t[2],
32
+ bottomOffset: s[2],
33
33
  leftOffset: 0,
34
34
  pageIndex: e,
35
35
  scaleTo: 1
@@ -42,132 +42,126 @@ const S = (e, t, n) => {
42
42
  scaleTo: 1
43
43
  };
44
44
  }
45
- }, M = (e) => {
45
+ }, E = (e) => {
46
46
  e && (() => {
47
- const n = e == null ? void 0 : e.querySelectorAll(
47
+ const t = e == null ? void 0 : e.querySelectorAll(
48
48
  '[data-l10n-id="pdfjs-annotation-date-time-string"]'
49
49
  );
50
- n == null || n.forEach((s) => {
51
- const { date: a, time: o, dateObj: i } = JSON.parse(s.dataset.l10nArgs ?? "{}");
52
- a && o ? s.textContent = `${a}, ${o}` : i && (s.textContent = B(i));
50
+ t == null || t.forEach((n) => {
51
+ const { date: o, time: a, dateObj: i } = JSON.parse(n.dataset.l10nArgs ?? "{}");
52
+ o && a ? n.textContent = `${o}, ${a}` : i && (n.textContent = T(i));
53
53
  });
54
54
  })();
55
55
  };
56
- async function E(e, t) {
57
- let n;
58
- if (typeof t == "string" ? n = await e.getDestination(t) : n = t, n && typeof n[0] == "object" && n[0] !== null) {
59
- const s = n[0], a = C(e, s);
60
- if (a === null) {
61
- const o = await e.getPageIndex(s);
62
- return S(e, s, o), await E(e, n);
56
+ async function N(e, s) {
57
+ let t;
58
+ if (typeof s == "string" ? t = await e.getDestination(s) : t = s, t && typeof t[0] == "object" && t[0] !== null) {
59
+ const n = t[0], o = y(e, n);
60
+ if (o === null) {
61
+ const a = await e.getPageIndex(n);
62
+ return O(e, n, a), await N(e, t);
63
63
  } else
64
- return T(a, n);
64
+ return g(o, t);
65
65
  } else
66
- return T(n[0], n);
66
+ return g(t[0], t);
67
67
  }
68
- function P(e, t) {
69
- for (const n of v)
70
- e.addEventListener(n, t);
68
+ function L(e, s) {
69
+ for (const t of p)
70
+ e.addEventListener(t, s);
71
71
  }
72
- function $(e, t) {
73
- for (const n of v)
74
- e.removeEventListener(n, t);
72
+ function C(e, s) {
73
+ for (const t of p)
74
+ e.removeEventListener(t, s);
75
75
  }
76
- function D(e) {
77
- const { id: t, url: n, unsafeUrl: s } = e;
78
- new MutationObserver((o, i) => {
79
- const c = document.querySelector(`[data-annotation-id="${t}"]`);
76
+ function R(e) {
77
+ const { id: s, url: t, unsafeUrl: n } = e;
78
+ new MutationObserver((a, i) => {
79
+ const c = document.querySelector(`[data-annotation-id="${s}"]`);
80
80
  if (c) {
81
- const r = c.querySelector("a"), p = I((n || s) ?? "", "");
82
- r && (r == null || r.setAttribute("target", "_blank"), r == null || r.setAttribute("href", p), r == null || r.setAttribute("rel", "noopener noreferrer")), i.disconnect();
81
+ const r = c.querySelector("a"), A = x((t || n) ?? "", "");
82
+ r && (r == null || r.setAttribute("target", "_blank"), r == null || r.setAttribute("href", A), r == null || r.setAttribute("rel", "noopener noreferrer")), i.disconnect();
83
83
  }
84
84
  }).observe(document.body, { childList: !0, subtree: !0 });
85
85
  }
86
- function U(e, t, n) {
87
- const { rotation: s, scale: a } = t, o = s % 180 === 0;
86
+ function F(e, s, t) {
87
+ const { rotation: n, scale: o } = s, a = n % 180 === 0;
88
88
  if (e.fieldType === "Btn" && e.pushButton) {
89
89
  const i = e.rect[2] - e.rect[0], c = e.rect[3] - e.rect[1], r = document.createElement("canvas");
90
- r.setAttribute("width", ((o ? i : c) * a).toString()), r.setAttribute("height", ((o ? c : i) * a).toString()), n.set(e.id, r);
90
+ r.setAttribute("width", ((a ? i : c) * o).toString()), r.setAttribute("height", ((a ? c : i) * o).toString()), t.set(e.id, r);
91
91
  }
92
92
  }
93
- function V(e) {
94
- var o;
95
- let t = e;
96
- for (; t.tagName !== "SECTION"; )
97
- t = t.parentElement;
98
- const n = t.getAttribute("aria-haspopup") === "dialog", s = t.classList.contains("popupAnnotation");
99
- if (!n && !s)
100
- return;
101
- let a = t.id || t.getAttribute("aria-controls");
102
- if (a || (a = (o = t.firstChild) == null ? void 0 : o.id), a && t.parentElement) {
103
- const i = t.parentElement.querySelector(`[aria-controls="${a}"]`);
104
- i && new MutationObserver((r, p) => {
105
- const b = document.querySelectorAll(".popupDate");
106
- b.length > 0 && (b.forEach((m) => {
107
- if (m.innerHTML)
108
- return !1;
109
- const N = m.getAttribute("data-l10n-args");
110
- if (N) {
111
- const { date: h, time: O, dateObj: A } = JSON.parse(N);
112
- if (h && O)
113
- m.textContent = `${h}, ${O}`;
114
- else if (A) {
115
- const _ = new Date(A);
116
- m.textContent = _.toLocaleString();
117
- }
93
+ function S(e) {
94
+ e.querySelectorAll("[tabindex]").forEach((t) => {
95
+ const n = t.getAttribute("tabindex");
96
+ n && parseInt(n, 10) > 0 && (t.tagName === "A" || t.tagName === "BUTTON" || t.getAttribute("role") === "button" || t.getAttribute("role") === "link" || t.classList.contains("linkAnnotation") ? t.setAttribute("tabindex", "0") : t.removeAttribute("tabindex"));
97
+ });
98
+ }
99
+ function U(e) {
100
+ e.querySelectorAll("a").forEach((t) => {
101
+ const n = t.textContent && t.textContent.trim().length > 0, o = t.getAttribute("aria-label");
102
+ if (!n && !o) {
103
+ const a = t.getAttribute("href") || "";
104
+ let i;
105
+ if (!a || a.startsWith("#") || a.startsWith("javascript:"))
106
+ i = "Link to page in document";
107
+ else
108
+ try {
109
+ i = `External link to ${new URL(a, window.location.href).hostname.replace("www.", "")}`;
110
+ } catch {
111
+ i = "External link";
118
112
  }
119
- }), p.disconnect());
120
- }).observe(i, { childList: !0, subtree: !0 });
121
- }
113
+ t.setAttribute("aria-label", i);
114
+ }
115
+ });
122
116
  }
123
- function d(e, t, n) {
124
- const s = [];
125
- if (n)
126
- for (const a of n)
127
- a[e] === t && s.push(a);
128
- return s;
117
+ function d(e, s, t) {
118
+ const n = [];
119
+ if (t)
120
+ for (const o of t)
121
+ o[e] === s && n.push(o);
122
+ return n;
129
123
  }
130
- function u(e, t) {
131
- return { type: e, data: t };
124
+ function u(e, s) {
125
+ return { type: e, data: s };
132
126
  }
133
- async function k(e, t) {
127
+ async function I(e, s) {
134
128
  if (e.dest)
135
129
  if (typeof e.dest == "string") {
136
- const n = await E(t, e.dest);
130
+ const t = await N(s, e.dest);
137
131
  return u(l.INTERNAL_LINK, {
138
- referencedPage: n.pageIndex,
132
+ referencedPage: t.pageIndex,
139
133
  offset: null
140
134
  });
141
135
  } else {
142
- const n = await t.getPageIndex(e.dest[0]);
136
+ const t = await s.getPageIndex(e.dest[0]);
143
137
  return u(l.INTERNAL_LINK, {
144
- referencedPage: n,
138
+ referencedPage: t,
145
139
  offset: {
146
140
  left: e.dest[2],
147
141
  bottom: e.dest[3]
148
142
  }
149
143
  });
150
144
  }
151
- else if (e.url)
145
+ else if (e.url || e.unsafeUrl)
152
146
  return u(l.LINK, {
153
- url: e.url,
147
+ url: e.url ?? e.unsafeUrl,
154
148
  unsafeUrl: e.unsafeUrl
155
149
  });
156
150
  }
157
- function y(e) {
158
- for (const t of e.getElementsByTagName("span")) {
159
- let n = t.textContent;
160
- const s = JSON.parse(t.dataset.l10nArgs ?? "{}");
161
- if (n)
162
- for (const a in s)
163
- n = n.replace(`{{${a}}}`, s[a]);
164
- t.textContent = n;
151
+ function m(e) {
152
+ for (const s of e.getElementsByTagName("span")) {
153
+ let t = s.textContent;
154
+ const n = JSON.parse(s.dataset.l10nArgs ?? "{}");
155
+ if (t)
156
+ for (const o in n)
157
+ t = t.replace(`{{${o}}}`, n[o]);
158
+ s.textContent = t;
165
159
  }
166
160
  }
167
- function w(e) {
161
+ function v(e) {
168
162
  return u(l.FILE_ATTACHMENT, e.file);
169
163
  }
170
- function f(e, t) {
164
+ function f(e, s) {
171
165
  switch (e.type) {
172
166
  case "textarea":
173
167
  case "text":
@@ -177,22 +171,22 @@ function f(e, t) {
177
171
  });
178
172
  case "select-one":
179
173
  case "select-multiple":
174
+ const t = [];
175
+ for (const o of e.options)
176
+ t.push({
177
+ value: o.value,
178
+ label: o.label
179
+ });
180
180
  const n = [];
181
- for (const a of e.options)
181
+ for (const o of e.selectedOptions)
182
182
  n.push({
183
- value: a.value,
184
- label: a.label
185
- });
186
- const s = [];
187
- for (const a of e.selectedOptions)
188
- s.push({
189
- value: a.value,
190
- label: a.label
183
+ value: o.value,
184
+ label: o.label
191
185
  });
192
186
  return u(l.FORM_SELECT, {
193
187
  fieldName: e.name,
194
- value: s,
195
- options: n
188
+ value: n,
189
+ options: t
196
190
  });
197
191
  case "checkbox":
198
192
  return u(l.FORM_CHECKBOX, {
@@ -202,64 +196,64 @@ function f(e, t) {
202
196
  case "radio":
203
197
  return u(l.FORM_RADIO, {
204
198
  fieldName: e.name,
205
- ...t
199
+ ...s
206
200
  });
207
201
  case "button":
208
202
  return u(l.FORM_BUTTON, {
209
203
  fieldName: e.name,
210
- ...t
204
+ ...s
211
205
  });
212
206
  }
213
207
  }
214
- async function j(e, t, n) {
215
- var a;
216
- let s = e.target.parentNode;
217
- if (s.tagName === "DIV" && (s = s.firstChild), typeof s.className != "object")
218
- if (s.className === "linkAnnotation" && e.type === "click") {
219
- const o = (a = s.dataset) == null ? void 0 : a.annotationId;
220
- if (o) {
221
- const i = d("id", o, n);
208
+ async function W(e, s, t) {
209
+ var o;
210
+ let n = e.target.parentNode;
211
+ if (n.tagName === "DIV" && (n = n.firstChild), typeof n.className != "object")
212
+ if (n.className === "linkAnnotation" && e.type === "click") {
213
+ const a = (o = n.dataset) == null ? void 0 : o.annotationId;
214
+ if (a) {
215
+ const i = d("id", a, t);
222
216
  if (i.length)
223
- return await k(i[0], t);
217
+ return await I(i[0], s);
224
218
  }
225
219
  } else if (
226
220
  /* annotation.className.includes('popupAnnotation') || */
227
- s.className.includes("textAnnotation")
221
+ n.className.includes("textAnnotation")
228
222
  )
229
- y(s);
230
- else if (s.className.includes("fileAttachmentAnnotation")) {
231
- y(s);
232
- const o = s.dataset.annotationId;
233
- if (o && e.type === "dblclick")
234
- return w(d("id", o, n)[0]);
235
- } else if (s.className.includes("textWidgetAnnotation") && e.type === "input") {
236
- let o = s.getElementsByTagName("input")[0];
237
- return o || (o = s.getElementsByTagName("textarea")[0]), f(o);
223
+ m(n);
224
+ else if (n.className.includes("fileAttachmentAnnotation")) {
225
+ m(n);
226
+ const a = n.dataset.annotationId;
227
+ if (a && e.type === "dblclick")
228
+ return v(d("id", a, t)[0]);
229
+ } else if (n.className.includes("textWidgetAnnotation") && e.type === "input") {
230
+ let a = n.getElementsByTagName("input")[0];
231
+ return a || (a = n.getElementsByTagName("textarea")[0]), f(a);
238
232
  } else {
239
- if (s.className.includes("choiceWidgetAnnotation") && e.type === "input")
240
- return f(s.getElementsByTagName("select")[0]);
241
- if (s.className.includes("buttonWidgetAnnotation checkBox") && e.type === "change")
242
- return f(s.getElementsByTagName("input")[0]);
243
- if (s.className.includes("buttonWidgetAnnotation radioButton") && e.type === "change") {
244
- const o = s.dataset.annotationId;
245
- if (o) {
246
- const i = d("id", o, n)[0], c = [];
233
+ if (n.className.includes("choiceWidgetAnnotation") && e.type === "input")
234
+ return f(n.getElementsByTagName("select")[0]);
235
+ if (n.className.includes("buttonWidgetAnnotation checkBox") && e.type === "change")
236
+ return f(n.getElementsByTagName("input")[0]);
237
+ if (n.className.includes("buttonWidgetAnnotation radioButton") && e.type === "change") {
238
+ const a = n.dataset.annotationId;
239
+ if (a) {
240
+ const i = d("id", a, t)[0], c = [];
247
241
  for (const r of d(
248
242
  "fieldName",
249
243
  i.fieldName,
250
- n
244
+ t
251
245
  ))
252
246
  r.buttonValue && c.push(r.buttonValue);
253
- return f(s.getElementsByTagName("input")[0], {
247
+ return f(n.getElementsByTagName("input")[0], {
254
248
  value: i.buttonValue,
255
249
  defaultValue: i.fieldValue,
256
250
  options: c
257
251
  });
258
252
  }
259
- } else if (s.className.includes("buttonWidgetAnnotation pushButton") && e.type === "click") {
260
- const o = s.dataset.annotationId;
261
- if (o) {
262
- const i = d("id", o, n)[0], { action: c } = i;
253
+ } else if (n.className.includes("buttonWidgetAnnotation pushButton") && e.type === "click") {
254
+ const a = n.dataset.annotationId;
255
+ if (a) {
256
+ const i = d("id", a, t)[0], { action: c } = i;
263
257
  return c && ["Print", "SaveAs"].includes(c) ? { type: l.BUTTON, data: i } : i.resetForm ? f(
264
258
  { name: i.fieldName, type: "button" },
265
259
  { actions: i.actions, reset: !0 }
@@ -272,11 +266,12 @@ async function j(e, t, n) {
272
266
  }
273
267
  }
274
268
  export {
275
- j as annotationEventsHandler,
276
- P as bindLayerEvents,
277
- D as handleAnnotationLink,
278
- U as handleAnnotationWidget,
279
- V as handleAriaHasPopup,
280
- M as insertDateText,
281
- $ as unbindLayerEvents
269
+ W as annotationEventsHandler,
270
+ L as bindLayerEvents,
271
+ U as enhanceLinkAccessibility,
272
+ S as fixTabIndexAccessibility,
273
+ R as handleAnnotationLink,
274
+ F as handleAnnotationWidget,
275
+ E as insertDateText,
276
+ C as unbindLayerEvents
282
277
  };
@@ -1,15 +1,21 @@
1
- const d = (e, t, o) => e * o + t + 1, a = (e, t) => {
2
- const o = e - 1, n = Math.floor(o / t), s = (o - n * t) % t;
3
- return { rowIndex: n, columnIndex: s };
4
- }, h = (e, t) => {
5
- const o = [], n = [];
6
- return e.heights.forEach((s, c) => {
7
- const r = a(c + 1, t), i = e.widths[c];
8
- o[r.rowIndex] = Math.max(o[r.rowIndex] || 0, s), n[r.columnIndex] = Math.max(n[r.columnIndex] || 0, i);
9
- }), { rowsHeight: o, columnsWidth: n };
1
+ const d = (o, e, s, t = !1) => t ? o === 0 ? e === 0 ? 1 : -1 : 1 + (o - 1) * s + e + 1 : o * s + e + 1, g = (o, e, s = !1) => {
2
+ if (s) {
3
+ if (o === 1)
4
+ return { rowIndex: 0, columnIndex: 0 };
5
+ const n = o - 1 - 1, f = Math.floor(n / e) + 1, i = n % e;
6
+ return { rowIndex: f, columnIndex: i };
7
+ }
8
+ const t = o - 1, r = Math.floor(t / e), c = (t - r * e) % e;
9
+ return { rowIndex: r, columnIndex: c };
10
+ }, x = (o, e, s = !1) => {
11
+ const t = [], r = [];
12
+ return o.heights.forEach((c, a) => {
13
+ const n = g(a + 1, e, s), f = o.widths[a];
14
+ t[n.rowIndex] = Math.max(t[n.rowIndex] || 0, c), r[n.columnIndex] = Math.max(r[n.columnIndex] || 0, f);
15
+ }), { rowsHeight: t, columnsWidth: r };
10
16
  };
11
17
  export {
12
- h as getGridDimension,
18
+ x as getGridDimension,
13
19
  d as getPageFromPosition,
14
- a as getPositionFromPage
20
+ g as getPositionFromPage
15
21
  };
@@ -1,24 +1,24 @@
1
- import { SCROLL_BAR_WIDTH as n, PAGE_PADDING as f } from "./constants.js";
2
- import { ViewMode as i, ZoomLevel as r } from "./types.js";
3
- import "../th_TH-d627cd51.js";
4
- const D = (o, t, a, e, A, c) => {
1
+ import { SCROLL_BAR_WIDTH as a, PAGE_PADDING as f } from "./constants.js";
2
+ import { ViewMode as A, ZoomLevel as r } from "./types.js";
3
+ import "../de_DE-a553b162.js";
4
+ const E = (o, t, _, e, c, m) => {
5
5
  if (typeof o == "number")
6
6
  return o;
7
- const m = c === i.DUAL_PAGE ? 2 * e : e;
7
+ const n = m === A.DUAL_PAGE || m === A.DUAL_PAGE_WITH_COVER ? 2 * e : e;
8
8
  switch (o) {
9
9
  case r.PAGE_FIT:
10
10
  const s = Math.min(
11
- (t - n) / m,
12
- (a - f) / A
11
+ (t - a) / n,
12
+ (_ - f) / c
13
13
  );
14
14
  return Math.floor(s * 100);
15
15
  case r.PAGE_WIDTH:
16
- return Math.floor((t - n) / m * 100);
16
+ return Math.floor((t - a) / n * 100);
17
17
  case r.ACTUAL:
18
18
  default:
19
19
  return 100;
20
20
  }
21
21
  };
22
22
  export {
23
- D as getZoomLevel
23
+ E as getZoomLevel
24
24
  };