@alfadocs/ui-kit 1.3.13 → 1.4.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/agenda-card.agent-Cb5tuEh3.js +28 -0
- package/dist/_chunks/{alia-sidebar-DzNz1gDf.js → alia-sidebar-DSBZMick.js} +3 -3
- package/dist/_chunks/{anamnesis-i18n-CfC0qYzy.js → anamnesis-i18n-BA631X4t.js} +2209 -2144
- package/dist/_chunks/{antenatal-schedule-timeline-BMMpi2lb.js → antenatal-schedule-timeline-u8TsS2QJ.js} +27 -26
- package/dist/_chunks/{appointment-timeline-B630OT_J.js → appointment-timeline-Bqf1sTU5.js} +2 -2
- package/dist/_chunks/{ar-THMLfSoN.js → ar-BR1FGFP2.js} +14 -14
- package/dist/_chunks/{bmi-calculator-CM0-G2mg.js → bmi-calculator-CpyY13MV.js} +2 -2
- package/dist/_chunks/{booking-DjNbd7C1.js → booking-BjsA7j1-.js} +699 -688
- package/dist/_chunks/calculator-dialog-12d3Sxaz.js +48 -0
- package/dist/_chunks/{care-plan-card-1G_f4I5s.js → care-plan-card-BvQy366X.js} +3 -3
- package/dist/_chunks/{care-plan-entry-card-DmBsffHS.js → care-plan-entry-card-apk_5B3O.js} +2 -2
- package/dist/_chunks/{chat-container-HlFnoEIl.js → chat-container-CYYego1W.js} +105 -81
- package/dist/_chunks/cycle-calculator-B7fyH-h4.js +425 -0
- package/dist/_chunks/{date-picker-ZHejTVAJ.js → date-picker-Bp64zk2p.js} +19 -19
- package/dist/_chunks/date-picker-variants-pKAJfnWr.js +2089 -0
- package/dist/_chunks/{date-range-picker-pEG3Ln3i.js → date-range-picker-CDrZ8Zh0.js} +27 -27
- package/dist/_chunks/{date-time-picker-695QvBGj.js → date-time-picker-DafkGDGO.js} +10 -10
- package/dist/_chunks/{de-DmZ-8rTN.js → de-3iM4rGqo.js} +7 -7
- package/dist/_chunks/{document-preview-D3gg4MXB.js → document-preview-DOrsqiN1.js} +2 -2
- package/dist/_chunks/due-date-calculator-CnkbbAej.js +571 -0
- package/dist/_chunks/{editor-overlay-DE3esyio.js → editor-overlay-B1tr2i7B.js} +22 -21
- package/dist/_chunks/{el-Bela9mxs.js → el-C96rGJvU.js} +2 -2
- package/dist/_chunks/{es-BNncHKex.js → es-Cxiqjx8r.js} +12 -12
- package/dist/_chunks/fetal-weight-avlj-l-S.js +223 -0
- package/dist/_chunks/format-4HNwNGrN.js +1315 -0
- package/dist/_chunks/{fr-CH8ADfhN.js → fr-Bhr6SYKj.js} +21 -21
- package/dist/_chunks/{freemium-paywall-C_Ue6wxU.js → freemium-paywall-DRDdWuOg.js} +3 -3
- package/dist/_chunks/gestational-age-calculator-BljY_DVJ.js +488 -0
- package/dist/_chunks/hcg-doubling-Cv_vH61p.js +312 -0
- package/dist/_chunks/header-settings-Cn5fPXCE.js +335 -0
- package/dist/_chunks/{hi-Bppfxp8l.js → hi-BxXX26d_.js} +12 -12
- package/dist/_chunks/isSameWeek-B73MagWB.js +13 -0
- package/dist/_chunks/{it-B4ySaRyK.js → it-Xmjomvyj.js} +24 -24
- package/dist/_chunks/{ja-CGF6Io9P.js → ja-mfZvt1ZV.js} +16 -16
- package/dist/_chunks/{link-cell-renderer-C5XLwVXQ.js → link-cell-renderer-CJ_gk7gl.js} +3 -3
- package/dist/_chunks/{locale-picker-BfBUdT1m.js → locale-picker-D9Kv2zrK.js} +153 -132
- package/dist/_chunks/map-view-2yZCQW2l.js +445 -0
- package/dist/_chunks/{marketplace-app-shell-DwcFMxzp.js → marketplace-app-shell-BLRvg-M0.js} +49 -40
- package/dist/_chunks/{nl-DuShqwuV.js → nl-DDs-KEnD.js} +15 -15
- package/dist/_chunks/{notes-panel-DPsgB4Mv.js → notes-panel-CiFN3sLW.js} +2 -2
- package/dist/_chunks/{number-input-DrozbZAU.js → number-input-DOe5VYei.js} +64 -64
- package/dist/_chunks/{optical-prescription-BDHJr8Zz.js → optical-prescription-CRemE8fL.js} +2 -2
- package/dist/_chunks/{parse-DvA97ro9.js → parse-JqixfsU0.js} +43 -43
- package/dist/_chunks/parseISO-fOGpHKXm.js +120 -0
- package/dist/_chunks/{patient-details-DqjjwPmt.js → patient-details-CpunD0qx.js} +3 -3
- package/dist/_chunks/{patient-table-BmIDrLIS.js → patient-table-2eWx-Rrk.js} +2 -2
- package/dist/_chunks/{payment-form-h-BZ8onk.js → payment-form-Ds1I9KqB.js} +308 -231
- package/dist/_chunks/{pdf-viewer-Ddx-T053.js → pdf-viewer-DUIsV9s5.js} +429 -369
- package/dist/_chunks/{pl-CKQwX9Fk.js → pl-BYYMnEWP.js} +18 -18
- package/dist/_chunks/{practice-results-B-HPc13W.js → practice-results-SjCniMd2.js} +2 -2
- package/dist/_chunks/pregnancy-dating-BmpHScZ0.js +770 -0
- package/dist/_chunks/pregnancy-weight-gain-B5KSJzdc.js +553 -0
- package/dist/_chunks/progress-CK8otcQ-.js +343 -0
- package/dist/_chunks/{pt-_njpXyOZ.js → pt-BSPnVrQ7.js} +20 -20
- package/dist/_chunks/{radiograph-panel.agent-BQZ64Riy.js → radiograph-panel.agent-CtFtNMzk.js} +3 -3
- package/dist/_chunks/{rich-text-editor-CfeXPPWs.js → rich-text-editor-BedTpWzL.js} +2 -2
- package/dist/_chunks/{ro-3X6_4FcN.js → ro-BbiylGmG.js} +14 -14
- package/dist/_chunks/{ru-bAcgmnS-.js → ru-BX_qsV67.js} +14 -14
- package/dist/_chunks/{session-countdown-Bc70VXN1.js → session-countdown-BL-Psg8u.js} +2 -2
- package/dist/_chunks/{sign-document-CW_ByDUh.js → sign-document-jF4fZDJ5.js} +2 -2
- package/dist/_chunks/slot-grid-DNiUcXy2.js +640 -0
- package/dist/_chunks/{sparkline-BTY4B5tv.js → sparkline-BmGcEyZO.js} +209 -164
- package/dist/_chunks/{sq-jYFqr4Ga.js → sq-i9UOk4P7.js} +10 -10
- package/dist/_chunks/subDays-CAUv47M1.js +8 -0
- package/dist/_chunks/{sv-BSGEJ-8B.js → sv-CpTdtmDQ.js} +8 -8
- package/dist/_chunks/{tab-bar-Axhk6xzx.js → tab-bar-BYESZINM.js} +83 -77
- package/dist/_chunks/task-card.agent-CF2N_uu4.js +29 -0
- package/dist/_chunks/{tr-CTpgUtw6.js → tr-DXG2QN1K.js} +17 -17
- package/dist/_chunks/{unit-converter-COgkN7YP.js → unit-converter-CHPDuV7W.js} +2 -2
- package/dist/_chunks/{warning-stack-BtjmJChC.js → warning-stack-B7t_8jRE.js} +42 -37
- package/dist/_chunks/{zh-CN-BgM0Io2O.js → zh-CN-vPkPEK6H.js} +18 -18
- package/dist/agent-catalog.json +6426 -3382
- package/dist/agent-i18n/en.json +234 -15
- package/dist/components/agenda-card/index.js +1 -1
- package/dist/components/appointment-timeline/index.js +1 -1
- package/dist/components/bmi-calculator/index.js +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/calculator-dialog/index.js +1 -1
- package/dist/components/care-plan-card/index.js +1 -1
- package/dist/components/care-plan-entry-card/index.js +1 -1
- package/dist/components/chat-container/chat-container.d.ts +14 -0
- package/dist/components/chat-container/index.js +1 -1
- package/dist/components/cycle-calculator/cycle-calculator.agent.d.ts +4 -0
- package/dist/components/cycle-calculator/cycle-calculator.d.ts +42 -0
- package/dist/components/cycle-calculator/index.d.ts +1 -1
- package/dist/components/cycle-calculator/index.js +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/date-picker/index.js +1 -1
- package/dist/components/date-range-picker/index.js +1 -1
- package/dist/components/date-time-picker/index.js +1 -1
- package/dist/components/document-preview/index.js +1 -1
- package/dist/components/due-date-calculator/due-date-calculator.agent.d.ts +4 -0
- package/dist/components/due-date-calculator/due-date-calculator.d.ts +61 -1
- package/dist/components/due-date-calculator/index.d.ts +1 -1
- package/dist/components/due-date-calculator/index.js +2 -2
- package/dist/components/editor-overlay/editor-overlay.d.ts +7 -1
- package/dist/components/editor-overlay/index.js +1 -1
- package/dist/components/fetal-weight/fetal-weight.agent.d.ts +4 -0
- package/dist/components/fetal-weight/fetal-weight.d.ts +26 -0
- package/dist/components/fetal-weight/index.d.ts +1 -1
- package/dist/components/fetal-weight/index.js +1 -1
- package/dist/components/freemium-paywall/index.js +1 -1
- package/dist/components/gestational-age-calculator/gestational-age-calculator.agent.d.ts +4 -0
- package/dist/components/gestational-age-calculator/gestational-age-calculator.d.ts +44 -2
- package/dist/components/gestational-age-calculator/index.d.ts +1 -1
- package/dist/components/gestational-age-calculator/index.js +1 -1
- package/dist/components/hcg-doubling/hcg-doubling.agent.d.ts +4 -0
- package/dist/components/hcg-doubling/hcg-doubling.d.ts +30 -0
- package/dist/components/hcg-doubling/index.d.ts +1 -1
- package/dist/components/hcg-doubling/index.js +1 -1
- package/dist/components/header-settings/header-settings.d.ts +13 -1
- package/dist/components/header-settings/index.js +1 -1
- package/dist/components/locale-picker/index.js +1 -1
- package/dist/components/locale-picker/locale-picker.d.ts +9 -0
- package/dist/components/map-view/index.js +1 -1
- package/dist/components/map-view/map-view.d.ts +22 -0
- package/dist/components/notes-panel/index.js +1 -1
- package/dist/components/number-input/index.js +1 -1
- package/dist/components/number-input/number-input.d.ts +2 -1
- package/dist/components/optical-prescription/index.js +1 -1
- package/dist/components/patient-details/index.js +1 -1
- package/dist/components/patient-table/index.js +1 -1
- package/dist/components/payment-form/index.d.ts +1 -1
- package/dist/components/payment-form/index.js +1 -1
- package/dist/components/payment-form/payment-form.d.ts +32 -1
- package/dist/components/pdf-viewer/index.js +1 -1
- package/dist/components/pdf-viewer/pdf-viewer.d.ts +13 -0
- package/dist/components/practice-results/index.js +1 -1
- package/dist/components/pregnancy-dating/index.d.ts +1 -1
- package/dist/components/pregnancy-dating/index.js +1 -1
- package/dist/components/pregnancy-dating/pregnancy-dating.agent.d.ts +4 -0
- package/dist/components/pregnancy-dating/pregnancy-dating.d.ts +65 -1
- package/dist/components/pregnancy-weight-gain/index.d.ts +2 -1
- package/dist/components/pregnancy-weight-gain/index.js +6 -5
- package/dist/components/pregnancy-weight-gain/pregnancy-weight-gain.agent.d.ts +4 -0
- package/dist/components/pregnancy-weight-gain/pregnancy-weight-gain.d.ts +35 -0
- package/dist/components/progress/index.js +1 -1
- package/dist/components/progress/progress.d.ts +13 -0
- package/dist/components/radiograph-panel/index.js +1 -1
- package/dist/components/rich-text-editor/index.js +1 -1
- package/dist/components/session-countdown/index.js +1 -1
- package/dist/components/sign-document/index.js +1 -1
- package/dist/components/slot-grid/index.d.ts +2 -1
- package/dist/components/slot-grid/index.js +5 -4
- package/dist/components/slot-grid/slot-grid.agent.d.ts +4 -0
- package/dist/components/slot-grid/slot-grid.d.ts +34 -0
- package/dist/components/sparkline/index.js +1 -1
- package/dist/components/sparkline/sparkline.d.ts +10 -0
- package/dist/components/tab-bar/index.js +1 -1
- package/dist/components/tab-bar/tab-bar.d.ts +13 -0
- package/dist/components/task-card/index.js +1 -1
- package/dist/components/unit-converter/index.js +1 -1
- package/dist/components/warning-stack/index.js +1 -1
- package/dist/index.js +630 -627
- package/dist/patterns/alia-assistant/index.js +1 -1
- package/dist/patterns/anamnesis/anamnesis-derive.d.ts +27 -8
- package/dist/patterns/anamnesis/anamnesis-format.d.ts +11 -3
- package/dist/patterns/anamnesis/anamnesis-highlight.d.ts +6 -0
- package/dist/patterns/anamnesis/anamnesis-questionnaire.d.ts +23 -9
- package/dist/patterns/anamnesis/anamnesis-types.d.ts +7 -0
- package/dist/patterns/anamnesis/anamnesis.d.ts +16 -7
- package/dist/patterns/anamnesis/index.d.ts +3 -2
- package/dist/patterns/anamnesis/index.js +7 -6
- package/dist/patterns/marketplace-app-shell/index.js +1 -1
- package/dist/patterns/marketplace-app-shell/marketplace-app-shell.d.ts +6 -0
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/agenda-card.agent-mTCrkKSZ.js +0 -27
- package/dist/_chunks/calculator-dialog-DuXMQSdm.js +0 -40
- package/dist/_chunks/cycle-calculator-BwqYVPB4.js +0 -252
- package/dist/_chunks/date-picker-variants-eL6HjWvw.js +0 -3363
- package/dist/_chunks/due-date-calculator-CwfsFd3T.js +0 -256
- package/dist/_chunks/fetal-weight-ePlLjJPc.js +0 -122
- package/dist/_chunks/gestational-age-calculator-DdgbH69Z.js +0 -311
- package/dist/_chunks/hcg-doubling-BBqD2wI2.js +0 -170
- package/dist/_chunks/header-settings--pjYOe6g.js +0 -284
- package/dist/_chunks/isSameDay-DUEiAT0G.js +0 -39
- package/dist/_chunks/isSameWeek-CK4HS9lH.js +0 -14
- package/dist/_chunks/map-view-CsaHfoo6.js +0 -378
- package/dist/_chunks/pregnancy-dating-DzYTlBkT.js +0 -421
- package/dist/_chunks/pregnancy-weight-gain-O6J0sUIi.js +0 -322
- package/dist/_chunks/progress-DA413-zn.js +0 -299
- package/dist/_chunks/slot-grid-CQSULZjd.js +0 -502
- package/dist/_chunks/subDays-BcNi04uf.js +0 -8
- package/dist/_chunks/task-card.agent-Bt14CzUd.js +0 -25
|
@@ -1,26 +1,64 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as Ze, useId as
|
|
3
|
-
import * as
|
|
1
|
+
import { jsx as s, jsxs as K, Fragment as ke } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Ze, useId as _e, useMemo as Pe, useState as y, useEffect as T, useRef as j, useCallback as H, useImperativeHandle as Le } from "react";
|
|
3
|
+
import * as ge from "pdfjs-dist/legacy/build/pdf.min.mjs";
|
|
4
4
|
import { c as $ } from "./index-D2ZczOXr.js";
|
|
5
|
-
import { useTranslation as
|
|
6
|
-
import * as
|
|
5
|
+
import { useTranslation as he } from "react-i18next";
|
|
6
|
+
import * as ae from "@radix-ui/react-popover";
|
|
7
7
|
import De from "pdfjs-dist/legacy/build/pdf.worker.min.mjs?url";
|
|
8
|
-
import { S as
|
|
9
|
-
import { A as
|
|
10
|
-
import { u as
|
|
11
|
-
import { X as
|
|
12
|
-
import { C as
|
|
8
|
+
import { S as qe } from "./spinner-hbwuKwMf.js";
|
|
9
|
+
import { A as Ce } from "./alert-CiJT540z.js";
|
|
10
|
+
import { u as Be } from "./registry-DvAUVLHh.js";
|
|
11
|
+
import { X as He } from "./x-B5YnXwCz.js";
|
|
12
|
+
import { C as We } from "./chevron-left-B8cOyH-V.js";
|
|
13
13
|
import { C as Qe } from "./chevron-right-I9AeSxH2.js";
|
|
14
|
-
import { Z as
|
|
15
|
-
import { S as
|
|
16
|
-
import { P as
|
|
17
|
-
const
|
|
14
|
+
import { Z as Ue, a as Je } from "./zoom-out-Dnif4kJx.js";
|
|
15
|
+
import { S as Xe } from "./search-QbWPlY5f.js";
|
|
16
|
+
import { P as $e } from "./printer-rkK0T1gi.js";
|
|
17
|
+
const Ge = {
|
|
18
18
|
id: "pdf-viewer",
|
|
19
19
|
// `paginate` (go_to_page), `set_value` (zoom preset — ephemeral view state),
|
|
20
20
|
// `filter` (in-document search/highlight). Zoom maps to `set_value` rather
|
|
21
21
|
// than the old `view_change` per the agent-readiness capability vocabulary.
|
|
22
22
|
capabilities: ["paginate", "set_value", "filter"],
|
|
23
|
-
|
|
23
|
+
// Every action is a silent no-op until the document loads, and
|
|
24
|
+
// `go_to_page` clamps into range without saying so. These slots are
|
|
25
|
+
// how an agent range-checks before calling and verifies afterwards.
|
|
26
|
+
// A9: page numbers, counts, a zoom enum and a match count are
|
|
27
|
+
// structural. Extracted page text is NOT exposed, and neither is
|
|
28
|
+
// `src` — it may be a signed / tokenised document URL, i.e. a
|
|
29
|
+
// credential.
|
|
30
|
+
state: {
|
|
31
|
+
status: {
|
|
32
|
+
type: "'loading' | 'ready' | 'error'",
|
|
33
|
+
descriptionKey: "ui.agent.pdfViewer.state.status",
|
|
34
|
+
description: "Whether the document has loaded. Read this first — every action is a silent no-op while the viewer is loading or has failed.",
|
|
35
|
+
read: (a) => a.getStatus()
|
|
36
|
+
},
|
|
37
|
+
currentPage: {
|
|
38
|
+
type: "number",
|
|
39
|
+
descriptionKey: "ui.agent.pdfViewer.state.currentPage",
|
|
40
|
+
description: "1-indexed page currently in view. The read-back for `go_to_page`, which clamps out-of-range requests silently.",
|
|
41
|
+
read: (a) => a.getCurrentPage()
|
|
42
|
+
},
|
|
43
|
+
pageCount: {
|
|
44
|
+
type: "number",
|
|
45
|
+
descriptionKey: "ui.agent.pdfViewer.state.pageCount",
|
|
46
|
+
description: "Number of pages in the loaded document, or 0 before it loads. Range-check against this before calling `go_to_page` rather than discovering the clamp after the fact.",
|
|
47
|
+
read: (a) => a.getPageCount()
|
|
48
|
+
},
|
|
49
|
+
zoom: {
|
|
50
|
+
type: "'fit-width' | 'fit-page' | 'actual-size' | number",
|
|
51
|
+
descriptionKey: "ui.agent.pdfViewer.state.zoom",
|
|
52
|
+
description: "Zoom preset or numeric scale factor currently applied. The read-back for `set_zoom`.",
|
|
53
|
+
read: (a) => a.getZoom()
|
|
54
|
+
},
|
|
55
|
+
searchMatchCount: {
|
|
56
|
+
type: "number",
|
|
57
|
+
descriptionKey: "ui.agent.pdfViewer.state.searchMatchCount",
|
|
58
|
+
description: "Number of matches for the active search query — 0 when nothing matched or no search is running. A count only; the matched text is never exposed.",
|
|
59
|
+
read: (a) => a.getSearchMatchCount()
|
|
60
|
+
}
|
|
61
|
+
},
|
|
24
62
|
actions: {
|
|
25
63
|
go_to_page: {
|
|
26
64
|
safety: "read",
|
|
@@ -37,12 +75,15 @@ const $e = {
|
|
|
37
75
|
required: ["page"]
|
|
38
76
|
},
|
|
39
77
|
idempotent: !0,
|
|
40
|
-
errors: [
|
|
78
|
+
errors: [
|
|
79
|
+
'No-op while `status` is not "ready" — the document has not loaded.',
|
|
80
|
+
"A page outside 1..`pageCount` is silently clamped into range; read `currentPage` back to see where it landed."
|
|
81
|
+
],
|
|
41
82
|
examples: [{ args: { page: 2 } }],
|
|
42
83
|
descriptionKey: "ui.agent.pdfViewer.actions.goToPage",
|
|
43
|
-
description:
|
|
44
|
-
invoke: (
|
|
45
|
-
|
|
84
|
+
description: 'Navigate to a specific 1-indexed page. Check `pageCount` first — an out-of-range page is clamped silently, and the call is a no-op until `status` is "ready".',
|
|
85
|
+
invoke: (a, t) => {
|
|
86
|
+
a.goToPage(t.page);
|
|
46
87
|
}
|
|
47
88
|
},
|
|
48
89
|
set_zoom: {
|
|
@@ -65,8 +106,8 @@ const $e = {
|
|
|
65
106
|
examples: [{ args: { zoom: "fit-width" } }, { args: { zoom: 1.5 } }],
|
|
66
107
|
descriptionKey: "ui.agent.pdfViewer.actions.setZoom",
|
|
67
108
|
description: "Apply a zoom preset or numeric scale factor.",
|
|
68
|
-
invoke: (
|
|
69
|
-
|
|
109
|
+
invoke: (a, t) => {
|
|
110
|
+
a.setZoom(t.zoom);
|
|
70
111
|
}
|
|
71
112
|
},
|
|
72
113
|
search: {
|
|
@@ -85,17 +126,17 @@ const $e = {
|
|
|
85
126
|
idempotent: !0,
|
|
86
127
|
examples: [{ args: { query: "consent" } }],
|
|
87
128
|
descriptionKey: "ui.agent.pdfViewer.actions.search",
|
|
88
|
-
description: "Search the document for the given query and highlight matches.",
|
|
89
|
-
invoke: (
|
|
90
|
-
|
|
129
|
+
description: "Search the document for the given query and highlight matches. Read the `searchMatchCount` slot afterwards — the action itself returns nothing.",
|
|
130
|
+
invoke: (a, t) => {
|
|
131
|
+
a.search(t.query);
|
|
91
132
|
}
|
|
92
133
|
},
|
|
93
134
|
print: {
|
|
94
135
|
safety: "read",
|
|
95
136
|
descriptionKey: "ui.agent.pdfViewer.actions.print",
|
|
96
137
|
description: "Open the browser print dialog for the document.",
|
|
97
|
-
invoke: (
|
|
98
|
-
|
|
138
|
+
invoke: (a) => {
|
|
139
|
+
a.print();
|
|
99
140
|
}
|
|
100
141
|
}
|
|
101
142
|
},
|
|
@@ -108,8 +149,8 @@ const $e = {
|
|
|
108
149
|
}
|
|
109
150
|
}
|
|
110
151
|
};
|
|
111
|
-
|
|
112
|
-
const
|
|
152
|
+
ge.GlobalWorkerOptions.workerSrc = De;
|
|
153
|
+
const Se = $(
|
|
113
154
|
[
|
|
114
155
|
"ds:pdf-viewer-alfadocs ds:flex ds:flex-col",
|
|
115
156
|
// Allow the viewer to shrink below its content's intrinsic width when it
|
|
@@ -126,7 +167,7 @@ const Pe = $(
|
|
|
126
167
|
"ds:focus-visible:outline-[var(--ring)]",
|
|
127
168
|
"ds:forced-colors:focus-visible:outline-[CanvasText]"
|
|
128
169
|
].join(" ")
|
|
129
|
-
),
|
|
170
|
+
), Ye = $(
|
|
130
171
|
[
|
|
131
172
|
"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
|
|
132
173
|
"ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)]",
|
|
@@ -134,7 +175,7 @@ const Pe = $(
|
|
|
134
175
|
"ds:bg-[var(--background)]",
|
|
135
176
|
"ds:border-b ds:border-[color:var(--border)]"
|
|
136
177
|
].join(" ")
|
|
137
|
-
),
|
|
178
|
+
), Me = $(
|
|
138
179
|
[
|
|
139
180
|
"ds:inline-flex ds:items-center ds:justify-center",
|
|
140
181
|
"ds:[min-block-size:var(--min-target-size)]",
|
|
@@ -151,7 +192,7 @@ const Pe = $(
|
|
|
151
192
|
"ds:forced-colors:focus-visible:outline-[CanvasText]",
|
|
152
193
|
"ds:aria-disabled:opacity-[var(--opacity-50)] ds:aria-disabled:cursor-not-allowed"
|
|
153
194
|
].join(" ")
|
|
154
|
-
),
|
|
195
|
+
), Ne = $(
|
|
155
196
|
[
|
|
156
197
|
"ds:[min-block-size:var(--min-target-size)]",
|
|
157
198
|
"ds:inline-size-[4rem] ds:text-center",
|
|
@@ -163,7 +204,7 @@ const Pe = $(
|
|
|
163
204
|
"ds:focus-visible:outline-[var(--ring)]",
|
|
164
205
|
"ds:forced-colors:focus-visible:outline-[CanvasText]"
|
|
165
206
|
].join(" ")
|
|
166
|
-
),
|
|
207
|
+
), et = $(
|
|
167
208
|
[
|
|
168
209
|
"ds:[min-block-size:var(--min-target-size)]",
|
|
169
210
|
"ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)]",
|
|
@@ -174,7 +215,7 @@ const Pe = $(
|
|
|
174
215
|
"ds:focus-visible:outline-[var(--ring)]",
|
|
175
216
|
"ds:forced-colors:focus-visible:outline-[CanvasText]"
|
|
176
217
|
].join(" ")
|
|
177
|
-
),
|
|
218
|
+
), tt = $(
|
|
178
219
|
[
|
|
179
220
|
"ds:relative ds:flex ds:flex-col ds:items-center",
|
|
180
221
|
"ds:gap-[var(--spacing-md)]",
|
|
@@ -195,14 +236,14 @@ const Pe = $(
|
|
|
195
236
|
"ds:min-h-[30rem]",
|
|
196
237
|
"ds:max-h-[80vh]"
|
|
197
238
|
].join(" ")
|
|
198
|
-
),
|
|
239
|
+
), rt = $(
|
|
199
240
|
[
|
|
200
241
|
"ds:relative ds:flex ds:items-center ds:justify-center",
|
|
201
242
|
"ds:bg-[var(--background)]",
|
|
202
243
|
"ds:shadow-[var(--shadow-md)]",
|
|
203
244
|
"ds:rounded-[var(--radius-sm)]"
|
|
204
245
|
].join(" ")
|
|
205
|
-
),
|
|
246
|
+
), at = [
|
|
206
247
|
"fit-width",
|
|
207
248
|
"fit-page",
|
|
208
249
|
"actual-size",
|
|
@@ -213,55 +254,55 @@ const Pe = $(
|
|
|
213
254
|
1.5,
|
|
214
255
|
2
|
|
215
256
|
];
|
|
216
|
-
function
|
|
217
|
-
return typeof
|
|
257
|
+
function ee(a) {
|
|
258
|
+
return typeof a == "number";
|
|
218
259
|
}
|
|
219
|
-
function
|
|
220
|
-
if (
|
|
221
|
-
if (
|
|
222
|
-
const
|
|
223
|
-
return
|
|
260
|
+
function Ie(a, t, v) {
|
|
261
|
+
if (ee(a)) return a;
|
|
262
|
+
if (a === "actual-size" || !v) return 1;
|
|
263
|
+
const g = window.getComputedStyle(v), h = parseFloat(g.paddingInlineStart || "0") + parseFloat(g.paddingInlineEnd || "0"), m = parseFloat(g.paddingBlockStart || "0") + parseFloat(g.paddingBlockEnd || "0"), w = Math.max(v.clientWidth - h, 1), x = Math.max(v.clientHeight - m, 1), z = t.width, k = t.height;
|
|
264
|
+
return a === "fit-width" ? w / z : Math.min(w / z, x / k);
|
|
224
265
|
}
|
|
225
266
|
const nt = Ze(
|
|
226
267
|
({
|
|
227
|
-
id:
|
|
268
|
+
id: a,
|
|
228
269
|
src: t,
|
|
229
270
|
initialPage: v = 1,
|
|
230
|
-
initialZoom:
|
|
231
|
-
pageRotation:
|
|
232
|
-
renderPageOverlay:
|
|
271
|
+
initialZoom: g = "fit-width",
|
|
272
|
+
pageRotation: h,
|
|
273
|
+
renderPageOverlay: m,
|
|
233
274
|
onPageChange: w,
|
|
234
275
|
onLoadComplete: x,
|
|
235
276
|
onError: z,
|
|
236
277
|
toolbar: k = !0,
|
|
237
|
-
toolbarVariant:
|
|
238
|
-
ariaLabel:
|
|
278
|
+
toolbarVariant: Z = "full",
|
|
279
|
+
ariaLabel: C,
|
|
239
280
|
className: S
|
|
240
281
|
}, b) => {
|
|
241
|
-
const { t:
|
|
282
|
+
const { t: u } = he(), M = _e(), N = Pe(
|
|
242
283
|
() => `pdf-${M.replace(/[^a-zA-Z0-9-_]/g, "")}`,
|
|
243
284
|
[M]
|
|
244
|
-
), [
|
|
285
|
+
), [O, f] = y(!1), [L, W] = y(!1);
|
|
245
286
|
T(() => {
|
|
246
287
|
if (typeof document > "u") return;
|
|
247
|
-
|
|
248
|
-
const e = window.matchMedia("(prefers-reduced-motion: reduce)"), r = () =>
|
|
288
|
+
f(document.documentElement.dir === "rtl");
|
|
289
|
+
const e = window.matchMedia("(prefers-reduced-motion: reduce)"), r = () => W(e.matches);
|
|
249
290
|
return r(), e.addEventListener("change", r), () => e.removeEventListener("change", r);
|
|
250
291
|
}, []);
|
|
251
|
-
const [
|
|
292
|
+
const [o, Q] = y(null), [i, I] = y(null), [l, D] = y(v), [P, R] = y(g), [_, q] = y({ start: Math.max(1, v - 1), end: v + 1 }), [U, A] = y(""), [n, p] = y(!1), [te, me] = y(""), [ve, Ae] = y({ current: 0, total: 0 }), ne = j(w), se = j(x), oe = j(z);
|
|
252
293
|
T(() => {
|
|
253
|
-
ne.current = w,
|
|
294
|
+
ne.current = w, se.current = x, oe.current = z;
|
|
254
295
|
}, [w, x, z]);
|
|
255
|
-
const
|
|
296
|
+
const le = j(null);
|
|
256
297
|
T(() => {
|
|
257
|
-
|
|
258
|
-
}, [
|
|
298
|
+
le.current = o;
|
|
299
|
+
}, [o]), T(() => {
|
|
259
300
|
let e = !1;
|
|
260
|
-
|
|
301
|
+
Q(null), I(null);
|
|
261
302
|
const r = {
|
|
262
303
|
disableJavaScript: !0,
|
|
263
304
|
isEvalSupported: !1
|
|
264
|
-
}, c =
|
|
305
|
+
}, c = ge.getDocument(
|
|
265
306
|
typeof t == "string" ? { url: t, ...r } : t instanceof Uint8Array ? { data: t, ...r } : { data: new Uint8Array(t), ...r }
|
|
266
307
|
);
|
|
267
308
|
return c.promise.then(
|
|
@@ -270,8 +311,8 @@ const nt = Ze(
|
|
|
270
311
|
if (e) return;
|
|
271
312
|
let V;
|
|
272
313
|
try {
|
|
273
|
-
const X = await d.getMetadata(),
|
|
274
|
-
V =
|
|
314
|
+
const X = await d.getMetadata(), E = X == null ? void 0 : X.info;
|
|
315
|
+
V = E == null ? void 0 : E.Title;
|
|
275
316
|
} catch {
|
|
276
317
|
V = void 0;
|
|
277
318
|
}
|
|
@@ -283,246 +324,265 @@ const nt = Ze(
|
|
|
283
324
|
return;
|
|
284
325
|
}
|
|
285
326
|
const B = { doc: d, numPages: d.numPages, title: V };
|
|
286
|
-
|
|
327
|
+
Q(B), (J = se.current) == null || J.call(se, { numPages: d.numPages, title: V });
|
|
287
328
|
},
|
|
288
329
|
(d) => {
|
|
289
330
|
var B;
|
|
290
331
|
if (e) return;
|
|
291
332
|
const V = d instanceof Error ? d : new Error(String(d));
|
|
292
|
-
I(V), (B =
|
|
333
|
+
I(V), (B = oe.current) == null || B.call(oe, V);
|
|
293
334
|
}
|
|
294
335
|
), () => {
|
|
295
336
|
e = !0, c.destroy();
|
|
296
|
-
const d =
|
|
337
|
+
const d = le.current;
|
|
297
338
|
if (d) {
|
|
298
339
|
try {
|
|
299
340
|
d.doc.destroy();
|
|
300
341
|
} catch {
|
|
301
342
|
}
|
|
302
|
-
|
|
343
|
+
le.current = null;
|
|
303
344
|
}
|
|
304
345
|
};
|
|
305
346
|
}, [t]), T(() => {
|
|
306
347
|
var e;
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
), (e = ne.current) == null || e.call(ne,
|
|
310
|
-
}, [
|
|
311
|
-
const
|
|
348
|
+
o && (A(
|
|
349
|
+
u("pdf.pageOf", { current: l, total: o.numPages })
|
|
350
|
+
), (e = ne.current) == null || e.call(ne, l));
|
|
351
|
+
}, [l, o, u]);
|
|
352
|
+
const ie = j(null), ue = j([]), F = H(
|
|
312
353
|
(e) => {
|
|
313
|
-
if (!
|
|
314
|
-
const r = Math.max(1, Math.min(e,
|
|
315
|
-
|
|
316
|
-
const c =
|
|
354
|
+
if (!o) return;
|
|
355
|
+
const r = Math.max(1, Math.min(e, o.numPages));
|
|
356
|
+
D(r);
|
|
357
|
+
const c = ue.current[r - 1];
|
|
317
358
|
c && c.scrollIntoView({
|
|
318
359
|
behavior: "auto",
|
|
319
360
|
block: "start"
|
|
320
361
|
});
|
|
321
362
|
},
|
|
322
|
-
[
|
|
323
|
-
),
|
|
324
|
-
|
|
325
|
-
}, []),
|
|
363
|
+
[o, L]
|
|
364
|
+
), be = H((e) => {
|
|
365
|
+
R(e);
|
|
366
|
+
}, []), re = H(() => {
|
|
326
367
|
typeof window < "u" && window.print();
|
|
327
|
-
}, []),
|
|
328
|
-
|
|
329
|
-
}, []),
|
|
368
|
+
}, []), ye = H((e) => {
|
|
369
|
+
me(e), p(e.length > 0);
|
|
370
|
+
}, []), G = j({
|
|
371
|
+
currentPage: l,
|
|
372
|
+
pageCount: 0,
|
|
373
|
+
zoom: P,
|
|
374
|
+
status: "loading",
|
|
375
|
+
searchMatchCount: 0
|
|
376
|
+
});
|
|
377
|
+
G.current = {
|
|
378
|
+
currentPage: l,
|
|
379
|
+
pageCount: (o == null ? void 0 : o.numPages) ?? 0,
|
|
380
|
+
zoom: P,
|
|
381
|
+
status: i ? "error" : o ? "ready" : "loading",
|
|
382
|
+
searchMatchCount: ve.total
|
|
383
|
+
};
|
|
384
|
+
const pe = Pe(
|
|
330
385
|
() => ({
|
|
331
|
-
goToPage:
|
|
332
|
-
setZoom:
|
|
333
|
-
search:
|
|
334
|
-
print:
|
|
386
|
+
goToPage: F,
|
|
387
|
+
setZoom: be,
|
|
388
|
+
search: ye,
|
|
389
|
+
print: re,
|
|
390
|
+
getCurrentPage: () => G.current.currentPage,
|
|
391
|
+
getPageCount: () => G.current.pageCount,
|
|
392
|
+
getZoom: () => G.current.zoom,
|
|
393
|
+
getStatus: () => G.current.status,
|
|
394
|
+
getSearchMatchCount: () => G.current.searchMatchCount
|
|
335
395
|
}),
|
|
336
|
-
[
|
|
396
|
+
[F, be, ye, re]
|
|
337
397
|
);
|
|
338
|
-
Le(b, () =>
|
|
339
|
-
const
|
|
398
|
+
Le(b, () => pe, [pe]), Be(Ge, pe, a);
|
|
399
|
+
const Oe = H(
|
|
340
400
|
(e) => {
|
|
341
|
-
if (!
|
|
401
|
+
if (!o) return;
|
|
342
402
|
const r = e.metaKey || e.ctrlKey;
|
|
343
403
|
if (e.key === "PageDown") {
|
|
344
|
-
e.preventDefault(),
|
|
404
|
+
e.preventDefault(), F(l + 1);
|
|
345
405
|
return;
|
|
346
406
|
}
|
|
347
407
|
if (e.key === "PageUp") {
|
|
348
|
-
e.preventDefault(),
|
|
408
|
+
e.preventDefault(), F(l - 1);
|
|
349
409
|
return;
|
|
350
410
|
}
|
|
351
411
|
if (e.key === "Home") {
|
|
352
|
-
e.preventDefault(),
|
|
412
|
+
e.preventDefault(), F(1);
|
|
353
413
|
return;
|
|
354
414
|
}
|
|
355
415
|
if (e.key === "End") {
|
|
356
|
-
e.preventDefault(),
|
|
416
|
+
e.preventDefault(), F(o.numPages);
|
|
357
417
|
return;
|
|
358
418
|
}
|
|
359
419
|
if (r && e.key.toLowerCase() === "f") {
|
|
360
|
-
e.preventDefault(),
|
|
420
|
+
e.preventDefault(), p(!0);
|
|
361
421
|
return;
|
|
362
422
|
}
|
|
363
423
|
if (r && (e.key === "+" || e.key === "=")) {
|
|
364
|
-
e.preventDefault(),
|
|
424
|
+
e.preventDefault(), R((c) => ee(c) ? Math.min(c * 1.25, 4) : 1.25);
|
|
365
425
|
return;
|
|
366
426
|
}
|
|
367
427
|
if (r && e.key === "-") {
|
|
368
|
-
e.preventDefault(),
|
|
369
|
-
(c) =>
|
|
428
|
+
e.preventDefault(), R(
|
|
429
|
+
(c) => ee(c) ? Math.max(c / 1.25, 0.25) : 0.75
|
|
370
430
|
);
|
|
371
431
|
return;
|
|
372
432
|
}
|
|
373
433
|
if (r && e.key === "0") {
|
|
374
|
-
e.preventDefault(),
|
|
434
|
+
e.preventDefault(), R("fit-width");
|
|
375
435
|
return;
|
|
376
436
|
}
|
|
377
|
-
r && e.key.toLowerCase() === "p" && (e.preventDefault(),
|
|
437
|
+
r && e.key.toLowerCase() === "p" && (e.preventDefault(), re());
|
|
378
438
|
},
|
|
379
|
-
[
|
|
380
|
-
), fe =
|
|
439
|
+
[l, F, re, o]
|
|
440
|
+
), fe = j(l);
|
|
381
441
|
T(() => {
|
|
382
|
-
fe.current =
|
|
383
|
-
}, [
|
|
384
|
-
if (!
|
|
385
|
-
const e =
|
|
442
|
+
fe.current = l;
|
|
443
|
+
}, [l]), T(() => {
|
|
444
|
+
if (!o) return;
|
|
445
|
+
const e = ie.current;
|
|
386
446
|
if (!e) return;
|
|
387
447
|
const r = /* @__PURE__ */ new Map(), c = new IntersectionObserver(
|
|
388
448
|
(d) => {
|
|
389
|
-
for (const
|
|
390
|
-
const
|
|
391
|
-
if (!
|
|
392
|
-
const
|
|
393
|
-
r.set(
|
|
449
|
+
for (const E of d) {
|
|
450
|
+
const Y = E.target.dataset.pageNumber;
|
|
451
|
+
if (!Y) continue;
|
|
452
|
+
const Ke = Number(Y);
|
|
453
|
+
r.set(Ke, E.intersectionRatio);
|
|
394
454
|
}
|
|
395
455
|
let V = fe.current, B = 0, J = 1 / 0, X = -1 / 0;
|
|
396
|
-
for (const [
|
|
397
|
-
|
|
398
|
-
B > 0 && V !== fe.current &&
|
|
456
|
+
for (const [E, Y] of r.entries())
|
|
457
|
+
Y > B && (V = E, B = Y), Y > 0 && (J = Math.min(J, E), X = Math.max(X, E));
|
|
458
|
+
B > 0 && V !== fe.current && D(V), J !== 1 / 0 && q({
|
|
399
459
|
start: Math.max(1, J - 1),
|
|
400
|
-
end: Math.min(
|
|
460
|
+
end: Math.min(o.numPages, X + 1)
|
|
401
461
|
});
|
|
402
462
|
},
|
|
403
463
|
{ root: e, threshold: [0, 0.25, 0.5, 0.75, 1] }
|
|
404
464
|
);
|
|
405
|
-
return
|
|
465
|
+
return ue.current.forEach((d) => {
|
|
406
466
|
d && c.observe(d);
|
|
407
467
|
}), () => c.disconnect();
|
|
408
|
-
}, [
|
|
409
|
-
const [
|
|
468
|
+
}, [o]);
|
|
469
|
+
const [Ve, je] = y(0);
|
|
410
470
|
T(() => {
|
|
411
|
-
const e =
|
|
471
|
+
const e = ie.current;
|
|
412
472
|
if (!e || typeof ResizeObserver > "u") return;
|
|
413
473
|
const r = new ResizeObserver(() => {
|
|
414
|
-
(
|
|
474
|
+
(P === "fit-width" || P === "fit-page") && je((c) => c + 1);
|
|
415
475
|
});
|
|
416
476
|
return r.observe(e), () => r.disconnect();
|
|
417
|
-
}, [
|
|
418
|
-
const
|
|
477
|
+
}, [P]);
|
|
478
|
+
const we = j([]), [de, xe] = y(0), Fe = H(
|
|
419
479
|
(e) => (r) => {
|
|
420
|
-
|
|
480
|
+
we.current[e] = r;
|
|
421
481
|
},
|
|
422
482
|
[]
|
|
423
|
-
),
|
|
424
|
-
const r =
|
|
483
|
+
), ze = H((e) => {
|
|
484
|
+
const r = we.current[e];
|
|
425
485
|
r && r.focus();
|
|
426
|
-
}, []),
|
|
486
|
+
}, []), ce = Z === "minimal" ? 2 : 8, Ee = H(
|
|
427
487
|
(e) => {
|
|
428
|
-
const r =
|
|
488
|
+
const r = O ? "ArrowLeft" : "ArrowRight", c = O ? "ArrowRight" : "ArrowLeft";
|
|
429
489
|
let d = null;
|
|
430
|
-
e.key === r ? d = (
|
|
490
|
+
e.key === r ? d = (de + 1) % ce : e.key === c ? d = (de - 1 + ce) % ce : e.key === "Home" ? d = 0 : e.key === "End" && (d = ce - 1), d !== null && (e.preventDefault(), xe(d), ze(d));
|
|
431
491
|
},
|
|
432
|
-
[
|
|
492
|
+
[ze, O, de]
|
|
433
493
|
);
|
|
434
|
-
return i ? /* @__PURE__ */
|
|
494
|
+
return i ? /* @__PURE__ */ s(
|
|
435
495
|
"div",
|
|
436
496
|
{
|
|
437
|
-
className: [
|
|
438
|
-
"aria-label":
|
|
439
|
-
children: /* @__PURE__ */
|
|
440
|
-
|
|
497
|
+
className: [Se(), S].filter(Boolean).join(" "),
|
|
498
|
+
"aria-label": C ?? u("pdf.error"),
|
|
499
|
+
children: /* @__PURE__ */ s("div", { className: "ds:p-[var(--spacing-lg)]", children: /* @__PURE__ */ s(Ce, { variant: "error", live: "polite", children: /* @__PURE__ */ K(Ce.Description, { children: [
|
|
500
|
+
u("pdf.error"),
|
|
441
501
|
": ",
|
|
442
502
|
i.message
|
|
443
503
|
] }) }) })
|
|
444
504
|
}
|
|
445
505
|
) : (
|
|
446
506
|
// 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
|
|
447
|
-
/* @__PURE__ */
|
|
507
|
+
/* @__PURE__ */ K(
|
|
448
508
|
"div",
|
|
449
509
|
{
|
|
450
|
-
id:
|
|
510
|
+
id: N,
|
|
451
511
|
role: "region",
|
|
452
|
-
"aria-label":
|
|
453
|
-
className: [
|
|
454
|
-
dir:
|
|
455
|
-
onKeyDown:
|
|
512
|
+
"aria-label": C ?? u("pdf.toolbarLabel"),
|
|
513
|
+
className: [Se(), S].filter(Boolean).join(" "),
|
|
514
|
+
dir: O ? "rtl" : void 0,
|
|
515
|
+
onKeyDown: Oe,
|
|
456
516
|
tabIndex: -1,
|
|
457
517
|
"data-component": "pdf-viewer",
|
|
458
|
-
"data-component-id":
|
|
518
|
+
"data-component-id": a,
|
|
459
519
|
"data-pdfjs-worker-src": De,
|
|
460
520
|
children: [
|
|
461
|
-
k ? /* @__PURE__ */
|
|
462
|
-
|
|
521
|
+
k ? /* @__PURE__ */ s(
|
|
522
|
+
st,
|
|
463
523
|
{
|
|
464
|
-
variant:
|
|
465
|
-
currentPage:
|
|
466
|
-
numPages: (
|
|
467
|
-
zoom:
|
|
468
|
-
onPrev: () =>
|
|
469
|
-
onNext: () =>
|
|
470
|
-
onJump: (e) =>
|
|
524
|
+
variant: Z,
|
|
525
|
+
currentPage: l,
|
|
526
|
+
numPages: (o == null ? void 0 : o.numPages) ?? 0,
|
|
527
|
+
zoom: P,
|
|
528
|
+
onPrev: () => F(l - 1),
|
|
529
|
+
onNext: () => F(l + 1),
|
|
530
|
+
onJump: (e) => F(e),
|
|
471
531
|
onZoomIn: () => {
|
|
472
|
-
|
|
473
|
-
(e) =>
|
|
532
|
+
R(
|
|
533
|
+
(e) => ee(e) ? Math.min(e * 1.25, 4) : 1.25
|
|
474
534
|
);
|
|
475
535
|
},
|
|
476
536
|
onZoomOut: () => {
|
|
477
|
-
|
|
478
|
-
(e) =>
|
|
537
|
+
R(
|
|
538
|
+
(e) => ee(e) ? Math.max(e / 1.25, 0.25) : 0.75
|
|
479
539
|
);
|
|
480
540
|
},
|
|
481
|
-
onZoomPreset: (e) =>
|
|
482
|
-
onOpenSearch: () =>
|
|
483
|
-
onPrint:
|
|
541
|
+
onZoomPreset: (e) => R(e),
|
|
542
|
+
onOpenSearch: () => p(!0),
|
|
543
|
+
onPrint: re,
|
|
484
544
|
searchOpen: n,
|
|
485
|
-
onSearchOpenChange:
|
|
486
|
-
searchQuery:
|
|
545
|
+
onSearchOpenChange: p,
|
|
546
|
+
searchQuery: te,
|
|
487
547
|
onSearchQueryChange: (e) => {
|
|
488
|
-
|
|
548
|
+
me(e);
|
|
489
549
|
},
|
|
490
|
-
searchMatches:
|
|
491
|
-
register:
|
|
492
|
-
focusIndex:
|
|
493
|
-
setFocusIndex:
|
|
494
|
-
onToolbarKeyDown:
|
|
495
|
-
isRtl:
|
|
550
|
+
searchMatches: ve,
|
|
551
|
+
register: Fe,
|
|
552
|
+
focusIndex: de,
|
|
553
|
+
setFocusIndex: xe,
|
|
554
|
+
onToolbarKeyDown: Ee,
|
|
555
|
+
isRtl: O
|
|
496
556
|
}
|
|
497
557
|
) : null,
|
|
498
|
-
/* @__PURE__ */
|
|
499
|
-
/* @__PURE__ */
|
|
558
|
+
/* @__PURE__ */ s("div", { "aria-live": "polite", "aria-atomic": "true", className: "ds:sr-only", children: U }),
|
|
559
|
+
/* @__PURE__ */ s(
|
|
500
560
|
"div",
|
|
501
561
|
{
|
|
502
|
-
ref:
|
|
503
|
-
className:
|
|
562
|
+
ref: ie,
|
|
563
|
+
className: tt(),
|
|
504
564
|
"data-testid": "pdf-pages-container",
|
|
505
565
|
tabIndex: 0,
|
|
506
|
-
"aria-label":
|
|
507
|
-
children:
|
|
508
|
-
(e) => /* @__PURE__ */
|
|
509
|
-
|
|
566
|
+
"aria-label": u("pdf.pagesRegionLabel"),
|
|
567
|
+
children: o ? Array.from({ length: o.numPages }, (e, r) => r + 1).map(
|
|
568
|
+
(e) => /* @__PURE__ */ s(
|
|
569
|
+
ot,
|
|
510
570
|
{
|
|
511
571
|
pageNumber: e,
|
|
512
|
-
totalPages:
|
|
513
|
-
doc:
|
|
514
|
-
zoom:
|
|
515
|
-
pageRotation:
|
|
516
|
-
renderPageOverlay:
|
|
517
|
-
container:
|
|
518
|
-
resizeTick:
|
|
519
|
-
shouldRender: e >=
|
|
572
|
+
totalPages: o.numPages,
|
|
573
|
+
doc: o.doc,
|
|
574
|
+
zoom: P,
|
|
575
|
+
pageRotation: h,
|
|
576
|
+
renderPageOverlay: m,
|
|
577
|
+
container: ie.current,
|
|
578
|
+
resizeTick: Ve,
|
|
579
|
+
shouldRender: e >= _.start && e <= _.end,
|
|
520
580
|
registerRef: (r) => {
|
|
521
|
-
|
|
581
|
+
ue.current[e - 1] = r;
|
|
522
582
|
},
|
|
523
|
-
searchQuery:
|
|
583
|
+
searchQuery: te,
|
|
524
584
|
onMatchCount: (r) => {
|
|
525
|
-
|
|
585
|
+
Ae((c) => r === 0 && c.total === 0 ? c : {
|
|
526
586
|
current: Math.min(c.current || 1, r || 1),
|
|
527
587
|
total: Math.max(c.total, r)
|
|
528
588
|
});
|
|
@@ -530,9 +590,9 @@ const nt = Ze(
|
|
|
530
590
|
},
|
|
531
591
|
e
|
|
532
592
|
)
|
|
533
|
-
) : /* @__PURE__ */
|
|
534
|
-
/* @__PURE__ */
|
|
535
|
-
/* @__PURE__ */
|
|
593
|
+
) : /* @__PURE__ */ K("div", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)] ds:text-[var(--muted-foreground)] ds:p-[var(--spacing-lg)]", children: [
|
|
594
|
+
/* @__PURE__ */ s(qe, { variant: "pulse", size: "sm", label: u("pdf.loading") }),
|
|
595
|
+
/* @__PURE__ */ s("span", { children: u("pdf.loading") })
|
|
536
596
|
] })
|
|
537
597
|
}
|
|
538
598
|
)
|
|
@@ -543,89 +603,89 @@ const nt = Ze(
|
|
|
543
603
|
}
|
|
544
604
|
);
|
|
545
605
|
nt.displayName = "PDFViewer";
|
|
546
|
-
function
|
|
547
|
-
const { t } =
|
|
606
|
+
function st(a) {
|
|
607
|
+
const { t } = he(), {
|
|
548
608
|
variant: v,
|
|
549
|
-
currentPage:
|
|
550
|
-
numPages:
|
|
551
|
-
zoom:
|
|
609
|
+
currentPage: g,
|
|
610
|
+
numPages: h,
|
|
611
|
+
zoom: m,
|
|
552
612
|
onPrev: w,
|
|
553
613
|
onNext: x,
|
|
554
614
|
onJump: z,
|
|
555
615
|
onZoomIn: k,
|
|
556
|
-
onZoomOut:
|
|
557
|
-
onZoomPreset:
|
|
616
|
+
onZoomOut: Z,
|
|
617
|
+
onZoomPreset: C,
|
|
558
618
|
onOpenSearch: S,
|
|
559
619
|
onPrint: b,
|
|
560
|
-
searchOpen:
|
|
620
|
+
searchOpen: u,
|
|
561
621
|
onSearchOpenChange: M,
|
|
562
|
-
searchQuery:
|
|
563
|
-
onSearchQueryChange:
|
|
564
|
-
searchMatches:
|
|
565
|
-
register:
|
|
566
|
-
focusIndex:
|
|
567
|
-
setFocusIndex:
|
|
568
|
-
onToolbarKeyDown:
|
|
569
|
-
} =
|
|
622
|
+
searchQuery: N,
|
|
623
|
+
onSearchQueryChange: O,
|
|
624
|
+
searchMatches: f,
|
|
625
|
+
register: L,
|
|
626
|
+
focusIndex: W,
|
|
627
|
+
setFocusIndex: o,
|
|
628
|
+
onToolbarKeyDown: Q
|
|
629
|
+
} = a, i = v === "minimal", I = i ? 0 : 3, l = i ? 1 : 4, D = 5, [P, R] = y(String(g));
|
|
570
630
|
T(() => {
|
|
571
|
-
|
|
572
|
-
}, [
|
|
573
|
-
const
|
|
631
|
+
R(String(g));
|
|
632
|
+
}, [g]);
|
|
633
|
+
const _ = g <= 1, q = g >= h;
|
|
574
634
|
function U() {
|
|
575
|
-
const n = Number(
|
|
576
|
-
Number.isFinite(n) && n >= 1 ? z(Math.min(n,
|
|
635
|
+
const n = Number(P);
|
|
636
|
+
Number.isFinite(n) && n >= 1 ? z(Math.min(n, h)) : R(String(g));
|
|
577
637
|
}
|
|
578
|
-
function
|
|
579
|
-
return /* @__PURE__ */
|
|
638
|
+
function A(n) {
|
|
639
|
+
return /* @__PURE__ */ s(
|
|
580
640
|
"button",
|
|
581
641
|
{
|
|
582
642
|
type: "button",
|
|
583
|
-
ref:
|
|
584
|
-
tabIndex: n.index ===
|
|
585
|
-
onFocus: () =>
|
|
586
|
-
onKeyDown:
|
|
643
|
+
ref: L(n.index),
|
|
644
|
+
tabIndex: n.index === W ? 0 : -1,
|
|
645
|
+
onFocus: () => o(n.index),
|
|
646
|
+
onKeyDown: Q,
|
|
587
647
|
"aria-label": n.label,
|
|
588
648
|
"aria-disabled": n.disabled || void 0,
|
|
589
649
|
title: n.label,
|
|
590
|
-
onClick: (
|
|
650
|
+
onClick: (p) => {
|
|
591
651
|
if (n.disabled) {
|
|
592
|
-
|
|
652
|
+
p.preventDefault();
|
|
593
653
|
return;
|
|
594
654
|
}
|
|
595
655
|
n.onActivate();
|
|
596
656
|
},
|
|
597
|
-
className:
|
|
657
|
+
className: Me(),
|
|
598
658
|
children: n.icon
|
|
599
659
|
}
|
|
600
660
|
);
|
|
601
661
|
}
|
|
602
|
-
return /* @__PURE__ */
|
|
662
|
+
return /* @__PURE__ */ K(
|
|
603
663
|
"div",
|
|
604
664
|
{
|
|
605
665
|
role: "toolbar",
|
|
606
666
|
"aria-label": t("pdf.toolbarLabel"),
|
|
607
|
-
className:
|
|
667
|
+
className: Ye(),
|
|
608
668
|
children: [
|
|
609
|
-
!i && /* @__PURE__ */
|
|
610
|
-
|
|
669
|
+
!i && /* @__PURE__ */ K(ke, { children: [
|
|
670
|
+
A({
|
|
611
671
|
index: 0,
|
|
612
672
|
label: t("pdf.previousPage"),
|
|
613
|
-
disabled:
|
|
673
|
+
disabled: _,
|
|
614
674
|
onActivate: w,
|
|
615
|
-
icon: /* @__PURE__ */
|
|
616
|
-
|
|
675
|
+
icon: /* @__PURE__ */ s(
|
|
676
|
+
We,
|
|
617
677
|
{
|
|
618
678
|
"aria-hidden": "true",
|
|
619
679
|
className: "ds:block-size-4 ds:inline-size-4 ds:rtl:rotate-180"
|
|
620
680
|
}
|
|
621
681
|
)
|
|
622
682
|
}),
|
|
623
|
-
|
|
683
|
+
A({
|
|
624
684
|
index: 1,
|
|
625
685
|
label: t("pdf.nextPage"),
|
|
626
686
|
disabled: q,
|
|
627
687
|
onActivate: x,
|
|
628
|
-
icon: /* @__PURE__ */
|
|
688
|
+
icon: /* @__PURE__ */ s(
|
|
629
689
|
Qe,
|
|
630
690
|
{
|
|
631
691
|
"aria-hidden": "true",
|
|
@@ -633,34 +693,34 @@ function at(o) {
|
|
|
633
693
|
}
|
|
634
694
|
)
|
|
635
695
|
}),
|
|
636
|
-
/* @__PURE__ */
|
|
696
|
+
/* @__PURE__ */ s(
|
|
637
697
|
"input",
|
|
638
698
|
{
|
|
639
699
|
type: "number",
|
|
640
700
|
min: 1,
|
|
641
|
-
max: Math.max(
|
|
642
|
-
value:
|
|
643
|
-
onChange: (n) =>
|
|
701
|
+
max: Math.max(h, 1),
|
|
702
|
+
value: P,
|
|
703
|
+
onChange: (n) => R(n.target.value),
|
|
644
704
|
onKeyDown: (n) => {
|
|
645
705
|
n.key === "Enter" && (n.preventDefault(), U());
|
|
646
706
|
},
|
|
647
707
|
onBlur: U,
|
|
648
|
-
onFocus: () =>
|
|
649
|
-
ref:
|
|
650
|
-
tabIndex:
|
|
708
|
+
onFocus: () => o(2),
|
|
709
|
+
ref: L(2),
|
|
710
|
+
tabIndex: W === 2 ? 0 : -1,
|
|
651
711
|
"aria-label": t("pdf.currentPageInput"),
|
|
652
|
-
className:
|
|
712
|
+
className: Ne()
|
|
653
713
|
}
|
|
654
714
|
),
|
|
655
|
-
/* @__PURE__ */
|
|
715
|
+
/* @__PURE__ */ s(
|
|
656
716
|
"span",
|
|
657
717
|
{
|
|
658
718
|
"aria-hidden": "true",
|
|
659
719
|
className: "type-body-sm ds:text-[var(--muted-foreground)]",
|
|
660
|
-
children: t("pdf.pageOf", { current:
|
|
720
|
+
children: t("pdf.pageOf", { current: g, total: h || 0 })
|
|
661
721
|
}
|
|
662
722
|
),
|
|
663
|
-
/* @__PURE__ */
|
|
723
|
+
/* @__PURE__ */ s(
|
|
664
724
|
"span",
|
|
665
725
|
{
|
|
666
726
|
"aria-hidden": "true",
|
|
@@ -668,78 +728,78 @@ function at(o) {
|
|
|
668
728
|
}
|
|
669
729
|
)
|
|
670
730
|
] }),
|
|
671
|
-
|
|
731
|
+
A({
|
|
672
732
|
index: I,
|
|
673
733
|
label: t("pdf.zoom.out"),
|
|
674
|
-
onActivate:
|
|
675
|
-
icon: /* @__PURE__ */
|
|
676
|
-
|
|
734
|
+
onActivate: Z,
|
|
735
|
+
icon: /* @__PURE__ */ s(
|
|
736
|
+
Ue,
|
|
677
737
|
{
|
|
678
738
|
"aria-hidden": "true",
|
|
679
739
|
className: "ds:block-size-4 ds:inline-size-4"
|
|
680
740
|
}
|
|
681
741
|
)
|
|
682
742
|
}),
|
|
683
|
-
|
|
684
|
-
index:
|
|
743
|
+
A({
|
|
744
|
+
index: l,
|
|
685
745
|
label: t("pdf.zoom.in"),
|
|
686
746
|
onActivate: k,
|
|
687
|
-
icon: /* @__PURE__ */
|
|
688
|
-
|
|
747
|
+
icon: /* @__PURE__ */ s(
|
|
748
|
+
Je,
|
|
689
749
|
{
|
|
690
750
|
"aria-hidden": "true",
|
|
691
751
|
className: "ds:block-size-4 ds:inline-size-4"
|
|
692
752
|
}
|
|
693
753
|
)
|
|
694
754
|
}),
|
|
695
|
-
!i && /* @__PURE__ */
|
|
755
|
+
!i && /* @__PURE__ */ K(
|
|
696
756
|
"select",
|
|
697
757
|
{
|
|
698
758
|
"aria-label": t("pdf.zoom.preset"),
|
|
699
|
-
value: typeof
|
|
759
|
+
value: typeof m == "number" ? String(m) : m,
|
|
700
760
|
onChange: (n) => {
|
|
701
|
-
const
|
|
702
|
-
if (
|
|
703
|
-
|
|
761
|
+
const p = n.target.value;
|
|
762
|
+
if (p === "fit-width" || p === "fit-page" || p === "actual-size")
|
|
763
|
+
C(p);
|
|
704
764
|
else {
|
|
705
|
-
const
|
|
706
|
-
Number.isFinite(
|
|
765
|
+
const te = Number(p);
|
|
766
|
+
Number.isFinite(te) && C(te);
|
|
707
767
|
}
|
|
708
768
|
},
|
|
709
|
-
ref:
|
|
710
|
-
tabIndex:
|
|
711
|
-
onFocus: () =>
|
|
712
|
-
onKeyDown:
|
|
713
|
-
className:
|
|
769
|
+
ref: L(D),
|
|
770
|
+
tabIndex: W === D ? 0 : -1,
|
|
771
|
+
onFocus: () => o(D),
|
|
772
|
+
onKeyDown: Q,
|
|
773
|
+
className: et(),
|
|
714
774
|
children: [
|
|
715
|
-
/* @__PURE__ */
|
|
716
|
-
/* @__PURE__ */
|
|
717
|
-
/* @__PURE__ */
|
|
718
|
-
|
|
775
|
+
/* @__PURE__ */ s("option", { value: "fit-width", children: t("pdf.zoom.fitWidth") }),
|
|
776
|
+
/* @__PURE__ */ s("option", { value: "fit-page", children: t("pdf.zoom.fitPage") }),
|
|
777
|
+
/* @__PURE__ */ s("option", { value: "actual-size", children: t("pdf.zoom.actualSize") }),
|
|
778
|
+
at.filter(ee).map((n) => /* @__PURE__ */ s("option", { value: String(n), children: `${Math.round(n * 100)}%` }, n))
|
|
719
779
|
]
|
|
720
780
|
}
|
|
721
781
|
),
|
|
722
|
-
!i && /* @__PURE__ */
|
|
723
|
-
/* @__PURE__ */
|
|
724
|
-
|
|
782
|
+
!i && /* @__PURE__ */ K(ke, { children: [
|
|
783
|
+
/* @__PURE__ */ K(
|
|
784
|
+
ae.Root,
|
|
725
785
|
{
|
|
726
|
-
open:
|
|
786
|
+
open: u,
|
|
727
787
|
onOpenChange: M,
|
|
728
788
|
children: [
|
|
729
|
-
/* @__PURE__ */
|
|
789
|
+
/* @__PURE__ */ s(ae.Trigger, { asChild: !0, children: A({
|
|
730
790
|
index: 6,
|
|
731
791
|
label: t("pdf.search.open"),
|
|
732
792
|
onActivate: S,
|
|
733
|
-
icon: /* @__PURE__ */
|
|
734
|
-
|
|
793
|
+
icon: /* @__PURE__ */ s(
|
|
794
|
+
Xe,
|
|
735
795
|
{
|
|
736
796
|
"aria-hidden": "true",
|
|
737
797
|
className: "ds:block-size-4 ds:inline-size-4"
|
|
738
798
|
}
|
|
739
799
|
)
|
|
740
800
|
}) }),
|
|
741
|
-
/* @__PURE__ */
|
|
742
|
-
|
|
801
|
+
/* @__PURE__ */ s(ae.Portal, { children: /* @__PURE__ */ K(
|
|
802
|
+
ae.Content,
|
|
743
803
|
{
|
|
744
804
|
sideOffset: 8,
|
|
745
805
|
className: [
|
|
@@ -751,39 +811,39 @@ function at(o) {
|
|
|
751
811
|
"ds:flex ds:items-center ds:gap-[var(--spacing-xs)]"
|
|
752
812
|
].join(" "),
|
|
753
813
|
children: [
|
|
754
|
-
/* @__PURE__ */
|
|
814
|
+
/* @__PURE__ */ s(
|
|
755
815
|
"input",
|
|
756
816
|
{
|
|
757
817
|
type: "search",
|
|
758
818
|
autoFocus: !0,
|
|
759
|
-
value:
|
|
760
|
-
onChange: (n) =>
|
|
819
|
+
value: N,
|
|
820
|
+
onChange: (n) => O(n.target.value),
|
|
761
821
|
placeholder: t("pdf.search.placeholder"),
|
|
762
822
|
"aria-label": t("pdf.search.placeholder"),
|
|
763
|
-
className:
|
|
823
|
+
className: Ne({
|
|
764
824
|
className: "ds:inline-size-[16rem] ds:text-start"
|
|
765
825
|
})
|
|
766
826
|
}
|
|
767
827
|
),
|
|
768
|
-
/* @__PURE__ */
|
|
828
|
+
/* @__PURE__ */ s(
|
|
769
829
|
"span",
|
|
770
830
|
{
|
|
771
831
|
"aria-live": "polite",
|
|
772
832
|
className: "type-meta ds:text-[var(--muted-foreground)]",
|
|
773
|
-
children:
|
|
774
|
-
current:
|
|
775
|
-
total:
|
|
776
|
-
}) :
|
|
833
|
+
children: f.total > 0 ? t("pdf.search.countOfTotal", {
|
|
834
|
+
current: f.current,
|
|
835
|
+
total: f.total
|
|
836
|
+
}) : N ? t("pdf.search.noResults") : ""
|
|
777
837
|
}
|
|
778
838
|
),
|
|
779
|
-
/* @__PURE__ */
|
|
839
|
+
/* @__PURE__ */ s(ae.Close, { asChild: !0, children: /* @__PURE__ */ s(
|
|
780
840
|
"button",
|
|
781
841
|
{
|
|
782
842
|
type: "button",
|
|
783
843
|
"aria-label": t("pdf.search.close"),
|
|
784
|
-
className:
|
|
785
|
-
children: /* @__PURE__ */
|
|
786
|
-
|
|
844
|
+
className: Me(),
|
|
845
|
+
children: /* @__PURE__ */ s(
|
|
846
|
+
He,
|
|
787
847
|
{
|
|
788
848
|
"aria-hidden": "true",
|
|
789
849
|
className: "ds:block-size-4 ds:inline-size-4"
|
|
@@ -797,12 +857,12 @@ function at(o) {
|
|
|
797
857
|
]
|
|
798
858
|
}
|
|
799
859
|
),
|
|
800
|
-
|
|
860
|
+
A({
|
|
801
861
|
index: 7,
|
|
802
862
|
label: t("pdf.print"),
|
|
803
863
|
onActivate: b,
|
|
804
|
-
icon: /* @__PURE__ */
|
|
805
|
-
|
|
864
|
+
icon: /* @__PURE__ */ s(
|
|
865
|
+
$e,
|
|
806
866
|
{
|
|
807
867
|
"aria-hidden": "true",
|
|
808
868
|
className: "ds:block-size-4 ds:inline-size-4"
|
|
@@ -814,70 +874,70 @@ function at(o) {
|
|
|
814
874
|
}
|
|
815
875
|
);
|
|
816
876
|
}
|
|
817
|
-
function
|
|
877
|
+
function ot(a) {
|
|
818
878
|
const {
|
|
819
879
|
pageNumber: t,
|
|
820
880
|
totalPages: v,
|
|
821
|
-
doc:
|
|
822
|
-
zoom:
|
|
823
|
-
pageRotation:
|
|
881
|
+
doc: g,
|
|
882
|
+
zoom: h,
|
|
883
|
+
pageRotation: m,
|
|
824
884
|
renderPageOverlay: w,
|
|
825
885
|
container: x,
|
|
826
886
|
resizeTick: z,
|
|
827
887
|
shouldRender: k,
|
|
828
|
-
registerRef:
|
|
829
|
-
searchQuery:
|
|
888
|
+
registerRef: Z,
|
|
889
|
+
searchQuery: C,
|
|
830
890
|
onMatchCount: S
|
|
831
|
-
} =
|
|
891
|
+
} = a, { t: b } = he(), u = j(null), M = j(null), [N, O] = y({
|
|
832
892
|
width: 612,
|
|
833
893
|
height: 792
|
|
834
|
-
}), [
|
|
894
|
+
}), [f, L] = y(null);
|
|
835
895
|
T(() => {
|
|
836
896
|
let i = !1;
|
|
837
|
-
return
|
|
838
|
-
i ||
|
|
897
|
+
return g.getPage(t).then((I) => {
|
|
898
|
+
i || L(I);
|
|
839
899
|
}), () => {
|
|
840
900
|
i = !0;
|
|
841
901
|
};
|
|
842
|
-
}, [
|
|
843
|
-
if (!
|
|
844
|
-
const i = (
|
|
845
|
-
|
|
846
|
-
width: Math.floor(
|
|
847
|
-
height: Math.floor(
|
|
902
|
+
}, [g, t]), T(() => {
|
|
903
|
+
if (!f) return;
|
|
904
|
+
const i = (P) => m === void 0 ? { scale: P } : { scale: P, rotation: m }, I = f.getViewport(i(1)), l = Ie(h, I, x), D = f.getViewport(i(l));
|
|
905
|
+
O({
|
|
906
|
+
width: Math.floor(D.width),
|
|
907
|
+
height: Math.floor(D.height)
|
|
848
908
|
});
|
|
849
|
-
}, [
|
|
850
|
-
const
|
|
909
|
+
}, [f, h, x, z, m]);
|
|
910
|
+
const W = m ?? (f == null ? void 0 : f.rotate) ?? 0;
|
|
851
911
|
T(() => {
|
|
852
|
-
if (!
|
|
853
|
-
const
|
|
854
|
-
|
|
912
|
+
if (!f || !k) {
|
|
913
|
+
const p = u.current;
|
|
914
|
+
p && !k && (p.width = 0);
|
|
855
915
|
return;
|
|
856
916
|
}
|
|
857
|
-
const i =
|
|
917
|
+
const i = u.current, I = M.current;
|
|
858
918
|
if (!i) return;
|
|
859
|
-
const
|
|
860
|
-
if (!
|
|
861
|
-
const
|
|
862
|
-
i.width = Math.floor(
|
|
863
|
-
const U =
|
|
919
|
+
const l = i.getContext("2d");
|
|
920
|
+
if (!l) return;
|
|
921
|
+
const D = (p) => m === void 0 ? { scale: p } : { scale: p, rotation: m }, P = f.getViewport(D(1)), R = Ie(h, P, x), _ = f.getViewport(D(R)), q = Math.max(1, window.devicePixelRatio || 1);
|
|
922
|
+
i.width = Math.floor(_.width * q), i.height = Math.floor(_.height * q), l.setTransform(q, 0, 0, q, 0, 0);
|
|
923
|
+
const U = f.render({
|
|
864
924
|
canvas: i,
|
|
865
|
-
canvasContext:
|
|
866
|
-
viewport:
|
|
925
|
+
canvasContext: l,
|
|
926
|
+
viewport: _
|
|
867
927
|
});
|
|
868
|
-
let
|
|
928
|
+
let A = !1, n = null;
|
|
869
929
|
return U.promise.then(async () => {
|
|
870
|
-
if (
|
|
930
|
+
if (A || !I) return;
|
|
871
931
|
I.textContent = "";
|
|
872
|
-
const
|
|
873
|
-
|
|
874
|
-
textContentSource:
|
|
932
|
+
const p = await f.getTextContent();
|
|
933
|
+
A || (n = new ge.TextLayer({
|
|
934
|
+
textContentSource: p,
|
|
875
935
|
container: I,
|
|
876
|
-
viewport:
|
|
877
|
-
}), await n.render(),
|
|
936
|
+
viewport: _
|
|
937
|
+
}), await n.render(), Te(I, C, S));
|
|
878
938
|
}).catch(() => {
|
|
879
939
|
}), () => {
|
|
880
|
-
|
|
940
|
+
A = !0;
|
|
881
941
|
try {
|
|
882
942
|
U.cancel();
|
|
883
943
|
} catch {
|
|
@@ -889,39 +949,39 @@ function st(o) {
|
|
|
889
949
|
}
|
|
890
950
|
};
|
|
891
951
|
}, [
|
|
892
|
-
|
|
952
|
+
f,
|
|
893
953
|
k,
|
|
894
|
-
|
|
954
|
+
h,
|
|
895
955
|
x,
|
|
896
956
|
z,
|
|
897
|
-
|
|
957
|
+
C,
|
|
898
958
|
S,
|
|
899
|
-
|
|
959
|
+
m
|
|
900
960
|
]), T(() => {
|
|
901
961
|
if (!k) return;
|
|
902
962
|
const i = M.current;
|
|
903
|
-
i &&
|
|
904
|
-
}, [
|
|
905
|
-
const
|
|
906
|
-
width:
|
|
907
|
-
height:
|
|
908
|
-
},
|
|
909
|
-
width:
|
|
910
|
-
height:
|
|
963
|
+
i && Te(i, C, S);
|
|
964
|
+
}, [C, k, S]);
|
|
965
|
+
const o = {
|
|
966
|
+
width: N.width,
|
|
967
|
+
height: N.height
|
|
968
|
+
}, Q = {
|
|
969
|
+
width: N.width,
|
|
970
|
+
height: N.height
|
|
911
971
|
};
|
|
912
|
-
return /* @__PURE__ */
|
|
972
|
+
return /* @__PURE__ */ K(
|
|
913
973
|
"article",
|
|
914
974
|
{
|
|
915
975
|
ref: (i) => {
|
|
916
|
-
|
|
976
|
+
Z(i);
|
|
917
977
|
},
|
|
918
978
|
"data-page-number": t,
|
|
919
979
|
"aria-label": b("pdf.pageOf", { current: t, total: v }),
|
|
920
|
-
className:
|
|
921
|
-
style:
|
|
980
|
+
className: rt(),
|
|
981
|
+
style: Q,
|
|
922
982
|
children: [
|
|
923
|
-
/* @__PURE__ */
|
|
924
|
-
/* @__PURE__ */
|
|
983
|
+
/* @__PURE__ */ s("canvas", { ref: u, style: o }),
|
|
984
|
+
/* @__PURE__ */ s(
|
|
925
985
|
"div",
|
|
926
986
|
{
|
|
927
987
|
ref: M,
|
|
@@ -938,7 +998,7 @@ function st(o) {
|
|
|
938
998
|
].join(" ")
|
|
939
999
|
}
|
|
940
1000
|
),
|
|
941
|
-
k && w ? /* @__PURE__ */
|
|
1001
|
+
k && w ? /* @__PURE__ */ s(
|
|
942
1002
|
"div",
|
|
943
1003
|
{
|
|
944
1004
|
role: "group",
|
|
@@ -948,9 +1008,9 @@ function st(o) {
|
|
|
948
1008
|
"data-page-number": t,
|
|
949
1009
|
children: w({
|
|
950
1010
|
pageNumber: t,
|
|
951
|
-
pageWidthCss:
|
|
952
|
-
pageHeightCss:
|
|
953
|
-
rotation:
|
|
1011
|
+
pageWidthCss: N.width,
|
|
1012
|
+
pageHeightCss: N.height,
|
|
1013
|
+
rotation: W
|
|
954
1014
|
})
|
|
955
1015
|
}
|
|
956
1016
|
) : null
|
|
@@ -958,48 +1018,48 @@ function st(o) {
|
|
|
958
1018
|
}
|
|
959
1019
|
);
|
|
960
1020
|
}
|
|
961
|
-
function
|
|
962
|
-
return
|
|
1021
|
+
function Re(a) {
|
|
1022
|
+
return a.normalize("NFKD").replace(new RegExp("\\p{Diacritic}", "gu"), "").toLowerCase();
|
|
963
1023
|
}
|
|
964
|
-
function
|
|
965
|
-
if (
|
|
1024
|
+
function Te(a, t, v) {
|
|
1025
|
+
if (a.querySelectorAll("[data-match]").forEach((b) => {
|
|
966
1026
|
b.removeAttribute("data-match");
|
|
967
1027
|
}), !t) {
|
|
968
1028
|
v(0);
|
|
969
1029
|
return;
|
|
970
1030
|
}
|
|
971
|
-
const
|
|
972
|
-
if (!
|
|
1031
|
+
const h = Re(t);
|
|
1032
|
+
if (!h) {
|
|
973
1033
|
v(0);
|
|
974
1034
|
return;
|
|
975
1035
|
}
|
|
976
|
-
const
|
|
1036
|
+
const m = Array.from(a.querySelectorAll("span")), w = [], x = [];
|
|
977
1037
|
let z = 0;
|
|
978
|
-
for (const b of
|
|
979
|
-
const
|
|
980
|
-
w.push({ start: z, end: z +
|
|
1038
|
+
for (const b of m) {
|
|
1039
|
+
const u = Re(b.textContent ?? "");
|
|
1040
|
+
w.push({ start: z, end: z + u.length }), x.push(u), z += u.length;
|
|
981
1041
|
}
|
|
982
1042
|
const k = x.join("");
|
|
983
|
-
let
|
|
984
|
-
const
|
|
1043
|
+
let Z = 0;
|
|
1044
|
+
const C = /* @__PURE__ */ new Set();
|
|
985
1045
|
let S = 0;
|
|
986
|
-
for (; S <= k.length -
|
|
987
|
-
const b = k.indexOf(
|
|
1046
|
+
for (; S <= k.length - h.length; ) {
|
|
1047
|
+
const b = k.indexOf(h, S);
|
|
988
1048
|
if (b === -1) break;
|
|
989
|
-
|
|
990
|
-
const
|
|
1049
|
+
Z += 1;
|
|
1050
|
+
const u = b + h.length;
|
|
991
1051
|
for (let M = 0; M < w.length; M++) {
|
|
992
|
-
const { start:
|
|
993
|
-
|
|
1052
|
+
const { start: N, end: O } = w[M];
|
|
1053
|
+
N < u && O > b && C.add(M);
|
|
994
1054
|
}
|
|
995
|
-
S =
|
|
1055
|
+
S = u;
|
|
996
1056
|
}
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
}), v(
|
|
1057
|
+
C.forEach((b) => {
|
|
1058
|
+
m[b].setAttribute("data-match", "true");
|
|
1059
|
+
}), v(Z);
|
|
1000
1060
|
}
|
|
1001
1061
|
export {
|
|
1002
1062
|
nt as P,
|
|
1003
|
-
|
|
1063
|
+
Ge as p
|
|
1004
1064
|
};
|
|
1005
|
-
//# sourceMappingURL=pdf-viewer-
|
|
1065
|
+
//# sourceMappingURL=pdf-viewer-DUIsV9s5.js.map
|