@jc-times/business-ui 0.2.53 → 0.2.55

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.
@@ -4,165 +4,180 @@ import { PdfToolbar as n } from "../document-viewer/PdfToolbar.js";
4
4
  import { usePdfViewport as r } from "../document-viewer/usePdfViewport.js";
5
5
  import { ZoomGestureWrapper as i, react_exports as a, useZoom as o } from "../vendor/embedpdf-zoom-react.js";
6
6
  import { HeadlessSearch as s } from "./HeadlessSearch.js";
7
- import { useEffect as c, useLayoutEffect as l, useMemo as ee, useRef as u, useState as d } from "react";
8
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
9
- import { createPluginRegistration as m } from "@embedpdf/core";
10
- import { EmbedPDF as h, useDocumentState as g } from "@embedpdf/core/react";
11
- import { usePdfiumEngine as _ } from "@embedpdf/engines/react";
12
- import { DocumentManagerPluginPackage as v } from "@embedpdf/plugin-document-manager/react";
13
- import { Viewport as te, ViewportPluginPackage as y, useViewportCapability as ne } from "@embedpdf/plugin-viewport/react";
14
- import { ScrollPluginPackage as b, Scroller as x, useScrollCapability as re } from "@embedpdf/plugin-scroll/react";
15
- import { RenderLayer as ie, RenderPluginPackage as S } from "@embedpdf/plugin-render/react";
16
- import { Rotate as ae, RotatePluginPackage as C, useRotate as oe } from "@embedpdf/plugin-rotate/react";
17
- import { ThumbImg as se, ThumbnailPluginPackage as w, ThumbnailsPane as ce } from "@embedpdf/plugin-thumbnail/react";
18
- import { SearchLayer as le, SearchPluginPackage as T } from "@embedpdf/plugin-search/react";
19
- import { SelectionLayer as ue, SelectionPluginPackage as E, useSelectionCapability as D } from "@embedpdf/plugin-selection/react";
20
- import { InteractionManagerPluginPackage as O, PagePointerProvider as k } from "@embedpdf/plugin-interaction-manager/react";
7
+ import { Search as ee, X as te } from "lucide-react";
8
+ import { useEffect as c, useLayoutEffect as ne, useMemo as re, useRef as l, useState as u } from "react";
9
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
10
+ import { createPluginRegistration as p } from "@embedpdf/core";
11
+ import { EmbedPDF as m, useDocumentState as ie } from "@embedpdf/core/react";
12
+ import { usePdfiumEngine as h } from "@embedpdf/engines/react";
13
+ import { DocumentManagerPluginPackage as g } from "@embedpdf/plugin-document-manager/react";
14
+ import { Viewport as ae, ViewportPluginPackage as _, useViewportCapability as oe } from "@embedpdf/plugin-viewport/react";
15
+ import { ScrollPluginPackage as v, Scroller as se, useScrollCapability as ce } from "@embedpdf/plugin-scroll/react";
16
+ import { RenderLayer as le, RenderPluginPackage as y } from "@embedpdf/plugin-render/react";
17
+ import { Rotate as ue, RotatePluginPackage as b, useRotate as de } from "@embedpdf/plugin-rotate/react";
18
+ import { ThumbImg as fe, ThumbnailPluginPackage as x, ThumbnailsPane as pe } from "@embedpdf/plugin-thumbnail/react";
19
+ import { SearchLayer as me, SearchPluginPackage as S, useSearch as he } from "@embedpdf/plugin-search/react";
20
+ import { SelectionLayer as ge, SelectionPluginPackage as _e, useSelectionCapability as ve } from "@embedpdf/plugin-selection/react";
21
+ import { InteractionManagerPluginPackage as C, PagePointerProvider as ye } from "@embedpdf/plugin-interaction-manager/react";
21
22
  //#region src/document-viewer-v2/HeadlessPdfViewer.tsx
22
- function A(e) {
23
- let { engine: t, isLoading: n, error: r } = _({
23
+ var w = "(max-width: 900px), (hover: none) and (pointer: coarse)";
24
+ function be(e) {
25
+ let [t, n] = u(() => e && typeof window < "u" && window.matchMedia(w).matches);
26
+ return c(() => {
27
+ if (!e) {
28
+ n(!1);
29
+ return;
30
+ }
31
+ let t = window.matchMedia(w), r = () => n(t.matches);
32
+ return r(), t.addEventListener("change", r), () => t.removeEventListener("change", r);
33
+ }, [e]), t;
34
+ }
35
+ function T(e) {
36
+ let { engine: t, isLoading: n, error: r } = h({
24
37
  worker: !0,
25
38
  fontFallback: null,
26
39
  ...e.engineOptions
27
- }), [i] = d(() => {
40
+ }), [i] = u(() => {
28
41
  let { id: t, kind: n, ...r } = e.source;
29
42
  return [
30
- m(v, { initialDocuments: [{
43
+ p(g, { initialDocuments: [{
31
44
  ...r,
32
45
  documentId: t,
33
46
  autoActivate: !0
34
47
  }] }),
35
- m(y),
36
- m(b, { defaultPageGap: 20 }),
37
- m(S, { withAnnotations: !0 }),
38
- m(a.ZoomPluginPackage, {
48
+ p(_),
49
+ p(v, { defaultPageGap: 20 }),
50
+ p(y, { withAnnotations: !0 }),
51
+ p(a.ZoomPluginPackage, {
39
52
  defaultZoomLevel: 1,
40
53
  minZoom: e.initialZoom === "fit-width" ? .1 : .5,
41
54
  maxZoom: 3
42
55
  }),
43
- m(C),
44
- m(O, { exclusionRules: { dataAttributes: ["data-pdf-business-control"] } }),
45
- m(T),
46
- m(E, { marquee: { enabled: !1 } }),
47
- m(w, { width: 100 })
56
+ p(b),
57
+ p(C, { exclusionRules: { dataAttributes: ["data-pdf-business-control"] } }),
58
+ p(S),
59
+ p(_e, { marquee: { enabled: !1 } }),
60
+ p(x, { width: 100 })
48
61
  ];
49
62
  });
50
- return r ? /* @__PURE__ */ p("div", {
63
+ return r ? /* @__PURE__ */ f("div", {
51
64
  role: "alert",
52
65
  children: ["PDF 引擎加载失败:", r.message]
53
- }) : n || !t ? /* @__PURE__ */ f("div", {
66
+ }) : n || !t ? /* @__PURE__ */ d("div", {
54
67
  role: "status",
55
68
  children: "正在加载 PDF 引擎…"
56
- }) : /* @__PURE__ */ f(h, {
69
+ }) : /* @__PURE__ */ d(m, {
57
70
  engine: t,
58
71
  plugins: i,
59
72
  onInitialized: async (t) => {
60
73
  e.onReady?.(t);
61
74
  },
62
- children: /* @__PURE__ */ f(j, { ...e })
75
+ children: /* @__PURE__ */ d(E, { ...e })
63
76
  });
64
77
  }
65
- function j(m) {
66
- let h = m.source.id, _ = g(h), v = _?.document, { provides: y } = re(), b = ee(() => y?.forDocument(h), [y, h]), { provides: S, state: C } = o(h), { provides: w } = ne(), { provides: T } = D(), { provides: E, rotation: O } = oe(h), A = r(h), [j, M] = d(1), [N, P] = d(null), F = v?.pages.length ?? 0, I = Math.max(1, Math.min(F || 1, m.currentPage ?? j)), L = m.pageMode === "single", R = u(m);
67
- R.current = m;
68
- let z = _?.scale ?? 1, B = u(!1), V = u(m.currentPage ?? 1), H = u(!0), U = u(I), W = u(L), G = u(null);
69
- l(() => {
70
- (U.current !== I || W.current !== L) && ((W.current !== L || I !== G.current) && (V.current = I), W.current !== L && (H.current = !0), U.current = I, W.current = L, G.current = null);
78
+ function E(p) {
79
+ let m = p.source.id, h = ie(m), g = h?.document, { provides: _ } = ce(), v = re(() => _?.forDocument(m), [_, m]), { provides: y, state: b } = o(m), { provides: x } = oe(), { provides: S } = ve(), { provides: _e } = he(m), { provides: C, rotation: w } = de(m), T = r(m), [E, D] = u(1), [O, k] = u(null), A = be(p.mobileMode === "continuous-reader"), j = p.searchMode === "collapsible", M = p.features?.search !== !1, [N, P] = u(!j), F = g?.pages.length ?? 0, I = Math.max(1, Math.min(F || 1, p.currentPage ?? E)), L = p.pageMode === "single" && !A, R = p.features?.textSelection !== !1 && !A, z = l(p);
80
+ z.current = p, c(() => {
81
+ P(!j), k(null);
82
+ }, [m, j]);
83
+ let B = h?.scale ?? 1, V = l(!1), H = l(p.currentPage ?? 1), U = l(!0), W = l(I), G = l(L), K = l(null);
84
+ ne(() => {
85
+ (W.current !== I || G.current !== L) && ((G.current !== L || I !== K.current) && (H.current = I), G.current !== L && (U.current = !0), W.current = I, G.current = L, K.current = null);
71
86
  }, [I, L]);
72
- let K = u(S);
73
- K.current = S, c(() => {
74
- if (!w || !F) return;
87
+ let q = l(y);
88
+ q.current = y, c(() => {
89
+ if (!x || !F) return;
75
90
  let e = () => {
76
- let e = w.forDocument(h).getMetrics();
77
- !B.current && e.clientWidth && e.clientHeight && K.current && (B.current = !0, K.current.requestZoom(R.current.zoom ?? (R.current.initialZoom === "fit-width" ? a.ZoomMode.FitWidth : R.current.initialZoom ?? 1)));
78
- }, t = w.onViewportResize((t) => {
79
- t.documentId === h && e();
91
+ let e = x.forDocument(m).getMetrics();
92
+ !V.current && e.clientWidth && e.clientHeight && q.current && (V.current = !0, q.current.requestZoom(z.current.zoom ?? (z.current.initialZoom === "fit-width" ? a.ZoomMode.FitWidth : z.current.initialZoom ?? 1)));
93
+ }, t = x.onViewportResize((t) => {
94
+ t.documentId === m && e();
80
95
  });
81
96
  return e(), t;
82
97
  }, [
83
- w,
84
- h,
98
+ x,
99
+ m,
85
100
  F
86
101
  ]), c(() => {
87
- if (b && !L) return b.onPageChange((e) => {
88
- B.current && !H.current && (R.current.currentPage === void 0 && M(e.pageNumber), e.pageNumber !== R.current.currentPage && (G.current = e.pageNumber, R.current.onCurrentPageChange?.(e.pageNumber)));
102
+ if (v && !L) return v.onPageChange((e) => {
103
+ V.current && !U.current && (z.current.currentPage === void 0 && D(e.pageNumber), e.pageNumber !== z.current.currentPage && (K.current = e.pageNumber, z.current.onCurrentPageChange?.(e.pageNumber)));
89
104
  });
90
- }, [b, L]), c(() => {
91
- if (!b || L || !F) return;
105
+ }, [v, L]), c(() => {
106
+ if (!v || L || !F) return;
92
107
  let e = () => {
93
- V.current !== null && (H.current = !0, b.scrollToPage({
94
- pageNumber: V.current,
108
+ H.current !== null && (U.current = !0, v.scrollToPage({
109
+ pageNumber: H.current,
95
110
  behavior: "instant",
96
- ...N?.page === V.current ? {
97
- pageCoordinates: N,
111
+ ...O?.page === H.current ? {
112
+ pageCoordinates: O,
98
113
  alignX: 50,
99
114
  alignY: 40
100
115
  } : {}
101
116
  }));
102
- }, t = y?.onLayoutReady((t) => {
103
- t.documentId === h && e();
104
- }), n = w?.onViewportResize((t) => {
105
- t.documentId === h && e();
117
+ }, t = _?.onLayoutReady((t) => {
118
+ t.documentId === m && e();
119
+ }), n = x?.onViewportResize((t) => {
120
+ t.documentId === m && e();
106
121
  }), r = requestAnimationFrame(e);
107
122
  return () => {
108
123
  cancelAnimationFrame(r), t?.(), n?.();
109
124
  };
110
125
  }, [
111
- b,
112
- y,
113
- w,
114
- h,
126
+ v,
127
+ _,
128
+ x,
129
+ m,
115
130
  L,
116
131
  F,
117
132
  I,
118
- z,
119
- O,
120
- N
133
+ B,
134
+ w,
135
+ O
121
136
  ]), c(() => {
122
- if (!L || !N || !w) return;
123
- let e = () => de(A.containerRef.current, N, w.forDocument(h)), t = w.onViewportResize((t) => {
124
- t.documentId === h && e();
137
+ if (!L || !O || !x) return;
138
+ let e = () => xe(T.containerRef.current, O, x.forDocument(m)), t = x.onViewportResize((t) => {
139
+ t.documentId === m && e();
125
140
  }), n = requestAnimationFrame(e);
126
141
  return () => {
127
142
  cancelAnimationFrame(n), t();
128
143
  };
129
144
  }, [
130
145
  L,
131
- N,
132
- w,
133
- h,
146
+ O,
147
+ x,
148
+ m,
134
149
  I,
135
- z,
136
- O
150
+ B,
151
+ w
137
152
  ]);
138
- let q = u(m.zoom ?? null), J = u(m.rotation ?? null), Y = u(z), X = u(O);
153
+ let J = l(p.zoom ?? null), Y = l(p.rotation ?? null), X = l(B), Se = l(w);
139
154
  c(() => {
140
- m.zoom !== void 0 && S && F && Math.abs(m.zoom - z) > .001 && (q.current = m.zoom, S.requestZoom(m.zoom));
155
+ p.zoom !== void 0 && y && F && Math.abs(p.zoom - B) > .001 && (J.current = p.zoom, y.requestZoom(p.zoom));
141
156
  }, [
142
- m.zoom,
143
- !!S,
157
+ p.zoom,
158
+ !!y,
144
159
  F
145
160
  ]), c(() => {
146
- m.rotation !== void 0 && E && F && m.rotation !== O * 90 && (J.current = m.rotation, E.setRotation((m.rotation / 90 % 4 + 4) % 4));
161
+ p.rotation !== void 0 && C && F && p.rotation !== w * 90 && (Y.current = p.rotation, C.setRotation((p.rotation / 90 % 4 + 4) % 4));
147
162
  }, [
148
- m.rotation,
149
- !!E,
163
+ p.rotation,
164
+ !!C,
150
165
  F
151
166
  ]), c(() => {
152
- if (q.current !== null) {
153
- if (Math.abs(q.current - z) > .001) return;
154
- q.current = null;
155
- }
156
- Y.current !== z && R.current.onZoomChange?.(z), Y.current = z;
157
- }, [z]), c(() => {
158
167
  if (J.current !== null) {
159
- if (J.current !== O * 90) return;
168
+ if (Math.abs(J.current - B) > .001) return;
160
169
  J.current = null;
161
170
  }
162
- X.current !== O && R.current.onRotationChange?.(O * 90), X.current = O;
163
- }, [O]), c(() => {
164
- let e = m.focusTarget, t = e && v?.pages[e.page - 1];
165
- e && t && b && !L && (H.current = !0, b.scrollToPage({
171
+ X.current !== B && z.current.onZoomChange?.(B), X.current = B;
172
+ }, [B]), c(() => {
173
+ if (Y.current !== null) {
174
+ if (Y.current !== w * 90) return;
175
+ Y.current = null;
176
+ }
177
+ Se.current !== w && z.current.onRotationChange?.(w * 90), Se.current = w;
178
+ }, [w]), c(() => {
179
+ let e = p.focusTarget, t = e && g?.pages[e.page - 1];
180
+ e && t && v && !L && (U.current = !0, v.scrollToPage({
166
181
  pageNumber: e.page,
167
182
  pageCoordinates: {
168
183
  x: t.size.width / 2,
@@ -172,158 +187,177 @@ function j(m) {
172
187
  behavior: "instant"
173
188
  }));
174
189
  }, [
175
- m.focusTarget?.token,
176
- b,
190
+ p.focusTarget?.token,
191
+ v,
177
192
  F,
178
193
  L
179
194
  ]);
180
195
  let Z = () => {
181
- H.current = !1, V.current = null;
196
+ U.current = !1, H.current = null;
182
197
  }, Q = (e) => {
183
- G.current = null;
198
+ K.current = null;
184
199
  let t = Math.max(1, Math.min(F, e));
185
- m.currentPage === void 0 && M(t), m.onCurrentPageChange?.(t);
186
- }, $ = (e) => {
187
- let t = v?.pages[e];
200
+ p.currentPage === void 0 && D(t), p.onCurrentPageChange?.(t);
201
+ }, Ce = (e) => {
202
+ let t = g?.pages[e];
188
203
  if (!t) return null;
189
- let n = (t.rotation + O) % 4, { width: r, height: i } = t.size, a = {
190
- documentId: h,
204
+ let n = (t.rotation + w) % 4, { width: r, height: i } = t.size, a = {
205
+ documentId: m,
191
206
  page: e + 1,
192
207
  pageIndex: e,
193
208
  width: r,
194
209
  height: i,
195
- zoom: z,
210
+ zoom: B,
196
211
  rotation: n * 90
197
212
  }, o = n % 2 == 1;
198
- return /* @__PURE__ */ f("div", {
213
+ return /* @__PURE__ */ d("div", {
199
214
  className: "ui-v2-native-page",
200
215
  "data-page": e + 1,
201
216
  style: {
202
217
  position: "relative",
203
- width: (o ? i : r) * z,
204
- height: (o ? r : i) * z
218
+ width: (o ? i : r) * B,
219
+ height: (o ? r : i) * B
205
220
  },
206
- children: /* @__PURE__ */ f(k, {
207
- documentId: h,
221
+ children: /* @__PURE__ */ d(ye, {
222
+ documentId: m,
208
223
  pageIndex: e,
209
224
  rotation: n,
210
- scale: z,
211
- children: /* @__PURE__ */ p(ae, {
212
- documentId: h,
225
+ scale: B,
226
+ children: /* @__PURE__ */ f(ue, {
227
+ documentId: m,
213
228
  pageIndex: e,
214
229
  rotation: n,
215
230
  style: {
216
- width: r * z,
217
- height: i * z
231
+ width: r * B,
232
+ height: i * B
218
233
  },
219
234
  children: [
220
- m.renderPage ? m.renderPage({
235
+ p.renderPage ? p.renderPage({
221
236
  page: e + 1,
222
- zoom: z,
237
+ zoom: B,
223
238
  rotation: n * 90
224
- }) : /* @__PURE__ */ f(ie, {
239
+ }) : /* @__PURE__ */ d(le, {
225
240
  draggable: !1,
226
- documentId: h,
241
+ documentId: m,
227
242
  pageIndex: e,
228
243
  "aria-label": `第 ${e + 1} 页`
229
244
  }),
230
- m.features?.search !== !1 && /* @__PURE__ */ f(le, {
245
+ M && N && /* @__PURE__ */ d(me, {
231
246
  "data-ui-search-layer": !0,
232
- documentId: h,
247
+ documentId: m,
233
248
  pageIndex: e,
234
- scale: z
249
+ scale: B
235
250
  }),
236
- N?.page === e + 1 && /* @__PURE__ */ f("span", {
251
+ O?.page === e + 1 && /* @__PURE__ */ d("span", {
237
252
  "data-ui-search-target": !0,
238
253
  style: {
239
254
  position: "absolute",
240
- left: N.x * z,
241
- top: N.y * z,
255
+ left: O.x * B,
256
+ top: O.y * B,
242
257
  width: 0,
243
258
  height: 0,
244
259
  pointerEvents: "none"
245
260
  }
246
261
  }),
247
- m.features?.textSelection !== !1 && /* @__PURE__ */ f(ue, {
248
- documentId: h,
262
+ R && /* @__PURE__ */ d(ge, {
263
+ documentId: m,
249
264
  pageIndex: e,
250
- scale: z,
265
+ scale: B,
251
266
  rotation: 0
252
267
  }),
253
- m.renderPageOverlay && /* @__PURE__ */ f("div", {
268
+ p.renderPageOverlay && /* @__PURE__ */ d("div", {
254
269
  className: "ui-v2-page-overlay",
255
270
  style: {
256
271
  position: "absolute",
257
272
  inset: 0,
258
273
  width: r,
259
274
  height: i,
260
- transform: `scale(${z})`,
275
+ transform: `scale(${B})`,
261
276
  transformOrigin: "0 0",
262
277
  pointerEvents: "none"
263
278
  },
264
- children: m.renderPageOverlay(a)
279
+ children: p.renderPageOverlay(a)
265
280
  })
266
281
  ]
267
282
  })
268
283
  })
269
284
  });
270
- };
271
- return /* @__PURE__ */ p("section", {
272
- ref: A.containerRef,
273
- style: m.style,
285
+ }, $ = M && j && /* @__PURE__ */ f(e, {
286
+ variant: "ghost",
287
+ size: "compact",
288
+ "aria-expanded": N,
289
+ "aria-label": N ? "收起文档搜索" : "搜索文档",
290
+ onClick: () => {
291
+ N && (_e?.stopSearch(), k(null)), P(!N);
292
+ },
293
+ children: [d(N ? te : ee, { size: 15 }), /* @__PURE__ */ d("span", {
294
+ className: "ui-mobile-reader-search-label",
295
+ children: N ? "收起搜索" : "搜索文档"
296
+ })]
297
+ });
298
+ return /* @__PURE__ */ f("section", {
299
+ ref: T.containerRef,
300
+ style: p.style,
274
301
  onKeyDown: (e) => {
275
- if (m.features?.textSelection === !1 || !(e.ctrlKey || e.metaKey) || e.key.toLowerCase() !== "c" || e.target.closest("input, textarea, [contenteditable=\"true\"]")) return;
276
- let t = T?.forDocument(h);
302
+ if (!R || !(e.ctrlKey || e.metaKey) || e.key.toLowerCase() !== "c" || e.target.closest("input, textarea, [contenteditable=\"true\"]")) return;
303
+ let t = S?.forDocument(m);
277
304
  t?.getState().selection && (e.preventDefault(), t.copyToClipboard());
278
305
  },
279
- "aria-label": m.ariaLabel ?? "PDF 文档查看器",
306
+ "aria-label": p.ariaLabel ?? "PDF 文档查看器",
280
307
  className: [
281
308
  "ui-document-viewer",
282
309
  "ui-document-viewer-v2-headless",
283
- A.fullscreen && "ui-viewer-fullscreen",
284
- m.className
310
+ p.layoutMode === "fill" && "ui-viewer-fill",
311
+ A && "ui-mobile-continuous-reader",
312
+ T.fullscreen && "ui-viewer-fullscreen",
313
+ p.className
285
314
  ].filter(Boolean).join(" "),
286
315
  children: [
287
- m.showToolbar !== !1 && /* @__PURE__ */ p("div", {
316
+ p.showToolbar !== !1 && /* @__PURE__ */ f("div", {
288
317
  className: "ui-viewer-toolbar",
289
318
  children: [
290
- m.title !== void 0 && /* @__PURE__ */ f("div", {
319
+ p.title !== void 0 && /* @__PURE__ */ d("div", {
291
320
  className: "ui-viewer-title",
292
- children: m.title
321
+ children: p.title
293
322
  }),
294
- m.toolbar,
295
- /* @__PURE__ */ f(n, {
296
- zoom: C.currentZoomLevel,
323
+ p.toolbar,
324
+ $,
325
+ /* @__PURE__ */ d(n, {
326
+ zoom: b.currentZoomLevel,
297
327
  disabled: !F,
298
- fullscreen: A.fullscreen,
299
- canZoomIn: z < 3,
300
- canZoomOut: z > (m.initialZoom === "fit-width" ? .1 : .5),
301
- onZoomIn: () => S?.zoomIn(),
302
- onZoomOut: () => S?.zoomOut(),
303
- onRotate: () => E?.rotateForward(),
304
- onToggleFullscreen: A.toggleFullscreen
328
+ fullscreen: T.fullscreen,
329
+ canZoomIn: B < 3,
330
+ canZoomOut: B > (p.initialZoom === "fit-width" ? .1 : .5),
331
+ onZoomIn: () => y?.zoomIn(),
332
+ onZoomOut: () => y?.zoomOut(),
333
+ onRotate: () => C?.rotateForward(),
334
+ onToggleFullscreen: T.toggleFullscreen
305
335
  })
306
336
  ]
307
337
  }),
308
- m.features?.search !== !1 && /* @__PURE__ */ f(s, {
309
- onClear: () => P(null),
338
+ p.showToolbar === !1 && $ && /* @__PURE__ */ d("div", {
339
+ className: "ui-v2-search-disclosure",
340
+ children: $
341
+ }),
342
+ M && N && /* @__PURE__ */ d(s, {
343
+ onClear: () => k(null),
310
344
  enabled: !!F,
311
- documentId: h,
345
+ documentId: m,
312
346
  onPageChange: (e, t) => {
313
- V.current = e, P(t ? {
347
+ H.current = e, k(t ? {
314
348
  page: e,
315
349
  ...t
316
350
  } : null), Q(e);
317
351
  }
318
352
  }),
319
- _?.status === "error" ? /* @__PURE__ */ p("div", {
353
+ h?.status === "error" ? /* @__PURE__ */ f("div", {
320
354
  role: "alert",
321
- children: ["PDF 加载失败:", _.error]
322
- }) : v ? /* @__PURE__ */ f(t, {
323
- defaultRailCollapsed: m.defaultRailCollapsed,
324
- rail: /* @__PURE__ */ f(ce, {
325
- documentId: h,
326
- children: (t) => /* @__PURE__ */ p(e, {
355
+ children: ["PDF 加载失败:", h.error]
356
+ }) : g ? /* @__PURE__ */ d(t, {
357
+ defaultRailCollapsed: p.defaultRailCollapsed,
358
+ rail: /* @__PURE__ */ d(pe, {
359
+ documentId: m,
360
+ children: (t) => /* @__PURE__ */ f(e, {
327
361
  variant: "ghost",
328
362
  className: "ui-v2-thumbnail",
329
363
  "aria-label": `第 ${t.pageIndex + 1} 页`,
@@ -336,19 +370,19 @@ function j(m) {
336
370
  height: t.wrapperHeight,
337
371
  display: "grid"
338
372
  },
339
- children: [/* @__PURE__ */ f(se, {
340
- documentId: h,
373
+ children: [/* @__PURE__ */ d(fe, {
374
+ documentId: m,
341
375
  meta: t,
342
376
  className: "ui-v2-thumbnail-image",
343
377
  style: {
344
378
  width: t.width,
345
379
  height: t.height
346
380
  }
347
- }), /* @__PURE__ */ f("span", { children: t.pageIndex + 1 })]
381
+ }), /* @__PURE__ */ d("span", { children: t.pageIndex + 1 })]
348
382
  }, t.pageIndex)
349
383
  }),
350
- children: /* @__PURE__ */ f(te, {
351
- documentId: h,
384
+ children: /* @__PURE__ */ d(ae, {
385
+ documentId: m,
352
386
  className: "ui-v2-native-viewport",
353
387
  tabIndex: 0,
354
388
  "aria-label": "PDF 页面滚动区域",
@@ -361,35 +395,35 @@ function j(m) {
361
395
  onTouchMoveCapture: Z,
362
396
  onPointerDownCapture: Z,
363
397
  onKeyDownCapture: Z,
364
- children: /* @__PURE__ */ f(i, {
365
- documentId: h,
366
- enablePinch: m.features?.pinchZoom !== !1,
367
- minZoom: m.initialZoom === "fit-width" ? .1 : .5,
398
+ children: /* @__PURE__ */ d(i, {
399
+ documentId: m,
400
+ enablePinch: p.features?.pinchZoom !== !1,
401
+ minZoom: p.initialZoom === "fit-width" ? .1 : .5,
368
402
  maxZoom: 3,
369
- children: L ? /* @__PURE__ */ f("div", {
403
+ children: L ? /* @__PURE__ */ d("div", {
370
404
  className: "ui-v2-native-single",
371
- children: $(I - 1)
372
- }) : /* @__PURE__ */ f(x, {
373
- documentId: h,
374
- renderPage: ({ pageIndex: e }) => $(e)
405
+ children: Ce(I - 1)
406
+ }) : /* @__PURE__ */ d(se, {
407
+ documentId: m,
408
+ renderPage: ({ pageIndex: e }) => Ce(e)
375
409
  })
376
410
  })
377
411
  })
378
- }) : /* @__PURE__ */ f("div", {
412
+ }) : /* @__PURE__ */ d("div", {
379
413
  role: "status",
380
414
  children: "正在加载 PDF 文档…"
381
415
  }),
382
- /* @__PURE__ */ p("div", {
416
+ /* @__PURE__ */ f("div", {
383
417
  className: "ui-viewer-footer",
384
418
  children: [
385
- /* @__PURE__ */ f(e, {
419
+ /* @__PURE__ */ d(e, {
386
420
  variant: "ghost",
387
421
  size: "compact",
388
422
  disabled: !F || I <= 1,
389
423
  onClick: () => Q(I - 1),
390
424
  children: "上一页"
391
425
  }),
392
- /* @__PURE__ */ p("span", {
426
+ /* @__PURE__ */ f("span", {
393
427
  "aria-live": "polite",
394
428
  children: [
395
429
  F ? I : 0,
@@ -397,20 +431,20 @@ function j(m) {
397
431
  F
398
432
  ]
399
433
  }),
400
- /* @__PURE__ */ f(e, {
434
+ /* @__PURE__ */ d(e, {
401
435
  variant: "ghost",
402
436
  size: "compact",
403
437
  disabled: !F || I >= F,
404
438
  onClick: () => Q(I + 1),
405
439
  children: "下一页"
406
440
  }),
407
- m.footer
441
+ p.footer
408
442
  ]
409
443
  })
410
444
  ]
411
445
  });
412
446
  }
413
- function de(e, t, n) {
447
+ function xe(e, t, n) {
414
448
  let r = e?.querySelector(`[data-page="${t.page}"] [data-ui-search-target]`), i = e?.querySelector(".ui-v2-native-viewport");
415
449
  if (!r || !i) return;
416
450
  let a = r.getBoundingClientRect(), o = i.getBoundingClientRect(), s = n.getMetrics();
@@ -422,4 +456,4 @@ function de(e, t, n) {
422
456
  });
423
457
  }
424
458
  //#endregion
425
- export { A as default };
459
+ export { T as default };
@@ -6,6 +6,7 @@ function i(t) {
6
6
  return /* @__PURE__ */ n(e, {
7
7
  fallback: /* @__PURE__ */ n("div", {
8
8
  role: "status",
9
+ className: t.layoutMode === "fill" ? "ui-pdfium-viewer-fallback ui-viewer-fill" : "ui-pdfium-viewer-fallback",
9
10
  children: "正在加载 PDF 查看器…"
10
11
  }),
11
12
  children: /* @__PURE__ */ n(r, {
@@ -29,5 +29,8 @@ function s(e, t, n, r) {
29
29
  function c(e) {
30
30
  e?.[t] && (e[t].consumed = !0);
31
31
  }
32
+ function l(e, t) {
33
+ return !e || [...e.targets.values()].filter((e) => e.accepts(t)).length === 1;
34
+ }
32
35
  //#endregion
33
- export { r as activeSortableTransfer, i as beginSortableTransfer, c as consumeSortableTransfer, a as endSortableTransfer, o as registerSortableTarget, s as routeSortableTarget, n as useSortableTransferScope };
36
+ export { r as activeSortableTransfer, i as beginSortableTransfer, c as consumeSortableTransfer, a as endSortableTransfer, l as hasUniqueSortableTarget, o as registerSortableTarget, s as routeSortableTarget, n as useSortableTransferScope };