pdf-tsx 0.4.0 → 0.6.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 (103) hide show
  1. package/README.md +33 -6
  2. package/dist/cjs/components/PDFSidebar.cjs +1 -1
  3. package/dist/cjs/components/PDFViewer.cjs +1 -1
  4. package/dist/cjs/components/PDFViewer.module.cjs +1 -1
  5. package/dist/cjs/components/features/PDFAnnotations.cjs +1 -1
  6. package/dist/cjs/components/features/PDFAnnotations.module.cjs +1 -1
  7. package/dist/cjs/components/features/PDFAttachments.cjs +1 -0
  8. package/dist/cjs/components/features/PDFAttachments.module.cjs +1 -0
  9. package/dist/cjs/components/features/PDFChangeFile.cjs +1 -1
  10. package/dist/cjs/components/features/PDFDownloadButton.cjs +1 -1
  11. package/dist/cjs/components/features/PDFNavigation.cjs +1 -1
  12. package/dist/cjs/components/features/PDFOutline.cjs +1 -1
  13. package/dist/cjs/components/features/PDFPageFit.cjs +1 -1
  14. package/dist/cjs/components/features/PDFPrintButton.cjs +1 -1
  15. package/dist/cjs/components/features/PDFRotationControl.cjs +1 -1
  16. package/dist/cjs/components/features/PDFSearch.cjs +1 -1
  17. package/dist/cjs/components/features/PDFSidebarToggle.cjs +1 -1
  18. package/dist/cjs/components/features/PDFSignatures.cjs +1 -1
  19. package/dist/cjs/components/features/PDFSignatures.module.cjs +1 -1
  20. package/dist/cjs/components/features/PDFThemeToggle.cjs +1 -1
  21. package/dist/cjs/components/features/PDFThumbnails.cjs +1 -1
  22. package/dist/cjs/components/features/PDFThumbnails.module.cjs +1 -1
  23. package/dist/cjs/components/features/PDFZoomControls.cjs +1 -1
  24. package/dist/cjs/components/ui/icons.cjs +1 -1
  25. package/dist/cjs/context/ThemeContext.cjs +1 -1
  26. package/dist/cjs/context/themeContextValue.cjs +1 -0
  27. package/dist/cjs/hooks/useAnnotationLayer.cjs +1 -1
  28. package/dist/cjs/hooks/useAnnotations.cjs +1 -1
  29. package/dist/cjs/hooks/useAttachments.cjs +1 -0
  30. package/dist/cjs/hooks/useKeyboardShortcuts.cjs +1 -1
  31. package/dist/cjs/hooks/useOutline.cjs +1 -1
  32. package/dist/cjs/hooks/useOverlayRects.cjs +1 -0
  33. package/dist/cjs/hooks/usePDFLoader.cjs +1 -0
  34. package/dist/cjs/hooks/usePDFRenderer.cjs +1 -0
  35. package/dist/cjs/hooks/useScrollTracking.cjs +1 -1
  36. package/dist/cjs/hooks/useTextLayer.cjs +1 -1
  37. package/dist/cjs/hooks/useTextSearch.cjs +1 -1
  38. package/dist/cjs/hooks/useTheme.cjs +1 -0
  39. package/dist/cjs/hooks/useThumbnails.cjs +1 -1
  40. package/dist/cjs/index.cjs +1 -1
  41. package/dist/cjs/pdf-tsx.css +1 -1
  42. package/dist/cjs/theme.cjs +1 -1
  43. package/dist/components/PDFSidebar.d.ts +1 -2
  44. package/dist/components/features/PDFAttachments.d.ts +5 -0
  45. package/dist/components/features/PDFSidebarToggle.d.ts +1 -1
  46. package/dist/components/ui/icons.d.ts +0 -14
  47. package/dist/context/ThemeContext.d.ts +0 -6
  48. package/dist/context/themeContextValue.d.ts +7 -0
  49. package/dist/es/components/PDFSidebar.js +26 -33
  50. package/dist/es/components/PDFViewer.js +240 -269
  51. package/dist/es/components/PDFViewer.module.js +15 -15
  52. package/dist/es/components/features/PDFAnnotations.js +57 -64
  53. package/dist/es/components/features/PDFAnnotations.module.js +12 -12
  54. package/dist/es/components/features/PDFAttachments.js +117 -0
  55. package/dist/es/components/features/PDFAttachments.module.js +12 -0
  56. package/dist/es/components/features/PDFChangeFile.js +3 -3
  57. package/dist/es/components/features/PDFDownloadButton.js +2 -2
  58. package/dist/es/components/features/PDFNavigation.js +3 -3
  59. package/dist/es/components/features/PDFOutline.js +7 -7
  60. package/dist/es/components/features/PDFPageFit.js +1 -1
  61. package/dist/es/components/features/PDFPrintButton.js +5 -4
  62. package/dist/es/components/features/PDFRotationControl.js +1 -1
  63. package/dist/es/components/features/PDFSearch.js +4 -4
  64. package/dist/es/components/features/PDFSidebarToggle.js +10 -9
  65. package/dist/es/components/features/PDFSignatures.js +158 -116
  66. package/dist/es/components/features/PDFSignatures.module.js +16 -16
  67. package/dist/es/components/features/PDFThemeToggle.js +5 -5
  68. package/dist/es/components/features/PDFThumbnails.js +54 -30
  69. package/dist/es/components/features/PDFThumbnails.module.js +9 -7
  70. package/dist/es/components/features/PDFZoomControls.js +1 -1
  71. package/dist/es/components/ui/icons.js +1 -1
  72. package/dist/es/context/ThemeContext.js +20 -25
  73. package/dist/es/context/themeContextValue.js +5 -0
  74. package/dist/es/hooks/useAnnotationLayer.js +11 -11
  75. package/dist/es/hooks/useAnnotations.js +0 -1
  76. package/dist/es/hooks/useAttachments.js +31 -0
  77. package/dist/es/hooks/useKeyboardShortcuts.js +12 -15
  78. package/dist/es/hooks/useOutline.js +31 -12
  79. package/dist/es/hooks/useOverlayRects.js +72 -0
  80. package/dist/es/hooks/usePDFLoader.js +26 -0
  81. package/dist/es/hooks/usePDFRenderer.js +83 -0
  82. package/dist/es/hooks/useScrollTracking.js +21 -20
  83. package/dist/es/hooks/useTextLayer.js +13 -12
  84. package/dist/es/hooks/useTextSearch.js +30 -18
  85. package/dist/es/hooks/useTheme.js +10 -0
  86. package/dist/es/hooks/useThumbnails.js +86 -24
  87. package/dist/es/index.js +16 -15
  88. package/dist/es/pdf-tsx.css +1 -1
  89. package/dist/es/theme.js +6 -3
  90. package/dist/hooks/useAnnotationLayer.d.ts +2 -2
  91. package/dist/hooks/useAnnotations.d.ts +0 -5
  92. package/dist/hooks/useAttachments.d.ts +11 -0
  93. package/dist/hooks/useKeyboardShortcuts.d.ts +1 -2
  94. package/dist/hooks/useOverlayRects.d.ts +21 -0
  95. package/dist/hooks/usePDFLoader.d.ts +4 -0
  96. package/dist/hooks/usePDFRenderer.d.ts +16 -0
  97. package/dist/hooks/useScrollTracking.d.ts +2 -1
  98. package/dist/hooks/useTextLayer.d.ts +2 -2
  99. package/dist/hooks/useTheme.d.ts +2 -0
  100. package/dist/hooks/useThumbnails.d.ts +3 -2
  101. package/dist/index.d.ts +1 -0
  102. package/dist/theme.d.ts +1 -0
  103. package/package.json +1 -1
@@ -1,10 +1,11 @@
1
1
  import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
- import { useAnnotations as t } from "../../hooks/useAnnotations.js";
3
- import n from "./PDFAnnotations.module.js";
4
- import { c as r } from "react/compiler-runtime";
5
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
2
+ import { computeFit as t } from "../../utils/pdfFit.js";
3
+ import { useAnnotations as n } from "../../hooks/useAnnotations.js";
4
+ import r from "./PDFAnnotations.module.js";
5
+ import { c as i } from "react/compiler-runtime";
6
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
7
  //#region src/components/features/PDFAnnotations.tsx
7
- var o = {
8
+ var s = {
8
9
  Text: "Nota",
9
10
  Highlight: "Evidenziazione",
10
11
  Underline: "Sottolineatura",
@@ -17,89 +18,81 @@ var o = {
17
18
  Stamp: "Timbro",
18
19
  FileAttachment: "Allegato"
19
20
  };
20
- function s(e) {
21
- return e ? `rgb(${e.r}, ${e.g}, ${e.b})` : "#d4d4d8";
22
- }
23
21
  function c(e) {
24
- let t = r(22), { ann: c, onClick: l } = e, u = o[c.subtype] ?? c.subtype, d = `${n.card} ${c.rect ? n.cardClickable : ""}`, f;
25
- t[0] === c.color ? f = t[1] : (f = s(c.color), t[0] = c.color, t[1] = f);
26
- let p = `3px solid ${f}`, m;
27
- t[2] === p ? m = t[3] : (m = { borderLeft: p }, t[2] = p, t[3] = m);
22
+ let t = i(17), { ann: n, onClick: c } = e, l = s[n.subtype] ?? n.subtype, u = `${r.card} ${n.rect ? r.cardClickable : ""}`, d;
23
+ t[0] === l ? d = t[1] : (d = /* @__PURE__ */ a("span", {
24
+ className: r.cardLabel,
25
+ children: l
26
+ }), t[0] = l, t[1] = d);
27
+ let f;
28
+ t[2] === n.page ? f = t[3] : (f = /* @__PURE__ */ o("span", {
29
+ className: r.cardPage,
30
+ children: ["p.", n.page]
31
+ }), t[2] = n.page, t[3] = f);
32
+ let p;
33
+ t[4] !== d || t[5] !== f ? (p = /* @__PURE__ */ o("div", {
34
+ className: r.cardHeader,
35
+ children: [d, f]
36
+ }), t[4] = d, t[5] = f, t[6] = p) : p = t[6];
37
+ let m;
38
+ t[7] === n.title ? m = t[8] : (m = n.title && /* @__PURE__ */ a("div", {
39
+ className: r.cardAuthor,
40
+ children: n.title
41
+ }), t[7] = n.title, t[8] = m);
28
42
  let h;
29
- t[4] === u ? h = t[5] : (h = /* @__PURE__ */ i("span", {
30
- className: n.cardLabel,
31
- children: u
32
- }), t[4] = u, t[5] = h);
43
+ t[9] === n.contents ? h = t[10] : (h = n.contents && /* @__PURE__ */ a("div", {
44
+ className: r.cardContent,
45
+ children: n.contents
46
+ }), t[9] = n.contents, t[10] = h);
33
47
  let g;
34
- t[6] === c.page ? g = t[7] : (g = /* @__PURE__ */ a("span", {
35
- className: n.cardPage,
36
- children: ["p.", c.page]
37
- }), t[6] = c.page, t[7] = g);
38
- let _;
39
- t[8] !== h || t[9] !== g ? (_ = /* @__PURE__ */ a("div", {
40
- className: n.cardHeader,
41
- children: [h, g]
42
- }), t[8] = h, t[9] = g, t[10] = _) : _ = t[10];
43
- let v;
44
- t[11] === c.title ? v = t[12] : (v = c.title && /* @__PURE__ */ i("div", {
45
- className: n.cardAuthor,
46
- children: c.title
47
- }), t[11] = c.title, t[12] = v);
48
- let y;
49
- t[13] === c.contents ? y = t[14] : (y = c.contents && /* @__PURE__ */ i("div", {
50
- className: n.cardContent,
51
- children: c.contents
52
- }), t[13] = c.contents, t[14] = y);
53
- let b;
54
- return t[15] !== l || t[16] !== d || t[17] !== m || t[18] !== _ || t[19] !== v || t[20] !== y ? (b = /* @__PURE__ */ a("div", {
55
- className: d,
56
- style: m,
57
- onClick: l,
48
+ return t[11] !== c || t[12] !== u || t[13] !== p || t[14] !== m || t[15] !== h ? (g = /* @__PURE__ */ o("div", {
49
+ className: u,
50
+ onClick: c,
58
51
  children: [
59
- _,
60
- v,
61
- y
52
+ p,
53
+ m,
54
+ h
62
55
  ]
63
- }), t[15] = l, t[16] = d, t[17] = m, t[18] = _, t[19] = v, t[20] = y, t[21] = b) : b = t[21], b;
56
+ }), t[11] = c, t[12] = u, t[13] = p, t[14] = m, t[15] = h, t[16] = g) : g = t[16], g;
64
57
  }
65
- function l(o) {
66
- let s = r(8), { icon: c } = o, { pdf: l } = e(), u;
58
+ function l(t) {
59
+ let s = i(8), { icon: c } = t, { pdf: l } = e(), u;
67
60
  s[0] === l ? u = s[1] : (u = { pdf: l }, s[0] = l, s[1] = u);
68
- let { annotations: d, loading: f } = t(u), p = d.length, m;
69
- s[2] !== p || s[3] !== f ? (m = !f && p > 0 && /* @__PURE__ */ i("span", {
70
- className: n.badge,
61
+ let { annotations: d, loading: f } = n(u), p = d.length, m;
62
+ s[2] !== p || s[3] !== f ? (m = !f && p > 0 && /* @__PURE__ */ a("span", {
63
+ className: r.badge,
71
64
  children: p > 99 ? "99+" : p
72
65
  }), s[2] = p, s[3] = f, s[4] = m) : m = s[4];
73
66
  let h;
74
- return s[5] !== c || s[6] !== m ? (h = /* @__PURE__ */ a("span", {
75
- className: n.iconWrapper,
67
+ return s[5] !== c || s[6] !== m ? (h = /* @__PURE__ */ o("span", {
68
+ className: r.iconWrapper,
76
69
  children: [c, m]
77
70
  }), s[5] = c, s[6] = m, s[7] = h) : h = s[7], h;
78
71
  }
79
72
  function u() {
80
- let { pdf: r, goToPage: o, setHighlight: s } = e(), { annotations: l, loading: u } = t({ pdf: r }), d = (e) => {
81
- o(e.page), e.rect && s({
73
+ let { pdf: i, goToPage: s, setHighlight: l, setZoom: u, rotation: d, containerRef: f } = e(), { annotations: p, loading: m } = n({ pdf: i }), h = async (e) => {
74
+ i && f.current && u(await t("page", i, f.current, d)), s(e.page), e.rect && l({
82
75
  page: e.page,
83
76
  pdfRect: e.rect
84
77
  });
85
- }, f = l.reduce((e, t) => ((e[t.page] ??= []).push(t), e), {});
86
- return /* @__PURE__ */ a("div", {
87
- className: n.list,
78
+ }, g = p.reduce((e, t) => ((e[t.page] ??= []).push(t), e), {});
79
+ return /* @__PURE__ */ o("div", {
80
+ className: r.list,
88
81
  children: [
89
- u && /* @__PURE__ */ i("div", {
90
- className: n.emptyState,
82
+ m && /* @__PURE__ */ a("div", {
83
+ className: r.emptyState,
91
84
  children: "Caricamento..."
92
85
  }),
93
- !u && l.length === 0 && /* @__PURE__ */ i("div", {
94
- className: n.emptyState,
86
+ !m && p.length === 0 && /* @__PURE__ */ a("div", {
87
+ className: r.emptyState,
95
88
  children: "Nessuna annotazione rilevata."
96
89
  }),
97
- !u && Object.entries(f).map(([e, t]) => /* @__PURE__ */ a("div", { children: [/* @__PURE__ */ a("div", {
98
- className: n.pageHeader,
90
+ !m && Object.entries(g).map(([e, t]) => /* @__PURE__ */ o("div", { children: [/* @__PURE__ */ o("div", {
91
+ className: r.pageHeader,
99
92
  children: ["Pagina ", e]
100
- }), t.map((e) => /* @__PURE__ */ i(c, {
93
+ }), t.map((e) => /* @__PURE__ */ a(c, {
101
94
  ann: e,
102
- onClick: () => d(e)
95
+ onClick: () => h(e)
103
96
  }, e.id))] }, e))
104
97
  ]
105
98
  });
@@ -1,16 +1,16 @@
1
1
  var e = {
2
- list: "_list_10scn_1",
3
- emptyState: "_emptyState_10scn_11",
4
- pageHeader: "_pageHeader_10scn_23",
5
- card: "_card_10scn_45",
6
- cardClickable: "_cardClickable_10scn_65",
7
- cardHeader: "_cardHeader_10scn_81",
8
- cardLabel: "_cardLabel_10scn_95",
9
- cardPage: "_cardPage_10scn_107",
10
- cardAuthor: "_cardAuthor_10scn_117",
11
- cardContent: "_cardContent_10scn_129",
12
- iconWrapper: "_iconWrapper_10scn_141",
13
- badge: "_badge_10scn_155"
2
+ list: "_list_185ig_1",
3
+ emptyState: "_emptyState_185ig_11",
4
+ pageHeader: "_pageHeader_185ig_23",
5
+ card: "_card_185ig_45",
6
+ cardClickable: "_cardClickable_185ig_65",
7
+ cardHeader: "_cardHeader_185ig_81",
8
+ cardLabel: "_cardLabel_185ig_95",
9
+ cardPage: "_cardPage_185ig_107",
10
+ cardAuthor: "_cardAuthor_185ig_117",
11
+ cardContent: "_cardContent_185ig_129",
12
+ iconWrapper: "_iconWrapper_185ig_141",
13
+ badge: "_badge_185ig_155"
14
14
  };
15
15
  //#endregion
16
16
  export { e as default };
@@ -0,0 +1,117 @@
1
+ import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
+ import { useAttachments as t } from "../../hooks/useAttachments.js";
3
+ import n from "./PDFAttachments.module.js";
4
+ import { c as r } from "react/compiler-runtime";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ //#region src/components/features/PDFAttachments.tsx
7
+ function o() {
8
+ let e = r(1), t;
9
+ return e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ a("svg", {
10
+ width: "13",
11
+ height: "13",
12
+ viewBox: "0 0 13 13",
13
+ fill: "none",
14
+ "aria-hidden": !0,
15
+ children: [/* @__PURE__ */ i("path", {
16
+ d: "M6.5 1.5v7M3.5 6l3 3 3-3",
17
+ stroke: "currentColor",
18
+ strokeWidth: "1.5",
19
+ strokeLinecap: "round",
20
+ strokeLinejoin: "round"
21
+ }), /* @__PURE__ */ i("path", {
22
+ d: "M1.5 10.5h10",
23
+ stroke: "currentColor",
24
+ strokeWidth: "1.5",
25
+ strokeLinecap: "round"
26
+ })]
27
+ }), e[0] = t) : t = e[0], t;
28
+ }
29
+ function s() {
30
+ let e = r(1), t;
31
+ return e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ a("svg", {
32
+ width: "14",
33
+ height: "14",
34
+ viewBox: "0 0 14 14",
35
+ fill: "none",
36
+ "aria-hidden": !0,
37
+ children: [/* @__PURE__ */ i("path", {
38
+ d: "M3 1.5h5.5L11 4v8.5H3V1.5z",
39
+ stroke: "currentColor",
40
+ strokeWidth: "1.2",
41
+ strokeLinejoin: "round"
42
+ }), /* @__PURE__ */ i("path", {
43
+ d: "M8.5 1.5V4H11",
44
+ stroke: "currentColor",
45
+ strokeWidth: "1.2",
46
+ strokeLinejoin: "round"
47
+ })]
48
+ }), e[0] = t) : t = e[0], t;
49
+ }
50
+ function c(e) {
51
+ let t = new Blob([new Uint8Array(e.content)]), n = URL.createObjectURL(t), r = document.createElement("a");
52
+ r.href = n, r.download = e.filename, r.click(), URL.revokeObjectURL(n);
53
+ }
54
+ function l(o) {
55
+ let s = r(8), { icon: c } = o, { pdf: l } = e(), u;
56
+ s[0] === l ? u = s[1] : (u = { pdf: l }, s[0] = l, s[1] = u);
57
+ let { attachments: d, loading: f } = t(u), p = d.length, m;
58
+ s[2] !== p || s[3] !== f ? (m = !f && p > 0 && /* @__PURE__ */ i("span", {
59
+ className: n.badge,
60
+ children: p > 99 ? "99+" : p
61
+ }), s[2] = p, s[3] = f, s[4] = m) : m = s[4];
62
+ let h;
63
+ return s[5] !== c || s[6] !== m ? (h = /* @__PURE__ */ a("span", {
64
+ className: n.iconWrapper,
65
+ children: [c, m]
66
+ }), s[5] = c, s[6] = m, s[7] = h) : h = s[7], h;
67
+ }
68
+ function u() {
69
+ let o = r(14), { pdf: s } = e(), c;
70
+ o[0] === s ? c = o[1] : (c = { pdf: s }, o[0] = s, o[1] = c);
71
+ let { attachments: l, loading: u } = t(c), f;
72
+ o[2] === u ? f = o[3] : (f = u && /* @__PURE__ */ i("div", {
73
+ className: n.emptyState,
74
+ children: "Caricamento..."
75
+ }), o[2] = u, o[3] = f);
76
+ let p;
77
+ o[4] !== l || o[5] !== u ? (p = !u && l.length === 0 && /* @__PURE__ */ i("div", {
78
+ className: n.emptyState,
79
+ children: "Nessun allegato rilevato."
80
+ }), o[4] = l, o[5] = u, o[6] = p) : p = o[6];
81
+ let m;
82
+ o[7] !== l || o[8] !== u ? (m = !u && l.map(d), o[7] = l, o[8] = u, o[9] = m) : m = o[9];
83
+ let h;
84
+ return o[10] !== f || o[11] !== p || o[12] !== m ? (h = /* @__PURE__ */ a("div", {
85
+ className: n.list,
86
+ children: [
87
+ f,
88
+ p,
89
+ m
90
+ ]
91
+ }), o[10] = f, o[11] = p, o[12] = m, o[13] = h) : h = o[13], h;
92
+ }
93
+ function d(e, t) {
94
+ return /* @__PURE__ */ a("div", {
95
+ className: n.card,
96
+ children: [
97
+ /* @__PURE__ */ i("span", {
98
+ className: n.fileIcon,
99
+ children: /* @__PURE__ */ i(s, {})
100
+ }),
101
+ /* @__PURE__ */ i("span", {
102
+ className: n.filename,
103
+ title: e.filename,
104
+ children: e.filename
105
+ }),
106
+ /* @__PURE__ */ i("button", {
107
+ type: "button",
108
+ className: n.downloadBtn,
109
+ title: `Scarica ${e.filename}`,
110
+ onClick: () => c(e),
111
+ children: /* @__PURE__ */ i(o, {})
112
+ })
113
+ ]
114
+ }, t);
115
+ }
116
+ //#endregion
117
+ export { u as PDFAttachments, l as PDFAttachmentsIcon };
@@ -0,0 +1,12 @@
1
+ var e = {
2
+ list: "_list_8oiyp_1",
3
+ emptyState: "_emptyState_8oiyp_15",
4
+ card: "_card_8oiyp_29",
5
+ fileIcon: "_fileIcon_8oiyp_65",
6
+ filename: "_filename_8oiyp_79",
7
+ downloadBtn: "_downloadBtn_8oiyp_101",
8
+ iconWrapper: "_iconWrapper_8oiyp_153",
9
+ badge: "_badge_8oiyp_167"
10
+ };
11
+ //#endregion
12
+ export { e as default };
@@ -1,11 +1,11 @@
1
1
  import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
2
  import { ToolbarButton as t } from "../ui/ToolbarButton.js";
3
- import { useRef as n } from "react";
4
- import { c as r } from "react/compiler-runtime";
3
+ import { c as n } from "react/compiler-runtime";
4
+ import { useRef as r } from "react";
5
5
  import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
6
6
  //#region src/components/features/PDFChangeFile.tsx
7
7
  function s(s) {
8
- let c = r(11), { icon: l } = s, { onChangeFile: u } = e(), d = n(null), f;
8
+ let c = n(11), { icon: l } = s, { onChangeFile: u } = e(), d = r(null), f;
9
9
  c[0] === u ? f = c[1] : (f = (e) => {
10
10
  let t = e.target.files?.[0];
11
11
  t && u?.(t), e.target.value = "";
@@ -1,14 +1,14 @@
1
1
  import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
2
  import { ToolbarButton as t } from "../ui/ToolbarButton.js";
3
- import "react";
4
3
  import { c as n } from "react/compiler-runtime";
4
+ import "react";
5
5
  import { jsxs as r } from "react/jsx-runtime";
6
6
  //#region src/components/features/PDFDownloadButton.tsx
7
7
  function i(i) {
8
8
  let a = n(5), { icon: o } = i, { file: s } = e(), c;
9
9
  a[0] === s ? c = a[1] : (c = () => {
10
10
  let e = URL.createObjectURL(s), t = document.createElement("a");
11
- t.href = e, t.download = s.name || "documento.pdf", t.click(), URL.revokeObjectURL(e);
11
+ t.href = e, t.download = s.name || "documento.pdf", t.click(), setTimeout(() => URL.revokeObjectURL(e), 0);
12
12
  }, a[0] = s, a[1] = c);
13
13
  let l = c, u;
14
14
  return a[2] !== l || a[3] !== o ? (u = /* @__PURE__ */ r(t, {
@@ -1,12 +1,12 @@
1
1
  import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
2
  import { ToolbarButton as t } from "../ui/ToolbarButton.js";
3
3
  import n from "./PDFNavigation.module.js";
4
- import { useState as r } from "react";
5
- import { c as i } from "react/compiler-runtime";
4
+ import { c as r } from "react/compiler-runtime";
5
+ import { useState as i } from "react";
6
6
  import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
7
  //#region src/components/features/PDFNavigation.tsx
8
8
  function s(s) {
9
- let c = i(34), { prevIcon: l, nextIcon: u } = s, { currentPage: d, numPages: f, goToPage: p } = e(), [m, h] = r(!1), [g, _] = r(""), v;
9
+ let c = r(34), { prevIcon: l, nextIcon: u } = s, { currentPage: d, numPages: f, goToPage: p } = e(), [m, h] = i(!1), [g, _] = i(""), v;
10
10
  c[0] !== p || c[1] !== g ? (v = () => {
11
11
  let e = parseInt(g, 10);
12
12
  isNaN(e) || p(e), h(!1);
@@ -2,8 +2,8 @@ import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
2
  import { useOutline as t } from "../../hooks/useOutline.js";
3
3
  import { IconChevronDown as n, IconChevronRight as r } from "../ui/icons.js";
4
4
  import i from "./PDFOutline.module.js";
5
- import { useState as a } from "react";
6
- import { c as o } from "react/compiler-runtime";
5
+ import { c as a } from "react/compiler-runtime";
6
+ import { useState as o } from "react";
7
7
  import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
8
8
  //#region src/components/features/PDFOutline.tsx
9
9
  async function u(e, t) {
@@ -18,7 +18,7 @@ async function u(e, t) {
18
18
  }
19
19
  }
20
20
  function d(e) {
21
- let t = o(25), { node: u, depth: p, onNavigate: m } = e, [h, g] = a(p === 0), _ = u.items.length > 0, v = 12 + p * 14, y = u.bold ? 600 : 400, b = u.italic ? "italic" : "normal", x;
21
+ let t = a(25), { node: u, depth: p, onNavigate: m } = e, [h, g] = o(p === 0), _ = u.items.length > 0, v = 12 + p * 14, y = u.bold ? 600 : 400, b = u.italic ? "italic" : "normal", x;
22
22
  t[0] !== v || t[1] !== y || t[2] !== b ? (x = {
23
23
  paddingLeft: v,
24
24
  fontWeight: y,
@@ -63,13 +63,13 @@ function f(e) {
63
63
  return !e;
64
64
  }
65
65
  function p() {
66
- let n = o(18), { pdf: r, goToPage: a } = e(), s;
66
+ let n = a(18), { pdf: r, goToPage: o } = e(), s;
67
67
  n[0] === r ? s = n[1] : (s = { pdf: r }, n[0] = r, n[1] = s);
68
68
  let { outline: f, loading: p } = t(s), m;
69
- n[2] !== a || n[3] !== r ? (m = async (e) => {
69
+ n[2] !== o || n[3] !== r ? (m = async (e) => {
70
70
  let t = await u(r, e);
71
- t !== null && a(t);
72
- }, n[2] = a, n[3] = r, n[4] = m) : m = n[4];
71
+ t !== null && o(t);
72
+ }, n[2] = o, n[3] = r, n[4] = m) : m = n[4];
73
73
  let h = m, g;
74
74
  n[5] === p ? g = n[6] : (g = p && /* @__PURE__ */ c("div", {
75
75
  className: i.emptyState,
@@ -1,8 +1,8 @@
1
1
  import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
2
  import { computeFit as t } from "../../utils/pdfFit.js";
3
3
  import { ToolbarButton as n } from "../ui/ToolbarButton.js";
4
- import "react";
5
4
  import { c as r } from "react/compiler-runtime";
5
+ import "react";
6
6
  import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
7
7
  //#region src/components/features/PDFPageFit.tsx
8
8
  function s(s) {
@@ -1,7 +1,7 @@
1
1
  import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
2
  import { ToolbarButton as t } from "../ui/ToolbarButton.js";
3
- import "react";
4
3
  import { c as n } from "react/compiler-runtime";
4
+ import "react";
5
5
  import { jsx as r } from "react/jsx-runtime";
6
6
  //#region src/components/features/PDFPrintButton.tsx
7
7
  function i(i) {
@@ -9,9 +9,10 @@ function i(i) {
9
9
  a[0] === s ? c = a[1] : (c = () => {
10
10
  let e = URL.createObjectURL(s), t = document.createElement("iframe");
11
11
  t.style.display = "none", t.src = e, document.body.appendChild(t), t.onload = () => {
12
- t.contentWindow?.addEventListener("afterprint", () => {
13
- document.body.removeChild(t), URL.revokeObjectURL(e);
14
- }, { once: !0 }), t.contentWindow?.print();
12
+ let n = !1, r = () => {
13
+ n || (n = !0, t.remove(), URL.revokeObjectURL(e));
14
+ };
15
+ t.contentWindow?.addEventListener("afterprint", r, { once: !0 }), setTimeout(r, 6e4), t.contentWindow?.print();
15
16
  };
16
17
  }, a[0] = s, a[1] = c);
17
18
  let l = c, u;
@@ -1,7 +1,7 @@
1
1
  import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
2
  import { ToolbarButton as t } from "../ui/ToolbarButton.js";
3
- import "react";
4
3
  import { c as n } from "react/compiler-runtime";
4
+ import "react";
5
5
  import { jsx as r } from "react/jsx-runtime";
6
6
  //#region src/components/features/PDFRotationControl.tsx
7
7
  function i(i) {
@@ -1,18 +1,18 @@
1
1
  import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
2
2
  import { useTextSearch as t } from "../../hooks/useTextSearch.js";
3
3
  import n from "./PDFSearch.module.js";
4
- import { useEffect as r, useState as i } from "react";
5
- import { c as a } from "react/compiler-runtime";
4
+ import { c as r } from "react/compiler-runtime";
5
+ import { useEffect as i, useState as a } from "react";
6
6
  import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
7
7
  //#region src/components/features/PDFSearch.tsx
8
8
  function l(l) {
9
- let u = a(35), { searchIcon: d, prevIcon: f, nextIcon: p, clearIcon: m } = l, { pdf: h, goToPage: g, setHighlight: _, setSearchMatches: v } = e(), [y, b] = i(""), [x, S] = i(0), C;
9
+ let u = r(35), { searchIcon: d, prevIcon: f, nextIcon: p, clearIcon: m } = l, { pdf: h, goToPage: g, setHighlight: _, setSearchMatches: v } = e(), [y, b] = a(""), [x, S] = a(0), C;
10
10
  u[0] !== h || u[1] !== y ? (C = {
11
11
  pdf: h,
12
12
  query: y
13
13
  }, u[0] = h, u[1] = y, u[2] = C) : C = u[2];
14
14
  let { matches: w, searching: T } = t(C), E = w.length, D, O;
15
- u[3] !== w || u[4] !== v ? (D = () => (v(w), () => v([])), O = [w, v], u[3] = w, u[4] = v, u[5] = D, u[6] = O) : (D = u[5], O = u[6]), r(D, O);
15
+ u[3] !== w || u[4] !== v ? (D = () => (v(w), () => v([])), O = [w, v], u[3] = w, u[4] = v, u[5] = D, u[6] = O) : (D = u[5], O = u[6]), i(D, O);
16
16
  let k;
17
17
  u[7] !== g || u[8] !== w || u[9] !== _ || u[10] !== E ? (k = (e) => {
18
18
  let t = (e + E) % E;
@@ -4,17 +4,18 @@ import { c as n } from "react/compiler-runtime";
4
4
  import { jsx as r } from "react/jsx-runtime";
5
5
  //#region src/components/features/PDFSidebarToggle.tsx
6
6
  function i(i) {
7
- let a = n(5), { collapseIcon: o, expandIcon: s } = i, { sidebarCollapsed: c, setSidebarCollapsed: l } = e();
8
- if (!c) return null;
9
- let u;
10
- a[0] === l ? u = a[1] : (u = () => l(!1), a[0] = l, a[1] = u);
11
- let d = s ?? o, f;
12
- return a[2] !== u || a[3] !== d ? (f = /* @__PURE__ */ r("button", {
7
+ let o = n(6), { collapseIcon: s, expandIcon: c } = i, { sidebarCollapsed: l, setSidebarCollapsed: u } = e(), d = l ? c ?? s : s, f = l ? "Espandi sidebar" : "Comprimi sidebar", p;
8
+ o[0] === u ? p = o[1] : (p = () => u(a), o[0] = u, o[1] = p);
9
+ let m;
10
+ return o[2] !== d || o[3] !== p || o[4] !== f ? (m = /* @__PURE__ */ r("button", {
13
11
  className: t.btn,
14
- onClick: u,
15
- title: "Espandi sidebar",
12
+ onClick: p,
13
+ title: f,
16
14
  children: d
17
- }), a[2] = u, a[3] = d, a[4] = f) : f = a[4], f;
15
+ }), o[2] = d, o[3] = p, o[4] = f, o[5] = m) : m = o[5], m;
16
+ }
17
+ function a(e) {
18
+ return !e;
18
19
  }
19
20
  //#endregion
20
21
  export { i as PDFSidebarToggle };