@turinhub/atomix-common-ui 0.1.1 → 0.2.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.
@@ -0,0 +1,1293 @@
1
+ import { clsx as he } from "clsx";
2
+ import { twMerge as pe } from "tailwind-merge";
3
+ import je, { useState as G, useEffect as se, useRef as ve, useMemo as be, useCallback as ne } from "react";
4
+ import { MoreVertical as we, Plus as ge, Search as Ne, ChevronLeft as ke, ChevronRight as ye } from "lucide-react";
5
+ function $e(...s) {
6
+ return pe(he(s));
7
+ }
8
+ var oe = { exports: {} }, le = {};
9
+ /**
10
+ * @license React
11
+ * react-jsx-runtime.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */
18
+ var de;
19
+ function Te() {
20
+ if (de) return le;
21
+ de = 1;
22
+ var s = Symbol.for("react.transitional.element"), w = Symbol.for("react.fragment");
23
+ function m(f, l, u) {
24
+ var d = null;
25
+ if (u !== void 0 && (d = "" + u), l.key !== void 0 && (d = "" + l.key), "key" in l) {
26
+ u = {};
27
+ for (var a in l)
28
+ a !== "key" && (u[a] = l[a]);
29
+ } else u = l;
30
+ return l = u.ref, {
31
+ $$typeof: s,
32
+ type: f,
33
+ key: d,
34
+ ref: l !== void 0 ? l : null,
35
+ props: u
36
+ };
37
+ }
38
+ return le.Fragment = w, le.jsx = m, le.jsxs = m, le;
39
+ }
40
+ var ae = {};
41
+ /**
42
+ * @license React
43
+ * react-jsx-runtime.development.js
44
+ *
45
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
46
+ *
47
+ * This source code is licensed under the MIT license found in the
48
+ * LICENSE file in the root directory of this source tree.
49
+ */
50
+ var me;
51
+ function Re() {
52
+ return me || (me = 1, process.env.NODE_ENV !== "production" && (function() {
53
+ function s(t) {
54
+ if (t == null) return null;
55
+ if (typeof t == "function")
56
+ return t.$$typeof === H ? null : t.displayName || t.name || null;
57
+ if (typeof t == "string") return t;
58
+ switch (t) {
59
+ case _:
60
+ return "Fragment";
61
+ case V:
62
+ return "Profiler";
63
+ case U:
64
+ return "StrictMode";
65
+ case z:
66
+ return "Suspense";
67
+ case A:
68
+ return "SuspenseList";
69
+ case O:
70
+ return "Activity";
71
+ }
72
+ if (typeof t == "object")
73
+ switch (typeof t.tag == "number" && console.error(
74
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
75
+ ), t.$$typeof) {
76
+ case S:
77
+ return "Portal";
78
+ case v:
79
+ return t.displayName || "Context";
80
+ case I:
81
+ return (t._context.displayName || "Context") + ".Consumer";
82
+ case B:
83
+ var n = t.render;
84
+ return t = t.displayName, t || (t = n.displayName || n.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
85
+ case P:
86
+ return n = t.displayName || null, n !== null ? n : s(t.type) || "Memo";
87
+ case M:
88
+ n = t._payload, t = t._init;
89
+ try {
90
+ return s(t(n));
91
+ } catch {
92
+ }
93
+ }
94
+ return null;
95
+ }
96
+ function w(t) {
97
+ return "" + t;
98
+ }
99
+ function m(t) {
100
+ try {
101
+ w(t);
102
+ var n = !1;
103
+ } catch {
104
+ n = !0;
105
+ }
106
+ if (n) {
107
+ n = console;
108
+ var x = n.error, b = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
109
+ return x.call(
110
+ n,
111
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
112
+ b
113
+ ), w(t);
114
+ }
115
+ }
116
+ function f(t) {
117
+ if (t === _) return "<>";
118
+ if (typeof t == "object" && t !== null && t.$$typeof === M)
119
+ return "<...>";
120
+ try {
121
+ var n = s(t);
122
+ return n ? "<" + n + ">" : "<...>";
123
+ } catch {
124
+ return "<...>";
125
+ }
126
+ }
127
+ function l() {
128
+ var t = i.A;
129
+ return t === null ? null : t.getOwner();
130
+ }
131
+ function u() {
132
+ return Error("react-stack-top-frame");
133
+ }
134
+ function d(t) {
135
+ if (p.call(t, "key")) {
136
+ var n = Object.getOwnPropertyDescriptor(t, "key").get;
137
+ if (n && n.isReactWarning) return !1;
138
+ }
139
+ return t.key !== void 0;
140
+ }
141
+ function a(t, n) {
142
+ function x() {
143
+ $ || ($ = !0, console.error(
144
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
145
+ n
146
+ ));
147
+ }
148
+ x.isReactWarning = !0, Object.defineProperty(t, "key", {
149
+ get: x,
150
+ configurable: !0
151
+ });
152
+ }
153
+ function j() {
154
+ var t = s(this.type);
155
+ return Z[t] || (Z[t] = !0, console.error(
156
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
157
+ )), t = this.props.ref, t !== void 0 ? t : null;
158
+ }
159
+ function h(t, n, x, b, X, Q) {
160
+ var g = x.ref;
161
+ return t = {
162
+ $$typeof: C,
163
+ type: t,
164
+ key: n,
165
+ props: x,
166
+ _owner: b
167
+ }, (g !== void 0 ? g : null) !== null ? Object.defineProperty(t, "ref", {
168
+ enumerable: !1,
169
+ get: j
170
+ }) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
171
+ configurable: !1,
172
+ enumerable: !1,
173
+ writable: !0,
174
+ value: 0
175
+ }), Object.defineProperty(t, "_debugInfo", {
176
+ configurable: !1,
177
+ enumerable: !1,
178
+ writable: !0,
179
+ value: null
180
+ }), Object.defineProperty(t, "_debugStack", {
181
+ configurable: !1,
182
+ enumerable: !1,
183
+ writable: !0,
184
+ value: X
185
+ }), Object.defineProperty(t, "_debugTask", {
186
+ configurable: !1,
187
+ enumerable: !1,
188
+ writable: !0,
189
+ value: Q
190
+ }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
191
+ }
192
+ function r(t, n, x, b, X, Q) {
193
+ var g = n.children;
194
+ if (g !== void 0)
195
+ if (b)
196
+ if (L(g)) {
197
+ for (b = 0; b < g.length; b++)
198
+ y(g[b]);
199
+ Object.freeze && Object.freeze(g);
200
+ } else
201
+ console.error(
202
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
203
+ );
204
+ else y(g);
205
+ if (p.call(n, "key")) {
206
+ g = s(t);
207
+ var J = Object.keys(n).filter(function(k) {
208
+ return k !== "key";
209
+ });
210
+ b = 0 < J.length ? "{key: someKey, " + J.join(": ..., ") + ": ...}" : "{key: someKey}", T[g + b] || (J = 0 < J.length ? "{" + J.join(": ..., ") + ": ...}" : "{}", console.error(
211
+ `A props object containing a "key" prop is being spread into JSX:
212
+ let props = %s;
213
+ <%s {...props} />
214
+ React keys must be passed directly to JSX without using spread:
215
+ let props = %s;
216
+ <%s key={someKey} {...props} />`,
217
+ b,
218
+ g,
219
+ J,
220
+ g
221
+ ), T[g + b] = !0);
222
+ }
223
+ if (g = null, x !== void 0 && (m(x), g = "" + x), d(n) && (m(n.key), g = "" + n.key), "key" in n) {
224
+ x = {};
225
+ for (var c in n)
226
+ c !== "key" && (x[c] = n[c]);
227
+ } else x = n;
228
+ return g && a(
229
+ x,
230
+ typeof t == "function" ? t.displayName || t.name || "Unknown" : t
231
+ ), h(
232
+ t,
233
+ g,
234
+ x,
235
+ l(),
236
+ X,
237
+ Q
238
+ );
239
+ }
240
+ function y(t) {
241
+ R(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === M && (t._payload.status === "fulfilled" ? R(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
242
+ }
243
+ function R(t) {
244
+ return typeof t == "object" && t !== null && t.$$typeof === C;
245
+ }
246
+ var N = je, C = Symbol.for("react.transitional.element"), S = Symbol.for("react.portal"), _ = Symbol.for("react.fragment"), U = Symbol.for("react.strict_mode"), V = Symbol.for("react.profiler"), I = Symbol.for("react.consumer"), v = Symbol.for("react.context"), B = Symbol.for("react.forward_ref"), z = Symbol.for("react.suspense"), A = Symbol.for("react.suspense_list"), P = Symbol.for("react.memo"), M = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), H = Symbol.for("react.client.reference"), i = N.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, p = Object.prototype.hasOwnProperty, L = Array.isArray, D = console.createTask ? console.createTask : function() {
247
+ return null;
248
+ };
249
+ N = {
250
+ react_stack_bottom_frame: function(t) {
251
+ return t();
252
+ }
253
+ };
254
+ var $, Z = {}, Y = N.react_stack_bottom_frame.bind(
255
+ N,
256
+ u
257
+ )(), q = D(f(u)), T = {};
258
+ ae.Fragment = _, ae.jsx = function(t, n, x) {
259
+ var b = 1e4 > i.recentlyCreatedOwnerStacks++;
260
+ return r(
261
+ t,
262
+ n,
263
+ x,
264
+ !1,
265
+ b ? Error("react-stack-top-frame") : Y,
266
+ b ? D(f(t)) : q
267
+ );
268
+ }, ae.jsxs = function(t, n, x) {
269
+ var b = 1e4 > i.recentlyCreatedOwnerStacks++;
270
+ return r(
271
+ t,
272
+ n,
273
+ x,
274
+ !0,
275
+ b ? Error("react-stack-top-frame") : Y,
276
+ b ? D(f(t)) : q
277
+ );
278
+ };
279
+ })()), ae;
280
+ }
281
+ var fe;
282
+ function Ee() {
283
+ return fe || (fe = 1, process.env.NODE_ENV === "production" ? oe.exports = Te() : oe.exports = Re()), oe.exports;
284
+ }
285
+ var e = Ee();
286
+ function We({
287
+ data: s,
288
+ loading: w = !1,
289
+ columns: m,
290
+ rowKey: f,
291
+ emptyText: l = "暂无数据",
292
+ searchActiveEmptyText: u = "未找到匹配的记录",
293
+ header: d,
294
+ pagination: a,
295
+ rowClassName: j,
296
+ onRow: h,
297
+ actions: r,
298
+ components: y,
299
+ renderCard: R,
300
+ renderTable: N,
301
+ renderActions: C
302
+ }) {
303
+ var g, J;
304
+ if (!y)
305
+ return /* @__PURE__ */ e.jsxs("div", { className: "p-4 text-center text-destructive", children: [
306
+ "错误:请通过 components prop 注入 UI 组件",
307
+ /* @__PURE__ */ e.jsx("br", {}),
308
+ /* @__PURE__ */ e.jsx("code", { className: "text-sm", children: 'import { Card, Table, Button, ... } from "@/components/ui"' })
309
+ ] });
310
+ const {
311
+ Card: S,
312
+ CardContent: _,
313
+ CardFooter: U,
314
+ Table: V,
315
+ TableBody: I,
316
+ TableCell: v,
317
+ TableHead: B,
318
+ TableHeader: z,
319
+ TableRow: A,
320
+ Button: P,
321
+ DropdownMenu: M,
322
+ DropdownMenuTrigger: O,
323
+ DropdownMenuContent: H,
324
+ DropdownMenuItem: i,
325
+ DropdownMenuSeparator: p,
326
+ Skeleton: L,
327
+ TableHeaderComponent: D,
328
+ TablePaginationComponent: $
329
+ } = y, Z = (c, k) => {
330
+ if (typeof f == "function")
331
+ return f(c);
332
+ const E = c[f];
333
+ return E != null ? String(E) : `row-${k}`;
334
+ }, Y = !!(d != null && d.searchValue && d.searchValue.trim().length > 0), q = !!(r != null && r.render || (g = r == null ? void 0 : r.items) != null && g.length), T = (r == null ? void 0 : r.mode) ?? ((J = r == null ? void 0 : r.items) != null && J.length ? "collapsed" : "expanded"), t = (c) => c.separator === !0, n = (c, k) => !r || !q ? null : T === "collapsed" && r.items && r.items.length > 0 ? /* @__PURE__ */ e.jsxs(M, { children: [
335
+ /* @__PURE__ */ e.jsx(O, { asChild: !0, children: /* @__PURE__ */ e.jsx(
336
+ P,
337
+ {
338
+ variant: "ghost",
339
+ className: "h-8 w-8 p-0",
340
+ "aria-label": "打开行操作菜单",
341
+ children: /* @__PURE__ */ e.jsx(we, { className: "h-4 w-4" })
342
+ }
343
+ ) }),
344
+ /* @__PURE__ */ e.jsx(H, { align: "end", children: r.items.map(
345
+ (E, te) => t(E) ? /* @__PURE__ */ e.jsx(p, {}, `separator-${te}`) : /* @__PURE__ */ e.jsxs(
346
+ i,
347
+ {
348
+ onClick: () => E.onClick(c, k),
349
+ className: E.className,
350
+ children: [
351
+ E.icon && /* @__PURE__ */ e.jsx("span", { className: "mr-2 h-4 w-4", children: E.icon }),
352
+ E.label
353
+ ]
354
+ },
355
+ `action-${te}`
356
+ )
357
+ ) })
358
+ ] }) : r.render ? r.render(c, k) : null, x = () => /* @__PURE__ */ e.jsx(z, { children: /* @__PURE__ */ e.jsxs(A, { className: "bg-muted/50 hover:bg-muted/50", children: [
359
+ m.map((c) => /* @__PURE__ */ e.jsx(
360
+ B,
361
+ {
362
+ className: `font-semibold text-foreground ${c.align === "center" ? "text-center" : c.align === "right" ? "text-right" : "text-left"}`,
363
+ style: { width: c.width },
364
+ children: c.title
365
+ },
366
+ String(c.key)
367
+ )),
368
+ q && /* @__PURE__ */ e.jsx(B, { className: "text-right font-semibold text-foreground", children: (r == null ? void 0 : r.title) || "操作" })
369
+ ] }) }), b = () => w ? /* @__PURE__ */ e.jsx(I, { children: Array.from({ length: 5 }).map((c, k) => /* @__PURE__ */ e.jsxs(A, { children: [
370
+ m.map((E) => /* @__PURE__ */ e.jsx(
371
+ v,
372
+ {
373
+ style: { width: E.width },
374
+ className: E.align === "center" ? "text-center" : E.align === "right" ? "text-right" : "",
375
+ children: /* @__PURE__ */ e.jsx(L, { className: "h-4 w-full" })
376
+ },
377
+ String(E.key)
378
+ )),
379
+ q && /* @__PURE__ */ e.jsx(v, { children: /* @__PURE__ */ e.jsx(L, { className: "ml-auto h-4 w-8" }) })
380
+ ] }, k)) }) : s.length === 0 ? /* @__PURE__ */ e.jsx(I, { children: /* @__PURE__ */ e.jsx(A, { children: /* @__PURE__ */ e.jsx(
381
+ v,
382
+ {
383
+ colSpan: m.length + (q ? 1 : 0),
384
+ className: "py-8 text-center text-muted-foreground",
385
+ children: Y ? u : l
386
+ }
387
+ ) }) }) : /* @__PURE__ */ e.jsx(I, { children: s.map((c, k) => {
388
+ const E = Z(c, k), te = h == null ? void 0 : h(c, k), ce = j == null ? void 0 : j(c, k);
389
+ return /* @__PURE__ */ e.jsxs(
390
+ A,
391
+ {
392
+ className: `${ce || ""} hover:bg-muted/50`,
393
+ ...te,
394
+ children: [
395
+ m.map((K) => {
396
+ const ie = c[K.key], ue = K.render ? K.render(ie, c, k) : ie;
397
+ return /* @__PURE__ */ e.jsx(
398
+ v,
399
+ {
400
+ className: K.align === "center" ? "text-center" : K.align === "right" ? "text-right" : "",
401
+ children: ue
402
+ },
403
+ String(K.key)
404
+ );
405
+ }),
406
+ q && /* @__PURE__ */ e.jsx(v, { className: "text-right", children: C ? C(c, k) : n(c, k) })
407
+ ]
408
+ },
409
+ E
410
+ );
411
+ }) }), X = (c) => /* @__PURE__ */ e.jsxs(S, { children: [
412
+ d && /* @__PURE__ */ e.jsx("div", { className: "p-6 pb-0", children: /* @__PURE__ */ e.jsx(D, { ...d }) }),
413
+ /* @__PURE__ */ e.jsx(_, { className: "p-0", children: c }),
414
+ (a == null ? void 0 : a.show) !== !1 && a && /* @__PURE__ */ e.jsx(U, { className: "border-t py-4", children: /* @__PURE__ */ e.jsx(
415
+ $,
416
+ {
417
+ currentPage: a.currentPage,
418
+ pageSize: a.pageSize,
419
+ total: a.total,
420
+ onPageChange: a.onPageChange,
421
+ onPageSizeChange: a.onPageSizeChange,
422
+ pageSizeOptions: a.pageSizeOptions,
423
+ showPageSizeSelector: a.showPageSizeSelector,
424
+ showJumpToPage: a.showJumpToPage,
425
+ showTotal: a.showTotal,
426
+ searchActive: Y
427
+ }
428
+ ) })
429
+ ] }), Q = (c, k) => /* @__PURE__ */ e.jsxs(V, { children: [
430
+ c,
431
+ k
432
+ ] });
433
+ return R ? R(
434
+ N ? N(x(), b()) : Q(x(), b())
435
+ ) : X(
436
+ N ? N(x(), b()) : Q(x(), b())
437
+ );
438
+ }
439
+ function Be({
440
+ open: s,
441
+ onOpenChange: w,
442
+ title: m,
443
+ description: f,
444
+ onConfirm: l,
445
+ loading: u = !1,
446
+ confirmText: d = "确认删除",
447
+ cancelText: a = "取消",
448
+ confirmButtonVariant: j = "destructive",
449
+ verification: h,
450
+ components: r,
451
+ loadingIcon: y
452
+ }) {
453
+ const [R, N] = G("");
454
+ if (se(() => {
455
+ s && N("");
456
+ }, [s, h == null ? void 0 : h.targetValue]), !r)
457
+ return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
458
+ const {
459
+ Dialog: C,
460
+ DialogContent: S,
461
+ DialogHeader: _,
462
+ DialogFooter: U,
463
+ DialogTitle: V,
464
+ DialogDescription: I,
465
+ Button: v,
466
+ Input: B,
467
+ Label: z
468
+ } = r, A = h ? R !== h.targetValue : !1, P = () => {
469
+ A || l();
470
+ };
471
+ return /* @__PURE__ */ e.jsx(C, { open: s, onOpenChange: w, children: /* @__PURE__ */ e.jsxs(S, { children: [
472
+ /* @__PURE__ */ e.jsxs(_, { children: [
473
+ /* @__PURE__ */ e.jsx(V, { asChild: !0, children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: m }) }),
474
+ /* @__PURE__ */ e.jsx(I, { asChild: !0, children: /* @__PURE__ */ e.jsx("div", { children: f }) })
475
+ ] }),
476
+ h && /* @__PURE__ */ e.jsx("div", { className: "space-y-4 py-2", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
477
+ /* @__PURE__ */ e.jsx(z, { htmlFor: "confirm-input", children: h.label || "请输入以确认" }),
478
+ /* @__PURE__ */ e.jsx(
479
+ B,
480
+ {
481
+ id: "confirm-input",
482
+ value: R,
483
+ onChange: (M) => N(M.target.value),
484
+ placeholder: h.placeholder,
485
+ disabled: u
486
+ }
487
+ )
488
+ ] }) }),
489
+ /* @__PURE__ */ e.jsxs(U, { children: [
490
+ /* @__PURE__ */ e.jsx(
491
+ v,
492
+ {
493
+ variant: "outline",
494
+ onClick: () => w(!1),
495
+ disabled: u,
496
+ children: a
497
+ }
498
+ ),
499
+ /* @__PURE__ */ e.jsxs(
500
+ v,
501
+ {
502
+ variant: j,
503
+ onClick: P,
504
+ disabled: A || u,
505
+ children: [
506
+ u && /* @__PURE__ */ e.jsx("span", { className: "mr-2", children: y || /* @__PURE__ */ e.jsxs(
507
+ "svg",
508
+ {
509
+ className: "h-4 w-4 animate-spin",
510
+ fill: "none",
511
+ viewBox: "0 0 24 24",
512
+ children: [
513
+ /* @__PURE__ */ e.jsx(
514
+ "circle",
515
+ {
516
+ className: "opacity-25",
517
+ cx: "12",
518
+ cy: "12",
519
+ r: "10",
520
+ stroke: "currentColor",
521
+ strokeWidth: "4"
522
+ }
523
+ ),
524
+ /* @__PURE__ */ e.jsx(
525
+ "path",
526
+ {
527
+ className: "opacity-75",
528
+ fill: "currentColor",
529
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
530
+ }
531
+ )
532
+ ]
533
+ }
534
+ ) }),
535
+ d
536
+ ]
537
+ }
538
+ )
539
+ ] })
540
+ ] }) });
541
+ }
542
+ function ze({
543
+ title: s,
544
+ searchPlaceholder: w = "搜索...",
545
+ searchValue: m = "",
546
+ onSearchChange: f,
547
+ onSearch: l,
548
+ showSearch: u = !0,
549
+ action: d,
550
+ actionLabel: a,
551
+ onActionClick: j,
552
+ loading: h = !1,
553
+ components: r
554
+ }) {
555
+ if (!r)
556
+ return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
557
+ const { Input: y, Button: R } = r, N = (C) => {
558
+ C.key === "Enter" && l && l();
559
+ };
560
+ return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4 p-1", children: [
561
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
562
+ /* @__PURE__ */ e.jsx("div", { className: "text-lg font-semibold leading-none tracking-tight", children: s }),
563
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
564
+ d && /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: d }),
565
+ !d && a && j && /* @__PURE__ */ e.jsxs(R, { onClick: j, disabled: h, size: "sm", children: [
566
+ /* @__PURE__ */ e.jsx(ge, { className: "mr-2 h-4 w-4" }),
567
+ a
568
+ ] })
569
+ ] })
570
+ ] }),
571
+ u && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
572
+ /* @__PURE__ */ e.jsxs("div", { className: "relative max-w-sm flex-1", children: [
573
+ /* @__PURE__ */ e.jsx(Ne, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
574
+ /* @__PURE__ */ e.jsx(
575
+ y,
576
+ {
577
+ placeholder: w,
578
+ value: m,
579
+ onChange: (C) => f == null ? void 0 : f(C.target.value),
580
+ onKeyPress: N,
581
+ className: "h-9 pl-8",
582
+ disabled: h
583
+ }
584
+ )
585
+ ] }),
586
+ l && /* @__PURE__ */ e.jsx(
587
+ R,
588
+ {
589
+ onClick: l,
590
+ disabled: h,
591
+ variant: "secondary",
592
+ size: "sm",
593
+ children: "搜索"
594
+ }
595
+ )
596
+ ] })
597
+ ] });
598
+ }
599
+ function Le({
600
+ currentPage: s,
601
+ pageSize: w,
602
+ total: m,
603
+ onPageChange: f,
604
+ onPageSizeChange: l,
605
+ pageSizeOptions: u = [10, 20, 50],
606
+ showPageSizeSelector: d = !0,
607
+ showJumpToPage: a = !0,
608
+ showTotal: j = !0,
609
+ searchActive: h = !1,
610
+ components: r
611
+ }) {
612
+ const [y, R] = G(String(s + 1));
613
+ if (se(() => {
614
+ R(String(s + 1));
615
+ }, [s]), !r)
616
+ return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
617
+ const {
618
+ Button: N,
619
+ Select: C,
620
+ SelectTrigger: S,
621
+ SelectContent: _,
622
+ SelectItem: U,
623
+ SelectValue: V
624
+ } = r, I = Math.ceil(m / w), v = Math.max(I, 1), B = s * w + 1, z = Math.min((s + 1) * w, m), A = Array.from(
625
+ /* @__PURE__ */ new Set([...u, w])
626
+ ).sort((i, p) => i - p), P = d && !!l, M = v > 1, O = (i) => {
627
+ const p = Math.max(0, Math.min(i, v - 1));
628
+ p !== s && f(p);
629
+ }, H = (() => {
630
+ if (v <= 7)
631
+ return Array.from({ length: v }, (D, $) => $);
632
+ const i = /* @__PURE__ */ new Set([
633
+ 0,
634
+ 1,
635
+ v - 2,
636
+ v - 1,
637
+ s - 1,
638
+ s,
639
+ s + 1
640
+ ]), p = Array.from(i).filter((D) => D >= 0 && D < v).sort((D, $) => D - $), L = [];
641
+ for (const D of p) {
642
+ const $ = L[L.length - 1];
643
+ typeof $ == "number" && D - $ > 1 && L.push("ellipsis"), L.push(D);
644
+ }
645
+ return L;
646
+ })();
647
+ return m === 0 ? null : /* @__PURE__ */ e.jsxs(
648
+ "div",
649
+ {
650
+ className: `flex w-full items-center gap-3 ${j ? "justify-between" : "justify-end"}`,
651
+ children: [
652
+ j && /* @__PURE__ */ e.jsx("div", { className: "text-sm text-muted-foreground", children: h ? `找到 ${m} 条匹配记录` : m > 0 ? `显示 ${B} - ${z} 条,共 ${m} 条记录` : "暂无数据" }),
653
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-wrap items-center justify-end gap-2", children: [
654
+ P && /* @__PURE__ */ e.jsxs("div", { className: "mr-2 flex items-center gap-2", children: [
655
+ /* @__PURE__ */ e.jsx("span", { className: "text-sm text-muted-foreground", children: "每页" }),
656
+ /* @__PURE__ */ e.jsxs(
657
+ C,
658
+ {
659
+ value: String(w),
660
+ onValueChange: (i) => {
661
+ const p = Number(i);
662
+ Number.isNaN(p) || p === w || !l || l(p);
663
+ },
664
+ children: [
665
+ /* @__PURE__ */ e.jsx(S, { className: "h-8 w-[90px]", children: /* @__PURE__ */ e.jsx(V, {}) }),
666
+ /* @__PURE__ */ e.jsx(_, { children: A.map((i) => /* @__PURE__ */ e.jsx(U, { value: String(i), children: i }, i)) })
667
+ ]
668
+ }
669
+ ),
670
+ /* @__PURE__ */ e.jsx("span", { className: "text-sm text-muted-foreground", children: "条" })
671
+ ] }),
672
+ /* @__PURE__ */ e.jsxs("div", { className: "mr-4 text-sm text-muted-foreground", children: [
673
+ "第 ",
674
+ s + 1,
675
+ " 页,共 ",
676
+ v,
677
+ " 页"
678
+ ] }),
679
+ /* @__PURE__ */ e.jsx(
680
+ N,
681
+ {
682
+ variant: "outline",
683
+ size: "icon",
684
+ onClick: () => O(s - 1),
685
+ disabled: s === 0 || !M,
686
+ "aria-label": "上一页",
687
+ children: /* @__PURE__ */ e.jsx(ke, { className: "h-4 w-4" })
688
+ }
689
+ ),
690
+ /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-1", children: H.map(
691
+ (i, p) => i === "ellipsis" ? /* @__PURE__ */ e.jsx(
692
+ "span",
693
+ {
694
+ className: "inline-flex h-8 w-8 items-center justify-center text-sm text-muted-foreground",
695
+ children: "..."
696
+ },
697
+ `ellipsis-${p}`
698
+ ) : /* @__PURE__ */ e.jsx(
699
+ N,
700
+ {
701
+ variant: i === s ? "default" : "outline",
702
+ size: "sm",
703
+ onClick: () => O(i),
704
+ disabled: i === s,
705
+ "aria-current": i === s ? "page" : void 0,
706
+ children: i + 1
707
+ },
708
+ i
709
+ )
710
+ ) }),
711
+ /* @__PURE__ */ e.jsx(
712
+ N,
713
+ {
714
+ variant: "outline",
715
+ size: "icon",
716
+ onClick: () => O(s + 1),
717
+ disabled: s >= v - 1 || !M,
718
+ "aria-label": "下一页",
719
+ children: /* @__PURE__ */ e.jsx(ye, { className: "h-4 w-4" })
720
+ }
721
+ ),
722
+ a && /* @__PURE__ */ e.jsxs(
723
+ "form",
724
+ {
725
+ className: "ml-1 flex items-center gap-2",
726
+ onSubmit: (i) => {
727
+ i.preventDefault();
728
+ const p = Number.parseInt(y, 10);
729
+ Number.isNaN(p) || O(p - 1);
730
+ },
731
+ children: [
732
+ /* @__PURE__ */ e.jsx("span", { className: "text-sm text-muted-foreground", children: "跳至" }),
733
+ /* @__PURE__ */ e.jsx(
734
+ "input",
735
+ {
736
+ type: "number",
737
+ min: 1,
738
+ max: v,
739
+ value: y,
740
+ disabled: !M,
741
+ onChange: (i) => R(i.target.value),
742
+ className: "h-8 w-16 rounded-md border border-input bg-background px-2 text-sm",
743
+ "aria-label": "跳转页码"
744
+ }
745
+ ),
746
+ /* @__PURE__ */ e.jsx(
747
+ N,
748
+ {
749
+ type: "submit",
750
+ variant: "outline",
751
+ size: "sm",
752
+ disabled: !M,
753
+ children: "跳转"
754
+ }
755
+ )
756
+ ]
757
+ }
758
+ )
759
+ ] })
760
+ ]
761
+ }
762
+ );
763
+ }
764
+ const _e = [
765
+ {
766
+ value: "light",
767
+ label: "浅色",
768
+ icon: /* @__PURE__ */ e.jsxs(
769
+ "svg",
770
+ {
771
+ className: "h-4 w-4",
772
+ fill: "none",
773
+ viewBox: "0 0 24 24",
774
+ stroke: "currentColor",
775
+ children: [
776
+ /* @__PURE__ */ e.jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", strokeWidth: "2" }),
777
+ /* @__PURE__ */ e.jsx(
778
+ "path",
779
+ {
780
+ className: "opacity-75",
781
+ d: "M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41",
782
+ strokeWidth: "2",
783
+ strokeLinecap: "round"
784
+ }
785
+ )
786
+ ]
787
+ }
788
+ )
789
+ },
790
+ {
791
+ value: "dark",
792
+ label: "深色",
793
+ icon: /* @__PURE__ */ e.jsx(
794
+ "svg",
795
+ {
796
+ className: "h-4 w-4",
797
+ fill: "none",
798
+ viewBox: "0 0 24 24",
799
+ stroke: "currentColor",
800
+ children: /* @__PURE__ */ e.jsx(
801
+ "path",
802
+ {
803
+ d: "M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z",
804
+ strokeWidth: "2",
805
+ strokeLinecap: "round",
806
+ strokeLinejoin: "round"
807
+ }
808
+ )
809
+ }
810
+ )
811
+ },
812
+ {
813
+ value: "system",
814
+ label: "跟随系统",
815
+ icon: /* @__PURE__ */ e.jsxs(
816
+ "svg",
817
+ {
818
+ className: "h-4 w-4",
819
+ fill: "none",
820
+ viewBox: "0 0 24 24",
821
+ stroke: "currentColor",
822
+ children: [
823
+ /* @__PURE__ */ e.jsx(
824
+ "rect",
825
+ {
826
+ x: "2",
827
+ y: "3",
828
+ width: "20",
829
+ height: "14",
830
+ rx: "2",
831
+ ry: "2",
832
+ strokeWidth: "2"
833
+ }
834
+ ),
835
+ /* @__PURE__ */ e.jsx("path", { d: "M8 21h8m-4-4v4", strokeWidth: "2", strokeLinecap: "round" })
836
+ ]
837
+ }
838
+ )
839
+ }
840
+ ];
841
+ function Ye({
842
+ value: s,
843
+ onValueChange: w,
844
+ themes: m = _e,
845
+ triggerVariant: f = "ghost",
846
+ triggerSize: l = "icon",
847
+ triggerClassName: u,
848
+ iconSize: d = 16,
849
+ showCurrentIcon: a = !0,
850
+ enableSSRHandling: j = !0,
851
+ triggerContent: h,
852
+ components: r,
853
+ themeIcons: y
854
+ }) {
855
+ const [R, N] = G(!1);
856
+ if (se(() => {
857
+ N(!0);
858
+ }, []), j && !R)
859
+ return null;
860
+ if (!r)
861
+ return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
862
+ const {
863
+ DropdownMenu: C,
864
+ DropdownMenuTrigger: S,
865
+ DropdownMenuContent: _,
866
+ DropdownMenuRadioGroup: U,
867
+ DropdownMenuRadioItem: V,
868
+ Button: I
869
+ } = r, v = (P) => {
870
+ if (y && y[P])
871
+ return y[P];
872
+ const M = m.find((O) => O.value === P);
873
+ return M == null ? void 0 : M.icon;
874
+ }, B = v(s), z = a ? B : null, A = d ? { width: d, height: d } : {};
875
+ return /* @__PURE__ */ e.jsxs(C, { children: [
876
+ /* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsx(
877
+ I,
878
+ {
879
+ variant: f,
880
+ size: l,
881
+ className: u,
882
+ children: h || /* @__PURE__ */ e.jsx(
883
+ "span",
884
+ {
885
+ style: A,
886
+ className: "inline-flex items-center justify-center",
887
+ children: z
888
+ }
889
+ )
890
+ }
891
+ ) }),
892
+ /* @__PURE__ */ e.jsx(_, { children: /* @__PURE__ */ e.jsx(U, { value: s, onValueChange: w, children: m.map((P) => /* @__PURE__ */ e.jsxs(V, { value: P.value, children: [
893
+ /* @__PURE__ */ e.jsx("span", { className: "mr-2 inline-flex items-center", children: v(P.value) }),
894
+ /* @__PURE__ */ e.jsx("span", { children: P.label })
895
+ ] }, P.value)) }) })
896
+ ] });
897
+ }
898
+ const Pe = [
899
+ {
900
+ value: "light",
901
+ label: "浅色",
902
+ icon: /* @__PURE__ */ e.jsxs(
903
+ "svg",
904
+ {
905
+ className: "h-4 w-4",
906
+ fill: "none",
907
+ viewBox: "0 0 24 24",
908
+ stroke: "currentColor",
909
+ children: [
910
+ /* @__PURE__ */ e.jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", strokeWidth: "2" }),
911
+ /* @__PURE__ */ e.jsx(
912
+ "path",
913
+ {
914
+ className: "opacity-75",
915
+ d: "M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41",
916
+ strokeWidth: "2",
917
+ strokeLinecap: "round"
918
+ }
919
+ )
920
+ ]
921
+ }
922
+ )
923
+ },
924
+ {
925
+ value: "dark",
926
+ label: "深色",
927
+ icon: /* @__PURE__ */ e.jsx(
928
+ "svg",
929
+ {
930
+ className: "h-4 w-4",
931
+ fill: "none",
932
+ viewBox: "0 0 24 24",
933
+ stroke: "currentColor",
934
+ children: /* @__PURE__ */ e.jsx(
935
+ "path",
936
+ {
937
+ d: "M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z",
938
+ strokeWidth: "2",
939
+ strokeLinecap: "round",
940
+ strokeLinejoin: "round"
941
+ }
942
+ )
943
+ }
944
+ )
945
+ },
946
+ {
947
+ value: "system",
948
+ label: "跟随系统",
949
+ icon: /* @__PURE__ */ e.jsxs(
950
+ "svg",
951
+ {
952
+ className: "h-4 w-4",
953
+ fill: "none",
954
+ viewBox: "0 0 24 24",
955
+ stroke: "currentColor",
956
+ children: [
957
+ /* @__PURE__ */ e.jsx(
958
+ "rect",
959
+ {
960
+ x: "2",
961
+ y: "3",
962
+ width: "20",
963
+ height: "14",
964
+ rx: "2",
965
+ ry: "2",
966
+ strokeWidth: "2"
967
+ }
968
+ ),
969
+ /* @__PURE__ */ e.jsx("path", { d: "M8 21h8m-4-4v4", strokeWidth: "2", strokeLinecap: "round" })
970
+ ]
971
+ }
972
+ )
973
+ }
974
+ ];
975
+ function Ue({
976
+ value: s,
977
+ onValueChange: w,
978
+ themes: m = Pe,
979
+ iconSize: f = 16,
980
+ components: l,
981
+ themeIcons: u
982
+ }) {
983
+ if (!l)
984
+ return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
985
+ const { DropdownMenuRadioGroup: d, DropdownMenuRadioItem: a } = l, j = (r) => {
986
+ if (u && u[r])
987
+ return u[r];
988
+ const y = m.find((R) => R.value === r);
989
+ return y == null ? void 0 : y.icon;
990
+ }, h = f ? { width: f, height: f } : {};
991
+ return /* @__PURE__ */ e.jsx(d, { value: s, onValueChange: w, children: m.map((r) => /* @__PURE__ */ e.jsxs(a, { value: r.value, children: [
992
+ /* @__PURE__ */ e.jsx("span", { className: "mr-2 inline-flex items-center", style: h, children: j(r.value) }),
993
+ /* @__PURE__ */ e.jsx("span", { children: r.label })
994
+ ] }, r.value)) });
995
+ }
996
+ const Ce = () => /* @__PURE__ */ e.jsx(
997
+ "svg",
998
+ {
999
+ xmlns: "http://www.w3.org/2000/svg",
1000
+ width: "16",
1001
+ height: "16",
1002
+ viewBox: "0 0 24 24",
1003
+ fill: "none",
1004
+ stroke: "currentColor",
1005
+ strokeWidth: "2",
1006
+ strokeLinecap: "round",
1007
+ strokeLinejoin: "round",
1008
+ children: /* @__PURE__ */ e.jsx("path", { d: "m15 18-6-6 6-6" })
1009
+ }
1010
+ ), Me = () => /* @__PURE__ */ e.jsx(
1011
+ "svg",
1012
+ {
1013
+ xmlns: "http://www.w3.org/2000/svg",
1014
+ width: "16",
1015
+ height: "16",
1016
+ viewBox: "0 0 24 24",
1017
+ fill: "none",
1018
+ stroke: "currentColor",
1019
+ strokeWidth: "2",
1020
+ strokeLinecap: "round",
1021
+ strokeLinejoin: "round",
1022
+ children: /* @__PURE__ */ e.jsx("path", { d: "m9 18 6-6-6-6" })
1023
+ }
1024
+ ), De = () => /* @__PURE__ */ e.jsxs(
1025
+ "svg",
1026
+ {
1027
+ xmlns: "http://www.w3.org/2000/svg",
1028
+ width: "16",
1029
+ height: "16",
1030
+ viewBox: "0 0 24 24",
1031
+ fill: "none",
1032
+ stroke: "currentColor",
1033
+ strokeWidth: "2",
1034
+ strokeLinecap: "round",
1035
+ strokeLinejoin: "round",
1036
+ children: [
1037
+ /* @__PURE__ */ e.jsx("circle", { cx: "11", cy: "11", r: "8" }),
1038
+ /* @__PURE__ */ e.jsx("path", { d: "m21 21-4.3-4.3" }),
1039
+ /* @__PURE__ */ e.jsx("path", { d: "m11 8v6" }),
1040
+ /* @__PURE__ */ e.jsx("path", { d: "m8 11h6" })
1041
+ ]
1042
+ }
1043
+ ), Ae = () => /* @__PURE__ */ e.jsxs(
1044
+ "svg",
1045
+ {
1046
+ xmlns: "http://www.w3.org/2000/svg",
1047
+ width: "16",
1048
+ height: "16",
1049
+ viewBox: "0 0 24 24",
1050
+ fill: "none",
1051
+ stroke: "currentColor",
1052
+ strokeWidth: "2",
1053
+ strokeLinecap: "round",
1054
+ strokeLinejoin: "round",
1055
+ children: [
1056
+ /* @__PURE__ */ e.jsx("circle", { cx: "11", cy: "11", r: "8" }),
1057
+ /* @__PURE__ */ e.jsx("path", { d: "m21 21-4.3-4.3" }),
1058
+ /* @__PURE__ */ e.jsx("path", { d: "m8 11h6" })
1059
+ ]
1060
+ }
1061
+ );
1062
+ function Ve({
1063
+ url: s,
1064
+ initialPage: w = 1,
1065
+ initialScale: m = 1,
1066
+ scale: f,
1067
+ onScaleChange: l,
1068
+ minScale: u = 0.5,
1069
+ maxScale: d = 3,
1070
+ currentPage: a,
1071
+ onPageChange: j,
1072
+ showToolbar: h = !0,
1073
+ showPagination: r = !0,
1074
+ className: y,
1075
+ containerClassName: R,
1076
+ pageClassName: N,
1077
+ components: C,
1078
+ onLoadSuccess: S,
1079
+ onLoadError: _,
1080
+ loadingText: U = "加载中...",
1081
+ errorText: V = "加载失败"
1082
+ }) {
1083
+ const [I, v] = G(null), [B, z] = G(w), [A, P] = G(m), [M, O] = G(!0), [H, i] = G(null), [p, L] = G(0), [D, $] = G(!1), Z = ve(null), [Y, q] = G(null), T = a ?? B, t = f ?? A, n = be(() => {
1084
+ const o = [T];
1085
+ return T > 1 && o.push(T - 1), T < p && o.push(T + 1), o;
1086
+ }, [T, p]), x = ne(() => {
1087
+ if (T > 1) {
1088
+ const o = T - 1;
1089
+ a === void 0 && z(o), j == null || j(o);
1090
+ }
1091
+ }, [T, a, j]), b = ne(() => {
1092
+ if (T < p) {
1093
+ const o = T + 1;
1094
+ a === void 0 && z(o), j == null || j(o);
1095
+ }
1096
+ }, [T, p, a, j]), X = ne(() => {
1097
+ const o = Math.min(t + 0.25, d);
1098
+ f === void 0 && P(o), l == null || l(o);
1099
+ }, [t, d, f, l]), Q = ne(() => {
1100
+ const o = Math.max(t - 0.25, u);
1101
+ f === void 0 && P(o), l == null || l(o);
1102
+ }, [t, u, f, l]), g = ne(async () => {
1103
+ var o, ee, W;
1104
+ if (!(typeof document > "u")) {
1105
+ if (!document.fullscreenElement) {
1106
+ await ((ee = (o = Z.current) == null ? void 0 : o.requestFullscreen) == null ? void 0 : ee.call(o));
1107
+ return;
1108
+ }
1109
+ await ((W = document.exitFullscreen) == null ? void 0 : W.call(document));
1110
+ }
1111
+ }, []);
1112
+ if (se(() => {
1113
+ let o = !0;
1114
+ return (async () => {
1115
+ try {
1116
+ const W = await import("./index-BYKrRClM.js");
1117
+ if (typeof window < "u") {
1118
+ const F = W.pdfjs, re = F == null ? void 0 : F.version;
1119
+ F != null && F.GlobalWorkerOptions && re && (F.GlobalWorkerOptions.workerSrc = `https://cdn.jsdelivr.net/npm/pdfjs-dist@${re}/build/pdf.worker.min.mjs`);
1120
+ }
1121
+ o && q(W);
1122
+ } catch (W) {
1123
+ if (o) {
1124
+ const F = W instanceof Error ? W : new Error("无法加载 react-pdf 库");
1125
+ i(F), O(!1), _ == null || _(F);
1126
+ }
1127
+ }
1128
+ })(), () => {
1129
+ o = !1;
1130
+ };
1131
+ }, []), se(() => {
1132
+ if (!Y || !s) return;
1133
+ let o = !0;
1134
+ return (async () => {
1135
+ O(!0), i(null);
1136
+ try {
1137
+ const { Document: W } = Y;
1138
+ if (!W)
1139
+ throw new Error("react-pdf Document 组件不可用");
1140
+ const re = await Y.pdfjs.getDocument(s).promise;
1141
+ o && (v(re), L(re.numPages), O(!1), S == null || S(re));
1142
+ } catch (W) {
1143
+ if (o) {
1144
+ const F = W instanceof Error ? W : new Error("PDF 加载失败");
1145
+ i(F), O(!1), _ == null || _(F);
1146
+ }
1147
+ }
1148
+ })(), () => {
1149
+ o = !1;
1150
+ };
1151
+ }, [Y, s, S, _]), se(() => {
1152
+ if (typeof document > "u") return;
1153
+ const o = () => {
1154
+ $(document.fullscreenElement === Z.current);
1155
+ };
1156
+ return document.addEventListener("fullscreenchange", o), () => {
1157
+ document.removeEventListener("fullscreenchange", o);
1158
+ };
1159
+ }, []), !C)
1160
+ return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
1161
+ const { Card: J, CardContent: c, Button: k, Skeleton: E } = C, te = () => h ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1162
+ /* @__PURE__ */ e.jsx(
1163
+ k,
1164
+ {
1165
+ variant: "outline",
1166
+ size: "sm",
1167
+ onClick: Q,
1168
+ disabled: t <= u,
1169
+ children: /* @__PURE__ */ e.jsx(Ae, {})
1170
+ }
1171
+ ),
1172
+ /* @__PURE__ */ e.jsxs("span", { className: "text-sm", children: [
1173
+ Math.round(t * 100),
1174
+ "%"
1175
+ ] }),
1176
+ /* @__PURE__ */ e.jsx(
1177
+ k,
1178
+ {
1179
+ variant: "outline",
1180
+ size: "sm",
1181
+ onClick: X,
1182
+ disabled: t >= d,
1183
+ children: /* @__PURE__ */ e.jsx(De, {})
1184
+ }
1185
+ ),
1186
+ /* @__PURE__ */ e.jsx(
1187
+ k,
1188
+ {
1189
+ variant: "outline",
1190
+ size: "sm",
1191
+ onClick: () => {
1192
+ g();
1193
+ },
1194
+ children: D ? "退出全屏" : "全屏"
1195
+ }
1196
+ )
1197
+ ] }) : null, ce = () => r ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1198
+ /* @__PURE__ */ e.jsxs(
1199
+ k,
1200
+ {
1201
+ variant: "outline",
1202
+ size: "sm",
1203
+ onClick: x,
1204
+ disabled: T <= 1,
1205
+ children: [
1206
+ /* @__PURE__ */ e.jsx(Ce, {}),
1207
+ /* @__PURE__ */ e.jsx("span", { className: "ml-1", children: "上一页" })
1208
+ ]
1209
+ }
1210
+ ),
1211
+ /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ e.jsxs("span", { className: "text-sm text-muted-foreground", children: [
1212
+ T,
1213
+ " / ",
1214
+ p
1215
+ ] }) }),
1216
+ /* @__PURE__ */ e.jsxs(
1217
+ k,
1218
+ {
1219
+ variant: "outline",
1220
+ size: "sm",
1221
+ onClick: b,
1222
+ disabled: T >= p,
1223
+ children: [
1224
+ /* @__PURE__ */ e.jsx("span", { className: "mr-1", children: "下一页" }),
1225
+ /* @__PURE__ */ e.jsx(Me, {})
1226
+ ]
1227
+ }
1228
+ )
1229
+ ] }) : null, K = () => !h && !r ? null : /* @__PURE__ */ e.jsxs(
1230
+ "div",
1231
+ {
1232
+ "data-testid": "pdf-operations-bar",
1233
+ className: "flex items-center justify-between gap-4 border-b px-4 py-2",
1234
+ children: [
1235
+ te(),
1236
+ ce()
1237
+ ]
1238
+ }
1239
+ ), ie = () => /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center space-y-4 p-8", children: [
1240
+ /* @__PURE__ */ e.jsx(E, { className: "h-8 w-32" }),
1241
+ /* @__PURE__ */ e.jsx(E, { className: "h-64 w-full max-w-2xl" }),
1242
+ /* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground", children: U })
1243
+ ] }), ue = () => /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center space-y-4 p-8", children: /* @__PURE__ */ e.jsxs("div", { className: "text-center text-destructive", children: [
1244
+ /* @__PURE__ */ e.jsx("p", { className: "font-medium", children: V }),
1245
+ H && /* @__PURE__ */ e.jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: H.message })
1246
+ ] }) }), xe = () => {
1247
+ if (!Y || !I) return null;
1248
+ const { Page: o } = Y;
1249
+ return /* @__PURE__ */ e.jsx(
1250
+ "div",
1251
+ {
1252
+ className: `flex flex-col items-center justify-center ${D ? "h-[calc(100vh-56px)] overflow-auto" : "overflow-visible"}`,
1253
+ children: n.map((ee) => /* @__PURE__ */ e.jsx(
1254
+ "div",
1255
+ {
1256
+ className: N,
1257
+ style: {
1258
+ display: ee === T ? "block" : "none"
1259
+ },
1260
+ children: /* @__PURE__ */ e.jsx(
1261
+ o,
1262
+ {
1263
+ pdf: I,
1264
+ pageNumber: ee,
1265
+ scale: t,
1266
+ renderTextLayer: !1,
1267
+ renderAnnotationLayer: !1,
1268
+ className: "shadow-md"
1269
+ }
1270
+ )
1271
+ },
1272
+ ee
1273
+ ))
1274
+ }
1275
+ );
1276
+ };
1277
+ return /* @__PURE__ */ e.jsx("div", { ref: Z, children: /* @__PURE__ */ e.jsxs(J, { className: y, children: [
1278
+ K(),
1279
+ /* @__PURE__ */ e.jsx(c, { className: R, children: M ? ie() : H ? ue() : xe() })
1280
+ ] }) });
1281
+ }
1282
+ export {
1283
+ We as D,
1284
+ Ve as S,
1285
+ ze as T,
1286
+ Be as a,
1287
+ Le as b,
1288
+ Ye as c,
1289
+ Ue as d,
1290
+ $e as e,
1291
+ e as j
1292
+ };
1293
+ //# sourceMappingURL=index-DruzjpTS.js.map