@av-pi-studio/workbench 0.0.0-stage → 0.0.117

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 (273) hide show
  1. package/README.md +157 -2
  2. package/dist/chunks/BinaryFallbackViewer-BN-9Yvel.js +19 -0
  3. package/dist/chunks/ChatPanel-CjPUJMEs.js +2493 -0
  4. package/dist/chunks/CodeView-6kJms_MF.js +143 -0
  5. package/dist/chunks/DiffView-BqDuT3CF.js +48 -0
  6. package/dist/chunks/FilePanel-B8IXG2bj.js +92 -0
  7. package/dist/chunks/HtmlViewer-DpuVFaDo.js +490 -0
  8. package/dist/chunks/ImageViewer-BBfyA5QN.js +27 -0
  9. package/dist/chunks/MarkdownFileViewer-DPFPDS7G.js +88 -0
  10. package/dist/chunks/ModelProvidersPanel-Dsezq7Ss.js +95 -0
  11. package/dist/chunks/MoleculeViewerPanel-DEEU6Zkx.js +191 -0
  12. package/dist/chunks/PdfViewer-BdacmAu_.js +300 -0
  13. package/dist/chunks/SaveFileButton-2rOu02Xx.js +33 -0
  14. package/dist/chunks/SettingsDialog-DO1tDhMW.js +471 -0
  15. package/dist/chunks/SkillsPanel-DZDia4Pw.js +833 -0
  16. package/dist/chunks/TerminalPanel-bphwCSyW.js +242 -0
  17. package/dist/chunks/TextViewer-CVGqN6yy.js +63 -0
  18. package/dist/chunks/VideoViewer-BkB9BoOr.js +20 -0
  19. package/dist/chunks/ViewersPanel-C2E9FLf7.js +50 -0
  20. package/dist/chunks/href-resolution-jv3tpRcp.js +25 -0
  21. package/dist/chunks/index-Dlz8mEKZ.js +6258 -0
  22. package/dist/chunks/markdown-B2OXhZ-_.js +353 -0
  23. package/dist/chunks/provider-auth-store-C1GaLTlw.js +34 -0
  24. package/dist/chunks/use-file-download-CogCqTvU.js +31 -0
  25. package/dist/chunks/use-file-watch-Bb_Xzbr-.js +55 -0
  26. package/dist/chunks/use-provider-auth-list-DTjIZycd.js +16 -0
  27. package/dist/features/agent-ui/AskCard.d.ts +62 -0
  28. package/dist/features/agent-ui/agent-ui-store.d.ts +84 -0
  29. package/dist/features/agent-ui/announce.d.ts +51 -0
  30. package/dist/features/agent-ui/ask-list.d.ts +53 -0
  31. package/dist/features/agent-ui/ask-placement.d.ts +47 -0
  32. package/dist/features/agent-ui/deadline.d.ts +27 -0
  33. package/dist/features/agent-ui/keyboard.d.ts +37 -0
  34. package/dist/features/agent-ui/notify-effect.d.ts +41 -0
  35. package/dist/features/agent-ui/option-layout.d.ts +24 -0
  36. package/dist/features/agent-ui/outcome-line.d.ts +38 -0
  37. package/dist/features/agent-ui/prompt-text.d.ts +24 -0
  38. package/dist/features/chat/Attachments.d.ts +20 -0
  39. package/dist/features/chat/ChatPanel.d.ts +12 -0
  40. package/dist/features/chat/CommandMenu.d.ts +41 -0
  41. package/dist/features/chat/Composer.d.ts +58 -0
  42. package/dist/features/chat/ForkDialog.d.ts +24 -0
  43. package/dist/features/chat/ModelMenu.d.ts +54 -0
  44. package/dist/features/chat/ThinkingMenu.d.ts +39 -0
  45. package/dist/features/chat/Timeline.d.ts +30 -0
  46. package/dist/features/chat/TurnProgressBar.d.ts +14 -0
  47. package/dist/features/chat/composer-busy.d.ts +22 -0
  48. package/dist/features/chat/composer-gate.d.ts +37 -0
  49. package/dist/features/chat/composer-path-drop.d.ts +75 -0
  50. package/dist/features/chat/fork-correlation.d.ts +39 -0
  51. package/dist/features/chat/fork-gate.d.ts +27 -0
  52. package/dist/features/chat/fork-picker-nav.d.ts +14 -0
  53. package/dist/features/chat/fork-result.d.ts +43 -0
  54. package/dist/features/chat/model-menu-sort.d.ts +30 -0
  55. package/dist/features/chat/onboarding-nudge.d.ts +18 -0
  56. package/dist/features/chat/rows/AssistantRow.d.ts +24 -0
  57. package/dist/features/chat/rows/CompactionRow.d.ts +16 -0
  58. package/dist/features/chat/rows/ErrorRow.d.ts +13 -0
  59. package/dist/features/chat/rows/ReasoningRow.d.ts +16 -0
  60. package/dist/features/chat/rows/RowShell.d.ts +37 -0
  61. package/dist/features/chat/rows/SystemRow.d.ts +11 -0
  62. package/dist/features/chat/rows/ToolCard.d.ts +30 -0
  63. package/dist/features/chat/rows/UserRow.d.ts +43 -0
  64. package/dist/features/chat/slash-commands.d.ts +81 -0
  65. package/dist/features/chat/thinking-level-source.d.ts +29 -0
  66. package/dist/features/chat/todos/TodoPanel.d.ts +11 -0
  67. package/dist/features/chat/todos/agent-todos-store.d.ts +35 -0
  68. package/dist/features/chat/todos/todo-collapse-codec.d.ts +12 -0
  69. package/dist/features/chat/todos/todo-panel-model.d.ts +37 -0
  70. package/dist/features/chat/use-bottom-anchor.d.ts +33 -0
  71. package/dist/features/chat/use-fork-action.d.ts +32 -0
  72. package/dist/features/connection/ConnectionBar.d.ts +18 -0
  73. package/dist/features/connection/connection-presentation.d.ts +70 -0
  74. package/dist/features/files/BinaryFallbackViewer.d.ts +9 -0
  75. package/dist/features/files/CodeView.d.ts +15 -0
  76. package/dist/features/files/DiffView.d.ts +18 -0
  77. package/dist/features/files/FileContextMenu.d.ts +13 -0
  78. package/dist/features/files/FileExplorer.d.ts +24 -0
  79. package/dist/features/files/FilePanel.d.ts +26 -0
  80. package/dist/features/files/HtmlViewer.d.ts +22 -0
  81. package/dist/features/files/ImageViewer.d.ts +8 -0
  82. package/dist/features/files/MarkdownFileViewer.d.ts +14 -0
  83. package/dist/features/files/MoleculeViewer.d.ts +60 -0
  84. package/dist/features/files/MoleculeViewerPanel.d.ts +9 -0
  85. package/dist/features/files/PdfViewer.d.ts +14 -0
  86. package/dist/features/files/RightSidebar.d.ts +9 -0
  87. package/dist/features/files/SaveFileButton.d.ts +9 -0
  88. package/dist/features/files/TextViewer.d.ts +23 -0
  89. package/dist/features/files/TreeDraftRow.d.ts +15 -0
  90. package/dist/features/files/TreeNode.d.ts +42 -0
  91. package/dist/features/files/TreeRenameRow.d.ts +19 -0
  92. package/dist/features/files/VideoViewer.d.ts +8 -0
  93. package/dist/features/files/create-entry.d.ts +23 -0
  94. package/dist/features/files/delete-entry.d.ts +17 -0
  95. package/dist/features/files/file-tree.d.ts +92 -0
  96. package/dist/features/files/git-status-index.d.ts +37 -0
  97. package/dist/features/files/html-asset-loader.d.ts +43 -0
  98. package/dist/features/files/html-assets.d.ts +97 -0
  99. package/dist/features/files/html-sandbox.d.ts +62 -0
  100. package/dist/features/files/molecule-reload.d.ts +20 -0
  101. package/dist/features/files/molecule-source.d.ts +10 -0
  102. package/dist/features/files/molecule-theme.d.ts +31 -0
  103. package/dist/features/files/move-entry.d.ts +10 -0
  104. package/dist/features/files/move-status.d.ts +10 -0
  105. package/dist/features/files/move-target.d.ts +31 -0
  106. package/dist/features/files/open-file-tab.d.ts +32 -0
  107. package/dist/features/files/pdf-layout.d.ts +28 -0
  108. package/dist/features/files/pdfjs-runtime.d.ts +30 -0
  109. package/dist/features/files/polymer-file.d.ts +33 -0
  110. package/dist/features/files/text-viewer-state.d.ts +53 -0
  111. package/dist/features/files/upload-sources.d.ts +20 -0
  112. package/dist/features/files/viewer-registry.d.ts +81 -0
  113. package/dist/features/files/write-file.d.ts +12 -0
  114. package/dist/features/git/ChangesPanel.d.ts +13 -0
  115. package/dist/features/provider-auth/LoginDialog.d.ts +21 -0
  116. package/dist/features/provider-auth/ModelProvidersPanel.d.ts +12 -0
  117. package/dist/features/provider-auth/QrCode.d.ts +26 -0
  118. package/dist/features/provider-auth/login-flow.d.ts +55 -0
  119. package/dist/features/provider-auth/provider-auth-presentation.d.ts +31 -0
  120. package/dist/features/provider-auth/provider-auth-store.d.ts +42 -0
  121. package/dist/features/sessions/SessionContextMenu.d.ts +11 -0
  122. package/dist/features/sessions/SessionItem.d.ts +22 -0
  123. package/dist/features/sessions/SessionList.d.ts +9 -0
  124. package/dist/features/sessions/WorkspaceContextMenu.d.ts +9 -0
  125. package/dist/features/sessions/WorkspaceGroupHeader.d.ts +26 -0
  126. package/dist/features/sessions/apply-agent-deep-link.d.ts +7 -0
  127. package/dist/features/sessions/open-chat-tab.d.ts +14 -0
  128. package/dist/features/sessions/open-workspace.d.ts +20 -0
  129. package/dist/features/sessions/session-actions.d.ts +18 -0
  130. package/dist/features/sessions/session-presentation.d.ts +47 -0
  131. package/dist/features/sessions/status-map.d.ts +10 -0
  132. package/dist/features/sessions/workspace-grouping.d.ts +30 -0
  133. package/dist/features/settings/SettingsDialog.d.ts +22 -0
  134. package/dist/features/settings/ViewersPanel.d.ts +18 -0
  135. package/dist/features/settings/settings-categories.d.ts +32 -0
  136. package/dist/features/skills/InstallSkillDialog.d.ts +21 -0
  137. package/dist/features/skills/SkillsPanel.d.ts +32 -0
  138. package/dist/features/skills/skills-presentation.d.ts +159 -0
  139. package/dist/features/skills/use-skills.d.ts +215 -0
  140. package/dist/features/terminal/TerminalPanel.d.ts +37 -0
  141. package/dist/features/terminal/terminal-font.d.ts +44 -0
  142. package/dist/features/terminal/terminal-size.d.ts +52 -0
  143. package/dist/features/workspace/ContextMeter.d.ts +15 -0
  144. package/dist/features/workspace/ContextMeterPopover.d.ts +16 -0
  145. package/dist/features/workspace/DropPreview.d.ts +23 -0
  146. package/dist/features/workspace/PaneDividers.d.ts +30 -0
  147. package/dist/features/workspace/StatusBar.d.ts +16 -0
  148. package/dist/features/workspace/TabContextMenu.d.ts +15 -0
  149. package/dist/features/workspace/TabPanelHost.d.ts +30 -0
  150. package/dist/features/workspace/TabStrip.d.ts +36 -0
  151. package/dist/features/workspace/compact-action.d.ts +21 -0
  152. package/dist/features/workspace/context-meter.d.ts +26 -0
  153. package/dist/features/workspace/external-drag.d.ts +99 -0
  154. package/dist/features/workspace/pane-dnd.d.ts +70 -0
  155. package/dist/features/workspace/pane-layout-view.d.ts +73 -0
  156. package/dist/features/workspace/pane-tree.d.ts +141 -0
  157. package/dist/features/workspace/panel-registry.d.ts +13 -0
  158. package/dist/features/workspace/reopen-client-tabs.d.ts +44 -0
  159. package/dist/features/workspace/restore-active-workspace.d.ts +30 -0
  160. package/dist/features/workspace/status-bar-format.d.ts +20 -0
  161. package/dist/features/workspace/tab-attention.d.ts +35 -0
  162. package/dist/features/workspace-picker/OpenWorkspaceDialog.d.ts +11 -0
  163. package/dist/fonts/CascadiaMono.woff2 +0 -0
  164. package/dist/fonts/CascadiaMonoNF.woff2 +0 -0
  165. package/dist/fonts/LICENSE-Cascadia.txt +97 -0
  166. package/dist/fonts.css +60 -0
  167. package/dist/hooks/agent-stream-events.d.ts +20 -0
  168. package/dist/hooks/file-text-state.d.ts +31 -0
  169. package/dist/hooks/file-transfer-instance.d.ts +10 -0
  170. package/dist/hooks/use-agent-commands.d.ts +18 -0
  171. package/dist/hooks/use-agent-deep-link-boot.d.ts +9 -0
  172. package/dist/hooks/use-agent-stream.d.ts +15 -0
  173. package/dist/hooks/use-agent-todos.d.ts +10 -0
  174. package/dist/hooks/use-checkout-status.d.ts +13 -0
  175. package/dist/hooks/use-connection.d.ts +27 -0
  176. package/dist/hooks/use-explorer-tree.d.ts +20 -0
  177. package/dist/hooks/use-explorer-watch.d.ts +39 -0
  178. package/dist/hooks/use-explorer.d.ts +21 -0
  179. package/dist/hooks/use-external-pane-drop.d.ts +47 -0
  180. package/dist/hooks/use-file-diff.d.ts +9 -0
  181. package/dist/hooks/use-file-download.d.ts +18 -0
  182. package/dist/hooks/use-file-live-refresh.d.ts +31 -0
  183. package/dist/hooks/use-file-read.d.ts +31 -0
  184. package/dist/hooks/use-file-source.d.ts +16 -0
  185. package/dist/hooks/use-file-text.d.ts +21 -0
  186. package/dist/hooks/use-file-transfer.d.ts +18 -0
  187. package/dist/hooks/use-file-watch.d.ts +36 -0
  188. package/dist/hooks/use-home-dir.d.ts +14 -0
  189. package/dist/hooks/use-inline-image.d.ts +37 -0
  190. package/dist/hooks/use-is-compacting.d.ts +9 -0
  191. package/dist/hooks/use-pane-drag.d.ts +40 -0
  192. package/dist/hooks/use-pane-layout.d.ts +40 -0
  193. package/dist/hooks/use-provider-auth-list.d.ts +19 -0
  194. package/dist/hooks/use-provider-models.d.ts +14 -0
  195. package/dist/hooks/use-session-restore.d.ts +44 -0
  196. package/dist/hooks/use-session-stats.d.ts +40 -0
  197. package/dist/hooks/use-shortcuts.d.ts +6 -0
  198. package/dist/hooks/use-terminal-exit-watch.d.ts +47 -0
  199. package/dist/hooks/use-terminal-restore.d.ts +38 -0
  200. package/dist/hooks/use-thinking-levels.d.ts +13 -0
  201. package/dist/hooks/use-timeline-reset-watch.d.ts +43 -0
  202. package/dist/hooks/use-viewer-settings.d.ts +17 -0
  203. package/dist/host/browser-clipboard.d.ts +9 -0
  204. package/dist/host/browser-connection.d.ts +13 -0
  205. package/dist/host/browser-files.d.ts +9 -0
  206. package/dist/host/browser-host.d.ts +14 -0
  207. package/dist/host/browser-launch.d.ts +19 -0
  208. package/dist/host/browser-worker-timers.d.ts +29 -0
  209. package/dist/host/external-link.d.ts +14 -0
  210. package/dist/host/index.d.ts +4 -0
  211. package/dist/host/install.d.ts +21 -0
  212. package/dist/host/types.d.ts +168 -0
  213. package/dist/index.d.ts +14 -0
  214. package/dist/index.js +18 -0
  215. package/dist/lib/agent-deep-link.d.ts +29 -0
  216. package/dist/lib/connection/connection-store.d.ts +49 -0
  217. package/dist/lib/connection/files-changed.d.ts +41 -0
  218. package/dist/lib/connection/live-file-transfer.d.ts +8 -0
  219. package/dist/lib/connection/normalize-url.d.ts +16 -0
  220. package/dist/lib/connection/query-client.d.ts +3 -0
  221. package/dist/lib/connection/resolve-connect-target.d.ts +10 -0
  222. package/dist/lib/connection/resume-action.d.ts +33 -0
  223. package/dist/lib/connection/resume-handler.d.ts +6 -0
  224. package/dist/lib/connection/rpc-keys.d.ts +39 -0
  225. package/dist/lib/drag-guard.d.ts +39 -0
  226. package/dist/lib/inline-image-cache.d.ts +34 -0
  227. package/dist/lib/pane-layout-persistence.d.ts +74 -0
  228. package/dist/lib/paths.d.ts +33 -0
  229. package/dist/lib/protocol/events.d.ts +19 -0
  230. package/dist/lib/protocol/timeline-paging.d.ts +29 -0
  231. package/dist/lib/random-id.d.ts +16 -0
  232. package/dist/shell/Workbench.d.ts +6 -0
  233. package/dist/shell/WorkbenchBoot.d.ts +4 -0
  234. package/dist/shell/WorkbenchProvider.d.ts +10 -0
  235. package/dist/shell/WorkspaceShell.d.ts +12 -0
  236. package/dist/shell/context.d.ts +8 -0
  237. package/dist/shell/hooks.d.ts +32 -0
  238. package/dist/shell/regions.d.ts +17 -0
  239. package/dist/stores/compaction-store.d.ts +45 -0
  240. package/dist/stores/deep-link-store.d.ts +15 -0
  241. package/dist/stores/draft-store.d.ts +45 -0
  242. package/dist/stores/explorer-store.d.ts +63 -0
  243. package/dist/stores/fork-store.d.ts +69 -0
  244. package/dist/stores/git-store.d.ts +59 -0
  245. package/dist/stores/layout-store.d.ts +137 -0
  246. package/dist/stores/materialize.d.ts +47 -0
  247. package/dist/stores/session-store.d.ts +76 -0
  248. package/dist/stores/stats-store.d.ts +48 -0
  249. package/dist/stores/tab-store.d.ts +145 -0
  250. package/dist/stores/ui-store.d.ts +85 -0
  251. package/dist/styles.css +1 -0
  252. package/dist/timeline/FileLink.d.ts +22 -0
  253. package/dist/timeline/InlineImage.d.ts +16 -0
  254. package/dist/timeline/bottom-anchor.d.ts +77 -0
  255. package/dist/timeline/compaction.d.ts +12 -0
  256. package/dist/timeline/file-link-src.d.ts +34 -0
  257. package/dist/timeline/file-open-target.d.ts +19 -0
  258. package/dist/timeline/format-meta-time.d.ts +10 -0
  259. package/dist/timeline/highlight.d.ts +9 -0
  260. package/dist/timeline/href-resolution.d.ts +34 -0
  261. package/dist/timeline/image-src.d.ts +32 -0
  262. package/dist/timeline/inline-image-view.d.ts +34 -0
  263. package/dist/timeline/live-tail.d.ts +5 -0
  264. package/dist/timeline/markdown.d.ts +35 -0
  265. package/dist/timeline/mermaid-theme.d.ts +23 -0
  266. package/dist/timeline/reducer.d.ts +38 -0
  267. package/dist/timeline/row-model.d.ts +154 -0
  268. package/dist/timeline/streaming-split.d.ts +42 -0
  269. package/dist/timeline/tool-mapping.d.ts +60 -0
  270. package/dist/viewer-plugins/viewer-settings-store.d.ts +55 -0
  271. package/dist/vite/index.d.ts +36 -0
  272. package/dist/vite/index.js +39 -0
  273. package/package.json +81 -4
@@ -0,0 +1,471 @@
1
+ import { jsx as t, jsxs as a, Fragment as x } from "react/jsx-runtime";
2
+ import { useState as f, useEffect as w, useCallback as X, useReducer as J, useRef as y, Suspense as W } from "react";
3
+ import { clsx as ee } from "clsx";
4
+ import { Dialog as K, Button as k, Spinner as E, TextInput as ne, IconButton as te, Icon as oe, EmptyState as T } from "@av-pi-studio/ui-library";
5
+ import { g as q, u as B, r as Q, b as ie, S as re } from "./index-Dlz8mEKZ.js";
6
+ import { useQueryClient as se } from "@tanstack/react-query";
7
+ import { ExternalLink as O, Check as ae, Copy as ce } from "lucide-react";
8
+ import le from "qrcode";
9
+ import { u as L } from "./provider-auth-store-C1GaLTlw.js";
10
+ function ue(e, n) {
11
+ const o = q().links.openExternal;
12
+ o && (e.preventDefault(), o(n));
13
+ }
14
+ function P({ href: e, onClick: n, ...o }) {
15
+ return /* @__PURE__ */ t(
16
+ "a",
17
+ {
18
+ ...o,
19
+ href: e,
20
+ target: "_blank",
21
+ rel: "noreferrer",
22
+ onClick: (r) => {
23
+ n?.(r), r.defaultPrevented || ue(r, e);
24
+ }
25
+ }
26
+ );
27
+ }
28
+ function pe(e, n) {
29
+ return {
30
+ provider: e,
31
+ authType: n,
32
+ phase: "starting",
33
+ statusLines: []
34
+ };
35
+ }
36
+ function de(e, n, o) {
37
+ return {
38
+ ...e,
39
+ phase: e.phase === "starting" ? "waiting" : e.phase,
40
+ statusLines: [...e.statusLines, { kind: "info", message: n, links: o }]
41
+ };
42
+ }
43
+ function ge(e, n) {
44
+ const o = e.statusLines.filter((r) => r.kind !== "progress");
45
+ return {
46
+ ...e,
47
+ phase: e.phase === "starting" ? "waiting" : e.phase,
48
+ statusLines: [...o, { kind: "progress", message: n }]
49
+ };
50
+ }
51
+ function he(e, n, o) {
52
+ return { ...e, authUrl: { url: n, instructions: o } };
53
+ }
54
+ function me(e, n, o, r, d) {
55
+ return { ...e, deviceCode: { userCode: n, verificationUri: o, intervalSeconds: r, expiresInSeconds: d } };
56
+ }
57
+ function fe(e, n) {
58
+ return { ...e, phase: "prompt", prompt: n };
59
+ }
60
+ function _e(e, n) {
61
+ return e.prompt?.promptId !== n ? e : { ...e, phase: "waiting", prompt: void 0 };
62
+ }
63
+ function ve(e, n, o) {
64
+ return { ...e, phase: "done", result: { ok: n, error: o } };
65
+ }
66
+ function be(e, n) {
67
+ if (e.phase === "done") return e;
68
+ switch (n.kind) {
69
+ case "info":
70
+ return de(e, n.message, n.links);
71
+ case "progress":
72
+ return ge(e, n.message);
73
+ case "auth_url":
74
+ return he(e, n.url, n.instructions);
75
+ case "device_code":
76
+ return me(
77
+ e,
78
+ n.userCode,
79
+ n.verificationUri,
80
+ n.intervalSeconds,
81
+ n.expiresInSeconds
82
+ );
83
+ case "prompt":
84
+ return fe(e, n);
85
+ case "prompt_cancelled":
86
+ return _e(e, n.promptId);
87
+ case "done":
88
+ return ve(e, n.ok, n.error);
89
+ }
90
+ }
91
+ const Le = "piwb-QrCode_qr_URoLM", we = "piwb-QrCode_placeholder_TxqZK", U = {
92
+ qr: Le,
93
+ placeholder: we
94
+ }, Ce = 320;
95
+ function z({ value: e, label: n }) {
96
+ const [o, r] = f(null), [d, c] = f(!1);
97
+ return w(() => {
98
+ let p = !0;
99
+ return r(null), c(!1), le.toDataURL(e, { width: Ce, margin: 1, errorCorrectionLevel: "M" }).then((g) => {
100
+ p && r(g);
101
+ }).catch(() => {
102
+ p && c(!0);
103
+ }), () => {
104
+ p = !1;
105
+ };
106
+ }, [e]), d ? null : o ? /* @__PURE__ */ t("img", { className: U.qr, src: o, alt: n }) : /* @__PURE__ */ t("div", { className: U.placeholder, "aria-hidden": "true" });
107
+ }
108
+ const De = "piwb-LoginDialog_body_GIlGl", Se = "piwb-LoginDialog_status_rqfrD", Ne = "piwb-LoginDialog_statusLine_Hh0Xn", Ie = "piwb-LoginDialog_statusLineProgress_khvrx", ke = "piwb-LoginDialog_statusText_m5xDP", ye = "piwb-LoginDialog_prompt__-xfG", xe = "piwb-LoginDialog_promptMessage_DY8Sq", Ee = "piwb-LoginDialog_options_yZXpb", Pe = "piwb-LoginDialog_option_ZdMmQ", Ae = "piwb-LoginDialog_optionLabel__CA8q", Me = "piwb-LoginDialog_optionDescription_ha4A3", Re = "piwb-LoginDialog_success_zLKu2", Te = "piwb-LoginDialog_error_SAY5b", Qe = "piwb-LoginDialog_oauth_kwBPZ", Ue = "piwb-LoginDialog_oauthInstructions_qewUJ", Ke = "piwb-LoginDialog_oauthMain_jEuW3", qe = "piwb-LoginDialog_oauthActions_NC3y_", Be = "piwb-LoginDialog_openButton_iwdTY", Oe = "piwb-LoginDialog_urlRow_jEnPI", ze = "piwb-LoginDialog_oauthUrl_cCSag", Fe = "piwb-LoginDialog_oauthQr_v6BwP", $e = "piwb-LoginDialog_oauthQrCaption_Mc-ho", je = "piwb-LoginDialog_deviceCode__RauS", Ge = "piwb-LoginDialog_countdown_gYTuP", i = {
109
+ body: De,
110
+ status: Se,
111
+ statusLine: Ne,
112
+ statusLineProgress: Ie,
113
+ statusText: ke,
114
+ prompt: ye,
115
+ promptMessage: xe,
116
+ options: Ee,
117
+ option: Pe,
118
+ optionLabel: Ae,
119
+ optionDescription: Me,
120
+ success: Re,
121
+ error: Te,
122
+ oauth: Qe,
123
+ oauthInstructions: Ue,
124
+ oauthMain: Ke,
125
+ oauthActions: qe,
126
+ openButton: Be,
127
+ urlRow: Oe,
128
+ oauthUrl: ze,
129
+ oauthQr: Fe,
130
+ oauthQrCaption: $e,
131
+ deviceCode: je,
132
+ countdown: Ge
133
+ }, Ye = 1200, F = "provider-auth-prompt-form";
134
+ function Ze() {
135
+ const e = L((g) => g.pendingLogin), n = L((g) => g.cancelLogin), o = L((g) => g.clearLogin), r = L((g) => g.retryLogin), d = B((g) => g.client), c = se(), p = X(() => {
136
+ c.invalidateQueries({ queryKey: Q.providerAuthList() }), c.invalidateQueries({ queryKey: Q.providerModelsAll() });
137
+ }, [c]);
138
+ return !e || !d ? null : /* @__PURE__ */ t(
139
+ He,
140
+ {
141
+ provider: e.provider,
142
+ providerName: e.providerName,
143
+ authType: e.authType,
144
+ controller: e.controller,
145
+ client: d,
146
+ onCancel: n,
147
+ onClear: o,
148
+ onRetry: r,
149
+ onSuccess: p
150
+ },
151
+ `${e.provider}:${e.authType}:${e.attempt}`
152
+ );
153
+ }
154
+ function He({
155
+ provider: e,
156
+ providerName: n,
157
+ authType: o,
158
+ controller: r,
159
+ client: d,
160
+ onCancel: c,
161
+ onClear: p,
162
+ onRetry: g,
163
+ onSuccess: C
164
+ }) {
165
+ const [u, m] = J(
166
+ be,
167
+ pe(e, o)
168
+ ), h = y(null), I = y(!1), _ = y(!1), [s, v] = f(""), [j, G] = f(null);
169
+ w(() => (_.current = !0, I.current || (I.current = !0, d.loginProvider(
170
+ e,
171
+ o,
172
+ {
173
+ prompt: (l) => new Promise((S, V) => {
174
+ h.current = { promptId: l.promptId, resolve: S, reject: V }, m({ kind: "prompt", ...l }), l.signal?.addEventListener(
175
+ "abort",
176
+ () => {
177
+ h.current?.promptId === l.promptId && (h.current = null), v(""), m({ kind: "prompt_cancelled", promptId: l.promptId });
178
+ },
179
+ { once: !0 }
180
+ );
181
+ }),
182
+ onEvent: (l) => m(l)
183
+ },
184
+ { signal: r.signal }
185
+ ).then((l) => {
186
+ _.current && m({ kind: "done", ok: l.ok, error: l.error });
187
+ }).catch((l) => {
188
+ _.current && m({
189
+ kind: "done",
190
+ ok: !1,
191
+ error: l instanceof Error ? l.message : String(l)
192
+ });
193
+ })), () => {
194
+ _.current = !1, h.current?.reject(new Error("login dialog closed")), h.current = null;
195
+ }), []), w(() => {
196
+ if (u.phase !== "done" || !u.result?.ok) return;
197
+ C();
198
+ const l = setTimeout(p, Ye);
199
+ return () => clearTimeout(l);
200
+ }, [u.phase, u.result?.ok, C, p]);
201
+ function A(l) {
202
+ const S = h.current;
203
+ S && (h.current = null, G(S.promptId), v(""), S.resolve(l));
204
+ }
205
+ function Y(l) {
206
+ l.preventDefault(), A(s);
207
+ }
208
+ function Z(l) {
209
+ l || (u.phase === "done" ? p() : c());
210
+ }
211
+ const b = u.phase === "done", H = b && u.result?.ok === !0, M = b && u.result?.ok === !1, D = u.phase === "prompt" && u.prompt && u.prompt.promptId !== j ? u.prompt : void 0, R = D && D.promptKind !== "select" ? D : void 0;
212
+ return /* @__PURE__ */ t(
213
+ K,
214
+ {
215
+ open: !0,
216
+ onOpenChange: Z,
217
+ title: `Log in to ${n}`,
218
+ width: 480,
219
+ footer: b ? /* @__PURE__ */ a(x, { children: [
220
+ /* @__PURE__ */ t(k, { variant: "ghost", onClick: p, children: "Close" }),
221
+ M && /* @__PURE__ */ t(k, { onClick: g, children: "Try again" })
222
+ ] }) : /* @__PURE__ */ a(x, { children: [
223
+ /* @__PURE__ */ t(k, { variant: "ghost", onClick: c, children: "Cancel" }),
224
+ R && // Associated with the body's form by id, so Enter-in-the-input and this click are
225
+ // the same submit path while both actions still sit in the footer's action row.
226
+ //
227
+ // Deliberately NOT disabled on an empty input: blank is a meaningful answer to some
228
+ // prompts — GitHub Copilot opens with "GitHub Enterprise URL/domain (blank for
229
+ // github.com)", and gating on length made that flow impossible to advance. The
230
+ // provider decides what it accepts, exactly as `pi-studio auth login` does (its
231
+ // `@inquirer/prompts` input carries no non-empty validation either).
232
+ /* @__PURE__ */ t(k, { type: "submit", form: F, children: "Submit" })
233
+ ] }),
234
+ children: /* @__PURE__ */ a("div", { className: i.body, children: [
235
+ /* @__PURE__ */ t(Ve, { state: u }),
236
+ !b && u.authUrl && /* @__PURE__ */ t(We, { authUrl: u.authUrl, showInstructions: !R }),
237
+ !b && u.deviceCode && /* @__PURE__ */ t(nn, { deviceCode: u.deviceCode, stopped: b }),
238
+ D && /* @__PURE__ */ t(
239
+ Xe,
240
+ {
241
+ prompt: D,
242
+ inputValue: s,
243
+ onInputChange: v,
244
+ onTextSubmit: Y,
245
+ onSelect: A
246
+ }
247
+ ),
248
+ H && /* @__PURE__ */ t("p", { className: i.success, children: "Signed in. Closing…" }),
249
+ M && /* @__PURE__ */ t("p", { className: i.error, children: u.result?.error ?? "Login failed." })
250
+ ] })
251
+ }
252
+ );
253
+ }
254
+ function Ve({ state: e }) {
255
+ return e.statusLines.length === 0 && e.phase !== "starting" ? null : /* @__PURE__ */ a("div", { className: i.status, children: [
256
+ e.phase === "starting" && /* @__PURE__ */ a("div", { className: i.statusLine, children: [
257
+ /* @__PURE__ */ t(E, { size: "sm" }),
258
+ " Starting…"
259
+ ] }),
260
+ e.statusLines.map((n, o) => /* @__PURE__ */ a(
261
+ "div",
262
+ {
263
+ className: n.kind === "progress" ? i.statusLineProgress : i.statusLine,
264
+ children: [
265
+ n.kind === "progress" && /* @__PURE__ */ t(E, { size: "sm" }),
266
+ /* @__PURE__ */ a("span", { className: i.statusText, children: [
267
+ /* @__PURE__ */ t("span", { children: n.message }),
268
+ n.links?.map((r) => /* @__PURE__ */ t(P, { href: r.url, children: r.label ?? r.url }, r.url))
269
+ ] })
270
+ ]
271
+ },
272
+ o
273
+ ))
274
+ ] });
275
+ }
276
+ function Xe({
277
+ prompt: e,
278
+ inputValue: n,
279
+ onInputChange: o,
280
+ onTextSubmit: r,
281
+ onSelect: d
282
+ }) {
283
+ return e.promptKind === "select" ? /* @__PURE__ */ a("div", { className: i.prompt, children: [
284
+ /* @__PURE__ */ t("p", { className: i.promptMessage, children: e.message }),
285
+ /* @__PURE__ */ t("div", { className: i.options, children: e.options?.map((c) => /* @__PURE__ */ a(
286
+ "button",
287
+ {
288
+ type: "button",
289
+ className: i.option,
290
+ onClick: () => d(c.id),
291
+ children: [
292
+ /* @__PURE__ */ t("span", { className: i.optionLabel, children: c.label }),
293
+ c.description && /* @__PURE__ */ t("span", { className: i.optionDescription, children: c.description })
294
+ ]
295
+ },
296
+ c.id
297
+ )) })
298
+ ] }) : /* @__PURE__ */ a("form", { id: F, className: i.prompt, onSubmit: r, children: [
299
+ /* @__PURE__ */ t("label", { className: i.promptMessage, htmlFor: "login-prompt-input", children: e.message }),
300
+ /* @__PURE__ */ t(
301
+ ne,
302
+ {
303
+ id: "login-prompt-input",
304
+ autoFocus: !0,
305
+ type: e.promptKind === "secret" ? "password" : "text",
306
+ autoComplete: e.promptKind === "secret" ? "off" : void 0,
307
+ "data-1p-ignore": e.promptKind === "secret" ? "true" : void 0,
308
+ "data-lpignore": e.promptKind === "secret" ? "true" : void 0,
309
+ "data-bwignore": e.promptKind === "secret" ? "true" : void 0,
310
+ placeholder: e.placeholder,
311
+ value: n,
312
+ onChange: (c) => o(c.target.value)
313
+ }
314
+ )
315
+ ] });
316
+ }
317
+ const Je = 1800;
318
+ function $({ value: e, label: n }) {
319
+ const [o, r] = f(!1);
320
+ return w(() => {
321
+ if (!o) return;
322
+ const d = setTimeout(() => r(!1), Je);
323
+ return () => clearTimeout(d);
324
+ }, [o]), /* @__PURE__ */ t(
325
+ te,
326
+ {
327
+ size: "sm",
328
+ "aria-label": o ? "Copied" : n,
329
+ title: o ? "Copied" : n,
330
+ onClick: () => {
331
+ q().clipboard.writeText(e).then(
332
+ () => r(!0),
333
+ () => r(!1)
334
+ );
335
+ },
336
+ children: o ? /* @__PURE__ */ t(ae, { size: 14 }) : /* @__PURE__ */ t(ce, { size: 14 })
337
+ }
338
+ );
339
+ }
340
+ function We({
341
+ authUrl: e,
342
+ showInstructions: n
343
+ }) {
344
+ return /* @__PURE__ */ a("div", { className: i.oauth, children: [
345
+ n && e.instructions && /* @__PURE__ */ t("p", { className: i.oauthInstructions, children: e.instructions }),
346
+ /* @__PURE__ */ a("div", { className: i.oauthMain, children: [
347
+ /* @__PURE__ */ a("div", { className: i.oauthActions, children: [
348
+ /* @__PURE__ */ a(P, { className: i.openButton, href: e.url, children: [
349
+ /* @__PURE__ */ t(O, { size: 14 }),
350
+ "Open login page"
351
+ ] }),
352
+ /* @__PURE__ */ a("div", { className: i.urlRow, children: [
353
+ /* @__PURE__ */ t("span", { className: i.oauthUrl, children: e.url }),
354
+ /* @__PURE__ */ t($, { value: e.url, label: "Copy link" })
355
+ ] })
356
+ ] }),
357
+ /* @__PURE__ */ a("div", { className: i.oauthQr, children: [
358
+ /* @__PURE__ */ t(z, { value: e.url, label: "QR code for the provider's login page" }),
359
+ /* @__PURE__ */ t("span", { className: i.oauthQrCaption, children: "Scan on another device" })
360
+ ] })
361
+ ] })
362
+ ] });
363
+ }
364
+ function en(e) {
365
+ const n = Math.max(0, e), o = Math.floor(n / 60), r = n % 60;
366
+ return `${o}:${String(r).padStart(2, "0")}`;
367
+ }
368
+ function nn({
369
+ deviceCode: e,
370
+ stopped: n
371
+ }) {
372
+ const [o, r] = f(e.expiresInSeconds);
373
+ return w(() => {
374
+ if (n || e.expiresInSeconds === void 0) return;
375
+ r(e.expiresInSeconds);
376
+ const d = setInterval(() => {
377
+ r((c) => c === void 0 ? void 0 : Math.max(0, c - 1));
378
+ }, 1e3);
379
+ return () => clearInterval(d);
380
+ }, [e.expiresInSeconds, n]), /* @__PURE__ */ t("div", { className: i.oauth, children: /* @__PURE__ */ a("div", { className: i.oauthMain, children: [
381
+ /* @__PURE__ */ a("div", { className: i.oauthActions, children: [
382
+ /* @__PURE__ */ t("span", { className: i.oauthInstructions, children: "Enter this code at the verification page" }),
383
+ /* @__PURE__ */ a("div", { className: i.urlRow, children: [
384
+ /* @__PURE__ */ t("span", { className: i.deviceCode, children: e.userCode }),
385
+ /* @__PURE__ */ t($, { value: e.userCode, label: "Copy code" })
386
+ ] }),
387
+ /* @__PURE__ */ a(P, { className: i.openButton, href: e.verificationUri, children: [
388
+ /* @__PURE__ */ t(O, { size: 14 }),
389
+ "Open verification page"
390
+ ] }),
391
+ o !== void 0 && /* @__PURE__ */ t("span", { className: i.countdown, children: o > 0 ? `Expires in ${en(o)}` : "Code expired" })
392
+ ] }),
393
+ /* @__PURE__ */ a("div", { className: i.oauthQr, children: [
394
+ /* @__PURE__ */ t(z, { value: e.verificationUri, label: "QR code for the verification page" }),
395
+ /* @__PURE__ */ t("span", { className: i.oauthQrCaption, children: "Scan on another device" })
396
+ ] })
397
+ ] }) });
398
+ }
399
+ const tn = "piwb-SettingsDialog_shell_N_xAE", on = "piwb-SettingsDialog_sidebar_1dH3S", rn = "piwb-SettingsDialog_category__q-DM", sn = "piwb-SettingsDialog_categoryActive_zc7nw", an = "piwb-SettingsDialog_content_opjtv", N = {
400
+ shell: tn,
401
+ sidebar: on,
402
+ category: rn,
403
+ categoryActive: sn,
404
+ content: an
405
+ };
406
+ function _n({ open: e, onOpenChange: n }) {
407
+ const o = B((s) => s.serverInfo), r = L((s) => s.pendingLogin), d = L((s) => s.cancelLogin), c = ie(o?.features), p = re.filter((s) => s.available(c)), [g, C] = f(p[0]?.id);
408
+ w(() => {
409
+ p.some((s) => s.id === g) || C(p[0]?.id);
410
+ }, [p.map((s) => s.id).join(",")]);
411
+ const u = p.find((s) => s.id === g) ?? p[0], m = u?.component;
412
+ function h(s) {
413
+ !s && r && d(), n(s);
414
+ }
415
+ function I(s) {
416
+ if (r) {
417
+ s.preventDefault();
418
+ return;
419
+ }
420
+ const v = s.detail.originalEvent.target;
421
+ v instanceof Node && !v.isConnected && s.preventDefault();
422
+ }
423
+ function _(s) {
424
+ r && s.preventDefault();
425
+ }
426
+ return /* @__PURE__ */ a(x, { children: [
427
+ /* @__PURE__ */ t(
428
+ K,
429
+ {
430
+ open: e,
431
+ onOpenChange: h,
432
+ title: "Settings",
433
+ width: 900,
434
+ onInteractOutside: I,
435
+ onEscapeKeyDown: _,
436
+ children: /* @__PURE__ */ a("div", { className: N.shell, children: [
437
+ /* @__PURE__ */ t("nav", { className: N.sidebar, children: p.map((s) => /* @__PURE__ */ a(
438
+ "button",
439
+ {
440
+ type: "button",
441
+ className: ee(
442
+ N.category,
443
+ s.id === u?.id && N.categoryActive
444
+ ),
445
+ onClick: () => C(s.id),
446
+ children: [
447
+ /* @__PURE__ */ t(oe, { icon: s.icon, size: "sm" }),
448
+ s.label
449
+ ]
450
+ },
451
+ s.id
452
+ )) }),
453
+ /* @__PURE__ */ t("div", { className: N.content, children: m ? /* @__PURE__ */ t(
454
+ W,
455
+ {
456
+ fallback: /* @__PURE__ */ a(T, { children: [
457
+ /* @__PURE__ */ t(E, { size: "sm" }),
458
+ " Loading…"
459
+ ] }),
460
+ children: /* @__PURE__ */ t(m, {})
461
+ }
462
+ ) : /* @__PURE__ */ t(T, { children: "No settings categories available." }) })
463
+ ] })
464
+ }
465
+ ),
466
+ /* @__PURE__ */ t(Ze, {})
467
+ ] });
468
+ }
469
+ export {
470
+ _n as SettingsDialog
471
+ };