@photon-ai/pho-ui 4.26.0 → 4.27.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 (123) hide show
  1. package/README.md +2 -2
  2. package/dist/chunks/{avatar-PgBOfszL.js → avatar-BJvgi8ON.js} +24 -30
  3. package/dist/chunks/avatar-BJvgi8ON.js.map +1 -0
  4. package/dist/chunks/{basic-page-aep8pM4s.js → basic-page-DSPzDKrZ.js} +79 -82
  5. package/dist/chunks/basic-page-DSPzDKrZ.js.map +1 -0
  6. package/dist/chunks/{box-search-CMl5bQ7Y.js → box-search-DD2EPtDy.js} +18 -19
  7. package/dist/chunks/box-search-DD2EPtDy.js.map +1 -0
  8. package/dist/chunks/{calendar-DDWITGo4.js → calendar-s-QRks1Z.js} +66 -69
  9. package/dist/chunks/calendar-s-QRks1Z.js.map +1 -0
  10. package/dist/chunks/{chat-D98GCjbe.js → chat-D6SGRahp.js} +226 -276
  11. package/dist/chunks/chat-D6SGRahp.js.map +1 -0
  12. package/dist/chunks/{checkbox-D8smFViR.js → checkbox-B3fVczYP.js} +2 -2
  13. package/dist/chunks/checkbox-B3fVczYP.js.map +1 -0
  14. package/dist/chunks/{close-button-Ck4rY1Fp.js → close-button-Bwv_OoCZ.js} +2 -2
  15. package/dist/chunks/close-button-Bwv_OoCZ.js.map +1 -0
  16. package/dist/chunks/{code-block-CthLWfxd.js → code-block-CiZWZBO2.js} +169 -238
  17. package/dist/chunks/code-block-CiZWZBO2.js.map +1 -0
  18. package/dist/chunks/copy-button-DNNZu6r4.js +69 -0
  19. package/dist/chunks/copy-button-DNNZu6r4.js.map +1 -0
  20. package/dist/chunks/{data-table-C1tLUdw0.js → data-table-CshUlqIu.js} +11 -12
  21. package/dist/chunks/data-table-CshUlqIu.js.map +1 -0
  22. package/dist/chunks/{date-picker-D-sWo3i8.js → date-picker-BaAkim2u.js} +126 -151
  23. package/dist/chunks/date-picker-BaAkim2u.js.map +1 -0
  24. package/dist/chunks/{description-list-DcTvBHzI.js → description-list-VTNz1MmJ.js} +2 -2
  25. package/dist/chunks/{description-list-DcTvBHzI.js.map → description-list-VTNz1MmJ.js.map} +1 -1
  26. package/dist/chunks/{dialog-H72fZGtf.js → dialog-C116Qr0w.js} +2 -2
  27. package/dist/chunks/{dialog-H72fZGtf.js.map → dialog-C116Qr0w.js.map} +1 -1
  28. package/dist/chunks/{filter-bar-D_sBAT5Y.js → filter-bar-DI5JO1Cd.js} +63 -72
  29. package/dist/chunks/filter-bar-DI5JO1Cd.js.map +1 -0
  30. package/dist/chunks/{ghost-search-CMUI2UH0.js → ghost-search-DhADxaWi.js} +11 -12
  31. package/dist/chunks/ghost-search-DhADxaWi.js.map +1 -0
  32. package/dist/chunks/icons-eq5FZ3Yc.js +1254 -0
  33. package/dist/chunks/icons-eq5FZ3Yc.js.map +1 -0
  34. package/dist/chunks/{input-DWnb33UF.js → input-hrrPhzXp.js} +37 -56
  35. package/dist/chunks/input-hrrPhzXp.js.map +1 -0
  36. package/dist/chunks/{select-Dux2SBVc.js → select-DlyDd7AB.js} +10 -10
  37. package/dist/chunks/select-DlyDd7AB.js.map +1 -0
  38. package/dist/chunks/{sidebar-ttBkgGRh.js → sidebar-DTRcoxrB.js} +95 -111
  39. package/dist/chunks/sidebar-DTRcoxrB.js.map +1 -0
  40. package/dist/chunks/{toast-Cbnn8lcA.js → toast-Btwu5Kjk.js} +7 -7
  41. package/dist/chunks/toast-Btwu5Kjk.js.map +1 -0
  42. package/dist/chunks/{trace-ClMpG82z.js → trace-CKYAff2U.js} +498 -607
  43. package/dist/chunks/trace-CKYAff2U.js.map +1 -0
  44. package/dist/components/avatar.js +1 -1
  45. package/dist/components/button.js +1 -1
  46. package/dist/components/calendar.js +1 -1
  47. package/dist/components/chat.js +1 -1
  48. package/dist/components/checkbox.js +1 -1
  49. package/dist/components/code-block.js +1 -1
  50. package/dist/components/command.js +36 -37
  51. package/dist/components/command.js.map +1 -1
  52. package/dist/components/copy-button.js +1 -1
  53. package/dist/components/data-table.js +2 -2
  54. package/dist/components/date-picker.js +1 -1
  55. package/dist/components/description-list.js +1 -1
  56. package/dist/components/dialog.js +1 -1
  57. package/dist/components/error.js +252 -11
  58. package/dist/components/error.js.map +1 -0
  59. package/dist/components/filter-bar.js +1 -1
  60. package/dist/components/input.js +1 -1
  61. package/dist/components/notification.js +27 -34
  62. package/dist/components/notification.js.map +1 -1
  63. package/dist/components/phone-input.js +3 -4
  64. package/dist/components/phone-input.js.map +1 -1
  65. package/dist/components/scope.js +52 -53
  66. package/dist/components/scope.js.map +1 -1
  67. package/dist/components/select.js +1 -1
  68. package/dist/components/theme-toggle.js +69 -95
  69. package/dist/components/theme-toggle.js.map +1 -1
  70. package/dist/components/toast.js +1 -1
  71. package/dist/components/trace.js +1 -1
  72. package/dist/icons.js +235 -78
  73. package/dist/icons.js.map +1 -1
  74. package/dist/index.js +158 -158
  75. package/dist/sections/basic-page.js +2 -2
  76. package/dist/sections/sidebar.js +1 -1
  77. package/dist/src/components/avatar/avatar.d.ts +1 -1
  78. package/dist/src/components/notification/notification.d.ts +2 -2
  79. package/dist/src/components/trace/decorations.d.ts +3 -3
  80. package/dist/src/icons/index.d.ts +1 -0
  81. package/dist/src/icons/photon/icons.d.ts +315 -0
  82. package/dist/src/icons/photon/index.d.ts +2 -0
  83. package/dist/src/icons/photon/photon-icon.d.ts +51 -0
  84. package/package.json +5 -3
  85. package/dist/chunks/IconArrowUpRight-OK8Fp0KQ.js +0 -14
  86. package/dist/chunks/IconArrowUpRight-OK8Fp0KQ.js.map +0 -1
  87. package/dist/chunks/IconCheck-DwSMn1wK.js +0 -11
  88. package/dist/chunks/IconCheck-DwSMn1wK.js.map +0 -1
  89. package/dist/chunks/IconChevronDown-Cd68NnX2.js +0 -11
  90. package/dist/chunks/IconChevronDown-Cd68NnX2.js.map +0 -1
  91. package/dist/chunks/IconChevronLeft-CptqhdxO.js +0 -11
  92. package/dist/chunks/IconChevronLeft-CptqhdxO.js.map +0 -1
  93. package/dist/chunks/IconChevronRight-BNkXCTk6.js +0 -11
  94. package/dist/chunks/IconChevronRight-BNkXCTk6.js.map +0 -1
  95. package/dist/chunks/IconChevronUp-Bxllwz8J.js +0 -11
  96. package/dist/chunks/IconChevronUp-Bxllwz8J.js.map +0 -1
  97. package/dist/chunks/IconInfoCircle-CTAynhe8.js +0 -21
  98. package/dist/chunks/IconInfoCircle-CTAynhe8.js.map +0 -1
  99. package/dist/chunks/IconSearch-DkcWWZ1H.js +0 -14
  100. package/dist/chunks/IconSearch-DkcWWZ1H.js.map +0 -1
  101. package/dist/chunks/IconX-DnPlFC68.js +0 -14
  102. package/dist/chunks/IconX-DnPlFC68.js.map +0 -1
  103. package/dist/chunks/avatar-PgBOfszL.js.map +0 -1
  104. package/dist/chunks/basic-page-aep8pM4s.js.map +0 -1
  105. package/dist/chunks/box-search-CMl5bQ7Y.js.map +0 -1
  106. package/dist/chunks/calendar-DDWITGo4.js.map +0 -1
  107. package/dist/chunks/chat-D98GCjbe.js.map +0 -1
  108. package/dist/chunks/checkbox-D8smFViR.js.map +0 -1
  109. package/dist/chunks/close-button-Ck4rY1Fp.js.map +0 -1
  110. package/dist/chunks/code-block-CthLWfxd.js.map +0 -1
  111. package/dist/chunks/copy-button-BLvirhXk.js +0 -76
  112. package/dist/chunks/copy-button-BLvirhXk.js.map +0 -1
  113. package/dist/chunks/data-table-C1tLUdw0.js.map +0 -1
  114. package/dist/chunks/date-picker-D-sWo3i8.js.map +0 -1
  115. package/dist/chunks/error-BT71wcUd.js +0 -270
  116. package/dist/chunks/error-BT71wcUd.js.map +0 -1
  117. package/dist/chunks/filter-bar-D_sBAT5Y.js.map +0 -1
  118. package/dist/chunks/ghost-search-CMUI2UH0.js.map +0 -1
  119. package/dist/chunks/input-DWnb33UF.js.map +0 -1
  120. package/dist/chunks/select-Dux2SBVc.js.map +0 -1
  121. package/dist/chunks/sidebar-ttBkgGRh.js.map +0 -1
  122. package/dist/chunks/toast-Cbnn8lcA.js.map +0 -1
  123. package/dist/chunks/trace-ClMpG82z.js.map +0 -1
@@ -1,82 +1,15 @@
1
1
  "use client";
2
- import { t as _ } from "./cn-CPbhpG1q.js";
3
- import { a as de } from "./button-KM0lAQ4x.js";
4
- import { t as z } from "./createReactComponent-yKZn9MIX.js";
5
- import { t as me } from "./IconChevronDown-Cd68NnX2.js";
6
- import { t as he } from "./IconChevronUp-Bxllwz8J.js";
7
- import { n as fe } from "./copy-button-BLvirhXk.js";
2
+ import { t as L } from "./cn-CPbhpG1q.js";
3
+ import { a as ut } from "./button-KM0lAQ4x.js";
4
+ import { $ as dt, B as mt, F as ht, M as ft } from "./icons-eq5FZ3Yc.js";
5
+ import { t as yt } from "./createReactComponent-yKZn9MIX.js";
8
6
  import { t as d } from "./scroll-area-DjdSnx2p.js";
9
- import { n as ye } from "./toggle-DeFSPgIj.js";
7
+ import { n as gt } from "./copy-button-DNNZu6r4.js";
8
+ import { n as xt } from "./toggle-DeFSPgIj.js";
10
9
  import { t as g } from "./tooltip-4J1PUJmB.js";
11
- import { useEffect as ge, useMemo as H, useState as F, useSyncExternalStore as xe } from "react";
12
- import { Fragment as ve, jsx as o, jsxs as m } from "react/jsx-runtime";
13
- var we = [
14
- ["path", {
15
- d: "M16 4l4 0l0 4",
16
- key: "svg-0"
17
- }],
18
- ["path", {
19
- d: "M14 10l6 -6",
20
- key: "svg-1"
21
- }],
22
- ["path", {
23
- d: "M8 20l-4 0l0 -4",
24
- key: "svg-2"
25
- }],
26
- ["path", {
27
- d: "M4 20l6 -6",
28
- key: "svg-3"
29
- }],
30
- ["path", {
31
- d: "M16 20l4 0l0 -4",
32
- key: "svg-4"
33
- }],
34
- ["path", {
35
- d: "M14 14l6 6",
36
- key: "svg-5"
37
- }],
38
- ["path", {
39
- d: "M8 4l-4 0l0 4",
40
- key: "svg-6"
41
- }],
42
- ["path", {
43
- d: "M4 4l6 6",
44
- key: "svg-7"
45
- }]
46
- ], ke = z("outline", "arrows-maximize", "ArrowsMaximize", we), be = [
47
- ["path", {
48
- d: "M5 9l4 0l0 -4",
49
- key: "svg-0"
50
- }],
51
- ["path", {
52
- d: "M3 3l6 6",
53
- key: "svg-1"
54
- }],
55
- ["path", {
56
- d: "M5 15l4 0l0 4",
57
- key: "svg-2"
58
- }],
59
- ["path", {
60
- d: "M3 21l6 -6",
61
- key: "svg-3"
62
- }],
63
- ["path", {
64
- d: "M19 9l-4 0l0 -4",
65
- key: "svg-4"
66
- }],
67
- ["path", {
68
- d: "M15 9l6 -6",
69
- key: "svg-5"
70
- }],
71
- ["path", {
72
- d: "M19 15l-4 0l0 4",
73
- key: "svg-6"
74
- }],
75
- ["path", {
76
- d: "M15 15l6 6",
77
- key: "svg-7"
78
- }]
79
- ], Me = z("outline", "arrows-minimize", "ArrowsMinimize", be), Ce = [
10
+ import { useEffect as wt, useMemo as D, useState as H, useSyncExternalStore as bt } from "react";
11
+ import { Fragment as vt, jsx as o, jsxs as m } from "react/jsx-runtime";
12
+ var kt = [
80
13
  ["path", {
81
14
  d: "M4 6l16 0",
82
15
  key: "svg-0"
@@ -89,7 +22,7 @@ var we = [
89
22
  d: "M4 12h13a3 3 0 0 1 0 6h-4l2 -2m0 4l-2 -2",
90
23
  key: "svg-2"
91
24
  }]
92
- ], Ne = z("outline", "text-wrap", "TextWrap", Ce), V = {
25
+ ], Ct = yt("outline", "text-wrap", "TextWrap", kt), J = {
93
26
  json: () => import("@shikijs/langs/json"),
94
27
  jsonc: () => import("@shikijs/langs/jsonc"),
95
28
  javascript: () => import("@shikijs/langs/javascript"),
@@ -117,7 +50,7 @@ var we = [
117
50
  http: () => import("@shikijs/langs/http"),
118
51
  markdown: () => import("@shikijs/langs/markdown"),
119
52
  diff: () => import("@shikijs/langs/diff")
120
- }, K = {
53
+ }, F = {
121
54
  js: "javascript",
122
55
  ts: "typescript",
123
56
  bash: "shellscript",
@@ -133,10 +66,10 @@ var we = [
133
66
  md: "markdown",
134
67
  htm: "html"
135
68
  };
136
- function v(e) {
137
- return Object.hasOwn(K, e) ? K[e] : Object.hasOwn(V, e) ? e : null;
69
+ function w(t) {
70
+ return Object.hasOwn(F, t) ? F[t] : Object.hasOwn(J, t) ? t : null;
138
71
  }
139
- var Y = {
72
+ var V = {
140
73
  key: "text-pho-code-key",
141
74
  string: "text-pho-code-string",
142
75
  number: "text-pho-code-number",
@@ -147,17 +80,17 @@ var Y = {
147
80
  type: "text-pho-code-type",
148
81
  plain: void 0
149
82
  };
150
- function Se(e) {
151
- return `var(--color-pho-code-${e})`;
83
+ function Nt(t) {
84
+ return `var(--color-pho-code-${t})`;
152
85
  }
153
- function Te(e) {
154
- const t = e?.match(/^var\(--color-pho-code-([a-z]+)\)$/)?.[1];
155
- return t != null && t in Y && t !== "plain" ? t : "plain";
86
+ function St(t) {
87
+ const e = t?.match(/^var\(--color-pho-code-([a-z]+)\)$/)?.[1];
88
+ return e != null && e in V && e !== "plain" ? e : "plain";
156
89
  }
157
- var s = (e, t) => ({
158
- scope: t,
159
- settings: { foreground: e === "plain" ? "var(--color-pho-code-fg)" : Se(e) }
160
- }), Ee = {
90
+ var s = (t, e) => ({
91
+ scope: e,
92
+ settings: { foreground: t === "plain" ? "var(--color-pho-code-fg)" : Nt(t) }
93
+ }), Tt = {
161
94
  name: "pho",
162
95
  type: "light",
163
96
  fg: "var(--color-pho-code-fg)",
@@ -229,33 +162,33 @@ var s = (e, t) => ({
229
162
  "meta.brace"
230
163
  ])
231
164
  ]
232
- }, C = null, U = null, N = /* @__PURE__ */ new Set(), T = /* @__PURE__ */ new Map();
233
- function _e() {
234
- return U ??= Promise.all([import("shiki/core"), import("shiki/engine/javascript")]).then(([{ createHighlighterCore: e }, { createJavaScriptRegexEngine: t }]) => e({
235
- themes: [Ee],
165
+ }, N = null, K = null, S = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Map();
166
+ function Et() {
167
+ return K ??= Promise.all([import("shiki/core"), import("shiki/engine/javascript")]).then(([{ createHighlighterCore: t }, { createJavaScriptRegexEngine: e }]) => t({
168
+ themes: [Tt],
236
169
  langs: [],
237
- engine: t({ forgiving: !0 })
238
- })).then((e) => (C = e, e)), U;
170
+ engine: e({ forgiving: !0 })
171
+ })).then((t) => (N = t, t)), K;
239
172
  }
240
- function Ae(e) {
241
- const t = v(e);
242
- if (t == null || N.has(t)) return Promise.resolve();
243
- let n = T.get(t);
244
- return n == null && (n = Promise.all([_e(), V[t]()]).then(([r, a]) => r.loadLanguage(...a.default)).then(() => {
245
- N.add(t);
173
+ function Ot(t) {
174
+ const e = w(t);
175
+ if (e == null || S.has(e)) return Promise.resolve();
176
+ let n = E.get(e);
177
+ return n == null && (n = Promise.all([Et(), J[e]()]).then(([r, a]) => r.loadLanguage(...a.default)).then(() => {
178
+ S.add(e);
246
179
  }).finally(() => {
247
- T.delete(t);
248
- }), T.set(t, n)), n;
180
+ E.delete(e);
181
+ }), E.set(e, n)), n;
249
182
  }
250
- function ot(e) {
251
- const t = v(e);
252
- return t != null && C != null && N.has(t);
183
+ function ee(t) {
184
+ const e = w(t);
185
+ return e != null && N != null && S.has(e);
253
186
  }
254
- function Oe(e) {
255
- return e.map((t) => {
187
+ function Lt(t) {
188
+ return t.map((e) => {
256
189
  const n = [];
257
- for (const r of t) {
258
- const a = Te(r.color), i = n[n.length - 1];
190
+ for (const r of e) {
191
+ const a = St(r.color), i = n[n.length - 1];
259
192
  i != null && i.type === a ? i.text += r.content : n.push({
260
193
  type: a,
261
194
  text: r.content
@@ -264,253 +197,251 @@ function Oe(e) {
264
197
  return n;
265
198
  });
266
199
  }
267
- function Q(e, t) {
268
- const n = v(t);
269
- return n == null || C == null || !N.has(n) ? null : Oe(C.codeToTokensBase(e, {
200
+ function Y(t, e) {
201
+ const n = w(e);
202
+ return n == null || N == null || !S.has(n) ? null : Lt(N.codeToTokensBase(t, {
270
203
  lang: n,
271
204
  theme: "pho"
272
205
  }));
273
206
  }
274
- function A(e) {
275
- return e.split(`
276
- `).map((t) => [{
207
+ function M(t) {
208
+ return t.split(`
209
+ `).map((e) => [{
277
210
  type: "plain",
278
- text: t
211
+ text: e
279
212
  }]);
280
213
  }
281
- async function ze(e, t) {
282
- return v(t) == null ? A(e) : (await Ae(t), Q(e, t) ?? A(e));
214
+ async function Mt(t, e) {
215
+ return w(e) == null ? M(t) : (await Ot(e), Y(t, e) ?? M(t));
283
216
  }
284
- var Le = 200, h = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Set();
285
- function q(e, t) {
286
- const n = h.get(e);
217
+ var jt = 200, h = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Set();
218
+ function U(t, e) {
219
+ const n = h.get(t);
287
220
  if (n != null) return n;
288
- if (h.size >= Le) {
221
+ if (h.size >= jt) {
289
222
  const r = h.keys().next().value;
290
223
  r != null && h.delete(r);
291
224
  }
292
- return h.set(e, t), t;
225
+ return h.set(t, e), e;
293
226
  }
294
- function je(e) {
295
- return O.add(e), () => {
296
- O.delete(e);
227
+ function _t(t) {
228
+ return j.add(t), () => {
229
+ j.delete(t);
297
230
  };
298
231
  }
299
- function $e() {
300
- for (const e of O) e();
232
+ function At() {
233
+ for (const t of j) t();
301
234
  }
302
- function Ie(e, t) {
303
- return `${e}\0${t}`;
235
+ function It(t, e) {
236
+ return `${t}\0${e}`;
304
237
  }
305
- function Pe(e, t) {
306
- const n = v(t), r = n != null ? Ie(n, e) : null, a = xe(je, () => {
238
+ function $t(t, e) {
239
+ const n = w(e), r = n != null ? It(n, t) : null, a = bt(_t, () => {
307
240
  if (r == null) return null;
308
241
  const i = h.get(r);
309
242
  if (i != null) return i;
310
- const l = Q(e, t);
311
- return l != null ? q(r, l) : null;
243
+ const l = Y(t, e);
244
+ return l != null ? U(r, l) : null;
312
245
  }, () => null);
313
- return ge(() => {
314
- r == null || h.has(r) || ze(e, t).then((i) => {
315
- q(r, i), $e();
246
+ return wt(() => {
247
+ r == null || h.has(r) || Mt(t, e).then((i) => {
248
+ U(r, i), At();
316
249
  }, () => {
317
250
  });
318
251
  }, [
319
252
  r,
320
- e,
321
- t
253
+ t,
254
+ e
322
255
  ]), a;
323
256
  }
324
- var E = /("(?:[^"\\]|\\.)*")(\s*:)?|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)|\b(true|false|null)\b|([{}[\]:,])/g;
325
- function Re(e) {
326
- const t = [];
257
+ var O = /("(?:[^"\\]|\\.)*")(\s*:)?|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)|\b(true|false|null)\b|([{}[\]:,])/g;
258
+ function Pt(t) {
259
+ const e = [];
327
260
  let n = 0;
328
- E.lastIndex = 0;
329
- for (let r = E.exec(e); r != null; r = E.exec(e)) {
330
- r.index > n && t.push({
261
+ O.lastIndex = 0;
262
+ for (let r = O.exec(t); r != null; r = O.exec(t)) {
263
+ r.index > n && e.push({
331
264
  type: "plain",
332
- text: e.slice(n, r.index)
265
+ text: t.slice(n, r.index)
333
266
  });
334
- const [, a, i, l, f, w] = r;
335
- a != null ? (t.push({
267
+ const [, a, i, l, f, b] = r;
268
+ a != null ? (e.push({
336
269
  type: i != null ? "key" : "string",
337
270
  text: a
338
- }), i != null && t.push({
271
+ }), i != null && e.push({
339
272
  type: "punctuation",
340
273
  text: i
341
- })) : l != null ? t.push({
274
+ })) : l != null ? e.push({
342
275
  type: "number",
343
276
  text: l
344
- }) : f != null ? t.push({
277
+ }) : f != null ? e.push({
345
278
  type: "keyword",
346
279
  text: f
347
- }) : w != null && t.push({
280
+ }) : b != null && e.push({
348
281
  type: "punctuation",
349
- text: w
282
+ text: b
350
283
  }), n = r.index + r[0].length;
351
284
  }
352
- return n < e.length && t.push({
285
+ return n < t.length && e.push({
353
286
  type: "plain",
354
- text: e.slice(n)
355
- }), t;
287
+ text: t.slice(n)
288
+ }), e;
356
289
  }
357
- var Ge = "rounded-base border border-pho-secondary bg-pho-code-bg text-pho-code-fg", We = "1.25rem", Be = "0.75rem";
358
- function De(e) {
359
- if (e == null) return "";
360
- if (typeof e == "string") return e;
290
+ var zt = "rounded-base border border-pho-secondary bg-pho-code-bg text-pho-code-fg", Rt = "1.25rem", Bt = "0.75rem";
291
+ function Gt(t) {
292
+ if (t == null) return "";
293
+ if (typeof t == "string") return t;
361
294
  try {
362
- return JSON.stringify(e, null, 2) ?? "";
295
+ return JSON.stringify(t, null, 2) ?? "";
363
296
  } catch {
364
- return String(e);
297
+ return String(t);
365
298
  }
366
299
  }
367
- function He(e, t) {
368
- return t === "json" || t === "jsonc" ? e.split(`
369
- `).map((n) => Re(n)) : A(e);
300
+ function Wt(t, e) {
301
+ return e === "json" || e === "jsonc" ? t.split(`
302
+ `).map((n) => Pt(n)) : M(t);
370
303
  }
371
- var Fe = [
304
+ var Dt = [
372
305
  void 0,
373
306
  "pr-12",
374
307
  "pr-20",
375
308
  "pr-28"
376
309
  ];
377
- function J({ label: e, pressed: t, onPressedChange: n, children: r }) {
378
- return /* @__PURE__ */ m(g.Root, { children: [/* @__PURE__ */ o(g.Trigger, { render: /* @__PURE__ */ o(ye, {
310
+ function q({ label: t, pressed: e, onPressedChange: n, children: r }) {
311
+ return /* @__PURE__ */ m(g.Root, { children: [/* @__PURE__ */ o(g.Trigger, { render: /* @__PURE__ */ o(xt, {
379
312
  size: "sm",
380
- pressed: t,
313
+ pressed: e,
381
314
  onPressedChange: n,
382
- "aria-label": e,
315
+ "aria-label": t,
383
316
  className: "rounded-sm",
384
317
  children: r
385
- }) }), /* @__PURE__ */ o(g.Portal, { children: /* @__PURE__ */ o(g.Positioner, { children: /* @__PURE__ */ o(g.Popup, { children: e }) }) })] });
318
+ }) }), /* @__PURE__ */ o(g.Portal, { children: /* @__PURE__ */ o(g.Positioner, { children: /* @__PURE__ */ o(g.Popup, { children: t }) }) })] });
386
319
  }
387
- function Ke({ lines: e, lineNumbers: t, digits: n, wrap: r }) {
388
- return /* @__PURE__ */ o("code", { children: e.map((a, i) => /* @__PURE__ */ m("span", {
320
+ function Ht({ lines: t, lineNumbers: e, digits: n, wrap: r }) {
321
+ return /* @__PURE__ */ o("code", { children: t.map((a, i) => /* @__PURE__ */ m("span", {
389
322
  "data-line": "",
390
- className: _("min-h-5", t ? "flex items-start" : "block", t && !r && "min-w-max"),
391
- children: [t ? /* @__PURE__ */ o("span", {
323
+ className: L("min-h-5", e ? "flex items-start" : "block", e && !r && "min-w-max"),
324
+ children: [e ? /* @__PURE__ */ o("span", {
392
325
  "data-line-number": "",
393
326
  "aria-hidden": !0,
394
327
  className: "text-pho-placeholder bg-pho-code-bg sticky left-0 z-[1] box-content shrink-0 pr-3 pl-3 text-right font-mono text-xs leading-5 tabular-nums select-none",
395
328
  style: { width: `${n}ch` },
396
329
  children: i + 1
397
330
  }) : null, /* @__PURE__ */ o("span", {
398
- className: t ? "min-w-0 flex-1" : void 0,
331
+ className: e ? "min-w-0 flex-1" : void 0,
399
332
  children: a.map((l, f) => l.type === "plain" ? l.text : /* @__PURE__ */ o("span", {
400
- className: Y[l.type],
333
+ className: V[l.type],
401
334
  children: l.text
402
335
  }, f))
403
336
  })]
404
337
  }, i)) });
405
338
  }
406
- function Ue({ code: e, language: t = "text", title: n, maxLines: r = 30, overflow: a = "scroll", wrap: i, defaultWrap: l = !1, onWrapChange: f, expandToggle: w = !0, wrapToggle: X = !0, lineNumbers: L = !1, copy: Z = !0, empty: ee = "Nothing to show.", actions: S, className: te, ...ne }) {
407
- const x = H(() => De(e), [e]), y = Pe(x, t), c = H(() => {
408
- const u = He(x, t);
339
+ function Ft({ code: t, language: e = "text", title: n, maxLines: r = 30, overflow: a = "scroll", wrap: i, defaultWrap: l = !1, onWrapChange: f, expandToggle: b = !0, wrapToggle: Q = !0, lineNumbers: _ = !1, copy: X = !0, empty: Z = "Nothing to show.", actions: T, className: tt, ...et }) {
340
+ const x = D(() => Gt(t), [t]), y = $t(x, e), c = D(() => {
341
+ const u = Wt(x, e);
409
342
  return y != null && y.length === u.length ? y : u;
410
343
  }, [
411
344
  x,
412
- t,
345
+ e,
413
346
  y
414
- ]), [re, oe] = F(l), k = i ?? re, ie = (u) => {
415
- i == null && oe(u), f?.(u);
416
- }, [p, j] = F(!1), b = c.length > r, $ = a === "scroll" && b && !p, ae = a === "expand" && b && !p ? c.slice(0, r) : c, M = x === "", I = a === "scroll" && w && b && !M, P = X && !M, R = Z && !M, G = n != null, W = Number(I) + Number(P) + Number(R), le = S != null || W > 0, se = typeof n == "string" ? n.toLowerCase() : "code", pe = typeof n == "string" ? n : "Code", ce = p ? `Collapse to ${r} lines` : `Show all ${c.length} lines`, ue = String(Math.max(c.length, 1)).length, B = /* @__PURE__ */ m(ve, { children: [
417
- S,
418
- /* @__PURE__ */ m(g.Provider, { children: [I ? /* @__PURE__ */ o(J, {
419
- label: ce,
347
+ ]), [nt, rt] = H(l), v = i ?? nt, ot = (u) => {
348
+ i == null && rt(u), f?.(u);
349
+ }, [p, A] = H(!1), k = c.length > r, I = a === "scroll" && k && !p, it = a === "expand" && k && !p ? c.slice(0, r) : c, C = x === "", $ = a === "scroll" && b && k && !C, P = Q && !C, z = X && !C, R = n != null, B = Number($) + Number(P) + Number(z), at = T != null || B > 0, lt = typeof n == "string" ? n.toLowerCase() : "code", st = typeof n == "string" ? n : "Code", pt = p ? `Collapse to ${r} lines` : `Show all ${c.length} lines`, ct = String(Math.max(c.length, 1)).length, G = /* @__PURE__ */ m(vt, { children: [
350
+ T,
351
+ /* @__PURE__ */ m(g.Provider, { children: [$ ? /* @__PURE__ */ o(q, {
352
+ label: pt,
420
353
  pressed: p,
421
- onPressedChange: j,
422
- children: p ? /* @__PURE__ */ o(Me, { "aria-hidden": !0 }) : /* @__PURE__ */ o(ke, { "aria-hidden": !0 })
423
- }) : null, P ? /* @__PURE__ */ o(J, {
354
+ onPressedChange: A,
355
+ children: p ? /* @__PURE__ */ o(mt, { "aria-hidden": !0 }) : /* @__PURE__ */ o(dt, { "aria-hidden": !0 })
356
+ }) : null, P ? /* @__PURE__ */ o(q, {
424
357
  label: "Wrap long lines",
425
- pressed: k,
426
- onPressedChange: ie,
427
- children: /* @__PURE__ */ o(Ne, { "aria-hidden": !0 })
358
+ pressed: v,
359
+ onPressedChange: ot,
360
+ children: /* @__PURE__ */ o(Ct, { "aria-hidden": !0 })
428
361
  }) : null] }),
429
- R ? /* @__PURE__ */ o(fe, {
362
+ z ? /* @__PURE__ */ o(gt, {
430
363
  value: x,
431
- label: se,
364
+ label: lt,
432
365
  size: "md"
433
366
  }) : null
434
- ] }), D = /* @__PURE__ */ o("pre", {
435
- className: _("m-0 min-w-0 py-3 font-mono text-xs leading-5", L ? "pr-3 pl-0" : "px-3", !G && Fe[Math.min(W + (S != null ? 1 : 0), 3)], k ? "[overflow-wrap:anywhere] whitespace-pre-wrap" : $ ? "w-max min-w-full whitespace-pre" : "max-w-full overflow-x-auto whitespace-pre"),
436
- children: /* @__PURE__ */ o(Ke, {
437
- lines: ae,
438
- lineNumbers: L,
439
- digits: ue,
440
- wrap: k
367
+ ] }), W = /* @__PURE__ */ o("pre", {
368
+ className: L("m-0 min-w-0 py-3 font-mono text-xs leading-5", _ ? "pr-3 pl-0" : "px-3", !R && Dt[Math.min(B + (T != null ? 1 : 0), 3)], v ? "[overflow-wrap:anywhere] whitespace-pre-wrap" : I ? "w-max min-w-full whitespace-pre" : "max-w-full overflow-x-auto whitespace-pre"),
369
+ children: /* @__PURE__ */ o(Ht, {
370
+ lines: it,
371
+ lineNumbers: _,
372
+ digits: ct,
373
+ wrap: v
441
374
  })
442
375
  });
443
376
  return /* @__PURE__ */ m("div", {
444
377
  "data-code-block": "",
445
- "data-language": t,
378
+ "data-language": e,
446
379
  "data-overflow": a,
447
380
  "data-highlighted": y != null && c === y ? "" : void 0,
448
- className: _(Ge, "relative flex w-full min-w-0 flex-col overflow-hidden", te),
449
- ...ne,
381
+ className: L(zt, "relative flex w-full min-w-0 flex-col overflow-hidden", tt),
382
+ ...et,
450
383
  children: [
451
- G ? /* @__PURE__ */ m("div", {
384
+ R ? /* @__PURE__ */ m("div", {
452
385
  className: "border-pho-secondary flex min-h-10 items-center gap-2 border-b py-1 pr-1.5 pl-3",
453
386
  children: [/* @__PURE__ */ o("div", {
454
387
  className: "text-pho-secondary min-w-0 flex-1 truncate text-xs font-medium",
455
388
  children: n
456
- }), B]
457
- }) : le ? /* @__PURE__ */ o("div", {
389
+ }), G]
390
+ }) : at ? /* @__PURE__ */ o("div", {
458
391
  className: "bg-pho-code-bg absolute top-1 right-1.5 z-10 flex items-center gap-2 rounded-sm",
459
- children: B
392
+ children: G
460
393
  }) : null,
461
- M ? /* @__PURE__ */ o("p", {
394
+ C ? /* @__PURE__ */ o("p", {
462
395
  className: "text-pho-description m-0 px-3 py-3 text-base",
463
- children: ee
464
- }) : $ ? /* @__PURE__ */ o("section", {
396
+ children: Z
397
+ }) : I ? /* @__PURE__ */ o("section", {
465
398
  className: "min-w-0",
466
399
  children: /* @__PURE__ */ m(d.Root, {
467
400
  fade: !1,
468
401
  "data-code-scroll": "",
469
402
  className: "min-w-0 rounded-b-[inherit]",
470
- style: { height: `calc(${r} * ${We} + ${Be} * 2)` },
403
+ style: { height: `calc(${r} * ${Rt} + ${Bt} * 2)` },
471
404
  children: [
472
405
  /* @__PURE__ */ o(d.Viewport, {
473
406
  tabIndex: 0,
474
- "aria-label": pe,
475
- children: /* @__PURE__ */ o(d.Content, { children: D })
407
+ "aria-label": st,
408
+ children: /* @__PURE__ */ o(d.Content, { children: W })
476
409
  }),
477
410
  /* @__PURE__ */ o(d.Scrollbar, { children: /* @__PURE__ */ o(d.Thumb, {}) }),
478
- k ? null : /* @__PURE__ */ o(d.Scrollbar, {
411
+ v ? null : /* @__PURE__ */ o(d.Scrollbar, {
479
412
  orientation: "horizontal",
480
413
  children: /* @__PURE__ */ o(d.Thumb, {})
481
414
  })
482
415
  ]
483
416
  })
484
- }) : D,
485
- a === "expand" && b ? /* @__PURE__ */ o("div", {
417
+ }) : W,
418
+ a === "expand" && k ? /* @__PURE__ */ o("div", {
486
419
  className: "border-pho-secondary flex items-center border-t px-1.5 py-1",
487
- children: /* @__PURE__ */ o(de, {
420
+ children: /* @__PURE__ */ o(ut, {
488
421
  variant: "ghost",
489
422
  size: "sm",
490
423
  "aria-expanded": p,
491
- prefix: p ? he : me,
492
- onClick: () => j((u) => !u),
424
+ prefix: p ? ht : ft,
425
+ onClick: () => A((u) => !u),
493
426
  children: p ? "Show less" : `Show all ${c.length} lines`
494
427
  })
495
428
  }) : null
496
429
  ]
497
430
  });
498
431
  }
499
- Ue.displayName = "CodeBlock";
432
+ Ft.displayName = "CodeBlock";
500
433
  export {
501
- ot as a,
502
- Y as c,
503
- v as d,
504
- Me as f,
505
- Q as i,
506
- V as l,
507
- Re as n,
508
- Ae as o,
509
- ke as p,
510
- ze as r,
511
- Pe as s,
512
- Ue as t,
513
- K as u
434
+ ee as a,
435
+ V as c,
436
+ w as d,
437
+ Y as i,
438
+ J as l,
439
+ Pt as n,
440
+ Ot as o,
441
+ Mt as r,
442
+ $t as s,
443
+ Ft as t,
444
+ F as u
514
445
  };
515
446
 
516
- //# sourceMappingURL=code-block-CthLWfxd.js.map
447
+ //# sourceMappingURL=code-block-CiZWZBO2.js.map