@tangle-network/ui 11.9.0 → 11.11.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 (155) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +14 -0
  3. package/dist/active-sessions-store-Gt1R0rFG.js +262 -0
  4. package/dist/{active-sessions-store-CeOmXgv5.d.ts → active-sessions-store-nl70ZnMC.d.ts} +40 -41
  5. package/dist/artifact-pane-BL_DFWNl.d.ts +32 -0
  6. package/dist/artifact-pane-DMXT9a8U.js +70 -0
  7. package/dist/auth-DixfCMCk.js +154 -0
  8. package/dist/auth.d.ts +2 -74
  9. package/dist/auth.js +2 -15
  10. package/dist/branding-26d5ARIr.d.ts +14 -0
  11. package/dist/button-uhNnwdsD.js +78 -0
  12. package/dist/button-yoIv77e2.d.ts +16 -0
  13. package/dist/chat-CPLL0Fd9.js +667 -0
  14. package/dist/chat.d.ts +2 -201
  15. package/dist/chat.js +2 -30
  16. package/dist/code-block-B9miUPht.d.ts +23 -0
  17. package/dist/code-block-CngSn37j.js +165 -0
  18. package/dist/diff-preview-cySuqowW.js +533 -0
  19. package/dist/document-editor-pane-BcoABlhn.d.ts +131 -0
  20. package/dist/document-editor-pane-Cz6oEF1o.js +1287 -0
  21. package/dist/dropdown-menu-BpcLa5vF.js +101 -0
  22. package/dist/editor.d.ts +76 -78
  23. package/dist/editor.js +2 -33
  24. package/dist/file-format-BgXbr-Ib.js +160 -0
  25. package/dist/files-CYlOo0mE.js +743 -0
  26. package/dist/files.d.ts +2 -243
  27. package/dist/files.js +3 -40
  28. package/dist/focus-Cw02pNSr.js +56 -0
  29. package/dist/format-DfcLWqMa.js +54 -0
  30. package/dist/hooks.d.ts +30 -37
  31. package/dist/hooks.js +111 -45
  32. package/dist/index-2UntyjBb.d.ts +52 -0
  33. package/dist/index-COgqsFAQ.d.ts +42 -0
  34. package/dist/index-CPDET_s1.d.ts +549 -0
  35. package/dist/index-CUhfHT_V.d.ts +204 -0
  36. package/dist/index-Cg6gYAqh.d.ts +73 -0
  37. package/dist/index-Cq-EJzqW.d.ts +16 -0
  38. package/dist/index-DhYmSaLF.d.ts +245 -0
  39. package/dist/index-DjKxO357.d.ts +128 -0
  40. package/dist/index-b56ew9aF.d.ts +107 -0
  41. package/dist/index.d.ts +26 -43
  42. package/dist/index.js +35 -460
  43. package/dist/markdown-BprL96Gl.js +45 -0
  44. package/dist/markdown.d.ts +3 -18
  45. package/dist/markdown.js +3 -14
  46. package/dist/message-vhUI0c5G.d.ts +16 -0
  47. package/dist/nav.d.ts +6 -8
  48. package/dist/nav.js +29 -11
  49. package/dist/openui-artifact-renderer-D3E5bIAI.d.ts +114 -0
  50. package/dist/openui-artifact-renderer-DT4xbvWt.js +266 -0
  51. package/dist/openui.d.ts +2 -115
  52. package/dist/openui.js +2 -12
  53. package/dist/parts-5mhy9yJ3.d.ts +37 -0
  54. package/dist/primitives-DE-blUz-.js +1239 -0
  55. package/dist/primitives.d.ts +5 -523
  56. package/dist/primitives.js +9 -211
  57. package/dist/redaction-CGGB2ENG.js +74 -0
  58. package/dist/redaction.d.ts +2 -42
  59. package/dist/redaction.js +2 -7
  60. package/dist/run-OyWmIDqu.d.ts +41 -0
  61. package/dist/run-ZsIKPA6J.js +17 -0
  62. package/dist/run-group-D1InSdQu.js +410 -0
  63. package/dist/run.d.ts +3 -126
  64. package/dist/run.js +5 -39
  65. package/dist/sdk-hooks.d.ts +2 -285
  66. package/dist/sdk-hooks.js +3 -35
  67. package/dist/stores.d.ts +13 -14
  68. package/dist/stores.js +34 -76
  69. package/dist/table-DHyqDPbU.js +146 -0
  70. package/dist/tabs-ujuqAdtb.js +40 -0
  71. package/dist/text-shimmer-BUUo6I-g.js +64 -0
  72. package/dist/tool-call-feed-BeB1_4pX.d.ts +47 -0
  73. package/dist/tool-call-feed-C1W1N54c.js +109 -0
  74. package/dist/tool-call-step-Bi3_YJRV.js +434 -0
  75. package/dist/tool-display-BAuAVa43.js +158 -0
  76. package/dist/{tool-display-z4JcDmMQ.d.ts → tool-display-DgmL5rIU.d.ts} +16 -16
  77. package/dist/tool-previews.d.ts +2 -48
  78. package/dist/tool-previews.js +2 -22
  79. package/dist/types.d.ts +6 -19
  80. package/dist/types.js +0 -1
  81. package/dist/use-auto-scroll-C5Pjeqon.js +153 -0
  82. package/dist/use-sse-stream-BjVBDbxK.js +884 -0
  83. package/dist/use-sse-stream-Dm6R5YWz.d.ts +282 -0
  84. package/dist/utils-Bl_CZ0Qp.js +37 -0
  85. package/dist/{chunk-RQHJBTEU.js → utils-C_uf36nf.js} +4 -6
  86. package/dist/utils.d.ts +2 -51
  87. package/dist/utils.js +6 -32
  88. package/package.json +39 -41
  89. package/src/auth/auth.tsx +5 -1
  90. package/src/chat/agent-timeline.tsx +6 -1
  91. package/src/chat/chat-container.tsx +2 -1
  92. package/src/editor/document-editor-pane.test.tsx +3 -1
  93. package/src/editor/document-editor-pane.tsx +5 -1
  94. package/src/editor/markdown-document-editor.test.tsx +9 -4
  95. package/src/files/file-artifact-pane.tsx +3 -2
  96. package/src/files/file-preview.tsx +3 -1
  97. package/src/files/file-tabs.tsx +9 -2
  98. package/src/lib/focus.ts +63 -0
  99. package/src/markdown/code-block.tsx +5 -1
  100. package/src/primitives/badge.tsx +2 -1
  101. package/src/primitives/button.tsx +2 -1
  102. package/src/primitives/card.tsx +1 -2
  103. package/src/primitives/dialog.tsx +7 -1
  104. package/src/primitives/input.tsx +15 -14
  105. package/src/primitives/segmented-control.tsx +5 -3
  106. package/src/primitives/select.tsx +3 -1
  107. package/src/primitives/switch.tsx +3 -1
  108. package/src/primitives/tabs.tsx +6 -4
  109. package/src/primitives/terminal-display.tsx +6 -8
  110. package/src/primitives/toast.tsx +5 -1
  111. package/src/tool-previews/command-preview.tsx +5 -1
  112. package/src/tool-previews/web-search-preview.tsx +2 -1
  113. package/src/utils/index.ts +7 -0
  114. package/dist/artifact-pane-DpuWcAiF.d.ts +0 -33
  115. package/dist/button-CMQuQEW_.d.ts +0 -17
  116. package/dist/chunk-34A66VBG.js +0 -214
  117. package/dist/chunk-3OI2QKFD.js +0 -0
  118. package/dist/chunk-3TI5DEHV.js +0 -299
  119. package/dist/chunk-4CLN43XT.js +0 -45
  120. package/dist/chunk-565EATZZ.js +0 -156
  121. package/dist/chunk-5Z5ZYMOJ.js +0 -0
  122. package/dist/chunk-6BGQA4BQ.js +0 -0
  123. package/dist/chunk-7YOCS6IF.js +0 -728
  124. package/dist/chunk-EOAX2ENE.js +0 -60
  125. package/dist/chunk-GYPQXTJU.js +0 -230
  126. package/dist/chunk-HFL6R6IF.js +0 -37
  127. package/dist/chunk-HGML45QH.js +0 -104
  128. package/dist/chunk-KNYSKNZX.js +0 -550
  129. package/dist/chunk-L57WRIND.js +0 -59
  130. package/dist/chunk-LDLOJKPC.js +0 -1585
  131. package/dist/chunk-LTEKI7YJ.js +0 -59
  132. package/dist/chunk-MKTSMWVD.js +0 -109
  133. package/dist/chunk-ND3ZFXQK.js +0 -179
  134. package/dist/chunk-NKDZ7GZE.js +0 -192
  135. package/dist/chunk-NWECTSOH.js +0 -589
  136. package/dist/chunk-OEX7NZE3.js +0 -321
  137. package/dist/chunk-Q56BYXQF.js +0 -61
  138. package/dist/chunk-REJESC5U.js +0 -117
  139. package/dist/chunk-RQGKSCEZ.js +0 -0
  140. package/dist/chunk-TN4FUEWY.js +0 -437
  141. package/dist/chunk-VPWY4I5O.js +0 -1048
  142. package/dist/chunk-WUQDUBJG.js +0 -168
  143. package/dist/chunk-XGKULLYE.js +0 -40
  144. package/dist/chunk-XU3HB5QL.js +0 -127
  145. package/dist/chunk-XYAIX4SU.js +0 -133
  146. package/dist/chunk-YJ6RE5WV.js +0 -875
  147. package/dist/chunk-YTO5V6QS.js +0 -19
  148. package/dist/chunk-ZKCEAIIZ.js +0 -1395
  149. package/dist/code-block-0kSpWMnf.d.ts +0 -25
  150. package/dist/document-editor-pane-EX25CEYW.js +0 -12
  151. package/dist/document-editor-pane-IAEQn_Dl.d.ts +0 -128
  152. package/dist/message-BHWbxBtT.d.ts +0 -15
  153. package/dist/parts-dj7AcUg0.d.ts +0 -36
  154. package/dist/run-PfLmDAox.d.ts +0 -41
  155. package/dist/tool-call-feed-D9iofJgW.d.ts +0 -46
@@ -1,60 +0,0 @@
1
- import {
2
- CodeBlock,
3
- CopyButton
4
- } from "./chunk-WUQDUBJG.js";
5
- import {
6
- cn
7
- } from "./chunk-RQHJBTEU.js";
8
-
9
- // src/markdown/markdown.tsx
10
- import { memo } from "react";
11
- import ReactMarkdown from "react-markdown";
12
- import remarkGfm from "remark-gfm";
13
- import rehypeSanitize from "rehype-sanitize";
14
- import { Fragment, jsx } from "react/jsx-runtime";
15
- var Markdown = memo(({ children, className, urlTransform }) => {
16
- return /* @__PURE__ */ jsx(
17
- "div",
18
- {
19
- className: cn("tangle-prose max-w-none text-sm", className),
20
- children: /* @__PURE__ */ jsx(
21
- ReactMarkdown,
22
- {
23
- remarkPlugins: [remarkGfm],
24
- rehypePlugins: [rehypeSanitize],
25
- urlTransform,
26
- components: {
27
- pre({ children: preChildren }) {
28
- return /* @__PURE__ */ jsx(Fragment, { children: preChildren });
29
- },
30
- code({ className: codeClass, children: codeChildren, ...rest }) {
31
- const match = /language-(\w+)/.exec(codeClass || "");
32
- const language = match?.[1];
33
- const code = String(codeChildren).replace(/\n$/, "");
34
- if (!language && !code.includes("\n")) {
35
- return /* @__PURE__ */ jsx(
36
- "code",
37
- {
38
- className: cn(
39
- "px-1.5 py-0.5 rounded border border-border bg-card text-[var(--code-keyword)] text-[0.85em] font-mono",
40
- codeClass
41
- ),
42
- ...rest,
43
- children: codeChildren
44
- }
45
- );
46
- }
47
- return /* @__PURE__ */ jsx(CodeBlock, { code, language, children: /* @__PURE__ */ jsx(CopyButton, { text: code }) });
48
- }
49
- },
50
- children
51
- }
52
- )
53
- }
54
- );
55
- });
56
- Markdown.displayName = "Markdown";
57
-
58
- export {
59
- Markdown
60
- };
@@ -1,230 +0,0 @@
1
- import {
2
- cn
3
- } from "./chunk-RQHJBTEU.js";
4
-
5
- // src/primitives/card.tsx
6
- import * as React from "react";
7
- import { jsx } from "react/jsx-runtime";
8
- var Card = React.forwardRef(({ className, variant = "default", hover = false, ...props }, ref) => {
9
- const variants = {
10
- default: "bg-card border-border",
11
- elevated: "bg-muted/50 border-border shadow-[var(--shadow-card)]",
12
- glass: "bg-card/80 backdrop-blur-xl border-border shadow-[var(--shadow-card)]",
13
- sandbox: "bg-muted/50 border-primary/20 shadow-[var(--shadow-accent)]"
14
- };
15
- return /* @__PURE__ */ jsx(
16
- "div",
17
- {
18
- ref,
19
- className: cn(
20
- "rounded-[var(--radius-lg)] border text-card-foreground transition-[border-color,box-shadow]",
21
- "duration-[var(--transition-default)]",
22
- variants[variant],
23
- hover && "cursor-pointer hover:border-primary/30",
24
- className
25
- ),
26
- ...props
27
- }
28
- );
29
- });
30
- Card.displayName = "Card";
31
- var CardHeader = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
32
- "div",
33
- {
34
- ref,
35
- className: cn("flex flex-col space-y-1 p-4", className),
36
- ...props
37
- }
38
- ));
39
- CardHeader.displayName = "CardHeader";
40
- var CardTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
41
- "h3",
42
- {
43
- ref,
44
- className: cn("font-semibold leading-none tracking-tight", className),
45
- ...props
46
- }
47
- ));
48
- CardTitle.displayName = "CardTitle";
49
- var CardDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
50
- "p",
51
- {
52
- ref,
53
- className: cn("text-muted-foreground text-sm", className),
54
- ...props
55
- }
56
- ));
57
- CardDescription.displayName = "CardDescription";
58
- var CardContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-4 pt-0", className), ...props }));
59
- CardContent.displayName = "CardContent";
60
- var CardFooter = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
61
- "div",
62
- {
63
- ref,
64
- className: cn("flex items-center p-6 pt-0", className),
65
- ...props
66
- }
67
- ));
68
- CardFooter.displayName = "CardFooter";
69
-
70
- // src/primitives/badge.tsx
71
- import { cva } from "class-variance-authority";
72
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
73
- var badgeVariants = cva(
74
- "inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 font-medium text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
75
- {
76
- variants: {
77
- variant: {
78
- default: "border-transparent bg-primary text-primary-foreground",
79
- secondary: "border-transparent bg-secondary text-secondary-foreground",
80
- destructive: "border-transparent bg-destructive/15 border-destructive/25 text-destructive",
81
- outline: "text-foreground border-border",
82
- success: "border-[var(--surface-success-border)] bg-[var(--surface-success-bg)] text-[var(--surface-success-text)]",
83
- warning: "border-[var(--surface-warning-border)] bg-[var(--surface-warning-bg)] text-[var(--surface-warning-text)]",
84
- error: "border-[var(--surface-danger-border)] bg-[var(--surface-danger-bg)] text-[var(--surface-danger-text)]",
85
- info: "border-[var(--surface-info-border)] bg-[var(--surface-info-bg)] text-[var(--surface-info-text)]",
86
- sandbox: "border-border bg-[var(--accent-surface-soft)] text-[var(--accent-text)]",
87
- /* Operational status variants */
88
- running: "border-[var(--surface-teal-border)] bg-[var(--surface-teal-bg)] text-[var(--surface-teal-text)]",
89
- creating: "border-[var(--surface-violet-border)] bg-[var(--surface-violet-bg)] text-[var(--surface-violet-text)]",
90
- stopped: "border-[var(--surface-warning-border)] bg-[var(--surface-warning-bg)] text-[var(--surface-warning-text)]",
91
- warm: "border-[var(--surface-orange-border)] bg-[var(--surface-orange-bg)] text-[var(--surface-orange-text)]",
92
- cold: "border-[var(--surface-info-border)] bg-[var(--surface-info-bg)] text-[var(--surface-info-text)]",
93
- deleted: "border-[var(--surface-neutral-border)] bg-[var(--surface-neutral-bg)] text-[var(--surface-neutral-text)]"
94
- }
95
- },
96
- defaultVariants: {
97
- variant: "default"
98
- }
99
- }
100
- );
101
- var statusDotClass = {
102
- running: "status-dot status-dot-running",
103
- creating: "status-dot status-dot-creating",
104
- stopped: "status-dot status-dot-stopped",
105
- warm: "status-dot status-dot-warm",
106
- cold: "status-dot status-dot-cold",
107
- error: "status-dot status-dot-error",
108
- deleted: "status-dot status-dot-deleted"
109
- };
110
- function Badge({ className, variant, dot, children, ...props }) {
111
- const dotClass = dot && variant ? statusDotClass[variant] : null;
112
- return /* @__PURE__ */ jsxs("div", { className: cn(badgeVariants({ variant }), className), ...props, children: [
113
- dotClass && /* @__PURE__ */ jsx2("span", { className: dotClass, "aria-hidden": true }),
114
- children
115
- ] });
116
- }
117
-
118
- // src/primitives/table.tsx
119
- import * as React2 from "react";
120
- import { jsx as jsx3 } from "react/jsx-runtime";
121
- var Table = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx3(
122
- "table",
123
- {
124
- ref,
125
- className: cn("w-full caption-bottom text-sm", className),
126
- ...props
127
- }
128
- ) }));
129
- Table.displayName = "Table";
130
- var TableHeader = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
131
- TableHeader.displayName = "TableHeader";
132
- var TableBody = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
133
- "tbody",
134
- {
135
- ref,
136
- className: cn("[&_tr:last-child]:border-0", className),
137
- ...props
138
- }
139
- ));
140
- TableBody.displayName = "TableBody";
141
- var TableFooter = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
142
- "tfoot",
143
- {
144
- ref,
145
- className: cn(
146
- "border-t bg-card font-medium [&>tr]:last:border-b-0",
147
- className
148
- ),
149
- ...props
150
- }
151
- ));
152
- TableFooter.displayName = "TableFooter";
153
- var TableRow = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
154
- "tr",
155
- {
156
- ref,
157
- className: cn(
158
- "border-border border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted/50",
159
- className
160
- ),
161
- ...props
162
- }
163
- ));
164
- TableRow.displayName = "TableRow";
165
- var TableHead = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
166
- "th",
167
- {
168
- ref,
169
- className: cn(
170
- "h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
171
- className
172
- ),
173
- ...props
174
- }
175
- ));
176
- TableHead.displayName = "TableHead";
177
- var TableCell = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
178
- "td",
179
- {
180
- ref,
181
- className: cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className),
182
- ...props
183
- }
184
- ));
185
- TableCell.displayName = "TableCell";
186
- var TableCaption = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
187
- "caption",
188
- {
189
- ref,
190
- className: cn("mt-4 text-muted-foreground text-sm", className),
191
- ...props
192
- }
193
- ));
194
- TableCaption.displayName = "TableCaption";
195
-
196
- // src/primitives/code-block.tsx
197
- import { jsx as jsx4 } from "react/jsx-runtime";
198
- function InlineCode({ className, children, ...props }) {
199
- return /* @__PURE__ */ jsx4(
200
- "code",
201
- {
202
- className: cn(
203
- "rounded border border-border bg-card px-1.5 py-0.5 font-mono text-[0.85em] text-[var(--code-keyword)]",
204
- className
205
- ),
206
- ...props,
207
- children
208
- }
209
- );
210
- }
211
-
212
- export {
213
- Card,
214
- CardHeader,
215
- CardTitle,
216
- CardDescription,
217
- CardContent,
218
- CardFooter,
219
- badgeVariants,
220
- Badge,
221
- Table,
222
- TableHeader,
223
- TableBody,
224
- TableFooter,
225
- TableRow,
226
- TableHead,
227
- TableCell,
228
- TableCaption,
229
- InlineCode
230
- };
@@ -1,37 +0,0 @@
1
- // src/stores/chat-store.ts
2
- import { atom, map } from "nanostores";
3
- var messagesAtom = atom([]);
4
- var partMapAtom = map({});
5
- var isStreamingAtom = atom(false);
6
- var insertionCounter = 0;
7
- function addMessage(msg) {
8
- const withIndex = { ...msg, _insertionIndex: insertionCounter++ };
9
- messagesAtom.set([...messagesAtom.get(), withIndex]);
10
- }
11
- function addParts(messageId, parts) {
12
- const current = partMapAtom.get();
13
- const existing = current[messageId] ?? [];
14
- partMapAtom.setKey(messageId, [...existing, ...parts]);
15
- }
16
- function updatePart(messageId, partIndex, part) {
17
- const current = partMapAtom.get();
18
- const existing = [...current[messageId] ?? []];
19
- existing[partIndex] = part;
20
- partMapAtom.setKey(messageId, existing);
21
- }
22
- function clearChat() {
23
- messagesAtom.set([]);
24
- partMapAtom.set({});
25
- isStreamingAtom.set(false);
26
- insertionCounter = 0;
27
- }
28
-
29
- export {
30
- messagesAtom,
31
- partMapAtom,
32
- isStreamingAtom,
33
- addMessage,
34
- addParts,
35
- updatePart,
36
- clearChat
37
- };
@@ -1,104 +0,0 @@
1
- import {
2
- cn
3
- } from "./chunk-RQHJBTEU.js";
4
-
5
- // src/redaction/redacted-document.tsx
6
- import { useCallback, useState } from "react";
7
- import { Eye, EyeOff, Loader2, ShieldAlert } from "lucide-react";
8
- import { jsx, jsxs } from "react/jsx-runtime";
9
- var defaultLabel = (kind) => kind.replace(/[-_]/g, " ").toUpperCase();
10
- function RedactedChip({
11
- kind,
12
- label,
13
- onReveal
14
- }) {
15
- const [state, setState] = useState({ status: "masked" });
16
- const reveal = useCallback(async () => {
17
- setState({ status: "loading" });
18
- try {
19
- const r = await onReveal();
20
- setState(
21
- r.ok && r.value !== void 0 ? { status: "revealed", value: r.value } : { status: "denied", reason: r.reason }
22
- );
23
- } catch {
24
- setState({ status: "denied", reason: "error" });
25
- }
26
- }, [onReveal]);
27
- if (state.status === "revealed") {
28
- return /* @__PURE__ */ jsxs(
29
- "button",
30
- {
31
- type: "button",
32
- onClick: () => setState({ status: "masked" }),
33
- title: "Revealed \u2014 click to hide",
34
- "aria-label": `${label}: revealed, click to hide`,
35
- className: cn(
36
- "inline-flex items-center gap-1 rounded-[var(--radius-sm)] px-1 font-medium",
37
- "bg-[color-mix(in_oklch,var(--color-warning,orange)_18%,transparent)] text-foreground ring-1 ring-warning/40"
38
- ),
39
- children: [
40
- state.value,
41
- /* @__PURE__ */ jsx(EyeOff, { className: "size-3 opacity-60" })
42
- ]
43
- }
44
- );
45
- }
46
- if (state.status === "denied") {
47
- return /* @__PURE__ */ jsxs(
48
- "span",
49
- {
50
- title: `Restricted${state.reason ? ` (${state.reason})` : ""}`,
51
- "aria-label": `${label}: restricted`,
52
- className: "inline-flex items-center gap-1 rounded-[var(--radius-sm)] bg-muted px-1 text-muted-foreground",
53
- children: [
54
- /* @__PURE__ */ jsx(ShieldAlert, { className: "size-3" }),
55
- " ",
56
- label
57
- ]
58
- }
59
- );
60
- }
61
- return /* @__PURE__ */ jsxs(
62
- "button",
63
- {
64
- type: "button",
65
- disabled: state.status === "loading",
66
- onClick: reveal,
67
- title: `${label} \u2014 click to reveal`,
68
- "aria-label": `${label} redacted, click to reveal`,
69
- className: cn(
70
- "inline-flex items-center gap-1 rounded-[var(--radius-sm)] px-1 font-medium tracking-wide",
71
- "bg-muted text-muted-foreground hover:bg-muted/80 hover:text-foreground transition-colors",
72
- "cursor-pointer select-none"
73
- ),
74
- children: [
75
- state.status === "loading" ? /* @__PURE__ */ jsx(Loader2, { className: "size-3 animate-spin" }) : /* @__PURE__ */ jsx(Eye, { className: "size-3 opacity-60" }),
76
- /* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "\u2588\u2588\u2588" }),
77
- " ",
78
- label
79
- ]
80
- }
81
- );
82
- }
83
- function RedactedDocument({
84
- document,
85
- onReveal,
86
- labelForKind = defaultLabel,
87
- className
88
- }) {
89
- return /* @__PURE__ */ jsx("div", { className: cn("whitespace-pre-wrap break-words leading-relaxed", className), children: document.segments.map(
90
- (seg, i) => seg.type === "text" ? /* @__PURE__ */ jsx("span", { children: seg.text }, i) : /* @__PURE__ */ jsx(
91
- RedactedChip,
92
- {
93
- kind: seg.kind,
94
- label: labelForKind(seg.kind),
95
- onReveal: () => onReveal(seg.id)
96
- },
97
- seg.id
98
- )
99
- ) });
100
- }
101
-
102
- export {
103
- RedactedDocument
104
- };