@996-design/996-ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE.md +35 -0
  3. package/README.md +31 -0
  4. package/dist/cjs/index.cjs +4228 -0
  5. package/dist/cjs/index.cjs.map +41 -0
  6. package/dist/cjs/legacy-index.cjs +17297 -0
  7. package/dist/cjs/legacy-index.cjs.map +96 -0
  8. package/dist/cjs/pro/index.cjs +8544 -0
  9. package/dist/cjs/pro/index.cjs.map +35 -0
  10. package/dist/esm/index.js +4063 -0
  11. package/dist/esm/index.js.map +41 -0
  12. package/dist/esm/legacy-index.js +17294 -0
  13. package/dist/esm/legacy-index.js.map +96 -0
  14. package/dist/esm/pro/index.js +8554 -0
  15. package/dist/esm/pro/index.js.map +35 -0
  16. package/dist/styles.css +5816 -0
  17. package/dist/theme.css +601 -0
  18. package/dist/types/ConfigProvider.d.ts +195 -0
  19. package/dist/types/antd-theme.d.ts +12 -0
  20. package/dist/types/components/Alert.d.ts +51 -0
  21. package/dist/types/components/Avatar.d.ts +44 -0
  22. package/dist/types/components/Badge.d.ts +31 -0
  23. package/dist/types/components/Breadcrumb.d.ts +45 -0
  24. package/dist/types/components/Button.d.ts +42 -0
  25. package/dist/types/components/ButtonGroup.d.ts +13 -0
  26. package/dist/types/components/Card.d.ts +55 -0
  27. package/dist/types/components/Carousel.d.ts +70 -0
  28. package/dist/types/components/Checkbox.d.ts +43 -0
  29. package/dist/types/components/Collapse.d.ts +23 -0
  30. package/dist/types/components/ColorPicker.d.ts +143 -0
  31. package/dist/types/components/DataDisplayPrimitives.d.ts +205 -0
  32. package/dist/types/components/DataEntryPrimitives.d.ts +454 -0
  33. package/dist/types/components/Divider.d.ts +24 -0
  34. package/dist/types/components/Drawer.d.ts +68 -0
  35. package/dist/types/components/Dropdown.d.ts +41 -0
  36. package/dist/types/components/Empty.d.ts +14 -0
  37. package/dist/types/components/EmptyState.d.ts +6 -0
  38. package/dist/types/components/FeedbackPrimitives.d.ts +102 -0
  39. package/dist/types/components/Form.d.ts +67 -0
  40. package/dist/types/components/GameCover.d.ts +8 -0
  41. package/dist/types/components/Grid.d.ts +50 -0
  42. package/dist/types/components/Icon.d.ts +13 -0
  43. package/dist/types/components/IconButton.d.ts +14 -0
  44. package/dist/types/components/Input.d.ts +110 -0
  45. package/dist/types/components/InputNumber.d.ts +29 -0
  46. package/dist/types/components/LayoutPrimitives.d.ts +130 -0
  47. package/dist/types/components/List.d.ts +64 -0
  48. package/dist/types/components/Masonry.d.ts +43 -0
  49. package/dist/types/components/MenuList.d.ts +24 -0
  50. package/dist/types/components/Message.d.ts +58 -0
  51. package/dist/types/components/MessageToast.d.ts +27 -0
  52. package/dist/types/components/Modal.d.ts +123 -0
  53. package/dist/types/components/NavigationPrimitives.d.ts +73 -0
  54. package/dist/types/components/OtherPrimitives.d.ts +36 -0
  55. package/dist/types/components/Pagination.d.ts +18 -0
  56. package/dist/types/components/Panel.d.ts +8 -0
  57. package/dist/types/components/Popconfirm.d.ts +18 -0
  58. package/dist/types/components/Popover.d.ts +10 -0
  59. package/dist/types/components/PriceText.d.ts +9 -0
  60. package/dist/types/components/Progress.d.ts +57 -0
  61. package/dist/types/components/ProgressBar.d.ts +8 -0
  62. package/dist/types/components/ProgressButton.d.ts +9 -0
  63. package/dist/types/components/Radio.d.ts +67 -0
  64. package/dist/types/components/Rate.d.ts +17 -0
  65. package/dist/types/components/Result.d.ts +11 -0
  66. package/dist/types/components/SectionHeader.d.ts +11 -0
  67. package/dist/types/components/Segmented.d.ts +41 -0
  68. package/dist/types/components/SegmentedTabs.d.ts +42 -0
  69. package/dist/types/components/SelectInput.d.ts +33 -0
  70. package/dist/types/components/Skeleton.d.ts +54 -0
  71. package/dist/types/components/Slider.d.ts +48 -0
  72. package/dist/types/components/Spin.d.ts +21 -0
  73. package/dist/types/components/Splitter.d.ts +7 -0
  74. package/dist/types/components/StatCard.d.ts +10 -0
  75. package/dist/types/components/Statistic.d.ts +48 -0
  76. package/dist/types/components/StatusItem.d.ts +12 -0
  77. package/dist/types/components/Steps.d.ts +40 -0
  78. package/dist/types/components/Switch.d.ts +41 -0
  79. package/dist/types/components/Table.d.ts +61 -0
  80. package/dist/types/components/Tabs.d.ts +50 -0
  81. package/dist/types/components/Tag.d.ts +52 -0
  82. package/dist/types/components/TagPill.d.ts +7 -0
  83. package/dist/types/components/Tooltip.d.ts +64 -0
  84. package/dist/types/components/Typography.d.ts +374 -0
  85. package/dist/types/components/affix/utils.d.ts +10 -0
  86. package/dist/types/components/feedback/FloatButton.d.ts +51 -0
  87. package/dist/types/components/feedback/Watermark.d.ts +33 -0
  88. package/dist/types/components/feedback/globalHolder.d.ts +17 -0
  89. package/dist/types/components/form/statusContext.d.ts +18 -0
  90. package/dist/types/components/form/statusContext.type-smoke.d.ts +24 -0
  91. package/dist/types/components/splitter/Panel.d.ts +6 -0
  92. package/dist/types/components/splitter/SplitBar.d.ts +32 -0
  93. package/dist/types/components/splitter/interface.d.ts +89 -0
  94. package/dist/types/components/splitter/sizeUtil.d.ts +5 -0
  95. package/dist/types/components/splitter/useItems.d.ts +3 -0
  96. package/dist/types/components/splitter/useResizable.d.ts +9 -0
  97. package/dist/types/components/splitter/useResize.d.ts +9 -0
  98. package/dist/types/components/splitter/useSizes.d.ts +11 -0
  99. package/dist/types/components/table/columnState.d.ts +36 -0
  100. package/dist/types/components/table/pagination.d.ts +34 -0
  101. package/dist/types/components/table/selection.d.ts +23 -0
  102. package/dist/types/components/table/types.d.ts +163 -0
  103. package/dist/types/hooks/useReducedMotion.d.ts +1 -0
  104. package/dist/types/index.d.ts +44 -0
  105. package/dist/types/legacy-index.d.ts +136 -0
  106. package/dist/types/pro/index.d.ts +17 -0
  107. package/dist/types/tokens.d.ts +266 -0
  108. package/dist/types/utils/cn.d.ts +3 -0
  109. package/dist/types/utils/slots.d.ts +5 -0
  110. package/package.json +126 -0
@@ -0,0 +1,4063 @@
1
+ // src/index.ts
2
+ export * from "@996-design/996-antd";
3
+
4
+ // src/antd-theme.ts
5
+ import { theme } from "@996-design/996-antd";
6
+ var sharedToken = {
7
+ borderRadius: 8,
8
+ borderRadiusLG: 16,
9
+ colorError: "#fa433d",
10
+ colorInfo: "#1e8cff",
11
+ colorSuccess: "#07c160",
12
+ colorWarning: "#f39713",
13
+ controlHeight: 40,
14
+ controlHeightLG: 48,
15
+ controlHeightSM: 32,
16
+ fontFamily: '"PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif'
17
+ };
18
+ var antd996DarkTheme = {
19
+ algorithm: theme.darkAlgorithm,
20
+ cssVar: { key: "hj-996ux", prefix: "hj" },
21
+ token: {
22
+ ...sharedToken,
23
+ colorBgBase: "#121318",
24
+ colorPrimary: "#ffcc33",
25
+ colorTextBase: "#ffffff"
26
+ }
27
+ };
28
+ var antd996LightTheme = {
29
+ algorithm: theme.defaultAlgorithm,
30
+ cssVar: { key: "hj-996ux", prefix: "hj" },
31
+ token: {
32
+ ...sharedToken,
33
+ colorBgBase: "#f5f7fa",
34
+ colorPrimary: "#9a6d00",
35
+ colorTextBase: "#17191f"
36
+ }
37
+ };
38
+ function getAntd996Theme(colorScheme) {
39
+ return colorScheme === "light" ? antd996LightTheme : antd996DarkTheme;
40
+ }
41
+ var antd996Theme = antd996DarkTheme;
42
+ // src/utils/cn.ts
43
+ function cn(...values) {
44
+ return values.filter(Boolean).join(" ");
45
+ }
46
+
47
+ // src/utils/slots.ts
48
+ function slotClass(classNames, slot, ...defaults) {
49
+ return cn(...defaults, classNames?.[slot]);
50
+ }
51
+ function slotStyle(styles, slot, defaults) {
52
+ return { ...defaults, ...styles?.[slot] };
53
+ }
54
+
55
+ // src/components/ButtonGroup.tsx
56
+ import { jsxDEV } from "react/jsx-dev-runtime";
57
+ function ButtonGroup({
58
+ attached = true,
59
+ block = false,
60
+ children,
61
+ className = "",
62
+ classNames,
63
+ separated = false,
64
+ style,
65
+ styles,
66
+ ...props
67
+ }) {
68
+ return /* @__PURE__ */ jsxDEV("div", {
69
+ className: slotClass(classNames, "root", "hj-button-group", attached && "hj-button-group-attached", block && "hj-button-group-block", separated && "hj-button-group-separated", className),
70
+ role: "group",
71
+ style: slotStyle(styles, "root", style),
72
+ ...props,
73
+ children
74
+ }, undefined, false, undefined, this);
75
+ }
76
+ // src/components/EmptyState.tsx
77
+ import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
78
+ function EmptyState({ description, title }) {
79
+ return /* @__PURE__ */ jsxDEV2("div", {
80
+ className: "rounded-[4px] border border-dashed border-[#3b4652] bg-[#111923] p-4 text-center",
81
+ children: [
82
+ /* @__PURE__ */ jsxDEV2("p", {
83
+ className: "text-sm font-semibold text-[#f2f4f6]",
84
+ children: title
85
+ }, undefined, false, undefined, this),
86
+ description ? /* @__PURE__ */ jsxDEV2("p", {
87
+ className: "mt-1.5 text-xs text-[#6f7985]",
88
+ children: description
89
+ }, undefined, false, undefined, this) : null
90
+ ]
91
+ }, undefined, true, undefined, this);
92
+ }
93
+ // src/components/GameCover.tsx
94
+ import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
95
+ function GameCover({ alt = "", className = "", fallback, src }) {
96
+ if (src) {
97
+ return /* @__PURE__ */ jsxDEV3("img", {
98
+ className: `h-full w-full object-cover ${className}`,
99
+ alt,
100
+ src
101
+ }, undefined, false, undefined, this);
102
+ }
103
+ return /* @__PURE__ */ jsxDEV3("div", {
104
+ className: `flex h-full w-full items-center justify-center bg-[#151f29] text-xl font-semibold text-[#6f7985] ${className}`,
105
+ children: fallback
106
+ }, undefined, false, undefined, this);
107
+ }
108
+ // src/components/Icon.tsx
109
+ import { jsxDEV as jsxDEV4, Fragment } from "react/jsx-dev-runtime";
110
+ function Icon({
111
+ className = "",
112
+ classNames,
113
+ name,
114
+ size = 16,
115
+ strokeWidth = 2,
116
+ style,
117
+ styles,
118
+ ...props
119
+ }) {
120
+ return /* @__PURE__ */ jsxDEV4("svg", {
121
+ "aria-hidden": props["aria-label"] ? undefined : true,
122
+ className: slotClass(classNames, "root", "inline-block shrink-0", className),
123
+ fill: "none",
124
+ height: size,
125
+ style: slotStyle(styles, "root", style),
126
+ viewBox: "0 0 24 24",
127
+ width: size,
128
+ ...props,
129
+ children: renderPath(name, strokeWidth)
130
+ }, undefined, false, undefined, this);
131
+ }
132
+ function renderPath(name, strokeWidth) {
133
+ switch (name) {
134
+ case "back":
135
+ return /* @__PURE__ */ jsxDEV4("path", {
136
+ d: "m14.5 6-6 6 6 6",
137
+ stroke: "currentColor",
138
+ strokeLinecap: "round",
139
+ strokeLinejoin: "round",
140
+ strokeWidth
141
+ }, undefined, false, undefined, this);
142
+ case "bars":
143
+ return /* @__PURE__ */ jsxDEV4(Fragment, {
144
+ children: [
145
+ /* @__PURE__ */ jsxDEV4("rect", {
146
+ fill: "currentColor",
147
+ height: "8",
148
+ rx: "1.5",
149
+ width: "4",
150
+ x: "4",
151
+ y: "10"
152
+ }, undefined, false, undefined, this),
153
+ /* @__PURE__ */ jsxDEV4("rect", {
154
+ fill: "currentColor",
155
+ height: "14",
156
+ rx: "1.5",
157
+ width: "4",
158
+ x: "10",
159
+ y: "4"
160
+ }, undefined, false, undefined, this),
161
+ /* @__PURE__ */ jsxDEV4("rect", {
162
+ fill: "currentColor",
163
+ height: "6",
164
+ rx: "1.5",
165
+ width: "4",
166
+ x: "16",
167
+ y: "12"
168
+ }, undefined, false, undefined, this)
169
+ ]
170
+ }, undefined, true, undefined, this);
171
+ case "bell":
172
+ return /* @__PURE__ */ jsxDEV4(Fragment, {
173
+ children: [
174
+ /* @__PURE__ */ jsxDEV4("path", {
175
+ d: "M6.5 10.5c0-3.4 2.1-5.7 5.5-5.7s5.5 2.3 5.5 5.7v3.2l1.5 2H5l1.5-2v-3.2Z",
176
+ stroke: "currentColor",
177
+ strokeLinejoin: "round",
178
+ strokeWidth
179
+ }, undefined, false, undefined, this),
180
+ /* @__PURE__ */ jsxDEV4("path", {
181
+ d: "M9.8 18.2c.45.72 1.18 1.08 2.2 1.08s1.75-.36 2.2-1.08",
182
+ stroke: "currentColor",
183
+ strokeLinecap: "round",
184
+ strokeWidth
185
+ }, undefined, false, undefined, this)
186
+ ]
187
+ }, undefined, true, undefined, this);
188
+ case "calendar":
189
+ return /* @__PURE__ */ jsxDEV4(Fragment, {
190
+ children: [
191
+ /* @__PURE__ */ jsxDEV4("rect", {
192
+ height: "16",
193
+ rx: "3",
194
+ stroke: "currentColor",
195
+ strokeWidth,
196
+ width: "16",
197
+ x: "4",
198
+ y: "5"
199
+ }, undefined, false, undefined, this),
200
+ /* @__PURE__ */ jsxDEV4("path", {
201
+ d: "M8 3.5v4M16 3.5v4M4 10h16",
202
+ stroke: "currentColor",
203
+ strokeLinecap: "round",
204
+ strokeWidth
205
+ }, undefined, false, undefined, this)
206
+ ]
207
+ }, undefined, true, undefined, this);
208
+ case "cart":
209
+ return /* @__PURE__ */ jsxDEV4(Fragment, {
210
+ children: [
211
+ /* @__PURE__ */ jsxDEV4("path", {
212
+ d: "M4 5h2l1.5 9h9.2l2-6.5H7",
213
+ stroke: "currentColor",
214
+ strokeLinecap: "round",
215
+ strokeLinejoin: "round",
216
+ strokeWidth
217
+ }, undefined, false, undefined, this),
218
+ /* @__PURE__ */ jsxDEV4("circle", {
219
+ cx: "9.3",
220
+ cy: "18.5",
221
+ fill: "currentColor",
222
+ r: "1.3"
223
+ }, undefined, false, undefined, this),
224
+ /* @__PURE__ */ jsxDEV4("circle", {
225
+ cx: "16.4",
226
+ cy: "18.5",
227
+ fill: "currentColor",
228
+ r: "1.3"
229
+ }, undefined, false, undefined, this)
230
+ ]
231
+ }, undefined, true, undefined, this);
232
+ case "check":
233
+ return /* @__PURE__ */ jsxDEV4("path", {
234
+ d: "m5 12.5 4.2 4.2L19 7",
235
+ stroke: "currentColor",
236
+ strokeLinecap: "round",
237
+ strokeLinejoin: "round",
238
+ strokeWidth
239
+ }, undefined, false, undefined, this);
240
+ case "chevron-down":
241
+ return /* @__PURE__ */ jsxDEV4("path", {
242
+ d: "m7 10 5 5 5-5",
243
+ stroke: "currentColor",
244
+ strokeLinecap: "round",
245
+ strokeLinejoin: "round",
246
+ strokeWidth
247
+ }, undefined, false, undefined, this);
248
+ case "chevron-right":
249
+ return /* @__PURE__ */ jsxDEV4("path", {
250
+ d: "m10 7 5 5-5 5",
251
+ stroke: "currentColor",
252
+ strokeLinecap: "round",
253
+ strokeLinejoin: "round",
254
+ strokeWidth
255
+ }, undefined, false, undefined, this);
256
+ case "close":
257
+ return /* @__PURE__ */ jsxDEV4("path", {
258
+ d: "m7 7 10 10M17 7 7 17",
259
+ stroke: "currentColor",
260
+ strokeLinecap: "round",
261
+ strokeWidth
262
+ }, undefined, false, undefined, this);
263
+ case "copy":
264
+ return /* @__PURE__ */ jsxDEV4(Fragment, {
265
+ children: [
266
+ /* @__PURE__ */ jsxDEV4("rect", {
267
+ height: "11",
268
+ rx: "2",
269
+ stroke: "currentColor",
270
+ strokeWidth,
271
+ width: "11",
272
+ x: "8",
273
+ y: "5"
274
+ }, undefined, false, undefined, this),
275
+ /* @__PURE__ */ jsxDEV4("path", {
276
+ d: "M5 8v9c0 1.1.9 2 2 2h9",
277
+ stroke: "currentColor",
278
+ strokeLinecap: "round",
279
+ strokeWidth
280
+ }, undefined, false, undefined, this)
281
+ ]
282
+ }, undefined, true, undefined, this);
283
+ case "document":
284
+ return /* @__PURE__ */ jsxDEV4(Fragment, {
285
+ children: [
286
+ /* @__PURE__ */ jsxDEV4("rect", {
287
+ height: "20",
288
+ rx: "4",
289
+ stroke: "currentColor",
290
+ strokeWidth,
291
+ width: "20",
292
+ x: "2",
293
+ y: "2"
294
+ }, undefined, false, undefined, this),
295
+ /* @__PURE__ */ jsxDEV4("path", {
296
+ d: "M8 8h8M8 12h8M8 16h5",
297
+ stroke: "currentColor",
298
+ strokeLinecap: "round",
299
+ strokeWidth
300
+ }, undefined, false, undefined, this)
301
+ ]
302
+ }, undefined, true, undefined, this);
303
+ case "download":
304
+ return /* @__PURE__ */ jsxDEV4(Fragment, {
305
+ children: /* @__PURE__ */ jsxDEV4("path", {
306
+ d: "M12 4v10M8 10l4 4 4-4M5 19h14",
307
+ stroke: "currentColor",
308
+ strokeLinecap: "round",
309
+ strokeLinejoin: "round",
310
+ strokeWidth
311
+ }, undefined, false, undefined, this)
312
+ }, undefined, false, undefined, this);
313
+ case "eye":
314
+ return /* @__PURE__ */ jsxDEV4(Fragment, {
315
+ children: [
316
+ /* @__PURE__ */ jsxDEV4("path", {
317
+ d: "M3.5 12s3-5 8.5-5 8.5 5 8.5 5-3 5-8.5 5-8.5-5-8.5-5Z",
318
+ stroke: "currentColor",
319
+ strokeLinejoin: "round",
320
+ strokeWidth
321
+ }, undefined, false, undefined, this),
322
+ /* @__PURE__ */ jsxDEV4("circle", {
323
+ cx: "12",
324
+ cy: "12",
325
+ r: "2.2",
326
+ stroke: "currentColor",
327
+ strokeWidth
328
+ }, undefined, false, undefined, this)
329
+ ]
330
+ }, undefined, true, undefined, this);
331
+ case "flame":
332
+ return /* @__PURE__ */ jsxDEV4("path", {
333
+ d: "M12.4 21c-3.4 0-6.2-2.3-6.2-5.9 0-2.4 1.4-4.3 3.4-5.9.4 1.8 1.4 2.8 2.6 3.3-.6-3.1.8-5.8 3-7.5.3 2.8 2.6 4.4 2.6 8.1 0 4.6-2.6 7.9-5.4 7.9Z",
334
+ stroke: "currentColor",
335
+ strokeLinejoin: "round",
336
+ strokeWidth
337
+ }, undefined, false, undefined, this);
338
+ case "gamepad":
339
+ return /* @__PURE__ */ jsxDEV4(Fragment, {
340
+ children: [
341
+ /* @__PURE__ */ jsxDEV4("path", {
342
+ d: "M7.1 8.2h9.8c1.73 0 2.8.93 3.18 2.76l.66 3.17c.34 1.62-.53 2.77-1.95 2.77-.84 0-1.39-.34-2.06-1.12l-.83-.98H8.1l-.83.98c-.67.78-1.22 1.12-2.06 1.12-1.42 0-2.29-1.15-1.95-2.77l.66-3.17C4.3 9.13 5.37 8.2 7.1 8.2Z",
343
+ stroke: "currentColor",
344
+ strokeLinejoin: "round",
345
+ strokeWidth
346
+ }, undefined, false, undefined, this),
347
+ /* @__PURE__ */ jsxDEV4("path", {
348
+ d: "M7.1 12.5h3.4M8.8 10.8v3.4",
349
+ stroke: "currentColor",
350
+ strokeLinecap: "round",
351
+ strokeWidth
352
+ }, undefined, false, undefined, this),
353
+ /* @__PURE__ */ jsxDEV4("circle", {
354
+ cx: "15.1",
355
+ cy: "12.5",
356
+ fill: "currentColor",
357
+ r: "1"
358
+ }, undefined, false, undefined, this),
359
+ /* @__PURE__ */ jsxDEV4("circle", {
360
+ cx: "17.7",
361
+ cy: "12.5",
362
+ fill: "currentColor",
363
+ r: "1"
364
+ }, undefined, false, undefined, this)
365
+ ]
366
+ }, undefined, true, undefined, this);
367
+ case "gift":
368
+ return /* @__PURE__ */ jsxDEV4(Fragment, {
369
+ children: [
370
+ /* @__PURE__ */ jsxDEV4("path", {
371
+ d: "M4 10h16v10H4V10ZM3.5 7h17v3h-17V7ZM12 7v13",
372
+ stroke: "currentColor",
373
+ strokeLinejoin: "round",
374
+ strokeWidth
375
+ }, undefined, false, undefined, this),
376
+ /* @__PURE__ */ jsxDEV4("path", {
377
+ d: "M12 7c-2.7 0-4.5-.8-4.5-2.2C7.5 3.8 8.2 3 9.2 3 10.8 3 12 7 12 7Zm0 0c2.7 0 4.5-.8 4.5-2.2 0-1-.7-1.8-1.7-1.8C13.2 3 12 7 12 7Z",
378
+ stroke: "currentColor",
379
+ strokeLinejoin: "round",
380
+ strokeWidth
381
+ }, undefined, false, undefined, this)
382
+ ]
383
+ }, undefined, true, undefined, this);
384
+ case "lock":
385
+ return /* @__PURE__ */ jsxDEV4(Fragment, {
386
+ children: [
387
+ /* @__PURE__ */ jsxDEV4("path", {
388
+ d: "M7.5 10V8.2C7.5 5.65 9.2 4 12 4s4.5 1.65 4.5 4.2V10",
389
+ stroke: "currentColor",
390
+ strokeLinecap: "round",
391
+ strokeWidth
392
+ }, undefined, false, undefined, this),
393
+ /* @__PURE__ */ jsxDEV4("rect", {
394
+ height: "9",
395
+ rx: "2.2",
396
+ stroke: "currentColor",
397
+ strokeWidth,
398
+ width: "15",
399
+ x: "4.5",
400
+ y: "10"
401
+ }, undefined, false, undefined, this)
402
+ ]
403
+ }, undefined, true, undefined, this);
404
+ case "minus":
405
+ return /* @__PURE__ */ jsxDEV4("path", {
406
+ d: "M5 12h14",
407
+ stroke: "currentColor",
408
+ strokeLinecap: "round",
409
+ strokeWidth
410
+ }, undefined, false, undefined, this);
411
+ case "plus":
412
+ return /* @__PURE__ */ jsxDEV4("path", {
413
+ d: "M12 5v14M5 12h14",
414
+ stroke: "currentColor",
415
+ strokeLinecap: "round",
416
+ strokeWidth
417
+ }, undefined, false, undefined, this);
418
+ case "refresh":
419
+ return /* @__PURE__ */ jsxDEV4("path", {
420
+ d: "M18 8.2A6.8 6.8 0 1 0 19 12M18 4v4.2h-4.2",
421
+ stroke: "currentColor",
422
+ strokeLinecap: "round",
423
+ strokeLinejoin: "round",
424
+ strokeWidth
425
+ }, undefined, false, undefined, this);
426
+ case "rocket":
427
+ return /* @__PURE__ */ jsxDEV4(Fragment, {
428
+ children: [
429
+ /* @__PURE__ */ jsxDEV4("path", {
430
+ d: "M13 5.5c2-1.9 4.3-2.4 6.2-2.2.2 1.9-.3 4.2-2.2 6.2l-5.6 5.6-3.9.9.9-3.9L13 5.5Z",
431
+ stroke: "currentColor",
432
+ strokeLinejoin: "round",
433
+ strokeWidth
434
+ }, undefined, false, undefined, this),
435
+ /* @__PURE__ */ jsxDEV4("path", {
436
+ d: "M8 16l-3 3M14.8 6.2l3 3",
437
+ stroke: "currentColor",
438
+ strokeLinecap: "round",
439
+ strokeWidth
440
+ }, undefined, false, undefined, this)
441
+ ]
442
+ }, undefined, true, undefined, this);
443
+ case "search":
444
+ return /* @__PURE__ */ jsxDEV4(Fragment, {
445
+ children: [
446
+ /* @__PURE__ */ jsxDEV4("circle", {
447
+ cx: "11",
448
+ cy: "11",
449
+ r: "6",
450
+ stroke: "currentColor",
451
+ strokeWidth
452
+ }, undefined, false, undefined, this),
453
+ /* @__PURE__ */ jsxDEV4("path", {
454
+ d: "m16 16 4 4",
455
+ stroke: "currentColor",
456
+ strokeLinecap: "round",
457
+ strokeWidth
458
+ }, undefined, false, undefined, this)
459
+ ]
460
+ }, undefined, true, undefined, this);
461
+ case "shield":
462
+ return /* @__PURE__ */ jsxDEV4("path", {
463
+ d: "M12 3.5 18 6v5.2c0 4.2-2.3 7.2-6 9.3-3.7-2.1-6-5.1-6-9.3V6l6-2.5Z",
464
+ stroke: "currentColor",
465
+ strokeLinejoin: "round",
466
+ strokeWidth
467
+ }, undefined, false, undefined, this);
468
+ case "star":
469
+ return /* @__PURE__ */ jsxDEV4("path", {
470
+ d: "m12 3.8 2.35 4.76 5.25.76-3.8 3.7.9 5.23L12 15.78l-4.7 2.47.9-5.23-3.8-3.7 5.25-.76L12 3.8Z",
471
+ stroke: "currentColor",
472
+ strokeLinejoin: "round",
473
+ strokeWidth
474
+ }, undefined, false, undefined, this);
475
+ case "tag":
476
+ return /* @__PURE__ */ jsxDEV4(Fragment, {
477
+ children: [
478
+ /* @__PURE__ */ jsxDEV4("path", {
479
+ d: "M4 5.5V12l7.3 7.3a2.4 2.4 0 0 0 3.4 0l4.6-4.6a2.4 2.4 0 0 0 0-3.4L12 4H5.5A1.5 1.5 0 0 0 4 5.5Z",
480
+ stroke: "currentColor",
481
+ strokeLinejoin: "round",
482
+ strokeWidth
483
+ }, undefined, false, undefined, this),
484
+ /* @__PURE__ */ jsxDEV4("circle", {
485
+ cx: "8",
486
+ cy: "8",
487
+ fill: "currentColor",
488
+ r: "1.2"
489
+ }, undefined, false, undefined, this)
490
+ ]
491
+ }, undefined, true, undefined, this);
492
+ case "thumb-up":
493
+ return /* @__PURE__ */ jsxDEV4(Fragment, {
494
+ children: [
495
+ /* @__PURE__ */ jsxDEV4("path", {
496
+ d: "M8.5 10.5 11.5 4c1.7.4 2.3 1.7 1.8 3.2l-.6 1.8H18c1.4 0 2.3 1.2 2 2.6l-1.1 5.7c-.3 1.4-1.3 2.2-2.7 2.2H8.5v-9Z",
497
+ stroke: "currentColor",
498
+ strokeLinejoin: "round",
499
+ strokeWidth
500
+ }, undefined, false, undefined, this),
501
+ /* @__PURE__ */ jsxDEV4("path", {
502
+ d: "M4 10.5h4.5v9H4z",
503
+ stroke: "currentColor",
504
+ strokeLinejoin: "round",
505
+ strokeWidth
506
+ }, undefined, false, undefined, this)
507
+ ]
508
+ }, undefined, true, undefined, this);
509
+ case "user":
510
+ return /* @__PURE__ */ jsxDEV4(Fragment, {
511
+ children: [
512
+ /* @__PURE__ */ jsxDEV4("path", {
513
+ d: "M7.7 8.4a4.3 4.3 0 1 1 8.6 0 4.3 4.3 0 0 1-8.6 0Z",
514
+ stroke: "currentColor",
515
+ strokeWidth
516
+ }, undefined, false, undefined, this),
517
+ /* @__PURE__ */ jsxDEV4("path", {
518
+ d: "M5 20c.66-3.38 3.2-5.33 7-5.33s6.34 1.95 7 5.33",
519
+ stroke: "currentColor",
520
+ strokeLinecap: "round",
521
+ strokeWidth
522
+ }, undefined, false, undefined, this)
523
+ ]
524
+ }, undefined, true, undefined, this);
525
+ case "warning":
526
+ return /* @__PURE__ */ jsxDEV4(Fragment, {
527
+ children: [
528
+ /* @__PURE__ */ jsxDEV4("circle", {
529
+ cx: "12",
530
+ cy: "12",
531
+ fill: "currentColor",
532
+ r: "10"
533
+ }, undefined, false, undefined, this),
534
+ /* @__PURE__ */ jsxDEV4("path", {
535
+ d: "M12 6.8v6.6",
536
+ stroke: "var(--hj-color-web-surface)",
537
+ strokeLinecap: "round",
538
+ strokeWidth
539
+ }, undefined, false, undefined, this),
540
+ /* @__PURE__ */ jsxDEV4("circle", {
541
+ cx: "12",
542
+ cy: "17",
543
+ fill: "var(--hj-color-web-surface)",
544
+ r: "1.2"
545
+ }, undefined, false, undefined, this)
546
+ ]
547
+ }, undefined, true, undefined, this);
548
+ }
549
+ }
550
+ // src/components/IconButton.tsx
551
+ import { jsxDEV as jsxDEV5 } from "react/jsx-dev-runtime";
552
+ var toneClass = {
553
+ default: "border-[var(--hj-icon-button-default-border)] bg-[var(--hj-icon-button-default-bg)] text-[var(--hj-icon-button-default-fg)] hover:border-[var(--hj-icon-button-default-border-hover)] hover:text-[var(--hj-icon-button-default-fg-hover)]",
554
+ primary: "border-[var(--hj-icon-button-primary-border)] bg-[var(--hj-icon-button-primary-bg)] text-[var(--hj-icon-button-primary-fg)] hover:bg-[var(--hj-icon-button-primary-bg-hover)]",
555
+ ghost: "border-[var(--hj-icon-button-ghost-border)] bg-[var(--hj-icon-button-ghost-bg)] text-[var(--hj-icon-button-ghost-fg)] hover:text-[var(--hj-icon-button-ghost-fg-hover)]",
556
+ selected: "border-[var(--hj-icon-button-selected-border)] bg-[var(--hj-icon-button-selected-bg)] text-[var(--hj-icon-button-selected-fg)]"
557
+ };
558
+ var sizeClass = {
559
+ xs: "h-2 w-2 text-[0px]",
560
+ sm: "h-6 w-6 text-sm",
561
+ md: "h-9 w-9 text-lg"
562
+ };
563
+ function IconButton({
564
+ children,
565
+ className = "",
566
+ classNames,
567
+ size = "sm",
568
+ style,
569
+ styles,
570
+ tone = "default",
571
+ type = "button",
572
+ ...props
573
+ }) {
574
+ return /* @__PURE__ */ jsxDEV5("button", {
575
+ className: slotClass(classNames, "root", "hj-wave inline-flex shrink-0 items-center justify-center rounded-[3px] border font-semibold leading-none transition disabled:cursor-not-allowed disabled:opacity-50", toneClass[tone], sizeClass[size], className),
576
+ style: slotStyle(styles, "root", style),
577
+ type,
578
+ ...props,
579
+ children: /* @__PURE__ */ jsxDEV5("span", {
580
+ className: slotClass(classNames, "content"),
581
+ style: slotStyle(styles, "content"),
582
+ children
583
+ }, undefined, false, undefined, this)
584
+ }, undefined, false, undefined, this);
585
+ }
586
+ // src/ConfigProvider.tsx
587
+ import { createContext, useCallback, useContext, useId, useMemo } from "react";
588
+ import { jsxDEV as jsxDEV6 } from "react/jsx-dev-runtime";
589
+ var Variants = ["outlined", "borderless", "filled", "underlined"];
590
+ var defaultPrefixCls = "hj";
591
+ var defaultIconPrefixCls = "hjicon";
592
+ var defaultGetPrefixCls = (suffixCls, customizePrefixCls) => {
593
+ if (customizePrefixCls)
594
+ return customizePrefixCls;
595
+ return suffixCls ? `${defaultPrefixCls}-${suffixCls}` : defaultPrefixCls;
596
+ };
597
+ var defaultConfig = {
598
+ componentDisabled: false,
599
+ componentSize: "medium",
600
+ components: {},
601
+ disabled: false,
602
+ getPrefixCls: defaultGetPrefixCls,
603
+ iconPrefixCls: defaultIconPrefixCls,
604
+ motion: true,
605
+ prefixCls: defaultPrefixCls,
606
+ rootPrefixCls: defaultPrefixCls,
607
+ size: "md",
608
+ surface: "web"
609
+ };
610
+ var ConfigContext = createContext(defaultConfig);
611
+ var { Consumer: ConfigConsumer } = ConfigContext;
612
+ var globalPrefixCls;
613
+ var globalIconPrefixCls;
614
+ var globalTheme;
615
+ var globalHolderRender;
616
+ function getGlobalPrefixCls() {
617
+ return globalPrefixCls ?? defaultPrefixCls;
618
+ }
619
+ function getGlobalIconPrefixCls() {
620
+ return globalIconPrefixCls ?? defaultIconPrefixCls;
621
+ }
622
+ function setGlobalConfig(props) {
623
+ if (props.prefixCls !== undefined)
624
+ globalPrefixCls = props.prefixCls;
625
+ if (props.iconPrefixCls !== undefined)
626
+ globalIconPrefixCls = props.iconPrefixCls;
627
+ if (Object.prototype.hasOwnProperty.call(props, "holderRender")) {
628
+ globalHolderRender = props.holderRender;
629
+ }
630
+ if (props.theme)
631
+ globalTheme = props.theme;
632
+ }
633
+ function globalConfig() {
634
+ const prefixCls = getGlobalPrefixCls();
635
+ return {
636
+ getIconPrefixCls: getGlobalIconPrefixCls,
637
+ getPrefixCls: (suffixCls, customizePrefixCls) => {
638
+ if (customizePrefixCls)
639
+ return customizePrefixCls;
640
+ return suffixCls ? `${prefixCls}-${suffixCls}` : prefixCls;
641
+ },
642
+ getRootPrefixCls: () => prefixCls,
643
+ getTheme: () => globalTheme,
644
+ holderRender: globalHolderRender
645
+ };
646
+ }
647
+ function isMotionDisabled(motion) {
648
+ return motion === false || typeof motion === "object" && motion.disabled === true;
649
+ }
650
+ function normalizeUiSize(size, fallback = "md") {
651
+ if (size === "small" || size === "sm")
652
+ return "sm";
653
+ if (size === "large" || size === "lg")
654
+ return "lg";
655
+ if (size === "medium" || size === "middle" || size === "md")
656
+ return "md";
657
+ return fallback;
658
+ }
659
+ function normalizeComponentSize(size, fallback) {
660
+ if (size === "small" || size === "sm")
661
+ return "small";
662
+ if (size === "large" || size === "lg")
663
+ return "large";
664
+ if (size === "middle")
665
+ return "middle";
666
+ if (size === "medium" || size === "md")
667
+ return "medium";
668
+ return fallback;
669
+ }
670
+ function isRecord(value) {
671
+ return typeof value === "object" && value !== null && !Array.isArray(value);
672
+ }
673
+ function mergeObjectMap(parent, current) {
674
+ if (!current)
675
+ return parent;
676
+ const merged = {
677
+ ...parent
678
+ };
679
+ for (const [name, value] of Object.entries(current)) {
680
+ const parentValue = merged[name];
681
+ merged[name] = isRecord(parentValue) && isRecord(value) ? { ...parentValue, ...value } : value;
682
+ }
683
+ return merged;
684
+ }
685
+ function normalizeLocale(locale) {
686
+ if (!locale)
687
+ return;
688
+ const defaultLocale = locale.default;
689
+ return isRecord(defaultLocale) && defaultLocale.locale ? defaultLocale : locale;
690
+ }
691
+ function normalizeCssVarConfig(theme2, parentTheme, prefixCls, generatedKey) {
692
+ if (theme2.cssVar === false)
693
+ return false;
694
+ const inherited = parentTheme?.cssVar;
695
+ const effective = theme2.cssVar ?? inherited;
696
+ if (!effective)
697
+ return effective;
698
+ const parentConfig = isRecord(inherited) ? inherited : {};
699
+ const currentConfig = isRecord(theme2.cssVar) ? theme2.cssVar : {};
700
+ return {
701
+ ...parentConfig,
702
+ ...currentConfig,
703
+ key: typeof currentConfig.key === "string" ? currentConfig.key : generatedKey,
704
+ prefix: typeof currentConfig.prefix === "string" ? currentConfig.prefix : typeof parentConfig.prefix === "string" ? parentConfig.prefix : prefixCls
705
+ };
706
+ }
707
+ function mergeTheme(theme2, parentTheme, prefixCls, generatedKey) {
708
+ if (!theme2)
709
+ return parentTheme;
710
+ const inheritedTheme = theme2.inherit === false ? undefined : parentTheme;
711
+ const mergedComponents = mergeObjectMap(inheritedTheme?.components ?? {}, theme2.components);
712
+ const cssVar = normalizeCssVarConfig(theme2, parentTheme, prefixCls, generatedKey);
713
+ return {
714
+ ...inheritedTheme,
715
+ ...theme2,
716
+ components: mergedComponents,
717
+ cssVar,
718
+ hashed: theme2.hashed ?? parentTheme?.hashed,
719
+ token: {
720
+ ...inheritedTheme?.token,
721
+ ...theme2.token
722
+ }
723
+ };
724
+ }
725
+ var tokenCssVariableAliases = {
726
+ borderRadius: ["--hj-radius-md"],
727
+ borderRadiusLG: ["--hj-radius-lg"],
728
+ borderRadiusSM: ["--hj-radius-sm"],
729
+ borderRadiusXS: ["--hj-radius-xs"],
730
+ boxShadowSecondary: ["--hj-shadow-lg"],
731
+ colorBgBase: ["--hj-color-web-page"],
732
+ colorBgContainer: ["--hj-color-web-surface"],
733
+ colorBgElevated: ["--hj-color-web-surface-raised"],
734
+ colorBorder: ["--hj-color-web-border"],
735
+ colorDanger: ["--hj-color-danger"],
736
+ colorError: ["--hj-color-danger"],
737
+ colorForeground: ["--hj-color-web-foreground"],
738
+ colorInfo: ["--hj-color-info"],
739
+ colorMuted: ["--hj-color-web-muted"],
740
+ colorPrimary: ["--hj-color-brand"],
741
+ colorPrimaryActive: ["--hj-color-brand-active"],
742
+ colorPrimaryHover: ["--hj-color-brand-hover"],
743
+ colorSuccess: ["--hj-color-success"],
744
+ colorSurface: ["--hj-color-web-surface"],
745
+ colorSurfaceElevated: ["--hj-color-web-surface-raised"],
746
+ colorText: ["--hj-color-web-foreground"],
747
+ colorTextSecondary: ["--hj-color-web-muted"],
748
+ colorWarning: ["--hj-color-warning"],
749
+ motionDurationMid: ["--hj-motion-duration-normal"],
750
+ shadowPopup: ["--hj-shadow-lg"],
751
+ zDropdown: ["--hj-z-dropdown"],
752
+ zModal: ["--hj-z-modal"],
753
+ zToast: ["--hj-z-toast"]
754
+ };
755
+ function toKebabCase(value) {
756
+ return value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z])([A-Z][a-z])/g, "$1-$2").replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").toLowerCase();
757
+ }
758
+ function formatTokenValue(name, value) {
759
+ if (typeof value !== "number")
760
+ return value;
761
+ if (/duration/i.test(name))
762
+ return `${value}ms`;
763
+ if (/radius/i.test(name) || /(fontSize|width|height|size|padding|margin|gap|offset|inset)$/i.test(name)) {
764
+ return `${value}px`;
765
+ }
766
+ return String(value);
767
+ }
768
+ function createThemeStyle(theme2) {
769
+ if (!theme2)
770
+ return {};
771
+ const style = {};
772
+ const cssVarConfig = isRecord(theme2.cssVar) ? theme2.cssVar : undefined;
773
+ const customPrefix = typeof cssVarConfig?.prefix === "string" ? toKebabCase(cssVarConfig.prefix) : undefined;
774
+ const assignToken = (name, value, namespace) => {
775
+ if (typeof value !== "string" && typeof value !== "number")
776
+ return;
777
+ const kebabName = toKebabCase(name);
778
+ if (!kebabName)
779
+ return;
780
+ const formattedValue = formatTokenValue(name, value);
781
+ const componentPrefix = namespace ? `${toKebabCase(namespace)}-` : "";
782
+ style[`--hj-${componentPrefix}${kebabName}`] = formattedValue;
783
+ if (customPrefix) {
784
+ style[`--${customPrefix}-${componentPrefix}${kebabName}`] = formattedValue;
785
+ }
786
+ if (!namespace) {
787
+ for (const variableName of tokenCssVariableAliases[name] ?? []) {
788
+ style[variableName] = formattedValue;
789
+ }
790
+ }
791
+ };
792
+ for (const [name, value] of Object.entries(theme2.token ?? {})) {
793
+ assignToken(name, value);
794
+ }
795
+ for (const [componentName, componentToken] of Object.entries(theme2.components ?? {})) {
796
+ for (const [name, value] of Object.entries(componentToken)) {
797
+ if (name !== "algorithm")
798
+ assignToken(name, value, componentName);
799
+ }
800
+ }
801
+ return style;
802
+ }
803
+ var InternalConfigProvider = ({
804
+ children,
805
+ className,
806
+ componentDisabled,
807
+ componentSize,
808
+ components,
809
+ direction,
810
+ disabled,
811
+ dropdownMatchSelectWidth,
812
+ getPopupContainer,
813
+ getTargetContainer,
814
+ iconPrefixCls,
815
+ locale,
816
+ motion,
817
+ popupMatchSelectWidth,
818
+ prefixCls,
819
+ renderEmpty,
820
+ size,
821
+ style,
822
+ surface,
823
+ theme: theme2,
824
+ variant,
825
+ virtual
826
+ }) => {
827
+ const parent = useContext(ConfigContext);
828
+ const themeId = useId().replace(/:/g, "");
829
+ const rootPrefixCls = prefixCls ?? parent.getPrefixCls();
830
+ const getPrefixCls = useCallback((suffixCls, customizePrefixCls) => {
831
+ if (customizePrefixCls)
832
+ return customizePrefixCls;
833
+ return suffixCls ? `${rootPrefixCls}-${suffixCls}` : rootPrefixCls;
834
+ }, [rootPrefixCls]);
835
+ const localSize = componentSize ?? size;
836
+ const mergedTheme = useMemo(() => mergeTheme(theme2, parent.theme, rootPrefixCls, `css-var-${themeId}`), [parent.theme, rootPrefixCls, theme2, themeId]);
837
+ const mergedComponents = useMemo(() => mergeObjectMap(parent.components, components), [components, parent.components]);
838
+ const value = useMemo(() => {
839
+ const mergedDisabled = componentDisabled ?? disabled ?? parent.disabled;
840
+ return {
841
+ componentDisabled: mergedDisabled,
842
+ componentSize: normalizeComponentSize(localSize, parent.componentSize),
843
+ components: mergedComponents,
844
+ direction: direction ?? parent.direction,
845
+ disabled: mergedDisabled,
846
+ getPopupContainer: getPopupContainer ?? parent.getPopupContainer,
847
+ getPrefixCls,
848
+ getTargetContainer: getTargetContainer ?? parent.getTargetContainer,
849
+ iconPrefixCls: iconPrefixCls ?? parent.iconPrefixCls,
850
+ locale: normalizeLocale(locale) ?? parent.locale,
851
+ motion: motion ?? parent.motion,
852
+ popupMatchSelectWidth: popupMatchSelectWidth ?? dropdownMatchSelectWidth ?? parent.popupMatchSelectWidth,
853
+ prefixCls: rootPrefixCls,
854
+ renderEmpty: renderEmpty ?? parent.renderEmpty,
855
+ rootPrefixCls,
856
+ size: normalizeUiSize(localSize, parent.size),
857
+ surface: surface ?? parent.surface,
858
+ theme: mergedTheme,
859
+ variant: variant ?? parent.variant,
860
+ virtual: virtual ?? parent.virtual
861
+ };
862
+ }, [
863
+ componentDisabled,
864
+ direction,
865
+ disabled,
866
+ dropdownMatchSelectWidth,
867
+ getPopupContainer,
868
+ getPrefixCls,
869
+ getTargetContainer,
870
+ iconPrefixCls,
871
+ localSize,
872
+ locale,
873
+ mergedComponents,
874
+ mergedTheme,
875
+ motion,
876
+ parent,
877
+ popupMatchSelectWidth,
878
+ renderEmpty,
879
+ rootPrefixCls,
880
+ surface,
881
+ variant,
882
+ virtual
883
+ ]);
884
+ const rootClass = value.surface === "admin" ? "huaijiu-admin-root" : "huaijiu-web-root";
885
+ const cssVarClassName = isRecord(value.theme?.cssVar) && typeof value.theme.cssVar.key === "string" ? value.theme.cssVar.key : undefined;
886
+ const themeStyle = useMemo(() => createThemeStyle(value.theme), [value.theme]);
887
+ return /* @__PURE__ */ jsxDEV6(ConfigContext.Provider, {
888
+ value,
889
+ children: /* @__PURE__ */ jsxDEV6("div", {
890
+ className: cn(rootClass, value.direction === "rtl" && `${value.rootPrefixCls}-rtl`, isMotionDisabled(value.motion) && "huaijiu-motion-disabled", cssVarClassName, className),
891
+ dir: value.direction,
892
+ style: { ...themeStyle, ...style },
893
+ children
894
+ }, undefined, false, undefined, this)
895
+ }, undefined, false, undefined, this);
896
+ };
897
+ function useConfig() {
898
+ return useContext(ConfigContext);
899
+ }
900
+ var ConfigProvider = Object.assign(InternalConfigProvider, {
901
+ ConfigConsumer,
902
+ ConfigContext,
903
+ config: setGlobalConfig,
904
+ useConfig
905
+ });
906
+ ConfigProvider.displayName = "ConfigProvider";
907
+
908
+ // src/components/MenuList.tsx
909
+ import { jsxDEV as jsxDEV7 } from "react/jsx-dev-runtime";
910
+ var rootWidthClass = {
911
+ dropdown: "w-full py-0",
912
+ menu: "w-40 py-2",
913
+ user: "w-[172px] py-2"
914
+ };
915
+ var itemClass = {
916
+ dropdown: "h-[45px] px-4 text-base leading-6",
917
+ menu: "h-10 px-4 text-sm leading-[18px]",
918
+ user: "h-16 px-4"
919
+ };
920
+ function MenuList({
921
+ activeId,
922
+ className = "",
923
+ classNames,
924
+ disabled,
925
+ items,
926
+ onSelect,
927
+ style,
928
+ styles,
929
+ variant
930
+ }) {
931
+ const config = useConfig();
932
+ const mergedVariant = variant ?? config.components.MenuList?.variant ?? "menu";
933
+ const mergedDisabled = disabled || config.disabled || config.components.MenuList?.disabled;
934
+ return /* @__PURE__ */ jsxDEV7("div", {
935
+ className: slotClass(classNames, "root", "overflow-hidden rounded-[var(--hj-radius-md)] border border-[var(--hj-menu-border)] bg-[var(--hj-menu-bg)] shadow-[var(--hj-menu-shadow)]", rootWidthClass[mergedVariant], className),
936
+ "aria-disabled": mergedDisabled || undefined,
937
+ role: "menu",
938
+ style: slotStyle(styles, "root", style),
939
+ children: items.map((item) => {
940
+ const active = item.id === activeId;
941
+ return /* @__PURE__ */ jsxDEV7("button", {
942
+ "aria-current": active || undefined,
943
+ className: slotClass(classNames, "item", "flex w-full items-center gap-3 text-left transition hover:bg-[var(--hj-menu-item-bg-hover)] disabled:cursor-not-allowed disabled:opacity-50", itemClass[mergedVariant], active ? "bg-[var(--hj-menu-item-bg-active)] text-[var(--hj-menu-item-fg-active)]" : "bg-[var(--hj-menu-item-bg)] text-[var(--hj-menu-item-fg)]"),
944
+ disabled: mergedDisabled || item.disabled,
945
+ onClick: () => onSelect?.(item.id),
946
+ role: "menuitem",
947
+ style: slotStyle(styles, "item"),
948
+ type: "button",
949
+ children: [
950
+ item.avatar ? /* @__PURE__ */ jsxDEV7("span", {
951
+ className: slotClass(classNames, "avatar", "flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-full bg-[var(--hj-menu-avatar-bg)] text-[var(--hj-menu-avatar-fg)]"),
952
+ style: slotStyle(styles, "avatar"),
953
+ children: item.avatar
954
+ }, undefined, false, undefined, this) : null,
955
+ /* @__PURE__ */ jsxDEV7("span", {
956
+ className: slotClass(classNames, "content", "min-w-0 flex-1"),
957
+ style: slotStyle(styles, "content"),
958
+ children: [
959
+ /* @__PURE__ */ jsxDEV7("span", {
960
+ className: slotClass(classNames, "label", "block truncate", active ? "font-semibold" : "font-normal", mergedVariant === "dropdown" ? "text-base leading-6" : "text-sm leading-[18px]", active ? "text-[var(--hj-menu-item-fg-active)]" : mergedVariant === "user" ? "text-[var(--hj-menu-item-fg-active)]" : "text-[var(--hj-menu-item-fg)]"),
961
+ style: slotStyle(styles, "label"),
962
+ children: item.label
963
+ }, undefined, false, undefined, this),
964
+ item.description ? /* @__PURE__ */ jsxDEV7("span", {
965
+ className: slotClass(classNames, "description", "mt-[5px] block truncate text-xs leading-4 text-[var(--hj-menu-item-muted)]"),
966
+ style: slotStyle(styles, "description"),
967
+ children: item.description
968
+ }, undefined, false, undefined, this) : null
969
+ ]
970
+ }, undefined, true, undefined, this),
971
+ item.suffix ? /* @__PURE__ */ jsxDEV7("span", {
972
+ className: slotClass(classNames, "suffix", "shrink-0 text-[var(--hj-input-clear)]"),
973
+ style: slotStyle(styles, "suffix"),
974
+ children: item.suffix
975
+ }, undefined, false, undefined, this) : null
976
+ ]
977
+ }, item.id, true, undefined, this);
978
+ })
979
+ }, undefined, false, undefined, this);
980
+ }
981
+ // src/components/MessageToast.tsx
982
+ import CSSMotion from "@rc-component/motion";
983
+
984
+ // src/hooks/useReducedMotion.ts
985
+ import { useEffect, useState } from "react";
986
+ function useReducedMotion() {
987
+ const [reduced, setReduced] = useState(false);
988
+ useEffect(() => {
989
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function")
990
+ return;
991
+ const query = window.matchMedia("(prefers-reduced-motion: reduce)");
992
+ const update = () => setReduced(query.matches);
993
+ update();
994
+ query.addEventListener("change", update);
995
+ return () => query.removeEventListener("change", update);
996
+ }, []);
997
+ return reduced;
998
+ }
999
+
1000
+ // src/components/MessageToast.tsx
1001
+ import { jsxDEV as jsxDEV8 } from "react/jsx-dev-runtime";
1002
+ var iconClass = {
1003
+ success: "bg-[var(--hj-message-success)]",
1004
+ warning: "bg-[var(--hj-message-warning)]",
1005
+ error: "bg-[var(--hj-message-error)]",
1006
+ info: "bg-[var(--hj-message-info)]",
1007
+ loading: "bg-[var(--hj-message-info)]"
1008
+ };
1009
+ var defaultIcon = {
1010
+ success: "✓",
1011
+ warning: "!",
1012
+ error: "×",
1013
+ info: "i",
1014
+ loading: "…"
1015
+ };
1016
+ function MessageToast({
1017
+ action,
1018
+ children,
1019
+ className = "",
1020
+ classNames,
1021
+ closable = false,
1022
+ closeIcon,
1023
+ icon,
1024
+ onClose,
1025
+ open = true,
1026
+ role = "status",
1027
+ showIcon,
1028
+ styles,
1029
+ type = "info",
1030
+ variant
1031
+ }) {
1032
+ const config = useConfig();
1033
+ const reducedMotion = useReducedMotion();
1034
+ const mergedShowIcon = showIcon ?? config.components.MessageToast?.showIcon ?? true;
1035
+ const mergedVariant = variant ?? config.components.MessageToast?.variant ?? "dark";
1036
+ const motionDisabled = reducedMotion || isMotionDisabled(config.motion);
1037
+ return /* @__PURE__ */ jsxDEV8(CSSMotion, {
1038
+ motionAppear: true,
1039
+ motionDeadline: motionDisabled ? 1 : 300,
1040
+ motionName: motionDisabled ? undefined : "hj-slide-up",
1041
+ removeOnLeave: true,
1042
+ visible: open,
1043
+ children: ({ className: motionClassName, style: motionStyle }, ref) => /* @__PURE__ */ jsxDEV8("div", {
1044
+ className: slotClass(classNames, "root", "inline-flex min-h-[var(--hj-message-height)] max-w-full items-center gap-[var(--hj-message-gap)] rounded-[var(--hj-message-radius)] px-[var(--hj-message-padding-x)] text-sm leading-[18px] shadow-[var(--hj-message-shadow)]", mergedVariant === "dark" ? "bg-[var(--hj-message-bg)] text-[var(--hj-message-fg)]" : "bg-[var(--hj-message-light-bg)] text-[var(--hj-message-light-fg)]", motionDisabled && "huaijiu-motion-disabled", motionClassName, className),
1045
+ ref,
1046
+ role,
1047
+ style: { ...slotStyle(styles, "root"), ...motionStyle },
1048
+ children: [
1049
+ mergedShowIcon && icon !== null ? /* @__PURE__ */ jsxDEV8("span", {
1050
+ className: slotClass(classNames, "icon", "flex h-[var(--hj-message-icon-size)] w-[var(--hj-message-icon-size)] shrink-0 items-center justify-center rounded-full text-xs font-bold leading-none text-white", iconClass[type]),
1051
+ style: slotStyle(styles, "icon"),
1052
+ children: icon ?? defaultIcon[type]
1053
+ }, undefined, false, undefined, this) : null,
1054
+ /* @__PURE__ */ jsxDEV8("span", {
1055
+ className: slotClass(classNames, "content", "min-w-0 break-words"),
1056
+ style: slotStyle(styles, "content"),
1057
+ children
1058
+ }, undefined, false, undefined, this),
1059
+ action ? /* @__PURE__ */ jsxDEV8("span", {
1060
+ className: slotClass(classNames, "action", "ml-1 whitespace-nowrap text-[var(--hj-message-action-fg)]"),
1061
+ style: slotStyle(styles, "action"),
1062
+ children: action
1063
+ }, undefined, false, undefined, this) : null,
1064
+ closable ? /* @__PURE__ */ jsxDEV8("button", {
1065
+ "aria-label": "关闭",
1066
+ className: slotClass(classNames, "close", "ml-1 inline-flex h-4 w-4 shrink-0 items-center justify-center text-[var(--hj-message-close-fg)] transition hover:text-[var(--hj-message-close-fg-hover)]"),
1067
+ onClick: onClose,
1068
+ style: slotStyle(styles, "close"),
1069
+ type: "button",
1070
+ children: closeIcon ?? "×"
1071
+ }, undefined, false, undefined, this) : null
1072
+ ]
1073
+ }, undefined, true, undefined, this)
1074
+ }, undefined, false, undefined, this);
1075
+ }
1076
+ // src/components/Panel.tsx
1077
+ import { jsxDEV as jsxDEV9 } from "react/jsx-dev-runtime";
1078
+ var radiusClass = { sm: "rounded-[6px]", md: "rounded-[8px]" };
1079
+ function Panel({
1080
+ as: Component = "section",
1081
+ children,
1082
+ className = "",
1083
+ radius = "md",
1084
+ ...props
1085
+ }) {
1086
+ return /* @__PURE__ */ jsxDEV9(Component, {
1087
+ className: `${radiusClass[radius]} bg-[#242731] ${className}`,
1088
+ ...props,
1089
+ children
1090
+ }, undefined, false, undefined, this);
1091
+ }
1092
+ // src/components/PriceText.tsx
1093
+ import { jsxDEV as jsxDEV10 } from "react/jsx-dev-runtime";
1094
+ function PriceText({
1095
+ className,
1096
+ freeClassName,
1097
+ freeLabel = "免费",
1098
+ originalPrice,
1099
+ price
1100
+ }) {
1101
+ const priceClassName = className ?? "text-base";
1102
+ const numericPrice = Number(price);
1103
+ if (numericPrice === 0) {
1104
+ return /* @__PURE__ */ jsxDEV10("span", {
1105
+ className: `${priceClassName} ${freeClassName ?? "font-semibold text-[#69c04a]"}`,
1106
+ children: freeLabel
1107
+ }, undefined, false, undefined, this);
1108
+ }
1109
+ return /* @__PURE__ */ jsxDEV10("span", {
1110
+ className: "inline-flex items-baseline gap-2",
1111
+ children: [
1112
+ originalPrice && originalPrice !== price ? /* @__PURE__ */ jsxDEV10("span", {
1113
+ className: "text-xs text-[#6f7985] line-through",
1114
+ children: [
1115
+ "¥",
1116
+ originalPrice
1117
+ ]
1118
+ }, undefined, true, undefined, this) : null,
1119
+ /* @__PURE__ */ jsxDEV10("span", {
1120
+ className: `${priceClassName} font-semibold text-[#ffcc33]`,
1121
+ children: [
1122
+ "¥",
1123
+ price
1124
+ ]
1125
+ }, undefined, true, undefined, this)
1126
+ ]
1127
+ }, undefined, true, undefined, this);
1128
+ }
1129
+ // src/components/ProgressBar.tsx
1130
+ import { jsxDEV as jsxDEV11 } from "react/jsx-dev-runtime";
1131
+ var toneClass2 = {
1132
+ primary: "bg-[#ffcc33]",
1133
+ success: "bg-[#69c04a]",
1134
+ achievement: ""
1135
+ };
1136
+ function ProgressBar({
1137
+ className = "",
1138
+ max = 100,
1139
+ tone = "primary",
1140
+ value
1141
+ }) {
1142
+ const width = `${Math.round(value / Math.max(max, 1) * 100)}%`;
1143
+ const achievementGradient = "linear-gradient(90deg, #ffa50e 0%, #ff5f0b 100%)";
1144
+ const trackColor = tone === "achievement" ? "rgba(255, 255, 255, 0.2)" : "#24303a";
1145
+ return /* @__PURE__ */ jsxDEV11("div", {
1146
+ className: `h-1.5 overflow-hidden rounded ${tone === "achievement" ? "bg-white/20" : "bg-[#24303a]"} ${className}`,
1147
+ style: { backgroundColor: trackColor, flexShrink: 0, height: "6px", minHeight: "6px" },
1148
+ children: /* @__PURE__ */ jsxDEV11("div", {
1149
+ className: `h-full rounded ${toneClass2[tone]}`,
1150
+ style: {
1151
+ height: "100%",
1152
+ width,
1153
+ ...tone === "achievement" ? { backgroundImage: achievementGradient } : {}
1154
+ }
1155
+ }, undefined, false, undefined, this)
1156
+ }, undefined, false, undefined, this);
1157
+ }
1158
+ // src/components/Button.tsx
1159
+ import { forwardRef, useEffect as useEffect2, useMemo as useMemo2, useState as useState2 } from "react";
1160
+ import { jsxDEV as jsxDEV12, Fragment as Fragment2 } from "react/jsx-dev-runtime";
1161
+ var solidToneClass = {
1162
+ primary: "bg-[var(--hj-button-primary-bg)] text-[var(--hj-button-primary-fg)] hover:bg-[var(--hj-button-primary-bg-hover)] active:bg-[var(--hj-button-primary-bg-active)] active:text-[var(--hj-button-primary-fg-active)]",
1163
+ default: "bg-[var(--hj-button-default-bg)] text-[var(--hj-button-default-fg)] hover:bg-[var(--hj-button-default-bg-hover)] hover:text-[var(--hj-button-default-fg-hover)] active:bg-[var(--hj-button-default-bg-active)] active:text-[var(--hj-button-default-fg-hover)]",
1164
+ secondary: "bg-[var(--hj-button-default-bg)] text-[var(--hj-button-default-fg)] hover:bg-[var(--hj-button-default-bg-hover)] hover:text-[var(--hj-button-default-fg-hover)] active:bg-[var(--hj-button-default-bg-active)] active:text-[var(--hj-button-default-fg-hover)]",
1165
+ ghost: "bg-transparent text-white/60 hover:bg-white/5 hover:text-white",
1166
+ danger: "bg-[var(--hj-color-danger)] text-white hover:bg-[var(--hj-color-danger-soft)]",
1167
+ success: "bg-[var(--hj-color-success)] text-white hover:brightness-110",
1168
+ info: "bg-[var(--hj-color-info)] text-white hover:brightness-110",
1169
+ light: "bg-[var(--hj-button-light-bg)] text-[var(--hj-button-light-fg)] shadow-[inset_0_0_0_1px_var(--hj-button-light-border)] hover:bg-[var(--hj-button-light-bg-hover)] hover:shadow-[inset_0_0_0_1px_var(--hj-button-light-border-hover)] active:bg-[var(--hj-button-light-bg-active)]",
1170
+ purchase: "bg-[var(--hj-color-purchase)] text-white hover:brightness-110",
1171
+ download: "bg-[var(--hj-button-primary-bg)] text-[var(--hj-button-primary-fg)] hover:bg-[var(--hj-button-primary-bg-hover)] active:bg-[var(--hj-button-primary-bg-active)] active:text-[var(--hj-button-primary-fg-active)]"
1172
+ };
1173
+ var sizeClass2 = {
1174
+ xs: "h-[var(--hj-button-xs-height)] min-w-[var(--hj-button-xs-min-width)] rounded-[var(--hj-radius-sm)] px-[var(--hj-button-xs-padding-x)] text-[length:var(--hj-button-xs-font-size)] leading-[var(--hj-button-xs-line-height)]",
1175
+ sm: "h-[var(--hj-button-sm-height)] min-w-[var(--hj-button-sm-min-width)] rounded-[var(--hj-radius-sm)] px-[var(--hj-button-sm-padding-x)] text-[length:var(--hj-button-sm-font-size)] leading-[var(--hj-button-sm-line-height)]",
1176
+ md: "h-[var(--hj-button-md-height)] min-w-[var(--hj-button-md-min-width)] rounded-[var(--hj-radius-md)] px-[var(--hj-button-md-padding-x)] text-[length:var(--hj-button-md-font-size)] leading-[var(--hj-button-md-line-height)]",
1177
+ lg: "h-[var(--hj-button-lg-height)] min-w-[var(--hj-button-lg-min-width)] rounded-[var(--hj-radius-md)] px-[var(--hj-button-lg-padding-x)] text-[length:var(--hj-button-lg-font-size)] leading-[var(--hj-button-lg-line-height)]"
1178
+ };
1179
+ var iconTextPaddingVariable = {
1180
+ xs: "var(--hj-button-xs-icon-padding-x)",
1181
+ sm: "var(--hj-button-sm-icon-padding-x)",
1182
+ md: "var(--hj-button-md-icon-padding-x)",
1183
+ lg: "var(--hj-button-lg-icon-padding-x)"
1184
+ };
1185
+ var narrowWidthClass = {
1186
+ xs: "w-[var(--hj-button-xs-narrow-width)] min-w-[var(--hj-button-xs-narrow-width)] px-0",
1187
+ sm: "w-[var(--hj-button-sm-narrow-width)] min-w-[var(--hj-button-sm-narrow-width)] px-0",
1188
+ md: "w-[var(--hj-button-md-min-width)] min-w-[var(--hj-button-md-min-width)]",
1189
+ lg: "w-[var(--hj-button-lg-min-width)] min-w-[var(--hj-button-lg-min-width)]"
1190
+ };
1191
+ var autoWidthClass = "w-auto min-w-0";
1192
+ var iconSizeClass = {
1193
+ xs: "h-[var(--hj-button-xs-height)] w-[var(--hj-button-xs-height)] min-w-[var(--hj-button-xs-height)] rounded-[var(--hj-radius-sm)] p-0 text-[length:var(--hj-button-xs-font-size)] leading-[var(--hj-button-xs-line-height)]",
1194
+ sm: "h-[var(--hj-button-sm-height)] w-[var(--hj-button-sm-height)] min-w-[var(--hj-button-sm-height)] rounded-[var(--hj-radius-sm)] p-0 text-[length:var(--hj-button-sm-font-size)] leading-[var(--hj-button-sm-line-height)]",
1195
+ md: "h-[var(--hj-button-md-height)] w-[var(--hj-button-md-height)] min-w-[var(--hj-button-md-height)] rounded-[var(--hj-radius-md)] p-0 text-[length:var(--hj-button-md-font-size)] leading-[var(--hj-button-md-line-height)]",
1196
+ lg: "h-[var(--hj-button-lg-height)] w-[var(--hj-button-lg-height)] min-w-[var(--hj-button-lg-height)] rounded-[var(--hj-radius-md)] p-0 text-[length:var(--hj-button-lg-font-size)] leading-[var(--hj-button-lg-line-height)]"
1197
+ };
1198
+ var circleSizeClass = {
1199
+ xs: "h-[var(--hj-button-xs-height)] w-[var(--hj-button-xs-height)] min-w-[var(--hj-button-xs-height)] rounded-full px-0",
1200
+ sm: "h-[var(--hj-button-sm-height)] w-[var(--hj-button-sm-height)] min-w-[var(--hj-button-sm-height)] rounded-full px-0",
1201
+ md: "h-[var(--hj-button-md-height)] w-[var(--hj-button-md-height)] min-w-[var(--hj-button-md-height)] rounded-full px-0",
1202
+ lg: "h-[var(--hj-button-lg-height)] w-[var(--hj-button-lg-height)] min-w-[var(--hj-button-lg-height)] rounded-full px-0"
1203
+ };
1204
+ var textSizeClass = "h-5 min-w-0 rounded-none p-0 text-[length:var(--hj-button-md-font-size)] leading-[var(--hj-button-md-line-height)]";
1205
+ function normalizeButtonSize(size, fallback) {
1206
+ if (size === "small" || size === "sm")
1207
+ return "sm";
1208
+ if (size === "large" || size === "lg")
1209
+ return "lg";
1210
+ if (size === "medium" || size === "middle" || size === "md")
1211
+ return "md";
1212
+ return size ?? fallback;
1213
+ }
1214
+ var statusClass = {
1215
+ default: {
1216
+ primary: "",
1217
+ default: "",
1218
+ toggle: "",
1219
+ text: ""
1220
+ },
1221
+ hover: {
1222
+ primary: "bg-[var(--hj-button-primary-bg-hover)] text-[var(--hj-button-primary-fg-active)]",
1223
+ default: "bg-[var(--hj-button-default-bg-hover)] text-[var(--hj-button-default-fg-hover)]",
1224
+ toggle: "bg-[var(--hj-button-toggle-bg-hover)] text-[var(--hj-button-primary-bg)]",
1225
+ text: "text-[var(--hj-button-primary-bg)] brightness-110"
1226
+ },
1227
+ active: {
1228
+ primary: "bg-[var(--hj-button-primary-bg-active)] text-[var(--hj-button-primary-fg-active)]",
1229
+ default: "bg-[var(--hj-button-default-bg-active)] text-[var(--hj-button-default-fg-hover)]",
1230
+ toggle: "bg-[var(--hj-button-toggle-bg-active)] text-[var(--hj-button-primary-fg-active)]",
1231
+ text: "text-[var(--hj-button-text-fg)] brightness-50"
1232
+ }
1233
+ };
1234
+ function resolveVariantClass(tone, variant) {
1235
+ if ((variant === "text" || variant === "link") && (tone === "default" || tone === "secondary"))
1236
+ return "bg-transparent text-[var(--hj-button-text-default-fg)] hover:text-[var(--hj-button-text-fg)] active:brightness-50";
1237
+ if (variant === "text" || variant === "link")
1238
+ return "bg-transparent text-[var(--hj-button-text-fg)] hover:brightness-110 active:brightness-50";
1239
+ if (variant === "outlined" || variant === "dashed") {
1240
+ const toneClass3 = tone === "danger" ? "text-[var(--hj-color-danger)]" : tone === "success" ? "text-[var(--hj-color-success)]" : tone === "info" ? "text-[var(--hj-color-info)]" : tone === "purchase" ? "text-[var(--hj-color-purchase)]" : tone === "primary" || tone === "download" ? "text-[var(--hj-color-brand)]" : "text-[var(--hj-button-default-fg)]";
1241
+ return cn("border border-current bg-transparent hover:bg-[var(--hj-button-default-bg-hover)]", variant === "dashed" && "border-dashed", toneClass3);
1242
+ }
1243
+ if (variant === "translucent" || variant === "filled")
1244
+ return "bg-[var(--hj-button-translucent-bg)] text-[var(--hj-button-default-fg)] hover:bg-[var(--hj-button-translucent-bg-hover)] hover:text-[var(--hj-button-default-fg-hover)] active:bg-[var(--hj-button-translucent-bg-active)] active:text-[var(--hj-button-default-fg-hover)]";
1245
+ if (variant === "toggle")
1246
+ return "border border-[var(--hj-button-toggle-border)] bg-[var(--hj-button-toggle-bg)] text-[var(--hj-color-brand-weak)] hover:bg-[var(--hj-button-toggle-bg-hover)] active:bg-[var(--hj-button-toggle-bg-active)]";
1247
+ if (variant === "icon" || variant === "solid")
1248
+ return solidToneClass[tone];
1249
+ if (variant === "secondary" || tone === "secondary" || tone === "default")
1250
+ return solidToneClass.secondary;
1251
+ return solidToneClass[tone];
1252
+ }
1253
+ function resolveStatusClass(tone, variant, status) {
1254
+ if (status === "default")
1255
+ return "";
1256
+ if (variant === "text" || variant === "link")
1257
+ return statusClass[status].text;
1258
+ if (variant === "translucent" || variant === "filled") {
1259
+ if (status === "hover")
1260
+ return "bg-[var(--hj-button-translucent-bg-hover)] text-[var(--hj-button-default-fg-hover)]";
1261
+ return "bg-[var(--hj-button-translucent-bg-active)] text-[var(--hj-button-default-fg-hover)]";
1262
+ }
1263
+ if (variant === "toggle")
1264
+ return statusClass[status].toggle;
1265
+ if (variant === "secondary" || variant === "outlined" || variant === "dashed" || tone === "secondary" || tone === "default" || tone === "light")
1266
+ return statusClass[status].default;
1267
+ return statusClass[status].primary;
1268
+ }
1269
+ function resolveDisabledOpacity(tone, variant) {
1270
+ if (variant === "toggle")
1271
+ return "disabled:opacity-50";
1272
+ if (variant === "secondary" || variant === "outlined" || variant === "dashed" || tone === "secondary" || tone === "default" || tone === "light")
1273
+ return "disabled:opacity-40";
1274
+ return "disabled:opacity-50";
1275
+ }
1276
+ function resolveAntdTone({
1277
+ color,
1278
+ danger,
1279
+ ghost,
1280
+ tone,
1281
+ type
1282
+ }) {
1283
+ if (tone)
1284
+ return tone;
1285
+ if (danger || color === "danger" || color === "red" || color === "pink" || color === "magenta" || color === "volcano")
1286
+ return "danger";
1287
+ if (color === "success" || color === "green" || color === "lime")
1288
+ return "success";
1289
+ if (color === "info" || color === "blue" || color === "cyan" || color === "geekblue" || color === "purple")
1290
+ return "info";
1291
+ if (color === "purchase" || color === "orange" || color === "yellow" || color === "gold")
1292
+ return "purchase";
1293
+ if (color === "download")
1294
+ return "download";
1295
+ if (ghost)
1296
+ return "ghost";
1297
+ if (type === "primary" || color === "primary")
1298
+ return "primary";
1299
+ if (type === "link" || type === "text")
1300
+ return "ghost";
1301
+ return "secondary";
1302
+ }
1303
+ function resolveAntdVariant({
1304
+ ghost,
1305
+ tone,
1306
+ type,
1307
+ variant
1308
+ }) {
1309
+ if (variant)
1310
+ return variant;
1311
+ if (type === "text" || ghost || tone === "ghost")
1312
+ return "text";
1313
+ if (type === "link")
1314
+ return "link";
1315
+ if (type === "dashed")
1316
+ return "dashed";
1317
+ if (tone === "secondary" || tone === "default")
1318
+ return "outlined";
1319
+ return "solid";
1320
+ }
1321
+ function getLoadingDelay(loading) {
1322
+ if (typeof loading === "object")
1323
+ return Math.max(0, loading.delay ?? 0);
1324
+ return 0;
1325
+ }
1326
+ var Button = forwardRef(function Button2({
1327
+ autoInsertSpace,
1328
+ block = false,
1329
+ children,
1330
+ className = "",
1331
+ classNames,
1332
+ color,
1333
+ danger,
1334
+ disabled,
1335
+ ghost,
1336
+ href,
1337
+ htmlType = "button",
1338
+ icon,
1339
+ iconPlacement,
1340
+ iconPosition = "start",
1341
+ loading = false,
1342
+ onClick,
1343
+ rootClassName,
1344
+ shape = "default",
1345
+ size,
1346
+ style,
1347
+ styles,
1348
+ status = "default",
1349
+ tone,
1350
+ type,
1351
+ variant,
1352
+ width = "default",
1353
+ ...props
1354
+ }, ref) {
1355
+ const config = useConfig();
1356
+ const mergedSize = normalizeButtonSize(size ?? config.components.Button?.size, config.size);
1357
+ const delay = useMemo2(() => getLoadingDelay(loading), [loading]);
1358
+ const [delayedLoading, setDelayedLoading] = useState2(typeof loading === "boolean" ? loading : delay <= 0 && Boolean(loading));
1359
+ useEffect2(() => {
1360
+ if (!loading) {
1361
+ setDelayedLoading(false);
1362
+ return;
1363
+ }
1364
+ if (delay <= 0) {
1365
+ setDelayedLoading(true);
1366
+ return;
1367
+ }
1368
+ const timer = window.setTimeout(() => setDelayedLoading(true), delay);
1369
+ return () => window.clearTimeout(timer);
1370
+ }, [delay, loading]);
1371
+ const mergedTone = resolveAntdTone({ color, danger, ghost, tone, type });
1372
+ const mergedDisabled = disabled || delayedLoading || config.disabled || config.components.Button?.disabled;
1373
+ const mergedVariant = resolveAntdVariant({ ghost, tone: mergedTone, type, variant });
1374
+ const isTextVariant = mergedVariant === "text" || mergedVariant === "link";
1375
+ const mergedSizeClass = mergedVariant === "icon" ? iconSizeClass[mergedSize] : isTextVariant ? textSizeClass : sizeClass2[mergedSize];
1376
+ const fontStyle = mergedTone === "light" ? {
1377
+ fontFamily: "var(--hj-button-light-font-family)",
1378
+ fontWeight: "var(--hj-button-light-font-weight)"
1379
+ } : { fontFamily: "var(--hj-button-font-family)" };
1380
+ const mergedIconPosition = iconPlacement ?? iconPosition;
1381
+ const loadingIcon = typeof loading === "object" ? loading.icon : undefined;
1382
+ const iconNode = delayedLoading ? /* @__PURE__ */ jsxDEV12("span", {
1383
+ "aria-hidden": "true",
1384
+ className: slotClass(classNames, "loadingIcon", "h-3.5 w-3.5 animate-spin rounded-full border-2 border-current border-t-transparent motion-reduce:animate-none"),
1385
+ style: slotStyle(styles, "loadingIcon"),
1386
+ children: loadingIcon
1387
+ }, undefined, false, undefined, this) : icon ? /* @__PURE__ */ jsxDEV12("span", {
1388
+ className: slotClass(classNames, "icon", "inline-flex shrink-0 items-center justify-center"),
1389
+ style: slotStyle(styles, "icon"),
1390
+ children: icon
1391
+ }, undefined, false, undefined, this) : null;
1392
+ const hasTextIcon = Boolean(iconNode && children != null && mergedVariant !== "icon" && !isTextVariant);
1393
+ const iconTextPaddingStyle = hasTextIcon ? { paddingInline: iconTextPaddingVariable[mergedSize] } : undefined;
1394
+ const rootClass = slotClass(classNames, "root", "hj-wave inline-flex cursor-pointer select-none items-center justify-center gap-1.5 border-0 font-[var(--hj-button-font-weight)] transition disabled:cursor-not-allowed", block && "w-full", mergedSizeClass, shape === "round" && "rounded-full", shape === "circle" && circleSizeClass[mergedSize], shape === "square" && children == null && iconSizeClass[mergedSize], width === "narrow" && mergedVariant !== "icon" && !isTextVariant && narrowWidthClass[mergedSize], width === "auto" && mergedVariant !== "icon" && !isTextVariant && autoWidthClass, resolveVariantClass(mergedTone, mergedVariant), resolveStatusClass(mergedTone, mergedVariant, status), resolveDisabledOpacity(mergedTone, mergedVariant), rootClassName, className);
1395
+ const rootStyle = {
1396
+ ...fontStyle,
1397
+ ...iconTextPaddingStyle,
1398
+ ...slotStyle(styles, "root", style)
1399
+ };
1400
+ const content = /* @__PURE__ */ jsxDEV12(Fragment2, {
1401
+ children: [
1402
+ mergedIconPosition === "start" ? iconNode : null,
1403
+ children == null ? null : /* @__PURE__ */ jsxDEV12("span", {
1404
+ className: cn("relative overflow-visible whitespace-nowrap", autoInsertSpace && "tracking-normal", classNames?.content),
1405
+ style: styles?.content,
1406
+ children
1407
+ }, undefined, false, undefined, this),
1408
+ mergedIconPosition === "end" ? iconNode : null
1409
+ ]
1410
+ }, undefined, true, undefined, this);
1411
+ const handleClick = (event) => {
1412
+ if (mergedDisabled) {
1413
+ event.preventDefault();
1414
+ event.stopPropagation();
1415
+ return;
1416
+ }
1417
+ onClick?.(event);
1418
+ };
1419
+ if (href !== undefined) {
1420
+ return /* @__PURE__ */ jsxDEV12("a", {
1421
+ ...props,
1422
+ "aria-busy": delayedLoading || undefined,
1423
+ "aria-disabled": mergedDisabled || undefined,
1424
+ className: rootClass,
1425
+ href: mergedDisabled ? undefined : href,
1426
+ onClick: handleClick,
1427
+ ref,
1428
+ style: rootStyle,
1429
+ children: content
1430
+ }, undefined, false, undefined, this);
1431
+ }
1432
+ return /* @__PURE__ */ jsxDEV12("button", {
1433
+ ...props,
1434
+ "aria-busy": delayedLoading || undefined,
1435
+ className: rootClass,
1436
+ disabled: mergedDisabled,
1437
+ onClick: handleClick,
1438
+ ref,
1439
+ style: rootStyle,
1440
+ type: htmlType,
1441
+ children: content
1442
+ }, undefined, false, undefined, this);
1443
+ });
1444
+
1445
+ // src/components/ProgressButton.tsx
1446
+ import { jsxDEV as jsxDEV13 } from "react/jsx-dev-runtime";
1447
+ function ProgressButton({
1448
+ className = "",
1449
+ disabled,
1450
+ label,
1451
+ max = 100,
1452
+ tone = "download",
1453
+ value,
1454
+ ...props
1455
+ }) {
1456
+ const normalizedMax = Number.isFinite(max) && max > 0 ? max : 100;
1457
+ const normalizedValue = value == null || !Number.isFinite(value) ? null : Math.max(0, Math.min(normalizedMax, value));
1458
+ const width = normalizedValue == null ? "100%" : `${normalizedValue / normalizedMax * 100}%`;
1459
+ return /* @__PURE__ */ jsxDEV13(Button, {
1460
+ ...props,
1461
+ className: `relative overflow-hidden ${className}`,
1462
+ disabled,
1463
+ tone,
1464
+ children: [
1465
+ /* @__PURE__ */ jsxDEV13("span", {
1466
+ "aria-label": label,
1467
+ "aria-valuemax": normalizedMax,
1468
+ "aria-valuemin": 0,
1469
+ "aria-valuenow": normalizedValue ?? undefined,
1470
+ className: `absolute inset-y-0 left-0 bg-[#d6a84a]/30 ${normalizedValue == null ? "animate-pulse motion-reduce:animate-none" : ""}`,
1471
+ role: "progressbar",
1472
+ style: { width }
1473
+ }, undefined, false, undefined, this),
1474
+ /* @__PURE__ */ jsxDEV13("span", {
1475
+ className: "relative",
1476
+ children: label
1477
+ }, undefined, false, undefined, this)
1478
+ ]
1479
+ }, undefined, true, undefined, this);
1480
+ }
1481
+ // src/components/Typography.tsx
1482
+ import { TextArea as RcTextArea } from "@rc-component/input";
1483
+ import ResizeObserver from "@rc-component/resize-observer";
1484
+ import {
1485
+ composeRef,
1486
+ toArray,
1487
+ useControlledState as useControlledState2,
1488
+ useEvent,
1489
+ useLayoutEffect
1490
+ } from "@rc-component/util";
1491
+ import {
1492
+ createElement,
1493
+ forwardRef as forwardRef3,
1494
+ isValidElement as isValidElement2,
1495
+ useEffect as useEffect3,
1496
+ useImperativeHandle,
1497
+ useMemo as useMemo4,
1498
+ useRef,
1499
+ useState as useState3
1500
+ } from "react";
1501
+
1502
+ // src/components/Tooltip.tsx
1503
+ import RcTooltip from "@rc-component/tooltip";
1504
+ import { useControlledState } from "@rc-component/util";
1505
+ import { Fragment as Fragment3, cloneElement, forwardRef as forwardRef2, isValidElement, useMemo as useMemo3 } from "react";
1506
+ import { jsxDEV as jsxDEV14 } from "react/jsx-dev-runtime";
1507
+ function getTooltipChild(children, className) {
1508
+ if (isValidElement(children) && children.type !== Fragment3) {
1509
+ if (!className)
1510
+ return children;
1511
+ return cloneElement(children, { className: cn(children.props.className, className) });
1512
+ }
1513
+ return /* @__PURE__ */ jsxDEV14("span", {
1514
+ className,
1515
+ children
1516
+ }, undefined, false, undefined, this);
1517
+ }
1518
+ function getTooltipPlacements(pointAtCenter, autoAdjustOverflow) {
1519
+ const overflow = autoAdjustOverflow === false ? { adjustX: 0, adjustY: 0 } : {
1520
+ adjustX: typeof autoAdjustOverflow === "object" ? autoAdjustOverflow.adjustX ?? 1 : 1,
1521
+ adjustY: typeof autoAdjustOverflow === "object" ? autoAdjustOverflow.adjustY ?? 1 : 1
1522
+ };
1523
+ const cornerOffset = 12;
1524
+ return {
1525
+ top: { points: ["bc", "tc"], offset: [0, -8], overflow },
1526
+ bottom: { points: ["tc", "bc"], offset: [0, 8], overflow },
1527
+ left: { points: ["cr", "cl"], offset: [-8, 0], overflow },
1528
+ right: { points: ["cl", "cr"], offset: [8, 0], overflow },
1529
+ topLeft: pointAtCenter ? { points: ["bl", "tc"], offset: [-cornerOffset, -8], overflow, autoArrow: false } : { points: ["bl", "tl"], offset: [0, -8], overflow, autoArrow: false },
1530
+ topRight: pointAtCenter ? { points: ["br", "tc"], offset: [cornerOffset, -8], overflow, autoArrow: false } : { points: ["br", "tr"], offset: [0, -8], overflow, autoArrow: false },
1531
+ bottomLeft: pointAtCenter ? { points: ["tl", "bc"], offset: [-cornerOffset, 8], overflow, autoArrow: false } : { points: ["tl", "bl"], offset: [0, 8], overflow, autoArrow: false },
1532
+ bottomRight: pointAtCenter ? { points: ["tr", "bc"], offset: [cornerOffset, 8], overflow, autoArrow: false } : { points: ["tr", "br"], offset: [0, 8], overflow, autoArrow: false },
1533
+ leftTop: pointAtCenter ? { points: ["tr", "cl"], offset: [-8, -cornerOffset], overflow, autoArrow: false } : { points: ["tr", "tl"], offset: [-8, 0], overflow, autoArrow: false },
1534
+ leftBottom: pointAtCenter ? { points: ["br", "cl"], offset: [-8, cornerOffset], overflow, autoArrow: false } : { points: ["br", "bl"], offset: [-8, 0], overflow, autoArrow: false },
1535
+ rightTop: pointAtCenter ? { points: ["tl", "cr"], offset: [8, -cornerOffset], overflow, autoArrow: false } : { points: ["tl", "tr"], offset: [8, 0], overflow, autoArrow: false },
1536
+ rightBottom: pointAtCenter ? { points: ["bl", "cr"], offset: [8, cornerOffset], overflow, autoArrow: false } : { points: ["bl", "br"], offset: [8, 0], overflow, autoArrow: false }
1537
+ };
1538
+ }
1539
+ var Tooltip = forwardRef2(function Tooltip2({
1540
+ afterOpenChange,
1541
+ afterVisibleChange,
1542
+ align,
1543
+ arrow,
1544
+ autoAdjustOverflow = true,
1545
+ builtinPlacements,
1546
+ children,
1547
+ className = "",
1548
+ classNames,
1549
+ color,
1550
+ defaultOpen,
1551
+ defaultVisible,
1552
+ disabled,
1553
+ destroyOnHidden,
1554
+ destroyTooltipOnHide,
1555
+ forceRender,
1556
+ fresh,
1557
+ getPopupContainer,
1558
+ getTooltipContainer,
1559
+ id,
1560
+ maxWidth,
1561
+ motion,
1562
+ mouseEnterDelay = 0.1,
1563
+ mouseLeaveDelay = 0.1,
1564
+ onOpenChange,
1565
+ onPopupAlign,
1566
+ onVisibleChange,
1567
+ open,
1568
+ openClassName,
1569
+ overlay,
1570
+ overlayClassName,
1571
+ overlayInnerStyle,
1572
+ overlayStyle,
1573
+ placement,
1574
+ rootClassName,
1575
+ style,
1576
+ styles,
1577
+ title,
1578
+ trigger,
1579
+ unique,
1580
+ variant,
1581
+ visible,
1582
+ zIndex
1583
+ }, ref) {
1584
+ const config = useConfig();
1585
+ const motionDisabled = isMotionDisabled(config.motion);
1586
+ const mergedArrow = arrow ?? config.components.Tooltip?.arrow ?? true;
1587
+ const mergedDisabled = disabled || config.disabled || config.components.Tooltip?.disabled;
1588
+ const mergedPlacement = placement ?? config.components.Tooltip?.placement ?? "top";
1589
+ const mergedTrigger = trigger ?? config.components.Tooltip?.trigger ?? "hover";
1590
+ const mergedVariant = variant ?? config.components.Tooltip?.variant ?? "dark";
1591
+ const mergedTitle = title ?? overlay;
1592
+ const [mergedOpen, setMergedOpen] = useControlledState(defaultOpen ?? defaultVisible ?? false, open ?? visible);
1593
+ const noTitle = !mergedTitle && mergedTitle !== 0;
1594
+ const popupVisible = mergedDisabled || noTitle ? false : mergedOpen;
1595
+ const pointAtCenter = typeof mergedArrow === "object" && mergedArrow.pointAtCenter === true;
1596
+ const placements = useMemo3(() => builtinPlacements ?? getTooltipPlacements(pointAtCenter, autoAdjustOverflow), [autoAdjustOverflow, builtinPlacements, pointAtCenter]);
1597
+ const triggerNode = getTooltipChild(children, cn(slotClass(classNames, "trigger"), popupVisible && openClassName));
1598
+ const popupStyle = slotStyle(styles, "root", slotStyle(styles, "popup", {
1599
+ ...maxWidth == null ? undefined : { maxWidth, whiteSpace: "normal" },
1600
+ ...color ? { "--hj-tooltip-color": color, backgroundColor: color } : undefined,
1601
+ ...overlayStyle,
1602
+ ...style
1603
+ }));
1604
+ const popupClassName = cn("hj-tooltip-root", `hj-tooltip-${mergedVariant}`, pointAtCenter && "hj-tooltip-arrow-center", className, overlayClassName, rootClassName, classNames?.root, classNames?.popup);
1605
+ const rcTrigger = typeof mergedTrigger === "string" ? mergedTrigger : [...mergedTrigger];
1606
+ return /* @__PURE__ */ jsxDEV14(RcTooltip, {
1607
+ afterVisibleChange: (nextOpen) => {
1608
+ afterOpenChange?.(nextOpen);
1609
+ afterVisibleChange?.(nextOpen);
1610
+ },
1611
+ align,
1612
+ builtinPlacements: placements,
1613
+ classNames: {
1614
+ root: popupClassName,
1615
+ arrow: slotClass(classNames, "arrow", "hj-tooltip-arrow-inner"),
1616
+ container: slotClass(classNames, "content", "hj-tooltip-container-inner")
1617
+ },
1618
+ destroyOnHidden: destroyOnHidden ?? (typeof destroyTooltipOnHide === "object" ? true : destroyTooltipOnHide),
1619
+ forceRender,
1620
+ fresh,
1621
+ getTooltipContainer: getPopupContainer ?? getTooltipContainer ?? (config.getPopupContainer ? () => config.getPopupContainer?.() ?? document.body : undefined),
1622
+ id,
1623
+ mouseEnterDelay,
1624
+ mouseLeaveDelay,
1625
+ motion: motionDisabled ? undefined : motion ?? { motionName: "hj-zoom" },
1626
+ onPopupAlign,
1627
+ overlay: mergedTitle,
1628
+ placement: mergedPlacement,
1629
+ prefixCls: "hj-tooltip",
1630
+ ref,
1631
+ showArrow: typeof mergedArrow === "object" ? true : mergedArrow,
1632
+ styles: {
1633
+ root: popupStyle,
1634
+ arrow: slotStyle(styles, "arrow"),
1635
+ container: slotStyle(styles, "content", overlayInnerStyle)
1636
+ },
1637
+ trigger: rcTrigger,
1638
+ unique,
1639
+ visible: popupVisible,
1640
+ zIndex,
1641
+ onVisibleChange: (nextOpen) => {
1642
+ if (mergedDisabled || noTitle)
1643
+ return;
1644
+ setMergedOpen(nextOpen);
1645
+ onOpenChange?.(nextOpen);
1646
+ onVisibleChange?.(nextOpen);
1647
+ },
1648
+ children: triggerNode
1649
+ }, undefined, false, undefined, this);
1650
+ });
1651
+ Tooltip.displayName = "Tooltip";
1652
+
1653
+ // src/components/Typography.tsx
1654
+ import { jsxDEV as jsxDEV15, Fragment as Fragment4 } from "react/jsx-dev-runtime";
1655
+ var titleClass = {
1656
+ page: "text-[32px] font-bold leading-[38px] tracking-normal text-white",
1657
+ section: "text-sm font-semibold text-[#f2f4f6]",
1658
+ card: "text-[13px] font-semibold text-[#f2f4f6]"
1659
+ };
1660
+ var titleLevelClass = {
1661
+ 1: "text-[32px] font-semibold leading-[1.25] text-[var(--hj-color-web-foreground)]",
1662
+ 2: "text-2xl font-semibold leading-[1.3] text-[var(--hj-color-web-foreground)]",
1663
+ 3: "text-xl font-semibold leading-[1.35] text-[var(--hj-color-web-foreground)]",
1664
+ 4: "text-base font-semibold leading-[1.4] text-[var(--hj-color-web-foreground)]",
1665
+ 5: "text-sm font-semibold leading-[1.45] text-[var(--hj-color-web-foreground)]"
1666
+ };
1667
+ var textClass = {
1668
+ body: "text-sm text-[#a5adb8]",
1669
+ muted: "text-xs text-[#8b94a0]",
1670
+ action: "text-xs font-normal leading-none text-[#8b94a0] hover:text-[#d6a84a]"
1671
+ };
1672
+ var typeClass = {
1673
+ secondary: "text-[var(--hj-color-web-muted)]",
1674
+ success: "text-[var(--hj-color-success)]",
1675
+ warning: "text-[var(--hj-color-warning)]",
1676
+ danger: "text-[var(--hj-color-danger)]"
1677
+ };
1678
+ var EMPTY_COPY_CONFIG = {};
1679
+ var EMPTY_EDIT_CONFIG = {};
1680
+ var EMPTY_ELLIPSIS_CONFIG = {};
1681
+ var ELLIPSIS_TEXT = "...";
1682
+ function decorateContent(props, content) {
1683
+ let result = content;
1684
+ if (props.mark)
1685
+ result = /* @__PURE__ */ jsxDEV15("mark", {
1686
+ children: result
1687
+ }, undefined, false, undefined, this);
1688
+ if (props.code)
1689
+ result = /* @__PURE__ */ jsxDEV15("code", {
1690
+ children: result
1691
+ }, undefined, false, undefined, this);
1692
+ if (props.keyboard)
1693
+ result = /* @__PURE__ */ jsxDEV15("kbd", {
1694
+ children: result
1695
+ }, undefined, false, undefined, this);
1696
+ if (props.underline)
1697
+ result = /* @__PURE__ */ jsxDEV15("u", {
1698
+ children: result
1699
+ }, undefined, false, undefined, this);
1700
+ if (props.delete)
1701
+ result = /* @__PURE__ */ jsxDEV15("del", {
1702
+ children: result
1703
+ }, undefined, false, undefined, this);
1704
+ if (props.strong)
1705
+ result = /* @__PURE__ */ jsxDEV15("strong", {
1706
+ children: result
1707
+ }, undefined, false, undefined, this);
1708
+ if (props.italic)
1709
+ result = /* @__PURE__ */ jsxDEV15("i", {
1710
+ children: result
1711
+ }, undefined, false, undefined, this);
1712
+ return result;
1713
+ }
1714
+ function getNodeText(node) {
1715
+ if (typeof node === "string" || typeof node === "number" || typeof node === "bigint") {
1716
+ return String(node);
1717
+ }
1718
+ if (Array.isArray(node))
1719
+ return node.map(getNodeText).join("");
1720
+ if (isValidElement2(node)) {
1721
+ return getNodeText(node.props.children);
1722
+ }
1723
+ return "";
1724
+ }
1725
+ function legacyCopy(text, format) {
1726
+ const holder = document.createElement("textarea");
1727
+ holder.value = text;
1728
+ holder.setAttribute("readonly", "");
1729
+ holder.style.position = "fixed";
1730
+ holder.style.insetInlineStart = "-9999px";
1731
+ holder.style.opacity = "0";
1732
+ const handleCopy = (event) => {
1733
+ event.clipboardData?.setData(format, text);
1734
+ event.preventDefault();
1735
+ };
1736
+ document.addEventListener("copy", handleCopy);
1737
+ document.body.appendChild(holder);
1738
+ holder.select();
1739
+ let copied = false;
1740
+ try {
1741
+ if (typeof document.execCommand !== "function")
1742
+ throw new Error("Clipboard is unavailable");
1743
+ copied = document.execCommand("copy");
1744
+ } finally {
1745
+ holder.remove();
1746
+ document.removeEventListener("copy", handleCopy);
1747
+ }
1748
+ if (!copied)
1749
+ throw new Error("Unable to copy text to the clipboard");
1750
+ }
1751
+ async function copyText(text, format = "text/plain") {
1752
+ if (typeof navigator !== "undefined" && navigator.clipboard) {
1753
+ try {
1754
+ if (format === "text/html" && typeof ClipboardItem !== "undefined" && typeof navigator.clipboard.write === "function") {
1755
+ const item = new ClipboardItem({
1756
+ [format]: new Blob([text], { type: format })
1757
+ });
1758
+ await navigator.clipboard.write([item]);
1759
+ return;
1760
+ }
1761
+ if (typeof navigator.clipboard.writeText === "function") {
1762
+ await navigator.clipboard.writeText(text);
1763
+ return;
1764
+ }
1765
+ } catch {}
1766
+ }
1767
+ if (typeof document === "undefined")
1768
+ throw new Error("Clipboard is unavailable");
1769
+ legacyCopy(text, format);
1770
+ }
1771
+ function toConfigList(value) {
1772
+ if (value === false)
1773
+ return [false, false];
1774
+ return Array.isArray(value) ? value : [value];
1775
+ }
1776
+ function getConfigNode(value, fallback, alwaysRender = false) {
1777
+ if (value === true || value === undefined)
1778
+ return fallback;
1779
+ return value || (alwaysRender ? fallback : value);
1780
+ }
1781
+ function EditableTypography({
1782
+ ariaLabel,
1783
+ className,
1784
+ component,
1785
+ config,
1786
+ disabled,
1787
+ onCancel,
1788
+ onSave,
1789
+ style,
1790
+ value
1791
+ }) {
1792
+ const inputRef = useRef(null);
1793
+ const composingRef = useRef(false);
1794
+ const lastKeyCodeRef = useRef(null);
1795
+ const [current, setCurrent] = useState3(value);
1796
+ useEffect3(() => setCurrent(value), [value]);
1797
+ useLayoutEffect(() => {
1798
+ const textArea = inputRef.current?.resizableTextArea.textArea;
1799
+ if (!textArea)
1800
+ return;
1801
+ textArea.focus();
1802
+ textArea.setSelectionRange(textArea.value.length, textArea.value.length);
1803
+ }, []);
1804
+ const confirmChange = useEvent(() => onSave(current.trim()));
1805
+ const handleChange = (event) => {
1806
+ setCurrent(event.target.value.replace(/[\n\r]/g, ""));
1807
+ };
1808
+ const handleKeyDown = (event) => {
1809
+ if (!composingRef.current)
1810
+ lastKeyCodeRef.current = event.keyCode;
1811
+ };
1812
+ const handleKeyUp = (event) => {
1813
+ if (composingRef.current || lastKeyCodeRef.current !== event.keyCode || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
1814
+ return;
1815
+ }
1816
+ if (event.key === "Enter" || event.keyCode === 13) {
1817
+ confirmChange();
1818
+ config.onEnd?.();
1819
+ } else if (event.key === "Escape" || event.keyCode === 27) {
1820
+ onCancel();
1821
+ }
1822
+ };
1823
+ const handleBlur = () => confirmChange();
1824
+ const enterIcon = config.enterIcon === undefined ? /* @__PURE__ */ jsxDEV15(Icon, {
1825
+ "aria-hidden": "true",
1826
+ name: "check",
1827
+ size: 14
1828
+ }, undefined, false, undefined, this) : config.enterIcon;
1829
+ return /* @__PURE__ */ jsxDEV15("div", {
1830
+ className: cn("hj-typography hj-typography-edit-content relative inline-flex w-full min-w-0 items-start", `hj-typography-${component}`, className),
1831
+ style,
1832
+ children: [
1833
+ /* @__PURE__ */ jsxDEV15(RcTextArea, {
1834
+ "aria-label": ariaLabel,
1835
+ autoSize: config.autoSize ?? true,
1836
+ className: "hj-typography-edit-input min-w-0 flex-1 rounded-[var(--hj-input-radius)] border border-[var(--hj-input-border-active)] bg-[var(--hj-input-bg)] text-[var(--hj-input-fg)]",
1837
+ classNames: {
1838
+ affixWrapper: "hj-typography-edit-input min-w-0 flex-1 rounded-[var(--hj-input-radius)] border border-[var(--hj-input-border-active)] bg-[var(--hj-input-bg)]",
1839
+ textarea: cn("hj-typography-edit-textarea block min-h-8 w-full resize-none bg-transparent px-3 py-2 font-[inherit] leading-[inherit] text-[var(--hj-input-fg)] outline-none", enterIcon !== null && "pr-8")
1840
+ },
1841
+ disabled,
1842
+ maxLength: config.maxLength,
1843
+ prefixCls: "hj-typography-edit",
1844
+ ref: inputRef,
1845
+ rows: 1,
1846
+ value: current,
1847
+ onBlur: handleBlur,
1848
+ onChange: handleChange,
1849
+ onCompositionEnd: () => {
1850
+ composingRef.current = false;
1851
+ },
1852
+ onCompositionStart: () => {
1853
+ composingRef.current = true;
1854
+ },
1855
+ onKeyDown: handleKeyDown,
1856
+ onKeyUp: handleKeyUp
1857
+ }, undefined, false, undefined, this),
1858
+ enterIcon !== null ? /* @__PURE__ */ jsxDEV15("span", {
1859
+ "aria-hidden": "true",
1860
+ className: "hj-typography-edit-content-confirm pointer-events-none absolute right-2 top-2 inline-flex text-[var(--hj-color-brand)]",
1861
+ children: enterIcon
1862
+ }, undefined, false, undefined, this) : null
1863
+ ]
1864
+ }, undefined, true, undefined, this);
1865
+ }
1866
+ var MeasureText = forwardRef3(function MeasureText2({ children, style }, ref) {
1867
+ const elementRef = useRef(null);
1868
+ useImperativeHandle(ref, () => ({
1869
+ getHeight: () => {
1870
+ const element = elementRef.current;
1871
+ return element ? element.getBoundingClientRect().height || element.clientHeight : 0;
1872
+ },
1873
+ isExceed: () => {
1874
+ const element = elementRef.current;
1875
+ return element ? element.scrollHeight > element.clientHeight : false;
1876
+ }
1877
+ }));
1878
+ return /* @__PURE__ */ jsxDEV15("span", {
1879
+ "aria-hidden": "true",
1880
+ ref: elementRef,
1881
+ style: {
1882
+ background: "transparent",
1883
+ insetInlineStart: 0,
1884
+ pointerEvents: "none",
1885
+ position: "fixed",
1886
+ top: 0,
1887
+ visibility: "hidden",
1888
+ zIndex: -1,
1889
+ ...style
1890
+ },
1891
+ children
1892
+ }, undefined, false, undefined, this);
1893
+ });
1894
+ function getNodesLength(nodes) {
1895
+ return nodes.reduce((length, node) => length + (typeof node === "string" || typeof node === "number" ? String(node).length : 1), 0);
1896
+ }
1897
+ function sliceNodes(nodes, length) {
1898
+ let currentLength = 0;
1899
+ const result = [];
1900
+ for (const node of nodes) {
1901
+ if (currentLength === length)
1902
+ break;
1903
+ const canSlice = typeof node === "string" || typeof node === "number";
1904
+ const nodeLength = canSlice ? String(node).length : 1;
1905
+ const nextLength = currentLength + nodeLength;
1906
+ if (nextLength > length) {
1907
+ result.push(String(node).slice(0, length - currentLength));
1908
+ break;
1909
+ }
1910
+ result.push(node);
1911
+ currentLength = nextLength;
1912
+ }
1913
+ return result;
1914
+ }
1915
+ var lineClampStyle = {
1916
+ WebkitBoxOrient: "vertical",
1917
+ display: "-webkit-box",
1918
+ overflow: "hidden"
1919
+ };
1920
+ function EllipsisMeasure({
1921
+ enable,
1922
+ expanded,
1923
+ measureKey,
1924
+ onEllipsis,
1925
+ renderContent,
1926
+ rows,
1927
+ text,
1928
+ width
1929
+ }) {
1930
+ const render = useEvent(renderContent);
1931
+ const triggerEllipsis = useEvent(onEllipsis);
1932
+ const nodes = useMemo4(() => toArray(text), [text]);
1933
+ const nodeLength = useMemo4(() => getNodesLength(nodes), [nodes]);
1934
+ const cutMeasureRef = useRef(null);
1935
+ const overflowMeasureRef = useRef(null);
1936
+ const previousRowsMeasureRef = useRef(null);
1937
+ const operationMeasureRef = useRef(null);
1938
+ const whiteSpaceMeasureRef = useRef(null);
1939
+ const [status, setStatus] = useState3("none");
1940
+ const [cutRange, setCutRange] = useState3(null);
1941
+ const [canEllipsis, setCanEllipsis] = useState3(false);
1942
+ const [ellipsisHeight, setEllipsisHeight] = useState3(0);
1943
+ const [parentWhiteSpace, setParentWhiteSpace] = useState3(null);
1944
+ useLayoutEffect(() => {
1945
+ if (enable && width > 0 && nodeLength > 0) {
1946
+ setStatus("prepare");
1947
+ } else {
1948
+ setStatus("none");
1949
+ setCutRange(null);
1950
+ setCanEllipsis(false);
1951
+ }
1952
+ }, [enable, measureKey, nodeLength, rows, text, width]);
1953
+ useLayoutEffect(() => {
1954
+ if (status === "prepare") {
1955
+ setParentWhiteSpace(whiteSpaceMeasureRef.current ? getComputedStyle(whiteSpaceMeasureRef.current).whiteSpace : null);
1956
+ setStatus("start");
1957
+ return;
1958
+ }
1959
+ if (status !== "start")
1960
+ return;
1961
+ const overflowing = overflowMeasureRef.current?.isExceed() ?? false;
1962
+ const baseHeight = overflowMeasureRef.current?.getHeight() ?? 0;
1963
+ const previousRowsHeight = rows === 1 ? 0 : previousRowsMeasureRef.current?.getHeight() ?? 0;
1964
+ const operationHeight = operationMeasureRef.current?.getHeight() ?? 0;
1965
+ setCanEllipsis(overflowing);
1966
+ setCutRange(overflowing ? [0, nodeLength] : null);
1967
+ setEllipsisHeight(Math.max(baseHeight, previousRowsHeight + operationHeight) + 1);
1968
+ setStatus(overflowing ? "need" : "not-needed");
1969
+ triggerEllipsis(overflowing);
1970
+ }, [nodeLength, rows, status, triggerEllipsis]);
1971
+ const cutMiddle = cutRange ? Math.ceil((cutRange[0] + cutRange[1]) / 2) : 0;
1972
+ useLayoutEffect(() => {
1973
+ if (!cutRange || cutRange[0] === cutRange[1])
1974
+ return;
1975
+ const [minimum, maximum] = cutRange;
1976
+ const overflowing = (cutMeasureRef.current?.getHeight() ?? 0) > ellipsisHeight;
1977
+ let target = cutMiddle;
1978
+ if (maximum - minimum === 1)
1979
+ target = overflowing ? minimum : maximum;
1980
+ setCutRange(overflowing ? [minimum, target] : [target, maximum]);
1981
+ }, [cutMiddle, cutRange, ellipsisHeight]);
1982
+ const fullContent = render(nodes, false);
1983
+ let visibleContent;
1984
+ if (!enable || status === "none" || status === "not-needed") {
1985
+ visibleContent = fullContent;
1986
+ } else if (status !== "need" || !cutRange || cutRange[0] !== cutRange[1]) {
1987
+ visibleContent = /* @__PURE__ */ jsxDEV15("span", {
1988
+ style: { ...lineClampStyle, WebkitLineClamp: rows },
1989
+ children: fullContent
1990
+ }, undefined, false, undefined, this);
1991
+ } else {
1992
+ visibleContent = render(expanded ? nodes : sliceNodes(nodes, cutRange[0]), canEllipsis);
1993
+ }
1994
+ const measureStyle = {
1995
+ margin: 0,
1996
+ padding: 0,
1997
+ whiteSpace: parentWhiteSpace === "nowrap" ? "normal" : "inherit",
1998
+ width
1999
+ };
2000
+ return /* @__PURE__ */ jsxDEV15(Fragment4, {
2001
+ children: [
2002
+ visibleContent,
2003
+ status === "start" ? /* @__PURE__ */ jsxDEV15(Fragment4, {
2004
+ children: [
2005
+ /* @__PURE__ */ jsxDEV15(MeasureText, {
2006
+ ref: overflowMeasureRef,
2007
+ style: { ...measureStyle, ...lineClampStyle, WebkitLineClamp: rows },
2008
+ children: fullContent
2009
+ }, undefined, false, undefined, this),
2010
+ /* @__PURE__ */ jsxDEV15(MeasureText, {
2011
+ ref: previousRowsMeasureRef,
2012
+ style: { ...measureStyle, ...lineClampStyle, WebkitLineClamp: rows - 1 },
2013
+ children: fullContent
2014
+ }, undefined, false, undefined, this),
2015
+ /* @__PURE__ */ jsxDEV15(MeasureText, {
2016
+ ref: operationMeasureRef,
2017
+ style: { ...measureStyle, ...lineClampStyle, WebkitLineClamp: 1 },
2018
+ children: render([], true)
2019
+ }, undefined, false, undefined, this)
2020
+ ]
2021
+ }, undefined, true, undefined, this) : null,
2022
+ status === "need" && cutRange && cutRange[0] !== cutRange[1] ? /* @__PURE__ */ jsxDEV15(MeasureText, {
2023
+ ref: cutMeasureRef,
2024
+ style: { ...measureStyle, top: 400 },
2025
+ children: render(sliceNodes(nodes, cutMiddle), true)
2026
+ }, undefined, false, undefined, this) : null,
2027
+ status === "prepare" ? /* @__PURE__ */ jsxDEV15("span", {
2028
+ ref: whiteSpaceMeasureRef,
2029
+ style: { whiteSpace: "inherit" }
2030
+ }, undefined, false, undefined, this) : null
2031
+ ]
2032
+ }, undefined, true, undefined, this);
2033
+ }
2034
+ function isPlainObject(value) {
2035
+ if (!value || typeof value !== "object" || Array.isArray(value) || isValidElement2(value)) {
2036
+ return false;
2037
+ }
2038
+ const prototype = Object.getPrototypeOf(value);
2039
+ return prototype === Object.prototype || prototype === null;
2040
+ }
2041
+ function getEllipsisTooltipProps(tooltip, editText, children) {
2042
+ if (tooltip === true)
2043
+ return { title: editText ?? children };
2044
+ if (isValidElement2(tooltip))
2045
+ return { title: tooltip };
2046
+ if (isPlainObject(tooltip)) {
2047
+ return {
2048
+ title: editText ?? children,
2049
+ ...tooltip
2050
+ };
2051
+ }
2052
+ return { title: tooltip };
2053
+ }
2054
+ function isElementEllipsized(element, rows) {
2055
+ return rows === 1 ? element.scrollWidth > element.clientWidth : element.scrollHeight > element.clientHeight;
2056
+ }
2057
+ function TypographyBase({
2058
+ actions,
2059
+ children,
2060
+ className,
2061
+ code,
2062
+ copyable = false,
2063
+ delete: deleted,
2064
+ disabled = false,
2065
+ editable = false,
2066
+ ellipsis,
2067
+ italic,
2068
+ keyboard,
2069
+ mark,
2070
+ rootClassName,
2071
+ strong,
2072
+ style,
2073
+ type,
2074
+ underline,
2075
+ component,
2076
+ onClick,
2077
+ "aria-label": ariaLabel,
2078
+ ...props
2079
+ }) {
2080
+ const typographyRef = useRef(null);
2081
+ const editButtonRef = useRef(null);
2082
+ const copyTimerRef = useRef(null);
2083
+ const enableCopy = Boolean(copyable);
2084
+ const enableEdit = Boolean(editable);
2085
+ const enableEllipsis = Boolean(ellipsis);
2086
+ const copyConfig = typeof copyable === "object" ? copyable : EMPTY_COPY_CONFIG;
2087
+ const editConfig = typeof editable === "object" ? editable : EMPTY_EDIT_CONFIG;
2088
+ const ellipsisConfig = typeof ellipsis === "object" ? ellipsis : EMPTY_ELLIPSIS_CONFIG;
2089
+ const triggerType = editConfig.triggerType ?? ["icon"];
2090
+ const placement = actions?.placement ?? "end";
2091
+ const [editing, setEditing] = useControlledState2(false, editConfig.editing);
2092
+ const [expanded, setExpanded] = useControlledState2(ellipsisConfig.defaultExpanded ?? false, ellipsisConfig.expanded);
2093
+ const [copied, setCopied] = useState3(false);
2094
+ const [copyLoading, setCopyLoading] = useState3(false);
2095
+ const [ellipsisWidth, setEllipsisWidth] = useState3(0);
2096
+ const [isJsEllipsis, setIsJsEllipsis] = useState3(false);
2097
+ const [isNativeEllipsis, setIsNativeEllipsis] = useState3(false);
2098
+ const previousEditingRef = useRef(editing);
2099
+ const rows = Math.max(1, Math.floor(ellipsisConfig.rows ?? 1));
2100
+ const mergedEnableEllipsis = enableEllipsis && (!expanded || ellipsisConfig.expandable === "collapsible");
2101
+ const needMeasureEllipsis = mergedEnableEllipsis && (ellipsisConfig.suffix !== undefined || Boolean(ellipsisConfig.onEllipsis) || Boolean(ellipsisConfig.expandable) || enableEdit || enableCopy);
2102
+ const cssEllipsis = mergedEnableEllipsis && !needMeasureEllipsis;
2103
+ const tooltipProps = getEllipsisTooltipProps(ellipsisConfig.tooltip, editConfig.text, children);
2104
+ const { title: ellipsisTooltipTitle, ...ellipsisTooltipRest } = tooltipProps;
2105
+ const hasEllipsisTooltip = ellipsisTooltipTitle !== undefined && ellipsisTooltipTitle !== false;
2106
+ const isMergedEllipsis = mergedEnableEllipsis ? cssEllipsis ? hasEllipsisTooltip && isNativeEllipsis : isJsEllipsis : false;
2107
+ const measureKey = useMemo4(() => ({
2108
+ code,
2109
+ copied,
2110
+ copyIcon: copyConfig.icon,
2111
+ copyLoading,
2112
+ deleted,
2113
+ editIcon: editConfig.icon,
2114
+ enableCopy,
2115
+ enableEdit,
2116
+ expanded,
2117
+ italic,
2118
+ keyboard,
2119
+ mark,
2120
+ placement,
2121
+ strong,
2122
+ style,
2123
+ suffix: ellipsisConfig.suffix,
2124
+ symbol: ellipsisConfig.symbol,
2125
+ underline
2126
+ }), [
2127
+ code,
2128
+ copied,
2129
+ copyConfig.icon,
2130
+ copyLoading,
2131
+ deleted,
2132
+ editConfig.icon,
2133
+ ellipsisConfig.suffix,
2134
+ ellipsisConfig.symbol,
2135
+ enableCopy,
2136
+ enableEdit,
2137
+ expanded,
2138
+ italic,
2139
+ keyboard,
2140
+ mark,
2141
+ placement,
2142
+ strong,
2143
+ style,
2144
+ underline
2145
+ ]);
2146
+ useEffect3(() => () => {
2147
+ if (copyTimerRef.current)
2148
+ clearTimeout(copyTimerRef.current);
2149
+ }, []);
2150
+ useLayoutEffect(() => {
2151
+ if (!editing && previousEditingRef.current)
2152
+ editButtonRef.current?.focus();
2153
+ previousEditingRef.current = editing;
2154
+ }, [editing]);
2155
+ useLayoutEffect(() => {
2156
+ const element = typographyRef.current;
2157
+ if (!cssEllipsis || !hasEllipsisTooltip || !element) {
2158
+ setIsNativeEllipsis(false);
2159
+ return;
2160
+ }
2161
+ setIsNativeEllipsis(isElementEllipsized(element, rows));
2162
+ }, [children, cssEllipsis, ellipsisWidth, hasEllipsisTooltip, rows, style]);
2163
+ const triggerEditing = useEvent((nextEditing) => {
2164
+ if (nextEditing)
2165
+ editConfig.onStart?.();
2166
+ setEditing(nextEditing);
2167
+ });
2168
+ const handleEditSave = useEvent((value) => {
2169
+ editConfig.onChange?.(value);
2170
+ setEditing(false);
2171
+ });
2172
+ const handleEditCancel = useEvent(() => {
2173
+ editConfig.onCancel?.();
2174
+ setEditing(false);
2175
+ });
2176
+ const handleCopy = useEvent(async (event) => {
2177
+ event.preventDefault();
2178
+ event.stopPropagation();
2179
+ if (disabled || copyLoading)
2180
+ return;
2181
+ setCopyLoading(true);
2182
+ try {
2183
+ const configuredText = typeof copyConfig.text === "function" ? await copyConfig.text() : copyConfig.text;
2184
+ await copyText(configuredText ?? getNodeText(children), copyConfig.format);
2185
+ setCopied(true);
2186
+ if (copyTimerRef.current)
2187
+ clearTimeout(copyTimerRef.current);
2188
+ copyTimerRef.current = setTimeout(() => setCopied(false), 3000);
2189
+ copyConfig.onCopy?.(event);
2190
+ } finally {
2191
+ setCopyLoading(false);
2192
+ }
2193
+ });
2194
+ const handleJsEllipsis = useEvent((nextEllipsis) => {
2195
+ setIsJsEllipsis((previous) => {
2196
+ if (previous !== nextEllipsis)
2197
+ ellipsisConfig.onEllipsis?.(nextEllipsis);
2198
+ return nextEllipsis;
2199
+ });
2200
+ });
2201
+ if (enableEdit && editing) {
2202
+ const editableValue = editConfig.text ?? (typeof children === "string" || typeof children === "number" ? String(children) : "");
2203
+ return /* @__PURE__ */ jsxDEV15(EditableTypography, {
2204
+ ariaLabel,
2205
+ className: cn(type && type !== "button" ? `hj-typography-${type}` : undefined, type && type !== "button" ? typeClass[type] : undefined, disabled && "hj-typography-disabled cursor-not-allowed opacity-45", rootClassName, className),
2206
+ component,
2207
+ config: editConfig,
2208
+ disabled,
2209
+ style,
2210
+ value: editableValue,
2211
+ onCancel: handleEditCancel,
2212
+ onSave: handleEditSave
2213
+ }, undefined, false, undefined, this);
2214
+ }
2215
+ const renderExpand = (canEllipsis) => {
2216
+ if (!canEllipsis || !ellipsisConfig.expandable)
2217
+ return null;
2218
+ const nextExpanded = !expanded;
2219
+ const defaultSymbol = expanded ? "Collapse" : "Expand";
2220
+ const symbol = typeof ellipsisConfig.symbol === "function" ? ellipsisConfig.symbol(expanded) : ellipsisConfig.symbol ?? defaultSymbol;
2221
+ return /* @__PURE__ */ jsxDEV15("button", {
2222
+ "aria-expanded": expanded,
2223
+ "aria-label": defaultSymbol,
2224
+ className: cn("hj-typography-action border-0 bg-transparent p-0 text-[var(--hj-color-brand)] hover:text-[var(--hj-color-brand-hover)]", expanded ? "hj-typography-collapse" : "hj-typography-expand"),
2225
+ disabled,
2226
+ type: "button",
2227
+ onClick: (event) => {
2228
+ event.preventDefault();
2229
+ event.stopPropagation();
2230
+ setExpanded(nextExpanded);
2231
+ ellipsisConfig.onExpand?.(event, { expanded: nextExpanded });
2232
+ },
2233
+ children: symbol
2234
+ }, "expand", false, undefined, this);
2235
+ };
2236
+ const renderEdit = () => {
2237
+ if (!enableEdit || !triggerType.includes("icon"))
2238
+ return null;
2239
+ const editTitle = editConfig.tooltip === false ? undefined : editConfig.tooltip === true || editConfig.tooltip === undefined ? "Edit" : editConfig.tooltip;
2240
+ return /* @__PURE__ */ jsxDEV15(Tooltip, {
2241
+ title: editTitle,
2242
+ children: /* @__PURE__ */ jsxDEV15("button", {
2243
+ "aria-label": typeof editTitle === "string" ? editTitle : "Edit",
2244
+ className: "hj-typography-action hj-typography-edit inline-flex border-0 bg-transparent p-0 text-current opacity-70 hover:text-[var(--hj-color-brand)] hover:opacity-100",
2245
+ disabled,
2246
+ ref: editButtonRef,
2247
+ tabIndex: editConfig.tabIndex,
2248
+ type: "button",
2249
+ onClick: (event) => {
2250
+ event.preventDefault();
2251
+ event.stopPropagation();
2252
+ triggerEditing(true);
2253
+ },
2254
+ children: editConfig.icon ?? /* @__PURE__ */ jsxDEV15("span", {
2255
+ "aria-hidden": "true",
2256
+ className: "text-[15px] leading-none",
2257
+ children: "✎"
2258
+ }, undefined, false, undefined, this)
2259
+ }, undefined, false, undefined, this)
2260
+ }, "edit", false, undefined, this);
2261
+ };
2262
+ const renderCopy = () => {
2263
+ if (!enableCopy)
2264
+ return null;
2265
+ const icons = toConfigList(copyConfig.icon);
2266
+ const tooltips = toConfigList(copyConfig.tooltips);
2267
+ const defaultTitle = copied ? "Copied" : "Copy";
2268
+ const copyTitle = getConfigNode(tooltips[copied ? 1 : 0], defaultTitle);
2269
+ const defaultIcon2 = copied ? /* @__PURE__ */ jsxDEV15(Icon, {
2270
+ "aria-hidden": "true",
2271
+ name: "check",
2272
+ size: 14
2273
+ }, undefined, false, undefined, this) : copyLoading ? /* @__PURE__ */ jsxDEV15(Icon, {
2274
+ "aria-hidden": "true",
2275
+ className: "animate-spin",
2276
+ name: "refresh",
2277
+ size: 14
2278
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV15(Icon, {
2279
+ "aria-hidden": "true",
2280
+ name: "copy",
2281
+ size: 14
2282
+ }, undefined, false, undefined, this);
2283
+ return /* @__PURE__ */ jsxDEV15(Tooltip, {
2284
+ title: copyTitle,
2285
+ children: /* @__PURE__ */ jsxDEV15("button", {
2286
+ "aria-label": typeof copyTitle === "string" ? copyTitle : defaultTitle,
2287
+ className: cn("hj-typography-action hj-typography-copy inline-flex border-0 bg-transparent p-0 text-current opacity-70 hover:text-[var(--hj-color-brand)] hover:opacity-100", copied && "hj-typography-copy-success text-[var(--hj-color-success)] opacity-100", copyLoading && "hj-typography-copy-loading"),
2288
+ disabled: disabled || copyLoading,
2289
+ tabIndex: copyConfig.tabIndex,
2290
+ type: "button",
2291
+ onClick: handleCopy,
2292
+ children: getConfigNode(icons[copied ? 1 : 0], defaultIcon2, true)
2293
+ }, undefined, false, undefined, this)
2294
+ }, "copy", false, undefined, this);
2295
+ };
2296
+ const renderOperations = (canEllipsis) => {
2297
+ const operations = [renderExpand(canEllipsis), renderEdit(), renderCopy()];
2298
+ if (operations.every((operation) => operation == null))
2299
+ return null;
2300
+ return /* @__PURE__ */ jsxDEV15("span", {
2301
+ className: cn("hj-typography-actions inline-flex items-center gap-1 align-baseline", placement === "start" ? "hj-typography-actions-start mr-1" : "ml-1"),
2302
+ children: operations
2303
+ }, undefined, false, undefined, this);
2304
+ };
2305
+ const renderContent = (nodes, canEllipsis) => {
2306
+ const textContent = decorateContent({ code, delete: deleted, italic, keyboard, mark, strong, underline }, /* @__PURE__ */ jsxDEV15(Fragment4, {
2307
+ children: [
2308
+ nodes,
2309
+ canEllipsis && !expanded ? /* @__PURE__ */ jsxDEV15("span", {
2310
+ "aria-hidden": "true",
2311
+ children: ELLIPSIS_TEXT
2312
+ }, undefined, false, undefined, this) : null,
2313
+ ellipsisConfig.suffix
2314
+ ]
2315
+ }, undefined, true, undefined, this));
2316
+ const operations = renderOperations(canEllipsis);
2317
+ return /* @__PURE__ */ jsxDEV15(Fragment4, {
2318
+ children: [
2319
+ placement === "start" ? operations : null,
2320
+ textContent,
2321
+ placement === "end" ? operations : null
2322
+ ]
2323
+ }, undefined, true, undefined, this);
2324
+ };
2325
+ const cssEllipsisStyle = cssEllipsis ? rows > 1 ? { ...lineClampStyle, WebkitLineClamp: rows } : {
2326
+ display: component === "span" || component === "a" ? "inline-block" : undefined,
2327
+ overflow: "hidden",
2328
+ textOverflow: "ellipsis",
2329
+ whiteSpace: "nowrap"
2330
+ } : undefined;
2331
+ const fullText = editConfig.text ?? getNodeText(children);
2332
+ const rootProps = {
2333
+ ...props,
2334
+ "aria-disabled": disabled || undefined,
2335
+ "aria-label": ariaLabel ?? (needMeasureEllipsis && isMergedEllipsis ? fullText : undefined),
2336
+ className: cn("hj-typography", type && type !== "button" ? `hj-typography-${type}` : undefined, type && type !== "button" ? typeClass[type] : undefined, disabled && "hj-typography-disabled cursor-not-allowed opacity-45", enableEllipsis && "hj-typography-ellipsis", cssEllipsis && rows === 1 && "hj-typography-ellipsis-single-line", cssEllipsis && rows > 1 && "hj-typography-ellipsis-multiple-line", expanded && "hj-typography-ellipsis-expanded", triggerType.includes("text") && enableEdit && !disabled && "cursor-pointer", rootClassName, className),
2337
+ onClick: (event) => {
2338
+ onClick?.(event);
2339
+ if (!event.defaultPrevented && enableEdit && !disabled && triggerType.includes("text")) {
2340
+ event.preventDefault();
2341
+ triggerEditing(true);
2342
+ }
2343
+ },
2344
+ style: { ...cssEllipsisStyle, ...style },
2345
+ ...component === "button" ? { disabled, type: type === "button" ? "button" : undefined } : {}
2346
+ };
2347
+ return /* @__PURE__ */ jsxDEV15(ResizeObserver, {
2348
+ disabled: !mergedEnableEllipsis,
2349
+ onResize: ({ offsetWidth }) => setEllipsisWidth(offsetWidth),
2350
+ children: (resizeRef) => {
2351
+ const typographyNode = createElement(component, { ...rootProps, ref: composeRef(resizeRef, typographyRef) }, /* @__PURE__ */ jsxDEV15(EllipsisMeasure, {
2352
+ enable: needMeasureEllipsis,
2353
+ expanded,
2354
+ measureKey,
2355
+ rows,
2356
+ text: children,
2357
+ width: ellipsisWidth,
2358
+ onEllipsis: handleJsEllipsis,
2359
+ renderContent
2360
+ }, undefined, false, undefined, this));
2361
+ return hasEllipsisTooltip ? /* @__PURE__ */ jsxDEV15(Tooltip, {
2362
+ ...ellipsisTooltipRest,
2363
+ title: isMergedEllipsis ? ellipsisTooltipTitle : undefined,
2364
+ children: typographyNode
2365
+ }, undefined, false, undefined, this) : typographyNode;
2366
+ }
2367
+ }, undefined, false, undefined, this);
2368
+ }
2369
+ function Title({ as, className, level = 1, variant, ...props }) {
2370
+ const component = as ?? (variant ? "h2" : `h${level}`);
2371
+ return /* @__PURE__ */ jsxDEV15(TypographyBase, {
2372
+ ...props,
2373
+ className: cn("hj-typography-title", variant ? titleClass[variant] : titleLevelClass[level], className),
2374
+ component
2375
+ }, undefined, false, undefined, this);
2376
+ }
2377
+ function Text({ as, className, variant, ...props }) {
2378
+ const component = as ?? (variant ? "p" : "span");
2379
+ return /* @__PURE__ */ jsxDEV15(TypographyBase, {
2380
+ ...props,
2381
+ className: cn("hj-typography-text", textClass[variant ?? "body"], className),
2382
+ component
2383
+ }, undefined, false, undefined, this);
2384
+ }
2385
+ function Paragraph({ as = "p", className, ...props }) {
2386
+ return /* @__PURE__ */ jsxDEV15(TypographyBase, {
2387
+ ...props,
2388
+ className: cn("hj-typography-paragraph", className),
2389
+ component: as
2390
+ }, undefined, false, undefined, this);
2391
+ }
2392
+ function Link({ className, ...props }) {
2393
+ return /* @__PURE__ */ jsxDEV15(TypographyBase, {
2394
+ ...props,
2395
+ className: cn("hj-typography-link text-[var(--hj-color-brand)] transition hover:underline", className),
2396
+ component: "a"
2397
+ }, undefined, false, undefined, this);
2398
+ }
2399
+ function TypographyRoot({
2400
+ children,
2401
+ className,
2402
+ component = "article",
2403
+ rootClassName,
2404
+ ...props
2405
+ }) {
2406
+ return createElement(component, { ...props, className: cn("hj-typography", rootClassName, className) }, children);
2407
+ }
2408
+ var Typography = Object.assign(TypographyRoot, {
2409
+ Link,
2410
+ Paragraph,
2411
+ Text,
2412
+ Title
2413
+ });
2414
+
2415
+ // src/components/SectionHeader.tsx
2416
+ import { jsxDEV as jsxDEV16 } from "react/jsx-dev-runtime";
2417
+ function SectionHeader({
2418
+ action,
2419
+ className = "",
2420
+ meta,
2421
+ middle,
2422
+ onAction,
2423
+ title
2424
+ }) {
2425
+ return /* @__PURE__ */ jsxDEV16("div", {
2426
+ className: `flex items-center justify-between gap-3 ${className}`,
2427
+ children: [
2428
+ /* @__PURE__ */ jsxDEV16("div", {
2429
+ className: "flex min-w-0 items-baseline gap-2",
2430
+ children: [
2431
+ /* @__PURE__ */ jsxDEV16(Title, {
2432
+ className: "shrink-0",
2433
+ variant: "section",
2434
+ children: title
2435
+ }, undefined, false, undefined, this),
2436
+ meta ? /* @__PURE__ */ jsxDEV16(Text, {
2437
+ as: "span",
2438
+ className: "truncate font-semibold text-[#a5adb8]",
2439
+ variant: "muted",
2440
+ children: meta
2441
+ }, undefined, false, undefined, this) : null
2442
+ ]
2443
+ }, undefined, true, undefined, this),
2444
+ middle ? /* @__PURE__ */ jsxDEV16("div", {
2445
+ className: "min-w-0 flex-1",
2446
+ children: middle
2447
+ }, undefined, false, undefined, this) : null,
2448
+ action ? /* @__PURE__ */ jsxDEV16(Text, {
2449
+ as: onAction ? "button" : "span",
2450
+ className: "shrink-0",
2451
+ onClick: onAction,
2452
+ type: onAction ? "button" : undefined,
2453
+ variant: "action",
2454
+ children: action
2455
+ }, undefined, false, undefined, this) : null
2456
+ ]
2457
+ }, undefined, true, undefined, this);
2458
+ }
2459
+ // src/components/Segmented.tsx
2460
+ import RcSegmented from "@rc-component/segmented";
2461
+ import { forwardRef as forwardRef4, useId as useId2, useMemo as useMemo5 } from "react";
2462
+ import { jsxDEV as jsxDEV17, Fragment as Fragment5 } from "react/jsx-dev-runtime";
2463
+ function isLabeledOption(option) {
2464
+ return typeof option === "object" && option !== null;
2465
+ }
2466
+ function normalizeSize(size, fallback) {
2467
+ if (size === "small" || size === "sm")
2468
+ return "sm";
2469
+ if (size === "large" || size === "lg")
2470
+ return "lg";
2471
+ if (size === "xs")
2472
+ return "xs";
2473
+ if (size === "medium" || size === "middle" || size === "md")
2474
+ return "md";
2475
+ return fallback;
2476
+ }
2477
+ function resolveSemantic(value, props) {
2478
+ return typeof value === "function" ? value({ props }) : value;
2479
+ }
2480
+ var InternalSegmented = forwardRef4((props, ref) => {
2481
+ const {
2482
+ block = false,
2483
+ className,
2484
+ classNames,
2485
+ disabled,
2486
+ items,
2487
+ name,
2488
+ options,
2489
+ orientation,
2490
+ rootClassName,
2491
+ shape = "default",
2492
+ size,
2493
+ style,
2494
+ styles,
2495
+ vertical,
2496
+ ...restProps
2497
+ } = props;
2498
+ const config = useConfig();
2499
+ const generatedName = useId2();
2500
+ const mergedDisabled = disabled ?? config.components.Segmented?.disabled ?? config.disabled;
2501
+ const mergedSize = normalizeSize(size ?? config.components.Segmented?.size, config.size);
2502
+ const mergedVertical = orientation ? orientation === "vertical" : vertical;
2503
+ const sourceOptions = useMemo5(() => options ?? items?.map(({ id, ...item }) => ({ ...item, value: id })) ?? [], [items, options]);
2504
+ const semanticProps = {
2505
+ ...props,
2506
+ disabled: mergedDisabled,
2507
+ options: sourceOptions,
2508
+ shape,
2509
+ size,
2510
+ vertical: mergedVertical
2511
+ };
2512
+ const mergedClassNames = resolveSemantic(classNames, semanticProps) ?? {};
2513
+ const mergedStyles = resolveSemantic(styles, semanticProps) ?? {};
2514
+ const rcOptions = useMemo5(() => sourceOptions.map((option) => {
2515
+ if (!isLabeledOption(option))
2516
+ return option;
2517
+ const { icon, label, tooltip: _tooltip, ...optionProps } = option;
2518
+ return {
2519
+ ...optionProps,
2520
+ label: /* @__PURE__ */ jsxDEV17(Fragment5, {
2521
+ children: [
2522
+ icon ? /* @__PURE__ */ jsxDEV17("span", {
2523
+ className: cn("hj-segmented-item-icon", mergedClassNames.icon),
2524
+ style: mergedStyles.icon,
2525
+ children: icon
2526
+ }, undefined, false, undefined, this) : null,
2527
+ label != null ? /* @__PURE__ */ jsxDEV17("span", {
2528
+ children: label
2529
+ }, undefined, false, undefined, this) : null
2530
+ ]
2531
+ }, undefined, true, undefined, this)
2532
+ };
2533
+ }), [mergedClassNames.icon, mergedStyles.icon, sourceOptions]);
2534
+ return /* @__PURE__ */ jsxDEV17(RcSegmented, {
2535
+ ...restProps,
2536
+ ref,
2537
+ className: cn("hj-segmented-root", `hj-segmented-${mergedSize}`, block && "hj-segmented-block", shape === "round" && "hj-segmented-shape-round", rootClassName, mergedClassNames.root, className),
2538
+ classNames: { item: mergedClassNames.item, label: mergedClassNames.label },
2539
+ disabled: mergedDisabled,
2540
+ itemRender: (node, { item }) => {
2541
+ const sourceOption = sourceOptions.find((option) => isLabeledOption(option) && option.value === item.value);
2542
+ const tooltip = sourceOption && isLabeledOption(sourceOption) ? sourceOption.tooltip : undefined;
2543
+ if (!tooltip)
2544
+ return node;
2545
+ return typeof tooltip === "string" ? /* @__PURE__ */ jsxDEV17(Tooltip, {
2546
+ title: tooltip,
2547
+ children: node
2548
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV17(Tooltip, {
2549
+ ...tooltip,
2550
+ children: node
2551
+ }, undefined, false, undefined, this);
2552
+ },
2553
+ motionName: "thumb-motion",
2554
+ name: name ?? generatedName,
2555
+ options: rcOptions,
2556
+ prefixCls: "hj-segmented",
2557
+ style: { ...style, ...mergedStyles.root },
2558
+ styles: { item: mergedStyles.item, label: mergedStyles.label },
2559
+ vertical: mergedVertical
2560
+ }, undefined, false, undefined, this);
2561
+ });
2562
+ var Segmented = InternalSegmented;
2563
+ Segmented.displayName = "Segmented";
2564
+
2565
+ // src/components/SegmentedTabs.tsx
2566
+ import { jsxDEV as jsxDEV18 } from "react/jsx-dev-runtime";
2567
+ var legacyTypeAppearance = {
2568
+ boxed: "boxed",
2569
+ "glow-pill": "glow-pill",
2570
+ line: "plain",
2571
+ segmented: "segmented"
2572
+ };
2573
+ var appearanceClass = {
2574
+ boxed: "boxed",
2575
+ "glow-pill": "glow-pill",
2576
+ plain: "line",
2577
+ segmented: "segmented"
2578
+ };
2579
+ function SegmentedTabs(props) {
2580
+ const {
2581
+ animated,
2582
+ appearance,
2583
+ block,
2584
+ disabled,
2585
+ fullWidth,
2586
+ indicator,
2587
+ items,
2588
+ size,
2589
+ type,
2590
+ ...segmentedProps
2591
+ } = props;
2592
+ const config = useConfig();
2593
+ const mergedSize = size ?? config.components.SegmentedTabs?.size ?? "sm";
2594
+ const mergedDisabled = disabled ?? config.components.SegmentedTabs?.disabled ?? config.disabled;
2595
+ const mergedAppearance = appearance ?? (type ? legacyTypeAppearance[type] : "boxed");
2596
+ const visualClass = appearanceClass[mergedAppearance];
2597
+ const hideLegacyThumb = mergedAppearance === "plain" && indicator === "none";
2598
+ return /* @__PURE__ */ jsxDEV18(Segmented, {
2599
+ ...segmentedProps,
2600
+ block: block ?? fullWidth,
2601
+ className: cn("hj-segmented-tabs", `hj-segmented-tabs-${visualClass}`, animated === false && "hj-segmented-tabs-no-motion", hideLegacyThumb && "hj-segmented-tabs-no-indicator", segmentedProps.className),
2602
+ disabled: mergedDisabled,
2603
+ options: items.map(({ id, ...item }) => ({ ...item, value: id })),
2604
+ shape: mergedAppearance === "segmented" ? "round" : "default",
2605
+ size: mergedSize
2606
+ }, undefined, false, undefined, this);
2607
+ }
2608
+ // src/components/SelectInput.tsx
2609
+ import RcSelect from "@rc-component/select";
2610
+
2611
+ // src/components/Input.tsx
2612
+ import RcInput, { TextArea as RcTextArea2 } from "@rc-component/input";
2613
+ import { composeRef as composeRef2, raf, triggerFocus, useControlledState as useControlledState3 } from "@rc-component/util";
2614
+ import {
2615
+ Fragment as Fragment6,
2616
+ cloneElement as cloneElement2,
2617
+ createContext as createContext3,
2618
+ forwardRef as forwardRef5,
2619
+ isValidElement as isValidElement3,
2620
+ useContext as useContext3,
2621
+ useImperativeHandle as useImperativeHandle2,
2622
+ useRef as useRef2,
2623
+ useState as useState4
2624
+ } from "react";
2625
+
2626
+ // src/components/form/statusContext.ts
2627
+ import { createContext as createContext2, useContext as useContext2 } from "react";
2628
+ var EMPTY_STATUS_NODES = [];
2629
+ var FormItemInputContext = createContext2({});
2630
+ FormItemInputContext.displayName = "FormItemInputContext";
2631
+ function getMergedFormItemStatus(contextStatus, customStatus) {
2632
+ const nativeCustomStatus = customStatus === "default" ? "" : customStatus;
2633
+ return nativeCustomStatus || contextStatus || "";
2634
+ }
2635
+ function useMergedFormItemStatus(customStatus) {
2636
+ const { status: contextStatus } = useContext2(FormItemInputContext);
2637
+ return getMergedFormItemStatus(contextStatus, customStatus);
2638
+ }
2639
+ function useFormItemStatus() {
2640
+ const {
2641
+ errors = EMPTY_STATUS_NODES,
2642
+ status,
2643
+ warnings = EMPTY_STATUS_NODES
2644
+ } = useContext2(FormItemInputContext);
2645
+ return { errors, status, warnings };
2646
+ }
2647
+
2648
+ // src/components/Input.tsx
2649
+ import { jsxDEV as jsxDEV19, Fragment as Fragment7 } from "react/jsx-dev-runtime";
2650
+ var statusClass2 = {
2651
+ "": "border-[var(--hj-input-border)] focus-within:border-[var(--hj-input-border-active)] focus:border-[var(--hj-input-border-active)]",
2652
+ error: "border-[var(--hj-color-danger)] focus-within:border-[var(--hj-color-danger)] focus:border-[var(--hj-color-danger)]",
2653
+ warning: "border-[var(--hj-color-warning)] focus-within:border-[var(--hj-color-warning)] focus:border-[var(--hj-color-warning)]",
2654
+ success: "border-[var(--hj-color-success)] focus-within:border-[var(--hj-color-success)] focus:border-[var(--hj-color-success)]",
2655
+ validating: "border-[var(--hj-input-border)] focus-within:border-[var(--hj-input-border-active)] focus:border-[var(--hj-input-border-active)]"
2656
+ };
2657
+ var sizeClass3 = {
2658
+ sm: "h-[var(--hj-input-height-sm)] px-[var(--hj-input-padding-x)] text-[length:var(--hj-input-font-size)] leading-[var(--hj-input-line-height)]",
2659
+ md: "h-[var(--hj-input-height-md)] px-[var(--hj-input-padding-x)] text-[length:var(--hj-input-font-size)] leading-[var(--hj-input-line-height)]",
2660
+ lg: "h-[var(--hj-input-height-lg)] px-[var(--hj-input-padding-x)] text-[length:var(--hj-input-font-size)] leading-[var(--hj-input-line-height)]"
2661
+ };
2662
+ var nativeSizeClass = {
2663
+ sm: "hj-input-small",
2664
+ md: "hj-input-medium",
2665
+ lg: "hj-input-large"
2666
+ };
2667
+ var textAreaSizeClass = {
2668
+ sm: "min-h-[var(--hj-input-height-sm)] px-[var(--hj-input-padding-x)] py-1.5",
2669
+ md: "min-h-[calc(var(--hj-input-height-md)*2)] px-[var(--hj-input-padding-x)] py-2",
2670
+ lg: "min-h-[calc(var(--hj-input-height-lg)*2)] px-[var(--hj-input-padding-x)] py-2.5"
2671
+ };
2672
+ var otpCellSizeClass = {
2673
+ sm: "w-[var(--hj-input-height-sm)] px-0 text-center",
2674
+ md: "w-[var(--hj-input-height-md)] px-0 text-center",
2675
+ lg: "w-[var(--hj-input-height-lg)] px-0 text-center"
2676
+ };
2677
+ function normalizeInputSize(size, fallback = "md") {
2678
+ if (size === "small" || size === "sm")
2679
+ return "sm";
2680
+ if (size === "large" || size === "lg")
2681
+ return "lg";
2682
+ if (size === "medium" || size === "middle" || size === "md")
2683
+ return "md";
2684
+ return fallback;
2685
+ }
2686
+ var variantClassName = {
2687
+ active: "border-[var(--hj-input-border-active)] bg-[var(--hj-input-bg-active)]",
2688
+ borderless: "border-transparent bg-transparent",
2689
+ default: "",
2690
+ filled: "border-transparent bg-[var(--hj-input-bg-active)]",
2691
+ outlined: "",
2692
+ underlined: "rounded-none border-x-0 border-t-0 bg-transparent px-0"
2693
+ };
2694
+ var inputBaseClass = "min-w-0 rounded-[var(--hj-input-radius)] border bg-[var(--hj-input-bg)] text-[var(--hj-input-fg)] outline-none transition placeholder:text-[var(--hj-input-placeholder)] hover:bg-[var(--hj-input-bg-active)] disabled:cursor-not-allowed disabled:opacity-50";
2695
+ var affixInputClass = "h-full min-w-0 flex-1 border-0 bg-transparent p-0 font-[inherit] text-[var(--hj-input-fg)] outline-none placeholder:text-[var(--hj-input-placeholder)] disabled:cursor-not-allowed";
2696
+ var affixWrapperClass = "flex min-w-0 items-center gap-[var(--hj-input-gap)] rounded-[var(--hj-input-radius)] border bg-[var(--hj-input-bg)] transition hover:bg-[var(--hj-input-bg-active)]";
2697
+ var textAreaBaseClass = "w-full resize-y rounded-[var(--hj-input-radius)] border bg-[var(--hj-input-bg)] text-[var(--hj-input-fg)] outline-none transition placeholder:text-[var(--hj-input-placeholder)] hover:bg-[var(--hj-input-bg-active)] disabled:cursor-not-allowed disabled:opacity-50";
2698
+ var InputGroupSizeContext = createContext3(undefined);
2699
+ function getMergedVariant(variant, bordered) {
2700
+ if (variant)
2701
+ return variant;
2702
+ return bordered === false ? "borderless" : "outlined";
2703
+ }
2704
+ function renderClearIcon() {
2705
+ return /* @__PURE__ */ jsxDEV19(Fragment7, {
2706
+ children: [
2707
+ /* @__PURE__ */ jsxDEV19(Icon, {
2708
+ name: "close",
2709
+ size: 14
2710
+ }, undefined, false, undefined, this),
2711
+ /* @__PURE__ */ jsxDEV19("span", {
2712
+ className: "sr-only",
2713
+ children: "清空"
2714
+ }, undefined, false, undefined, this)
2715
+ ]
2716
+ }, undefined, true, undefined, this);
2717
+ }
2718
+ function mergeAllowClear(allowClear) {
2719
+ if (!allowClear)
2720
+ return allowClear;
2721
+ if (typeof allowClear === "object") {
2722
+ return {
2723
+ ...allowClear,
2724
+ clearIcon: allowClear.clearIcon || renderClearIcon()
2725
+ };
2726
+ }
2727
+ return { clearIcon: renderClearIcon() };
2728
+ }
2729
+ function InputInner(props, ref) {
2730
+ const {
2731
+ addonAfter,
2732
+ addonBefore,
2733
+ allowClear,
2734
+ bordered,
2735
+ className,
2736
+ classNames,
2737
+ count,
2738
+ disabled,
2739
+ rootClassName,
2740
+ showCount,
2741
+ size,
2742
+ status,
2743
+ style,
2744
+ styles,
2745
+ variant,
2746
+ ...restProps
2747
+ } = props;
2748
+ const config = useConfig();
2749
+ const groupSize = useContext3(InputGroupSizeContext);
2750
+ const mergedStatus = useMergedFormItemStatus(status);
2751
+ const mergedSize = normalizeInputSize(size ?? groupSize ?? config.components.Input?.size, config.size);
2752
+ const mergedDisabled = disabled ?? config.components.Input?.disabled ?? config.disabled;
2753
+ const mergedVariant = getMergedVariant(variant, bordered);
2754
+ const mergedAllowClear = mergeAllowClear(allowClear);
2755
+ const hasAffix = Boolean(restProps.prefix || restProps.suffix || mergedAllowClear || showCount || count?.show);
2756
+ const hasAddon = addonBefore != null || addonAfter != null;
2757
+ const variantClass = cn(mergedStatus && `hj-input-status-${mergedStatus}`, `hj-input-variant-${mergedVariant}`, mergedVariant === "outlined" && "hj-input-variant-default", statusClass2[mergedStatus], variantClassName[mergedVariant]);
2758
+ const addonBeforeNode = addonBefore == null ? null : /* @__PURE__ */ jsxDEV19("span", {
2759
+ className: slotClass(classNames, "addonBefore", "hj-input-addon-before", "flex shrink-0 items-center border border-r-0 border-[var(--hj-input-border)] bg-[var(--hj-input-addon-bg)] text-[var(--hj-input-addon-fg)]", sizeClass3[mergedSize]),
2760
+ style: slotStyle(styles, "addonBefore"),
2761
+ children: addonBefore
2762
+ }, undefined, false, undefined, this);
2763
+ const addonAfterNode = addonAfter == null ? null : /* @__PURE__ */ jsxDEV19("span", {
2764
+ className: slotClass(classNames, "addonAfter", "hj-input-addon-after", "flex shrink-0 items-center border border-l-0 border-[var(--hj-input-border)] bg-[var(--hj-input-addon-bg)] text-[var(--hj-input-addon-fg)]", sizeClass3[mergedSize]),
2765
+ style: slotStyle(styles, "addonAfter"),
2766
+ children: addonAfter
2767
+ }, undefined, false, undefined, this);
2768
+ return /* @__PURE__ */ jsxDEV19(RcInput, {
2769
+ ...restProps,
2770
+ addonAfter: addonAfterNode,
2771
+ addonBefore: addonBeforeNode,
2772
+ allowClear: mergedAllowClear,
2773
+ className: slotClass(classNames, "root", "hj-input-root", `hj-input-${mergedSize}`, nativeSizeClass[mergedSize], mergedStatus && `hj-input-status-${mergedStatus}`, `hj-input-variant-${mergedVariant}`, mergedVariant === "outlined" && "hj-input-variant-default", rootClassName, className),
2774
+ classNames: {
2775
+ affixWrapper: cn(affixWrapperClass, sizeClass3[mergedSize], `hj-input-affix-wrapper-${mergedSize}`),
2776
+ clear: slotClass(classNames, "clear", "shrink-0 text-[var(--hj-input-clear)] transition hover:text-white [&.hj-input-clear-icon-hidden]:invisible"),
2777
+ count: slotClass(classNames, "count", "shrink-0 text-[var(--hj-input-clear)]"),
2778
+ groupWrapper: slotClass(classNames, "group", "inline-flex min-w-0 overflow-hidden rounded-[var(--hj-input-radius)]", `hj-input-group-wrapper-${mergedSize}`, mergedStatus && `hj-input-group-wrapper-status-${mergedStatus}`, `hj-input-group-wrapper-variant-${mergedVariant}`),
2779
+ input: slotClass(classNames, "input", hasAffix ? affixInputClass : inputBaseClass, !hasAffix && sizeClass3[mergedSize], `hj-input-${mergedSize}`, nativeSizeClass[mergedSize], hasAddon && !hasAffix && "min-w-0 flex-1 rounded-none"),
2780
+ prefix: slotClass(classNames, "prefix", "shrink-0 text-[var(--hj-input-icon)]"),
2781
+ suffix: slotClass(classNames, "suffix", "shrink-0 text-[var(--hj-input-icon)]"),
2782
+ variant: variantClass,
2783
+ wrapper: slotClass(classNames, "wrapper", "inline-flex min-w-0 flex-1")
2784
+ },
2785
+ count,
2786
+ disabled: mergedDisabled,
2787
+ prefixCls: "hj-input",
2788
+ ref,
2789
+ showCount,
2790
+ style: {
2791
+ ...style,
2792
+ ...styles?.root,
2793
+ ...hasAddon ? styles?.group : undefined
2794
+ },
2795
+ styles: {
2796
+ affixWrapper: slotStyle(styles, "root"),
2797
+ clear: slotStyle(styles, "clear"),
2798
+ count: slotStyle(styles, "count"),
2799
+ input: slotStyle(styles, "input"),
2800
+ prefix: slotStyle(styles, "prefix"),
2801
+ suffix: slotStyle(styles, "suffix")
2802
+ }
2803
+ }, undefined, false, undefined, this);
2804
+ }
2805
+ var InternalInput = forwardRef5(InputInner);
2806
+ InternalInput.displayName = "Input";
2807
+ var InputGroup = forwardRef5(function InputGroup2({ children, className, compact = false, rootClassName, size, ...props }, ref) {
2808
+ const config = useConfig();
2809
+ const mergedSize = normalizeInputSize(size, config.size);
2810
+ return /* @__PURE__ */ jsxDEV19(InputGroupSizeContext.Provider, {
2811
+ value: size,
2812
+ children: /* @__PURE__ */ jsxDEV19("span", {
2813
+ ...props,
2814
+ className: cn("hj-input-group", `hj-input-group-${mergedSize}`, nativeSizeClass[mergedSize], "inline-flex min-w-0 items-stretch", compact && "hj-input-group-compact gap-0", rootClassName, className),
2815
+ ref,
2816
+ children
2817
+ }, undefined, false, undefined, this)
2818
+ }, undefined, false, undefined, this);
2819
+ });
2820
+ var InputSearch = forwardRef5(function InputSearch2(props, ref) {
2821
+ const {
2822
+ addonAfter,
2823
+ className,
2824
+ classNames,
2825
+ disabled,
2826
+ enterButton = false,
2827
+ loading = false,
2828
+ onChange,
2829
+ onCompositionEnd,
2830
+ onCompositionStart,
2831
+ onPressEnter,
2832
+ onSearch,
2833
+ searchIcon,
2834
+ styles,
2835
+ ...inputProps
2836
+ } = props;
2837
+ const config = useConfig();
2838
+ const inputRef = useRef2(null);
2839
+ const composingRef = useRef2(false);
2840
+ const mergedDisabled = disabled ?? config.components.Input?.disabled ?? config.disabled;
2841
+ const triggerSearch = (event) => {
2842
+ if (mergedDisabled || loading)
2843
+ return;
2844
+ onSearch?.(inputRef.current?.input?.value ?? "", event, { source: "input" });
2845
+ };
2846
+ const handleMouseDown = (event) => {
2847
+ if (document.activeElement === inputRef.current?.input)
2848
+ event.preventDefault();
2849
+ };
2850
+ const defaultButtonContent = loading ? /* @__PURE__ */ jsxDEV19(Icon, {
2851
+ className: "animate-spin",
2852
+ name: "refresh",
2853
+ size: 16
2854
+ }, undefined, false, undefined, this) : searchIcon ?? /* @__PURE__ */ jsxDEV19(Icon, {
2855
+ name: "search",
2856
+ size: 16
2857
+ }, undefined, false, undefined, this);
2858
+ const buttonClassName = slotClass(classNames, "button", "hj-input-search-button", "inline-flex h-full min-w-8 items-center justify-center gap-1 border-0 bg-transparent px-2 text-[var(--hj-button-default-fg)] transition hover:bg-[var(--hj-button-default-bg-hover)] disabled:cursor-not-allowed disabled:opacity-50", enterButton !== false && "bg-[var(--hj-color-brand)] text-[var(--hj-button-primary-fg)]");
2859
+ let searchButton;
2860
+ if (isValidElement3(enterButton) && enterButton.type !== Fragment6) {
2861
+ searchButton = cloneElement2(enterButton, {
2862
+ "aria-busy": loading || undefined,
2863
+ className: cn(buttonClassName, enterButton.props.className),
2864
+ disabled: mergedDisabled || loading || enterButton.props.disabled,
2865
+ onClick: (event) => {
2866
+ enterButton.props.onClick?.(event);
2867
+ if (!event.defaultPrevented)
2868
+ triggerSearch(event);
2869
+ },
2870
+ onMouseDown: (event) => {
2871
+ enterButton.props.onMouseDown?.(event);
2872
+ if (!event.defaultPrevented)
2873
+ handleMouseDown(event);
2874
+ },
2875
+ style: { ...slotStyle(styles, "button"), ...enterButton.props.style }
2876
+ });
2877
+ } else {
2878
+ searchButton = /* @__PURE__ */ jsxDEV19("button", {
2879
+ "aria-busy": loading || undefined,
2880
+ "aria-label": typeof enterButton === "string" ? undefined : "搜索",
2881
+ className: buttonClassName,
2882
+ disabled: mergedDisabled || loading,
2883
+ onClick: triggerSearch,
2884
+ onMouseDown: handleMouseDown,
2885
+ style: slotStyle(styles, "button"),
2886
+ type: "button",
2887
+ children: typeof enterButton === "boolean" || enterButton == null ? defaultButtonContent : enterButton
2888
+ }, undefined, false, undefined, this);
2889
+ }
2890
+ const mergedAddonAfter = /* @__PURE__ */ jsxDEV19("span", {
2891
+ className: "inline-flex h-full items-stretch",
2892
+ children: [
2893
+ searchButton,
2894
+ addonAfter == null ? null : /* @__PURE__ */ jsxDEV19("span", {
2895
+ className: "inline-flex items-center",
2896
+ children: addonAfter
2897
+ }, undefined, false, undefined, this)
2898
+ ]
2899
+ }, undefined, true, undefined, this);
2900
+ return /* @__PURE__ */ jsxDEV19(InternalInput, {
2901
+ ...inputProps,
2902
+ addonAfter: mergedAddonAfter,
2903
+ className: cn("hj-input-search", enterButton !== false && "hj-input-search-with-button", className),
2904
+ classNames,
2905
+ disabled: mergedDisabled,
2906
+ onChange: (event) => {
2907
+ if (event.type === "click") {
2908
+ onSearch?.(event.currentTarget.value, event, { source: "clear" });
2909
+ }
2910
+ onChange?.(event);
2911
+ },
2912
+ onCompositionEnd: (event) => {
2913
+ composingRef.current = false;
2914
+ onCompositionEnd?.(event);
2915
+ },
2916
+ onCompositionStart: (event) => {
2917
+ composingRef.current = true;
2918
+ onCompositionStart?.(event);
2919
+ },
2920
+ onPressEnter: (event) => {
2921
+ if (composingRef.current || loading)
2922
+ return;
2923
+ onPressEnter?.(event);
2924
+ triggerSearch(event);
2925
+ },
2926
+ ref: composeRef2(inputRef, ref),
2927
+ styles,
2928
+ type: "search"
2929
+ }, undefined, false, undefined, this);
2930
+ });
2931
+ function defaultPasswordIcon(visible) {
2932
+ return /* @__PURE__ */ jsxDEV19("span", {
2933
+ className: "relative inline-flex",
2934
+ children: [
2935
+ /* @__PURE__ */ jsxDEV19(Icon, {
2936
+ name: "eye",
2937
+ size: 16
2938
+ }, undefined, false, undefined, this),
2939
+ visible ? null : /* @__PURE__ */ jsxDEV19("span", {
2940
+ "aria-hidden": "true",
2941
+ className: "absolute left-0 top-1/2 h-px w-full -rotate-45 bg-current"
2942
+ }, undefined, false, undefined, this)
2943
+ ]
2944
+ }, undefined, true, undefined, this);
2945
+ }
2946
+ var InputPassword = forwardRef5(function InputPassword2(props, ref) {
2947
+ const {
2948
+ action = "click",
2949
+ className,
2950
+ disabled,
2951
+ iconRender = defaultPasswordIcon,
2952
+ suffix,
2953
+ type: _type,
2954
+ visibilityToggle = true,
2955
+ ...inputProps
2956
+ } = props;
2957
+ const config = useConfig();
2958
+ const mergedDisabled = disabled ?? config.components.Input?.disabled ?? config.disabled;
2959
+ const visibilityOptions = typeof visibilityToggle === "object" ? visibilityToggle : undefined;
2960
+ const [visible, setVisible] = useControlledState3(false, visibilityOptions?.visible);
2961
+ const changeVisibility = (nextVisible) => {
2962
+ if (mergedDisabled || visibilityToggle === false)
2963
+ return;
2964
+ setVisible(nextVisible);
2965
+ visibilityOptions?.onVisibleChange?.(nextVisible);
2966
+ };
2967
+ const toggleVisibility = () => changeVisibility(!visible);
2968
+ const visibilityIcon = visibilityToggle === false ? null : /* @__PURE__ */ jsxDEV19("button", {
2969
+ "aria-label": visible ? "隐藏密码" : "显示密码",
2970
+ "aria-pressed": visible,
2971
+ className: "hj-input-password-icon inline-flex shrink-0 items-center justify-center border-0 bg-transparent p-0 text-[var(--hj-input-icon)]",
2972
+ disabled: mergedDisabled,
2973
+ onBlur: action === "hover" ? () => changeVisibility(false) : undefined,
2974
+ onClick: action === "click" ? toggleVisibility : undefined,
2975
+ onFocus: action === "hover" ? () => changeVisibility(true) : undefined,
2976
+ onMouseDown: (event) => event.preventDefault(),
2977
+ onMouseEnter: action === "hover" ? () => changeVisibility(true) : undefined,
2978
+ onMouseLeave: action === "hover" ? () => changeVisibility(false) : undefined,
2979
+ tabIndex: mergedDisabled ? -1 : visibilityOptions?.tabIndex ?? 0,
2980
+ type: "button",
2981
+ children: iconRender(visible)
2982
+ }, undefined, false, undefined, this);
2983
+ return /* @__PURE__ */ jsxDEV19(InternalInput, {
2984
+ ...inputProps,
2985
+ className: cn("hj-input-password", className),
2986
+ disabled: mergedDisabled,
2987
+ ref,
2988
+ suffix: visibilityIcon || suffix ? /* @__PURE__ */ jsxDEV19("span", {
2989
+ className: "inline-flex items-center gap-[var(--hj-input-gap)]",
2990
+ children: [
2991
+ visibilityIcon,
2992
+ suffix
2993
+ ]
2994
+ }, undefined, true, undefined, this) : undefined,
2995
+ type: visible ? "text" : "password"
2996
+ }, undefined, false, undefined, this);
2997
+ });
2998
+ var InputTextArea = forwardRef5(function InputTextArea2(props, ref) {
2999
+ const {
3000
+ allowClear,
3001
+ bordered,
3002
+ className,
3003
+ classNames,
3004
+ count,
3005
+ disabled,
3006
+ rootClassName,
3007
+ showCount,
3008
+ size,
3009
+ status,
3010
+ style,
3011
+ styles,
3012
+ variant,
3013
+ ...textAreaProps
3014
+ } = props;
3015
+ const config = useConfig();
3016
+ const groupSize = useContext3(InputGroupSizeContext);
3017
+ const mergedStatus = useMergedFormItemStatus(status);
3018
+ const mergedSize = normalizeInputSize(size ?? groupSize ?? config.components.Input?.size, config.size);
3019
+ const mergedDisabled = disabled ?? config.components.Input?.disabled ?? config.disabled;
3020
+ const mergedVariant = getMergedVariant(variant, bordered);
3021
+ const mergedAllowClear = mergeAllowClear(allowClear);
3022
+ const hasAffix = Boolean(mergedAllowClear || showCount || count?.show);
3023
+ const innerRef = useRef2(null);
3024
+ useImperativeHandle2(ref, () => ({
3025
+ blur: () => innerRef.current?.blur(),
3026
+ focus: (options) => {
3027
+ triggerFocus(innerRef.current?.resizableTextArea?.textArea, options);
3028
+ },
3029
+ nativeElement: innerRef.current?.nativeElement ?? null,
3030
+ resizableTextArea: innerRef.current?.resizableTextArea
3031
+ }));
3032
+ return /* @__PURE__ */ jsxDEV19(RcTextArea2, {
3033
+ ...textAreaProps,
3034
+ allowClear: mergedAllowClear,
3035
+ className: slotClass(classNames, "root", "hj-input-textarea-root", `hj-input-${mergedSize}`, nativeSizeClass[mergedSize], mergedStatus && `hj-input-status-${mergedStatus}`, `hj-input-variant-${mergedVariant}`, mergedVariant === "outlined" && "hj-input-variant-default", rootClassName, className),
3036
+ classNames: {
3037
+ affixWrapper: cn(affixWrapperClass, "items-start", `hj-input-affix-wrapper-${mergedSize}`),
3038
+ clear: slotClass(classNames, "clear", "shrink-0 text-[var(--hj-input-clear)] transition hover:text-white [&.hj-input-clear-icon-hidden]:invisible"),
3039
+ count: slotClass(classNames, "count", "shrink-0 text-[var(--hj-input-clear)]"),
3040
+ textarea: slotClass(classNames, "textarea", hasAffix ? "w-full flex-1 resize-y border-0 bg-transparent text-[var(--hj-input-fg)] outline-none placeholder:text-[var(--hj-input-placeholder)]" : textAreaBaseClass, textAreaSizeClass[mergedSize]),
3041
+ variant: cn(mergedStatus && `hj-input-status-${mergedStatus}`, `hj-input-variant-${mergedVariant}`, statusClass2[mergedStatus], variantClassName[mergedVariant])
3042
+ },
3043
+ count,
3044
+ disabled: mergedDisabled,
3045
+ prefixCls: "hj-input",
3046
+ ref: innerRef,
3047
+ showCount,
3048
+ style: slotStyle(styles, "root", style),
3049
+ styles: {
3050
+ affixWrapper: slotStyle(styles, "root"),
3051
+ clear: slotStyle(styles, "clear"),
3052
+ count: slotStyle(styles, "count"),
3053
+ textarea: slotStyle(styles, "textarea")
3054
+ }
3055
+ }, undefined, false, undefined, this);
3056
+ });
3057
+ function stringToCells(value) {
3058
+ return Array.from(value ?? "");
3059
+ }
3060
+ var InputOTP = forwardRef5(function InputOTP2(props, ref) {
3061
+ const {
3062
+ autoComplete,
3063
+ autoFocus,
3064
+ className,
3065
+ classNames,
3066
+ defaultValue,
3067
+ disabled,
3068
+ formatter,
3069
+ inputMode,
3070
+ length = 6,
3071
+ mask,
3072
+ onChange,
3073
+ onFocus,
3074
+ onInput,
3075
+ rootClassName,
3076
+ separator,
3077
+ size,
3078
+ status,
3079
+ style,
3080
+ styles,
3081
+ type,
3082
+ value,
3083
+ variant = "outlined",
3084
+ ...rootProps
3085
+ } = props;
3086
+ const config = useConfig();
3087
+ const mergedStatus = useMergedFormItemStatus(status);
3088
+ const mergedLength = Math.max(1, Math.floor(length));
3089
+ const mergedSize = normalizeInputSize(size ?? config.components.Input?.size, config.size);
3090
+ const mergedDisabled = disabled ?? config.components.Input?.disabled ?? config.disabled;
3091
+ const formatValue = (text) => formatter ? formatter(text) : text;
3092
+ const [innerCells, setInnerCells] = useState4(() => stringToCells(formatValue(defaultValue ?? "")).slice(0, mergedLength));
3093
+ const controlled = value !== undefined;
3094
+ const valueCells = controlled ? stringToCells(formatValue(value ?? "")).slice(0, mergedLength) : innerCells.slice(0, mergedLength);
3095
+ const containerRef = useRef2(null);
3096
+ const inputRefs = useRef2({});
3097
+ const focusCell = (index) => {
3098
+ if (index >= 0 && index < mergedLength)
3099
+ inputRefs.current[index]?.focus();
3100
+ };
3101
+ useImperativeHandle2(ref, () => ({
3102
+ blur: () => {
3103
+ for (let index = 0;index < mergedLength; index += 1) {
3104
+ inputRefs.current[index]?.blur();
3105
+ }
3106
+ },
3107
+ focus: () => inputRefs.current[0]?.focus(),
3108
+ nativeElement: containerRef.current
3109
+ }), [mergedLength]);
3110
+ const patchValue = (index, text) => {
3111
+ let nextCells = [...valueCells];
3112
+ for (let fillIndex = 0;fillIndex < index; fillIndex += 1) {
3113
+ if (!nextCells[fillIndex])
3114
+ nextCells[fillIndex] = "";
3115
+ }
3116
+ if (text.length <= 1)
3117
+ nextCells[index] = text;
3118
+ else
3119
+ nextCells = nextCells.slice(0, index).concat(stringToCells(text));
3120
+ nextCells = nextCells.slice(0, mergedLength);
3121
+ while (nextCells.length && !nextCells.at(-1))
3122
+ nextCells.pop();
3123
+ const formatted = formatValue(nextCells.map((cell) => cell || " ").join(""));
3124
+ return stringToCells(formatted).slice(0, mergedLength).map((cell, cellIndex) => cell === " " && !nextCells[cellIndex] ? nextCells[cellIndex] : cell);
3125
+ };
3126
+ const commitCells = (nextCells) => {
3127
+ if (!controlled)
3128
+ setInnerCells(nextCells);
3129
+ onInput?.([...nextCells]);
3130
+ const nextValue = nextCells.join("");
3131
+ const currentValue = valueCells.join("");
3132
+ if (nextCells.length === mergedLength && nextCells.every(Boolean) && nextValue !== currentValue) {
3133
+ onChange?.(nextValue);
3134
+ }
3135
+ };
3136
+ const syncSelection = (index) => {
3137
+ raf(() => {
3138
+ const input = inputRefs.current[index]?.input;
3139
+ if (input && document.activeElement === input)
3140
+ input.select();
3141
+ });
3142
+ };
3143
+ const handleInput = (index, event) => {
3144
+ const text = event.currentTarget.value;
3145
+ const nextCells = patchValue(index, text);
3146
+ const nextIndex = Math.min(index + stringToCells(text).length, mergedLength - 1);
3147
+ if (nextIndex !== index && nextCells[index] !== undefined)
3148
+ focusCell(nextIndex);
3149
+ commitCells(nextCells);
3150
+ };
3151
+ return /* @__PURE__ */ jsxDEV19("div", {
3152
+ ...rootProps,
3153
+ "aria-disabled": mergedDisabled || undefined,
3154
+ className: slotClass(classNames, "root", "hj-input-otp hj-otp", `hj-input-otp-${mergedSize}`, nativeSizeClass[mergedSize], mergedStatus && `hj-input-status-${mergedStatus}`, `hj-input-variant-${variant}`, "inline-flex items-center gap-[var(--hj-input-gap)]", mergedDisabled && "hj-input-otp-disabled opacity-50", rootClassName, className),
3155
+ ref: containerRef,
3156
+ role: rootProps.role ?? "group",
3157
+ style: slotStyle(styles, "root", style),
3158
+ children: Array.from({ length: mergedLength }, (_, index) => {
3159
+ const singleValue = valueCells[index] ?? "";
3160
+ const customMask = typeof mask === "string" && singleValue !== "";
3161
+ const separatorNode = typeof separator === "function" ? separator(index) : separator;
3162
+ return /* @__PURE__ */ jsxDEV19(Fragment6, {
3163
+ children: [
3164
+ /* @__PURE__ */ jsxDEV19("span", {
3165
+ className: "hj-input-otp-cell relative inline-flex shrink-0",
3166
+ children: [
3167
+ /* @__PURE__ */ jsxDEV19(InternalInput, {
3168
+ "aria-label": `OTP Input ${index + 1}`,
3169
+ autoComplete,
3170
+ autoFocus: index === 0 && autoFocus,
3171
+ className: slotClass(classNames, "input", "hj-input-otp-input", otpCellSizeClass[mergedSize], customMask && "text-transparent caret-[var(--hj-input-fg)]"),
3172
+ disabled: mergedDisabled,
3173
+ htmlSize: 1,
3174
+ inputMode,
3175
+ onFocus: (event) => {
3176
+ for (let previous = 0;previous < index; previous += 1) {
3177
+ if (!inputRefs.current[previous]?.input?.value) {
3178
+ focusCell(previous);
3179
+ break;
3180
+ }
3181
+ }
3182
+ onFocus?.(event);
3183
+ syncSelection(index);
3184
+ },
3185
+ onInput: (event) => handleInput(index, event),
3186
+ onKeyDown: (event) => {
3187
+ if (event.key === "ArrowLeft")
3188
+ focusCell(index - 1);
3189
+ else if (event.key === "ArrowRight" && singleValue)
3190
+ focusCell(index + 1);
3191
+ else if (event.key === "Backspace" && !singleValue)
3192
+ focusCell(index - 1);
3193
+ else if (event.key === "z" && (event.ctrlKey || event.metaKey)) {
3194
+ event.preventDefault();
3195
+ }
3196
+ syncSelection(index);
3197
+ },
3198
+ onMouseDown: () => syncSelection(index),
3199
+ onMouseUp: () => syncSelection(index),
3200
+ ref: (input) => {
3201
+ inputRefs.current[index] = input;
3202
+ },
3203
+ size: mergedSize,
3204
+ status: mergedStatus,
3205
+ style: slotStyle(styles, "input"),
3206
+ type: mask === true ? "password" : type ?? "text",
3207
+ value: singleValue,
3208
+ variant
3209
+ }, undefined, false, undefined, this),
3210
+ customMask ? /* @__PURE__ */ jsxDEV19("span", {
3211
+ "aria-hidden": "true",
3212
+ className: "pointer-events-none absolute inset-0 inline-flex items-center justify-center text-[var(--hj-input-fg)]",
3213
+ children: mask
3214
+ }, undefined, false, undefined, this) : null
3215
+ ]
3216
+ }, undefined, true, undefined, this),
3217
+ index < mergedLength - 1 && separatorNode != null ? /* @__PURE__ */ jsxDEV19("span", {
3218
+ className: slotClass(classNames, "separator", "hj-input-otp-separator hj-otp-separator"),
3219
+ style: slotStyle(styles, "separator"),
3220
+ children: separatorNode
3221
+ }, undefined, false, undefined, this) : null
3222
+ ]
3223
+ }, `otp-${index}`, true, undefined, this);
3224
+ })
3225
+ }, undefined, false, undefined, this);
3226
+ });
3227
+ var Input = InternalInput;
3228
+ Input.Group = InputGroup;
3229
+ Input.OTP = InputOTP;
3230
+ Input.Password = InputPassword;
3231
+ Input.Search = InputSearch;
3232
+ Input.TextArea = InputTextArea;
3233
+
3234
+ // src/components/SelectInput.tsx
3235
+ import { jsxDEV as jsxDEV20 } from "react/jsx-dev-runtime";
3236
+ function SelectInput({
3237
+ activeFirstOption = false,
3238
+ activeValue,
3239
+ allowClear,
3240
+ autoFocus,
3241
+ className = "",
3242
+ classNames,
3243
+ defaultPopupOpen = false,
3244
+ defaultValue,
3245
+ disabled,
3246
+ displayValue,
3247
+ id,
3248
+ onBlur,
3249
+ onChange,
3250
+ onClick,
3251
+ onFocus,
3252
+ onKeyDown,
3253
+ onPopupOpenChange,
3254
+ options,
3255
+ placeholder,
3256
+ popupMatchInputWidth = true,
3257
+ popupOffset,
3258
+ popupOpen,
3259
+ prefix,
3260
+ size,
3261
+ status,
3262
+ style,
3263
+ styles,
3264
+ suffixIcon,
3265
+ tabIndex,
3266
+ title,
3267
+ value,
3268
+ variant
3269
+ }) {
3270
+ const config = useConfig();
3271
+ const mergedStatus = useMergedFormItemStatus(status);
3272
+ const mergedSize = normalizeInputSize(size ?? config.components.SelectInput?.size, config.size);
3273
+ const mergedPopupOffset = popupOffset ?? config.components.SelectInput?.popupOffset ?? 8;
3274
+ const mergedDisabled = disabled ?? config.components.SelectInput?.disabled ?? config.disabled;
3275
+ const rcOptions = options.map((option) => ({ ...option }));
3276
+ return /* @__PURE__ */ jsxDEV20(RcSelect, {
3277
+ allowClear,
3278
+ autoFocus,
3279
+ className: cn("hj-select-input-root", `hj-select-input-${mergedSize}`, mergedStatus && `hj-select-input-status-${mergedStatus}`, variant && `hj-select-input-variant-${variant}`, slotClass(classNames, "root"), className),
3280
+ classNames: { input: slotClass(classNames, "input") },
3281
+ defaultActiveFirstOption: activeFirstOption,
3282
+ defaultOpen: defaultPopupOpen,
3283
+ defaultValue,
3284
+ disabled: mergedDisabled,
3285
+ getPopupContainer: config.getPopupContainer ? () => config.getPopupContainer?.() ?? document.body : undefined,
3286
+ id,
3287
+ labelRender: displayValue === undefined ? undefined : () => displayValue,
3288
+ open: popupOpen,
3289
+ optionRender: (option) => /* @__PURE__ */ jsxDEV20("span", {
3290
+ className: cn("hj-select-input-option-content", activeValue === option.value && "hj-select-input-option-active"),
3291
+ children: [
3292
+ /* @__PURE__ */ jsxDEV20("span", {
3293
+ className: "hj-select-input-option-label",
3294
+ children: option.label
3295
+ }, undefined, false, undefined, this),
3296
+ option.data.suffix ? /* @__PURE__ */ jsxDEV20("span", {
3297
+ className: "hj-select-input-option-suffix",
3298
+ children: option.data.suffix
3299
+ }, undefined, false, undefined, this) : null
3300
+ ]
3301
+ }, undefined, true, undefined, this),
3302
+ options: rcOptions,
3303
+ placeholder,
3304
+ popupAlign: { offset: [0, mergedPopupOffset] },
3305
+ popupClassName: slotClass(classNames, "popup", "hj-select-input-popup"),
3306
+ popupMatchSelectWidth: popupMatchInputWidth,
3307
+ popupStyle: slotStyle(styles, "popup"),
3308
+ prefix,
3309
+ prefixCls: "hj-select-input",
3310
+ style: slotStyle(styles, "root", style),
3311
+ suffix: () => /* @__PURE__ */ jsxDEV20("span", {
3312
+ className: slotClass(classNames, "suffix", "hj-select-input-suffix"),
3313
+ style: slotStyle(styles, "suffix"),
3314
+ children: suffixIcon ?? /* @__PURE__ */ jsxDEV20(Icon, {
3315
+ name: "chevron-down",
3316
+ size: 16,
3317
+ strokeWidth: 2
3318
+ }, undefined, false, undefined, this)
3319
+ }, undefined, false, undefined, this),
3320
+ tabIndex,
3321
+ title,
3322
+ value,
3323
+ onBlur,
3324
+ onChange: (nextValue, option) => onChange?.(nextValue, option),
3325
+ onClick,
3326
+ onFocus,
3327
+ onKeyDown,
3328
+ onPopupVisibleChange: onPopupOpenChange
3329
+ }, undefined, false, undefined, this);
3330
+ }
3331
+ // src/components/StatCard.tsx
3332
+ import { jsxDEV as jsxDEV21 } from "react/jsx-dev-runtime";
3333
+ function StatCard({ accent, className = "", label, meta, value }) {
3334
+ return /* @__PURE__ */ jsxDEV21("div", {
3335
+ className: `rounded-[4px] border border-[#24303a] bg-[#151f29] p-3 ${className}`,
3336
+ children: [
3337
+ /* @__PURE__ */ jsxDEV21("div", {
3338
+ className: "flex items-start justify-between gap-3",
3339
+ children: [
3340
+ /* @__PURE__ */ jsxDEV21("div", {
3341
+ className: "min-w-0",
3342
+ children: [
3343
+ /* @__PURE__ */ jsxDEV21(Text, {
3344
+ as: "div",
3345
+ className: "truncate",
3346
+ variant: "muted",
3347
+ children: label
3348
+ }, undefined, false, undefined, this),
3349
+ /* @__PURE__ */ jsxDEV21(Title, {
3350
+ as: "p",
3351
+ className: "mt-1 text-2xl",
3352
+ variant: "page",
3353
+ children: value
3354
+ }, undefined, false, undefined, this)
3355
+ ]
3356
+ }, undefined, true, undefined, this),
3357
+ accent ? /* @__PURE__ */ jsxDEV21("div", {
3358
+ className: "shrink-0 text-[#d6a84a]",
3359
+ children: accent
3360
+ }, undefined, false, undefined, this) : null
3361
+ ]
3362
+ }, undefined, true, undefined, this),
3363
+ meta ? /* @__PURE__ */ jsxDEV21(Text, {
3364
+ as: "div",
3365
+ className: "mt-2 truncate",
3366
+ variant: "muted",
3367
+ children: meta
3368
+ }, undefined, false, undefined, this) : null
3369
+ ]
3370
+ }, undefined, true, undefined, this);
3371
+ }
3372
+ // src/components/StatusItem.tsx
3373
+ import { jsxDEV as jsxDEV22 } from "react/jsx-dev-runtime";
3374
+ function StatusItem({
3375
+ className = "",
3376
+ icon,
3377
+ label,
3378
+ max = 100,
3379
+ orientation,
3380
+ progress,
3381
+ value
3382
+ }) {
3383
+ if (icon === undefined && orientation === undefined && progress === undefined) {
3384
+ return /* @__PURE__ */ jsxDEV22("div", {
3385
+ className: `flex items-center justify-between gap-3 rounded-[4px] border border-[#24303a] bg-[#111923] px-3 py-2 ${className}`,
3386
+ children: [
3387
+ /* @__PURE__ */ jsxDEV22("dt", {
3388
+ className: "text-[#6f7985]",
3389
+ children: label
3390
+ }, undefined, false, undefined, this),
3391
+ /* @__PURE__ */ jsxDEV22("dd", {
3392
+ className: "font-mono text-white",
3393
+ children: value
3394
+ }, undefined, false, undefined, this)
3395
+ ]
3396
+ }, undefined, true, undefined, this);
3397
+ }
3398
+ const layoutClass = orientation === "column" ? "flex-col text-center" : "items-center";
3399
+ return /* @__PURE__ */ jsxDEV22("div", {
3400
+ className: `flex gap-3 rounded-[4px] bg-[#151f29] p-3 ${layoutClass} ${className}`,
3401
+ children: [
3402
+ icon ? /* @__PURE__ */ jsxDEV22("div", {
3403
+ className: "shrink-0",
3404
+ children: icon
3405
+ }, undefined, false, undefined, this) : null,
3406
+ /* @__PURE__ */ jsxDEV22("div", {
3407
+ className: "min-w-0 flex-1",
3408
+ children: [
3409
+ /* @__PURE__ */ jsxDEV22("div", {
3410
+ className: "flex items-center justify-between gap-2",
3411
+ children: [
3412
+ /* @__PURE__ */ jsxDEV22("span", {
3413
+ className: "truncate text-sm text-[#f2f4f6]",
3414
+ children: label
3415
+ }, undefined, false, undefined, this),
3416
+ /* @__PURE__ */ jsxDEV22("span", {
3417
+ className: "shrink-0 text-xs text-[#a5adb8]",
3418
+ children: value
3419
+ }, undefined, false, undefined, this)
3420
+ ]
3421
+ }, undefined, true, undefined, this),
3422
+ progress === undefined ? null : /* @__PURE__ */ jsxDEV22(ProgressBar, {
3423
+ className: "mt-2",
3424
+ max,
3425
+ value: progress
3426
+ }, undefined, false, undefined, this)
3427
+ ]
3428
+ }, undefined, true, undefined, this)
3429
+ ]
3430
+ }, undefined, true, undefined, this);
3431
+ }
3432
+ // src/components/TagPill.tsx
3433
+ import { jsxDEV as jsxDEV23 } from "react/jsx-dev-runtime";
3434
+ var toneClass3 = {
3435
+ amber: "border-[#6f5529] bg-[#2a2115] text-[#d6a84a]",
3436
+ slate: "border-[#3b4652] bg-[#161d24] text-[#aab0b8]",
3437
+ green: "border-[#3f6f36] bg-[#172a19] text-[#69c04a]",
3438
+ red: "border-[#ff8f86]/50 bg-[#3a2426] text-[#ff8f86]"
3439
+ };
3440
+ function TagPill({
3441
+ children,
3442
+ tone = "slate"
3443
+ }) {
3444
+ return /* @__PURE__ */ jsxDEV23("span", {
3445
+ className: `inline-flex h-5 items-center rounded-[3px] border px-1.5 text-[11px] ${toneClass3[tone]}`,
3446
+ children
3447
+ }, undefined, false, undefined, this);
3448
+ }
3449
+ // src/components/OtherPrimitives.tsx
3450
+ import { composeRefs, useControllableValue, useLatest, warning } from "@996-design/996-utils";
3451
+ import ResizeObserver2 from "@rc-component/resize-observer";
3452
+ import { raf as raf2, useEvent as useEvent2 } from "@rc-component/util";
3453
+ import { forwardRef as forwardRef6, useEffect as useEffect4, useImperativeHandle as useImperativeHandle3, useRef as useRef3, useState as useState5 } from "react";
3454
+
3455
+ // src/components/affix/utils.ts
3456
+ function getTargetRect(target) {
3457
+ if (typeof window !== "undefined" && target === window) {
3458
+ return { top: 0, bottom: window.innerHeight };
3459
+ }
3460
+ return target.getBoundingClientRect();
3461
+ }
3462
+ function getFixedTop(placeholderRect, targetRect, offsetTop) {
3463
+ if (offsetTop !== undefined && Math.round(targetRect.top) > Math.round(placeholderRect.top) - offsetTop) {
3464
+ return offsetTop + targetRect.top;
3465
+ }
3466
+ return;
3467
+ }
3468
+ function getFixedBottom(placeholderRect, targetRect, offsetBottom) {
3469
+ if (offsetBottom !== undefined && Math.round(targetRect.bottom) < Math.round(placeholderRect.bottom) + offsetBottom) {
3470
+ return offsetBottom + window.innerHeight - targetRect.bottom;
3471
+ }
3472
+ return;
3473
+ }
3474
+ function createsFixedContainingBlock(element) {
3475
+ const view = element.ownerDocument.defaultView;
3476
+ if (!view)
3477
+ return false;
3478
+ return view.getComputedStyle(element).transform !== "none";
3479
+ }
3480
+ function getFixedContainerOffset(element) {
3481
+ const view = element.ownerDocument.defaultView;
3482
+ if (!view)
3483
+ return { top: 0, bottom: 0 };
3484
+ let parent = element.parentElement;
3485
+ while (parent) {
3486
+ if (createsFixedContainingBlock(parent)) {
3487
+ const rect = parent.getBoundingClientRect();
3488
+ return {
3489
+ top: rect.top,
3490
+ bottom: view.innerHeight - rect.bottom
3491
+ };
3492
+ }
3493
+ parent = parent.parentElement;
3494
+ }
3495
+ return { top: 0, bottom: 0 };
3496
+ }
3497
+
3498
+ // src/components/OtherPrimitives.tsx
3499
+ import { jsxDEV as jsxDEV24 } from "react/jsx-dev-runtime";
3500
+ var TRIGGER_EVENTS = [
3501
+ "resize",
3502
+ "scroll",
3503
+ "touchstart",
3504
+ "touchmove",
3505
+ "touchend",
3506
+ "pageshow",
3507
+ "load"
3508
+ ];
3509
+ var AFFIX_STATUS_NONE = 0;
3510
+ var AFFIX_STATUS_PREPARE = 1;
3511
+ function getDefaultTarget() {
3512
+ return typeof window === "undefined" ? null : window;
3513
+ }
3514
+ function throttleByAnimationFrame(callback) {
3515
+ let requestId = null;
3516
+ const throttled = (...args) => {
3517
+ if (requestId !== null)
3518
+ return;
3519
+ requestId = raf2(() => {
3520
+ requestId = null;
3521
+ callback(...args);
3522
+ });
3523
+ };
3524
+ throttled.cancel = () => {
3525
+ if (requestId !== null) {
3526
+ raf2.cancel(requestId);
3527
+ }
3528
+ requestId = null;
3529
+ };
3530
+ return throttled;
3531
+ }
3532
+ function normalizeTarget(target) {
3533
+ if (typeof window !== "undefined" && target === window) {
3534
+ return window;
3535
+ }
3536
+ if (typeof HTMLElement !== "undefined" && target instanceof HTMLElement) {
3537
+ return target;
3538
+ }
3539
+ if (typeof ShadowRoot !== "undefined" && target instanceof ShadowRoot) {
3540
+ return target.host instanceof HTMLElement ? target.host : null;
3541
+ }
3542
+ return null;
3543
+ }
3544
+ var Affix = forwardRef6(function Affix2({
3545
+ children,
3546
+ className = "",
3547
+ offsetBottom,
3548
+ offsetTop,
3549
+ onChange,
3550
+ onTestUpdate,
3551
+ onTestUpdatePosition,
3552
+ prefixCls,
3553
+ rootClassName,
3554
+ style,
3555
+ target,
3556
+ ...props
3557
+ }, ref) {
3558
+ const config = useConfig();
3559
+ const componentConfig = config.components.Affix;
3560
+ const affixPrefixCls = config.getPrefixCls("affix", prefixCls);
3561
+ const [affixStyle, setAffixStyle] = useState5();
3562
+ const [placeholderStyle, setPlaceholderStyle] = useState5();
3563
+ const statusRef = useRef3(AFFIX_STATUS_NONE);
3564
+ const lastAffixRef = useRef3(false);
3565
+ const affixStyleRef = useRef3(undefined);
3566
+ const prevTargetRef = useRef3(null);
3567
+ const prevListenerRef = useRef3(null);
3568
+ const placeholderRef = useRef3(null);
3569
+ const fixedRef = useRef3(null);
3570
+ const timerRef = useRef3(null);
3571
+ affixStyleRef.current = affixStyle;
3572
+ const targetFunc = target ?? (config.getTargetContainer ? () => normalizeTarget(config.getTargetContainer?.() ?? null) : getDefaultTarget);
3573
+ const internalOffsetTop = offsetBottom === undefined && offsetTop === undefined ? 0 : offsetTop;
3574
+ const commitMeasure = useEvent2((nextAffixStyle, nextPlaceholderStyle) => {
3575
+ const nextAffix = Boolean(nextAffixStyle);
3576
+ if (lastAffixRef.current !== nextAffix) {
3577
+ lastAffixRef.current = nextAffix;
3578
+ onChange?.(nextAffix);
3579
+ }
3580
+ affixStyleRef.current = nextAffixStyle;
3581
+ setAffixStyle(nextAffixStyle);
3582
+ setPlaceholderStyle(nextPlaceholderStyle);
3583
+ });
3584
+ const measure = useEvent2(() => {
3585
+ if (statusRef.current !== AFFIX_STATUS_PREPARE || !fixedRef.current || !placeholderRef.current) {
3586
+ return;
3587
+ }
3588
+ const targetNode = targetFunc();
3589
+ const placeholderNode = placeholderRef.current;
3590
+ if (!targetNode) {
3591
+ statusRef.current = AFFIX_STATUS_NONE;
3592
+ commitMeasure();
3593
+ return;
3594
+ }
3595
+ const placeholderRect = getTargetRect(placeholderNode);
3596
+ if (placeholderRect.top === 0 && placeholderRect.left === 0 && placeholderRect.width === 0 && placeholderRect.height === 0) {
3597
+ return;
3598
+ }
3599
+ const targetRect = getTargetRect(targetNode);
3600
+ const fixedTop = getFixedTop(placeholderRect, targetRect, internalOffsetTop);
3601
+ const fixedBottom = getFixedBottom(placeholderRect, targetRect, offsetBottom);
3602
+ const containerOffset = getFixedContainerOffset(fixedRef.current);
3603
+ let nextAffixStyle;
3604
+ if (fixedTop !== undefined) {
3605
+ nextAffixStyle = {
3606
+ position: "fixed",
3607
+ top: fixedTop - containerOffset.top,
3608
+ width: placeholderRect.width,
3609
+ height: placeholderRect.height
3610
+ };
3611
+ } else if (fixedBottom !== undefined) {
3612
+ nextAffixStyle = {
3613
+ position: "fixed",
3614
+ bottom: fixedBottom - containerOffset.bottom,
3615
+ width: placeholderRect.width,
3616
+ height: placeholderRect.height
3617
+ };
3618
+ }
3619
+ statusRef.current = AFFIX_STATUS_NONE;
3620
+ commitMeasure(nextAffixStyle, nextAffixStyle ? { width: placeholderRect.width, height: placeholderRect.height } : undefined);
3621
+ });
3622
+ const prepareMeasure = useEvent2(() => {
3623
+ statusRef.current = AFFIX_STATUS_PREPARE;
3624
+ measure();
3625
+ onTestUpdate?.();
3626
+ onTestUpdatePosition?.();
3627
+ });
3628
+ const updatePositionRef = useRef3(null);
3629
+ if (!updatePositionRef.current) {
3630
+ updatePositionRef.current = throttleByAnimationFrame(prepareMeasure);
3631
+ }
3632
+ const updatePosition = updatePositionRef.current;
3633
+ const lazyMeasure = useEvent2(() => {
3634
+ const currentAffixStyle = affixStyleRef.current;
3635
+ const targetNode = targetFunc();
3636
+ const placeholderNode = placeholderRef.current;
3637
+ const fixedNode = fixedRef.current;
3638
+ if (currentAffixStyle && targetNode && placeholderNode && fixedNode) {
3639
+ const targetRect = getTargetRect(targetNode);
3640
+ const placeholderRect = getTargetRect(placeholderNode);
3641
+ const fixedTop = getFixedTop(placeholderRect, targetRect, internalOffsetTop);
3642
+ const fixedBottom = getFixedBottom(placeholderRect, targetRect, offsetBottom);
3643
+ const containerOffset = getFixedContainerOffset(fixedNode);
3644
+ if (fixedTop !== undefined && currentAffixStyle.top === fixedTop - containerOffset.top || fixedBottom !== undefined && currentAffixStyle.bottom === fixedBottom - containerOffset.bottom) {
3645
+ return;
3646
+ }
3647
+ }
3648
+ prepareMeasure();
3649
+ });
3650
+ const lazyUpdatePositionRef = useRef3(null);
3651
+ if (!lazyUpdatePositionRef.current) {
3652
+ lazyUpdatePositionRef.current = throttleByAnimationFrame(lazyMeasure);
3653
+ }
3654
+ const lazyUpdatePosition = lazyUpdatePositionRef.current;
3655
+ const removeTargetListeners = useEvent2((listenerTarget, listener) => {
3656
+ if (!listenerTarget || !listener)
3657
+ return;
3658
+ for (const eventName of TRIGGER_EVENTS) {
3659
+ listenerTarget.removeEventListener(eventName, listener);
3660
+ }
3661
+ });
3662
+ const addListeners = useEvent2(() => {
3663
+ const listenerTarget = targetFunc();
3664
+ if (!listenerTarget)
3665
+ return;
3666
+ removeTargetListeners(prevTargetRef.current, prevListenerRef.current);
3667
+ const listener = lazyUpdatePosition;
3668
+ for (const eventName of TRIGGER_EVENTS) {
3669
+ listenerTarget.addEventListener(eventName, listener);
3670
+ }
3671
+ prevTargetRef.current = listenerTarget;
3672
+ prevListenerRef.current = listener;
3673
+ });
3674
+ const removeListeners = useEvent2(() => {
3675
+ removeTargetListeners(targetFunc(), lazyUpdatePosition);
3676
+ removeTargetListeners(prevTargetRef.current, prevListenerRef.current);
3677
+ prevTargetRef.current = null;
3678
+ prevListenerRef.current = null;
3679
+ updatePosition.cancel();
3680
+ lazyUpdatePosition.cancel();
3681
+ });
3682
+ useImperativeHandle3(ref, () => ({
3683
+ nativeElement: placeholderRef.current,
3684
+ updatePosition
3685
+ }), [updatePosition]);
3686
+ useEffect4(() => {
3687
+ timerRef.current = setTimeout(addListeners);
3688
+ return () => {
3689
+ if (timerRef.current) {
3690
+ clearTimeout(timerRef.current);
3691
+ timerRef.current = null;
3692
+ }
3693
+ removeListeners();
3694
+ };
3695
+ }, [addListeners, removeListeners]);
3696
+ useEffect4(() => {
3697
+ addListeners();
3698
+ return removeListeners;
3699
+ }, [addListeners, config.getTargetContainer, removeListeners, target]);
3700
+ useEffect4(() => {
3701
+ updatePosition();
3702
+ }, [config.getTargetContainer, offsetBottom, offsetTop, target, updatePosition]);
3703
+ return /* @__PURE__ */ jsxDEV24(ResizeObserver2, {
3704
+ onResize: updatePosition,
3705
+ children: /* @__PURE__ */ jsxDEV24("div", {
3706
+ ...props,
3707
+ className: cn(className, componentConfig?.className),
3708
+ ref: placeholderRef,
3709
+ style: { ...componentConfig?.style, ...style },
3710
+ children: [
3711
+ affixStyle ? /* @__PURE__ */ jsxDEV24("div", {
3712
+ "aria-hidden": "true",
3713
+ style: placeholderStyle
3714
+ }, undefined, false, undefined, this) : null,
3715
+ /* @__PURE__ */ jsxDEV24("div", {
3716
+ className: cn(affixStyle && "hj-affix", affixStyle && affixPrefixCls !== "hj-affix" && affixPrefixCls, affixStyle && rootClassName),
3717
+ ref: fixedRef,
3718
+ style: affixStyle,
3719
+ children: /* @__PURE__ */ jsxDEV24(ResizeObserver2, {
3720
+ onResize: updatePosition,
3721
+ children
3722
+ }, undefined, false, undefined, this)
3723
+ }, undefined, false, undefined, this)
3724
+ ]
3725
+ }, undefined, true, undefined, this)
3726
+ }, undefined, false, undefined, this);
3727
+ });
3728
+ Affix.displayName = "Affix";
3729
+ function BorderBeam({
3730
+ children,
3731
+ className = "",
3732
+ duration = 2600,
3733
+ style,
3734
+ ...props
3735
+ }) {
3736
+ return /* @__PURE__ */ jsxDEV24("div", {
3737
+ className: cn("relative overflow-hidden rounded-[var(--hj-radius-md)] border border-[var(--hj-color-web-border)]", className),
3738
+ style: { "--hj-border-beam-duration": `${duration}ms`, ...style },
3739
+ ...props,
3740
+ children: [
3741
+ /* @__PURE__ */ jsxDEV24("span", {
3742
+ className: "pointer-events-none absolute inset-0 rounded-[inherit] bg-[conic-gradient(from_0deg,transparent_0deg,var(--hj-color-brand)_80deg,transparent_120deg)] opacity-60 [animation:hj-border-beam_var(--hj-border-beam-duration)_linear_infinite]"
3743
+ }, undefined, false, undefined, this),
3744
+ /* @__PURE__ */ jsxDEV24("span", {
3745
+ className: "relative z-[1] block rounded-[inherit] bg-[var(--hj-color-web-surface)]",
3746
+ children
3747
+ }, undefined, false, undefined, this)
3748
+ ]
3749
+ }, undefined, true, undefined, this);
3750
+ }
3751
+ var Util = {
3752
+ composeRefs,
3753
+ useControllableValue,
3754
+ useLatest,
3755
+ warning
3756
+ };
3757
+ // src/tokens.ts
3758
+ var themeToken = {
3759
+ color: {
3760
+ brand: "var(--hj-color-brand)",
3761
+ brandHover: "var(--hj-color-brand-hover)",
3762
+ brandActive: "var(--hj-color-brand-active)",
3763
+ brandWeak: "var(--hj-color-brand-weak)",
3764
+ success: "var(--hj-color-success)",
3765
+ warning: "var(--hj-color-warning)",
3766
+ info: "var(--hj-color-info)",
3767
+ danger: "var(--hj-color-danger)",
3768
+ dangerSoft: "var(--hj-color-danger-soft)",
3769
+ purchase: "var(--hj-color-purchase)",
3770
+ webPage: "var(--hj-color-web-page)",
3771
+ webBg: "var(--hj-color-web-bg)",
3772
+ webSurface: "var(--hj-color-web-surface)",
3773
+ webControl: "var(--hj-color-web-control)",
3774
+ webSurfaceRaised: "var(--hj-color-web-surface-raised)",
3775
+ webSurfaceActive: "var(--hj-color-web-surface-active)",
3776
+ webBorder: "var(--hj-color-web-border)",
3777
+ webBorderStrong: "var(--hj-color-web-border-strong)",
3778
+ webForeground: "var(--hj-color-web-foreground)",
3779
+ webForeground80: "var(--hj-color-web-foreground-80)",
3780
+ webMuted: "var(--hj-color-web-muted)",
3781
+ webSubtle: "var(--hj-color-web-subtle)",
3782
+ webDisabled: "var(--hj-color-web-disabled)",
3783
+ adminBrand: "var(--hj-color-admin-brand)",
3784
+ adminBrandHover: "var(--hj-color-admin-brand-hover)",
3785
+ adminBg: "var(--hj-color-admin-bg)",
3786
+ adminSurface: "var(--hj-color-admin-surface)",
3787
+ adminSurfaceMuted: "var(--hj-color-admin-surface-muted)",
3788
+ adminBorder: "var(--hj-color-admin-border)",
3789
+ adminBorderStrong: "var(--hj-color-admin-border-strong)",
3790
+ adminForeground: "var(--hj-color-admin-foreground)",
3791
+ adminMuted: "var(--hj-color-admin-muted)"
3792
+ },
3793
+ radius: {
3794
+ xs: "var(--hj-radius-xs)",
3795
+ sm: "var(--hj-radius-sm)",
3796
+ md: "var(--hj-radius-md)",
3797
+ lg: "var(--hj-radius-lg)"
3798
+ },
3799
+ button: {
3800
+ fontFamily: "var(--hj-button-font-family)",
3801
+ fontWeight: "var(--hj-button-font-weight)",
3802
+ lightFontFamily: "var(--hj-button-light-font-family)",
3803
+ lightFontWeight: "var(--hj-button-light-font-weight)",
3804
+ heightXs: "var(--hj-button-xs-height)",
3805
+ heightSm: "var(--hj-button-sm-height)",
3806
+ heightMd: "var(--hj-button-md-height)",
3807
+ heightLg: "var(--hj-button-lg-height)",
3808
+ minWidthXs: "var(--hj-button-xs-min-width)",
3809
+ minWidthSm: "var(--hj-button-sm-min-width)",
3810
+ minWidthMd: "var(--hj-button-md-min-width)",
3811
+ minWidthLg: "var(--hj-button-lg-min-width)",
3812
+ lineHeightXs: "var(--hj-button-xs-line-height)",
3813
+ lineHeightSm: "var(--hj-button-sm-line-height)",
3814
+ lineHeightMd: "var(--hj-button-md-line-height)",
3815
+ lineHeightLg: "var(--hj-button-lg-line-height)",
3816
+ primaryBg: "var(--hj-button-primary-bg)",
3817
+ primaryBgHover: "var(--hj-button-primary-bg-hover)",
3818
+ primaryBgActive: "var(--hj-button-primary-bg-active)",
3819
+ defaultBg: "var(--hj-button-default-bg)",
3820
+ defaultBgHover: "var(--hj-button-default-bg-hover)",
3821
+ defaultBgActive: "var(--hj-button-default-bg-active)",
3822
+ lightBg: "var(--hj-button-light-bg)",
3823
+ lightBgHover: "var(--hj-button-light-bg-hover)",
3824
+ lightBgActive: "var(--hj-button-light-bg-active)",
3825
+ lightBorder: "var(--hj-button-light-border)",
3826
+ lightBorderHover: "var(--hj-button-light-border-hover)",
3827
+ lightForeground: "var(--hj-button-light-fg)",
3828
+ translucentBg: "var(--hj-button-translucent-bg)",
3829
+ translucentBgHover: "var(--hj-button-translucent-bg-hover)",
3830
+ translucentBgActive: "var(--hj-button-translucent-bg-active)",
3831
+ toggleBg: "var(--hj-button-toggle-bg)",
3832
+ toggleBgHover: "var(--hj-button-toggle-bg-hover)",
3833
+ toggleBgActive: "var(--hj-button-toggle-bg-active)",
3834
+ textForeground: "var(--hj-button-text-fg)",
3835
+ textDefaultForeground: "var(--hj-button-text-default-fg)",
3836
+ groupSeparator: "var(--hj-button-group-separator)"
3837
+ },
3838
+ iconButton: {
3839
+ defaultBorder: "var(--hj-icon-button-default-border)",
3840
+ defaultBackground: "var(--hj-icon-button-default-bg)",
3841
+ defaultForeground: "var(--hj-icon-button-default-fg)",
3842
+ defaultBorderHover: "var(--hj-icon-button-default-border-hover)",
3843
+ defaultForegroundHover: "var(--hj-icon-button-default-fg-hover)",
3844
+ primaryBorder: "var(--hj-icon-button-primary-border)",
3845
+ primaryBackground: "var(--hj-icon-button-primary-bg)",
3846
+ primaryBackgroundHover: "var(--hj-icon-button-primary-bg-hover)",
3847
+ primaryForeground: "var(--hj-icon-button-primary-fg)",
3848
+ ghostBorder: "var(--hj-icon-button-ghost-border)",
3849
+ ghostBackground: "var(--hj-icon-button-ghost-bg)",
3850
+ ghostForeground: "var(--hj-icon-button-ghost-fg)",
3851
+ ghostForegroundHover: "var(--hj-icon-button-ghost-fg-hover)",
3852
+ selectedBorder: "var(--hj-icon-button-selected-border)",
3853
+ selectedBackground: "var(--hj-icon-button-selected-bg)",
3854
+ selectedForeground: "var(--hj-icon-button-selected-fg)"
3855
+ },
3856
+ input: {
3857
+ heightSm: "var(--hj-input-height-sm)",
3858
+ heightMd: "var(--hj-input-height-md)",
3859
+ heightLg: "var(--hj-input-height-lg)",
3860
+ paddingX: "var(--hj-input-padding-x)",
3861
+ gap: "var(--hj-input-gap)",
3862
+ fontSize: "var(--hj-input-font-size)",
3863
+ lineHeight: "var(--hj-input-line-height)",
3864
+ radius: "var(--hj-input-radius)",
3865
+ background: "var(--hj-input-bg)",
3866
+ backgroundActive: "var(--hj-input-bg-active)",
3867
+ border: "var(--hj-input-border)",
3868
+ borderActive: "var(--hj-input-border-active)",
3869
+ foreground: "var(--hj-input-fg)",
3870
+ placeholder: "var(--hj-input-placeholder)",
3871
+ icon: "var(--hj-input-icon)",
3872
+ clear: "var(--hj-input-clear)",
3873
+ addon: "var(--hj-input-addon)",
3874
+ addonBackground: "var(--hj-input-addon-bg)",
3875
+ addonForeground: "var(--hj-input-addon-fg)"
3876
+ },
3877
+ checkbox: {
3878
+ size: "var(--hj-checkbox-size)",
3879
+ borderWidth: "var(--hj-checkbox-border-width)",
3880
+ border: "var(--hj-checkbox-border)",
3881
+ borderHover: "var(--hj-checkbox-border-hover)",
3882
+ background: "var(--hj-checkbox-bg)",
3883
+ backgroundChecked: "var(--hj-checkbox-bg-checked)",
3884
+ icon: "var(--hj-checkbox-icon)",
3885
+ label: "var(--hj-checkbox-label)",
3886
+ labelActive: "var(--hj-checkbox-label-active)"
3887
+ },
3888
+ switch: {
3889
+ width: "var(--hj-switch-width)",
3890
+ height: "var(--hj-switch-height)",
3891
+ padding: "var(--hj-switch-padding)",
3892
+ thumbSize: "var(--hj-switch-thumb-size)",
3893
+ background: "var(--hj-switch-bg)",
3894
+ backgroundChecked: "var(--hj-switch-bg-checked)",
3895
+ thumbBackground: "var(--hj-switch-thumb-bg)"
3896
+ },
3897
+ skeleton: {
3898
+ background: "var(--hj-skeleton-bg)",
3899
+ highlight: "var(--hj-skeleton-highlight)",
3900
+ gap: "var(--hj-skeleton-gap)",
3901
+ rowHeight: "var(--hj-skeleton-row-height)",
3902
+ rowGap: "var(--hj-skeleton-row-gap)",
3903
+ titleHeight: "var(--hj-skeleton-title-height)",
3904
+ titleMargin: "var(--hj-skeleton-title-margin)",
3905
+ radius: "var(--hj-skeleton-radius)",
3906
+ radiusSquare: "var(--hj-skeleton-radius-square)",
3907
+ sizeSm: "var(--hj-skeleton-size-sm)",
3908
+ sizeMd: "var(--hj-skeleton-size-md)",
3909
+ sizeLg: "var(--hj-skeleton-size-lg)"
3910
+ },
3911
+ tooltip: {
3912
+ radius: "var(--hj-tooltip-radius)",
3913
+ height: "var(--hj-tooltip-height)",
3914
+ minWidth: "var(--hj-tooltip-min-width)",
3915
+ paddingX: "var(--hj-tooltip-padding-x)",
3916
+ arrowSize: "var(--hj-tooltip-arrow-size)",
3917
+ gap: "var(--hj-tooltip-gap)",
3918
+ lightBg: "var(--hj-tooltip-light-bg)",
3919
+ lightFg: "var(--hj-tooltip-light-fg)",
3920
+ darkBg: "var(--hj-tooltip-dark-bg)",
3921
+ darkFg: "var(--hj-tooltip-dark-fg)",
3922
+ shadow: "var(--hj-tooltip-shadow)"
3923
+ },
3924
+ message: {
3925
+ height: "var(--hj-message-height)",
3926
+ radius: "var(--hj-message-radius)",
3927
+ paddingX: "var(--hj-message-padding-x)",
3928
+ gap: "var(--hj-message-gap)",
3929
+ background: "var(--hj-message-bg)",
3930
+ foreground: "var(--hj-message-fg)",
3931
+ lightBackground: "var(--hj-message-light-bg)",
3932
+ lightForeground: "var(--hj-message-light-fg)",
3933
+ actionForeground: "var(--hj-message-action-fg)",
3934
+ closeForeground: "var(--hj-message-close-fg)",
3935
+ closeForegroundHover: "var(--hj-message-close-fg-hover)",
3936
+ iconSize: "var(--hj-message-icon-size)",
3937
+ success: "var(--hj-message-success)",
3938
+ warning: "var(--hj-message-warning)",
3939
+ error: "var(--hj-message-error)",
3940
+ info: "var(--hj-message-info)",
3941
+ shadow: "var(--hj-message-shadow)"
3942
+ },
3943
+ modal: {
3944
+ background: "var(--hj-modal-bg)",
3945
+ foreground: "var(--hj-modal-fg)",
3946
+ bodyForeground: "var(--hj-modal-body-fg)",
3947
+ paddingX: "var(--hj-modal-padding-x)",
3948
+ paddingY: "var(--hj-modal-padding-y)",
3949
+ headerHeight: "var(--hj-modal-header-height)",
3950
+ wrapPaddingY: "var(--hj-modal-wrap-padding-y)",
3951
+ closeSize: "var(--hj-modal-close-size)",
3952
+ closeInset: "var(--hj-modal-close-inset)",
3953
+ maskBackground: "var(--hj-modal-mask-bg)",
3954
+ radius: "var(--hj-modal-radius)",
3955
+ shadow: "var(--hj-modal-shadow)"
3956
+ },
3957
+ menu: {
3958
+ background: "var(--hj-menu-bg)",
3959
+ border: "var(--hj-menu-border)",
3960
+ shadow: "var(--hj-menu-shadow)",
3961
+ itemBackground: "var(--hj-menu-item-bg)",
3962
+ itemBackgroundHover: "var(--hj-menu-item-bg-hover)",
3963
+ itemBackgroundActive: "var(--hj-menu-item-bg-active)",
3964
+ itemForeground: "var(--hj-menu-item-fg)",
3965
+ itemForegroundActive: "var(--hj-menu-item-fg-active)",
3966
+ itemMuted: "var(--hj-menu-item-muted)",
3967
+ avatarBackground: "var(--hj-menu-avatar-bg)",
3968
+ avatarForeground: "var(--hj-menu-avatar-fg)",
3969
+ divider: "var(--hj-menu-divider)"
3970
+ },
3971
+ tabs: {
3972
+ lineForeground: "var(--hj-tabs-line-fg)",
3973
+ lineForegroundHover: "var(--hj-tabs-line-fg-hover)",
3974
+ lineForegroundActive: "var(--hj-tabs-line-fg-active)",
3975
+ lineInk: "var(--hj-tabs-line-ink)",
3976
+ cardBackground: "var(--hj-tabs-card-bg)",
3977
+ cardBackgroundHover: "var(--hj-tabs-card-bg-hover)",
3978
+ cardBackgroundActive: "var(--hj-tabs-card-bg-active)",
3979
+ cardForeground: "var(--hj-tabs-card-fg)",
3980
+ cardForegroundActive: "var(--hj-tabs-card-fg-active)",
3981
+ boxedBackground: "var(--hj-tabs-boxed-bg)",
3982
+ boxedBorder: "var(--hj-tabs-boxed-border)",
3983
+ boxedItemBorder: "var(--hj-tabs-boxed-item-border)",
3984
+ boxedForeground: "var(--hj-tabs-boxed-fg)",
3985
+ boxedForegroundHover: "var(--hj-tabs-boxed-fg-hover)",
3986
+ boxedForegroundActive: "var(--hj-tabs-boxed-fg-active)",
3987
+ boxedIndicatorBackground: "var(--hj-tabs-boxed-indicator-bg)",
3988
+ boxedIndicatorBorder: "var(--hj-tabs-boxed-indicator-border)",
3989
+ boxedIndicatorShadow: "var(--hj-tabs-boxed-indicator-shadow)"
3990
+ },
3991
+ shadow: {
3992
+ sm: "var(--hj-shadow-sm)",
3993
+ md: "var(--hj-shadow-md)",
3994
+ lg: "var(--hj-shadow-lg)"
3995
+ },
3996
+ spacing: {
3997
+ xs: "var(--hj-spacing-xs)",
3998
+ sm: "var(--hj-spacing-sm)",
3999
+ md: "var(--hj-spacing-md)",
4000
+ lg: "var(--hj-spacing-lg)",
4001
+ xl: "var(--hj-spacing-xl)"
4002
+ },
4003
+ zIndex: {
4004
+ dropdown: "var(--hj-z-dropdown)",
4005
+ sticky: "var(--hj-z-sticky)",
4006
+ modal: "var(--hj-z-modal)",
4007
+ toast: "var(--hj-z-toast)"
4008
+ },
4009
+ motion: {
4010
+ durationFast: "var(--hj-motion-duration-fast)",
4011
+ durationNormal: "var(--hj-motion-duration-normal)",
4012
+ durationSlow: "var(--hj-motion-duration-slow)",
4013
+ easeIn: "var(--hj-motion-ease-in)",
4014
+ easeOut: "var(--hj-motion-ease-out)",
4015
+ easeInOut: "var(--hj-motion-ease-in-out)",
4016
+ easeOutCirc: "var(--hj-motion-ease-out-circ)",
4017
+ easeInOutCirc: "var(--hj-motion-ease-in-out-circ)",
4018
+ deadline: "var(--hj-motion-deadline)"
4019
+ }
4020
+ };
4021
+ function cssVar(name, fallback) {
4022
+ return fallback ? `var(${name}, ${fallback})` : `var(${name})`;
4023
+ }
4024
+
4025
+ // src/index.ts
4026
+ var uiPackage = {
4027
+ package: "@996-design/996-ui",
4028
+ upstream: "antd@6.5.1",
4029
+ upstreamCommit: "46bfeb5c667bf701eb6941b740c96f0fdac9325b",
4030
+ componentPolicy: "exact-upstream-behavior-with-996ux-style-layer"
4031
+ };
4032
+ export {
4033
+ useReducedMotion,
4034
+ uiPackage,
4035
+ themeToken,
4036
+ getAntd996Theme,
4037
+ cssVar,
4038
+ antd996Theme,
4039
+ antd996LightTheme,
4040
+ antd996DarkTheme,
4041
+ Util,
4042
+ Title,
4043
+ Text,
4044
+ TagPill,
4045
+ StatusItem,
4046
+ StatCard,
4047
+ SelectInput,
4048
+ SegmentedTabs,
4049
+ SectionHeader,
4050
+ ProgressButton,
4051
+ ProgressBar,
4052
+ PriceText,
4053
+ Panel,
4054
+ MessageToast,
4055
+ MenuList,
4056
+ IconButton,
4057
+ Icon,
4058
+ GameCover,
4059
+ EmptyState,
4060
+ ButtonGroup
4061
+ };
4062
+
4063
+ //# debugId=1DAE6D00AEB6806564756E2164756E21