spiracha 1.2.0 → 1.3.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 (149) hide show
  1. package/AGENTS.md +49 -12
  2. package/README.md +117 -64
  3. package/apps/ui/AGENTS.md +16 -8
  4. package/apps/ui/README.md +28 -12
  5. package/apps/ui/dist/client/assets/{analytics-Cv0JMDN2.js → analytics-B_hYz65v.js} +1 -1
  6. package/apps/ui/dist/client/assets/antigravity-conversations._conversationId-qiyygB7e.js +1 -0
  7. package/apps/ui/dist/client/assets/antigravity-conversations._conversationId-z1SQC2Kg.js +1 -0
  8. package/apps/ui/dist/client/assets/antigravity-keychain-panel-dYuRWtCf.js +1 -0
  9. package/apps/ui/dist/client/assets/antigravity._workspaceKey-CliqUr7o.js +1 -0
  10. package/apps/ui/dist/client/assets/antigravity._workspaceKey-CnoBzyX6.js +1 -0
  11. package/apps/ui/dist/client/assets/antigravity.index-CakfZz_E.js +1 -0
  12. package/apps/ui/dist/client/assets/antigravity.index-DY7M1KhG.js +1 -0
  13. package/apps/ui/dist/client/assets/badge-aHE9ETVe.js +1 -0
  14. package/apps/ui/dist/client/assets/checkbox-DN3XnJaA.js +1 -0
  15. package/apps/ui/dist/client/assets/cursor-threads._composerId-BMQyx8qG.js +1 -0
  16. package/apps/ui/dist/client/assets/cursor-threads._composerId-BTlaA-tV.js +1 -0
  17. package/apps/ui/dist/client/assets/cursor._workspaceKey-CrgrfevV.js +1 -0
  18. package/apps/ui/dist/client/assets/cursor._workspaceKey-bYS2syGL.js +1 -0
  19. package/apps/ui/dist/client/assets/cursor.index-CTqZMPYU.js +1 -0
  20. package/apps/ui/dist/client/assets/cursor.index-Clsz4E_e.js +2 -0
  21. package/apps/ui/dist/client/assets/{data-table-Bgnh7phF.js → data-table-Cj-v-uyB.js} +2 -2
  22. package/apps/ui/dist/client/assets/delete-confirm-dialog-DTpzBiNK.js +11 -0
  23. package/apps/ui/dist/client/assets/dist-BNAn99Pu.js +1 -0
  24. package/apps/ui/dist/client/assets/download-P3Rp23Ad.js +1 -0
  25. package/apps/ui/dist/client/assets/dropdown-menu-3qB5j9nt.js +1 -0
  26. package/apps/ui/dist/client/assets/es2015-Dwm_turD.js +41 -0
  27. package/apps/ui/dist/client/assets/export-dialog-CazdrASq.js +1 -0
  28. package/apps/ui/dist/client/assets/formatters-BdnWuM1z.js +1 -0
  29. package/apps/ui/dist/client/assets/index-BVFnfS78.js +22 -0
  30. package/apps/ui/dist/client/assets/json-panel-DLkS30sQ.js +1 -0
  31. package/apps/ui/dist/client/assets/metadata-section-jnIkB7dB.js +1 -0
  32. package/apps/ui/dist/client/assets/{metric-card-BJX5rkHK.js → metric-card-CBZuWLzQ.js} +1 -1
  33. package/apps/ui/dist/client/assets/page-header-CnD21cPn.js +1 -0
  34. package/apps/ui/dist/client/assets/projects._project-BLszwvYL.js +1 -0
  35. package/apps/ui/dist/client/assets/projects._project-DvLxYbvk.js +1 -0
  36. package/apps/ui/dist/client/assets/projects.index-COn8woBR.js +1 -0
  37. package/apps/ui/dist/client/assets/projects.index-DYs98skV.js +3 -0
  38. package/apps/ui/dist/client/assets/refresh-ccw-BDrYXjtD.js +1 -0
  39. package/apps/ui/dist/client/assets/reload-error-panel-DLAg0AW2.js +1 -0
  40. package/apps/ui/dist/client/assets/routes-BtF5-coe.js +1 -0
  41. package/apps/ui/dist/client/assets/scroll-text-CqaFm9by.js +1 -0
  42. package/apps/ui/dist/client/assets/select-DbnpwqL6.js +1 -0
  43. package/apps/ui/dist/client/assets/settings-CGX3VleN.js +1 -0
  44. package/apps/ui/dist/client/assets/styles-Ch0r3kMZ.css +1 -0
  45. package/apps/ui/dist/client/assets/text-document-panel-DPleOmmq.js +1 -0
  46. package/apps/ui/dist/client/assets/text-filter-7M6wRo-t.js +2 -0
  47. package/apps/ui/dist/client/assets/threads._threadId-D5w76IB-.js +7 -0
  48. package/apps/ui/dist/client/assets/{threads._threadId-CUiCZSwo.js → threads._threadId-Dx85sI9P.js} +1 -1
  49. package/apps/ui/dist/client/assets/useMutation-MZ3Hr9h9.js +1 -0
  50. package/apps/ui/dist/client/assets/useQuery-Cb4V0AT0.js +1 -0
  51. package/apps/ui/dist/client/icon.svg +28 -0
  52. package/apps/ui/dist/client/manifest.json +6 -16
  53. package/apps/ui/dist/server/assets/_tanstack-start-manifest_v-CBbkUXw6.js +227 -0
  54. package/apps/ui/dist/server/assets/{analytics-2QpLKjlG.js → analytics-CBNOYZwJ.js} +2 -2
  55. package/apps/ui/dist/server/assets/antigravity-conversation-state-HgzS302O.js +16 -0
  56. package/apps/ui/dist/server/assets/antigravity-conversations._conversationId-B9Rm4EXh.js +212 -0
  57. package/apps/ui/dist/server/assets/antigravity-conversations._conversationId-BIdYNy68.js +20 -0
  58. package/apps/ui/dist/server/assets/antigravity-conversations._conversationId-D426O-64.js +11 -0
  59. package/apps/ui/dist/server/assets/antigravity-db-D9gW1D8G.js +576 -0
  60. package/apps/ui/dist/server/assets/antigravity-keychain-DOiuHDwK.js +126 -0
  61. package/apps/ui/dist/server/assets/antigravity-keychain-panel-DcLyBBwd.js +55 -0
  62. package/apps/ui/dist/server/assets/antigravity-queries-CgQhlQ7J.js +37 -0
  63. package/apps/ui/dist/server/assets/antigravity-server-DFUx4Khk.js +114 -0
  64. package/apps/ui/dist/server/assets/antigravity._workspaceKey-3m_MzNFA.js +11 -0
  65. package/apps/ui/dist/server/assets/antigravity._workspaceKey-D42ixtzp.js +210 -0
  66. package/apps/ui/dist/server/assets/antigravity._workspaceKey-DnSlSC-C.js +28 -0
  67. package/apps/ui/dist/server/assets/antigravity.index-DZVT-cac.js +104 -0
  68. package/apps/ui/dist/server/assets/antigravity.index-DudTB3Tq.js +11 -0
  69. package/apps/ui/dist/server/assets/badge-EvdhKK_Z.js +26 -0
  70. package/apps/ui/dist/server/assets/{codex-queries-BH4Cb0v3.js → codex-queries-eOJGfHQj.js} +4 -16
  71. package/apps/ui/dist/server/assets/{codex-server-DqzruLmg.js → codex-server-nrETIF--.js} +149 -140
  72. package/apps/ui/dist/server/assets/createServerRpc-BtXIw2iP.js +12 -0
  73. package/apps/ui/dist/server/assets/createSsrRpc-COf5Zuye.js +16 -0
  74. package/apps/ui/dist/server/assets/cursor-db-B7agkAvM.js +643 -0
  75. package/apps/ui/dist/server/assets/cursor-exporter-types-CI3goo-c.js +34 -0
  76. package/apps/ui/dist/server/assets/cursor-queries-BMhuJeUO.js +65 -0
  77. package/apps/ui/dist/server/assets/cursor-recovery-9bJLs7vG.js +361 -0
  78. package/apps/ui/dist/server/assets/cursor-server-BgylIFgn.js +184 -0
  79. package/apps/ui/dist/server/assets/cursor-threads._composerId-BB0Y_Mao.js +11 -0
  80. package/apps/ui/dist/server/assets/cursor-threads._composerId-BsxFKzoJ.js +218 -0
  81. package/apps/ui/dist/server/assets/cursor-threads._composerId-DXffY_CK.js +18 -0
  82. package/apps/ui/dist/server/assets/cursor-transcript-2iL3KFSK.js +125 -0
  83. package/apps/ui/dist/server/assets/cursor._workspaceKey-BP2J1x_x.js +28 -0
  84. package/apps/ui/dist/server/assets/cursor._workspaceKey-BQd0e-Pd.js +399 -0
  85. package/apps/ui/dist/server/assets/cursor._workspaceKey-nmg3YIOQ.js +11 -0
  86. package/apps/ui/dist/server/assets/cursor.index-CQVxtCm8.js +189 -0
  87. package/apps/ui/dist/server/assets/cursor.index-CcsX7DG0.js +11 -0
  88. package/apps/ui/dist/server/assets/{delete-confirm-dialog-CWqcTXTF.js → delete-confirm-dialog-PCD7S0_M.js} +5 -4
  89. package/apps/ui/dist/server/assets/download-DMmiy1xf.js +92 -0
  90. package/apps/ui/dist/server/assets/{input-B4tEzctc.js → dropdown-menu-Dy_9t6TN.js} +1 -11
  91. package/apps/ui/dist/server/assets/{download-Drctxary.js → export-dialog-DaPlOGFT.js} +1 -92
  92. package/apps/ui/dist/server/assets/json-panel-RYsxWFae.js +16 -0
  93. package/apps/ui/dist/server/assets/{loading-panel-DbLdvjtR.js → loading-panel-BGFnWseS.js} +1 -1
  94. package/apps/ui/dist/server/assets/metadata-section-D6Lbc7D6.js +54 -0
  95. package/apps/ui/dist/server/assets/page-header-VNSaM3xd.js +29 -0
  96. package/apps/ui/dist/server/assets/projects._project-Bshqk7JA.js +12 -0
  97. package/apps/ui/dist/server/assets/{projects._project-gT01HBqH.js → projects._project-DUN3iWfg.js} +4 -4
  98. package/apps/ui/dist/server/assets/{projects._project-DreIU5b0.js → projects._project-Dim9Y0kD.js} +54 -26
  99. package/apps/ui/dist/server/assets/projects.index-BLXOx5eL.js +12 -0
  100. package/apps/ui/dist/server/assets/{projects.index-BYmgSGAj.js → projects.index-DjSQK5dm.js} +23 -27
  101. package/apps/ui/dist/server/assets/{projects.index-CaplpeMy.js → reload-error-panel-BJMxY3U1.js} +5 -6
  102. package/apps/ui/dist/server/assets/{router-Qj5Kn7bl.js → router-DrDgc-LD.js} +131 -44
  103. package/apps/ui/dist/server/assets/{routes-_LbCIjtJ.js → routes-B-GlEe2C.js} +54 -39
  104. package/apps/ui/dist/server/assets/{routes-BtcXuK0x.js → routes-CNHAUMwo.js} +2 -2
  105. package/apps/ui/dist/server/assets/{settings-MvWDgc1u.js → settings-OayxIYQQ.js} +1 -1
  106. package/apps/ui/dist/server/assets/shared-CPRNYIql.js +134 -0
  107. package/apps/ui/dist/server/assets/text-document-panel-D8JbQWAn.js +23 -0
  108. package/apps/ui/dist/server/assets/text-filter-CGKxMCKt.js +36 -0
  109. package/apps/ui/dist/server/assets/{threads._threadId-DcbAJkwf.js → threads._threadId-CJzm4KrZ.js} +3 -3
  110. package/apps/ui/dist/server/assets/{threads._threadId-D5m6ypGw.js → threads._threadId-DODTYddm.js} +69 -76
  111. package/apps/ui/dist/server/server.js +77 -13
  112. package/package.json +19 -9
  113. package/src/export-cursor.ts +244 -0
  114. package/src/lib/antigravity-db.ts +936 -0
  115. package/src/lib/antigravity-exporter-types.ts +70 -0
  116. package/src/lib/antigravity-keychain.ts +203 -0
  117. package/src/lib/codex-browser-db.ts +7 -1
  118. package/src/lib/codex-browser-types.ts +22 -1
  119. package/src/lib/codex-thread-recovery.ts +202 -0
  120. package/src/lib/cursor-db.ts +1096 -0
  121. package/src/lib/cursor-exporter-types.ts +190 -0
  122. package/src/lib/cursor-exporter.ts +266 -0
  123. package/src/lib/cursor-recovery.ts +543 -0
  124. package/src/lib/cursor-transcript.ts +183 -0
  125. package/src/spiracha.ts +16 -3
  126. package/src/ui-cli.ts +2 -2
  127. package/apps/ui/dist/client/assets/checkbox-DjHij7DJ.js +0 -1
  128. package/apps/ui/dist/client/assets/delete-confirm-dialog-CIZy_LXD.js +0 -11
  129. package/apps/ui/dist/client/assets/download-DQtfva4z.js +0 -1
  130. package/apps/ui/dist/client/assets/es2015-DsDKdYCE.js +0 -41
  131. package/apps/ui/dist/client/assets/formatters-CWFrMKSn.js +0 -1
  132. package/apps/ui/dist/client/assets/index-C_-e0lDI.js +0 -22
  133. package/apps/ui/dist/client/assets/input-BbgApiqZ.js +0 -1
  134. package/apps/ui/dist/client/assets/page-header-ODLuGLAB.js +0 -1
  135. package/apps/ui/dist/client/assets/projects._project-C2Pys_bB.js +0 -1
  136. package/apps/ui/dist/client/assets/projects._project-CHvAKvlu.js +0 -1
  137. package/apps/ui/dist/client/assets/projects.index-BmwtS1x-.js +0 -1
  138. package/apps/ui/dist/client/assets/projects.index-CuLw73mt.js +0 -1
  139. package/apps/ui/dist/client/assets/routes-CfnaTOlj.js +0 -1
  140. package/apps/ui/dist/client/assets/select-B1kH_5lx.js +0 -1
  141. package/apps/ui/dist/client/assets/settings-mYTB3sso.js +0 -1
  142. package/apps/ui/dist/client/assets/styles-CMrP9Jb4.css +0 -1
  143. package/apps/ui/dist/client/assets/threads._threadId-C_47okme.js +0 -7
  144. package/apps/ui/dist/client/favicon.ico +0 -0
  145. package/apps/ui/dist/client/logo192.png +0 -0
  146. package/apps/ui/dist/client/logo512.png +0 -0
  147. package/apps/ui/dist/server/assets/_tanstack-start-manifest_v-kj_QB_26.js +0 -99
  148. package/apps/ui/dist/server/assets/page-header-CxdZM86z.js +0 -25
  149. package/apps/ui/dist/server/assets/projects._project-CLSohrBp.js +0 -26
@@ -0,0 +1,183 @@
1
+ import type {
2
+ CursorBubble,
3
+ CursorExportOptions,
4
+ CursorThreadHead,
5
+ CursorThreadTranscript,
6
+ CursorToolCall,
7
+ } from './cursor-exporter-types';
8
+ import {
9
+ cleanExtractedText,
10
+ cleanInlineTitle,
11
+ type ExportFormat,
12
+ formatInlineLiteral,
13
+ type MetadataEntry,
14
+ renderCodeBlock,
15
+ renderDocumentTitle,
16
+ renderMetadataBlock,
17
+ renderSection,
18
+ } from './shared';
19
+
20
+ const TOOL_RESULT_PREVIEW_LIMIT = 4000;
21
+ const MIN_DATE_MS = -8_640_000_000_000_000;
22
+ const MAX_DATE_MS = 8_640_000_000_000_000;
23
+
24
+ const formatUnixMillis = (value: number | null): string | null => {
25
+ if (
26
+ value === null ||
27
+ value === undefined ||
28
+ !Number.isFinite(value) ||
29
+ value < MIN_DATE_MS ||
30
+ value > MAX_DATE_MS
31
+ ) {
32
+ return null;
33
+ }
34
+
35
+ return new Date(value).toISOString();
36
+ };
37
+
38
+ const prettyToolArguments = (argumentsText: string | null): string | null => {
39
+ if (!argumentsText) {
40
+ return null;
41
+ }
42
+
43
+ try {
44
+ return JSON.stringify(JSON.parse(argumentsText), null, 2);
45
+ } catch {
46
+ return argumentsText;
47
+ }
48
+ };
49
+
50
+ const truncateResult = (resultText: string): string => {
51
+ if (resultText.length <= TOOL_RESULT_PREVIEW_LIMIT) {
52
+ return resultText;
53
+ }
54
+
55
+ return `${resultText.slice(0, TOOL_RESULT_PREVIEW_LIMIT)}\n... (truncated)`;
56
+ };
57
+
58
+ export const renderCursorToolCall = (toolCall: CursorToolCall, outputFormat: ExportFormat): string => {
59
+ const lines: string[] = [`Tool: ${formatInlineLiteral(toolCall.name, outputFormat)}`];
60
+ if (toolCall.status) {
61
+ lines.push(`Status: ${toolCall.status}`);
62
+ }
63
+
64
+ const args = prettyToolArguments(toolCall.argumentsText);
65
+ if (args) {
66
+ lines.push('', 'Arguments:', '', renderCodeBlock(args, outputFormat));
67
+ }
68
+
69
+ const result = toolCall.resultText?.trim();
70
+ if (result) {
71
+ lines.push('', 'Result:', '', renderCodeBlock(truncateResult(result), outputFormat));
72
+ }
73
+
74
+ return renderSection('Tool Call', lines.join('\n'), outputFormat);
75
+ };
76
+
77
+ const renderUserBubble = (bubble: CursorBubble, outputFormat: ExportFormat): string => {
78
+ const text = cleanExtractedText(bubble.text).trim();
79
+ return text ? renderSection('User', text, outputFormat) : '';
80
+ };
81
+
82
+ const renderAssistantBubble = (bubble: CursorBubble, options: CursorExportOptions): string[] => {
83
+ const blocks: string[] = [];
84
+
85
+ if (options.includeCommentary && bubble.thinking?.trim()) {
86
+ const reasoning = cleanExtractedText(bubble.thinking).trim();
87
+ if (reasoning) {
88
+ blocks.push(renderSection('Reasoning', reasoning, options.outputFormat));
89
+ }
90
+ }
91
+
92
+ const text = cleanExtractedText(bubble.text).trim();
93
+ if (text) {
94
+ blocks.push(renderSection('Assistant', text, options.outputFormat));
95
+ }
96
+
97
+ if (options.includeTools && bubble.toolCall) {
98
+ blocks.push(renderCursorToolCall(bubble.toolCall, options.outputFormat));
99
+ }
100
+
101
+ return blocks;
102
+ };
103
+
104
+ export const renderCursorBubble = (bubble: CursorBubble, options: CursorExportOptions): string[] => {
105
+ if (bubble.kind === 'user') {
106
+ const block = renderUserBubble(bubble, options.outputFormat);
107
+ return block ? [block] : [];
108
+ }
109
+
110
+ if (bubble.kind === 'assistant') {
111
+ return renderAssistantBubble(bubble, options);
112
+ }
113
+
114
+ return [];
115
+ };
116
+
117
+ const getThreadTitle = (head: CursorThreadHead): string => {
118
+ if (head.name) {
119
+ return cleanInlineTitle(head.name);
120
+ }
121
+
122
+ return head.composerId;
123
+ };
124
+
125
+ const buildMetadataEntries = (transcript: CursorThreadTranscript): MetadataEntry[] => {
126
+ const { head } = transcript;
127
+
128
+ return [
129
+ { key: 'exported_from', value: 'cursor_global_storage_bubbles' },
130
+ { key: 'composer_id', value: head.composerId },
131
+ { key: 'title', value: head.name },
132
+ { key: 'mode', value: head.mode },
133
+ { key: 'created_at_unix_ms', value: head.createdAtMs },
134
+ { key: 'created_at_iso', value: formatUnixMillis(head.createdAtMs) },
135
+ { key: 'last_updated_at_unix_ms', value: head.lastUpdatedAtMs },
136
+ { key: 'last_updated_at_iso', value: formatUnixMillis(head.lastUpdatedAtMs) },
137
+ { key: 'rendered_message_count', value: transcript.renderableBubbleCount },
138
+ {
139
+ key: 'omitted_message_count',
140
+ value: transcript.omittedBubbleCount > 0 ? transcript.omittedBubbleCount : null,
141
+ },
142
+ ];
143
+ };
144
+
145
+ const buildTruncationNotice = (transcript: CursorThreadTranscript, outputFormat: ExportFormat): string => {
146
+ if (transcript.omittedBubbleCount <= 0) {
147
+ return '';
148
+ }
149
+
150
+ const orderedCount = transcript.head.orderedBubbleIds.length;
151
+ const message = [
152
+ `Cursor indexed only the most recent ${orderedCount} of`,
153
+ `${orderedCount + transcript.omittedBubbleCount} stored messages for this thread,`,
154
+ 'so earlier messages are not part of its conversation index and are not included here.',
155
+ ].join(' ');
156
+
157
+ return renderSection('Note', message, outputFormat);
158
+ };
159
+
160
+ export const renderCursorTranscript = (
161
+ transcript: CursorThreadTranscript,
162
+ options: CursorExportOptions,
163
+ ): string | null => {
164
+ const sections: string[] = [];
165
+ for (const bubble of transcript.bubbles) {
166
+ sections.push(...renderCursorBubble(bubble, options));
167
+ }
168
+
169
+ if (sections.length === 0) {
170
+ return null;
171
+ }
172
+
173
+ const title = getThreadTitle(transcript.head);
174
+ const parts = [
175
+ renderDocumentTitle(title, options.outputFormat),
176
+ '',
177
+ options.includeMetadata ? renderMetadataBlock(buildMetadataEntries(transcript), options.outputFormat) : '',
178
+ buildTruncationNotice(transcript, options.outputFormat),
179
+ ...sections,
180
+ ].filter(Boolean);
181
+
182
+ return `${parts.join('\n').trimEnd()}\n`;
183
+ };
package/src/spiracha.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bun
2
2
 
3
- type SpirachaCommandKind = 'codex' | 'claude' | 'help' | 'ui';
3
+ type SpirachaCommandKind = 'codex' | 'claude' | 'cursor' | 'help' | 'ui';
4
4
 
5
5
  type SpirachaInvocation = {
6
6
  kind: SpirachaCommandKind;
@@ -18,6 +18,10 @@ export const resolveSpirachaInvocation = (argv: string[]): SpirachaInvocation =>
18
18
  return { argv: rest, kind: 'codex' };
19
19
  }
20
20
 
21
+ if (firstArg === 'cursor') {
22
+ return { argv: rest, kind: 'cursor' };
23
+ }
24
+
21
25
  if (firstArg === 'ui') {
22
26
  return { argv: rest, kind: 'ui' };
23
27
  }
@@ -31,18 +35,20 @@ export const resolveSpirachaInvocation = (argv: string[]): SpirachaInvocation =>
31
35
 
32
36
  export const getSpirachaHelpText = (): string => {
33
37
  return [
34
- 'spiracha - export Codex chats and Claude transcripts',
38
+ 'spiracha - export local assistant transcripts and browse local history',
35
39
  '',
36
40
  'Usage:',
37
41
  ' spiracha',
38
42
  ' spiracha codex [Codex options]',
39
43
  ' spiracha claude [Claude options]',
44
+ ' spiracha cursor [Cursor options]',
40
45
  ' spiracha ui [UI options]',
41
46
  '',
42
47
  'Commands:',
43
48
  ' codex Export Codex chats (default when no subcommand is provided)',
44
49
  ' claude Export a Claude transcript file or export directory',
45
- ' ui Launch the local browser UI for browsing Codex history',
50
+ ' cursor Export, recover, and prune local Cursor Agent/Composer threads',
51
+ ' ui Launch the local browser UI for Codex, Cursor, and Antigravity history',
46
52
  '',
47
53
  'Aliases:',
48
54
  ' codex-chats',
@@ -51,6 +57,7 @@ export const getSpirachaHelpText = (): string => {
51
57
  'For command-specific help:',
52
58
  ' spiracha codex --help',
53
59
  ' spiracha claude --help',
60
+ ' spiracha cursor --help',
54
61
  ' spiracha ui --help',
55
62
  ].join('\n');
56
63
  };
@@ -69,6 +76,12 @@ export const runSpirachaCli = async (argv = process.argv.slice(2)): Promise<void
69
76
  return;
70
77
  }
71
78
 
79
+ if (invocation.kind === 'cursor') {
80
+ const { runExportCursorCli } = await import('./export-cursor');
81
+ await runExportCursorCli(invocation.argv);
82
+ return;
83
+ }
84
+
72
85
  if (invocation.kind === 'ui') {
73
86
  const { runUiCli } = await import('./ui-cli');
74
87
  await runUiCli(invocation.argv);
package/src/ui-cli.ts CHANGED
@@ -32,7 +32,7 @@ const resolveUiDistPaths = () => {
32
32
  const ensureUiBuildExists = async () => {
33
33
  const { clientDir, serverEntryPath } = resolveUiDistPaths();
34
34
  const serverEntry = Bun.file(serverEntryPath);
35
- const clientAssetExists = await Bun.file(path.join(clientDir, 'favicon.ico')).exists();
35
+ const clientAssetExists = await Bun.file(path.join(clientDir, 'icon.svg')).exists();
36
36
  const serverEntryExists = await serverEntry.exists();
37
37
 
38
38
  if (!clientAssetExists || !serverEntryExists) {
@@ -131,7 +131,7 @@ export const parseUiCliArgs = (argv: string[]): UiCliOptions => {
131
131
 
132
132
  export const getUiHelpText = (): string => {
133
133
  return [
134
- 'Launch the Spiracha browser UI.',
134
+ 'Launch the Spiracha browser UI for Codex, Cursor, and Antigravity history.',
135
135
  '',
136
136
  'Usage:',
137
137
  ' spiracha ui [--port 3000] [--host 127.0.0.1] [--db FILE] [--no-open]',
@@ -1 +0,0 @@
1
- import{A as e,B as t,D as n,H as r,M as i,O as a,P as o,S as s,W as c,dt as l,mt as u,pt as d}from"./index-C_-e0lDI.js";var f=c(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),p=u(d(),1);function m(e){let t=p.useRef({value:e,previous:e});return p.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var h=l(),g=`Checkbox`,[_,v]=i(g),[y,b]=_(g);function x(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:o,form:s,name:c,onCheckedChange:l,required:u,value:d=`on`,internal_do_not_use_render:f}=e,[m,_]=a({prop:n,defaultProp:i??!1,onChange:l,caller:g}),[v,b]=p.useState(null),[x,S]=p.useState(null),C=p.useRef(!1),w=v?!!s||!!v.closest(`form`):!0,T={checked:m,disabled:o,setChecked:_,control:v,setControl:b,name:c,form:s,value:d,hasConsumerStoppedPropagationRef:C,required:u,defaultChecked:A(i)?!1:i,isFormControl:w,bubbleInput:x,setBubbleInput:S};return(0,h.jsx)(y,{scope:t,...T,children:k(f)?f(T):r})}var S=`CheckboxTrigger`,C=p.forwardRef(({__scopeCheckbox:n,onKeyDown:r,onClick:i,...a},s)=>{let{control:c,value:l,disabled:u,checked:d,required:f,setControl:m,setChecked:g,hasConsumerStoppedPropagationRef:_,isFormControl:v,bubbleInput:y}=b(S,n),x=t(s,m),C=p.useRef(d);return p.useEffect(()=>{let e=c?.form;if(e){let t=()=>g(C.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[c,g]),(0,h.jsx)(o.button,{type:`button`,role:`checkbox`,"aria-checked":A(d)?`mixed`:d,"aria-required":f,"data-state":j(d),"data-disabled":u?``:void 0,disabled:u,value:l,...a,ref:x,onKeyDown:e(r,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:e(i,e=>{g(e=>A(e)?!0:!e),y&&v&&(_.current=e.isPropagationStopped(),_.current||e.stopPropagation())})})});C.displayName=S;var w=p.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,h.jsx)(x,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(C,{...d,ref:t,__scopeCheckbox:n}),e&&(0,h.jsx)(O,{__scopeCheckbox:n})]})})});w.displayName=g;var T=`CheckboxIndicator`,E=p.forwardRef((e,t)=>{let{__scopeCheckbox:r,forceMount:i,...a}=e,s=b(T,r);return(0,h.jsx)(n,{present:i||A(s.checked)||s.checked===!0,children:(0,h.jsx)(o.span,{"data-state":j(s.checked),"data-disabled":s.disabled?``:void 0,...a,ref:t,style:{pointerEvents:`none`,...e.style}})})});E.displayName=T;var D=`CheckboxBubbleInput`,O=p.forwardRef(({__scopeCheckbox:e,...n},r)=>{let{control:i,hasConsumerStoppedPropagationRef:a,checked:c,defaultChecked:l,required:u,disabled:d,name:f,value:g,form:_,bubbleInput:v,setBubbleInput:y}=b(D,e),x=t(r,y),S=m(c),C=s(i);p.useEffect(()=>{let e=v;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!a.current;if(S!==c&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=A(c),n.call(e,A(c)?!1:c),e.dispatchEvent(t)}},[v,S,c,a]);let w=p.useRef(A(c)?!1:c);return(0,h.jsx)(o.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:l??w.current,required:u,disabled:d,name:f,value:g,form:_,...n,tabIndex:-1,ref:x,style:{...n.style,...C,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});O.displayName=D;function k(e){return typeof e==`function`}function A(e){return e===`indeterminate`}function j(e){return A(e)?`indeterminate`:e?`checked`:`unchecked`}function M({className:e,...t}){return(0,h.jsx)(w,{"data-slot":`checkbox`,className:r(`peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs outline-none transition-shadow focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-white dark:bg-input/30 dark:data-[state=checked]:bg-primary dark:data-[state=checked]:text-primary-foreground dark:aria-invalid:ring-destructive/40`,e),...t,children:(0,h.jsx)(E,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none`,children:(0,h.jsx)(f,{className:`size-3.5`})})})}export{m as n,f as r,M as t};
@@ -1,11 +0,0 @@
1
- import{t as e}from"./checkbox-DjHij7DJ.js";import{a as t,i as n,n as r,o as i,r as a,t as o}from"./es2015-DsDKdYCE.js";import{$ as s,A as c,B as l,C as u,D as d,E as f,G as p,H as m,J as h,K as g,L as _,M as v,O as y,P as b,R as x,T as ee,W as S,Z as C,ct as w,dt as te,g as T,it as ne,j as E,mt as re,pt as ie,rt as ae,w as oe}from"./index-C_-e0lDI.js";var se=class extends w{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),ae(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&C(t.mutationKey)!==C(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??g();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){h.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},D=re(ie(),1);function ce(e,t){let n=p(t),[r]=D.useState(()=>new se(n,e));D.useEffect(()=>{r.setOptions(e)},[r,e]);let i=D.useSyncExternalStore(D.useCallback(e=>r.subscribe(h.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=D.useCallback((e,t)=>{r.mutate(e,t).catch(s)},[r]);if(i.error&&ne(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var le=S(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),O=te(),k=`Dialog`,[ue,A]=v(k),[de,j]=ue(k),fe=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=D.useRef(null),c=D.useRef(null),[l,u]=y({prop:r,defaultProp:i??!1,onChange:a,caller:k});return(0,O.jsx)(de,{scope:t,triggerRef:s,contentRef:c,contentId:f(),titleId:f(),descriptionId:f(),open:l,onOpenChange:u,onOpenToggle:D.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};fe.displayName=k;var pe=`DialogTrigger`,me=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=j(pe,n),a=l(t,i.triggerRef);return(0,O.jsx)(b.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":U(i.open),...r,ref:a,onClick:c(e.onClick,i.onOpenToggle)})});me.displayName=pe;var M=`DialogPortal`,[he,ge]=ue(M,{forceMount:void 0}),_e=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=j(M,t);return(0,O.jsx)(he,{scope:t,forceMount:n,children:D.Children.map(r,e=>(0,O.jsx)(d,{present:n||a.open,children:(0,O.jsx)(u,{asChild:!0,container:i,children:e})}))})};_e.displayName=M;var N=`DialogOverlay`,ve=D.forwardRef((e,t)=>{let n=ge(N,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=j(N,e.__scopeDialog);return a.modal?(0,O.jsx)(d,{present:r||a.open,children:(0,O.jsx)(be,{...i,ref:t})}):null});ve.displayName=N;var ye=_(`DialogOverlay.RemoveScroll`),be=D.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,a=j(N,n);return(0,O.jsx)(r,{as:ye,allowPinchZoom:!0,shards:[a.contentRef],children:(0,O.jsx)(b.div,{"data-state":U(a.open),...i,ref:t,style:{pointerEvents:`auto`,...i.style}})})}),P=`DialogContent`,F=D.forwardRef((e,t)=>{let n=ge(P,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=j(P,e.__scopeDialog);return(0,O.jsx)(d,{present:r||a.open,children:a.modal?(0,O.jsx)(xe,{...i,ref:t}):(0,O.jsx)(Se,{...i,ref:t})})});F.displayName=P;var xe=D.forwardRef((e,t)=>{let n=j(P,e.__scopeDialog),r=D.useRef(null),i=l(t,n.contentRef,r);return D.useEffect(()=>{let e=r.current;if(e)return o(e)},[]),(0,O.jsx)(I,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:c(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:c(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:c(e.onFocusOutside,e=>e.preventDefault())})}),Se=D.forwardRef((e,t)=>{let n=j(P,e.__scopeDialog),r=D.useRef(!1),i=D.useRef(!1);return(0,O.jsx)(I,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),I=D.forwardRef((e,t)=>{let{__scopeDialog:r,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,...c}=e,u=j(P,r),d=D.useRef(null),f=l(t,d);return a(),(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(n,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:o,onUnmountAutoFocus:s,children:(0,O.jsx)(oe,{role:`dialog`,id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":U(u.open),...c,ref:f,onDismiss:()=>u.onOpenChange(!1)})}),(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(we,{titleId:u.titleId}),(0,O.jsx)(Ee,{contentRef:d,descriptionId:u.descriptionId})]})]})}),L=`DialogTitle`,R=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=j(L,n);return(0,O.jsx)(b.h2,{id:i.titleId,...r,ref:t})});R.displayName=L;var z=`DialogDescription`,B=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=j(z,n);return(0,O.jsx)(b.p,{id:i.descriptionId,...r,ref:t})});B.displayName=z;var V=`DialogClose`,H=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=j(V,n);return(0,O.jsx)(b.button,{type:`button`,...r,ref:t,onClick:c(e.onClick,()=>i.onOpenChange(!1))})});H.displayName=V;function U(e){return e?`open`:`closed`}var W=`DialogTitleWarning`,[Ce,G]=E(W,{contentName:P,titleName:L,docsSlug:`dialog`}),we=({titleId:e})=>{let t=G(W),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
2
-
3
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
4
-
5
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return D.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Te=`DialogDescriptionWarning`,Ee=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${G(Te).contentName}}.`;return D.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},K=fe,De=me,Oe=_e,ke=ve,Ae=F,je=R,Me=B,q=H,Ne=`AlertDialog`,[Pe,Fe]=v(Ne,[A]),J=A(),Ie=e=>{let{__scopeAlertDialog:t,...n}=e,r=J(t);return(0,O.jsx)(K,{...r,...n,modal:!0})};Ie.displayName=Ne;var Le=`AlertDialogTrigger`,Re=D.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,O.jsx)(De,{...i,...r,ref:t})});Re.displayName=Le;var ze=`AlertDialogPortal`,Be=e=>{let{__scopeAlertDialog:t,...n}=e,r=J(t);return(0,O.jsx)(Oe,{...r,...n})};Be.displayName=ze;var Ve=`AlertDialogOverlay`,He=D.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,O.jsx)(ke,{...i,...r,ref:t})});He.displayName=Ve;var Y=`AlertDialogContent`,[Ue,We]=Pe(Y),Ge=x(`AlertDialogContent`),Ke=D.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=J(n),o=D.useRef(null),s=l(t,o),u=D.useRef(null);return(0,O.jsx)(Ce,{contentName:Y,titleName:qe,docsSlug:`alert-dialog`,children:(0,O.jsx)(Ue,{scope:n,cancelRef:u,children:(0,O.jsxs)(Ae,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:c(i.onOpenAutoFocus,e=>{e.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,O.jsx)(Ge,{children:r}),(0,O.jsx)(et,{contentRef:o})]})})})});Ke.displayName=Y;var qe=`AlertDialogTitle`,Je=D.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,O.jsx)(je,{...i,...r,ref:t})});Je.displayName=qe;var Ye=`AlertDialogDescription`,Xe=D.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,O.jsx)(Me,{...i,...r,ref:t})});Xe.displayName=Ye;var Ze=`AlertDialogAction`,Qe=D.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,O.jsx)(q,{...i,...r,ref:t})});Qe.displayName=Ze;var $e=`AlertDialogCancel`,X=D.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=We($e,n),a=J(n),o=l(t,i);return(0,O.jsx)(q,{...a,...r,ref:o})});X.displayName=$e;var et=({contentRef:e})=>{let t=`\`${Y}\` requires a description for the component to be accessible for screen reader users.
6
-
7
- You can add a description to the \`${Y}\` by passing a \`${Ye}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
8
-
9
- Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Y}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
10
-
11
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return D.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},tt=Ie,nt=Be,rt=He,it=Ke,at=Qe,ot=X,st=Je,ct=Xe,Z=`rovingFocusGroup.onEntryFocus`,lt={bubbles:!1,cancelable:!0},Q=`RovingFocusGroup`,[$,ut,dt]=i(Q),[ft,pt]=v(Q,[dt]),[mt,ht]=ft(Q),gt=D.forwardRef((e,t)=>(0,O.jsx)($.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,O.jsx)($.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,O.jsx)(_t,{...e,ref:t})})}));gt.displayName=Q;var _t=D.forwardRef((e,n)=>{let{__scopeRovingFocusGroup:r,orientation:i,loop:a=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:d,onEntryFocus:f,preventScrollOnEntryFocus:p=!1,...m}=e,h=D.useRef(null),g=l(n,h),_=t(o),[v,x]=y({prop:s,defaultProp:u??null,onChange:d,caller:Q}),[S,C]=D.useState(!1),w=ee(f),te=ut(r),T=D.useRef(!1),[ne,E]=D.useState(0);return D.useEffect(()=>{let e=h.current;if(e)return e.addEventListener(Z,w),()=>e.removeEventListener(Z,w)},[w]),(0,O.jsx)(mt,{scope:r,orientation:i,dir:_,loop:a,currentTabStopId:v,onItemFocus:D.useCallback(e=>x(e),[x]),onItemShiftTab:D.useCallback(()=>C(!0),[]),onFocusableItemAdd:D.useCallback(()=>E(e=>e+1),[]),onFocusableItemRemove:D.useCallback(()=>E(e=>e-1),[]),children:(0,O.jsx)(b.div,{tabIndex:S||ne===0?-1:0,"data-orientation":i,...m,ref:g,style:{outline:`none`,...e.style},onMouseDown:c(e.onMouseDown,()=>{T.current=!0}),onFocus:c(e.onFocus,e=>{let t=!T.current;if(e.target===e.currentTarget&&t&&!S){let t=new CustomEvent(Z,lt);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=te().filter(e=>e.focusable);Ct([e.find(e=>e.active),e.find(e=>e.id===v),...e].filter(Boolean).map(e=>e.ref.current),p)}}T.current=!1}),onBlur:c(e.onBlur,()=>C(!1))})})}),vt=`RovingFocusGroupItem`,yt=D.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,l=f(),u=a||l,d=ht(vt,n),p=d.currentTabStopId===u,m=ut(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:_}=d;return D.useEffect(()=>{if(r)return h(),()=>g()},[r,h,g]),(0,O.jsx)($.ItemSlot,{scope:n,id:u,focusable:r,active:i,children:(0,O.jsx)(b.span,{tabIndex:p?0:-1,"data-orientation":d.orientation,...s,ref:t,onMouseDown:c(e.onMouseDown,e=>{r?d.onItemFocus(u):e.preventDefault()}),onFocus:c(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:c(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){d.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=St(e,d.orientation,d.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=m().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=d.loop?wt(n,r+1):n.slice(r+1)}setTimeout(()=>Ct(n))}}),children:typeof o==`function`?o({isCurrentTabStop:p,hasTabStop:_!=null}):o})})});yt.displayName=vt;var bt={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function xt(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function St(e,t,n){let r=xt(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return bt[r]}function Ct(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function wt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Tt=gt,Et=yt;function Dt({...e}){return(0,O.jsx)(tt,{"data-slot":`alert-dialog`,...e})}function Ot({...e}){return(0,O.jsx)(nt,{"data-slot":`alert-dialog-portal`,...e})}function kt({className:e,...t}){return(0,O.jsx)(rt,{"data-slot":`alert-dialog-overlay`,className:m(`data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...t})}function At({className:e,size:t=`default`,...n}){return(0,O.jsxs)(Ot,{children:[(0,O.jsx)(kt,{}),(0,O.jsx)(it,{"data-slot":`alert-dialog-content`,"data-size":t,className:m(`group/alert-dialog-content data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[size=sm]:max-w-xs data-[state=closed]:animate-out data-[state=open]:animate-in data-[size=default]:sm:max-w-lg`,e),...n})]})}function jt({className:e,...t}){return(0,O.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:m(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function Mt({className:e,...t}){return(0,O.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:m(`flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function Nt({className:e,...t}){return(0,O.jsx)(st,{"data-slot":`alert-dialog-title`,className:m(`font-semibold text-lg sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function Pt({className:e,...t}){return(0,O.jsx)(ct,{"data-slot":`alert-dialog-description`,className:m(`text-muted-foreground text-sm`,e),...t})}function Ft({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,O.jsx)(T,{variant:t,size:n,asChild:!0,children:(0,O.jsx)(at,{"data-slot":`alert-dialog-action`,className:m(e),...r})})}function It({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,O.jsx)(T,{variant:t,size:n,asChild:!0,children:(0,O.jsx)(ot,{"data-slot":`alert-dialog-cancel`,className:m(e),...r})})}function Lt({confirmLabel:t=`Delete`,description:n,open:r,showDeleteSessionFilesOption:i=!1,title:a,onConfirm:o,onOpenChange:s}){let c=(0,D.useId)(),l=(0,D.useId)(),[u,d]=(0,D.useState)(!1);return(0,D.useEffect)(()=>{r||d(!1)},[r]),(0,O.jsx)(Dt,{open:r,onOpenChange:s,children:(0,O.jsxs)(At,{className:`border-[var(--border)] bg-[var(--panel)] text-[var(--foreground)]`,children:[(0,O.jsxs)(jt,{children:[(0,O.jsx)(Nt,{children:a}),(0,O.jsx)(Pt,{className:`text-[var(--muted-foreground)]`,children:n})]}),i?(0,O.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-[var(--border)] bg-[var(--background)]/70 px-4 py-3 text-sm`,children:[(0,O.jsx)(e,{"aria-describedby":l,checked:u,id:c,onCheckedChange:e=>d(e===!0)}),(0,O.jsxs)(`span`,{className:`space-y-1`,children:[(0,O.jsx)(`label`,{className:`block font-medium`,htmlFor:c,children:`Delete Session files`}),(0,O.jsx)(`span`,{className:`block text-[var(--muted-foreground)] text-xs`,id:l,children:`Remove the rollout JSONL from disk as well, so Codex cannot backfill this thread later.`})]})]}):null,(0,O.jsxs)(Mt,{children:[(0,O.jsx)(It,{className:`border-[var(--border)]`,children:`Cancel`}),(0,O.jsx)(Ft,{className:`bg-[var(--destructive)] text-[var(--destructive-foreground)] hover:bg-[var(--destructive)]/90`,onClick:()=>o({deleteSessionFiles:u}),children:t})]})]})})}export{q as a,ke as c,je as d,le as f,pt as i,Oe as l,Et as n,Ae as o,ce as p,Tt as r,Me as s,Lt as t,K as u};
@@ -1 +0,0 @@
1
- import{a as e,c as t,d as n,l as r,o as i,s as a,u as o}from"./delete-confirm-dialog-CIZy_LXD.js";import{t as s}from"./checkbox-DjHij7DJ.js";import{a as c,i as l,n as u,r as d,t as f}from"./select-B1kH_5lx.js";import{H as p,W as m,dt as h,g,mt as _,pt as v}from"./index-C_-e0lDI.js";var y=m(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),b=m(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),x=_(v(),1),S=h();function C({...e}){return(0,S.jsx)(o,{"data-slot":`dialog`,...e})}function w({...e}){return(0,S.jsx)(r,{"data-slot":`dialog-portal`,...e})}function T({className:e,...n}){return(0,S.jsx)(t,{"data-slot":`dialog-overlay`,className:p(`data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...n})}function E({className:t,children:n,showCloseButton:r=!0,...a}){return(0,S.jsxs)(w,{"data-slot":`dialog-portal`,children:[(0,S.jsx)(T,{}),(0,S.jsxs)(i,{"data-slot":`dialog-content`,className:p(`data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg outline-none duration-200 data-[state=closed]:animate-out data-[state=open]:animate-in sm:max-w-lg`,t),...a,children:[n,r&&(0,S.jsxs)(e,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,children:[(0,S.jsx)(b,{}),(0,S.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function D({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`dialog-header`,className:p(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function O({className:t,showCloseButton:n=!1,children:r,...i}){return(0,S.jsxs)(`div`,{"data-slot":`dialog-footer`,className:p(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,t),...i,children:[r,n&&(0,S.jsx)(e,{asChild:!0,children:(0,S.jsx)(g,{variant:`outline`,children:`Close`})})]})}function k({className:e,...t}){return(0,S.jsx)(n,{"data-slot":`dialog-title`,className:p(`font-semibold text-lg leading-none`,e),...t})}function A({className:e,...t}){return(0,S.jsx)(a,{"data-slot":`dialog-description`,className:p(`text-muted-foreground text-sm`,e),...t})}function j({open:e,pending:t=!1,title:n=`Export thread`,onExport:r,onOpenChange:i}){let[a,o]=(0,x.useState)(`md`),[p,m]=(0,x.useState)(!0),[h,_]=(0,x.useState)(!1),[v,y]=(0,x.useState)(!0);return(0,S.jsx)(C,{open:e,onOpenChange:i,children:(0,S.jsxs)(E,{className:`border-[var(--border)] bg-[var(--panel)] text-[var(--foreground)]`,children:[(0,S.jsxs)(D,{children:[(0,S.jsx)(k,{children:n}),(0,S.jsx)(A,{className:`text-[var(--muted-foreground)]`,children:`Choose the transcript format and whether the export includes tool calls.`})]}),(0,S.jsxs)(`div`,{className:`space-y-5 py-2`,children:[(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(`label`,{className:`font-medium text-sm`,htmlFor:`output-format`,children:`Output format`}),(0,S.jsxs)(f,{value:a,onValueChange:e=>o(e),children:[(0,S.jsx)(l,{id:`output-format`,className:`border-[var(--border)] bg-[var(--panel-secondary)]`,children:(0,S.jsx)(c,{placeholder:`Choose a format`})}),(0,S.jsxs)(u,{children:[(0,S.jsx)(d,{value:`md`,children:`Markdown (.md)`}),(0,S.jsx)(d,{value:`txt`,children:`Plain text (.txt)`})]})]})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-3 rounded-2xl border border-[var(--border)] bg-[var(--panel-secondary)] p-3`,children:[(0,S.jsx)(s,{"aria-label":`Include metadata`,checked:p,onCheckedChange:e=>m(e===!0)}),(0,S.jsxs)(`span`,{className:`space-y-1`,children:[(0,S.jsx)(`span`,{className:`block font-medium text-sm`,children:`Include metadata`}),(0,S.jsx)(`span`,{className:`block text-[var(--muted-foreground)] text-sm`,children:`Includes the chat metadata section at the top of the exported transcript.`})]})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-3 rounded-2xl border border-[var(--border)] bg-[var(--panel-secondary)] p-3`,children:[(0,S.jsx)(s,{"aria-label":`Include commentary`,checked:h,onCheckedChange:e=>_(e===!0)}),(0,S.jsxs)(`span`,{className:`space-y-1`,children:[(0,S.jsx)(`span`,{className:`block font-medium text-sm`,children:`Include commentary`}),(0,S.jsx)(`span`,{className:`block text-[var(--muted-foreground)] text-sm`,children:`Includes assistant commentary-phase updates in the exported transcript.`})]})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-3 rounded-2xl border border-[var(--border)] bg-[var(--panel-secondary)] p-3`,children:[(0,S.jsx)(s,{"aria-label":`Include tool calls`,checked:v,onCheckedChange:e=>y(e===!0)}),(0,S.jsxs)(`span`,{className:`space-y-1`,children:[(0,S.jsx)(`span`,{className:`block font-medium text-sm`,children:`Include tool calls`}),(0,S.jsx)(`span`,{className:`block text-[var(--muted-foreground)] text-sm`,children:`Includes tool-call summaries and tool-output summaries in the export.`})]})]})]}),(0,S.jsxs)(O,{children:[(0,S.jsx)(g,{className:`rounded-full`,variant:`outline`,onClick:()=>i(!1),children:`Cancel`}),(0,S.jsx)(g,{className:`rounded-full`,disabled:t,onClick:()=>r({includeCommentary:h,includeMetadata:p,includeTools:v,outputFormat:a}),children:t?`Exporting...`:`Download export`})]})]})})}var M=6,N=250,P=3e4,F=(e,t,n,r)=>{e[t](`[spiracha:download] ${n}`,r)},I=e=>new Promise(t=>{window.setTimeout(t,e)}),L=(e,t,n)=>{let r=e.createElement(`a`);r.href=t,r.download=n,e.body.append(r),r.click(),r.remove()},R=e=>e>=200&&e<400||e===405,z=async(e,t,{fetchImpl:n=fetch,logger:r=console,maxAttempts:i=M,retryDelayMs:a=N,sleep:o=I}={})=>{for(let s=1;s<=i;s+=1){try{let i=await n(e,{cache:`no-store`,method:`HEAD`});if(R(i.status)){F(r,`info`,`url_ready`,{attempt:s,downloadUrl:e,fileName:t,status:i.status});return}F(r,`warn`,`url_not_ready`,{attempt:s,downloadUrl:e,fileName:t,status:i.status})}catch(n){F(r,`warn`,`url_probe_failed`,{attempt:s,downloadUrl:e,error:n instanceof Error?n.message:String(n),fileName:t})}s<i&&await o(a)}throw Error(`Download file was not available after ${i} attempts: ${t}`)},B=async(e,t,{documentRef:n=document,fetchImpl:r=fetch,logger:i=console,maxAttempts:a=M,retryDelayMs:o=N,sleep:s=I}={})=>{F(i,`info`,`start`,{downloadUrl:t,fileName:e}),await z(t,e,{fetchImpl:r,logger:i,maxAttempts:a,retryDelayMs:o,sleep:s}),L(n,t,e),F(i,`info`,`triggered`,{downloadUrl:t,fileName:e})},V=(e,t,n,{createObjectUrl:r=e=>URL.createObjectURL(e),documentRef:i=document,logger:a=console,revokeDelayMs:o=P,revokeObjectUrl:s=e=>URL.revokeObjectURL(e),schedule:c=(e,t)=>{window.setTimeout(e,t)}}={})=>{F(a,`info`,`inline_start`,{fileName:e,mimeType:n,sizeBytes:t.length});let l=r(new Blob([t],{type:n}));L(i,l,e),c(()=>s(l),o),F(a,`info`,`inline_triggered`,{fileName:e,mimeType:n,sizeBytes:t.length})};export{y as a,b as i,B as n,j as r,V as t};
@@ -1,41 +0,0 @@
1
- import{B as e,L as t,M as n,P as r,T as i,dt as a,mt as o,pt as s}from"./index-C_-e0lDI.js";var c=o(s(),1),l=a();function u(r){let i=r+`CollectionProvider`,[a,o]=n(i),[s,u]=a(i,{collectionRef:{current:null},itemMap:new Map}),d=e=>{let{scope:t,children:n}=e,r=c.useRef(null),i=c.useRef(new Map).current;return(0,l.jsx)(s,{scope:t,itemMap:i,collectionRef:r,children:n})};d.displayName=i;let f=r+`CollectionSlot`,p=t(f),m=c.forwardRef((t,n)=>{let{scope:r,children:i}=t;return(0,l.jsx)(p,{ref:e(n,u(f,r).collectionRef),children:i})});m.displayName=f;let h=r+`CollectionItemSlot`,g=`data-radix-collection-item`,_=t(h),v=c.forwardRef((t,n)=>{let{scope:r,children:i,...a}=t,o=c.useRef(null),s=e(n,o),d=u(h,r);return c.useEffect(()=>(d.itemMap.set(o,{ref:o,...a}),()=>void d.itemMap.delete(o))),(0,l.jsx)(_,{[g]:``,ref:s,children:i})});v.displayName=h;function y(e){let t=u(r+`CollectionConsumer`,e);return c.useCallback(()=>{let e=t.collectionRef.current;if(!e)return[];let n=Array.from(e.querySelectorAll(`[${g}]`));return Array.from(t.itemMap.values()).sort((e,t)=>n.indexOf(e.ref.current)-n.indexOf(t.ref.current))},[t.collectionRef,t.itemMap])}return[{Provider:d,Slot:m,ItemSlot:v},y,o]}var d=c.createContext(void 0);function f(e){let t=c.useContext(d);return e||t||`ltr`}var p=`focusScope.autoFocusOnMount`,m=`focusScope.autoFocusOnUnmount`,h={bubbles:!1,cancelable:!0},g=`FocusScope`,_=c.forwardRef((t,n)=>{let{loop:a=!1,trapped:o=!1,onMountAutoFocus:s,onUnmountAutoFocus:u,...d}=t,[f,g]=c.useState(null),_=i(s),x=i(u),S=c.useRef(null),C=e(n,e=>g(e)),E=c.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;c.useEffect(()=>{if(o){let e=function(e){if(E.paused||!f)return;let t=e.target;f.contains(t)?S.current=t:w(S.current,{select:!0})},t=function(e){if(E.paused||!f)return;let t=e.relatedTarget;t!==null&&(f.contains(t)||w(S.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&w(f)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return f&&r.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[o,f,E.paused]),c.useEffect(()=>{if(f){T.add(E);let e=document.activeElement;if(!f.contains(e)){let t=new CustomEvent(p,h);f.addEventListener(p,_),f.dispatchEvent(t),t.defaultPrevented||(v(ee(b(f)),{select:!0}),document.activeElement===e&&w(f))}return()=>{f.removeEventListener(p,_),setTimeout(()=>{let t=new CustomEvent(m,h);f.addEventListener(m,x),f.dispatchEvent(t),t.defaultPrevented||w(e??document.body,{select:!0}),f.removeEventListener(m,x),T.remove(E)},0)}}},[f,_,x,E]);let D=c.useCallback(e=>{if(!a&&!o||E.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,n=document.activeElement;if(t&&n){let t=e.currentTarget,[r,i]=y(t);r&&i?!e.shiftKey&&n===i?(e.preventDefault(),a&&w(r,{select:!0})):e.shiftKey&&n===r&&(e.preventDefault(),a&&w(i,{select:!0})):n===t&&e.preventDefault()}},[a,o,E.paused]);return(0,l.jsx)(r.div,{tabIndex:-1,...d,ref:C,onKeyDown:D})});_.displayName=g;function v(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(w(r,{select:t}),document.activeElement!==n)return}function y(e){let t=b(e);return[x(t,e),x(t.reverse(),e)]}function b(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function x(e,t){for(let n of e)if(!S(n,{upTo:t}))return n}function S(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function C(e){return e instanceof HTMLInputElement&&`select`in e}function w(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&C(e)&&t&&e.select()}}var T=E();function E(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=D(e,t),e.unshift(t)},remove(t){e=D(e,t),e[0]?.resume()}}}function D(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function ee(e){return e.filter(e=>e.tagName!==`A`)}var O=0;function te(){c.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??k()),document.body.insertAdjacentElement(`beforeend`,e[1]??k()),O++,()=>{O===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),O--}},[])}function k(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var A=function(){return A=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},A.apply(this,arguments)};function j(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function ne(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var M=`right-scroll-bar-position`,N=`width-before-scroll-bar`,re=`with-scroll-bars-hidden`,ie=`--removed-body-scroll-bar-size`;function P(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function ae(e,t){var n=(0,c.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var oe=typeof window<`u`?c.useLayoutEffect:c.useEffect,se=new WeakMap;function ce(e,t){var n=ae(t||null,function(t){return e.forEach(function(e){return P(e,t)})});return oe(function(){var t=se.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||P(e,null)}),i.forEach(function(e){r.has(e)||P(e,a)})}se.set(n,e)},[e]),n}function le(e){return e}function ue(e,t){t===void 0&&(t=le);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function de(e){e===void 0&&(e={});var t=ue(null);return t.options=A({async:!0,ssr:!1},e),t}var F=function(e){var t=e.sideCar,n=j(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return c.createElement(r,A({},n))};F.isSideCarExport=!0;function fe(e,t){return e.useMedium(t),F}var I=de(),L=function(){},R=c.forwardRef(function(e,t){var n=c.useRef(null),r=c.useState({onScrollCapture:L,onWheelCapture:L,onTouchMoveCapture:L}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,l=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=j(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=p,C=ce([n,t]),w=A(A({},x),i);return c.createElement(c.Fragment,null,d&&c.createElement(S,{sideCar:I,removeScrollBar:u,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!_,lockRef:n,gapMode:b}),o?c.cloneElement(c.Children.only(s),A(A({},w),{ref:C})):c.createElement(y,A({},w,{className:l,ref:C}),s))});R.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},R.classNames={fullWidth:N,zeroRight:M};var z,pe=function(){if(z)return z;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function me(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=pe();return t&&e.setAttribute(`nonce`,t),e}function he(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ge(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var _e=function(){var e=0,t=null;return{add:function(n){e==0&&(t=me())&&(he(t,n),ge(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ve=function(){var e=_e();return function(t,n){c.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},B=function(){var e=ve();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},ye={left:0,top:0,right:0,gap:0},V=function(e){return parseInt(e||``,10)||0},be=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[V(n),V(r),V(i)]},xe=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return ye;var t=be(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Se=B(),H=`data-scroll-locked`,Ce=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
2
- .${re} {
3
- overflow: hidden ${r};
4
- padding-right: ${s}px ${r};
5
- }
6
- body[${H}] {
7
- overflow: hidden ${r};
8
- overscroll-behavior: contain;
9
- ${[t&&`position: relative ${r};`,n===`margin`&&`
10
- padding-left: ${i}px;
11
- padding-top: ${a}px;
12
- padding-right: ${o}px;
13
- margin-left:0;
14
- margin-top:0;
15
- margin-right: ${s}px ${r};
16
- `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
17
- }
18
-
19
- .${M} {
20
- right: ${s}px ${r};
21
- }
22
-
23
- .${N} {
24
- margin-right: ${s}px ${r};
25
- }
26
-
27
- .${M} .${M} {
28
- right: 0 ${r};
29
- }
30
-
31
- .${N} .${N} {
32
- margin-right: 0 ${r};
33
- }
34
-
35
- body[${H}] {
36
- ${ie}: ${s}px;
37
- }
38
- `},U=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},we=function(){c.useEffect(function(){return document.body.setAttribute(H,(U()+1).toString()),function(){var e=U()-1;e<=0?document.body.removeAttribute(H):document.body.setAttribute(H,e.toString())}},[])},Te=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;we();var a=c.useMemo(function(){return xe(i)},[i]);return c.createElement(Se,{styles:Ce(a,!t,i,n?``:`!important`)})},W=!1;if(typeof window<`u`)try{var G=Object.defineProperty({},"passive",{get:function(){return W=!0,!0}});window.addEventListener(`test`,G,G),window.removeEventListener(`test`,G,G)}catch{W=!1}var K=W?{passive:!1}:!1,Ee=function(e){return e.tagName===`TEXTAREA`},q=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Ee(e)&&n[t]===`visible`)},De=function(e){return q(e,`overflowY`)},Oe=function(e){return q(e,`overflowX`)},ke=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Me(e,r)){var i=Ne(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ae=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},je=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Me=function(e,t){return e===`v`?De(t):Oe(t)},Ne=function(e,t){return e===`v`?Ae(t):je(t)},Pe=function(e,t){return e===`h`&&t===`rtl`?-1:1},Fe=function(e,t,n,r,i){var a=Pe(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Ne(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Me(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},J=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Ie=function(e){return[e.deltaX,e.deltaY]},Le=function(e){return e&&`current`in e?e.current:e},Re=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ze=function(e){return`
39
- .block-interactivity-${e} {pointer-events: none;}
40
- .allow-interactivity-${e} {pointer-events: all;}
41
- `},Be=0,Y=[];function Ve(e){var t=c.useRef([]),n=c.useRef([0,0]),r=c.useRef(),i=c.useState(Be++)[0],a=c.useState(B)[0],o=c.useRef(e);c.useEffect(function(){o.current=e},[e]),c.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=ne([e.lockRef.current],(e.shards||[]).map(Le),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=c.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=J(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=ke(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=ke(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Fe(h,t,e,h===`h`?s:c,!0)},[]),l=c.useCallback(function(e){var n=e;if(!(!Y.length||Y[Y.length-1]!==a)){var r=`deltaY`in n?Ie(n):J(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Re(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Le).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),u=c.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:He(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),d=c.useCallback(function(e){n.current=J(e),r.current=void 0},[]),f=c.useCallback(function(t){u(t.type,Ie(t),t.target,s(t,e.lockRef.current))},[]),p=c.useCallback(function(t){u(t.type,J(t),t.target,s(t,e.lockRef.current))},[]);c.useEffect(function(){return Y.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener(`wheel`,l,K),document.addEventListener(`touchmove`,l,K),document.addEventListener(`touchstart`,d,K),function(){Y=Y.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,l,K),document.removeEventListener(`touchmove`,l,K),document.removeEventListener(`touchstart`,d,K)}},[]);var m=e.removeScrollBar,h=e.inert;return c.createElement(c.Fragment,null,h?c.createElement(a,{styles:ze(i)}):null,m?c.createElement(Te,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function He(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Ue=fe(I,Ve),We=c.forwardRef(function(e,t){return c.createElement(R,A({},e,{ref:t,sideCar:Ue}))});We.classNames=R.classNames;var Ge=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},X=new WeakMap,Z=new WeakMap,Q={},$=0,Ke=function(e){return e&&(e.host||Ke(e.parentNode))},qe=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Ke(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Je=function(e,t,n,r){var i=qe(t,Array.isArray(e)?e:[e]);Q[n]||(Q[n]=new WeakMap);var a=Q[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(X.get(e)||0)+1,l=(a.get(e)||0)+1;X.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Z.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),$++,function(){o.forEach(function(e){var t=X.get(e)-1,i=a.get(e)-1;X.set(e,t),a.set(e,i),t||(Z.has(e)||e.removeAttribute(r),Z.delete(e)),i||e.removeAttribute(n)}),$--,$||(X=new WeakMap,X=new WeakMap,Z=new WeakMap,Q={})}},Ye=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Ge(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Je(r,i,n,`aria-hidden`)):function(){return null}};export{f as a,_ as i,We as n,u as o,te as r,Ye as t};
@@ -1 +0,0 @@
1
- import{$ as e,G as t,J as n,Q as r,X as i,Y as a,at as o,ct as s,dt as c,et as l,it as u,mt as d,nt as f,ot as p,pt as m,q as h,rt as g,st as _,tt as v}from"./index-C_-e0lDI.js";var y=class extends s{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=a(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),x(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return S(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return S(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof v(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!g(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&C(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||v(this.options.enabled,this.#t)!==v(t.enabled,this.#t)||f(this.options.staleTime,this.#t)!==f(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||v(this.options.enabled,this.#t)!==v(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return T(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(t){this.#S();let n=this.#t.fetch(this.options,t);return t?.throwOnError||(n=n.catch(e)),n}#g(){this.#b();let e=f(this.options.staleTime,this.#t);if(i.isServer()||this.#r.isStale||!r(e))return;let t=o(this.#r.dataUpdatedAt,e)+1;this.#d=p.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(i.isServer()||v(this.options.enabled,this.#t)===!1||!r(this.#p)||this.#p===0)&&(this.#f=p.setInterval(()=>{(this.options.refetchIntervalInBackground||_.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(p.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(p.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,o=this.#i,s=this.#a,c=e===n?this.#n:e.state,{state:u}=e,d={...u},f=!1,p;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&x(e,t),o=i&&C(e,n,t,r);(a||o)&&(d={...d,...h(u.data,e.options)}),t._optimisticResults===`isRestoring`&&(d.fetchStatus=`idle`)}let{error:m,errorUpdatedAt:g,status:_}=d;p=d.data;let y=!1;if(t.placeholderData!==void 0&&p===void 0&&_===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===s?.placeholderData?(e=i.data,y=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(_=`success`,p=l(i?.data,e,t),f=!0)}if(t.select&&p!==void 0&&!y)if(i&&p===o?.data&&t.select===this.#c)p=this.#l;else try{this.#c=t.select,p=t.select(p),p=l(i?.data,p,t),this.#l=p,this.#s=null}catch(e){this.#s=e}this.#s&&(m=this.#s,p=this.#l,g=Date.now(),_=`error`);let b=d.fetchStatus===`fetching`,S=_===`pending`,T=_===`error`,E=S&&b,D=p!==void 0,O={status:_,fetchStatus:d.fetchStatus,isPending:S,isSuccess:_===`success`,isError:T,isInitialLoading:E,isLoading:E,data:p,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:d.dataUpdateCount>c.dataUpdateCount||d.errorUpdateCount>c.errorUpdateCount,isFetching:b,isRefetching:b&&!S,isLoadingError:T&&!D,isPaused:d.fetchStatus===`paused`,isPlaceholderData:f,isRefetchError:T&&D,isStale:w(e,t),refetch:this.refetch,promise:this.#o,isEnabled:v(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=O.data!==void 0,r=O.status===`error`&&!t,i=e=>{r?e.reject(O.error):t&&e.resolve(O.data)},o=()=>{i(this.#o=O.promise=a())},s=this.#o;switch(s.status){case`pending`:e.queryHash===n.queryHash&&i(s);break;case`fulfilled`:(r||O.data!==s.value)&&o();break;case`rejected`:(!r||O.error!==s.reason)&&o();break}}return O}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!g(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){n.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function b(e,t){return v(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&v(t.retryOnMount,e)===!1)}function x(e,t){return b(e,t)||e.state.data!==void 0&&S(e,t,t.refetchOnMount)}function S(e,t,n){if(v(t.enabled,e)!==!1&&f(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&w(e,t)}return!1}function C(e,t,n,r){return(e!==t||v(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&w(e,n)}function w(e,t){return v(t.enabled,e)!==!1&&e.isStaleByTime(f(t.staleTime,e))}function T(e,t){return!g(e.getCurrentResult(),t)}c();var E=d(m(),1),D=E.createContext(!1),O=()=>E.useContext(D);D.Provider;function k(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var A=E.createContext(k()),j=()=>E.useContext(A),M=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?u(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},N=e=>{E.useEffect(()=>{e.clearReset()},[e])},P=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||u(n,[e.error,r])),F=(e,t)=>t.state.data===void 0,I=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},L=(e,t)=>e.isLoading&&e.isFetching&&!t,R=(e,t)=>e?.suspense&&t.isPending,z=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function B(r,a,o){let s=O(),c=j(),l=t(o),u=l.defaultQueryOptions(r);l.getDefaultOptions().queries?._experimental_beforeQuery?.(u);let d=l.getQueryCache().get(u.queryHash),f=r.subscribed!==!1;u._optimisticResults=s?`isRestoring`:f?`optimistic`:void 0,I(u),M(u,c,d),N(c);let p=!l.getQueryCache().get(u.queryHash),[m]=E.useState(()=>new a(l,u)),h=m.getOptimisticResult(u),g=!s&&f;if(E.useSyncExternalStore(E.useCallback(t=>{let r=g?m.subscribe(n.batchCalls(t)):e;return m.updateResult(),r},[m,g]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),E.useEffect(()=>{m.setOptions(u)},[u,m]),R(u,h))throw z(u,m,c);if(P({result:h,errorResetBoundary:c,throwOnError:u.throwOnError,query:d,suspense:u.suspense}))throw h.error;return l.getDefaultOptions().queries?._experimental_afterQuery?.(u,h),u.experimental_prefetchInRender&&!i.isServer()&&L(h,s)&&(p?z(u,m,c):d?.promise)?.catch(e).finally(()=>{m.updateResult()}),u.notifyOnChangeProps?h:m.trackResult(h)}function V(e,t){return B({...e,enabled:!0,suspense:!0,throwOnError:F,placeholderData:void 0},y,t)}var H=e=>e?e.split(/[-_\s]+/u).filter(Boolean).map(e=>{let t=e.toLowerCase();return t===`gpt`?`GPT`:/^[a-z]\d$/u.test(t)?t.toUpperCase():/^\d+(\.\d+)*$/u.test(e)?e:`${e.slice(0,1).toUpperCase()}${e.slice(1)}`}).join(` `):`Assistant`,U=new Map,W=e=>{let t=e??`local`,n=U.get(t);if(n)return n;let r={dayKeyFormatter:new Intl.DateTimeFormat(`en-CA`,{day:`2-digit`,month:`2-digit`,timeZone:e,year:`numeric`}),timePartsFormatter:new Intl.DateTimeFormat(`en-US`,{day:`numeric`,hour:`numeric`,hour12:!0,minute:`2-digit`,month:`short`,timeZone:e,year:`numeric`})};return U.set(t,r),r},G=(e,t)=>W(t).dayKeyFormatter.format(e),K=(e,t)=>{let n=W(t).timePartsFormatter.formatToParts(e),r=new Map(n.map(e=>[e.type,e.value])),i=r.get(`hour`),a=r.get(`minute`),o=r.get(`dayPeriod`);return!i||!a||!o?null:{day:r.get(`day`)??``,month:r.get(`month`)??``,time:`${i}:${a} ${o}`.trim(),year:r.get(`year`)??``}},q=e=>new Intl.NumberFormat(`en-US`).format(e),J=e=>`${q(e)} tokens`,Y=e=>{if(!e||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;let i=n>=100||r===0?0:1;return`${n.toFixed(i)} ${t[r]}`},X=(e,t={})=>{if(e==null||e===``)return`n/a`;let n=new Date(e);if(Number.isNaN(n.getTime()))return`n/a`;let r=t.now??new Date,i=K(n,t.timeZone);if(!i)return`n/a`;let{day:a,month:o,time:s,year:c}=i;if(G(n,t.timeZone)===G(r,t.timeZone))return s;let l=K(r,t.timeZone)?.year;return c&&l&&c!==l?`${o} ${a}, ${c} · ${s}`:`${o} ${a} · ${s}`},Z=e=>e.length===0?`n/a`:e.join(`, `),Q=e=>e?`Yes`:`No`,$=H;export{$ as a,V as c,Z as i,B as l,Y as n,q as o,X as r,J as s,Q as t,y as u};