@kaitranntt/ccs 6.5.0 → 6.6.0-dev.3
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.
- package/README.md +1 -0
- package/dist/ccs.js +7 -4
- package/dist/ccs.js.map +1 -1
- package/dist/cliproxy/binary-manager.d.ts +16 -2
- package/dist/cliproxy/binary-manager.d.ts.map +1 -1
- package/dist/cliproxy/binary-manager.js +39 -15
- package/dist/cliproxy/binary-manager.js.map +1 -1
- package/dist/cliproxy/cliproxy-executor.d.ts.map +1 -1
- package/dist/cliproxy/cliproxy-executor.js +208 -118
- package/dist/cliproxy/cliproxy-executor.js.map +1 -1
- package/dist/cliproxy/config-generator.d.ts +21 -1
- package/dist/cliproxy/config-generator.d.ts.map +1 -1
- package/dist/cliproxy/config-generator.js +60 -9
- package/dist/cliproxy/config-generator.js.map +1 -1
- package/dist/cliproxy/proxy-config-resolver.d.ts +79 -0
- package/dist/cliproxy/proxy-config-resolver.d.ts.map +1 -0
- package/dist/cliproxy/proxy-config-resolver.js +208 -0
- package/dist/cliproxy/proxy-config-resolver.js.map +1 -0
- package/dist/cliproxy/remote-proxy-client.d.ts +51 -0
- package/dist/cliproxy/remote-proxy-client.d.ts.map +1 -0
- package/dist/cliproxy/remote-proxy-client.js +198 -0
- package/dist/cliproxy/remote-proxy-client.js.map +1 -0
- package/dist/cliproxy/service-manager.d.ts.map +1 -1
- package/dist/cliproxy/service-manager.js +4 -0
- package/dist/cliproxy/service-manager.js.map +1 -1
- package/dist/cliproxy/stats-fetcher.d.ts +24 -0
- package/dist/cliproxy/stats-fetcher.d.ts.map +1 -1
- package/dist/cliproxy/stats-fetcher.js +56 -1
- package/dist/cliproxy/stats-fetcher.js.map +1 -1
- package/dist/cliproxy/types.d.ts +24 -0
- package/dist/cliproxy/types.d.ts.map +1 -1
- package/dist/commands/cleanup-command.d.ts +1 -0
- package/dist/commands/cleanup-command.d.ts.map +1 -1
- package/dist/commands/cleanup-command.js +158 -10
- package/dist/commands/cleanup-command.js.map +1 -1
- package/dist/commands/help-command.d.ts.map +1 -1
- package/dist/commands/help-command.js +17 -0
- package/dist/commands/help-command.js.map +1 -1
- package/dist/commands/update-command.d.ts +1 -1
- package/dist/commands/update-command.d.ts.map +1 -1
- package/dist/commands/update-command.js +24 -132
- package/dist/commands/update-command.js.map +1 -1
- package/dist/config/unified-config-loader.d.ts +6 -1
- package/dist/config/unified-config-loader.d.ts.map +1 -1
- package/dist/config/unified-config-loader.js +58 -1
- package/dist/config/unified-config-loader.js.map +1 -1
- package/dist/config/unified-config-types.d.ts +74 -2
- package/dist/config/unified-config-types.d.ts.map +1 -1
- package/dist/config/unified-config-types.js +38 -2
- package/dist/config/unified-config-types.js.map +1 -1
- package/dist/copilot/copilot-executor.d.ts.map +1 -1
- package/dist/copilot/copilot-executor.js +6 -1
- package/dist/copilot/copilot-executor.js.map +1 -1
- package/dist/ui/assets/accounts-DNYYJ7ul.js +1 -0
- package/dist/ui/assets/analytics-Dhp2ikxe.js +1 -0
- package/dist/ui/assets/api-CZf-jQ-_.js +1 -0
- package/dist/ui/assets/{card-CR0u1y_L.js → card--rU2tDlq.js} +1 -1
- package/dist/ui/assets/{charts-D_0N6JY8.js → charts-B9Jh-s-X.js} +1 -1
- package/dist/ui/assets/cliproxy-DZ_5oEVY.js +1 -0
- package/dist/ui/assets/{cliproxy-control-panel-DIIw97Bs.js → cliproxy-control-panel-DKMAi4_4.js} +1 -1
- package/dist/ui/assets/{code-editor-CVohe7u9.js → code-editor-CYOD5x0C.js} +1 -1
- package/dist/ui/assets/{code-highlight-C2TXE0-z.js → code-highlight-BoHWVYut.js} +1 -1
- package/dist/ui/assets/copilot-Dd0yazW6.js +4 -0
- package/dist/ui/assets/{form-utils-BXvNPyud.js → form-utils-BuXDJb0w.js} +1 -1
- package/dist/ui/assets/{health-Dh8bSHe-.js → health-CyZQOQg7.js} +1 -1
- package/dist/ui/assets/icons-BOsxPbiD.js +1 -0
- package/dist/ui/assets/index-Brq6EBKZ.css +1 -0
- package/dist/ui/assets/index-Ced9Xuhx.js +48 -0
- package/dist/ui/assets/{notifications-cqk-Qeo2.js → notifications-B2Pz7lik.js} +1 -1
- package/dist/ui/assets/{radix-ui-VbLlN_Dz.js → radix-ui-DFHQr9A5.js} +1 -1
- package/dist/ui/assets/react-vendor-FspHSO0w.js +3 -0
- package/dist/ui/assets/settings-COL3veEu.js +1 -0
- package/dist/ui/assets/{shared-DQlPCpix.js → shared-BG9bijB0.js} +1 -1
- package/dist/ui/assets/{switch-pOvJh4Ez.js → switch-fBCFt0Fe.js} +1 -1
- package/dist/ui/assets/{tanstack-yybD444-.js → tanstack-C4gT2P7V.js} +1 -1
- package/dist/ui/index.html +9 -9
- package/dist/utils/package-manager-detector.d.ts +1 -4
- package/dist/utils/package-manager-detector.d.ts.map +1 -1
- package/dist/utils/package-manager-detector.js +2 -61
- package/dist/utils/package-manager-detector.js.map +1 -1
- package/dist/web-server/index.d.ts.map +1 -1
- package/dist/web-server/index.js +3 -0
- package/dist/web-server/index.js.map +1 -1
- package/dist/web-server/routes/proxy-routes.d.ts +11 -0
- package/dist/web-server/routes/proxy-routes.d.ts.map +1 -0
- package/dist/web-server/routes/proxy-routes.js +88 -0
- package/dist/web-server/routes/proxy-routes.js.map +1 -0
- package/dist/web-server/routes.d.ts.map +1 -1
- package/dist/web-server/routes.js +141 -2
- package/dist/web-server/routes.js.map +1 -1
- package/package.json +6 -3
- package/scripts/send-discord-release.cjs +214 -0
- package/scripts/worker.js +18 -38
- package/VERSION +0 -1
- package/dist/ui/assets/accounts-OHf-47mH.js +0 -1
- package/dist/ui/assets/analytics-C4uOxyuU.js +0 -1
- package/dist/ui/assets/api-B_mbwU9C.js +0 -1
- package/dist/ui/assets/cliproxy-tXwMpEJd.js +0 -1
- package/dist/ui/assets/copilot-C-eWI9Ce.js +0 -4
- package/dist/ui/assets/icons-WTNLz24z.js +0 -1
- package/dist/ui/assets/index-BXPLu3zJ.js +0 -44
- package/dist/ui/assets/index-D2qNwUdc.css +0 -1
- package/dist/ui/assets/react-vendor-DMek_JCF.js +0 -3
- package/dist/ui/assets/settings-Bi8Aw4yN.js +0 -1
- package/scripts/sync-version-plugin.cjs +0 -41
- package/scripts/sync-version.js +0 -15
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Send Release Notification to Discord using Embeds
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* node send-discord-release.cjs <type> <webhook-url>
|
|
6
|
+
*
|
|
7
|
+
* Args:
|
|
8
|
+
* type: 'production' or 'dev'
|
|
9
|
+
* webhook-url: Discord webhook URL
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
const https = require('https');
|
|
14
|
+
const { URL } = require('url');
|
|
15
|
+
|
|
16
|
+
const releaseType = process.argv[2]; // 'production' or 'dev'
|
|
17
|
+
const webhookUrl = process.argv[3];
|
|
18
|
+
|
|
19
|
+
if (!releaseType || !webhookUrl) {
|
|
20
|
+
console.error('Usage: node send-discord-release.cjs <type> <webhook-url>');
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Validate webhook URL is Discord
|
|
25
|
+
try {
|
|
26
|
+
const parsed = new URL(webhookUrl);
|
|
27
|
+
if (!parsed.hostname.endsWith('discord.com') || !parsed.pathname.startsWith('/api/webhooks/')) {
|
|
28
|
+
console.error('[X] Invalid Discord webhook URL');
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
} catch {
|
|
32
|
+
console.error('[X] Invalid URL format');
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Extract latest release from CHANGELOG.md
|
|
38
|
+
*/
|
|
39
|
+
function extractLatestRelease() {
|
|
40
|
+
const changelogPath = 'CHANGELOG.md';
|
|
41
|
+
|
|
42
|
+
if (!fs.existsSync(changelogPath)) {
|
|
43
|
+
return {
|
|
44
|
+
version: 'Unknown',
|
|
45
|
+
date: new Date().toISOString().split('T')[0],
|
|
46
|
+
sections: {},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const content = fs.readFileSync(changelogPath, 'utf8');
|
|
51
|
+
const lines = content.split('\n');
|
|
52
|
+
|
|
53
|
+
let version = 'Unknown';
|
|
54
|
+
let date = new Date().toISOString().split('T')[0];
|
|
55
|
+
let collecting = false;
|
|
56
|
+
let currentSection = null;
|
|
57
|
+
const sections = {};
|
|
58
|
+
|
|
59
|
+
for (const line of lines) {
|
|
60
|
+
// Match: ## [1.0.0](url) (2025-01-01) or ## 1.0.0 (2025-01-01)
|
|
61
|
+
const versionMatch = line.match(/^## \[?(\d+\.\d+\.\d+(?:-dev\.\d+)?)\]?.*?\((\d{4}-\d{2}-\d{2})\)/);
|
|
62
|
+
if (versionMatch) {
|
|
63
|
+
if (!collecting) {
|
|
64
|
+
version = versionMatch[1];
|
|
65
|
+
date = versionMatch[2];
|
|
66
|
+
collecting = true;
|
|
67
|
+
continue;
|
|
68
|
+
} else {
|
|
69
|
+
break; // Found next version, stop
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (!collecting) continue;
|
|
74
|
+
|
|
75
|
+
// Match section headers: ### Features, ### Bug Fixes
|
|
76
|
+
const sectionMatch = line.match(/^### (.+)/);
|
|
77
|
+
if (sectionMatch) {
|
|
78
|
+
currentSection = sectionMatch[1];
|
|
79
|
+
sections[currentSection] = [];
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Collect bullet points
|
|
84
|
+
if (currentSection && line.trim().startsWith('*')) {
|
|
85
|
+
const item = line.trim().substring(1).trim();
|
|
86
|
+
if (item) {
|
|
87
|
+
sections[currentSection].push(item);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return { version, date, sections };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Create Discord embed
|
|
97
|
+
*/
|
|
98
|
+
function createEmbed(release) {
|
|
99
|
+
const isDev = releaseType === 'dev';
|
|
100
|
+
const color = isDev ? 0xf59e0b : 0x10b981; // Orange for dev, Green for production
|
|
101
|
+
const title = isDev ? `Dev Release ${release.version}` : `Release ${release.version}`;
|
|
102
|
+
const url = `https://github.com/kaitranntt/ccs/releases/tag/v${release.version}`;
|
|
103
|
+
|
|
104
|
+
// Section name to indicator mapping (ASCII only per CLAUDE.md)
|
|
105
|
+
const sectionIndicators = {
|
|
106
|
+
Features: '[+]',
|
|
107
|
+
'Bug Fixes': '[X]',
|
|
108
|
+
Documentation: '[i]',
|
|
109
|
+
Styles: '[~]',
|
|
110
|
+
'Code Refactoring': '[~]',
|
|
111
|
+
'Performance Improvements': '[!]',
|
|
112
|
+
Tests: '[T]',
|
|
113
|
+
'Build System': '[B]',
|
|
114
|
+
CI: '[C]',
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const fields = [];
|
|
118
|
+
|
|
119
|
+
for (const [sectionName, items] of Object.entries(release.sections)) {
|
|
120
|
+
if (items.length === 0) continue;
|
|
121
|
+
|
|
122
|
+
const indicator = sectionIndicators[sectionName] || '[*]';
|
|
123
|
+
let fieldValue = items.map((item) => `• ${item}`).join('\n');
|
|
124
|
+
|
|
125
|
+
// Discord field value max is 1024 characters
|
|
126
|
+
if (fieldValue.length > 1024) {
|
|
127
|
+
const truncateAt = fieldValue.lastIndexOf('\n', 1000);
|
|
128
|
+
fieldValue = fieldValue.substring(0, truncateAt > 0 ? truncateAt : 1000) + '\n... *(truncated)*';
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
fields.push({
|
|
132
|
+
name: `${indicator} ${sectionName}`,
|
|
133
|
+
value: fieldValue,
|
|
134
|
+
inline: false,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (fields.length === 0) {
|
|
139
|
+
fields.push({
|
|
140
|
+
name: '[i] Release Notes',
|
|
141
|
+
value: 'Release completed. See changelog on GitHub.',
|
|
142
|
+
inline: false,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return {
|
|
147
|
+
title,
|
|
148
|
+
url,
|
|
149
|
+
color,
|
|
150
|
+
timestamp: new Date().toISOString(),
|
|
151
|
+
footer: {
|
|
152
|
+
text: isDev ? 'npm i @kaitranntt/ccs@dev' : 'npm i @kaitranntt/ccs@latest',
|
|
153
|
+
},
|
|
154
|
+
fields,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Send to Discord webhook
|
|
160
|
+
*/
|
|
161
|
+
function sendToDiscord(embed) {
|
|
162
|
+
const payload = {
|
|
163
|
+
username: releaseType === 'dev' ? 'CCS Dev Release' : 'CCS Release',
|
|
164
|
+
embeds: [embed],
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const url = new URL(webhookUrl);
|
|
168
|
+
const options = {
|
|
169
|
+
hostname: url.hostname,
|
|
170
|
+
path: url.pathname + url.search,
|
|
171
|
+
method: 'POST',
|
|
172
|
+
headers: {
|
|
173
|
+
'Content-Type': 'application/json',
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const req = https.request(options, (res) => {
|
|
178
|
+
let data = '';
|
|
179
|
+
|
|
180
|
+
res.on('data', (chunk) => {
|
|
181
|
+
data += chunk;
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
res.on('end', () => {
|
|
185
|
+
if (res.statusCode >= 200 && res.statusCode < 300) {
|
|
186
|
+
console.log('[OK] Discord notification sent');
|
|
187
|
+
} else {
|
|
188
|
+
console.error(`[X] Discord webhook failed: ${res.statusCode}`);
|
|
189
|
+
console.error(data);
|
|
190
|
+
process.exit(1);
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
req.on('error', (error) => {
|
|
196
|
+
console.error('[X] Error sending Discord notification:', error);
|
|
197
|
+
process.exit(1);
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
req.write(JSON.stringify(payload));
|
|
201
|
+
req.end();
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Main
|
|
205
|
+
try {
|
|
206
|
+
const release = extractLatestRelease();
|
|
207
|
+
console.log(`[i] Preparing ${releaseType} notification for v${release.version}`);
|
|
208
|
+
|
|
209
|
+
const embed = createEmbed(release);
|
|
210
|
+
sendToDiscord(embed);
|
|
211
|
+
} catch (error) {
|
|
212
|
+
console.error('[X] Error:', error);
|
|
213
|
+
process.exit(1);
|
|
214
|
+
}
|
package/scripts/worker.js
CHANGED
|
@@ -1,46 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CCS CloudFlare Worker - Redirect to npm Installation
|
|
3
|
+
*
|
|
4
|
+
* Legacy shell installers are deprecated. This worker now redirects
|
|
5
|
+
* all /install* and /uninstall* requests to the npm installation docs.
|
|
6
|
+
*/
|
|
1
7
|
export default {
|
|
2
8
|
async fetch(request) {
|
|
3
9
|
const url = new URL(request.url);
|
|
10
|
+
const docsUrl = 'https://docs.ccs.kaitran.ca/getting-started/installation';
|
|
4
11
|
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
filePath = 'installers/install.ps1';
|
|
16
|
-
} else if (url.pathname === '/uninstall' || url.pathname === '/uninstall.sh') {
|
|
17
|
-
filePath = (isWindows && isPowerShell) ? 'installers/uninstall.ps1' : 'installers/uninstall.sh';
|
|
18
|
-
} else if (url.pathname === '/uninstall.ps1') {
|
|
19
|
-
filePath = 'installers/uninstall.ps1';
|
|
20
|
-
} else {
|
|
21
|
-
return new Response('Not Found', { status: 404 });
|
|
12
|
+
// Redirect all install/uninstall paths to npm installation docs
|
|
13
|
+
if (
|
|
14
|
+
url.pathname === '/install' ||
|
|
15
|
+
url.pathname === '/install.sh' ||
|
|
16
|
+
url.pathname === '/install.ps1' ||
|
|
17
|
+
url.pathname === '/uninstall' ||
|
|
18
|
+
url.pathname === '/uninstall.sh' ||
|
|
19
|
+
url.pathname === '/uninstall.ps1'
|
|
20
|
+
) {
|
|
21
|
+
return Response.redirect(docsUrl, 301);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
const githubUrl = `https://raw.githubusercontent.com/kaitranntt/ccs/main/${filePath}`;
|
|
26
|
-
const response = await fetch(githubUrl);
|
|
27
|
-
|
|
28
|
-
if (!response.ok) {
|
|
29
|
-
return new Response('File not found on GitHub', { status: 404 });
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const contentType = filePath.endsWith('.ps1')
|
|
33
|
-
? 'text/plain; charset=utf-8'
|
|
34
|
-
: 'text/x-shellscript; charset=utf-8';
|
|
35
|
-
|
|
36
|
-
return new Response(response.body, {
|
|
37
|
-
headers: {
|
|
38
|
-
'Content-Type': contentType,
|
|
39
|
-
'Cache-Control': 'public, max-age=300'
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
} catch (error) {
|
|
43
|
-
return new Response('Server Error', { status: 500 });
|
|
44
|
-
}
|
|
24
|
+
return new Response('Not Found', { status: 404 });
|
|
45
25
|
}
|
|
46
26
|
};
|
package/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
6.5.0
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-VbLlN_Dz.js";import{a as x,u as p,b as h,d as f,f as l,g as b}from"./tanstack-yybD444-.js";import"./react-vendor-DMek_JCF.js";import{c as r,Z as u,B as g}from"./index-BXPLu3zJ.js";import{t as d}from"./notifications-cqk-Qeo2.js";import{j}from"./icons-WTNLz24z.js";import"./utils-CzKF5WmX.js";import"./form-utils-BXvNPyud.js";import"./code-highlight-C2TXE0-z.js";function y({className:s,...t}){return e.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:e.jsx("table",{"data-slot":"table",className:r("w-full caption-bottom text-sm",s),...t})})}function N({className:s,...t}){return e.jsx("thead",{"data-slot":"table-header",className:r("[&_tr]:border-b",s),...t})}function w({className:s,...t}){return e.jsx("tbody",{"data-slot":"table-body",className:r("[&_tr:last-child]:border-0",s),...t})}function i({className:s,...t}){return e.jsx("tr",{"data-slot":"table-row",className:r("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",s),...t})}function v({className:s,...t}){return e.jsx("th",{"data-slot":"table-head",className:r("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...t})}function C({className:s,...t}){return e.jsx("td",{"data-slot":"table-cell",className:r("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...t})}function D(){return x({queryKey:["accounts"],queryFn:()=>u.accounts.list()})}function T(){const s=p();return h({mutationFn:t=>u.accounts.setDefault(t),onSuccess:(t,o)=>{s.invalidateQueries({queryKey:["accounts"]}),d.success(`Default account set to "${o}"`)},onError:t=>{d.error(t.message)}})}function A({data:s,defaultAccount:t}){const o=T(),c=f({data:s,columns:[{accessorKey:"name",header:"Name",size:200,cell:({row:a})=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:a.original.name}),a.original.name===t&&e.jsx("span",{className:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded border border-primary/20",children:"default"})]})},{accessorKey:"type",header:"Type",size:100,cell:({row:a})=>e.jsx("span",{className:"capitalize text-muted-foreground",children:a.original.type||"oauth"})},{accessorKey:"created",header:"Created",size:150,cell:({row:a})=>{const n=new Date(a.original.created);return e.jsx("span",{className:"text-muted-foreground",children:n.toLocaleDateString()})}},{accessorKey:"last_used",header:"Last Used",size:150,cell:({row:a})=>{if(!a.original.last_used)return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});const n=new Date(a.original.last_used);return e.jsx("span",{className:"text-muted-foreground",children:n.toLocaleDateString()})}},{id:"actions",header:"Actions",size:100,cell:({row:a})=>{const n=a.original.name===t;return e.jsxs(g,{variant:n?"secondary":"default",size:"sm",className:"h-8 px-2 w-full",disabled:n||o.isPending,onClick:()=>o.mutate(a.original.name),children:[e.jsx(j,{className:`w-3 h-3 mr-1.5 ${n?"opacity-50":""}`}),n?"Active":"Set Default"]})}}],getCoreRowModel:b()});return s.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:["No accounts found. Use ",e.jsx("code",{className:"text-sm bg-muted px-1 rounded",children:"ccs login"})," to add accounts."]}):e.jsx("div",{className:"border rounded-md",children:e.jsxs(y,{children:[e.jsx(N,{children:c.getHeaderGroups().map(a=>e.jsx(i,{children:a.headers.map(n=>{const m={name:"w-[200px]",type:"w-[100px]",created:"w-[150px]",last_used:"w-[150px]",actions:"w-[100px]"}[n.id]||"w-auto";return e.jsx(v,{className:m,children:n.isPlaceholder?null:l(n.column.columnDef.header,n.getContext())},n.id)})},a.id))}),e.jsx(w,{children:c.getRowModel().rows.map(a=>e.jsx(i,{children:a.getVisibleCells().map(n=>e.jsx(C,{children:l(n.column.columnDef.cell,n.getContext())},n.id))},a.id))})]})})}function H(){const{data:s,isLoading:t}=D();return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-8",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Accounts"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Manage multi-account Claude sessions (profiles.json)"})]})}),t?e.jsx("div",{className:"text-muted-foreground",children:"Loading accounts..."}):e.jsx(A,{data:s?.accounts||[],defaultAccount:s?.default??null}),e.jsx("div",{className:"text-sm text-muted-foreground border-t pt-4 mt-4",children:e.jsxs("p",{children:["Accounts are isolated Claude instances with separate sessions.",e.jsx("br",{}),"Use ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"ccs auth create <name>"})," to add new accounts via CLI."]})})]})}export{H as AccountsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-VbLlN_Dz.js";import{c as ge,r as p}from"./react-vendor-DMek_JCF.js";import{C as g,a as j,b as N,c as C}from"./card-CR0u1y_L.js";import{c as i,B as I,P as ee,a as je,b as se,C as Ne,u as R,S as m,d as y,g as te,e as B,f as ye,h as be,i as we,j as ve}from"./index-BXPLu3zJ.js";import{K as F,f as k,L as H,H as ke}from"./utils-CzKF5WmX.js";import{N as Ce,O as $e,Q as ae,V as W,Y as re,_ as ne,w as Se,G as De,$ as Q,U as Le,Z as le,z as Fe,a0 as q,a1 as Te,a2 as Me,p as Re,a3 as Pe,b as Ae,a4 as Be}from"./icons-WTNLz24z.js";import{R as ie,A as Ue,C as qe,X as Oe,Y as V,T as oe,a as Z,P as Ie,b as Ke,c as Ee}from"./charts-D_0N6JY8.js";import{u as Ge,a as P}from"./tanstack-yybD444-.js";import"./notifications-cqk-Qeo2.js";import"./form-utils-BXvNPyud.js";import"./code-highlight-C2TXE0-z.js";function He({value:s,onChange:t,presets:a=[{label:"Last 7 days",range:{from:F(new Date,7),to:new Date}},{label:"Last 30 days",range:{from:F(new Date,30),to:new Date}},{label:"Last 90 days",range:{from:F(new Date,90),to:new Date}}],className:d}){const[o,c]=ge.useState(!1),n=r=>!s||!s.from||!s.to||!r.from||!r.to?!1:k(s.from,"yyyy-MM-dd")===k(r.from,"yyyy-MM-dd")&&k(s.to,"yyyy-MM-dd")===k(r.to,"yyyy-MM-dd");return e.jsxs("div",{className:i("flex items-center gap-2",d),children:[a.map(r=>e.jsx(I,{variant:n(r.range)?"default":"outline",size:"sm",onClick:()=>t(r.range),children:r.label},r.label)),e.jsxs(ee,{open:o,onOpenChange:c,children:[e.jsx(je,{asChild:!0,children:e.jsxs(I,{id:"date",variant:"outline",className:i("w-auto min-w-[240px] justify-start text-left font-normal",!s&&"text-muted-foreground"),children:[e.jsx(Ce,{className:"mr-2 h-4 w-4"}),s?.from?s.to?e.jsxs(e.Fragment,{children:[k(s.from,"LLL dd, y")," - ",k(s.to,"LLL dd, y")]}):k(s.from,"LLL dd, y"):e.jsx("span",{children:"Pick a date"})]})}),e.jsx(se,{className:"w-auto p-0",align:"end",children:e.jsx(Ne,{initialFocus:!0,mode:"range",defaultMonth:s?.from,selected:s,onSelect:t,numberOfMonths:2})})]})]})}function We({data:s,isLoading:t}){const{privacyMode:a}=R();if(t)return e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 xl:grid-cols-5 gap-4",children:[1,2,3,4,5].map(n=>e.jsx(g,{children:e.jsx(j,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{className:"h-4 w-[100px]"}),e.jsx(m,{className:"h-8 w-[80px]"})]}),e.jsx(m,{className:"h-8 w-8 rounded-lg"})]})})},n))});const d=(s?.tokenBreakdown?.cacheCreation?.cost??0)+(s?.tokenBreakdown?.cacheRead?.cost??0),o=s?.totalCost?Math.round(d/s.totalCost*100):0,c=[{title:"Total Tokens",value:s?.totalTokens??0,icon:$e,format:n=>M(n),color:"text-blue-600",bgColor:"bg-blue-100 dark:bg-blue-900/20",subtitle:`${M(s?.totalInputTokens??0)} in / ${M(s?.totalOutputTokens??0)} out`},{title:"Total Cost",value:s?.totalCost??0,icon:ae,format:n=>`$${n.toFixed(2)}`,color:"text-green-600",bgColor:"bg-green-100 dark:bg-green-900/20",subtitle:`$${s?.averageCostPerDay?.toFixed(2)??"0.00"}/day avg`},{title:"Cache Tokens",value:s?.totalCacheTokens??0,icon:W,format:n=>M(n),color:"text-cyan-600",bgColor:"bg-cyan-100 dark:bg-cyan-900/20",subtitle:`$${d.toFixed(2)} (${o}% of cost)`},{title:"Input Cost",value:s?.tokenBreakdown?.input?.cost??0,icon:re,format:n=>`$${n.toFixed(2)}`,color:"text-purple-600",bgColor:"bg-purple-100 dark:bg-purple-900/20",subtitle:`${M(s?.tokenBreakdown?.input?.tokens??0)} tokens`},{title:"Output Cost",value:s?.tokenBreakdown?.output?.cost??0,icon:ne,format:n=>`$${n.toFixed(2)}`,color:"text-orange-600",bgColor:"bg-orange-100 dark:bg-orange-900/20",subtitle:`${M(s?.tokenBreakdown?.output?.tokens??0)} tokens`}];return e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 xl:grid-cols-5 gap-4",children:c.map((n,r)=>{const x=n.icon;return e.jsx(g,{className:"hover:shadow-md transition-shadow",children:e.jsx(j,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between space-x-2",children:[e.jsxs("div",{className:"space-y-1 min-w-0",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground truncate",children:n.title}),e.jsx("p",{className:i("text-xl font-bold truncate",a&&y),children:n.format(n.value)}),n.subtitle&&e.jsx("p",{className:i("text-[10px] text-muted-foreground truncate",a&&y),children:n.subtitle})]}),e.jsx("div",{className:i("p-2 rounded-lg shrink-0",n.bgColor),children:e.jsx(x,{className:i("h-4 w-4",n.color)})})]})})},r)})})}function M(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function _e({data:s,isLoading:t,granularity:a="daily",className:d}){const{privacyMode:o}=R(),c=p.useMemo(()=>!s||s.length===0?[]:(a==="hourly"?s:[...s].reverse()).map(x=>{const u="hour"in x?x.hour:x.date;return{...x,dateFormatted:ze(u,a),costRounded:Number(x.cost.toFixed(4))}}),[s,a]);if(t)return e.jsx(m,{className:i("h-full w-full",d)});if(!s||s.length===0)return e.jsx("div",{className:i("h-full flex items-center justify-center",d),children:e.jsx("p",{className:"text-muted-foreground",children:a==="hourly"?"No usage data for today":"No usage data available"})});const n=({x:r,y:x,payload:u,isRight:f})=>{const h=f?`$${u.value}`:X(Number(u.value));return e.jsx("text",{x:r,y:x,dy:4,textAnchor:f?"start":"end",fontSize:12,fill:"currentColor",className:i("fill-muted-foreground",o&&"blur-[4px]"),children:h})};return e.jsx("div",{className:i("w-full h-full",d),children:e.jsx(ie,{width:"100%",height:"100%",children:e.jsxs(Ue,{data:c,margin:{top:5,right:30,left:20,bottom:5},children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"tokenGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#0080FF",stopOpacity:.8}),e.jsx("stop",{offset:"95%",stopColor:"#0080FF",stopOpacity:.1})]}),e.jsxs("linearGradient",{id:"costGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#00C49F",stopOpacity:.8}),e.jsx("stop",{offset:"95%",stopColor:"#00C49F",stopOpacity:.1})]})]}),e.jsx(qe,{strokeDasharray:"3 3",className:"stroke-muted"}),e.jsx(Oe,{dataKey:"dateFormatted",tick:{fontSize:12},tickLine:!1,axisLine:{className:"stroke-muted"}}),e.jsx(V,{yAxisId:"left",orientation:"left",tick:r=>e.jsx(n,{...r,isRight:!1}),tickLine:!1,axisLine:{className:"stroke-muted"}}),e.jsx(V,{yAxisId:"right",orientation:"right",tick:r=>e.jsx(n,{...r,isRight:!0}),tickLine:!1,axisLine:{className:"stroke-muted"}}),e.jsx(oe,{content:({active:r,payload:x,label:u})=>{if(!r||!x||!x.length)return null;const f=x[0].payload;return e.jsxs("div",{className:"rounded-lg border bg-background p-3 shadow-lg",children:[e.jsx("p",{className:"font-medium mb-2",children:u}),x.map((h,S)=>e.jsxs("p",{className:i("text-sm",o&&y),style:{color:h.color},children:[h.name,":"," ",h.name==="Tokens"?X(Number(h.value)||0):`$${h.value}`]},S)),"requests"in f&&e.jsxs("p",{className:i("text-sm text-muted-foreground mt-1",o&&y),children:["Requests: ",f.requests]})]})}}),e.jsx(Z,{yAxisId:"left",type:"monotone",dataKey:"tokens",stroke:"#0080FF",strokeWidth:2,fillOpacity:1,fill:"url(#tokenGradient)",name:"Tokens"}),e.jsx(Z,{yAxisId:"right",type:"monotone",dataKey:"costRounded",stroke:"#00C49F",strokeWidth:2,fillOpacity:1,fill:"url(#costGradient)",name:"Cost"})]})})})}function ze(s,t){if(t==="hourly"){const[d,o]=s.split(" ");if(d&&o){const c=new Date(`${d}T${o}:00Z`);return k(c,"HH:mm")}return s}const a=new Date(s);return t==="monthly"?k(a,"MMM yyyy"):k(a,"MMM dd")}function X(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function Ye({data:s,isLoading:t,className:a}){const{privacyMode:d}=R(),o=p.useMemo(()=>!s||s.length===0?[]:s.map(r=>({name:r.model,value:r.tokens,cost:r.cost,percentage:r.percentage,fill:te(r.model)})),[s]);if(t)return e.jsx(m,{className:i("h-[300px] w-full",a)});if(!s||s.length===0)return e.jsx("div",{className:i("h-[300px] flex items-center justify-center",a),children:e.jsx("p",{className:"text-muted-foreground",children:"No model data available"})});const c=({active:r,payload:x})=>{if(!r||!x)return null;const u=x;if(!u.length)return null;const f=u[0].payload;return e.jsxs("div",{className:"rounded-lg border bg-background p-2 shadow-lg text-xs",children:[e.jsx("p",{className:"font-medium mb-1",children:f.name}),e.jsxs("p",{className:i("text-muted-foreground",d&&y),children:[Qe(f.value)," (",f.percentage.toFixed(1),"%)"]}),e.jsxs("p",{className:i("text-muted-foreground",d&&y),children:["$",f.cost.toFixed(4)]})]})},n=r=>r.percentage>5?`${r.percentage.toFixed(1)}%`:"";return e.jsx("div",{className:i("w-full",a),children:e.jsx(ie,{width:"100%",height:250,children:e.jsxs(Ie,{children:[e.jsx(Ke,{data:o,cx:"50%",cy:"50%",labelLine:!1,label:n,innerRadius:50,outerRadius:70,paddingAngle:2,dataKey:"value",children:o.map((r,x)=>e.jsx(Ee,{fill:r.fill,strokeWidth:1},`cell-${x}`))}),e.jsx(oe,{content:c})]})})})}function Qe(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function Ve({model:s}){const{privacyMode:t}=R(),a=Ze(s.ioRatio);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Se,{className:"h-4 w-4 text-primary shrink-0"}),e.jsx("h4",{className:"font-semibold leading-none truncate",title:s.model,children:s.model})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(B,{variant:"secondary",className:"text-[10px] h-5 px-1.5",children:[s.percentage.toFixed(1),"% usage"]}),e.jsxs(B,{variant:a.variant,className:"text-[10px] h-5 px-1.5",children:[s.ioRatio.toFixed(0),":1 I/O"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsxs("p",{className:i("text-lg font-bold",t&&y),children:["$",s.cost.toFixed(2)]}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Total Cost"})]}),e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsx("p",{className:i("text-lg font-bold",t&&y),children:Je(s.tokens)}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Total Tokens"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h5",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:"Token Breakdown"}),e.jsxs("div",{className:i("space-y-1",t&&y),children:[e.jsx(O,{label:"Input",tokens:s.inputTokens,cost:s.costBreakdown.input.cost,color:"#335c67",icon:re}),e.jsx(O,{label:"Output",tokens:s.outputTokens,cost:s.costBreakdown.output.cost,color:"#fff3b0",icon:ne}),e.jsx(O,{label:"Cache Write",tokens:s.cacheCreationTokens,cost:s.costBreakdown.cacheCreation.cost,color:"#e09f3e",icon:W}),e.jsx(O,{label:"Cache Read",tokens:s.cacheReadTokens,cost:s.costBreakdown.cacheRead.cost,color:"#9e2a2b",icon:W})]})]}),e.jsxs("div",{className:"p-2.5 rounded-md border bg-muted/20 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(De,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs font-medium",children:"Input/Output Ratio"})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground leading-snug",children:a.description})]})]})}function O({label:s,tokens:t,cost:a,color:d,icon:o}){return t===0?null:e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("div",{className:"w-1 h-6 rounded-full shrink-0",style:{backgroundColor:d}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium truncate",children:s}),e.jsxs("span",{className:"font-mono text-muted-foreground",children:["$",a.toFixed(3)]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(o,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{children:Xe(t)})]})]})]})}function Ze(s){return s>=200?{variant:"destructive",description:"Extended thinking or large context loading. Expected for reasoning models."}:s>=50?{variant:"secondary",description:"More input than output. Typical for analysis tasks."}:s>=5?{variant:"outline",description:"Balanced input/output ratio for typical coding tasks."}:{variant:"default",description:"More output than input. Generation-heavy workload."}}function Xe(s){return s.toLocaleString()}function Je(s){return s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toString()}function es({data:s,isLoading:t,className:a}){const{privacyMode:d}=R(),o=p.useMemo(()=>{if(!s?.sessions||s.sessions.length===0)return null;const c=s.sessions,n=s.total,r=c.reduce((v,b)=>v+(b.inputTokens+b.outputTokens),0),x=Math.round(r/c.length),f=c.reduce((v,b)=>v+b.cost,0)/c.length,h=c[0],S=h?H(new Date(h.lastActivity),{addSuffix:!0}):"N/A";return{totalSessions:n,avgTokens:x,avgCost:f,lastActive:S,recentSessions:c.slice(0,3)}},[s]);return t?e.jsxs(g,{className:i("flex flex-col h-full",a),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsx(m,{className:"h-5 w-32"})}),e.jsx(j,{className:"px-3 pb-3 pt-0 flex-1",children:e.jsx(m,{className:"h-full w-full"})})]}):o?e.jsxs(g,{className:i("flex flex-col h-full shadow-sm",a),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs(C,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Q,{className:"w-4 h-4"}),"Session Stats"]})}),e.jsxs(j,{className:"px-3 pb-3 pt-0 flex-1 flex flex-col gap-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-blue-600 dark:text-blue-400",children:[e.jsx(Le,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xl font-bold",children:o.totalSessions})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mt-0.5",children:"Total Sessions"})]}),e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-green-600 dark:text-green-400",children:[e.jsx(le,{className:"w-4 h-4"}),e.jsxs("span",{className:i("text-xl font-bold",d&&y),children:["$",o.avgCost.toFixed(2)]})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mt-0.5",children:"Avg Cost/Session"})]})]}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground font-medium mb-1",children:[e.jsx(Fe,{className:"w-3 h-3"}),"Recent Activity"]}),e.jsx("div",{className:"space-y-1.5",children:o.recentSessions.map(c=>e.jsxs("div",{className:"flex items-center justify-between text-xs p-1.5 rounded bg-muted/30 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[e.jsx("span",{className:"font-medium truncate",title:c.projectPath,children:c.projectPath.split("/").pop()}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:H(new Date(c.lastActivity),{addSuffix:!0})})]}),e.jsxs("div",{className:i("text-right shrink-0 ml-2",d&&y),children:[e.jsxs("div",{className:"font-mono",children:["$",c.cost.toFixed(2)]}),e.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[ss(c.inputTokens+c.outputTokens)," toks"]})]})]},c.sessionId))})]})]})]}):e.jsxs(g,{className:i("flex flex-col h-full",a),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs(C,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Q,{className:"w-4 h-4"}),"Session Stats"]})}),e.jsx(j,{className:"px-3 pb-3 pt-0 flex-1 flex items-center justify-center",children:e.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"No session data available"})})]})}function ss(s){return s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toString()}function ts({className:s,isLoading:t}){const{data:a,isLoading:d}=ye(),{data:o,isLoading:c,error:n}=be(a?.running);if(t||d||a?.running&&c)return e.jsxs(g,{className:i("flex flex-col h-full",s),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs(C,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(q,{className:"h-4 w-4"}),"CLIProxy Stats"]})}),e.jsx(j,{className:"px-3 pb-3 pt-0 flex-1",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(m,{className:"h-4 w-[100px]"}),e.jsx(m,{className:"h-16 w-full"})]})})]});if(!a?.running)return e.jsxs(g,{className:i("flex flex-col h-full border-dashed",s),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(C,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(q,{className:"h-4 w-4 text-muted-foreground"}),"CLIProxy Stats"]}),e.jsx(B,{variant:"secondary",className:"text-[10px] h-5",children:"Offline"})]})}),e.jsx(j,{className:"px-3 pb-3 pt-0 flex-1 flex items-center justify-center",children:e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Start a CLIProxy session (gemini, codex, agy) to collect stats."})})]});if(n)return e.jsxs(g,{className:i("flex flex-col h-full border-destructive/50",s),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(C,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(q,{className:"h-4 w-4"}),"CLIProxy Stats"]}),e.jsx(B,{variant:"destructive",className:"text-[10px] h-5",children:"Error"})]})}),e.jsx(j,{className:"px-3 pb-3 pt-0 flex-1",children:e.jsx("p",{className:"text-xs text-destructive",children:n.message})})]});const x=o?.totalRequests??0,u=o?.quotaExceededCount??0,f=x-u,h=x>0?Math.round(f/x*100):100,S=o?.tokens?.total??0,v=Object.entries(o?.requestsByModel??{}).sort((D,L)=>L[1]-D[1]).slice(0,4),b=v.length>0?v[0][1]:1;return e.jsxs(g,{className:i("flex flex-col h-full overflow-hidden",s),children:[e.jsx(N,{className:"px-3 py-2 border-b bg-muted/5",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(C,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(q,{className:"h-4 w-4"}),"CLIProxy Stats"]}),e.jsxs(B,{variant:"outline",className:"text-[10px] h-5 text-green-600 border-green-200 bg-green-50 dark:bg-green-900/10 dark:border-green-800",children:[e.jsx(le,{className:"h-3 w-3 mr-0.5"}),"Running"]})]})}),e.jsx(j,{className:"p-0 flex-1 min-h-0",children:e.jsx(we,{className:"h-full",children:e.jsxs("div",{className:"p-3 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-muted/30",children:[e.jsxs("div",{className:"relative",children:[e.jsxs("svg",{className:"w-10 h-10 -rotate-90",viewBox:"0 0 36 36",children:[e.jsx("circle",{cx:"18",cy:"18",r:"14",fill:"none",stroke:"currentColor",strokeWidth:"3",className:"text-muted/30"}),e.jsx("circle",{cx:"18",cy:"18",r:"14",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeDasharray:`${h*.88} 88`,strokeLinecap:"round",className:h>=90?"text-green-500":"text-amber-500"})]}),e.jsxs("span",{className:"absolute inset-0 flex items-center justify-center text-[8px] font-bold",children:[h,"%"]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-lg font-bold leading-none",children:J(x)}),e.jsx("div",{className:"text-[9px] text-muted-foreground mt-0.5",children:u>0?`${u} failed`:"All success"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-muted/30",children:[e.jsx("div",{className:"p-1.5 rounded-md bg-purple-100 dark:bg-purple-900/20",children:e.jsx(Te,{className:"h-4 w-4 text-purple-600"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-lg font-bold leading-none",children:J(S)}),e.jsx("div",{className:"text-[9px] text-muted-foreground mt-0.5",children:"Total tokens"})]})]})]}),v.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-medium text-muted-foreground",children:[e.jsx(Me,{className:"h-3 w-3"}),"Models Used"]}),e.jsx("div",{className:"space-y-1",children:v.map(([D,L])=>{const K=Math.round(L/b*100),E=as(D);return e.jsxs("div",{className:"group",children:[e.jsxs("div",{className:"flex items-center justify-between text-[10px] mb-0.5",children:[e.jsx("span",{className:"truncate font-medium",title:D,children:E}),e.jsx("span",{className:"text-muted-foreground shrink-0 ml-2",children:L})]}),e.jsx("div",{className:"h-1 bg-muted/50 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-accent/70 rounded-full transition-all",style:{width:`${K}%`}})})]},D)})})]})]})})})]})}function J(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function as(s){let t=s.replace(/^gemini-claude-/,"").replace(/^gemini-/,"").replace(/^claude-/,"").replace(/^anthropic\./,"").replace(/-thinking$/," Thinking");return t=t.split(/[-_]/).map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" "),t.length>20&&(t=t.slice(0,18)+"..."),t}const rs="/api";function w(s){const t=s.getFullYear(),a=String(s.getMonth()+1).padStart(2,"0"),d=String(s.getDate()).padStart(2,"0");return`${t}${a}${d}`}const T={summary:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",w(s.startDate)),s?.endDate&&t.append("until",w(s.endDate)),s?.profile&&t.append("profile",s.profile),$(`/usage/summary?${t}`)},trends:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",w(s.startDate)),s?.endDate&&t.append("until",w(s.endDate)),s?.profile&&t.append("profile",s.profile),$(`/usage/daily?${t}`)},hourly:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",w(s.startDate)),s?.endDate&&t.append("until",w(s.endDate)),$(`/usage/hourly?${t}`)},models:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",w(s.startDate)),s?.endDate&&t.append("until",w(s.endDate)),s?.profile&&t.append("profile",s.profile),$(`/usage/models?${t}`)},sessions:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",w(s.startDate)),s?.endDate&&t.append("until",w(s.endDate)),s?.profile&&t.append("profile",s.profile),s?.limit&&t.append("limit",s.limit.toString()),s?.offset&&t.append("offset",s.offset.toString()),$(`/usage/sessions?${t}`)},monthly:(s,t)=>{const a=new URLSearchParams;return s&&a.append("months",s.toString()),t&&a.append("profile",t),$(`/usage/monthly?${a}`)},refresh:async()=>{if(!(await fetch(`${rs}/usage/refresh`,{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Failed to refresh usage cache")},status:()=>$("/usage/status"),insights:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",w(s.startDate)),s?.endDate&&t.append("until",w(s.endDate)),s?.profile&&t.append("profile",s.profile),$(`/usage/insights?${t}`)}};async function $(s){const a=await fetch(`/api${s}`,{headers:{"Content-Type":"application/json"}});if(!a.ok){const o=await a.json().catch(()=>({error:"Unknown error"}));throw new Error(o.error||a.statusText)}const d=await a.json();return d.data||d}function ns(s){return P({queryKey:["usage","summary",s],queryFn:()=>T.summary(s),staleTime:60*1e3})}function ls(s){return P({queryKey:["usage","trends",s],queryFn:()=>T.trends(s),staleTime:60*1e3})}function is(s){return P({queryKey:["usage","hourly",s],queryFn:()=>T.hourly(s),staleTime:60*1e3})}function os(s){return P({queryKey:["usage","models",s],queryFn:()=>T.models(s),staleTime:60*1e3})}function cs(){const s=Ge();return p.useCallback(async()=>{await T.refresh(),await s.invalidateQueries({queryKey:["usage"]})},[s])}function ds(){return P({queryKey:["usage","status"],queryFn:()=>T.status(),staleTime:10*1e3,refetchInterval:30*1e3})}function xs(s){return P({queryKey:["usage","sessions",s],queryFn:()=>T.sessions(s),staleTime:60*1e3})}function us(s){return s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(0)}K`:s.toString()}function ks(){const{privacyMode:s}=R(),[t,a]=p.useState({from:F(new Date,30),to:new Date}),[d,o]=p.useState(!1),[c,n]=p.useState(null),[r,x]=p.useState(null),[u,f]=p.useState("daily"),h=p.useRef(null),S=cs(),v=async()=>{o(!0);try{await S()}finally{o(!1)}},b={startDate:t?.from,endDate:t?.to},{data:D,isLoading:L}=ns(b),{data:K,isLoading:E}=ls(b),{data:ce,isLoading:de}=is(b),{data:_,isLoading:z}=os(b),{data:xe,isLoading:ue}=xs({...b,limit:3}),{data:G}=ds(),me=p.useCallback(()=>{const l=new Date;a({from:F(l,1),to:l}),f("hourly")},[]),fe=p.useCallback(l=>{a(l),f("daily")},[]),Y=p.useMemo(()=>G?.lastFetch?H(new Date(G.lastFetch),{addSuffix:!0}):null,[G?.lastFetch]),he=p.useCallback((l,A)=>{const U=A.currentTarget.getBoundingClientRect();x({x:U.left+U.width/2,y:U.top+U.height/2}),n(l)},[]),pe=p.useCallback(()=>{n(null),x(null)},[]);return e.jsxs("div",{className:"flex flex-col h-full overflow-hidden px-4 pt-4 pb-50 gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between shrink-0",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold",children:"Analytics"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Track usage & insights"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(I,{variant:u==="hourly"?"default":"outline",size:"sm",className:"h-8",onClick:me,children:"24H"}),e.jsx(He,{value:t,onChange:fe,presets:[{label:"7D",range:{from:F(new Date,7),to:new Date}},{label:"30D",range:{from:F(new Date,30),to:new Date}},{label:"Month",range:{from:ke(new Date),to:new Date}},{label:"All Time",range:{from:void 0,to:new Date}}]}),Y&&e.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:["Updated ",Y]}),e.jsx(I,{variant:"outline",size:"sm",className:"gap-2 h-8",onClick:v,disabled:d,children:e.jsx(Re,{className:`w-3.5 h-3.5 ${d?"animate-spin":""}`})})]})]}),e.jsx(We,{data:D,isLoading:L}),e.jsxs("div",{className:"flex-1 flex flex-col min-h-0 gap-4",children:[e.jsxs(g,{className:"flex flex-col flex-1 min-h-0 max-h-[500px] overflow-hidden shadow-sm",children:[e.jsx(N,{className:"px-3 py-2 shrink-0",children:e.jsxs(C,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Pe,{className:"w-4 h-4"}),u==="hourly"?"Last 24 Hours":"Usage Trends"]})}),e.jsx(j,{className:"px-3 pb-3 pt-0 flex-1 min-h-0",children:e.jsx(_e,{data:u==="hourly"?ce||[]:K||[],isLoading:u==="hourly"?de:E,granularity:u==="hourly"?"hourly":"daily"})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-10 gap-4 h-auto lg:h-[180px] shrink-0",children:[e.jsxs(g,{className:"flex flex-col h-full min-h-0 shadow-sm lg:col-span-4",children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs(C,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(ae,{className:"w-4 h-4"}),"Cost by Model"]})}),e.jsx(j,{className:"px-2 pb-2 pt-0 flex-1 min-h-0 overflow-y-auto",children:z?e.jsx(m,{className:"h-full w-full"}):e.jsxs("div",{className:"space-y-0.5",children:[[..._||[]].sort((l,A)=>A.cost-l.cost).map(l=>e.jsxs("button",{className:"group flex items-center text-xs w-full hover:bg-muted/50 rounded px-2 py-1.5 transition-colors cursor-pointer gap-3",onClick:A=>he(l,A),title:"Click for details",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-[180px] shrink-0",children:[e.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:te(l.model)}}),e.jsx("span",{className:"font-medium truncate group-hover:underline underline-offset-2",children:l.model})]}),e.jsx("div",{className:"flex-1 flex items-center gap-1 min-w-0",children:e.jsxs("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden flex",children:[e.jsx("div",{className:"h-full",style:{backgroundColor:"#335c67",width:`${l.cost>0?l.costBreakdown.input.cost/l.cost*100:0}%`},title:`Input: $${l.costBreakdown.input.cost.toFixed(2)}`}),e.jsx("div",{className:"h-full",style:{backgroundColor:"#fff3b0",width:`${l.cost>0?l.costBreakdown.output.cost/l.cost*100:0}%`},title:`Output: $${l.costBreakdown.output.cost.toFixed(2)}`}),e.jsx("div",{className:"h-full",style:{backgroundColor:"#e09f3e",width:`${l.cost>0?l.costBreakdown.cacheCreation.cost/l.cost*100:0}%`},title:`Cache Write: $${l.costBreakdown.cacheCreation.cost.toFixed(2)}`}),e.jsx("div",{className:"h-full",style:{backgroundColor:"#9e2a2b",width:`${l.cost>0?l.costBreakdown.cacheRead.cost/l.cost*100:0}%`},title:`Cache Read: $${l.costBreakdown.cacheRead.cost.toFixed(2)}`})]})}),e.jsx("span",{className:i("text-[10px] text-muted-foreground w-14 text-right shrink-0",s&&y),children:us(l.tokens)}),e.jsxs("span",{className:i("font-mono font-medium w-16 text-right shrink-0",s&&y),children:["$",l.cost.toFixed(2)]}),e.jsx(Ae,{className:"w-3 h-3 opacity-0 group-hover:opacity-50 transition-opacity shrink-0"})]},l.model)),e.jsxs("div",{className:"flex items-center gap-3 pt-2 px-2 text-[10px] text-muted-foreground border-t mt-2",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#335c67"}}),"Input"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full border border-muted-foreground/30",style:{backgroundColor:"#fff3b0"}}),"Output"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#e09f3e"}}),"Cache Write"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#9e2a2b"}}),"Cache Read"]})]})]})})]}),e.jsxs(g,{className:"flex flex-col h-full min-h-0 shadow-sm lg:col-span-2",children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs(C,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Be,{className:"w-4 h-4"}),"Model Usage"]})}),e.jsx(j,{className:"px-2 pb-2 pt-0 flex-1 min-h-0 flex items-center justify-center",children:e.jsx(Ye,{data:_||[],isLoading:z,className:"h-full w-full"})})]}),e.jsx(es,{data:xe,isLoading:ue,className:"lg:col-span-2"}),e.jsx(ts,{isLoading:L,className:"lg:col-span-2"})]}),e.jsxs(ee,{open:!!c,onOpenChange:l=>!l&&pe(),children:[e.jsx(ve,{asChild:!0,children:e.jsx("div",{ref:h,className:"fixed pointer-events-none",style:{left:r?.x??0,top:r?.y??0,width:1,height:1}})}),e.jsx(se,{className:"w-80 p-3",side:"top",align:"center",children:c&&e.jsx(Ve,{model:c})})]})]})]})}function Cs(){return e.jsxs("div",{className:"space-y-4 h-full overflow-hidden",children:[e.jsxs(g,{className:"flex flex-col min-h-[300px]",children:[e.jsx(N,{className:"p-4 pb-2",children:e.jsx(m,{className:"h-4 w-32"})}),e.jsx(j,{className:"p-4 pt-0 flex-1",children:e.jsx(m,{className:"h-full w-full"})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[e.jsxs(g,{className:"flex flex-col min-h-[250px]",children:[e.jsx(N,{className:"p-4 pb-2",children:e.jsx(m,{className:"h-4 w-28"})}),e.jsx(j,{className:"p-4 pt-2",children:e.jsx("div",{className:"space-y-3",children:[1,2,3,4,5].map(s=>e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{className:"w-2.5 h-2.5 rounded-full"}),e.jsx(m,{className:"h-3 w-24"})]}),e.jsx(m,{className:"h-3 w-16"})]},s))})})]}),e.jsxs(g,{className:"flex flex-col min-h-[250px]",children:[e.jsx(N,{className:"p-4 pb-2",children:e.jsx(m,{className:"h-4 w-28"})}),e.jsx(j,{className:"p-4 pt-0 flex-1",children:e.jsxs("div",{className:"flex w-full h-full items-center",children:[e.jsx("div",{className:"flex-1 flex justify-center",children:e.jsx(m,{className:"h-[180px] w-[180px] rounded-full"})}),e.jsx("div",{className:"w-[140px] shrink-0 pl-2 space-y-2",children:[1,2,3,4].map(s=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{className:"w-2 h-2 rounded-full"}),e.jsx(m,{className:"h-3 w-20"})]},s))})]})})]})]})]})}export{ks as AnalyticsPage,Cs as AnalyticsSkeleton};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-VbLlN_Dz.js";import{r}from"./react-vendor-DMek_JCF.js";import{k as S,l as A,B as i,I,i as D,m as L,n as M,o as E,c as R,p as z,q as B,e as j}from"./index-BXPLu3zJ.js";import{a0 as O,t as g,a5 as F,a6 as y,p as T,a7 as U,l as C,q,a8 as Q,a9 as H}from"./icons-WTNLz24z.js";import"./tanstack-yybD444-.js";import"./notifications-cqk-Qeo2.js";import"./utils-CzKF5WmX.js";import"./form-utils-BXvNPyud.js";import"./code-highlight-C2TXE0-z.js";function se(){const{data:a,isLoading:d,isError:x,refetch:u}=S(),h=A(),[l,p]=r.useState(null),[o,w]=r.useState(""),[b,n]=r.useState(!1),[c,m]=r.useState(null),t=r.useMemo(()=>a?.profiles||[],[a?.profiles]),N=r.useMemo(()=>t.filter(s=>s.name.toLowerCase().includes(o.toLowerCase())),[t,o]),v=r.useMemo(()=>l&&t.some(s=>s.name===l)?l:t.length>0?t[0].name:null,[l,t]),P=s=>{h.mutate(s,{onSuccess:()=>{l===s&&p(null),m(null)}})},k=s=>{n(!1),p(s)},f=t.find(s=>s.name===v);return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:"API Profiles"})]}),e.jsxs(i,{size:"sm",onClick:()=>{n(!0)},children:[e.jsx(g,{className:"w-4 h-4 mr-1"}),"New"]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(F,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(I,{placeholder:"Search profiles...",className:"pl-8 h-9",value:o,onChange:s=>w(s.target.value)})]})]}),e.jsx(D,{className:"flex-1",children:d?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading profiles..."}):x?e.jsx("div",{className:"p-4 text-center",children:e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(y,{className:"w-12 h-12 mx-auto text-destructive/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Failed to load profiles"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Unable to fetch API profiles. Please try again."})]}),e.jsxs(i,{size:"sm",variant:"outline",onClick:()=>u(),children:[e.jsx(T,{className:"w-4 h-4 mr-1"}),"Retry"]})]})}):N.length===0?e.jsx("div",{className:"p-4 text-center",children:t.length===0?e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(U,{className:"w-12 h-12 mx-auto text-muted-foreground/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"No API profiles yet"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Create your first profile to connect to custom API endpoints"})]}),e.jsxs(i,{size:"sm",variant:"outline",onClick:()=>{n(!0)},children:[e.jsx(g,{className:"w-4 h-4 mr-1"}),"Create Profile"]})]}):e.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:['No profiles match "',o,'"']})}):e.jsx("div",{className:"p-2 space-y-1",children:N.map(s=>e.jsx(W,{profile:s,isSelected:v===s.name,onSelect:()=>{p(s.name)},onDelete:()=>m(s.name)},s.name))})}),t.length>0&&e.jsx("div",{className:"p-3 border-t bg-background text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{children:[t.length," profile",t.length!==1?"s":""]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(C,{className:"w-3 h-3 text-green-600"}),t.filter(s=>s.configured).length," configured"]})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:f?e.jsx(L,{profileName:f.name,onDelete:()=>m(f.name)}):e.jsx(Y,{onCreateClick:()=>{n(!0)}})}),e.jsx(M,{open:b,onOpenChange:n,onSuccess:k}),e.jsx(E,{open:!!c,title:"Delete Profile",description:`Are you sure you want to delete "${c}"? This will remove the settings file and cannot be undone.`,confirmText:"Delete",variant:"destructive",onConfirm:()=>c&&P(c),onCancel:()=>m(null)})]})}function W({profile:a,isSelected:d,onSelect:x,onDelete:u}){return e.jsxs("div",{className:R("group flex items-center gap-2 px-3 py-2.5 rounded-md cursor-pointer transition-colors",d?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:x,children:[a.configured?e.jsx(C,{className:"w-4 h-4 text-green-600 shrink-0"}):e.jsx(y,{className:"w-4 h-4 text-yellow-600 shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm truncate",children:a.name}),e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("div",{className:"text-xs text-muted-foreground truncate flex-1",children:a.settingsPath}),e.jsx(z,{value:a.settingsPath,size:"icon",className:"h-5 w-5 opacity-0 group-hover:opacity-100 transition-opacity"})]})]}),e.jsx(i,{variant:"ghost",size:"icon",className:"h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",onClick:h=>{h.stopPropagation(),u()},children:e.jsx(q,{className:"w-3.5 h-3.5 text-destructive"})})]})}function Y({onCreateClick:a}){return e.jsx("div",{className:"flex-1 flex items-center justify-center bg-muted/20",children:e.jsxs("div",{className:"text-center max-w-md px-8",children:[e.jsx(Q,{className:"w-16 h-16 mx-auto text-muted-foreground/30 mb-6"}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"API Profile Manager"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"Configure custom API endpoints for Claude CLI. Connect to proxy services like copilot-api, OpenRouter, or your own API backend."}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(i,{onClick:a,className:"w-full",children:[e.jsx(g,{className:"w-4 h-4 mr-2"}),"Create Your First Profile"]}),e.jsx(B,{className:"my-4"}),e.jsxs("div",{className:"text-left space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"What you can configure:"}),e.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1.5",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(j,{variant:"outline",className:"text-xs shrink-0 mt-0.5",children:"URL"}),e.jsx("span",{children:"Custom API base URL endpoint"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(j,{variant:"outline",className:"text-xs shrink-0 mt-0.5",children:"Auth"}),e.jsx("span",{children:"API key or authentication token"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(j,{variant:"outline",className:"text-xs shrink-0 mt-0.5",children:"Models"}),e.jsx("span",{children:"Model mapping for Opus/Sonnet/Haiku"})]})]})]}),e.jsx("div",{className:"pt-4",children:e.jsxs("a",{href:"https://github.com/kaitranntt/ccs#api-profiles",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-xs text-primary hover:underline",children:["Learn more about API profiles",e.jsx(H,{className:"w-3 h-3 ml-1"})]})})]})]})})}export{se as ApiPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-VbLlN_Dz.js";import{r as o}from"./react-vendor-DMek_JCF.js";import{u as fe}from"./tanstack-yybD444-.js";import{r as Y,s as je,t as Z,u as ve,D as J,v as X,w as ee,x as se,y as te,B as m,c as b,d as E,L as T,I as ae,z as Ne,A as we,E as ye,F as be,G as Ce,H as Se,J as Ae,K as ke,M as Pe,N as De,O as Me,i as Fe,S as Le,Q as $,R as ne,e as ie}from"./index-BXPLu3zJ.js";import{C as U,a as K}from"./card-CR0u1y_L.js";import{w as z,b as W,L as re,a9 as V,$ as Oe,j as P,o as Re,aa as R,p as M,y as G,A as Te,ab as _,U as Ve,z as Ge,Z as de,ac as ce,X as le,q as ze}from"./icons-WTNLz24z.js";import"./notifications-cqk-Qeo2.js";import"./utils-CzKF5WmX.js";import"./form-utils-BXvNPyud.js";import"./code-highlight-C2TXE0-z.js";const F={agy:{provider:"agy",displayName:"Antigravity",defaultModel:"gemini-claude-opus-4-5-thinking",models:[{id:"gemini-claude-opus-4-5-thinking",name:"Claude Opus 4.5 Thinking",description:"Most capable, extended thinking"},{id:"gemini-claude-sonnet-4-5-thinking",name:"Claude Sonnet 4.5 Thinking",description:"Balanced with extended thinking"},{id:"gemini-claude-sonnet-4-5",name:"Claude Sonnet 4.5",description:"Fast and capable"},{id:"gemini-3-pro-preview",name:"Gemini 3 Pro",description:"Google latest model via Antigravity"}]},gemini:{provider:"gemini",displayName:"Gemini",defaultModel:"gemini-2.5-pro",models:[{id:"gemini-3-pro-preview",name:"Gemini 3 Pro",tier:"paid",description:"Latest model, requires paid Google account"},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",description:"Stable, works with free Google account"}]},codex:{provider:"codex",displayName:"Codex",defaultModel:"gpt-5.1-codex-max",models:[{id:"gpt-5.1-codex-max",name:"Codex Max (5.1)",description:"Most capable Codex model",presetMapping:{default:"gpt-5.1-codex-max",opus:"gpt-5.1-codex-max-high",sonnet:"gpt-5.1-codex-max",haiku:"gpt-5.1-codex-mini-high"}},{id:"gpt-5.2",name:"GPT 5.2",description:"Latest GPT model",presetMapping:{default:"gpt-5.2",opus:"gpt-5.2",sonnet:"gpt-5.2",haiku:"gpt-5.2"}},{id:"gpt-5.1-codex-mini",name:"Codex Mini",description:"Fast and efficient Codex model"}]},qwen:{provider:"qwen",displayName:"Qwen",defaultModel:"qwen-coder-plus",models:[{id:"qwen-coder-plus",name:"Qwen Coder Plus",description:"Alibaba code-focused model"},{id:"qwen-max",name:"Qwen Max",description:"Most capable Qwen model"}]},iflow:{provider:"iflow",displayName:"iFlow",defaultModel:"iflow-default",models:[{id:"iflow-default",name:"iFlow Default",description:"Default iFlow model"}]}},H=[{id:"gemini",name:"Google Gemini",description:"Gemini Pro/Flash models"},{id:"codex",name:"OpenAI Codex",description:"GPT-4 and codex models"},{id:"agy",name:"Antigravity",description:"Antigravity AI models"},{id:"qwen",name:"Alibaba Qwen",description:"Qwen Code models"},{id:"iflow",name:"iFlow",description:"iFlow AI models"}];function Ie({open:a,onClose:c}){const[n,i]=o.useState("provider"),[r,u]=o.useState(""),[d,j]=o.useState(null),[p,f]=o.useState(""),[v,A]=o.useState(""),[L,N]=o.useState(!1),[w,C]=o.useState(!1),[x,S]=o.useState(!1),{data:k,refetch:h}=Y(),l=je(),g=Z(),{privacyMode:D}=ve(),y=k?.authStatus.find(s=>s.provider===r)?.accounts||[];o.useEffect(()=>{if(!a){const s=setTimeout(()=>{i("provider"),u(""),j(null),f(""),A(""),N(!1),S(!1)},0);return()=>clearTimeout(s)}},[a]),o.useEffect(()=>{if(n==="auth"&&y.length>0&&!x){const s=setTimeout(()=>{i("account")},0);return()=>clearTimeout(s)}},[n,y,x]);const t=async s=>{await navigator.clipboard.writeText(s),N(!0),setTimeout(()=>N(!1),2e3)},O=async()=>{C(!0),await h(),C(!1)},oe=()=>{g.mutate({provider:r},{onSuccess:s=>{s.account&&(j(s.account),i("variant")),h()}})},me=s=>{u(s),(k?.authStatus.find(ge=>ge.provider===s)?.accounts||[]).length===0?i("auth"):i("account")},ue=s=>{j(s),i("variant")},xe=async()=>{if(!(!p||!r))try{await l.mutateAsync({name:p,provider:r,model:v||void 0,account:d?.id}),i("success")}catch(s){console.error("Failed to create variant:",s)}},Q=`ccs ${r} --auth --add`,q=["provider","auth","variant","success"],pe=(s=>s==="account"?1:q.indexOf(s))(n),he=s=>{if(!s&&(n==="success"||n==="provider")){c();return}};return e.jsx(J,{open:a,onOpenChange:he,children:e.jsxs(X,{className:"sm:max-w-lg",onPointerDownOutside:s=>{n!=="success"&&n!=="provider"&&s.preventDefault()},onEscapeKeyDown:s=>{(g.isPending||l.isPending)&&s.preventDefault()},children:[e.jsxs(ee,{children:[e.jsxs(se,{className:"flex items-center gap-2",children:[e.jsx(z,{className:"w-5 h-5 text-primary"}),"Quick Setup Wizard"]}),e.jsxs(te,{children:[n==="provider"&&"Select a provider to get started",n==="auth"&&"Authenticate with your provider",n==="account"&&"Select which account to use",n==="variant"&&"Create your custom variant",n==="success"&&"Setup complete!"]})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[n==="provider"&&e.jsx("div",{className:"grid gap-2",children:H.map(s=>e.jsxs("button",{onClick:()=>me(s.id),className:"flex items-center justify-between p-3 border rounded-lg hover:bg-muted/50 transition-colors text-left",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:s.name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s.description})]}),e.jsx(W,{className:"w-4 h-4 text-muted-foreground"})]},s.id))}),n==="auth"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-center space-y-3",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Authenticate with ",H.find(s=>s.id===r)?.name," to add an account"]}),e.jsx(m,{onClick:oe,disabled:g.isPending,className:"w-full gap-2",size:"lg",children:g.isPending?e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"w-4 h-4 animate-spin"}),"Authenticating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"w-4 h-4"}),"Authenticate in Browser"]})}),g.isPending&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Complete the OAuth flow in your browser..."})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Or use terminal"})})]}),e.jsx(U,{children:e.jsxs(K,{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Oe,{className:"w-4 h-4"}),"Run this command in your terminal:"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 px-3 py-2 bg-muted rounded-md font-mono text-sm",children:Q}),e.jsx(m,{variant:"outline",size:"icon",onClick:()=>t(Q),children:L?e.jsx(P,{className:"w-4 h-4 text-green-500"}):e.jsx(Re,{className:"w-4 h-4"})})]})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(m,{variant:"ghost",onClick:()=>i("provider"),disabled:g.isPending,children:[e.jsx(R,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs(m,{variant:"outline",onClick:O,disabled:w||g.isPending,children:[e.jsx(M,{className:`w-4 h-4 mr-2 ${w?"animate-spin":""}`}),w?"Checking...":"Refresh Status"]})]})]}),n==="account"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:["Select an account (",y.length,")"]}),e.jsx("div",{className:"grid gap-2",children:y.map(s=>e.jsxs("button",{type:"button",onClick:()=>ue(s),className:"flex items-center justify-between p-3 border rounded-lg hover:bg-muted/50 transition-colors text-left",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-muted flex items-center justify-center",children:e.jsx(G,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("div",{className:b("font-medium",D&&E),children:s.email||s.id}),s.isDefault&&e.jsx("div",{className:"text-xs text-muted-foreground",children:"Default account"})]})]}),e.jsx(W,{className:"w-4 h-4 text-muted-foreground"})]},s.id))}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Or"})})]}),e.jsxs("button",{type:"button",className:"w-full flex items-center gap-3 p-3 border-2 border-dashed border-primary/50 rounded-lg hover:border-primary hover:bg-primary/5 transition-colors text-left",onClick:()=>{S(!0),i("auth")},children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(V,{className:"w-4 h-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-primary",children:"Add new account"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Authenticate with a different account"})]})]}),e.jsx("div",{className:"flex items-center justify-between pt-2",children:e.jsxs(m,{variant:"ghost",onClick:()=>i("provider"),children:[e.jsx(R,{className:"w-4 h-4 mr-2"}),"Back"]})})]}),n==="variant"&&e.jsxs("div",{className:"space-y-4",children:[d&&e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-muted/50 rounded-md text-sm",children:[e.jsx(G,{className:"w-4 h-4"}),e.jsxs("span",{children:["Using:"," ",e.jsx("span",{className:b(D&&E),children:d.email||d.id})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"variant-name",children:"Variant Name *"}),e.jsx(ae,{id:"variant-name",value:p,onChange:s=>f(s.target.value),placeholder:"e.g., my-gemini, g3, flash"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Use this name to invoke: ccs ",p||"<name>",' "prompt"']})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"Model"}),e.jsxs(Ne,{value:v,onValueChange:A,children:[e.jsx(we,{children:e.jsx(ye,{placeholder:"Select a model"})}),e.jsx(be,{children:F[r]?.models.map(s=>e.jsx(Ce,{value:s.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:s.name}),s.description&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",s.description]})]})},s.id))})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Default: ",F[r]?.defaultModel||"provider default"]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsxs(m,{variant:"ghost",onClick:()=>y.length>0?i("account"):i("provider"),children:[e.jsx(R,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{variant:"ghost",onClick:c,children:"Skip"}),e.jsx(m,{onClick:xe,disabled:!p||l.isPending,children:l.isPending?"Creating...":"Create Variant"})]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"Skip if you just wanted to add an account without creating a variant"})]}),n==="success"&&e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-16 h-16 bg-green-100 dark:bg-green-900/30 rounded-full flex items-center justify-center",children:e.jsx(P,{className:"w-8 h-8 text-green-600 dark:text-green-400"})})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-lg",children:"Variant Created!"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Your custom variant is ready to use"})]}),e.jsx(U,{children:e.jsxs(K,{className:"p-4 space-y-2",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"Usage:"}),e.jsxs("code",{className:"block px-3 py-2 bg-muted rounded-md font-mono text-sm",children:["ccs ",p,' "your prompt here"']})]})}),e.jsx(m,{onClick:c,className:"w-full",children:"Done"})]})]}),e.jsx("div",{className:"flex justify-center gap-1 pt-2",children:q.map((s,B)=>e.jsx("div",{className:`w-2 h-2 rounded-full transition-colors ${pe>=B?"bg-primary":"bg-muted"}`},s))})]})})}function Qe({open:a,onClose:c,provider:n,displayName:i}){const[r,u]=o.useState(""),d=Z(),j=()=>{d.mutate({provider:n,nickname:r.trim()||void 0},{onSuccess:()=>{u(""),c()}})},p=f=>{!f&&!d.isPending&&(u(""),c())};return e.jsx(J,{open:a,onOpenChange:p,children:e.jsxs(X,{className:"sm:max-w-md",children:[e.jsxs(ee,{children:[e.jsxs(se,{children:["Add ",i," Account"]}),e.jsx(te,{children:"Click the button below to authenticate a new account. A browser window will open for OAuth."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"nickname",children:"Nickname (optional)"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(G,{className:"w-4 h-4 text-muted-foreground"}),e.jsx(ae,{id:"nickname",value:r,onChange:f=>u(f.target.value),placeholder:"e.g., work, personal",disabled:d.isPending,className:"flex-1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"A friendly name to identify this account. Auto-generated from email if left empty."})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2",children:[e.jsx(m,{variant:"ghost",onClick:c,disabled:d.isPending,children:"Cancel"}),e.jsx(m,{onClick:j,disabled:d.isPending,children:d.isPending?e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"w-4 h-4 mr-2 animate-spin"}),"Authenticating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"w-4 h-4 mr-2"}),"Authenticate"]})})]}),d.isPending&&e.jsx("p",{className:"text-sm text-center text-muted-foreground",children:"Complete the OAuth flow in your browser..."})]})]})})}function qe(a){if(!a)return"";const c=new Date(a).getTime(),i=Date.now()-c,r=Math.floor(i/(1e3*60*60)),u=Math.floor(i%(1e3*60*60)/(1e3*60));return r>0?`${r}h ${u}m`:`${u}m`}function Be(){const{data:a,isLoading:c}=Se(),n=Ae(),i=a?.running??!1;return e.jsxs("div",{className:b("rounded-lg border p-3 transition-colors",i?"border-green-500/30 bg-green-500/5":"border-muted bg-muted/30"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:b("w-2 h-2 rounded-full",i?"bg-green-500 animate-pulse":"bg-muted-foreground/30")}),e.jsx("span",{className:"text-sm font-medium",children:"CLIProxy Service"})]}),e.jsx("div",{className:"flex items-center gap-1",children:c?e.jsx(M,{className:"w-3 h-3 animate-spin text-muted-foreground"}):i?e.jsx(Te,{className:"w-3 h-3 text-green-600"}):e.jsx(_,{className:"w-3 h-3 text-muted-foreground"})})]}),i&&a?e.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:["Port ",a.port]}),a.sessionCount!==void 0&&a.sessionCount>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ve,{className:"w-3 h-3"}),a.sessionCount," session",a.sessionCount!==1?"s":""]}),a.startedAt&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ge,{className:"w-3 h-3"}),qe(a.startedAt)]})]}):e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Not running"}),e.jsxs(m,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>n.mutate(),disabled:n.isPending,children:[n.isPending?e.jsx(M,{className:"w-3 h-3 animate-spin"}):e.jsx(_,{className:"w-3 h-3"}),"Start"]})]})]})}function Ee({status:a,isSelected:c,onSelect:n}){const i=a.accounts?.length||0;return e.jsxs("button",{className:b("w-full flex items-center gap-3 px-3 py-2.5 rounded-lg transition-colors cursor-pointer text-left",c?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:n,children:[e.jsx(ne,{provider:a.provider,size:"md"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm truncate",children:a.displayName}),i>0&&e.jsx(ie,{variant:"secondary",className:"text-[10px] h-4 px-1",children:i})]}),e.jsx("div",{className:"flex items-center gap-1.5 mt-0.5",children:a.authenticated?e.jsxs(e.Fragment,{children:[e.jsx(P,{className:"w-3 h-3 text-green-600"}),e.jsx("span",{className:"text-xs text-green-600",children:"Connected"})]}):e.jsxs(e.Fragment,{children:[e.jsx(le,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Not connected"})]})})]})]})}function $e({variant:a,parentAuth:c,isSelected:n,onSelect:i,onDelete:r,isDeleting:u}){return e.jsxs("button",{className:b("group w-full flex items-center gap-3 px-3 py-2 rounded-lg transition-colors cursor-pointer text-left pl-6",n?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:i,children:[e.jsxs("div",{className:"relative",children:[e.jsx(ne,{provider:a.provider,size:"sm"}),e.jsx(ce,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-muted-foreground"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm truncate",children:a.name}),e.jsx(ie,{variant:"outline",className:"text-[9px] h-4 px-1",children:"variant"})]}),e.jsx("div",{className:"flex items-center gap-1.5 mt-0.5",children:c?.authenticated?e.jsxs(e.Fragment,{children:[e.jsx(P,{className:"w-3 h-3 text-green-600"}),e.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["via ",a.provider]})]}):e.jsxs(e.Fragment,{children:[e.jsx(le,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Parent not connected"})]})})]}),e.jsx(m,{variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 hover:text-destructive",onClick:d=>{d.stopPropagation(),r()},disabled:u,children:e.jsx(ze,{className:"w-3 h-3"})})]})}function Ue({onSetup:a}){return e.jsx("div",{className:"flex-1 flex items-center justify-center bg-muted/20",children:e.jsxs("div",{className:"text-center max-w-md px-8",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-muted flex items-center justify-center mx-auto mb-6",children:e.jsx(de,{className:"w-8 h-8 text-muted-foreground"})}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"CCS Profile Manager"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Manage OAuth authentication, account preferences, and model selection for CLIProxy providers. Configure how CCS routes requests to different AI backends."}),e.jsxs("p",{className:"text-xs text-muted-foreground mb-6",children:["For live usage stats and real-time monitoring, visit the"," ",e.jsx("a",{href:"/cliproxy/control-panel",className:"text-primary hover:underline",children:"Control Panel"}),"."]}),e.jsxs(m,{onClick:a,className:"gap-2",children:[e.jsx(z,{className:"w-4 h-4"}),"Quick Setup"]})]})})}function ns(){const a=fe(),{data:c,isLoading:n}=Y(),{data:i,isFetching:r}=ke(),u=Pe(),d=De(),j=Me(),[p,f]=o.useState(null),[v,A]=o.useState(null),[L,N]=o.useState(!1),[w,C]=o.useState(null),x=c?.authStatus||[],S=i?.variants||[],k=o.useMemo(()=>v?null:p&&x.some(t=>t.provider===p)?p:x.length>0?x[0].provider:null,[p,v,x]),h=x.find(t=>t.provider===k),l=S.find(t=>t.name===v),g=l?x.find(t=>t.provider===l.provider):void 0,D=()=>{a.invalidateQueries({queryKey:["cliproxy"]}),a.invalidateQueries({queryKey:["cliproxy-auth"]})},I=t=>{f(t),A(null)},y=t=>{A(t),f(null)};return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex",children:[e.jsxs("div",{className:"w-64 border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(de,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:"CLIProxy"})]}),e.jsx(m,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:D,disabled:r,children:e.jsx(M,{className:b("w-4 h-4",r&&"animate-spin")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"CCS-level account management"}),e.jsxs(m,{variant:"default",size:"sm",className:"w-full gap-2",onClick:()=>N(!0),children:[e.jsx(z,{className:"w-4 h-4"}),"Quick Setup"]})]}),e.jsx(Fe,{className:"flex-1",children:e.jsxs("div",{className:"p-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide px-3 py-2",children:"Providers"}),n?e.jsx("div",{className:"space-y-2 px-2",children:[1,2,3,4].map(t=>e.jsx(Le,{className:"h-14 w-full rounded-lg"},t))}):e.jsx("div",{className:"space-y-1",children:x.map(t=>e.jsx(Ee,{status:t,isSelected:k===t.provider,onSelect:()=>I(t.provider)},t.provider))}),S.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide px-3 py-2 mt-4 flex items-center gap-1.5",children:[e.jsx(ce,{className:"w-3 h-3"}),"Variants"]}),e.jsx("div",{className:"space-y-1",children:S.map(t=>e.jsx($e,{variant:t,parentAuth:x.find(O=>O.provider===t.provider),isSelected:v===t.name,onSelect:()=>y(t.name),onDelete:()=>j.mutate(t.name),isDeleting:j.isPending},t.name))})]})]})}),e.jsx("div",{className:"p-3 border-t",children:e.jsx(Be,{})}),e.jsx("div",{className:"p-3 border-t bg-background text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{children:[x.length," provider",x.length!==1?"s":""]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(P,{className:"w-3 h-3 text-green-600"}),x.filter(t=>t.authenticated).length," connected"]})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-background",children:l&&g?e.jsx($,{provider:l.name,displayName:`${l.name} (${l.provider} variant)`,authStatus:g,catalog:F[l.provider],logoProvider:l.provider,onAddAccount:()=>C({provider:l.provider,displayName:g.displayName}),onSetDefault:t=>u.mutate({provider:l.provider,accountId:t}),onRemoveAccount:t=>d.mutate({provider:l.provider,accountId:t}),isRemovingAccount:d.isPending}):h?e.jsx($,{provider:h.provider,displayName:h.displayName,authStatus:h,catalog:F[h.provider],onAddAccount:()=>C({provider:h.provider,displayName:h.displayName}),onSetDefault:t=>u.mutate({provider:h.provider,accountId:t}),onRemoveAccount:t=>d.mutate({provider:h.provider,accountId:t}),isRemovingAccount:d.isPending}):e.jsx(Ue,{onSetup:()=>N(!0)})}),e.jsx(Ie,{open:L,onClose:()=>N(!1)}),e.jsx(Qe,{open:w!==null,onClose:()=>C(null),provider:w?.provider||"",displayName:w?.displayName||""})]})}export{ns as CliproxyPage};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/code-editor-CVohe7u9.js","assets/radix-ui-VbLlN_Dz.js","assets/react-vendor-DMek_JCF.js","assets/index-BXPLu3zJ.js","assets/tanstack-yybD444-.js","assets/notifications-cqk-Qeo2.js","assets/utils-CzKF5WmX.js","assets/icons-WTNLz24z.js","assets/form-utils-BXvNPyud.js","assets/code-highlight-C2TXE0-z.js","assets/index-D2qNwUdc.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{j as e}from"./radix-ui-VbLlN_Dz.js";import{S as j,e as v,B as p,o as we,T as ye,U as be,V as I,W as O,i as A,q,L as w,I as te,z as le,A as oe,E as re,F as ce,G as L,p as de,X as Se,Y as Ce,_ as ke,c as $}from"./index-BXPLu3zJ.js";import{u as Fe,a as C,b as y}from"./tanstack-yybD444-.js";import{r as h}from"./react-vendor-DMek_JCF.js";import{S as D}from"./switch-pOvJh4Ez.js";import{t as Q}from"./notifications-cqk-Qeo2.js";import{p as me,L as J,r as Pe,s as Me,w as Ae,Z as ae,I as Le,X as Te,j as Ee,a as _e,T as Re,a0 as Ie,ad as Oe,ab as ne,K as qe,a2 as De,ae as Qe,l as ue,m as xe}from"./icons-WTNLz24z.js";import"./utils-CzKF5WmX.js";import"./form-utils-BXvNPyud.js";import"./code-highlight-C2TXE0-z.js";const m="/api";async function Ke(){const s=await fetch(`${m}/copilot/status`);if(!s.ok)throw new Error("Failed to fetch copilot status");return s.json()}async function $e(){const s=await fetch(`${m}/copilot/config`);if(!s.ok)throw new Error("Failed to fetch copilot config");return s.json()}async function Je(){const s=await fetch(`${m}/copilot/models`);if(!s.ok)throw new Error("Failed to fetch copilot models");return s.json()}async function ze(){const s=await fetch(`${m}/copilot/settings/raw`);if(!s.ok)throw new Error("Failed to fetch copilot raw settings");return s.json()}async function Ge(s){const a=await fetch(`${m}/copilot/config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!a.ok)throw new Error("Failed to update copilot config");return a.json()}async function Ue(s){const a=await fetch(`${m}/copilot/settings/raw`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(a.status===409)throw new Error("CONFLICT");if(!a.ok)throw new Error("Failed to save copilot raw settings");return a.json()}async function Be(){const s=await fetch(`${m}/copilot/auth/start`,{method:"POST"});if(!s.ok)throw new Error("Failed to start auth");return s.json()}async function Ve(){const s=await fetch(`${m}/copilot/daemon/start`,{method:"POST"});if(!s.ok)throw new Error("Failed to start daemon");return s.json()}async function He(){const s=await fetch(`${m}/copilot/daemon/stop`,{method:"POST"});if(!s.ok)throw new Error("Failed to stop daemon");return s.json()}async function Xe(){const s=await fetch(`${m}/copilot/info`);if(!s.ok)throw new Error("Failed to fetch copilot info");return s.json()}async function We(s){const a=await fetch(`${m}/copilot/install`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s?{version:s}:{})});if(!a.ok)throw new Error("Failed to install copilot-api");return a.json()}function he(){const s=Fe(),a=C({queryKey:["copilot-status"],queryFn:Ke,refetchInterval:5e3}),l=C({queryKey:["copilot-config"],queryFn:$e}),r=C({queryKey:["copilot-models"],queryFn:Je}),n=C({queryKey:["copilot-raw-settings"],queryFn:ze}),d=C({queryKey:["copilot-info"],queryFn:Xe}),c=y({mutationFn:Ge,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]}),s.invalidateQueries({queryKey:["copilot-config"]}),s.invalidateQueries({queryKey:["copilot-raw-settings"]})}}),i=y({mutationFn:Ue,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]}),s.invalidateQueries({queryKey:["copilot-config"]}),s.invalidateQueries({queryKey:["copilot-raw-settings"]})}}),x=y({mutationFn:Be,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]})}}),N=y({mutationFn:Ve,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]})}}),f=y({mutationFn:He,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]})}}),o=y({mutationFn:We,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]}),s.invalidateQueries({queryKey:["copilot-info"]})}});return{status:a.data,statusLoading:a.isLoading,statusError:a.error,refetchStatus:a.refetch,config:l.data,configLoading:l.isLoading,models:r.data?.models??[],currentModel:r.data?.current,modelsLoading:r.isLoading,rawSettings:n.data,rawSettingsLoading:n.isLoading,refetchRawSettings:n.refetch,updateConfig:c.mutate,updateConfigAsync:c.mutateAsync,isUpdating:c.isPending,saveRawSettings:i.mutate,saveRawSettingsAsync:i.mutateAsync,isSavingRawSettings:i.isPending,startAuth:x.mutate,startAuthAsync:x.mutateAsync,isAuthenticating:x.isPending,authResult:x.data,startDaemon:N.mutate,isStartingDaemon:N.isPending,stopDaemon:f.mutate,isStoppingDaemon:f.isPending,info:d.data,infoLoading:d.isLoading,refetchInfo:d.refetch,install:o.mutate,installAsync:o.mutateAsync,isInstalling:o.isPending}}const Ye=h.lazy(()=>ke(()=>import("./code-editor-CVohe7u9.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(s=>({default:s.CodeEditor}))),Ze=[{name:"GPT-4.1 (Free)",description:"Free tier - no premium usage",default:"gpt-4.1",opus:"gpt-4.1",sonnet:"gpt-4.1",haiku:"gpt-4.1"},{name:"GPT-5 Mini (Free)",description:"Free tier - lightweight model",default:"gpt-5-mini",opus:"gpt-5-mini",sonnet:"gpt-5-mini",haiku:"gpt-5-mini"},{name:"Raptor Mini (Free)",description:"Free tier - fine-tuned for coding",default:"raptor-mini",opus:"raptor-mini",sonnet:"raptor-mini",haiku:"raptor-mini"}],es=[{name:"Claude Opus 4.5",description:"Pro+ (3x) - Most capable reasoning",default:"claude-opus-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"},{name:"Claude Sonnet 4.5",description:"Pro+ (1x) - Balanced performance",default:"claude-sonnet-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"},{name:"GPT-5.2",description:"Pro+ (1x) - Latest OpenAI (Preview)",default:"gpt-5.2",opus:"gpt-5.2",sonnet:"gpt-5.1",haiku:"gpt-5-mini"},{name:"GPT-5.1 Codex Max",description:"Pro+ (1x) - Best for coding",default:"gpt-5.1-codex-max",opus:"gpt-5.1-codex-max",sonnet:"gpt-5.1-codex",haiku:"gpt-5.1-codex-mini"},{name:"Gemini 2.5 Pro",description:"Pro+ (1x) - Google latest",default:"gemini-2.5-pro",opus:"gemini-2.5-pro",sonnet:"gemini-2.5-pro",haiku:"gemini-3-flash"}];function ie(s){switch(s){case"free":return"bg-green-100 text-green-700 border-green-200";case"pro":return"bg-blue-100 text-blue-700 border-blue-200";case"pro+":return"bg-purple-100 text-purple-700 border-purple-200";case"business":return"bg-orange-100 text-orange-700 border-orange-200";case"enterprise":return"bg-red-100 text-red-700 border-red-200";default:return"bg-muted text-muted-foreground"}}function ss(s){return s==null?null:s===0?"Free":s<1?`${s}x`:s===1?"1x":`${s}x`}function F({label:s,description:a,value:l,onChange:r,models:n,disabled:d}){const c=n.find(i=>i.id===l);return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium",children:s}),a&&e.jsx("p",{className:"text-[10px] text-muted-foreground",children:a})]}),e.jsxs(le,{value:l||"",onValueChange:r,disabled:d,children:[e.jsx(oe,{className:"h-9",children:e.jsx(re,{placeholder:"Select model",children:l&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:l}),c?.minPlan&&e.jsx(v,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${ie(c.minPlan)}`,children:c.minPlan})]})})}),e.jsx(ce,{className:"max-h-[300px]",children:e.jsxs(Se,{children:[e.jsxs(Ce,{className:"text-xs text-muted-foreground",children:["Available Models (",n.length,")"]}),n.map(i=>e.jsx(L,{value:i.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:i.name||i.id}),i.minPlan&&e.jsx(v,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${ie(i.minPlan)}`,children:i.minPlan}),i.multiplier!==void 0&&e.jsx("span",{className:"text-[9px] text-muted-foreground",children:ss(i.multiplier)}),i.preview&&e.jsx(v,{variant:"secondary",className:"text-[9px] px-1 py-0 h-4",children:"Preview"}),l===i.id&&e.jsx(Ee,{className:"w-3 h-3 text-primary ml-auto"})]})},i.id))]})})]})]})}function ts(){const{config:s,configLoading:a,models:l,modelsLoading:r,rawSettings:n,rawSettingsLoading:d,updateConfigAsync:c,isUpdating:i,saveRawSettingsAsync:x,isSavingRawSettings:N,refetchRawSettings:f}=he(),[o,T]=h.useState({}),[g,E]=h.useState(null),[pe,z]=h.useState(!1),G=o.enabled??s?.enabled??!1,U=o.autoStart??s?.auto_start??!1,B=o.port??s?.port??4141,V=o.accountType??s?.account_type??"individual",b=o.model??s?.model??"claude-opus-4-5-20250514",_=o.rateLimit??s?.rate_limit?.toString()??"",H=o.waitOnLimit??s?.wait_on_limit??!0,X=o.opusModel??s?.opus_model??"",W=o.sonnetModel??s?.sonnet_model??"",Y=o.haikuModel??s?.haiku_model??"",u=(t,S)=>{T(ve=>({...ve,[t]:S}))},Z=t=>{T(S=>({...S,model:t.default,opusModel:t.opus,sonnetModel:t.sonnet,haikuModel:t.haiku})),Q.success(`Applied "${t.name}" preset`)},k=h.useMemo(()=>g!==null?g:n?.settings?JSON.stringify(n.settings,null,2):`{
|
|
3
|
-
"env": {}
|
|
4
|
-
}`,[g,n]),fe=h.useCallback(t=>{E(t)},[]),R=h.useMemo(()=>{try{return JSON.parse(k),!0}catch{return!1}},[k]),ge=h.useMemo(()=>{const t=Object.keys(o).length>0,S=g!==null&&g!==JSON.stringify(n?.settings,null,2);return t||S},[o,g,n]),ee=async()=>{try{if(Object.keys(o).length>0&&await c({enabled:G,auto_start:U,port:B,account_type:V,model:b,rate_limit:_?parseInt(_,10):null,wait_on_limit:H,opus_model:X||void 0,sonnet_model:W||void 0,haiku_model:Y||void 0}),g!==null&&R){const t=JSON.parse(k);await x({settings:t,expectedMtime:n?.mtime})}T({}),E(null),Q.success("Copilot configuration saved")}catch(t){t.message==="CONFLICT"?z(!0):Q.error("Failed to save settings")}},se=async t=>{z(!1),t?(await f(),ee()):E(null)};if(a||d)return e.jsxs("div",{className:"space-y-6",children:[e.jsx(j,{className:"h-10 w-full"}),e.jsx(j,{className:"h-10 w-full"}),e.jsx(j,{className:"h-10 w-full"}),e.jsx(j,{className:"h-10 w-full"})]});const je=()=>e.jsx("div",{className:"h-full flex flex-col",children:e.jsxs(ye,{defaultValue:"config",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(be,{className:"w-full",children:[e.jsx(I,{value:"config",className:"flex-1",children:"Model Config"}),e.jsx(I,{value:"settings",className:"flex-1",children:"Settings"}),e.jsx(I,{value:"info",className:"flex-1",children:"Info"})]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[e.jsx(O,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(A,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(Ae,{className:"w-4 h-4"}),"Presets"]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Apply pre-configured model mappings"}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(v,{variant:"outline",className:"text-[10px] bg-green-100 text-green-700 border-green-200",children:"Free Tier"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"No premium usage count"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Ze.map(t=>e.jsxs(p,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>Z(t),title:t.description,children:[e.jsx(ae,{className:"w-3 h-3 text-green-600"}),t.name]},t.name))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(v,{variant:"outline",className:"text-[10px] bg-blue-100 text-blue-700 border-blue-200",children:"Pro+ Required"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Uses premium request quota"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:es.map(t=>e.jsxs(p,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>Z(t),title:t.description,children:[e.jsx(ae,{className:"w-3 h-3"}),t.name]},t.name))})]})]}),e.jsx(q,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-2",children:"Model Mapping"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Configure which models to use for each tier"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(F,{label:"Default Model",description:"Used when no specific tier is requested",value:b,onChange:t=>u("model",t),models:l,disabled:r}),e.jsx(F,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:X||b,onChange:t=>u("opusModel",t),models:l,disabled:r}),e.jsx(F,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:W||b,onChange:t=>u("sonnetModel",t),models:l,disabled:r}),e.jsx(F,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:Y||b,onChange:t=>u("haikuModel",t),models:l,disabled:r})]})]})]})})}),e.jsx(O,{value:"settings",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(A,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(w,{htmlFor:"enabled",className:"text-sm font-medium",children:"Enable Copilot"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Allow using GitHub Copilot subscription"})]}),e.jsx(D,{id:"enabled",checked:G,onCheckedChange:t=>u("enabled",t)})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Basic Settings"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{htmlFor:"port",className:"text-xs",children:"Port"}),e.jsx(te,{id:"port",type:"number",value:B,onChange:t=>u("port",parseInt(t.target.value,10)),min:1024,max:65535,className:"max-w-[150px] h-8"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{htmlFor:"account-type",className:"text-xs",children:"Account Type"}),e.jsxs(le,{value:V,onValueChange:t=>u("accountType",t),children:[e.jsx(oe,{id:"account-type",className:"max-w-[150px] h-8",children:e.jsx(re,{})}),e.jsxs(ce,{children:[e.jsx(L,{value:"individual",children:"Individual"}),e.jsx(L,{value:"business",children:"Business"}),e.jsx(L,{value:"enterprise",children:"Enterprise"})]})]})]})]}),e.jsx(q,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Rate Limiting"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{htmlFor:"rate-limit",className:"text-xs",children:"Rate Limit (seconds)"}),e.jsx(te,{id:"rate-limit",type:"number",value:_,onChange:t=>u("rateLimit",t.target.value),placeholder:"No limit",min:0,className:"max-w-[150px] h-8"})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(w,{htmlFor:"wait-on-limit",className:"text-xs",children:"Wait on Rate Limit"}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Wait instead of error when limit hit"})]}),e.jsx(D,{id:"wait-on-limit",checked:H,onCheckedChange:t=>u("waitOnLimit",t)})]})]}),e.jsx(q,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Daemon Settings"}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(w,{htmlFor:"auto-start",className:"text-xs",children:"Auto-start Daemon"}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Start copilot-api when using profile"})]}),e.jsx(D,{id:"auto-start",checked:U,onCheckedChange:t=>u("autoStart",t)})]})]})]})})}),e.jsx(O,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(A,{className:"h-full",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2 mb-3",children:[e.jsx(Le,{className:"w-4 h-4"}),"Configuration Info"]}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Provider"}),e.jsx("span",{className:"font-mono",children:"GitHub Copilot"})]}),n&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"File Path"}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs break-all",children:n.path}),e.jsx(de,{value:n.path,size:"icon",className:"h-5 w-5"})]})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Status"}),e.jsx(v,{variant:"outline",className:n.exists?"w-fit text-green-600 border-green-200 bg-green-50":"w-fit text-muted-foreground",children:n.exists?"File exists":"Using defaults"})]})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:"Quick Usage"}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsx(P,{label:"Run with Copilot",command:"ccs copilot"}),e.jsx(P,{label:"Authenticate",command:"ccs copilot auth"}),e.jsx(P,{label:"Start daemon",command:"ccs copilot --start"}),e.jsx(P,{label:"Stop daemon",command:"ccs copilot --stop"})]})]})]})})})]})]})}),Ne=()=>e.jsx(h.Suspense,{fallback:e.jsxs("div",{className:"flex items-center justify-center h-full",children:[e.jsx(J,{className:"w-6 h-6 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:e.jsxs("div",{className:"h-full flex flex-col",children:[!R&&g!==null&&e.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[e.jsx(Te,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),e.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-6 pt-4",children:e.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:e.jsx(Ye,{value:k,onChange:fe,language:"json",minHeight:"100%"})})})]})});return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Copilot Configuration"}),n&&e.jsx(v,{variant:"outline",className:"text-xs",children:"copilot.settings.json"})]}),n&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Last modified:"," ",n.exists?new Date(n.mtime).toLocaleString():"Never saved"]})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{variant:"ghost",size:"sm",onClick:()=>f(),disabled:d,children:e.jsx(me,{className:`w-4 h-4 ${d?"animate-spin":""}`})}),e.jsx(p,{size:"sm",onClick:ee,disabled:i||N||!ge||!R,children:i||N?e.jsxs(e.Fragment,{children:[e.jsx(J,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Pe,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]}),e.jsxs("div",{className:"flex-1 flex divide-x overflow-hidden",children:[e.jsx("div",{className:"w-[540px] shrink-0 flex flex-col overflow-hidden bg-muted/5",children:je()}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-2 bg-muted/30 border-b flex items-center gap-2 shrink-0 h-[45px]",children:[e.jsx(Me,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Raw Configuration (JSON)"})]}),Ne()]})]}),e.jsx(we,{open:pe,title:"File Modified Externally",description:"This settings file was modified by another process. Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>se(!0),onCancel:()=>se(!1)})]})}function P({label:s,command:a}){return e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:s}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsx("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:a}),e.jsx(de,{value:a,size:"icon",className:"h-6 w-6"})]})]})}function K({title:s,children:a}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide px-3",children:s}),e.jsx("div",{className:"space-y-1",children:a})]})}function M({icon:s,label:a,status:l,statusText:r,variant:n="default"}){return e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg bg-muted/50",children:[e.jsx(s,{className:"w-4 h-4 text-muted-foreground shrink-0"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("span",{className:"text-sm",children:a})}),e.jsx("div",{className:"flex items-center gap-1.5",children:l?e.jsxs(e.Fragment,{children:[e.jsx(ue,{className:$("w-4 h-4",n==="warning"?"text-yellow-500":"text-green-500")}),e.jsx("span",{className:$("text-xs",n==="warning"?"text-yellow-500":"text-green-500"),children:r||"Yes"})]}):e.jsxs(e.Fragment,{children:[e.jsx(xe,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:r||"No"})]})})]})}function as(){return e.jsxs("div",{className:"space-y-4 p-4",children:[e.jsx(j,{className:"h-8 w-full"}),e.jsx(j,{className:"h-12 w-full"}),e.jsx(j,{className:"h-12 w-full"}),e.jsx(j,{className:"h-12 w-full"})]})}function hs(){const{status:s,statusLoading:a,refetchStatus:l,startAuth:r,isAuthenticating:n,startDaemon:d,isStartingDaemon:c,stopDaemon:i,isStoppingDaemon:x,install:N,isInstalling:f}=he();return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/30 shrink-0",children:[e.jsxs("div",{className:"p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_e,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:"Copilot"})]}),e.jsx(p,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>l(),disabled:a,children:e.jsx(me,{className:$("w-4 h-4",a&&"animate-spin")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"GitHub Copilot proxy"})]}),e.jsx(A,{className:"flex-1",children:a?e.jsx(as,{}):e.jsxs("div",{className:"p-3 space-y-4",children:[e.jsxs("div",{className:"rounded-md border border-yellow-500/50 bg-yellow-500/15 p-3 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Re,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-400 shrink-0"}),e.jsx("span",{className:"text-xs font-semibold text-yellow-800 dark:text-yellow-200",children:"Unofficial API - Use at Your Own Risk"})]}),e.jsxs("ul",{className:"text-[11px] text-yellow-700 dark:text-yellow-300 space-y-0.5 pl-6 list-disc",children:[e.jsx("li",{children:"Reverse-engineered API - may break anytime"}),e.jsx("li",{children:"Excessive use may trigger account restrictions"}),e.jsx("li",{children:"No warranty, no responsibility from CCS"})]})]}),e.jsxs(K,{title:"Setup",children:[e.jsx(M,{icon:Ie,label:"copilot-api",status:s?.installed??!1,statusText:s?.installed?s.version?`v${s.version}`:"Installed":"Missing"}),!s?.installed&&e.jsx(p,{size:"sm",className:"w-full mt-2",onClick:()=>N(void 0),disabled:f,children:f?e.jsxs(e.Fragment,{children:[e.jsx(J,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}),"Installing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Oe,{className:"w-3.5 h-3.5 mr-1.5"}),"Install copilot-api"]})}),s?.installed&&e.jsx(M,{icon:ne,label:"Integration",status:s?.enabled??!1,statusText:s?.enabled?"Enabled":"Disabled"})]}),s?.installed&&e.jsxs(K,{title:"Auth",children:[e.jsx(M,{icon:qe,label:"GitHub",status:s?.authenticated??!1,statusText:s?.authenticated?"Connected":"Not Connected"}),!s?.authenticated&&e.jsx(p,{size:"sm",className:"w-full mt-2",onClick:()=>r(),disabled:n,children:n?"Authenticating...":"Authenticate"})]}),s?.authenticated&&e.jsxs(K,{title:"Daemon",children:[e.jsx(M,{icon:De,label:"Status",status:s?.daemon_running??!1,statusText:s?.daemon_running?"Running":"Stopped"}),e.jsxs("div",{className:"px-3 py-1 text-xs text-muted-foreground",children:["Port: ",s?.port??4141]}),e.jsx("div",{className:"px-1",children:s?.daemon_running?e.jsxs(p,{size:"sm",variant:"outline",className:"w-full",onClick:()=>i(),disabled:x,children:[e.jsx(Qe,{className:"w-3.5 h-3.5 mr-1.5"}),x?"Stopping...":"Stop"]}):e.jsxs(p,{size:"sm",variant:"outline",className:"w-full",onClick:()=>d(),disabled:c,children:[e.jsx(ne,{className:"w-3.5 h-3.5 mr-1.5"}),c?"Starting...":"Start"]})})]})]})}),e.jsx("div",{className:"p-3 border-t bg-background text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Proxy"}),s?.daemon_running?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ue,{className:"w-3 h-3 text-green-500"}),"Active"]}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(xe,{className:"w-3 h-3 text-muted-foreground"}),"Inactive"]})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-hidden",children:e.jsx(ts,{})})]})}export{hs as CopilotPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s}from"./react-vendor-DMek_JCF.js";const _=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),M=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,c,o)=>o?o.toUpperCase():c.toLowerCase()),d=t=>{const a=M(t);return a.charAt(0).toUpperCase()+a.slice(1)},r=(...t)=>t.filter((a,c,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===c).join(" ").trim(),v=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var m={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const x=s.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:y="",children:n,iconNode:k,...h},i)=>s.createElement("svg",{ref:i,...m,width:a,height:a,stroke:t,strokeWidth:o?Number(c)*24/Number(a):c,className:r("lucide",y),...!n&&!v(h)&&{"aria-hidden":"true"},...h},[...k.map(([p,l])=>s.createElement(p,l)),...Array.isArray(n)?n:[n]]));const e=(t,a)=>{const c=s.forwardRef(({className:o,...y},n)=>s.createElement(x,{ref:n,iconNode:a,className:r(`lucide-${_(d(t))}`,`lucide-${t}`,o),...y}));return c.displayName=d(t),c};const f=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],O1=e("activity",f);const g=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],D1=e("arrow-down-right",g);const $=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],G1=e("arrow-left",$);const w=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],T1=e("arrow-up-right",w);const N=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],W1=e("book-open",N);const u=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],F1=e("bot",u);const b=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],I1=e("calendar",b);const z=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],Z1=e("chart-column",z);const C=[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]],K1=e("chart-pie",C);const j=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],X1=e("check",j);const q=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],J1=e("chevron-down",q);const A=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Q1=e("chevron-left",A);const H=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Y1=e("chevron-right",H);const L=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],e0=e("chevron-up",L);const V=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],a0=e("circle-alert",V);const S=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],t0=e("circle-check-big",S);const E=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],c0=e("circle-check",E);const R=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],o0=e("circle-x",R);const B=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],n0=e("circle",B);const P=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],s0=e("clock",P);const U=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],y0=e("code-xml",U);const O=[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]],h0=e("coins",O);const D=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],d0=e("copy",D);const G=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],r0=e("cpu",G);const T=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],k0=e("database",T);const W=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],i0=e("dollar-sign",W);const F=[["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"}]],p0=e("download",F);const I=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],l0=e("ellipsis",I);const Z=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],_0=e("external-link",Z);const K=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],M0=e("eye-off",K);const X=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],v0=e("eye",X);const J=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],m0=e("file-braces",J);const Q=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],x0=e("file-code",Q);const Y=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],f0=e("file-text",Y);const e1=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],g0=e("folder-open",e1);const a1=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],$0=e("gauge",a1);const t1=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],w0=e("git-branch",t1);const c1=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],N0=e("github",c1);const o1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],u0=e("globe",o1);const n1=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],b0=e("grip-vertical",n1);const s1=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],z0=e("heart",s1);const y1=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],C0=e("house",y1);const h1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],j0=e("info",h1);const d1=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],q0=e("key",d1);const r1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],A0=e("loader-circle",r1);const k1=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],H0=e("monitor",k1);const i1=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],L0=e("moon",i1);const p1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],V0=e("panel-left",p1);const l1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],S0=e("plus",l1);const _1=[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],E0=e("power-off",_1);const M1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],R0=e("power",M1);const v1=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],B0=e("radio",v1);const m1=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],P0=e("refresh-cw",m1);const x1=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],U0=e("rotate-ccw",x1);const f1=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],O0=e("save",f1);const g1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],D0=e("search",g1);const $1=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],G0=e("server",$1);const w1=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],T0=e("settings-2",w1);const N1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],W0=e("settings",N1);const u1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],F0=e("shield",u1);const b1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],I0=e("sparkles",b1);const z1=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],Z0=e("star",z1);const C1=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],K0=e("sun",C1);const j1=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],X0=e("terminal",j1);const q1=[["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"}]],J0=e("trash-2",q1);const A1=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Q0=e("trending-up",A1);const H1=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Y0=e("triangle-alert",H1);const L1=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],e2=e("user",L1);const V1=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],a2=e("users",V1);const S1=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],t2=e("wifi-off",S1);const E1=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],c2=e("wifi",E1);const R1=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],o2=e("wrench",R1);const B1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],n2=e("x",B1);const P1=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],s2=e("zap",P1);export{X0 as $,O1 as A,W1 as B,Z1 as C,l0 as D,M0 as E,g0 as F,$0 as G,C0 as H,j0 as I,Q1 as J,q0 as K,A0 as L,L0 as M,I1 as N,f0 as O,V0 as P,i0 as Q,U0 as R,W0 as S,Y0 as T,a2 as U,k0 as V,t2 as W,n2 as X,D1 as Y,s2 as Z,T1 as _,N0 as a,G0 as a0,h0 as a1,r0 as a2,Q0 as a3,K1 as a4,D0 as a5,a0 as a6,m0 as a7,T0 as a8,_0 as a9,G1 as aa,R0 as ab,w0 as ac,p0 as ad,E0 as ae,u0 as af,x0 as ag,o2 as ah,H0 as ai,F1 as aj,Y1 as b,K0 as c,v0 as d,c2 as e,F0 as f,z0 as g,t0 as h,n0 as i,X1 as j,b0 as k,c0 as l,o0 as m,B0 as n,d0 as o,P0 as p,J0 as q,O0 as r,y0 as s,S0 as t,J1 as u,e0 as v,I0 as w,Z0 as x,e2 as y,s0 as z};
|