tarsk 0.4.18 → 0.4.20
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/dist/index.js +116 -7
- package/dist/public/assets/{account-view-BCTSx-mj.js → account-view-D1kGyryt.js} +1 -1
- package/dist/public/assets/alert-dialog-Bk7neo_n.js +1 -0
- package/dist/public/assets/{api-CTYLCFyl.js → api-DL5XaoTS.js} +1 -1
- package/dist/public/assets/browser-tab-Cz-q-Pvk.js +1 -0
- package/dist/public/assets/chat-input-container-0T-khQfd.js +1 -0
- package/dist/public/assets/context-menu-DHHElhQ1.js +1 -0
- package/dist/public/assets/conversation-history-view-HVFzgO9e.js +1 -0
- package/dist/public/assets/{dialogs-config-jWciSgHl.js → dialogs-config-DmDjliuA.js} +6 -6
- package/dist/public/assets/diff-view-VbYca6ii.js +3 -0
- package/dist/public/assets/{dist-OF8pavjm.js → dist-CIGnaqp2.js} +7 -7
- package/dist/public/assets/explorer-tab-view-uSxyCL34.js +2 -0
- package/dist/public/assets/explorer-tree-DOg67ane.js +1 -0
- package/dist/public/assets/explorer-view-B0uaxiLf.js +1 -0
- package/dist/public/assets/history-view-BOjZoBCb.js +1 -0
- package/dist/public/assets/index-BE8v6oQ0.js +50 -0
- package/dist/public/assets/index-DVUFB7SX.css +1 -0
- package/dist/public/assets/onboarding-BgEjTEKs.js +1 -0
- package/dist/public/assets/onboarding-dialog-EiVl-ynw.js +1 -0
- package/dist/public/assets/page-toolbar-CvreDTwj.js +1 -0
- package/dist/public/assets/{project-settings-view-Bu1Pw54-.js → project-settings-view-BJYR_l3u.js} +1 -1
- package/dist/public/assets/provider-details-view-B1eTEo0M.js +1 -0
- package/dist/public/assets/providers-sidebar-Df50eL_5.js +1 -0
- package/dist/public/assets/react-vendor-CaS5zjF7.js +17 -0
- package/dist/public/assets/resizable-DJ5w1ZWX.js +1 -0
- package/dist/public/assets/run-stop-button-Z7jiLiq7.js +2 -0
- package/dist/public/assets/settings-view-C38jeeqJ.js +2 -0
- package/dist/public/assets/side-panel-container-BqWSTCOr.js +2 -0
- package/dist/public/assets/standard-list-item-CpBjveM0.js +1 -0
- package/dist/public/assets/store-CLOSXq_q.js +2 -0
- package/dist/public/assets/{tab-context-Dt4dsRtJ.js → tab-context-Bmd79Rk0.js} +1 -1
- package/dist/public/assets/tabs-DEmnnGvq.js +1 -0
- package/dist/public/assets/{terminal-panel-BSrV0okI.js → terminal-panel-D6GPXaCe.js} +2 -2
- package/dist/public/assets/{textarea-QU8Nv9O7.js → textarea-BjfyGfGR.js} +1 -1
- package/dist/public/assets/todos-view-yPftPooW.js +1 -0
- package/dist/public/assets/{use-toast-CoI8ds2n.js → use-toast-C9B1H3P9.js} +1 -1
- package/dist/public/assets/{utils-CCEUAD_u.js → utils-BG_JNnOl.js} +1 -1
- package/dist/public/index.html +20 -12
- package/package.json +16 -16
- package/dist/public/assets/browser-tab-DU0hQ0Qt.js +0 -1
- package/dist/public/assets/context-menu-Dy4KkPRW.js +0 -1
- package/dist/public/assets/conversation-history-view-Dors7tOx.js +0 -1
- package/dist/public/assets/diff-view-dDf3oLmb.js +0 -3
- package/dist/public/assets/explorer-tab-view-HfudmHM2.js +0 -2
- package/dist/public/assets/explorer-tree-qIt5h_Zr.js +0 -1
- package/dist/public/assets/explorer-view-Cbl_shds.js +0 -1
- package/dist/public/assets/history-view-D0-oG6k6.js +0 -1
- package/dist/public/assets/index-DYQT8pCu.js +0 -51
- package/dist/public/assets/index-wptl__nQ.css +0 -1
- package/dist/public/assets/onboarding-DSX8c4T-.js +0 -1
- package/dist/public/assets/onboarding-dialog-nou5aY1L.js +0 -1
- package/dist/public/assets/provider-details-view-BdnybbeE.js +0 -1
- package/dist/public/assets/providers-sidebar-F0N6061Y.js +0 -1
- package/dist/public/assets/react-vendor-C9VUgcc-.js +0 -17
- package/dist/public/assets/settings-view--SOtQ4dD.js +0 -2
- package/dist/public/assets/store-CHZlq7-o.js +0 -2
- package/dist/public/assets/todos-view-DDLe_Dhz.js +0 -1
- /package/dist/public/assets/{monaco-DvsnxTfD.js → monaco-c-HyCuEi.js} +0 -0
package/dist/index.js
CHANGED
|
@@ -4196,7 +4196,7 @@ function createGenerateImageTool(options) {
|
|
|
4196
4196
|
let apiKey = providerConfig.env && providerConfig.env.length > 0 ? process.env[providerConfig.env[0]] : void 0;
|
|
4197
4197
|
if (!apiKey) {
|
|
4198
4198
|
const providerKeys = await metadataManager.getProviderKeys();
|
|
4199
|
-
apiKey = providerKeys[providerConfig.
|
|
4199
|
+
apiKey = providerKeys[providerConfig.id];
|
|
4200
4200
|
}
|
|
4201
4201
|
if (!apiKey) {
|
|
4202
4202
|
return {
|
|
@@ -5070,7 +5070,7 @@ async function executeSubagent(options) {
|
|
|
5070
5070
|
let apiKey = providerConfig.env && providerConfig.env.length > 0 ? process.env[providerConfig.env[0]] : void 0;
|
|
5071
5071
|
if (!apiKey) {
|
|
5072
5072
|
const providerKeys = await metadataManager.getProviderKeys();
|
|
5073
|
-
apiKey = providerKeys[providerConfig.
|
|
5073
|
+
apiKey = providerKeys[providerConfig.id];
|
|
5074
5074
|
}
|
|
5075
5075
|
if (!apiKey) {
|
|
5076
5076
|
throw new Error(
|
|
@@ -5951,6 +5951,7 @@ var PiExecutorImpl = class {
|
|
|
5951
5951
|
constructor(metadataManager) {
|
|
5952
5952
|
this.metadataManager = metadataManager;
|
|
5953
5953
|
}
|
|
5954
|
+
metadataManager;
|
|
5954
5955
|
async *execute(userPrompt, context, signal, conversationHistory) {
|
|
5955
5956
|
try {
|
|
5956
5957
|
const providerName = context.provider;
|
|
@@ -5978,7 +5979,7 @@ var PiExecutorImpl = class {
|
|
|
5978
5979
|
if (!apiKey) {
|
|
5979
5980
|
try {
|
|
5980
5981
|
const providerKeys = await this.metadataManager.getProviderKeys();
|
|
5981
|
-
apiKey = providerKeys[providerConfig.
|
|
5982
|
+
apiKey = providerKeys[providerConfig.id];
|
|
5982
5983
|
apiKeySource = "configuration";
|
|
5983
5984
|
} catch (error) {
|
|
5984
5985
|
console.error(`[ai] Failed to retrieve provider keys from configuration:`, error);
|
|
@@ -10260,6 +10261,8 @@ var OpenWithHandler = class {
|
|
|
10260
10261
|
this.getProject = getProject2;
|
|
10261
10262
|
this.metadataManager = metadataManager;
|
|
10262
10263
|
}
|
|
10264
|
+
getProject;
|
|
10265
|
+
metadataManager;
|
|
10263
10266
|
async openWith(projectId, program) {
|
|
10264
10267
|
console.log("[openWith] Request: projectId=%s program=%s", projectId, program);
|
|
10265
10268
|
const programError = validateProgram(program);
|
|
@@ -10957,6 +10960,9 @@ function validateFilePath(projectPath, filePath) {
|
|
|
10957
10960
|
async function handleGetAIFiles(c, projectManager) {
|
|
10958
10961
|
try {
|
|
10959
10962
|
const projectId = c.req.param("id");
|
|
10963
|
+
if (!projectId) {
|
|
10964
|
+
return errorResponse(c, ErrorCodes.INVALID_REQUEST, "Project ID is required", 400);
|
|
10965
|
+
}
|
|
10960
10966
|
const project = await projectManager.getProject(projectId);
|
|
10961
10967
|
if (!project) {
|
|
10962
10968
|
return errorResponse(c, ErrorCodes.PROJECT_NOT_FOUND, `Project not found: ${projectId}`, 404);
|
|
@@ -10976,6 +10982,9 @@ async function handleGetAIFiles(c, projectManager) {
|
|
|
10976
10982
|
async function handleGetAIFile(c, projectManager) {
|
|
10977
10983
|
try {
|
|
10978
10984
|
const projectId = c.req.param("id");
|
|
10985
|
+
if (!projectId) {
|
|
10986
|
+
return errorResponse(c, ErrorCodes.INVALID_REQUEST, "Project ID is required", 400);
|
|
10987
|
+
}
|
|
10979
10988
|
const filePath = c.req.query("path");
|
|
10980
10989
|
if (!filePath) {
|
|
10981
10990
|
return c.json(
|
|
@@ -11046,6 +11055,9 @@ Links to important documentation, tools, or references.
|
|
|
11046
11055
|
async function handleSaveAIFile(c, projectManager) {
|
|
11047
11056
|
try {
|
|
11048
11057
|
const projectId = c.req.param("id");
|
|
11058
|
+
if (!projectId) {
|
|
11059
|
+
return errorResponse(c, ErrorCodes.INVALID_REQUEST, "Project ID is required", 400);
|
|
11060
|
+
}
|
|
11049
11061
|
let body;
|
|
11050
11062
|
try {
|
|
11051
11063
|
body = await c.req.json();
|
|
@@ -11084,6 +11096,9 @@ async function handleSaveAIFile(c, projectManager) {
|
|
|
11084
11096
|
async function handleDeleteAIFile(c, projectManager) {
|
|
11085
11097
|
try {
|
|
11086
11098
|
const projectId = c.req.param("id");
|
|
11099
|
+
if (!projectId) {
|
|
11100
|
+
return errorResponse(c, ErrorCodes.INVALID_REQUEST, "Project ID is required", 400);
|
|
11101
|
+
}
|
|
11087
11102
|
const filePath = c.req.query("path");
|
|
11088
11103
|
if (!filePath) {
|
|
11089
11104
|
return c.json(
|
|
@@ -11122,6 +11137,9 @@ async function handleDeleteAIFile(c, projectManager) {
|
|
|
11122
11137
|
async function handleCreateSkill(c, projectManager) {
|
|
11123
11138
|
try {
|
|
11124
11139
|
const projectId = c.req.param("id");
|
|
11140
|
+
if (!projectId) {
|
|
11141
|
+
return errorResponse(c, ErrorCodes.INVALID_REQUEST, "Project ID is required", 400);
|
|
11142
|
+
}
|
|
11125
11143
|
let body;
|
|
11126
11144
|
try {
|
|
11127
11145
|
body = await c.req.json();
|
|
@@ -12657,6 +12675,11 @@ var ProjectCreator = class {
|
|
|
12657
12675
|
this.processingStateManager = processingStateManager;
|
|
12658
12676
|
this.runCommandCallbacks = runCommandCallbacks;
|
|
12659
12677
|
}
|
|
12678
|
+
rootFolder;
|
|
12679
|
+
metadataManager;
|
|
12680
|
+
gitManager;
|
|
12681
|
+
processingStateManager;
|
|
12682
|
+
runCommandCallbacks;
|
|
12660
12683
|
async *createProject(gitUrl, commitMethod = CommitMethods.PullRequest) {
|
|
12661
12684
|
if (!this.gitManager.validateGitUrl(gitUrl)) {
|
|
12662
12685
|
yield {
|
|
@@ -13827,6 +13850,14 @@ async function getAIHubMixCredits(apiKey) {
|
|
|
13827
13850
|
// src/features/providers/providers-get-credits.route.ts
|
|
13828
13851
|
async function getProviderCredits(c, metadataManager) {
|
|
13829
13852
|
const name = c.req.param("name");
|
|
13853
|
+
if (!name) {
|
|
13854
|
+
const { response, statusCode } = ResponseBuilder.error(
|
|
13855
|
+
ErrorCodes.INVALID_REQUEST,
|
|
13856
|
+
"Provider name is required",
|
|
13857
|
+
400
|
|
13858
|
+
);
|
|
13859
|
+
return c.json(response, statusCode);
|
|
13860
|
+
}
|
|
13830
13861
|
if (name.toLowerCase() === "openrouter") {
|
|
13831
13862
|
try {
|
|
13832
13863
|
const keys = await metadataManager.getProviderKeys();
|
|
@@ -14110,7 +14141,8 @@ async function checkVp(c) {
|
|
|
14110
14141
|
});
|
|
14111
14142
|
const installed = result.status === 0;
|
|
14112
14143
|
return c.json({ installed });
|
|
14113
|
-
} catch (
|
|
14144
|
+
} catch (error) {
|
|
14145
|
+
console.error("Failed to check vp installation:", error);
|
|
14114
14146
|
return c.json({ installed: false });
|
|
14115
14147
|
}
|
|
14116
14148
|
}
|
|
@@ -16101,6 +16133,9 @@ async function getIgnoredPaths(repoPath, relativePaths) {
|
|
|
16101
16133
|
async function handleListThreadExplorerDir(c, threadManager) {
|
|
16102
16134
|
try {
|
|
16103
16135
|
const threadId = c.req.param("id");
|
|
16136
|
+
if (!threadId) {
|
|
16137
|
+
return errorResponse(c, ErrorCodes.INVALID_REQUEST, "Thread ID is required", 400);
|
|
16138
|
+
}
|
|
16104
16139
|
const queryPath = c.req.query("path") ?? "";
|
|
16105
16140
|
const thread = await threadManager.getThread(threadId);
|
|
16106
16141
|
if (!thread) {
|
|
@@ -16153,6 +16188,9 @@ async function handleListThreadExplorerDir(c, threadManager) {
|
|
|
16153
16188
|
async function handleDeleteExplorerItem(c, threadManager) {
|
|
16154
16189
|
try {
|
|
16155
16190
|
const threadId = c.req.param("id");
|
|
16191
|
+
if (!threadId) {
|
|
16192
|
+
return errorResponse(c, ErrorCodes.INVALID_REQUEST, "Thread ID is required", 400);
|
|
16193
|
+
}
|
|
16156
16194
|
const filePath = c.req.query("path");
|
|
16157
16195
|
if (!filePath) {
|
|
16158
16196
|
return c.json({ error: { code: "BAD_REQUEST", message: "path is required" } }, 400);
|
|
@@ -16190,6 +16228,9 @@ async function handleDeleteExplorerItem(c, threadManager) {
|
|
|
16190
16228
|
async function handleRenameExplorerItem(c, threadManager) {
|
|
16191
16229
|
try {
|
|
16192
16230
|
const threadId = c.req.param("id");
|
|
16231
|
+
if (!threadId) {
|
|
16232
|
+
return errorResponse(c, ErrorCodes.INVALID_REQUEST, "Thread ID is required", 400);
|
|
16233
|
+
}
|
|
16193
16234
|
let body;
|
|
16194
16235
|
try {
|
|
16195
16236
|
body = await c.req.json();
|
|
@@ -16235,6 +16276,9 @@ async function handleRenameExplorerItem(c, threadManager) {
|
|
|
16235
16276
|
async function handleCreateExplorerFile(c, threadManager) {
|
|
16236
16277
|
try {
|
|
16237
16278
|
const threadId = c.req.param("id");
|
|
16279
|
+
if (!threadId) {
|
|
16280
|
+
return errorResponse(c, ErrorCodes.INVALID_REQUEST, "Thread ID is required", 400);
|
|
16281
|
+
}
|
|
16238
16282
|
let body;
|
|
16239
16283
|
try {
|
|
16240
16284
|
body = await c.req.json();
|
|
@@ -16295,6 +16339,9 @@ var MEDIA_MIME_TYPES = {
|
|
|
16295
16339
|
async function handleGetExplorerMedia(c, threadManager) {
|
|
16296
16340
|
try {
|
|
16297
16341
|
const threadId = c.req.param("id");
|
|
16342
|
+
if (!threadId) {
|
|
16343
|
+
return errorResponse(c, ErrorCodes.INVALID_REQUEST, "Thread ID is required", 400);
|
|
16344
|
+
}
|
|
16298
16345
|
const filePath = c.req.query("path");
|
|
16299
16346
|
if (!filePath) {
|
|
16300
16347
|
return c.json(
|
|
@@ -16332,6 +16379,9 @@ async function handleGetExplorerMedia(c, threadManager) {
|
|
|
16332
16379
|
async function handleCreateExplorerFolder(c, threadManager) {
|
|
16333
16380
|
try {
|
|
16334
16381
|
const threadId = c.req.param("id");
|
|
16382
|
+
if (!threadId) {
|
|
16383
|
+
return errorResponse(c, ErrorCodes.INVALID_REQUEST, "Thread ID is required", 400);
|
|
16384
|
+
}
|
|
16335
16385
|
let body;
|
|
16336
16386
|
try {
|
|
16337
16387
|
body = await c.req.json();
|
|
@@ -16592,6 +16642,12 @@ async function downloadGithubFolder(repoUrl, srcPath, destPath, options = {}) {
|
|
|
16592
16642
|
async function handleGetThreadAIFiles(c, threadManager) {
|
|
16593
16643
|
try {
|
|
16594
16644
|
const threadId = c.req.param("id");
|
|
16645
|
+
if (!threadId) {
|
|
16646
|
+
return errorResponse(c, ErrorCodes.INVALID_REQUEST, "Thread ID is required", 400);
|
|
16647
|
+
}
|
|
16648
|
+
if (!threadId) {
|
|
16649
|
+
return errorResponse(c, ErrorCodes.INVALID_REQUEST, "Thread ID is required", 400);
|
|
16650
|
+
}
|
|
16595
16651
|
const thread = await threadManager.getThread(threadId);
|
|
16596
16652
|
if (!thread) {
|
|
16597
16653
|
return errorResponse(c, ErrorCodes.THREAD_NOT_FOUND, `Thread not found: ${threadId}`, 404);
|
|
@@ -16611,6 +16667,9 @@ async function handleGetThreadAIFiles(c, threadManager) {
|
|
|
16611
16667
|
async function handleGetThreadAIFile(c, threadManager) {
|
|
16612
16668
|
try {
|
|
16613
16669
|
const threadId = c.req.param("id");
|
|
16670
|
+
if (!threadId) {
|
|
16671
|
+
return errorResponse(c, ErrorCodes.INVALID_REQUEST, "Thread ID is required", 400);
|
|
16672
|
+
}
|
|
16614
16673
|
const filePath = c.req.query("path");
|
|
16615
16674
|
if (!filePath) {
|
|
16616
16675
|
return c.json(
|
|
@@ -16681,6 +16740,9 @@ Links to important documentation, tools, or references.
|
|
|
16681
16740
|
async function handleSaveThreadAIFile(c, threadManager) {
|
|
16682
16741
|
try {
|
|
16683
16742
|
const threadId = c.req.param("id");
|
|
16743
|
+
if (!threadId) {
|
|
16744
|
+
return errorResponse(c, ErrorCodes.INVALID_REQUEST, "Thread ID is required", 400);
|
|
16745
|
+
}
|
|
16684
16746
|
let body;
|
|
16685
16747
|
try {
|
|
16686
16748
|
body = await c.req.json();
|
|
@@ -16719,6 +16781,9 @@ async function handleSaveThreadAIFile(c, threadManager) {
|
|
|
16719
16781
|
async function handleDeleteThreadAIFile(c, threadManager) {
|
|
16720
16782
|
try {
|
|
16721
16783
|
const threadId = c.req.param("id");
|
|
16784
|
+
if (!threadId) {
|
|
16785
|
+
return errorResponse(c, ErrorCodes.INVALID_REQUEST, "Thread ID is required", 400);
|
|
16786
|
+
}
|
|
16722
16787
|
const filePath = c.req.query("path");
|
|
16723
16788
|
if (!filePath) {
|
|
16724
16789
|
return c.json(
|
|
@@ -16757,6 +16822,9 @@ async function handleDeleteThreadAIFile(c, threadManager) {
|
|
|
16757
16822
|
async function handleCreateThreadAgent(c, threadManager) {
|
|
16758
16823
|
try {
|
|
16759
16824
|
const threadId = c.req.param("id");
|
|
16825
|
+
if (!threadId) {
|
|
16826
|
+
return errorResponse(c, ErrorCodes.INVALID_REQUEST, "Thread ID is required", 400);
|
|
16827
|
+
}
|
|
16760
16828
|
let body;
|
|
16761
16829
|
try {
|
|
16762
16830
|
body = await c.req.json();
|
|
@@ -16824,6 +16892,9 @@ Place your agent system prompt here as markdown. This will be used as the system
|
|
|
16824
16892
|
async function handleCreateThreadSkill(c, threadManager) {
|
|
16825
16893
|
try {
|
|
16826
16894
|
const threadId = c.req.param("id");
|
|
16895
|
+
if (!threadId) {
|
|
16896
|
+
return errorResponse(c, ErrorCodes.INVALID_REQUEST, "Thread ID is required", 400);
|
|
16897
|
+
}
|
|
16827
16898
|
let body;
|
|
16828
16899
|
try {
|
|
16829
16900
|
body = await c.req.json();
|
|
@@ -16889,6 +16960,9 @@ Place your skill instructions here as markdown. This will be used when Tarsk is
|
|
|
16889
16960
|
async function handleInstallGithubFolder(c, threadManager) {
|
|
16890
16961
|
try {
|
|
16891
16962
|
const threadId = c.req.param("id");
|
|
16963
|
+
if (!threadId) {
|
|
16964
|
+
return errorResponse(c, ErrorCodes.INVALID_REQUEST, "Thread ID is required", 400);
|
|
16965
|
+
}
|
|
16892
16966
|
let body;
|
|
16893
16967
|
try {
|
|
16894
16968
|
body = await c.req.json();
|
|
@@ -19153,6 +19227,14 @@ import { existsSync as existsSync19 } from "fs";
|
|
|
19153
19227
|
async function gitUnifiedStatusHandler(c, metadataManager, db) {
|
|
19154
19228
|
try {
|
|
19155
19229
|
const threadId = c.req.param("threadId");
|
|
19230
|
+
if (!threadId) {
|
|
19231
|
+
const { response, statusCode } = ResponseBuilder.error(
|
|
19232
|
+
ErrorCodes.INVALID_REQUEST,
|
|
19233
|
+
"Thread ID is required",
|
|
19234
|
+
400
|
|
19235
|
+
);
|
|
19236
|
+
return c.json(response, statusCode);
|
|
19237
|
+
}
|
|
19156
19238
|
const fresh = c.req.query("fresh") === "true";
|
|
19157
19239
|
if (!fresh) {
|
|
19158
19240
|
const cached = await getGitStatusCache(db, threadId);
|
|
@@ -20857,7 +20939,7 @@ async function generateImage(c, metadataManager, conversationManager, threadMana
|
|
|
20857
20939
|
let apiKey = providerConfig.env && providerConfig.env.length > 0 ? process.env[providerConfig.env[0]] : void 0;
|
|
20858
20940
|
if (!apiKey) {
|
|
20859
20941
|
const providerKeys = await metadataManager.getProviderKeys();
|
|
20860
|
-
apiKey = providerKeys[providerConfig.
|
|
20942
|
+
apiKey = providerKeys[providerConfig.id];
|
|
20861
20943
|
}
|
|
20862
20944
|
if (!apiKey) {
|
|
20863
20945
|
return c.json({ error: `No API key found for provider: ${provider}` }, 400);
|
|
@@ -20947,8 +21029,35 @@ async function callStandard(apiKey, baseUrl, rawModel, provider, prompt) {
|
|
|
20947
21029
|
const rawText = await response.text();
|
|
20948
21030
|
if (!response.ok) {
|
|
20949
21031
|
const isHtml = rawText.trimStart().startsWith("<");
|
|
20950
|
-
|
|
20951
|
-
|
|
21032
|
+
if (isHtml) {
|
|
21033
|
+
throw new Error(
|
|
21034
|
+
`Provider returned an HTML page (status ${response.status}). The model may not support image generation or the provider endpoint is misconfigured.`
|
|
21035
|
+
);
|
|
21036
|
+
}
|
|
21037
|
+
try {
|
|
21038
|
+
const errorData = JSON.parse(rawText);
|
|
21039
|
+
if (errorData.error) {
|
|
21040
|
+
const errorCode = errorData.error.code;
|
|
21041
|
+
const errorMessage = errorData.error.message;
|
|
21042
|
+
if (errorCode === "1113" || errorMessage?.toLowerCase().includes("balance")) {
|
|
21043
|
+
throw new Error(
|
|
21044
|
+
`Insufficient balance for provider: ${provider}. Please recharge your account or check your resource package.`
|
|
21045
|
+
);
|
|
21046
|
+
}
|
|
21047
|
+
if (errorCode === "1101" || errorMessage?.toLowerCase().includes("invalid api key")) {
|
|
21048
|
+
throw new Error(
|
|
21049
|
+
`Invalid API key for provider: ${provider}. Please check your API key configuration.`
|
|
21050
|
+
);
|
|
21051
|
+
}
|
|
21052
|
+
throw new Error(`${provider} API error: ${errorMessage || rawText}`);
|
|
21053
|
+
}
|
|
21054
|
+
} catch (parseError) {
|
|
21055
|
+
if (parseError instanceof SyntaxError) {
|
|
21056
|
+
throw new Error(`Provider error (${provider}): ${rawText}`);
|
|
21057
|
+
}
|
|
21058
|
+
throw parseError;
|
|
21059
|
+
}
|
|
21060
|
+
throw new Error(`Provider error (${provider}): ${rawText}`);
|
|
20952
21061
|
}
|
|
20953
21062
|
let data;
|
|
20954
21063
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{
|
|
1
|
+
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{$i as t,Cr as n,Gt as r,Pn as i,Wn as a,Z as o,fi as s,la as c,sa as l,zi as u}from"./dialogs-config-DmDjliuA.js";import{t as d}from"./use-toast-C9B1H3P9.js";var f=e(c(),1),p=l(),m=n();function h(e){let t=(0,p.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=a(`animate-pulse rounded-md bg-muted`,n),t[3]=n,t[4]=i);let o;return t[5]!==r||t[6]!==i?(o=(0,m.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=o):o=t[7],o}function g(){let[e,n]=(0,f.useState)(null),[a,c]=(0,f.useState)(!0);(0,f.useEffect)(()=>{l();let e=()=>{document.visibilityState===`visible`&&l()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);async function l(){c(!0);try{n(await o())}catch(e){d({title:`Error`,description:e instanceof Error?e.message:`Failed to load account info`,variant:`destructive`})}finally{c(!1)}}function p(){r(`https://buy.stripe.com/14AcN6feK0Jjbheb2H3Nm03?client_reference_id=${e?.clientReferenceId??``}`)}function g(){r(`https://buy.stripe.com/9B67sMd6CgIh70Y0o33Nm04?client_reference_id=${e?.clientReferenceId??``}`)}if(a)return(0,m.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,m.jsxs)(`div`,{className:`mb-6`,children:[(0,m.jsx)(h,{className:`h-8 w-32 mb-2`}),(0,m.jsx)(h,{className:`h-4 w-64`})]}),(0,m.jsxs)(`div`,{className:`space-y-6`,children:[(0,m.jsxs)(`div`,{className:`flex gap-4`,children:[(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-2`,children:[(0,m.jsx)(h,{className:`h-4 w-20`}),(0,m.jsx)(h,{className:`h-9 w-28`})]}),(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-3`,children:[(0,m.jsx)(h,{className:`h-4 w-24`}),(0,m.jsx)(h,{className:`h-6 w-32`}),(0,m.jsx)(h,{className:`h-4 w-full`})]})]}),(0,m.jsxs)(`div`,{className:`space-y-3`,children:[(0,m.jsx)(h,{className:`h-4 w-24`}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1 flex-1`,children:[(0,m.jsx)(h,{className:`h-5 w-28`}),(0,m.jsx)(h,{className:`h-4 w-64`})]}),(0,m.jsx)(h,{className:`h-9 w-28 shrink-0`})]}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1 flex-1`,children:[(0,m.jsx)(h,{className:`h-5 w-36`}),(0,m.jsx)(h,{className:`h-4 w-56`}),(0,m.jsx)(h,{className:`h-4 w-32`})]}),(0,m.jsx)(h,{className:`h-9 w-24 shrink-0`})]})]})]})]});let _=e?.plan===`unlimited-pro`;return(0,m.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,m.jsxs)(`div`,{className:`mb-6`,children:[(0,m.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Account`}),(0,m.jsx)(`p`,{className:`text-muted-foreground`,children:`Manage your Tarsk plan and prompt balance.`})]}),(0,m.jsxs)(`div`,{className:`space-y-6`,children:[(0,m.jsxs)(`div`,{className:`flex gap-4`,children:[(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-2`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[(0,m.jsx)(s,{className:`h-4 w-4`}),`Balance`]}),(0,m.jsx)(`div`,{className:`flex items-end gap-2`,children:_?(0,m.jsx)(`span`,{className:`text-3xl font-bold`,children:`Unlimited`}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`text-3xl font-bold`,children:e?.promptsRemaining.toLocaleString()??0}),(0,m.jsx)(`span`,{className:`text-muted-foreground mb-1 text-sm`,children:`prompts remaining`})]})})]}),(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-3`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[(0,m.jsx)(u,{className:`h-4 w-4`}),`Current Plan`]}),(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`text-lg font-semibold`,children:_?`Unlimited Pro`:`Pay as you go`}),_&&(0,m.jsx)(`span`,{className:`rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary`,children:`Active`})]}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:_?`You have unlimited prompts with no restrictions.`:`Purchase prompts as needed. Upgrade to Pro for unlimited access.`})]})]}),!_&&(0,m.jsxs)(`div`,{className:`space-y-3`,children:[(0,m.jsx)(`h2`,{className:`text-sm font-semibold text-muted-foreground uppercase tracking-wide`,children:`Add Prompts`}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,m.jsx)(`span`,{className:`font-semibold`,children:`1,000 Prompts`})}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Top up your balance with 1,000 additional prompts for $5.`})]}),(0,m.jsx)(i,{onClick:p,className:`shrink-0`,children:`Top Up Balance`})]}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(u,{className:`h-4 w-4 text-primary`}),(0,m.jsx)(`span`,{className:`font-semibold`,children:`Unlimited Pro Plan`})]}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Unlimited prompts for $100 and lifetime access to Tarsk.`}),(0,m.jsxs)(`ul`,{className:`text-sm text-muted-foreground space-y-0.5`,children:[(0,m.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,m.jsx)(t,{className:`h-3 w-3 text-primary`}),`Unlimited prompts`]}),(0,m.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,m.jsx)(t,{className:`h-3 w-3 text-primary`}),`Priority access`]})]})]}),(0,m.jsx)(i,{onClick:g,className:`shrink-0`,children:`Purchase`})]})]})]})]})}export{g as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Fn as n,Wn as r,la as i,sa as a}from"./dialogs-config-DmDjliuA.js";import{at as o,ct as s,it as c,lt as l,ot as u,rt as d,st as f,ut as p}from"./react-vendor-CaS5zjF7.js";var m=a(),h=e(i(),1),g=t(),_=l,v=s,y=h.forwardRef((e,t)=>{let n=(0,m.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,g.jsx)(f,{className:o,...a,ref:t}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});y.displayName=f.displayName;var b=h.forwardRef((e,t)=>{let n=(0,m.c)(10),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let s;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,g.jsx)(y,{}),n[3]=s):s=n[3];let c;n[4]===i?c=n[5]:(c=r(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,i),n[4]=i,n[5]=c);let l;return n[6]!==a||n[7]!==t||n[8]!==c?(l=(0,g.jsxs)(v,{children:[s,(0,g.jsx)(o,{ref:t,className:c,...a})]}),n[6]=a,n[7]=t,n[8]=c,n[9]=l):l=n[9],l});b.displayName=o.displayName;var x=e=>{let t=(0,m.c)(8),n,i;t[0]===e?(n=t[1],i=t[2]):({className:n,...i}=e,t[0]=e,t[1]=n,t[2]=i);let a;t[3]===n?a=t[4]:(a=r(`flex flex-col space-y-2 text-center sm:text-left`,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,g.jsx)(`div`,{className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o};x.displayName=`AlertDialogHeader`;var S=e=>{let t=(0,m.c)(8),n,i;t[0]===e?(n=t[1],i=t[2]):({className:n,...i}=e,t[0]=e,t[1]=n,t[2]=i);let a;t[3]===n?a=t[4]:(a=r(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,g.jsx)(`div`,{className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o};S.displayName=`AlertDialogFooter`;var C=h.forwardRef((e,t)=>{let n=(0,m.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`text-lg font-semibold`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,g.jsx)(p,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});C.displayName=p.displayName;var w=h.forwardRef((e,t)=>{let n=(0,m.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`text-sm text-muted-foreground`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,g.jsx)(u,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});w.displayName=u.displayName;var T=h.forwardRef((e,t)=>{let i=(0,m.c)(9),a,o;i[0]===e?(a=i[1],o=i[2]):({className:a,...o}=e,i[0]=e,i[1]=a,i[2]=o);let s;i[3]===a?s=i[4]:(s=r(n(),a),i[3]=a,i[4]=s);let c;return i[5]!==o||i[6]!==t||i[7]!==s?(c=(0,g.jsx)(d,{ref:t,className:s,...o}),i[5]=o,i[6]=t,i[7]=s,i[8]=c):c=i[8],c});T.displayName=d.displayName;var E=h.forwardRef((e,t)=>{let i=(0,m.c)(9),a,o;i[0]===e?(a=i[1],o=i[2]):({className:a,...o}=e,i[0]=e,i[1]=a,i[2]=o);let s;i[3]===a?s=i[4]:(s=r(n({variant:`outline`}),`mt-2 sm:mt-0`,a),i[3]=a,i[4]=s);let l;return i[5]!==o||i[6]!==t||i[7]!==s?(l=(0,g.jsx)(c,{ref:t,className:s,...o}),i[5]=o,i[6]=t,i[7]=s,i[8]=l):l=i[8],l});E.displayName=c.displayName;export{w as a,C as c,b as i,T as n,S as o,E as r,x as s,_ as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Cn as e,Dn as t,En as n,On as r,Sn as i,Tn as a,wn as o}from"./dialogs-config-
|
|
1
|
+
import{Cn as e,Dn as t,En as n,On as r,Sn as i,Tn as a,wn as o}from"./dialogs-config-DmDjliuA.js";async function s(t,n){return o(`api/threads/${e(t)}/explorer?path=${encodeURIComponent(n)}`)}async function c(t,n){return o(`api/threads/${e(t)}/ai-file?path=${encodeURIComponent(n)}`)}async function l(t,n,i){return r(`api/threads/${e(t)}/ai-file`,{path:n,content:i})}async function u(t,n){return i(`api/threads/${e(t)}/explorer?path=${encodeURIComponent(n)}`)}async function d(t,r,i){return n(`api/threads/${e(t)}/explorer`,{path:r,newName:i})}async function f(n,r,i){return t(`api/threads/${e(n)}/explorer/file`,{dirPath:r,name:i})}function p(t,n){return`${a()}/api/threads/${e(t)}/explorer/media?path=${encodeURIComponent(n)}`}async function m(n,r,i){return t(`api/threads/${e(n)}/explorer/folder`,{dirPath:r,name:i})}export{p as a,l as c,c as i,m as n,s as o,u as r,d as s,f as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Gt as n,Ii as r,Rr as i,Wr as a,Xr as o,la as s,sa as c,si as l}from"./dialogs-config-DmDjliuA.js";import{a as u}from"./store-CLOSXq_q.js";import{n as d}from"./tab-context-Bmd79Rk0.js";import{t as f}from"./run-stop-button-Z7jiLiq7.js";var p=c(),m=e(s(),1),h=t();function g(){let e=(0,p.c)(41),{devServerUrl:t,browserResetTrigger:s}=d(),{state:c}=u(),{selectedProjectId:g,projects:_}=c,v;if(e[0]!==_||e[1]!==g){let t;e[3]===g?t=e[4]:(t=e=>e.projectId===g,e[3]=g,e[4]=t),v=_.find(t),e[0]=_,e[1]=g,e[2]=v}else v=e[2];let y=v,[b,x]=(0,m.useState)(``),[S,C]=(0,m.useState)(``),[w,T]=(0,m.useState)(`desktop`),E=(0,m.useRef)(null),D;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{C(``),x(``),E.current&&(E.current.src=``)},e[5]=D):D=e[5];let O;e[6]===s?O=e[7]:(O=[s],e[6]=s,e[7]=O),(0,m.useEffect)(D,O);let k,A;e[8]===t?(k=e[9],A=e[10]):(k=()=>{t&&(x(t),C(t))},A=[t],e[8]=t,e[9]=k,e[10]=A),(0,m.useEffect)(k,A);let j;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{let t=e.trim();t&&(!t.startsWith(`http://`)&&!t.startsWith(`https://`)&&(t=`http://`+t),x(t),C(t))},e[11]=j):j=e[11];let M=j,N;e[12]===b?N=e[13]:(N=e=>{e.key===`Enter`&&M(b)},e[12]=b,e[13]=N);let P=N,F;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{if(E.current){let e=E.current.src;E.current.src=``,setTimeout(()=>{E.current&&(E.current.src=e)},0)}},e[14]=F):F=e[14];let I=F,L;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(L={desktop:{width:`100%`,height:`100%`},tablet:{width:`768px`,height:`1024px`},mobile:{width:`375px`,height:`667px`}},e[15]=L):L=e[15];let R=L[w],z;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>x(e.target.value),e[16]=z):z=e[16];let B;e[17]!==P||e[18]!==b?(B=(0,h.jsx)(`input`,{type:`text`,value:b,onChange:z,onKeyDown:P,placeholder:`Enter URL...`,className:`flex-1 px-4 py-1.5 text-sm bg-muted rounded-full border border-border outline-none focus:ring-1 focus:ring-ring font-mono`,spellCheck:!1}),e[17]=P,e[18]=b,e[19]=B):B=e[19];let V;e[20]===S?V=e[21]:(V=S&&(0,h.jsx)(`button`,{onClick:I,title:`Refresh page`,className:`p-1.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,children:(0,h.jsx)(o,{size:15})}),e[20]=S,e[21]=V);let H;e[22]!==w||e[23]!==S?(H=S&&(0,h.jsxs)(`div`,{className:`flex items-center bg-muted rounded-md p-0.5`,children:[(0,h.jsx)(`button`,{onClick:()=>T(`desktop`),title:`Desktop view`,className:`p-1.5 rounded transition-colors ${w===`desktop`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`}`,children:(0,h.jsx)(l,{size:15})}),(0,h.jsx)(`button`,{onClick:()=>T(`tablet`),title:`Tablet view`,className:`p-1.5 rounded transition-colors ${w===`tablet`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`}`,children:(0,h.jsx)(i,{size:15})}),(0,h.jsx)(`button`,{onClick:()=>T(`mobile`),title:`Mobile view`,className:`p-1.5 rounded transition-colors ${w===`mobile`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`}`,children:(0,h.jsx)(a,{size:15})})]}),e[22]=w,e[23]=S,e[24]=H):H=e[24];let U;e[25]===S?U=e[26]:(U=S&&(0,h.jsx)(`button`,{onClick:()=>void n(S),title:`Open in external browser`,className:`p-1.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,children:(0,h.jsx)(r,{size:15})}),e[25]=S,e[26]=U);let W;e[27]!==B||e[28]!==V||e[29]!==H||e[30]!==U?(W=(0,h.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b border-border shrink-0`,children:[B,V,H,U]}),e[27]=B,e[28]=V,e[29]=H,e[30]=U,e[31]=W):W=e[31];let G;e[32]!==R||e[33]!==w||e[34]!==S||e[35]!==y||e[36]!==g?(G=S?(0,h.jsx)(`div`,{className:`flex-1 flex items-center justify-center bg-background`,children:w===`desktop`?(0,h.jsx)(`iframe`,{ref:E,src:S,className:`flex-1 w-full h-full border-none`,title:`Browser`}):(0,h.jsx)(`div`,{className:`bg-white border border-border rounded-lg shadow-lg overflow-hidden transition-all duration-200`,style:{width:R.width,height:R.height,maxWidth:`100%`,maxHeight:`100%`},children:(0,h.jsx)(`iframe`,{ref:E,src:S,className:`w-full h-full border-none`,title:`Browser`})})}):(0,h.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center gap-6 text-muted-foreground`,children:g&&y?.runCommand?(0,h.jsx)(f,{projectId:g,runCommand:y.runCommand,large:!0}):(0,h.jsx)(`p`,{className:`text-sm`,children:`Enter a URL to browse`})}),e[32]=R,e[33]=w,e[34]=S,e[35]=y,e[36]=g,e[37]=G):G=e[37];let K;return e[38]!==W||e[39]!==G?(K=(0,h.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[W,G]}),e[38]=W,e[39]=G,e[40]=K):K=e[40],K}export{g as BrowserTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{$ as t,$i as n,Cr as r,D as i,Jr as a,Lr as o,Mi as s,Ni as c,Nr as l,Or as u,Pn as d,Q as f,Qr as p,Si as m,Tn as h,Tt as g,Vr as _,Wn as v,Y as y,Yi as b,Yt as x,_i as S,bi as C,bn as w,cn as T,d as E,di as D,fn as O,ki as k,kr as A,kt as ee,la as j,m as M,nt as N,on as P,pn as F,ra as I,sa as L,ti as R,tt as te,ui as ne,w as z,y as re}from"./dialogs-config-DmDjliuA.js";import{gt as B}from"./react-vendor-CaS5zjF7.js";import{a as ie,l as V,s as ae,t as H,u as U}from"./store-CLOSXq_q.js";import{c as W,s as G,u as K}from"./history-view-BOjZoBCb.js";import{a as q,c as J,i as oe,o as se,s as ce,t as le}from"./alert-dialog-Bk7neo_n.js";import{r as ue}from"./onboarding-BgEjTEKs.js";var Y=L(),X=e(j(),1),Z=r();function Q(e){let t=(0,Y.c)(24),{node:n,level:r,renderNode:i,defaultOpen:a,indent:o,childContainerClassName:s,openState:c,onToggle:l}=e,u=!!(n.children&&n.children.length>0),d=c[n.id]??a,f;t[0]!==n.id||t[1]!==l?(f=()=>l(n.id),t[0]=n.id,t[1]=l,t[2]=f):f=t[2];let p=f,m;t[3]!==u||t[4]!==d||t[5]!==r||t[6]!==n||t[7]!==i||t[8]!==p?(m=i(n,{isOpen:d,level:r,toggle:p,hasChildren:u}),t[3]=u,t[4]=d,t[5]=r,t[6]=n,t[7]=i,t[8]=p,t[9]=m):m=t[9];let h;t[10]!==s||t[11]!==a||t[12]!==u||t[13]!==o||t[14]!==d||t[15]!==r||t[16]!==n.children||t[17]!==l||t[18]!==c||t[19]!==i?(h=u&&d&&(0,Z.jsx)(`div`,{style:{paddingLeft:o},className:s,children:n.children.map(e=>(0,Z.jsx)(Q,{node:e,level:r+1,renderNode:i,defaultOpen:a,indent:o,childContainerClassName:s,openState:c,onToggle:l},e.id))}),t[10]=s,t[11]=a,t[12]=u,t[13]=o,t[14]=d,t[15]=r,t[16]=n.children,t[17]=l,t[18]=c,t[19]=i,t[20]=h):h=t[20];let g;return t[21]!==m||t[22]!==h?(g=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),t[21]=m,t[22]=h,t[23]=g):g=t[23],g}function de(e){let t=(0,Y.c)(23),{nodes:n,renderNode:r,resetKey:i,defaultOpen:a,indent:o,childContainerClassName:s,className:c}=e,l=a===void 0?!1:a,u=o===void 0?16:o,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d={},t[0]=d):d=t[0];let[f,p]=(0,X.useState)(d),[m,h]=(0,X.useState)(i);i!==m&&(h(i),p({}));let g;t[1]===l?g=t[2]:(g=e=>{p(t=>({...t,[e]:!(t[e]??l)}))},t[1]=l,t[2]=g);let _=g,y;t[3]===c?y=t[4]:(y=v(`min-w-0`,c),t[3]=c,t[4]=y);let b;if(t[5]!==s||t[6]!==l||t[7]!==_||t[8]!==u||t[9]!==n||t[10]!==f||t[11]!==r){let e;t[13]!==s||t[14]!==l||t[15]!==_||t[16]!==u||t[17]!==f||t[18]!==r?(e=e=>(0,Z.jsx)(Q,{node:e,level:0,renderNode:r,defaultOpen:l,indent:u,childContainerClassName:s,openState:f,onToggle:_},e.id),t[13]=s,t[14]=l,t[15]=_,t[16]=u,t[17]=f,t[18]=r,t[19]=e):e=t[19],b=n.map(e),t[5]=s,t[6]=l,t[7]=_,t[8]=u,t[9]=n,t[10]=f,t[11]=r,t[12]=b}else b=t[12];let x;return t[20]!==y||t[21]!==b?(x=(0,Z.jsx)(`div`,{className:y,children:b}),t[20]=y,t[21]=b,t[22]=x):x=t[22],x}var fe=new Map,$=new Map;function pe(e){return fe.get(e)}function me(e,t){let n=$.get(e);return n||(n=new Set,$.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&$.delete(e)}}function he(e){let t=$.get(e);if(t)for(let e of t)e()}function ge(e,t){return async function(n,r){let i=await fetch(e+`/api/browser-js/execute-tool`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({threadId:t,toolName:n,params:r})});if(!i.ok){let e=await i.text();try{let t=JSON.parse(e).error||{};e=t.details||t.message||e}catch{}return{text:null,error:`Tool `+n+` failed: `+e}}let a=await i.json();return{text:a.content&&a.content[0]?a.content[0].text:null,error:null}}}function _e(e,t,n){if(fe.has(e))return;fe.set(e,{status:`running`}),he(e);let r=h();(async()=>{try{let i=ge(r,n),a=Object.getPrototypeOf(async function(){}).constructor,o=await new a(`callTool`,t)(i),s=o===void 0?null:o;fe.set(e,{status:`success`,result:s}),he(e),await O(e,s)}catch(t){let n=t instanceof Error?t.stack||t.message:String(t);fe.set(e,{status:`error`,error:n}),he(e);try{await O(e,{error:n})}catch(e){console.error(`[browser-js-executor] failed to submit error result`,e)}}})()}var ve=()=>{if(typeof window>`u`)return null;let e=window.SpeechRecognition||window.webkitSpeechRecognition;return e?new e:null};function ye(){let e=(0,Y.c)(14),[t,n]=(0,X.useState)(!1),[r,i]=(0,X.useState)(``),[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)(!1),l=(0,X.useRef)(null),u=(0,X.useRef)(``),d,f;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{try{let e=ve();e?(e.continuous=!0,e.interimResults=!0,e.lang=`en-US`,e.onstart=()=>{n(!0),o(null),u.current=``},e.onresult=e=>{let t=``;for(let n=e.resultIndex;n<e.results.length;n++){let r=e.results[n][0].transcript;e.results[n].isFinal?i(e=>e+r+` `):t+=r}u.current=t},e.onerror=e=>{console.error(`Speech recognition error:`,e.error),o(e.error||`An error occurred during speech recognition`)},e.onend=()=>{n(!1)},l.current=e,c(!0)):(c(!1),o(`Speech Recognition API is not supported in your browser`))}catch(e){console.error(`Failed to initialize speech recognition:`,e),c(!1),o(`Failed to initialize speech recognition`)}return()=>{l.current&&l.current.abort()}},f=[],e[0]=d,e[1]=f):(d=e[0],f=e[1]),(0,X.useEffect)(d,f);let p;e[2]===t?p=e[3]:(p=()=>{l.current&&!t&&l.current.start()},e[2]=t,e[3]=p);let m=p,h;e[4]===t?h=e[5]:(h=()=>{l.current&&t&&l.current.stop()},e[4]=t,e[5]=h);let g=h,_;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>{i(``),u.current=``},e[6]=_):_=e[6];let v=_,y;return e[7]!==a||e[8]!==t||e[9]!==s||e[10]!==m||e[11]!==g||e[12]!==r?(y={isListening:t,transcript:r,error:a,startListening:m,stopListening:g,resetTranscript:v,isSupported:s},e[7]=a,e[8]=t,e[9]=s,e[10]=m,e[11]=g,e[12]=r,e[13]=y):y=e[13],y}function be({initialValue:e}={}){let{state:n,dispatch:r}=ie(),[i,a]=(0,X.useState)(e??``),[o,s]=(0,X.useState)(-1),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(0),[p,m]=(0,X.useState)([]),[h,_]=(0,X.useState)(()=>(n.selectedThreadId?n.projectModelSelections[n.selectedThreadId]:void 0)??null),v=(0,X.useRef)(h?.id??``),y=(0,X.useRef)(h?.provider??``),b=(0,X.useRef)(null),[x,S]=(0,X.useState)(!1),[C,T]=(0,X.useState)(!1),[E,D]=(0,X.useState)([]),[O,k]=(0,X.useState)(!1),[A,ee]=(0,X.useState)(!1),[j,M]=(0,X.useState)([]),[N,P]=(0,X.useState)(null),[F,I]=(0,X.useState)([]),[L,R]=(0,X.useState)(!1),[ne,re]=(0,X.useState)(``),[B,V]=(0,X.useState)(0),[ae,U]=(0,X.useState)([]),[W,G]=(0,X.useState)([]),[K,q]=(0,X.useState)(!1),[J,oe]=(0,X.useState)(``),se=(0,X.useRef)(null),ce=(0,X.useRef)(null),le=(0,X.useRef)(null),ue=(0,X.useRef)(null),Y=(0,X.useRef)(null),Z=(0,X.useRef)(null);(0,X.useEffect)(()=>{v.current=h?.id??``,y.current=h?.provider??``},[h?.id,h?.provider]);let Q=(0,X.useCallback)((e,t)=>{_(e);let i=n.selectedThreadId;if(!i||(r({type:H.SetProjectModel,threadId:i,model:e}),t?.persist===!1))return;let a=`${i}:${e.provider??``}:${e.id}`;b.current!==a&&(b.current=a,console.log(`[useChatInputState] Persisting model to thread:`,{threadId:i,model:{id:e.id,provider:e.provider}}),w(i,{model:e.id,modelProvider:e.provider}).then(()=>{b.current===a&&(b.current=null),console.log(`[useChatInputState] Model persisted successfully`)}).catch(e=>{b.current===a&&(b.current=null),console.error(`Failed to save model to thread:`,e)}))},[n.selectedThreadId,r]);(0,X.useEffect)(()=>{(async()=>{let e=n.selectedProjectId?n.projects.find(e=>e.projectId===n.selectedProjectId)?.threads.find(e=>e.threadId===n.selectedThreadId):void 0,r=n.selectedThreadId?n.projectModelSelections[n.selectedThreadId]:void 0,i=e?.model??r?.id??null,a=e?.modelProvider??r?.provider??null;console.log(`[useChatInputState] Loading models for thread:`,{threadId:n.selectedThreadId,projectId:n.selectedProjectId,currentThread:e?{model:e.model,modelProvider:e.modelProvider}:void 0,storedModel:r?{id:r.id,provider:r.provider}:void 0,savedModelId:i,savedModelProvider:a});try{let e=await t(),n=Object.values(e).flat();if(n.length===0){m([]),_(null);return}m(n);let r=i&&a?n.find(e=>e.id===i&&e.provider===a)??null:null,o=n[0],s=r??o,c=!r&&!!(i||a),l=v.current===s.id&&y.current===s.provider;console.log(`[useChatInputState] Model selection decision:`,{matchedSavedModel:r?{id:r.id}:null,fallbackModel:{id:o.id},modelToSelect:{id:s.id},shouldPersistFallback:c,hasSameSelection:l,currentSelected:{id:v.current,provider:y.current}}),l||Q(s,{persist:c})}catch(e){console.error(`Failed to load enabled models:`,e)}})()},[n.selectedThreadId,n.selectedProjectId,n.projects,Q]);let de=(0,X.useRef)(Q);(0,X.useEffect)(()=>{de.current=Q},[Q]),(0,X.useEffect)(()=>{n.configUpdatedAt!==0&&(async()=>{try{let e=await t(),n=Object.values(e).flat();if(n.length>0){m(n);let e=v.current,t=y.current;n.some(n=>n.id===e&&n.provider===t)||de.current(n[0],{persist:!0})}}catch(e){console.error(`Failed to reload enabled models:`,e)}})()},[n.configUpdatedAt]),(0,X.useEffect)(()=>{!A||j.length>0||(async()=>{try{let e=await f(),t=Object.values(e).flat();t.length>0&&(M(t),P(e=>e??t[0]))}catch(e){console.error(`Failed to load image models:`,e)}})()},[A,j.length]);let[fe,$]=(0,X.useState)(n.selectedThreadId);return(0,X.useEffect)(()=>{n.selectedThreadId!==fe&&setTimeout(()=>{$(n.selectedThreadId),I([]),R(!1),U([]),G([]),q(!1),k(!1),ee(!1)},0)},[n.selectedThreadId,fe]),(0,X.useEffect)(()=>{n.selectedThreadId&&g(n.selectedThreadId).then(({commands:e,skills:t})=>{console.log(`Loaded slash commands:`,e,`skills:`,t),U(e),G(t)}).catch(e=>console.error(`Failed to load slash commands and skills:`,e))},[n.selectedThreadId]),(0,X.useEffect)(()=>{n.focusChatInput&&n.selectedThreadId&&!n.isStreaming&&(ce.current?.focus(),r({type:H.ClearFocusChatInput}))},[n.focusChatInput,n.selectedThreadId,n.isStreaming,r]),(0,X.useEffect)(()=>{let e=e=>{le.current&&!le.current.contains(e.target)&&S(!1),ue.current&&!ue.current.contains(e.target)&&T(!1)};if(x||C)return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[x,C]),{message:i,setMessage:a,historyIndex:o,setHistoryIndex:s,draftMessage:c,setDraftMessage:l,cursorPosition:u,setCursorPosition:d,availableModels:p,setAvailableModels:m,selectedModel:h,setSelectedModel:Q,selectedModelIdRef:v,showModelMenu:x,setShowModelMenu:S,showPlusMenu:C,setShowPlusMenu:T,attachments:E,setAttachments:D,planMode:O,setPlanMode:k,imageMode:A,setImageMode:ee,availableImageModels:j,setAvailableImageModels:M,selectedImageModel:N,setSelectedImageModel:P,allFiles:F,setAllFiles:I,showSuggestions:L,setShowSuggestions:R,suggestionQuery:ne,setSuggestionQuery:re,selectedIndex:B,setSelectedIndex:V,slashCommands:ae,setSlashCommands:U,skills:W,setSkills:G,showCommandSuggestions:K,setShowCommandSuggestions:q,commandQuery:J,setCommandQuery:oe,fileInputRef:se,textareaRef:ce,modelMenuRef:le,plusMenuRef:ue,suggestionsRef:Y,commandSuggestionsRef:Z,handleNewChat:async()=>{if(n.selectedThreadId)try{let e=await z(n.selectedThreadId);r({type:H.ClearMessages}),console.log(`New conversation started:`,e);let t=await te(n.selectedThreadId);r({type:H.SetMessages,messages:t.messages})}catch(e){console.error(`Failed to start new chat:`,e)}},state:n,dispatch:r}}var xe=e=>{E(e)};function Se(e){let t=(0,Y.c)(99),{message:n,setMessage:r,attachments:i,selectedModel:a,onSend:o,isStreaming:s,selectedThreadId:c,isListening:l,stopListening:u,resetTranscript:d,dispatch:f,historyIndex:p,setHistoryIndex:m,draftMessage:h,setDraftMessage:g,cursorPosition:_,setCursorPosition:v,showSuggestions:y,setShowSuggestions:b,suggestionQuery:x,setSuggestionQuery:S,allFiles:C,setAllFiles:w,selectedIndex:T,setSelectedIndex:E,showCommandSuggestions:D,setShowCommandSuggestions:O,commandQuery:k,setCommandQuery:A,slashCommands:j,skills:N,textareaRef:P,setAttachments:F,planMode:I,setPlanMode:L,imageMode:R,selectedImageModel:te}=e,ne;t[0]!==i||t[1]!==f||t[2]!==R||t[3]!==l||t[4]!==s||t[5]!==n||t[6]!==o||t[7]!==I||t[8]!==d||t[9]!==te||t[10]!==a||t[11]!==c||t[12]!==F||t[13]!==g||t[14]!==m||t[15]!==r||t[16]!==u||t[17]!==P?(ne=()=>{if(!n.trim()&&i.length===0||!c)return;let e=R?te:a;e&&(l&&(u(),d()),s?f({type:H.EnqueueChatMessage,message:{id:`queued-${Date.now()}`,threadId:c,message:n,model:e.id,attachments:i,provider:e.provider,planMode:I,imageMode:R}}):o(n,e.id,i,e.provider,I,R),xe(n),r(``),F([]),m(-1),g(``),P.current&&(P.current.style.height=`auto`))},t[0]=i,t[1]=f,t[2]=R,t[3]=l,t[4]=s,t[5]=n,t[6]=o,t[7]=I,t[8]=d,t[9]=te,t[10]=a,t[11]=c,t[12]=F,t[13]=g,t[14]=m,t[15]=r,t[16]=u,t[17]=P,t[18]=ne):ne=t[18];let z=ne,re;t[19]!==_||t[20]!==n||t[21]!==r||t[22]!==b||t[23]!==x||t[24]!==P?(re=e=>{let t=n.substring(0,_-x.length-1);r(`${t}${e} ${n.substring(_)}`),b(!1),setTimeout(()=>{if(P.current){P.current.focus();let n=t.length+e.length+1;P.current.setSelectionRange(n,n)}},0)},t[19]=_,t[20]=n,t[21]=r,t[22]=b,t[23]=x,t[24]=P,t[25]=re):re=t[25];let B=re,ie;t[26]!==k||t[27]!==_||t[28]!==n||t[29]!==r||t[30]!==L||t[31]!==O||t[32]!==P?(ie=e=>{let t=n.substring(0,_-k.length-1),i=n.substring(_);r(`${t}${e.content}${i}`),O(!1),setTimeout(()=>{if(P.current){P.current.focus();let n=t.length+e.content.length;P.current.setSelectionRange(n,n)}},0),e.metadata.mode===`plan`&&L(!0)},t[26]=k,t[27]=_,t[28]=n,t[29]=r,t[30]=L,t[31]=O,t[32]=P,t[33]=ie):ie=t[33];let V=ie,ae;t[34]!==k||t[35]!==_||t[36]!==n||t[37]!==r||t[38]!==O||t[39]!==P?(ae=e=>{let t=n.substring(0,_-k.length-1),i=n.substring(_),a=e.name.includes(` `)?`/"${e.name}"`:`/${e.name}`;r(`${t}${a}${i}`),O(!1),setTimeout(()=>{if(P.current){P.current.focus();let e=t.length+a.length;P.current.setSelectionRange(e,e)}},0)},t[34]=k,t[35]=_,t[36]=n,t[37]=r,t[38]=O,t[39]=P,t[40]=ae):ae=t[40];let U=ae,W,G,K,q;if(t[41]!==C||t[42]!==k||t[43]!==h||t[44]!==z||t[45]!==p||t[46]!==V||t[47]!==B||t[48]!==U||t[49]!==n||t[50]!==T||t[51]!==c||t[52]!==w||t[53]!==A||t[54]!==v||t[55]!==g||t[56]!==m||t[57]!==r||t[58]!==E||t[59]!==O||t[60]!==b||t[61]!==S||t[62]!==D||t[63]!==y||t[64]!==N||t[65]!==j||t[66]!==x){K=e=>{if(D){if(e.key===`ArrowDown`){e.preventDefault(),E((T+1)%W.length);return}if(e.key===`ArrowUp`){e.preventDefault(),E((T-1+W.length)%W.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault();let t=W[T];t&&(t.type===`command`?V(t.data):U(t.data));return}if(e.key===`Escape`){O(!1);return}}if(y){let t=G.length>0;if(e.key===`ArrowDown`&&t){e.preventDefault(),E((T+1)%G.length);return}if(e.key===`ArrowUp`&&t){e.preventDefault(),E((T-1+G.length)%G.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault(),G[T]&&B(G[T]);return}if(e.key===`Escape`){b(!1);return}}if(e.key===`Enter`&&!e.shiftKey){e.preventDefault(),z();return}let t=M();t.length!==0&&(e.key===`ArrowUp`?(e.preventDefault(),p===-1?(g(n),m(t.length-1),r(t[t.length-1])):p>0&&(m(p-1),r(t[p-1]))):e.key===`ArrowDown`&&(e.preventDefault(),p>0?(m(p-1),r(t[p-1])):p===0&&(m(-1),r(h))))};let e;t[71]!==C||t[72]!==c||t[73]!==w||t[74]!==A||t[75]!==v||t[76]!==r||t[77]!==E||t[78]!==O||t[79]!==b||t[80]!==S?(e=e=>{let t=e.target.value,n=e.target.selectionStart;r(t),v(n);let i=t.substring(0,n),a=i.lastIndexOf(`/`);if(a!==-1){let e=a>0?i[a-1]:``;if(a===0||/\s/.test(e)){let e=i.substring(a+1);e.includes(` `)?O(!1):(A(e),O(!0),b(!1),E(0))}else O(!1)}else{O(!1);let e=i.lastIndexOf(`#`);if(e!==-1){let t=e>0?i[e-1]:``;if(e===0||/\s/.test(t)){let t=i.substring(e+1);t.includes(` `)?b(!1):(S(t),b(!0),E(0),C.length===0&&c&&ee(c).then(e=>{w(e)}).catch(Te))}else b(!1)}else b(!1)}let o=e.target;o.style.height=`auto`,o.style.height=`${Math.min(o.scrollHeight,160)}px`},t[71]=C,t[72]=c,t[73]=w,t[74]=A,t[75]=v,t[76]=r,t[77]=E,t[78]=O,t[79]=b,t[80]=S,t[81]=e):e=t[81],q=e;let i;if(t[82]!==k||t[83]!==N||t[84]!==j){let e;t[86]===k?e=t[87]:(e=e=>e.name.toLowerCase().includes(k.toLowerCase()),t[86]=k,t[87]=e);let n=j.filter(e),r;t[88]===k?r=t[89]:(r=e=>e.name.toLowerCase().includes(k.toLowerCase()),t[88]=k,t[89]=r);let a=N.filter(r);i=[...n.map(we),...a.map(Ce)],t[82]=k,t[83]=N,t[84]=j,t[85]=i}else i=t[85];W=i.slice(0,10),G=y?C.filter(e=>e.toLowerCase().includes(x.toLowerCase())).slice(0,10):[],t[41]=C,t[42]=k,t[43]=h,t[44]=z,t[45]=p,t[46]=V,t[47]=B,t[48]=U,t[49]=n,t[50]=T,t[51]=c,t[52]=w,t[53]=A,t[54]=v,t[55]=g,t[56]=m,t[57]=r,t[58]=E,t[59]=O,t[60]=b,t[61]=S,t[62]=D,t[63]=y,t[64]=N,t[65]=j,t[66]=x,t[67]=W,t[68]=G,t[69]=K,t[70]=q}else W=t[67],G=t[68],K=t[69],q=t[70];let J;return t[90]!==W||t[91]!==G||t[92]!==K||t[93]!==z||t[94]!==q||t[95]!==V||t[96]!==B||t[97]!==U?(J={handleSend:z,handleKeyDown:K,handleTextareaInput:q,insertFileReference:B,insertCommand:V,insertSkill:U,allSuggestions:W,fileSuggestions:G},t[90]=W,t[91]=G,t[92]=K,t[93]=z,t[94]=q,t[95]=V,t[96]=B,t[97]=U,t[98]=J):J=t[98],J}function Ce(e){return{type:`skill`,data:e}}function we(e){return{type:`command`,data:e}}function Te(e){return console.error(`Failed to fetch files:`,e)}function Ee(e){let t=(0,Y.c)(21),{visible:n,commands:r,skills:i,query:a,selectedIndex:s,onSelectCommand:c,onSelectSkill:l,onMouseEnterSuggestion:d,containerRef:f}=e;if(!n)return null;let p;if(t[0]!==r||t[1]!==a||t[2]!==i){let e;t[4]===a?e=t[5]:(e=e=>e.name.toLowerCase().includes(a.toLowerCase()),t[4]=a,t[5]=e);let n=r.filter(e),o;t[6]===a?o=t[7]:(o=e=>e.name.toLowerCase().includes(a.toLowerCase()),t[6]=a,t[7]=o);let s=i.filter(o);p=[...n.map(Oe),...s.map(De)].slice(0,10),t[0]=r,t[1]=a,t[2]=i,t[3]=p}else p=t[3];let m=p,h;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(o,{className:`h-3 w-3`}),t[8]=h):h=t[8];let g=a&&` matching "${a}"`,_;t[9]===g?_=t[10]:(_=(0,Z.jsxs)(`div`,{className:`px-2 py-1.5 text-xs font-semibold text-muted-foreground border-b border-border/50 mb-1 flex items-center gap-2`,children:[h,`Commands & Skills`,g]}),t[9]=g,t[10]=_);let y;t[11]!==m||t[12]!==d||t[13]!==c||t[14]!==l||t[15]!==s?(y=m.length>0?m.map((e,t)=>{let n=t===s;if(e.type===`command`){let r=e.data;return(0,Z.jsxs)(`button`,{type:`button`,className:v(`flex w-full flex-col gap-1 rounded-lg px-3 py-2 text-left transition-colors`,n?`bg-accent text-accent-foreground`:`text-popover-foreground hover:bg-accent/50`),onClick:()=>c(r),onMouseEnter:()=>d(t),children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(o,{className:`h-3 w-3 text-muted-foreground`}),(0,Z.jsxs)(`span`,{className:`font-medium`,children:[`/`,r.name]}),r.metadata.argumentHint&&(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r.metadata.argumentHint}),r.scope===`project`&&(0,Z.jsx)(`span`,{className:`ml-auto text-[10px] rounded-full bg-primary/10 px-1.5 py-0.5 text-primary`,children:`project`})]}),r.metadata.description&&(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r.metadata.description})]},`cmd-${r.name}`)}else{let r=e.data;return(0,Z.jsxs)(`button`,{type:`button`,className:v(`flex w-full flex-col gap-1 rounded-lg px-3 py-2 text-left transition-colors`,n?`bg-accent text-accent-foreground`:`text-popover-foreground hover:bg-accent/50`),onClick:()=>l(r),onMouseEnter:()=>d(t),children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(u,{className:`h-3 w-3 text-amber-500`}),(0,Z.jsxs)(`span`,{className:`font-medium`,children:[`/`,r.name]}),(0,Z.jsx)(`span`,{className:`ml-auto text-[10px] rounded-full bg-amber-500/10 px-1.5 py-0.5 text-amber-700 dark:text-amber-400`,children:`skill`}),r.scope===`project`&&(0,Z.jsx)(`span`,{className:`text-[10px] rounded-full bg-primary/10 px-1.5 py-0.5 text-primary`,children:`project`})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r.description})]},`skill-${r.name}`)}}):(0,Z.jsxs)(`div`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:[`No commands or skills found.`,(0,Z.jsx)(`br`,{}),(0,Z.jsxs)(`span`,{className:`text-[10px]`,children:[`Create commands in `,(0,Z.jsx)(`code`,{className:`bg-muted px-1 rounded`,children:`.agents/commands/`}),` or skills in `,(0,Z.jsx)(`code`,{className:`bg-muted px-1 rounded`,children:`.agents/skills/`})]})]}),t[11]=m,t[12]=d,t[13]=c,t[14]=l,t[15]=s,t[16]=y):y=t[16];let b;return t[17]!==f||t[18]!==_||t[19]!==y?(b=(0,Z.jsxs)(`div`,{ref:f,className:`absolute bottom-full left-0 mb-2 w-full max-h-64 overflow-y-auto rounded-xl border border-border bg-popover p-1 shadow-lg z-50 animate-in fade-in slide-in-from-bottom-2`,children:[_,y]}),t[17]=f,t[18]=_,t[19]=y,t[20]=b):b=t[20],b}function De(e){return{type:`skill`,data:e}}function Oe(e){return{type:`command`,data:e}}function ke(e){return e.startsWith(`image/`)}function Ae(e){let t=(0,Y.c)(7),{attachments:n,onRemove:r}=e;if(n.length===0)return null;let i;if(t[0]!==n||t[1]!==r){let e;t[3]===r?e=t[4]:(e=(e,t)=>(0,Z.jsx)(`div`,{className:`group relative flex items-center gap-1 rounded-md bg-muted text-xs text-muted-foreground`,children:ke(e.mimeType)?(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(`img`,{src:`data:${e.mimeType};base64,${e.content}`,alt:e.fileName,className:`h-16 w-16 rounded-md object-cover`}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>r(t),className:`absolute -right-1.5 -top-1.5 flex h-4 w-4 items-center justify-center rounded-full bg-foreground text-background opacity-0 transition-opacity group-hover:opacity-100`,children:[(0,Z.jsx)(A,{className:`h-2.5 w-2.5`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Remove attachment`})]})]}):(0,Z.jsxs)(`span`,{className:`flex items-center gap-1 px-2 py-1`,children:[(0,Z.jsx)(R,{className:`h-3 w-3`}),e.fileName,(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>r(t),className:`ml-1 hover:text-foreground`,children:[(0,Z.jsx)(A,{className:`h-3 w-3`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Remove attachment`})]})]})},t),t[3]=r,t[4]=e),i=n.map(e),t[0]=n,t[1]=r,t[2]=i}else i=t[2];let a;return t[5]===i?a=t[6]:(a=(0,Z.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1.5`,children:i}),t[5]=i,t[6]=a),a}function je(e,t){let n=e.target.files;if(!n||n.length===0)return;let r=Array.from(n),i=r.length,a=Array.from({length:i}),o=0;e.target.value=``,r.forEach((e,n)=>{let r=new FileReader;r.onload=()=>{let s=r.result.split(`,`)[1];a[n]={fileName:e.name,content:s,mimeType:e.type||`application/octet-stream`},o+=1,o===i&&t(a)},r.readAsDataURL(e)})}function Me(e){let t=(0,Y.c)(16),{showSuggestions:n,fileSuggestions:r,suggestionQuery:i,selectedIndex:o,onSelectFile:l,onMouseEnterSuggestion:u,containerRef:d}=e;if(!n||r.length===0)return null;let f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(a,{className:`h-3 w-3`}),t[0]=f):f=t[0];let p;t[1]===i?p=t[2]:(p=(0,Z.jsxs)(`div`,{className:`px-2 py-1.5 text-xs font-semibold text-muted-foreground border-b border-border/50 mb-1 flex items-center gap-2`,children:[f,`Files matching "`,i,`"`]}),t[1]=i,t[2]=p);let m;if(t[3]!==r||t[4]!==u||t[5]!==l||t[6]!==o){let e;t[8]!==u||t[9]!==l||t[10]!==o?(e=(e,t)=>{let n=e.split(`/`).pop()??e;return(0,Z.jsxs)(`button`,{type:`button`,className:v(`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-left transition-colors`,t===o?`bg-accent text-accent-foreground`:`text-popover-foreground hover:bg-accent/50`),onClick:()=>l(e),onMouseEnter:()=>u(t),children:[e.endsWith(`.ts`)||e.endsWith(`.tsx`)||e.endsWith(`.js`)||e.endsWith(`.jsx`)?(0,Z.jsx)(c,{className:`h-4 w-4 text-blue-500`}):(0,Z.jsx)(s,{className:`h-4 w-4 text-muted-foreground`}),(0,Z.jsxs)(`div`,{className:`flex flex-col overflow-hidden`,children:[(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:n}),(0,Z.jsx)(`span`,{className:`truncate text-[10px] text-muted-foreground opacity-70`,children:e})]})]},e)},t[8]=u,t[9]=l,t[10]=o,t[11]=e):e=t[11],m=r.map(e),t[3]=r,t[4]=u,t[5]=l,t[6]=o,t[7]=m}else m=t[7];let h;return t[12]!==d||t[13]!==p||t[14]!==m?(h=(0,Z.jsxs)(`div`,{ref:d,className:`absolute bottom-full left-0 mb-2 w-full max-h-64 overflow-y-auto rounded-xl border border-border bg-popover p-1 shadow-lg z-50 animate-in fade-in slide-in-from-bottom-2`,children:[p,m]}),t[12]=d,t[13]=p,t[14]=m,t[15]=h):h=t[15],h}function Ne(e){let t=(0,Y.c)(3),{provider:n}=e;if(!n)return null;let r=`https://models.tarsk.io/svg/${n}.svg`,i=`${n} logo`,a;return t[0]!==r||t[1]!==i?(a=(0,Z.jsx)(`img`,{src:r,alt:i,className:`h-3.5 w-3.5 flex-shrink-0`,onError:Pe}),t[0]=r,t[1]=i,t[2]=a):a=t[2],a}function Pe(e){e.currentTarget.style.visibility=`hidden`}function Fe(e){let t=(0,Y.c)(26),{availableModels:n,selectedModel:r,onModelSelect:i}=e,[a,o]=X.useState(!1),s=X.useRef(null),c,l;t[0]===a?(c=t[1],l=t[2]):(c=()=>{let e=e=>{s.current&&!s.current.contains(e.target)&&o(!1)};if(a)return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},l=[a],t[0]=a,t[1]=c,t[2]=l),X.useEffect(c,l);let u;t[3]===i?u=t[4]:(u=e=>{i(e),o(!1)},t[3]=i,t[4]=u);let f=u,p;t[5]===a?p=t[6]:(p=()=>o(!a),t[5]=a,t[6]=p);let m=r?.provider,h;t[7]===m?h=t[8]:(h=(0,Z.jsx)(Ne,{provider:m}),t[7]=m,t[8]=h);let g;t[9]===r?g=t[10]:(g=r?ue(r.id):`No model`,t[9]=r,t[10]=g);let _;t[11]===g?_=t[12]:(_=(0,Z.jsx)(`span`,{className:`text-xs font-medium`,children:g}),t[11]=g,t[12]=_);let v;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(b,{className:`h-3 w-3`}),t[13]=v):v=t[13];let y;t[14]!==p||t[15]!==h||t[16]!==_?(y=(0,Z.jsxs)(d,{variant:`action`,size:`icon-sm`,className:`gap-1 w-auto px-2`,onClick:p,children:[h,_,v]}),t[14]=p,t[15]=h,t[16]=_,t[17]=y):y=t[17];let x;t[18]!==n||t[19]!==f||t[20]!==r?.id||t[21]!==a?(x=a&&(0,Z.jsx)(`div`,{className:`absolute bottom-full left-0 mb-1 w-80 max-h-80 overflow-y-auto rounded-lg border border-border bg-popover p-1 shadow-md z-50`,children:Object.entries(n.reduce(Ie,{})).map(e=>{let[t,n]=e;return(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:[(0,Z.jsx)(Ne,{provider:t}),t]}),n.map(e=>(0,Z.jsx)(`button`,{type:`button`,className:`flex w-full items-center whitespace-nowrap rounded-md px-3 py-1.5 pl-8 text-sm text-popover-foreground hover:bg-accent ${e.id===r?.id?`bg-accent font-medium`:``}`,onClick:()=>f(e),children:ue(e.id)},e.id))]},t)})}),t[18]=n,t[19]=f,t[20]=r?.id,t[21]=a,t[22]=x):x=t[22];let S;return t[23]!==y||t[24]!==x?(S=(0,Z.jsxs)(`div`,{className:`relative`,ref:s,children:[y,x]}),t[23]=y,t[24]=x,t[25]=S):S=t[25],S}function Ie(e,t){let n=t.provider??`Other`;return e[n]||(e[n]=[]),e[n].push(t),e}var Le=[{value:`build`,label:`Build`,icon:m},{value:`plan`,label:`Plan`,icon:S},{value:`image`,label:`Image`,icon:C}];function Re(e,t){return e?`plan`:t?`image`:`build`}function ze(e){let t=(0,Y.c)(29),{planMode:r,imageMode:i,setPlanMode:a,setImageMode:o}=e,[s,c]=X.useState(!1),l=X.useRef(null),u;t[0]!==i||t[1]!==r?(u=Re(r,i),t[0]=i,t[1]=r,t[2]=u):u=t[2];let f=u,p;t[3]===f?p=t[4]:(p=Le.find(e=>e.value===f),t[3]=f,t[4]=p);let m=p,h=m.icon,g,_;t[5]===s?(g=t[6],_=t[7]):(g=()=>{let e=function(e){l.current&&!l.current.contains(e.target)&&c(!1)};if(s)return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},_=[s],t[5]=s,t[6]=g,t[7]=_),X.useEffect(g,_);let v;t[8]!==o||t[9]!==a?(v=function(e){a(e===`plan`),o(e===`image`),c(!1)},t[8]=o,t[9]=a,t[10]=v):v=t[10];let y=v,x;t[11]===s?x=t[12]:(x=()=>c(!s),t[11]=s,t[12]=x);let S;t[13]===h?S=t[14]:(S=(0,Z.jsx)(h,{className:`h-3.5 w-3.5`}),t[13]=h,t[14]=S);let C;t[15]===m.label?C=t[16]:(C=(0,Z.jsx)(`span`,{className:`text-xs font-medium`,children:m.label}),t[15]=m.label,t[16]=C);let w;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(b,{className:`h-3 w-3`}),t[17]=w):w=t[17];let T;t[18]!==x||t[19]!==S||t[20]!==C?(T=(0,Z.jsxs)(d,{variant:`action`,size:`icon-sm`,className:`gap-1 w-auto px-2`,onClick:x,children:[S,C,w]}),t[18]=x,t[19]=S,t[20]=C,t[21]=T):T=t[21];let E;t[22]!==f||t[23]!==s||t[24]!==y?(E=s&&(0,Z.jsx)(`div`,{className:`absolute bottom-full right-0 mb-1 w-40 rounded-lg border border-border bg-popover p-1 shadow-md z-50`,children:Le.map(e=>{let t=e.icon,r=e.value===f;return(0,Z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-3 py-2 text-sm text-popover-foreground hover:bg-accent`,onClick:()=>y(e.value),children:[(0,Z.jsx)(t,{className:`h-3.5 w-3.5`}),e.label,r&&(0,Z.jsx)(n,{className:`ml-auto h-3.5 w-3.5`})]},e.value)})}),t[22]=f,t[23]=s,t[24]=y,t[25]=E):E=t[25];let D;return t[26]!==T||t[27]!==E?(D=(0,Z.jsxs)(`div`,{className:`relative`,ref:l,children:[T,E]}),t[26]=T,t[27]=E,t[28]=D):D=t[28],D}function Be(e){let t=(0,Y.c)(17),{onFileAttach:n}=e,[r,i]=X.useState(!1),a=X.useRef(null),o,s;t[0]===r?(o=t[1],s=t[2]):(o=()=>{let e=e=>{a.current&&!a.current.contains(e.target)&&i(!1)};if(r)return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},s=[r],t[0]=r,t[1]=o,t[2]=s),X.useEffect(o,s);let c;t[3]===n?c=t[4]:(c=function(){n(),i(!1)},t[3]=n,t[4]=c);let l=c,u;t[5]===r?u=t[6]:(u=()=>i(!r),t[5]=r,t[6]=u);let f,m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(p,{}),m=(0,Z.jsx)(`span`,{className:`sr-only`,children:`More options`}),t[7]=f,t[8]=m):(f=t[7],m=t[8]);let h;t[9]===u?h=t[10]:(h=(0,Z.jsxs)(d,{variant:`action`,size:`icon-sm`,onClick:u,children:[f,m]}),t[9]=u,t[10]=h);let g;t[11]!==l||t[12]!==r?(g=r&&(0,Z.jsx)(`div`,{className:`absolute bottom-full left-0 mb-1 w-48 rounded-lg border border-border bg-popover p-1 shadow-md z-50`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-3 py-2 text-sm text-popover-foreground hover:bg-accent`,onClick:l,children:[(0,Z.jsx)(R,{className:`h-3.5 w-3.5`}),`Attach File`]})}),t[11]=l,t[12]=r,t[13]=g):g=t[13];let _;return t[14]!==h||t[15]!==g?(_=(0,Z.jsxs)(`div`,{className:`relative`,ref:a,children:[h,g]}),t[14]=h,t[15]=g,t[16]=_):_=t[16],_}function Ve(e){let t=(0,Y.c)(14),{onToggleSpeech:n}=e,{isListening:r,isSupported:i}=ye();if(!i)return null;let a=r?`bg-red-500/20 text-red-500 hover:bg-red-500/30`:`text-muted-foreground hover:text-background`,o;t[0]===r?o=t[1]:(o=r?(0,Z.jsx)(D,{}):(0,Z.jsx)(ne,{}),t[0]=r,t[1]=o);let s=r?`Stop listening`:`Start listening`,c;t[2]===s?c=t[3]:(c=(0,Z.jsx)(`span`,{className:`sr-only`,children:s}),t[2]=s,t[3]=c);let l;t[4]!==n||t[5]!==a||t[6]!==o||t[7]!==c?(l=(0,Z.jsx)(K,{asChild:!0,children:(0,Z.jsxs)(d,{variant:`ghost`,size:`icon-sm`,className:a,onClick:n,children:[o,c]})}),t[4]=n,t[5]=a,t[6]=o,t[7]=c,t[8]=l):l=t[8];let u=r?`Stop listening`:`Start listening`,f;t[9]===u?f=t[10]:(f=(0,Z.jsx)(W,{side:`top`,className:`bg-popover text-popover-foreground`,children:u}),t[9]=u,t[10]=f);let p;return t[11]!==l||t[12]!==f?(p=(0,Z.jsxs)(G,{children:[l,f]}),t[11]=l,t[12]=f,t[13]=p):p=t[13],p}function He(e){let t=(0,Y.c)(8),{queuedMessages:n,onRemoveQueuedMessage:r}=e;if(n.length===0)return null;let i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:`Queued messages`}),t[0]=i):i=t[0];let a;if(t[1]!==r||t[2]!==n){let e;t[4]===r?e=t[5]:(e=e=>(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3 rounded-md border border-border/60 bg-background px-3 py-2 text-sm`,children:[(0,Z.jsx)(`p`,{className:`flex-1 whitespace-pre-wrap text-foreground`,children:e.message}),(0,Z.jsx)(`button`,{type:`button`,className:`rounded-full p-1 text-muted-foreground transition-colors hover:bg-foreground hover:text-background`,onClick:()=>r(e.id),"aria-label":`Remove queued message`,children:(0,Z.jsx)(A,{className:`h-3.5 w-3.5`})})]},e.id),t[4]=r,t[5]=e),a=n.map(e),t[1]=r,t[2]=n,t[3]=a}else a=t[3];let o;return t[6]===a?o=t[7]:(o=(0,Z.jsxs)(`div`,{className:`mb-3 rounded-lg border border-border/60 bg-muted/30 px-4 py-3`,children:[i,(0,Z.jsx)(`div`,{className:`mt-2 flex flex-col gap-2`,children:a})]}),t[6]=a,t[7]=o),o}function Ue(e){let t=(0,Y.c)(144),{onSend:n,onStop:r,isStreaming:i,disabled:a,initialValue:o,queuedMessages:s,onRemoveQueuedMessage:c,isOverlay:u}=e,f=i===void 0?!1:i,p=u===void 0?!1:u,{isListening:m,transcript:h,startListening:g,stopListening:v,resetTranscript:y}=ye(),b;t[0]===o?b=t[1]:(b={initialValue:o},t[0]=o,t[1]=b);let{message:x,setMessage:S,historyIndex:C,setHistoryIndex:w,draftMessage:T,setDraftMessage:E,cursorPosition:D,setCursorPosition:O,availableModels:k,selectedModel:A,setSelectedModel:ee,attachments:j,setAttachments:M,planMode:N,setPlanMode:P,imageMode:F,setImageMode:L,availableImageModels:R,selectedImageModel:te,setSelectedImageModel:ne,allFiles:z,setAllFiles:re,showSuggestions:B,setShowSuggestions:ie,suggestionQuery:V,setSuggestionQuery:ae,selectedIndex:H,setSelectedIndex:U,slashCommands:W,skills:G,showCommandSuggestions:K,setShowCommandSuggestions:q,commandQuery:J,setCommandQuery:oe,fileInputRef:se,textareaRef:ce,suggestionsRef:le,commandSuggestionsRef:ue,handleNewChat:Q,state:de,dispatch:fe}=be(b),$=F?te:A,pe=F?R:k,me=de.selectedThreadId??void 0,he;t[2]!==z||t[3]!==j||t[4]!==J||t[5]!==D||t[6]!==fe||t[7]!==T||t[8]!==C||t[9]!==F||t[10]!==m||t[11]!==f||t[12]!==x||t[13]!==n||t[14]!==N||t[15]!==y||t[16]!==te||t[17]!==H||t[18]!==A||t[19]!==re||t[20]!==M||t[21]!==oe||t[22]!==O||t[23]!==E||t[24]!==w||t[25]!==S||t[26]!==P||t[27]!==U||t[28]!==q||t[29]!==ie||t[30]!==ae||t[31]!==K||t[32]!==B||t[33]!==G||t[34]!==W||t[35]!==v||t[36]!==V||t[37]!==me||t[38]!==ce?(he={message:x,setMessage:S,attachments:j,selectedModel:A,onSend:n,isStreaming:f,selectedThreadId:me,isListening:m,stopListening:v,resetTranscript:y,dispatch:fe,historyIndex:C,setHistoryIndex:w,draftMessage:T,setDraftMessage:E,cursorPosition:D,setCursorPosition:O,showSuggestions:B,setShowSuggestions:ie,suggestionQuery:V,setSuggestionQuery:ae,allFiles:z,setAllFiles:re,selectedIndex:H,setSelectedIndex:U,showCommandSuggestions:K,setShowCommandSuggestions:q,commandQuery:J,setCommandQuery:oe,slashCommands:W,skills:G,textareaRef:ce,setAttachments:M,planMode:N,setPlanMode:P,imageMode:F,selectedImageModel:te},t[2]=z,t[3]=j,t[4]=J,t[5]=D,t[6]=fe,t[7]=T,t[8]=C,t[9]=F,t[10]=m,t[11]=f,t[12]=x,t[13]=n,t[14]=N,t[15]=y,t[16]=te,t[17]=H,t[18]=A,t[19]=re,t[20]=M,t[21]=oe,t[22]=O,t[23]=E,t[24]=w,t[25]=S,t[26]=P,t[27]=U,t[28]=q,t[29]=ie,t[30]=ae,t[31]=K,t[32]=B,t[33]=G,t[34]=W,t[35]=v,t[36]=V,t[37]=me,t[38]=ce,t[39]=he):he=t[39];let{handleSend:ge,handleKeyDown:_e,handleTextareaInput:ve,insertFileReference:xe,insertCommand:Ce,insertSkill:we,fileSuggestions:Te}=Se(he),De=X.useRef(``),Oe,ke;t[40]!==S||t[41]!==h?(Oe=()=>{if(h&&h!==De.current){let e=h.substring(De.current.length);S(t=>(t.endsWith(` `),t+e)),De.current=h}},ke=[h,S],t[40]=S,t[41]=h,t[42]=Oe,t[43]=ke):(Oe=t[42],ke=t[43]),X.useEffect(Oe,ke);let Ne;t[44]===M?Ne=t[45]:(Ne=e=>{let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(Ge);if(n.length!==0){e.preventDefault();for(let e of n){let t=e.getAsFile();if(!t)continue;let n=new FileReader;n.onload=()=>{let e=n.result.split(`,`)[1];M(n=>[...n,{fileName:t.name||`pasted-image.${t.type.split(`/`)[1]||`png`}`,content:e,mimeType:t.type}])},n.readAsDataURL(t)}}},t[44]=M,t[45]=Ne);let Pe=Ne,Ie;t[46]!==m||t[47]!==y||t[48]!==g||t[49]!==v?(Ie=()=>{m?(v(),y()):(y(),g())},t[46]=m,t[47]=y,t[48]=g,t[49]=v,t[50]=Ie):Ie=t[50];let Le=Ie,Re=p?`absolute inset-x-0 bottom-0 mx-auto w-full max-w-3xl px-4 pb-4 pointer-events-none`:`relative mx-auto w-full max-w-3xl px-4 pb-4`,Ue=`flex flex-col rounded-2xl border focus-within:ring-2 focus-within:ring-brand pointer-events-auto ${p?`border-border/50 bg-background/80 shadow-lg backdrop-blur-sm`:`border-border bg-background shadow-2xl`}`,Ke;t[51]!==c||t[52]!==s?(Ke=(0,Z.jsx)(He,{queuedMessages:s,onRemoveQueuedMessage:c}),t[51]=c,t[52]=s,t[53]=Ke):Ke=t[53];let qe=N?`Describe what you want Tarsk to plan...`:F?`Describe the image you want to generate...`:`Ask Tarsk anything, # for files, / for commands & skills`,Je;t[54]!==a||t[55]!==_e||t[56]!==Pe||t[57]!==ve||t[58]!==x||t[59]!==qe||t[60]!==ce?(Je=(0,Z.jsx)(`textarea`,{ref:ce,value:x,onChange:ve,onKeyDown:_e,onPaste:Pe,placeholder:qe,rows:1,className:`w-full resize-none bg-transparent px-6 pt-4 pb-4 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none`,disabled:a}),t[54]=a,t[55]=_e,t[56]=Pe,t[57]=ve,t[58]=x,t[59]=qe,t[60]=ce,t[61]=Je):Je=t[61];let Ye;t[62]!==J||t[63]!==ue||t[64]!==Ce||t[65]!==we||t[66]!==H||t[67]!==U||t[68]!==K||t[69]!==G||t[70]!==W?(Ye=(0,Z.jsx)(Ee,{visible:K,commands:W,skills:G,query:J,selectedIndex:H,onSelectCommand:Ce,onSelectSkill:we,onMouseEnterSuggestion:U,containerRef:ue}),t[62]=J,t[63]=ue,t[64]=Ce,t[65]=we,t[66]=H,t[67]=U,t[68]=K,t[69]=G,t[70]=W,t[71]=Ye):Ye=t[71];let Xe;t[72]!==Te||t[73]!==xe||t[74]!==H||t[75]!==U||t[76]!==B||t[77]!==V||t[78]!==le?(Xe=(0,Z.jsx)(Me,{showSuggestions:B,fileSuggestions:Te,suggestionQuery:V,selectedIndex:H,onSelectFile:xe,onMouseEnterSuggestion:U,containerRef:le}),t[72]=Te,t[73]=xe,t[74]=H,t[75]=U,t[76]=B,t[77]=V,t[78]=le,t[79]=Xe):Xe=t[79];let Ze;t[80]!==j||t[81]!==A?.id||t[82]!==A?.name||t[83]!==A?.supportsImages||t[84]!==M?(Ze=j.length>0&&(0,Z.jsxs)(`div`,{className:`px-4`,children:[(0,Z.jsx)(Ae,{attachments:j,onRemove:e=>M(t=>t.filter((t,n)=>n!==e))}),j.some(We)&&A?.supportsImages===!1&&(0,Z.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 text-xs text-amber-500`,children:[(0,Z.jsx)(l,{className:`h-3 w-3 shrink-0`}),(0,Z.jsxs)(`span`,{children:[`Images are not supported by `,A?.name||A?.id]})]})]}),t[80]=j,t[81]=A?.id,t[82]=A?.name,t[83]=A?.supportsImages,t[84]=M,t[85]=Ze):Ze=t[85];let Qe;t[86]===se?Qe=t[87]:(Qe=(0,Z.jsx)(Be,{onFileAttach:()=>se.current?.click()}),t[86]=se,t[87]=Qe);let $e;t[88]===Le?$e=t[89]:($e=(0,Z.jsx)(Ve,{onToggleSpeech:Le}),t[88]=Le,t[89]=$e);let et;t[90]===Q?et=t[91]:(et=(0,Z.jsx)(d,{variant:`action`,size:`sm`,className:`h-7 text-xs`,onClick:Q,children:`New Chat`}),t[90]=Q,t[91]=et);let tt=F?ne:ee,nt;t[92]!==pe||t[93]!==$||t[94]!==tt?(nt=(0,Z.jsx)(Fe,{availableModels:pe,selectedModel:$,onModelSelect:tt}),t[92]=pe,t[93]=$,t[94]=tt,t[95]=nt):nt=t[95];let rt;t[96]!==Qe||t[97]!==$e||t[98]!==et||t[99]!==nt?(rt=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[Qe,$e,et,nt]}),t[96]=Qe,t[97]=$e,t[98]=et,t[99]=nt,t[100]=rt):rt=t[100];let it;t[101]!==F||t[102]!==N||t[103]!==L||t[104]!==P?(it=(0,Z.jsx)(ze,{planMode:N,imageMode:F,setPlanMode:P,setImageMode:L}),t[101]=F,t[102]=N,t[103]=L,t[104]=P,t[105]=it):it=t[105];let at=f?r:ge,ot;t[106]!==j.length||t[107]!==a||t[108]!==$||t[109]!==f||t[110]!==x?(ot=!f&&((a??!1)||!x.trim()&&j.length===0||!$),t[106]=j.length,t[107]=a,t[108]=$,t[109]=f,t[110]=x,t[111]=ot):ot=t[111];let st;t[112]===f?st=t[113]:(st=f?(0,Z.jsx)(_,{className:`h-3 w-3 fill-current`}):(0,Z.jsx)(I,{className:`h-3 w-3`}),t[112]=f,t[113]=st);let ct=f?`Stop generation`:`Send message`,lt;t[114]===ct?lt=t[115]:(lt=(0,Z.jsx)(`span`,{className:`sr-only`,children:ct}),t[114]=ct,t[115]=lt);let ut;t[116]!==at||t[117]!==ot||t[118]!==st||t[119]!==lt?(ut=(0,Z.jsxs)(d,{size:`icon`,className:`h-7 w-7 rounded-full`,onClick:at,disabled:ot,children:[st,lt]}),t[116]=at,t[117]=ot,t[118]=st,t[119]=lt,t[120]=ut):ut=t[120];let dt;t[121]!==it||t[122]!==ut?(dt=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[it,ut]}),t[121]=it,t[122]=ut,t[123]=dt):dt=t[123];let ft;t[124]!==rt||t[125]!==dt?(ft=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between px-3 pb-2`,children:[rt,dt]}),t[124]=rt,t[125]=dt,t[126]=ft):ft=t[126];let pt;t[127]!==Ue||t[128]!==Ke||t[129]!==Je||t[130]!==Ye||t[131]!==Xe||t[132]!==Ze||t[133]!==ft?(pt=(0,Z.jsxs)(`div`,{className:Ue,children:[Ke,Je,Ye,Xe,Ze,ft]}),t[127]=Ue,t[128]=Ke,t[129]=Je,t[130]=Ye,t[131]=Xe,t[132]=Ze,t[133]=ft,t[134]=pt):pt=t[134];let mt;t[135]===M?mt=t[136]:(mt=e=>je(e,e=>M(t=>[...t,...e])),t[135]=M,t[136]=mt);let ht;t[137]!==se||t[138]!==mt?(ht=(0,Z.jsx)(`input`,{ref:se,type:`file`,multiple:!0,className:`hidden`,onChange:mt}),t[137]=se,t[138]=mt,t[139]=ht):ht=t[139];let gt;return t[140]!==Re||t[141]!==pt||t[142]!==ht?(gt=(0,Z.jsxs)(`div`,{className:Re,children:[pt,ht]}),t[140]=Re,t[141]=pt,t[142]=ht,t[143]=gt):gt=t[143],gt}function We(e){return e.mimeType.startsWith(`image/`)}function Ge(e){return e.type.startsWith(`image/`)}function Ke({threadId:e}){let[t,n]=(0,X.useState)(!1),[r,i]=(0,X.useState)(null);return(0,X.useEffect)(()=>{e&&N(e).then(i).catch(()=>{})},[e]),(0,Z.jsx)(`div`,{className:`flex items-center justify-end gap-2 px-8 py-2 mt-[-1rem] min-h-[2.25rem]`,children:e&&(0,Z.jsxs)(G,{children:[(0,Z.jsx)(K,{asChild:!0,children:(0,Z.jsx)(d,{variant:`ghost`,size:`icon`,className:`h-6 w-6 opacity-50 hover:opacity-80`,onClick:async()=>{if(!(!e||t)){n(!0);try{let t=await N(e);await navigator.clipboard.writeText(t)}finally{n(!1)}}},disabled:t,"aria-label":`Copy repository folder path`,children:(0,Z.jsx)(k,{className:`h-3 w-3`})})}),(0,Z.jsxs)(W,{side:`top`,className:`bg-slate-900 text-white`,children:[(0,Z.jsx)(`div`,{children:`Copy repository folder path`}),r&&(0,Z.jsx)(`div`,{className:`opacity-70 text-xs`,children:r})]})]})})}function qe(e,t){if(!(!t||!e.includes(`"run_js"`)))try{let n=JSON.parse(e.trim());if(!Array.isArray(n))return;for(let e of n)e?.type===`tool_use`&&e?.name===`run_js`&&e?.id&&e?.input?.code&&_e(e.id,e.input.code,t)}catch{}}function Je(){let{state:e,dispatch:t}=ie(),[n,r]=(0,X.useState)(null),[a,o]=(0,X.useState)(!1),s=(0,X.useRef)(``),c=(0,X.useRef)(``),l=(0,X.useRef)([]),u=(0,X.useRef)(!1),d=(0,X.useRef)(null),f=(0,X.useRef)(null),p=(0,X.useRef)(()=>{}),[m,h]=(0,X.useState)(null),g=(0,X.useRef)(!1),_=(0,X.useRef)(!1),v=(0,X.useRef)(null),b=(0,X.useRef)(null),S=(0,X.useRef)(null),{selectedThreadId:C,selectedProjectId:E,messages:D,queuedChatMessages:O,isStreaming:k,streamingModel:A,processingThreadIds:ee}=e,j=!!(C&&ee.includes(C)),M=(0,X.useCallback)(n=>{if(d.current=null,f.current=null,g.current){g.current=!1;return}let r=l.current,i=ae(r)||`...`;if(v.current&&(r.length===0||i===`...`)){let r={messageId:`msg-${Date.now()}-error`,sender:`agent`,content:`Error: ${v.current}`,contentType:`text`,timestamp:new Date().toISOString(),model:e.streamingModel||n,isThinking:!1};t({type:H.AddMessage,message:r}),t({type:H.ResetStream}),C&&t({type:H.RemoveProcessingThread,threadId:C}),v.current=null;return}let a={messageId:`msg-${Date.now()}-agent`,sender:`agent`,content:i,contentType:`markdown`,timestamp:new Date().toISOString(),model:e.streamingModel||n,isThinking:!1};s.current=``,c.current=``,l.current=[],v.current=null,t({type:H.AddMessage,message:a}),t({type:H.ResetStream}),C&&(t({type:H.MarkThreadCompleted,threadId:C}),t({type:H.RemoveProcessingThread,threadId:C}))},[e.streamingModel,t,C]);(0,X.useEffect)(()=>{p.current=M},[M]);let N=(0,X.useCallback)(()=>{C&&h(C),g.current=!0,C&&T(C),d.current&&=(d.current.abort(),null),f.current&&=(f.current(),null),s.current=``,c.current=``,l.current=[],v.current=null;let n={messageId:`msg-${Date.now()}-stopped`,sender:`agent`,content:`I've stopped working on your request.`,contentType:`text`,timestamp:new Date().toISOString(),model:e.streamingModel||`default`,isThinking:!1};t({type:H.AddMessage,message:n}),t({type:H.ResetStream}),C&&(t({type:H.MarkThreadCompleted,threadId:C}),t({type:H.RemoveProcessingThread,threadId:C}))},[C,t,e.streamingModel]);(0,X.useEffect)(()=>{_.current&&!k&&d.current&&(d.current.abort(),d.current=null,f.current&&=(f.current(),null),p.current(A||`default`)),_.current=k},[k,A]),(0,X.useEffect)(()=>{if(b.current&&=(clearTimeout(b.current),null),k){let e=12e4,t=n=>{b.current&&=(clearTimeout(b.current),null),b.current=setTimeout(()=>{let n=Date.now(),r=S?.current??null;if(r!=null){let i=n-r;if(i<e){t(e-i);return}}console.warn(`[stream-safety] Streaming stuck for 2 minutes with no activity, auto-finalizing`),d.current&&=(d.current.abort(),null),f.current&&=(f.current(),null),p.current(A||`default`)},n)},n=e;if(S?.current!=null){let t=Date.now()-S.current;n=t>=e?0:e-t}t(n)}return()=>{b.current&&=(clearTimeout(b.current),null)}},[k,A]),(0,X.useEffect)(()=>()=>{d.current&&=(d.current.abort(),null),f.current&&=(f.current(),null),s.current=``,c.current=``,l.current=[],u.current=!1,v.current=null,t({type:H.ResetStream})},[C,t]),(0,X.useEffect)(()=>{if(!C)return;let e=!1;async function n(){try{let n=await te(C);e||t({type:H.SetMessages,messages:n.messages})}catch(n){console.error(`Failed to load chat history:`,n),e||t({type:H.SetMessages,messages:[]})}}return n(),()=>{e=!0}},[C,E,t]),(0,X.useEffect)(()=>{if(!C||!j||k)return;let e=new AbortController;return d.current=e,t({type:H.ResetStream}),t({type:H.SetStreaming,isStreaming:!0}),s.current=``,c.current=``,l.current=[],u.current=!1,v.current=null,F(C,e.signal).then(n=>{if(!n||e.signal.aborted){p.current(`default`);return}f.current=x(n,e=>{if(e.type===`error`){let t=e.content||`Unknown error occurred`;v.current=t,r(t);return}if(e.type!==`message`){if(e.type===`toolcall_delta`){e.partial?.content?.[0]?.id&&e.delta&&t({type:H.UpdateToolCallProgress,toolCallId:e.partial.content[0].id,progress:{toolCallId:e.partial.content[0].id,toolName:e.partial.content[0].name,delta:e.delta,partial:e.partial}});return}if(e.model&&t({type:H.SetStreamModel,model:e.model}),e.type===`thinking`||e.isThinking){let n=e.content??``;qe(n,C),c.current+=n;let r=V(l.current,`thinking`,n);l.current=r,t({type:H.AppendStreamChunk,chunkType:`thinking`,content:n,segments:r})}else if(e.type===`result`)u.current=!0,s.current=e.content??``,l.current=U(l.current,e.content??``),t({type:H.SetStreamContent,content:e.content??``});else{if(u.current)return;s.current+=e.content??``;let n=V(l.current,`content`,e.content??``);l.current=n,t({type:H.AppendStreamChunk,chunkType:`content`,content:e.content??``,segments:n})}}},()=>{p.current(`default`)},e=>{if(e.includes(`AbortError`)||e.includes(`canceled`)||e.includes(`BodyStreamBuffer was aborted`)){p.current(`default`);return}v.current=e,r(e)},e=>{if(e.role===`assistant`){let n=e.content??``,r=typeof n==`string`?n:JSON.stringify(n);if(e.isThinking??!1){c.current+=r;let e=V(l.current,`thinking`,r);l.current=e,t({type:H.AppendStreamChunk,chunkType:`thinking`,content:r,segments:e});return}let i=!1;if(typeof n==`object`&&Array.isArray(n)&&n.length>0)i=!0;else if(typeof r==`string`&&r.trim().startsWith(`[`))try{let e=JSON.parse(r);i=Array.isArray(e)&&e.length>0}catch{}if(i)u.current=!0,s.current=r,l.current=U(l.current,r),t({type:H.SetStreamContent,content:r});else{s.current+=r;let e=V(l.current,`content`,r);l.current=e,t({type:H.AppendStreamChunk,chunkType:`content`,content:r,segments:e})}}else if(e.role===`tool`){let n=e.content??``,r=typeof n==`string`?n:JSON.stringify(n);if(r){s.current+=r;let e=V(l.current,`content`,r);l.current=e,t({type:H.AppendStreamChunk,chunkType:`content`,content:r,segments:e})}}})}).catch(e=>{if(e instanceof Error&&e.name===`AbortError`){t({type:H.ResetStream});return}if(e instanceof Error&&e.message.includes(`not currently processing`)){t({type:H.ResetStream});return}console.error(`Failed to subscribe to chat stream:`,e),t({type:H.ResetStream})}),()=>{e.abort(),f.current&&=(f.current(),null)}},[C,j]);let I=(0,X.useCallback)(async(n,a,m,g,_,b)=>{if(!C)return;r(null),h(null),d.current&&d.current.abort(),f.current&&f.current();let S=`msg-${Date.now()}`,T;try{let e=await i(C,S);e.success&&e.stashed&&e.checkpointRef&&(T=e.checkpointRef)}catch{}let D={messageId:S,sender:`user`,content:n,contentType:`text`,timestamp:new Date().toISOString(),model:a,attachments:m.map(e=>({fileName:e.fileName,content:e.content,mimeType:e.mimeType})),checkpointRef:T};t({type:H.AddMessage,message:D});let O=n.trim().replace(/\n/g,` `).slice(0,100);if(E&&C&&(w(C,{title:O}).catch(e=>{console.error(`Failed to update thread title:`,e)}),t({type:H.UpdateThreadTitle,projectId:E,threadId:C,title:O})),b){let e=g??void 0;if(!e&&typeof a==`string`){let t=a.split(/[:/]/)[0]?.trim();t&&(e=t)}if(!e){let e={messageId:`msg-${Date.now()}-error`,sender:`agent`,content:`Image generation is not available because no provider is configured for the selected model.`,contentType:`text`,timestamp:new Date().toISOString(),model:a,isThinking:!1};t({type:H.AddMessage,message:e}),t({type:H.ResetStream});return}t({type:H.SetStreaming,isStreaming:!0});try{let r=await y(n,a,e,C),i={messageId:`msg-${Date.now()}-agent`,sender:`agent`,content:n,contentType:`text`,timestamp:new Date().toISOString(),model:a,isThinking:!1,generatedImageUrl:r.imageUrl,generatedImageData:r.imageData};t({type:H.AddMessage,message:i})}catch(e){let n=e instanceof Error?e.message:`Image generation failed`,r={messageId:`msg-${Date.now()}-error`,sender:`agent`,content:`Error: ${n}`,contentType:`text`,timestamp:new Date().toISOString(),model:a,isThinking:!1};t({type:H.AddMessage,message:r})}finally{t({type:H.ResetStream})}return}t({type:H.ResetStream}),t({type:H.SetStreaming,isStreaming:!0}),s.current=``,u.current=!1;let k=new AbortController;d.current=k;try{let i=await P(C,n,a,m,k.signal,g,_);if(!i){p.current(a);return}f.current=x(i,n=>{if(n.type===`error`){let e=n.content||`Unknown error occurred`;v.current=e,r(e);return}if(n.type!==`message`){if(n.type===`toolcall_delta`){if(n.partial?.content?.[0]?.id&&n.delta){let e=n.partial.content[0].id,r=n.partial.content[0].name;t({type:H.UpdateToolCallProgress,toolCallId:e,progress:{toolCallId:e,toolName:r,delta:n.delta,partial:n.partial}})}return}if(n.model&&t({type:H.SetStreamModel,model:n.model}),n.type===`thinking`||n.isThinking){let r=n.content??``;qe(r,e.selectedThreadId),c.current+=r;let i=V(l.current,`thinking`,r);l.current=i,t({type:H.AppendStreamChunk,chunkType:`thinking`,content:r,segments:i})}else if(n.type===`result`)u.current=!0,s.current=n.content??``,l.current=U(l.current,n.content??``),t({type:H.SetStreamContent,content:n.content??``});else{if(u.current)return;s.current+=n.content??``;let e=V(l.current,`content`,n.content??``);l.current=e,t({type:H.AppendStreamChunk,chunkType:`content`,content:n.content??``,segments:e})}}},()=>{p.current(a)},e=>{if(e.includes(`AbortError`)||e.includes(`canceled`)||e.includes(`BodyStreamBuffer was aborted`)){p.current(a);return}v.current=e,r(e)},e=>{if(e.role===`assistant`){let n=e.content??``,r=typeof n==`string`?n:JSON.stringify(n);if(e.isThinking??!1){c.current+=r;let e=V(l.current,`thinking`,r);l.current=e,t({type:H.AppendStreamChunk,chunkType:`thinking`,content:r,segments:e});return}let i=!1;if(typeof n==`object`&&Array.isArray(n)&&n.length>0)i=!0;else if(typeof r==`string`&&r.trim().startsWith(`[`))try{let e=JSON.parse(r);i=Array.isArray(e)&&e.length>0}catch{}if(i)u.current=!0,s.current=r,l.current=U(l.current,r),t({type:H.SetStreamContent,content:r});else{s.current+=r;let e=V(l.current,`content`,r);l.current=e,t({type:H.AppendStreamChunk,chunkType:`content`,content:r,segments:e})}}else if(e.role===`tool`){let n=e.content??``,r=typeof n==`string`?n:JSON.stringify(n);if(r){s.current+=r;let e=V(l.current,`content`,r);l.current=e,t({type:H.AppendStreamChunk,chunkType:`content`,content:r,segments:e})}}})}catch(e){if(e instanceof Error&&e.name===`AbortError`||e instanceof Error&&e.message.includes(`BodyStreamBuffer was aborted`))return;if(e instanceof re){t({type:H.ResetStream}),o(!0);return}r(e instanceof Error?e.message:`Failed to send message. Please ensure the CLI server is running on localhost:641`),v.current=e instanceof Error?e.message:`Failed to send message. Please ensure the CLI server is running on localhost:641`,t({type:H.ResetStream})}},[C,E,t]);(0,X.useEffect)(()=>{let n=e.pendingChatMessage;if(!n||k||n.threadId!==C)return;let r=setTimeout(()=>{t({type:H.ClearPendingChatMessage}),I(n.message,n.model,[],n.provider)},100);return()=>clearTimeout(r)},[e.pendingChatMessage,k,C,t,I]);let L=(0,X.useMemo)(()=>C?O.filter(e=>e.threadId===C):[],[C,O]),R=(0,X.useRef)(!1);return(0,X.useEffect)(()=>{if(k||!C||L.length===0||R.current)return;let[e]=L;R.current=!0,t({type:H.RemoveQueuedChatMessage,queuedMessageId:e.id});let n=setTimeout(()=>{I(e.message,e.model,e.attachments,e.provider,e.planMode),R.current=!1},0);return()=>{clearTimeout(n),R.current=!1}},[t,I,k,L,C]),{error:n,setError:r,handleSend:I,handleStop:N,isStreaming:k,selectedThreadId:C,queuedMessagesForThread:L,handleRemoveQueuedMessage:(0,X.useCallback)(e=>{let n=L.find(t=>t.id===e);t({type:H.RemoveQueuedChatMessage,queuedMessageId:e}),!(!n||k||D.length>0||!C)&&I(n.message,n.model,n.attachments,n.provider,n.planMode)},[t,I,k,D.length,L,C]),showEmptyBalanceDialog:a,setShowEmptyBalanceDialog:o}}function Ye(e){let t=(0,Y.c)(10),{open:n,onClose:r}=e,i=B(),a;t[0]===r?a=t[1]:(a=e=>{e||r()},t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsxs)(ce,{children:[(0,Z.jsx)(J,{children:`Balance empty`}),(0,Z.jsx)(q,{children:`You have no prompts remaining. Purchase additional prompts to continue.`})]}),t[2]=o):o=t[2];let s;t[3]!==i||t[4]!==r?(s=(0,Z.jsxs)(oe,{children:[o,(0,Z.jsx)(se,{children:(0,Z.jsx)(d,{onClick:()=>{r(),i(`/settings/account`)},children:`Go to Account`})})]}),t[3]=i,t[4]=r,t[5]=s):s=t[5];let c;return t[6]!==n||t[7]!==a||t[8]!==s?(c=(0,Z.jsx)(le,{open:n,onOpenChange:a,children:s}),t[6]=n,t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function Xe(){let e=(0,Y.c)(20),{state:t}=ie(),{isCreatingProject:n}=t,{handleSend:r,handleStop:i,isStreaming:a,selectedThreadId:o,queuedMessagesForThread:s,handleRemoveQueuedMessage:c,showEmptyBalanceDialog:l,setShowEmptyBalanceDialog:u}=Je(),d=t.pendingChatMessage?.threadId===o,f=a||d,p;e[0]===u?p=e[1]:(p=()=>u(!1),e[0]=u,e[1]=p);let m;e[2]!==l||e[3]!==p?(m=(0,Z.jsx)(Ye,{open:l,onClose:p}),e[2]=l,e[3]=p,e[4]=m):m=e[4];let h=!o&&!n,g;e[5]!==f||e[6]!==c||e[7]!==r||e[8]!==i||e[9]!==s||e[10]!==h?(g=(0,Z.jsx)(Ue,{onSend:r,onStop:i,isStreaming:f,disabled:h,initialValue:``,queuedMessages:s,onRemoveQueuedMessage:c,isOverlay:!1}),e[5]=f,e[6]=c,e[7]=r,e[8]=i,e[9]=s,e[10]=h,e[11]=g):g=e[11];let _=o??void 0,v;e[12]===_?v=e[13]:(v=(0,Z.jsx)(Ke,{threadId:_}),e[12]=_,e[13]=v);let y;e[14]!==g||e[15]!==v?(y=(0,Z.jsxs)(`div`,{className:`relative mx-auto min-w-[400px] w-[90vw] max-w-3xl`,children:[g,v]}),e[14]=g,e[15]=v,e[16]=y):y=e[16];let b;return e[17]!==m||e[18]!==y?(b=(0,Z.jsxs)(Z.Fragment,{children:[m,y]}),e[17]=m,e[18]=y,e[19]=b):b=e[19],b}export{de as a,me as i,_e as n,pe as r,Xe as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{$i as t,Cr as n,Gi as r,Wn as i,Xi as a,la as o,sa as s}from"./dialogs-config-DmDjliuA.js";import{a as c,d as l,h as u,i as d,l as f,m as p,n as m,o as h,p as g,s as _,t as v,u as y}from"./react-vendor-CaS5zjF7.js";var b=s(),x=e(o(),1),S=n(),C=y,w=u,T=x.forwardRef((e,t)=>{let n=(0,b.c)(14),r,o,s,c;n[0]===e?(r=n[1],o=n[2],s=n[3],c=n[4]):({className:o,inset:s,children:r,...c}=e,n[0]=e,n[1]=r,n[2]=o,n[3]=s,n[4]=c);let l=s&&`pl-8`,u;n[5]!==o||n[6]!==l?(u=i(`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground`,l,o),n[5]=o,n[6]=l,n[7]=u):u=n[7];let d;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,S.jsx)(a,{className:`ml-auto h-4 w-4`}),n[8]=d):d=n[8];let f;return n[9]!==r||n[10]!==c||n[11]!==t||n[12]!==u?(f=(0,S.jsxs)(p,{ref:t,className:u,...c,children:[r,d]}),n[9]=r,n[10]=c,n[11]=t,n[12]=u,n[13]=f):f=n[13],f});T.displayName=p.displayName;var E=x.forwardRef((e,t)=>{let n=(0,b.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,S.jsx)(g,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});E.displayName=g.displayName;var D=x.forwardRef((e,t)=>{let n=(0,b.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,S.jsx)(_,{children:(0,S.jsx)(m,{ref:t,className:o,...a})}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});D.displayName=m.displayName;var O=x.forwardRef((e,t)=>{let n=(0,b.c)(11),r,a,o;n[0]===e?(r=n[1],a=n[2],o=n[3]):({className:r,inset:a,...o}=e,n[0]=e,n[1]=r,n[2]=a,n[3]=o);let s=a&&`pl-8`,c;n[4]!==r||n[5]!==s?(c=i(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,s,r),n[4]=r,n[5]=s,n[6]=c):c=n[6];let l;return n[7]!==o||n[8]!==t||n[9]!==c?(l=(0,S.jsx)(d,{ref:t,className:c,...o}),n[7]=o,n[8]=t,n[9]=c,n[10]=l):l=n[10],l});O.displayName=d.displayName;var k=x.forwardRef((e,n)=>{let r=(0,b.c)(14),a,o,s,l;r[0]===e?(a=r[1],o=r[2],s=r[3],l=r[4]):({className:s,children:o,checked:a,...l}=e,r[0]=e,r[1]=a,r[2]=o,r[3]=s,r[4]=l);let u;r[5]===s?u=r[6]:(u=i(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,s),r[5]=s,r[6]=u);let d;r[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,S.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,S.jsx)(c,{children:(0,S.jsx)(t,{className:`h-4 w-4`})})}),r[7]=d):d=r[7];let f;return r[8]!==a||r[9]!==o||r[10]!==l||r[11]!==n||r[12]!==u?(f=(0,S.jsxs)(v,{ref:n,className:u,checked:a,...l,children:[d,o]}),r[8]=a,r[9]=o,r[10]=l,r[11]=n,r[12]=u,r[13]=f):f=r[13],f});k.displayName=v.displayName;var A=x.forwardRef((e,t)=>{let n=(0,b.c)(12),a,o,s;n[0]===e?(a=n[1],o=n[2],s=n[3]):({className:o,children:a,...s}=e,n[0]=e,n[1]=a,n[2]=o,n[3]=s);let l;n[4]===o?l=n[5]:(l=i(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,o),n[4]=o,n[5]=l);let u;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,S.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,S.jsx)(c,{children:(0,S.jsx)(r,{className:`h-2 w-2 fill-current`})})}),n[6]=u):u=n[6];let d;return n[7]!==a||n[8]!==s||n[9]!==t||n[10]!==l?(d=(0,S.jsxs)(f,{ref:t,className:l,...s,children:[u,a]}),n[7]=a,n[8]=s,n[9]=t,n[10]=l,n[11]=d):d=n[11],d});A.displayName=f.displayName;var j=x.forwardRef((e,t)=>{let n=(0,b.c)(11),r,a,o;n[0]===e?(r=n[1],a=n[2],o=n[3]):({className:r,inset:a,...o}=e,n[0]=e,n[1]=r,n[2]=a,n[3]=o);let s=a&&`pl-8`,c;n[4]!==r||n[5]!==s?(c=i(`px-2 py-1.5 text-sm font-semibold text-foreground`,s,r),n[4]=r,n[5]=s,n[6]=c):c=n[6];let l;return n[7]!==o||n[8]!==t||n[9]!==c?(l=(0,S.jsx)(h,{ref:t,className:c,...o}),n[7]=o,n[8]=t,n[9]=c,n[10]=l):l=n[10],l});j.displayName=h.displayName;var M=x.forwardRef((e,t)=>{let n=(0,b.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`-mx-1 my-1 h-px bg-border`,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,S.jsx)(l,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});M.displayName=l.displayName;var N=e=>{let t=(0,b.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let a;t[3]===n?a=t[4]:(a=i(`ml-auto text-xs tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=a);let o;return t[5]!==r||t[6]!==a?(o=(0,S.jsx)(`span`,{className:a,...r}),t[5]=r,t[6]=a,t[7]=o):o=t[7],o};N.displayName=`ContextMenuShortcut`;export{w as a,M as i,D as n,O as r,C as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./history-view-BOjZoBCb.js";export{e as ConversationHistoryView,e as default};
|