@alfadocs/ui-kit-debug 0.60.0 → 0.63.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.
- package/dist/_chunks/finished-terminal-VjZ_-eDD.js +122 -0
- package/dist/_chunks/finished-terminal-VjZ_-eDD.js.map +1 -0
- package/dist/_chunks/pdf-viewer-chMpwpA4.js +979 -0
- package/dist/_chunks/pdf-viewer-chMpwpA4.js.map +1 -0
- package/dist/_chunks/{sign-document-BmAT0kKD.js → sign-document--nr5cxsB.js} +2 -2
- package/dist/_chunks/{sign-document-BmAT0kKD.js.map → sign-document--nr5cxsB.js.map} +1 -1
- package/dist/_chunks/signature-field-DbhbpLha.js +190 -0
- package/dist/_chunks/signature-field-DbhbpLha.js.map +1 -0
- package/dist/_chunks/use-countdown-Yd6ts0_a.js +26 -0
- package/dist/_chunks/use-countdown-Yd6ts0_a.js.map +1 -0
- package/dist/agent-catalog.json +15 -1
- package/dist/components/finished-terminal/finished-terminal.d.ts +55 -0
- package/dist/components/finished-terminal/finished-terminal.d.ts.map +1 -0
- package/dist/components/finished-terminal/index.d.ts +3 -0
- package/dist/components/finished-terminal/index.d.ts.map +1 -0
- package/dist/components/finished-terminal/index.js +5 -0
- package/dist/components/finished-terminal/index.js.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/pdf-viewer/index.js +1 -1
- package/dist/components/pdf-viewer/pdf-viewer.d.ts +7 -0
- package/dist/components/pdf-viewer/pdf-viewer.d.ts.map +1 -1
- package/dist/components/sign-document/index.js +1 -1
- package/dist/components/signature-field/index.js +1 -1
- package/dist/components/signature-field/signature-field.d.ts +8 -0
- package/dist/components/signature-field/signature-field.d.ts.map +1 -1
- package/dist/hooks/index.js +79 -99
- package/dist/hooks/index.js.map +1 -1
- package/dist/i18n/locales/ar.d.ts +5 -0
- package/dist/i18n/locales/ar.d.ts.map +1 -1
- package/dist/i18n/locales/ar.js +5 -0
- package/dist/i18n/locales/ar.js.map +1 -1
- package/dist/i18n/locales/de.d.ts +5 -0
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/de.js +5 -0
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/el.d.ts +5 -0
- package/dist/i18n/locales/el.d.ts.map +1 -1
- package/dist/i18n/locales/el.js +5 -0
- package/dist/i18n/locales/el.js.map +1 -1
- package/dist/i18n/locales/en.d.ts +5 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +5 -0
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +5 -0
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/es.js +5 -0
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +5 -0
- package/dist/i18n/locales/fr.d.ts.map +1 -1
- package/dist/i18n/locales/fr.js +5 -0
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hi.d.ts +5 -0
- package/dist/i18n/locales/hi.d.ts.map +1 -1
- package/dist/i18n/locales/hi.js +5 -0
- package/dist/i18n/locales/hi.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +5 -0
- package/dist/i18n/locales/it.d.ts.map +1 -1
- package/dist/i18n/locales/it.js +5 -0
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/ja.d.ts +5 -0
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/i18n/locales/ja.js +5 -0
- package/dist/i18n/locales/ja.js.map +1 -1
- package/dist/i18n/locales/nl.d.ts +5 -0
- package/dist/i18n/locales/nl.d.ts.map +1 -1
- package/dist/i18n/locales/nl.js +5 -0
- package/dist/i18n/locales/nl.js.map +1 -1
- package/dist/i18n/locales/pl.d.ts +5 -0
- package/dist/i18n/locales/pl.d.ts.map +1 -1
- package/dist/i18n/locales/pl.js +5 -0
- package/dist/i18n/locales/pl.js.map +1 -1
- package/dist/i18n/locales/pt.d.ts +5 -0
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/pt.js +5 -0
- package/dist/i18n/locales/pt.js.map +1 -1
- package/dist/i18n/locales/ro.d.ts +5 -0
- package/dist/i18n/locales/ro.d.ts.map +1 -1
- package/dist/i18n/locales/ro.js +5 -0
- package/dist/i18n/locales/ro.js.map +1 -1
- package/dist/i18n/locales/ru.d.ts +5 -0
- package/dist/i18n/locales/ru.d.ts.map +1 -1
- package/dist/i18n/locales/ru.js +5 -0
- package/dist/i18n/locales/ru.js.map +1 -1
- package/dist/i18n/locales/sq.d.ts +5 -0
- package/dist/i18n/locales/sq.d.ts.map +1 -1
- package/dist/i18n/locales/sq.js +5 -0
- package/dist/i18n/locales/sq.js.map +1 -1
- package/dist/i18n/locales/sv.d.ts +5 -0
- package/dist/i18n/locales/sv.d.ts.map +1 -1
- package/dist/i18n/locales/sv.js +5 -0
- package/dist/i18n/locales/sv.js.map +1 -1
- package/dist/i18n/locales/tr.d.ts +5 -0
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/locales/tr.js +5 -0
- package/dist/i18n/locales/tr.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +5 -0
- package/dist/i18n/locales/zh.d.ts.map +1 -1
- package/dist/i18n/locales/zh.js +5 -0
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.js +299 -297
- package/dist/index.js.map +1 -1
- package/dist/locales/ar.json +5 -0
- package/dist/locales/de.json +5 -0
- package/dist/locales/el.json +5 -0
- package/dist/locales/en.json +5 -0
- package/dist/locales/es.json +5 -0
- package/dist/locales/fr.json +5 -0
- package/dist/locales/hi.json +5 -0
- package/dist/locales/it.json +5 -0
- package/dist/locales/ja.json +5 -0
- package/dist/locales/nl.json +5 -0
- package/dist/locales/pl.json +5 -0
- package/dist/locales/pt.json +5 -0
- package/dist/locales/ro.json +5 -0
- package/dist/locales/ru.json +5 -0
- package/dist/locales/sq.json +5 -0
- package/dist/locales/sv.json +5 -0
- package/dist/locales/tr.json +5 -0
- package/dist/locales/zh.json +5 -0
- package/dist/tokens.css +1 -1
- package/package.json +7 -1
- package/dist/_chunks/pdf-viewer-XxWdtKfD.js +0 -965
- package/dist/_chunks/pdf-viewer-XxWdtKfD.js.map +0 -1
- package/dist/_chunks/signature-field-DhscKdgk.js +0 -152
- package/dist/_chunks/signature-field-DhscKdgk.js.map +0 -1
|
@@ -1,965 +0,0 @@
|
|
|
1
|
-
import { jsx as n, jsxs as B } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as Ee, useId as _e, useMemo as xe, useState as b, useEffect as C, useRef as V, useCallback as K, useImperativeHandle as Le } from "react";
|
|
3
|
-
import * as fe from "pdfjs-dist/legacy/build/pdf.min.mjs";
|
|
4
|
-
import { c as J } from "./index-D2ZczOXr.js";
|
|
5
|
-
import { useTranslation as pe } from "react-i18next";
|
|
6
|
-
import * as ee from "@radix-ui/react-popover";
|
|
7
|
-
import Ce from "pdfjs-dist/legacy/build/pdf.worker.min.mjs?url";
|
|
8
|
-
import { S as Ze } from "./spinner-OjQNn8oN.js";
|
|
9
|
-
import { A as we } from "./alert-_mUKLmwA.js";
|
|
10
|
-
import { u as Ke } from "./registry-nPAVE19X.js";
|
|
11
|
-
import { X as Be } from "./x-CCcI3eJp.js";
|
|
12
|
-
import { C as He } from "./chevron-left-CX1jqD2M.js";
|
|
13
|
-
import { C as Qe } from "./chevron-right-BrpYejk0.js";
|
|
14
|
-
import { c as De } from "./createLucideIcon-CrFbzy84.js";
|
|
15
|
-
import { S as We } from "./search-BonnQsHv.js";
|
|
16
|
-
import { P as qe } from "./printer-CeVEWfQq.js";
|
|
17
|
-
/**
|
|
18
|
-
* @license lucide-react v1.8.0 - ISC
|
|
19
|
-
*
|
|
20
|
-
* This source code is licensed under the ISC license.
|
|
21
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/
|
|
23
|
-
const Ue = [
|
|
24
|
-
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
25
|
-
["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
|
|
26
|
-
["line", { x1: "11", x2: "11", y1: "8", y2: "14", key: "1vmskp" }],
|
|
27
|
-
["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
|
|
28
|
-
], Je = De("zoom-in", Ue);
|
|
29
|
-
/**
|
|
30
|
-
* @license lucide-react v1.8.0 - ISC
|
|
31
|
-
*
|
|
32
|
-
* This source code is licensed under the ISC license.
|
|
33
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
34
|
-
*/
|
|
35
|
-
const $e = [
|
|
36
|
-
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
37
|
-
["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
|
|
38
|
-
["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
|
|
39
|
-
], Xe = De("zoom-out", $e), Ge = {
|
|
40
|
-
id: "pdf-viewer",
|
|
41
|
-
capabilities: ["paginate", "view_change", "filter"],
|
|
42
|
-
state: {},
|
|
43
|
-
actions: {
|
|
44
|
-
go_to_page: {
|
|
45
|
-
safety: "read",
|
|
46
|
-
argsType: "{ page: number }",
|
|
47
|
-
description: "Navigate to a specific 1-indexed page.",
|
|
48
|
-
invoke: (o, t) => {
|
|
49
|
-
o.goToPage(t.page);
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
set_zoom: {
|
|
53
|
-
safety: "read",
|
|
54
|
-
argsType: "{ zoom: PDFZoomPreset }",
|
|
55
|
-
description: "Apply a zoom preset.",
|
|
56
|
-
invoke: (o, t) => {
|
|
57
|
-
o.setZoom(t.zoom);
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
search: {
|
|
61
|
-
safety: "read",
|
|
62
|
-
argsType: "{ query: string }",
|
|
63
|
-
description: "Search the document for the given query and highlight matches.",
|
|
64
|
-
invoke: (o, t) => {
|
|
65
|
-
o.search(t.query);
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
print: {
|
|
69
|
-
safety: "read",
|
|
70
|
-
description: "Open the browser print dialog for the document.",
|
|
71
|
-
invoke: (o) => {
|
|
72
|
-
o.print();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
domHooks: {
|
|
77
|
-
root: { attr: "data-component", value: "pdf-viewer" },
|
|
78
|
-
instanceId: {
|
|
79
|
-
attr: "data-component-id",
|
|
80
|
-
sourceProp: "id",
|
|
81
|
-
description: "Sourced from the id prop."
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
fe.GlobalWorkerOptions.workerSrc = Ce;
|
|
86
|
-
const ke = J(
|
|
87
|
-
[
|
|
88
|
-
"ds:pdf-viewer-alfadocs ds:flex ds:flex-col",
|
|
89
|
-
// Allow the viewer to shrink below its content's intrinsic width when it
|
|
90
|
-
// sits in a constrained flex/grid context (mobile signing flows): without
|
|
91
|
-
// min-inline-size:0 the page canvas's natural width pins the flex item
|
|
92
|
-
// open, fit-width then measures that inflated width and never scales down.
|
|
93
|
-
"ds:min-w-0",
|
|
94
|
-
"ds:gap-[var(--spacing-sm)]",
|
|
95
|
-
"ds:bg-[var(--background)] ds:text-[var(--foreground)]",
|
|
96
|
-
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--card-border)] ds:[.theme-accessible_&]:border-2",
|
|
97
|
-
"ds:overflow-hidden",
|
|
98
|
-
"ds:focus-visible:outline-[length:var(--focus-ring-width)]",
|
|
99
|
-
"ds:focus-visible:outline-solid",
|
|
100
|
-
"ds:focus-visible:outline-[var(--ring)]",
|
|
101
|
-
"ds:forced-colors:focus-visible:outline-[CanvasText]"
|
|
102
|
-
].join(" ")
|
|
103
|
-
), Ye = J(
|
|
104
|
-
[
|
|
105
|
-
"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
|
|
106
|
-
"ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)]",
|
|
107
|
-
"ds:pt-[var(--spacing-xs)] ds:pb-[var(--spacing-xs)]",
|
|
108
|
-
"ds:bg-[var(--background)]",
|
|
109
|
-
"ds:border-b ds:border-[color:var(--border)]"
|
|
110
|
-
].join(" ")
|
|
111
|
-
), ze = J(
|
|
112
|
-
[
|
|
113
|
-
"ds:inline-flex ds:items-center ds:justify-center",
|
|
114
|
-
"ds:[min-block-size:var(--min-target-size)]",
|
|
115
|
-
"ds:[min-inline-size:var(--min-target-size)]",
|
|
116
|
-
"ds:gap-[var(--spacing-xs)]",
|
|
117
|
-
"ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)]",
|
|
118
|
-
"ds:rounded-[var(--radius-sm)] ds:bg-transparent ds:text-[var(--foreground)]",
|
|
119
|
-
"ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
|
|
120
|
-
"ds:hover:bg-[var(--muted)]",
|
|
121
|
-
"ds:focus-visible:outline-[length:var(--focus-ring-width)]",
|
|
122
|
-
"ds:focus-visible:outline-solid",
|
|
123
|
-
"ds:focus-visible:outline-[var(--ring)]",
|
|
124
|
-
"ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
125
|
-
"ds:forced-colors:focus-visible:outline-[CanvasText]",
|
|
126
|
-
"ds:aria-disabled:opacity-[var(--opacity-50)] ds:aria-disabled:cursor-not-allowed"
|
|
127
|
-
].join(" ")
|
|
128
|
-
), Pe = J(
|
|
129
|
-
[
|
|
130
|
-
"ds:[min-block-size:var(--min-target-size)]",
|
|
131
|
-
"ds:inline-size-[4rem] ds:text-center",
|
|
132
|
-
"ds:ps-[var(--spacing-xs)] ds:pe-[var(--spacing-xs)]",
|
|
133
|
-
"ds:rounded-[var(--radius-sm)] ds:border ds:border-[color:var(--border)]",
|
|
134
|
-
"ds:bg-[var(--background)] ds:text-[var(--foreground)]",
|
|
135
|
-
"ds:focus-visible:outline-[length:var(--focus-ring-width)]",
|
|
136
|
-
"ds:focus-visible:outline-solid",
|
|
137
|
-
"ds:focus-visible:outline-[var(--ring)]",
|
|
138
|
-
"ds:forced-colors:focus-visible:outline-[CanvasText]"
|
|
139
|
-
].join(" ")
|
|
140
|
-
), et = J(
|
|
141
|
-
[
|
|
142
|
-
"ds:[min-block-size:var(--min-target-size)]",
|
|
143
|
-
"ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)]",
|
|
144
|
-
"ds:rounded-[var(--radius-sm)] ds:border ds:border-[color:var(--border)]",
|
|
145
|
-
"ds:bg-[var(--background)] ds:text-[var(--foreground)]",
|
|
146
|
-
"ds:focus-visible:outline-[length:var(--focus-ring-width)]",
|
|
147
|
-
"ds:focus-visible:outline-solid",
|
|
148
|
-
"ds:focus-visible:outline-[var(--ring)]",
|
|
149
|
-
"ds:forced-colors:focus-visible:outline-[CanvasText]"
|
|
150
|
-
].join(" ")
|
|
151
|
-
), tt = J(
|
|
152
|
-
[
|
|
153
|
-
"ds:relative ds:flex ds:flex-col ds:items-center",
|
|
154
|
-
"ds:gap-[var(--spacing-md)]",
|
|
155
|
-
"ds:p-[var(--spacing-md)]",
|
|
156
|
-
"ds:bg-[var(--muted)]",
|
|
157
|
-
"ds:overflow-auto",
|
|
158
|
-
"ds:focus-visible:outline-[length:var(--focus-ring-width)]",
|
|
159
|
-
"ds:focus-visible:outline-solid",
|
|
160
|
-
"ds:focus-visible:outline-[var(--ring)]",
|
|
161
|
-
"ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
162
|
-
"ds:forced-colors:focus-visible:outline-[CanvasText]",
|
|
163
|
-
// NB: `min-block-size-[…]` / `max-block-size-[…]` arbitrary utilities don't
|
|
164
|
-
// generate any CSS in this Tailwind setup (silent no-op) — using them left
|
|
165
|
-
// the container uncapped, so it rendered all pages at full height and never
|
|
166
|
-
// scrolled, which froze the page tracker at 1 and broke SignDocument's
|
|
167
|
-
// read-to-end gate. `min-h`/`max-h` are block-axis height (writing-mode
|
|
168
|
-
// agnostic) and generate correctly.
|
|
169
|
-
"ds:min-h-[30rem]",
|
|
170
|
-
"ds:max-h-[80vh]"
|
|
171
|
-
].join(" ")
|
|
172
|
-
), rt = J(
|
|
173
|
-
[
|
|
174
|
-
"ds:relative ds:flex ds:items-center ds:justify-center",
|
|
175
|
-
"ds:bg-[var(--background)]",
|
|
176
|
-
"ds:shadow-[var(--shadow-md)]",
|
|
177
|
-
"ds:rounded-[var(--radius-sm)]"
|
|
178
|
-
].join(" ")
|
|
179
|
-
), nt = [
|
|
180
|
-
"fit-width",
|
|
181
|
-
"fit-page",
|
|
182
|
-
"actual-size",
|
|
183
|
-
0.5,
|
|
184
|
-
0.75,
|
|
185
|
-
1,
|
|
186
|
-
1.25,
|
|
187
|
-
1.5,
|
|
188
|
-
2
|
|
189
|
-
];
|
|
190
|
-
function X(o) {
|
|
191
|
-
return typeof o == "number";
|
|
192
|
-
}
|
|
193
|
-
function Se(o, t, f) {
|
|
194
|
-
if (X(o)) return o;
|
|
195
|
-
if (o === "actual-size" || !f) return 1;
|
|
196
|
-
const y = window.getComputedStyle(f), h = parseFloat(y.paddingInlineStart || "0") + parseFloat(y.paddingInlineEnd || "0"), g = parseFloat(y.paddingBlockStart || "0") + parseFloat(y.paddingBlockEnd || "0"), x = Math.max(f.clientWidth - h, 1), w = Math.max(f.clientHeight - g, 1), k = t.width, z = t.height;
|
|
197
|
-
return o === "fit-width" ? x / k : Math.min(x / k, w / z);
|
|
198
|
-
}
|
|
199
|
-
const st = Ee(
|
|
200
|
-
({
|
|
201
|
-
id: o,
|
|
202
|
-
src: t,
|
|
203
|
-
initialPage: f = 1,
|
|
204
|
-
initialZoom: y = "fit-width",
|
|
205
|
-
pageRotation: h,
|
|
206
|
-
renderPageOverlay: g,
|
|
207
|
-
onPageChange: x,
|
|
208
|
-
onLoadComplete: w,
|
|
209
|
-
onError: k,
|
|
210
|
-
toolbar: z = !0,
|
|
211
|
-
ariaLabel: T,
|
|
212
|
-
className: D
|
|
213
|
-
}, I) => {
|
|
214
|
-
const { t: d } = pe(), P = _e(), N = xe(
|
|
215
|
-
() => `pdf-${P.replace(/[^a-zA-Z0-9-_]/g, "")}`,
|
|
216
|
-
[P]
|
|
217
|
-
), [v, E] = b(!1), [p, H] = b(!1);
|
|
218
|
-
C(() => {
|
|
219
|
-
if (typeof document > "u") return;
|
|
220
|
-
E(document.documentElement.dir === "rtl");
|
|
221
|
-
const e = window.matchMedia("(prefers-reduced-motion: reduce)"), r = () => H(e.matches);
|
|
222
|
-
return r(), e.addEventListener("change", r), () => e.removeEventListener("change", r);
|
|
223
|
-
}, []);
|
|
224
|
-
const [a, Q] = b(null), [W, c] = b(null), [l, A] = b(f), [S, m] = b(y), [s, M] = b({ start: Math.max(1, f - 1), end: f + 1 }), [_, te] = b(""), [G, L] = b(!1), [O, me] = b(""), [Ie, Re] = b({ current: 0, total: 0 }), re = V(x), ne = V(w), se = V(k);
|
|
225
|
-
C(() => {
|
|
226
|
-
re.current = x, ne.current = w, se.current = k;
|
|
227
|
-
}, [x, w, k]);
|
|
228
|
-
const de = V(null);
|
|
229
|
-
C(() => {
|
|
230
|
-
de.current = a;
|
|
231
|
-
}, [a]), C(() => {
|
|
232
|
-
let e = !1;
|
|
233
|
-
Q(null), c(null);
|
|
234
|
-
const r = {
|
|
235
|
-
disableJavaScript: !0,
|
|
236
|
-
isEvalSupported: !1
|
|
237
|
-
}, u = fe.getDocument(
|
|
238
|
-
typeof t == "string" ? { url: t, ...r } : t instanceof Uint8Array ? { data: t, ...r } : { data: new Uint8Array(t), ...r }
|
|
239
|
-
);
|
|
240
|
-
return u.promise.then(
|
|
241
|
-
async (i) => {
|
|
242
|
-
var q;
|
|
243
|
-
if (e) return;
|
|
244
|
-
let R;
|
|
245
|
-
try {
|
|
246
|
-
const U = await i.getMetadata(), F = U == null ? void 0 : U.info;
|
|
247
|
-
R = F == null ? void 0 : F.Title;
|
|
248
|
-
} catch {
|
|
249
|
-
R = void 0;
|
|
250
|
-
}
|
|
251
|
-
if (e) {
|
|
252
|
-
try {
|
|
253
|
-
await i.destroy();
|
|
254
|
-
} catch {
|
|
255
|
-
}
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
const Z = { doc: i, numPages: i.numPages, title: R };
|
|
259
|
-
Q(Z), (q = ne.current) == null || q.call(ne, { numPages: i.numPages, title: R });
|
|
260
|
-
},
|
|
261
|
-
(i) => {
|
|
262
|
-
var Z;
|
|
263
|
-
if (e) return;
|
|
264
|
-
const R = i instanceof Error ? i : new Error(String(i));
|
|
265
|
-
c(R), (Z = se.current) == null || Z.call(se, R);
|
|
266
|
-
}
|
|
267
|
-
), () => {
|
|
268
|
-
e = !0, u.destroy();
|
|
269
|
-
const i = de.current;
|
|
270
|
-
if (i) {
|
|
271
|
-
try {
|
|
272
|
-
i.doc.destroy();
|
|
273
|
-
} catch {
|
|
274
|
-
}
|
|
275
|
-
de.current = null;
|
|
276
|
-
}
|
|
277
|
-
};
|
|
278
|
-
}, [t]), C(() => {
|
|
279
|
-
var e;
|
|
280
|
-
a && (te(
|
|
281
|
-
d("pdf.pageOf", { current: l, total: a.numPages })
|
|
282
|
-
), (e = re.current) == null || e.call(re, l));
|
|
283
|
-
}, [l, a, d]);
|
|
284
|
-
const ae = V(null), ce = V([]), j = K(
|
|
285
|
-
(e) => {
|
|
286
|
-
if (!a) return;
|
|
287
|
-
const r = Math.max(1, Math.min(e, a.numPages));
|
|
288
|
-
A(r);
|
|
289
|
-
const u = ce.current[r - 1];
|
|
290
|
-
u && u.scrollIntoView({
|
|
291
|
-
behavior: "auto",
|
|
292
|
-
block: "start"
|
|
293
|
-
});
|
|
294
|
-
},
|
|
295
|
-
[a, p]
|
|
296
|
-
), he = K((e) => {
|
|
297
|
-
m(e);
|
|
298
|
-
}, []), Y = K(() => {
|
|
299
|
-
typeof window < "u" && window.print();
|
|
300
|
-
}, []), ge = K((e) => {
|
|
301
|
-
me(e), L(e.length > 0);
|
|
302
|
-
}, []), le = xe(
|
|
303
|
-
() => ({
|
|
304
|
-
goToPage: j,
|
|
305
|
-
setZoom: he,
|
|
306
|
-
search: ge,
|
|
307
|
-
print: Y
|
|
308
|
-
}),
|
|
309
|
-
[j, he, ge, Y]
|
|
310
|
-
);
|
|
311
|
-
Le(I, () => le, [le]), Ke(Ge, le, o);
|
|
312
|
-
const Te = K(
|
|
313
|
-
(e) => {
|
|
314
|
-
if (!a) return;
|
|
315
|
-
const r = e.metaKey || e.ctrlKey;
|
|
316
|
-
if (e.key === "PageDown") {
|
|
317
|
-
e.preventDefault(), j(l + 1);
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
if (e.key === "PageUp") {
|
|
321
|
-
e.preventDefault(), j(l - 1);
|
|
322
|
-
return;
|
|
323
|
-
}
|
|
324
|
-
if (e.key === "Home") {
|
|
325
|
-
e.preventDefault(), j(1);
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
if (e.key === "End") {
|
|
329
|
-
e.preventDefault(), j(a.numPages);
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
if (r && e.key.toLowerCase() === "f") {
|
|
333
|
-
e.preventDefault(), L(!0);
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
if (r && (e.key === "+" || e.key === "=")) {
|
|
337
|
-
e.preventDefault(), m((u) => X(u) ? Math.min(u * 1.25, 4) : 1.25);
|
|
338
|
-
return;
|
|
339
|
-
}
|
|
340
|
-
if (r && e.key === "-") {
|
|
341
|
-
e.preventDefault(), m(
|
|
342
|
-
(u) => X(u) ? Math.max(u / 1.25, 0.25) : 0.75
|
|
343
|
-
);
|
|
344
|
-
return;
|
|
345
|
-
}
|
|
346
|
-
if (r && e.key === "0") {
|
|
347
|
-
e.preventDefault(), m("fit-width");
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
r && e.key.toLowerCase() === "p" && (e.preventDefault(), Y());
|
|
351
|
-
},
|
|
352
|
-
[l, j, Y, a]
|
|
353
|
-
), ue = V(l);
|
|
354
|
-
C(() => {
|
|
355
|
-
ue.current = l;
|
|
356
|
-
}, [l]), C(() => {
|
|
357
|
-
if (!a) return;
|
|
358
|
-
const e = ae.current;
|
|
359
|
-
if (!e) return;
|
|
360
|
-
const r = /* @__PURE__ */ new Map(), u = new IntersectionObserver(
|
|
361
|
-
(i) => {
|
|
362
|
-
for (const F of i) {
|
|
363
|
-
const $ = F.target.dataset.pageNumber;
|
|
364
|
-
if (!$) continue;
|
|
365
|
-
const Ve = Number($);
|
|
366
|
-
r.set(Ve, F.intersectionRatio);
|
|
367
|
-
}
|
|
368
|
-
let R = ue.current, Z = 0, q = 1 / 0, U = -1 / 0;
|
|
369
|
-
for (const [F, $] of r.entries())
|
|
370
|
-
$ > Z && (R = F, Z = $), $ > 0 && (q = Math.min(q, F), U = Math.max(U, F));
|
|
371
|
-
Z > 0 && R !== ue.current && A(R), q !== 1 / 0 && M({
|
|
372
|
-
start: Math.max(1, q - 1),
|
|
373
|
-
end: Math.min(a.numPages, U + 1)
|
|
374
|
-
});
|
|
375
|
-
},
|
|
376
|
-
{ root: e, threshold: [0, 0.25, 0.5, 0.75, 1] }
|
|
377
|
-
);
|
|
378
|
-
return ce.current.forEach((i) => {
|
|
379
|
-
i && u.observe(i);
|
|
380
|
-
}), () => u.disconnect();
|
|
381
|
-
}, [a]);
|
|
382
|
-
const [Ae, Oe] = b(0);
|
|
383
|
-
C(() => {
|
|
384
|
-
const e = ae.current;
|
|
385
|
-
if (!e || typeof ResizeObserver > "u") return;
|
|
386
|
-
const r = new ResizeObserver(() => {
|
|
387
|
-
(S === "fit-width" || S === "fit-page") && Oe((u) => u + 1);
|
|
388
|
-
});
|
|
389
|
-
return r.observe(e), () => r.disconnect();
|
|
390
|
-
}, [S]);
|
|
391
|
-
const ve = V([]), [oe, be] = b(0), je = K(
|
|
392
|
-
(e) => (r) => {
|
|
393
|
-
ve.current[e] = r;
|
|
394
|
-
},
|
|
395
|
-
[]
|
|
396
|
-
), ye = K((e) => {
|
|
397
|
-
const r = ve.current[e];
|
|
398
|
-
r && r.focus();
|
|
399
|
-
}, []), ie = 8, Fe = K(
|
|
400
|
-
(e) => {
|
|
401
|
-
const r = v ? "ArrowLeft" : "ArrowRight", u = v ? "ArrowRight" : "ArrowLeft";
|
|
402
|
-
let i = null;
|
|
403
|
-
e.key === r ? i = (oe + 1) % ie : e.key === u ? i = (oe - 1 + ie) % ie : e.key === "Home" ? i = 0 : e.key === "End" && (i = ie - 1), i !== null && (e.preventDefault(), be(i), ye(i));
|
|
404
|
-
},
|
|
405
|
-
[ye, v, oe]
|
|
406
|
-
);
|
|
407
|
-
return W ? /* @__PURE__ */ n(
|
|
408
|
-
"div",
|
|
409
|
-
{
|
|
410
|
-
className: [ke(), D].filter(Boolean).join(" "),
|
|
411
|
-
"aria-label": T ?? d("pdf.error"),
|
|
412
|
-
children: /* @__PURE__ */ n("div", { className: "ds:p-[var(--spacing-lg)]", children: /* @__PURE__ */ n(we, { variant: "error", live: "polite", children: /* @__PURE__ */ B(we.Description, { children: [
|
|
413
|
-
d("pdf.error"),
|
|
414
|
-
": ",
|
|
415
|
-
W.message
|
|
416
|
-
] }) }) })
|
|
417
|
-
}
|
|
418
|
-
) : (
|
|
419
|
-
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- region-level keyboard shortcuts (search, zoom) intentionally captured at the wrapper for the entire PDF viewer
|
|
420
|
-
/* @__PURE__ */ B(
|
|
421
|
-
"div",
|
|
422
|
-
{
|
|
423
|
-
id: N,
|
|
424
|
-
role: "region",
|
|
425
|
-
"aria-label": T ?? d("pdf.toolbarLabel"),
|
|
426
|
-
className: [ke(), D].filter(Boolean).join(" "),
|
|
427
|
-
dir: v ? "rtl" : void 0,
|
|
428
|
-
onKeyDown: Te,
|
|
429
|
-
tabIndex: -1,
|
|
430
|
-
"data-component": "pdf-viewer",
|
|
431
|
-
"data-component-id": o,
|
|
432
|
-
"data-pdfjs-worker-src": Ce,
|
|
433
|
-
children: [
|
|
434
|
-
z ? /* @__PURE__ */ n(
|
|
435
|
-
at,
|
|
436
|
-
{
|
|
437
|
-
currentPage: l,
|
|
438
|
-
numPages: (a == null ? void 0 : a.numPages) ?? 0,
|
|
439
|
-
zoom: S,
|
|
440
|
-
onPrev: () => j(l - 1),
|
|
441
|
-
onNext: () => j(l + 1),
|
|
442
|
-
onJump: (e) => j(e),
|
|
443
|
-
onZoomIn: () => {
|
|
444
|
-
m(
|
|
445
|
-
(e) => X(e) ? Math.min(e * 1.25, 4) : 1.25
|
|
446
|
-
);
|
|
447
|
-
},
|
|
448
|
-
onZoomOut: () => {
|
|
449
|
-
m(
|
|
450
|
-
(e) => X(e) ? Math.max(e / 1.25, 0.25) : 0.75
|
|
451
|
-
);
|
|
452
|
-
},
|
|
453
|
-
onZoomPreset: (e) => m(e),
|
|
454
|
-
onOpenSearch: () => L(!0),
|
|
455
|
-
onPrint: Y,
|
|
456
|
-
searchOpen: G,
|
|
457
|
-
onSearchOpenChange: L,
|
|
458
|
-
searchQuery: O,
|
|
459
|
-
onSearchQueryChange: (e) => {
|
|
460
|
-
me(e);
|
|
461
|
-
},
|
|
462
|
-
searchMatches: Ie,
|
|
463
|
-
register: je,
|
|
464
|
-
focusIndex: oe,
|
|
465
|
-
setFocusIndex: be,
|
|
466
|
-
onToolbarKeyDown: Fe,
|
|
467
|
-
isRtl: v
|
|
468
|
-
}
|
|
469
|
-
) : null,
|
|
470
|
-
/* @__PURE__ */ n("div", { "aria-live": "polite", "aria-atomic": "true", className: "ds:sr-only", children: _ }),
|
|
471
|
-
/* @__PURE__ */ n(
|
|
472
|
-
"div",
|
|
473
|
-
{
|
|
474
|
-
ref: ae,
|
|
475
|
-
className: tt(),
|
|
476
|
-
"data-testid": "pdf-pages-container",
|
|
477
|
-
tabIndex: 0,
|
|
478
|
-
"aria-label": d("pdf.pagesRegionLabel"),
|
|
479
|
-
children: a ? Array.from({ length: a.numPages }, (e, r) => r + 1).map(
|
|
480
|
-
(e) => /* @__PURE__ */ n(
|
|
481
|
-
ot,
|
|
482
|
-
{
|
|
483
|
-
pageNumber: e,
|
|
484
|
-
totalPages: a.numPages,
|
|
485
|
-
doc: a.doc,
|
|
486
|
-
zoom: S,
|
|
487
|
-
pageRotation: h,
|
|
488
|
-
renderPageOverlay: g,
|
|
489
|
-
container: ae.current,
|
|
490
|
-
resizeTick: Ae,
|
|
491
|
-
shouldRender: e >= s.start && e <= s.end,
|
|
492
|
-
registerRef: (r) => {
|
|
493
|
-
ce.current[e - 1] = r;
|
|
494
|
-
},
|
|
495
|
-
searchQuery: O,
|
|
496
|
-
onMatchCount: (r) => {
|
|
497
|
-
Re((u) => r === 0 && u.total === 0 ? u : {
|
|
498
|
-
current: Math.min(u.current || 1, r || 1),
|
|
499
|
-
total: Math.max(u.total, r)
|
|
500
|
-
});
|
|
501
|
-
}
|
|
502
|
-
},
|
|
503
|
-
e
|
|
504
|
-
)
|
|
505
|
-
) : /* @__PURE__ */ B("div", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)] ds:text-[var(--muted-foreground)] ds:p-[var(--spacing-lg)]", children: [
|
|
506
|
-
/* @__PURE__ */ n(Ze, { size: "sm", label: d("pdf.loading") }),
|
|
507
|
-
/* @__PURE__ */ n("span", { children: d("pdf.loading") })
|
|
508
|
-
] })
|
|
509
|
-
}
|
|
510
|
-
)
|
|
511
|
-
]
|
|
512
|
-
}
|
|
513
|
-
)
|
|
514
|
-
);
|
|
515
|
-
}
|
|
516
|
-
);
|
|
517
|
-
st.displayName = "PDFViewer";
|
|
518
|
-
function at(o) {
|
|
519
|
-
const { t } = pe(), {
|
|
520
|
-
currentPage: f,
|
|
521
|
-
numPages: y,
|
|
522
|
-
zoom: h,
|
|
523
|
-
onPrev: g,
|
|
524
|
-
onNext: x,
|
|
525
|
-
onJump: w,
|
|
526
|
-
onZoomIn: k,
|
|
527
|
-
onZoomOut: z,
|
|
528
|
-
onZoomPreset: T,
|
|
529
|
-
onOpenSearch: D,
|
|
530
|
-
onPrint: I,
|
|
531
|
-
searchOpen: d,
|
|
532
|
-
onSearchOpenChange: P,
|
|
533
|
-
searchQuery: N,
|
|
534
|
-
onSearchQueryChange: v,
|
|
535
|
-
searchMatches: E,
|
|
536
|
-
register: p,
|
|
537
|
-
focusIndex: H,
|
|
538
|
-
setFocusIndex: a,
|
|
539
|
-
onToolbarKeyDown: Q
|
|
540
|
-
} = o, [W, c] = b(String(f));
|
|
541
|
-
C(() => {
|
|
542
|
-
c(String(f));
|
|
543
|
-
}, [f]);
|
|
544
|
-
const l = f <= 1, A = f >= y;
|
|
545
|
-
function S() {
|
|
546
|
-
const s = Number(W);
|
|
547
|
-
Number.isFinite(s) && s >= 1 ? w(Math.min(s, y)) : c(String(f));
|
|
548
|
-
}
|
|
549
|
-
function m(s) {
|
|
550
|
-
return /* @__PURE__ */ n(
|
|
551
|
-
"button",
|
|
552
|
-
{
|
|
553
|
-
type: "button",
|
|
554
|
-
ref: p(s.index),
|
|
555
|
-
tabIndex: s.index === H ? 0 : -1,
|
|
556
|
-
onFocus: () => a(s.index),
|
|
557
|
-
onKeyDown: Q,
|
|
558
|
-
"aria-label": s.label,
|
|
559
|
-
"aria-disabled": s.disabled || void 0,
|
|
560
|
-
title: s.label,
|
|
561
|
-
onClick: (M) => {
|
|
562
|
-
if (s.disabled) {
|
|
563
|
-
M.preventDefault();
|
|
564
|
-
return;
|
|
565
|
-
}
|
|
566
|
-
s.onActivate();
|
|
567
|
-
},
|
|
568
|
-
className: ze(),
|
|
569
|
-
children: s.icon
|
|
570
|
-
}
|
|
571
|
-
);
|
|
572
|
-
}
|
|
573
|
-
return /* @__PURE__ */ B(
|
|
574
|
-
"div",
|
|
575
|
-
{
|
|
576
|
-
role: "toolbar",
|
|
577
|
-
"aria-label": t("pdf.toolbarLabel"),
|
|
578
|
-
className: Ye(),
|
|
579
|
-
children: [
|
|
580
|
-
m({
|
|
581
|
-
index: 0,
|
|
582
|
-
label: t("pdf.previousPage"),
|
|
583
|
-
disabled: l,
|
|
584
|
-
onActivate: g,
|
|
585
|
-
icon: /* @__PURE__ */ n(
|
|
586
|
-
He,
|
|
587
|
-
{
|
|
588
|
-
"aria-hidden": "true",
|
|
589
|
-
className: "ds:block-size-4 ds:inline-size-4 ds:rtl:rotate-180"
|
|
590
|
-
}
|
|
591
|
-
)
|
|
592
|
-
}),
|
|
593
|
-
m({
|
|
594
|
-
index: 1,
|
|
595
|
-
label: t("pdf.nextPage"),
|
|
596
|
-
disabled: A,
|
|
597
|
-
onActivate: x,
|
|
598
|
-
icon: /* @__PURE__ */ n(
|
|
599
|
-
Qe,
|
|
600
|
-
{
|
|
601
|
-
"aria-hidden": "true",
|
|
602
|
-
className: "ds:block-size-4 ds:inline-size-4 ds:rtl:rotate-180"
|
|
603
|
-
}
|
|
604
|
-
)
|
|
605
|
-
}),
|
|
606
|
-
/* @__PURE__ */ n(
|
|
607
|
-
"input",
|
|
608
|
-
{
|
|
609
|
-
type: "number",
|
|
610
|
-
min: 1,
|
|
611
|
-
max: Math.max(y, 1),
|
|
612
|
-
value: W,
|
|
613
|
-
onChange: (s) => c(s.target.value),
|
|
614
|
-
onKeyDown: (s) => {
|
|
615
|
-
s.key === "Enter" && (s.preventDefault(), S());
|
|
616
|
-
},
|
|
617
|
-
onBlur: S,
|
|
618
|
-
onFocus: () => a(2),
|
|
619
|
-
ref: p(2),
|
|
620
|
-
tabIndex: H === 2 ? 0 : -1,
|
|
621
|
-
"aria-label": t("pdf.currentPageInput"),
|
|
622
|
-
className: Pe()
|
|
623
|
-
}
|
|
624
|
-
),
|
|
625
|
-
/* @__PURE__ */ n(
|
|
626
|
-
"span",
|
|
627
|
-
{
|
|
628
|
-
"aria-hidden": "true",
|
|
629
|
-
className: "type-body-sm ds:text-[var(--muted-foreground)]",
|
|
630
|
-
children: t("pdf.pageOf", { current: f, total: y || 0 })
|
|
631
|
-
}
|
|
632
|
-
),
|
|
633
|
-
/* @__PURE__ */ n(
|
|
634
|
-
"span",
|
|
635
|
-
{
|
|
636
|
-
"aria-hidden": "true",
|
|
637
|
-
className: "ds:inline-block ds:block-size-6 ds:inline-size-px ds:bg-[var(--border)] ds:ms-[var(--spacing-xs)] ds:me-[var(--spacing-xs)]"
|
|
638
|
-
}
|
|
639
|
-
),
|
|
640
|
-
m({
|
|
641
|
-
index: 3,
|
|
642
|
-
label: t("pdf.zoom.out"),
|
|
643
|
-
onActivate: z,
|
|
644
|
-
icon: /* @__PURE__ */ n(
|
|
645
|
-
Xe,
|
|
646
|
-
{
|
|
647
|
-
"aria-hidden": "true",
|
|
648
|
-
className: "ds:block-size-4 ds:inline-size-4"
|
|
649
|
-
}
|
|
650
|
-
)
|
|
651
|
-
}),
|
|
652
|
-
m({
|
|
653
|
-
index: 4,
|
|
654
|
-
label: t("pdf.zoom.in"),
|
|
655
|
-
onActivate: k,
|
|
656
|
-
icon: /* @__PURE__ */ n(
|
|
657
|
-
Je,
|
|
658
|
-
{
|
|
659
|
-
"aria-hidden": "true",
|
|
660
|
-
className: "ds:block-size-4 ds:inline-size-4"
|
|
661
|
-
}
|
|
662
|
-
)
|
|
663
|
-
}),
|
|
664
|
-
/* @__PURE__ */ B(
|
|
665
|
-
"select",
|
|
666
|
-
{
|
|
667
|
-
"aria-label": t("pdf.zoom.preset"),
|
|
668
|
-
value: typeof h == "number" ? String(h) : h,
|
|
669
|
-
onChange: (s) => {
|
|
670
|
-
const M = s.target.value;
|
|
671
|
-
if (M === "fit-width" || M === "fit-page" || M === "actual-size")
|
|
672
|
-
T(M);
|
|
673
|
-
else {
|
|
674
|
-
const _ = Number(M);
|
|
675
|
-
Number.isFinite(_) && T(_);
|
|
676
|
-
}
|
|
677
|
-
},
|
|
678
|
-
ref: p(5),
|
|
679
|
-
tabIndex: H === 5 ? 0 : -1,
|
|
680
|
-
onFocus: () => a(5),
|
|
681
|
-
onKeyDown: Q,
|
|
682
|
-
className: et(),
|
|
683
|
-
children: [
|
|
684
|
-
/* @__PURE__ */ n("option", { value: "fit-width", children: t("pdf.zoom.fitWidth") }),
|
|
685
|
-
/* @__PURE__ */ n("option", { value: "fit-page", children: t("pdf.zoom.fitPage") }),
|
|
686
|
-
/* @__PURE__ */ n("option", { value: "actual-size", children: t("pdf.zoom.actualSize") }),
|
|
687
|
-
nt.filter(X).map((s) => /* @__PURE__ */ n("option", { value: String(s), children: `${Math.round(s * 100)}%` }, s))
|
|
688
|
-
]
|
|
689
|
-
}
|
|
690
|
-
),
|
|
691
|
-
/* @__PURE__ */ B(ee.Root, { open: d, onOpenChange: P, children: [
|
|
692
|
-
/* @__PURE__ */ n(ee.Trigger, { asChild: !0, children: m({
|
|
693
|
-
index: 6,
|
|
694
|
-
label: t("pdf.search.open"),
|
|
695
|
-
onActivate: D,
|
|
696
|
-
icon: /* @__PURE__ */ n(
|
|
697
|
-
We,
|
|
698
|
-
{
|
|
699
|
-
"aria-hidden": "true",
|
|
700
|
-
className: "ds:block-size-4 ds:inline-size-4"
|
|
701
|
-
}
|
|
702
|
-
)
|
|
703
|
-
}) }),
|
|
704
|
-
/* @__PURE__ */ n(ee.Portal, { children: /* @__PURE__ */ B(
|
|
705
|
-
ee.Content,
|
|
706
|
-
{
|
|
707
|
-
sideOffset: 8,
|
|
708
|
-
className: [
|
|
709
|
-
"ds:z-[var(--z-popover)]",
|
|
710
|
-
"ds:bg-[var(--popover)] ds:text-[var(--popover-foreground)]",
|
|
711
|
-
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
|
|
712
|
-
"ds:shadow-[var(--shadow-lg)]",
|
|
713
|
-
"ds:p-[var(--spacing-sm)]",
|
|
714
|
-
"ds:flex ds:items-center ds:gap-[var(--spacing-xs)]"
|
|
715
|
-
].join(" "),
|
|
716
|
-
children: [
|
|
717
|
-
/* @__PURE__ */ n(
|
|
718
|
-
"input",
|
|
719
|
-
{
|
|
720
|
-
type: "search",
|
|
721
|
-
autoFocus: !0,
|
|
722
|
-
value: N,
|
|
723
|
-
onChange: (s) => v(s.target.value),
|
|
724
|
-
placeholder: t("pdf.search.placeholder"),
|
|
725
|
-
"aria-label": t("pdf.search.placeholder"),
|
|
726
|
-
className: Pe({
|
|
727
|
-
className: "ds:inline-size-[16rem] ds:text-start"
|
|
728
|
-
})
|
|
729
|
-
}
|
|
730
|
-
),
|
|
731
|
-
/* @__PURE__ */ n(
|
|
732
|
-
"span",
|
|
733
|
-
{
|
|
734
|
-
"aria-live": "polite",
|
|
735
|
-
className: "type-meta ds:text-[var(--muted-foreground)]",
|
|
736
|
-
children: E.total > 0 ? t("pdf.search.countOfTotal", {
|
|
737
|
-
current: E.current,
|
|
738
|
-
total: E.total
|
|
739
|
-
}) : N ? t("pdf.search.noResults") : ""
|
|
740
|
-
}
|
|
741
|
-
),
|
|
742
|
-
/* @__PURE__ */ n(ee.Close, { asChild: !0, children: /* @__PURE__ */ n(
|
|
743
|
-
"button",
|
|
744
|
-
{
|
|
745
|
-
type: "button",
|
|
746
|
-
"aria-label": t("pdf.search.close"),
|
|
747
|
-
className: ze(),
|
|
748
|
-
children: /* @__PURE__ */ n(
|
|
749
|
-
Be,
|
|
750
|
-
{
|
|
751
|
-
"aria-hidden": "true",
|
|
752
|
-
className: "ds:block-size-4 ds:inline-size-4"
|
|
753
|
-
}
|
|
754
|
-
)
|
|
755
|
-
}
|
|
756
|
-
) })
|
|
757
|
-
]
|
|
758
|
-
}
|
|
759
|
-
) })
|
|
760
|
-
] }),
|
|
761
|
-
m({
|
|
762
|
-
index: 7,
|
|
763
|
-
label: t("pdf.print"),
|
|
764
|
-
onActivate: I,
|
|
765
|
-
icon: /* @__PURE__ */ n(
|
|
766
|
-
qe,
|
|
767
|
-
{
|
|
768
|
-
"aria-hidden": "true",
|
|
769
|
-
className: "ds:block-size-4 ds:inline-size-4"
|
|
770
|
-
}
|
|
771
|
-
)
|
|
772
|
-
})
|
|
773
|
-
]
|
|
774
|
-
}
|
|
775
|
-
);
|
|
776
|
-
}
|
|
777
|
-
function ot(o) {
|
|
778
|
-
const {
|
|
779
|
-
pageNumber: t,
|
|
780
|
-
totalPages: f,
|
|
781
|
-
doc: y,
|
|
782
|
-
zoom: h,
|
|
783
|
-
pageRotation: g,
|
|
784
|
-
renderPageOverlay: x,
|
|
785
|
-
container: w,
|
|
786
|
-
resizeTick: k,
|
|
787
|
-
shouldRender: z,
|
|
788
|
-
registerRef: T,
|
|
789
|
-
searchQuery: D,
|
|
790
|
-
onMatchCount: I
|
|
791
|
-
} = o, { t: d } = pe(), P = V(null), N = V(null), [v, E] = b({
|
|
792
|
-
width: 612,
|
|
793
|
-
height: 792
|
|
794
|
-
}), [p, H] = b(null);
|
|
795
|
-
C(() => {
|
|
796
|
-
let c = !1;
|
|
797
|
-
return y.getPage(t).then((l) => {
|
|
798
|
-
c || H(l);
|
|
799
|
-
}), () => {
|
|
800
|
-
c = !0;
|
|
801
|
-
};
|
|
802
|
-
}, [y, t]), C(() => {
|
|
803
|
-
if (!p) return;
|
|
804
|
-
const c = (m) => g === void 0 ? { scale: m } : { scale: m, rotation: g }, l = p.getViewport(c(1)), A = Se(h, l, w), S = p.getViewport(c(A));
|
|
805
|
-
E({
|
|
806
|
-
width: Math.floor(S.width),
|
|
807
|
-
height: Math.floor(S.height)
|
|
808
|
-
});
|
|
809
|
-
}, [p, h, w, k, g]);
|
|
810
|
-
const a = g ?? (p == null ? void 0 : p.rotate) ?? 0;
|
|
811
|
-
C(() => {
|
|
812
|
-
if (!p || !z) {
|
|
813
|
-
const O = P.current;
|
|
814
|
-
O && !z && (O.width = 0);
|
|
815
|
-
return;
|
|
816
|
-
}
|
|
817
|
-
const c = P.current, l = N.current;
|
|
818
|
-
if (!c) return;
|
|
819
|
-
const A = c.getContext("2d");
|
|
820
|
-
if (!A) return;
|
|
821
|
-
const S = (O) => g === void 0 ? { scale: O } : { scale: O, rotation: g }, m = p.getViewport(S(1)), s = Se(h, m, w), M = p.getViewport(S(s)), _ = Math.max(1, window.devicePixelRatio || 1);
|
|
822
|
-
c.width = Math.floor(M.width * _), c.height = Math.floor(M.height * _), A.setTransform(_, 0, 0, _, 0, 0);
|
|
823
|
-
const te = p.render({
|
|
824
|
-
canvas: c,
|
|
825
|
-
canvasContext: A,
|
|
826
|
-
viewport: M
|
|
827
|
-
});
|
|
828
|
-
let G = !1, L = null;
|
|
829
|
-
return te.promise.then(async () => {
|
|
830
|
-
if (G || !l) return;
|
|
831
|
-
l.textContent = "";
|
|
832
|
-
const O = await p.getTextContent();
|
|
833
|
-
G || (L = new fe.TextLayer({
|
|
834
|
-
textContentSource: O,
|
|
835
|
-
container: l,
|
|
836
|
-
viewport: M
|
|
837
|
-
}), await L.render(), Ne(l, D, I));
|
|
838
|
-
}).catch(() => {
|
|
839
|
-
}), () => {
|
|
840
|
-
G = !0;
|
|
841
|
-
try {
|
|
842
|
-
te.cancel();
|
|
843
|
-
} catch {
|
|
844
|
-
}
|
|
845
|
-
if (L)
|
|
846
|
-
try {
|
|
847
|
-
L.cancel();
|
|
848
|
-
} catch {
|
|
849
|
-
}
|
|
850
|
-
};
|
|
851
|
-
}, [
|
|
852
|
-
p,
|
|
853
|
-
z,
|
|
854
|
-
h,
|
|
855
|
-
w,
|
|
856
|
-
k,
|
|
857
|
-
D,
|
|
858
|
-
I,
|
|
859
|
-
g
|
|
860
|
-
]), C(() => {
|
|
861
|
-
if (!z) return;
|
|
862
|
-
const c = N.current;
|
|
863
|
-
c && Ne(c, D, I);
|
|
864
|
-
}, [D, z, I]);
|
|
865
|
-
const Q = {
|
|
866
|
-
width: v.width,
|
|
867
|
-
height: v.height
|
|
868
|
-
}, W = {
|
|
869
|
-
width: v.width,
|
|
870
|
-
height: v.height
|
|
871
|
-
};
|
|
872
|
-
return /* @__PURE__ */ B(
|
|
873
|
-
"article",
|
|
874
|
-
{
|
|
875
|
-
ref: (c) => {
|
|
876
|
-
T(c);
|
|
877
|
-
},
|
|
878
|
-
"data-page-number": t,
|
|
879
|
-
"aria-label": d("pdf.pageOf", { current: t, total: f }),
|
|
880
|
-
className: rt(),
|
|
881
|
-
style: W,
|
|
882
|
-
children: [
|
|
883
|
-
/* @__PURE__ */ n("canvas", { ref: P, style: Q }),
|
|
884
|
-
/* @__PURE__ */ n(
|
|
885
|
-
"div",
|
|
886
|
-
{
|
|
887
|
-
ref: N,
|
|
888
|
-
"aria-hidden": "false",
|
|
889
|
-
className: [
|
|
890
|
-
"ds:absolute ds:inset-0",
|
|
891
|
-
"ds:overflow-hidden",
|
|
892
|
-
"ds:select-text",
|
|
893
|
-
"ds:opacity-100",
|
|
894
|
-
"ds:[&>span]:absolute ds:[&>span]:whitespace-pre",
|
|
895
|
-
"ds:[&>span]:text-transparent ds:[&>span]:origin-[0_0]",
|
|
896
|
-
"ds:[&_[data-match=true]]:bg-[color-mix(in_srgb,var(--warning)_35%,transparent)]",
|
|
897
|
-
"ds:[&_[data-match=current]]:bg-[color-mix(in_srgb,var(--warning)_60%,transparent)]"
|
|
898
|
-
].join(" ")
|
|
899
|
-
}
|
|
900
|
-
),
|
|
901
|
-
z && x ? /* @__PURE__ */ n(
|
|
902
|
-
"div",
|
|
903
|
-
{
|
|
904
|
-
role: "group",
|
|
905
|
-
"aria-label": d("pdf.pageOverlay", { page: t }),
|
|
906
|
-
className: "ds:absolute ds:inset-0 ds:pointer-events-auto",
|
|
907
|
-
"data-pdf-page-overlay": "",
|
|
908
|
-
"data-page-number": t,
|
|
909
|
-
children: x({
|
|
910
|
-
pageNumber: t,
|
|
911
|
-
pageWidthCss: v.width,
|
|
912
|
-
pageHeightCss: v.height,
|
|
913
|
-
rotation: a
|
|
914
|
-
})
|
|
915
|
-
}
|
|
916
|
-
) : null
|
|
917
|
-
]
|
|
918
|
-
}
|
|
919
|
-
);
|
|
920
|
-
}
|
|
921
|
-
function Me(o) {
|
|
922
|
-
return o.normalize("NFKD").replace(new RegExp("\\p{Diacritic}", "gu"), "").toLowerCase();
|
|
923
|
-
}
|
|
924
|
-
function Ne(o, t, f) {
|
|
925
|
-
if (o.querySelectorAll("[data-match]").forEach((d) => {
|
|
926
|
-
d.removeAttribute("data-match");
|
|
927
|
-
}), !t) {
|
|
928
|
-
f(0);
|
|
929
|
-
return;
|
|
930
|
-
}
|
|
931
|
-
const h = Me(t);
|
|
932
|
-
if (!h) {
|
|
933
|
-
f(0);
|
|
934
|
-
return;
|
|
935
|
-
}
|
|
936
|
-
const g = Array.from(o.querySelectorAll("span")), x = [], w = [];
|
|
937
|
-
let k = 0;
|
|
938
|
-
for (const d of g) {
|
|
939
|
-
const P = Me(d.textContent ?? "");
|
|
940
|
-
x.push({ start: k, end: k + P.length }), w.push(P), k += P.length;
|
|
941
|
-
}
|
|
942
|
-
const z = w.join("");
|
|
943
|
-
let T = 0;
|
|
944
|
-
const D = /* @__PURE__ */ new Set();
|
|
945
|
-
let I = 0;
|
|
946
|
-
for (; I <= z.length - h.length; ) {
|
|
947
|
-
const d = z.indexOf(h, I);
|
|
948
|
-
if (d === -1) break;
|
|
949
|
-
T += 1;
|
|
950
|
-
const P = d + h.length;
|
|
951
|
-
for (let N = 0; N < x.length; N++) {
|
|
952
|
-
const { start: v, end: E } = x[N];
|
|
953
|
-
v < P && E > d && D.add(N);
|
|
954
|
-
}
|
|
955
|
-
I = P;
|
|
956
|
-
}
|
|
957
|
-
D.forEach((d) => {
|
|
958
|
-
g[d].setAttribute("data-match", "true");
|
|
959
|
-
}), f(T);
|
|
960
|
-
}
|
|
961
|
-
export {
|
|
962
|
-
st as P,
|
|
963
|
-
Ge as p
|
|
964
|
-
};
|
|
965
|
-
//# sourceMappingURL=pdf-viewer-XxWdtKfD.js.map
|