@react-pdf-kit/viewer 2.0.0-beta.1 → 2.0.0-beta.10

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 (150) hide show
  1. package/README.md +6 -6
  2. package/dist/Combination-54a77a7a.js +701 -0
  3. package/dist/MostPageTool.module-13578ad6.js +6 -0
  4. package/dist/OtherTool.module-a4be5f1f.js +6 -0
  5. package/dist/Paginate.module-206a7d7d.js +8 -0
  6. package/dist/PaginationContext-9217cab4.js +201 -0
  7. package/dist/{LayoutWrapper-6224491f.js → RPLayout.module-967bf4bc.js} +3 -9
  8. package/dist/RPToolbar.module-27d7fe77.js +10 -0
  9. package/dist/SearchTool.module-99f60dc7.js +16 -0
  10. package/dist/ToolbarLayout.module-1fee0a18.js +11 -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 -31
  14. package/dist/components/RPConfig.js +10 -1485
  15. package/dist/components/RPController.js +77 -148
  16. package/dist/components/RPPages.js +981 -124
  17. package/dist/components/RPProvider.js +56 -118
  18. package/dist/components/icons/DualPageIcon.js +6 -6
  19. package/dist/components/icons/SinglePageIcon.js +6 -6
  20. package/dist/components/layout/LayoutContainer.js +31 -138
  21. package/dist/components/layout/LayoutWrapper.js +8 -4
  22. package/dist/components/layout/RPDefaultLayout.js +162 -88
  23. package/dist/components/layout/RPLayout.js +119 -107
  24. package/dist/components/layout/sidebar/RPSidebar.js +83 -113
  25. package/dist/components/layout/sidebar/Thumbnail.js +120 -126
  26. package/dist/components/layout/sidebar/Thumbnails.js +56 -121
  27. package/dist/components/layout/toolbar/DarkModeTool.js +6 -4
  28. package/dist/components/layout/toolbar/DocumentDialog.js +304 -132
  29. package/dist/components/layout/toolbar/DocumentProperties.js +12 -9
  30. package/dist/components/layout/toolbar/FileDownloadTool.js +34 -126
  31. package/dist/components/layout/toolbar/FileUploadTool.js +8 -5
  32. package/dist/components/layout/toolbar/FullScreenTool.js +16 -13
  33. package/dist/components/layout/toolbar/MenuItem.js +11 -8
  34. package/dist/components/layout/toolbar/MenuSeparator.js +8 -5
  35. package/dist/components/layout/toolbar/MostPageTool.js +64 -125
  36. package/dist/components/layout/toolbar/OtherTool.js +162 -114
  37. package/dist/components/layout/toolbar/Paginate.js +113 -117
  38. package/dist/components/layout/toolbar/PrintTool.js +55 -125
  39. package/dist/components/layout/toolbar/RPMenuItem.js +14 -11
  40. package/dist/components/layout/toolbar/RPMoreOptions.js +66 -121
  41. package/dist/components/layout/toolbar/RPToolbar.js +89 -81
  42. package/dist/components/layout/toolbar/RPToolbarEnd.js +68 -90
  43. package/dist/components/layout/toolbar/RotateTool.js +12 -9
  44. package/dist/components/layout/toolbar/ScrollModeTool.js +14 -11
  45. package/dist/components/layout/toolbar/SearchCloseButton.js +23 -9
  46. package/dist/components/layout/toolbar/SearchResultNavigator.js +53 -106
  47. package/dist/components/layout/toolbar/SearchTool.js +222 -121
  48. package/dist/components/layout/toolbar/SelectionModeTool.js +8 -5
  49. package/dist/components/layout/toolbar/ThumbnailTool.js +15 -124
  50. package/dist/components/layout/toolbar/ToolbarCustom.js +44 -130
  51. package/dist/components/layout/toolbar/ToolbarDefault.js +122 -120
  52. package/dist/components/layout/toolbar/ToolbarLayout.js +85 -83
  53. package/dist/components/layout/toolbar/ViewModeTool.js +10 -7
  54. package/dist/components/layout/toolbar/ZoomTool.js +128 -120
  55. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +17 -123
  56. package/dist/components/layout/toolbar/tools/DualPageTool.js +26 -0
  57. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +10 -121
  58. package/dist/components/layout/toolbar/tools/FileUploadTool.js +6 -4
  59. package/dist/components/layout/toolbar/tools/FullScreenTool.js +13 -11
  60. package/dist/components/layout/toolbar/tools/InputPageTool.js +19 -112
  61. package/dist/components/layout/toolbar/tools/NextPageTool.js +30 -123
  62. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +16 -109
  63. package/dist/components/layout/toolbar/tools/PrintTool.js +12 -123
  64. package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +6 -4
  65. package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +6 -4
  66. package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +31 -0
  67. package/dist/components/layout/toolbar/tools/SinglePageTool.js +26 -0
  68. package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +6 -4
  69. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +17 -128
  70. package/dist/components/layout/toolbar/tools/ZoomInTool.js +6 -4
  71. package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +22 -137
  72. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +26 -123
  73. package/dist/components/layout/toolbar/tools/ZoomOutTool.js +6 -4
  74. package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +95 -105
  75. package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +16 -125
  76. package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +8 -5
  77. package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +10 -117
  78. package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +12 -120
  79. package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +10 -7
  80. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +36 -125
  81. package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +16 -123
  82. package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +14 -11
  83. package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +15 -12
  84. package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +18 -15
  85. package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +10 -7
  86. package/dist/components/page/AnnotationLayer.js +122 -126
  87. package/dist/components/page/CanvasLayer.js +54 -125
  88. package/dist/components/page/DualPage.js +68 -111
  89. package/dist/components/page/RPPage.js +126 -125
  90. package/dist/components/page/SinglePage.js +58 -111
  91. package/dist/components/page/TextHighlightLayer.js +184 -128
  92. package/dist/components/page/TextLayer.js +184 -125
  93. package/dist/components/ui/Checkbox.js +25 -24
  94. package/dist/components/ui/DropDown.js +11 -8
  95. package/dist/components/ui/LoadingIndicator.js +34 -129
  96. package/dist/components/ui/RPTooltip.js +412 -196
  97. package/dist/contexts/ElementPageContext.js +1 -1
  98. package/dist/contexts/FullScreenContext.js +17 -10
  99. package/dist/contexts/LocalizationContext.js +24 -29
  100. package/dist/contexts/PaginationContext.js +14 -119
  101. package/dist/contexts/PrintContext.js +67 -133
  102. package/dist/contexts/RPDocumentContext.js +32 -24
  103. package/dist/contexts/RenderQueueProvider.js +47 -119
  104. package/dist/contexts/SearchContext.js +65 -113
  105. package/dist/contexts/ThumbnailsContext.js +32 -133
  106. package/dist/contexts/ZoomContext.js +22 -22
  107. package/dist/floating-ui.react-dom-5ec29bd6.js +1327 -0
  108. package/dist/index-4baea9b5.js +1198 -0
  109. package/dist/index-655864a7.js +27 -0
  110. package/dist/{index-c9a2990a.js → index-c0faa594.js} +64 -87
  111. package/dist/index-e3ee9457.js +150 -0
  112. package/dist/main.js +193 -142
  113. package/dist/types/components/icons/DualPageIcon.d.ts +1 -1
  114. package/dist/types/components/icons/SinglePageIcon.d.ts +1 -1
  115. package/dist/types/components/layout/toolbar/tools/DualPageTool.d.ts +3 -0
  116. package/dist/types/components/layout/toolbar/tools/SelectionModeSwitcherTool.d.ts +3 -0
  117. package/dist/types/components/layout/toolbar/tools/SinglePageTool.d.ts +3 -0
  118. package/dist/types/contexts/RenderQueueProvider.d.ts +2 -2
  119. package/dist/types/main.d.ts +5 -5
  120. package/dist/types/utils/annotations.d.ts +2 -1
  121. package/dist/types/utils/getElementPositionInPage.d.ts +2 -2
  122. package/dist/types/utils/hooks/useCopyText.d.ts +1 -0
  123. package/dist/types/utils/hooks/usePrint.d.ts +3 -2
  124. package/dist/types/utils/hooks/useSearch.d.ts +1 -2
  125. package/dist/types/utils/renderPage.d.ts +2 -2
  126. package/dist/types/utils/types.d.ts +27 -4
  127. package/dist/utils/annotations.js +128 -142
  128. package/dist/utils/getWordPositionInPage.js +5 -5
  129. package/dist/utils/highlight.js +72 -72
  130. package/dist/utils/hooks/useCopyText.js +36 -0
  131. package/dist/utils/hooks/useFileDownload.js +20 -129
  132. package/dist/utils/hooks/useHighlight.js +28 -28
  133. package/dist/utils/hooks/useLicense.js +1 -1
  134. package/dist/utils/hooks/useLoadPdf.js +42 -39
  135. package/dist/utils/hooks/useLoadWorker.js +9 -6
  136. package/dist/utils/hooks/useLocalization.js +13 -13
  137. package/dist/utils/hooks/usePaginate.js +21 -126
  138. package/dist/utils/hooks/usePresentPage.js +75 -127
  139. package/dist/utils/hooks/usePrint.js +173 -130
  140. package/dist/utils/hooks/useScrollToPage.js +15 -120
  141. package/dist/utils/hooks/useSearch.js +132 -126
  142. package/dist/utils/hooks/useThumbnail.js +47 -130
  143. package/dist/utils/hooks/useVirtualReactWindow.js +64 -128
  144. package/dist/utils/injectPrintCSS.js +1 -1
  145. package/dist/utils/renderPage.js +12 -10
  146. package/package.json +23 -20
  147. package/dist/SearchCloseButton-08d57275.js +0 -33
  148. package/dist/ToolbarLayout.module-37619c4b.js +0 -3548
  149. package/dist/index-808ea7bf.js +0 -1685
  150. package/dist/index-a48ec088.js +0 -1672
@@ -224,10 +224,11 @@ export interface DarkModeProps {
224
224
  export interface DarkMode extends DarkModeProps {
225
225
  onDarkModeChange: (value: boolean) => void;
226
226
  }
227
- export interface renderOptions {
227
+ export interface RenderOptions {
228
228
  scale?: number;
229
229
  rotate?: number;
230
230
  renderForms?: boolean;
231
+ interactiveForm?: boolean;
231
232
  }
232
233
  export interface License {
233
234
  validating?: boolean;
@@ -321,13 +322,18 @@ export interface PreparePrintProgress {
321
322
  totalPages: number;
322
323
  percentage: number;
323
324
  }
325
+ export interface PrintConfiguration {
326
+ visibleDefaultProgress?: boolean;
327
+ }
328
+ export type PrintOptions = PrintConfiguration | React.MouseEvent<{}>;
324
329
  export interface PrintToolProps {
325
- print: () => void;
330
+ print: (options?: PrintOptions) => Promise<void>;
326
331
  cancel: () => void;
327
332
  setOnProgress: (callback: (progress: PreparePrintProgress) => void) => void;
328
333
  setOnComplete: (callback: () => void) => void;
329
334
  setOnError: (callback: (error: Error) => void) => void;
330
335
  progress: PreparePrintProgress;
336
+ showDefaultProgress?: boolean;
331
337
  }
332
338
  export interface ThumbnailToolProps {
333
339
  onClick: () => void;
@@ -474,6 +480,7 @@ export interface RPControllerProps extends PropsWithChildren, DarkModeProviderPr
474
480
  localization?: LocalizationMap;
475
481
  downloadFilename?: string;
476
482
  initialSelectionMode?: SelectionMode;
483
+ interactiveForm?: boolean;
477
484
  }
478
485
  export interface RPConfigProps extends Omit<ConfigContextType, 'workerUrlAdded'>, RPThemeContextType, PropsWithChildren {
479
486
  workerUrl?: string;
@@ -508,6 +515,7 @@ export interface ZoomContextType {
508
515
  export type ZoomProps = Omit<ZoomContextType, 'currentZoom'>;
509
516
  export type InitialStateContextType = {
510
517
  instanceId: string;
518
+ interactiveForm?: boolean;
511
519
  } & ZoomProviderProps & PageProviderProps & ViewModeInitialProps & ScrollModeInitialProps & RotateProviderProps;
512
520
  export interface ZoomProviderProps {
513
521
  initialScale?: number | ZoomLevel;
@@ -541,6 +549,12 @@ export interface ScrollModeInitialProps {
541
549
  initialScrollMode?: ScrollMode;
542
550
  }
543
551
  export interface RectPosition {
552
+ left: number;
553
+ bottom: number;
554
+ width: number;
555
+ height: number;
556
+ }
557
+ export interface ElementPosition {
544
558
  left: number;
545
559
  top: number;
546
560
  width: number;
@@ -611,8 +625,7 @@ export interface SearchContextType {
611
625
  prevMatch: () => void;
612
626
  searchOptions: SearchOptions;
613
627
  setSearchOptions: Dispatch<SetStateAction<SearchOptions>>;
614
- currentMatchElement: HTMLElement | null;
615
- setCurrentMatchElement: Dispatch<SetStateAction<HTMLElement | null>>;
628
+ setCurrentMatchPosition: Dispatch<React.SetStateAction<number>>;
616
629
  }
617
630
  export declare enum SelectionMode {
618
631
  TEXT = "TEXT",
@@ -631,6 +644,9 @@ export interface LoadPDFOptions {
631
644
  onLoaded?: (pdfDocument: PDFDocumentProxy) => void;
632
645
  onLoadProgress?: (progress: number) => void;
633
646
  loaderImage?: LoaderImage;
647
+ disableAutoFetch?: boolean;
648
+ disableStream?: boolean;
649
+ rangeChunkSize?: number;
634
650
  }
635
651
  export interface ScrollPosition {
636
652
  left: number;
@@ -720,6 +736,13 @@ export interface ThemeSwitcherIcons {
720
736
  export interface ThemeSwitcherToolProps {
721
737
  icons?: ThemeSwitcherIcons;
722
738
  }
739
+ export interface SelectionModeSwitcherIcons {
740
+ textSelectionIcon?: React.ReactNode;
741
+ handModeIcon?: React.ReactNode;
742
+ }
743
+ export interface SelectionModeSwitcherToolProps {
744
+ icons?: SelectionModeSwitcherIcons;
745
+ }
723
746
  export interface ToolbarSection {
724
747
  component: React.ReactNode;
725
748
  }
@@ -1,20 +1,20 @@
1
- import { sanitizeExternalUrl as _ } from "./sanitizeExternalUrl.js";
1
+ import { sanitizeExternalUrl as I } from "./sanitizeExternalUrl.js";
2
2
  import { AnnotationType as l } from "./types.js";
3
- import { dateFormatter as L } from "./dateFormatter.js";
3
+ import { dateFormatter as B } from "./dateFormatter.js";
4
4
  import "../th_TH-d627cd51.js";
5
- const T = ["click", "dblclick", "input", "change"], m = /* @__PURE__ */ new Map(), v = (e, t) => `${e.loadingTask.docId}___${t.num}R${t.gen === 0 ? "" : t.gen}`;
6
- function I(e, t) {
7
- const n = v(e, t);
8
- return m.has(n) ? m.get(n) ?? null : null;
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;
9
9
  }
10
- const x = (e, t, n) => {
11
- m.set(v(e, t), n);
12
- }, A = (e, t) => {
10
+ const S = (e, t, n) => {
11
+ g.set(x(e, t), n);
12
+ }, T = (e, t) => {
13
13
  switch (t[1].name) {
14
14
  case "XYZ":
15
15
  return {
16
- bottomOffset: (n, a) => t[3] === null ? a : t[3],
17
- leftOffset: (n, a) => t[2] === null ? 0 : t[2],
16
+ bottomOffset: (n, s) => t[3] === null ? s : t[3],
17
+ leftOffset: (n, s) => t[2] === null ? 0 : t[2],
18
18
  pageIndex: e,
19
19
  scaleTo: t[4]
20
20
  };
@@ -42,110 +42,95 @@ const x = (e, t, n) => {
42
42
  scaleTo: 1
43
43
  };
44
44
  }
45
+ }, M = (e) => {
46
+ e && (() => {
47
+ const n = e == null ? void 0 : e.querySelectorAll(
48
+ '[data-l10n-id="pdfjs-annotation-date-time-string"]'
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));
53
+ });
54
+ })();
45
55
  };
46
56
  async function E(e, t) {
47
57
  let n;
48
58
  if (typeof t == "string" ? n = await e.getDestination(t) : n = t, n && typeof n[0] == "object" && n[0] !== null) {
49
- const a = n[0], s = I(e, a);
50
- if (s === null) {
51
- const r = await e.getPageIndex(a);
52
- return x(e, a, r), await E(e, n);
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);
53
63
  } else
54
- return A(s, n);
64
+ return T(a, n);
55
65
  } else
56
- return A(n[0], n);
66
+ return T(n[0], n);
57
67
  }
58
- const M = (e) => {
59
- const n = e.target.parentNode;
60
- if (!n)
61
- return;
62
- const a = new MutationObserver((s) => {
63
- s.forEach(() => {
64
- n.querySelectorAll(
65
- '[data-l10n-id="pdfjs-annotation-date-time-string"]'
66
- ).forEach((o) => {
67
- const c = o.getAttribute("data-l10n-args");
68
- if (c) {
69
- try {
70
- const { dateObj: i } = JSON.parse(c);
71
- i && (o.textContent = L(i));
72
- } catch {
73
- }
74
- a.disconnect();
75
- }
76
- });
77
- });
78
- });
79
- return a.observe(n, {
80
- childList: !0,
81
- // Watch for changes to child elements
82
- subtree: !0,
83
- // Watch all descendants, not just direct children
84
- attributes: !0
85
- // Watch for changes to attributes
86
- }), () => a.disconnect();
87
- };
88
- function H(e, t) {
89
- for (const n of T)
68
+ function P(e, t) {
69
+ for (const n of v)
90
70
  e.addEventListener(n, t);
91
71
  }
92
- function P(e, t) {
93
- for (const n of T)
72
+ function $(e, t) {
73
+ for (const n of v)
94
74
  e.removeEventListener(n, t);
95
75
  }
96
- function U(e) {
97
- const { id: t, url: n, unsafeUrl: a } = e;
98
- new MutationObserver((r, o) => {
76
+ function D(e) {
77
+ const { id: t, url: n, unsafeUrl: s } = e;
78
+ new MutationObserver((o, i) => {
99
79
  const c = document.querySelector(`[data-annotation-id="${t}"]`);
100
80
  if (c) {
101
- const i = c.querySelector("a"), p = _((n || a) ?? "", "");
102
- i && (i == null || i.setAttribute("target", "_blank"), i == null || i.setAttribute("href", p), i == null || i.setAttribute("rel", "noopener noreferrer")), o.disconnect();
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();
103
83
  }
104
84
  }).observe(document.body, { childList: !0, subtree: !0 });
105
85
  }
106
- function V(e, t, n) {
107
- const { rotation: a, scale: s } = t, r = a % 180 === 0;
86
+ function U(e, t, n) {
87
+ const { rotation: s, scale: a } = t, o = s % 180 === 0;
108
88
  if (e.fieldType === "Btn" && e.pushButton) {
109
- const o = e.rect[2] - e.rect[0], c = e.rect[3] - e.rect[1], i = document.createElement("canvas");
110
- i.setAttribute("width", ((r ? o : c) * s).toString()), i.setAttribute("height", ((r ? c : o) * s).toString()), n.set(e.id, i);
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);
111
91
  }
112
92
  }
113
- function B(e) {
114
- var r;
93
+ function V(e) {
94
+ var o;
115
95
  let t = e;
116
96
  for (; t.tagName !== "SECTION"; )
117
97
  t = t.parentElement;
118
- const n = t.getAttribute("aria-haspopup") === "dialog", a = t.classList.contains("popupAnnotation");
119
- if (!n && !a)
98
+ const n = t.getAttribute("aria-haspopup") === "dialog", s = t.classList.contains("popupAnnotation");
99
+ if (!n && !s)
120
100
  return;
121
- let s = t.id || t.getAttribute("aria-controls");
122
- if (s || (s = (r = t.firstChild) == null ? void 0 : r.id), s && t.parentElement) {
123
- const o = t.parentElement.querySelector(`[aria-controls="${s}"]`);
124
- o && new MutationObserver((i, p) => {
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) => {
125
105
  const b = document.querySelectorAll(".popupDate");
126
- b.length > 0 && (b.forEach((g) => {
127
- if (g.innerHTML)
106
+ b.length > 0 && (b.forEach((m) => {
107
+ if (m.innerHTML)
128
108
  return !1;
129
- const N = g.getAttribute("data-l10n-args");
109
+ const N = m.getAttribute("data-l10n-args");
130
110
  if (N) {
131
- const { date: h, time: y } = JSON.parse(N);
132
- h && y && (g.textContent = `${h}, ${y}`);
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
+ }
133
118
  }
134
119
  }), p.disconnect());
135
- }).observe(o, { childList: !0, subtree: !0 });
120
+ }).observe(i, { childList: !0, subtree: !0 });
136
121
  }
137
122
  }
138
123
  function d(e, t, n) {
139
- const a = [];
124
+ const s = [];
140
125
  if (n)
141
- for (const s of n)
142
- s[e] === t && a.push(s);
143
- return a;
126
+ for (const a of n)
127
+ a[e] === t && s.push(a);
128
+ return s;
144
129
  }
145
130
  function u(e, t) {
146
131
  return { type: e, data: t };
147
132
  }
148
- async function w(e, t) {
133
+ async function k(e, t) {
149
134
  if (e.dest)
150
135
  if (typeof e.dest == "string") {
151
136
  const n = await E(t, e.dest);
@@ -169,17 +154,17 @@ async function w(e, t) {
169
154
  unsafeUrl: e.unsafeUrl
170
155
  });
171
156
  }
172
- function O(e) {
157
+ function y(e) {
173
158
  for (const t of e.getElementsByTagName("span")) {
174
159
  let n = t.textContent;
175
- const a = JSON.parse(t.dataset.l10nArgs ?? "{}");
160
+ const s = JSON.parse(t.dataset.l10nArgs ?? "{}");
176
161
  if (n)
177
- for (const s in a)
178
- n = n.replace(`{{${s}}}`, a[s]);
162
+ for (const a in s)
163
+ n = n.replace(`{{${a}}}`, s[a]);
179
164
  t.textContent = n;
180
165
  }
181
166
  }
182
- function S(e) {
167
+ function w(e) {
183
168
  return u(l.FILE_ATTACHMENT, e.file);
184
169
  }
185
170
  function f(e, t) {
@@ -193,20 +178,20 @@ function f(e, t) {
193
178
  case "select-one":
194
179
  case "select-multiple":
195
180
  const n = [];
196
- for (const s of e.options)
181
+ for (const a of e.options)
197
182
  n.push({
198
- value: s.value,
199
- label: s.label
183
+ value: a.value,
184
+ label: a.label
200
185
  });
201
- const a = [];
202
- for (const s of e.selectedOptions)
203
- a.push({
204
- value: s.value,
205
- label: s.label
186
+ const s = [];
187
+ for (const a of e.selectedOptions)
188
+ s.push({
189
+ value: a.value,
190
+ label: a.label
206
191
  });
207
192
  return u(l.FORM_SELECT, {
208
193
  fieldName: e.name,
209
- value: a,
194
+ value: s,
210
195
  options: n
211
196
  });
212
197
  case "checkbox":
@@ -226,71 +211,72 @@ function f(e, t) {
226
211
  });
227
212
  }
228
213
  }
229
- async function $(e, t, n) {
230
- var s;
231
- let a = e.target.parentNode;
232
- if (a.tagName === "DIV" && (a = a.firstChild), B(a), typeof a.className != "object")
233
- if (a.className === "linkAnnotation" && e.type === "click") {
234
- const r = (s = a.dataset) == null ? void 0 : s.annotationId;
235
- if (r) {
236
- const o = d("id", r, n);
237
- if (o.length)
238
- return await w(o[0], t);
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);
222
+ if (i.length)
223
+ return await k(i[0], t);
239
224
  }
240
225
  } else if (
241
226
  /* annotation.className.includes('popupAnnotation') || */
242
- a.className.includes("textAnnotation")
227
+ s.className.includes("textAnnotation")
243
228
  )
244
- O(a);
245
- else if (a.className.includes("fileAttachmentAnnotation")) {
246
- O(a);
247
- const r = a.dataset.annotationId;
248
- if (r && e.type === "dblclick")
249
- return S(d("id", r, n)[0]);
250
- } else if (a.className.includes("textWidgetAnnotation") && e.type === "input") {
251
- let r = a.getElementsByTagName("input")[0];
252
- return r || (r = a.getElementsByTagName("textarea")[0]), f(r);
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);
253
238
  } else {
254
- if (a.className.includes("choiceWidgetAnnotation") && e.type === "input")
255
- return f(a.getElementsByTagName("select")[0]);
256
- if (a.className.includes("buttonWidgetAnnotation checkBox") && e.type === "change")
257
- return f(a.getElementsByTagName("input")[0]);
258
- if (a.className.includes("buttonWidgetAnnotation radioButton") && e.type === "change") {
259
- const r = a.dataset.annotationId;
260
- if (r) {
261
- const o = d("id", r, n)[0], c = [];
262
- for (const i of d(
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 = [];
247
+ for (const r of d(
263
248
  "fieldName",
264
- o.fieldName,
249
+ i.fieldName,
265
250
  n
266
251
  ))
267
- i.buttonValue && c.push(i.buttonValue);
268
- return f(a.getElementsByTagName("input")[0], {
269
- value: o.buttonValue,
270
- defaultValue: o.fieldValue,
252
+ r.buttonValue && c.push(r.buttonValue);
253
+ return f(s.getElementsByTagName("input")[0], {
254
+ value: i.buttonValue,
255
+ defaultValue: i.fieldValue,
271
256
  options: c
272
257
  });
273
258
  }
274
- } else if (a.className.includes("buttonWidgetAnnotation pushButton") && e.type === "click") {
275
- const r = a.dataset.annotationId;
276
- if (r) {
277
- const o = d("id", r, n)[0], { action: c } = o;
278
- return c && ["Print", "SaveAs"].includes(c) ? { type: l.BUTTON, data: o } : o.resetForm ? f(
279
- { name: o.fieldName, type: "button" },
280
- { actions: o.actions, reset: !0 }
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;
263
+ return c && ["Print", "SaveAs"].includes(c) ? { type: l.BUTTON, data: i } : i.resetForm ? f(
264
+ { name: i.fieldName, type: "button" },
265
+ { actions: i.actions, reset: !0 }
281
266
  ) : f(
282
- { name: o.fieldName, type: "button" },
283
- { actions: o.actions, reset: !1 }
267
+ { name: i.fieldName, type: "button" },
268
+ { actions: i.actions, reset: !1 }
284
269
  );
285
270
  }
286
271
  }
287
272
  }
288
273
  }
289
274
  export {
290
- $ as annotationEventsHandler,
291
- M as annotationsEvents,
292
- H as bindLayerEvents,
293
- U as handleAnnotationLink,
294
- V as handleAnnotationWidget,
295
- P as unbindLayerEvents
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
296
282
  };
@@ -1,5 +1,5 @@
1
1
  const a = (i, h, l, o, n) => {
2
- const c = l.height * o, s = l.width * o, y = l.top * o, w = l.left * o, d = {
2
+ const c = l.height * o, s = l.width * o, y = l.bottom * o, m = l.left * o, d = {
3
3
  width: n % 180 === 90 ? i.height : i.width,
4
4
  height: n % 180 === 90 ? i.width : i.height
5
5
  }, r = {
@@ -8,16 +8,16 @@ const a = (i, h, l, o, n) => {
8
8
  }, t = document.createElement("div");
9
9
  t.style.width = `${d.width}px`, t.style.height = `${d.height}px`, t.style.position = "absolute", t.style.transform = `rotate(${n}deg)`, t.style.transformOrigin = "center center", t.style.visibility = "hidden", t.style.left = "-99999px";
10
10
  const e = document.createElement("div");
11
- e.style.position = "absolute", e.style.width = `${s}px`, e.style.height = `${c}px`, e.style.position = "absolute", e.style.bottom = `${y}px`, e.style.left = `${w}px`, t.appendChild(e), h.appendChild(t);
12
- const p = t.getBoundingClientRect(), g = e.getBoundingClientRect();
11
+ e.style.position = "absolute", e.style.width = `${s}px`, e.style.height = `${c}px`, e.style.position = "absolute", e.style.bottom = `${y}px`, e.style.left = `${m}px`, t.appendChild(e), h.appendChild(t);
12
+ const g = t.getBoundingClientRect(), p = e.getBoundingClientRect();
13
13
  h.removeChild(t);
14
14
  const u = {
15
15
  top: h.clientHeight / 2,
16
16
  left: h.clientWidth / 2
17
17
  };
18
18
  return {
19
- leftInPage: g.left - p.left - u.left + r.width / 2,
20
- topInPage: g.top - p.top - u.top + r.height / 2
19
+ leftInPage: p.left - g.left - u.left + r.width / 2,
20
+ topInPage: p.top - g.top - u.top + r.height / 2
21
21
  };
22
22
  };
23
23
  export {