@agentstep/gateway 0.4.15 → 0.4.17
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/gateway.js +250 -260
- package/package.json +2 -2
package/dist/gateway.js
CHANGED
|
@@ -8413,7 +8413,7 @@ var init_zod = __esm({
|
|
|
8413
8413
|
}
|
|
8414
8414
|
});
|
|
8415
8415
|
|
|
8416
|
-
// ../agent-sdk/dist/chunk-
|
|
8416
|
+
// ../agent-sdk/dist/chunk-OXWELRJL.js
|
|
8417
8417
|
function listEnvelope(name, item) {
|
|
8418
8418
|
const schema2 = external_exports.object({
|
|
8419
8419
|
data: external_exports.array(item),
|
|
@@ -8422,8 +8422,8 @@ function listEnvelope(name, item) {
|
|
|
8422
8422
|
return registry.register(name, schema2);
|
|
8423
8423
|
}
|
|
8424
8424
|
var import_zod_to_openapi2, UlidId, IsoTimestamp, ErrorEnvelopeSchema, AgentToolsetTool, CustomTool, ToolConfigSchema, McpServerConfigSchema, AgentSkillSchema, ModelConfigSchema, AgentSchema, CreateAgentRequestSchema, UpdateAgentRequestSchema, EnvironmentPackages, EnvironmentNetworking, EnvironmentConfigSchema, EnvironmentSchema, CreateEnvironmentRequestSchema, UpdateEnvironmentRequestSchema, SessionStatsSchema, SessionUsageSchema, SessionStatusSchema, SessionSchema, CreateSessionRequestSchema, UpdateSessionRequestSchema, TextBlock, UserMessageEvent, UserInterruptEvent, UserCustomToolResultEvent, UserToolConfirmationEvent, UserDefineOutcomeEvent, UserEventSchema, UserEventBatchRequestSchema, ManagedEventSchema, VaultSchema, VaultEntrySchema, CreateVaultRequestSchema, SetVaultEntryRequestSchema, VaultDeletedResponseSchema, VaultEntryDeletedResponseSchema, BatchOperationSchema, BatchRequestSchema, BatchResultSchema, BatchResponseSchema, AgentListResponseSchema, EnvironmentListResponseSchema, SessionListResponseSchema, EventListResponseSchema, VaultListResponseSchema, VaultEntryListResponseSchema, AgentDeletedResponseSchema, SessionDeletedResponseSchema, EnvironmentDeletedResponseSchema, UserEventAppendResponseSchema, FileScopeSchema, FileRecordSchema, FileListResponseSchema, FileDeletedResponseSchema, VaultCredentialSchema, CreateCredentialRequestSchema, UpdateCredentialRequestSchema, CredentialListResponseSchema, CredentialDeletedResponseSchema, MemoryStoreSchema, CreateMemoryStoreRequestSchema, MemoryStoreListResponseSchema, MemoryStoreDeletedResponseSchema, MemorySchema, CreateMemoryRequestSchema, UpdateMemoryRequestSchema, MemoryListResponseSchema, MemoryDeletedResponseSchema, SessionResourceSchema, AddResourceRequestSchema, ResourceListResponseSchema, ResourceDeletedResponseSchema, KeyScopeSchema, KeyPermissionsSchema, ApiKeySchema, ApiKeyCreatedSchema, CreateApiKeyRequestSchema, PatchApiKeyRequestSchema, ApiKeyListResponseSchema, ApiKeyRevokedResponseSchema, ApiKeyActivityResponseSchema, UpstreamKeySchema, AddUpstreamKeyRequestSchema, PatchUpstreamKeyRequestSchema, UpstreamKeyListResponseSchema, UpstreamKeyDeletedResponseSchema, TenantSchema, CreateTenantRequestSchema, PatchTenantRequestSchema, TenantListResponseSchema, TenantArchivedResponseSchema, AuditEntrySchema, AuditListResponseSchema, TraceListItemSchema, TraceListResponseSchema, SpanNodeSchema, TraceDetailSchema, TraceExportResponseSchema, SkillsCatalogResponseSchema, SkillsSearchResponseSchema, SkillsStatsResponseSchema, SkillsSourcesResponseSchema, MetricsTotalsSchema, MetricsResponseSchema, ApiMetricsResponseSchema, PutSettingRequestSchema, SettingResponseSchema, ProviderStatusResponseSchema, ModelEntrySchema, ModelListResponseSchema, WhoamiResponseSchema, LicenseResponseSchema;
|
|
8425
|
-
var
|
|
8426
|
-
"../agent-sdk/dist/chunk-
|
|
8425
|
+
var init_chunk_OXWELRJL = __esm({
|
|
8426
|
+
"../agent-sdk/dist/chunk-OXWELRJL.js"() {
|
|
8427
8427
|
"use strict";
|
|
8428
8428
|
init_chunk_7346CKTF();
|
|
8429
8429
|
init_zod();
|
|
@@ -8983,26 +8983,30 @@ var init_chunk_OWTXN2FU = __esm({
|
|
|
8983
8983
|
VaultCredentialSchema = registry.register(
|
|
8984
8984
|
"VaultCredential",
|
|
8985
8985
|
external_exports.object({
|
|
8986
|
+
type: external_exports.literal("vault_credential"),
|
|
8986
8987
|
id: UlidId,
|
|
8987
8988
|
vault_id: UlidId,
|
|
8988
8989
|
display_name: external_exports.string(),
|
|
8989
8990
|
auth: external_exports.object({
|
|
8990
|
-
type: external_exports.
|
|
8991
|
-
mcp_server_url: external_exports.string().nullable().openapi({ description: "
|
|
8991
|
+
type: external_exports.enum(["static_bearer"]).openapi({ description: "Auth type. Currently only `static_bearer` is supported." }),
|
|
8992
|
+
mcp_server_url: external_exports.string().nullable().openapi({ description: "MCP server URL this credential authenticates with. Null for plain API keys." })
|
|
8992
8993
|
}),
|
|
8994
|
+
metadata: external_exports.record(external_exports.string()).optional().openapi({ description: "Arbitrary key-value metadata." }),
|
|
8993
8995
|
created_at: IsoTimestamp,
|
|
8994
|
-
updated_at: IsoTimestamp
|
|
8995
|
-
|
|
8996
|
+
updated_at: IsoTimestamp,
|
|
8997
|
+
archived_at: IsoTimestamp.nullable()
|
|
8998
|
+
}).openapi({ description: "Vault credential. Secret fields (token) are write-only \u2014 never returned in responses." })
|
|
8996
8999
|
);
|
|
8997
9000
|
CreateCredentialRequestSchema = registry.register(
|
|
8998
9001
|
"CreateCredentialRequest",
|
|
8999
9002
|
external_exports.object({
|
|
9000
|
-
display_name: external_exports.string().min(1).max(200),
|
|
9003
|
+
display_name: external_exports.string().min(1).max(200).openapi({ description: "Human-readable name for this credential.", example: "Linear API key" }),
|
|
9001
9004
|
auth: external_exports.object({
|
|
9002
|
-
type: external_exports.enum(["static_bearer"]),
|
|
9003
|
-
|
|
9004
|
-
|
|
9005
|
-
})
|
|
9005
|
+
type: external_exports.enum(["static_bearer"]).openapi({ description: "Auth type." }),
|
|
9006
|
+
mcp_server_url: external_exports.string().url().optional().openapi({ description: "MCP server URL this credential authenticates with. Optional for plain API keys.", example: "https://mcp.linear.app/mcp" }),
|
|
9007
|
+
token: external_exports.string().min(1).openapi({ description: "Secret token. Stored encrypted at rest; never returned in responses.", example: "lin_api_xxxxx" })
|
|
9008
|
+
}),
|
|
9009
|
+
metadata: external_exports.record(external_exports.string()).optional().openapi({ description: "Arbitrary key-value metadata." })
|
|
9006
9010
|
})
|
|
9007
9011
|
);
|
|
9008
9012
|
UpdateCredentialRequestSchema = registry.register(
|
|
@@ -9011,9 +9015,10 @@ var init_chunk_OWTXN2FU = __esm({
|
|
|
9011
9015
|
display_name: external_exports.string().min(1).max(200).optional(),
|
|
9012
9016
|
auth: external_exports.object({
|
|
9013
9017
|
type: external_exports.enum(["static_bearer"]).optional(),
|
|
9014
|
-
token: external_exports.string().min(1).optional(),
|
|
9018
|
+
token: external_exports.string().min(1).optional().openapi({ description: "New token value. Write-only." }),
|
|
9015
9019
|
mcp_server_url: external_exports.string().url().nullish()
|
|
9016
|
-
}).optional()
|
|
9020
|
+
}).optional(),
|
|
9021
|
+
metadata: external_exports.record(external_exports.string().nullable()).optional().openapi({ description: "Patch semantics: set key to string to upsert, null to delete, omit to preserve." })
|
|
9017
9022
|
})
|
|
9018
9023
|
);
|
|
9019
9024
|
CredentialListResponseSchema = registry.register(
|
|
@@ -9022,7 +9027,7 @@ var init_chunk_OWTXN2FU = __esm({
|
|
|
9022
9027
|
);
|
|
9023
9028
|
CredentialDeletedResponseSchema = registry.register(
|
|
9024
9029
|
"CredentialDeletedResponse",
|
|
9025
|
-
external_exports.object({ id: UlidId, type: external_exports.literal("
|
|
9030
|
+
external_exports.object({ id: UlidId, type: external_exports.literal("vault_credential_deleted") })
|
|
9026
9031
|
);
|
|
9027
9032
|
MemoryStoreSchema = registry.register(
|
|
9028
9033
|
"MemoryStore",
|
|
@@ -9483,14 +9488,14 @@ var init_chunk_OWTXN2FU = __esm({
|
|
|
9483
9488
|
}
|
|
9484
9489
|
});
|
|
9485
9490
|
|
|
9486
|
-
// ../agent-sdk/dist/chunk-
|
|
9491
|
+
// ../agent-sdk/dist/chunk-D2TRWKVQ.js
|
|
9487
9492
|
function buildOpenApiDocument(opts) {
|
|
9488
9493
|
const generator = new import_zod_to_openapi3.OpenApiGeneratorV31(registry.definitions);
|
|
9489
9494
|
return generator.generateDocument({
|
|
9490
9495
|
openapi: "3.1.0",
|
|
9491
9496
|
info: {
|
|
9492
9497
|
title: "AgentStep Gateway",
|
|
9493
|
-
version: "0.4.
|
|
9498
|
+
version: "0.4.16",
|
|
9494
9499
|
description: "Open-source, drop-in replacement for the Claude Managed Agents API. Self-hosted agent gateway with 7 agent harnesses and 11 sandbox providers. Use with `@agentstep/agent-sdk` or the official Anthropic SDK \u2014 just change the baseURL."
|
|
9495
9500
|
},
|
|
9496
9501
|
servers: [{ url: opts.serverUrl, description: "This host" }],
|
|
@@ -9521,10 +9526,10 @@ function buildOpenApiDocument(opts) {
|
|
|
9521
9526
|
});
|
|
9522
9527
|
}
|
|
9523
9528
|
var import_zod_to_openapi3, ErrorResponses;
|
|
9524
|
-
var
|
|
9525
|
-
"../agent-sdk/dist/chunk-
|
|
9529
|
+
var init_chunk_D2TRWKVQ = __esm({
|
|
9530
|
+
"../agent-sdk/dist/chunk-D2TRWKVQ.js"() {
|
|
9526
9531
|
"use strict";
|
|
9527
|
-
|
|
9532
|
+
init_chunk_OXWELRJL();
|
|
9528
9533
|
init_chunk_7346CKTF();
|
|
9529
9534
|
init_zod();
|
|
9530
9535
|
import_zod_to_openapi3 = __toESM(require_dist(), 1);
|
|
@@ -10211,7 +10216,7 @@ var init_chunk_Y27R572J = __esm({
|
|
|
10211
10216
|
path: "/v1/vaults/{id}/credentials",
|
|
10212
10217
|
tags: ["Credentials"],
|
|
10213
10218
|
summary: "Create a vault credential",
|
|
10214
|
-
description: "Creates a
|
|
10219
|
+
description: "Creates a credential in the vault for MCP server authentication or plain API key storage. The token is encrypted at rest and never returned in responses. When `mcp_server_url` is provided, the credential is automatically injected as MCP auth during sessions. Without `mcp_server_url`, the token is injected as an env var derived from `display_name`.",
|
|
10215
10220
|
security: [{ ApiKey: [] }],
|
|
10216
10221
|
request: {
|
|
10217
10222
|
params: external_exports.object({ id: external_exports.string() }),
|
|
@@ -155693,9 +155698,10 @@ var init_chunk_AIBH32FN = __esm({
|
|
|
155693
155698
|
}
|
|
155694
155699
|
});
|
|
155695
155700
|
|
|
155696
|
-
// ../agent-sdk/dist/chunk-
|
|
155701
|
+
// ../agent-sdk/dist/chunk-ZQGJKPPY.js
|
|
155697
155702
|
function hydrate6(row) {
|
|
155698
155703
|
return {
|
|
155704
|
+
type: "vault_credential",
|
|
155699
155705
|
id: row.id,
|
|
155700
155706
|
vault_id: row.vault_id,
|
|
155701
155707
|
display_name: row.display_name,
|
|
@@ -155704,7 +155710,8 @@ function hydrate6(row) {
|
|
|
155704
155710
|
mcp_server_url: row.mcp_server_url
|
|
155705
155711
|
},
|
|
155706
155712
|
created_at: toIso(row.created_at),
|
|
155707
|
-
updated_at: toIso(row.updated_at)
|
|
155713
|
+
updated_at: toIso(row.updated_at),
|
|
155714
|
+
archived_at: null
|
|
155708
155715
|
};
|
|
155709
155716
|
}
|
|
155710
155717
|
function createCredential(input) {
|
|
@@ -155767,8 +155774,8 @@ function deleteCredential(id) {
|
|
|
155767
155774
|
const res = db.prepare(`DELETE FROM vault_credentials WHERE id = ?`).run(id);
|
|
155768
155775
|
return res.changes > 0;
|
|
155769
155776
|
}
|
|
155770
|
-
var
|
|
155771
|
-
"../agent-sdk/dist/chunk-
|
|
155777
|
+
var init_chunk_ZQGJKPPY = __esm({
|
|
155778
|
+
"../agent-sdk/dist/chunk-ZQGJKPPY.js"() {
|
|
155772
155779
|
"use strict";
|
|
155773
155780
|
init_chunk_AIBH32FN();
|
|
155774
155781
|
init_chunk_F4WUVOLE();
|
|
@@ -155879,7 +155886,7 @@ var init_chunk_VIGJQU6V = __esm({
|
|
|
155879
155886
|
}
|
|
155880
155887
|
});
|
|
155881
155888
|
|
|
155882
|
-
// ../agent-sdk/dist/chunk-
|
|
155889
|
+
// ../agent-sdk/dist/chunk-M4CTE7EH.js
|
|
155883
155890
|
function loadSessionSecrets(vaultIds) {
|
|
155884
155891
|
const secrets = [];
|
|
155885
155892
|
for (const vid of vaultIds) {
|
|
@@ -155912,10 +155919,10 @@ function deriveServerName(url2) {
|
|
|
155912
155919
|
return null;
|
|
155913
155920
|
}
|
|
155914
155921
|
}
|
|
155915
|
-
var
|
|
155916
|
-
"../agent-sdk/dist/chunk-
|
|
155922
|
+
var init_chunk_M4CTE7EH = __esm({
|
|
155923
|
+
"../agent-sdk/dist/chunk-M4CTE7EH.js"() {
|
|
155917
155924
|
"use strict";
|
|
155918
|
-
|
|
155925
|
+
init_chunk_ZQGJKPPY();
|
|
155919
155926
|
init_chunk_VIGJQU6V();
|
|
155920
155927
|
}
|
|
155921
155928
|
});
|
|
@@ -158857,7 +158864,17 @@ var init_storage = __esm({
|
|
|
158857
158864
|
}
|
|
158858
158865
|
});
|
|
158859
158866
|
|
|
158860
|
-
// ../agent-sdk/dist/chunk-
|
|
158867
|
+
// ../agent-sdk/dist/chunk-ZMCS7MYZ.js
|
|
158868
|
+
function wrapProviderWithSecrets(provider, secrets) {
|
|
158869
|
+
if (!secrets || Object.keys(secrets).length === 0) return provider;
|
|
158870
|
+
return {
|
|
158871
|
+
...provider,
|
|
158872
|
+
exec: (n, argv, opts) => provider.exec(n, argv, { ...opts, secrets }),
|
|
158873
|
+
startExec: (n, opts) => provider.startExec(n, { ...opts, secrets }),
|
|
158874
|
+
create: (opts) => provider.create({ ...opts, secrets }),
|
|
158875
|
+
delete: (n, s) => provider.delete(n, s ?? secrets)
|
|
158876
|
+
};
|
|
158877
|
+
}
|
|
158861
158878
|
async function installSkills(sandboxName, provider, skills, engine) {
|
|
158862
158879
|
if (!skills || skills.length === 0) return;
|
|
158863
158880
|
const SAFE_NAME_RE = /^[a-zA-Z0-9_.-]+$/;
|
|
@@ -158923,14 +158940,7 @@ async function acquireForFirstTurn(sessionId) {
|
|
|
158923
158940
|
throw new Error(`provider ${provider.name} is not available: ${result.message}`);
|
|
158924
158941
|
}
|
|
158925
158942
|
}
|
|
158926
|
-
const
|
|
158927
|
-
const sp = hasSecrets ? {
|
|
158928
|
-
...provider,
|
|
158929
|
-
exec: (n, argv, opts) => provider.exec(n, argv, { ...opts, secrets }),
|
|
158930
|
-
startExec: (n, opts) => provider.startExec(n, { ...opts, secrets }),
|
|
158931
|
-
create: (opts) => provider.create({ ...opts, secrets }),
|
|
158932
|
-
delete: (n, s) => provider.delete(n, s ?? secrets)
|
|
158933
|
-
} : provider;
|
|
158943
|
+
const sp = wrapProviderWithSecrets(provider, secrets);
|
|
158934
158944
|
const name = deriveSandboxName(sessionId);
|
|
158935
158945
|
lcLog(`[lifecycle] ${sessionId} creating container via ${sp.name}...`);
|
|
158936
158946
|
try {
|
|
@@ -159202,8 +159212,8 @@ async function reconcileDockerOrphanSandboxes() {
|
|
|
159202
159212
|
return { deleted, kept };
|
|
159203
159213
|
}
|
|
159204
159214
|
var lcLog, SANDBOX_NAME_PREFIX;
|
|
159205
|
-
var
|
|
159206
|
-
"../agent-sdk/dist/chunk-
|
|
159215
|
+
var init_chunk_ZMCS7MYZ = __esm({
|
|
159216
|
+
"../agent-sdk/dist/chunk-ZMCS7MYZ.js"() {
|
|
159207
159217
|
"use strict";
|
|
159208
159218
|
init_chunk_DO4WVWW7();
|
|
159209
159219
|
init_chunk_RMZRSYIJ();
|
|
@@ -159255,30 +159265,6 @@ var init_api_keys = __esm({
|
|
|
159255
159265
|
}
|
|
159256
159266
|
});
|
|
159257
159267
|
|
|
159258
|
-
// ../agent-sdk/dist/providers/resolve-secrets.js
|
|
159259
|
-
var resolve_secrets_exports = {};
|
|
159260
|
-
__export(resolve_secrets_exports, {
|
|
159261
|
-
BLOCKED_ENV_KEYS: () => BLOCKED_ENV_KEYS,
|
|
159262
|
-
resolveVaultSecrets: () => resolveVaultSecrets
|
|
159263
|
-
});
|
|
159264
|
-
var init_resolve_secrets = __esm({
|
|
159265
|
-
"../agent-sdk/dist/providers/resolve-secrets.js"() {
|
|
159266
|
-
"use strict";
|
|
159267
|
-
init_chunk_DO4WVWW7();
|
|
159268
|
-
init_chunk_VIGJQU6V();
|
|
159269
|
-
init_chunk_AIBH32FN();
|
|
159270
|
-
init_chunk_YPXI7Q2M();
|
|
159271
|
-
init_chunk_JDELTTHV();
|
|
159272
|
-
init_chunk_F4WUVOLE();
|
|
159273
|
-
init_chunk_SXE7H3VK();
|
|
159274
|
-
init_chunk_LHHBOQUR();
|
|
159275
|
-
init_chunk_HFDLUBWN();
|
|
159276
|
-
init_chunk_5GZEX4HV();
|
|
159277
|
-
init_chunk_2BDD6OHG();
|
|
159278
|
-
init_chunk_2ESYSVXG();
|
|
159279
|
-
}
|
|
159280
|
-
});
|
|
159281
|
-
|
|
159282
159268
|
// ../agent-sdk/dist/backends/claude/tool-bridge.js
|
|
159283
159269
|
var tool_bridge_exports = {};
|
|
159284
159270
|
__export(tool_bridge_exports, {
|
|
@@ -159787,17 +159773,17 @@ var MAX_THREAD_DEPTH;
|
|
|
159787
159773
|
var init_threads = __esm({
|
|
159788
159774
|
"../agent-sdk/dist/sessions/threads.js"() {
|
|
159789
159775
|
"use strict";
|
|
159790
|
-
|
|
159776
|
+
init_chunk_ORFFR5UG();
|
|
159791
159777
|
init_chunk_PJZ5TQYW();
|
|
159792
159778
|
init_chunk_AU4NAQGA();
|
|
159793
159779
|
init_chunk_H6TQGV4L();
|
|
159794
159780
|
init_chunk_SV2B3P6B();
|
|
159795
159781
|
init_chunk_72BKGVBE();
|
|
159796
|
-
|
|
159782
|
+
init_chunk_M4CTE7EH();
|
|
159797
159783
|
init_chunk_NIOWKTIF();
|
|
159798
|
-
|
|
159784
|
+
init_chunk_ZQGJKPPY();
|
|
159799
159785
|
init_chunk_LAWTTG2E();
|
|
159800
|
-
|
|
159786
|
+
init_chunk_ZMCS7MYZ();
|
|
159801
159787
|
init_chunk_DO4WVWW7();
|
|
159802
159788
|
init_chunk_RMZRSYIJ();
|
|
159803
159789
|
init_chunk_5ZFOKZGR();
|
|
@@ -159870,7 +159856,7 @@ var init_threads = __esm({
|
|
|
159870
159856
|
}
|
|
159871
159857
|
});
|
|
159872
159858
|
|
|
159873
|
-
// ../agent-sdk/dist/chunk-
|
|
159859
|
+
// ../agent-sdk/dist/chunk-ORFFR5UG.js
|
|
159874
159860
|
function formatStopReason(reason, eventIds) {
|
|
159875
159861
|
if (reason === "custom_tool_call" && eventIds?.length) {
|
|
159876
159862
|
return { type: "requires_action", event_ids: eventIds };
|
|
@@ -159970,6 +159956,7 @@ async function runTurn(sessionId, inputs, _depth = 0, parentTrace) {
|
|
|
159970
159956
|
try {
|
|
159971
159957
|
sandboxName = await acquireForFirstTurn(sessionId);
|
|
159972
159958
|
console.log(`[driver] ${sessionId} container ready: ${sandboxName}`);
|
|
159959
|
+
const postAcquireSecrets = getBySession(sessionId)?.vaultSecrets ?? (session.vault_ids?.length ? resolveVaultSecrets(session.vault_ids) : void 0);
|
|
159973
159960
|
const latestAgent = getAgent(session.agent.id);
|
|
159974
159961
|
if (latestAgent && latestAgent.skills && latestAgent.skills.length > 0) {
|
|
159975
159962
|
const currentSkills = new Map((agent.skills ?? []).map((s) => [s.name, s.content.length]));
|
|
@@ -159979,7 +159966,8 @@ async function runTurn(sessionId, inputs, _depth = 0, parentTrace) {
|
|
|
159979
159966
|
if (newSkills.length > 0) {
|
|
159980
159967
|
console.log(`[driver] ${sessionId} injecting ${newSkills.length} new skill(s)...`);
|
|
159981
159968
|
const envRow = getEnvironment(session.environment_id);
|
|
159982
|
-
const
|
|
159969
|
+
const baseProvider = await resolveContainerProvider(envRow?.config?.provider);
|
|
159970
|
+
const sp = wrapProviderWithSecrets(baseProvider, postAcquireSecrets);
|
|
159983
159971
|
await installSkills(sandboxName, sp, newSkills, agent.engine);
|
|
159984
159972
|
console.log(`[driver] ${sessionId} skills injected`);
|
|
159985
159973
|
}
|
|
@@ -159987,7 +159975,8 @@ async function runTurn(sessionId, inputs, _depth = 0, parentTrace) {
|
|
|
159987
159975
|
const freshSession2 = getSession(sessionId);
|
|
159988
159976
|
if (freshSession2?.resources && freshSession2.resources.length > 0) {
|
|
159989
159977
|
const envRow = getEnvironment(session.environment_id);
|
|
159990
|
-
const
|
|
159978
|
+
const baseProvider = await resolveContainerProvider(envRow?.config?.provider);
|
|
159979
|
+
const sp = wrapProviderWithSecrets(baseProvider, postAcquireSecrets);
|
|
159991
159980
|
await provisionResources(sandboxName, freshSession2.resources, sp);
|
|
159992
159981
|
}
|
|
159993
159982
|
} catch (err) {
|
|
@@ -160094,7 +160083,7 @@ ${turnBuild.stdin}`;
|
|
|
160094
160083
|
const env3 = getEnvironment(session.environment_id);
|
|
160095
160084
|
const provider = await resolveContainerProvider(env3?.config?.provider);
|
|
160096
160085
|
const poolEntry = getBySession(sessionId);
|
|
160097
|
-
const secrets = poolEntry?.vaultSecrets ?? (session.vault_ids?.length ?
|
|
160086
|
+
const secrets = poolEntry?.vaultSecrets ?? (session.vault_ids?.length ? resolveVaultSecrets(session.vault_ids) : void 0);
|
|
160098
160087
|
const tools = resolveToolset(agent.tools);
|
|
160099
160088
|
if (agent.threads_enabled) {
|
|
160100
160089
|
tools.customToolNames.add("spawn_agent");
|
|
@@ -160530,17 +160519,17 @@ async function writePermissionResponse(sessionId, result, denyMessage) {
|
|
|
160530
160519
|
getPendingConfirmations().delete(sessionId);
|
|
160531
160520
|
}
|
|
160532
160521
|
var gd;
|
|
160533
|
-
var
|
|
160534
|
-
"../agent-sdk/dist/chunk-
|
|
160522
|
+
var init_chunk_ORFFR5UG = __esm({
|
|
160523
|
+
"../agent-sdk/dist/chunk-ORFFR5UG.js"() {
|
|
160535
160524
|
"use strict";
|
|
160536
160525
|
init_chunk_PJZ5TQYW();
|
|
160537
160526
|
init_chunk_AU4NAQGA();
|
|
160538
160527
|
init_chunk_H6TQGV4L();
|
|
160539
160528
|
init_chunk_SV2B3P6B();
|
|
160540
160529
|
init_chunk_72BKGVBE();
|
|
160541
|
-
|
|
160530
|
+
init_chunk_M4CTE7EH();
|
|
160542
160531
|
init_chunk_NIOWKTIF();
|
|
160543
|
-
|
|
160532
|
+
init_chunk_ZMCS7MYZ();
|
|
160544
160533
|
init_chunk_DO4WVWW7();
|
|
160545
160534
|
init_chunk_BMPB7XJH();
|
|
160546
160535
|
init_chunk_I5ZA45YL();
|
|
@@ -212910,7 +212899,7 @@ var init_chunk_3MQ2FWXS = __esm({
|
|
|
212910
212899
|
}
|
|
212911
212900
|
});
|
|
212912
212901
|
|
|
212913
|
-
// ../agent-sdk/dist/chunk-
|
|
212902
|
+
// ../agent-sdk/dist/chunk-G5CIMVGV.js
|
|
212914
212903
|
function markStopping() {
|
|
212915
212904
|
stopping = true;
|
|
212916
212905
|
}
|
|
@@ -212976,11 +212965,11 @@ async function evictIdleSessions() {
|
|
|
212976
212965
|
}
|
|
212977
212966
|
}
|
|
212978
212967
|
var sweeping, stopping;
|
|
212979
|
-
var
|
|
212980
|
-
"../agent-sdk/dist/chunk-
|
|
212968
|
+
var init_chunk_G5CIMVGV = __esm({
|
|
212969
|
+
"../agent-sdk/dist/chunk-G5CIMVGV.js"() {
|
|
212981
212970
|
"use strict";
|
|
212982
212971
|
init_chunk_LAWTTG2E();
|
|
212983
|
-
|
|
212972
|
+
init_chunk_ZMCS7MYZ();
|
|
212984
212973
|
init_chunk_BMPB7XJH();
|
|
212985
212974
|
init_chunk_I5ZA45YL();
|
|
212986
212975
|
init_chunk_QH57EOKP();
|
|
@@ -212992,7 +212981,7 @@ var init_chunk_PNYCULIF = __esm({
|
|
|
212992
212981
|
}
|
|
212993
212982
|
});
|
|
212994
212983
|
|
|
212995
|
-
// ../agent-sdk/dist/chunk-
|
|
212984
|
+
// ../agent-sdk/dist/chunk-U7GILP6F.js
|
|
212996
212985
|
function installShutdownHandlers() {
|
|
212997
212986
|
if (g12.__caShutdownInstalled) return;
|
|
212998
212987
|
g12.__caShutdownInstalled = true;
|
|
@@ -213035,10 +213024,10 @@ async function shutdown(signal) {
|
|
|
213035
213024
|
process.exit(0);
|
|
213036
213025
|
}
|
|
213037
213026
|
var g12, shuttingDown;
|
|
213038
|
-
var
|
|
213039
|
-
"../agent-sdk/dist/chunk-
|
|
213027
|
+
var init_chunk_U7GILP6F = __esm({
|
|
213028
|
+
"../agent-sdk/dist/chunk-U7GILP6F.js"() {
|
|
213040
213029
|
"use strict";
|
|
213041
|
-
|
|
213030
|
+
init_chunk_G5CIMVGV();
|
|
213042
213031
|
init_chunk_5GZEX4HV();
|
|
213043
213032
|
init_chunk_UYTSKFGK();
|
|
213044
213033
|
init_client();
|
|
@@ -215139,7 +215128,7 @@ var init_rate_limit = __esm({
|
|
|
215139
215128
|
}
|
|
215140
215129
|
});
|
|
215141
215130
|
|
|
215142
|
-
// ../agent-sdk/dist/chunk-
|
|
215131
|
+
// ../agent-sdk/dist/chunk-4X4KT4CJ.js
|
|
215143
215132
|
import path10 from "path";
|
|
215144
215133
|
async function ensureInitialized() {
|
|
215145
215134
|
if (g14.__caInitPromise) return g14.__caInitPromise;
|
|
@@ -215358,18 +215347,18 @@ async function rebuildContainerPool() {
|
|
|
215358
215347
|
}
|
|
215359
215348
|
}
|
|
215360
215349
|
var g14;
|
|
215361
|
-
var
|
|
215362
|
-
"../agent-sdk/dist/chunk-
|
|
215350
|
+
var init_chunk_4X4KT4CJ = __esm({
|
|
215351
|
+
"../agent-sdk/dist/chunk-4X4KT4CJ.js"() {
|
|
215363
215352
|
"use strict";
|
|
215364
215353
|
init_chunk_HECQRMDR();
|
|
215365
|
-
|
|
215354
|
+
init_chunk_ORFFR5UG();
|
|
215366
215355
|
init_chunk_ACKMNK3C();
|
|
215367
215356
|
init_chunk_TWPTR2C2();
|
|
215368
215357
|
init_chunk_ADK2TYO4();
|
|
215369
215358
|
init_chunk_3MQ2FWXS();
|
|
215370
|
-
|
|
215371
|
-
|
|
215372
|
-
|
|
215359
|
+
init_chunk_U7GILP6F();
|
|
215360
|
+
init_chunk_G5CIMVGV();
|
|
215361
|
+
init_chunk_ZMCS7MYZ();
|
|
215373
215362
|
init_chunk_BMPB7XJH();
|
|
215374
215363
|
init_chunk_I5ZA45YL();
|
|
215375
215364
|
init_chunk_YPXI7Q2M();
|
|
@@ -215387,7 +215376,7 @@ var init_chunk_AH7DAJU5 = __esm({
|
|
|
215387
215376
|
}
|
|
215388
215377
|
});
|
|
215389
215378
|
|
|
215390
|
-
// ../agent-sdk/dist/chunk-
|
|
215379
|
+
// ../agent-sdk/dist/chunk-OYXDU3HX.js
|
|
215391
215380
|
async function routeWrap(request2, handler) {
|
|
215392
215381
|
const startedAt = Date.now();
|
|
215393
215382
|
let status = 500;
|
|
@@ -215431,13 +215420,13 @@ async function routeWrap(request2, handler) {
|
|
|
215431
215420
|
function jsonOk(body, status = 200) {
|
|
215432
215421
|
return Response.json(body, { status });
|
|
215433
215422
|
}
|
|
215434
|
-
var
|
|
215435
|
-
"../agent-sdk/dist/chunk-
|
|
215423
|
+
var init_chunk_OYXDU3HX = __esm({
|
|
215424
|
+
"../agent-sdk/dist/chunk-OYXDU3HX.js"() {
|
|
215436
215425
|
"use strict";
|
|
215437
215426
|
init_chunk_D2XITRN6();
|
|
215438
215427
|
init_chunk_PWWRWR75();
|
|
215439
215428
|
init_chunk_HVUWXUUI();
|
|
215440
|
-
|
|
215429
|
+
init_chunk_4X4KT4CJ();
|
|
215441
215430
|
init_chunk_3MQ2FWXS();
|
|
215442
215431
|
init_chunk_EZYKRG4W();
|
|
215443
215432
|
}
|
|
@@ -215558,8 +215547,8 @@ var init_dist2 = __esm({
|
|
|
215558
215547
|
"../agent-sdk/dist/index.js"() {
|
|
215559
215548
|
"use strict";
|
|
215560
215549
|
init_chunk_VFSOYCGN();
|
|
215561
|
-
|
|
215562
|
-
|
|
215550
|
+
init_chunk_D2TRWKVQ();
|
|
215551
|
+
init_chunk_OXWELRJL();
|
|
215563
215552
|
init_chunk_7346CKTF();
|
|
215564
215553
|
init_chunk_DC2UMEQH();
|
|
215565
215554
|
init_chunk_S3SKODVV();
|
|
@@ -215567,31 +215556,31 @@ var init_dist2 = __esm({
|
|
|
215567
215556
|
init_chunk_SDLNBA53();
|
|
215568
215557
|
init_chunk_MHQXDTJB();
|
|
215569
215558
|
init_chunk_2N2KL4KM();
|
|
215570
|
-
|
|
215559
|
+
init_chunk_OYXDU3HX();
|
|
215571
215560
|
init_chunk_D2XITRN6();
|
|
215572
215561
|
init_chunk_PWWRWR75();
|
|
215573
215562
|
init_chunk_QLWA4MJ5();
|
|
215574
215563
|
init_chunk_W6WKXFHN();
|
|
215575
215564
|
init_chunk_HVUWXUUI();
|
|
215576
|
-
|
|
215565
|
+
init_chunk_4X4KT4CJ();
|
|
215577
215566
|
init_chunk_HECQRMDR();
|
|
215578
|
-
|
|
215567
|
+
init_chunk_ORFFR5UG();
|
|
215579
215568
|
init_chunk_PJZ5TQYW();
|
|
215580
215569
|
init_chunk_AU4NAQGA();
|
|
215581
215570
|
init_chunk_H6TQGV4L();
|
|
215582
215571
|
init_chunk_SV2B3P6B();
|
|
215583
215572
|
init_chunk_72BKGVBE();
|
|
215584
|
-
|
|
215573
|
+
init_chunk_M4CTE7EH();
|
|
215585
215574
|
init_chunk_ACKMNK3C();
|
|
215586
215575
|
init_chunk_TWPTR2C2();
|
|
215587
215576
|
init_chunk_NIOWKTIF();
|
|
215588
|
-
|
|
215577
|
+
init_chunk_ZQGJKPPY();
|
|
215589
215578
|
init_chunk_ADK2TYO4();
|
|
215590
215579
|
init_chunk_3MQ2FWXS();
|
|
215591
|
-
|
|
215592
|
-
|
|
215580
|
+
init_chunk_U7GILP6F();
|
|
215581
|
+
init_chunk_G5CIMVGV();
|
|
215593
215582
|
init_chunk_LAWTTG2E();
|
|
215594
|
-
|
|
215583
|
+
init_chunk_ZMCS7MYZ();
|
|
215595
215584
|
init_chunk_DO4WVWW7();
|
|
215596
215585
|
init_chunk_RMZRSYIJ();
|
|
215597
215586
|
init_chunk_5ZFOKZGR();
|
|
@@ -215665,7 +215654,7 @@ var init_dist2 = __esm({
|
|
|
215665
215654
|
}
|
|
215666
215655
|
});
|
|
215667
215656
|
|
|
215668
|
-
// ../agent-sdk/dist/chunk-
|
|
215657
|
+
// ../agent-sdk/dist/chunk-FANJGS3D.js
|
|
215669
215658
|
function handleWhoami(request2) {
|
|
215670
215659
|
return routeWrap(request2, async ({ auth }) => {
|
|
215671
215660
|
return jsonOk({
|
|
@@ -215676,10 +215665,10 @@ function handleWhoami(request2) {
|
|
|
215676
215665
|
});
|
|
215677
215666
|
});
|
|
215678
215667
|
}
|
|
215679
|
-
var
|
|
215680
|
-
"../agent-sdk/dist/chunk-
|
|
215668
|
+
var init_chunk_FANJGS3D = __esm({
|
|
215669
|
+
"../agent-sdk/dist/chunk-FANJGS3D.js"() {
|
|
215681
215670
|
"use strict";
|
|
215682
|
-
|
|
215671
|
+
init_chunk_OYXDU3HX();
|
|
215683
215672
|
}
|
|
215684
215673
|
});
|
|
215685
215674
|
|
|
@@ -215893,7 +215882,7 @@ var init_chunk_FB4OSWM2 = __esm({
|
|
|
215893
215882
|
}
|
|
215894
215883
|
});
|
|
215895
215884
|
|
|
215896
|
-
// ../agent-sdk/dist/chunk-
|
|
215885
|
+
// ../agent-sdk/dist/chunk-5ZZX7JZP.js
|
|
215897
215886
|
async function handleGetSkillsCatalog(request2) {
|
|
215898
215887
|
return routeWrap(request2, async ({ request: req }) => {
|
|
215899
215888
|
const url2 = new URL(req.url);
|
|
@@ -215949,11 +215938,11 @@ async function handleGetSkillsFeed(request2) {
|
|
|
215949
215938
|
return jsonOk(feed);
|
|
215950
215939
|
});
|
|
215951
215940
|
}
|
|
215952
|
-
var
|
|
215953
|
-
"../agent-sdk/dist/chunk-
|
|
215941
|
+
var init_chunk_5ZZX7JZP = __esm({
|
|
215942
|
+
"../agent-sdk/dist/chunk-5ZZX7JZP.js"() {
|
|
215954
215943
|
"use strict";
|
|
215955
215944
|
init_chunk_FB4OSWM2();
|
|
215956
|
-
|
|
215945
|
+
init_chunk_OYXDU3HX();
|
|
215957
215946
|
}
|
|
215958
215947
|
});
|
|
215959
215948
|
|
|
@@ -216013,7 +216002,7 @@ var init_chunk_23UKWXJH = __esm({
|
|
|
216013
216002
|
}
|
|
216014
216003
|
});
|
|
216015
216004
|
|
|
216016
|
-
// ../agent-sdk/dist/chunk-
|
|
216005
|
+
// ../agent-sdk/dist/chunk-KWB3FXD5.js
|
|
216017
216006
|
async function prepareSessionStream(request2, sessionId) {
|
|
216018
216007
|
try {
|
|
216019
216008
|
await ensureInitialized();
|
|
@@ -216106,14 +216095,14 @@ data: ${JSON.stringify(evt)}
|
|
|
216106
216095
|
}
|
|
216107
216096
|
});
|
|
216108
216097
|
}
|
|
216109
|
-
var
|
|
216110
|
-
"../agent-sdk/dist/chunk-
|
|
216098
|
+
var init_chunk_KWB3FXD5 = __esm({
|
|
216099
|
+
"../agent-sdk/dist/chunk-KWB3FXD5.js"() {
|
|
216111
216100
|
"use strict";
|
|
216112
216101
|
init_chunk_YGAHGTVZ();
|
|
216113
216102
|
init_chunk_23UKWXJH();
|
|
216114
216103
|
init_chunk_PWWRWR75();
|
|
216115
216104
|
init_chunk_QLWA4MJ5();
|
|
216116
|
-
|
|
216105
|
+
init_chunk_4X4KT4CJ();
|
|
216117
216106
|
init_chunk_NIOWKTIF();
|
|
216118
216107
|
init_chunk_BMPB7XJH();
|
|
216119
216108
|
init_chunk_I5ZA45YL();
|
|
@@ -216123,7 +216112,7 @@ var init_chunk_EO5ZTIP7 = __esm({
|
|
|
216123
216112
|
}
|
|
216124
216113
|
});
|
|
216125
216114
|
|
|
216126
|
-
// ../agent-sdk/dist/chunk-
|
|
216115
|
+
// ../agent-sdk/dist/chunk-4XG3HLXP.js
|
|
216127
216116
|
function handleCreateTenant(request2) {
|
|
216128
216117
|
return routeWrap(request2, async ({ auth, request: req }) => {
|
|
216129
216118
|
requireFeature("tenancy", "multi-tenancy");
|
|
@@ -216222,13 +216211,13 @@ function handleArchiveTenant(request2, id) {
|
|
|
216222
216211
|
});
|
|
216223
216212
|
}
|
|
216224
216213
|
var CreateBody, PatchBody;
|
|
216225
|
-
var
|
|
216226
|
-
"../agent-sdk/dist/chunk-
|
|
216214
|
+
var init_chunk_4XG3HLXP = __esm({
|
|
216215
|
+
"../agent-sdk/dist/chunk-4XG3HLXP.js"() {
|
|
216227
216216
|
"use strict";
|
|
216228
216217
|
init_chunk_23UKWXJH();
|
|
216229
216218
|
init_chunk_MHQXDTJB();
|
|
216230
216219
|
init_chunk_2N2KL4KM();
|
|
216231
|
-
|
|
216220
|
+
init_chunk_OYXDU3HX();
|
|
216232
216221
|
init_chunk_JDELTTHV();
|
|
216233
216222
|
init_chunk_EZYKRG4W();
|
|
216234
216223
|
init_zod();
|
|
@@ -216242,7 +216231,7 @@ var init_chunk_TFK6TCMC = __esm({
|
|
|
216242
216231
|
}
|
|
216243
216232
|
});
|
|
216244
216233
|
|
|
216245
|
-
// ../agent-sdk/dist/chunk-
|
|
216234
|
+
// ../agent-sdk/dist/chunk-DGLW2SSG.js
|
|
216246
216235
|
function handleListThreads(request2, sessionId) {
|
|
216247
216236
|
return routeWrap(request2, async ({ auth }) => {
|
|
216248
216237
|
const row = getDb().prepare(`SELECT tenant_id FROM sessions WHERE id = ?`).get(sessionId);
|
|
@@ -216267,11 +216256,11 @@ function handleListThreads(request2, sessionId) {
|
|
|
216267
216256
|
});
|
|
216268
216257
|
});
|
|
216269
216258
|
}
|
|
216270
|
-
var
|
|
216271
|
-
"../agent-sdk/dist/chunk-
|
|
216259
|
+
var init_chunk_DGLW2SSG = __esm({
|
|
216260
|
+
"../agent-sdk/dist/chunk-DGLW2SSG.js"() {
|
|
216272
216261
|
"use strict";
|
|
216273
216262
|
init_chunk_23UKWXJH();
|
|
216274
|
-
|
|
216263
|
+
init_chunk_OYXDU3HX();
|
|
216275
216264
|
init_chunk_I5ZA45YL();
|
|
216276
216265
|
init_chunk_5GZEX4HV();
|
|
216277
216266
|
init_chunk_EZYKRG4W();
|
|
@@ -216321,7 +216310,7 @@ var init_chunk_JK5TPJHH = __esm({
|
|
|
216321
216310
|
}
|
|
216322
216311
|
});
|
|
216323
216312
|
|
|
216324
|
-
// ../agent-sdk/dist/chunk-
|
|
216313
|
+
// ../agent-sdk/dist/chunk-ZJFWDMML.js
|
|
216325
216314
|
function buildSpanTree(events2) {
|
|
216326
216315
|
const nodes = /* @__PURE__ */ new Map();
|
|
216327
216316
|
const openStarts = /* @__PURE__ */ new Map();
|
|
@@ -216505,18 +216494,18 @@ function handleExportTrace(request2, traceId) {
|
|
|
216505
216494
|
return jsonOk(result, result.ok ? 200 : 502);
|
|
216506
216495
|
});
|
|
216507
216496
|
}
|
|
216508
|
-
var
|
|
216509
|
-
"../agent-sdk/dist/chunk-
|
|
216497
|
+
var init_chunk_ZJFWDMML = __esm({
|
|
216498
|
+
"../agent-sdk/dist/chunk-ZJFWDMML.js"() {
|
|
216510
216499
|
"use strict";
|
|
216511
216500
|
init_chunk_JK5TPJHH();
|
|
216512
|
-
|
|
216501
|
+
init_chunk_OYXDU3HX();
|
|
216513
216502
|
init_chunk_ACKMNK3C();
|
|
216514
216503
|
init_chunk_O45IQUWS();
|
|
216515
216504
|
init_chunk_EZYKRG4W();
|
|
216516
216505
|
}
|
|
216517
216506
|
});
|
|
216518
216507
|
|
|
216519
|
-
// ../agent-sdk/dist/chunk-
|
|
216508
|
+
// ../agent-sdk/dist/chunk-HKAW5ATE.js
|
|
216520
216509
|
async function handleGetUI(opts) {
|
|
216521
216510
|
let body = HTML_TEMPLATE;
|
|
216522
216511
|
const scripts = [];
|
|
@@ -216545,8 +216534,8 @@ async function handleGetUI(opts) {
|
|
|
216545
216534
|
});
|
|
216546
216535
|
}
|
|
216547
216536
|
var HTML_TEMPLATE, UI_VERSION;
|
|
216548
|
-
var
|
|
216549
|
-
"../agent-sdk/dist/chunk-
|
|
216537
|
+
var init_chunk_HKAW5ATE = __esm({
|
|
216538
|
+
"../agent-sdk/dist/chunk-HKAW5ATE.js"() {
|
|
216550
216539
|
"use strict";
|
|
216551
216540
|
HTML_TEMPLATE = `<!DOCTYPE html>
|
|
216552
216541
|
<html lang="en" class="dark">
|
|
@@ -216958,7 +216947,7 @@ Url: \${Wx(e)}\`),!0}return!1}function Nee(e,t){return t?.length?d6(e).some(n=>k
|
|
|
216958
216947
|
*
|
|
216959
216948
|
* This source code is licensed under the ISC license.
|
|
216960
216949
|
* See the LICENSE file in the root directory of this source tree.
|
|
216961
|
-
*/const jfe=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Tfe=it("zap",jfe),Afe=({...e})=>{const{theme:t="system"}=xce();return m.jsx(Kce,{theme:t,className:"toaster group",icons:{success:m.jsx(bue,{className:"size-4"}),info:m.jsx($T,{className:"size-4"}),warning:m.jsx(i8,{className:"size-4"}),error:m.jsx(Uue,{className:"size-4"}),loading:m.jsx(tw,{className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},toastOptions:{classNames:{toast:"cn-toast"}},...e})};function HT(e){return vt(e.defaultTagName??"div",e,e)}const YL=e=>typeof e=="boolean"?\`\${e}\`:e===0?"0":e,WL=ln,Ag=(e,t)=>n=>{var r;if(t?.variants==null)return WL(e,n?.class,n?.className);const{variants:i,defaultVariants:o}=t,a=Object.keys(i).map(f=>{const d=n?.[f],h=o?.[f];if(d===null)return null;const g=YL(d)||YL(h);return i[f][g]}),l=n&&Object.entries(n).reduce((f,d)=>{let[h,g]=d;return g===void 0||(f[h]=g),f},{}),u=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((f,d)=>{let{class:h,className:g,...v}=d;return Object.entries(v).every(b=>{let[w,S]=b;return Array.isArray(S)?S.includes({...o,...l}[w]):{...o,...l}[w]===S})?[...f,h,g]:f},[]);return WL(e,a,u,n?.class,n?.className)},fC=768;function Nfe(){const[e,t]=x.useState(void 0);return x.useEffect(()=>{const n=window.matchMedia(\`(max-width: \${fC-1}px)\`),r=()=>{t(window.innerWidth<fC)};return n.addEventListener("change",r),t(window.innerWidth<fC),()=>n.removeEventListener("change",r)},[]),!!e}const o8=x.createContext(void 0);function qT(e=!1){const t=x.useContext(o8);if(t===void 0&&!e)throw new Error(Xt(16));return t}function Rfe(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:o}=e,a=r&&t!==!1,l=r&&t===!1;return{props:x.useMemo(()=>{const f={onKeyDown(d){n&&t&&d.key!=="Tab"&&d.preventDefault()}};return r||(f.tabIndex=i,!o&&n&&(f.tabIndex=t?i:-1)),(o&&(t||a)||!o&&n)&&(f["aria-disabled"]=n),o&&(!t||l)&&(f.disabled=n),f},[r,n,t,a,l,o,i])}}function Zo(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:o}=e,a=x.useRef(null),l=qT(!0),u=o??l!==void 0,{props:f}=Rfe({focusableWhenDisabled:n,disabled:t,composite:u,tabIndex:r,isNativeButton:i}),d=x.useCallback(()=>{const v=a.current;dC(v)&&u&&t&&f.disabled===void 0&&v.disabled&&(v.disabled=!1)},[t,f.disabled,u]);Pe(d,[d]);const h=x.useCallback((v={})=>{const{onClick:b,onMouseDown:w,onKeyUp:S,onKeyDown:E,onPointerDown:k,...O}=v;return Mo({type:i?"button":void 0,onClick(A){if(t){A.preventDefault();return}b?.(A)},onMouseDown(A){t||w?.(A)},onKeyDown(A){if(t||(sb(A),E?.(A),A.baseUIHandlerPrevented))return;const T=A.target===A.currentTarget,N=A.currentTarget,P=dC(N),F=!i&&Pfe(N),D=T&&(i?P:!F),q=A.key==="Enter",L=A.key===" ",U=N.getAttribute("role"),H=U?.startsWith("menuitem")||U==="option"||U==="gridcell";if(T&&u&&L){if(A.defaultPrevented&&H)return;A.preventDefault(),F||i&&P?(N.click(),A.preventBaseUIHandler()):D&&(b?.(A),A.preventBaseUIHandler());return}D&&(!i&&(L||q)&&A.preventDefault(),!i&&q&&b?.(A))},onKeyUp(A){if(!t){if(sb(A),S?.(A),A.target===A.currentTarget&&i&&u&&dC(A.currentTarget)&&A.key===" "){A.preventDefault();return}A.baseUIHandlerPrevented||A.target===A.currentTarget&&!i&&!u&&A.key===" "&&b?.(A)}},onPointerDown(A){if(t){A.preventDefault();return}k?.(A)}},i?void 0:{role:"button"},f,O)},[t,f,u,i]),g=Le(v=>{a.current=v,d()});return{getButtonProps:h,buttonRef:g}}function dC(e){return fn(e)&&e.tagName==="BUTTON"}function Pfe(e){return!!(e?.tagName==="A"&&e?.href)}const Mfe=x.forwardRef(function(t,n){const{render:r,className:i,disabled:o=!1,focusableWhenDisabled:a=!1,nativeButton:l=!0,style:u,...f}=t,{getButtonProps:d,buttonRef:h}=Zo({disabled:o,focusableWhenDisabled:a,native:l});return vt("button",t,{state:{disabled:o},ref:[n,h],props:[f,d]})}),Ife=Ag("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Fe({className:e,variant:t="default",size:n="default",...r}){return m.jsx(Mfe,{"data-slot":"button",className:Ne(Ife({variant:t,size:n,className:e})),...r})}let GL=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Dfe={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},cm={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Lfe={disabled:!1,...cm},VT={valid(e){return e===null?null:e?{[GL.valid]:""}:{[GL.invalid]:""}}},zfe=x.createContext({invalid:void 0,name:void 0,validityData:{state:Dfe,errors:[],error:"",value:"",initialValue:null},setValidityData:Yr,disabled:void 0,touched:cm.touched,setTouched:Yr,dirty:cm.dirty,setDirty:Yr,filled:cm.filled,setFilled:Yr,focused:cm.focused,setFocused:Yr,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:Lfe,markedDirtyRef:{current:!1},registerFieldControl:Yr,validation:{getValidationProps:(e=Wn)=>e,getInputValidationProps:(e=Wn)=>e,inputRef:{current:null},commit:async()=>{}}});function mh(e=!0){const t=x.useContext(zfe);if(t.setValidityData===Yr&&!e)throw new Error(Xt(28));return t}const Ffe=x.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Yr,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function a8(){return x.useContext(Ffe)}const Bfe=x.createContext({controlId:void 0,registerControlId:Yr,labelId:void 0,setLabelId:Yr,messageIds:[],setMessageIds:Yr,getDescriptionProps:e=>e});function ow(){return x.useContext(Bfe)}function Lu({controlled:e,default:t,name:n,state:r="value"}){const{current:i}=x.useRef(e!==void 0),[o,a]=x.useState(t),l=i?e:o,u=x.useCallback(f=>{i||a(f)},[]);return[l,u]}function KT(e,t){const{enabled:n=!0,getValue:r,id:i,value:o}=t,{registerFieldControl:a}=mh(),l=x.useRef(null);l.current||(l.current=Symbol()),Pe(()=>{const u=l.current;if(!(!u||!n))return a(u,{controlRef:e,getValue:r,id:i,value:o}),()=>{a(u,void 0)}},[e,n,r,i,a,o])}function aw(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:o}=ow(),a=Br(t),l=n?i:void 0,u=pr(()=>Symbol("labelable-control")),f=x.useRef(!1),d=x.useRef(t!=null),h=Le(()=>{!f.current||o===Yr||(f.current=!1,o(u.current,void 0))});return Pe(()=>{if(o===Yr)return;let g;if(n){const v=r?.current;Dt(v)&&v.closest("label")!=null?g=t??null:g=l??a}else if(t!=null)d.current=!0,g=t;else if(d.current)g=a;else{h();return}if(g===void 0){h();return}f.current=!0,o(u.current,g)},[t,r,l,o,n,a,u,h]),x.useEffect(()=>h,[h]),i??a}const $fe=x.forwardRef(function(t,n){const{render:r,className:i,id:o,name:a,value:l,disabled:u=!1,onValueChange:f,defaultValue:d,autoFocus:h=!1,style:g,...v}=t,{state:b,name:w,disabled:S,setTouched:E,setDirty:k,validityData:O,setFocused:j,setFilled:A,validationMode:T,validation:N}=mh(),P=S||u,F=w??a,D={...b,disabled:P},{labelId:q}=ow(),L=aw({id:o});Pe(()=>{const G=l!=null;N.inputRef.current?.value||G&&l!==""?A(!0):G&&l===""&&A(!1)},[N.inputRef,A,l]);const U=x.useRef(null);Pe(()=>{h&&U.current===Oi(jt(U.current))&&j(!0)},[h,j]);const[H]=Lu({controlled:l,default:d,name:"FieldControl",state:"value"}),B=l!==void 0,z=B?H:void 0,V=Le(()=>N.inputRef.current?.value);return KT(N.inputRef,{id:L,value:z,getValue:V}),vt("input",t,{ref:[n,U],state:D,props:[{id:L,disabled:P,name:F,ref:N.inputRef,"aria-labelledby":q,autoFocus:h,...B?{value:z}:{defaultValue:d},onChange(G){const I=G.currentTarget.value;f?.(I,ct(Wo,G.nativeEvent)),k(I!==O.initialValue),A(I!=="")},onFocus(){j(!0)},onBlur(G){E(!0),j(!1),T==="onBlur"&&N.commit(G.currentTarget.value)},onKeyDown(G){G.currentTarget.tagName==="INPUT"&&G.key==="Enter"&&(E(!0),N.commit(G.currentTarget.value))}},N.getInputValidationProps(),v],stateAttributesMapping:VT})}),Ufe=x.forwardRef(function(t,n){return m.jsx($fe,{ref:n,...t})});function en({className:e,type:t,...n}){return m.jsx(Ufe,{type:t,"data-slot":"input",className:Ne("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...n})}const Hfe=x.forwardRef(function(t,n){const{className:r,render:i,orientation:o="horizontal",style:a,...l}=t;return vt("div",t,{state:{orientation:o},ref:n,props:[{role:"separator","aria-orientation":o},l]})});function qfe({className:e,orientation:t="horizontal",...n}){return m.jsx(Hfe,{"data-slot":"separator",orientation:t,className:Ne("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",e),...n})}const YT=x.createContext(void 0);function Us(e){const t=x.useContext(YT);if(e===!1&&t===void 0)throw new Error(Xt(27));return t}const Vfe={...yc,...$s},WT=x.forwardRef(function(t,n){const{render:r,className:i,style:o,forceRender:a=!1,...l}=t,{store:u}=Us(),f=u.useState("open"),d=u.useState("nested"),h=u.useState("mounted"),g=u.useState("transitionStatus");return vt("div",t,{state:{open:f,transitionStatus:g},ref:[u.context.backdropRef,n],stateAttributesMapping:Vfe,props:[{role:"presentation",hidden:!h,style:{userSelect:"none",WebkitUserSelect:"none"}},l],enabled:a||!d})}),sw=x.forwardRef(function(t,n){const{render:r,className:i,disabled:o=!1,nativeButton:a=!0,style:l,...u}=t,{store:f}=Us(),d=f.useState("open");function h(w){d&&f.setOpen(!1,ct(Aoe,w.nativeEvent))}const{getButtonProps:g,buttonRef:v}=Zo({disabled:o,native:a});return vt("button",t,{state:{disabled:o},ref:[n,v],props:[{onClick:h},u,g]})}),s8=x.forwardRef(function(t,n){const{render:r,className:i,style:o,id:a,...l}=t,{store:u}=Us(),f=Br(a);return u.useSyncedValueWithCleanup("descriptionElementId",f),vt("p",t,{ref:n,props:[{id:f},l]})});let Kfe=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),Yfe=(function(e){return e[e.open=uu.open]="open",e[e.closed=uu.closed]="closed",e[e.startingStyle=uu.startingStyle]="startingStyle",e[e.endingStyle=uu.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const l8=x.createContext(void 0);function Wfe(){const e=x.useContext(l8);if(e===void 0)throw new Error(Xt(26));return e}const Jl="ArrowUp",vs="ArrowDown",zu="ArrowLeft",ec="ArrowRight",gh="Home",vh="End",c8=new Set([zu,ec]),Gfe=new Set([zu,ec,gh,vh]),u8=new Set([Jl,vs]),Xfe=new Set([Jl,vs,gh,vh]),f8=new Set([...c8,...u8]),Qfe=new Set([...f8,gh,vh]),lw=new Set([Jl,vs,zu,ec,gh,vh]),Zfe="Shift",Jfe="Control",ede="Alt",tde="Meta",nde=new Set([Zfe,Jfe,ede,tde]);function rde(e){return fn(e)&&e.tagName==="INPUT"}function XL(e){return!!(rde(e)&&e.selectionStart!=null||fn(e)&&e.tagName==="TEXTAREA")}function QL(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,o=e.scrollTop;const a=e.clientWidth<e.scrollWidth,l=e.clientHeight<e.scrollHeight;if(a&&r!=="vertical"){const u=ZL(e,t,"left"),f=By(e),d=By(t);n==="ltr"&&(u+t.offsetWidth+d.scrollMarginRight>e.scrollLeft+e.clientWidth-f.scrollPaddingRight?i=u+t.offsetWidth+d.scrollMarginRight-e.clientWidth+f.scrollPaddingRight:u-d.scrollMarginLeft<e.scrollLeft+f.scrollPaddingLeft&&(i=u-d.scrollMarginLeft-f.scrollPaddingLeft)),n==="rtl"&&(u-d.scrollMarginRight<e.scrollLeft+f.scrollPaddingLeft?i=u-d.scrollMarginLeft-f.scrollPaddingLeft:u+t.offsetWidth+d.scrollMarginRight>e.scrollLeft+e.clientWidth-f.scrollPaddingRight&&(i=u+t.offsetWidth+d.scrollMarginRight-e.clientWidth+f.scrollPaddingRight))}if(l&&r!=="horizontal"){const u=ZL(e,t,"top"),f=By(e),d=By(t);u-d.scrollMarginTop<e.scrollTop+f.scrollPaddingTop?o=u-d.scrollMarginTop-f.scrollPaddingTop:u+t.offsetHeight+d.scrollMarginBottom>e.scrollTop+e.clientHeight-f.scrollPaddingBottom&&(o=u+t.offsetHeight+d.scrollMarginBottom-e.clientHeight+f.scrollPaddingBottom)}e.scrollTo({left:i,top:o,behavior:"auto"})}function ZL(e,t,n){const r=n==="left"?"offsetLeft":"offsetTop";let i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function By(e){const t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}const ide={...yc,...$s,nestedDialogOpen(e){return e?{[Yfe.nestedDialogOpen]:""}:null}},GT=x.forwardRef(function(t,n){const{className:r,finalFocus:i,initialFocus:o,render:a,style:l,...u}=t,{store:f}=Us(),d=f.useState("descriptionElementId"),h=f.useState("disablePointerDismissal"),g=f.useState("floatingRootContext"),v=f.useState("popupProps"),b=f.useState("modal"),w=f.useState("mounted"),S=f.useState("nested"),E=f.useState("nestedOpenDialogCount"),k=f.useState("open"),O=f.useState("openMethod"),j=f.useState("titleElementId"),A=f.useState("transitionStatus"),T=f.useState("role");Wfe(),Qo({open:k,ref:f.context.popupRef,onComplete(){k&&f.context.onOpenChangeComplete?.(!0)}});function N(L){return L==="touch"?f.context.popupRef.current:!0}const P=o===void 0?N:o,F=E>0,q=vt("div",t,{state:{open:k,nested:S,transitionStatus:A,nestedDialogOpen:F},props:[v,{"aria-labelledby":j??void 0,"aria-describedby":d??void 0,role:T,tabIndex:-1,hidden:!w,onKeyDown(L){lw.has(L.key)&&L.stopPropagation()},style:{[Kfe.nestedDialogs]:E}},u],ref:[n,f.context.popupRef,f.useStateSetter("popupElement")],stateAttributesMapping:ide});return m.jsx(B0,{context:g,openInteractionType:O,disabled:!w,closeOnFocusOut:!h,initialFocus:P,returnFocus:i,modal:b!==!1,restoreFocus:"popup",children:q})}),cw=x.forwardRef(function(t,n){const{cutout:r,...i}=t;let o;if(r){const a=r.getBoundingClientRect();o=\`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,\${a.left}px \${a.top}px,\${a.left}px \${a.bottom}px,\${a.right}px \${a.bottom}px,\${a.right}px \${a.top}px,\${a.left}px \${a.top}px)\`}return m.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:o}})}),XT=x.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,{store:o}=Us(),a=o.useState("mounted"),l=o.useState("modal"),u=o.useState("open");return a||r?m.jsx(l8.Provider,{value:r,children:m.jsxs(F0,{ref:n,...i,children:[a&&l===!0&&m.jsx(cw,{ref:o.context.internalBackdropRef,inert:jg(!u)}),t.children]})}):null});let JL={},ez={},tz="";function ode(e){if(typeof document>"u")return!1;const t=jt(e);return In(t).innerWidth-t.documentElement.clientWidth>0}function ade(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=jt(e),r=n.documentElement,i=n.body,o=pc(r)?r:i,a=o.style.overflowY,l=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",o.style.overflowY="scroll";const u=o.offsetWidth;o.style.overflowY="hidden";const f=o.offsetWidth;return o.style.overflowY=a,r.style.scrollbarGutter=l,u===f}function sde(e){const t=jt(e),n=t.documentElement,r=t.body,i=pc(n)?n:r,o={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(i.style,o)}}function lde(e){const t=jt(e),n=t.documentElement,r=t.body,i=In(n);let o=0,a=0,l=!1;const u=Vn.create();if(A0&&(i.visualViewport?.scale??1)!==1)return()=>{};function f(){const v=i.getComputedStyle(n),b=i.getComputedStyle(r),E=(v.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";o=n.scrollTop,a=n.scrollLeft,JL={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},tz=n.style.scrollBehavior,ez={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const k=n.scrollHeight>n.clientHeight,O=n.scrollWidth>n.clientWidth,j=v.overflowY==="scroll"||b.overflowY==="scroll",A=v.overflowX==="scroll"||b.overflowX==="scroll",T=Math.max(0,i.innerWidth-r.clientWidth),N=Math.max(0,i.innerHeight-r.clientHeight),P=parseFloat(b.marginTop)+parseFloat(b.marginBottom),F=parseFloat(b.marginLeft)+parseFloat(b.marginRight),D=pc(n)?n:r;if(l=ade(e),l){n.style.scrollbarGutter=E,D.style.overflowY="hidden",D.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:E,overflowY:"hidden",overflowX:"hidden"}),(k||j)&&(n.style.overflowY="scroll"),(O||A)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:P||N?\`calc(100dvh - \${P+N}px)\`:"100dvh",width:F||T?\`calc(100vw - \${F+T}px)\`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=o,r.scrollLeft=a,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function d(){Object.assign(n.style,JL),Object.assign(r.style,ez),l||(n.scrollTop=o,n.scrollLeft=a,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=tz)}function h(){d(),u.request(f)}f();const g=kt(i,"resize",h);return()=>{u.cancel(),d(),typeof i.removeEventListener=="function"&&g()}}class cde{constructor(){qt(this,"lockCount",0);qt(this,"restore",null);qt(this,"timeoutLock",Ro.create());qt(this,"timeoutUnlock",Ro.create());qt(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});qt(this,"unlock",()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)})}acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}lock(t){if(this.lockCount===0||this.restore!==null)return;const r=jt(t).documentElement,i=In(r).getComputedStyle(r).overflowY;if(i==="hidden"||i==="clip"){this.restore=Yr;return}const o=mU||!ode(t);this.restore=o?sde(t):lde(t)}}const ude=new cde;function d8(e=!0,t=null){Pe(()=>{if(e)return ude.acquire(t)},[e,t])}function fde(e){const t=x.useRef(""),n=x.useCallback(i=>{i.defaultPrevented||(t.current=i.pointerType,e(i,i.pointerType))},[e]);return{onClick:x.useCallback(i=>{if(i.detail===0){e(i,"keyboard");return}"pointerType"in i?e(i,i.pointerType):e(i,t.current),t.current=""},[e]),onPointerDown:n}}function QT(e,t){const n=x.useRef(e),r=Le(t);Pe(()=>{n.current!==e&&r(n.current)},[e,r]),Pe(()=>{n.current=e},[e])}function uw(e){const[t,n]=x.useState(null),r=Le((a,l)=>{e||n(l||(mU?"touch":""))});QT(e,a=>{a&&!e&&n(null)});const{onClick:i,onPointerDown:o}=fde(r);return x.useMemo(()=>({openMethod:t,triggerProps:{onClick:i,onPointerDown:o}}),[t,i,o])}function h8(e){const{store:t,parentContext:n,actionsRef:r,isDrawer:i}=e,o=t.useState("open"),a=t.useState("disablePointerDismissal"),l=t.useState("modal"),u=t.useState("popupElement"),{openMethod:f,triggerProps:d}=uw(o);V0(t);const{forceUnmount:h}=K0(o,t),g=Le(L=>{const U=ct(L);return U.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},U}),v=x.useCallback(()=>{t.setOpen(!1,g(R0))},[t,g]);x.useImperativeHandle(r,()=>({unmount:h,close:v}),[h,v]);const b=G0({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0}),[w,S]=x.useState(0),[E,k]=x.useState(0),O=w===0,j=TT(b),A=_g(b,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:l==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(L){if(!t.context.outsidePressEnabledRef.current||"button"in L&&L.button!==0||"touches"in L&&L.touches.length!==1)return!1;const U=Sr(L);if(O&&!a){const H=U;return l&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===H||t.context.backdropRef.current===H||lt(H,u)&&!H?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:O});d8(o&&l===!0,u);const{getReferenceProps:T,getFloatingProps:N,getTriggerProps:P}=vc([j,A]);t.useContextCallback("onNestedDialogOpen",(L,U)=>{S(L),k(U)}),t.useContextCallback("onNestedDialogClose",()=>{S(0),k(0)}),x.useEffect(()=>(n?.onNestedDialogOpen&&o&&n.onNestedDialogOpen(w+1,E+(i?1:0)),n?.onNestedDialogClose&&!o&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&o&&n.onNestedDialogClose()}),[i,o,w,E,n]);const F=x.useMemo(()=>T(d),[T,d]),D=x.useMemo(()=>P(d),[P,d]),q=x.useMemo(()=>N(),[N]);t.useSyncedValues({openMethod:f,activeTriggerProps:F,inactiveTriggerProps:D,popupProps:q,floatingRootContext:b,nestedOpenDialogCount:w,nestedOpenDrawerCount:E})}const dde={...W0,modal:Te(e=>e.modal),nested:Te(e=>e.nested),nestedOpenDialogCount:Te(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:Te(e=>e.nestedOpenDrawerCount),disablePointerDismissal:Te(e=>e.disablePointerDismissal),openMethod:Te(e=>e.openMethod),descriptionElementId:Te(e=>e.descriptionElementId),titleElementId:Te(e=>e.titleElementId),viewportElement:Te(e=>e.viewportElement),role:Te(e=>e.role)};class fw extends kg{constructor(n){super(hde(n),{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new ph,onOpenChange:void 0,onOpenChangeComplete:void 0},dde);qt(this,"setOpen",(n,r)=>{if(r.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!n&&r.trigger==null&&this.state.activeTriggerId!=null&&(r.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(n,r),r.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,r);const i={open:n},o=r.trigger?.id??null;(o||n)&&(i.activeTriggerId=o,i.activeTriggerElement=r.trigger??null),this.update(i)})}static useStore(n,r){const i=pr(()=>new fw(r)).current;return n??i}}function hde(e={}){return{...Y0(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}const fO=x.createContext(!1);function p8(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:o,disablePointerDismissal:a=!1,modal:l=!0,actionsRef:u,handle:f,triggerId:d,defaultTriggerId:h=null}=e,g=Us(!0),v=x.useContext(fO),b=!!g,w=fw.useStore(f?.store,{open:r,openProp:n,activeTriggerId:h,triggerIdProp:d,modal:l,disablePointerDismissal:a,nested:b});yg(()=>{n===void 0&&w.state.open===!1&&r===!0&&w.update({open:!0,activeTriggerId:h})}),w.useControlledProp("openProp",n),w.useControlledProp("triggerIdProp",d),w.useSyncedValues({disablePointerDismissal:a,nested:b,modal:l}),w.useContextCallback("onOpenChange",i),w.useContextCallback("onOpenChangeComplete",o);const S=w.useState("payload");h8({store:w,actionsRef:u,parentContext:g?.store.context,isDrawer:v});const E=x.useMemo(()=>({store:w}),[w]);return m.jsx(fO.Provider,{value:!1,children:m.jsx(YT.Provider,{value:E,children:typeof t=="function"?t({payload:S}):t})})}const ZT=x.forwardRef(function(t,n){const{render:r,className:i,style:o,id:a,...l}=t,{store:u}=Us(),f=Br(a);return u.useSyncedValueWithCleanup("titleElementId",f),vt("h2",t,{ref:n,props:[{id:f},l]})}),pde=x.forwardRef(function(t,n){const{render:r,className:i,disabled:o=!1,nativeButton:a=!0,id:l,payload:u,handle:f,style:d,...h}=t,g=Us(!0),v=f?.store??g?.store;if(!v)throw new Error(Xt(79));const b=Br(l),w=v.useState("floatingRootContext"),S=v.useState("isOpenedByTrigger",b),E=x.useRef(null),{registerTrigger:k,isMountedByThisTrigger:O}=q0(b,E,v,{payload:u}),{getButtonProps:j,buttonRef:A}=Zo({disabled:o,native:a}),T=$0(w,{enabled:w!=null}),N=vc([T]),P={disabled:o,open:S},F=v.useState("triggerProps",O);return vt("button",t,{state:P,ref:[A,n,k,E],props:[N.getReferenceProps(),F,{[sT]:"",id:b},h,j],stateAttributesMapping:Q0})});function mde({...e}){return m.jsx(p8,{"data-slot":"sheet",...e})}function gde({...e}){return m.jsx(XT,{"data-slot":"sheet-portal",...e})}function vde({className:e,...t}){return m.jsx(WT,{"data-slot":"sheet-overlay",className:Ne("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",e),...t})}function yde({className:e,children:t,side:n="right",showCloseButton:r=!0,...i}){return m.jsxs(gde,{children:[m.jsx(vde,{}),m.jsxs(GT,{"data-slot":"sheet-content","data-side":n,className:Ne("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",e),...i,children:[t,r&&m.jsxs(sw,{"data-slot":"sheet-close",render:m.jsx(Fe,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[m.jsx(uc,{}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function xde({className:e,...t}){return m.jsx("div",{"data-slot":"sheet-header",className:Ne("flex flex-col gap-0.5 p-4",e),...t})}function bde({className:e,...t}){return m.jsx(ZT,{"data-slot":"sheet-title",className:Ne("font-heading text-base font-medium text-foreground",e),...t})}function wde({className:e,...t}){return m.jsx(s8,{"data-slot":"sheet-description",className:Ne("text-sm text-muted-foreground",e),...t})}const Sde="sidebar_state",Ede=3600*24*7,Cde="16rem",_de="18rem",kde="3rem",Ode="b",m8=x.createContext(null);function dw(){const e=x.useContext(m8);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function jde({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:o,...a}){const l=Nfe(),[u,f]=x.useState(!1),[d,h]=x.useState(e),g=t??d,v=x.useCallback(E=>{const k=typeof E=="function"?E(g):E;n?n(k):h(k),document.cookie=\`\${Sde}=\${k}; path=/; max-age=\${Ede}\`},[n,g]),b=x.useCallback(()=>l?f(E=>!E):v(E=>!E),[l,v,f]);x.useEffect(()=>{const E=k=>{k.key===Ode&&(k.metaKey||k.ctrlKey)&&(k.preventDefault(),b())};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[b]);const w=g?"expanded":"collapsed",S=x.useMemo(()=>({state:w,open:g,setOpen:v,isMobile:l,openMobile:u,setOpenMobile:f,toggleSidebar:b}),[w,g,v,l,u,f,b]);return m.jsx(m8.Provider,{value:S,children:m.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Cde,"--sidebar-width-icon":kde,...i},className:Ne("group/sidebar-wrapper flex h-svh w-full overflow-hidden has-data-[variant=inset]:bg-sidebar",r),...a,children:o})})}function Tde({side:e="left",variant:t="sidebar",collapsible:n="offcanvas",className:r,children:i,dir:o,...a}){const{isMobile:l,state:u,openMobile:f,setOpenMobile:d}=dw();return n==="none"?m.jsx("div",{"data-slot":"sidebar",className:Ne("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",r),...a,children:i}):l?m.jsx(mde,{open:f,onOpenChange:d,...a,children:m.jsxs(yde,{dir:o,"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":_de},side:e,children:[m.jsxs(xde,{className:"sr-only",children:[m.jsx(bde,{children:"Sidebar"}),m.jsx(wde,{children:"Displays the mobile sidebar."})]}),m.jsx("div",{className:"flex h-full w-full flex-col",children:i})]})}):m.jsxs("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":u,"data-collapsible":u==="collapsed"?n:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[m.jsx("div",{"data-slot":"sidebar-gap",className:Ne("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),m.jsx("div",{"data-slot":"sidebar-container","data-side":e,className:Ne("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",r),...a,children:m.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",children:i})})]})}function Ade({className:e,onClick:t,...n}){const{toggleSidebar:r}=dw();return m.jsxs(Fe,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon-sm",className:Ne(e),onClick:i=>{t?.(i),r()},...n,children:[m.jsx(Wue,{}),m.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Nde({className:e,...t}){const{toggleSidebar:n}=dw();return m.jsx("button",{"data-sidebar":"rail","data-slot":"sidebar-rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:n,title:"Toggle Sidebar",className:Ne("absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2","in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})}function Rde({className:e,...t}){return m.jsx("main",{"data-slot":"sidebar-inset",className:Ne("relative flex w-full flex-1 flex-col min-h-0 bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",e),...t})}function Pde({className:e,...t}){return m.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:Ne("flex flex-col gap-2 p-2",e),...t})}function Mde({className:e,...t}){return m.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:Ne("flex flex-col gap-2 p-2",e),...t})}function Ide({className:e,...t}){return m.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:Ne("no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function Dde({className:e,...t}){return m.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:Ne("relative flex w-full min-w-0 flex-col p-2",e),...t})}function Lde({className:e,render:t,...n}){return HT({defaultTagName:"div",props:Mo({className:Ne("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",e)},n),render:t,state:{slot:"sidebar-group-label",sidebar:"group-label"}})}function g8({className:e,...t}){return m.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:Ne("flex w-full min-w-0 flex-col gap-0",e),...t})}function v8({className:e,...t}){return m.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:Ne("group/menu-item relative",e),...t})}const zde=Ag("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function y8({render:e,isActive:t=!1,variant:n="default",size:r="default",tooltip:i,className:o,...a}){const{isMobile:l,state:u}=dw(),f=HT({defaultTagName:"button",props:Mo({className:Ne(zde({variant:n,size:r}),o)},a),render:i?m.jsx(DT,{render:e}):e,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:r,active:t}});return i?(typeof i=="string"&&(i={children:i}),m.jsxs(IT,{children:[f,m.jsx(LT,{side:"right",align:"center",hidden:u!=="collapsed"||l,...i})]})):f}const nz=e=>{let t;const n=new Set,r=(f,d)=>{const h=typeof f=="function"?f(t):f;if(!Object.is(h,t)){const g=t;t=d??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(v=>v(t,g))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>u,subscribe:f=>(n.add(f),()=>n.delete(f))},u=t=e(r,i,l);return l},Fde=(e=>e?nz(e):nz),Bde=e=>e;function $de(e,t=Bde){const n=Ie.useSyncExternalStore(e.subscribe,Ie.useCallback(()=>t(e.getState()),[e,t]),Ie.useCallback(()=>t(e.getInitialState()),[e,t]));return Ie.useDebugValue(n),n}const rz=e=>{const t=Fde(e),n=r=>$de(t,r);return Object.assign(n,t),n},Ude=(e=>e?rz(e):rz);function x8(){const e=window.location.pathname;if(e==="/analytics")return{sessionId:null,settingsOpen:!1,selectedAgentId:null,dashboardOpen:!0};const t=e.match(/^\\/agents\\/(.+)$/);if(t)return{sessionId:null,settingsOpen:!0,selectedAgentId:t[1],dashboardOpen:!1};if(e==="/settings")return{sessionId:null,settingsOpen:!0,selectedAgentId:null,dashboardOpen:!1};const n=e.match(/^\\/playground\\/(.+)$/);if(n)return{sessionId:n[1],settingsOpen:!1,selectedAgentId:null,dashboardOpen:!1};const r=e.match(/^\\/sessions\\/(.+)$/);return r?{sessionId:r[1],settingsOpen:!1,selectedAgentId:null,dashboardOpen:!1}:{sessionId:null,settingsOpen:!1,selectedAgentId:null,dashboardOpen:!1}}const $y=x8(),bn=Ude(e=>({apiKey:window.__MA_API_KEY__||localStorage.getItem("ma-api-key")||"",setApiKey:t=>{localStorage.setItem("ma-api-key",t),e({apiKey:t})},activeSessionId:$y.sessionId,setActiveSessionId:t=>{t?window.history.pushState(null,"",\`/sessions/\${t}\`):window.history.pushState(null,"","/"),e({activeSessionId:t,settingsOpen:!1})},debugOpen:!1,toggleDebug:()=>e(t=>({debugOpen:!t.debugOpen})),selectedAgentId:$y.selectedAgentId,setSelectedAgentId:t=>e({selectedAgentId:t}),settingsOpen:$y.settingsOpen,setSettingsOpen:t=>{if(t)window.history.pushState(null,"","/settings");else{const n=bn.getState().activeSessionId;window.history.pushState(null,"",n?\`/sessions/\${n}\`:"/")}e({settingsOpen:t,dashboardOpen:t?!1:bn.getState().dashboardOpen})},sidebarOpen:!0,setSidebarOpen:t=>e({sidebarOpen:t}),commandOpen:!1,setCommandOpen:t=>e({commandOpen:t}),dashboardOpen:$y.dashboardOpen,setDashboardOpen:t=>{if(t)window.history.pushState(null,"","/analytics");else{const n=bn.getState().activeSessionId;window.history.pushState(null,"",n?\`/sessions/\${n}\`:"/")}e({dashboardOpen:t,settingsOpen:t?!1:bn.getState().settingsOpen})},dashboardWindowMinutes:60,setDashboardWindowMinutes:t=>e({dashboardWindowMinutes:t})}));window.addEventListener("popstate",()=>{const{sessionId:e,settingsOpen:t,selectedAgentId:n,dashboardOpen:r}=x8();bn.setState({activeSessionId:e,settingsOpen:t,selectedAgentId:n,dashboardOpen:r})});const Hde="/v1";class qde extends Error{constructor(t,n){super(\`API error \${t}\`),this.status=t,this.body=n}}async function Xe(e,t={}){const r={"x-api-key":bn.getState().apiKey,...t.headers};t.body&&(r["Content-Type"]="application/json");const i=await fetch(\`\${Hde}\${e}\`,{...t,headers:r});if(!i.ok){const o=await i.json().catch(()=>null);throw new qde(i.status,o)}if(i.status!==204)return i.json()}function Hs(){return Bn({queryKey:["agents"],queryFn:()=>Xe("/agents?limit=50"),select:e=>e.data})}function JT(e){return Bn({queryKey:["agents",e],queryFn:()=>Xe(\`/agents/\${e}\`),enabled:!!e})}function b8(){const e=hn();return Nn({mutationFn:t=>{const n={...t};return t.engine==="claude"&&(n.tools=[{type:"agent_toolset_20260401"}]),Xe("/agents",{method:"POST",body:JSON.stringify(n)})},onSuccess:()=>e.invalidateQueries({queryKey:["agents"]})})}function Ng(){const e=hn();return Nn({mutationFn:({id:t,...n})=>Xe(\`/agents/\${t}\`,{method:"POST",body:JSON.stringify(n)}),onSuccess:()=>e.invalidateQueries({queryKey:["agents"]})})}function Vde(){const e=hn();return Nn({mutationFn:t=>Xe(\`/agents/\${t}\`,{method:"DELETE"}),onSuccess:()=>e.invalidateQueries({queryKey:["agents"]})})}function nf(){return Bn({queryKey:["environments"],queryFn:()=>Xe("/environments?limit=50"),select:e=>e.data})}function w8(){const e=hn();return Nn({mutationFn:({name:t,config:n})=>Xe("/environments",{method:"POST",body:JSON.stringify({name:t,config:{type:"cloud",provider:n?.provider,packages:{}}})}),onSuccess:()=>e.invalidateQueries({queryKey:["environments"]})})}function Kde(){const e=hn();return Nn({mutationFn:t=>Xe(\`/environments/\${t}\`,{method:"DELETE"}),onSuccess:()=>e.invalidateQueries({queryKey:["environments"]})})}function hw(){return Bn({queryKey:["sessions"],queryFn:()=>Xe("/sessions?limit=50&order=desc"),select:e=>e.data})}function yh(e){return Bn({queryKey:["sessions",e],queryFn:()=>Xe(\`/sessions/\${e}\`),enabled:!!e})}function S8(){const e=hn();return Nn({mutationFn:({agent_id:t,environment_id:n,vault_ids:r})=>Xe("/sessions",{method:"POST",body:JSON.stringify({agent:t,environment_id:n,vault_ids:r})}),onSuccess:()=>e.invalidateQueries({queryKey:["sessions"]})})}function Yde({className:e,...t}){return m.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:Ne(e),...t})}function Wde({className:e,...t}){return m.jsx("ol",{"data-slot":"breadcrumb-list",className:Ne("flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground",e),...t})}function Gde({className:e,...t}){return m.jsx("li",{"data-slot":"breadcrumb-item",className:Ne("inline-flex items-center gap-1",e),...t})}function Xde({className:e,...t}){return m.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:Ne("font-normal text-foreground",e),...t})}function eA(){return Bn({queryKey:["whoami"],queryFn:async()=>{try{return await Xe("/whoami")}catch(e){if(e?.status===404)return;throw e}},staleTime:6e4})}function tA(){return Bn({queryKey:["license"],queryFn:async()=>{try{return await Xe("/license")}catch{return{plan:"community",features:[],limits:{maxKeys:20,auditRetentionMs:10080*60*1e3}}}},staleTime:6e4})}const Qde="0.4.15",iz=[{label:"Home",to:"/",icon:Nue,exact:!0},{label:"API Keys",to:"/api-keys",icon:UT}],Zde={label:"Tenants",to:"/tenants",icon:JH},Jde=[{label:"Agents",to:"/agents",icon:QH},{label:"Environments",to:"/environments",icon:iw},{label:"Sessions",to:"/sessions",icon:zue},{label:"Secrets",to:"/secrets",icon:Due},{label:"Files",to:"/files",icon:Oue},{label:"Skills",to:"/skills",icon:mfe},{label:"Memory",to:"/memory",icon:ZH}],ehe=[{label:"Playground",to:"/playground",icon:nw},{label:"Analytics",to:"/analytics",icon:fue},{label:"API Docs",to:"/docs",icon:XH}];function dO({title:e,items:t}){const r=Zu().location.pathname;return m.jsxs(Dde,{children:[m.jsx(Lde,{children:e}),m.jsx(g8,{children:t.map(i=>{const o=i.icon,a=i.exact?r===i.to:r===i.to||r.startsWith(i.to+"/");return m.jsx(v8,{children:m.jsxs(y8,{render:m.jsx(ki,{to:i.to}),isActive:a,children:[m.jsx(o,{className:"size-4"}),m.jsx("span",{children:i.label})]})},i.to)})})]})}function the(){const{data:e}=eA(),{data:t}=tA(),n=t?.features.includes("tenancy"),r=e?.is_global_admin&&n?[...iz,Zde]:iz;return m.jsx(dO,{title:"Overview",items:r})}function nhe(){const{data:e}=eA();if(!e)return null;const t=e.is_global_admin?"global":e.tenant_id??"unscoped";return m.jsxs("div",{className:"flex items-center gap-2 px-2 pt-1 pb-0.5 text-[11px] text-sidebar-foreground/60",children:[m.jsx(JH,{className:"size-3"}),m.jsx("span",{className:"truncate font-mono",children:t})]})}function rhe(){const[e,t]=x.useState(()=>document.documentElement.classList.contains("dark"));return x.useEffect(()=>{e?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")},[e]),m.jsx("button",{onClick:()=>{const n=document.documentElement.classList.toggle("dark");localStorage.setItem("theme",n?"dark":"light"),t(n)},className:"rounded-md p-1.5 text-sidebar-foreground/60 transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","aria-label":"Toggle theme",children:e?m.jsx(xfe,{className:"size-3.5"}):m.jsx(Bue,{className:"size-3.5"})})}function ihe({...e}){return m.jsxs(Tde,{...e,children:[m.jsx(Pde,{children:m.jsx(g8,{children:m.jsx(v8,{children:m.jsxs(y8,{size:"lg",render:m.jsx(ki,{to:"/"}),children:[m.jsx("span",{className:"size-2.5 rounded-full bg-lime-500 shrink-0"}),m.jsx("span",{className:"font-mono text-sm font-semibold tracking-tight",children:"agentstep"})]})})})}),m.jsxs(Ide,{children:[m.jsx(the,{}),m.jsx(dO,{title:"Resources",items:Jde}),m.jsx(dO,{title:"Tools",items:ehe})]}),m.jsxs(Mde,{children:[m.jsx(nhe,{}),m.jsxs("div",{className:"flex items-center justify-between px-2 py-1",children:[m.jsxs("span",{className:"font-mono text-[11px] text-sidebar-foreground/50",children:["v",Qde]}),m.jsx(rhe,{})]})]}),m.jsx(Nde,{})]})}const ohe=Ag("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function an({className:e,variant:t="default",render:n,...r}){return HT({defaultTagName:"span",props:Mo({className:Ne(ohe({variant:t}),e)},r),render:n,state:{slot:"badge",variant:t}})}function eo({className:e,...t}){return m.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:m.jsx("table",{"data-slot":"table",className:Ne("w-full caption-bottom text-sm",e),...t})})}function Jo({className:e,...t}){return m.jsx("thead",{"data-slot":"table-header",className:Ne("[&_tr]:border-b",e),...t})}function to({className:e,...t}){return m.jsx("tbody",{"data-slot":"table-body",className:Ne("[&_tr:last-child]:border-0",e),...t})}function yn({className:e,...t}){return m.jsx("tr",{"data-slot":"table-row",className:Ne("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",e),...t})}function et({className:e,...t}){return m.jsx("th",{"data-slot":"table-head",className:Ne("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",e),...t})}function Ue({className:e,...t}){return m.jsx("td",{"data-slot":"table-cell",className:Ne("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",e),...t})}const E8=x.createContext(void 0);function C8(e){const t=x.useContext(E8);if(t===void 0&&!e)throw new Error(Xt(33));return t}const _8=x.createContext(void 0);function rf(e){const t=x.useContext(_8);if(t===void 0&&!e)throw new Error(Xt(36));return t}const ahe=x.createContext(void 0);function pw(e=!0){const t=x.useContext(ahe);if(t===void 0&&!e)throw new Error(Xt(25));return t}function she(e){const{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:o,typingRef:a,itemRef:l,itemMetadata:u}=e,{events:f}=o.useState("floatingTreeRoot"),d=pw(!0),h=d!==void 0;return x.useMemo(()=>({id:r,role:"menuitem",tabIndex:n?0:-1,onKeyDown(g){g.key===" "&&a?.current&&g.preventDefault()},onMouseMove(g){i&&f.emit("itemhover",{nodeId:i,target:g.currentTarget})},onClick(g){t&&f.emit("close",{domEvent:g,reason:pm})},onMouseUp(g){if(d){const v=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,h&&v&&Math.abs(g.clientX-v.x)<=1&&Math.abs(g.clientY-v.y)<=1||h&&!vU&&g.button===2)return}l.current&&o.context.allowMouseUpTriggerRef.current&&(!h||g.button===2)&&(!u||u.type==="regular-item")&&l.current.click()}}),[t,n,r,f,i,o,a,l,d,h,u])}const lhe={type:"regular-item"};function che(e){const{closeOnClick:t,disabled:n=!1,highlighted:r,id:i,store:o,typingRef:a=o.context.typingRef,nativeButton:l,itemMetadata:u,nodeId:f}=e,d=x.useRef(null),{getButtonProps:h,buttonRef:g}=Zo({disabled:n,focusableWhenDisabled:!0,native:l,composite:!0}),v=she({closeOnClick:t,highlighted:r,id:i,nodeId:f,store:o,typingRef:a,itemRef:d,itemMetadata:u}),b=x.useCallback(S=>Mo(v,{onMouseEnter(){u.type==="submenu-trigger"&&u.setActive()}},S,h),[v,h,u]),w=Po(d,g);return x.useMemo(()=>({getItemProps:b,itemRef:w}),[b,w])}const k8=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function uhe(){return x.useContext(k8)}let O8=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Rg(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:o}=e,{register:a,unregister:l,subscribeMapChange:u,elementsRef:f,labelsRef:d,nextIndexRef:h}=uhe(),g=x.useRef(-1),[v,b]=x.useState(o??(i===O8.GuessFromOrder?()=>{if(g.current===-1){const E=h.current;h.current+=1,g.current=E}return g.current}:-1)),w=x.useRef(null),S=x.useCallback(E=>{if(w.current=E,v!==-1&&E!==null&&(f.current[v]=E,d)){const k=t!==void 0;d.current[v]=k?t:r?.current?.textContent??E.textContent}},[v,f,d,t,r]);return Pe(()=>{if(o!=null)return;const E=w.current;if(E)return a(E,n),()=>{l(E)}},[o,a,l,n]),Pe(()=>{if(o==null)return u(E=>{const k=w.current?E.get(w.current)?.index:null;k!=null&&b(k)})},[o,u,b]),x.useMemo(()=>({ref:S,index:v}),[v,S])}const fhe=x.forwardRef(function(t,n){const{render:r,className:i,id:o,label:a,nativeButton:l=!1,disabled:u=!1,closeOnClick:f=!0,style:d,...h}=t,g=Rg({label:a}),v=C8(!0),b=Br(o),{store:w}=rf(),S=w.useState("isActive",g.index),E=w.useState("itemProps"),{getItemProps:k,itemRef:O}=che({closeOnClick:f,disabled:u,highlighted:S,id:b,store:w,nativeButton:l,nodeId:v?.context.nodeId,itemMetadata:lhe});return vt("div",t,{state:{disabled:u,highlighted:S},props:[E,h,k],ref:[O,n,g.ref]})}),dhe=x.createContext(void 0);function nA(e){return x.useContext(dhe)}const hhe={...yc,...$s},phe=x.forwardRef(function(t,n){const{render:r,className:i,style:o,finalFocus:a,...l}=t,{store:u}=rf(),{side:f,align:d}=C8(),h=nA()!=null,g=u.useState("open"),v=u.useState("transitionStatus"),b=u.useState("popupProps"),w=u.useState("mounted"),S=u.useState("instantType"),E=u.useState("activeTriggerElement"),k=u.useState("parent"),O=u.useState("lastOpenChangeReason"),j=u.useState("rootId"),A=u.useState("floatingRootContext"),T=u.useState("floatingTreeRoot"),N=u.useState("closeDelay"),P=u.useState("activeTriggerElement"),F=k.type==="context-menu";Qo({open:g,ref:u.context.popupRef,onComplete(){g&&u.context.onOpenChangeComplete?.(!0)}}),x.useEffect(()=>{function z(V){u.setOpen(!1,ct(V.reason,V.domEvent))}return T.events.on("close",z),()=>{T.events.off("close",z)}},[T.events,u]);const D=u.useState("hoverEnabled"),q=u.useState("disabled");OT(A,{enabled:D&&!q&&!F&&k.type!=="menubar",closeDelay:N});const L={transitionStatus:v,side:f,align:d,open:g,nested:k.type==="menu",instant:S},U=x.useCallback(z=>{u.set("popupElement",z)},[u]),H=vt("div",t,{state:L,ref:[n,u.context.popupRef,U],stateAttributesMapping:hhe,props:[b,{onKeyDown(z){h&&lw.has(z.key)&&z.stopPropagation()}},Og(v),l,{"data-rootownerid":j}]});let B=k.type===void 0||F;return(E||k.type==="menubar"&&O!==N0)&&(B=!0),m.jsx(B0,{context:A,modal:F,disabled:!w,returnFocus:a===void 0?B:a,initialFocus:k.type!=="menu",restoreFocus:!0,externalTree:k.type!=="menubar"?T:void 0,previousFocusableElement:P,nextFocusableElement:k.type===void 0?u.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:k.type===void 0?u.context.beforeContentFocusGuardRef:void 0,children:H})}),j8=x.createContext(void 0);function mhe(){const e=x.useContext(j8);if(e===void 0)throw new Error(Xt(32));return e}const ghe=x.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,{store:o}=rf();return o.useState("mounted")||r?m.jsx(j8.Provider,{value:r,children:m.jsx(F0,{ref:n,...i})}):null});function Pg(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,o=Le(i),a=x.useRef(0),l=pr(yhe).current,u=pr(vhe).current,[f,d]=x.useState(0),h=x.useRef(f),g=Le((E,k)=>{u.set(E,k??null),h.current+=1,d(h.current)}),v=Le(E=>{u.delete(E),h.current+=1,d(h.current)}),b=x.useMemo(()=>{const E=new Map;return Array.from(u.keys()).filter(O=>O.isConnected).sort(xhe).forEach((O,j)=>{const A=u.get(O)??{};E.set(O,{...A,index:j})}),E},[u,f]);Pe(()=>{if(typeof MutationObserver!="function"||b.size===0)return;const E=new MutationObserver(k=>{const O=new Set,j=A=>O.has(A)?O.delete(A):O.add(A);k.forEach(A=>{A.removedNodes.forEach(j),A.addedNodes.forEach(j)}),O.size===0&&(h.current+=1,d(h.current))});return b.forEach((k,O)=>{O.parentElement&&E.observe(O.parentElement,{childList:!0})}),()=>{E.disconnect()}},[b]),Pe(()=>{h.current===f&&(n.current.length!==b.size&&(n.current.length=b.size),r&&r.current.length!==b.size&&(r.current.length=b.size),a.current=b.size),o(b)},[o,b,n,r,f]),Pe(()=>()=>{n.current=[]},[n]),Pe(()=>()=>{r&&(r.current=[])},[r]);const w=Le(E=>(l.add(E),()=>{l.delete(E)}));Pe(()=>{l.forEach(E=>E(b))},[l,b]);const S=x.useMemo(()=>({register:g,unregister:v,subscribeMapChange:w,elementsRef:n,labelsRef:r,nextIndexRef:a}),[g,v,w,n,r,a]);return m.jsx(k8.Provider,{value:S,children:t})}function vhe(){return new Map}function yhe(){return new Set}function xhe(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const bhe=20;function rA(e,t,n,r){const[i,o]=x.useState(!1);Pe(()=>{if(!e||!t||n==null){o(!1);return}const a=jt(n).documentElement.clientWidth,l=n.offsetWidth;o(a>0&&l>0&&l>=a-bhe)},[e,t,n]),d8(e&&(!t||i),r)}const whe=x.forwardRef(function(t,n){const{anchor:r,positionMethod:i="absolute",className:o,render:a,side:l,align:u,sideOffset:f=0,alignOffset:d=0,collisionBoundary:h="clipping-ancestors",collisionPadding:g=5,arrowPadding:v=5,sticky:b=!1,disableAnchorTracking:w=!1,collisionAvoidance:S=CU,style:E,...k}=t,{store:O}=rf(),j=mhe(),A=pw(!0),T=O.useState("parent"),N=O.useState("floatingRootContext"),P=O.useState("floatingTreeRoot"),F=O.useState("mounted"),D=O.useState("open"),q=O.useState("modal"),L=O.useState("openMethod"),U=O.useState("activeTriggerElement"),H=O.useState("transitionStatus"),B=O.useState("positionerElement"),z=O.useState("instantType"),V=O.useState("hasViewport"),Q=O.useState("lastOpenChangeReason"),G=O.useState("floatingNodeId"),I=O.useState("floatingParentNodeId"),K=N.useState("domReferenceElement"),$=x.useRef(null),R=H0(B,!1,!1);let X=r,W=f,Z=d,oe=u,ie=S;T.type==="context-menu"&&(X=r??T.context?.anchor,oe=oe??"start",!l&&oe!=="center"&&(Z=t.alignOffset??2,W=t.sideOffset??-5));let J=l,se=oe;T.type==="menu"?(J=J??"inline-end",se=se??"start",ie=t.collisionAvoidance??lT):T.type==="menubar"&&(J=J??"bottom",se=se??"start");const xe=T.type==="context-menu",ne=Z0({anchor:X,floatingRootContext:N,positionMethod:A?"fixed":i,mounted:F,side:J,sideOffset:W,align:se,alignOffset:Z,arrowPadding:xe?0:v,collisionBoundary:h,collisionPadding:g,sticky:b,nodeId:G,keepMounted:j,disableAnchorTracking:w,collisionAvoidance:ie,shiftCrossAxis:xe&&!("side"in ie&&ie.side==="flip"),externalTree:P,adaptiveOrigin:V?RT:void 0});x.useEffect(()=>{function _e(de){de.open&&(de.parentNodeId===G&&O.set("hoverEnabled",!1),de.nodeId!==G&&de.parentNodeId===O.select("floatingParentNodeId")&&O.setOpen(!1,ct(sm)))}return P.events.on("menuopenchange",_e),()=>{P.events.off("menuopenchange",_e)}},[O,P.events,G]),x.useEffect(()=>{if(O.select("floatingParentNodeId")==null)return;function _e(de){if(de.open||de.nodeId!==O.select("floatingParentNodeId"))return;const be=de.reason??sm;O.setOpen(!1,ct(be))}return P.events.on("menuopenchange",_e),()=>{P.events.off("menuopenchange",_e)}},[P.events,O]);const ke=Fn();x.useEffect(()=>{D||ke.clear()},[D,ke]),x.useEffect(()=>{function _e(de){if(!(!D||de.nodeId!==O.select("floatingParentNodeId")))if(de.target&&U&&U!==de.target){const be=O.select("closeDelay");be>0?ke.isStarted()||ke.start(be,()=>{O.setOpen(!1,ct(sm))}):O.setOpen(!1,ct(sm))}else ke.clear()}return P.events.on("itemhover",_e),()=>{P.events.off("itemhover",_e)}},[P.events,D,U,O,ke]),x.useEffect(()=>{const _e={open:D,nodeId:G,parentNodeId:I,reason:O.select("lastOpenChangeReason")};P.events.emit("menuopenchange",_e)},[P.events,D,O,G,I]),Pe(()=>{const _e=K,de=$.current;if(_e&&($.current=_e),de&&_e&&_e!==de){O.set("instantType",void 0);const be=new AbortController;return R(()=>{O.set("instantType","trigger-change")},be.signal),()=>{be.abort()}}},[K,R,O]);const Ce={open:D,side:ne.side,align:ne.align,anchorHidden:ne.anchorHidden,nested:T.type==="menu",instant:z},Be=T.type==="menubar"&&T.context.modal;rA(D&&(Be||q&&Q!==or),L==="touch",B,U);const Oe=J0(t,Ce,{styles:ne.positionerStyles,transitionStatus:H,props:k,refs:[n,O.useStateSetter("positionerElement")],hidden:!F,inert:!D}),Re=F&&T.type!=="menu"&&(T.type!=="menubar"&&q&&Q!==or||T.type==="menubar"&&T.context.modal);let je=null;return T.type==="menubar"?je=T.context.contentElement:T.type===void 0&&(je=U),m.jsxs(E8.Provider,{value:ne,children:[Re&&m.jsx(cw,{ref:T.type==="context-menu"||T.type==="nested-context-menu"?T.context.internalBackdropRef:null,inert:jg(!D),cutout:je}),m.jsx(lH,{id:G,children:m.jsx(Pg,{elementsRef:O.context.itemDomElements,labelsRef:O.context.itemLabels,children:Oe})})]})}),She=x.createContext(null);function T8(e){return x.useContext(She)}const Ehe={...W0,disabled:Te(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:Te(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),openMethod:Te(e=>e.openMethod),allowMouseEnter:Te(e=>e.allowMouseEnter),stickIfOpen:Te(e=>e.stickIfOpen),parent:Te(e=>e.parent),rootId:Te(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:Te(e=>e.activeIndex),isActive:Te((e,t)=>e.activeIndex===t),hoverEnabled:Te(e=>e.hoverEnabled),instantType:Te(e=>e.instantType),lastOpenChangeReason:Te(e=>e.openChangeReason),floatingTreeRoot:Te(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:Te(e=>e.floatingNodeId),floatingParentNodeId:Te(e=>e.floatingParentNodeId),itemProps:Te(e=>e.itemProps),closeDelay:Te(e=>e.closeDelay),hasViewport:Te(e=>e.hasViewport),keyboardEventRelay:Te(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class iA extends kg{constructor(n){super({...Che(),...n},{positionerRef:x.createRef(),popupRef:x.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),onOpenChangeComplete:void 0,triggerElements:new ph},Ehe);qt(this,"unsubscribeParentListener",null);this.unsubscribeParentListener=this.observe("parent",r=>{if(this.unsubscribeParentListener?.(),r.type==="menu"){let i=r.store.select("rootId"),o=r.store.select("floatingTreeRoot"),a=r.store.select("keyboardEventRelay");this.unsubscribeParentListener=r.store.subscribe(()=>{const l=r.store.select("rootId"),u=r.store.select("floatingTreeRoot"),f=r.store.select("keyboardEventRelay");i===l&&o===u&&a===f||(i=l,o=u,a=f,this.notifyAll())}),this.context.allowMouseUpTriggerRef=r.store.context.allowMouseUpTriggerRef;return}r.type!==void 0&&(this.context.allowMouseUpTriggerRef=r.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(n,r){this.state.floatingRootContext.context.events.emit("setOpen",{open:n,eventDetails:r})}static useStore(n,r){const i=pr(()=>new iA(r)).current;return n??i}}function Che(){return{...Y0(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new wT,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Wn,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}const _he=x.createContext(void 0);function khe(){return x.useContext(_he)}const Ohe=aT(function(t){const{children:n,open:r,onOpenChange:i,onOpenChangeComplete:o,defaultOpen:a=!1,disabled:l=!1,modal:u,loopFocus:f=!0,orientation:d="vertical",actionsRef:h,closeParentOnEsc:g=!1,handle:v,triggerId:b,defaultTriggerId:w=null,highlightItemOnHover:S=!0}=t,E=pw(!0),k=rf(!0),O=T8(!0),j=khe(),A=x.useMemo(()=>j&&k?{type:"menu",store:k.store}:O?{type:"menubar",context:O}:E&&!k?{type:"context-menu",context:E}:{type:void 0},[E,k,O,j]),T=iA.useStore(v?.store,{open:a,openProp:r,activeTriggerId:w,triggerIdProp:b,parent:A});yg(()=>{r===void 0&&T.state.open===!1&&a===!0&&T.update({open:!0,activeTriggerId:w})}),T.useControlledProp("openProp",r),T.useControlledProp("triggerIdProp",b),T.useContextCallback("onOpenChangeComplete",o);const N=T.useState("floatingTreeRoot"),P=ST(N),F=La();Pe(()=>{E&&!k?T.update({parent:{type:"context-menu",context:E},floatingNodeId:P,floatingParentNodeId:F}):k&&T.update({floatingNodeId:P,floatingParentNodeId:F})},[E,k,P,F,T]);const D=T.useState("open"),q=T.useState("activeTriggerElement"),L=T.useState("positionerElement"),U=T.useState("hoverEnabled"),H=T.useState("disabled"),B=T.useState("lastOpenChangeReason"),z=T.useState("parent"),V=T.useState("activeIndex"),Q=T.useState("payload"),G=T.useState("floatingParentNodeId"),I=x.useRef(null),K=G!=null,{openMethod:$,triggerProps:R}=uw(D);T.useSyncedValues({disabled:l,modal:z.type===void 0?u:void 0,openMethod:$,rootId:Ju()}),V0(T);const{forceUnmount:X}=K0(D,T,()=>{T.update({allowMouseEnter:!1,stickIfOpen:!0})}),W=x.useRef(z.type!=="context-menu"),Z=Fn();x.useEffect(()=>{if(D||(I.current=null),z.type==="context-menu"){if(!D){Z.clear(),W.current=!1;return}Z.start(500,()=>{W.current=!0})}},[Z,D,z.type]),Pe(()=>{!D&&!U&&T.set("hoverEnabled",!0)},[D,U,T]);const oe=x.useRef(!0),ie=Fn(),J=Le((ze,Ke)=>{const tt=Ke.reason;if(D===ze&&Ke.trigger===q&&B===tt||(Ke.preventUnmountOnClose=()=>{T.set("preventUnmountingOnClose",!0)},!ze&&Ke.trigger==null&&(Ke.trigger=q??void 0),i?.(ze,Ke),Ke.isCanceled))return;T.state.floatingRootContext.dispatchOpenChange(ze,Ke);const Tt=Ke.event;if(ze===!1&&Tt?.type==="click"&&Tt.pointerType==="touch"&&!oe.current)return;if(!ze&&V!==null){const zt=T.context.itemDomElements.current[V];queueMicrotask(()=>{zt?.setAttribute("tabindex","-1")})}ze&&tt===vd?(oe.current=!1,ie.start(300,()=>{oe.current=!0})):(oe.current=!0,ie.clear());const yt=(tt===ja||tt===pm)&&Tt.detail===0&&Tt?.isTrusted,Wt=!ze&&(tt===wg||tt==null),nt={open:ze,openChangeReason:tt};I.current=Ke.event??null;const Rt=Ke.trigger?.id??null;(Rt||ze)&&(nt.activeTriggerId=Rt,nt.activeTriggerElement=Ke.trigger??null),T.update(nt),z.type==="menubar"&&(tt===vd||tt===lc||tt===or||tt===Px||tt===sm)?T.set("instantType","group"):yt||Wt?T.set("instantType",yt?"click":"dismiss"):T.set("instantType",void 0)}),se=x.useCallback(ze=>{const Ke=ct(ze);return Ke.preventUnmountOnClose=()=>{T.set("preventUnmountingOnClose",!0)},Ke},[T]),xe=x.useCallback(()=>{T.setOpen(!1,se(R0))},[T,se]);x.useImperativeHandle(h,()=>({unmount:X,close:xe}),[X,xe]);let ne;z.type==="context-menu"&&(ne=z.context),x.useImperativeHandle(ne?.positionerRef,()=>L,[L]),x.useImperativeHandle(ne?.actionsRef,()=>({setOpen:J}),[J]);const ke=G0({popupStore:T,onOpenChange:J}),Ce=ke.context.events;x.useEffect(()=>{const ze=({open:Ke,eventDetails:tt})=>J(Ke,tt);return Ce.on("setOpen",ze),()=>{Ce?.off("setOpen",ze)}},[Ce,J]);const Be=_g(ke,{enabled:!H,bubbles:{escapeKey:g&&z.type==="menu"},outsidePress(){return z.type!=="context-menu"||I.current?.type==="contextmenu"?!0:W.current},externalTree:K?N:void 0}),Ee=TT(ke,{role:"menu"}),Oe=ef(),Re=x.useCallback(ze=>{T.select("activeIndex")!==ze&&T.set("activeIndex",ze)},[T]),je=kH(ke,{enabled:!H,listRef:T.context.itemDomElements,activeIndex:V,nested:z.type!==void 0,loopFocus:f,orientation:d,parentOrientation:z.type==="menubar"?z.context.orientation:void 0,rtl:Oe==="rtl",disabledIndices:sc,onNavigate:Re,openOnArrowKeyDown:z.type!=="context-menu",externalTree:K?N:void 0,focusItemOnHover:S}),_e=x.useCallback(ze=>{T.context.typingRef.current=ze},[T]),de=OH(ke,{listRef:T.context.itemLabels,elementsRef:T.context.itemDomElements,activeIndex:V,resetMs:Ooe,onMatch:ze=>{D&&ze!==V&&T.set("activeIndex",ze)},onTypingChange:_e}),{getReferenceProps:be,getFloatingProps:ve,getItemProps:pe,getTriggerProps:Ae}=vc([Be,Ee,je,de]),ae=x.useMemo(()=>{const ze=Mo(be(),{onMouseMove(){T.set("allowMouseEnter",!0)}},R);return delete ze.role,ze},[be,T,R]),me=x.useMemo(()=>{const ze=Ae();if(!ze)return ze;const Ke=Mo(ze,R);return delete Ke.role,delete Ke["aria-controls"],Ke},[Ae,R]),De=x.useMemo(()=>ve({onMouseMove(){T.set("allowMouseEnter",!0),z.type==="menu"&&T.set("hoverEnabled",!1)},onClick(){T.select("hoverEnabled")&&T.set("hoverEnabled",!1)},onKeyDown(ze){const Ke=T.select("keyboardEventRelay");Ke&&!ze.isPropagationStopped()&&Ke(ze)}}),[ve,z.type,T]),$e=x.useMemo(()=>pe(),[pe]);T.useSyncedValues({floatingRootContext:ke,activeTriggerProps:ae,inactiveTriggerProps:me,popupProps:De,itemProps:$e});const Ve=x.useMemo(()=>({store:T,parent:A}),[T,A]),dt=m.jsx(_8.Provider,{value:Ve,children:typeof n=="function"?n({payload:Q}):n});return z.type===void 0||z.type==="context-menu"?m.jsx(cH,{externalTree:N,children:dt}):dt});function A8(e){const t=e.getBoundingClientRect(),n=In(e),r=n.getComputedStyle(e,"::before"),i=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||i.content!=="none"))return t;const a=parseFloat(r.width)||0,l=parseFloat(r.height)||0,u=parseFloat(i.width)||0,f=parseFloat(i.height)||0,d=Math.max(t.width,a,u),h=Math.max(t.height,l,f),g=d-t.width,v=h-t.height;return{left:t.left-g/2,right:t.right+g/2,top:t.top-v/2,bottom:t.bottom+v/2}}function N8(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=qT(),{ref:i,index:o}=Rg(e),a=n===o,l=x.useRef(null),u=Po(i,l);return{compositeProps:x.useMemo(()=>({tabIndex:a?0:-1,onFocus(){r(o)},onMouseMove(){const d=l.current;if(!t||!d)return;const h=d.hasAttribute("disabled")||d.ariaDisabled==="true";!a&&!h&&d.focus()}}),[a,r,o,t]),compositeRef:u,index:o}}function jhe(e){const{render:t,className:n,style:r,state:i=Wn,props:o=sc,refs:a=sc,metadata:l,stateAttributesMapping:u,tag:f="div",...d}=e,{compositeProps:h,compositeRef:g}=N8({metadata:l});return vt(f,e,{state:i,ref:[...a,g],props:[h,...o,d],stateAttributesMapping:u})}function R8(e){if(fn(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!wa(e))return R8(Ta(e))}function P8(e,t){const n=x.useRef(null),r=Le(o=>{Fr.flushSync(()=>{e.setOpen(!1,ct(lc,o.nativeEvent,o.currentTarget))}),uae(n.current)?.focus()}),i=Le(o=>{const a=e.select("positionerElement");if(a&&yd(o,a))e.context.beforeContentFocusGuardRef.current?.focus();else{Fr.flushSync(()=>{e.setOpen(!1,ct(lc,o.nativeEvent,o.currentTarget))});let l=cae(e.context.triggerFocusTargetRef.current||t.current);for(;l!==null&<(a,l);){const u=l;if(l=vT(l),l===u)break}l?.focus()}});return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function The(e){const{enabled:t=!0,mouseDownAction:n,open:r}=e,i=x.useRef(!1);return x.useMemo(()=>t?{onMouseDown:o=>{(n==="open"&&!r||n==="close"&&r)&&(i.current=!0,jt(o.currentTarget).addEventListener("click",()=>{i.current=!1},{once:!0}))},onClick:o=>{i.current&&(i.current=!1,o.preventBaseUIHandler())}}:Wn,[t,n,r])}const Uy=2,Ahe=fU(function(t,n){const{render:r,className:i,disabled:o=!1,nativeButton:a=!0,id:l,openOnHover:u,delay:f=100,closeDelay:d=0,handle:h,payload:g,style:v,...b}=t,w=rf(!0),S=h?.store??w?.store;if(!S)throw new Error(Xt(85));const E=Br(l),k=S.useState("isTriggerActive",E),O=S.useState("floatingRootContext"),j=S.useState("isOpenedByTrigger",E),A=x.useRef(null),T=Rhe(),N=qT(!0),P=gc(),F=x.useMemo(()=>P??new wT,[P]),D=ST(F),q=La(),{registerTrigger:L,isMountedByThisTrigger:U}=q0(E,A,S,{payload:g,closeDelay:d,parent:T,floatingTreeRoot:F,floatingNodeId:D,floatingParentNodeId:q,keyboardEventRelay:N?.relayKeyboardEvent}),H=T.type==="menubar",B=S.useState("disabled"),z=o||B||H&&T.context.disabled,{getButtonProps:V,buttonRef:Q}=Zo({disabled:z,native:a});x.useEffect(()=>{!j&&T.type===void 0&&(S.context.allowMouseUpTriggerRef.current=!1)},[S,j,T.type]);const G=x.useRef(null),I=Fn(),K=Le(Re=>{if(!G.current)return;I.clear(),S.context.allowMouseUpTriggerRef.current=!1;const je=Re.target;if(lt(G.current,je)||lt(S.select("positionerElement"),je)||je===G.current||je!=null&&R8(je)===S.select("rootId"))return;const _e=A8(G.current);Re.clientX>=_e.left-Uy&&Re.clientX<=_e.right+Uy&&Re.clientY>=_e.top-Uy&&Re.clientY<=_e.bottom+Uy||F.events.emit("close",{domEvent:Re,reason:_U})});x.useEffect(()=>{j&&S.select("lastOpenChangeReason")===or&&jt(G.current).addEventListener("mouseup",K,{once:!0})},[j,K,S]);const $=H&&T.context.hasSubmenuOpen,X=jT(O,{enabled:(u??$)&&!z&&T.type!=="context-menu"&&(!H||$&&!U),handleClose:AT({blockPointerEvents:!H}),mouseOnly:!0,move:!1,restMs:T.type===void 0?f:void 0,delay:{close:d},triggerElementRef:A,externalTree:F,isActiveTrigger:k,isClosing:()=>S.select("transitionStatus")==="ending"}),W=Nhe(j,S.select("lastOpenChangeReason")),Z=$0(O,{enabled:!z&&T.type!=="context-menu",event:j&&H?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:T.type===void 0?W:!1}),oe=EH(O,{enabled:!z&&$}),ie=The({open:j,enabled:H,mouseDownAction:"open"}),J=vc([Z,oe]),se={disabled:z,open:j},xe=S.useState("triggerProps",U),ne=[G,n,Q,L,A],ke=[J.getReferenceProps(),X??Wn,xe,{"aria-haspopup":"menu",id:E,onMouseDown:Re=>{if(S.select("open"))return;I.start(200,()=>{S.context.allowMouseUpTriggerRef.current=!0}),jt(Re.currentTarget).addEventListener("mouseup",K,{once:!0})}},H?{role:"menuitem"}:{},ie,b,V],{preFocusGuardRef:Ce,handlePreFocusGuardFocus:Be,handleFocusTargetFocus:Ee}=P8(S,A),Oe=vt("button",t,{enabled:!H,stateAttributesMapping:db,state:se,ref:ne,props:ke});return H?m.jsx(jhe,{tag:"button",render:r,className:i,style:v,state:se,refs:ne,props:ke,stateAttributesMapping:db}):j?m.jsxs(x.Fragment,{children:[m.jsx(cc,{ref:Ce,onFocus:Be},\`\${E}-pre-focus-guard\`),m.jsx(x.Fragment,{children:Oe},E),m.jsx(cc,{ref:S.context.triggerFocusTargetRef,onFocus:Ee},\`\${E}-post-focus-guard\`)]}):m.jsx(x.Fragment,{children:Oe},E)});function Nhe(e,t){const n=Fn(),[r,i]=x.useState(!1);return Pe(()=>{e&&t==="trigger-hover"?(i(!0),n.start(EU,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function Rhe(){const e=pw(!0),t=rf(!0),n=T8();return x.useMemo(()=>n?{type:"menubar",context:n}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,n])}function hO(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function M8({...e}){return m.jsx(Ohe,{"data-slot":"dropdown-menu",...e})}function I8({...e}){return m.jsx(Ahe,{"data-slot":"dropdown-menu-trigger",...e})}function D8({align:e="start",alignOffset:t=0,side:n="bottom",sideOffset:r=4,className:i,...o}){return m.jsx(ghe,{children:m.jsx(whe,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:n,sideOffset:r,children:m.jsx(phe,{"data-slot":"dropdown-menu-content",className:Ne("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",i),...o})})})}function pO({className:e,inset:t,variant:n="default",...r}){return m.jsx(fhe,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:Ne("group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",e),...r})}function Phe(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:o,actionsRef:a,handle:l,triggerId:u,defaultTriggerId:f=null}=e,d=Us(!0),h=!!d,g=fw.useStore(l?.store,{open:r,openProp:n,activeTriggerId:f,triggerIdProp:u,modal:!0,disablePointerDismissal:!0,nested:h,role:"alertdialog"});g.useControlledProp("openProp",n),g.useControlledProp("triggerIdProp",u),g.useSyncedValue("nested",h),g.useContextCallback("onOpenChange",i),g.useContextCallback("onOpenChangeComplete",o);const v=g.useState("payload");h8({store:g,actionsRef:a,parentContext:d?.store.context,isDrawer:!1});const b=x.useMemo(()=>({store:g}),[g]);return m.jsx(fO.Provider,{value:!1,children:m.jsx(YT.Provider,{value:b,children:typeof t=="function"?t({payload:v}):t})})}function xh({...e}){return m.jsx(Phe,{"data-slot":"alert-dialog",...e})}function Mhe({...e}){return m.jsx(XT,{"data-slot":"alert-dialog-portal",...e})}function Ihe({className:e,...t}){return m.jsx(WT,{"data-slot":"alert-dialog-overlay",className:Ne("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function bh({className:e,size:t="default",...n}){return m.jsxs(Mhe,{children:[m.jsx(Ihe,{}),m.jsx(GT,{"data-slot":"alert-dialog-content","data-size":t,className:Ne("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...n})]})}function wh({className:e,...t}){return m.jsx("div",{"data-slot":"alert-dialog-header",className:Ne("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...t})}function Sh({className:e,...t}){return m.jsx("div",{"data-slot":"alert-dialog-footer",className:Ne("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t border-border/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...t})}function Eh({className:e,...t}){return m.jsx(ZT,{"data-slot":"alert-dialog-title",className:Ne("font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...t})}function Ch({className:e,...t}){return m.jsx(s8,{"data-slot":"alert-dialog-description",className:Ne("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function _h({className:e,...t}){return m.jsx(Fe,{"data-slot":"alert-dialog-action",className:Ne(e),...t})}function kh({className:e,variant:t="outline",size:n="default",...r}){return m.jsx(sw,{"data-slot":"alert-dialog-cancel",className:Ne(e),render:m.jsx(Fe,{variant:t,size:n}),...r})}function ea({...e}){return m.jsx(p8,{"data-slot":"dialog",...e})}function Dhe({...e}){return m.jsx(pde,{"data-slot":"dialog-trigger",...e})}function Lhe({...e}){return m.jsx(XT,{"data-slot":"dialog-portal",...e})}function zhe({className:e,...t}){return m.jsx(WT,{"data-slot":"dialog-overlay",className:Ne("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function za({className:e,children:t,showCloseButton:n=!0,...r}){return m.jsxs(Lhe,{children:[m.jsx(zhe,{}),m.jsxs(GT,{"data-slot":"dialog-content",className:Ne("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...r,children:[t,n&&m.jsxs(sw,{"data-slot":"dialog-close",render:m.jsx(Fe,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[m.jsx(uc,{}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Fa({className:e,...t}){return m.jsx("div",{"data-slot":"dialog-header",className:Ne("flex flex-col gap-2",e),...t})}function mb({className:e,showCloseButton:t=!1,children:n,...r}){return m.jsxs("div",{"data-slot":"dialog-footer",className:Ne("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t border-border/50 p-4 sm:flex-row sm:justify-end",e),...r,children:[n,t&&m.jsx(sw,{render:m.jsx(Fe,{variant:"outline"}),children:"Close"})]})}function Ba({className:e,...t}){return m.jsx(ZT,{"data-slot":"dialog-title",className:Ne("font-heading text-base leading-none font-medium",e),...t})}function wt({className:e,...t}){return m.jsx("label",{"data-slot":"label",className:Ne("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}const L8=x.createContext(null),z8=x.createContext(null);function $a(){const e=x.useContext(L8);if(e===null)throw new Error(Xt(60));return e}function F8(){const e=x.useContext(z8);if(e===null)throw new Error(Xt(61));return e}const Fhe=(e,t)=>Object.is(e,t);function Wd(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Bhe(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:Wd(t,r,n))}function mm(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:Wd(r,t,n))}function $he(e,t,n){return e.filter(r=>!Wd(t,r,n))}function mO(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function B8(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Uhe(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(B8(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function $8(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return mO(e)}function cd(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?mO(e.value):mO(e)}function U8(e,t,n){function r(){return $8(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){const i=t,o=B8(i)?i.flatMap(a=>a.items):i;if(e==null||typeof e!="object"){const a=o.find(l=>l.value===e);return a&&a.label!=null?a.label:r()}if("value"in e){const a=o.find(l=>l&&l.value===e.value);if(a&&a.label!=null)return a.label}}return r()}function Hhe(e,t,n){return e.reduce((r,i,o)=>(o>0&&r.push(", "),r.push(m.jsx(x.Fragment,{children:U8(i,t,n)},o)),r),[])}const mt={id:Te(e=>e.id),labelId:Te(e=>e.labelId),modal:Te(e=>e.modal),multiple:Te(e=>e.multiple),items:Te(e=>e.items),itemToStringLabel:Te(e=>e.itemToStringLabel),itemToStringValue:Te(e=>e.itemToStringValue),isItemEqualToValue:Te(e=>e.isItemEqualToValue),value:Te(e=>e.value),hasSelectedValue:Te(e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:cd(t,r)!==""}),hasNullItemLabel:Te((e,t)=>t?Uhe(e.items):!1),open:Te(e=>e.open),mounted:Te(e=>e.mounted),forceMount:Te(e=>e.forceMount),transitionStatus:Te(e=>e.transitionStatus),openMethod:Te(e=>e.openMethod),activeIndex:Te(e=>e.activeIndex),selectedIndex:Te(e=>e.selectedIndex),isActive:Te((e,t)=>e.activeIndex===t),isSelected:Te((e,t,n)=>{const r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(o=>Wd(n,o,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:Wd(n,i,r)}),isSelectedByFocus:Te((e,t)=>e.selectedIndex===t),popupProps:Te(e=>e.popupProps),triggerProps:Te(e=>e.triggerProps),triggerElement:Te(e=>e.triggerElement),positionerElement:Te(e=>e.positionerElement),listElement:Te(e=>e.listElement),scrollUpArrowVisible:Te(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Te(e=>e.scrollDownArrowVisible),hasScrollArrows:Te(e=>e.hasScrollArrows)};function va(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const Uo=1;function oA(e,t){return Math.max(0,e-t)}function Gd(e,t){if(t<=0)return 0;const n=va(e,0,t),r=n,i=t-n,o=r<=Uo,a=i<=Uo;return o&&a?r<=i?0:t:o?0:a?t:n}function qhe(e){const{id:t,value:n,defaultValue:r=null,onValueChange:i,open:o,defaultOpen:a=!1,onOpenChange:l,name:u,form:f,autoComplete:d,disabled:h=!1,readOnly:g=!1,required:v=!1,modal:b=!0,actionsRef:w,inputRef:S,onOpenChangeComplete:E,items:k,multiple:O=!1,itemToStringLabel:j,itemToStringValue:A,isItemEqualToValue:T=Fhe,highlightItemOnHover:N=!0,children:P}=e,{clearErrors:F}=a8(),{setDirty:D,setTouched:q,setFocused:L,shouldValidateOnChange:U,validityData:H,setFilled:B,name:z,disabled:V,validation:Q,validationMode:G}=mh(),I=aw({id:t}),K=V||h,$=z??u,[R,X]=Lu({controlled:n,default:O?r??sc:r,name:"Select",state:"value"}),[W,Z]=Lu({controlled:o,default:a,name:"Select",state:"open"}),oe=x.useRef([]),ie=x.useRef([]),J=x.useRef(null),se=x.useRef(null),xe=x.useRef(0),ne=x.useRef(null),ke=x.useRef([]),Ce=x.useRef(!1),Be=x.useRef(!1),Ee=x.useRef(null),Oe=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),Re=x.useRef(!1),{mounted:je,setMounted:_e,transitionStatus:de}=hh(W),{openMethod:be,triggerProps:ve}=uw(W),pe=pr(()=>new wH({id:I,labelId:void 0,modal:b,multiple:O,itemToStringLabel:j,itemToStringValue:A,isItemEqualToValue:T,value:R,open:W,mounted:je,transitionStatus:de,items:k,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Ae=gt(pe,mt.activeIndex),ae=gt(pe,mt.selectedIndex),me=gt(pe,mt.triggerElement),De=gt(pe,mt.positionerElement),$e=_le(be),Ve=be??$e,dt=x.useMemo(()=>O&&Array.isArray(R)&&R.length===0?"":cd(R,A),[O,R,A]),ze=x.useMemo(()=>O&&Array.isArray(R)?R.map(Ot=>cd(Ot,A)):cd(R,A),[O,R,A]),Ke=ar(pe.state.triggerElement),tt=Le(()=>ze);KT(Ke,{id:I,value:R,getValue:tt});const Tt=x.useRef(R);Pe(()=>{R!==Tt.current&&pe.set("forceMount",!0)},[pe,R]),Pe(()=>{B(O?Array.isArray(R)&&R.length>0:R!=null)},[O,R,B]),Pe(function(){if(W)return;const Pt=ke.current;if(O){const Li=Array.isArray(R)?R:[];if(Li.length===0){pe.set("selectedIndex",null);return}const Jn=Li[Li.length-1],zn=mm(Pt,Jn,T);pe.set("selectedIndex",zn===-1?null:zn);return}const ti=mm(Pt,R,T);pe.set("selectedIndex",ti===-1?null:ti)},[O,W,R,ke,T,pe]),QT(R,()=>{F($),D(R!==H.initialValue),U()?Q.commit(R):Q.commit(R,!0)});const yt=Le((Ot,Pt)=>{if(l?.(Ot,Pt),!Pt.isCanceled&&(Z(Ot),!Ot&&(Pt.reason===lc||Pt.reason===N0)&&(q(!0),L(!1),G==="onBlur"&&Q.commit(R)),!Ot&&pe.state.activeIndex!==null)){const ti=oe.current[pe.state.activeIndex];queueMicrotask(()=>{ti?.setAttribute("tabindex","-1")})}}),Wt=Le(()=>{_e(!1),pe.update({activeIndex:null,openMethod:null}),E?.(!1)});Qo({enabled:!w,open:W,ref:J,onComplete(){W||Wt()}}),x.useImperativeHandle(w,()=>({unmount:Wt}),[Wt]);const nt=Le((Ot,Pt)=>{i?.(Ot,Pt),!Pt.isCanceled&&X(Ot)}),Rt=Le(()=>{const Ot=pe.state.listElement||J.current;if(!Ot)return;const Pt=oA(Ot.scrollHeight,Ot.clientHeight),ti=Gd(Ot.scrollTop,Pt),Li=ti>0,Jn=ti<Pt;pe.state.scrollUpArrowVisible!==Li&&pe.set("scrollUpArrowVisible",Li),pe.state.scrollDownArrowVisible!==Jn&&pe.set("scrollDownArrowVisible",Jn)}),zt=SH({open:W,onOpenChange:yt,elements:{reference:me,floating:De}}),Gt=$0(zt,{enabled:!g&&!K,event:"mousedown"}),Dn=_g(zt,{bubbles:!1}),Qt=kH(zt,{enabled:!g&&!K,listRef:oe,activeIndex:Ae,selectedIndex:ae,disabledIndices:sc,onNavigate(Ot){Ot===null&&!W||pe.set("activeIndex",Ot)},focusItemOnHover:N}),Ze=OH(zt,{enabled:!g&&!K&&(W||!O),listRef:ie,activeIndex:Ae,selectedIndex:ae,onMatch(Ot){W?pe.set("activeIndex",Ot):nt(ke.current[Ot],ct("none"))},onTypingChange(Ot){Ce.current=Ot}}),{getReferenceProps:At,getFloatingProps:Ft,getItemProps:ht}=vc([Gt,Dn,Qt,Ze]),En=x.useMemo(()=>Mo(At(),ve,I?{id:I}:Wn),[At,ve,I]);yg(()=>{pe.update({popupProps:Ft(),triggerProps:En})}),Pe(()=>{pe.update({id:I,modal:b,multiple:O,value:R,open:W,mounted:je,transitionStatus:de,popupProps:Ft(),triggerProps:En,items:k,itemToStringLabel:j,itemToStringValue:A,isItemEqualToValue:T,openMethod:Ve})},[pe,I,b,O,R,W,je,de,Ft,En,k,j,A,T,Ve]);const Bt=x.useMemo(()=>({store:pe,name:$,required:v,disabled:K,readOnly:g,multiple:O,itemToStringLabel:j,itemToStringValue:A,highlightItemOnHover:N,setValue:nt,setOpen:yt,listRef:oe,popupRef:J,scrollHandlerRef:se,handleScrollArrowVisibility:Rt,scrollArrowsMountedCountRef:xe,getItemProps:ht,events:zt.context.events,valueRef:ne,valuesRef:ke,labelsRef:ie,typingRef:Ce,selectionRef:Oe,selectedItemTextRef:Ee,validation:Q,onOpenChangeComplete:E,keyboardActiveRef:Be,alignItemWithTriggerActiveRef:Re,initialValueRef:Tt}),[pe,$,v,K,g,O,j,A,N,nt,yt,ht,zt.context.events,Q,E,Rt]),rn=Po(S,Q.inputRef),vr=O&&Array.isArray(R)&&R.length>0,Ln=O?void 0:$,Zn=x.useMemo(()=>!O||!Array.isArray(R)||!$?null:R.map(Ot=>{const Pt=cd(Ot,A);return m.jsx("input",{type:"hidden",form:f,name:$,value:Pt},Pt)}),[O,R,f,$,A]);return m.jsx(L8.Provider,{value:Bt,children:m.jsxs(z8.Provider,{value:zt,children:[P,m.jsx("input",{...Q.getInputValidationProps({onFocus(){pe.state.triggerElement?.focus({focusVisible:!0})},onChange(Ot){if(Ot.nativeEvent.defaultPrevented)return;const Pt=Ot.currentTarget.value,ti=ct(Wo,Ot.nativeEvent);function Li(){if(O)return;const Jn=ke.current.find(zn=>cd(zn,A).toLowerCase()===Pt.toLowerCase()||$8(zn,j).toLowerCase()===Pt.toLowerCase());Jn!=null&&(D(Jn!==H.initialValue),nt(Jn,ti),U()&&Q.commit(Jn))}pe.set("forceMount",!0),queueMicrotask(Li)}}),id:I&&Ln==null?\`\${I}-hidden-input\`:void 0,form:f,name:Ln,autoComplete:d,value:dt,disabled:K,required:v&&!vr,readOnly:g,ref:rn,style:$?NU:fT,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Zn]})})}function Vhe(e,t){return e??t}const Hy=2,Khe=400,oz=200,Yhe={...db,...VT,value:()=>null},Whe=x.forwardRef(function(t,n){const{render:r,className:i,id:o,disabled:a=!1,nativeButton:l=!0,style:u,...f}=t,{setTouched:d,setFocused:h,validationMode:g,state:v,disabled:b}=mh(),{labelId:w}=ow(),{store:S,setOpen:E,selectionRef:k,validation:O,readOnly:j,required:A,alignItemWithTriggerActiveRef:T,disabled:N,keyboardActiveRef:P}=$a(),F=b||N||a,D=gt(S,mt.open),q=gt(S,mt.value),L=gt(S,mt.triggerProps),U=gt(S,mt.positionerElement),H=gt(S,mt.listElement),B=gt(S,mt.id),z=gt(S,mt.labelId),V=gt(S,mt.hasSelectedValue),Q=!V&&D,G=gt(S,mt.hasNullItemLabel,Q),I=o??B,K=Vhe(w,z);aw({id:I});const $=ar(U),R=x.useRef(null),{getButtonProps:X,buttonRef:W}=Zo({disabled:F,native:l}),Z=Le(Be=>{S.set("triggerElement",Be)}),oe=Po(n,R,W,Z),ie=Fn(),J=Fn(),se=Fn(),xe=Fn();x.useEffect(()=>{if(D)return!(V||G)?se.start(Khe,()=>{k.current.allowUnselectedMouseUp=!0,k.current.allowSelectedMouseUp=!0}):xe.start(oz,()=>{k.current.allowUnselectedMouseUp=!0,se.start(oz,()=>{k.current.allowSelectedMouseUp=!0})}),()=>{se.clear(),xe.clear()};k.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},J.clear()},[D,V,G,k,J,se,xe]);const ne=x.useMemo(()=>H?.id??Mm(U)?.id,[H,U]),ke=Mo(L,{id:I,role:"combobox","aria-expanded":D?"true":"false","aria-haspopup":"listbox","aria-controls":D?ne:void 0,"aria-labelledby":K,"aria-readonly":j||void 0,"aria-required":A||void 0,tabIndex:F?-1:0,ref:oe,onFocus(Be){h(!0),D&&T.current&&E(!1,ct(Wo,Be.nativeEvent)),ie.start(0,()=>{S.set("forceMount",!0)})},onBlur(Be){lt(U,Be.relatedTarget)||(d(!0),h(!1),g==="onBlur"&&O.commit(q))},onPointerMove(){P.current=!1},onKeyDown(){P.current=!0},onMouseDown(Be){if(D)return;const Ee=jt(Be.currentTarget);function Oe(Re){if(!R.current)return;const je=Re.target;if(lt(R.current,je)||lt($.current,je)||je===R.current)return;const _e=A8(R.current);Re.clientX>=_e.left-Hy&&Re.clientX<=_e.right+Hy&&Re.clientY>=_e.top-Hy&&Re.clientY<=_e.bottom+Hy||E(!1,ct(_U,Re))}J.start(0,()=>{Ee.addEventListener("mouseup",Oe,{once:!0})})}},O.getValidationProps,f,X);ke.role="combobox";const Ce={...v,open:D,disabled:F,value:q,readOnly:j,placeholder:!V};return vt("button",t,{ref:[n,R],state:Ce,stateAttributesMapping:Yhe,props:ke})}),Ghe={value:()=>null},Xhe=x.forwardRef(function(t,n){const{className:r,render:i,children:o,placeholder:a,style:l,...u}=t,{store:f,valueRef:d}=$a(),h=gt(f,mt.value),g=gt(f,mt.items),v=gt(f,mt.itemToStringLabel),b=gt(f,mt.hasSelectedValue),w=!b&&a!=null&&o==null,S=gt(f,mt.hasNullItemLabel,w),E={value:h,placeholder:!b};let k=null;return typeof o=="function"?k=o(h):o!=null?k=o:!b&&a!=null&&!S?k=a:Array.isArray(h)?k=Hhe(h,g,v):k=U8(h,g,v),vt("span",t,{state:E,ref:[n,d],props:[{children:k},u],stateAttributesMapping:Ghe})}),Qhe=x.forwardRef(function(t,n){const{className:r,render:i,style:o,...a}=t,{store:l}=$a(),f={open:gt(l,mt.open)};return vt("span",t,{state:f,ref:n,props:[{"aria-hidden":!0,children:"\u25BC"},a],stateAttributesMapping:Q0})}),Zhe=x.createContext(void 0),Jhe=x.forwardRef(function(t,n){const{store:r}=$a(),i=gt(r,mt.mounted),o=gt(r,mt.forceMount);return i||o?m.jsx(Zhe.Provider,{value:!0,children:m.jsx(F0,{ref:n,...t})}):null}),H8=x.createContext(void 0);function aA(){const e=x.useContext(H8);if(!e)throw new Error(Xt(59));return e}function gb(e,t){e&&Object.assign(e.style,t)}const q8={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},epe={position:"fixed"},tpe=x.forwardRef(function(t,n){const{anchor:r,positionMethod:i="absolute",className:o,render:a,side:l="bottom",align:u="center",sideOffset:f=0,alignOffset:d=0,collisionBoundary:h="clipping-ancestors",collisionPadding:g,arrowPadding:v=5,sticky:b=!1,disableAnchorTracking:w,alignItemWithTrigger:S=!0,collisionAvoidance:E=CU,style:k,...O}=t,{store:j,listRef:A,labelsRef:T,alignItemWithTriggerActiveRef:N,selectedItemTextRef:P,valuesRef:F,initialValueRef:D,popupRef:q,setValue:L}=$a(),U=F8(),H=gt(j,mt.open),B=gt(j,mt.mounted),z=gt(j,mt.modal),V=gt(j,mt.value),Q=gt(j,mt.openMethod),G=gt(j,mt.positionerElement),I=gt(j,mt.triggerElement),K=gt(j,mt.isItemEqualToValue),$=gt(j,mt.transitionStatus),R=x.useRef(null),X=x.useRef(null),[W,Z]=x.useState(S),oe=B&&W&&Q!=="touch";!B&&W!==S&&Z(S),Pe(()=>{B||(mt.scrollUpArrowVisible(j.state)&&j.set("scrollUpArrowVisible",!1),mt.scrollDownArrowVisible(j.state)&&j.set("scrollDownArrowVisible",!1))},[j,B]),x.useImperativeHandle(N,()=>oe),rA((oe||z)&&H,Q==="touch",G,I);const ie=Z0({anchor:r,floatingRootContext:U,positionMethod:i,mounted:B,side:l,sideOffset:f,align:u,alignOffset:d,arrowPadding:v,collisionBoundary:h,collisionPadding:g,sticky:b,disableAnchorTracking:w??oe,collisionAvoidance:E,keepMounted:!0}),J=oe?"none":ie.side,se=oe?epe:ie.positionerStyles,xe={open:H,side:J,align:ie.align,anchorHidden:ie.anchorHidden},ne=Le(Oe=>{j.set("positionerElement",Oe)}),ke=J0(t,xe,{styles:se,transitionStatus:$,props:O,refs:[n,ne],hidden:!B,inert:!H}),Ce=x.useRef(0),Be=Le(Oe=>{if(Oe.size===0&&Ce.current===0||F.current.length===0)return;const Re=Ce.current;if(Ce.current=Oe.size,Oe.size===Re)return;const je=ct(Wo);if(Re!==0&&!j.state.multiple&&V!==null&&mm(F.current,V,K)===-1){const de=D.current,ve=de!=null&&mm(F.current,de,K)!==-1?de:null;L(ve,je),ve===null&&(j.set("selectedIndex",null),P.current=null)}if(Re!==0&&j.state.multiple&&Array.isArray(V)){const _e=be=>mm(F.current,be,K)!==-1,de=V.filter(be=>_e(be));(de.length!==V.length||de.some(be=>!Bhe(V,be,K)))&&(L(de,je),de.length===0&&(j.set("selectedIndex",null),P.current=null))}if(H&&oe){j.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const _e={height:""};gb(G,_e),gb(q.current,_e)}}),Ee=x.useMemo(()=>({...ie,side:J,alignItemWithTriggerActive:oe,setControlledAlignItemWithTrigger:Z,scrollUpArrowRef:R,scrollDownArrowRef:X}),[ie,J,oe,Z]);return m.jsx(Pg,{elementsRef:A,labelsRef:T,onMapChange:Be,children:m.jsxs(H8.Provider,{value:Ee,children:[B&&z&&m.jsx(cw,{inert:jg(!H),cutout:I}),ke]})})}),qy="base-ui-disable-scrollbar",zm={className:qy,getElement(e){return m.jsx("style",{nonce:e,href:qy,precedence:"base-ui:low",children:\`.\${qy}{scrollbar-width:none}.\${qy}::-webkit-scrollbar{display:none}\`})}},npe=x.createContext(void 0),rpe={disableStyleElements:!1};function V8(){return x.useContext(npe)??rpe}const ipe={...yc,...$s},ope=x.forwardRef(function(t,n){const{render:r,className:i,style:o,finalFocus:a,...l}=t,{store:u,popupRef:f,onOpenChangeComplete:d,setOpen:h,valueRef:g,selectedItemTextRef:v,keyboardActiveRef:b,multiple:w,handleScrollArrowVisibility:S,scrollHandlerRef:E,listRef:k,highlightItemOnHover:O}=$a(),{side:j,align:A,alignItemWithTriggerActive:T,isPositioned:N,setControlledAlignItemWithTrigger:P,scrollDownArrowRef:F,scrollUpArrowRef:D}=aA(),q=nA()!=null,L=F8(),U=ef(),{nonce:H,disableStyleElements:B}=V8(),z=gt(u,mt.id),V=gt(u,mt.open),Q=gt(u,mt.mounted),G=gt(u,mt.popupProps),I=gt(u,mt.transitionStatus),K=gt(u,mt.triggerElement),$=gt(u,mt.positionerElement),R=gt(u,mt.listElement),X=x.useRef(!1),W=x.useRef(!1),Z=x.useRef({}),oe=Sg(),ie=Le(ne=>{if(!$||!f.current||!W.current)return;if(X.current||!T){S();return}const ke=$.style.top==="0px",Ce=$.style.bottom==="0px";if(!ke&&!Ce){S();return}const Be=sz($),Ee=um($.getBoundingClientRect().height,"y",Be),Oe=jt($),Re=getComputedStyle($),je=parseFloat(Re.marginTop),_e=parseFloat(Re.marginBottom),de=az(getComputedStyle(f.current)),be=Math.min(Oe.documentElement.clientHeight-je-_e,de),ve=ne.scrollTop,pe=Vy(ne);let Ae=0,ae=null,me=!1,De=!1;const $e=Ke=>{$.style.height=\`\${Ke}px\`},Ve=(Ke,tt)=>{const Tt=va(Ke,0,be-Ee);Tt>0&&$e(Ee+Tt),ne.scrollTop=tt,be-(Ee+Tt)<=Uo&&(X.current=!0),S()},dt=ke?pe-ve:ve,ze=Math.min(Ee+dt,be);if(Ae=ze,dt<=Uo){Ve(dt,ke?pe:0);return}if(be-ze>Uo)ke?De=!0:ae=0;else if(me=!0,Ce&&ve<pe){const Ke=Ee+dt-be;ae=ve-(dt-Ke)}if(Ae=Math.ceil(Ae),Ae!==0&&$e(Ae),De||ae!=null){const Ke=Vy(ne),tt=De?Ke:va(ae,0,Ke);Math.abs(ne.scrollTop-tt)>Uo&&(ne.scrollTop=tt)}(me||Ae>=be-Uo)&&(X.current=!0),S()});x.useImperativeHandle(E,()=>ie,[ie]),Qo({open:V,ref:f,onComplete(){V&&d?.(!0)}});const J={open:V,transitionStatus:I,side:j,align:A};Pe(()=>{!$||!f.current||Object.keys(Z.current).length||(Z.current={top:$.style.top||"0",left:$.style.left||"0",right:$.style.right,height:$.style.height,bottom:$.style.bottom,minHeight:$.style.minHeight,maxHeight:$.style.maxHeight,marginTop:$.style.marginTop,marginBottom:$.style.marginBottom})},[f,$]),Pe(()=>{V||T||(W.current=!1,X.current=!1,gb($,Z.current))},[V,T,$,f]),Pe(()=>{const ne=f.current;if(!V||!K||!$||!ne||T&&!N||u.state.transitionStatus==="ending")return;if(!T){W.current=!0,oe.request(S),ne.style.removeProperty("--transform-origin");return}const ke=ape(ne);ne.style.removeProperty("--transform-origin");try{const Ce=v.current,Be=g.current,Ee=getComputedStyle($),Oe=getComputedStyle(ne),Re=jt(K),je=In($),_e=sz(K),de=Ky(K.getBoundingClientRect(),_e),be=Ky($.getBoundingClientRect(),_e),ve=de.height,pe=R||ne,Ae=pe.scrollHeight,ae=parseFloat(Oe.borderBottomWidth),me=parseFloat(Ee.marginTop)||10,De=parseFloat(Ee.marginBottom)||10,$e=parseFloat(Ee.minHeight)||100,Ve=az(Oe),dt=5,ze=5,Ke=20,tt=Re.documentElement.clientHeight-me-De,Tt=Re.documentElement.clientWidth,yt=tt-de.bottom+ve;let Wt,nt=U==="rtl"?de.right-be.width:de.left,Rt=0;if(Ce&&Be){const rn=Ky(Be.getBoundingClientRect(),_e);Wt=Ky(Ce.getBoundingClientRect(),_e),nt=be.left+(U==="rtl"?rn.right-Wt.right:rn.left-Wt.left);const vr=rn.top-de.top+rn.height/2;Rt=Wt.top-be.top+Wt.height/2-vr}const zt=yt+Rt+De+ae;let Gt=Math.min(tt,zt);const Dn=tt-me-De,Qt=zt-Gt,Ze=Tt-ze;$.style.left=\`\${va(nt,dt,Ze-be.width)}px\`,$.style.height=\`\${Gt}px\`,$.style.maxHeight="auto",$.style.marginTop=\`\${me}px\`,$.style.marginBottom=\`\${De}px\`,ne.style.height="100%";const At=Vy(pe),Ft=Qt>=At-Uo;Ft&&(Gt=Math.min(tt,be.height)-(Qt-At));const ht=de.top<Ke||de.bottom>tt-Ke||Math.ceil(Gt)+Uo<Math.min(Ae,$e),En=(je.visualViewport?.scale??1)!==1&&A0;if(ht||En){W.current=!0,gb($,Z.current),P(!1);return}const Bt=Math.max($e,Gt);if(Ft){const rn=Math.max(0,tt-zt);$.style.top=be.height>=Dn?"0":\`\${rn}px\`,$.style.height=\`\${Gt}px\`,pe.scrollTop=Vy(pe)}else $.style.bottom="0",pe.scrollTop=Qt;if(Wt){const rn=be.top,vr=be.height,Ln=Wt.top+Wt.height/2,Zn=vr>0?(Ln-rn)/vr*100:50,Ot=va(Zn,0,100);ne.style.setProperty("--transform-origin",\`50% \${Ot}%\`)}(Bt===tt||Gt>=Ve)&&(X.current=!0),S(),O&&u.state.selectedIndex===null&&u.state.activeIndex===null&&k.current[0]!=null&&u.set("activeIndex",0),W.current=!0}finally{ke()}},[u,V,$,K,g,v,f,S,T,P,oe,F,D,R,k,O,U,N]),x.useEffect(()=>{if(!T||!$||!V)return;const ne=In($);function ke(Ce){h(!1,ct(Roe,Ce))}return kt(ne,"resize",ke)},[h,T,$,V]);const se={...R?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":w||void 0,id:\`\${z}-list\`},onKeyDown(ne){b.current=!0,q&&lw.has(ne.key)&&ne.stopPropagation()},onMouseMove(){b.current=!1},onScroll(ne){R||ie(ne.currentTarget)},...T&&{style:R?{height:"100%"}:q8}},xe=vt("div",t,{ref:[n,f],state:J,stateAttributesMapping:ipe,props:[G,se,Og(I),{className:!R&&T?zm.className:void 0},l]});return m.jsxs(x.Fragment,{children:[!B&&zm.getElement(H),m.jsx(B0,{context:L,modal:!1,disabled:!Q,returnFocus:a,restoreFocus:!0,children:xe})]})});function az(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function Vy(e){return oA(e.scrollHeight,e.clientHeight)}function sz(e){return gH.getScale(e)}function um(e,t,n){return e/n[t]}function Ky(e,t){return Im({x:um(e.x,"x",t),y:um(e.y,"y",t),width:um(e.width,"x",t),height:um(e.height,"y",t)})}const lz=[["transform","none"],["scale","1"],["translate","0 0"]];function ape(e){const{style:t}=e,n={};for(const[r,i]of lz)n[r]=t.getPropertyValue(r),t.setProperty(r,i,"important");return()=>{for(const[r]of lz){const i=n[r];i?t.setProperty(r,i):t.removeProperty(r)}}}const spe=x.forwardRef(function(t,n){const{className:r,render:i,style:o,...a}=t,{store:l,scrollHandlerRef:u}=$a(),{alignItemWithTriggerActive:f}=aA(),d=gt(l,mt.hasScrollArrows),h=gt(l,mt.openMethod),g=gt(l,mt.multiple),b={id:\`\${gt(l,mt.id)}-list\`,role:"listbox","aria-multiselectable":g||void 0,onScroll(S){u.current?.(S.currentTarget)},...f&&{style:q8},className:d&&h!=="touch"?zm.className:void 0},w=Le(S=>{l.set("listElement",S)});return vt("div",t,{ref:[n,w],props:[b,a]})}),K8=x.createContext(void 0);function sA(){const e=x.useContext(K8);if(!e)throw new Error(Xt(57));return e}const lpe=x.memo(x.forwardRef(function(t,n){const{render:r,className:i,value:o=null,label:a,disabled:l=!1,nativeButton:u=!1,style:f,...d}=t,h=x.useRef(null),g=Rg({label:a,textRef:h,indexGuessBehavior:O8.GuessFromOrder}),{store:v,getItemProps:b,setOpen:w,setValue:S,selectionRef:E,typingRef:k,valuesRef:O,multiple:j,selectedItemTextRef:A}=$a(),T=gt(v,mt.isActive,g.index),N=gt(v,mt.isSelected,g.index,o),P=gt(v,mt.isSelectedByFocus,g.index),F=gt(v,mt.isItemEqualToValue),D=g.index,q=D!==-1,L=x.useRef(null),U=ar(D);Pe(()=>{if(!q)return;const W=O.current;return W[D]=o,()=>{delete W[D]}},[q,D,o,O]),Pe(()=>{if(!q)return;const W=v.state.value;let Z=W;j&&Array.isArray(W)&&W.length>0&&(Z=W[W.length-1]),Z!==void 0&&Wd(o,Z,F)&&(v.set("selectedIndex",D),h.current&&(A.current=h.current))},[q,D,j,F,v,o,A]);const H={disabled:l,selected:N,highlighted:T},B=b({active:T,selected:N});B.id=void 0;const z=x.useRef(null),V=x.useRef("mouse"),Q=x.useRef(!1),{getButtonProps:G,buttonRef:I}=Zo({disabled:l,focusableWhenDisabled:!0,native:u,composite:!0});function K(W){const Z=v.state.value;if(j){const oe=Array.isArray(Z)?Z:[],ie=N?$he(oe,o,F):[...oe,o];S(ie,ct(pm,W))}else S(o,ct(pm,W)),w(!1,ct(pm,W))}const $={role:"option","aria-selected":N,tabIndex:T?0:-1,onTouchStart(){E.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(W){z.current=W.key,v.set("activeIndex",D),W.key===" "&&k.current&&W.preventDefault()},onClick(W){Q.current=!1,!(W.type==="keydown"&&z.current===null)&&(l||W.type==="keydown"&&z.current===" "&&k.current||V.current!=="touch"&&!T||(z.current=null,K(W.nativeEvent)))},onPointerEnter(W){V.current=W.pointerType},onPointerDown(W){V.current=W.pointerType,Q.current=!0},onMouseUp(){if(l)return;if(Q.current){Q.current=!1;return}const W=!E.current.allowSelectedMouseUp&&N,Z=!E.current.allowUnselectedMouseUp&&!N;W||Z||V.current!=="touch"&&!T||L.current?.click()}},R=vt("div",t,{ref:[I,n,g.ref,L],state:H,props:[B,$,d,G]}),X=x.useMemo(()=>({selected:N,indexRef:U,textRef:h,selectedByFocus:P,hasRegistered:q}),[N,U,h,P,q]);return m.jsx(K8.Provider,{value:X,children:R})})),cpe=x.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:i}=sA();return r||i?m.jsx(upe,{...t,ref:n}):null}),upe=x.memo(x.forwardRef((e,t)=>{const{render:n,className:r,style:i,keepMounted:o,...a}=e,{selected:l}=sA(),u=x.useRef(null),{transitionStatus:f,setMounted:d}=hh(l),g=vt("span",e,{ref:[t,u],state:{selected:l,transitionStatus:f},props:[{"aria-hidden":!0,children:"\u2714\uFE0F"},a],stateAttributesMapping:$s});return Qo({open:l,ref:u,onComplete(){l||d(!1)}}),g})),fpe=x.memo(x.forwardRef(function(t,n){const{indexRef:r,textRef:i,selectedByFocus:o,hasRegistered:a}=sA(),{selectedItemTextRef:l}=$a(),{className:u,render:f,style:d,...h}=t,g=x.useCallback(b=>{if(!b||!a)return;const w=l.current===null||!l.current.isConnected;(o||w&&r.current===0)&&(l.current=b)},[l,r,o,a]);return vt("div",t,{ref:[g,n,i],props:h})})),Y8=x.forwardRef(function(t,n){const{render:r,className:i,style:o,direction:a,keepMounted:l=!1,...u}=t,f=a==="up",{store:d,popupRef:h,listRef:g,handleScrollArrowVisibility:v,scrollArrowsMountedCountRef:b}=$a(),{side:w,scrollDownArrowRef:S,scrollUpArrowRef:E}=aA(),k=f?mt.scrollUpArrowVisible:mt.scrollDownArrowVisible,O=gt(d,k),j=gt(d,mt.openMethod),A=O&&j!=="touch",T=Fn(),N=f?E:S,{transitionStatus:P,setMounted:F}=hh(A);Pe(()=>(b.current+=1,d.state.hasScrollArrows||d.set("hasScrollArrows",!0),()=>{b.current=Math.max(0,b.current-1),b.current===0&&d.state.hasScrollArrows&&d.set("hasScrollArrows",!1)}),[d,b]),Qo({open:A,ref:N,onComplete(){A||F(!1)}});const L=vt("div",t,{ref:[n,N],state:{direction:a,visible:A,side:w,transitionStatus:P},props:[{"aria-hidden":!0,children:f?"\u25B2":"\u25BC",style:{position:"absolute"},onMouseMove(H){if(H.movementX===0&&H.movementY===0||T.isStarted())return;d.set("activeIndex",null);function B(){const z=d.state.listElement??h.current;if(!z)return;d.set("activeIndex",null),v();const V=oA(z.scrollHeight,z.clientHeight),Q=Gd(z.scrollTop,V),G=Q===(f?0:V),I=g.current;if(Q!==z.scrollTop&&(z.scrollTop=Q),I.length===0&&d.set(f?"scrollUpArrowVisible":"scrollDownArrowVisible",!G),G){T.clear();return}if(I.length>0){const K=N.current?.offsetHeight||0;z.scrollTop=dpe(I,f,Q,z.clientHeight,K,V)}T.start(40,B)}T.start(40,B)},onMouseLeave(){T.clear()}},u]});return A||l?L:null});function dpe(e,t,n,r,i,o){if(t){let d=0;const h=n+i-Uo;for(let b=0;b<e.length;b+=1){const w=e[b];if(w&&w.offsetTop>=h){d=b;break}}const g=Math.max(0,d-1),v=e[g];return g<d&&v?Gd(v.offsetTop-i,o):0}let a=e.length-1;const l=n+r-i+Uo;for(let d=0;d<e.length;d+=1){const h=e[d];if(h&&h.offsetTop+h.offsetHeight>l){a=Math.max(0,d-1);break}}const u=Math.min(e.length-1,a+1),f=e[u];return u>a&&f?Gd(f.offsetTop+f.offsetHeight-r+i,o):o}const hpe=x.forwardRef(function(t,n){return m.jsx(Y8,{...t,ref:n,direction:"down"})}),ppe=x.forwardRef(function(t,n){return m.jsx(Y8,{...t,ref:n,direction:"up"})}),W8=x.createContext(void 0);function mpe(){const e=x.useContext(W8);if(e===void 0)throw new Error(Xt(56));return e}const gpe=x.forwardRef(function(t,n){const{className:r,render:i,style:o,...a}=t,[l,u]=x.useState(),f=x.useMemo(()=>({labelId:l,setLabelId:u}),[l,u]),d=vt("div",t,{ref:n,props:[{role:"group","aria-labelledby":l},a]});return m.jsx(W8.Provider,{value:f,children:d})}),vpe=x.forwardRef(function(t,n){const{className:r,render:i,id:o,style:a,...l}=t,{setLabelId:u}=mpe(),f=Br(o);return Pe(()=>{u(f)},[f,u]),vt("div",t,{ref:n,props:[{id:f},l]})}),To=qhe;function cz({className:e,...t}){return m.jsx(gpe,{"data-slot":"select-group",className:Ne("scroll-my-1 p-1",e),...t})}function Oh({className:e,...t}){return m.jsx(Xhe,{"data-slot":"select-value",className:Ne("flex flex-1 text-left",e),...t})}function Ao({className:e,size:t="default",children:n,...r}){return m.jsxs(Whe,{"data-slot":"select-trigger","data-size":t,className:Ne("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,m.jsx(Qhe,{render:m.jsx(Tg,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function No({className:e,children:t,side:n="bottom",sideOffset:r=4,align:i="center",alignOffset:o=0,alignItemWithTrigger:a=!0,...l}){return m.jsx(Jhe,{children:m.jsx(tpe,{side:n,sideOffset:r,align:i,alignOffset:o,alignItemWithTrigger:a,className:"isolate z-50",children:m.jsxs(ope,{"data-slot":"select-content","data-align-trigger":a,className:Ne("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...l,children:[m.jsx(ype,{}),m.jsx(spe,{children:t}),m.jsx(xpe,{})]})})})}function uz({className:e,...t}){return m.jsx(vpe,{"data-slot":"select-label",className:Ne("px-1.5 py-1 text-xs text-muted-foreground",e),...t})}function ai({className:e,children:t,...n}){return m.jsxs(lpe,{"data-slot":"select-item",className:Ne("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[m.jsx(fpe,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),m.jsx(cpe,{render:m.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:m.jsx(Aa,{className:"pointer-events-none"})})]})}function ype({className:e,...t}){return m.jsx(ppe,{"data-slot":"select-scroll-up-button",className:Ne("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:m.jsx(e8,{})})}function xpe({className:e,...t}){return m.jsx(hpe,{"data-slot":"select-scroll-down-button",className:Ne("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:m.jsx(Tg,{})})}const Xd={claude:["claude-sonnet-4-6","claude-opus-4-6","claude-haiku-4-5"],opencode:["anthropic/claude-sonnet-4-6","anthropic/claude-opus-4-6","openai/gpt-5.4","openai/gpt-5.4-mini"],codex:["gpt-5.4-mini","gpt-5.4","gpt-5.3-codex"],gemini:["gemini-3.1-pro-preview","gemini-3.1-flash-preview","gemini-2.5-pro","gemini-2.5-flash"],factory:["claude-sonnet-4-6","claude-opus-4-6","gpt-5.4","gemini-3.1-pro-preview"],pi:["anthropic/claude-sonnet-4-6","anthropic/claude-opus-4-6","openai/gpt-5.4","google/gemini-2.5-flash"]},lA=Object.keys(Xd),Fm=["docker","apple-container","podman"],ju=["anthropic","sprites","e2b","vercel","daytona","fly","modal"];[...Fm,...ju];const G8={anthropic:{key:"ANTHROPIC_API_KEY",label:"Anthropic API Key",placeholder:"sk-ant-..."},sprites:{key:"SPRITE_TOKEN",label:"Sprites.dev Token",placeholder:"user/org/.../token"},e2b:{key:"E2B_API_KEY",label:"E2B API Key",placeholder:"e2b_..."},vercel:{key:"VERCEL_TOKEN",label:"Vercel Token",placeholder:"..."},daytona:{key:"DAYTONA_API_KEY",label:"Daytona API Key",placeholder:"..."},fly:{key:"FLY_API_TOKEN",label:"Fly.io API Token",placeholder:"fo1_..."},modal:{key:"MODAL_TOKEN_ID",label:"Modal Token ID",placeholder:"..."}},bpe={claude:{key:"ANTHROPIC_API_KEY",label:"Anthropic API Key or OAuth Token"},codex:{key:"OPENAI_API_KEY",label:"OpenAI API Key"},gemini:{key:"GEMINI_API_KEY",label:"Gemini API Key"},factory:{key:"ANTHROPIC_API_KEY",label:"Anthropic API Key"},pi:{key:"ANTHROPIC_API_KEY",label:"Anthropic API Key"}};function gO(e){return e.includes("/")?!1:!["claude-","gpt-","o1-","o3-","o4-","codex-","chatgpt-","gemini-"].some(n=>e.startsWith(n))}function wpe(e,t){if(!gO(t))return e==="opencode"||e==="pi"?t.startsWith("openai/")?{key:"OPENAI_API_KEY",label:"OpenAI API Key"}:t.startsWith("google/")||t.startsWith("gemini/")?{key:"GEMINI_API_KEY",label:"Gemini API Key"}:{key:"ANTHROPIC_API_KEY",label:"Anthropic API Key"}:bpe[e]}const X8=x.createContext(void 0);function Mg(e){const t=x.useContext(X8);if(t===void 0&&!e)throw new Error(Xt(47));return t}function Spe(){return{...Y0(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const Epe={...W0,disabled:Te(e=>e.disabled),instantType:Te(e=>e.instantType),openMethod:Te(e=>e.openMethod),openChangeReason:Te(e=>e.openChangeReason),modal:Te(e=>e.modal),focusManagerModal:Te(e=>e.focusManagerModal),stickIfOpen:Te(e=>e.stickIfOpen),titleElementId:Te(e=>e.titleElementId),descriptionElementId:Te(e=>e.descriptionElementId),openOnHover:Te(e=>e.openOnHover),closeDelay:Te(e=>e.closeDelay),hasViewport:Te(e=>e.hasViewport)};class cA extends kg{constructor(n){const r={...Spe(),...n};r.open&&n?.mounted===void 0&&(r.mounted=!0);super(r,{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),stickIfOpenTimeout:new Ro,triggerElements:new ph},Epe);qt(this,"setOpen",(n,r)=>{const i=r.reason===or,o=r.reason===ja&&r.event.detail===0,a=!n&&(r.reason===wg||r.reason==null);if(r.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(n,r),r.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,r);const l=()=>{const u={open:n,openChangeReason:r.reason},f=r.trigger?.id??null;(f||n)&&(u.activeTriggerId=f,u.activeTriggerElement=r.trigger??null),this.update(u)};i?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(EU,()=>{this.set("stickIfOpen",!1)}),Fr.flushSync(l)):l(),o||a?this.set("instantType",o?"click":"dismiss"):r.reason===lc?this.set("instantType","focus"):this.set("instantType",void 0)});qt(this,"disposeEffect",()=>this.context.stickIfOpenTimeout.disposeEffect())}static useStore(n,r){const i=pr(()=>new cA(r)).current,o=n??i;return bg(i.disposeEffect),o}}function fz({props:e}){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:o,modal:a=!1,handle:l,triggerId:u,defaultTriggerId:f=null}=e,d=cA.useStore(l?.store,{modal:a,open:r,openProp:n,activeTriggerId:f,triggerIdProp:u});yg(()=>{n===void 0&&d.state.open===!1&&r===!0&&d.update({open:!0,activeTriggerId:f})}),d.useControlledProp("openProp",n),d.useControlledProp("triggerIdProp",u);const h=d.useState("open"),g=d.useState("payload");d.useContextCallback("onOpenChange",i),d.useContextCallback("onOpenChangeComplete",o);const{openMethod:v,triggerProps:b}=uw(h);V0(d);const{forceUnmount:w}=K0(h,d,()=>{d.update({stickIfOpen:!0,openChangeReason:null})});x.useEffect(()=>{h||d.context.stickIfOpenTimeout.clear()},[d,h]);const S=x.useCallback(L=>{const U=ct(L);return U.preventUnmountOnClose=()=>{d.set("preventUnmountingOnClose",!0)},U},[d]),E=x.useCallback(()=>{d.setOpen(!1,S(R0))},[d,S]);x.useImperativeHandle(e.actionsRef,()=>({unmount:w,close:E}),[w,E]);const k=G0({popupStore:d,onOpenChange:d.setOpen}),O=_g(k,{outsidePressEvent:{mouse:a==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),j=TT(k),{getReferenceProps:A,getFloatingProps:T,getTriggerProps:N}=vc([O,j]),P=x.useMemo(()=>A(b),[A,b]),F=x.useMemo(()=>N(b),[N,b]),D=x.useMemo(()=>T(),[T]);d.useSyncedValues({modal:a,openMethod:v,activeTriggerProps:P,inactiveTriggerProps:F,popupProps:D,floatingRootContext:k,nested:La()!=null});const q=x.useMemo(()=>({store:d}),[d]);return m.jsx(X8.Provider,{value:q,children:typeof t=="function"?t({payload:g}):t})}function Cpe(e){return Mg(!0)?m.jsx(fz,{props:e}):m.jsx(cH,{children:m.jsx(fz,{props:e})})}const _pe=300,kpe=x.forwardRef(function(t,n){const{render:r,className:i,disabled:o=!1,nativeButton:a=!0,handle:l,payload:u,openOnHover:f=!1,delay:d=_pe,closeDelay:h=0,id:g,style:v,...b}=t,w=Mg(!0),S=l?.store??w?.store;if(!S)throw new Error(Xt(74));const E=Br(g),k=S.useState("isTriggerActive",E),O=S.useState("floatingRootContext"),j=S.useState("isOpenedByTrigger",E),A=x.useRef(null),{registerTrigger:T,isMountedByThisTrigger:N}=q0(E,A,S,{payload:u,disabled:o,openOnHover:f,closeDelay:h}),P=S.useState("openChangeReason"),F=S.useState("stickIfOpen"),D=S.useState("openMethod"),q=S.useState("focusManagerModal"),L=jT(O,{enabled:O!=null&&f&&(D!=="touch"||P!==ja),mouseOnly:!0,move:!1,handleClose:AT(),restMs:d,delay:{close:h},triggerElementRef:A,isActiveTrigger:k,isClosing:()=>S.select("transitionStatus")==="ending"}),U=$0(O,{enabled:O!=null,stickIfOpen:F}),H=vc([U]),B=S.useState("triggerProps",N),z={disabled:o,open:j},{getButtonProps:V,buttonRef:Q}=Zo({disabled:o,native:a}),G=x.useMemo(()=>({open(X){return X&&P===ja?db.open(X):Q0.open(X)}}),[P]),I=vt("button",t,{state:z,ref:[Q,n,T,A],props:[H.getReferenceProps(),L,B,{[sT]:"",id:E},b,V],stateAttributesMapping:G}),{preFocusGuardRef:K,handlePreFocusGuardFocus:$,handleFocusTargetFocus:R}=P8(S,A);return k&&!q?m.jsxs(x.Fragment,{children:[m.jsx(cc,{ref:K,onFocus:$}),m.jsx(x.Fragment,{children:I},E),m.jsx(cc,{ref:S.context.triggerFocusTargetRef,onFocus:R})]}):m.jsx(x.Fragment,{children:I},E)}),Q8=x.createContext(void 0);function Ope(){const e=x.useContext(Q8);if(e===void 0)throw new Error(Xt(45));return e}const jpe=x.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,{store:o}=Mg();return o.useState("mounted")||r?m.jsx(Q8.Provider,{value:r,children:m.jsx(F0,{ref:n,...i})}):null}),Z8=x.createContext(void 0);function Tpe(){const e=x.useContext(Z8);if(!e)throw new Error(Xt(46));return e}const Ape=x.forwardRef(function(t,n){const{render:r,className:i,anchor:o,positionMethod:a="absolute",side:l="bottom",align:u="center",sideOffset:f=0,alignOffset:d=0,collisionBoundary:h="clipping-ancestors",collisionPadding:g=5,arrowPadding:v=5,sticky:b=!1,disableAnchorTracking:w=!1,collisionAvoidance:S=lT,style:E,...k}=t,{store:O}=Mg(),j=Ope(),A=ST(),T=O.useState("floatingRootContext"),N=O.useState("mounted"),P=O.useState("open"),F=O.useState("openChangeReason"),D=O.useState("activeTriggerElement"),q=O.useState("modal"),L=O.useState("openMethod"),U=O.useState("positionerElement"),H=O.useState("instantType"),B=O.useState("transitionStatus"),z=O.useState("hasViewport"),V=x.useRef(null),Q=H0(U,!1,!1),G=Z0({anchor:o,floatingRootContext:T,positionMethod:a,mounted:N,side:l,sideOffset:f,align:u,alignOffset:d,arrowPadding:v,collisionBoundary:h,collisionPadding:g,sticky:b,disableAnchorTracking:w,keepMounted:j,nodeId:A,collisionAvoidance:S,adaptiveOrigin:z?RT:void 0}),I=T.useState("domReferenceElement");Pe(()=>{const X=I,W=V.current;if(X&&(V.current=X),W&&X&&X!==W){O.set("instantType",void 0);const Z=new AbortController;return Q(()=>{O.set("instantType","trigger-change")},Z.signal),()=>{Z.abort()}}},[I,Q,O]);const K={open:P,side:G.side,align:G.align,anchorHidden:G.anchorHidden,instant:H};rA(P&&q===!0&&F!==or,L==="touch",U,D);const $=x.useCallback(X=>{O.set("positionerElement",X)},[O]),R=J0(t,K,{styles:G.positionerStyles,transitionStatus:B,props:k,refs:[n,$],hidden:!N,inert:!P});return m.jsxs(Z8.Provider,{value:G,children:[N&&q===!0&&F!==or&&m.jsx(cw,{ref:O.context.internalBackdropRef,inert:jg(!P),cutout:D}),m.jsx(lH,{id:A,children:R})]})}),Npe=x.createContext(void 0);function Rpe(){const[e,t]=x.useState(0),n=Le(()=>(t(i=>i+1),()=>{t(i=>Math.max(0,i-1))}));return{context:x.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function Ppe(e){const{value:t,children:n}=e;return m.jsx(Npe.Provider,{value:t,children:n})}const Mpe={...yc,...$s},Ipe=x.forwardRef(function(t,n){const{className:r,render:i,initialFocus:o,finalFocus:a,style:l,...u}=t,{store:f}=Mg(),d=Tpe(),h=nA()!=null,{context:g,hasClosePart:v}=Rpe(),b=f.useState("open"),w=f.useState("openMethod"),S=f.useState("instantType"),E=f.useState("transitionStatus"),k=f.useState("popupProps"),O=f.useState("titleElementId"),j=f.useState("descriptionElementId"),A=f.useState("modal"),T=f.useState("mounted"),N=f.useState("openChangeReason"),P=f.useState("activeTriggerElement"),F=f.useState("floatingRootContext");Qo({open:b,ref:f.context.popupRef,onComplete(){b&&f.context.onOpenChangeComplete?.(!0)}});const D=f.useState("disabled"),q=f.useState("openOnHover"),L=f.useState("closeDelay");OT(F,{enabled:q&&!D,closeDelay:L});function U(G){return G==="touch"?f.context.popupRef.current:!0}const H=o===void 0?U:o,B={open:b,side:d.side,align:d.align,instant:S,transitionStatus:E},z=A!==!1&&v;f.useSyncedValue("focusManagerModal",z);const V=x.useCallback(G=>{f.set("popupElement",G)},[f]),Q=vt("div",t,{state:B,ref:[n,f.context.popupRef,V],props:[k,{"aria-labelledby":O,"aria-describedby":j,onKeyDown(G){h&&lw.has(G.key)&&G.stopPropagation()}},Og(E),u],stateAttributesMapping:Mpe});return m.jsx(B0,{context:F,openInteractionType:w,modal:z,disabled:!T||N===or,initialFocus:H,returnFocus:a,restoreFocus:"popup",previousFocusableElement:fn(P)?P:void 0,nextFocusableElement:f.context.triggerFocusTargetRef,beforeContentFocusGuardRef:f.context.beforeContentFocusGuardRef,children:m.jsx(Ppe,{value:g,children:Q})})});function Dpe({...e}){return m.jsx(Cpe,{"data-slot":"popover",...e})}function Lpe({...e}){return m.jsx(kpe,{"data-slot":"popover-trigger",...e})}function zpe({className:e,align:t="center",alignOffset:n=0,side:r="bottom",sideOffset:i=4,...o}){return m.jsx(jpe,{children:m.jsx(Ape,{align:t,alignOffset:n,side:r,sideOffset:i,className:"isolate z-50",children:m.jsx(Ipe,{"data-slot":"popover-content",className:Ne("z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...o})})})}var dz=1,Fpe=.9,Bpe=.8,$pe=.17,hC=.1,pC=.999,Upe=.9999,Hpe=.99,qpe=/[\\\\\\/_+.#"@\\[\\(\\{&]/,Vpe=/[\\\\\\/_+.#"@\\[\\(\\{&]/g,Kpe=/[\\s-]/,J8=/[\\s-]/g;function vO(e,t,n,r,i,o,a){if(o===t.length)return i===e.length?dz:Hpe;var l=\`\${i},\${o}\`;if(a[l]!==void 0)return a[l];for(var u=r.charAt(o),f=n.indexOf(u,i),d=0,h,g,v,b;f>=0;)h=vO(e,t,n,r,f+1,o+1,a),h>d&&(f===i?h*=dz:qpe.test(e.charAt(f-1))?(h*=Bpe,v=e.slice(i,f-1).match(Vpe),v&&i>0&&(h*=Math.pow(pC,v.length))):Kpe.test(e.charAt(f-1))?(h*=Fpe,b=e.slice(i,f-1).match(J8),b&&i>0&&(h*=Math.pow(pC,b.length))):(h*=$pe,i>0&&(h*=Math.pow(pC,f-i))),e.charAt(f)!==t.charAt(o)&&(h*=Upe)),(h<hC&&n.charAt(f-1)===r.charAt(o+1)||r.charAt(o+1)===r.charAt(o)&&n.charAt(f-1)!==r.charAt(o))&&(g=vO(e,t,n,r,f+1,o+2,a),g*hC>h&&(h=g*hC)),h>d&&(d=h),f=n.indexOf(u,f+1);return a[l]=d,d}function hz(e){return e.toLowerCase().replace(J8," ")}function Ype(e,t,n){return e=n&&n.length>0?\`\${e+" "+n.join(" ")}\`:e,vO(e,t,hz(e),hz(t),0,0,{})}function tc(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}function pz(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function fc(...e){return t=>{let n=!1;const r=e.map(i=>{const o=pz(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():pz(e[i],null)}}}}function of(...e){return x.useCallback(fc(...e),e)}function Wpe(e,t){const n=x.createContext(t),r=o=>{const{children:a,...l}=o,u=x.useMemo(()=>l,Object.values(l));return m.jsx(n.Provider,{value:u,children:a})};r.displayName=e+"Provider";function i(o){const a=x.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(\`\\\`\${o}\\\` must be used within \\\`\${e}\\\`\`)}return[r,i]}function Gpe(e,t=[]){let n=[];function r(o,a){const l=x.createContext(a),u=n.length;n=[...n,a];const f=h=>{const{scope:g,children:v,...b}=h,w=g?.[e]?.[u]||l,S=x.useMemo(()=>b,Object.values(b));return m.jsx(w.Provider,{value:S,children:v})};f.displayName=o+"Provider";function d(h,g){const v=g?.[e]?.[u]||l,b=x.useContext(v);if(b)return b;if(a!==void 0)return a;throw new Error(\`\\\`\${h}\\\` must be used within \\\`\${o}\\\`\`)}return[f,d]}const i=()=>{const o=n.map(a=>x.createContext(a));return function(l){const u=l?.[e]||o;return x.useMemo(()=>({[\`__scope\${e}\`]:{...l,[e]:u}}),[l,u])}};return i.scopeName=e,[r,Xpe(i,...t)]}function Xpe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const a=r.reduce((l,{useScope:u,scopeName:f})=>{const h=u(o)[\`__scope\${f}\`];return{...l,...h}},{});return x.useMemo(()=>({[\`__scope\${t.scopeName}\`]:a}),[a])}};return n.scopeName=t.scopeName,n}var Bm=globalThis?.document?x.useLayoutEffect:()=>{},Qpe=oh[" useId ".trim().toString()]||(()=>{}),Zpe=0;function Cs(e){const[t,n]=x.useState(Qpe());return Bm(()=>{n(r=>r??String(Zpe++))},[e]),t?\`radix-\${t}\`:""}var Jpe=oh[" useInsertionEffect ".trim().toString()]||Bm;function eme({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,o,a]=tme({defaultProp:t,onChange:n}),l=e!==void 0,u=l?e:i;{const d=x.useRef(e!==void 0);x.useEffect(()=>{const h=d.current;h!==l&&console.warn(\`\${r} is changing from \${h?"controlled":"uncontrolled"} to \${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.\`),d.current=l},[l,r])}const f=x.useCallback(d=>{if(l){const h=nme(d)?d(e):d;h!==e&&a.current?.(h)}else o(d)},[l,e,o,a]);return[u,f]}function tme({defaultProp:e,onChange:t}){const[n,r]=x.useState(e),i=x.useRef(n),o=x.useRef(t);return Jpe(()=>{o.current=t},[t]),x.useEffect(()=>{i.current!==n&&(o.current?.(n),i.current=n)},[n,i]),[n,r,o]}function nme(e){return typeof e=="function"}function Ig(e){const t=rme(e),n=x.forwardRef((r,i)=>{const{children:o,...a}=r,l=x.Children.toArray(o),u=l.find(ome);if(u){const f=u.props.children,d=l.map(h=>h===u?x.Children.count(f)>1?x.Children.only(null):x.isValidElement(f)?f.props.children:null:h);return m.jsx(t,{...a,ref:i,children:x.isValidElement(f)?x.cloneElement(f,void 0,d):null})}return m.jsx(t,{...a,ref:i,children:o})});return n.displayName=\`\${e}.Slot\`,n}function rme(e){const t=x.forwardRef((n,r)=>{const{children:i,...o}=n;if(x.isValidElement(i)){const a=sme(i),l=ame(o,i.props);return i.type!==x.Fragment&&(l.ref=r?fc(r,a):a),x.cloneElement(i,l)}return x.Children.count(i)>1?x.Children.only(null):null});return t.displayName=\`\${e}.SlotClone\`,t}var ime=Symbol("radix.slottable");function ome(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ime}function ame(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...l)=>{const u=o(...l);return i(...l),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function sme(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var lme=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],eq=lme.reduce((e,t)=>{const n=Ig(\`Primitive.\${t}\`),r=x.forwardRef((i,o)=>{const{asChild:a,...l}=i,u=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(u,{...l,ref:o})});return r.displayName=\`Primitive.\${t}\`,{...e,[t]:r}},{});function cme(e,t){e&&Fr.flushSync(()=>e.dispatchEvent(t))}function $m(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...n)=>t.current?.(...n),[])}function ume(e,t=globalThis?.document){const n=$m(e);x.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var fme="DismissableLayer",yO="dismissableLayer.update",dme="dismissableLayer.pointerDownOutside",hme="dismissableLayer.focusOutside",mz,tq=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),nq=x.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...u}=e,f=x.useContext(tq),[d,h]=x.useState(null),g=d?.ownerDocument??globalThis?.document,[,v]=x.useState({}),b=of(t,N=>h(N)),w=Array.from(f.layers),[S]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),E=w.indexOf(S),k=d?w.indexOf(d):-1,O=f.layersWithOutsidePointerEventsDisabled.size>0,j=k>=E,A=gme(N=>{const P=N.target,F=[...f.branches].some(D=>D.contains(P));!j||F||(i?.(N),a?.(N),N.defaultPrevented||l?.())},g),T=vme(N=>{const P=N.target;[...f.branches].some(D=>D.contains(P))||(o?.(N),a?.(N),N.defaultPrevented||l?.())},g);return ume(N=>{k===f.layers.size-1&&(r?.(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},g),x.useEffect(()=>{if(d)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(mz=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(d)),f.layers.add(d),gz(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=mz)}},[d,g,n,f]),x.useEffect(()=>()=>{d&&(f.layers.delete(d),f.layersWithOutsidePointerEventsDisabled.delete(d),gz())},[d,f]),x.useEffect(()=>{const N=()=>v({});return document.addEventListener(yO,N),()=>document.removeEventListener(yO,N)},[]),m.jsx(eq.div,{...u,ref:b,style:{pointerEvents:O?j?"auto":"none":void 0,...e.style},onFocusCapture:tc(e.onFocusCapture,T.onFocusCapture),onBlurCapture:tc(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:tc(e.onPointerDownCapture,A.onPointerDownCapture)})});nq.displayName=fme;var pme="DismissableLayerBranch",mme=x.forwardRef((e,t)=>{const n=x.useContext(tq),r=x.useRef(null),i=of(t,r);return x.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),m.jsx(eq.div,{...e,ref:i})});mme.displayName=pme;function gme(e,t=globalThis?.document){const n=$m(e),r=x.useRef(!1),i=x.useRef(()=>{});return x.useEffect(()=>{const o=l=>{if(l.target&&!r.current){let u=function(){rq(dme,n,f,{discrete:!0})};const f={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=u,t.addEventListener("click",i.current,{once:!0})):u()}else t.removeEventListener("click",i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",o),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function vme(e,t=globalThis?.document){const n=$m(e),r=x.useRef(!1);return x.useEffect(()=>{const i=o=>{o.target&&!r.current&&rq(hme,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function gz(){const e=new CustomEvent(yO);document.dispatchEvent(e)}function rq(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?cme(i,o):i.dispatchEvent(o)}var yme=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],xme=yme.reduce((e,t)=>{const n=Ig(\`Primitive.\${t}\`),r=x.forwardRef((i,o)=>{const{asChild:a,...l}=i,u=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(u,{...l,ref:o})});return r.displayName=\`Primitive.\${t}\`,{...e,[t]:r}},{}),mC="focusScope.autoFocusOnMount",gC="focusScope.autoFocusOnUnmount",vz={bubbles:!1,cancelable:!0},bme="FocusScope",iq=x.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...a}=e,[l,u]=x.useState(null),f=$m(i),d=$m(o),h=x.useRef(null),g=of(t,w=>u(w)),v=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(r){let w=function(O){if(v.paused||!l)return;const j=O.target;l.contains(j)?h.current=j:jl(h.current,{select:!0})},S=function(O){if(v.paused||!l)return;const j=O.relatedTarget;j!==null&&(l.contains(j)||jl(h.current,{select:!0}))},E=function(O){if(document.activeElement===document.body)for(const A of O)A.removedNodes.length>0&&jl(l)};document.addEventListener("focusin",w),document.addEventListener("focusout",S);const k=new MutationObserver(E);return l&&k.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",S),k.disconnect()}}},[r,l,v.paused]),x.useEffect(()=>{if(l){xz.add(v);const w=document.activeElement;if(!l.contains(w)){const E=new CustomEvent(mC,vz);l.addEventListener(mC,f),l.dispatchEvent(E),E.defaultPrevented||(wme(kme(oq(l)),{select:!0}),document.activeElement===w&&jl(l))}return()=>{l.removeEventListener(mC,f),setTimeout(()=>{const E=new CustomEvent(gC,vz);l.addEventListener(gC,d),l.dispatchEvent(E),E.defaultPrevented||jl(w??document.body,{select:!0}),l.removeEventListener(gC,d),xz.remove(v)},0)}}},[l,f,d,v]);const b=x.useCallback(w=>{if(!n&&!r||v.paused)return;const S=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,E=document.activeElement;if(S&&E){const k=w.currentTarget,[O,j]=Sme(k);O&&j?!w.shiftKey&&E===j?(w.preventDefault(),n&&jl(O,{select:!0})):w.shiftKey&&E===O&&(w.preventDefault(),n&&jl(j,{select:!0})):E===k&&w.preventDefault()}},[n,r,v.paused]);return m.jsx(xme.div,{tabIndex:-1,...a,ref:g,onKeyDown:b})});iq.displayName=bme;function wme(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(jl(r,{select:t}),document.activeElement!==n)return}function Sme(e){const t=oq(e),n=yz(t,e),r=yz(t.reverse(),e);return[n,r]}function oq(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function yz(e,t){for(const n of e)if(!Eme(n,{upTo:t}))return n}function Eme(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Cme(e){return e instanceof HTMLInputElement&&"select"in e}function jl(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Cme(e)&&t&&e.select()}}var xz=_me();function _me(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=bz(e,t),e.unshift(t)},remove(t){e=bz(e,t),e[0]?.resume()}}}function bz(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function kme(e){return e.filter(t=>t.tagName!=="A")}var Ome=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],jme=Ome.reduce((e,t)=>{const n=Ig(\`Primitive.\${t}\`),r=x.forwardRef((i,o)=>{const{asChild:a,...l}=i,u=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(u,{...l,ref:o})});return r.displayName=\`Primitive.\${t}\`,{...e,[t]:r}},{}),Tme="Portal",aq=x.forwardRef((e,t)=>{const{container:n,...r}=e,[i,o]=x.useState(!1);Bm(()=>o(!0),[]);const a=n||i&&globalThis?.document?.body;return a?sU.createPortal(m.jsx(jme.div,{...r,ref:t}),a):null});aq.displayName=Tme;function Ame(e,t){return x.useReducer((n,r)=>t[n][r]??n,e)}var mw=e=>{const{present:t,children:n}=e,r=Nme(t),i=typeof n=="function"?n({present:r.isPresent}):x.Children.only(n),o=of(r.ref,Rme(i));return typeof n=="function"||r.isPresent?x.cloneElement(i,{ref:o}):null};mw.displayName="Presence";function Nme(e){const[t,n]=x.useState(),r=x.useRef(null),i=x.useRef(e),o=x.useRef("none"),a=e?"mounted":"unmounted",[l,u]=Ame(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const f=Yy(r.current);o.current=l==="mounted"?f:"none"},[l]),Bm(()=>{const f=r.current,d=i.current;if(d!==e){const g=o.current,v=Yy(f);e?u("MOUNT"):v==="none"||f?.display==="none"?u("UNMOUNT"):u(d&&g!==v?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),Bm(()=>{if(t){let f;const d=t.ownerDocument.defaultView??window,h=v=>{const w=Yy(r.current).includes(CSS.escape(v.animationName));if(v.target===t&&w&&(u("ANIMATION_END"),!i.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",f=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},g=v=>{v.target===t&&(o.current=Yy(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{d.clearTimeout(f),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:x.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function Yy(e){return e?.animationName||"none"}function Rme(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Pme=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Dg=Pme.reduce((e,t)=>{const n=Ig(\`Primitive.\${t}\`),r=x.forwardRef((i,o)=>{const{asChild:a,...l}=i,u=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(u,{...l,ref:o})});return r.displayName=\`Primitive.\${t}\`,{...e,[t]:r}},{}),vC=0;function Mme(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??wz()),document.body.insertAdjacentElement("beforeend",e[1]??wz()),vC++,()=>{vC===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),vC--}},[])}function wz(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var ya=function(){return ya=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},ya.apply(this,arguments)};function sq(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Ime(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var zx="right-scroll-bar-position",Fx="width-before-scroll-bar",Dme="with-scroll-bars-hidden",Lme="--removed-body-scroll-bar-size";function yC(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function zme(e,t){var n=x.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}var Fme=typeof window<"u"?x.useLayoutEffect:x.useEffect,Sz=new WeakMap;function Bme(e,t){var n=zme(null,function(r){return e.forEach(function(i){return yC(i,r)})});return Fme(function(){var r=Sz.get(n);if(r){var i=new Set(r),o=new Set(e),a=n.current;i.forEach(function(l){o.has(l)||yC(l,null)}),o.forEach(function(l){i.has(l)||yC(l,a)})}Sz.set(n,e)},[e]),n}function $me(e){return e}function Ume(e,t){t===void 0&&(t=$me);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not \`read\` from an \`assigned\` medium. \`read\` could be used only with \`useMedium\`.");return n.length?n[n.length-1]:e},useMedium:function(o){var a=t(o,r);return n.push(a),function(){n=n.filter(function(l){return l!==a})}},assignSyncMedium:function(o){for(r=!0;n.length;){var a=n;n=[],a.forEach(o)}n={push:function(l){return o(l)},filter:function(){return n}}},assignMedium:function(o){r=!0;var a=[];if(n.length){var l=n;n=[],l.forEach(o),a=n}var u=function(){var d=a;a=[],d.forEach(o)},f=function(){return Promise.resolve().then(u)};f(),n={push:function(d){a.push(d),f()},filter:function(d){return a=a.filter(d),n}}}};return i}function Hme(e){e===void 0&&(e={});var t=Ume(null);return t.options=ya({async:!0,ssr:!1},e),t}var lq=function(e){var t=e.sideCar,n=sq(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide \`sideCar\` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return x.createElement(r,ya({},n))};lq.isSideCarExport=!0;function qme(e,t){return e.useMedium(t),lq}var cq=Hme(),xC=function(){},gw=x.forwardRef(function(e,t){var n=x.useRef(null),r=x.useState({onScrollCapture:xC,onWheelCapture:xC,onTouchMoveCapture:xC}),i=r[0],o=r[1],a=e.forwardProps,l=e.children,u=e.className,f=e.removeScrollBar,d=e.enabled,h=e.shards,g=e.sideCar,v=e.noRelative,b=e.noIsolation,w=e.inert,S=e.allowPinchZoom,E=e.as,k=E===void 0?"div":E,O=e.gapMode,j=sq(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),A=g,T=Bme([n,t]),N=ya(ya({},j),i);return x.createElement(x.Fragment,null,d&&x.createElement(A,{sideCar:cq,removeScrollBar:f,shards:h,noRelative:v,noIsolation:b,inert:w,setCallbacks:o,allowPinchZoom:!!S,lockRef:n,gapMode:O}),a?x.cloneElement(x.Children.only(l),ya(ya({},N),{ref:T})):x.createElement(k,ya({},N,{className:u,ref:T}),l))});gw.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};gw.classNames={fullWidth:Fx,zeroRight:zx};var Vme=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Kme(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Vme();return t&&e.setAttribute("nonce",t),e}function Yme(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Wme(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Gme=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Kme())&&(Yme(t,n),Wme(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Xme=function(){var e=Gme();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},uq=function(){var e=Xme(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},Qme={left:0,top:0,right:0,gap:0},bC=function(e){return parseInt(e||"",10)||0},Zme=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[bC(n),bC(r),bC(i)]},Jme=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Qme;var t=Zme(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},ege=uq(),bd="data-scroll-locked",tge=function(e,t,n,r){var i=e.left,o=e.top,a=e.right,l=e.gap;return n===void 0&&(n="margin"),\`
|
|
216950
|
+
*/const jfe=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Tfe=it("zap",jfe),Afe=({...e})=>{const{theme:t="system"}=xce();return m.jsx(Kce,{theme:t,className:"toaster group",icons:{success:m.jsx(bue,{className:"size-4"}),info:m.jsx($T,{className:"size-4"}),warning:m.jsx(i8,{className:"size-4"}),error:m.jsx(Uue,{className:"size-4"}),loading:m.jsx(tw,{className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},toastOptions:{classNames:{toast:"cn-toast"}},...e})};function HT(e){return vt(e.defaultTagName??"div",e,e)}const YL=e=>typeof e=="boolean"?\`\${e}\`:e===0?"0":e,WL=ln,Ag=(e,t)=>n=>{var r;if(t?.variants==null)return WL(e,n?.class,n?.className);const{variants:i,defaultVariants:o}=t,a=Object.keys(i).map(f=>{const d=n?.[f],h=o?.[f];if(d===null)return null;const g=YL(d)||YL(h);return i[f][g]}),l=n&&Object.entries(n).reduce((f,d)=>{let[h,g]=d;return g===void 0||(f[h]=g),f},{}),u=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((f,d)=>{let{class:h,className:g,...v}=d;return Object.entries(v).every(b=>{let[w,S]=b;return Array.isArray(S)?S.includes({...o,...l}[w]):{...o,...l}[w]===S})?[...f,h,g]:f},[]);return WL(e,a,u,n?.class,n?.className)},fC=768;function Nfe(){const[e,t]=x.useState(void 0);return x.useEffect(()=>{const n=window.matchMedia(\`(max-width: \${fC-1}px)\`),r=()=>{t(window.innerWidth<fC)};return n.addEventListener("change",r),t(window.innerWidth<fC),()=>n.removeEventListener("change",r)},[]),!!e}const o8=x.createContext(void 0);function qT(e=!1){const t=x.useContext(o8);if(t===void 0&&!e)throw new Error(Xt(16));return t}function Rfe(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:o}=e,a=r&&t!==!1,l=r&&t===!1;return{props:x.useMemo(()=>{const f={onKeyDown(d){n&&t&&d.key!=="Tab"&&d.preventDefault()}};return r||(f.tabIndex=i,!o&&n&&(f.tabIndex=t?i:-1)),(o&&(t||a)||!o&&n)&&(f["aria-disabled"]=n),o&&(!t||l)&&(f.disabled=n),f},[r,n,t,a,l,o,i])}}function Zo(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:o}=e,a=x.useRef(null),l=qT(!0),u=o??l!==void 0,{props:f}=Rfe({focusableWhenDisabled:n,disabled:t,composite:u,tabIndex:r,isNativeButton:i}),d=x.useCallback(()=>{const v=a.current;dC(v)&&u&&t&&f.disabled===void 0&&v.disabled&&(v.disabled=!1)},[t,f.disabled,u]);Pe(d,[d]);const h=x.useCallback((v={})=>{const{onClick:b,onMouseDown:w,onKeyUp:S,onKeyDown:E,onPointerDown:k,...O}=v;return Mo({type:i?"button":void 0,onClick(A){if(t){A.preventDefault();return}b?.(A)},onMouseDown(A){t||w?.(A)},onKeyDown(A){if(t||(sb(A),E?.(A),A.baseUIHandlerPrevented))return;const T=A.target===A.currentTarget,N=A.currentTarget,P=dC(N),F=!i&&Pfe(N),D=T&&(i?P:!F),q=A.key==="Enter",L=A.key===" ",U=N.getAttribute("role"),H=U?.startsWith("menuitem")||U==="option"||U==="gridcell";if(T&&u&&L){if(A.defaultPrevented&&H)return;A.preventDefault(),F||i&&P?(N.click(),A.preventBaseUIHandler()):D&&(b?.(A),A.preventBaseUIHandler());return}D&&(!i&&(L||q)&&A.preventDefault(),!i&&q&&b?.(A))},onKeyUp(A){if(!t){if(sb(A),S?.(A),A.target===A.currentTarget&&i&&u&&dC(A.currentTarget)&&A.key===" "){A.preventDefault();return}A.baseUIHandlerPrevented||A.target===A.currentTarget&&!i&&!u&&A.key===" "&&b?.(A)}},onPointerDown(A){if(t){A.preventDefault();return}k?.(A)}},i?void 0:{role:"button"},f,O)},[t,f,u,i]),g=Le(v=>{a.current=v,d()});return{getButtonProps:h,buttonRef:g}}function dC(e){return fn(e)&&e.tagName==="BUTTON"}function Pfe(e){return!!(e?.tagName==="A"&&e?.href)}const Mfe=x.forwardRef(function(t,n){const{render:r,className:i,disabled:o=!1,focusableWhenDisabled:a=!1,nativeButton:l=!0,style:u,...f}=t,{getButtonProps:d,buttonRef:h}=Zo({disabled:o,focusableWhenDisabled:a,native:l});return vt("button",t,{state:{disabled:o},ref:[n,h],props:[f,d]})}),Ife=Ag("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Fe({className:e,variant:t="default",size:n="default",...r}){return m.jsx(Mfe,{"data-slot":"button",className:Ne(Ife({variant:t,size:n,className:e})),...r})}let GL=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Dfe={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},cm={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Lfe={disabled:!1,...cm},VT={valid(e){return e===null?null:e?{[GL.valid]:""}:{[GL.invalid]:""}}},zfe=x.createContext({invalid:void 0,name:void 0,validityData:{state:Dfe,errors:[],error:"",value:"",initialValue:null},setValidityData:Yr,disabled:void 0,touched:cm.touched,setTouched:Yr,dirty:cm.dirty,setDirty:Yr,filled:cm.filled,setFilled:Yr,focused:cm.focused,setFocused:Yr,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:Lfe,markedDirtyRef:{current:!1},registerFieldControl:Yr,validation:{getValidationProps:(e=Wn)=>e,getInputValidationProps:(e=Wn)=>e,inputRef:{current:null},commit:async()=>{}}});function mh(e=!0){const t=x.useContext(zfe);if(t.setValidityData===Yr&&!e)throw new Error(Xt(28));return t}const Ffe=x.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Yr,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function a8(){return x.useContext(Ffe)}const Bfe=x.createContext({controlId:void 0,registerControlId:Yr,labelId:void 0,setLabelId:Yr,messageIds:[],setMessageIds:Yr,getDescriptionProps:e=>e});function ow(){return x.useContext(Bfe)}function Lu({controlled:e,default:t,name:n,state:r="value"}){const{current:i}=x.useRef(e!==void 0),[o,a]=x.useState(t),l=i?e:o,u=x.useCallback(f=>{i||a(f)},[]);return[l,u]}function KT(e,t){const{enabled:n=!0,getValue:r,id:i,value:o}=t,{registerFieldControl:a}=mh(),l=x.useRef(null);l.current||(l.current=Symbol()),Pe(()=>{const u=l.current;if(!(!u||!n))return a(u,{controlRef:e,getValue:r,id:i,value:o}),()=>{a(u,void 0)}},[e,n,r,i,a,o])}function aw(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:o}=ow(),a=Br(t),l=n?i:void 0,u=pr(()=>Symbol("labelable-control")),f=x.useRef(!1),d=x.useRef(t!=null),h=Le(()=>{!f.current||o===Yr||(f.current=!1,o(u.current,void 0))});return Pe(()=>{if(o===Yr)return;let g;if(n){const v=r?.current;Dt(v)&&v.closest("label")!=null?g=t??null:g=l??a}else if(t!=null)d.current=!0,g=t;else if(d.current)g=a;else{h();return}if(g===void 0){h();return}f.current=!0,o(u.current,g)},[t,r,l,o,n,a,u,h]),x.useEffect(()=>h,[h]),i??a}const $fe=x.forwardRef(function(t,n){const{render:r,className:i,id:o,name:a,value:l,disabled:u=!1,onValueChange:f,defaultValue:d,autoFocus:h=!1,style:g,...v}=t,{state:b,name:w,disabled:S,setTouched:E,setDirty:k,validityData:O,setFocused:j,setFilled:A,validationMode:T,validation:N}=mh(),P=S||u,F=w??a,D={...b,disabled:P},{labelId:q}=ow(),L=aw({id:o});Pe(()=>{const G=l!=null;N.inputRef.current?.value||G&&l!==""?A(!0):G&&l===""&&A(!1)},[N.inputRef,A,l]);const U=x.useRef(null);Pe(()=>{h&&U.current===Oi(jt(U.current))&&j(!0)},[h,j]);const[H]=Lu({controlled:l,default:d,name:"FieldControl",state:"value"}),B=l!==void 0,z=B?H:void 0,V=Le(()=>N.inputRef.current?.value);return KT(N.inputRef,{id:L,value:z,getValue:V}),vt("input",t,{ref:[n,U],state:D,props:[{id:L,disabled:P,name:F,ref:N.inputRef,"aria-labelledby":q,autoFocus:h,...B?{value:z}:{defaultValue:d},onChange(G){const I=G.currentTarget.value;f?.(I,ct(Wo,G.nativeEvent)),k(I!==O.initialValue),A(I!=="")},onFocus(){j(!0)},onBlur(G){E(!0),j(!1),T==="onBlur"&&N.commit(G.currentTarget.value)},onKeyDown(G){G.currentTarget.tagName==="INPUT"&&G.key==="Enter"&&(E(!0),N.commit(G.currentTarget.value))}},N.getInputValidationProps(),v],stateAttributesMapping:VT})}),Ufe=x.forwardRef(function(t,n){return m.jsx($fe,{ref:n,...t})});function en({className:e,type:t,...n}){return m.jsx(Ufe,{type:t,"data-slot":"input",className:Ne("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...n})}const Hfe=x.forwardRef(function(t,n){const{className:r,render:i,orientation:o="horizontal",style:a,...l}=t;return vt("div",t,{state:{orientation:o},ref:n,props:[{role:"separator","aria-orientation":o},l]})});function qfe({className:e,orientation:t="horizontal",...n}){return m.jsx(Hfe,{"data-slot":"separator",orientation:t,className:Ne("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",e),...n})}const YT=x.createContext(void 0);function Us(e){const t=x.useContext(YT);if(e===!1&&t===void 0)throw new Error(Xt(27));return t}const Vfe={...yc,...$s},WT=x.forwardRef(function(t,n){const{render:r,className:i,style:o,forceRender:a=!1,...l}=t,{store:u}=Us(),f=u.useState("open"),d=u.useState("nested"),h=u.useState("mounted"),g=u.useState("transitionStatus");return vt("div",t,{state:{open:f,transitionStatus:g},ref:[u.context.backdropRef,n],stateAttributesMapping:Vfe,props:[{role:"presentation",hidden:!h,style:{userSelect:"none",WebkitUserSelect:"none"}},l],enabled:a||!d})}),sw=x.forwardRef(function(t,n){const{render:r,className:i,disabled:o=!1,nativeButton:a=!0,style:l,...u}=t,{store:f}=Us(),d=f.useState("open");function h(w){d&&f.setOpen(!1,ct(Aoe,w.nativeEvent))}const{getButtonProps:g,buttonRef:v}=Zo({disabled:o,native:a});return vt("button",t,{state:{disabled:o},ref:[n,v],props:[{onClick:h},u,g]})}),s8=x.forwardRef(function(t,n){const{render:r,className:i,style:o,id:a,...l}=t,{store:u}=Us(),f=Br(a);return u.useSyncedValueWithCleanup("descriptionElementId",f),vt("p",t,{ref:n,props:[{id:f},l]})});let Kfe=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),Yfe=(function(e){return e[e.open=uu.open]="open",e[e.closed=uu.closed]="closed",e[e.startingStyle=uu.startingStyle]="startingStyle",e[e.endingStyle=uu.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const l8=x.createContext(void 0);function Wfe(){const e=x.useContext(l8);if(e===void 0)throw new Error(Xt(26));return e}const Jl="ArrowUp",vs="ArrowDown",zu="ArrowLeft",ec="ArrowRight",gh="Home",vh="End",c8=new Set([zu,ec]),Gfe=new Set([zu,ec,gh,vh]),u8=new Set([Jl,vs]),Xfe=new Set([Jl,vs,gh,vh]),f8=new Set([...c8,...u8]),Qfe=new Set([...f8,gh,vh]),lw=new Set([Jl,vs,zu,ec,gh,vh]),Zfe="Shift",Jfe="Control",ede="Alt",tde="Meta",nde=new Set([Zfe,Jfe,ede,tde]);function rde(e){return fn(e)&&e.tagName==="INPUT"}function XL(e){return!!(rde(e)&&e.selectionStart!=null||fn(e)&&e.tagName==="TEXTAREA")}function QL(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,o=e.scrollTop;const a=e.clientWidth<e.scrollWidth,l=e.clientHeight<e.scrollHeight;if(a&&r!=="vertical"){const u=ZL(e,t,"left"),f=By(e),d=By(t);n==="ltr"&&(u+t.offsetWidth+d.scrollMarginRight>e.scrollLeft+e.clientWidth-f.scrollPaddingRight?i=u+t.offsetWidth+d.scrollMarginRight-e.clientWidth+f.scrollPaddingRight:u-d.scrollMarginLeft<e.scrollLeft+f.scrollPaddingLeft&&(i=u-d.scrollMarginLeft-f.scrollPaddingLeft)),n==="rtl"&&(u-d.scrollMarginRight<e.scrollLeft+f.scrollPaddingLeft?i=u-d.scrollMarginLeft-f.scrollPaddingLeft:u+t.offsetWidth+d.scrollMarginRight>e.scrollLeft+e.clientWidth-f.scrollPaddingRight&&(i=u+t.offsetWidth+d.scrollMarginRight-e.clientWidth+f.scrollPaddingRight))}if(l&&r!=="horizontal"){const u=ZL(e,t,"top"),f=By(e),d=By(t);u-d.scrollMarginTop<e.scrollTop+f.scrollPaddingTop?o=u-d.scrollMarginTop-f.scrollPaddingTop:u+t.offsetHeight+d.scrollMarginBottom>e.scrollTop+e.clientHeight-f.scrollPaddingBottom&&(o=u+t.offsetHeight+d.scrollMarginBottom-e.clientHeight+f.scrollPaddingBottom)}e.scrollTo({left:i,top:o,behavior:"auto"})}function ZL(e,t,n){const r=n==="left"?"offsetLeft":"offsetTop";let i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function By(e){const t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}const ide={...yc,...$s,nestedDialogOpen(e){return e?{[Yfe.nestedDialogOpen]:""}:null}},GT=x.forwardRef(function(t,n){const{className:r,finalFocus:i,initialFocus:o,render:a,style:l,...u}=t,{store:f}=Us(),d=f.useState("descriptionElementId"),h=f.useState("disablePointerDismissal"),g=f.useState("floatingRootContext"),v=f.useState("popupProps"),b=f.useState("modal"),w=f.useState("mounted"),S=f.useState("nested"),E=f.useState("nestedOpenDialogCount"),k=f.useState("open"),O=f.useState("openMethod"),j=f.useState("titleElementId"),A=f.useState("transitionStatus"),T=f.useState("role");Wfe(),Qo({open:k,ref:f.context.popupRef,onComplete(){k&&f.context.onOpenChangeComplete?.(!0)}});function N(L){return L==="touch"?f.context.popupRef.current:!0}const P=o===void 0?N:o,F=E>0,q=vt("div",t,{state:{open:k,nested:S,transitionStatus:A,nestedDialogOpen:F},props:[v,{"aria-labelledby":j??void 0,"aria-describedby":d??void 0,role:T,tabIndex:-1,hidden:!w,onKeyDown(L){lw.has(L.key)&&L.stopPropagation()},style:{[Kfe.nestedDialogs]:E}},u],ref:[n,f.context.popupRef,f.useStateSetter("popupElement")],stateAttributesMapping:ide});return m.jsx(B0,{context:g,openInteractionType:O,disabled:!w,closeOnFocusOut:!h,initialFocus:P,returnFocus:i,modal:b!==!1,restoreFocus:"popup",children:q})}),cw=x.forwardRef(function(t,n){const{cutout:r,...i}=t;let o;if(r){const a=r.getBoundingClientRect();o=\`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,\${a.left}px \${a.top}px,\${a.left}px \${a.bottom}px,\${a.right}px \${a.bottom}px,\${a.right}px \${a.top}px,\${a.left}px \${a.top}px)\`}return m.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:o}})}),XT=x.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,{store:o}=Us(),a=o.useState("mounted"),l=o.useState("modal"),u=o.useState("open");return a||r?m.jsx(l8.Provider,{value:r,children:m.jsxs(F0,{ref:n,...i,children:[a&&l===!0&&m.jsx(cw,{ref:o.context.internalBackdropRef,inert:jg(!u)}),t.children]})}):null});let JL={},ez={},tz="";function ode(e){if(typeof document>"u")return!1;const t=jt(e);return In(t).innerWidth-t.documentElement.clientWidth>0}function ade(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=jt(e),r=n.documentElement,i=n.body,o=pc(r)?r:i,a=o.style.overflowY,l=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",o.style.overflowY="scroll";const u=o.offsetWidth;o.style.overflowY="hidden";const f=o.offsetWidth;return o.style.overflowY=a,r.style.scrollbarGutter=l,u===f}function sde(e){const t=jt(e),n=t.documentElement,r=t.body,i=pc(n)?n:r,o={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(i.style,o)}}function lde(e){const t=jt(e),n=t.documentElement,r=t.body,i=In(n);let o=0,a=0,l=!1;const u=Vn.create();if(A0&&(i.visualViewport?.scale??1)!==1)return()=>{};function f(){const v=i.getComputedStyle(n),b=i.getComputedStyle(r),E=(v.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";o=n.scrollTop,a=n.scrollLeft,JL={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},tz=n.style.scrollBehavior,ez={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const k=n.scrollHeight>n.clientHeight,O=n.scrollWidth>n.clientWidth,j=v.overflowY==="scroll"||b.overflowY==="scroll",A=v.overflowX==="scroll"||b.overflowX==="scroll",T=Math.max(0,i.innerWidth-r.clientWidth),N=Math.max(0,i.innerHeight-r.clientHeight),P=parseFloat(b.marginTop)+parseFloat(b.marginBottom),F=parseFloat(b.marginLeft)+parseFloat(b.marginRight),D=pc(n)?n:r;if(l=ade(e),l){n.style.scrollbarGutter=E,D.style.overflowY="hidden",D.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:E,overflowY:"hidden",overflowX:"hidden"}),(k||j)&&(n.style.overflowY="scroll"),(O||A)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:P||N?\`calc(100dvh - \${P+N}px)\`:"100dvh",width:F||T?\`calc(100vw - \${F+T}px)\`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=o,r.scrollLeft=a,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function d(){Object.assign(n.style,JL),Object.assign(r.style,ez),l||(n.scrollTop=o,n.scrollLeft=a,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=tz)}function h(){d(),u.request(f)}f();const g=kt(i,"resize",h);return()=>{u.cancel(),d(),typeof i.removeEventListener=="function"&&g()}}class cde{constructor(){qt(this,"lockCount",0);qt(this,"restore",null);qt(this,"timeoutLock",Ro.create());qt(this,"timeoutUnlock",Ro.create());qt(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});qt(this,"unlock",()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)})}acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}lock(t){if(this.lockCount===0||this.restore!==null)return;const r=jt(t).documentElement,i=In(r).getComputedStyle(r).overflowY;if(i==="hidden"||i==="clip"){this.restore=Yr;return}const o=mU||!ode(t);this.restore=o?sde(t):lde(t)}}const ude=new cde;function d8(e=!0,t=null){Pe(()=>{if(e)return ude.acquire(t)},[e,t])}function fde(e){const t=x.useRef(""),n=x.useCallback(i=>{i.defaultPrevented||(t.current=i.pointerType,e(i,i.pointerType))},[e]);return{onClick:x.useCallback(i=>{if(i.detail===0){e(i,"keyboard");return}"pointerType"in i?e(i,i.pointerType):e(i,t.current),t.current=""},[e]),onPointerDown:n}}function QT(e,t){const n=x.useRef(e),r=Le(t);Pe(()=>{n.current!==e&&r(n.current)},[e,r]),Pe(()=>{n.current=e},[e])}function uw(e){const[t,n]=x.useState(null),r=Le((a,l)=>{e||n(l||(mU?"touch":""))});QT(e,a=>{a&&!e&&n(null)});const{onClick:i,onPointerDown:o}=fde(r);return x.useMemo(()=>({openMethod:t,triggerProps:{onClick:i,onPointerDown:o}}),[t,i,o])}function h8(e){const{store:t,parentContext:n,actionsRef:r,isDrawer:i}=e,o=t.useState("open"),a=t.useState("disablePointerDismissal"),l=t.useState("modal"),u=t.useState("popupElement"),{openMethod:f,triggerProps:d}=uw(o);V0(t);const{forceUnmount:h}=K0(o,t),g=Le(L=>{const U=ct(L);return U.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},U}),v=x.useCallback(()=>{t.setOpen(!1,g(R0))},[t,g]);x.useImperativeHandle(r,()=>({unmount:h,close:v}),[h,v]);const b=G0({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0}),[w,S]=x.useState(0),[E,k]=x.useState(0),O=w===0,j=TT(b),A=_g(b,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:l==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(L){if(!t.context.outsidePressEnabledRef.current||"button"in L&&L.button!==0||"touches"in L&&L.touches.length!==1)return!1;const U=Sr(L);if(O&&!a){const H=U;return l&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===H||t.context.backdropRef.current===H||lt(H,u)&&!H?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:O});d8(o&&l===!0,u);const{getReferenceProps:T,getFloatingProps:N,getTriggerProps:P}=vc([j,A]);t.useContextCallback("onNestedDialogOpen",(L,U)=>{S(L),k(U)}),t.useContextCallback("onNestedDialogClose",()=>{S(0),k(0)}),x.useEffect(()=>(n?.onNestedDialogOpen&&o&&n.onNestedDialogOpen(w+1,E+(i?1:0)),n?.onNestedDialogClose&&!o&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&o&&n.onNestedDialogClose()}),[i,o,w,E,n]);const F=x.useMemo(()=>T(d),[T,d]),D=x.useMemo(()=>P(d),[P,d]),q=x.useMemo(()=>N(),[N]);t.useSyncedValues({openMethod:f,activeTriggerProps:F,inactiveTriggerProps:D,popupProps:q,floatingRootContext:b,nestedOpenDialogCount:w,nestedOpenDrawerCount:E})}const dde={...W0,modal:Te(e=>e.modal),nested:Te(e=>e.nested),nestedOpenDialogCount:Te(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:Te(e=>e.nestedOpenDrawerCount),disablePointerDismissal:Te(e=>e.disablePointerDismissal),openMethod:Te(e=>e.openMethod),descriptionElementId:Te(e=>e.descriptionElementId),titleElementId:Te(e=>e.titleElementId),viewportElement:Te(e=>e.viewportElement),role:Te(e=>e.role)};class fw extends kg{constructor(n){super(hde(n),{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new ph,onOpenChange:void 0,onOpenChangeComplete:void 0},dde);qt(this,"setOpen",(n,r)=>{if(r.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!n&&r.trigger==null&&this.state.activeTriggerId!=null&&(r.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(n,r),r.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,r);const i={open:n},o=r.trigger?.id??null;(o||n)&&(i.activeTriggerId=o,i.activeTriggerElement=r.trigger??null),this.update(i)})}static useStore(n,r){const i=pr(()=>new fw(r)).current;return n??i}}function hde(e={}){return{...Y0(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}const fO=x.createContext(!1);function p8(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:o,disablePointerDismissal:a=!1,modal:l=!0,actionsRef:u,handle:f,triggerId:d,defaultTriggerId:h=null}=e,g=Us(!0),v=x.useContext(fO),b=!!g,w=fw.useStore(f?.store,{open:r,openProp:n,activeTriggerId:h,triggerIdProp:d,modal:l,disablePointerDismissal:a,nested:b});yg(()=>{n===void 0&&w.state.open===!1&&r===!0&&w.update({open:!0,activeTriggerId:h})}),w.useControlledProp("openProp",n),w.useControlledProp("triggerIdProp",d),w.useSyncedValues({disablePointerDismissal:a,nested:b,modal:l}),w.useContextCallback("onOpenChange",i),w.useContextCallback("onOpenChangeComplete",o);const S=w.useState("payload");h8({store:w,actionsRef:u,parentContext:g?.store.context,isDrawer:v});const E=x.useMemo(()=>({store:w}),[w]);return m.jsx(fO.Provider,{value:!1,children:m.jsx(YT.Provider,{value:E,children:typeof t=="function"?t({payload:S}):t})})}const ZT=x.forwardRef(function(t,n){const{render:r,className:i,style:o,id:a,...l}=t,{store:u}=Us(),f=Br(a);return u.useSyncedValueWithCleanup("titleElementId",f),vt("h2",t,{ref:n,props:[{id:f},l]})}),pde=x.forwardRef(function(t,n){const{render:r,className:i,disabled:o=!1,nativeButton:a=!0,id:l,payload:u,handle:f,style:d,...h}=t,g=Us(!0),v=f?.store??g?.store;if(!v)throw new Error(Xt(79));const b=Br(l),w=v.useState("floatingRootContext"),S=v.useState("isOpenedByTrigger",b),E=x.useRef(null),{registerTrigger:k,isMountedByThisTrigger:O}=q0(b,E,v,{payload:u}),{getButtonProps:j,buttonRef:A}=Zo({disabled:o,native:a}),T=$0(w,{enabled:w!=null}),N=vc([T]),P={disabled:o,open:S},F=v.useState("triggerProps",O);return vt("button",t,{state:P,ref:[A,n,k,E],props:[N.getReferenceProps(),F,{[sT]:"",id:b},h,j],stateAttributesMapping:Q0})});function mde({...e}){return m.jsx(p8,{"data-slot":"sheet",...e})}function gde({...e}){return m.jsx(XT,{"data-slot":"sheet-portal",...e})}function vde({className:e,...t}){return m.jsx(WT,{"data-slot":"sheet-overlay",className:Ne("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",e),...t})}function yde({className:e,children:t,side:n="right",showCloseButton:r=!0,...i}){return m.jsxs(gde,{children:[m.jsx(vde,{}),m.jsxs(GT,{"data-slot":"sheet-content","data-side":n,className:Ne("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",e),...i,children:[t,r&&m.jsxs(sw,{"data-slot":"sheet-close",render:m.jsx(Fe,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[m.jsx(uc,{}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function xde({className:e,...t}){return m.jsx("div",{"data-slot":"sheet-header",className:Ne("flex flex-col gap-0.5 p-4",e),...t})}function bde({className:e,...t}){return m.jsx(ZT,{"data-slot":"sheet-title",className:Ne("font-heading text-base font-medium text-foreground",e),...t})}function wde({className:e,...t}){return m.jsx(s8,{"data-slot":"sheet-description",className:Ne("text-sm text-muted-foreground",e),...t})}const Sde="sidebar_state",Ede=3600*24*7,Cde="16rem",_de="18rem",kde="3rem",Ode="b",m8=x.createContext(null);function dw(){const e=x.useContext(m8);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function jde({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:o,...a}){const l=Nfe(),[u,f]=x.useState(!1),[d,h]=x.useState(e),g=t??d,v=x.useCallback(E=>{const k=typeof E=="function"?E(g):E;n?n(k):h(k),document.cookie=\`\${Sde}=\${k}; path=/; max-age=\${Ede}\`},[n,g]),b=x.useCallback(()=>l?f(E=>!E):v(E=>!E),[l,v,f]);x.useEffect(()=>{const E=k=>{k.key===Ode&&(k.metaKey||k.ctrlKey)&&(k.preventDefault(),b())};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[b]);const w=g?"expanded":"collapsed",S=x.useMemo(()=>({state:w,open:g,setOpen:v,isMobile:l,openMobile:u,setOpenMobile:f,toggleSidebar:b}),[w,g,v,l,u,f,b]);return m.jsx(m8.Provider,{value:S,children:m.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Cde,"--sidebar-width-icon":kde,...i},className:Ne("group/sidebar-wrapper flex h-svh w-full overflow-hidden has-data-[variant=inset]:bg-sidebar",r),...a,children:o})})}function Tde({side:e="left",variant:t="sidebar",collapsible:n="offcanvas",className:r,children:i,dir:o,...a}){const{isMobile:l,state:u,openMobile:f,setOpenMobile:d}=dw();return n==="none"?m.jsx("div",{"data-slot":"sidebar",className:Ne("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",r),...a,children:i}):l?m.jsx(mde,{open:f,onOpenChange:d,...a,children:m.jsxs(yde,{dir:o,"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":_de},side:e,children:[m.jsxs(xde,{className:"sr-only",children:[m.jsx(bde,{children:"Sidebar"}),m.jsx(wde,{children:"Displays the mobile sidebar."})]}),m.jsx("div",{className:"flex h-full w-full flex-col",children:i})]})}):m.jsxs("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":u,"data-collapsible":u==="collapsed"?n:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[m.jsx("div",{"data-slot":"sidebar-gap",className:Ne("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),m.jsx("div",{"data-slot":"sidebar-container","data-side":e,className:Ne("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",r),...a,children:m.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",children:i})})]})}function Ade({className:e,onClick:t,...n}){const{toggleSidebar:r}=dw();return m.jsxs(Fe,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon-sm",className:Ne(e),onClick:i=>{t?.(i),r()},...n,children:[m.jsx(Wue,{}),m.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Nde({className:e,...t}){const{toggleSidebar:n}=dw();return m.jsx("button",{"data-sidebar":"rail","data-slot":"sidebar-rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:n,title:"Toggle Sidebar",className:Ne("absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2","in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})}function Rde({className:e,...t}){return m.jsx("main",{"data-slot":"sidebar-inset",className:Ne("relative flex w-full flex-1 flex-col min-h-0 bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",e),...t})}function Pde({className:e,...t}){return m.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:Ne("flex flex-col gap-2 p-2",e),...t})}function Mde({className:e,...t}){return m.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:Ne("flex flex-col gap-2 p-2",e),...t})}function Ide({className:e,...t}){return m.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:Ne("no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function Dde({className:e,...t}){return m.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:Ne("relative flex w-full min-w-0 flex-col p-2",e),...t})}function Lde({className:e,render:t,...n}){return HT({defaultTagName:"div",props:Mo({className:Ne("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",e)},n),render:t,state:{slot:"sidebar-group-label",sidebar:"group-label"}})}function g8({className:e,...t}){return m.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:Ne("flex w-full min-w-0 flex-col gap-0",e),...t})}function v8({className:e,...t}){return m.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:Ne("group/menu-item relative",e),...t})}const zde=Ag("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function y8({render:e,isActive:t=!1,variant:n="default",size:r="default",tooltip:i,className:o,...a}){const{isMobile:l,state:u}=dw(),f=HT({defaultTagName:"button",props:Mo({className:Ne(zde({variant:n,size:r}),o)},a),render:i?m.jsx(DT,{render:e}):e,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:r,active:t}});return i?(typeof i=="string"&&(i={children:i}),m.jsxs(IT,{children:[f,m.jsx(LT,{side:"right",align:"center",hidden:u!=="collapsed"||l,...i})]})):f}const nz=e=>{let t;const n=new Set,r=(f,d)=>{const h=typeof f=="function"?f(t):f;if(!Object.is(h,t)){const g=t;t=d??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(v=>v(t,g))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>u,subscribe:f=>(n.add(f),()=>n.delete(f))},u=t=e(r,i,l);return l},Fde=(e=>e?nz(e):nz),Bde=e=>e;function $de(e,t=Bde){const n=Ie.useSyncExternalStore(e.subscribe,Ie.useCallback(()=>t(e.getState()),[e,t]),Ie.useCallback(()=>t(e.getInitialState()),[e,t]));return Ie.useDebugValue(n),n}const rz=e=>{const t=Fde(e),n=r=>$de(t,r);return Object.assign(n,t),n},Ude=(e=>e?rz(e):rz);function x8(){const e=window.location.pathname;if(e==="/analytics")return{sessionId:null,settingsOpen:!1,selectedAgentId:null,dashboardOpen:!0};const t=e.match(/^\\/agents\\/(.+)$/);if(t)return{sessionId:null,settingsOpen:!0,selectedAgentId:t[1],dashboardOpen:!1};if(e==="/settings")return{sessionId:null,settingsOpen:!0,selectedAgentId:null,dashboardOpen:!1};const n=e.match(/^\\/playground\\/(.+)$/);if(n)return{sessionId:n[1],settingsOpen:!1,selectedAgentId:null,dashboardOpen:!1};const r=e.match(/^\\/sessions\\/(.+)$/);return r?{sessionId:r[1],settingsOpen:!1,selectedAgentId:null,dashboardOpen:!1}:{sessionId:null,settingsOpen:!1,selectedAgentId:null,dashboardOpen:!1}}const $y=x8(),bn=Ude(e=>({apiKey:window.__MA_API_KEY__||localStorage.getItem("ma-api-key")||"",setApiKey:t=>{localStorage.setItem("ma-api-key",t),e({apiKey:t})},activeSessionId:$y.sessionId,setActiveSessionId:t=>{t?window.history.pushState(null,"",\`/sessions/\${t}\`):window.history.pushState(null,"","/"),e({activeSessionId:t,settingsOpen:!1})},debugOpen:!1,toggleDebug:()=>e(t=>({debugOpen:!t.debugOpen})),selectedAgentId:$y.selectedAgentId,setSelectedAgentId:t=>e({selectedAgentId:t}),settingsOpen:$y.settingsOpen,setSettingsOpen:t=>{if(t)window.history.pushState(null,"","/settings");else{const n=bn.getState().activeSessionId;window.history.pushState(null,"",n?\`/sessions/\${n}\`:"/")}e({settingsOpen:t,dashboardOpen:t?!1:bn.getState().dashboardOpen})},sidebarOpen:!0,setSidebarOpen:t=>e({sidebarOpen:t}),commandOpen:!1,setCommandOpen:t=>e({commandOpen:t}),dashboardOpen:$y.dashboardOpen,setDashboardOpen:t=>{if(t)window.history.pushState(null,"","/analytics");else{const n=bn.getState().activeSessionId;window.history.pushState(null,"",n?\`/sessions/\${n}\`:"/")}e({dashboardOpen:t,settingsOpen:t?!1:bn.getState().settingsOpen})},dashboardWindowMinutes:60,setDashboardWindowMinutes:t=>e({dashboardWindowMinutes:t})}));window.addEventListener("popstate",()=>{const{sessionId:e,settingsOpen:t,selectedAgentId:n,dashboardOpen:r}=x8();bn.setState({activeSessionId:e,settingsOpen:t,selectedAgentId:n,dashboardOpen:r})});const Hde="/v1";class qde extends Error{constructor(t,n){super(\`API error \${t}\`),this.status=t,this.body=n}}async function Xe(e,t={}){const r={"x-api-key":bn.getState().apiKey,...t.headers};t.body&&(r["Content-Type"]="application/json");const i=await fetch(\`\${Hde}\${e}\`,{...t,headers:r});if(!i.ok){const o=await i.json().catch(()=>null);throw new qde(i.status,o)}if(i.status!==204)return i.json()}function Hs(){return Bn({queryKey:["agents"],queryFn:()=>Xe("/agents?limit=50"),select:e=>e.data})}function JT(e){return Bn({queryKey:["agents",e],queryFn:()=>Xe(\`/agents/\${e}\`),enabled:!!e})}function b8(){const e=hn();return Nn({mutationFn:t=>{const n={...t};return t.engine==="claude"&&(n.tools=[{type:"agent_toolset_20260401"}]),Xe("/agents",{method:"POST",body:JSON.stringify(n)})},onSuccess:()=>e.invalidateQueries({queryKey:["agents"]})})}function Ng(){const e=hn();return Nn({mutationFn:({id:t,...n})=>Xe(\`/agents/\${t}\`,{method:"POST",body:JSON.stringify(n)}),onSuccess:()=>e.invalidateQueries({queryKey:["agents"]})})}function Vde(){const e=hn();return Nn({mutationFn:t=>Xe(\`/agents/\${t}\`,{method:"DELETE"}),onSuccess:()=>e.invalidateQueries({queryKey:["agents"]})})}function nf(){return Bn({queryKey:["environments"],queryFn:()=>Xe("/environments?limit=50"),select:e=>e.data})}function w8(){const e=hn();return Nn({mutationFn:({name:t,config:n})=>Xe("/environments",{method:"POST",body:JSON.stringify({name:t,config:{type:"cloud",provider:n?.provider,packages:{}}})}),onSuccess:()=>e.invalidateQueries({queryKey:["environments"]})})}function Kde(){const e=hn();return Nn({mutationFn:t=>Xe(\`/environments/\${t}\`,{method:"DELETE"}),onSuccess:()=>e.invalidateQueries({queryKey:["environments"]})})}function hw(){return Bn({queryKey:["sessions"],queryFn:()=>Xe("/sessions?limit=50&order=desc"),select:e=>e.data})}function yh(e){return Bn({queryKey:["sessions",e],queryFn:()=>Xe(\`/sessions/\${e}\`),enabled:!!e})}function S8(){const e=hn();return Nn({mutationFn:({agent_id:t,environment_id:n,vault_ids:r})=>Xe("/sessions",{method:"POST",body:JSON.stringify({agent:t,environment_id:n,vault_ids:r})}),onSuccess:()=>e.invalidateQueries({queryKey:["sessions"]})})}function Yde({className:e,...t}){return m.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:Ne(e),...t})}function Wde({className:e,...t}){return m.jsx("ol",{"data-slot":"breadcrumb-list",className:Ne("flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground",e),...t})}function Gde({className:e,...t}){return m.jsx("li",{"data-slot":"breadcrumb-item",className:Ne("inline-flex items-center gap-1",e),...t})}function Xde({className:e,...t}){return m.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:Ne("font-normal text-foreground",e),...t})}function eA(){return Bn({queryKey:["whoami"],queryFn:async()=>{try{return await Xe("/whoami")}catch(e){if(e?.status===404)return;throw e}},staleTime:6e4})}function tA(){return Bn({queryKey:["license"],queryFn:async()=>{try{return await Xe("/license")}catch{return{plan:"community",features:[],limits:{maxKeys:20,auditRetentionMs:10080*60*1e3}}}},staleTime:6e4})}const Qde="0.4.16",iz=[{label:"Home",to:"/",icon:Nue,exact:!0},{label:"API Keys",to:"/api-keys",icon:UT}],Zde={label:"Tenants",to:"/tenants",icon:JH},Jde=[{label:"Agents",to:"/agents",icon:QH},{label:"Environments",to:"/environments",icon:iw},{label:"Sessions",to:"/sessions",icon:zue},{label:"Secrets",to:"/secrets",icon:Due},{label:"Files",to:"/files",icon:Oue},{label:"Skills",to:"/skills",icon:mfe},{label:"Memory",to:"/memory",icon:ZH}],ehe=[{label:"Playground",to:"/playground",icon:nw},{label:"Analytics",to:"/analytics",icon:fue},{label:"API Docs",to:"/docs",icon:XH}];function dO({title:e,items:t}){const r=Zu().location.pathname;return m.jsxs(Dde,{children:[m.jsx(Lde,{children:e}),m.jsx(g8,{children:t.map(i=>{const o=i.icon,a=i.exact?r===i.to:r===i.to||r.startsWith(i.to+"/");return m.jsx(v8,{children:m.jsxs(y8,{render:m.jsx(ki,{to:i.to}),isActive:a,children:[m.jsx(o,{className:"size-4"}),m.jsx("span",{children:i.label})]})},i.to)})})]})}function the(){const{data:e}=eA(),{data:t}=tA(),n=t?.features.includes("tenancy"),r=e?.is_global_admin&&n?[...iz,Zde]:iz;return m.jsx(dO,{title:"Overview",items:r})}function nhe(){const{data:e}=eA();if(!e)return null;const t=e.is_global_admin?"global":e.tenant_id??"unscoped";return m.jsxs("div",{className:"flex items-center gap-2 px-2 pt-1 pb-0.5 text-[11px] text-sidebar-foreground/60",children:[m.jsx(JH,{className:"size-3"}),m.jsx("span",{className:"truncate font-mono",children:t})]})}function rhe(){const[e,t]=x.useState(()=>document.documentElement.classList.contains("dark"));return x.useEffect(()=>{e?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")},[e]),m.jsx("button",{onClick:()=>{const n=document.documentElement.classList.toggle("dark");localStorage.setItem("theme",n?"dark":"light"),t(n)},className:"rounded-md p-1.5 text-sidebar-foreground/60 transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","aria-label":"Toggle theme",children:e?m.jsx(xfe,{className:"size-3.5"}):m.jsx(Bue,{className:"size-3.5"})})}function ihe({...e}){return m.jsxs(Tde,{...e,children:[m.jsx(Pde,{children:m.jsx(g8,{children:m.jsx(v8,{children:m.jsxs(y8,{size:"lg",render:m.jsx(ki,{to:"/"}),children:[m.jsx("span",{className:"size-2.5 rounded-full bg-lime-500 shrink-0"}),m.jsx("span",{className:"font-mono text-sm font-semibold tracking-tight",children:"agentstep"})]})})})}),m.jsxs(Ide,{children:[m.jsx(the,{}),m.jsx(dO,{title:"Resources",items:Jde}),m.jsx(dO,{title:"Tools",items:ehe})]}),m.jsxs(Mde,{children:[m.jsx(nhe,{}),m.jsxs("div",{className:"flex items-center justify-between px-2 py-1",children:[m.jsxs("span",{className:"font-mono text-[11px] text-sidebar-foreground/50",children:["v",Qde]}),m.jsx(rhe,{})]})]}),m.jsx(Nde,{})]})}const ohe=Ag("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function an({className:e,variant:t="default",render:n,...r}){return HT({defaultTagName:"span",props:Mo({className:Ne(ohe({variant:t}),e)},r),render:n,state:{slot:"badge",variant:t}})}function eo({className:e,...t}){return m.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:m.jsx("table",{"data-slot":"table",className:Ne("w-full caption-bottom text-sm",e),...t})})}function Jo({className:e,...t}){return m.jsx("thead",{"data-slot":"table-header",className:Ne("[&_tr]:border-b",e),...t})}function to({className:e,...t}){return m.jsx("tbody",{"data-slot":"table-body",className:Ne("[&_tr:last-child]:border-0",e),...t})}function yn({className:e,...t}){return m.jsx("tr",{"data-slot":"table-row",className:Ne("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",e),...t})}function et({className:e,...t}){return m.jsx("th",{"data-slot":"table-head",className:Ne("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",e),...t})}function Ue({className:e,...t}){return m.jsx("td",{"data-slot":"table-cell",className:Ne("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",e),...t})}const E8=x.createContext(void 0);function C8(e){const t=x.useContext(E8);if(t===void 0&&!e)throw new Error(Xt(33));return t}const _8=x.createContext(void 0);function rf(e){const t=x.useContext(_8);if(t===void 0&&!e)throw new Error(Xt(36));return t}const ahe=x.createContext(void 0);function pw(e=!0){const t=x.useContext(ahe);if(t===void 0&&!e)throw new Error(Xt(25));return t}function she(e){const{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:o,typingRef:a,itemRef:l,itemMetadata:u}=e,{events:f}=o.useState("floatingTreeRoot"),d=pw(!0),h=d!==void 0;return x.useMemo(()=>({id:r,role:"menuitem",tabIndex:n?0:-1,onKeyDown(g){g.key===" "&&a?.current&&g.preventDefault()},onMouseMove(g){i&&f.emit("itemhover",{nodeId:i,target:g.currentTarget})},onClick(g){t&&f.emit("close",{domEvent:g,reason:pm})},onMouseUp(g){if(d){const v=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,h&&v&&Math.abs(g.clientX-v.x)<=1&&Math.abs(g.clientY-v.y)<=1||h&&!vU&&g.button===2)return}l.current&&o.context.allowMouseUpTriggerRef.current&&(!h||g.button===2)&&(!u||u.type==="regular-item")&&l.current.click()}}),[t,n,r,f,i,o,a,l,d,h,u])}const lhe={type:"regular-item"};function che(e){const{closeOnClick:t,disabled:n=!1,highlighted:r,id:i,store:o,typingRef:a=o.context.typingRef,nativeButton:l,itemMetadata:u,nodeId:f}=e,d=x.useRef(null),{getButtonProps:h,buttonRef:g}=Zo({disabled:n,focusableWhenDisabled:!0,native:l,composite:!0}),v=she({closeOnClick:t,highlighted:r,id:i,nodeId:f,store:o,typingRef:a,itemRef:d,itemMetadata:u}),b=x.useCallback(S=>Mo(v,{onMouseEnter(){u.type==="submenu-trigger"&&u.setActive()}},S,h),[v,h,u]),w=Po(d,g);return x.useMemo(()=>({getItemProps:b,itemRef:w}),[b,w])}const k8=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function uhe(){return x.useContext(k8)}let O8=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Rg(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:o}=e,{register:a,unregister:l,subscribeMapChange:u,elementsRef:f,labelsRef:d,nextIndexRef:h}=uhe(),g=x.useRef(-1),[v,b]=x.useState(o??(i===O8.GuessFromOrder?()=>{if(g.current===-1){const E=h.current;h.current+=1,g.current=E}return g.current}:-1)),w=x.useRef(null),S=x.useCallback(E=>{if(w.current=E,v!==-1&&E!==null&&(f.current[v]=E,d)){const k=t!==void 0;d.current[v]=k?t:r?.current?.textContent??E.textContent}},[v,f,d,t,r]);return Pe(()=>{if(o!=null)return;const E=w.current;if(E)return a(E,n),()=>{l(E)}},[o,a,l,n]),Pe(()=>{if(o==null)return u(E=>{const k=w.current?E.get(w.current)?.index:null;k!=null&&b(k)})},[o,u,b]),x.useMemo(()=>({ref:S,index:v}),[v,S])}const fhe=x.forwardRef(function(t,n){const{render:r,className:i,id:o,label:a,nativeButton:l=!1,disabled:u=!1,closeOnClick:f=!0,style:d,...h}=t,g=Rg({label:a}),v=C8(!0),b=Br(o),{store:w}=rf(),S=w.useState("isActive",g.index),E=w.useState("itemProps"),{getItemProps:k,itemRef:O}=che({closeOnClick:f,disabled:u,highlighted:S,id:b,store:w,nativeButton:l,nodeId:v?.context.nodeId,itemMetadata:lhe});return vt("div",t,{state:{disabled:u,highlighted:S},props:[E,h,k],ref:[O,n,g.ref]})}),dhe=x.createContext(void 0);function nA(e){return x.useContext(dhe)}const hhe={...yc,...$s},phe=x.forwardRef(function(t,n){const{render:r,className:i,style:o,finalFocus:a,...l}=t,{store:u}=rf(),{side:f,align:d}=C8(),h=nA()!=null,g=u.useState("open"),v=u.useState("transitionStatus"),b=u.useState("popupProps"),w=u.useState("mounted"),S=u.useState("instantType"),E=u.useState("activeTriggerElement"),k=u.useState("parent"),O=u.useState("lastOpenChangeReason"),j=u.useState("rootId"),A=u.useState("floatingRootContext"),T=u.useState("floatingTreeRoot"),N=u.useState("closeDelay"),P=u.useState("activeTriggerElement"),F=k.type==="context-menu";Qo({open:g,ref:u.context.popupRef,onComplete(){g&&u.context.onOpenChangeComplete?.(!0)}}),x.useEffect(()=>{function z(V){u.setOpen(!1,ct(V.reason,V.domEvent))}return T.events.on("close",z),()=>{T.events.off("close",z)}},[T.events,u]);const D=u.useState("hoverEnabled"),q=u.useState("disabled");OT(A,{enabled:D&&!q&&!F&&k.type!=="menubar",closeDelay:N});const L={transitionStatus:v,side:f,align:d,open:g,nested:k.type==="menu",instant:S},U=x.useCallback(z=>{u.set("popupElement",z)},[u]),H=vt("div",t,{state:L,ref:[n,u.context.popupRef,U],stateAttributesMapping:hhe,props:[b,{onKeyDown(z){h&&lw.has(z.key)&&z.stopPropagation()}},Og(v),l,{"data-rootownerid":j}]});let B=k.type===void 0||F;return(E||k.type==="menubar"&&O!==N0)&&(B=!0),m.jsx(B0,{context:A,modal:F,disabled:!w,returnFocus:a===void 0?B:a,initialFocus:k.type!=="menu",restoreFocus:!0,externalTree:k.type!=="menubar"?T:void 0,previousFocusableElement:P,nextFocusableElement:k.type===void 0?u.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:k.type===void 0?u.context.beforeContentFocusGuardRef:void 0,children:H})}),j8=x.createContext(void 0);function mhe(){const e=x.useContext(j8);if(e===void 0)throw new Error(Xt(32));return e}const ghe=x.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,{store:o}=rf();return o.useState("mounted")||r?m.jsx(j8.Provider,{value:r,children:m.jsx(F0,{ref:n,...i})}):null});function Pg(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,o=Le(i),a=x.useRef(0),l=pr(yhe).current,u=pr(vhe).current,[f,d]=x.useState(0),h=x.useRef(f),g=Le((E,k)=>{u.set(E,k??null),h.current+=1,d(h.current)}),v=Le(E=>{u.delete(E),h.current+=1,d(h.current)}),b=x.useMemo(()=>{const E=new Map;return Array.from(u.keys()).filter(O=>O.isConnected).sort(xhe).forEach((O,j)=>{const A=u.get(O)??{};E.set(O,{...A,index:j})}),E},[u,f]);Pe(()=>{if(typeof MutationObserver!="function"||b.size===0)return;const E=new MutationObserver(k=>{const O=new Set,j=A=>O.has(A)?O.delete(A):O.add(A);k.forEach(A=>{A.removedNodes.forEach(j),A.addedNodes.forEach(j)}),O.size===0&&(h.current+=1,d(h.current))});return b.forEach((k,O)=>{O.parentElement&&E.observe(O.parentElement,{childList:!0})}),()=>{E.disconnect()}},[b]),Pe(()=>{h.current===f&&(n.current.length!==b.size&&(n.current.length=b.size),r&&r.current.length!==b.size&&(r.current.length=b.size),a.current=b.size),o(b)},[o,b,n,r,f]),Pe(()=>()=>{n.current=[]},[n]),Pe(()=>()=>{r&&(r.current=[])},[r]);const w=Le(E=>(l.add(E),()=>{l.delete(E)}));Pe(()=>{l.forEach(E=>E(b))},[l,b]);const S=x.useMemo(()=>({register:g,unregister:v,subscribeMapChange:w,elementsRef:n,labelsRef:r,nextIndexRef:a}),[g,v,w,n,r,a]);return m.jsx(k8.Provider,{value:S,children:t})}function vhe(){return new Map}function yhe(){return new Set}function xhe(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const bhe=20;function rA(e,t,n,r){const[i,o]=x.useState(!1);Pe(()=>{if(!e||!t||n==null){o(!1);return}const a=jt(n).documentElement.clientWidth,l=n.offsetWidth;o(a>0&&l>0&&l>=a-bhe)},[e,t,n]),d8(e&&(!t||i),r)}const whe=x.forwardRef(function(t,n){const{anchor:r,positionMethod:i="absolute",className:o,render:a,side:l,align:u,sideOffset:f=0,alignOffset:d=0,collisionBoundary:h="clipping-ancestors",collisionPadding:g=5,arrowPadding:v=5,sticky:b=!1,disableAnchorTracking:w=!1,collisionAvoidance:S=CU,style:E,...k}=t,{store:O}=rf(),j=mhe(),A=pw(!0),T=O.useState("parent"),N=O.useState("floatingRootContext"),P=O.useState("floatingTreeRoot"),F=O.useState("mounted"),D=O.useState("open"),q=O.useState("modal"),L=O.useState("openMethod"),U=O.useState("activeTriggerElement"),H=O.useState("transitionStatus"),B=O.useState("positionerElement"),z=O.useState("instantType"),V=O.useState("hasViewport"),Q=O.useState("lastOpenChangeReason"),G=O.useState("floatingNodeId"),I=O.useState("floatingParentNodeId"),K=N.useState("domReferenceElement"),$=x.useRef(null),R=H0(B,!1,!1);let X=r,W=f,Z=d,oe=u,ie=S;T.type==="context-menu"&&(X=r??T.context?.anchor,oe=oe??"start",!l&&oe!=="center"&&(Z=t.alignOffset??2,W=t.sideOffset??-5));let J=l,se=oe;T.type==="menu"?(J=J??"inline-end",se=se??"start",ie=t.collisionAvoidance??lT):T.type==="menubar"&&(J=J??"bottom",se=se??"start");const xe=T.type==="context-menu",ne=Z0({anchor:X,floatingRootContext:N,positionMethod:A?"fixed":i,mounted:F,side:J,sideOffset:W,align:se,alignOffset:Z,arrowPadding:xe?0:v,collisionBoundary:h,collisionPadding:g,sticky:b,nodeId:G,keepMounted:j,disableAnchorTracking:w,collisionAvoidance:ie,shiftCrossAxis:xe&&!("side"in ie&&ie.side==="flip"),externalTree:P,adaptiveOrigin:V?RT:void 0});x.useEffect(()=>{function _e(de){de.open&&(de.parentNodeId===G&&O.set("hoverEnabled",!1),de.nodeId!==G&&de.parentNodeId===O.select("floatingParentNodeId")&&O.setOpen(!1,ct(sm)))}return P.events.on("menuopenchange",_e),()=>{P.events.off("menuopenchange",_e)}},[O,P.events,G]),x.useEffect(()=>{if(O.select("floatingParentNodeId")==null)return;function _e(de){if(de.open||de.nodeId!==O.select("floatingParentNodeId"))return;const be=de.reason??sm;O.setOpen(!1,ct(be))}return P.events.on("menuopenchange",_e),()=>{P.events.off("menuopenchange",_e)}},[P.events,O]);const ke=Fn();x.useEffect(()=>{D||ke.clear()},[D,ke]),x.useEffect(()=>{function _e(de){if(!(!D||de.nodeId!==O.select("floatingParentNodeId")))if(de.target&&U&&U!==de.target){const be=O.select("closeDelay");be>0?ke.isStarted()||ke.start(be,()=>{O.setOpen(!1,ct(sm))}):O.setOpen(!1,ct(sm))}else ke.clear()}return P.events.on("itemhover",_e),()=>{P.events.off("itemhover",_e)}},[P.events,D,U,O,ke]),x.useEffect(()=>{const _e={open:D,nodeId:G,parentNodeId:I,reason:O.select("lastOpenChangeReason")};P.events.emit("menuopenchange",_e)},[P.events,D,O,G,I]),Pe(()=>{const _e=K,de=$.current;if(_e&&($.current=_e),de&&_e&&_e!==de){O.set("instantType",void 0);const be=new AbortController;return R(()=>{O.set("instantType","trigger-change")},be.signal),()=>{be.abort()}}},[K,R,O]);const Ce={open:D,side:ne.side,align:ne.align,anchorHidden:ne.anchorHidden,nested:T.type==="menu",instant:z},Be=T.type==="menubar"&&T.context.modal;rA(D&&(Be||q&&Q!==or),L==="touch",B,U);const Oe=J0(t,Ce,{styles:ne.positionerStyles,transitionStatus:H,props:k,refs:[n,O.useStateSetter("positionerElement")],hidden:!F,inert:!D}),Re=F&&T.type!=="menu"&&(T.type!=="menubar"&&q&&Q!==or||T.type==="menubar"&&T.context.modal);let je=null;return T.type==="menubar"?je=T.context.contentElement:T.type===void 0&&(je=U),m.jsxs(E8.Provider,{value:ne,children:[Re&&m.jsx(cw,{ref:T.type==="context-menu"||T.type==="nested-context-menu"?T.context.internalBackdropRef:null,inert:jg(!D),cutout:je}),m.jsx(lH,{id:G,children:m.jsx(Pg,{elementsRef:O.context.itemDomElements,labelsRef:O.context.itemLabels,children:Oe})})]})}),She=x.createContext(null);function T8(e){return x.useContext(She)}const Ehe={...W0,disabled:Te(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:Te(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),openMethod:Te(e=>e.openMethod),allowMouseEnter:Te(e=>e.allowMouseEnter),stickIfOpen:Te(e=>e.stickIfOpen),parent:Te(e=>e.parent),rootId:Te(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:Te(e=>e.activeIndex),isActive:Te((e,t)=>e.activeIndex===t),hoverEnabled:Te(e=>e.hoverEnabled),instantType:Te(e=>e.instantType),lastOpenChangeReason:Te(e=>e.openChangeReason),floatingTreeRoot:Te(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:Te(e=>e.floatingNodeId),floatingParentNodeId:Te(e=>e.floatingParentNodeId),itemProps:Te(e=>e.itemProps),closeDelay:Te(e=>e.closeDelay),hasViewport:Te(e=>e.hasViewport),keyboardEventRelay:Te(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class iA extends kg{constructor(n){super({...Che(),...n},{positionerRef:x.createRef(),popupRef:x.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),onOpenChangeComplete:void 0,triggerElements:new ph},Ehe);qt(this,"unsubscribeParentListener",null);this.unsubscribeParentListener=this.observe("parent",r=>{if(this.unsubscribeParentListener?.(),r.type==="menu"){let i=r.store.select("rootId"),o=r.store.select("floatingTreeRoot"),a=r.store.select("keyboardEventRelay");this.unsubscribeParentListener=r.store.subscribe(()=>{const l=r.store.select("rootId"),u=r.store.select("floatingTreeRoot"),f=r.store.select("keyboardEventRelay");i===l&&o===u&&a===f||(i=l,o=u,a=f,this.notifyAll())}),this.context.allowMouseUpTriggerRef=r.store.context.allowMouseUpTriggerRef;return}r.type!==void 0&&(this.context.allowMouseUpTriggerRef=r.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(n,r){this.state.floatingRootContext.context.events.emit("setOpen",{open:n,eventDetails:r})}static useStore(n,r){const i=pr(()=>new iA(r)).current;return n??i}}function Che(){return{...Y0(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new wT,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Wn,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}const _he=x.createContext(void 0);function khe(){return x.useContext(_he)}const Ohe=aT(function(t){const{children:n,open:r,onOpenChange:i,onOpenChangeComplete:o,defaultOpen:a=!1,disabled:l=!1,modal:u,loopFocus:f=!0,orientation:d="vertical",actionsRef:h,closeParentOnEsc:g=!1,handle:v,triggerId:b,defaultTriggerId:w=null,highlightItemOnHover:S=!0}=t,E=pw(!0),k=rf(!0),O=T8(!0),j=khe(),A=x.useMemo(()=>j&&k?{type:"menu",store:k.store}:O?{type:"menubar",context:O}:E&&!k?{type:"context-menu",context:E}:{type:void 0},[E,k,O,j]),T=iA.useStore(v?.store,{open:a,openProp:r,activeTriggerId:w,triggerIdProp:b,parent:A});yg(()=>{r===void 0&&T.state.open===!1&&a===!0&&T.update({open:!0,activeTriggerId:w})}),T.useControlledProp("openProp",r),T.useControlledProp("triggerIdProp",b),T.useContextCallback("onOpenChangeComplete",o);const N=T.useState("floatingTreeRoot"),P=ST(N),F=La();Pe(()=>{E&&!k?T.update({parent:{type:"context-menu",context:E},floatingNodeId:P,floatingParentNodeId:F}):k&&T.update({floatingNodeId:P,floatingParentNodeId:F})},[E,k,P,F,T]);const D=T.useState("open"),q=T.useState("activeTriggerElement"),L=T.useState("positionerElement"),U=T.useState("hoverEnabled"),H=T.useState("disabled"),B=T.useState("lastOpenChangeReason"),z=T.useState("parent"),V=T.useState("activeIndex"),Q=T.useState("payload"),G=T.useState("floatingParentNodeId"),I=x.useRef(null),K=G!=null,{openMethod:$,triggerProps:R}=uw(D);T.useSyncedValues({disabled:l,modal:z.type===void 0?u:void 0,openMethod:$,rootId:Ju()}),V0(T);const{forceUnmount:X}=K0(D,T,()=>{T.update({allowMouseEnter:!1,stickIfOpen:!0})}),W=x.useRef(z.type!=="context-menu"),Z=Fn();x.useEffect(()=>{if(D||(I.current=null),z.type==="context-menu"){if(!D){Z.clear(),W.current=!1;return}Z.start(500,()=>{W.current=!0})}},[Z,D,z.type]),Pe(()=>{!D&&!U&&T.set("hoverEnabled",!0)},[D,U,T]);const oe=x.useRef(!0),ie=Fn(),J=Le((ze,Ke)=>{const tt=Ke.reason;if(D===ze&&Ke.trigger===q&&B===tt||(Ke.preventUnmountOnClose=()=>{T.set("preventUnmountingOnClose",!0)},!ze&&Ke.trigger==null&&(Ke.trigger=q??void 0),i?.(ze,Ke),Ke.isCanceled))return;T.state.floatingRootContext.dispatchOpenChange(ze,Ke);const Tt=Ke.event;if(ze===!1&&Tt?.type==="click"&&Tt.pointerType==="touch"&&!oe.current)return;if(!ze&&V!==null){const zt=T.context.itemDomElements.current[V];queueMicrotask(()=>{zt?.setAttribute("tabindex","-1")})}ze&&tt===vd?(oe.current=!1,ie.start(300,()=>{oe.current=!0})):(oe.current=!0,ie.clear());const yt=(tt===ja||tt===pm)&&Tt.detail===0&&Tt?.isTrusted,Wt=!ze&&(tt===wg||tt==null),nt={open:ze,openChangeReason:tt};I.current=Ke.event??null;const Rt=Ke.trigger?.id??null;(Rt||ze)&&(nt.activeTriggerId=Rt,nt.activeTriggerElement=Ke.trigger??null),T.update(nt),z.type==="menubar"&&(tt===vd||tt===lc||tt===or||tt===Px||tt===sm)?T.set("instantType","group"):yt||Wt?T.set("instantType",yt?"click":"dismiss"):T.set("instantType",void 0)}),se=x.useCallback(ze=>{const Ke=ct(ze);return Ke.preventUnmountOnClose=()=>{T.set("preventUnmountingOnClose",!0)},Ke},[T]),xe=x.useCallback(()=>{T.setOpen(!1,se(R0))},[T,se]);x.useImperativeHandle(h,()=>({unmount:X,close:xe}),[X,xe]);let ne;z.type==="context-menu"&&(ne=z.context),x.useImperativeHandle(ne?.positionerRef,()=>L,[L]),x.useImperativeHandle(ne?.actionsRef,()=>({setOpen:J}),[J]);const ke=G0({popupStore:T,onOpenChange:J}),Ce=ke.context.events;x.useEffect(()=>{const ze=({open:Ke,eventDetails:tt})=>J(Ke,tt);return Ce.on("setOpen",ze),()=>{Ce?.off("setOpen",ze)}},[Ce,J]);const Be=_g(ke,{enabled:!H,bubbles:{escapeKey:g&&z.type==="menu"},outsidePress(){return z.type!=="context-menu"||I.current?.type==="contextmenu"?!0:W.current},externalTree:K?N:void 0}),Ee=TT(ke,{role:"menu"}),Oe=ef(),Re=x.useCallback(ze=>{T.select("activeIndex")!==ze&&T.set("activeIndex",ze)},[T]),je=kH(ke,{enabled:!H,listRef:T.context.itemDomElements,activeIndex:V,nested:z.type!==void 0,loopFocus:f,orientation:d,parentOrientation:z.type==="menubar"?z.context.orientation:void 0,rtl:Oe==="rtl",disabledIndices:sc,onNavigate:Re,openOnArrowKeyDown:z.type!=="context-menu",externalTree:K?N:void 0,focusItemOnHover:S}),_e=x.useCallback(ze=>{T.context.typingRef.current=ze},[T]),de=OH(ke,{listRef:T.context.itemLabels,elementsRef:T.context.itemDomElements,activeIndex:V,resetMs:Ooe,onMatch:ze=>{D&&ze!==V&&T.set("activeIndex",ze)},onTypingChange:_e}),{getReferenceProps:be,getFloatingProps:ve,getItemProps:pe,getTriggerProps:Ae}=vc([Be,Ee,je,de]),ae=x.useMemo(()=>{const ze=Mo(be(),{onMouseMove(){T.set("allowMouseEnter",!0)}},R);return delete ze.role,ze},[be,T,R]),me=x.useMemo(()=>{const ze=Ae();if(!ze)return ze;const Ke=Mo(ze,R);return delete Ke.role,delete Ke["aria-controls"],Ke},[Ae,R]),De=x.useMemo(()=>ve({onMouseMove(){T.set("allowMouseEnter",!0),z.type==="menu"&&T.set("hoverEnabled",!1)},onClick(){T.select("hoverEnabled")&&T.set("hoverEnabled",!1)},onKeyDown(ze){const Ke=T.select("keyboardEventRelay");Ke&&!ze.isPropagationStopped()&&Ke(ze)}}),[ve,z.type,T]),$e=x.useMemo(()=>pe(),[pe]);T.useSyncedValues({floatingRootContext:ke,activeTriggerProps:ae,inactiveTriggerProps:me,popupProps:De,itemProps:$e});const Ve=x.useMemo(()=>({store:T,parent:A}),[T,A]),dt=m.jsx(_8.Provider,{value:Ve,children:typeof n=="function"?n({payload:Q}):n});return z.type===void 0||z.type==="context-menu"?m.jsx(cH,{externalTree:N,children:dt}):dt});function A8(e){const t=e.getBoundingClientRect(),n=In(e),r=n.getComputedStyle(e,"::before"),i=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||i.content!=="none"))return t;const a=parseFloat(r.width)||0,l=parseFloat(r.height)||0,u=parseFloat(i.width)||0,f=parseFloat(i.height)||0,d=Math.max(t.width,a,u),h=Math.max(t.height,l,f),g=d-t.width,v=h-t.height;return{left:t.left-g/2,right:t.right+g/2,top:t.top-v/2,bottom:t.bottom+v/2}}function N8(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=qT(),{ref:i,index:o}=Rg(e),a=n===o,l=x.useRef(null),u=Po(i,l);return{compositeProps:x.useMemo(()=>({tabIndex:a?0:-1,onFocus(){r(o)},onMouseMove(){const d=l.current;if(!t||!d)return;const h=d.hasAttribute("disabled")||d.ariaDisabled==="true";!a&&!h&&d.focus()}}),[a,r,o,t]),compositeRef:u,index:o}}function jhe(e){const{render:t,className:n,style:r,state:i=Wn,props:o=sc,refs:a=sc,metadata:l,stateAttributesMapping:u,tag:f="div",...d}=e,{compositeProps:h,compositeRef:g}=N8({metadata:l});return vt(f,e,{state:i,ref:[...a,g],props:[h,...o,d],stateAttributesMapping:u})}function R8(e){if(fn(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!wa(e))return R8(Ta(e))}function P8(e,t){const n=x.useRef(null),r=Le(o=>{Fr.flushSync(()=>{e.setOpen(!1,ct(lc,o.nativeEvent,o.currentTarget))}),uae(n.current)?.focus()}),i=Le(o=>{const a=e.select("positionerElement");if(a&&yd(o,a))e.context.beforeContentFocusGuardRef.current?.focus();else{Fr.flushSync(()=>{e.setOpen(!1,ct(lc,o.nativeEvent,o.currentTarget))});let l=cae(e.context.triggerFocusTargetRef.current||t.current);for(;l!==null&<(a,l);){const u=l;if(l=vT(l),l===u)break}l?.focus()}});return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function The(e){const{enabled:t=!0,mouseDownAction:n,open:r}=e,i=x.useRef(!1);return x.useMemo(()=>t?{onMouseDown:o=>{(n==="open"&&!r||n==="close"&&r)&&(i.current=!0,jt(o.currentTarget).addEventListener("click",()=>{i.current=!1},{once:!0}))},onClick:o=>{i.current&&(i.current=!1,o.preventBaseUIHandler())}}:Wn,[t,n,r])}const Uy=2,Ahe=fU(function(t,n){const{render:r,className:i,disabled:o=!1,nativeButton:a=!0,id:l,openOnHover:u,delay:f=100,closeDelay:d=0,handle:h,payload:g,style:v,...b}=t,w=rf(!0),S=h?.store??w?.store;if(!S)throw new Error(Xt(85));const E=Br(l),k=S.useState("isTriggerActive",E),O=S.useState("floatingRootContext"),j=S.useState("isOpenedByTrigger",E),A=x.useRef(null),T=Rhe(),N=qT(!0),P=gc(),F=x.useMemo(()=>P??new wT,[P]),D=ST(F),q=La(),{registerTrigger:L,isMountedByThisTrigger:U}=q0(E,A,S,{payload:g,closeDelay:d,parent:T,floatingTreeRoot:F,floatingNodeId:D,floatingParentNodeId:q,keyboardEventRelay:N?.relayKeyboardEvent}),H=T.type==="menubar",B=S.useState("disabled"),z=o||B||H&&T.context.disabled,{getButtonProps:V,buttonRef:Q}=Zo({disabled:z,native:a});x.useEffect(()=>{!j&&T.type===void 0&&(S.context.allowMouseUpTriggerRef.current=!1)},[S,j,T.type]);const G=x.useRef(null),I=Fn(),K=Le(Re=>{if(!G.current)return;I.clear(),S.context.allowMouseUpTriggerRef.current=!1;const je=Re.target;if(lt(G.current,je)||lt(S.select("positionerElement"),je)||je===G.current||je!=null&&R8(je)===S.select("rootId"))return;const _e=A8(G.current);Re.clientX>=_e.left-Uy&&Re.clientX<=_e.right+Uy&&Re.clientY>=_e.top-Uy&&Re.clientY<=_e.bottom+Uy||F.events.emit("close",{domEvent:Re,reason:_U})});x.useEffect(()=>{j&&S.select("lastOpenChangeReason")===or&&jt(G.current).addEventListener("mouseup",K,{once:!0})},[j,K,S]);const $=H&&T.context.hasSubmenuOpen,X=jT(O,{enabled:(u??$)&&!z&&T.type!=="context-menu"&&(!H||$&&!U),handleClose:AT({blockPointerEvents:!H}),mouseOnly:!0,move:!1,restMs:T.type===void 0?f:void 0,delay:{close:d},triggerElementRef:A,externalTree:F,isActiveTrigger:k,isClosing:()=>S.select("transitionStatus")==="ending"}),W=Nhe(j,S.select("lastOpenChangeReason")),Z=$0(O,{enabled:!z&&T.type!=="context-menu",event:j&&H?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:T.type===void 0?W:!1}),oe=EH(O,{enabled:!z&&$}),ie=The({open:j,enabled:H,mouseDownAction:"open"}),J=vc([Z,oe]),se={disabled:z,open:j},xe=S.useState("triggerProps",U),ne=[G,n,Q,L,A],ke=[J.getReferenceProps(),X??Wn,xe,{"aria-haspopup":"menu",id:E,onMouseDown:Re=>{if(S.select("open"))return;I.start(200,()=>{S.context.allowMouseUpTriggerRef.current=!0}),jt(Re.currentTarget).addEventListener("mouseup",K,{once:!0})}},H?{role:"menuitem"}:{},ie,b,V],{preFocusGuardRef:Ce,handlePreFocusGuardFocus:Be,handleFocusTargetFocus:Ee}=P8(S,A),Oe=vt("button",t,{enabled:!H,stateAttributesMapping:db,state:se,ref:ne,props:ke});return H?m.jsx(jhe,{tag:"button",render:r,className:i,style:v,state:se,refs:ne,props:ke,stateAttributesMapping:db}):j?m.jsxs(x.Fragment,{children:[m.jsx(cc,{ref:Ce,onFocus:Be},\`\${E}-pre-focus-guard\`),m.jsx(x.Fragment,{children:Oe},E),m.jsx(cc,{ref:S.context.triggerFocusTargetRef,onFocus:Ee},\`\${E}-post-focus-guard\`)]}):m.jsx(x.Fragment,{children:Oe},E)});function Nhe(e,t){const n=Fn(),[r,i]=x.useState(!1);return Pe(()=>{e&&t==="trigger-hover"?(i(!0),n.start(EU,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function Rhe(){const e=pw(!0),t=rf(!0),n=T8();return x.useMemo(()=>n?{type:"menubar",context:n}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,n])}function hO(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function M8({...e}){return m.jsx(Ohe,{"data-slot":"dropdown-menu",...e})}function I8({...e}){return m.jsx(Ahe,{"data-slot":"dropdown-menu-trigger",...e})}function D8({align:e="start",alignOffset:t=0,side:n="bottom",sideOffset:r=4,className:i,...o}){return m.jsx(ghe,{children:m.jsx(whe,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:n,sideOffset:r,children:m.jsx(phe,{"data-slot":"dropdown-menu-content",className:Ne("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",i),...o})})})}function pO({className:e,inset:t,variant:n="default",...r}){return m.jsx(fhe,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:Ne("group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",e),...r})}function Phe(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:o,actionsRef:a,handle:l,triggerId:u,defaultTriggerId:f=null}=e,d=Us(!0),h=!!d,g=fw.useStore(l?.store,{open:r,openProp:n,activeTriggerId:f,triggerIdProp:u,modal:!0,disablePointerDismissal:!0,nested:h,role:"alertdialog"});g.useControlledProp("openProp",n),g.useControlledProp("triggerIdProp",u),g.useSyncedValue("nested",h),g.useContextCallback("onOpenChange",i),g.useContextCallback("onOpenChangeComplete",o);const v=g.useState("payload");h8({store:g,actionsRef:a,parentContext:d?.store.context,isDrawer:!1});const b=x.useMemo(()=>({store:g}),[g]);return m.jsx(fO.Provider,{value:!1,children:m.jsx(YT.Provider,{value:b,children:typeof t=="function"?t({payload:v}):t})})}function xh({...e}){return m.jsx(Phe,{"data-slot":"alert-dialog",...e})}function Mhe({...e}){return m.jsx(XT,{"data-slot":"alert-dialog-portal",...e})}function Ihe({className:e,...t}){return m.jsx(WT,{"data-slot":"alert-dialog-overlay",className:Ne("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function bh({className:e,size:t="default",...n}){return m.jsxs(Mhe,{children:[m.jsx(Ihe,{}),m.jsx(GT,{"data-slot":"alert-dialog-content","data-size":t,className:Ne("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...n})]})}function wh({className:e,...t}){return m.jsx("div",{"data-slot":"alert-dialog-header",className:Ne("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...t})}function Sh({className:e,...t}){return m.jsx("div",{"data-slot":"alert-dialog-footer",className:Ne("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t border-border/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...t})}function Eh({className:e,...t}){return m.jsx(ZT,{"data-slot":"alert-dialog-title",className:Ne("font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...t})}function Ch({className:e,...t}){return m.jsx(s8,{"data-slot":"alert-dialog-description",className:Ne("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function _h({className:e,...t}){return m.jsx(Fe,{"data-slot":"alert-dialog-action",className:Ne(e),...t})}function kh({className:e,variant:t="outline",size:n="default",...r}){return m.jsx(sw,{"data-slot":"alert-dialog-cancel",className:Ne(e),render:m.jsx(Fe,{variant:t,size:n}),...r})}function ea({...e}){return m.jsx(p8,{"data-slot":"dialog",...e})}function Dhe({...e}){return m.jsx(pde,{"data-slot":"dialog-trigger",...e})}function Lhe({...e}){return m.jsx(XT,{"data-slot":"dialog-portal",...e})}function zhe({className:e,...t}){return m.jsx(WT,{"data-slot":"dialog-overlay",className:Ne("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function za({className:e,children:t,showCloseButton:n=!0,...r}){return m.jsxs(Lhe,{children:[m.jsx(zhe,{}),m.jsxs(GT,{"data-slot":"dialog-content",className:Ne("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...r,children:[t,n&&m.jsxs(sw,{"data-slot":"dialog-close",render:m.jsx(Fe,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[m.jsx(uc,{}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Fa({className:e,...t}){return m.jsx("div",{"data-slot":"dialog-header",className:Ne("flex flex-col gap-2",e),...t})}function mb({className:e,showCloseButton:t=!1,children:n,...r}){return m.jsxs("div",{"data-slot":"dialog-footer",className:Ne("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t border-border/50 p-4 sm:flex-row sm:justify-end",e),...r,children:[n,t&&m.jsx(sw,{render:m.jsx(Fe,{variant:"outline"}),children:"Close"})]})}function Ba({className:e,...t}){return m.jsx(ZT,{"data-slot":"dialog-title",className:Ne("font-heading text-base leading-none font-medium",e),...t})}function wt({className:e,...t}){return m.jsx("label",{"data-slot":"label",className:Ne("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}const L8=x.createContext(null),z8=x.createContext(null);function $a(){const e=x.useContext(L8);if(e===null)throw new Error(Xt(60));return e}function F8(){const e=x.useContext(z8);if(e===null)throw new Error(Xt(61));return e}const Fhe=(e,t)=>Object.is(e,t);function Wd(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Bhe(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:Wd(t,r,n))}function mm(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:Wd(r,t,n))}function $he(e,t,n){return e.filter(r=>!Wd(t,r,n))}function mO(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function B8(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Uhe(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(B8(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function $8(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return mO(e)}function cd(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?mO(e.value):mO(e)}function U8(e,t,n){function r(){return $8(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){const i=t,o=B8(i)?i.flatMap(a=>a.items):i;if(e==null||typeof e!="object"){const a=o.find(l=>l.value===e);return a&&a.label!=null?a.label:r()}if("value"in e){const a=o.find(l=>l&&l.value===e.value);if(a&&a.label!=null)return a.label}}return r()}function Hhe(e,t,n){return e.reduce((r,i,o)=>(o>0&&r.push(", "),r.push(m.jsx(x.Fragment,{children:U8(i,t,n)},o)),r),[])}const mt={id:Te(e=>e.id),labelId:Te(e=>e.labelId),modal:Te(e=>e.modal),multiple:Te(e=>e.multiple),items:Te(e=>e.items),itemToStringLabel:Te(e=>e.itemToStringLabel),itemToStringValue:Te(e=>e.itemToStringValue),isItemEqualToValue:Te(e=>e.isItemEqualToValue),value:Te(e=>e.value),hasSelectedValue:Te(e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:cd(t,r)!==""}),hasNullItemLabel:Te((e,t)=>t?Uhe(e.items):!1),open:Te(e=>e.open),mounted:Te(e=>e.mounted),forceMount:Te(e=>e.forceMount),transitionStatus:Te(e=>e.transitionStatus),openMethod:Te(e=>e.openMethod),activeIndex:Te(e=>e.activeIndex),selectedIndex:Te(e=>e.selectedIndex),isActive:Te((e,t)=>e.activeIndex===t),isSelected:Te((e,t,n)=>{const r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(o=>Wd(n,o,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:Wd(n,i,r)}),isSelectedByFocus:Te((e,t)=>e.selectedIndex===t),popupProps:Te(e=>e.popupProps),triggerProps:Te(e=>e.triggerProps),triggerElement:Te(e=>e.triggerElement),positionerElement:Te(e=>e.positionerElement),listElement:Te(e=>e.listElement),scrollUpArrowVisible:Te(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Te(e=>e.scrollDownArrowVisible),hasScrollArrows:Te(e=>e.hasScrollArrows)};function va(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const Uo=1;function oA(e,t){return Math.max(0,e-t)}function Gd(e,t){if(t<=0)return 0;const n=va(e,0,t),r=n,i=t-n,o=r<=Uo,a=i<=Uo;return o&&a?r<=i?0:t:o?0:a?t:n}function qhe(e){const{id:t,value:n,defaultValue:r=null,onValueChange:i,open:o,defaultOpen:a=!1,onOpenChange:l,name:u,form:f,autoComplete:d,disabled:h=!1,readOnly:g=!1,required:v=!1,modal:b=!0,actionsRef:w,inputRef:S,onOpenChangeComplete:E,items:k,multiple:O=!1,itemToStringLabel:j,itemToStringValue:A,isItemEqualToValue:T=Fhe,highlightItemOnHover:N=!0,children:P}=e,{clearErrors:F}=a8(),{setDirty:D,setTouched:q,setFocused:L,shouldValidateOnChange:U,validityData:H,setFilled:B,name:z,disabled:V,validation:Q,validationMode:G}=mh(),I=aw({id:t}),K=V||h,$=z??u,[R,X]=Lu({controlled:n,default:O?r??sc:r,name:"Select",state:"value"}),[W,Z]=Lu({controlled:o,default:a,name:"Select",state:"open"}),oe=x.useRef([]),ie=x.useRef([]),J=x.useRef(null),se=x.useRef(null),xe=x.useRef(0),ne=x.useRef(null),ke=x.useRef([]),Ce=x.useRef(!1),Be=x.useRef(!1),Ee=x.useRef(null),Oe=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),Re=x.useRef(!1),{mounted:je,setMounted:_e,transitionStatus:de}=hh(W),{openMethod:be,triggerProps:ve}=uw(W),pe=pr(()=>new wH({id:I,labelId:void 0,modal:b,multiple:O,itemToStringLabel:j,itemToStringValue:A,isItemEqualToValue:T,value:R,open:W,mounted:je,transitionStatus:de,items:k,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Ae=gt(pe,mt.activeIndex),ae=gt(pe,mt.selectedIndex),me=gt(pe,mt.triggerElement),De=gt(pe,mt.positionerElement),$e=_le(be),Ve=be??$e,dt=x.useMemo(()=>O&&Array.isArray(R)&&R.length===0?"":cd(R,A),[O,R,A]),ze=x.useMemo(()=>O&&Array.isArray(R)?R.map(Ot=>cd(Ot,A)):cd(R,A),[O,R,A]),Ke=ar(pe.state.triggerElement),tt=Le(()=>ze);KT(Ke,{id:I,value:R,getValue:tt});const Tt=x.useRef(R);Pe(()=>{R!==Tt.current&&pe.set("forceMount",!0)},[pe,R]),Pe(()=>{B(O?Array.isArray(R)&&R.length>0:R!=null)},[O,R,B]),Pe(function(){if(W)return;const Pt=ke.current;if(O){const Li=Array.isArray(R)?R:[];if(Li.length===0){pe.set("selectedIndex",null);return}const Jn=Li[Li.length-1],zn=mm(Pt,Jn,T);pe.set("selectedIndex",zn===-1?null:zn);return}const ti=mm(Pt,R,T);pe.set("selectedIndex",ti===-1?null:ti)},[O,W,R,ke,T,pe]),QT(R,()=>{F($),D(R!==H.initialValue),U()?Q.commit(R):Q.commit(R,!0)});const yt=Le((Ot,Pt)=>{if(l?.(Ot,Pt),!Pt.isCanceled&&(Z(Ot),!Ot&&(Pt.reason===lc||Pt.reason===N0)&&(q(!0),L(!1),G==="onBlur"&&Q.commit(R)),!Ot&&pe.state.activeIndex!==null)){const ti=oe.current[pe.state.activeIndex];queueMicrotask(()=>{ti?.setAttribute("tabindex","-1")})}}),Wt=Le(()=>{_e(!1),pe.update({activeIndex:null,openMethod:null}),E?.(!1)});Qo({enabled:!w,open:W,ref:J,onComplete(){W||Wt()}}),x.useImperativeHandle(w,()=>({unmount:Wt}),[Wt]);const nt=Le((Ot,Pt)=>{i?.(Ot,Pt),!Pt.isCanceled&&X(Ot)}),Rt=Le(()=>{const Ot=pe.state.listElement||J.current;if(!Ot)return;const Pt=oA(Ot.scrollHeight,Ot.clientHeight),ti=Gd(Ot.scrollTop,Pt),Li=ti>0,Jn=ti<Pt;pe.state.scrollUpArrowVisible!==Li&&pe.set("scrollUpArrowVisible",Li),pe.state.scrollDownArrowVisible!==Jn&&pe.set("scrollDownArrowVisible",Jn)}),zt=SH({open:W,onOpenChange:yt,elements:{reference:me,floating:De}}),Gt=$0(zt,{enabled:!g&&!K,event:"mousedown"}),Dn=_g(zt,{bubbles:!1}),Qt=kH(zt,{enabled:!g&&!K,listRef:oe,activeIndex:Ae,selectedIndex:ae,disabledIndices:sc,onNavigate(Ot){Ot===null&&!W||pe.set("activeIndex",Ot)},focusItemOnHover:N}),Ze=OH(zt,{enabled:!g&&!K&&(W||!O),listRef:ie,activeIndex:Ae,selectedIndex:ae,onMatch(Ot){W?pe.set("activeIndex",Ot):nt(ke.current[Ot],ct("none"))},onTypingChange(Ot){Ce.current=Ot}}),{getReferenceProps:At,getFloatingProps:Ft,getItemProps:ht}=vc([Gt,Dn,Qt,Ze]),En=x.useMemo(()=>Mo(At(),ve,I?{id:I}:Wn),[At,ve,I]);yg(()=>{pe.update({popupProps:Ft(),triggerProps:En})}),Pe(()=>{pe.update({id:I,modal:b,multiple:O,value:R,open:W,mounted:je,transitionStatus:de,popupProps:Ft(),triggerProps:En,items:k,itemToStringLabel:j,itemToStringValue:A,isItemEqualToValue:T,openMethod:Ve})},[pe,I,b,O,R,W,je,de,Ft,En,k,j,A,T,Ve]);const Bt=x.useMemo(()=>({store:pe,name:$,required:v,disabled:K,readOnly:g,multiple:O,itemToStringLabel:j,itemToStringValue:A,highlightItemOnHover:N,setValue:nt,setOpen:yt,listRef:oe,popupRef:J,scrollHandlerRef:se,handleScrollArrowVisibility:Rt,scrollArrowsMountedCountRef:xe,getItemProps:ht,events:zt.context.events,valueRef:ne,valuesRef:ke,labelsRef:ie,typingRef:Ce,selectionRef:Oe,selectedItemTextRef:Ee,validation:Q,onOpenChangeComplete:E,keyboardActiveRef:Be,alignItemWithTriggerActiveRef:Re,initialValueRef:Tt}),[pe,$,v,K,g,O,j,A,N,nt,yt,ht,zt.context.events,Q,E,Rt]),rn=Po(S,Q.inputRef),vr=O&&Array.isArray(R)&&R.length>0,Ln=O?void 0:$,Zn=x.useMemo(()=>!O||!Array.isArray(R)||!$?null:R.map(Ot=>{const Pt=cd(Ot,A);return m.jsx("input",{type:"hidden",form:f,name:$,value:Pt},Pt)}),[O,R,f,$,A]);return m.jsx(L8.Provider,{value:Bt,children:m.jsxs(z8.Provider,{value:zt,children:[P,m.jsx("input",{...Q.getInputValidationProps({onFocus(){pe.state.triggerElement?.focus({focusVisible:!0})},onChange(Ot){if(Ot.nativeEvent.defaultPrevented)return;const Pt=Ot.currentTarget.value,ti=ct(Wo,Ot.nativeEvent);function Li(){if(O)return;const Jn=ke.current.find(zn=>cd(zn,A).toLowerCase()===Pt.toLowerCase()||$8(zn,j).toLowerCase()===Pt.toLowerCase());Jn!=null&&(D(Jn!==H.initialValue),nt(Jn,ti),U()&&Q.commit(Jn))}pe.set("forceMount",!0),queueMicrotask(Li)}}),id:I&&Ln==null?\`\${I}-hidden-input\`:void 0,form:f,name:Ln,autoComplete:d,value:dt,disabled:K,required:v&&!vr,readOnly:g,ref:rn,style:$?NU:fT,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Zn]})})}function Vhe(e,t){return e??t}const Hy=2,Khe=400,oz=200,Yhe={...db,...VT,value:()=>null},Whe=x.forwardRef(function(t,n){const{render:r,className:i,id:o,disabled:a=!1,nativeButton:l=!0,style:u,...f}=t,{setTouched:d,setFocused:h,validationMode:g,state:v,disabled:b}=mh(),{labelId:w}=ow(),{store:S,setOpen:E,selectionRef:k,validation:O,readOnly:j,required:A,alignItemWithTriggerActiveRef:T,disabled:N,keyboardActiveRef:P}=$a(),F=b||N||a,D=gt(S,mt.open),q=gt(S,mt.value),L=gt(S,mt.triggerProps),U=gt(S,mt.positionerElement),H=gt(S,mt.listElement),B=gt(S,mt.id),z=gt(S,mt.labelId),V=gt(S,mt.hasSelectedValue),Q=!V&&D,G=gt(S,mt.hasNullItemLabel,Q),I=o??B,K=Vhe(w,z);aw({id:I});const $=ar(U),R=x.useRef(null),{getButtonProps:X,buttonRef:W}=Zo({disabled:F,native:l}),Z=Le(Be=>{S.set("triggerElement",Be)}),oe=Po(n,R,W,Z),ie=Fn(),J=Fn(),se=Fn(),xe=Fn();x.useEffect(()=>{if(D)return!(V||G)?se.start(Khe,()=>{k.current.allowUnselectedMouseUp=!0,k.current.allowSelectedMouseUp=!0}):xe.start(oz,()=>{k.current.allowUnselectedMouseUp=!0,se.start(oz,()=>{k.current.allowSelectedMouseUp=!0})}),()=>{se.clear(),xe.clear()};k.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},J.clear()},[D,V,G,k,J,se,xe]);const ne=x.useMemo(()=>H?.id??Mm(U)?.id,[H,U]),ke=Mo(L,{id:I,role:"combobox","aria-expanded":D?"true":"false","aria-haspopup":"listbox","aria-controls":D?ne:void 0,"aria-labelledby":K,"aria-readonly":j||void 0,"aria-required":A||void 0,tabIndex:F?-1:0,ref:oe,onFocus(Be){h(!0),D&&T.current&&E(!1,ct(Wo,Be.nativeEvent)),ie.start(0,()=>{S.set("forceMount",!0)})},onBlur(Be){lt(U,Be.relatedTarget)||(d(!0),h(!1),g==="onBlur"&&O.commit(q))},onPointerMove(){P.current=!1},onKeyDown(){P.current=!0},onMouseDown(Be){if(D)return;const Ee=jt(Be.currentTarget);function Oe(Re){if(!R.current)return;const je=Re.target;if(lt(R.current,je)||lt($.current,je)||je===R.current)return;const _e=A8(R.current);Re.clientX>=_e.left-Hy&&Re.clientX<=_e.right+Hy&&Re.clientY>=_e.top-Hy&&Re.clientY<=_e.bottom+Hy||E(!1,ct(_U,Re))}J.start(0,()=>{Ee.addEventListener("mouseup",Oe,{once:!0})})}},O.getValidationProps,f,X);ke.role="combobox";const Ce={...v,open:D,disabled:F,value:q,readOnly:j,placeholder:!V};return vt("button",t,{ref:[n,R],state:Ce,stateAttributesMapping:Yhe,props:ke})}),Ghe={value:()=>null},Xhe=x.forwardRef(function(t,n){const{className:r,render:i,children:o,placeholder:a,style:l,...u}=t,{store:f,valueRef:d}=$a(),h=gt(f,mt.value),g=gt(f,mt.items),v=gt(f,mt.itemToStringLabel),b=gt(f,mt.hasSelectedValue),w=!b&&a!=null&&o==null,S=gt(f,mt.hasNullItemLabel,w),E={value:h,placeholder:!b};let k=null;return typeof o=="function"?k=o(h):o!=null?k=o:!b&&a!=null&&!S?k=a:Array.isArray(h)?k=Hhe(h,g,v):k=U8(h,g,v),vt("span",t,{state:E,ref:[n,d],props:[{children:k},u],stateAttributesMapping:Ghe})}),Qhe=x.forwardRef(function(t,n){const{className:r,render:i,style:o,...a}=t,{store:l}=$a(),f={open:gt(l,mt.open)};return vt("span",t,{state:f,ref:n,props:[{"aria-hidden":!0,children:"\u25BC"},a],stateAttributesMapping:Q0})}),Zhe=x.createContext(void 0),Jhe=x.forwardRef(function(t,n){const{store:r}=$a(),i=gt(r,mt.mounted),o=gt(r,mt.forceMount);return i||o?m.jsx(Zhe.Provider,{value:!0,children:m.jsx(F0,{ref:n,...t})}):null}),H8=x.createContext(void 0);function aA(){const e=x.useContext(H8);if(!e)throw new Error(Xt(59));return e}function gb(e,t){e&&Object.assign(e.style,t)}const q8={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},epe={position:"fixed"},tpe=x.forwardRef(function(t,n){const{anchor:r,positionMethod:i="absolute",className:o,render:a,side:l="bottom",align:u="center",sideOffset:f=0,alignOffset:d=0,collisionBoundary:h="clipping-ancestors",collisionPadding:g,arrowPadding:v=5,sticky:b=!1,disableAnchorTracking:w,alignItemWithTrigger:S=!0,collisionAvoidance:E=CU,style:k,...O}=t,{store:j,listRef:A,labelsRef:T,alignItemWithTriggerActiveRef:N,selectedItemTextRef:P,valuesRef:F,initialValueRef:D,popupRef:q,setValue:L}=$a(),U=F8(),H=gt(j,mt.open),B=gt(j,mt.mounted),z=gt(j,mt.modal),V=gt(j,mt.value),Q=gt(j,mt.openMethod),G=gt(j,mt.positionerElement),I=gt(j,mt.triggerElement),K=gt(j,mt.isItemEqualToValue),$=gt(j,mt.transitionStatus),R=x.useRef(null),X=x.useRef(null),[W,Z]=x.useState(S),oe=B&&W&&Q!=="touch";!B&&W!==S&&Z(S),Pe(()=>{B||(mt.scrollUpArrowVisible(j.state)&&j.set("scrollUpArrowVisible",!1),mt.scrollDownArrowVisible(j.state)&&j.set("scrollDownArrowVisible",!1))},[j,B]),x.useImperativeHandle(N,()=>oe),rA((oe||z)&&H,Q==="touch",G,I);const ie=Z0({anchor:r,floatingRootContext:U,positionMethod:i,mounted:B,side:l,sideOffset:f,align:u,alignOffset:d,arrowPadding:v,collisionBoundary:h,collisionPadding:g,sticky:b,disableAnchorTracking:w??oe,collisionAvoidance:E,keepMounted:!0}),J=oe?"none":ie.side,se=oe?epe:ie.positionerStyles,xe={open:H,side:J,align:ie.align,anchorHidden:ie.anchorHidden},ne=Le(Oe=>{j.set("positionerElement",Oe)}),ke=J0(t,xe,{styles:se,transitionStatus:$,props:O,refs:[n,ne],hidden:!B,inert:!H}),Ce=x.useRef(0),Be=Le(Oe=>{if(Oe.size===0&&Ce.current===0||F.current.length===0)return;const Re=Ce.current;if(Ce.current=Oe.size,Oe.size===Re)return;const je=ct(Wo);if(Re!==0&&!j.state.multiple&&V!==null&&mm(F.current,V,K)===-1){const de=D.current,ve=de!=null&&mm(F.current,de,K)!==-1?de:null;L(ve,je),ve===null&&(j.set("selectedIndex",null),P.current=null)}if(Re!==0&&j.state.multiple&&Array.isArray(V)){const _e=be=>mm(F.current,be,K)!==-1,de=V.filter(be=>_e(be));(de.length!==V.length||de.some(be=>!Bhe(V,be,K)))&&(L(de,je),de.length===0&&(j.set("selectedIndex",null),P.current=null))}if(H&&oe){j.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const _e={height:""};gb(G,_e),gb(q.current,_e)}}),Ee=x.useMemo(()=>({...ie,side:J,alignItemWithTriggerActive:oe,setControlledAlignItemWithTrigger:Z,scrollUpArrowRef:R,scrollDownArrowRef:X}),[ie,J,oe,Z]);return m.jsx(Pg,{elementsRef:A,labelsRef:T,onMapChange:Be,children:m.jsxs(H8.Provider,{value:Ee,children:[B&&z&&m.jsx(cw,{inert:jg(!H),cutout:I}),ke]})})}),qy="base-ui-disable-scrollbar",zm={className:qy,getElement(e){return m.jsx("style",{nonce:e,href:qy,precedence:"base-ui:low",children:\`.\${qy}{scrollbar-width:none}.\${qy}::-webkit-scrollbar{display:none}\`})}},npe=x.createContext(void 0),rpe={disableStyleElements:!1};function V8(){return x.useContext(npe)??rpe}const ipe={...yc,...$s},ope=x.forwardRef(function(t,n){const{render:r,className:i,style:o,finalFocus:a,...l}=t,{store:u,popupRef:f,onOpenChangeComplete:d,setOpen:h,valueRef:g,selectedItemTextRef:v,keyboardActiveRef:b,multiple:w,handleScrollArrowVisibility:S,scrollHandlerRef:E,listRef:k,highlightItemOnHover:O}=$a(),{side:j,align:A,alignItemWithTriggerActive:T,isPositioned:N,setControlledAlignItemWithTrigger:P,scrollDownArrowRef:F,scrollUpArrowRef:D}=aA(),q=nA()!=null,L=F8(),U=ef(),{nonce:H,disableStyleElements:B}=V8(),z=gt(u,mt.id),V=gt(u,mt.open),Q=gt(u,mt.mounted),G=gt(u,mt.popupProps),I=gt(u,mt.transitionStatus),K=gt(u,mt.triggerElement),$=gt(u,mt.positionerElement),R=gt(u,mt.listElement),X=x.useRef(!1),W=x.useRef(!1),Z=x.useRef({}),oe=Sg(),ie=Le(ne=>{if(!$||!f.current||!W.current)return;if(X.current||!T){S();return}const ke=$.style.top==="0px",Ce=$.style.bottom==="0px";if(!ke&&!Ce){S();return}const Be=sz($),Ee=um($.getBoundingClientRect().height,"y",Be),Oe=jt($),Re=getComputedStyle($),je=parseFloat(Re.marginTop),_e=parseFloat(Re.marginBottom),de=az(getComputedStyle(f.current)),be=Math.min(Oe.documentElement.clientHeight-je-_e,de),ve=ne.scrollTop,pe=Vy(ne);let Ae=0,ae=null,me=!1,De=!1;const $e=Ke=>{$.style.height=\`\${Ke}px\`},Ve=(Ke,tt)=>{const Tt=va(Ke,0,be-Ee);Tt>0&&$e(Ee+Tt),ne.scrollTop=tt,be-(Ee+Tt)<=Uo&&(X.current=!0),S()},dt=ke?pe-ve:ve,ze=Math.min(Ee+dt,be);if(Ae=ze,dt<=Uo){Ve(dt,ke?pe:0);return}if(be-ze>Uo)ke?De=!0:ae=0;else if(me=!0,Ce&&ve<pe){const Ke=Ee+dt-be;ae=ve-(dt-Ke)}if(Ae=Math.ceil(Ae),Ae!==0&&$e(Ae),De||ae!=null){const Ke=Vy(ne),tt=De?Ke:va(ae,0,Ke);Math.abs(ne.scrollTop-tt)>Uo&&(ne.scrollTop=tt)}(me||Ae>=be-Uo)&&(X.current=!0),S()});x.useImperativeHandle(E,()=>ie,[ie]),Qo({open:V,ref:f,onComplete(){V&&d?.(!0)}});const J={open:V,transitionStatus:I,side:j,align:A};Pe(()=>{!$||!f.current||Object.keys(Z.current).length||(Z.current={top:$.style.top||"0",left:$.style.left||"0",right:$.style.right,height:$.style.height,bottom:$.style.bottom,minHeight:$.style.minHeight,maxHeight:$.style.maxHeight,marginTop:$.style.marginTop,marginBottom:$.style.marginBottom})},[f,$]),Pe(()=>{V||T||(W.current=!1,X.current=!1,gb($,Z.current))},[V,T,$,f]),Pe(()=>{const ne=f.current;if(!V||!K||!$||!ne||T&&!N||u.state.transitionStatus==="ending")return;if(!T){W.current=!0,oe.request(S),ne.style.removeProperty("--transform-origin");return}const ke=ape(ne);ne.style.removeProperty("--transform-origin");try{const Ce=v.current,Be=g.current,Ee=getComputedStyle($),Oe=getComputedStyle(ne),Re=jt(K),je=In($),_e=sz(K),de=Ky(K.getBoundingClientRect(),_e),be=Ky($.getBoundingClientRect(),_e),ve=de.height,pe=R||ne,Ae=pe.scrollHeight,ae=parseFloat(Oe.borderBottomWidth),me=parseFloat(Ee.marginTop)||10,De=parseFloat(Ee.marginBottom)||10,$e=parseFloat(Ee.minHeight)||100,Ve=az(Oe),dt=5,ze=5,Ke=20,tt=Re.documentElement.clientHeight-me-De,Tt=Re.documentElement.clientWidth,yt=tt-de.bottom+ve;let Wt,nt=U==="rtl"?de.right-be.width:de.left,Rt=0;if(Ce&&Be){const rn=Ky(Be.getBoundingClientRect(),_e);Wt=Ky(Ce.getBoundingClientRect(),_e),nt=be.left+(U==="rtl"?rn.right-Wt.right:rn.left-Wt.left);const vr=rn.top-de.top+rn.height/2;Rt=Wt.top-be.top+Wt.height/2-vr}const zt=yt+Rt+De+ae;let Gt=Math.min(tt,zt);const Dn=tt-me-De,Qt=zt-Gt,Ze=Tt-ze;$.style.left=\`\${va(nt,dt,Ze-be.width)}px\`,$.style.height=\`\${Gt}px\`,$.style.maxHeight="auto",$.style.marginTop=\`\${me}px\`,$.style.marginBottom=\`\${De}px\`,ne.style.height="100%";const At=Vy(pe),Ft=Qt>=At-Uo;Ft&&(Gt=Math.min(tt,be.height)-(Qt-At));const ht=de.top<Ke||de.bottom>tt-Ke||Math.ceil(Gt)+Uo<Math.min(Ae,$e),En=(je.visualViewport?.scale??1)!==1&&A0;if(ht||En){W.current=!0,gb($,Z.current),P(!1);return}const Bt=Math.max($e,Gt);if(Ft){const rn=Math.max(0,tt-zt);$.style.top=be.height>=Dn?"0":\`\${rn}px\`,$.style.height=\`\${Gt}px\`,pe.scrollTop=Vy(pe)}else $.style.bottom="0",pe.scrollTop=Qt;if(Wt){const rn=be.top,vr=be.height,Ln=Wt.top+Wt.height/2,Zn=vr>0?(Ln-rn)/vr*100:50,Ot=va(Zn,0,100);ne.style.setProperty("--transform-origin",\`50% \${Ot}%\`)}(Bt===tt||Gt>=Ve)&&(X.current=!0),S(),O&&u.state.selectedIndex===null&&u.state.activeIndex===null&&k.current[0]!=null&&u.set("activeIndex",0),W.current=!0}finally{ke()}},[u,V,$,K,g,v,f,S,T,P,oe,F,D,R,k,O,U,N]),x.useEffect(()=>{if(!T||!$||!V)return;const ne=In($);function ke(Ce){h(!1,ct(Roe,Ce))}return kt(ne,"resize",ke)},[h,T,$,V]);const se={...R?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":w||void 0,id:\`\${z}-list\`},onKeyDown(ne){b.current=!0,q&&lw.has(ne.key)&&ne.stopPropagation()},onMouseMove(){b.current=!1},onScroll(ne){R||ie(ne.currentTarget)},...T&&{style:R?{height:"100%"}:q8}},xe=vt("div",t,{ref:[n,f],state:J,stateAttributesMapping:ipe,props:[G,se,Og(I),{className:!R&&T?zm.className:void 0},l]});return m.jsxs(x.Fragment,{children:[!B&&zm.getElement(H),m.jsx(B0,{context:L,modal:!1,disabled:!Q,returnFocus:a,restoreFocus:!0,children:xe})]})});function az(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function Vy(e){return oA(e.scrollHeight,e.clientHeight)}function sz(e){return gH.getScale(e)}function um(e,t,n){return e/n[t]}function Ky(e,t){return Im({x:um(e.x,"x",t),y:um(e.y,"y",t),width:um(e.width,"x",t),height:um(e.height,"y",t)})}const lz=[["transform","none"],["scale","1"],["translate","0 0"]];function ape(e){const{style:t}=e,n={};for(const[r,i]of lz)n[r]=t.getPropertyValue(r),t.setProperty(r,i,"important");return()=>{for(const[r]of lz){const i=n[r];i?t.setProperty(r,i):t.removeProperty(r)}}}const spe=x.forwardRef(function(t,n){const{className:r,render:i,style:o,...a}=t,{store:l,scrollHandlerRef:u}=$a(),{alignItemWithTriggerActive:f}=aA(),d=gt(l,mt.hasScrollArrows),h=gt(l,mt.openMethod),g=gt(l,mt.multiple),b={id:\`\${gt(l,mt.id)}-list\`,role:"listbox","aria-multiselectable":g||void 0,onScroll(S){u.current?.(S.currentTarget)},...f&&{style:q8},className:d&&h!=="touch"?zm.className:void 0},w=Le(S=>{l.set("listElement",S)});return vt("div",t,{ref:[n,w],props:[b,a]})}),K8=x.createContext(void 0);function sA(){const e=x.useContext(K8);if(!e)throw new Error(Xt(57));return e}const lpe=x.memo(x.forwardRef(function(t,n){const{render:r,className:i,value:o=null,label:a,disabled:l=!1,nativeButton:u=!1,style:f,...d}=t,h=x.useRef(null),g=Rg({label:a,textRef:h,indexGuessBehavior:O8.GuessFromOrder}),{store:v,getItemProps:b,setOpen:w,setValue:S,selectionRef:E,typingRef:k,valuesRef:O,multiple:j,selectedItemTextRef:A}=$a(),T=gt(v,mt.isActive,g.index),N=gt(v,mt.isSelected,g.index,o),P=gt(v,mt.isSelectedByFocus,g.index),F=gt(v,mt.isItemEqualToValue),D=g.index,q=D!==-1,L=x.useRef(null),U=ar(D);Pe(()=>{if(!q)return;const W=O.current;return W[D]=o,()=>{delete W[D]}},[q,D,o,O]),Pe(()=>{if(!q)return;const W=v.state.value;let Z=W;j&&Array.isArray(W)&&W.length>0&&(Z=W[W.length-1]),Z!==void 0&&Wd(o,Z,F)&&(v.set("selectedIndex",D),h.current&&(A.current=h.current))},[q,D,j,F,v,o,A]);const H={disabled:l,selected:N,highlighted:T},B=b({active:T,selected:N});B.id=void 0;const z=x.useRef(null),V=x.useRef("mouse"),Q=x.useRef(!1),{getButtonProps:G,buttonRef:I}=Zo({disabled:l,focusableWhenDisabled:!0,native:u,composite:!0});function K(W){const Z=v.state.value;if(j){const oe=Array.isArray(Z)?Z:[],ie=N?$he(oe,o,F):[...oe,o];S(ie,ct(pm,W))}else S(o,ct(pm,W)),w(!1,ct(pm,W))}const $={role:"option","aria-selected":N,tabIndex:T?0:-1,onTouchStart(){E.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(W){z.current=W.key,v.set("activeIndex",D),W.key===" "&&k.current&&W.preventDefault()},onClick(W){Q.current=!1,!(W.type==="keydown"&&z.current===null)&&(l||W.type==="keydown"&&z.current===" "&&k.current||V.current!=="touch"&&!T||(z.current=null,K(W.nativeEvent)))},onPointerEnter(W){V.current=W.pointerType},onPointerDown(W){V.current=W.pointerType,Q.current=!0},onMouseUp(){if(l)return;if(Q.current){Q.current=!1;return}const W=!E.current.allowSelectedMouseUp&&N,Z=!E.current.allowUnselectedMouseUp&&!N;W||Z||V.current!=="touch"&&!T||L.current?.click()}},R=vt("div",t,{ref:[I,n,g.ref,L],state:H,props:[B,$,d,G]}),X=x.useMemo(()=>({selected:N,indexRef:U,textRef:h,selectedByFocus:P,hasRegistered:q}),[N,U,h,P,q]);return m.jsx(K8.Provider,{value:X,children:R})})),cpe=x.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:i}=sA();return r||i?m.jsx(upe,{...t,ref:n}):null}),upe=x.memo(x.forwardRef((e,t)=>{const{render:n,className:r,style:i,keepMounted:o,...a}=e,{selected:l}=sA(),u=x.useRef(null),{transitionStatus:f,setMounted:d}=hh(l),g=vt("span",e,{ref:[t,u],state:{selected:l,transitionStatus:f},props:[{"aria-hidden":!0,children:"\u2714\uFE0F"},a],stateAttributesMapping:$s});return Qo({open:l,ref:u,onComplete(){l||d(!1)}}),g})),fpe=x.memo(x.forwardRef(function(t,n){const{indexRef:r,textRef:i,selectedByFocus:o,hasRegistered:a}=sA(),{selectedItemTextRef:l}=$a(),{className:u,render:f,style:d,...h}=t,g=x.useCallback(b=>{if(!b||!a)return;const w=l.current===null||!l.current.isConnected;(o||w&&r.current===0)&&(l.current=b)},[l,r,o,a]);return vt("div",t,{ref:[g,n,i],props:h})})),Y8=x.forwardRef(function(t,n){const{render:r,className:i,style:o,direction:a,keepMounted:l=!1,...u}=t,f=a==="up",{store:d,popupRef:h,listRef:g,handleScrollArrowVisibility:v,scrollArrowsMountedCountRef:b}=$a(),{side:w,scrollDownArrowRef:S,scrollUpArrowRef:E}=aA(),k=f?mt.scrollUpArrowVisible:mt.scrollDownArrowVisible,O=gt(d,k),j=gt(d,mt.openMethod),A=O&&j!=="touch",T=Fn(),N=f?E:S,{transitionStatus:P,setMounted:F}=hh(A);Pe(()=>(b.current+=1,d.state.hasScrollArrows||d.set("hasScrollArrows",!0),()=>{b.current=Math.max(0,b.current-1),b.current===0&&d.state.hasScrollArrows&&d.set("hasScrollArrows",!1)}),[d,b]),Qo({open:A,ref:N,onComplete(){A||F(!1)}});const L=vt("div",t,{ref:[n,N],state:{direction:a,visible:A,side:w,transitionStatus:P},props:[{"aria-hidden":!0,children:f?"\u25B2":"\u25BC",style:{position:"absolute"},onMouseMove(H){if(H.movementX===0&&H.movementY===0||T.isStarted())return;d.set("activeIndex",null);function B(){const z=d.state.listElement??h.current;if(!z)return;d.set("activeIndex",null),v();const V=oA(z.scrollHeight,z.clientHeight),Q=Gd(z.scrollTop,V),G=Q===(f?0:V),I=g.current;if(Q!==z.scrollTop&&(z.scrollTop=Q),I.length===0&&d.set(f?"scrollUpArrowVisible":"scrollDownArrowVisible",!G),G){T.clear();return}if(I.length>0){const K=N.current?.offsetHeight||0;z.scrollTop=dpe(I,f,Q,z.clientHeight,K,V)}T.start(40,B)}T.start(40,B)},onMouseLeave(){T.clear()}},u]});return A||l?L:null});function dpe(e,t,n,r,i,o){if(t){let d=0;const h=n+i-Uo;for(let b=0;b<e.length;b+=1){const w=e[b];if(w&&w.offsetTop>=h){d=b;break}}const g=Math.max(0,d-1),v=e[g];return g<d&&v?Gd(v.offsetTop-i,o):0}let a=e.length-1;const l=n+r-i+Uo;for(let d=0;d<e.length;d+=1){const h=e[d];if(h&&h.offsetTop+h.offsetHeight>l){a=Math.max(0,d-1);break}}const u=Math.min(e.length-1,a+1),f=e[u];return u>a&&f?Gd(f.offsetTop+f.offsetHeight-r+i,o):o}const hpe=x.forwardRef(function(t,n){return m.jsx(Y8,{...t,ref:n,direction:"down"})}),ppe=x.forwardRef(function(t,n){return m.jsx(Y8,{...t,ref:n,direction:"up"})}),W8=x.createContext(void 0);function mpe(){const e=x.useContext(W8);if(e===void 0)throw new Error(Xt(56));return e}const gpe=x.forwardRef(function(t,n){const{className:r,render:i,style:o,...a}=t,[l,u]=x.useState(),f=x.useMemo(()=>({labelId:l,setLabelId:u}),[l,u]),d=vt("div",t,{ref:n,props:[{role:"group","aria-labelledby":l},a]});return m.jsx(W8.Provider,{value:f,children:d})}),vpe=x.forwardRef(function(t,n){const{className:r,render:i,id:o,style:a,...l}=t,{setLabelId:u}=mpe(),f=Br(o);return Pe(()=>{u(f)},[f,u]),vt("div",t,{ref:n,props:[{id:f},l]})}),To=qhe;function cz({className:e,...t}){return m.jsx(gpe,{"data-slot":"select-group",className:Ne("scroll-my-1 p-1",e),...t})}function Oh({className:e,...t}){return m.jsx(Xhe,{"data-slot":"select-value",className:Ne("flex flex-1 text-left",e),...t})}function Ao({className:e,size:t="default",children:n,...r}){return m.jsxs(Whe,{"data-slot":"select-trigger","data-size":t,className:Ne("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,m.jsx(Qhe,{render:m.jsx(Tg,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function No({className:e,children:t,side:n="bottom",sideOffset:r=4,align:i="center",alignOffset:o=0,alignItemWithTrigger:a=!0,...l}){return m.jsx(Jhe,{children:m.jsx(tpe,{side:n,sideOffset:r,align:i,alignOffset:o,alignItemWithTrigger:a,className:"isolate z-50",children:m.jsxs(ope,{"data-slot":"select-content","data-align-trigger":a,className:Ne("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...l,children:[m.jsx(ype,{}),m.jsx(spe,{children:t}),m.jsx(xpe,{})]})})})}function uz({className:e,...t}){return m.jsx(vpe,{"data-slot":"select-label",className:Ne("px-1.5 py-1 text-xs text-muted-foreground",e),...t})}function ai({className:e,children:t,...n}){return m.jsxs(lpe,{"data-slot":"select-item",className:Ne("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[m.jsx(fpe,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),m.jsx(cpe,{render:m.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:m.jsx(Aa,{className:"pointer-events-none"})})]})}function ype({className:e,...t}){return m.jsx(ppe,{"data-slot":"select-scroll-up-button",className:Ne("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:m.jsx(e8,{})})}function xpe({className:e,...t}){return m.jsx(hpe,{"data-slot":"select-scroll-down-button",className:Ne("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:m.jsx(Tg,{})})}const Xd={claude:["claude-sonnet-4-6","claude-opus-4-6","claude-haiku-4-5"],opencode:["anthropic/claude-sonnet-4-6","anthropic/claude-opus-4-6","openai/gpt-5.4","openai/gpt-5.4-mini"],codex:["gpt-5.4-mini","gpt-5.4","gpt-5.3-codex"],gemini:["gemini-3.1-pro-preview","gemini-3.1-flash-preview","gemini-2.5-pro","gemini-2.5-flash"],factory:["claude-sonnet-4-6","claude-opus-4-6","gpt-5.4","gemini-3.1-pro-preview"],pi:["anthropic/claude-sonnet-4-6","anthropic/claude-opus-4-6","openai/gpt-5.4","google/gemini-2.5-flash"]},lA=Object.keys(Xd),Fm=["docker","apple-container","podman"],ju=["anthropic","sprites","e2b","vercel","daytona","fly","modal"];[...Fm,...ju];const G8={anthropic:{key:"ANTHROPIC_API_KEY",label:"Anthropic API Key",placeholder:"sk-ant-..."},sprites:{key:"SPRITE_TOKEN",label:"Sprites.dev Token",placeholder:"user/org/.../token"},e2b:{key:"E2B_API_KEY",label:"E2B API Key",placeholder:"e2b_..."},vercel:{key:"VERCEL_TOKEN",label:"Vercel Token",placeholder:"..."},daytona:{key:"DAYTONA_API_KEY",label:"Daytona API Key",placeholder:"..."},fly:{key:"FLY_API_TOKEN",label:"Fly.io API Token",placeholder:"fo1_..."},modal:{key:"MODAL_TOKEN_ID",label:"Modal Token ID",placeholder:"..."}},bpe={claude:{key:"ANTHROPIC_API_KEY",label:"Anthropic API Key or OAuth Token"},codex:{key:"OPENAI_API_KEY",label:"OpenAI API Key"},gemini:{key:"GEMINI_API_KEY",label:"Gemini API Key"},factory:{key:"ANTHROPIC_API_KEY",label:"Anthropic API Key"},pi:{key:"ANTHROPIC_API_KEY",label:"Anthropic API Key"}};function gO(e){return e.includes("/")?!1:!["claude-","gpt-","o1-","o3-","o4-","codex-","chatgpt-","gemini-"].some(n=>e.startsWith(n))}function wpe(e,t){if(!gO(t))return e==="opencode"||e==="pi"?t.startsWith("openai/")?{key:"OPENAI_API_KEY",label:"OpenAI API Key"}:t.startsWith("google/")||t.startsWith("gemini/")?{key:"GEMINI_API_KEY",label:"Gemini API Key"}:{key:"ANTHROPIC_API_KEY",label:"Anthropic API Key"}:bpe[e]}const X8=x.createContext(void 0);function Mg(e){const t=x.useContext(X8);if(t===void 0&&!e)throw new Error(Xt(47));return t}function Spe(){return{...Y0(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const Epe={...W0,disabled:Te(e=>e.disabled),instantType:Te(e=>e.instantType),openMethod:Te(e=>e.openMethod),openChangeReason:Te(e=>e.openChangeReason),modal:Te(e=>e.modal),focusManagerModal:Te(e=>e.focusManagerModal),stickIfOpen:Te(e=>e.stickIfOpen),titleElementId:Te(e=>e.titleElementId),descriptionElementId:Te(e=>e.descriptionElementId),openOnHover:Te(e=>e.openOnHover),closeDelay:Te(e=>e.closeDelay),hasViewport:Te(e=>e.hasViewport)};class cA extends kg{constructor(n){const r={...Spe(),...n};r.open&&n?.mounted===void 0&&(r.mounted=!0);super(r,{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),stickIfOpenTimeout:new Ro,triggerElements:new ph},Epe);qt(this,"setOpen",(n,r)=>{const i=r.reason===or,o=r.reason===ja&&r.event.detail===0,a=!n&&(r.reason===wg||r.reason==null);if(r.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(n,r),r.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,r);const l=()=>{const u={open:n,openChangeReason:r.reason},f=r.trigger?.id??null;(f||n)&&(u.activeTriggerId=f,u.activeTriggerElement=r.trigger??null),this.update(u)};i?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(EU,()=>{this.set("stickIfOpen",!1)}),Fr.flushSync(l)):l(),o||a?this.set("instantType",o?"click":"dismiss"):r.reason===lc?this.set("instantType","focus"):this.set("instantType",void 0)});qt(this,"disposeEffect",()=>this.context.stickIfOpenTimeout.disposeEffect())}static useStore(n,r){const i=pr(()=>new cA(r)).current,o=n??i;return bg(i.disposeEffect),o}}function fz({props:e}){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:o,modal:a=!1,handle:l,triggerId:u,defaultTriggerId:f=null}=e,d=cA.useStore(l?.store,{modal:a,open:r,openProp:n,activeTriggerId:f,triggerIdProp:u});yg(()=>{n===void 0&&d.state.open===!1&&r===!0&&d.update({open:!0,activeTriggerId:f})}),d.useControlledProp("openProp",n),d.useControlledProp("triggerIdProp",u);const h=d.useState("open"),g=d.useState("payload");d.useContextCallback("onOpenChange",i),d.useContextCallback("onOpenChangeComplete",o);const{openMethod:v,triggerProps:b}=uw(h);V0(d);const{forceUnmount:w}=K0(h,d,()=>{d.update({stickIfOpen:!0,openChangeReason:null})});x.useEffect(()=>{h||d.context.stickIfOpenTimeout.clear()},[d,h]);const S=x.useCallback(L=>{const U=ct(L);return U.preventUnmountOnClose=()=>{d.set("preventUnmountingOnClose",!0)},U},[d]),E=x.useCallback(()=>{d.setOpen(!1,S(R0))},[d,S]);x.useImperativeHandle(e.actionsRef,()=>({unmount:w,close:E}),[w,E]);const k=G0({popupStore:d,onOpenChange:d.setOpen}),O=_g(k,{outsidePressEvent:{mouse:a==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),j=TT(k),{getReferenceProps:A,getFloatingProps:T,getTriggerProps:N}=vc([O,j]),P=x.useMemo(()=>A(b),[A,b]),F=x.useMemo(()=>N(b),[N,b]),D=x.useMemo(()=>T(),[T]);d.useSyncedValues({modal:a,openMethod:v,activeTriggerProps:P,inactiveTriggerProps:F,popupProps:D,floatingRootContext:k,nested:La()!=null});const q=x.useMemo(()=>({store:d}),[d]);return m.jsx(X8.Provider,{value:q,children:typeof t=="function"?t({payload:g}):t})}function Cpe(e){return Mg(!0)?m.jsx(fz,{props:e}):m.jsx(cH,{children:m.jsx(fz,{props:e})})}const _pe=300,kpe=x.forwardRef(function(t,n){const{render:r,className:i,disabled:o=!1,nativeButton:a=!0,handle:l,payload:u,openOnHover:f=!1,delay:d=_pe,closeDelay:h=0,id:g,style:v,...b}=t,w=Mg(!0),S=l?.store??w?.store;if(!S)throw new Error(Xt(74));const E=Br(g),k=S.useState("isTriggerActive",E),O=S.useState("floatingRootContext"),j=S.useState("isOpenedByTrigger",E),A=x.useRef(null),{registerTrigger:T,isMountedByThisTrigger:N}=q0(E,A,S,{payload:u,disabled:o,openOnHover:f,closeDelay:h}),P=S.useState("openChangeReason"),F=S.useState("stickIfOpen"),D=S.useState("openMethod"),q=S.useState("focusManagerModal"),L=jT(O,{enabled:O!=null&&f&&(D!=="touch"||P!==ja),mouseOnly:!0,move:!1,handleClose:AT(),restMs:d,delay:{close:h},triggerElementRef:A,isActiveTrigger:k,isClosing:()=>S.select("transitionStatus")==="ending"}),U=$0(O,{enabled:O!=null,stickIfOpen:F}),H=vc([U]),B=S.useState("triggerProps",N),z={disabled:o,open:j},{getButtonProps:V,buttonRef:Q}=Zo({disabled:o,native:a}),G=x.useMemo(()=>({open(X){return X&&P===ja?db.open(X):Q0.open(X)}}),[P]),I=vt("button",t,{state:z,ref:[Q,n,T,A],props:[H.getReferenceProps(),L,B,{[sT]:"",id:E},b,V],stateAttributesMapping:G}),{preFocusGuardRef:K,handlePreFocusGuardFocus:$,handleFocusTargetFocus:R}=P8(S,A);return k&&!q?m.jsxs(x.Fragment,{children:[m.jsx(cc,{ref:K,onFocus:$}),m.jsx(x.Fragment,{children:I},E),m.jsx(cc,{ref:S.context.triggerFocusTargetRef,onFocus:R})]}):m.jsx(x.Fragment,{children:I},E)}),Q8=x.createContext(void 0);function Ope(){const e=x.useContext(Q8);if(e===void 0)throw new Error(Xt(45));return e}const jpe=x.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,{store:o}=Mg();return o.useState("mounted")||r?m.jsx(Q8.Provider,{value:r,children:m.jsx(F0,{ref:n,...i})}):null}),Z8=x.createContext(void 0);function Tpe(){const e=x.useContext(Z8);if(!e)throw new Error(Xt(46));return e}const Ape=x.forwardRef(function(t,n){const{render:r,className:i,anchor:o,positionMethod:a="absolute",side:l="bottom",align:u="center",sideOffset:f=0,alignOffset:d=0,collisionBoundary:h="clipping-ancestors",collisionPadding:g=5,arrowPadding:v=5,sticky:b=!1,disableAnchorTracking:w=!1,collisionAvoidance:S=lT,style:E,...k}=t,{store:O}=Mg(),j=Ope(),A=ST(),T=O.useState("floatingRootContext"),N=O.useState("mounted"),P=O.useState("open"),F=O.useState("openChangeReason"),D=O.useState("activeTriggerElement"),q=O.useState("modal"),L=O.useState("openMethod"),U=O.useState("positionerElement"),H=O.useState("instantType"),B=O.useState("transitionStatus"),z=O.useState("hasViewport"),V=x.useRef(null),Q=H0(U,!1,!1),G=Z0({anchor:o,floatingRootContext:T,positionMethod:a,mounted:N,side:l,sideOffset:f,align:u,alignOffset:d,arrowPadding:v,collisionBoundary:h,collisionPadding:g,sticky:b,disableAnchorTracking:w,keepMounted:j,nodeId:A,collisionAvoidance:S,adaptiveOrigin:z?RT:void 0}),I=T.useState("domReferenceElement");Pe(()=>{const X=I,W=V.current;if(X&&(V.current=X),W&&X&&X!==W){O.set("instantType",void 0);const Z=new AbortController;return Q(()=>{O.set("instantType","trigger-change")},Z.signal),()=>{Z.abort()}}},[I,Q,O]);const K={open:P,side:G.side,align:G.align,anchorHidden:G.anchorHidden,instant:H};rA(P&&q===!0&&F!==or,L==="touch",U,D);const $=x.useCallback(X=>{O.set("positionerElement",X)},[O]),R=J0(t,K,{styles:G.positionerStyles,transitionStatus:B,props:k,refs:[n,$],hidden:!N,inert:!P});return m.jsxs(Z8.Provider,{value:G,children:[N&&q===!0&&F!==or&&m.jsx(cw,{ref:O.context.internalBackdropRef,inert:jg(!P),cutout:D}),m.jsx(lH,{id:A,children:R})]})}),Npe=x.createContext(void 0);function Rpe(){const[e,t]=x.useState(0),n=Le(()=>(t(i=>i+1),()=>{t(i=>Math.max(0,i-1))}));return{context:x.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function Ppe(e){const{value:t,children:n}=e;return m.jsx(Npe.Provider,{value:t,children:n})}const Mpe={...yc,...$s},Ipe=x.forwardRef(function(t,n){const{className:r,render:i,initialFocus:o,finalFocus:a,style:l,...u}=t,{store:f}=Mg(),d=Tpe(),h=nA()!=null,{context:g,hasClosePart:v}=Rpe(),b=f.useState("open"),w=f.useState("openMethod"),S=f.useState("instantType"),E=f.useState("transitionStatus"),k=f.useState("popupProps"),O=f.useState("titleElementId"),j=f.useState("descriptionElementId"),A=f.useState("modal"),T=f.useState("mounted"),N=f.useState("openChangeReason"),P=f.useState("activeTriggerElement"),F=f.useState("floatingRootContext");Qo({open:b,ref:f.context.popupRef,onComplete(){b&&f.context.onOpenChangeComplete?.(!0)}});const D=f.useState("disabled"),q=f.useState("openOnHover"),L=f.useState("closeDelay");OT(F,{enabled:q&&!D,closeDelay:L});function U(G){return G==="touch"?f.context.popupRef.current:!0}const H=o===void 0?U:o,B={open:b,side:d.side,align:d.align,instant:S,transitionStatus:E},z=A!==!1&&v;f.useSyncedValue("focusManagerModal",z);const V=x.useCallback(G=>{f.set("popupElement",G)},[f]),Q=vt("div",t,{state:B,ref:[n,f.context.popupRef,V],props:[k,{"aria-labelledby":O,"aria-describedby":j,onKeyDown(G){h&&lw.has(G.key)&&G.stopPropagation()}},Og(E),u],stateAttributesMapping:Mpe});return m.jsx(B0,{context:F,openInteractionType:w,modal:z,disabled:!T||N===or,initialFocus:H,returnFocus:a,restoreFocus:"popup",previousFocusableElement:fn(P)?P:void 0,nextFocusableElement:f.context.triggerFocusTargetRef,beforeContentFocusGuardRef:f.context.beforeContentFocusGuardRef,children:m.jsx(Ppe,{value:g,children:Q})})});function Dpe({...e}){return m.jsx(Cpe,{"data-slot":"popover",...e})}function Lpe({...e}){return m.jsx(kpe,{"data-slot":"popover-trigger",...e})}function zpe({className:e,align:t="center",alignOffset:n=0,side:r="bottom",sideOffset:i=4,...o}){return m.jsx(jpe,{children:m.jsx(Ape,{align:t,alignOffset:n,side:r,sideOffset:i,className:"isolate z-50",children:m.jsx(Ipe,{"data-slot":"popover-content",className:Ne("z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...o})})})}var dz=1,Fpe=.9,Bpe=.8,$pe=.17,hC=.1,pC=.999,Upe=.9999,Hpe=.99,qpe=/[\\\\\\/_+.#"@\\[\\(\\{&]/,Vpe=/[\\\\\\/_+.#"@\\[\\(\\{&]/g,Kpe=/[\\s-]/,J8=/[\\s-]/g;function vO(e,t,n,r,i,o,a){if(o===t.length)return i===e.length?dz:Hpe;var l=\`\${i},\${o}\`;if(a[l]!==void 0)return a[l];for(var u=r.charAt(o),f=n.indexOf(u,i),d=0,h,g,v,b;f>=0;)h=vO(e,t,n,r,f+1,o+1,a),h>d&&(f===i?h*=dz:qpe.test(e.charAt(f-1))?(h*=Bpe,v=e.slice(i,f-1).match(Vpe),v&&i>0&&(h*=Math.pow(pC,v.length))):Kpe.test(e.charAt(f-1))?(h*=Fpe,b=e.slice(i,f-1).match(J8),b&&i>0&&(h*=Math.pow(pC,b.length))):(h*=$pe,i>0&&(h*=Math.pow(pC,f-i))),e.charAt(f)!==t.charAt(o)&&(h*=Upe)),(h<hC&&n.charAt(f-1)===r.charAt(o+1)||r.charAt(o+1)===r.charAt(o)&&n.charAt(f-1)!==r.charAt(o))&&(g=vO(e,t,n,r,f+1,o+2,a),g*hC>h&&(h=g*hC)),h>d&&(d=h),f=n.indexOf(u,f+1);return a[l]=d,d}function hz(e){return e.toLowerCase().replace(J8," ")}function Ype(e,t,n){return e=n&&n.length>0?\`\${e+" "+n.join(" ")}\`:e,vO(e,t,hz(e),hz(t),0,0,{})}function tc(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}function pz(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function fc(...e){return t=>{let n=!1;const r=e.map(i=>{const o=pz(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():pz(e[i],null)}}}}function of(...e){return x.useCallback(fc(...e),e)}function Wpe(e,t){const n=x.createContext(t),r=o=>{const{children:a,...l}=o,u=x.useMemo(()=>l,Object.values(l));return m.jsx(n.Provider,{value:u,children:a})};r.displayName=e+"Provider";function i(o){const a=x.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(\`\\\`\${o}\\\` must be used within \\\`\${e}\\\`\`)}return[r,i]}function Gpe(e,t=[]){let n=[];function r(o,a){const l=x.createContext(a),u=n.length;n=[...n,a];const f=h=>{const{scope:g,children:v,...b}=h,w=g?.[e]?.[u]||l,S=x.useMemo(()=>b,Object.values(b));return m.jsx(w.Provider,{value:S,children:v})};f.displayName=o+"Provider";function d(h,g){const v=g?.[e]?.[u]||l,b=x.useContext(v);if(b)return b;if(a!==void 0)return a;throw new Error(\`\\\`\${h}\\\` must be used within \\\`\${o}\\\`\`)}return[f,d]}const i=()=>{const o=n.map(a=>x.createContext(a));return function(l){const u=l?.[e]||o;return x.useMemo(()=>({[\`__scope\${e}\`]:{...l,[e]:u}}),[l,u])}};return i.scopeName=e,[r,Xpe(i,...t)]}function Xpe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const a=r.reduce((l,{useScope:u,scopeName:f})=>{const h=u(o)[\`__scope\${f}\`];return{...l,...h}},{});return x.useMemo(()=>({[\`__scope\${t.scopeName}\`]:a}),[a])}};return n.scopeName=t.scopeName,n}var Bm=globalThis?.document?x.useLayoutEffect:()=>{},Qpe=oh[" useId ".trim().toString()]||(()=>{}),Zpe=0;function Cs(e){const[t,n]=x.useState(Qpe());return Bm(()=>{n(r=>r??String(Zpe++))},[e]),t?\`radix-\${t}\`:""}var Jpe=oh[" useInsertionEffect ".trim().toString()]||Bm;function eme({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,o,a]=tme({defaultProp:t,onChange:n}),l=e!==void 0,u=l?e:i;{const d=x.useRef(e!==void 0);x.useEffect(()=>{const h=d.current;h!==l&&console.warn(\`\${r} is changing from \${h?"controlled":"uncontrolled"} to \${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.\`),d.current=l},[l,r])}const f=x.useCallback(d=>{if(l){const h=nme(d)?d(e):d;h!==e&&a.current?.(h)}else o(d)},[l,e,o,a]);return[u,f]}function tme({defaultProp:e,onChange:t}){const[n,r]=x.useState(e),i=x.useRef(n),o=x.useRef(t);return Jpe(()=>{o.current=t},[t]),x.useEffect(()=>{i.current!==n&&(o.current?.(n),i.current=n)},[n,i]),[n,r,o]}function nme(e){return typeof e=="function"}function Ig(e){const t=rme(e),n=x.forwardRef((r,i)=>{const{children:o,...a}=r,l=x.Children.toArray(o),u=l.find(ome);if(u){const f=u.props.children,d=l.map(h=>h===u?x.Children.count(f)>1?x.Children.only(null):x.isValidElement(f)?f.props.children:null:h);return m.jsx(t,{...a,ref:i,children:x.isValidElement(f)?x.cloneElement(f,void 0,d):null})}return m.jsx(t,{...a,ref:i,children:o})});return n.displayName=\`\${e}.Slot\`,n}function rme(e){const t=x.forwardRef((n,r)=>{const{children:i,...o}=n;if(x.isValidElement(i)){const a=sme(i),l=ame(o,i.props);return i.type!==x.Fragment&&(l.ref=r?fc(r,a):a),x.cloneElement(i,l)}return x.Children.count(i)>1?x.Children.only(null):null});return t.displayName=\`\${e}.SlotClone\`,t}var ime=Symbol("radix.slottable");function ome(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ime}function ame(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...l)=>{const u=o(...l);return i(...l),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function sme(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var lme=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],eq=lme.reduce((e,t)=>{const n=Ig(\`Primitive.\${t}\`),r=x.forwardRef((i,o)=>{const{asChild:a,...l}=i,u=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(u,{...l,ref:o})});return r.displayName=\`Primitive.\${t}\`,{...e,[t]:r}},{});function cme(e,t){e&&Fr.flushSync(()=>e.dispatchEvent(t))}function $m(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...n)=>t.current?.(...n),[])}function ume(e,t=globalThis?.document){const n=$m(e);x.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var fme="DismissableLayer",yO="dismissableLayer.update",dme="dismissableLayer.pointerDownOutside",hme="dismissableLayer.focusOutside",mz,tq=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),nq=x.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...u}=e,f=x.useContext(tq),[d,h]=x.useState(null),g=d?.ownerDocument??globalThis?.document,[,v]=x.useState({}),b=of(t,N=>h(N)),w=Array.from(f.layers),[S]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),E=w.indexOf(S),k=d?w.indexOf(d):-1,O=f.layersWithOutsidePointerEventsDisabled.size>0,j=k>=E,A=gme(N=>{const P=N.target,F=[...f.branches].some(D=>D.contains(P));!j||F||(i?.(N),a?.(N),N.defaultPrevented||l?.())},g),T=vme(N=>{const P=N.target;[...f.branches].some(D=>D.contains(P))||(o?.(N),a?.(N),N.defaultPrevented||l?.())},g);return ume(N=>{k===f.layers.size-1&&(r?.(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},g),x.useEffect(()=>{if(d)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(mz=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(d)),f.layers.add(d),gz(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=mz)}},[d,g,n,f]),x.useEffect(()=>()=>{d&&(f.layers.delete(d),f.layersWithOutsidePointerEventsDisabled.delete(d),gz())},[d,f]),x.useEffect(()=>{const N=()=>v({});return document.addEventListener(yO,N),()=>document.removeEventListener(yO,N)},[]),m.jsx(eq.div,{...u,ref:b,style:{pointerEvents:O?j?"auto":"none":void 0,...e.style},onFocusCapture:tc(e.onFocusCapture,T.onFocusCapture),onBlurCapture:tc(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:tc(e.onPointerDownCapture,A.onPointerDownCapture)})});nq.displayName=fme;var pme="DismissableLayerBranch",mme=x.forwardRef((e,t)=>{const n=x.useContext(tq),r=x.useRef(null),i=of(t,r);return x.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),m.jsx(eq.div,{...e,ref:i})});mme.displayName=pme;function gme(e,t=globalThis?.document){const n=$m(e),r=x.useRef(!1),i=x.useRef(()=>{});return x.useEffect(()=>{const o=l=>{if(l.target&&!r.current){let u=function(){rq(dme,n,f,{discrete:!0})};const f={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=u,t.addEventListener("click",i.current,{once:!0})):u()}else t.removeEventListener("click",i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",o),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function vme(e,t=globalThis?.document){const n=$m(e),r=x.useRef(!1);return x.useEffect(()=>{const i=o=>{o.target&&!r.current&&rq(hme,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function gz(){const e=new CustomEvent(yO);document.dispatchEvent(e)}function rq(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?cme(i,o):i.dispatchEvent(o)}var yme=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],xme=yme.reduce((e,t)=>{const n=Ig(\`Primitive.\${t}\`),r=x.forwardRef((i,o)=>{const{asChild:a,...l}=i,u=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(u,{...l,ref:o})});return r.displayName=\`Primitive.\${t}\`,{...e,[t]:r}},{}),mC="focusScope.autoFocusOnMount",gC="focusScope.autoFocusOnUnmount",vz={bubbles:!1,cancelable:!0},bme="FocusScope",iq=x.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...a}=e,[l,u]=x.useState(null),f=$m(i),d=$m(o),h=x.useRef(null),g=of(t,w=>u(w)),v=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(r){let w=function(O){if(v.paused||!l)return;const j=O.target;l.contains(j)?h.current=j:jl(h.current,{select:!0})},S=function(O){if(v.paused||!l)return;const j=O.relatedTarget;j!==null&&(l.contains(j)||jl(h.current,{select:!0}))},E=function(O){if(document.activeElement===document.body)for(const A of O)A.removedNodes.length>0&&jl(l)};document.addEventListener("focusin",w),document.addEventListener("focusout",S);const k=new MutationObserver(E);return l&&k.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",S),k.disconnect()}}},[r,l,v.paused]),x.useEffect(()=>{if(l){xz.add(v);const w=document.activeElement;if(!l.contains(w)){const E=new CustomEvent(mC,vz);l.addEventListener(mC,f),l.dispatchEvent(E),E.defaultPrevented||(wme(kme(oq(l)),{select:!0}),document.activeElement===w&&jl(l))}return()=>{l.removeEventListener(mC,f),setTimeout(()=>{const E=new CustomEvent(gC,vz);l.addEventListener(gC,d),l.dispatchEvent(E),E.defaultPrevented||jl(w??document.body,{select:!0}),l.removeEventListener(gC,d),xz.remove(v)},0)}}},[l,f,d,v]);const b=x.useCallback(w=>{if(!n&&!r||v.paused)return;const S=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,E=document.activeElement;if(S&&E){const k=w.currentTarget,[O,j]=Sme(k);O&&j?!w.shiftKey&&E===j?(w.preventDefault(),n&&jl(O,{select:!0})):w.shiftKey&&E===O&&(w.preventDefault(),n&&jl(j,{select:!0})):E===k&&w.preventDefault()}},[n,r,v.paused]);return m.jsx(xme.div,{tabIndex:-1,...a,ref:g,onKeyDown:b})});iq.displayName=bme;function wme(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(jl(r,{select:t}),document.activeElement!==n)return}function Sme(e){const t=oq(e),n=yz(t,e),r=yz(t.reverse(),e);return[n,r]}function oq(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function yz(e,t){for(const n of e)if(!Eme(n,{upTo:t}))return n}function Eme(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Cme(e){return e instanceof HTMLInputElement&&"select"in e}function jl(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Cme(e)&&t&&e.select()}}var xz=_me();function _me(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=bz(e,t),e.unshift(t)},remove(t){e=bz(e,t),e[0]?.resume()}}}function bz(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function kme(e){return e.filter(t=>t.tagName!=="A")}var Ome=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],jme=Ome.reduce((e,t)=>{const n=Ig(\`Primitive.\${t}\`),r=x.forwardRef((i,o)=>{const{asChild:a,...l}=i,u=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(u,{...l,ref:o})});return r.displayName=\`Primitive.\${t}\`,{...e,[t]:r}},{}),Tme="Portal",aq=x.forwardRef((e,t)=>{const{container:n,...r}=e,[i,o]=x.useState(!1);Bm(()=>o(!0),[]);const a=n||i&&globalThis?.document?.body;return a?sU.createPortal(m.jsx(jme.div,{...r,ref:t}),a):null});aq.displayName=Tme;function Ame(e,t){return x.useReducer((n,r)=>t[n][r]??n,e)}var mw=e=>{const{present:t,children:n}=e,r=Nme(t),i=typeof n=="function"?n({present:r.isPresent}):x.Children.only(n),o=of(r.ref,Rme(i));return typeof n=="function"||r.isPresent?x.cloneElement(i,{ref:o}):null};mw.displayName="Presence";function Nme(e){const[t,n]=x.useState(),r=x.useRef(null),i=x.useRef(e),o=x.useRef("none"),a=e?"mounted":"unmounted",[l,u]=Ame(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const f=Yy(r.current);o.current=l==="mounted"?f:"none"},[l]),Bm(()=>{const f=r.current,d=i.current;if(d!==e){const g=o.current,v=Yy(f);e?u("MOUNT"):v==="none"||f?.display==="none"?u("UNMOUNT"):u(d&&g!==v?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),Bm(()=>{if(t){let f;const d=t.ownerDocument.defaultView??window,h=v=>{const w=Yy(r.current).includes(CSS.escape(v.animationName));if(v.target===t&&w&&(u("ANIMATION_END"),!i.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",f=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},g=v=>{v.target===t&&(o.current=Yy(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{d.clearTimeout(f),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:x.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function Yy(e){return e?.animationName||"none"}function Rme(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Pme=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Dg=Pme.reduce((e,t)=>{const n=Ig(\`Primitive.\${t}\`),r=x.forwardRef((i,o)=>{const{asChild:a,...l}=i,u=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(u,{...l,ref:o})});return r.displayName=\`Primitive.\${t}\`,{...e,[t]:r}},{}),vC=0;function Mme(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??wz()),document.body.insertAdjacentElement("beforeend",e[1]??wz()),vC++,()=>{vC===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),vC--}},[])}function wz(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var ya=function(){return ya=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},ya.apply(this,arguments)};function sq(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Ime(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var zx="right-scroll-bar-position",Fx="width-before-scroll-bar",Dme="with-scroll-bars-hidden",Lme="--removed-body-scroll-bar-size";function yC(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function zme(e,t){var n=x.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}var Fme=typeof window<"u"?x.useLayoutEffect:x.useEffect,Sz=new WeakMap;function Bme(e,t){var n=zme(null,function(r){return e.forEach(function(i){return yC(i,r)})});return Fme(function(){var r=Sz.get(n);if(r){var i=new Set(r),o=new Set(e),a=n.current;i.forEach(function(l){o.has(l)||yC(l,null)}),o.forEach(function(l){i.has(l)||yC(l,a)})}Sz.set(n,e)},[e]),n}function $me(e){return e}function Ume(e,t){t===void 0&&(t=$me);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not \`read\` from an \`assigned\` medium. \`read\` could be used only with \`useMedium\`.");return n.length?n[n.length-1]:e},useMedium:function(o){var a=t(o,r);return n.push(a),function(){n=n.filter(function(l){return l!==a})}},assignSyncMedium:function(o){for(r=!0;n.length;){var a=n;n=[],a.forEach(o)}n={push:function(l){return o(l)},filter:function(){return n}}},assignMedium:function(o){r=!0;var a=[];if(n.length){var l=n;n=[],l.forEach(o),a=n}var u=function(){var d=a;a=[],d.forEach(o)},f=function(){return Promise.resolve().then(u)};f(),n={push:function(d){a.push(d),f()},filter:function(d){return a=a.filter(d),n}}}};return i}function Hme(e){e===void 0&&(e={});var t=Ume(null);return t.options=ya({async:!0,ssr:!1},e),t}var lq=function(e){var t=e.sideCar,n=sq(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide \`sideCar\` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return x.createElement(r,ya({},n))};lq.isSideCarExport=!0;function qme(e,t){return e.useMedium(t),lq}var cq=Hme(),xC=function(){},gw=x.forwardRef(function(e,t){var n=x.useRef(null),r=x.useState({onScrollCapture:xC,onWheelCapture:xC,onTouchMoveCapture:xC}),i=r[0],o=r[1],a=e.forwardProps,l=e.children,u=e.className,f=e.removeScrollBar,d=e.enabled,h=e.shards,g=e.sideCar,v=e.noRelative,b=e.noIsolation,w=e.inert,S=e.allowPinchZoom,E=e.as,k=E===void 0?"div":E,O=e.gapMode,j=sq(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),A=g,T=Bme([n,t]),N=ya(ya({},j),i);return x.createElement(x.Fragment,null,d&&x.createElement(A,{sideCar:cq,removeScrollBar:f,shards:h,noRelative:v,noIsolation:b,inert:w,setCallbacks:o,allowPinchZoom:!!S,lockRef:n,gapMode:O}),a?x.cloneElement(x.Children.only(l),ya(ya({},N),{ref:T})):x.createElement(k,ya({},N,{className:u,ref:T}),l))});gw.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};gw.classNames={fullWidth:Fx,zeroRight:zx};var Vme=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Kme(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Vme();return t&&e.setAttribute("nonce",t),e}function Yme(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Wme(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Gme=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Kme())&&(Yme(t,n),Wme(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Xme=function(){var e=Gme();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},uq=function(){var e=Xme(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},Qme={left:0,top:0,right:0,gap:0},bC=function(e){return parseInt(e||"",10)||0},Zme=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[bC(n),bC(r),bC(i)]},Jme=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Qme;var t=Zme(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},ege=uq(),bd="data-scroll-locked",tge=function(e,t,n,r){var i=e.left,o=e.top,a=e.right,l=e.gap;return n===void 0&&(n="margin"),\`
|
|
216962
216951
|
.\`.concat(Dme,\` {
|
|
216963
216952
|
overflow: hidden \`).concat(r,\`;
|
|
216964
216953
|
padding-right: \`).concat(l,"px ").concat(r,\`;
|
|
@@ -217003,7 +216992,7 @@ Url: \${Wx(e)}\`),!0}return!1}function Nee(e,t){return t?.length?d6(e).some(n=>k
|
|
|
217003
216992
|
If you want to hide the \\\`\${t.titleName}\\\`, you can wrap it with our VisuallyHidden component.
|
|
217004
216993
|
|
|
217005
216994
|
For more information, see https://radix-ui.com/primitives/docs/components/\${t.docsSlug}\`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Rge="DialogDescriptionWarning",Pge=({contentRef:e,descriptionId:t})=>{const r=\`Warning: Missing \\\`Description\\\` or \\\`aria-describedby={undefined}\\\` for {\${Oq(Rge).contentName}}.\`;return x.useEffect(()=>{const i=e.current?.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Mge=vq,Ige=bq,Dge=wq,Lge=Sq,zge=Symbol.for("react.lazy"),yb=oh[" use ".trim().toString()];function Fge(e){return typeof e=="object"&&e!==null&&"then"in e}function jq(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===zge&&"_payload"in e&&Fge(e._payload)}function Bge(e){const t=$ge(e),n=x.forwardRef((r,i)=>{let{children:o,...a}=r;jq(o)&&typeof yb=="function"&&(o=yb(o._payload));const l=x.Children.toArray(o),u=l.find(Hge);if(u){const f=u.props.children,d=l.map(h=>h===u?x.Children.count(f)>1?x.Children.only(null):x.isValidElement(f)?f.props.children:null:h);return m.jsx(t,{...a,ref:i,children:x.isValidElement(f)?x.cloneElement(f,void 0,d):null})}return m.jsx(t,{...a,ref:i,children:o})});return n.displayName=\`\${e}.Slot\`,n}function $ge(e){const t=x.forwardRef((n,r)=>{let{children:i,...o}=n;if(jq(i)&&typeof yb=="function"&&(i=yb(i._payload)),x.isValidElement(i)){const a=Vge(i),l=qge(o,i.props);return i.type!==x.Fragment&&(l.ref=r?fc(r,a):a),x.cloneElement(i,l)}return x.Children.count(i)>1?x.Children.only(null):null});return t.displayName=\`\${e}.SlotClone\`,t}var Uge=Symbol("radix.slottable");function Hge(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Uge}function qge(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...l)=>{const u=o(...l);return i(...l),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function Vge(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Kge=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],wc=Kge.reduce((e,t)=>{const n=Bge(\`Primitive.\${t}\`),r=x.forwardRef((i,o)=>{const{asChild:a,...l}=i,u=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(u,{...l,ref:o})});return r.displayName=\`Primitive.\${t}\`,{...e,[t]:r}},{}),Up='[cmdk-group=""]',SC='[cmdk-group-items=""]',Yge='[cmdk-group-heading=""]',Tq='[cmdk-item=""]',Oz=\`\${Tq}:not([aria-disabled="true"])\`,bO="cmdk-item-select",ud="data-value",Wge=(e,t,n)=>Ype(e,t,n),Aq=x.createContext(void 0),Lg=()=>x.useContext(Aq),Nq=x.createContext(void 0),hA=()=>x.useContext(Nq),Rq=x.createContext(void 0),Pq=x.forwardRef((e,t)=>{let n=fd(()=>{var $,R;return{search:"",value:(R=($=e.value)!=null?$:e.defaultValue)!=null?R:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=fd(()=>new Set),i=fd(()=>new Map),o=fd(()=>new Map),a=fd(()=>new Set),l=Mq(e),{label:u,children:f,value:d,onValueChange:h,filter:g,shouldFilter:v,loop:b,disablePointerSelection:w=!1,vimBindings:S=!0,...E}=e,k=Cs(),O=Cs(),j=Cs(),A=x.useRef(null),T=ove();Bu(()=>{if(d!==void 0){let $=d.trim();n.current.value=$,N.emit()}},[d]),Bu(()=>{T(6,U)},[]);let N=x.useMemo(()=>({subscribe:$=>(a.current.add($),()=>a.current.delete($)),snapshot:()=>n.current,setState:($,R,X)=>{var W,Z,oe,ie;if(!Object.is(n.current[$],R)){if(n.current[$]=R,$==="search")L(),D(),T(1,q);else if($==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let J=document.getElementById(j);J?J.focus():(W=document.getElementById(k))==null||W.focus()}if(T(7,()=>{var J;n.current.selectedItemId=(J=H())==null?void 0:J.id,N.emit()}),X||T(5,U),((Z=l.current)==null?void 0:Z.value)!==void 0){let J=R??"";(ie=(oe=l.current).onValueChange)==null||ie.call(oe,J);return}}N.emit()}},emit:()=>{a.current.forEach($=>$())}}),[]),P=x.useMemo(()=>({value:($,R,X)=>{var W;R!==((W=o.current.get($))==null?void 0:W.value)&&(o.current.set($,{value:R,keywords:X}),n.current.filtered.items.set($,F(R,X)),T(2,()=>{D(),N.emit()}))},item:($,R)=>(r.current.add($),R&&(i.current.has(R)?i.current.get(R).add($):i.current.set(R,new Set([$]))),T(3,()=>{L(),D(),n.current.value||q(),N.emit()}),()=>{o.current.delete($),r.current.delete($),n.current.filtered.items.delete($);let X=H();T(4,()=>{L(),X?.getAttribute("id")===$&&q(),N.emit()})}),group:$=>(i.current.has($)||i.current.set($,new Set),()=>{o.current.delete($),i.current.delete($)}),filter:()=>l.current.shouldFilter,label:u||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:k,inputId:j,labelId:O,listInnerRef:A}),[]);function F($,R){var X,W;let Z=(W=(X=l.current)==null?void 0:X.filter)!=null?W:Wge;return $?Z($,n.current.search,R):0}function D(){if(!n.current.search||l.current.shouldFilter===!1)return;let $=n.current.filtered.items,R=[];n.current.filtered.groups.forEach(W=>{let Z=i.current.get(W),oe=0;Z.forEach(ie=>{let J=$.get(ie);oe=Math.max(J,oe)}),R.push([W,oe])});let X=A.current;B().sort((W,Z)=>{var oe,ie;let J=W.getAttribute("id"),se=Z.getAttribute("id");return((oe=$.get(se))!=null?oe:0)-((ie=$.get(J))!=null?ie:0)}).forEach(W=>{let Z=W.closest(SC);Z?Z.appendChild(W.parentElement===Z?W:W.closest(\`\${SC} > *\`)):X.appendChild(W.parentElement===X?W:W.closest(\`\${SC} > *\`))}),R.sort((W,Z)=>Z[1]-W[1]).forEach(W=>{var Z;let oe=(Z=A.current)==null?void 0:Z.querySelector(\`\${Up}[\${ud}="\${encodeURIComponent(W[0])}"]\`);oe?.parentElement.appendChild(oe)})}function q(){let $=B().find(X=>X.getAttribute("aria-disabled")!=="true"),R=$?.getAttribute(ud);N.setState("value",R||void 0)}function L(){var $,R,X,W;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let Z=0;for(let oe of r.current){let ie=(R=($=o.current.get(oe))==null?void 0:$.value)!=null?R:"",J=(W=(X=o.current.get(oe))==null?void 0:X.keywords)!=null?W:[],se=F(ie,J);n.current.filtered.items.set(oe,se),se>0&&Z++}for(let[oe,ie]of i.current)for(let J of ie)if(n.current.filtered.items.get(J)>0){n.current.filtered.groups.add(oe);break}n.current.filtered.count=Z}function U(){var $,R,X;let W=H();W&&((($=W.parentElement)==null?void 0:$.firstChild)===W&&((X=(R=W.closest(Up))==null?void 0:R.querySelector(Yge))==null||X.scrollIntoView({block:"nearest"})),W.scrollIntoView({block:"nearest"}))}function H(){var $;return($=A.current)==null?void 0:$.querySelector(\`\${Tq}[aria-selected="true"]\`)}function B(){var $;return Array.from((($=A.current)==null?void 0:$.querySelectorAll(Oz))||[])}function z($){let R=B()[$];R&&N.setState("value",R.getAttribute(ud))}function V($){var R;let X=H(),W=B(),Z=W.findIndex(ie=>ie===X),oe=W[Z+$];(R=l.current)!=null&&R.loop&&(oe=Z+$<0?W[W.length-1]:Z+$===W.length?W[0]:W[Z+$]),oe&&N.setState("value",oe.getAttribute(ud))}function Q($){let R=H(),X=R?.closest(Up),W;for(;X&&!W;)X=$>0?rve(X,Up):ive(X,Up),W=X?.querySelector(Oz);W?N.setState("value",W.getAttribute(ud)):V($)}let G=()=>z(B().length-1),I=$=>{$.preventDefault(),$.metaKey?G():$.altKey?Q(1):V(1)},K=$=>{$.preventDefault(),$.metaKey?z(0):$.altKey?Q(-1):V(-1)};return x.createElement(wc.div,{ref:t,tabIndex:-1,...E,"cmdk-root":"",onKeyDown:$=>{var R;(R=E.onKeyDown)==null||R.call(E,$);let X=$.nativeEvent.isComposing||$.keyCode===229;if(!($.defaultPrevented||X))switch($.key){case"n":case"j":{S&&$.ctrlKey&&I($);break}case"ArrowDown":{I($);break}case"p":case"k":{S&&$.ctrlKey&&K($);break}case"ArrowUp":{K($);break}case"Home":{$.preventDefault(),z(0);break}case"End":{$.preventDefault(),G();break}case"Enter":{$.preventDefault();let W=H();if(W){let Z=new Event(bO);W.dispatchEvent(Z)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:P.inputId,id:P.labelId,style:sve},u),yw(e,$=>x.createElement(Nq.Provider,{value:N},x.createElement(Aq.Provider,{value:P},$))))}),Gge=x.forwardRef((e,t)=>{var n,r;let i=Cs(),o=x.useRef(null),a=x.useContext(Rq),l=Lg(),u=Mq(e),f=(r=(n=u.current)==null?void 0:n.forceMount)!=null?r:a?.forceMount;Bu(()=>{if(!f)return l.item(i,a?.id)},[f]);let d=Iq(i,o,[e.value,e.children,o],e.keywords),h=hA(),g=dc(T=>T.value&&T.value===d.current),v=dc(T=>f||l.filter()===!1?!0:T.search?T.filtered.items.get(i)>0:!0);x.useEffect(()=>{let T=o.current;if(!(!T||e.disabled))return T.addEventListener(bO,b),()=>T.removeEventListener(bO,b)},[v,e.onSelect,e.disabled]);function b(){var T,N;w(),(N=(T=u.current).onSelect)==null||N.call(T,d.current)}function w(){h.setState("value",d.current,!0)}if(!v)return null;let{disabled:S,value:E,onSelect:k,forceMount:O,keywords:j,...A}=e;return x.createElement(wc.div,{ref:fc(o,t),...A,id:i,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!g,"data-disabled":!!S,"data-selected":!!g,onPointerMove:S||l.getDisablePointerSelection()?void 0:w,onClick:S?void 0:b},e.children)}),Xge=x.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...o}=e,a=Cs(),l=x.useRef(null),u=x.useRef(null),f=Cs(),d=Lg(),h=dc(v=>i||d.filter()===!1?!0:v.search?v.filtered.groups.has(a):!0);Bu(()=>d.group(a),[]),Iq(a,l,[e.value,e.heading,u]);let g=x.useMemo(()=>({id:a,forceMount:i}),[i]);return x.createElement(wc.div,{ref:fc(l,t),...o,"cmdk-group":"",role:"presentation",hidden:h?void 0:!0},n&&x.createElement("div",{ref:u,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),yw(e,v=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},x.createElement(Rq.Provider,{value:g},v))))}),Qge=x.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=x.useRef(null),o=dc(a=>!a.search);return!n&&!o?null:x.createElement(wc.div,{ref:fc(i,t),...r,"cmdk-separator":"",role:"separator"})}),Zge=x.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,o=hA(),a=dc(f=>f.search),l=dc(f=>f.selectedItemId),u=Lg();return x.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),x.createElement(wc.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":u.listId,"aria-labelledby":u.labelId,"aria-activedescendant":l,id:u.inputId,type:"text",value:i?e.value:a,onChange:f=>{i||o.setState("search",f.target.value),n?.(f.target.value)}})}),Jge=x.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...i}=e,o=x.useRef(null),a=x.useRef(null),l=dc(f=>f.selectedItemId),u=Lg();return x.useEffect(()=>{if(a.current&&o.current){let f=a.current,d=o.current,h,g=new ResizeObserver(()=>{h=requestAnimationFrame(()=>{let v=f.offsetHeight;d.style.setProperty("--cmdk-list-height",v.toFixed(1)+"px")})});return g.observe(f),()=>{cancelAnimationFrame(h),g.unobserve(f)}}},[]),x.createElement(wc.div,{ref:fc(o,t),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:u.listId},yw(e,f=>x.createElement("div",{ref:fc(a,u.listInnerRef),"cmdk-list-sizer":""},f)))}),eve=x.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:o,container:a,...l}=e;return x.createElement(Mge,{open:n,onOpenChange:r},x.createElement(Ige,{container:a},x.createElement(Dge,{"cmdk-overlay":"",className:i}),x.createElement(Lge,{"aria-label":e.label,"cmdk-dialog":"",className:o},x.createElement(Pq,{ref:t,...l}))))}),tve=x.forwardRef((e,t)=>dc(n=>n.filtered.count===0)?x.createElement(wc.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),nve=x.forwardRef((e,t)=>{let{progress:n,children:r,label:i="Loading...",...o}=e;return x.createElement(wc.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},yw(e,a=>x.createElement("div",{"aria-hidden":!0},a)))}),jh=Object.assign(Pq,{List:Jge,Item:Gge,Input:Zge,Group:Xge,Separator:Qge,Dialog:eve,Empty:tve,Loading:nve});function rve(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function ive(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Mq(e){let t=x.useRef(e);return Bu(()=>{t.current=e}),t}var Bu=typeof window>"u"?x.useEffect:x.useLayoutEffect;function fd(e){let t=x.useRef();return t.current===void 0&&(t.current=e()),t}function dc(e){let t=hA(),n=()=>e(t.snapshot());return x.useSyncExternalStore(t.subscribe,n,n)}function Iq(e,t,n,r=[]){let i=x.useRef(),o=Lg();return Bu(()=>{var a;let l=(()=>{var f;for(let d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(f=d.current.textContent)==null?void 0:f.trim():i.current}})(),u=r.map(f=>f.trim());o.value(e,l,u),(a=t.current)==null||a.setAttribute(ud,l),i.current=l}),i}var ove=()=>{let[e,t]=x.useState(),n=fd(()=>new Map);return Bu(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,i)=>{n.current.set(r,i),t({})}};function ave(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function yw({asChild:e,children:t},n){return e&&x.isValidElement(t)?x.cloneElement(ave(t),{ref:t.ref},n(t.props.children)):n(t)}var sve={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function xw({className:e,...t}){return m.jsx("textarea",{"data-slot":"textarea",className:Ne("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...t})}function lve({className:e,...t}){return m.jsx("div",{"data-slot":"input-group",role:"group",className:Ne("group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",e),...t})}const cve=Ag("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function uve({className:e,align:t="inline-start",...n}){return m.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:Ne(cve({align:t}),e),onClick:r=>{r.target.closest("button")||r.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}function fve({className:e,...t}){return m.jsx(jh,{"data-slot":"command",className:Ne("flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground",e),...t})}function dve({className:e,...t}){return m.jsx("div",{"data-slot":"command-input-wrapper",className:"p-1 pb-0",children:m.jsxs(lve,{className:"h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!",children:[m.jsx(jh.Input,{"data-slot":"command-input",className:Ne("w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t}),m.jsx(uve,{children:m.jsx(rw,{className:"size-4 shrink-0 opacity-50"})})]})})}function hve({className:e,...t}){return m.jsx(jh.List,{"data-slot":"command-list",className:Ne("no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",e),...t})}function pve({className:e,...t}){return m.jsx(jh.Empty,{"data-slot":"command-empty",className:Ne("py-6 text-center text-sm",e),...t})}function mve({className:e,...t}){return m.jsx(jh.Group,{"data-slot":"command-group",className:Ne("overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground",e),...t})}function gve({className:e,children:t,...n}){return m.jsxs(jh.Item,{"data-slot":"command-item",className:Ne("group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground",e),...n,children:[t,m.jsx(Aa,{className:"ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100"})]})}function vve(e){return Bn({queryKey:["models",e??"all"],queryFn:()=>Xe(\`/models\${e?\`?engine=\${e}\`:""}\`),select:t=>t.data,staleTime:14400*1e3})}const yve={anthropic:"Anthropic",openai:"OpenAI",google:"Google",ollama:"Ollama (local)",openrouter:"OpenRouter",unknown:"Other"},xve=["anthropic","openai","google","ollama","openrouter","unknown"];function bve(e){const t={};for(const n of e){const r=n.provider;t[r]||(t[r]=[]),t[r].push(n)}for(const n of Object.values(t))n.sort((r,i)=>(i.context_window??0)-(r.context_window??0));return xve.filter(n=>t[n]).map(n=>[n,t[n]])}function wve(e){return e?e>=1e6?\`\${(e/1e6).toFixed(1)}M\`:e>=1e3?\`\${Math.round(e/1e3)}K\`:String(e):""}function pA({engine:e,value:t,onChange:n}){const{data:r,isLoading:i,isError:o}=vve(e),[a,l]=x.useState(!1);if(o)return m.jsx(en,{value:t,onChange:g=>n(g.target.value),placeholder:"Enter model ID",className:"h-10 w-full text-foreground"});const u=g=>g.engines[e]??g.id,f=r?.find(g=>u(g)===t||g.id===t),d=f?u(f):t||"Select a model",h=r?bve(r):[];return m.jsxs(Dpe,{open:a,onOpenChange:l,children:[m.jsxs(Lpe,{role:"combobox","aria-expanded":a,className:Ne("flex h-10 w-full items-center justify-between rounded-lg border border-border bg-background px-2.5 text-sm text-foreground","hover:bg-muted dark:border-input dark:bg-input/30 dark:hover:bg-input/50"),children:[m.jsxs("span",{className:"truncate flex items-center gap-1.5",children:[d,f?.local&&m.jsx(an,{className:"bg-lime-400/15 text-lime-400 border-lime-400/30 text-[10px] px-1.5 py-0 h-4",children:"Local"})]}),m.jsx(vue,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]}),m.jsx(zpe,{className:"w-80 p-0",align:"start",children:m.jsxs(fve,{children:[m.jsx(dve,{placeholder:"Search models..."}),m.jsxs(hve,{className:"max-h-[300px]",children:[m.jsx(pve,{children:i?"Loading models...":"No models found."}),h.map(([g,v])=>m.jsx(mve,{heading:yve[g]??g,children:v.map(b=>{const w=u(b),S=w===t||b.id===t,E=wve(b.context_window);return m.jsxs(gve,{value:\`\${b.provider} \${b.id} \${w}\`,"data-checked":S||void 0,onSelect:()=>{n(w),l(!1)},className:"flex w-full items-center justify-between",children:[m.jsx("span",{className:"truncate flex-1 min-w-0",children:w}),m.jsxs("span",{className:"shrink-0 flex items-center gap-1.5 ml-2",children:[b.local&&m.jsx(an,{className:"bg-lime-400/15 text-lime-400 border-lime-400/30 text-[10px] px-1.5 py-0 h-4",children:"Local"}),E&&m.jsx("span",{className:"text-xs text-muted-foreground",children:E})]})]},\`\${b.provider}-\${b.id}\`)})},g))]})]})})]})}function Sve({open:e,onOpenChange:t}){const n=b8(),[r,i]=x.useState(""),[o,a]=x.useState("claude"),[l,u]=x.useState(Xd.claude[0]);async function f(){if(r.trim())try{await n.mutateAsync({name:r.trim(),engine:o,model:l}),i(""),qe.success("Agent created"),t(!1)}catch(d){const h=d?.body?.error?.message||(d instanceof Error?d.message:"Failed to create agent");qe.error(h)}}return m.jsx(ea,{open:e,onOpenChange:t,children:m.jsxs(za,{children:[m.jsx(Fa,{children:m.jsx(Ba,{children:"New agent"})}),m.jsxs("div",{className:"flex flex-col gap-4 pt-2",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Name"}),m.jsx(en,{placeholder:"My Agent",value:r,onChange:d=>i(d.target.value),className:"w-full text-foreground"})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Engine"}),m.jsxs(To,{value:o,onValueChange:d=>{d&&(a(d),u(Xd[d]?.[0]??""))},children:[m.jsx(Ao,{className:"w-full text-foreground",children:m.jsx(Oh,{})}),m.jsx(No,{children:lA.map(d=>m.jsx(ai,{value:d,children:d},d))})]})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Model"}),m.jsx(pA,{engine:o,value:l,onChange:u})]}),m.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[m.jsx(Fe,{variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),m.jsx(Fe,{className:"bg-cta-gradient text-black hover:opacity-90",onClick:f,disabled:!r.trim()||n.isPending,children:"Create"})]})]})]})})}function Sc({title:e,description:t,actionLabel:n,onAction:r}){return m.jsxs("div",{className:"flex items-start justify-between",children:[m.jsxs("div",{children:[m.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-foreground",children:e}),m.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:t})]}),n&&r&&m.jsxs(Fe,{variant:"secondary",size:"sm",onClick:r,className:"gap-1.5",children:[m.jsx(bc,{className:"size-3.5"}),n]})]})}function Eve(e){const t=typeof e=="string"?new Date(e).getTime():e,n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return\`\${r}m ago\`;const i=Math.floor(r/60);return i<24?\`\${i}h ago\`:\`\${Math.floor(i/24)}d ago\`}function Cve(){const{data:e}=Hs(),t=Vde(),n=Bs(),r=u=>n({to:"/agents/$id",params:{id:u}}),[i,o]=x.useState(!1),[a,l]=x.useState(null);return m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsx(Sc,{title:"Agents",description:"Create and manage autonomous agents.",actionLabel:"New agent",onAction:()=>o(!0)}),e&&e.length>0?m.jsx("div",{className:"rounded-lg border border-border",children:m.jsxs(eo,{children:[m.jsx(Jo,{children:m.jsxs(yn,{children:[m.jsx(et,{className:"w-[140px]",children:"ID"}),m.jsx(et,{children:"Name"}),m.jsx(et,{children:"Model"}),m.jsx(et,{children:"Status"}),m.jsx(et,{children:"Created"}),m.jsx(et,{className:"w-[50px]"})]})}),m.jsx(to,{children:e.map(u=>m.jsxs(yn,{className:"cursor-pointer",onClick:()=>r(u.id),children:[m.jsxs(Ue,{className:"font-mono text-xs text-muted-foreground",children:[u.id.slice(0,16),"..."]}),m.jsx(Ue,{className:"font-medium text-foreground",children:u.name}),m.jsx(Ue,{className:"font-mono text-xs text-muted-foreground",children:u.model}),m.jsx(Ue,{children:m.jsx(an,{variant:"outline",className:"border-lime-400/20 bg-lime-400/10 text-lime-400 text-xs",children:"Active"})}),m.jsx(Ue,{className:"text-sm text-muted-foreground",children:Eve(u.created_at)}),m.jsx(Ue,{onClick:f=>f.stopPropagation(),children:m.jsxs(M8,{children:[m.jsx(I8,{render:m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground"}),children:m.jsx(n8,{className:"size-4"})}),m.jsxs(D8,{align:"end",children:[m.jsxs(pO,{onSelect:()=>setTimeout(()=>r(u.id),0),children:[m.jsx(r8,{className:"mr-2 size-3.5"})," Edit"]}),m.jsxs(pO,{className:"text-destructive",onSelect:()=>l({id:u.id,name:u.name}),children:[m.jsx(Mi,{className:"mr-2 size-3.5"})," Delete"]})]})]})})]},u.id))})]})}):m.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No agents yet. Create one to get started."}),m.jsx(Sve,{open:i,onOpenChange:o}),m.jsx(xh,{open:!!a,onOpenChange:u=>!u&&l(null),children:m.jsxs(bh,{children:[m.jsxs(wh,{children:[m.jsxs(Eh,{children:["Delete ",a?.name,"?"]}),m.jsx(Ch,{children:"This action cannot be undone."})]}),m.jsxs(Sh,{children:[m.jsx(kh,{children:"Cancel"}),m.jsx(_h,{variant:"destructive",onClick:()=>{a&&t.mutate(a.id),l(null)},children:"Delete"})]})]})})]})}const Dq=x.createContext(void 0);function mA(){const e=x.useContext(Dq);if(e===void 0)throw new Error(Xt(64));return e}let _ve=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const gA={tabActivationDirection:e=>({[_ve.activationDirection]:e})},kve=x.forwardRef(function(t,n){const{className:r,defaultValue:i=0,onValueChange:o,orientation:a="horizontal",render:l,value:u,style:f,...d}=t,h=Object.hasOwn(t,"defaultValue"),g=x.useRef([]),[v,b]=x.useState(()=>new Map),[w,S]=Lu({controlled:u,default:i,name:"Tabs",state:"value"}),E=u!==void 0,[k,O]=x.useState(()=>new Map),j=x.useCallback(R=>{if(R===void 0)return null;for(const[X,W]of k.entries())if(W!=null&&R===(W.value??W.index))return X;return null},[k]),[A,T]=x.useState(()=>({previousValue:w,tabActivationDirection:"none"})),{previousValue:N,tabActivationDirection:P}=A;let F=P,D=!1;N!==w&&(F=jz(N,w,a,k),D=N!=null&&w!=null&&j(w)==null);const q=D?N:w,L=N!==q||P!==F;Pe(()=>{L&&T({previousValue:q,tabActivationDirection:F})},[q,L,F]);const U=Le((R,X)=>{const W=jz(w,R,a,k);X.activationDirection=W,o?.(R,X),!X.isCanceled&&S(R)}),H=Le((R,X)=>{b(W=>{if(W.get(R)===X)return W;const Z=new Map(W);return Z.set(R,X),Z})}),B=Le((R,X)=>{b(W=>{if(!W.has(R)||W.get(R)!==X)return W;const Z=new Map(W);return Z.delete(R),Z})}),z=x.useCallback(R=>v.get(R),[v]),V=x.useCallback(R=>{for(const X of k.values())if(R===X?.value)return X?.id},[k]),Q=x.useMemo(()=>({getTabElementBySelectedValue:j,getTabIdByPanelValue:V,getTabPanelIdByValue:z,onValueChange:U,orientation:a,registerMountedTabPanel:H,setTabMap:O,unregisterMountedTabPanel:B,tabActivationDirection:F,value:w}),[j,V,z,U,a,H,O,B,F,w]),G=x.useMemo(()=>{for(const R of k.values())if(R!=null&&R.value===w)return R},[k,w]),I=x.useMemo(()=>{for(const R of k.values())if(R!=null&&!R.disabled)return R.value},[k]);Pe(()=>{if(E||k.size===0)return;const R=G?.disabled,X=G==null&&w!==null;if(h&&R&&w===i||!R&&!X)return;const Z=I??null;w!==Z&&(S(Z),T(oe=>oe.tabActivationDirection==="none"?oe:{...oe,tabActivationDirection:"none"}))},[i,I,h,E,G,S,k,w]);const $=vt("div",t,{state:{orientation:a,tabActivationDirection:F},ref:n,props:d,stateAttributesMapping:gA});return m.jsx(Dq.Provider,{value:Q,children:m.jsx(Pg,{elementsRef:g,children:$})})});function jz(e,t,n,r){if(e==null||t==null)return"none";let i=null,o=null;for(const[u,f]of r.entries()){if(f==null)continue;const d=f.value??f.index;if(e===d&&(i=u),t===d&&(o=u),i!=null&&o!=null)break}if(i==null||o==null)return i!==o&&(typeof e=="number"||typeof e=="string")&&typeof e==typeof t?n==="horizontal"?t>e?"right":"left":t>e?"down":"up":"none";const a=i.getBoundingClientRect(),l=o.getBoundingClientRect();if(n==="horizontal"){if(l.left<a.left)return"left";if(l.left>a.left)return"right"}else{if(l.top<a.top)return"up";if(l.top>a.top)return"down"}return"none"}const Lq="data-composite-item-active",zq=x.createContext(void 0);function Ove(){const e=x.useContext(zq);if(e===void 0)throw new Error(Xt(65));return e}const jve=x.forwardRef(function(t,n){const{className:r,disabled:i=!1,render:o,value:a,id:l,nativeButton:u=!0,style:f,...d}=t,{value:h,getTabPanelIdByValue:g,orientation:v}=mA(),{activateOnFocus:b,highlightedTabIndex:w,onTabActivation:S,registerTabResizeObserverElement:E,setHighlightedTabIndex:k,tabsListElement:O}=Ove(),j=Br(l),A=x.useMemo(()=>({disabled:i,id:j,value:a}),[i,j,a]),{compositeProps:T,compositeRef:N,index:P}=N8({metadata:A}),F=a===h,D=x.useRef(!1),q=x.useRef(null);x.useEffect(()=>{const $=q.current;if($)return E($)},[E]),Pe(()=>{if(D.current){D.current=!1;return}if(!(F&&P>-1&&w!==P))return;const $=O;if($!=null){const R=Oi(jt($));if(R&<($,R))return}i||k(P)},[F,P,w,k,i,O]);const{getButtonProps:L,buttonRef:U}=Zo({disabled:i,native:u,focusableWhenDisabled:!0}),H=g(a),B=x.useRef(!1),z=x.useRef(!1);function V($){F||i||S(a,ct(Wo,$.nativeEvent,void 0,{activationDirection:"none"}))}function Q($){F||(P>-1&&!i&&k(P),!i&&b&&(!B.current||B.current&&z.current)&&S(a,ct(Wo,$.nativeEvent,void 0,{activationDirection:"none"})))}function G($){if(F||i)return;B.current=!0;function R(){B.current=!1,z.current=!1}(!$.button||$.button===0)&&(z.current=!0,jt($.currentTarget).addEventListener("pointerup",R,{once:!0}))}return vt("button",t,{state:{disabled:i,active:F,orientation:v},ref:[n,U,N,q],props:[T,{role:"tab","aria-controls":H,"aria-selected":F,id:j,onClick:V,onFocus:Q,onPointerDown:G,[Lq]:F?"":void 0,onKeyDownCapture(){D.current=!0}},d,L]})});let Tve=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e[e.startingStyle=Ns.startingStyle]="startingStyle",e[e.endingStyle=Ns.endingStyle]="endingStyle",e})({});const Ave={...gA,...$s},Nve=x.forwardRef(function(t,n){const{className:r,value:i,render:o,keepMounted:a=!1,style:l,...u}=t,{value:f,getTabIdByPanelValue:d,orientation:h,tabActivationDirection:g,registerMountedTabPanel:v,unregisterMountedTabPanel:b}=mA(),w=Br(),S=x.useMemo(()=>({id:w,value:i}),[w,i]),{ref:E,index:k}=Rg({metadata:S}),O=i===f,{mounted:j,transitionStatus:A,setMounted:T}=hh(O),N=!j,P=d(i),F={hidden:N,orientation:h,tabActivationDirection:g,transitionStatus:A},D=x.useRef(null),q=vt("div",t,{state:F,ref:[n,E,D],props:[{"aria-labelledby":P,hidden:N,id:w,role:"tabpanel",tabIndex:O?0:-1,inert:jg(!O),[Tve.index]:k},u],stateAttributesMapping:Ave});return Qo({open:O,ref:D,onComplete(){O||T(!1)}}),Pe(()=>{if(!(N&&!a)&&w!=null)return v(i,w),()=>{b(i,w)}},[N,a,i,w,v,b]),a||j?q:null}),Rve=[];function Pve(e){const{itemSizes:t,cols:n=1,loopFocus:r=!0,onLoop:i,dense:o=!1,orientation:a="both",direction:l,highlightedIndex:u,onHighlightedIndexChange:f,rootRef:d,enableHomeAndEndKeys:h=!1,stopEventPropagation:g=!1,disabledIndices:v,modifierKeys:b=Rve}=e,[w,S]=x.useState(0),E=n>1,k=x.useRef(null),O=Po(k,d),j=x.useRef([]),A=x.useRef(!1),T=u??w,N=Le((q,L=!1)=>{if((f??S)(q),L){const U=j.current[q];QL(k.current,U,l,a)}}),P=Le(q=>{if(q.size===0||A.current)return;A.current=!0;const L=Array.from(q.keys()),U=L.find(B=>B?.hasAttribute(Lq))??null,H=U?L.indexOf(U):-1;H!==-1&&N(H),QL(k.current,U,l,a)}),F=Le((q,L,U)=>i?i?.(q,L,U,j):U),D=x.useMemo(()=>({"aria-orientation":a==="both"?void 0:a,ref:O,onFocus(q){const L=k.current,U=Sr(q.nativeEvent);!L||U==null||!XL(U)||U.setSelectionRange(0,U.value.length??0)},onKeyDown(q){const L=h?Qfe:f8;if(!L.has(q.key)||Mve(q,b)||!k.current)return;const H=l==="rtl",B=H?zu:ec,z={horizontal:B,vertical:vs,both:B}[a],V=H?ec:zu,Q={horizontal:V,vertical:Jl,both:V}[a],G=Sr(q.nativeEvent);if(G!=null&&XL(G)&&!hO(G)){const Z=G.selectionStart,oe=G.selectionEnd,ie=G.value??"";if(Z==null||q.shiftKey||Z!==oe||q.key!==Q&&Z<ie.length||q.key!==z&&Z>0)return}let I=T;const K=Mx(j,v),$=oO(j,v);if(E){const Z=t||Array.from({length:j.current.length},()=>({width:1,height:1})),oe=LU(Z,n,o),ie=oe.findIndex(se=>se!=null&&!Es(j.current,se,v)),J=oe.reduce((se,xe,ne)=>xe!=null&&!Es(j.current,xe,v)?ne:se,-1);I=oe[DU(oe.map(se=>se!=null?j.current[se]:null),{event:q,orientation:a,loopFocus:r,onLoop:F,cols:n,disabledIndices:FU([...v||j.current.map((se,xe)=>Es(j.current,xe)?xe:void 0),void 0],oe),minIndex:ie,maxIndex:J,prevIndex:zU(T>$?K:T,Z,oe,n,q.key===vs?"bl":q.key===ec?"tr":"tl"),rtl:H})]}const R={horizontal:[B],vertical:[vs],both:[B,vs]}[a],X={horizontal:[V],vertical:[Jl],both:[V,Jl]}[a],W=E?L:{horizontal:h?Gfe:c8,vertical:h?Xfe:u8,both:L}[a];h&&(q.key===gh?I=K:q.key===vh&&(I=$)),I===T&&(R.includes(q.key)||X.includes(q.key))&&(r&&I===$&&R.includes(q.key)?(I=K,i&&(I=i(q,T,I,j))):r&&I===K&&X.includes(q.key)?(I=$,i&&(I=i(q,T,I,j))):I=Kr(j.current,{startingIndex:I,decrement:X.includes(q.key),disabledIndices:v})),I!==T&&!Dm(j.current,I)&&(g&&q.stopPropagation(),W.has(q.key)&&q.preventDefault(),N(I,!0),queueMicrotask(()=>{j.current[I]?.focus()}))}}),[n,o,l,v,j,h,T,E,t,r,i,F,O,b,N,a,g]);return x.useMemo(()=>({props:D,highlightedIndex:T,onHighlightedIndexChange:N,elementsRef:j,disabledIndices:v,onMapChange:P,relayKeyboardEvent:D.onKeyDown}),[D,T,N,j,v,P])}function Mve(e,t){for(const n of nde.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Ive(e){const{render:t,className:n,style:r,refs:i=sc,props:o=sc,state:a=Wn,stateAttributesMapping:l,highlightedIndex:u,onHighlightedIndexChange:f,orientation:d,dense:h,itemSizes:g,loopFocus:v,onLoop:b,cols:w,enableHomeAndEndKeys:S,onMapChange:E,stopEventPropagation:k=!0,rootRef:O,disabledIndices:j,modifierKeys:A,highlightItemOnHover:T=!1,tag:N="div",...P}=e,F=ef(),{props:D,highlightedIndex:q,onHighlightedIndexChange:L,elementsRef:U,onMapChange:H,relayKeyboardEvent:B}=Pve({itemSizes:g,cols:w,loopFocus:v,onLoop:b,dense:h,orientation:d,highlightedIndex:u,onHighlightedIndexChange:f,rootRef:O,stopEventPropagation:k,enableHomeAndEndKeys:S,direction:F,disabledIndices:j,modifierKeys:A}),z=vt(N,e,{state:a,ref:i,props:[D,...o,P],stateAttributesMapping:l}),V=x.useMemo(()=>({highlightedIndex:q,onHighlightedIndexChange:L,highlightItemOnHover:T,relayKeyboardEvent:B}),[q,L,T,B]);return m.jsx(o8.Provider,{value:V,children:m.jsx(Pg,{elementsRef:U,onMapChange:Q=>{E?.(Q),H(Q)},children:z})})}const Dve=x.forwardRef(function(t,n){const{activateOnFocus:r=!1,className:i,loopFocus:o=!0,render:a,style:l,...u}=t,{onValueChange:f,orientation:d,value:h,setTabMap:g,tabActivationDirection:v}=mA(),[b,w]=x.useState(0),[S,E]=x.useState(null),k=x.useRef(new Set),O=x.useRef(new Set),j=x.useRef(null),A=Le(()=>{k.current.forEach(L=>{L()})});x.useEffect(()=>{if(typeof ResizeObserver>"u")return;const L=new ResizeObserver(()=>{k.current.size&&A()});return j.current=L,S&&L.observe(S),O.current.forEach(U=>{L.observe(U)}),()=>{L.disconnect(),j.current=null}},[S,A]);const T=Le(L=>(k.current.add(L),()=>{k.current.delete(L)})),N=Le(L=>(O.current.add(L),j.current?.observe(L),()=>{O.current.delete(L),j.current?.unobserve(L)})),P=Le((L,U)=>{L!==h&&f(L,U)}),F={orientation:d,tabActivationDirection:v},D={"aria-orientation":d==="vertical"?"vertical":void 0,role:"tablist"},q=x.useMemo(()=>({activateOnFocus:r,highlightedTabIndex:b,registerIndicatorUpdateListener:T,registerTabResizeObserverElement:N,onTabActivation:P,setHighlightedTabIndex:w,tabsListElement:S}),[r,b,T,N,P,w,S]);return m.jsx(zq.Provider,{value:q,children:m.jsx(Ive,{render:a,className:i,style:l,state:F,refs:[n,E],props:[D,u],stateAttributesMapping:gA,highlightedIndex:b,enableHomeAndEndKeys:!0,loopFocus:o,orientation:d,onHighlightedIndexChange:w,onMapChange:g,disabledIndices:sc})})});function Lve({className:e,orientation:t="horizontal",...n}){return m.jsx(kve,{"data-slot":"tabs","data-orientation":t,className:Ne("group/tabs flex gap-2 data-horizontal:flex-col",e),...n})}const zve=Ag("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Fve({className:e,variant:t="default",...n}){return m.jsx(Dve,{"data-slot":"tabs-list","data-variant":t,className:Ne(zve({variant:t}),e),...n})}function Zy({className:e,...t}){return m.jsx(jve,{"data-slot":"tabs-trigger",className:Ne("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",e),...t})}function Jy({className:e,...t}){return m.jsx(Nve,{"data-slot":"tabs-content",className:Ne("flex-1 text-sm outline-none",e),...t})}const Fq=x.createContext(void 0);function Bve(){const e=x.useContext(Fq);if(e===void 0)throw new Error(Xt(63));return e}let Tz=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Bq={...VT,checked(e){return e?{[Tz.checked]:""}:{[Tz.unchecked]:""}}};function $ve(e,t,n,r=!0,i){const[o,a]=x.useState(),l=Br(i?\`\${i}-label\`:void 0),u=e??t??o;return Pe(()=>{const f=e||t||!r?void 0:Uve(n.current,l);o!==f&&a(f)}),u}function Uve(e,t){const n=Hve(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function Hve(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const n=e.id;if(n){const i=e.nextElementSibling;if(i&&i.htmlFor===n)return i}const r=e.labels;return r&&r[0]}const qve=x.forwardRef(function(t,n){const{checked:r,className:i,defaultChecked:o,"aria-labelledby":a,form:l,id:u,inputRef:f,name:d,nativeButton:h=!1,onCheckedChange:g,readOnly:v=!1,required:b=!1,disabled:w=!1,render:S,uncheckedValue:E,value:k,style:O,...j}=t,{clearErrors:A}=a8(),{state:T,setTouched:N,setDirty:P,validityData:F,setFilled:D,setFocused:q,shouldValidateOnChange:L,validationMode:U,disabled:H,name:B,validation:z}=mh(),{labelId:V}=ow(),Q=H||w,G=B??d,I=Le(g),K=x.useRef(null),$=Po(K,f,z.inputRef),R=x.useRef(null),X=Br(),W=aw({id:u,implicit:!1,controlRef:R}),Z=h?void 0:W,[oe,ie]=Lu({controlled:r,default:!!o,name:"Switch",state:"checked"});KT(R,{id:X,value:oe}),Pe(()=>{K.current&&D(K.current.checked)},[K,D]),QT(oe,()=>{A(G),P(oe!==F.initialValue),D(oe),L()?z.commit(oe):z.commit(oe,!0)});const{getButtonProps:J,buttonRef:se}=Zo({disabled:Q,native:h}),xe=$ve(a,V,K,!h,Z),ne={id:h?W:X,role:"switch","aria-checked":oe,"aria-readonly":v||void 0,"aria-required":b||void 0,"aria-labelledby":xe,onFocus(){Q||q(!0)},onBlur(){const Ee=K.current;!Ee||Q||(N(!0),q(!1),U==="onBlur"&&z.commit(Ee.checked))},onClick(Ee){v||Q||(Ee.preventDefault(),K.current?.dispatchEvent(new PointerEvent("click",{bubbles:!0,shiftKey:Ee.shiftKey,ctrlKey:Ee.ctrlKey,altKey:Ee.altKey,metaKey:Ee.metaKey})))}},ke=x.useMemo(()=>Mo({checked:oe,disabled:Q,form:l,id:Z,name:G,required:b,style:G?NU:fT,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:$,onChange(Ee){if(Ee.nativeEvent.defaultPrevented)return;if(v){Ee.preventDefault();return}const Oe=Ee.currentTarget.checked,Re=ct(Wo,Ee.nativeEvent);I?.(Oe,Re),!Re.isCanceled&&ie(Oe)},onFocus(){R.current?.focus()}},z.getInputValidationProps,k!==void 0?{value:k}:Wn),[oe,Q,l,$,Z,G,I,v,b,ie,z,k]),Ce=x.useMemo(()=>({...T,checked:oe,disabled:Q,readOnly:v,required:b}),[T,oe,Q,v,b]),Be=vt("span",t,{state:Ce,ref:[n,R,se],props:[ne,z.getValidationProps,j,J],stateAttributesMapping:Bq});return m.jsxs(Fq.Provider,{value:Ce,children:[Be,!oe&&G&&E!==void 0&&m.jsx("input",{type:"hidden",form:l,name:G,value:E}),m.jsx("input",{...ke,suppressHydrationWarning:!0})]})}),Vve=x.forwardRef(function(t,n){const{render:r,className:i,style:o,...a}=t,{state:l}=mh(),u=Bve(),f={...l,...u};return vt("span",t,{state:f,ref:n,stateAttributesMapping:Bq,props:a})});function Az({className:e,size:t="default",...n}){return m.jsx(qve,{"data-slot":"switch","data-size":t,className:Ne("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...n,children:m.jsx(Vve,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}function Kve({agent:e}){const t=Ng(),[n,r]=x.useState(e.name),[i,o]=x.useState(e.engine),[a,l]=x.useState(e.model),[u,f]=x.useState(e.system||""),[d,h]=x.useState(e.threads_enabled??!1),[g,v]=x.useState(e.confirmation_mode??!1),b=n!==e.name||i!==e.engine||a!==e.model||u!==(e.system||"")||d!==(e.threads_enabled??!1)||g!==(e.confirmation_mode??!1);async function w(){try{await t.mutateAsync({id:e.id,name:n,engine:i,model:a,system:u||void 0,threads_enabled:d,confirmation_mode:g}),qe.success("Agent updated")}catch{qe.error("Failed to update agent")}}return m.jsxs("div",{className:"flex flex-col gap-5",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{htmlFor:"agent-name",className:"text-sm text-foreground",children:"Name"}),m.jsx(en,{id:"agent-name",value:n,onChange:S=>r(S.target.value),className:"text-foreground"})]}),m.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-sm text-foreground",children:"Engine"}),m.jsxs(To,{value:i,onValueChange:S=>{S&&(o(S),l(Xd[S]?.[0]??""))},children:[m.jsx(Ao,{className:"text-foreground",children:m.jsx(Oh,{})}),m.jsx(No,{children:lA.map(S=>m.jsx(ai,{value:S,children:S},S))})]})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-sm text-foreground",children:"Model"}),m.jsx(pA,{engine:i,value:a,onChange:l})]})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{htmlFor:"agent-system",className:"text-sm text-foreground",children:"System Prompt"}),m.jsx(xw,{id:"agent-system",value:u,onChange:S=>f(S.target.value),placeholder:"Optional system prompt for the agent...",className:"min-h-[120px] text-foreground"})]}),m.jsxs("div",{className:"flex flex-col gap-4 rounded-lg border p-4",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-sm font-medium text-foreground",children:"Threads Enabled"}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"Allow agent to spawn child sessions"})]}),m.jsx(Az,{checked:d,onCheckedChange:h})]}),m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-sm font-medium text-foreground",children:"Confirmation Mode"}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"Require confirmation before executing tools"})]}),m.jsx(Az,{checked:g,onCheckedChange:v})]})]}),m.jsx("div",{className:"flex justify-end",children:m.jsx(Fe,{className:"bg-cta-gradient text-black font-medium hover:opacity-90",onClick:w,disabled:!b||t.isPending,children:t.isPending?"Saving...":"Save Changes"})})]})}function fi({className:e,size:t="default",...n}){return m.jsx("div",{"data-slot":"card","data-size":t,className:Ne("group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",e),...n})}function _s({className:e,...t}){return m.jsx("div",{"data-slot":"card-header",className:Ne("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",e),...t})}function ks({className:e,...t}){return m.jsx("div",{"data-slot":"card-title",className:Ne("font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",e),...t})}function Yve({className:e,...t}){return m.jsx("div",{"data-slot":"card-description",className:Ne("text-sm text-muted-foreground",e),...t})}function Lr({className:e,...t}){return m.jsx("div",{"data-slot":"card-content",className:Ne("px-4 group-data-[size=sm]/card:px-3",e),...t})}function Wve({className:e,...t}){return m.jsx("div",{"data-slot":"card-footer",className:Ne("flex items-center rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/card:p-3",e),...t})}const $q=x.createContext(void 0);function bw(){const e=x.useContext($q);if(e===void 0)throw new Error(Xt(53));return e}let xb=(function(e){return e.scrollAreaCornerHeight="--scroll-area-corner-height",e.scrollAreaCornerWidth="--scroll-area-corner-width",e})({});const ex=500,Nz=16;function Co(e,t,n){if(!e)return 0;const r=getComputedStyle(e),i=n==="x"?"Inline":"Block";return n==="x"&&t==="margin"?parseFloat(r[\`\${t}InlineStart\`])*2:parseFloat(r[\`\${t}\${i}Start\`])+parseFloat(r[\`\${t}\${i}End\`])}let Gve=(function(e){return e.orientation="data-orientation",e.hovering="data-hovering",e.scrolling="data-scrolling",e.hasOverflowX="data-has-overflow-x",e.hasOverflowY="data-has-overflow-y",e.overflowXStart="data-overflow-x-start",e.overflowXEnd="data-overflow-x-end",e.overflowYStart="data-overflow-y-start",e.overflowYEnd="data-overflow-y-end",e})({}),Zf=(function(e){return e.scrolling="data-scrolling",e.hasOverflowX="data-has-overflow-x",e.hasOverflowY="data-has-overflow-y",e.overflowXStart="data-overflow-x-start",e.overflowXEnd="data-overflow-x-end",e.overflowYStart="data-overflow-y-start",e.overflowYEnd="data-overflow-y-end",e})({});const vA={hasOverflowX:e=>e?{[Zf.hasOverflowX]:""}:null,hasOverflowY:e=>e?{[Zf.hasOverflowY]:""}:null,overflowXStart:e=>e?{[Zf.overflowXStart]:""}:null,overflowXEnd:e=>e?{[Zf.overflowXEnd]:""}:null,overflowYStart:e=>e?{[Zf.overflowYStart]:""}:null,overflowYEnd:e=>e?{[Zf.overflowYEnd]:""}:null,cornerHidden:()=>null},Xve={x:0,y:0},Rz={width:0,height:0},Qve={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},Zve={x:!0,y:!0,corner:!0},Jve=x.forwardRef(function(t,n){const{render:r,className:i,overflowEdgeThreshold:o,style:a,...l}=t,u=eye(o),f=Br(),d=Fn(),h=Fn(),{nonce:g,disableStyleElements:v}=V8(),[b,w]=x.useState(!1),[S,E]=x.useState(!1),[k,O]=x.useState(!1),[j,A]=x.useState(!1),[T,N]=x.useState(!1),[P,F]=x.useState(Rz),[D,q]=x.useState(Rz),[L,U]=x.useState(Qve),[H,B]=x.useState(Zve),z=x.useRef(null),V=x.useRef(null),Q=x.useRef(null),G=x.useRef(null),I=x.useRef(null),K=x.useRef(null),$=x.useRef(null),R=x.useRef(!1),X=x.useRef(0),W=x.useRef(0),Z=x.useRef(0),oe=x.useRef(0),ie=x.useRef("vertical"),J=x.useRef(Xve),se=Le(_e=>{const de=_e.x-J.current.x,be=_e.y-J.current.y;J.current=_e,be!==0&&(O(!0),d.start(ex,()=>{O(!1)})),de!==0&&(E(!0),h.start(ex,()=>{E(!1)}))}),xe=Le(_e=>{_e.button===0&&(R.current=!0,X.current=_e.clientY,W.current=_e.clientX,ie.current=_e.currentTarget.getAttribute(Gve.orientation),V.current&&(Z.current=V.current.scrollTop,oe.current=V.current.scrollLeft),I.current&&ie.current==="vertical"&&I.current.setPointerCapture(_e.pointerId),K.current&&ie.current==="horizontal"&&K.current.setPointerCapture(_e.pointerId))}),ne=Le(_e=>{if(!R.current)return;const de=_e.clientY-X.current,be=_e.clientX-W.current;if(V.current){const ve=V.current.scrollHeight,pe=V.current.clientHeight,Ae=V.current.scrollWidth,ae=V.current.clientWidth;if(I.current&&Q.current&&ie.current==="vertical"){const me=Co(Q.current,"padding","y"),De=Co(I.current,"margin","y"),$e=I.current.offsetHeight,Ve=Q.current.offsetHeight-$e-me-De,dt=de/Ve;V.current.scrollTop=Z.current+dt*(ve-pe),_e.preventDefault(),O(!0),d.start(ex,()=>{O(!1)})}if(K.current&&G.current&&ie.current==="horizontal"){const me=Co(G.current,"padding","x"),De=Co(K.current,"margin","x"),$e=K.current.offsetWidth,Ve=G.current.offsetWidth-$e-me-De,dt=be/Ve;V.current.scrollLeft=oe.current+dt*(Ae-ae),_e.preventDefault(),E(!0),h.start(ex,()=>{E(!1)})}}}),ke=Le(_e=>{R.current=!1,I.current&&ie.current==="vertical"&&I.current.releasePointerCapture(_e.pointerId),K.current&&ie.current==="horizontal"&&K.current.releasePointerCapture(_e.pointerId)});function Ce(_e){A(_e.pointerType==="touch")}function Be(_e){if(Ce(_e),_e.pointerType!=="touch"){const de=lt(z.current,_e.target);w(de)}}const Ee=x.useMemo(()=>({scrolling:S||k,hasOverflowX:!H.x,hasOverflowY:!H.y,overflowXStart:L.xStart,overflowXEnd:L.xEnd,overflowYStart:L.yStart,overflowYEnd:L.yEnd,cornerHidden:H.corner}),[S,k,H.x,H.y,H.corner,L]),Oe={role:"presentation",onPointerEnter:Be,onPointerMove:Be,onPointerDown:Ce,onPointerLeave(){w(!1)},style:{position:"relative",[xb.scrollAreaCornerHeight]:\`\${P.height}px\`,[xb.scrollAreaCornerWidth]:\`\${P.width}px\`}},Re=vt("div",t,{state:Ee,ref:[n,z],props:[Oe,l],stateAttributesMapping:vA}),je=x.useMemo(()=>({handlePointerDown:xe,handlePointerMove:ne,handlePointerUp:ke,handleScroll:se,cornerSize:P,setCornerSize:F,thumbSize:D,setThumbSize:q,hasMeasuredScrollbar:T,setHasMeasuredScrollbar:N,touchModality:j,cornerRef:$,scrollingX:S,setScrollingX:E,scrollingY:k,setScrollingY:O,hovering:b,setHovering:w,viewportRef:V,rootRef:z,scrollbarYRef:Q,scrollbarXRef:G,thumbYRef:I,thumbXRef:K,rootId:f,hiddenState:H,setHiddenState:B,overflowEdges:L,setOverflowEdges:U,viewportState:Ee,overflowEdgeThreshold:u}),[xe,ne,ke,se,P,D,T,j,S,E,k,O,b,w,f,H,L,Ee,u]);return m.jsxs($q.Provider,{value:je,children:[!v&&zm.getElement(g),Re]})});function eye(e){if(typeof e=="number"){const t=Math.max(0,e);return{xStart:t,xEnd:t,yStart:t,yEnd:t}}return{xStart:Math.max(0,e?.xStart||0),xEnd:Math.max(0,e?.xEnd||0),yStart:Math.max(0,e?.yStart||0),yEnd:Math.max(0,e?.yEnd||0)}}const tye=x.createContext(void 0);let Kl=(function(e){return e.scrollAreaOverflowXStart="--scroll-area-overflow-x-start",e.scrollAreaOverflowXEnd="--scroll-area-overflow-x-end",e.scrollAreaOverflowYStart="--scroll-area-overflow-y-start",e.scrollAreaOverflowYEnd="--scroll-area-overflow-y-end",e})({}),Pz=!1;function nye(){Pz||A0||(typeof CSS<"u"&&"registerProperty"in CSS&&[Kl.scrollAreaOverflowXStart,Kl.scrollAreaOverflowXEnd,Kl.scrollAreaOverflowYStart,Kl.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),Pz=!0)}const rye=x.forwardRef(function(t,n){const{render:r,className:i,style:o,...a}=t,{viewportRef:l,scrollbarYRef:u,scrollbarXRef:f,thumbYRef:d,thumbXRef:h,cornerRef:g,cornerSize:v,setCornerSize:b,setThumbSize:w,rootId:S,setHiddenState:E,hiddenState:k,setHasMeasuredScrollbar:O,handleScroll:j,setHovering:A,setOverflowEdges:T,overflowEdges:N,overflowEdgeThreshold:P,scrollingX:F,scrollingY:D}=bw(),q=ef(),L=x.useRef(!0),U=x.useRef([NaN,NaN,NaN,NaN]),H=Fn(),B=Fn(),z=Le(()=>{const $=l.current,R=u.current,X=f.current,W=d.current,Z=h.current,oe=g.current;if(!$)return;const ie=$.scrollHeight,J=$.scrollWidth,se=$.clientHeight,xe=$.clientWidth,ne=$.scrollTop,ke=$.scrollLeft,Ce=U.current,Be=Number.isNaN(Ce[0]);if(Ce[0]=se,Ce[1]=ie,Ce[2]=xe,Ce[3]=J,Be&&O(!0),ie===0||J===0)return;const Ee=iye($),Oe=Ee.y,Re=Ee.x,je=xe/J,_e=se/ie,de=Math.max(0,J-xe),be=Math.max(0,ie-se);let ve=0,pe=0;if(!Re){let ht=0;q==="rtl"?ht=va(-ke,0,de):ht=va(ke,0,de),ve=Gd(ht,de),pe=de-ve}const Ae=Oe?0:va(ne,0,be),ae=Oe?0:Gd(Ae,be),me=Oe?0:be-ae,De=Re?0:xe,$e=Oe?0:se;let Ve=0,dt=0;!Re&&!Oe&&(Ve=R?.offsetWidth||0,dt=X?.offsetHeight||0);const ze=v.width===0&&v.height===0,Ke=ze?Ve:0,tt=ze?dt:0,Tt=Co(X,"padding","x"),yt=Co(R,"padding","y"),Wt=Co(Z,"margin","x"),nt=Co(W,"margin","y"),Rt=De-Tt-Wt,zt=$e-yt-nt,Gt=X?Math.min(X.offsetWidth-Ke,Rt):Rt,Dn=R?Math.min(R.offsetHeight-tt,zt):zt,Qt=Math.max(Nz,Gt*je),Ze=Math.max(Nz,Dn*_e);if(w(ht=>ht.height===Ze&&ht.width===Qt?ht:{width:Qt,height:Ze}),R&&W){const ht=R.offsetHeight-Ze-yt-nt,En=ie-se,Bt=En===0?0:ne/En,rn=Math.min(ht,Math.max(0,Bt*ht));W.style.transform=\`translate3d(0,\${rn}px,0)\`}if(X&&Z){const ht=X.offsetWidth-Qt-Tt-Wt,En=J-xe,Bt=En===0?0:ke/En,rn=q==="rtl"?va(Bt*ht,-ht,0):va(Bt*ht,0,ht);Z.style.transform=\`translate3d(\${rn}px,0,0)\`}const At=[[Kl.scrollAreaOverflowXStart,ve],[Kl.scrollAreaOverflowXEnd,pe],[Kl.scrollAreaOverflowYStart,ae],[Kl.scrollAreaOverflowYEnd,me]];for(const[ht,En]of At)$.style.setProperty(ht,\`\${En}px\`);oe&&(Re||Oe?b({width:0,height:0}):!Re&&!Oe&&b({width:Ve,height:dt})),E(ht=>oye(ht,Ee));const Ft={xStart:!Re&&ve>P.xStart,xEnd:!Re&&pe>P.xEnd,yStart:!Oe&&ae>P.yStart,yEnd:!Oe&&me>P.yEnd};T(ht=>ht.xStart===Ft.xStart&&ht.xEnd===Ft.xEnd&&ht.yStart===Ft.yStart&&ht.yEnd===Ft.yEnd?ht:Ft)});Pe(()=>{l.current&&nye()},[l]),Pe(()=>{queueMicrotask(z)},[z,k,q]),Pe(()=>{l.current?.matches(":hover")&&A(!0)},[l,A]),x.useEffect(()=>{const $=l.current;if(typeof ResizeObserver>"u"||!$)return;let R=!1;const X=new ResizeObserver(()=>{if(!R){R=!0;const W=U.current;if(W[0]===$.clientHeight&&W[1]===$.scrollHeight&&W[2]===$.clientWidth&&W[3]===$.scrollWidth)return}z()});return X.observe($),B.start(0,()=>{const W=$.getAnimations({subtree:!0});W.length!==0&&Promise.allSettled(W.map(Z=>Z.finished)).then(z).catch(()=>{})}),()=>{X.disconnect(),B.clear()}},[z,l,B]);function V(){L.current=!1}const Q={role:"presentation",...S&&{"data-id":\`\${S}-viewport\`},tabIndex:k.x&&k.y?-1:0,className:zm.className,style:{overflow:"scroll"},onScroll(){l.current&&(z(),L.current||j({x:l.current.scrollLeft,y:l.current.scrollTop}),H.start(100,()=>{L.current=!0}))},onWheel:V,onTouchMove:V,onPointerMove:V,onPointerEnter:V,onKeyDown:V},G=x.useMemo(()=>({scrolling:F||D,hasOverflowX:!k.x,hasOverflowY:!k.y,overflowXStart:N.xStart,overflowXEnd:N.xEnd,overflowYStart:N.yStart,overflowYEnd:N.yEnd,cornerHidden:k.corner}),[F,D,k.x,k.y,k.corner,N]),I=vt("div",t,{ref:[n,l],state:G,props:[Q,a],stateAttributesMapping:vA}),K=x.useMemo(()=>({computeThumbPosition:z}),[z]);return m.jsx(tye.Provider,{value:K,children:I})});function iye(e){const t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function oye(e,t){return e.y===t.y&&e.x===t.x&&e.corner===t.corner?e:t}const Uq=x.createContext(void 0);function aye(){const e=x.useContext(Uq);if(e===void 0)throw new Error(Xt(54));return e}let bb=(function(e){return e.scrollAreaThumbHeight="--scroll-area-thumb-height",e.scrollAreaThumbWidth="--scroll-area-thumb-width",e})({});const sye=x.forwardRef(function(t,n){const{render:r,className:i,orientation:o="vertical",keepMounted:a=!1,style:l,...u}=t,{hovering:f,scrollingX:d,scrollingY:h,hiddenState:g,overflowEdges:v,scrollbarYRef:b,scrollbarXRef:w,viewportRef:S,thumbYRef:E,thumbXRef:k,handlePointerDown:O,handlePointerUp:j,rootId:A,thumbSize:T,hasMeasuredScrollbar:N}=bw(),P={hovering:f,scrolling:{horizontal:d,vertical:h}[o],orientation:o,hasOverflowX:!g.x,hasOverflowY:!g.y,overflowXStart:v.xStart,overflowXEnd:v.xEnd,overflowYStart:v.yStart,overflowYEnd:v.yEnd,cornerHidden:g.corner},F=ef(),D=!N&&!a;x.useEffect(()=>{const z=S.current,V=o==="vertical"?b.current:w.current;if(!V)return;function Q(G){if(!(!z||!V||G.ctrlKey)){if(G.preventDefault(),o==="vertical"){if(z.scrollTop===0&&G.deltaY<0)return}else if(z.scrollLeft===0&&G.deltaX<0)return;if(o==="vertical"){if(z.scrollTop===z.scrollHeight-z.clientHeight&&G.deltaY>0)return}else if(z.scrollLeft===z.scrollWidth-z.clientWidth&&G.deltaX>0)return;o==="vertical"?z.scrollTop+=G.deltaY:z.scrollLeft+=G.deltaX}}return kt(V,"wheel",Q,{passive:!1})},[o,w,b,S]);const q={...A&&{"data-id":\`\${A}-scrollbar\`},onPointerDown(z){if(z.button!==0)return;const V=Sr(z.nativeEvent),Q=o==="vertical"?E.current:k.current;if(!(Q&<(Q,V))&&S.current){if(E.current&&b.current&&o==="vertical"){const G=Co(E.current,"margin","y"),I=Co(b.current,"padding","y"),K=E.current.offsetHeight,$=b.current.getBoundingClientRect(),R=z.clientY-$.top-K/2-I+G/2,X=S.current.scrollHeight,W=S.current.clientHeight,Z=b.current.offsetHeight-K-I-G,ie=R/Z*(X-W);S.current.scrollTop=ie}if(k.current&&w.current&&o==="horizontal"){const G=Co(k.current,"margin","x"),I=Co(w.current,"padding","x"),K=k.current.offsetWidth,$=w.current.getBoundingClientRect(),R=z.clientX-$.left-K/2-I+G/2,X=S.current.scrollWidth,W=S.current.clientWidth,Z=w.current.offsetWidth-K-I-G,oe=R/Z;let ie;F==="rtl"?(ie=(1-oe)*(X-W),S.current.scrollLeft<=0&&(ie=-ie)):ie=oe*(X-W),S.current.scrollLeft=ie}O(z)}},onPointerUp:j,style:{position:"absolute",touchAction:"none",WebkitUserSelect:"none",userSelect:"none",visibility:D?"hidden":void 0,...o==="vertical"&&{top:0,bottom:\`var(\${xb.scrollAreaCornerHeight})\`,insetInlineEnd:0,[bb.scrollAreaThumbHeight]:\`\${T.height}px\`},...o==="horizontal"&&{insetInlineStart:0,insetInlineEnd:\`var(\${xb.scrollAreaCornerWidth})\`,bottom:0,[bb.scrollAreaThumbWidth]:\`\${T.width}px\`}}},L=vt("div",t,{ref:[n,o==="vertical"?b:w],state:P,props:[q,u],stateAttributesMapping:vA}),U=x.useMemo(()=>({orientation:o}),[o]),H=o==="vertical"?g.y:g.x;return a||!H?m.jsx(Uq.Provider,{value:U,children:L}):null}),lye=x.forwardRef(function(t,n){const{render:r,className:i,style:o,...a}=t,{thumbYRef:l,thumbXRef:u,handlePointerDown:f,handlePointerMove:d,handlePointerUp:h,setScrollingX:g,setScrollingY:v,hasMeasuredScrollbar:b}=bw(),{orientation:w}=aye();return vt("div",t,{ref:[n,w==="vertical"?l:u],state:{orientation:w},props:[{onPointerDown:f,onPointerMove:d,onPointerUp(k){w==="vertical"&&v(!1),w==="horizontal"&&g(!1),h(k)},style:{visibility:b?void 0:"hidden",...w==="vertical"&&{height:\`var(\${bb.scrollAreaThumbHeight})\`},...w==="horizontal"&&{width:\`var(\${bb.scrollAreaThumbWidth})\`}}},a]})}),cye=x.forwardRef(function(t,n){const{render:r,className:i,style:o,...a}=t,{cornerRef:l,cornerSize:u,hiddenState:f}=bw(),d=vt("div",t,{ref:[n,l],props:[{style:{position:"absolute",bottom:0,insetInlineEnd:0,width:u.width,height:u.height}},a]});return f.corner?null:d});function Hq({className:e,children:t,...n}){return m.jsxs(Jve,{"data-slot":"scroll-area",className:Ne("relative",e),...n,children:[m.jsx(rye,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",children:t}),m.jsx(uye,{}),m.jsx(cye,{})]})}function uye({className:e,orientation:t="vertical",...n}){return m.jsx(sye,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:Ne("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",e),...n,children:m.jsx(lye,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}function fye(e){const t=/^name:\\s*(.+)$/m.exec(e);if(t)return t[1].trim();const n=e.match(/^#\\s+(.+)$/m);return n?n[1].trim().toLowerCase().replace(/\\s+/g,"-"):null}async function yA(e){const t=e.indexOf("@");let n,r,i;if(t!==-1){const a=e.slice(0,t);i=e.slice(t+1),[n,r]=a.split("/")}else{const a=e.split("/");n=a[0],r=a[1]}if(!n||!r)throw new Error("Invalid format. Use owner/repo or owner/repo@skill-name");const o=i?[\`https://raw.githubusercontent.com/\${n}/\${r}/main/skills/\${i}/SKILL.md\`,\`https://raw.githubusercontent.com/\${n}/\${r}/main/\${i}/SKILL.md\`]:[\`https://raw.githubusercontent.com/\${n}/\${r}/main/SKILL.md\`,\`https://raw.githubusercontent.com/\${n}/\${r}/main/skills/SKILL.md\`];for(const a of o)try{const l=await fetch(a);if(l.ok){const u=await l.text();return{name:i||fye(u)||r,source:e,content:u,installed_at:new Date().toISOString()}}}catch{continue}throw new Error(\`Could not find SKILL.md for "\${e}"\`)}function dye(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return\`\${n}m ago\`;const r=Math.floor(n/60);return r<24?\`\${r}h ago\`:\`\${Math.floor(r/24)}d ago\`}function hye(e){return e>=1e6?\`\${(e/1e6).toFixed(1)}M\`:e>=1e3?\`\${(e/1e3).toFixed(1)}k\`:String(e)}function pye({agent:e}){const t=Ng(),[n,r]=x.useState(!1),[i,o]=x.useState(null),a=e.skills??[],[l,u]=x.useState(""),[f,d]=x.useState(""),[h,g]=x.useState("allTime"),[v,b]=x.useState(null),[w,S]=x.useState(null),[E,k]=x.useState(!1),[O,j]=x.useState([]),[A,T]=x.useState(null);x.useEffect(()=>{const U=setTimeout(()=>d(l),300);return()=>clearTimeout(U)},[l]),x.useEffect(()=>{Xe("/skills/sources?limit=20").then(U=>j(U.data??[])).catch(()=>{})},[]),x.useEffect(()=>{Xe("/skills/stats").then(T).catch(()=>{})},[]);const N=x.useCallback((U=0)=>{k(!0);const H=new URLSearchParams;f&&H.set("q",f),v&&H.set("source",v),H.set("sort",h),H.set("limit","30"),H.set("offset",String(U)),Xe(\`/skills?\${H}\`).then(B=>{S(U===0?B:z=>z?{...B,skills:[...z.skills,...B.skills]}:B)}).catch(()=>{}).finally(()=>k(!1))},[f,v,h]);x.useEffect(()=>{N(0)},[N]);async function P(U){try{await t.mutateAsync({id:e.id,skills:a.filter(H=>H.name!==U)}),qe.success(\`Removed skill "\${U}"\`)}catch{qe.error("Failed to remove skill")}}async function F(U){try{await t.mutateAsync({id:e.id,skills:[...a,U]}),qe.success(\`Installed skill "\${U.name}"\`),r(!1)}catch{qe.error("Failed to install skill")}}async function D(U){if(a.some(H=>H.name===U.title)){qe.error(\`Skill "\${U.title}" is already installed\`);return}o(U.id);try{const H=U.id.split("/");let B;H.length>=3?B=\`\${H[0]}/\${H[1]}@\${H.slice(2).join("/")}\`:B=U.id;const z=await yA(B);await F(z)}catch(H){qe.error(H instanceof Error?H.message:"Failed to install skill")}finally{o(null)}}const q=new Set(a.map(U=>U.name)),L=w&&w.offset+w.skills.length<w.total;return m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsxs("div",{children:[m.jsxs("p",{className:"text-sm font-medium text-foreground",children:["Installed Skills (",a.length,")"]}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"Give your agent domain expertise with skill files."})]}),m.jsxs(Fe,{variant:"outline",size:"sm",className:"gap-1.5 text-foreground",onClick:()=>r(!0),children:[m.jsx(bc,{className:"size-3.5"}),"Add from GitHub"]})]}),a.length===0?m.jsx("div",{className:"rounded-lg border border-dashed p-6 text-center",children:m.jsx("p",{className:"text-sm text-muted-foreground",children:"No skills installed. Browse the catalog below or add from GitHub."})}):m.jsx("div",{className:"grid gap-3",children:a.map(U=>m.jsxs(fi,{children:[m.jsx(_s,{className:"pb-2",children:m.jsxs("div",{className:"flex items-start justify-between",children:[m.jsxs("div",{children:[m.jsx(ks,{className:"text-sm",children:U.name}),m.jsx(Yve,{className:"font-mono text-xs",children:U.source})]}),U.installed_at&&m.jsx("span",{className:"text-xs text-muted-foreground",children:dye(U.installed_at)})]})}),m.jsx(Lr,{className:"pb-2",children:m.jsxs("pre",{className:"rounded bg-muted p-3 text-xs text-muted-foreground max-h-32 overflow-y-auto whitespace-pre-wrap",children:[U.content.slice(0,500),U.content.length>500?"...":""]})}),m.jsx(Wve,{children:m.jsxs(Fe,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>P(U.name),children:[m.jsx(Mi,{className:"mr-1.5 size-3.5"}),"Remove"]})})]},U.name))}),m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsx("div",{className:"flex items-center justify-between",children:m.jsxs("div",{children:[m.jsx("p",{className:"text-sm font-medium text-foreground",children:"Skills Catalog"}),A&&A.indexLoaded&&m.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[A.totalSkills.toLocaleString()," skills from"," ",A.totalOwners.toLocaleString()," authors"]})]})}),m.jsxs("div",{className:"relative",children:[m.jsx(rw,{className:"absolute left-2.5 top-2.5 size-3.5 text-muted-foreground"}),m.jsx(en,{placeholder:"Search 72k+ skills...",value:l,onChange:U=>u(U.target.value),className:"h-9 pl-8 text-sm text-foreground"})]}),m.jsx("div",{className:"flex flex-col gap-2",children:m.jsx("div",{className:"flex gap-1.5",children:["allTime","trending","hot","newest"].map(U=>m.jsx("button",{onClick:()=>g(U),className:\`rounded-full px-2.5 py-0.5 text-[11px] font-medium transition-colors \${h===U?"bg-lime-400/20 text-lime-400":"bg-muted text-muted-foreground hover:text-foreground"}\`,children:U==="allTime"?"All Time":U==="trending"?"Trending":U==="hot"?"Hot":"Newest"},U))})}),w&&m.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[w.total.toLocaleString()," results",E&&" \xB7 Loading..."]}),m.jsx("div",{className:"grid grid-cols-2 gap-2",children:w?.skills.map(U=>{const H=q.has(U.title),B=i===U.id,z=h==="trending"?U.installsTrending:h==="hot"?U.installsHot:U.installsAllTime;return m.jsxs("button",{disabled:H||B,onClick:()=>D(U),className:\`flex flex-col items-start gap-1 rounded-lg border px-3 py-2.5 text-left transition-colors \${H?"border-lime-400/30 bg-lime-400/5 opacity-60":"border-border hover:border-muted-foreground/50"}\`,children:[m.jsxs("div",{className:"flex items-center gap-2 w-full",children:[m.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:U.title}),m.jsxs(an,{variant:"outline",className:"ml-auto shrink-0 text-[10px] px-1.5 py-0",children:[m.jsx(Yd,{className:"size-2.5 mr-0.5"}),hye(z)]})]}),m.jsx("span",{className:"text-[10px] text-muted-foreground/60 font-mono",children:U.source}),H&&m.jsx("span",{className:"text-[10px] text-lime-400",children:"Installed"}),B&&m.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Installing..."})]},U.id)})}),L&&m.jsxs(Fe,{variant:"outline",size:"sm",className:"mx-auto gap-1.5 text-foreground",onClick:()=>N(w.offset+w.skills.length),disabled:E,children:[m.jsx(Tg,{className:"size-3.5"}),E?"Loading...":"Load more"]}),w&&w.skills.length===0&&!E&&m.jsxs("p",{className:"py-4 text-center text-xs text-muted-foreground",children:["No skills found",l?\` for "\${l}"\`:""]})]}),m.jsx(mye,{open:n,onOpenChange:r,existingNames:a.map(U=>U.name),onInstall:F})]})}function mye({open:e,onOpenChange:t,existingNames:n,onInstall:r}){const[i,o]=x.useState(""),[a,l]=x.useState(!1),[u,f]=x.useState(null),[d,h]=x.useState("");function g(){o(""),f(null),h(""),l(!1)}async function v(){h(""),f(null),l(!0);try{const b=await yA(i.trim());n.includes(b.name)?h(\`Skill "\${b.name}" is already installed\`):f(b)}catch(b){h(b instanceof Error?b.message:"Failed to fetch skill")}finally{l(!1)}}return m.jsx(ea,{open:e,onOpenChange:b=>{b||g(),t(b)},children:m.jsxs(za,{className:"max-w-lg border-border bg-card",children:[m.jsx(Fa,{children:m.jsx(Ba,{className:"text-foreground",children:"Add Skill from GitHub"})}),m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-sm text-foreground",children:"GitHub Source"}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx(en,{placeholder:"owner/repo or owner/repo@skill-name",value:i,onChange:b=>o(b.target.value),className:"flex-1 text-foreground",onKeyDown:b=>{b.key==="Enter"&&i.trim()&&v()}}),m.jsx(Fe,{variant:"outline",className:"text-foreground",onClick:v,disabled:!i.trim()||a,children:a?"Fetching...":"Fetch"})]}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"Fetches SKILL.md from the GitHub repository"})]}),d&&m.jsx("p",{className:"text-sm text-destructive",children:d}),u&&m.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border p-4",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-sm font-medium text-foreground",children:u.name}),m.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:u.source})]}),m.jsx(Hq,{className:"max-h-48",children:m.jsxs("pre",{className:"rounded bg-muted p-3 text-xs text-muted-foreground whitespace-pre-wrap",children:[u.content.slice(0,2e3),u.content.length>2e3?\`
|
|
217006
|
-
...\`:""]})}),m.jsx(Fe,{className:"bg-cta-gradient text-black font-medium hover:opacity-90",onClick:()=>r(u),children:"Install Skill"})]})]})]})})}function gye({agent:e}){const t=Ng(),[n,r]=x.useState(e.webhook_url||""),[i,o]=x.useState((e.webhook_events??[]).join(", ")),[a,l]=x.useState((e.callable_agents??[]).join(", ")),u=n!==(e.webhook_url||"")||i!==(e.webhook_events??[]).join(", ")||a!==(e.callable_agents??[]).join(", ");async function f(){try{await t.mutateAsync({id:e.id,webhook_url:n||void 0,webhook_events:i?i.split(",").map(d=>d.trim()).filter(Boolean):void 0,callable_agents:a?a.split(",").map(d=>d.trim()).filter(Boolean):void 0}),qe.success("Agent updated")}catch{qe.error("Failed to update agent")}}return m.jsxs("div",{className:"flex flex-col gap-6",children:[e.tools&&e.tools.length>0&&m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx(wt,{className:"text-sm text-foreground",children:"Tools"}),m.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.tools.map((d,h)=>m.jsx(an,{variant:"outline",className:"text-xs",children:typeof d=="string"?d:d?.name??JSON.stringify(d)},h))})]}),e.mcp_servers&&e.mcp_servers.length>0&&m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx(wt,{className:"text-sm text-foreground",children:"MCP Servers"}),m.jsx("pre",{className:"rounded bg-muted p-3 text-xs text-muted-foreground max-h-48 overflow-y-auto",children:JSON.stringify(e.mcp_servers,null,2)})]}),m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsx(wt,{className:"text-sm text-foreground",children:"Webhook"}),m.jsx(en,{placeholder:"https://example.com/webhook",value:n,onChange:d=>r(d.target.value),className:"text-foreground"}),m.jsx(en,{placeholder:"Events (comma-separated): session.created, turn.complete",value:i,onChange:d=>o(d.target.value),className:"text-foreground"})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-sm text-foreground",children:"Callable Agents"}),m.jsx(en,{placeholder:"Agent IDs (comma-separated)",value:a,onChange:d=>l(d.target.value),className:"text-foreground"}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"Other agents this agent can spawn as child sessions"})]}),u&&m.jsx("div",{className:"flex justify-end",children:m.jsx(Fe,{className:"bg-cta-gradient text-black font-medium hover:opacity-90",onClick:f,disabled:t.isPending,children:t.isPending?"Saving...":"Save Changes"})})]})}function vye({agent:e}){const t=Ng(),[n,r]=x.useState("");x.useEffect(()=>{const o={};for(const[a,l]of Object.entries(e))["id","created_at","updated_at","version"].includes(a)||(o[a]=l);r(JSON.stringify(o,null,2))},[e]);async function i(){try{const o=JSON.parse(n);await t.mutateAsync({id:e.id,...o}),qe.success("Agent updated")}catch(o){qe.error(o instanceof SyntaxError?"Invalid JSON":"Failed to update agent")}}return m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsx("p",{className:"text-xs text-muted-foreground",children:"Edit the full agent configuration as JSON."}),m.jsx(xw,{value:n,onChange:o=>r(o.target.value),className:"min-h-[400px] font-mono text-xs text-foreground leading-relaxed border-border bg-muted focus-visible:ring-ring"}),m.jsx("div",{className:"flex justify-end",children:m.jsx(Fe,{className:"bg-cta-gradient text-black font-medium hover:opacity-90",onClick:i,disabled:t.isPending,children:t.isPending?"Saving...":"Save"})})]})}function yye(){const e=bn(i=>i.selectedAgentId),t=Bs(),{data:n,isLoading:r}=JT(e);return r||!n?null:m.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[m.jsxs("div",{className:"flex items-center gap-3 border-b px-6 py-3",children:[m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground",onClick:()=>t({to:"/agents"}),children:m.jsx(GH,{className:"size-4"})}),m.jsxs("div",{className:"flex-1",children:[m.jsx("h2",{className:"text-sm font-semibold text-foreground",children:n.name}),m.jsxs("p",{className:"text-xs text-muted-foreground",children:[n.engine," / ",n.model]})]}),m.jsx(an,{variant:"outline",className:"border-lime-400/20 bg-lime-400/10 text-lime-400 text-xs",children:"Active"})]}),m.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-6",children:m.jsx("div",{children:m.jsxs(Lve,{defaultValue:"config",children:[m.jsxs(Fve,{children:[m.jsx(Zy,{value:"config",children:"Config"}),m.jsx(Zy,{value:"skills",children:"Skills"}),m.jsx(Zy,{value:"advanced",children:"Advanced"}),m.jsx(Zy,{value:"edit",children:"Edit"})]}),m.jsx(Jy,{value:"config",className:"mt-6",children:m.jsx(Kve,{agent:n})}),m.jsx(Jy,{value:"skills",className:"mt-6",children:m.jsx(pye,{agent:n})}),m.jsx(Jy,{value:"advanced",className:"mt-6",children:m.jsx(gye,{agent:n})}),m.jsx(Jy,{value:"edit",className:"mt-6",children:m.jsx(vye,{agent:n})})]})})})]})}const xye={SPRITE_TOKEN:"sprite_token",E2B_API_KEY:"e2b_api_key",VERCEL_TOKEN:"vercel_token",DAYTONA_API_KEY:"daytona_api_key",FLY_API_TOKEN:"fly_api_token",MODAL_TOKEN_ID:"modal_token_id"};function bye({open:e,onOpenChange:t}){const n=w8(),[r,i]=x.useState(""),[o,a]=x.useState("docker"),[l,u]=x.useState(""),f=G8[o],d=!!f;async function h(){if(r.trim())try{if(d&&l.trim()){const g=xye[f.key];g&&await Xe("/settings",{method:"PUT",body:JSON.stringify({key:g,value:l.trim()})})}await n.mutateAsync({name:r.trim(),config:{provider:o}}),i(""),u(""),qe.success("Environment created"),t(!1)}catch(g){const b=g?.body?.error?.message||(g instanceof Error?g.message:"Failed to create");qe.error(b)}}return m.jsx(ea,{open:e,onOpenChange:t,children:m.jsxs(za,{children:[m.jsx(Fa,{children:m.jsx(Ba,{children:"Add environment"})}),m.jsxs("div",{className:"flex flex-col gap-4 pt-2",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Name"}),m.jsx(en,{placeholder:"my-env",value:r,onChange:g=>i(g.target.value),className:"w-full text-foreground"})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Provider"}),m.jsxs(To,{value:o,onValueChange:g=>{g&&(a(g),u(""))},children:[m.jsx(Ao,{className:"w-full text-foreground",children:m.jsx(Oh,{})}),m.jsxs(No,{children:[m.jsxs(cz,{children:[m.jsx(uz,{children:"Local"}),Fm.map(g=>m.jsx(ai,{value:g,children:g},g))]}),m.jsxs(cz,{children:[m.jsx(uz,{children:"Cloud"}),ju.map(g=>m.jsx(ai,{value:g,children:g},g))]})]})]})]}),d&&m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:f.label}),m.jsx(en,{type:"password",placeholder:f.placeholder,value:l,onChange:g=>u(g.target.value),className:"w-full font-mono text-foreground"}),m.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Saved to server settings for provider access."})]}),m.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[m.jsx(Fe,{variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),m.jsx(Fe,{className:"bg-cta-gradient text-black hover:opacity-90",onClick:h,disabled:!r.trim()||n.isPending,children:"Create"})]})]})]})})}function wye(e){const t=typeof e=="string"?new Date(e).getTime():e,n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return\`\${r}m ago\`;const i=Math.floor(r/60);return i<24?\`\${i}h ago\`:\`\${Math.floor(i/24)}d ago\`}function Sye(){const{data:e}=nf(),t=Kde(),[n,r]=x.useState(!1);return m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsx(Sc,{title:"Environments",description:"Configuration for containers and code execution.",actionLabel:"Add environment",onAction:()=>r(!0)}),e&&e.length>0?m.jsx("div",{className:"rounded-lg border border-border",children:m.jsxs(eo,{children:[m.jsx(Jo,{children:m.jsxs(yn,{children:[m.jsx(et,{className:"w-[140px]",children:"ID"}),m.jsx(et,{children:"Name"}),m.jsx(et,{children:"Provider"}),m.jsx(et,{children:"Status"}),m.jsx(et,{children:"Created"}),m.jsx(et,{className:"w-[50px]"})]})}),m.jsx(to,{children:e.map(i=>m.jsxs(yn,{children:[m.jsxs(Ue,{className:"font-mono text-xs text-muted-foreground",children:[i.id.slice(0,16),"..."]}),m.jsx(Ue,{className:"font-medium text-foreground",children:i.name}),m.jsx(Ue,{className:"font-mono text-xs text-muted-foreground",children:i.config?.provider||"unknown"}),m.jsx(Ue,{children:m.jsx(an,{variant:"outline",className:Ne("text-xs",i.state==="ready"?"border-lime-400/20 bg-lime-400/10 text-lime-400":"text-muted-foreground"),children:i.state})}),m.jsx(Ue,{className:"text-muted-foreground",children:wye(i.created_at)}),m.jsx(Ue,{children:m.jsxs(M8,{children:[m.jsx(I8,{render:m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground"}),children:m.jsx(n8,{className:"size-4"})}),m.jsx(D8,{align:"end",children:m.jsxs(pO,{className:"text-destructive",onSelect:()=>t.mutate(i.id),children:[m.jsx(Mi,{className:"mr-2 size-3.5"})," Delete"]})})]})})]},i.id))})]})}):m.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No environments yet."}),m.jsx(bye,{open:n,onOpenChange:r})]})}function xA(e){const t=e?\`/vaults?agent_id=\${e}&limit=50\`:"/vaults?limit=50";return Bn({queryKey:["vaults",e??"all"],queryFn:()=>Xe(t),select:n=>n.data})}function Eye(e){return Bn({queryKey:["vaults",e,"entries"],queryFn:()=>Xe(\`/vaults/\${e}/entries\`),enabled:!!e,select:t=>t.data})}function qq(){const e=hn();return Nn({mutationFn:t=>Xe("/vaults",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>e.invalidateQueries({queryKey:["vaults"]})})}function Cye(){const e=hn();return Nn({mutationFn:t=>Xe(\`/vaults/\${t}\`,{method:"DELETE"}),onSuccess:()=>e.invalidateQueries({queryKey:["vaults"]})})}function Vq(){const e=hn();return Nn({mutationFn:({vaultId:t,key:n,value:r})=>Xe(\`/vaults/\${t}/entries/\${n}\`,{method:"PUT",body:JSON.stringify({value:r})}),onSuccess:(t,n)=>e.invalidateQueries({queryKey:["vaults",n.vaultId,"entries"]})})}function _ye(){const e=hn();return Nn({mutationFn:({vaultId:t,key:n})=>Xe(\`/vaults/\${t}/entries/\${n}\`,{method:"DELETE"}),onSuccess:(t,n)=>e.invalidateQueries({queryKey:["vaults",n.vaultId,"entries"]})})}function kye(e){const t=typeof e=="string"?new Date(e).getTime():e,n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return\`\${r}m ago\`;const i=Math.floor(r/60);return i<24?\`\${i}h ago\`:\`\${Math.floor(i/24)}d ago\`}function Oye(){const{data:e}=xA(),t=Cye(),[n,r]=x.useState(null),[i,o]=x.useState(!1),[a,l]=x.useState(null);return m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsx(Sc,{title:"Credential vaults",description:"Manage credential vaults that provide agents with access to APIs and services.",actionLabel:"New vault",onAction:()=>o(!0)}),e&&e.length>0?m.jsx("div",{className:"rounded-lg border border-border",children:m.jsxs(eo,{children:[m.jsx(Jo,{children:m.jsxs(yn,{children:[m.jsx(et,{className:"w-8"}),m.jsx(et,{className:"w-[140px]",children:"ID"}),m.jsx(et,{children:"Name"}),m.jsx(et,{children:"Status"}),m.jsx(et,{children:"Entries"}),m.jsx(et,{children:"Created"}),m.jsx(et,{className:"w-[50px]"})]})}),m.jsx(to,{children:e.map(u=>m.jsx(Tye,{vault:u,expanded:n===u.id,onToggle:()=>r(n===u.id?null:u.id),onDelete:()=>l({id:u.id,name:u.name})},u.id))})]})}):m.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No vaults yet. Create one to store API keys and credentials."}),m.jsx(jye,{open:i,onOpenChange:o}),m.jsx(xh,{open:!!a,onOpenChange:u=>!u&&l(null),children:m.jsxs(bh,{children:[m.jsxs(wh,{children:[m.jsxs(Eh,{children:['Delete vault "',a?.name,'"?']}),m.jsx(Ch,{children:"This will permanently delete the vault and all its entries. This action cannot be undone."})]}),m.jsxs(Sh,{children:[m.jsx(kh,{children:"Cancel"}),m.jsx(_h,{variant:"destructive",onClick:()=>{a&&t.mutate(a.id),l(null)},children:"Delete"})]})]})})]})}function jye({open:e,onOpenChange:t}){const n=qq(),{data:r}=Hs(),[i,o]=x.useState(""),[a,l]=x.useState("");async function u(){if(!(!i.trim()||!a))try{await n.mutateAsync({name:i.trim(),agent_id:a}),o(""),l(""),qe.success("Vault created"),t(!1)}catch(f){const d=f?.body?.error?.message||(f instanceof Error?f.message:"Failed to create vault");qe.error(d)}}return m.jsx(ea,{open:e,onOpenChange:t,children:m.jsxs(za,{children:[m.jsx(Fa,{children:m.jsx(Ba,{children:"New vault"})}),m.jsxs("div",{className:"flex flex-col gap-4 pt-2",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Name"}),m.jsx(en,{placeholder:"default",value:i,onChange:f=>o(f.target.value),className:"w-full text-foreground"})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Agent"}),m.jsxs(To,{value:a,onValueChange:f=>{f&&l(f)},children:[m.jsx(Ao,{className:"w-full text-foreground",children:m.jsx(Oh,{placeholder:"Select an agent"})}),m.jsx(No,{children:r?.map(f=>m.jsx(ai,{value:f.id,children:f.name},f.id))})]})]}),m.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[m.jsx(Fe,{variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),m.jsx(Fe,{className:"bg-cta-gradient text-black hover:opacity-90",onClick:u,disabled:!i.trim()||!a||n.isPending,children:"Create"})]})]})]})})}function Tye({vault:e,expanded:t,onToggle:n,onDelete:r}){return m.jsxs(m.Fragment,{children:[m.jsxs(yn,{className:"cursor-pointer",onClick:n,children:[m.jsx(Ue,{children:m.jsx(ew,{className:Ne("size-3.5 text-muted-foreground transition-transform",t&&"rotate-90")})}),m.jsxs(Ue,{className:"font-mono text-xs text-muted-foreground",children:[e.id.slice(0,16),"..."]}),m.jsx(Ue,{className:"font-medium text-foreground",children:e.name}),m.jsx(Ue,{children:m.jsx(an,{variant:"outline",className:"border-lime-400/20 bg-lime-400/10 text-lime-400 text-xs",children:"Active"})}),m.jsx(Ue,{className:"text-muted-foreground",children:e.entry_count}),m.jsx(Ue,{className:"text-muted-foreground",children:kye(e.created_at)}),m.jsx(Ue,{children:m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-red-400/40 hover:text-red-400",onClick:i=>{i.stopPropagation(),r()},children:m.jsx(Mi,{className:"size-3.5"})})})]}),t&&m.jsx(yn,{children:m.jsx(Ue,{colSpan:7,className:"bg-muted/50 p-4",children:m.jsx(Aye,{vaultId:e.id})})})]})}function Aye({vaultId:e}){const{data:t}=Eye(e),n=Vq(),r=_ye(),[i,o]=x.useState(""),[a,l]=x.useState("");async function u(){!i.trim()||!a.trim()||(await n.mutateAsync({vaultId:e,key:i.trim(),value:a.trim()}),o(""),l(""),qe.success("Entry added"))}return m.jsxs("div",{className:"flex flex-col gap-2",children:[t?.map(f=>m.jsxs("div",{className:"flex items-center gap-3 rounded-md bg-background px-3 py-2",children:[m.jsx("span",{className:"font-mono text-xs text-lime-400/60",children:f.key}),m.jsxs("span",{className:"flex-1 truncate font-mono text-xs text-muted-foreground",children:[f.value.slice(0,8),"...",f.value.slice(-4)]}),m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-6 text-red-400/30 hover:text-red-400",onClick:()=>r.mutate({vaultId:e,key:f.key}),children:m.jsx(Mi,{className:"size-3"})})]},f.key)),m.jsxs("div",{className:"flex gap-2",children:[m.jsx(en,{placeholder:"Key",value:i,onChange:f=>o(f.target.value),className:"h-8 w-full font-mono text-xs text-foreground"}),m.jsx(en,{placeholder:"Value",type:"password",value:a,onChange:f=>l(f.target.value),className:"h-8 w-full font-mono text-xs text-foreground"}),m.jsx(Fe,{size:"icon",className:"size-8 shrink-0 bg-cta-gradient text-black hover:opacity-90",onClick:u,children:m.jsx(bc,{className:"size-3"})})]})]})}function Nye(e){const t="/files?limit=100";return Bn({queryKey:["files","all"],queryFn:()=>Xe(t),select:n=>n.data})}function Rye(){const e=hn();return Nn({mutationFn:async t=>{const n=new FormData;n.append("file",t);const r=bn.getState().apiKey,i=await fetch("/v1/files",{method:"POST",headers:{"x-api-key":r},body:n});if(!i.ok){const o=await i.json().catch(()=>({error:{message:"Upload failed"}}));throw new Error(o.error?.message||\`Upload failed (\${i.status})\`)}return i.json()},onSuccess:()=>e.invalidateQueries({queryKey:["files"]})})}function Pye(){const e=hn();return Nn({mutationFn:t=>Xe(\`/files/\${t}\`,{method:"DELETE"}),onSuccess:()=>e.invalidateQueries({queryKey:["files"]})})}async function Mye(e,t){const n=bn.getState().apiKey,r=await fetch(\`/v1/files/\${e}/content\`,{headers:{"x-api-key":n}});if(!r.ok)throw new Error("Download failed");const i=await r.blob(),o=URL.createObjectURL(i),a=document.createElement("a");a.href=o,a.download=t,a.click(),URL.revokeObjectURL(o)}function Iye(){return Bn({queryKey:["saved-repositories"],queryFn:async()=>{const e=await Xe("/settings/saved_repositories");if(!e.value)return[];try{return JSON.parse(e.value)}catch{return[]}}})}function Dye(){const e=hn();return Nn({mutationFn:async t=>{await Xe("/settings",{method:"PUT",body:JSON.stringify({key:"saved_repositories",value:JSON.stringify(t)})})},onSuccess:()=>e.invalidateQueries({queryKey:["saved-repositories"]})})}function wO(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return\`\${n}m ago\`;const r=Math.floor(n/60);return r<24?\`\${r}h ago\`:\`\${Math.floor(r/24)}d ago\`}function Mz(e){return e>=1024*1024?\`\${(e/(1024*1024)).toFixed(1)} MB\`:e>=1024?\`\${(e/1024).toFixed(1)} KB\`:\`\${e} B\`}function Lye(){const{data:e}=Nye(),{data:t}=hw(),n=Rye(),r=Pye(),i=x.useRef(null),[o,a]=x.useState(null),l=new Map;t?.forEach(v=>{l.set(v.id,{title:v.title??v.id.slice(0,20),agent:v.agent?.id?.slice(0,16)??""})});const u=new Map,f=[];e?.forEach(v=>{if(v.scope?.id){const b=u.get(v.scope.id)??[];b.push(v),u.set(v.scope.id,b)}else f.push(v)});async function d(v){const b=v.target.files?.[0];if(b)try{await n.mutateAsync(b),qe.success(\`"\${b.name}" uploaded\`)}catch(w){qe.error(w instanceof Error?w.message:"Upload failed")}finally{i.current&&(i.current.value="")}}async function h(v,b){try{await Mye(v,b)}catch{qe.error("Download failed")}}const g=e?.length??0;return m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsx(Sc,{title:"Files",description:\`\${g} file\${g!==1?"s":""} across \${u.size} session\${u.size!==1?"s":""}\`,actionLabel:"Upload file",onAction:()=>i.current?.click()}),m.jsx("input",{ref:i,type:"file",className:"hidden",onChange:d}),g===0?m.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border border-dashed border-border py-12 text-center",children:[m.jsx(pb,{className:"size-8 text-muted-foreground/40"}),m.jsx("p",{className:"text-sm text-muted-foreground",children:"No files yet"}),m.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Files created by agents during sessions will appear here"})]}):m.jsxs("div",{className:"flex flex-col gap-6",children:[Array.from(u.entries()).map(([v,b])=>{const w=l.get(v);return m.jsxs("div",{className:"rounded-lg border border-border",children:[m.jsxs("div",{className:"flex items-center gap-2 border-b border-border bg-muted/30 px-4 py-2",children:[m.jsx(BT,{className:"size-3.5 text-muted-foreground"}),m.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:w?.title??v.slice(0,24)}),m.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:[v.slice(0,20),"..."]}),m.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[b.length," file",b.length!==1?"s":""]})]}),m.jsx(eo,{children:m.jsx(to,{children:b.map(S=>m.jsxs(yn,{children:[m.jsx(Ue,{className:"font-medium text-foreground",children:S.filename}),m.jsx(Ue,{className:"text-muted-foreground text-xs",children:Mz(S.size_bytes)}),m.jsx(Ue,{className:"font-mono text-[10px] text-muted-foreground",children:S.mime_type}),m.jsx(Ue,{className:"text-xs text-muted-foreground",children:wO(S.created_at)}),m.jsx(Ue,{className:"w-[80px]",children:m.jsxs("div",{className:"flex items-center gap-1",children:[S.downloadable&&m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground hover:text-foreground",onClick:()=>h(S.id,S.filename),children:m.jsx(Yd,{className:"size-3.5"})}),m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-red-400/40 hover:text-red-400",onClick:()=>a({id:S.id,filename:S.filename}),children:m.jsx(Mi,{className:"size-3.5"})})]})})]},S.id))})})]},v)}),f.length>0&&m.jsxs("div",{className:"rounded-lg border border-border",children:[m.jsxs("div",{className:"flex items-center gap-2 border-b border-border bg-muted/30 px-4 py-2",children:[m.jsx(pb,{className:"size-3.5 text-muted-foreground"}),m.jsx("span",{className:"text-xs font-medium text-foreground",children:"Uploaded (no session)"}),m.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[f.length," file",f.length!==1?"s":""]})]}),m.jsx(eo,{children:m.jsx(to,{children:f.map(v=>m.jsxs(yn,{children:[m.jsx(Ue,{className:"font-medium text-foreground",children:v.filename}),m.jsx(Ue,{className:"text-muted-foreground text-xs",children:Mz(v.size_bytes)}),m.jsx(Ue,{className:"font-mono text-[10px] text-muted-foreground",children:v.mime_type}),m.jsx(Ue,{className:"text-xs text-muted-foreground",children:wO(v.created_at)}),m.jsx(Ue,{className:"w-[80px]",children:m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground hover:text-foreground",onClick:()=>h(v.id,v.filename),children:m.jsx(Yd,{className:"size-3.5"})}),m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-red-400/40 hover:text-red-400",onClick:()=>a({id:v.id,filename:v.filename}),children:m.jsx(Mi,{className:"size-3.5"})})]})})]},v.id))})})]})]}),m.jsx(xh,{open:!!o,onOpenChange:v=>!v&&a(null),children:m.jsxs(bh,{children:[m.jsxs(wh,{children:[m.jsxs(Eh,{children:['Delete "',o?.filename,'"?']}),m.jsx(Ch,{children:"This will permanently delete the file."})]}),m.jsxs(Sh,{children:[m.jsx(kh,{children:"Cancel"}),m.jsx(_h,{variant:"destructive",onClick:()=>{o&&r.mutate(o.id,{onSuccess:()=>qe.success("File deleted"),onError:()=>qe.error("Failed to delete")}),a(null)},children:"Delete"})]})]})})]})}function zye(){const{data:e}=Iye(),t=Dye(),[n,r]=x.useState(!1),[i,o]=x.useState(""),[a,l]=x.useState("main");async function u(){if(!i.trim())return;const d=e??[],h={url:i.trim(),branch:a.trim()||"main",added_at:new Date().toISOString()};try{await t.mutateAsync([...d,h]),qe.success("Repository saved"),o(""),l("main"),r(!1)}catch{qe.error("Failed to save repository")}}async function f(d){const h=e??[];try{await t.mutateAsync(h.filter(g=>g.url!==d)),qe.success("Repository removed")}catch{qe.error("Failed to remove repository")}}return m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsx(Sc,{title:"Repositories",description:"Save repository URLs for agents to clone during sessions.",actionLabel:"Add repository",onAction:()=>r(!0)}),e&&e.length>0?m.jsx("div",{className:"rounded-lg border border-border",children:m.jsxs(eo,{children:[m.jsx(Jo,{children:m.jsxs(yn,{children:[m.jsx(et,{children:"URL"}),m.jsx(et,{children:"Branch"}),m.jsx(et,{children:"Added"}),m.jsx(et,{className:"w-[50px]"})]})}),m.jsx(to,{children:e.map(d=>m.jsxs(yn,{children:[m.jsx(Ue,{className:"font-mono text-xs text-foreground",children:d.url}),m.jsx(Ue,{children:m.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[m.jsx(KL,{className:"size-3"}),d.branch]})}),m.jsx(Ue,{className:"text-sm text-muted-foreground",children:wO(d.added_at)}),m.jsx(Ue,{children:m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-red-400/40 hover:text-red-400",onClick:()=>f(d.url),children:m.jsx(Mi,{className:"size-3.5"})})})]},d.url))})]})}):m.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border border-dashed border-border py-12 text-center",children:[m.jsx(KL,{className:"size-8 text-muted-foreground/40"}),m.jsx("p",{className:"text-sm text-muted-foreground",children:"No repositories saved yet"})]}),m.jsx(ea,{open:n,onOpenChange:r,children:m.jsxs(za,{children:[m.jsx(Fa,{children:m.jsx(Ba,{className:"text-foreground",children:"Add repository"})}),m.jsxs("div",{className:"flex flex-col gap-4 pt-2",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Repository URL"}),m.jsx(en,{placeholder:"https://github.com/org/repo",value:i,onChange:d=>o(d.target.value),className:"w-full text-foreground",onKeyDown:d=>d.key==="Enter"&&u()})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Branch"}),m.jsx(en,{placeholder:"main",value:a,onChange:d=>l(d.target.value),className:"w-full text-foreground",onKeyDown:d=>d.key==="Enter"&&u()})]}),m.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[m.jsx(Fe,{variant:"ghost",onClick:()=>r(!1),children:"Cancel"}),m.jsx(Fe,{className:"bg-cta-gradient text-black hover:opacity-90",onClick:u,disabled:!i.trim()||t.isPending,children:"Add"})]})]})]})})]})}function Fye(){return Bn({queryKey:["memory-stores"],queryFn:()=>Xe("/memory_stores?limit=50"),select:e=>e.data})}function Bye(){const e=hn();return Nn({mutationFn:t=>Xe("/memory_stores",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>e.invalidateQueries({queryKey:["memory-stores"]})})}function $ye(){const e=hn();return Nn({mutationFn:t=>Xe(\`/memory_stores/\${t}\`,{method:"DELETE"}),onSuccess:()=>e.invalidateQueries({queryKey:["memory-stores"]})})}function Uye(e){return Bn({queryKey:["memory-stores",e,"memories"],queryFn:()=>Xe(\`/memory_stores/\${e}/memories?limit=100\`),enabled:!!e,select:t=>t.data})}function Hye(){const e=hn();return Nn({mutationFn:({storeId:t,path:n,content:r})=>Xe(\`/memory_stores/\${t}/memories\`,{method:"POST",body:JSON.stringify({path:n,content:r})}),onSuccess:(t,n)=>e.invalidateQueries({queryKey:["memory-stores",n.storeId,"memories"]})})}function qye(){const e=hn();return Nn({mutationFn:({storeId:t,memoryId:n})=>Xe(\`/memory_stores/\${t}/memories/\${n}\`,{method:"DELETE"}),onSuccess:(t,n)=>e.invalidateQueries({queryKey:["memory-stores",n.storeId,"memories"]})})}function Vye(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return\`\${n}m ago\`;const r=Math.floor(n/60);return r<24?\`\${r}h ago\`:\`\${Math.floor(r/24)}d ago\`}function Kye(){const{data:e}=Fye(),t=$ye(),[n,r]=x.useState(!1),[i,o]=x.useState(null);return m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsx(Sc,{title:"Memory stores",description:"Persistent key-value stores for agent memory.",actionLabel:"New store",onAction:()=>r(!0)}),e&&e.length>0?m.jsx("div",{className:"rounded-lg border border-border",children:m.jsxs(eo,{children:[m.jsx(Jo,{children:m.jsxs(yn,{children:[m.jsx(et,{className:"w-8"}),m.jsx(et,{className:"w-[160px]",children:"ID"}),m.jsx(et,{children:"Name"}),m.jsx(et,{children:"Description"}),m.jsx(et,{children:"Created"}),m.jsx(et,{className:"w-[50px]"})]})}),m.jsx(to,{children:e.map(a=>m.jsxs(m.Fragment,{children:[m.jsxs(yn,{className:"cursor-pointer",onClick:()=>o(i===a.id?null:a.id),children:[m.jsx(Ue,{children:m.jsx(ew,{className:Ne("size-3.5 text-muted-foreground transition-transform",i===a.id&&"rotate-90")})}),m.jsxs(Ue,{className:"font-mono text-xs text-muted-foreground",children:[a.id.slice(0,18),"..."]}),m.jsx(Ue,{className:"font-medium text-foreground",children:a.name}),m.jsx(Ue,{className:"text-muted-foreground",children:a.description||"\u2014"}),m.jsx(Ue,{className:"text-sm text-muted-foreground",children:Vye(a.created_at)}),m.jsx(Ue,{children:m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-red-400/40 hover:text-red-400",onClick:l=>{l.stopPropagation(),t.mutate(a.id)},children:m.jsx(Mi,{className:"size-3.5"})})})]},a.id),i===a.id&&m.jsx(yn,{children:m.jsx(Ue,{colSpan:6,className:"bg-muted/50 p-4",children:m.jsx(Wye,{storeId:a.id})})},\`\${a.id}-memories\`)]}))})]})}):m.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No memory stores yet."}),m.jsx(Yye,{open:n,onOpenChange:r})]})}function Yye({open:e,onOpenChange:t}){const n=Bye(),[r,i]=x.useState(""),[o,a]=x.useState("");async function l(){r.trim()&&(await n.mutateAsync({name:r.trim(),description:o.trim()||void 0}),i(""),a(""),qe.success("Memory store created"),t(!1))}return m.jsx(ea,{open:e,onOpenChange:t,children:m.jsxs(za,{children:[m.jsx(Fa,{children:m.jsx(Ba,{className:"text-foreground",children:"New memory store"})}),m.jsxs("div",{className:"flex flex-col gap-4 pt-2",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Name"}),m.jsx(en,{placeholder:"my-store",value:r,onChange:u=>i(u.target.value),className:"w-full"})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Description"}),m.jsx(en,{placeholder:"Optional description",value:o,onChange:u=>a(u.target.value),className:"w-full"})]}),m.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[m.jsx(Fe,{variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),m.jsx(Fe,{className:"bg-cta-gradient text-black hover:opacity-90",onClick:l,disabled:!r.trim()||n.isPending,children:"Create"})]})]})]})})}function Wye({storeId:e}){const{data:t}=Uye(e),n=Hye(),r=qye(),[i,o]=x.useState(""),[a,l]=x.useState("");async function u(){!i.trim()||!a.trim()||(await n.mutateAsync({storeId:e,path:i.trim(),content:a.trim()}),o(""),l(""),qe.success("Memory created"))}return m.jsxs("div",{className:"flex flex-col gap-2",children:[t?.map(f=>m.jsxs("div",{className:"flex items-start gap-3 rounded-md bg-background px-3 py-2",children:[m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("p",{className:"font-mono text-xs text-lime-400/60",children:f.path}),m.jsxs("p",{className:"mt-1 text-xs text-muted-foreground whitespace-pre-wrap break-all",children:[f.content.slice(0,200),f.content.length>200?"...":""]})]}),m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-6 shrink-0 text-red-400/30 hover:text-red-400",onClick:()=>r.mutate({storeId:e,memoryId:f.id}),children:m.jsx(Mi,{className:"size-3"})})]},f.id)),m.jsxs("div",{className:"flex flex-col gap-2 pt-1",children:[m.jsx(en,{placeholder:"Path (e.g. notes/todo)",value:i,onChange:f=>o(f.target.value),className:"h-8 w-full font-mono text-xs"}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx(xw,{placeholder:"Content",value:a,onChange:f=>l(f.target.value),className:"min-h-[60px] w-full text-xs",rows:2}),m.jsx(Fe,{size:"icon",className:"size-8 shrink-0 self-end bg-cta-gradient text-black hover:opacity-90",onClick:u,children:m.jsx(bc,{className:"size-3"})})]})]})]})}function Gye(){return Bn({queryKey:["tenants"],queryFn:async()=>{try{return(await Xe("/tenants")).data}catch(e){const t=e?.status;if(t===403||t===404)return[];throw e}},staleTime:3e4})}function Xye(){const e=hn();return Nn({mutationFn:t=>Xe("/tenants",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>e.invalidateQueries({queryKey:["tenants"]})})}function Qye(){const e=hn();return Nn({mutationFn:({id:t,name:n})=>Xe(\`/tenants/\${t}\`,{method:"PATCH",body:JSON.stringify({name:n})}),onSuccess:()=>e.invalidateQueries({queryKey:["tenants"]})})}function Zye(){const e=hn();return Nn({mutationFn:t=>Xe(\`/tenants/\${t}\`,{method:"DELETE"}),onSuccess:()=>e.invalidateQueries({queryKey:["tenants"]})})}function Jye(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return\`\${n}m ago\`;const r=Math.floor(n/60);return r<24?\`\${r}h ago\`:\`\${Math.floor(r/24)}d ago\`}function exe(){const{data:e,isLoading:t,error:n}=Gye(),[r,i]=x.useState(!1),[o,a]=x.useState(null),l=n?.status,u=!t&&n!=null,f=l===401;return m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsx(Sc,{title:"Tenants",description:"Isolation boundary for agents, environments, vaults, sessions, and API keys. Only global admins can manage tenants.",actionLabel:e&&!u?"New tenant":void 0,onAction:()=>i(!0)}),u&&m.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border bg-card p-4",children:[m.jsx(t8,{className:"mt-0.5 size-4 text-muted-foreground"}),f?m.jsxs("p",{className:"text-sm text-muted-foreground",children:["Your API key isn't valid. Check the ",m.jsx("code",{className:"font-mono text-xs",children:"x-api-key"}),"value (or the one stored in this browser via ",m.jsx("code",{className:"font-mono text-xs",children:"localStorage.ma-api-key"}),") matches a row in the ",m.jsx("code",{className:"font-mono text-xs",children:"api_keys"})," table. A common cause is more than one ",m.jsx("code",{className:"font-mono text-xs",children:"SEED_API_KEY"})," line in ",m.jsx("code",{className:"font-mono text-xs",children:".env"})," \u2014 only the last one takes effect in ",m.jsx("code",{className:"font-mono text-xs",children:"process.env"}),", but only the first was actually seeded."]}):m.jsx("p",{className:"text-sm text-muted-foreground",children:"Tenant management requires a global admin API key. Your key is scoped to a tenant and can manage only resources within it."})]}),e&&e.length>0?m.jsx("div",{className:"rounded-lg border border-border",children:m.jsxs(eo,{children:[m.jsx(Jo,{children:m.jsxs(yn,{children:[m.jsx(et,{className:"w-[220px]",children:"ID"}),m.jsx(et,{children:"Name"}),m.jsx(et,{children:"Status"}),m.jsx(et,{children:"Created"}),m.jsx(et,{className:"w-[120px] text-right",children:"Actions"})]})}),m.jsx(to,{children:e.map(d=>m.jsx(txe,{tenant:d,onArchive:()=>a(d)},d.id))})]})}):!u&&!t?m.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No tenants yet. Create one to start isolating resources per team."}):null,m.jsx(nxe,{open:r,onOpenChange:i}),m.jsx(xh,{open:!!o,onOpenChange:d=>!d&&a(null),children:m.jsxs(bh,{children:[m.jsxs(wh,{children:[m.jsxs(Eh,{children:['Archive tenant "',o?.name,'"?']}),m.jsx(Ch,{children:"The tenant's existing resources (agents, environments, sessions, vaults, keys) stay in place but no new resources can be created under it. This action cannot be undone through the UI."})]}),m.jsxs(Sh,{children:[m.jsx(kh,{children:"Cancel"}),m.jsx(rxe,{tenant:o,onDone:()=>a(null)})]})]})})]})}function txe({tenant:e,onArchive:t}){const[n,r]=x.useState(!1),[i,o]=x.useState(e.name),a=Qye(),l=e.id==="tenant_default",u=!!e.archived_at;async function f(){if(!i.trim()||i===e.name){r(!1),o(e.name);return}try{await a.mutateAsync({id:e.id,name:i.trim()}),qe.success("Renamed"),r(!1)}catch(d){qe.error(d.message),o(e.name)}}return m.jsxs(yn,{children:[m.jsx(Ue,{children:m.jsx("code",{className:"text-xs text-muted-foreground",children:e.id})}),m.jsx(Ue,{children:n?m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx(en,{autoFocus:!0,value:i,onChange:d=>o(d.target.value),onKeyDown:d=>{d.key==="Enter"&&f(),d.key==="Escape"&&(r(!1),o(e.name))},className:"h-8 text-sm"}),m.jsx(Fe,{variant:"ghost",size:"icon",onClick:f,children:m.jsx(Aa,{className:"size-4"})}),m.jsx(Fe,{variant:"ghost",size:"icon",onClick:()=>{r(!1),o(e.name)},children:m.jsx(uc,{className:"size-4"})})]}):m.jsx("span",{className:"text-sm text-foreground",children:e.name})}),m.jsx(Ue,{children:u?m.jsx(an,{variant:"outline",className:"text-muted-foreground",children:"archived"}):l?m.jsx(an,{variant:"secondary",children:"default"}):m.jsx(an,{variant:"outline",className:"text-lime-500 border-lime-500/40",children:"active"})}),m.jsx(Ue,{className:"text-xs text-muted-foreground",children:Jye(e.created_at)}),m.jsx(Ue,{className:"text-right",children:!u&&m.jsxs("div",{className:"inline-flex gap-1",children:[m.jsx(Fe,{variant:"ghost",size:"icon",onClick:()=>r(!0),title:"Rename",children:m.jsx(r8,{className:"size-4"})}),!l&&m.jsx(Fe,{variant:"ghost",size:"icon",onClick:t,title:"Archive",children:m.jsx(eue,{className:"size-4 text-destructive"})})]})})]})}function nxe({open:e,onOpenChange:t}){const[n,r]=x.useState(""),[i,o]=x.useState(""),a=Xye();async function l(){if(n.trim())try{await a.mutateAsync({name:n.trim(),id:i.trim()||void 0}),qe.success("Tenant created"),r(""),o(""),t(!1)}catch(u){qe.error(u.message)}}return m.jsx(ea,{open:e,onOpenChange:t,children:m.jsxs(za,{children:[m.jsx(Fa,{children:m.jsx(Ba,{children:"New tenant"})}),m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsxs("div",{children:[m.jsx(wt,{htmlFor:"tenant-name",children:"Name"}),m.jsx(en,{id:"tenant-name",value:n,onChange:u=>r(u.target.value),placeholder:"acme",autoFocus:!0})]}),m.jsxs("div",{children:[m.jsxs(wt,{htmlFor:"tenant-id",children:["ID ",m.jsxs("span",{className:"text-muted-foreground",children:["(optional, must start with ",m.jsx("code",{className:"text-xs",children:"tenant_"}),")"]})]}),m.jsx(en,{id:"tenant-id",value:i,onChange:u=>o(u.target.value),placeholder:"tenant_acme"})]})]}),m.jsxs(mb,{children:[m.jsx(Fe,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),m.jsx(Fe,{onClick:l,disabled:!n.trim()||a.isPending,children:a.isPending?"Creating\u2026":"Create"})]})]})})}function rxe({tenant:e,onDone:t}){const n=Zye();async function r(){if(e)try{await n.mutateAsync(e.id),qe.success("Archived"),t()}catch(i){qe.error(i.message)}}return m.jsx(_h,{onClick:r,disabled:n.isPending,children:n.isPending?"Archiving\u2026":"Archive"})}function Kq(e){const{windowMs:t,groupBy:n="agent"}=e;return Bn({queryKey:["metrics","agent",t,n],queryFn:()=>{const r=Date.now(),i=r-t;return Xe(\`/metrics?group_by=\${n}&from=\${i}&to=\${r}\`)},refetchInterval:15e3})}function Yq(e){const{windowMinutes:t}=e;return Bn({queryKey:["metrics","api",t],queryFn:()=>Xe(\`/metrics/api?window_minutes=\${t}\`),refetchInterval:5e3})}function Wq({data:e,height:t=48,className:n,errors:r}){if(e.length===0)return m.jsx("div",{className:\`flex items-center justify-center text-xs text-muted-foreground/40 \${n??""}\`,style:{height:t},children:"no data"});const i=400,o=Math.max(...e,1),a=i/Math.max(e.length-1,1),l=e.map((d,h)=>\`\${(h*a).toFixed(1)},\${(t-d/o*(t-4)-2).toFixed(1)}\`).join(" "),u=\`M 0,\${t} L \${l} L \${i},\${t} Z\`,f=r?.map((d,h)=>{if(d===0)return null;const g=h*a,v=Math.max(2,d/o*(t-4));return m.jsx("rect",{x:g-1,y:t-v,width:2,height:v,fill:"currentColor",className:"text-destructive/70"},h)})??null;return m.jsxs("svg",{viewBox:\`0 0 \${i} \${t}\`,preserveAspectRatio:"none",className:\`w-full text-foreground \${n??""}\`,style:{height:t},children:[m.jsx("path",{d:u,className:"fill-primary/10"}),m.jsx("polyline",{points:l,fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-primary"}),f]})}function wb({data:e,limit:t=8,formatValue:n=r=>r.toLocaleString()}){if(e.length===0)return m.jsx("p",{className:"text-xs text-muted-foreground/50 italic",children:"no data"});const r=Math.max(...e.map(a=>a.value),1),i=e.slice(0,t),o=e.length-i.length;return m.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.map(a=>{const l=a.value/r*100;return m.jsxs("div",{className:"relative flex items-center text-xs",children:[m.jsx("div",{className:\`absolute inset-y-0 left-0 rounded-sm \${a.color??"bg-primary/10"}\`,style:{width:\`\${l}%\`}}),m.jsxs("div",{className:"relative z-10 flex w-full items-center justify-between gap-2 px-2 py-1",children:[m.jsx("span",{className:"truncate font-mono text-[11px] text-foreground",children:a.label}),m.jsxs("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:[n(a.value),a.subtitle&&m.jsx("span",{className:"ml-1.5 text-muted-foreground/60",children:a.subtitle})]})]})]},a.label)}),o>0&&m.jsxs("p",{className:"text-[11px] text-muted-foreground/50 px-2",children:["+ ",o," more"]})]})}function Ir({label:e,value:t,loading:n,tone:r="neutral",info:i}){const o=t===0||t==="0"||t==="\u2014";let a="text-foreground";return o||(r==="warn"?a="text-amber-500":r==="danger"?a="text-red-500":r==="accent"&&(a="text-lime-400")),m.jsx(fi,{size:"sm",className:"h-full",children:m.jsxs(Lr,{className:"flex h-full flex-col",children:[m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("p",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:e}),i&&m.jsxs(IT,{children:[m.jsx(DT,{render:l=>m.jsx("button",{...l,type:"button","aria-label":\`About \${e}\`,className:"text-muted-foreground/50 hover:text-muted-foreground transition-colors"}),children:m.jsx($T,{className:"size-3"})}),m.jsx(LT,{children:i})]})]}),m.jsx("p",{className:\`mt-auto pt-1 font-mono text-lg tabular-nums \${a} \${n?"opacity-40":""}\`,children:typeof t=="number"?t.toLocaleString():t})]})})}function SO(e){return e===0?"$0.00":e<.01?\`$\${e.toFixed(4)}\`:e<1?\`$\${e.toFixed(3)}\`:\`$\${e.toFixed(2)}\`}function EC({label:e,value:t}){return m.jsx(fi,{size:"sm",children:m.jsxs(Lr,{className:"text-center",children:[m.jsx("p",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:e}),m.jsxs("p",{className:"mt-1 font-mono text-2xl tabular-nums text-foreground",children:[t!=null?\`\${Math.round(t)}\`:"\u2014",t!=null&&m.jsx("span",{className:"ml-1 text-sm font-normal text-muted-foreground",children:"ms"})]})]})})}function ixe(e){switch(e){case"end_turn":return"bg-emerald-500/15";case"error":return"bg-red-500/15";case"interrupted":return"bg-amber-500/15";case"custom_tool_call":return"bg-sky-500/15";default:return"bg-primary/10"}}function oxe({windowMinutes:e}){const{data:t}=Hs(),n=Kq({windowMs:e*6e4,groupBy:"agent"}),r=i=>t?.find(o=>o.id===i)?.name??i.slice(0,16)+"\u2026";return m.jsxs("div",{children:[m.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-3 md:grid-cols-4",children:[m.jsx(Ir,{label:"Sessions",value:n.data?.totals.session_count??0,loading:n.isLoading}),m.jsx(Ir,{label:"Turns",value:n.data?.totals.turn_count??0,loading:n.isLoading}),m.jsx(Ir,{label:"Tool calls",value:n.data?.totals.tool_call_count??0,loading:n.isLoading}),m.jsx(Ir,{label:"Errors",value:n.data?.totals.error_count??0,loading:n.isLoading,tone:n.data&&n.data.totals.error_count>0?"warn":"neutral"}),m.jsx(Ir,{label:"Cost",value:SO(n.data?.totals.cost_usd??0),loading:n.isLoading}),m.jsx(Ir,{label:"Input tokens",value:n.data?.totals.input_tokens??0,loading:n.isLoading}),m.jsx(Ir,{label:"Output tokens",value:n.data?.totals.output_tokens??0,loading:n.isLoading}),m.jsx(Ir,{label:"Cache read",value:n.data?.totals.cache_read_input_tokens??0,loading:n.isLoading})]}),m.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[m.jsxs(fi,{children:[m.jsx(_s,{children:m.jsx(ks,{className:"text-sm",children:"Stop reasons"})}),m.jsx(Lr,{children:m.jsx(wb,{data:n.data?Object.entries(n.data.stop_reasons).map(([i,o])=>({label:i,value:o,color:ixe(i)})):[]})})]}),m.jsxs(fi,{children:[m.jsx(_s,{children:m.jsx(ks,{className:"text-sm",children:"Cost by agent"})}),m.jsx(Lr,{children:m.jsx(wb,{data:n.data?.groups.filter(i=>i.cost_usd>0).map(i=>({label:r(i.key),value:i.cost_usd,subtitle:\`\${i.turn_count}t\`}))??[],formatValue:SO})})]}),m.jsxs(fi,{className:"md:col-span-2",children:[m.jsx(_s,{children:m.jsxs(ks,{className:"text-sm",children:["Tool-call latency",m.jsxs("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:["(p50/p95/p99 over ",n.data?.tool_call_sample_count??0," samples)"]})]})}),m.jsx(Lr,{children:m.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[m.jsx(EC,{label:"p50",value:n.data?.tool_latency_p50_ms??null}),m.jsx(EC,{label:"p95",value:n.data?.tool_latency_p95_ms??null}),m.jsx(EC,{label:"p99",value:n.data?.tool_latency_p99_ms??null})]})})]})]})]})}function axe(e){return e==null?"":new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function sxe({windowMinutes:e}){const t=Math.min(e,60),n=Yq({windowMinutes:t});return m.jsxs("div",{children:[m.jsx("div",{className:"mb-3 flex items-center justify-end",children:m.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["last ",t," min \xB7 in-process"]})}),m.jsxs("div",{className:"mb-4 grid grid-cols-2 gap-3 md:grid-cols-5",children:[m.jsx(Ir,{label:"Requests",value:n.data?.totals.count??0,loading:n.isLoading}),m.jsx(Ir,{label:"Req / sec",value:(n.data?.totals.rps??0).toFixed(2),loading:n.isLoading}),m.jsx(Ir,{label:"p50",value:n.data?.totals.p50_ms!=null?\`\${Math.round(n.data.totals.p50_ms)} ms\`:"\u2014",loading:n.isLoading}),m.jsx(Ir,{label:"p95",value:n.data?.totals.p95_ms!=null?\`\${Math.round(n.data.totals.p95_ms)} ms\`:"\u2014",loading:n.isLoading}),m.jsx(Ir,{label:"Error rate",value:\`\${((n.data?.totals.error_rate??0)*100).toFixed(1)}%\`,loading:n.isLoading,tone:n.data&&n.data.totals.error_rate>.01?"warn":"neutral"})]}),m.jsxs(fi,{className:"mb-4",children:[m.jsx(_s,{children:m.jsx(ks,{className:"text-sm",children:"Requests per minute"})}),m.jsxs(Lr,{children:[m.jsx(Wq,{data:n.data?.timeline.map(r=>r.count)??[],errors:n.data?.timeline.map(r=>r.error_count)??[],height:96}),m.jsxs("div",{className:"mt-2 flex items-center justify-between text-[11px] text-muted-foreground",children:[m.jsx("span",{children:axe(n.data?.timeline[0]?.minute_ms)}),m.jsx("span",{children:"now"})]})]})]}),m.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[m.jsxs(fi,{children:[m.jsx(_s,{children:m.jsx(ks,{className:"text-sm",children:"By route"})}),m.jsx(Lr,{children:m.jsx(wb,{data:n.data?.routes.map(r=>({label:r.route,value:r.count,subtitle:r.p95_ms!=null?\`p95 \${Math.round(r.p95_ms)}ms\`:void 0}))??[],limit:10})})]}),m.jsxs(fi,{children:[m.jsx(_s,{children:m.jsx(ks,{className:"text-sm",children:"Status classes"})}),m.jsx(Lr,{children:m.jsx(wb,{data:n.data?[{label:"2xx",value:n.data.totals.status_2xx,color:"bg-emerald-500/15"},{label:"3xx",value:n.data.totals.status_3xx,color:"bg-sky-500/15"},{label:"4xx",value:n.data.totals.status_4xx,color:"bg-amber-500/15"},{label:"5xx",value:n.data.totals.status_5xx,color:"bg-red-500/15"}].filter(r=>r.value>0):[]})})]})]})]})}const lxe=[{label:"15 min",minutes:15},{label:"1 hour",minutes:60},{label:"6 hours",minutes:360},{label:"24 hours",minutes:1440}];function cxe(){const e=bn(r=>r.dashboardWindowMinutes),t=bn(r=>r.setDashboardWindowMinutes),{tab:n}=oT({from:"/analytics"});return m.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-6",children:[m.jsxs("div",{className:"flex items-center justify-between mb-6",children:[m.jsx("h1",{className:"text-xl font-semibold text-foreground",children:"Analytics"}),m.jsxs("div",{className:"flex items-center gap-1",children:[lxe.map(r=>m.jsx(Fe,{variant:e===r.minutes?"default":"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>t(r.minutes),children:r.label},r.minutes)),n==="api"&&e>60&&m.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(capped at 60 min)"})]})]}),n==="agents"?m.jsx(oxe,{windowMinutes:e}):m.jsx(sxe,{windowMinutes:e})]})}function bA({mode:e,onModeChange:t}){return m.jsxs("div",{className:"flex rounded-lg border border-border overflow-hidden",children:[m.jsx("button",{className:\`flex-1 px-3 py-1.5 text-sm font-medium transition-colors \${e==="select"?"bg-secondary text-foreground":"text-muted-foreground hover:text-foreground"}\`,onClick:()=>t("select"),children:"Use existing"}),m.jsx("button",{className:\`flex-1 px-3 py-1.5 text-sm font-medium transition-colors \${e==="create"?"bg-secondary text-foreground":"text-muted-foreground hover:text-foreground"}\`,onClick:()=>t("create"),children:"Create new"})]})}function uxe({onNext:e}){const{data:t,isLoading:n,isError:r}=Hs(),i=!n&&!r&&t&&t.length>0,[o,a]=x.useState("create"),[l,u]=x.useState(""),[f,d]=x.useState("my-agent"),[h,g]=x.useState("claude"),[v,b]=x.useState(Xd.claude[0]);x.useEffect(()=>{n||a(i?"select":"create")},[n,i]);function w(){if(o==="select"){const S=t?.find(E=>E.id===l);if(!S){qe.error("Please select an agent");return}e({mode:"select",agent:{id:S.id,name:S.name,engine:S.engine,model:S.model}})}else{if(!f.trim()){qe.error("Agent name is required");return}if(t?.some(S=>S.name.toLowerCase()===f.trim().toLowerCase())){qe.error(\`Agent "\${f.trim()}" already exists \u2014 pick a different name or select it\`);return}e({mode:"create",data:{name:f.trim(),engine:h,model:v}})}}return n?null:r?m.jsxs("div",{className:"w-full max-w-md flex flex-col gap-4",children:[m.jsx("p",{className:"text-sm text-destructive",children:"Failed to load agents. Check that the server is running."}),m.jsx(Fe,{variant:"outline",onClick:()=>window.location.reload(),children:"Retry"})]}):m.jsxs("div",{className:"w-full max-w-md flex flex-col gap-6",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-lime-400/60 mb-1",children:"Step 1 of 4"}),m.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Choose an Agent"}),m.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Select an existing agent or create a new one."})]}),i&&m.jsx(bA,{mode:o,onModeChange:a}),o==="select"&&i&&m.jsx("div",{className:"flex flex-col gap-3",children:m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Agent"}),m.jsxs(To,{value:l,onValueChange:S=>{S&&u(S)},children:[m.jsx(Ao,{className:"h-10 w-full text-foreground",children:m.jsx("span",{className:"truncate",children:t?.find(S=>S.id===l)?.name??"Select an agent"})}),m.jsx(No,{children:t.map(S=>m.jsxs(ai,{value:S.id,children:[S.name," ",m.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",S.engine,")"]})]},S.id))})]})]})}),o==="create"&&m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Name"}),m.jsx(en,{placeholder:"my-agent",value:f,onChange:S=>d(S.target.value),className:"h-10 w-full text-foreground"})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Engine"}),m.jsxs(To,{value:h,onValueChange:S=>{S&&(g(S),b(Xd[S]?.[0]??""))},children:[m.jsx(Ao,{className:"h-10 w-full text-foreground",children:m.jsx(Oh,{})}),m.jsx(No,{children:lA.map(S=>m.jsx(ai,{value:S,children:S},S))})]})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Model"}),m.jsx(pA,{engine:h,value:v,onChange:b})]})]}),m.jsx(Fe,{className:"w-full h-10 bg-cta-gradient text-sm font-medium text-black hover:opacity-90",onClick:w,disabled:o==="select"&&!l,children:"Continue"})]})}function wA(){return Bn({queryKey:["provider-status"],queryFn:()=>Xe("/providers/status"),select:e=>e.data,refetchInterval:15e3,refetchOnWindowFocus:!0})}const fxe={anthropic:"anthropic.com",docker:"docker.com","apple-container":"apple.com",podman:"podman.io",sprites:"sprites.dev",e2b:"e2b.dev",vercel:"vercel.com",daytona:"daytona.io",fly:"fly.io",modal:"modal.com"};function dxe({onNext:e,onBack:t,engine:n}){const{data:r,isLoading:i,isError:o}=nf(),{data:a}=wA(),l=n==="claude",u=r?.filter(A=>!(!(A.state==="ready"||A.state==="active"||A.state==="idle")||A.config?.provider==="anthropic"&&!l))??[],f=(r?.length??0)-u.length,d=!i&&!o&&(r?.length??0)>0,h=!i&&!o&&u.length>0,[g,v]=x.useState("create"),[b,w]=x.useState(""),[S,E]=x.useState("default"),[k,O]=x.useState("");x.useEffect(()=>{i||v(h?"select":"create")},[i,h]),x.useEffect(()=>{if(a&&!k){const T=[...Fm,...ju].filter(N=>N!=="anthropic"||l).find(N=>a[N]?.available);T&&O(T)}},[a,k,l]);function j(){if(g==="select"){const A=u.find(T=>T.id===b);if(!A){qe.error("Please select an environment");return}e({mode:"select",env:{id:A.id,name:A.name,provider:A.config?.provider||"unknown"}})}else{if(!S.trim()){qe.error("Environment name is required");return}if(!k){qe.error("Please select a provider");return}if(r?.some(A=>A.name.toLowerCase()===S.trim().toLowerCase())){qe.error(\`Environment "\${S.trim()}" already exists \u2014 pick a different name or select it\`);return}e({mode:"create",data:{name:S.trim(),provider:k}})}}return i?null:o?m.jsxs("div",{className:"w-full max-w-md flex flex-col gap-4",children:[m.jsx("p",{className:"text-sm text-destructive",children:"Failed to load environments. Check that the server is running."}),m.jsx(Fe,{variant:"outline",onClick:()=>window.location.reload(),children:"Retry"})]}):m.jsxs("div",{className:"w-full max-w-md flex flex-col gap-6",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-lime-400/60 mb-1",children:"Step 2 of 4"}),m.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Choose an Environment"}),m.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Select an existing environment or create a new one."})]}),f>0&&m.jsxs("p",{className:"text-xs text-muted-foreground rounded-md border border-amber-400/20 bg-amber-400/5 p-2",children:[f," existing environment",f>1?"s are":" is"," unavailable (unhealthy or incompatible with ",n??"this"," engine)."]}),d&&m.jsx(bA,{mode:g,onModeChange:v}),g==="select"&&!h&&d&&m.jsxs("p",{className:"text-xs text-muted-foreground text-center py-4",children:["No compatible environments for the ",n??"selected"," engine. Create a new one below."]}),g==="select"&&h&&m.jsx("div",{className:"flex flex-col gap-3",children:m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Environment"}),m.jsxs(To,{value:b,onValueChange:A=>{A&&w(A)},children:[m.jsx(Ao,{className:"h-10 w-full text-foreground",children:m.jsx("span",{className:"truncate",children:u.find(A=>A.id===b)?.name??"Select an environment"})}),m.jsx(No,{children:u.map(A=>m.jsxs(ai,{value:A.id,children:[A.name," ",m.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",A.config?.provider||"unknown",")"]})]},A.id))})]})]})}),g==="create"&&m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Name"}),m.jsx(en,{placeholder:"my-env",value:S,onChange:A=>E(A.target.value),className:"h-10 w-full text-foreground"})]}),m.jsx(Iz,{label:"Local",providers:Fm,providerStatus:a,selected:k,onSelect:O}),m.jsx(Iz,{label:"Cloud",providers:ju.filter(A=>A!=="anthropic"||l),providerStatus:a,selected:k,onSelect:O,cloud:!0})]}),m.jsxs("div",{className:"flex gap-2",children:[t&&m.jsx(Fe,{variant:"outline",className:"h-10 px-4 text-sm",onClick:t,children:"Back"}),m.jsx(Fe,{className:"flex-1 h-10 bg-cta-gradient text-sm font-medium text-black hover:opacity-90",onClick:j,disabled:g==="select"?!b:!S.trim()||!k,children:"Continue"})]})]})}function Iz({label:e,providers:t,providerStatus:n,selected:r,onSelect:i,cloud:o}){return m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx("p",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:e}),m.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:t.map(a=>{const l=n?.[a],u=o?!0:l?.available??!0,f=r===a;return m.jsxs("button",{disabled:!u,onClick:()=>u&&i(a),className:\`relative flex flex-col items-center justify-center rounded-lg border px-2 py-2.5 text-center transition-colors \${f?"border-lime-400/50 bg-lime-400/10":u?"border-border hover:border-muted-foreground/50":"border-border opacity-40 cursor-not-allowed"}\`,children:[f&&m.jsx(Aa,{className:"absolute top-1 right-1 size-3 text-lime-400"}),!o&&!u&&l?.message&&m.jsxs(IT,{children:[m.jsx(DT,{render:m.jsx("div",{className:"absolute top-1 left-1 rounded-full p-0.5 text-muted-foreground hover:text-foreground",onClick:d=>d.stopPropagation()}),children:m.jsx($T,{className:"size-3"})}),m.jsx(LT,{side:"top",className:"max-w-xs",children:m.jsx("p",{className:"text-xs",children:l.message})})]}),m.jsx("img",{src:\`https://www.google.com/s2/favicons?domain=\${fxe[a]??""}&sz=32\`,alt:"",className:"size-4 mb-1"}),m.jsx("span",{className:\`text-xs font-medium \${f||u?"text-foreground":"text-muted-foreground"}\`,children:a}),o&&m.jsx("span",{className:"text-[10px] text-muted-foreground mt-0.5",children:"API key required"}),!o&&!u&&m.jsx("span",{className:"text-[10px] text-destructive/70 mt-0.5",children:"Unavailable"})]},a)})})]})}function hxe({engine:e,model:t,provider:n,agentId:r,agentName:i,hasExistingVaults:o,onNext:a,onSkip:l,onSelectVault:u,onBack:f}){const[d,h]=x.useState({}),[g,v]=x.useState(""),b=i?\`\${i}-vault\`:"my-vault",[w,S]=x.useState(b),{data:E}=xA(),k=r?(E??[]).filter(B=>B.agent_id===r):[],O=new Set,j=k.filter(B=>O.has(B.name)?!1:(O.add(B.name),!0)),A=[],T=new Set;n==="anthropic"&&(A.push({key:"ANTHROPIC_API_KEY",label:"Anthropic API Key (required for hosted execution)"}),T.add("ANTHROPIC_API_KEY"));const N=wpe(e,t);N&&!T.has(N.key)&&(A.push(N),T.add(N.key));const P=G8[n];P&&!T.has(P.key)&&A.push({key:P.key,label:P.label});const F=o||j.length>0,[D,q]=x.useState(F?"select":"create");if(x.useEffect(()=>{F&&q("select")},[F]),A.length===0)return m.jsxs("div",{className:"w-full max-w-md flex flex-col gap-6",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-lime-400/60 mb-1",children:"Step 3 of 4"}),m.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Secrets"}),m.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t&&!t.includes("/")&&!["claude-","gpt-","o1-","o3-","codex-","gemini-"].some(B=>t.startsWith(B))?"No API key required \u2014 this model runs locally via Ollama.":"No API keys needed for this combination."})]}),m.jsxs("div",{className:"flex gap-2",children:[f&&m.jsx(Fe,{variant:"outline",className:"h-10 px-4 text-sm",onClick:f,children:"Back"}),m.jsx(Fe,{className:"flex-1 h-10 bg-cta-gradient text-sm font-medium text-black hover:opacity-90",onClick:l,children:"Continue"})]})]});const L=w.trim(),U=D==="create"&&L.length>0&&k.some(B=>B.name===L);function H(){if(D==="select")if(o)l();else{if(!g)return;const B=j.find(z=>z.id===g)?.name??g;u?.(g,B)}else{if(!L||U)return;a(d,L)}}return m.jsxs("div",{className:"w-full max-w-md flex flex-col gap-6",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-lime-400/60 mb-1",children:"Step 3 of 4"}),m.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Secrets"}),m.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:F?"Use existing secrets or enter new API keys.":"These keys will be stored securely in a vault."})]}),F&&m.jsx(bA,{mode:D,onModeChange:q}),D==="select"&&F&&m.jsx("div",{className:"flex flex-col gap-3",children:o?m.jsx("p",{className:"text-sm text-muted-foreground",children:"The agent's existing vault secrets will be used for this session."}):m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Vault"}),m.jsxs(To,{value:g,onValueChange:B=>{B&&v(B)},children:[m.jsx(Ao,{className:"h-10 w-full text-foreground",children:m.jsx("span",{className:"truncate",children:j.find(B=>B.id===g)?.name??"Select a vault"})}),m.jsx(No,{children:j.map(B=>m.jsxs(ai,{value:B.id,children:[B.name," ",m.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",B.entry_count," ",B.entry_count===1?"key":"keys",")"]})]},B.id))})]})]})}),D==="create"&&m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Vault name"}),m.jsx(en,{value:w,onChange:B=>S(B.target.value),placeholder:b,className:"h-10 w-full text-foreground border-border bg-muted text-sm placeholder:text-muted-foreground focus-visible:ring-ring"}),U&&m.jsxs("p",{className:"text-xs text-red-400",children:['A vault named "',L,'" already exists for this agent.']})]}),A.map(B=>m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:B.label}),m.jsx(en,{type:"password",placeholder:B.key==="ANTHROPIC_API_KEY"&&e==="claude"&&n!=="anthropic"?"ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN":B.key,value:d[B.key]||"",onChange:z=>h({...d,[B.key]:z.target.value}),className:"h-10 w-full text-foreground border-border bg-muted font-mono text-sm placeholder:text-muted-foreground focus-visible:ring-ring"})]},B.key))]}),m.jsxs("div",{className:"flex gap-2",children:[f&&m.jsx(Fe,{variant:"outline",className:"h-10 px-4 text-sm",onClick:f,children:"Back"}),m.jsx(Fe,{className:"flex-1 h-10 bg-cta-gradient text-sm font-medium text-black hover:opacity-90",onClick:H,disabled:D==="select"&&!o&&!g||D==="create"&&(!L||U),children:"Continue"})]})]})}function pxe({agentName:e,envName:t,secretsLabel:n,onStart:r,loading:i,error:o,isExistingAgent:a,isExistingEnv:l,onBack:u}){return m.jsxs("div",{className:"w-full max-w-md flex flex-col gap-6",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-lime-400/60 mb-1",children:"Step 4 of 4"}),m.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Ready to Go"}),m.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Everything is configured. Start your first session."})]}),m.jsxs("div",{className:"rounded-xl ring-1 ring-border bg-card p-4 flex flex-col gap-3",children:[m.jsx(CC,{label:"Agent",value:e,tag:a?"existing":"new"}),m.jsx("div",{className:"border-t border-border"}),m.jsx(CC,{label:"Environment",value:t,tag:l?"existing":"new"}),m.jsx("div",{className:"border-t border-border"}),m.jsx(CC,{label:"Secrets",value:n,tag:n!=="none"?"existing":void 0})]}),o&&m.jsx("p",{className:"text-sm text-destructive",children:o}),m.jsxs("div",{className:"flex gap-2",children:[u&&m.jsx(Fe,{variant:"outline",className:"h-10 px-4 text-sm",onClick:u,disabled:i,children:"Back"}),m.jsx(Fe,{className:"flex-1 h-10 bg-cta-gradient text-sm font-medium text-black hover:opacity-90",onClick:r,disabled:i,children:i?m.jsxs("span",{className:"flex items-center gap-2",children:[m.jsx(tw,{className:"size-4 animate-spin"}),"Starting session..."]}):"Start Session"})]})]})}function CC({label:e,value:t,tag:n}){return m.jsxs("div",{className:"flex justify-between text-sm",children:[m.jsx("span",{className:"text-muted-foreground",children:e}),m.jsxs("span",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"font-medium text-foreground",children:t}),n&&m.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["(",n,")"]})]})]})}function Gq(){const[e,t]=x.useState(0),[n,r]=x.useState(null),[i,o]=x.useState(null),[a,l]=x.useState({}),[u,f]=x.useState(""),[d,h]=x.useState(null),[g,v]=x.useState([]),[b,w]=x.useState(!1),[S,E]=x.useState(null),[k,O]=x.useState(null),[j,A]=x.useState(null),T=b8(),N=w8(),P=qq(),F=Vq(),D=S8(),q=Bs(),L=n?.mode==="select"?{name:n.agent.name,engine:n.agent.engine,model:n.agent.model}:n?.mode==="create"?n.data:{name:"",engine:"claude",model:""},U=i?.mode==="select"?{name:i.env.name,provider:i.env.provider}:i?.mode==="create"?i.data:{name:"",provider:"docker"},H=n?.mode==="select",B=i?.mode==="select";async function z($){if(r($),$.mode==="select")try{const X=(await Xe(\`/vaults?agent_id=\${$.agent.id}\`)).data.filter(W=>W.entry_count>0).map(W=>W.id);v(X)}catch{}else v([]);t(1)}function V($){o($),t(2)}function Q($,R){l($),f(R),h(null),t(3)}function G($,R){h({id:$,name:R}),l({}),t(3)}async function I(){if(!(!n||!i)){w(!0),E(null);try{let $;if(n.mode==="select")$=n.agent.id;else if(k)$=k;else{const oe=await T.mutateAsync(n.data);$=oe.id,O(oe.id)}let R;if(i.mode==="select")R=i.env.id;else if(j)R=j;else{const oe=await N.mutateAsync({name:i.data.name,config:{provider:i.data.provider}});R=oe.id,A(oe.id)}let X=[...g];if(d)X=[d.id];else{const oe=U.provider==="anthropic",ie=Object.entries(a).map(([J,se])=>[J,se.trim()]).filter(([,J])=>J.length>0).map(([J,se])=>{const xe=se.startsWith("sk-ant-oat");if(xe&&oe)throw new Error("OAuth tokens (sk-ant-oat) are not supported with the Anthropic provider. Use a regular API key (sk-ant-api03-...) instead.");return J==="ANTHROPIC_API_KEY"&&xe?["CLAUDE_CODE_OAUTH_TOKEN",se]:[J,se]});if(ie.length>0){let J;if(g.length>0)J=g[0];else{const se=u.trim()||"my-vault";try{const ne=(await Xe(\`/vaults?agent_id=\${$}\`)).data.find(ke=>ke.name===se);ne?J=ne.id:J=(await P.mutateAsync({name:se,agent_id:$})).id}catch{J=(await P.mutateAsync({name:\`\${se}-\${Date.now()}\`,agent_id:$})).id}}for(const[se,xe]of ie)await F.mutateAsync({vaultId:J,key:se,value:xe});X=[J]}}const W=await D.mutateAsync({agent_id:$,environment_id:R,vault_ids:X.length>0?X:void 0}),Z="as.first_session_shown";localStorage.getItem(Z)||(localStorage.setItem(Z,"1"),qe.success("Session started \u2014 try saying 'hi' in the chat.")),q({to:"/playground/$sessionId",params:{sessionId:W.id}})}catch($){const R=$?.body?.error?.message||($ instanceof Error?$.message:"Failed to start session");E(R),qe.error(R)}finally{w(!1)}}}function K(){if(d)return d.name;if(g.length>0)return"agent vault";const $=Object.entries(a).filter(([,R])=>R.trim());return $.length>0?\`\${$.length} key\${$.length>1?"s":""}\`:"none"}return m.jsxs("div",{className:"flex flex-1 items-center justify-center p-8",children:[e===0&&m.jsx(uxe,{onNext:z}),e===1&&m.jsx(dxe,{onNext:V,onBack:()=>t(0),engine:L.engine}),e===2&&m.jsx(hxe,{engine:L.engine,model:L.model,provider:U.provider,agentId:n?.mode==="select"?n.agent.id:null,agentName:L.name,hasExistingVaults:g.length>0,onNext:Q,onSkip:()=>t(3),onSelectVault:G,onBack:()=>t(1)}),e===3&&m.jsx(pxe,{agentName:L.name,envName:U.name,secretsLabel:K(),onStart:I,loading:b,error:S,isExistingAgent:H,isExistingEnv:B,onBack:()=>t(2)})]})}const mxe="0.4.15",gxe="https://github.com/agentstep/gateway",vxe={docker:"docker.com","apple-container":"apple.com",podman:"podman.io",sprites:"sprites.dev",e2b:"e2b.dev",vercel:"vercel.com",daytona:"daytona.io",fly:"fly.io",modal:"modal.com",anthropic:"anthropic.com"};function yxe(e){return e.length<=10?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022":\`\${e.slice(0,6)}\u2022\u2022\u2022\u2022\${e.slice(-4)}\`}function xxe({apiKey:e}){const{data:t}=wA(),[n,r]=x.useState(!1),[i,o]=x.useState(!1),[a,l]=x.useState(!1),u=\`curl http://localhost:4000/v1/agents \\\\
|
|
216995
|
+
...\`:""]})}),m.jsx(Fe,{className:"bg-cta-gradient text-black font-medium hover:opacity-90",onClick:()=>r(u),children:"Install Skill"})]})]})]})})}function gye({agent:e}){const t=Ng(),[n,r]=x.useState(e.webhook_url||""),[i,o]=x.useState((e.webhook_events??[]).join(", ")),[a,l]=x.useState((e.callable_agents??[]).join(", ")),u=n!==(e.webhook_url||"")||i!==(e.webhook_events??[]).join(", ")||a!==(e.callable_agents??[]).join(", ");async function f(){try{await t.mutateAsync({id:e.id,webhook_url:n||void 0,webhook_events:i?i.split(",").map(d=>d.trim()).filter(Boolean):void 0,callable_agents:a?a.split(",").map(d=>d.trim()).filter(Boolean):void 0}),qe.success("Agent updated")}catch{qe.error("Failed to update agent")}}return m.jsxs("div",{className:"flex flex-col gap-6",children:[e.tools&&e.tools.length>0&&m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx(wt,{className:"text-sm text-foreground",children:"Tools"}),m.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.tools.map((d,h)=>m.jsx(an,{variant:"outline",className:"text-xs",children:typeof d=="string"?d:d?.name??JSON.stringify(d)},h))})]}),e.mcp_servers&&e.mcp_servers.length>0&&m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx(wt,{className:"text-sm text-foreground",children:"MCP Servers"}),m.jsx("pre",{className:"rounded bg-muted p-3 text-xs text-muted-foreground max-h-48 overflow-y-auto",children:JSON.stringify(e.mcp_servers,null,2)})]}),m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsx(wt,{className:"text-sm text-foreground",children:"Webhook"}),m.jsx(en,{placeholder:"https://example.com/webhook",value:n,onChange:d=>r(d.target.value),className:"text-foreground"}),m.jsx(en,{placeholder:"Events (comma-separated): session.created, turn.complete",value:i,onChange:d=>o(d.target.value),className:"text-foreground"})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-sm text-foreground",children:"Callable Agents"}),m.jsx(en,{placeholder:"Agent IDs (comma-separated)",value:a,onChange:d=>l(d.target.value),className:"text-foreground"}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"Other agents this agent can spawn as child sessions"})]}),u&&m.jsx("div",{className:"flex justify-end",children:m.jsx(Fe,{className:"bg-cta-gradient text-black font-medium hover:opacity-90",onClick:f,disabled:t.isPending,children:t.isPending?"Saving...":"Save Changes"})})]})}function vye({agent:e}){const t=Ng(),[n,r]=x.useState("");x.useEffect(()=>{const o={};for(const[a,l]of Object.entries(e))["id","created_at","updated_at","version"].includes(a)||(o[a]=l);r(JSON.stringify(o,null,2))},[e]);async function i(){try{const o=JSON.parse(n);await t.mutateAsync({id:e.id,...o}),qe.success("Agent updated")}catch(o){qe.error(o instanceof SyntaxError?"Invalid JSON":"Failed to update agent")}}return m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsx("p",{className:"text-xs text-muted-foreground",children:"Edit the full agent configuration as JSON."}),m.jsx(xw,{value:n,onChange:o=>r(o.target.value),className:"min-h-[400px] font-mono text-xs text-foreground leading-relaxed border-border bg-muted focus-visible:ring-ring"}),m.jsx("div",{className:"flex justify-end",children:m.jsx(Fe,{className:"bg-cta-gradient text-black font-medium hover:opacity-90",onClick:i,disabled:t.isPending,children:t.isPending?"Saving...":"Save"})})]})}function yye(){const e=bn(i=>i.selectedAgentId),t=Bs(),{data:n,isLoading:r}=JT(e);return r||!n?null:m.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[m.jsxs("div",{className:"flex items-center gap-3 border-b px-6 py-3",children:[m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground",onClick:()=>t({to:"/agents"}),children:m.jsx(GH,{className:"size-4"})}),m.jsxs("div",{className:"flex-1",children:[m.jsx("h2",{className:"text-sm font-semibold text-foreground",children:n.name}),m.jsxs("p",{className:"text-xs text-muted-foreground",children:[n.engine," / ",n.model]})]}),m.jsx(an,{variant:"outline",className:"border-lime-400/20 bg-lime-400/10 text-lime-400 text-xs",children:"Active"})]}),m.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-6",children:m.jsx("div",{children:m.jsxs(Lve,{defaultValue:"config",children:[m.jsxs(Fve,{children:[m.jsx(Zy,{value:"config",children:"Config"}),m.jsx(Zy,{value:"skills",children:"Skills"}),m.jsx(Zy,{value:"advanced",children:"Advanced"}),m.jsx(Zy,{value:"edit",children:"Edit"})]}),m.jsx(Jy,{value:"config",className:"mt-6",children:m.jsx(Kve,{agent:n})}),m.jsx(Jy,{value:"skills",className:"mt-6",children:m.jsx(pye,{agent:n})}),m.jsx(Jy,{value:"advanced",className:"mt-6",children:m.jsx(gye,{agent:n})}),m.jsx(Jy,{value:"edit",className:"mt-6",children:m.jsx(vye,{agent:n})})]})})})]})}const xye={SPRITE_TOKEN:"sprite_token",E2B_API_KEY:"e2b_api_key",VERCEL_TOKEN:"vercel_token",DAYTONA_API_KEY:"daytona_api_key",FLY_API_TOKEN:"fly_api_token",MODAL_TOKEN_ID:"modal_token_id"};function bye({open:e,onOpenChange:t}){const n=w8(),[r,i]=x.useState(""),[o,a]=x.useState("docker"),[l,u]=x.useState(""),f=G8[o],d=!!f;async function h(){if(r.trim())try{if(d&&l.trim()){const g=xye[f.key];g&&await Xe("/settings",{method:"PUT",body:JSON.stringify({key:g,value:l.trim()})})}await n.mutateAsync({name:r.trim(),config:{provider:o}}),i(""),u(""),qe.success("Environment created"),t(!1)}catch(g){const b=g?.body?.error?.message||(g instanceof Error?g.message:"Failed to create");qe.error(b)}}return m.jsx(ea,{open:e,onOpenChange:t,children:m.jsxs(za,{children:[m.jsx(Fa,{children:m.jsx(Ba,{children:"Add environment"})}),m.jsxs("div",{className:"flex flex-col gap-4 pt-2",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Name"}),m.jsx(en,{placeholder:"my-env",value:r,onChange:g=>i(g.target.value),className:"w-full text-foreground"})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Provider"}),m.jsxs(To,{value:o,onValueChange:g=>{g&&(a(g),u(""))},children:[m.jsx(Ao,{className:"w-full text-foreground",children:m.jsx(Oh,{})}),m.jsxs(No,{children:[m.jsxs(cz,{children:[m.jsx(uz,{children:"Local"}),Fm.map(g=>m.jsx(ai,{value:g,children:g},g))]}),m.jsxs(cz,{children:[m.jsx(uz,{children:"Cloud"}),ju.map(g=>m.jsx(ai,{value:g,children:g},g))]})]})]})]}),d&&m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:f.label}),m.jsx(en,{type:"password",placeholder:f.placeholder,value:l,onChange:g=>u(g.target.value),className:"w-full font-mono text-foreground"}),m.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Saved to server settings for provider access."})]}),m.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[m.jsx(Fe,{variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),m.jsx(Fe,{className:"bg-cta-gradient text-black hover:opacity-90",onClick:h,disabled:!r.trim()||n.isPending,children:"Create"})]})]})]})})}function wye(e){const t=typeof e=="string"?new Date(e).getTime():e,n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return\`\${r}m ago\`;const i=Math.floor(r/60);return i<24?\`\${i}h ago\`:\`\${Math.floor(i/24)}d ago\`}function Sye(){const{data:e}=nf(),t=Kde(),[n,r]=x.useState(!1);return m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsx(Sc,{title:"Environments",description:"Configuration for containers and code execution.",actionLabel:"Add environment",onAction:()=>r(!0)}),e&&e.length>0?m.jsx("div",{className:"rounded-lg border border-border",children:m.jsxs(eo,{children:[m.jsx(Jo,{children:m.jsxs(yn,{children:[m.jsx(et,{className:"w-[140px]",children:"ID"}),m.jsx(et,{children:"Name"}),m.jsx(et,{children:"Provider"}),m.jsx(et,{children:"Status"}),m.jsx(et,{children:"Created"}),m.jsx(et,{className:"w-[50px]"})]})}),m.jsx(to,{children:e.map(i=>m.jsxs(yn,{children:[m.jsxs(Ue,{className:"font-mono text-xs text-muted-foreground",children:[i.id.slice(0,16),"..."]}),m.jsx(Ue,{className:"font-medium text-foreground",children:i.name}),m.jsx(Ue,{className:"font-mono text-xs text-muted-foreground",children:i.config?.provider||"unknown"}),m.jsx(Ue,{children:m.jsx(an,{variant:"outline",className:Ne("text-xs",i.state==="ready"?"border-lime-400/20 bg-lime-400/10 text-lime-400":"text-muted-foreground"),children:i.state})}),m.jsx(Ue,{className:"text-muted-foreground",children:wye(i.created_at)}),m.jsx(Ue,{children:m.jsxs(M8,{children:[m.jsx(I8,{render:m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground"}),children:m.jsx(n8,{className:"size-4"})}),m.jsx(D8,{align:"end",children:m.jsxs(pO,{className:"text-destructive",onSelect:()=>t.mutate(i.id),children:[m.jsx(Mi,{className:"mr-2 size-3.5"})," Delete"]})})]})})]},i.id))})]})}):m.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No environments yet."}),m.jsx(bye,{open:n,onOpenChange:r})]})}function xA(e){const t=e?\`/vaults?agent_id=\${e}&limit=50\`:"/vaults?limit=50";return Bn({queryKey:["vaults",e??"all"],queryFn:()=>Xe(t),select:n=>n.data})}function Eye(e){return Bn({queryKey:["vaults",e,"entries"],queryFn:()=>Xe(\`/vaults/\${e}/entries\`),enabled:!!e,select:t=>t.data})}function qq(){const e=hn();return Nn({mutationFn:t=>Xe("/vaults",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>e.invalidateQueries({queryKey:["vaults"]})})}function Cye(){const e=hn();return Nn({mutationFn:t=>Xe(\`/vaults/\${t}\`,{method:"DELETE"}),onSuccess:()=>e.invalidateQueries({queryKey:["vaults"]})})}function Vq(){const e=hn();return Nn({mutationFn:({vaultId:t,key:n,value:r})=>Xe(\`/vaults/\${t}/entries/\${n}\`,{method:"PUT",body:JSON.stringify({value:r})}),onSuccess:(t,n)=>e.invalidateQueries({queryKey:["vaults",n.vaultId,"entries"]})})}function _ye(){const e=hn();return Nn({mutationFn:({vaultId:t,key:n})=>Xe(\`/vaults/\${t}/entries/\${n}\`,{method:"DELETE"}),onSuccess:(t,n)=>e.invalidateQueries({queryKey:["vaults",n.vaultId,"entries"]})})}function kye(e){const t=typeof e=="string"?new Date(e).getTime():e,n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return\`\${r}m ago\`;const i=Math.floor(r/60);return i<24?\`\${i}h ago\`:\`\${Math.floor(i/24)}d ago\`}function Oye(){const{data:e}=xA(),t=Cye(),[n,r]=x.useState(null),[i,o]=x.useState(!1),[a,l]=x.useState(null);return m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsx(Sc,{title:"Credential vaults",description:"Manage credential vaults that provide agents with access to APIs and services.",actionLabel:"New vault",onAction:()=>o(!0)}),e&&e.length>0?m.jsx("div",{className:"rounded-lg border border-border",children:m.jsxs(eo,{children:[m.jsx(Jo,{children:m.jsxs(yn,{children:[m.jsx(et,{className:"w-8"}),m.jsx(et,{className:"w-[140px]",children:"ID"}),m.jsx(et,{children:"Name"}),m.jsx(et,{children:"Status"}),m.jsx(et,{children:"Entries"}),m.jsx(et,{children:"Created"}),m.jsx(et,{className:"w-[50px]"})]})}),m.jsx(to,{children:e.map(u=>m.jsx(Tye,{vault:u,expanded:n===u.id,onToggle:()=>r(n===u.id?null:u.id),onDelete:()=>l({id:u.id,name:u.name})},u.id))})]})}):m.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No vaults yet. Create one to store API keys and credentials."}),m.jsx(jye,{open:i,onOpenChange:o}),m.jsx(xh,{open:!!a,onOpenChange:u=>!u&&l(null),children:m.jsxs(bh,{children:[m.jsxs(wh,{children:[m.jsxs(Eh,{children:['Delete vault "',a?.name,'"?']}),m.jsx(Ch,{children:"This will permanently delete the vault and all its entries. This action cannot be undone."})]}),m.jsxs(Sh,{children:[m.jsx(kh,{children:"Cancel"}),m.jsx(_h,{variant:"destructive",onClick:()=>{a&&t.mutate(a.id),l(null)},children:"Delete"})]})]})})]})}function jye({open:e,onOpenChange:t}){const n=qq(),{data:r}=Hs(),[i,o]=x.useState(""),[a,l]=x.useState("");async function u(){if(!(!i.trim()||!a))try{await n.mutateAsync({name:i.trim(),agent_id:a}),o(""),l(""),qe.success("Vault created"),t(!1)}catch(f){const d=f?.body?.error?.message||(f instanceof Error?f.message:"Failed to create vault");qe.error(d)}}return m.jsx(ea,{open:e,onOpenChange:t,children:m.jsxs(za,{children:[m.jsx(Fa,{children:m.jsx(Ba,{children:"New vault"})}),m.jsxs("div",{className:"flex flex-col gap-4 pt-2",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Name"}),m.jsx(en,{placeholder:"default",value:i,onChange:f=>o(f.target.value),className:"w-full text-foreground"})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Agent"}),m.jsxs(To,{value:a,onValueChange:f=>{f&&l(f)},children:[m.jsx(Ao,{className:"w-full text-foreground",children:m.jsx(Oh,{placeholder:"Select an agent"})}),m.jsx(No,{children:r?.map(f=>m.jsx(ai,{value:f.id,children:f.name},f.id))})]})]}),m.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[m.jsx(Fe,{variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),m.jsx(Fe,{className:"bg-cta-gradient text-black hover:opacity-90",onClick:u,disabled:!i.trim()||!a||n.isPending,children:"Create"})]})]})]})})}function Tye({vault:e,expanded:t,onToggle:n,onDelete:r}){return m.jsxs(m.Fragment,{children:[m.jsxs(yn,{className:"cursor-pointer",onClick:n,children:[m.jsx(Ue,{children:m.jsx(ew,{className:Ne("size-3.5 text-muted-foreground transition-transform",t&&"rotate-90")})}),m.jsxs(Ue,{className:"font-mono text-xs text-muted-foreground",children:[e.id.slice(0,16),"..."]}),m.jsx(Ue,{className:"font-medium text-foreground",children:e.name}),m.jsx(Ue,{children:m.jsx(an,{variant:"outline",className:"border-lime-400/20 bg-lime-400/10 text-lime-400 text-xs",children:"Active"})}),m.jsx(Ue,{className:"text-muted-foreground",children:e.entry_count}),m.jsx(Ue,{className:"text-muted-foreground",children:kye(e.created_at)}),m.jsx(Ue,{children:m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-red-400/40 hover:text-red-400",onClick:i=>{i.stopPropagation(),r()},children:m.jsx(Mi,{className:"size-3.5"})})})]}),t&&m.jsx(yn,{children:m.jsx(Ue,{colSpan:7,className:"bg-muted/50 p-4",children:m.jsx(Aye,{vaultId:e.id})})})]})}function Aye({vaultId:e}){const{data:t}=Eye(e),n=Vq(),r=_ye(),[i,o]=x.useState(""),[a,l]=x.useState("");async function u(){!i.trim()||!a.trim()||(await n.mutateAsync({vaultId:e,key:i.trim(),value:a.trim()}),o(""),l(""),qe.success("Entry added"))}return m.jsxs("div",{className:"flex flex-col gap-2",children:[t?.map(f=>m.jsxs("div",{className:"flex items-center gap-3 rounded-md bg-background px-3 py-2",children:[m.jsx("span",{className:"font-mono text-xs text-lime-400/60",children:f.key}),m.jsxs("span",{className:"flex-1 truncate font-mono text-xs text-muted-foreground",children:[f.value.slice(0,8),"...",f.value.slice(-4)]}),m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-6 text-red-400/30 hover:text-red-400",onClick:()=>r.mutate({vaultId:e,key:f.key}),children:m.jsx(Mi,{className:"size-3"})})]},f.key)),m.jsxs("div",{className:"flex gap-2",children:[m.jsx(en,{placeholder:"Key",value:i,onChange:f=>o(f.target.value),className:"h-8 w-full font-mono text-xs text-foreground"}),m.jsx(en,{placeholder:"Value",type:"password",value:a,onChange:f=>l(f.target.value),className:"h-8 w-full font-mono text-xs text-foreground"}),m.jsx(Fe,{size:"icon",className:"size-8 shrink-0 bg-cta-gradient text-black hover:opacity-90",onClick:u,children:m.jsx(bc,{className:"size-3"})})]})]})}function Nye(e){const t="/files?limit=100";return Bn({queryKey:["files","all"],queryFn:()=>Xe(t),select:n=>n.data})}function Rye(){const e=hn();return Nn({mutationFn:async t=>{const n=new FormData;n.append("file",t);const r=bn.getState().apiKey,i=await fetch("/v1/files",{method:"POST",headers:{"x-api-key":r},body:n});if(!i.ok){const o=await i.json().catch(()=>({error:{message:"Upload failed"}}));throw new Error(o.error?.message||\`Upload failed (\${i.status})\`)}return i.json()},onSuccess:()=>e.invalidateQueries({queryKey:["files"]})})}function Pye(){const e=hn();return Nn({mutationFn:t=>Xe(\`/files/\${t}\`,{method:"DELETE"}),onSuccess:()=>e.invalidateQueries({queryKey:["files"]})})}async function Mye(e,t){const n=bn.getState().apiKey,r=await fetch(\`/v1/files/\${e}/content\`,{headers:{"x-api-key":n}});if(!r.ok)throw new Error("Download failed");const i=await r.blob(),o=URL.createObjectURL(i),a=document.createElement("a");a.href=o,a.download=t,a.click(),URL.revokeObjectURL(o)}function Iye(){return Bn({queryKey:["saved-repositories"],queryFn:async()=>{const e=await Xe("/settings/saved_repositories");if(!e.value)return[];try{return JSON.parse(e.value)}catch{return[]}}})}function Dye(){const e=hn();return Nn({mutationFn:async t=>{await Xe("/settings",{method:"PUT",body:JSON.stringify({key:"saved_repositories",value:JSON.stringify(t)})})},onSuccess:()=>e.invalidateQueries({queryKey:["saved-repositories"]})})}function wO(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return\`\${n}m ago\`;const r=Math.floor(n/60);return r<24?\`\${r}h ago\`:\`\${Math.floor(r/24)}d ago\`}function Mz(e){return e>=1024*1024?\`\${(e/(1024*1024)).toFixed(1)} MB\`:e>=1024?\`\${(e/1024).toFixed(1)} KB\`:\`\${e} B\`}function Lye(){const{data:e}=Nye(),{data:t}=hw(),n=Rye(),r=Pye(),i=x.useRef(null),[o,a]=x.useState(null),l=new Map;t?.forEach(v=>{l.set(v.id,{title:v.title??v.id.slice(0,20),agent:v.agent?.id?.slice(0,16)??""})});const u=new Map,f=[];e?.forEach(v=>{if(v.scope?.id){const b=u.get(v.scope.id)??[];b.push(v),u.set(v.scope.id,b)}else f.push(v)});async function d(v){const b=v.target.files?.[0];if(b)try{await n.mutateAsync(b),qe.success(\`"\${b.name}" uploaded\`)}catch(w){qe.error(w instanceof Error?w.message:"Upload failed")}finally{i.current&&(i.current.value="")}}async function h(v,b){try{await Mye(v,b)}catch{qe.error("Download failed")}}const g=e?.length??0;return m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsx(Sc,{title:"Files",description:\`\${g} file\${g!==1?"s":""} across \${u.size} session\${u.size!==1?"s":""}\`,actionLabel:"Upload file",onAction:()=>i.current?.click()}),m.jsx("input",{ref:i,type:"file",className:"hidden",onChange:d}),g===0?m.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border border-dashed border-border py-12 text-center",children:[m.jsx(pb,{className:"size-8 text-muted-foreground/40"}),m.jsx("p",{className:"text-sm text-muted-foreground",children:"No files yet"}),m.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Files created by agents during sessions will appear here"})]}):m.jsxs("div",{className:"flex flex-col gap-6",children:[Array.from(u.entries()).map(([v,b])=>{const w=l.get(v);return m.jsxs("div",{className:"rounded-lg border border-border",children:[m.jsxs("div",{className:"flex items-center gap-2 border-b border-border bg-muted/30 px-4 py-2",children:[m.jsx(BT,{className:"size-3.5 text-muted-foreground"}),m.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:w?.title??v.slice(0,24)}),m.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:[v.slice(0,20),"..."]}),m.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[b.length," file",b.length!==1?"s":""]})]}),m.jsx(eo,{children:m.jsx(to,{children:b.map(S=>m.jsxs(yn,{children:[m.jsx(Ue,{className:"font-medium text-foreground",children:S.filename}),m.jsx(Ue,{className:"text-muted-foreground text-xs",children:Mz(S.size_bytes)}),m.jsx(Ue,{className:"font-mono text-[10px] text-muted-foreground",children:S.mime_type}),m.jsx(Ue,{className:"text-xs text-muted-foreground",children:wO(S.created_at)}),m.jsx(Ue,{className:"w-[80px]",children:m.jsxs("div",{className:"flex items-center gap-1",children:[S.downloadable&&m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground hover:text-foreground",onClick:()=>h(S.id,S.filename),children:m.jsx(Yd,{className:"size-3.5"})}),m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-red-400/40 hover:text-red-400",onClick:()=>a({id:S.id,filename:S.filename}),children:m.jsx(Mi,{className:"size-3.5"})})]})})]},S.id))})})]},v)}),f.length>0&&m.jsxs("div",{className:"rounded-lg border border-border",children:[m.jsxs("div",{className:"flex items-center gap-2 border-b border-border bg-muted/30 px-4 py-2",children:[m.jsx(pb,{className:"size-3.5 text-muted-foreground"}),m.jsx("span",{className:"text-xs font-medium text-foreground",children:"Uploaded (no session)"}),m.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[f.length," file",f.length!==1?"s":""]})]}),m.jsx(eo,{children:m.jsx(to,{children:f.map(v=>m.jsxs(yn,{children:[m.jsx(Ue,{className:"font-medium text-foreground",children:v.filename}),m.jsx(Ue,{className:"text-muted-foreground text-xs",children:Mz(v.size_bytes)}),m.jsx(Ue,{className:"font-mono text-[10px] text-muted-foreground",children:v.mime_type}),m.jsx(Ue,{className:"text-xs text-muted-foreground",children:wO(v.created_at)}),m.jsx(Ue,{className:"w-[80px]",children:m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground hover:text-foreground",onClick:()=>h(v.id,v.filename),children:m.jsx(Yd,{className:"size-3.5"})}),m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-red-400/40 hover:text-red-400",onClick:()=>a({id:v.id,filename:v.filename}),children:m.jsx(Mi,{className:"size-3.5"})})]})})]},v.id))})})]})]}),m.jsx(xh,{open:!!o,onOpenChange:v=>!v&&a(null),children:m.jsxs(bh,{children:[m.jsxs(wh,{children:[m.jsxs(Eh,{children:['Delete "',o?.filename,'"?']}),m.jsx(Ch,{children:"This will permanently delete the file."})]}),m.jsxs(Sh,{children:[m.jsx(kh,{children:"Cancel"}),m.jsx(_h,{variant:"destructive",onClick:()=>{o&&r.mutate(o.id,{onSuccess:()=>qe.success("File deleted"),onError:()=>qe.error("Failed to delete")}),a(null)},children:"Delete"})]})]})})]})}function zye(){const{data:e}=Iye(),t=Dye(),[n,r]=x.useState(!1),[i,o]=x.useState(""),[a,l]=x.useState("main");async function u(){if(!i.trim())return;const d=e??[],h={url:i.trim(),branch:a.trim()||"main",added_at:new Date().toISOString()};try{await t.mutateAsync([...d,h]),qe.success("Repository saved"),o(""),l("main"),r(!1)}catch{qe.error("Failed to save repository")}}async function f(d){const h=e??[];try{await t.mutateAsync(h.filter(g=>g.url!==d)),qe.success("Repository removed")}catch{qe.error("Failed to remove repository")}}return m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsx(Sc,{title:"Repositories",description:"Save repository URLs for agents to clone during sessions.",actionLabel:"Add repository",onAction:()=>r(!0)}),e&&e.length>0?m.jsx("div",{className:"rounded-lg border border-border",children:m.jsxs(eo,{children:[m.jsx(Jo,{children:m.jsxs(yn,{children:[m.jsx(et,{children:"URL"}),m.jsx(et,{children:"Branch"}),m.jsx(et,{children:"Added"}),m.jsx(et,{className:"w-[50px]"})]})}),m.jsx(to,{children:e.map(d=>m.jsxs(yn,{children:[m.jsx(Ue,{className:"font-mono text-xs text-foreground",children:d.url}),m.jsx(Ue,{children:m.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[m.jsx(KL,{className:"size-3"}),d.branch]})}),m.jsx(Ue,{className:"text-sm text-muted-foreground",children:wO(d.added_at)}),m.jsx(Ue,{children:m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-red-400/40 hover:text-red-400",onClick:()=>f(d.url),children:m.jsx(Mi,{className:"size-3.5"})})})]},d.url))})]})}):m.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border border-dashed border-border py-12 text-center",children:[m.jsx(KL,{className:"size-8 text-muted-foreground/40"}),m.jsx("p",{className:"text-sm text-muted-foreground",children:"No repositories saved yet"})]}),m.jsx(ea,{open:n,onOpenChange:r,children:m.jsxs(za,{children:[m.jsx(Fa,{children:m.jsx(Ba,{className:"text-foreground",children:"Add repository"})}),m.jsxs("div",{className:"flex flex-col gap-4 pt-2",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Repository URL"}),m.jsx(en,{placeholder:"https://github.com/org/repo",value:i,onChange:d=>o(d.target.value),className:"w-full text-foreground",onKeyDown:d=>d.key==="Enter"&&u()})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Branch"}),m.jsx(en,{placeholder:"main",value:a,onChange:d=>l(d.target.value),className:"w-full text-foreground",onKeyDown:d=>d.key==="Enter"&&u()})]}),m.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[m.jsx(Fe,{variant:"ghost",onClick:()=>r(!1),children:"Cancel"}),m.jsx(Fe,{className:"bg-cta-gradient text-black hover:opacity-90",onClick:u,disabled:!i.trim()||t.isPending,children:"Add"})]})]})]})})]})}function Fye(){return Bn({queryKey:["memory-stores"],queryFn:()=>Xe("/memory_stores?limit=50"),select:e=>e.data})}function Bye(){const e=hn();return Nn({mutationFn:t=>Xe("/memory_stores",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>e.invalidateQueries({queryKey:["memory-stores"]})})}function $ye(){const e=hn();return Nn({mutationFn:t=>Xe(\`/memory_stores/\${t}\`,{method:"DELETE"}),onSuccess:()=>e.invalidateQueries({queryKey:["memory-stores"]})})}function Uye(e){return Bn({queryKey:["memory-stores",e,"memories"],queryFn:()=>Xe(\`/memory_stores/\${e}/memories?limit=100\`),enabled:!!e,select:t=>t.data})}function Hye(){const e=hn();return Nn({mutationFn:({storeId:t,path:n,content:r})=>Xe(\`/memory_stores/\${t}/memories\`,{method:"POST",body:JSON.stringify({path:n,content:r})}),onSuccess:(t,n)=>e.invalidateQueries({queryKey:["memory-stores",n.storeId,"memories"]})})}function qye(){const e=hn();return Nn({mutationFn:({storeId:t,memoryId:n})=>Xe(\`/memory_stores/\${t}/memories/\${n}\`,{method:"DELETE"}),onSuccess:(t,n)=>e.invalidateQueries({queryKey:["memory-stores",n.storeId,"memories"]})})}function Vye(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return\`\${n}m ago\`;const r=Math.floor(n/60);return r<24?\`\${r}h ago\`:\`\${Math.floor(r/24)}d ago\`}function Kye(){const{data:e}=Fye(),t=$ye(),[n,r]=x.useState(!1),[i,o]=x.useState(null);return m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsx(Sc,{title:"Memory stores",description:"Persistent key-value stores for agent memory.",actionLabel:"New store",onAction:()=>r(!0)}),e&&e.length>0?m.jsx("div",{className:"rounded-lg border border-border",children:m.jsxs(eo,{children:[m.jsx(Jo,{children:m.jsxs(yn,{children:[m.jsx(et,{className:"w-8"}),m.jsx(et,{className:"w-[160px]",children:"ID"}),m.jsx(et,{children:"Name"}),m.jsx(et,{children:"Description"}),m.jsx(et,{children:"Created"}),m.jsx(et,{className:"w-[50px]"})]})}),m.jsx(to,{children:e.map(a=>m.jsxs(m.Fragment,{children:[m.jsxs(yn,{className:"cursor-pointer",onClick:()=>o(i===a.id?null:a.id),children:[m.jsx(Ue,{children:m.jsx(ew,{className:Ne("size-3.5 text-muted-foreground transition-transform",i===a.id&&"rotate-90")})}),m.jsxs(Ue,{className:"font-mono text-xs text-muted-foreground",children:[a.id.slice(0,18),"..."]}),m.jsx(Ue,{className:"font-medium text-foreground",children:a.name}),m.jsx(Ue,{className:"text-muted-foreground",children:a.description||"\u2014"}),m.jsx(Ue,{className:"text-sm text-muted-foreground",children:Vye(a.created_at)}),m.jsx(Ue,{children:m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-red-400/40 hover:text-red-400",onClick:l=>{l.stopPropagation(),t.mutate(a.id)},children:m.jsx(Mi,{className:"size-3.5"})})})]},a.id),i===a.id&&m.jsx(yn,{children:m.jsx(Ue,{colSpan:6,className:"bg-muted/50 p-4",children:m.jsx(Wye,{storeId:a.id})})},\`\${a.id}-memories\`)]}))})]})}):m.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No memory stores yet."}),m.jsx(Yye,{open:n,onOpenChange:r})]})}function Yye({open:e,onOpenChange:t}){const n=Bye(),[r,i]=x.useState(""),[o,a]=x.useState("");async function l(){r.trim()&&(await n.mutateAsync({name:r.trim(),description:o.trim()||void 0}),i(""),a(""),qe.success("Memory store created"),t(!1))}return m.jsx(ea,{open:e,onOpenChange:t,children:m.jsxs(za,{children:[m.jsx(Fa,{children:m.jsx(Ba,{className:"text-foreground",children:"New memory store"})}),m.jsxs("div",{className:"flex flex-col gap-4 pt-2",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Name"}),m.jsx(en,{placeholder:"my-store",value:r,onChange:u=>i(u.target.value),className:"w-full"})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Description"}),m.jsx(en,{placeholder:"Optional description",value:o,onChange:u=>a(u.target.value),className:"w-full"})]}),m.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[m.jsx(Fe,{variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),m.jsx(Fe,{className:"bg-cta-gradient text-black hover:opacity-90",onClick:l,disabled:!r.trim()||n.isPending,children:"Create"})]})]})]})})}function Wye({storeId:e}){const{data:t}=Uye(e),n=Hye(),r=qye(),[i,o]=x.useState(""),[a,l]=x.useState("");async function u(){!i.trim()||!a.trim()||(await n.mutateAsync({storeId:e,path:i.trim(),content:a.trim()}),o(""),l(""),qe.success("Memory created"))}return m.jsxs("div",{className:"flex flex-col gap-2",children:[t?.map(f=>m.jsxs("div",{className:"flex items-start gap-3 rounded-md bg-background px-3 py-2",children:[m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("p",{className:"font-mono text-xs text-lime-400/60",children:f.path}),m.jsxs("p",{className:"mt-1 text-xs text-muted-foreground whitespace-pre-wrap break-all",children:[f.content.slice(0,200),f.content.length>200?"...":""]})]}),m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-6 shrink-0 text-red-400/30 hover:text-red-400",onClick:()=>r.mutate({storeId:e,memoryId:f.id}),children:m.jsx(Mi,{className:"size-3"})})]},f.id)),m.jsxs("div",{className:"flex flex-col gap-2 pt-1",children:[m.jsx(en,{placeholder:"Path (e.g. notes/todo)",value:i,onChange:f=>o(f.target.value),className:"h-8 w-full font-mono text-xs"}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx(xw,{placeholder:"Content",value:a,onChange:f=>l(f.target.value),className:"min-h-[60px] w-full text-xs",rows:2}),m.jsx(Fe,{size:"icon",className:"size-8 shrink-0 self-end bg-cta-gradient text-black hover:opacity-90",onClick:u,children:m.jsx(bc,{className:"size-3"})})]})]})]})}function Gye(){return Bn({queryKey:["tenants"],queryFn:async()=>{try{return(await Xe("/tenants")).data}catch(e){const t=e?.status;if(t===403||t===404)return[];throw e}},staleTime:3e4})}function Xye(){const e=hn();return Nn({mutationFn:t=>Xe("/tenants",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>e.invalidateQueries({queryKey:["tenants"]})})}function Qye(){const e=hn();return Nn({mutationFn:({id:t,name:n})=>Xe(\`/tenants/\${t}\`,{method:"PATCH",body:JSON.stringify({name:n})}),onSuccess:()=>e.invalidateQueries({queryKey:["tenants"]})})}function Zye(){const e=hn();return Nn({mutationFn:t=>Xe(\`/tenants/\${t}\`,{method:"DELETE"}),onSuccess:()=>e.invalidateQueries({queryKey:["tenants"]})})}function Jye(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return\`\${n}m ago\`;const r=Math.floor(n/60);return r<24?\`\${r}h ago\`:\`\${Math.floor(r/24)}d ago\`}function exe(){const{data:e,isLoading:t,error:n}=Gye(),[r,i]=x.useState(!1),[o,a]=x.useState(null),l=n?.status,u=!t&&n!=null,f=l===401;return m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsx(Sc,{title:"Tenants",description:"Isolation boundary for agents, environments, vaults, sessions, and API keys. Only global admins can manage tenants.",actionLabel:e&&!u?"New tenant":void 0,onAction:()=>i(!0)}),u&&m.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border bg-card p-4",children:[m.jsx(t8,{className:"mt-0.5 size-4 text-muted-foreground"}),f?m.jsxs("p",{className:"text-sm text-muted-foreground",children:["Your API key isn't valid. Check the ",m.jsx("code",{className:"font-mono text-xs",children:"x-api-key"}),"value (or the one stored in this browser via ",m.jsx("code",{className:"font-mono text-xs",children:"localStorage.ma-api-key"}),") matches a row in the ",m.jsx("code",{className:"font-mono text-xs",children:"api_keys"})," table. A common cause is more than one ",m.jsx("code",{className:"font-mono text-xs",children:"SEED_API_KEY"})," line in ",m.jsx("code",{className:"font-mono text-xs",children:".env"})," \u2014 only the last one takes effect in ",m.jsx("code",{className:"font-mono text-xs",children:"process.env"}),", but only the first was actually seeded."]}):m.jsx("p",{className:"text-sm text-muted-foreground",children:"Tenant management requires a global admin API key. Your key is scoped to a tenant and can manage only resources within it."})]}),e&&e.length>0?m.jsx("div",{className:"rounded-lg border border-border",children:m.jsxs(eo,{children:[m.jsx(Jo,{children:m.jsxs(yn,{children:[m.jsx(et,{className:"w-[220px]",children:"ID"}),m.jsx(et,{children:"Name"}),m.jsx(et,{children:"Status"}),m.jsx(et,{children:"Created"}),m.jsx(et,{className:"w-[120px] text-right",children:"Actions"})]})}),m.jsx(to,{children:e.map(d=>m.jsx(txe,{tenant:d,onArchive:()=>a(d)},d.id))})]})}):!u&&!t?m.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No tenants yet. Create one to start isolating resources per team."}):null,m.jsx(nxe,{open:r,onOpenChange:i}),m.jsx(xh,{open:!!o,onOpenChange:d=>!d&&a(null),children:m.jsxs(bh,{children:[m.jsxs(wh,{children:[m.jsxs(Eh,{children:['Archive tenant "',o?.name,'"?']}),m.jsx(Ch,{children:"The tenant's existing resources (agents, environments, sessions, vaults, keys) stay in place but no new resources can be created under it. This action cannot be undone through the UI."})]}),m.jsxs(Sh,{children:[m.jsx(kh,{children:"Cancel"}),m.jsx(rxe,{tenant:o,onDone:()=>a(null)})]})]})})]})}function txe({tenant:e,onArchive:t}){const[n,r]=x.useState(!1),[i,o]=x.useState(e.name),a=Qye(),l=e.id==="tenant_default",u=!!e.archived_at;async function f(){if(!i.trim()||i===e.name){r(!1),o(e.name);return}try{await a.mutateAsync({id:e.id,name:i.trim()}),qe.success("Renamed"),r(!1)}catch(d){qe.error(d.message),o(e.name)}}return m.jsxs(yn,{children:[m.jsx(Ue,{children:m.jsx("code",{className:"text-xs text-muted-foreground",children:e.id})}),m.jsx(Ue,{children:n?m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx(en,{autoFocus:!0,value:i,onChange:d=>o(d.target.value),onKeyDown:d=>{d.key==="Enter"&&f(),d.key==="Escape"&&(r(!1),o(e.name))},className:"h-8 text-sm"}),m.jsx(Fe,{variant:"ghost",size:"icon",onClick:f,children:m.jsx(Aa,{className:"size-4"})}),m.jsx(Fe,{variant:"ghost",size:"icon",onClick:()=>{r(!1),o(e.name)},children:m.jsx(uc,{className:"size-4"})})]}):m.jsx("span",{className:"text-sm text-foreground",children:e.name})}),m.jsx(Ue,{children:u?m.jsx(an,{variant:"outline",className:"text-muted-foreground",children:"archived"}):l?m.jsx(an,{variant:"secondary",children:"default"}):m.jsx(an,{variant:"outline",className:"text-lime-500 border-lime-500/40",children:"active"})}),m.jsx(Ue,{className:"text-xs text-muted-foreground",children:Jye(e.created_at)}),m.jsx(Ue,{className:"text-right",children:!u&&m.jsxs("div",{className:"inline-flex gap-1",children:[m.jsx(Fe,{variant:"ghost",size:"icon",onClick:()=>r(!0),title:"Rename",children:m.jsx(r8,{className:"size-4"})}),!l&&m.jsx(Fe,{variant:"ghost",size:"icon",onClick:t,title:"Archive",children:m.jsx(eue,{className:"size-4 text-destructive"})})]})})]})}function nxe({open:e,onOpenChange:t}){const[n,r]=x.useState(""),[i,o]=x.useState(""),a=Xye();async function l(){if(n.trim())try{await a.mutateAsync({name:n.trim(),id:i.trim()||void 0}),qe.success("Tenant created"),r(""),o(""),t(!1)}catch(u){qe.error(u.message)}}return m.jsx(ea,{open:e,onOpenChange:t,children:m.jsxs(za,{children:[m.jsx(Fa,{children:m.jsx(Ba,{children:"New tenant"})}),m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsxs("div",{children:[m.jsx(wt,{htmlFor:"tenant-name",children:"Name"}),m.jsx(en,{id:"tenant-name",value:n,onChange:u=>r(u.target.value),placeholder:"acme",autoFocus:!0})]}),m.jsxs("div",{children:[m.jsxs(wt,{htmlFor:"tenant-id",children:["ID ",m.jsxs("span",{className:"text-muted-foreground",children:["(optional, must start with ",m.jsx("code",{className:"text-xs",children:"tenant_"}),")"]})]}),m.jsx(en,{id:"tenant-id",value:i,onChange:u=>o(u.target.value),placeholder:"tenant_acme"})]})]}),m.jsxs(mb,{children:[m.jsx(Fe,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),m.jsx(Fe,{onClick:l,disabled:!n.trim()||a.isPending,children:a.isPending?"Creating\u2026":"Create"})]})]})})}function rxe({tenant:e,onDone:t}){const n=Zye();async function r(){if(e)try{await n.mutateAsync(e.id),qe.success("Archived"),t()}catch(i){qe.error(i.message)}}return m.jsx(_h,{onClick:r,disabled:n.isPending,children:n.isPending?"Archiving\u2026":"Archive"})}function Kq(e){const{windowMs:t,groupBy:n="agent"}=e;return Bn({queryKey:["metrics","agent",t,n],queryFn:()=>{const r=Date.now(),i=r-t;return Xe(\`/metrics?group_by=\${n}&from=\${i}&to=\${r}\`)},refetchInterval:15e3})}function Yq(e){const{windowMinutes:t}=e;return Bn({queryKey:["metrics","api",t],queryFn:()=>Xe(\`/metrics/api?window_minutes=\${t}\`),refetchInterval:5e3})}function Wq({data:e,height:t=48,className:n,errors:r}){if(e.length===0)return m.jsx("div",{className:\`flex items-center justify-center text-xs text-muted-foreground/40 \${n??""}\`,style:{height:t},children:"no data"});const i=400,o=Math.max(...e,1),a=i/Math.max(e.length-1,1),l=e.map((d,h)=>\`\${(h*a).toFixed(1)},\${(t-d/o*(t-4)-2).toFixed(1)}\`).join(" "),u=\`M 0,\${t} L \${l} L \${i},\${t} Z\`,f=r?.map((d,h)=>{if(d===0)return null;const g=h*a,v=Math.max(2,d/o*(t-4));return m.jsx("rect",{x:g-1,y:t-v,width:2,height:v,fill:"currentColor",className:"text-destructive/70"},h)})??null;return m.jsxs("svg",{viewBox:\`0 0 \${i} \${t}\`,preserveAspectRatio:"none",className:\`w-full text-foreground \${n??""}\`,style:{height:t},children:[m.jsx("path",{d:u,className:"fill-primary/10"}),m.jsx("polyline",{points:l,fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-primary"}),f]})}function wb({data:e,limit:t=8,formatValue:n=r=>r.toLocaleString()}){if(e.length===0)return m.jsx("p",{className:"text-xs text-muted-foreground/50 italic",children:"no data"});const r=Math.max(...e.map(a=>a.value),1),i=e.slice(0,t),o=e.length-i.length;return m.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.map(a=>{const l=a.value/r*100;return m.jsxs("div",{className:"relative flex items-center text-xs",children:[m.jsx("div",{className:\`absolute inset-y-0 left-0 rounded-sm \${a.color??"bg-primary/10"}\`,style:{width:\`\${l}%\`}}),m.jsxs("div",{className:"relative z-10 flex w-full items-center justify-between gap-2 px-2 py-1",children:[m.jsx("span",{className:"truncate font-mono text-[11px] text-foreground",children:a.label}),m.jsxs("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:[n(a.value),a.subtitle&&m.jsx("span",{className:"ml-1.5 text-muted-foreground/60",children:a.subtitle})]})]})]},a.label)}),o>0&&m.jsxs("p",{className:"text-[11px] text-muted-foreground/50 px-2",children:["+ ",o," more"]})]})}function Ir({label:e,value:t,loading:n,tone:r="neutral",info:i}){const o=t===0||t==="0"||t==="\u2014";let a="text-foreground";return o||(r==="warn"?a="text-amber-500":r==="danger"?a="text-red-500":r==="accent"&&(a="text-lime-400")),m.jsx(fi,{size:"sm",className:"h-full",children:m.jsxs(Lr,{className:"flex h-full flex-col",children:[m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("p",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:e}),i&&m.jsxs(IT,{children:[m.jsx(DT,{render:l=>m.jsx("button",{...l,type:"button","aria-label":\`About \${e}\`,className:"text-muted-foreground/50 hover:text-muted-foreground transition-colors"}),children:m.jsx($T,{className:"size-3"})}),m.jsx(LT,{children:i})]})]}),m.jsx("p",{className:\`mt-auto pt-1 font-mono text-lg tabular-nums \${a} \${n?"opacity-40":""}\`,children:typeof t=="number"?t.toLocaleString():t})]})})}function SO(e){return e===0?"$0.00":e<.01?\`$\${e.toFixed(4)}\`:e<1?\`$\${e.toFixed(3)}\`:\`$\${e.toFixed(2)}\`}function EC({label:e,value:t}){return m.jsx(fi,{size:"sm",children:m.jsxs(Lr,{className:"text-center",children:[m.jsx("p",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:e}),m.jsxs("p",{className:"mt-1 font-mono text-2xl tabular-nums text-foreground",children:[t!=null?\`\${Math.round(t)}\`:"\u2014",t!=null&&m.jsx("span",{className:"ml-1 text-sm font-normal text-muted-foreground",children:"ms"})]})]})})}function ixe(e){switch(e){case"end_turn":return"bg-emerald-500/15";case"error":return"bg-red-500/15";case"interrupted":return"bg-amber-500/15";case"custom_tool_call":return"bg-sky-500/15";default:return"bg-primary/10"}}function oxe({windowMinutes:e}){const{data:t}=Hs(),n=Kq({windowMs:e*6e4,groupBy:"agent"}),r=i=>t?.find(o=>o.id===i)?.name??i.slice(0,16)+"\u2026";return m.jsxs("div",{children:[m.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-3 md:grid-cols-4",children:[m.jsx(Ir,{label:"Sessions",value:n.data?.totals.session_count??0,loading:n.isLoading}),m.jsx(Ir,{label:"Turns",value:n.data?.totals.turn_count??0,loading:n.isLoading}),m.jsx(Ir,{label:"Tool calls",value:n.data?.totals.tool_call_count??0,loading:n.isLoading}),m.jsx(Ir,{label:"Errors",value:n.data?.totals.error_count??0,loading:n.isLoading,tone:n.data&&n.data.totals.error_count>0?"warn":"neutral"}),m.jsx(Ir,{label:"Cost",value:SO(n.data?.totals.cost_usd??0),loading:n.isLoading}),m.jsx(Ir,{label:"Input tokens",value:n.data?.totals.input_tokens??0,loading:n.isLoading}),m.jsx(Ir,{label:"Output tokens",value:n.data?.totals.output_tokens??0,loading:n.isLoading}),m.jsx(Ir,{label:"Cache read",value:n.data?.totals.cache_read_input_tokens??0,loading:n.isLoading})]}),m.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[m.jsxs(fi,{children:[m.jsx(_s,{children:m.jsx(ks,{className:"text-sm",children:"Stop reasons"})}),m.jsx(Lr,{children:m.jsx(wb,{data:n.data?Object.entries(n.data.stop_reasons).map(([i,o])=>({label:i,value:o,color:ixe(i)})):[]})})]}),m.jsxs(fi,{children:[m.jsx(_s,{children:m.jsx(ks,{className:"text-sm",children:"Cost by agent"})}),m.jsx(Lr,{children:m.jsx(wb,{data:n.data?.groups.filter(i=>i.cost_usd>0).map(i=>({label:r(i.key),value:i.cost_usd,subtitle:\`\${i.turn_count}t\`}))??[],formatValue:SO})})]}),m.jsxs(fi,{className:"md:col-span-2",children:[m.jsx(_s,{children:m.jsxs(ks,{className:"text-sm",children:["Tool-call latency",m.jsxs("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:["(p50/p95/p99 over ",n.data?.tool_call_sample_count??0," samples)"]})]})}),m.jsx(Lr,{children:m.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[m.jsx(EC,{label:"p50",value:n.data?.tool_latency_p50_ms??null}),m.jsx(EC,{label:"p95",value:n.data?.tool_latency_p95_ms??null}),m.jsx(EC,{label:"p99",value:n.data?.tool_latency_p99_ms??null})]})})]})]})]})}function axe(e){return e==null?"":new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function sxe({windowMinutes:e}){const t=Math.min(e,60),n=Yq({windowMinutes:t});return m.jsxs("div",{children:[m.jsx("div",{className:"mb-3 flex items-center justify-end",children:m.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["last ",t," min \xB7 in-process"]})}),m.jsxs("div",{className:"mb-4 grid grid-cols-2 gap-3 md:grid-cols-5",children:[m.jsx(Ir,{label:"Requests",value:n.data?.totals.count??0,loading:n.isLoading}),m.jsx(Ir,{label:"Req / sec",value:(n.data?.totals.rps??0).toFixed(2),loading:n.isLoading}),m.jsx(Ir,{label:"p50",value:n.data?.totals.p50_ms!=null?\`\${Math.round(n.data.totals.p50_ms)} ms\`:"\u2014",loading:n.isLoading}),m.jsx(Ir,{label:"p95",value:n.data?.totals.p95_ms!=null?\`\${Math.round(n.data.totals.p95_ms)} ms\`:"\u2014",loading:n.isLoading}),m.jsx(Ir,{label:"Error rate",value:\`\${((n.data?.totals.error_rate??0)*100).toFixed(1)}%\`,loading:n.isLoading,tone:n.data&&n.data.totals.error_rate>.01?"warn":"neutral"})]}),m.jsxs(fi,{className:"mb-4",children:[m.jsx(_s,{children:m.jsx(ks,{className:"text-sm",children:"Requests per minute"})}),m.jsxs(Lr,{children:[m.jsx(Wq,{data:n.data?.timeline.map(r=>r.count)??[],errors:n.data?.timeline.map(r=>r.error_count)??[],height:96}),m.jsxs("div",{className:"mt-2 flex items-center justify-between text-[11px] text-muted-foreground",children:[m.jsx("span",{children:axe(n.data?.timeline[0]?.minute_ms)}),m.jsx("span",{children:"now"})]})]})]}),m.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[m.jsxs(fi,{children:[m.jsx(_s,{children:m.jsx(ks,{className:"text-sm",children:"By route"})}),m.jsx(Lr,{children:m.jsx(wb,{data:n.data?.routes.map(r=>({label:r.route,value:r.count,subtitle:r.p95_ms!=null?\`p95 \${Math.round(r.p95_ms)}ms\`:void 0}))??[],limit:10})})]}),m.jsxs(fi,{children:[m.jsx(_s,{children:m.jsx(ks,{className:"text-sm",children:"Status classes"})}),m.jsx(Lr,{children:m.jsx(wb,{data:n.data?[{label:"2xx",value:n.data.totals.status_2xx,color:"bg-emerald-500/15"},{label:"3xx",value:n.data.totals.status_3xx,color:"bg-sky-500/15"},{label:"4xx",value:n.data.totals.status_4xx,color:"bg-amber-500/15"},{label:"5xx",value:n.data.totals.status_5xx,color:"bg-red-500/15"}].filter(r=>r.value>0):[]})})]})]})]})}const lxe=[{label:"15 min",minutes:15},{label:"1 hour",minutes:60},{label:"6 hours",minutes:360},{label:"24 hours",minutes:1440}];function cxe(){const e=bn(r=>r.dashboardWindowMinutes),t=bn(r=>r.setDashboardWindowMinutes),{tab:n}=oT({from:"/analytics"});return m.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-6",children:[m.jsxs("div",{className:"flex items-center justify-between mb-6",children:[m.jsx("h1",{className:"text-xl font-semibold text-foreground",children:"Analytics"}),m.jsxs("div",{className:"flex items-center gap-1",children:[lxe.map(r=>m.jsx(Fe,{variant:e===r.minutes?"default":"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>t(r.minutes),children:r.label},r.minutes)),n==="api"&&e>60&&m.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(capped at 60 min)"})]})]}),n==="agents"?m.jsx(oxe,{windowMinutes:e}):m.jsx(sxe,{windowMinutes:e})]})}function bA({mode:e,onModeChange:t}){return m.jsxs("div",{className:"flex rounded-lg border border-border overflow-hidden",children:[m.jsx("button",{className:\`flex-1 px-3 py-1.5 text-sm font-medium transition-colors \${e==="select"?"bg-secondary text-foreground":"text-muted-foreground hover:text-foreground"}\`,onClick:()=>t("select"),children:"Use existing"}),m.jsx("button",{className:\`flex-1 px-3 py-1.5 text-sm font-medium transition-colors \${e==="create"?"bg-secondary text-foreground":"text-muted-foreground hover:text-foreground"}\`,onClick:()=>t("create"),children:"Create new"})]})}function uxe({onNext:e}){const{data:t,isLoading:n,isError:r}=Hs(),i=!n&&!r&&t&&t.length>0,[o,a]=x.useState("create"),[l,u]=x.useState(""),[f,d]=x.useState("my-agent"),[h,g]=x.useState("claude"),[v,b]=x.useState(Xd.claude[0]);x.useEffect(()=>{n||a(i?"select":"create")},[n,i]);function w(){if(o==="select"){const S=t?.find(E=>E.id===l);if(!S){qe.error("Please select an agent");return}e({mode:"select",agent:{id:S.id,name:S.name,engine:S.engine,model:S.model}})}else{if(!f.trim()){qe.error("Agent name is required");return}if(t?.some(S=>S.name.toLowerCase()===f.trim().toLowerCase())){qe.error(\`Agent "\${f.trim()}" already exists \u2014 pick a different name or select it\`);return}e({mode:"create",data:{name:f.trim(),engine:h,model:v}})}}return n?null:r?m.jsxs("div",{className:"w-full max-w-md flex flex-col gap-4",children:[m.jsx("p",{className:"text-sm text-destructive",children:"Failed to load agents. Check that the server is running."}),m.jsx(Fe,{variant:"outline",onClick:()=>window.location.reload(),children:"Retry"})]}):m.jsxs("div",{className:"w-full max-w-md flex flex-col gap-6",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-lime-400/60 mb-1",children:"Step 1 of 4"}),m.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Choose an Agent"}),m.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Select an existing agent or create a new one."})]}),i&&m.jsx(bA,{mode:o,onModeChange:a}),o==="select"&&i&&m.jsx("div",{className:"flex flex-col gap-3",children:m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Agent"}),m.jsxs(To,{value:l,onValueChange:S=>{S&&u(S)},children:[m.jsx(Ao,{className:"h-10 w-full text-foreground",children:m.jsx("span",{className:"truncate",children:t?.find(S=>S.id===l)?.name??"Select an agent"})}),m.jsx(No,{children:t.map(S=>m.jsxs(ai,{value:S.id,children:[S.name," ",m.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",S.engine,")"]})]},S.id))})]})]})}),o==="create"&&m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Name"}),m.jsx(en,{placeholder:"my-agent",value:f,onChange:S=>d(S.target.value),className:"h-10 w-full text-foreground"})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Engine"}),m.jsxs(To,{value:h,onValueChange:S=>{S&&(g(S),b(Xd[S]?.[0]??""))},children:[m.jsx(Ao,{className:"h-10 w-full text-foreground",children:m.jsx(Oh,{})}),m.jsx(No,{children:lA.map(S=>m.jsx(ai,{value:S,children:S},S))})]})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Model"}),m.jsx(pA,{engine:h,value:v,onChange:b})]})]}),m.jsx(Fe,{className:"w-full h-10 bg-cta-gradient text-sm font-medium text-black hover:opacity-90",onClick:w,disabled:o==="select"&&!l,children:"Continue"})]})}function wA(){return Bn({queryKey:["provider-status"],queryFn:()=>Xe("/providers/status"),select:e=>e.data,refetchInterval:15e3,refetchOnWindowFocus:!0})}const fxe={anthropic:"anthropic.com",docker:"docker.com","apple-container":"apple.com",podman:"podman.io",sprites:"sprites.dev",e2b:"e2b.dev",vercel:"vercel.com",daytona:"daytona.io",fly:"fly.io",modal:"modal.com"};function dxe({onNext:e,onBack:t,engine:n}){const{data:r,isLoading:i,isError:o}=nf(),{data:a}=wA(),l=n==="claude",u=r?.filter(A=>!(!(A.state==="ready"||A.state==="active"||A.state==="idle")||A.config?.provider==="anthropic"&&!l))??[],f=(r?.length??0)-u.length,d=!i&&!o&&(r?.length??0)>0,h=!i&&!o&&u.length>0,[g,v]=x.useState("create"),[b,w]=x.useState(""),[S,E]=x.useState("default"),[k,O]=x.useState("");x.useEffect(()=>{i||v(h?"select":"create")},[i,h]),x.useEffect(()=>{if(a&&!k){const T=[...Fm,...ju].filter(N=>N!=="anthropic"||l).find(N=>a[N]?.available);T&&O(T)}},[a,k,l]);function j(){if(g==="select"){const A=u.find(T=>T.id===b);if(!A){qe.error("Please select an environment");return}e({mode:"select",env:{id:A.id,name:A.name,provider:A.config?.provider||"unknown"}})}else{if(!S.trim()){qe.error("Environment name is required");return}if(!k){qe.error("Please select a provider");return}if(r?.some(A=>A.name.toLowerCase()===S.trim().toLowerCase())){qe.error(\`Environment "\${S.trim()}" already exists \u2014 pick a different name or select it\`);return}e({mode:"create",data:{name:S.trim(),provider:k}})}}return i?null:o?m.jsxs("div",{className:"w-full max-w-md flex flex-col gap-4",children:[m.jsx("p",{className:"text-sm text-destructive",children:"Failed to load environments. Check that the server is running."}),m.jsx(Fe,{variant:"outline",onClick:()=>window.location.reload(),children:"Retry"})]}):m.jsxs("div",{className:"w-full max-w-md flex flex-col gap-6",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-lime-400/60 mb-1",children:"Step 2 of 4"}),m.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Choose an Environment"}),m.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Select an existing environment or create a new one."})]}),f>0&&m.jsxs("p",{className:"text-xs text-muted-foreground rounded-md border border-amber-400/20 bg-amber-400/5 p-2",children:[f," existing environment",f>1?"s are":" is"," unavailable (unhealthy or incompatible with ",n??"this"," engine)."]}),d&&m.jsx(bA,{mode:g,onModeChange:v}),g==="select"&&!h&&d&&m.jsxs("p",{className:"text-xs text-muted-foreground text-center py-4",children:["No compatible environments for the ",n??"selected"," engine. Create a new one below."]}),g==="select"&&h&&m.jsx("div",{className:"flex flex-col gap-3",children:m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Environment"}),m.jsxs(To,{value:b,onValueChange:A=>{A&&w(A)},children:[m.jsx(Ao,{className:"h-10 w-full text-foreground",children:m.jsx("span",{className:"truncate",children:u.find(A=>A.id===b)?.name??"Select an environment"})}),m.jsx(No,{children:u.map(A=>m.jsxs(ai,{value:A.id,children:[A.name," ",m.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",A.config?.provider||"unknown",")"]})]},A.id))})]})]})}),g==="create"&&m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Name"}),m.jsx(en,{placeholder:"my-env",value:S,onChange:A=>E(A.target.value),className:"h-10 w-full text-foreground"})]}),m.jsx(Iz,{label:"Local",providers:Fm,providerStatus:a,selected:k,onSelect:O}),m.jsx(Iz,{label:"Cloud",providers:ju.filter(A=>A!=="anthropic"||l),providerStatus:a,selected:k,onSelect:O,cloud:!0})]}),m.jsxs("div",{className:"flex gap-2",children:[t&&m.jsx(Fe,{variant:"outline",className:"h-10 px-4 text-sm",onClick:t,children:"Back"}),m.jsx(Fe,{className:"flex-1 h-10 bg-cta-gradient text-sm font-medium text-black hover:opacity-90",onClick:j,disabled:g==="select"?!b:!S.trim()||!k,children:"Continue"})]})]})}function Iz({label:e,providers:t,providerStatus:n,selected:r,onSelect:i,cloud:o}){return m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx("p",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:e}),m.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:t.map(a=>{const l=n?.[a],u=o?!0:l?.available??!0,f=r===a;return m.jsxs("button",{disabled:!u,onClick:()=>u&&i(a),className:\`relative flex flex-col items-center justify-center rounded-lg border px-2 py-2.5 text-center transition-colors \${f?"border-lime-400/50 bg-lime-400/10":u?"border-border hover:border-muted-foreground/50":"border-border opacity-40 cursor-not-allowed"}\`,children:[f&&m.jsx(Aa,{className:"absolute top-1 right-1 size-3 text-lime-400"}),!o&&!u&&l?.message&&m.jsxs(IT,{children:[m.jsx(DT,{render:m.jsx("div",{className:"absolute top-1 left-1 rounded-full p-0.5 text-muted-foreground hover:text-foreground",onClick:d=>d.stopPropagation()}),children:m.jsx($T,{className:"size-3"})}),m.jsx(LT,{side:"top",className:"max-w-xs",children:m.jsx("p",{className:"text-xs",children:l.message})})]}),m.jsx("img",{src:\`https://www.google.com/s2/favicons?domain=\${fxe[a]??""}&sz=32\`,alt:"",className:"size-4 mb-1"}),m.jsx("span",{className:\`text-xs font-medium \${f||u?"text-foreground":"text-muted-foreground"}\`,children:a}),o&&m.jsx("span",{className:"text-[10px] text-muted-foreground mt-0.5",children:"API key required"}),!o&&!u&&m.jsx("span",{className:"text-[10px] text-destructive/70 mt-0.5",children:"Unavailable"})]},a)})})]})}function hxe({engine:e,model:t,provider:n,agentId:r,agentName:i,hasExistingVaults:o,onNext:a,onSkip:l,onSelectVault:u,onBack:f}){const[d,h]=x.useState({}),[g,v]=x.useState(""),b=i?\`\${i}-vault\`:"my-vault",[w,S]=x.useState(b),{data:E}=xA(),k=r?(E??[]).filter(B=>B.agent_id===r):[],O=new Set,j=k.filter(B=>O.has(B.name)?!1:(O.add(B.name),!0)),A=[],T=new Set;n==="anthropic"&&(A.push({key:"ANTHROPIC_API_KEY",label:"Anthropic API Key (required for hosted execution)"}),T.add("ANTHROPIC_API_KEY"));const N=wpe(e,t);N&&!T.has(N.key)&&(A.push(N),T.add(N.key));const P=G8[n];P&&!T.has(P.key)&&A.push({key:P.key,label:P.label});const F=o||j.length>0,[D,q]=x.useState(F?"select":"create");if(x.useEffect(()=>{F&&q("select")},[F]),A.length===0)return m.jsxs("div",{className:"w-full max-w-md flex flex-col gap-6",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-lime-400/60 mb-1",children:"Step 3 of 4"}),m.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Secrets"}),m.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t&&!t.includes("/")&&!["claude-","gpt-","o1-","o3-","codex-","gemini-"].some(B=>t.startsWith(B))?"No API key required \u2014 this model runs locally via Ollama.":"No API keys needed for this combination."})]}),m.jsxs("div",{className:"flex gap-2",children:[f&&m.jsx(Fe,{variant:"outline",className:"h-10 px-4 text-sm",onClick:f,children:"Back"}),m.jsx(Fe,{className:"flex-1 h-10 bg-cta-gradient text-sm font-medium text-black hover:opacity-90",onClick:l,children:"Continue"})]})]});const L=w.trim(),U=D==="create"&&L.length>0&&k.some(B=>B.name===L);function H(){if(D==="select")if(o)l();else{if(!g)return;const B=j.find(z=>z.id===g)?.name??g;u?.(g,B)}else{if(!L||U)return;a(d,L)}}return m.jsxs("div",{className:"w-full max-w-md flex flex-col gap-6",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-lime-400/60 mb-1",children:"Step 3 of 4"}),m.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Secrets"}),m.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:F?"Use existing secrets or enter new API keys.":"These keys will be stored securely in a vault."})]}),F&&m.jsx(bA,{mode:D,onModeChange:q}),D==="select"&&F&&m.jsx("div",{className:"flex flex-col gap-3",children:o?m.jsx("p",{className:"text-sm text-muted-foreground",children:"The agent's existing vault secrets will be used for this session."}):m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Vault"}),m.jsxs(To,{value:g,onValueChange:B=>{B&&v(B)},children:[m.jsx(Ao,{className:"h-10 w-full text-foreground",children:m.jsx("span",{className:"truncate",children:j.find(B=>B.id===g)?.name??"Select a vault"})}),m.jsx(No,{children:j.map(B=>m.jsxs(ai,{value:B.id,children:[B.name," ",m.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",B.entry_count," ",B.entry_count===1?"key":"keys",")"]})]},B.id))})]})]})}),D==="create"&&m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Vault name"}),m.jsx(en,{value:w,onChange:B=>S(B.target.value),placeholder:b,className:"h-10 w-full text-foreground border-border bg-muted text-sm placeholder:text-muted-foreground focus-visible:ring-ring"}),U&&m.jsxs("p",{className:"text-xs text-red-400",children:['A vault named "',L,'" already exists for this agent.']})]}),A.map(B=>m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:B.label}),m.jsx(en,{type:"password",placeholder:B.key==="ANTHROPIC_API_KEY"&&e==="claude"&&n!=="anthropic"?"ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN":B.key,value:d[B.key]||"",onChange:z=>h({...d,[B.key]:z.target.value}),className:"h-10 w-full text-foreground border-border bg-muted font-mono text-sm placeholder:text-muted-foreground focus-visible:ring-ring"})]},B.key))]}),m.jsxs("div",{className:"flex gap-2",children:[f&&m.jsx(Fe,{variant:"outline",className:"h-10 px-4 text-sm",onClick:f,children:"Back"}),m.jsx(Fe,{className:"flex-1 h-10 bg-cta-gradient text-sm font-medium text-black hover:opacity-90",onClick:H,disabled:D==="select"&&!o&&!g||D==="create"&&(!L||U),children:"Continue"})]})]})}function pxe({agentName:e,envName:t,secretsLabel:n,onStart:r,loading:i,error:o,isExistingAgent:a,isExistingEnv:l,onBack:u}){return m.jsxs("div",{className:"w-full max-w-md flex flex-col gap-6",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-lime-400/60 mb-1",children:"Step 4 of 4"}),m.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Ready to Go"}),m.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Everything is configured. Start your first session."})]}),m.jsxs("div",{className:"rounded-xl ring-1 ring-border bg-card p-4 flex flex-col gap-3",children:[m.jsx(CC,{label:"Agent",value:e,tag:a?"existing":"new"}),m.jsx("div",{className:"border-t border-border"}),m.jsx(CC,{label:"Environment",value:t,tag:l?"existing":"new"}),m.jsx("div",{className:"border-t border-border"}),m.jsx(CC,{label:"Secrets",value:n,tag:n!=="none"?"existing":void 0})]}),o&&m.jsx("p",{className:"text-sm text-destructive",children:o}),m.jsxs("div",{className:"flex gap-2",children:[u&&m.jsx(Fe,{variant:"outline",className:"h-10 px-4 text-sm",onClick:u,disabled:i,children:"Back"}),m.jsx(Fe,{className:"flex-1 h-10 bg-cta-gradient text-sm font-medium text-black hover:opacity-90",onClick:r,disabled:i,children:i?m.jsxs("span",{className:"flex items-center gap-2",children:[m.jsx(tw,{className:"size-4 animate-spin"}),"Starting session..."]}):"Start Session"})]})]})}function CC({label:e,value:t,tag:n}){return m.jsxs("div",{className:"flex justify-between text-sm",children:[m.jsx("span",{className:"text-muted-foreground",children:e}),m.jsxs("span",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"font-medium text-foreground",children:t}),n&&m.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["(",n,")"]})]})]})}function Gq(){const[e,t]=x.useState(0),[n,r]=x.useState(null),[i,o]=x.useState(null),[a,l]=x.useState({}),[u,f]=x.useState(""),[d,h]=x.useState(null),[g,v]=x.useState([]),[b,w]=x.useState(!1),[S,E]=x.useState(null),[k,O]=x.useState(null),[j,A]=x.useState(null),T=b8(),N=w8(),P=qq(),F=Vq(),D=S8(),q=Bs(),L=n?.mode==="select"?{name:n.agent.name,engine:n.agent.engine,model:n.agent.model}:n?.mode==="create"?n.data:{name:"",engine:"claude",model:""},U=i?.mode==="select"?{name:i.env.name,provider:i.env.provider}:i?.mode==="create"?i.data:{name:"",provider:"docker"},H=n?.mode==="select",B=i?.mode==="select";async function z($){if(r($),$.mode==="select")try{const X=(await Xe(\`/vaults?agent_id=\${$.agent.id}\`)).data.filter(W=>W.entry_count>0).map(W=>W.id);v(X)}catch{}else v([]);t(1)}function V($){o($),t(2)}function Q($,R){l($),f(R),h(null),t(3)}function G($,R){h({id:$,name:R}),l({}),t(3)}async function I(){if(!(!n||!i)){w(!0),E(null);try{let $;if(n.mode==="select")$=n.agent.id;else if(k)$=k;else{const oe=await T.mutateAsync(n.data);$=oe.id,O(oe.id)}let R;if(i.mode==="select")R=i.env.id;else if(j)R=j;else{const oe=await N.mutateAsync({name:i.data.name,config:{provider:i.data.provider}});R=oe.id,A(oe.id)}let X=[...g];if(d)X=[d.id];else{const oe=U.provider==="anthropic",ie=Object.entries(a).map(([J,se])=>[J,se.trim()]).filter(([,J])=>J.length>0).map(([J,se])=>{const xe=se.startsWith("sk-ant-oat");if(xe&&oe)throw new Error("OAuth tokens (sk-ant-oat) are not supported with the Anthropic provider. Use a regular API key (sk-ant-api03-...) instead.");return J==="ANTHROPIC_API_KEY"&&xe?["CLAUDE_CODE_OAUTH_TOKEN",se]:[J,se]});if(ie.length>0){let J;if(g.length>0)J=g[0];else{const se=u.trim()||"my-vault";try{const ne=(await Xe(\`/vaults?agent_id=\${$}\`)).data.find(ke=>ke.name===se);ne?J=ne.id:J=(await P.mutateAsync({name:se,agent_id:$})).id}catch{J=(await P.mutateAsync({name:\`\${se}-\${Date.now()}\`,agent_id:$})).id}}for(const[se,xe]of ie)await F.mutateAsync({vaultId:J,key:se,value:xe});X=[J]}}const W=await D.mutateAsync({agent_id:$,environment_id:R,vault_ids:X.length>0?X:void 0}),Z="as.first_session_shown";localStorage.getItem(Z)||(localStorage.setItem(Z,"1"),qe.success("Session started \u2014 try saying 'hi' in the chat.")),q({to:"/playground/$sessionId",params:{sessionId:W.id}})}catch($){const R=$?.body?.error?.message||($ instanceof Error?$.message:"Failed to start session");E(R),qe.error(R)}finally{w(!1)}}}function K(){if(d)return d.name;if(g.length>0)return"agent vault";const $=Object.entries(a).filter(([,R])=>R.trim());return $.length>0?\`\${$.length} key\${$.length>1?"s":""}\`:"none"}return m.jsxs("div",{className:"flex flex-1 items-center justify-center p-8",children:[e===0&&m.jsx(uxe,{onNext:z}),e===1&&m.jsx(dxe,{onNext:V,onBack:()=>t(0),engine:L.engine}),e===2&&m.jsx(hxe,{engine:L.engine,model:L.model,provider:U.provider,agentId:n?.mode==="select"?n.agent.id:null,agentName:L.name,hasExistingVaults:g.length>0,onNext:Q,onSkip:()=>t(3),onSelectVault:G,onBack:()=>t(1)}),e===3&&m.jsx(pxe,{agentName:L.name,envName:U.name,secretsLabel:K(),onStart:I,loading:b,error:S,isExistingAgent:H,isExistingEnv:B,onBack:()=>t(2)})]})}const mxe="0.4.16",gxe="https://github.com/agentstep/gateway",vxe={docker:"docker.com","apple-container":"apple.com",podman:"podman.io",sprites:"sprites.dev",e2b:"e2b.dev",vercel:"vercel.com",daytona:"daytona.io",fly:"fly.io",modal:"modal.com",anthropic:"anthropic.com"};function yxe(e){return e.length<=10?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022":\`\${e.slice(0,6)}\u2022\u2022\u2022\u2022\${e.slice(-4)}\`}function xxe({apiKey:e}){const{data:t}=wA(),[n,r]=x.useState(!1),[i,o]=x.useState(!1),[a,l]=x.useState(!1),u=\`curl http://localhost:4000/v1/agents \\\\
|
|
217007
216996
|
-H "x-api-key: \${e||"YOUR_API_KEY"}"\`;async function f(d,h){await navigator.clipboard.writeText(d),h==="key"?(o(!0),qe.success("API key copied"),setTimeout(()=>o(!1),2e3)):(l(!0),qe.success("Copied to clipboard"),setTimeout(()=>l(!1),2e3))}return m.jsxs("div",{className:"flex flex-col min-h-[calc(100vh-3rem)] mx-auto max-w-6xl w-full px-6 pt-16 pb-6",children:[m.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[1fr_360px] gap-8 items-start flex-1",children:[m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"size-2.5 rounded-full bg-lime-500 shrink-0"}),m.jsx("span",{className:"font-mono text-sm font-semibold tracking-tight",children:"agentstep"})]}),m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-foreground leading-tight",children:"Run AI agents in sandboxed environments."}),m.jsx("p",{className:"text-base text-muted-foreground",children:"Start a session below, or use the API."})]}),m.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[m.jsxs(ki,{to:"/quickstart",className:"inline-flex items-center h-10 px-5 rounded-lg bg-cta-gradient text-sm font-medium text-black hover:opacity-90 transition-opacity",children:[m.jsx(nw,{className:"size-4 mr-1.5"}),"Start Quickstart"]}),m.jsxs(ki,{to:"/docs",className:"inline-flex items-center h-10 px-5 rounded-lg ring-1 ring-foreground/10 text-sm font-medium text-foreground hover:bg-accent transition-colors",children:[m.jsx(XH,{className:"size-4 mr-1.5"}),"View API Docs"]})]}),m.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-muted-foreground font-mono",children:[m.jsx(tx,{num:"01",label:"Agent"}),m.jsx("span",{className:"text-muted-foreground/40",children:"\u2192"}),m.jsx(tx,{num:"02",label:"Environment"}),m.jsx("span",{className:"text-muted-foreground/40",children:"\u2192"}),m.jsx(tx,{num:"03",label:"Secrets"}),m.jsx("span",{className:"text-muted-foreground/40",children:"\u2192"}),m.jsx(tx,{num:"04",label:"Session"})]})]}),m.jsxs(fi,{className:"!py-0 divide-y divide-border",children:[m.jsxs(Lr,{className:"flex flex-col gap-2 py-4",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:"Test it"}),m.jsx("button",{onClick:()=>f(u,"curl"),className:"text-muted-foreground hover:text-foreground transition-colors",children:a?m.jsx(Aa,{className:"size-3.5"}):m.jsx(Du,{className:"size-3.5"})})]}),m.jsx("pre",{className:"font-mono text-[11px] text-foreground bg-muted rounded px-2 py-2 whitespace-pre-wrap break-all select-all leading-relaxed",children:u})]}),m.jsxs(Lr,{className:"flex flex-col gap-2 py-4",children:[m.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:"Providers"}),m.jsx("div",{className:"flex flex-wrap gap-1.5",children:[...Fm,...ju].map(d=>{const h=t?.[d],g=ju.includes(d)?!0:h?.available??!0,v=ju.includes(d);return m.jsxs("span",{title:h?.message??(v?"Configure API key to use":g?"Ready":"Not available"),className:\`inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-[11px] ring-1 \${v?"ring-foreground/10 text-muted-foreground":g?"ring-lime-400/20 bg-lime-400/5 text-foreground":"ring-foreground/10 text-muted-foreground opacity-50"}\`,children:[!v&&m.jsx("span",{className:\`size-1.5 rounded-full \${g?"bg-lime-400":"bg-muted-foreground/40"}\`}),m.jsx("img",{src:\`https://www.google.com/s2/favicons?domain=\${vxe[d]??""}&sz=16\`,alt:"",className:"size-3"}),d]},d)})})]}),m.jsxs(Lr,{className:"flex flex-col gap-2 py-4",children:[m.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:"API Key"}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("code",{className:"flex-1 font-mono text-[11px] text-foreground bg-muted rounded px-2 py-1.5 break-all select-all",children:e?n?e:yxe(e):"no key"}),m.jsx("button",{onClick:()=>r(d=>!d),className:"text-muted-foreground hover:text-foreground transition-colors",title:n?"Hide":"Reveal",children:n?m.jsx(zT,{className:"size-3.5"}):m.jsx(FT,{className:"size-3.5"})}),m.jsx("button",{onClick:()=>e&&f(e,"key"),className:"text-muted-foreground hover:text-foreground transition-colors",title:"Copy",disabled:!e,children:i?m.jsx(Aa,{className:"size-3.5"}):m.jsx(Du,{className:"size-3.5"})})]})]})]})]}),m.jsxs("div",{className:"mt-12 pt-6 flex items-center gap-4 text-[11px] text-muted-foreground",children:[m.jsx(ki,{to:"/docs",className:"hover:text-foreground transition-colors",children:"docs"}),m.jsx("span",{className:"text-muted-foreground/30",children:"\xB7"}),m.jsx("a",{href:gxe,target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"github"}),m.jsx("span",{className:"text-muted-foreground/30",children:"\xB7"}),m.jsxs("span",{className:"font-mono",children:["v",mxe]})]})]})}function tx({num:e,label:t}){return m.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[m.jsx("span",{className:"text-muted-foreground/60",children:e}),m.jsx("span",{className:"text-foreground",children:t})]})}function bxe(){return m.jsx("div",{className:"mx-auto max-w-6xl px-6 pt-16 pb-8",children:m.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[1fr_360px] gap-8 items-start animate-pulse",children:[m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsx("div",{className:"h-4 w-24 bg-muted rounded"}),m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsx("div",{className:"h-10 w-3/4 bg-muted rounded"}),m.jsx("div",{className:"h-5 w-1/2 bg-muted rounded"})]}),m.jsxs("div",{className:"flex gap-3",children:[m.jsx("div",{className:"h-10 w-40 bg-muted rounded-lg"}),m.jsx("div",{className:"h-10 w-32 bg-muted rounded-lg"})]})]}),m.jsx("div",{className:"h-72 bg-muted rounded-xl"})]})})}function wxe(e){return e.length<=10?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022":\`\${e.slice(0,6)}\u2022\u2022\u2022\u2022\${e.slice(-4)}\`}function Sxe({apiKey:e}){const[t,n]=x.useState(!1),[r,i]=x.useState(!1);async function o(){e&&(await navigator.clipboard.writeText(e),i(!0),qe.success("API key copied"),setTimeout(()=>i(!1),2e3))}return m.jsx(fi,{size:"sm",className:"mt-2",children:m.jsxs(Lr,{children:[m.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[m.jsx(UT,{className:"size-3.5"}),"API Key"]}),e?m.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[m.jsx("code",{className:"flex-1 rounded bg-muted px-2 py-1.5 font-mono text-xs text-foreground break-all select-all",children:t?e:wxe(e)}),m.jsx("button",{type:"button",onClick:()=>n(a=>!a),className:"text-muted-foreground hover:text-foreground transition-colors",title:t?"Hide":"Reveal",children:t?m.jsx(zT,{className:"size-3.5"}):m.jsx(FT,{className:"size-3.5"})}),m.jsx("button",{type:"button",onClick:o,className:"text-muted-foreground hover:text-foreground transition-colors",title:"Copy",children:r?m.jsx(Aa,{className:"size-3.5"}):m.jsx(Du,{className:"size-3.5"})})]}):m.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"No API key found"})]})})}function Exe(e){const t=typeof e=="string"?new Date(e).getTime():e,n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return\`\${r}m ago\`;const i=Math.floor(r/60);return i<24?\`\${i}h ago\`:\`\${Math.floor(i/24)}d ago\`}function Cxe(e){return e==="active"||e==="running"?m.jsx(an,{variant:"outline",className:"border-lime-400/20 bg-lime-400/10 text-lime-400 text-xs",children:e}):e==="error"||e==="failed"?m.jsx(an,{variant:"outline",className:"border-red-400/20 bg-red-400/10 text-red-400 text-xs",children:e}):m.jsx(an,{variant:"outline",className:"text-muted-foreground text-xs",children:e})}const Dz="as.hero_dismissed",_xe=900*1e3,Lz=60;function kxe(){const e=Bs(),t=Hs(),n=hw(),r=nf(),[i,o]=x.useState(()=>localStorage.getItem(Dz)==="1");x.useEffect(()=>{const H=()=>o(localStorage.getItem(Dz)==="1");return window.addEventListener("storage",H),()=>window.removeEventListener("storage",H)},[]);const a=t.data,l=n.data,u=r.data,f=a?.length??0,d=u?.length??0,h=l?.length??0,g=l?.filter(H=>H.status==="active"||H.status==="running").length??0,v=l?.slice(0,20)??[],b=window.__MA_API_KEY__??"",w=!t.isPending&&!n.isPending&&!r.isPending,S=t.isError||n.isError||r.isError,E=w&&!S&&h===0,k=w&&!E,O=Kq({windowMs:_xe,groupBy:"agent"}),j=Yq({windowMinutes:Lz});if(!w&&!S)return m.jsx(bxe,{});if(E&&!i)return m.jsx(xxe,{apiKey:b});const A=O.data?.totals,T=j.data?.totals,N=k&&(O.isPending||j.isPending),P=A?.turn_count??0,F=A?.error_count??0,D=A?.cost_usd??0,q=T?.count??0,L=F>5?"danger":F>0?"warn":"neutral",U=g>0?"accent":"neutral";return m.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-6",children:m.jsxs("div",{className:"grid grid-cols-3 gap-6 h-full",children:[m.jsxs("div",{className:"col-span-2 flex flex-col gap-6 min-h-0",children:[m.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[m.jsx(Ir,{label:"Active",value:g,tone:U,info:"Sessions currently running a turn. Counts sessions whose status is active or running."}),m.jsx(Ir,{label:"Turns / 15m",value:P,loading:N,info:"Agent turns completed in the last 15 minutes. A turn is one user-message \u2192 agent-response round (may include multiple tool calls)."}),m.jsx(Ir,{label:"Errors / 15m",value:F,tone:L,loading:N,info:"Agent turns that ended in an error stop reason over the last 15 minutes (separate from API 5xx errors)."}),m.jsx(Ir,{label:"Cost / 15m",value:SO(D),loading:N,info:"Estimated model cost accrued in the last 15 minutes, summed across all agents and sessions."})]}),m.jsx(ki,{to:"/analytics",search:{tab:"agents"},className:"block group",children:m.jsx(fi,{size:"sm",className:"transition-colors group-hover:ring-foreground/20",children:m.jsxs(Lr,{children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsxs("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:["Requests \u2014 last ",Lz," min"]}),m.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:[q.toLocaleString()," total"]})]}),m.jsx("div",{className:"mt-2",children:m.jsx(Wq,{data:j.data?.timeline.map(H=>H.count)??[],height:64})})]})})}),m.jsxs(fi,{className:"flex-1 flex flex-col min-h-0",children:[m.jsx(_s,{children:m.jsx(ks,{children:"Recent Activity"})}),m.jsx(Lr,{className:"flex-1 overflow-y-auto min-h-0",children:v.length>0?m.jsxs(eo,{children:[m.jsx(Jo,{children:m.jsxs(yn,{children:[m.jsx(et,{children:"Title"}),m.jsx(et,{children:"Agent"}),m.jsx(et,{children:"Status"}),m.jsx(et,{children:"Created"})]})}),m.jsx(to,{children:v.map(H=>{const B=a?.find(z=>z.id===H.agent?.id)?.name??H.agent?.id?.slice(0,8)??"\u2014";return m.jsxs(yn,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>e({to:"/playground/$sessionId",params:{sessionId:H.id}}),children:[m.jsx(Ue,{className:"font-medium",children:H.title??H.id.slice(0,12)+"\u2026"}),m.jsx(Ue,{className:"text-muted-foreground",children:B}),m.jsx(Ue,{children:Cxe(H.status)}),m.jsx(Ue,{className:"text-muted-foreground",children:Exe(H.created_at)})]},H.id)})})]}):m.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No sessions yet."})})]})]}),m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Quick Actions"}),m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsxs(ki,{to:"/agents",className:"flex items-center gap-3 rounded-xl p-3 text-sm font-medium text-foreground ring-1 ring-foreground/10 hover:bg-accent transition-colors",children:[m.jsx("span",{className:"text-muted-foreground",children:m.jsx(bc,{className:"size-4"})}),"Create Agent"]}),m.jsxs(ki,{to:"/environments",className:"flex items-center gap-3 rounded-xl p-3 text-sm font-medium text-foreground ring-1 ring-foreground/10 hover:bg-accent transition-colors",children:[m.jsx("span",{className:"text-muted-foreground",children:m.jsx(iw,{className:"size-4"})}),"Add Environment"]}),m.jsxs(ki,{to:"/playground",className:"flex items-center gap-3 rounded-xl p-3 text-sm font-medium text-foreground ring-1 ring-foreground/10 hover:bg-accent transition-colors",children:[m.jsx("span",{className:"text-muted-foreground",children:m.jsx(nw,{className:"size-4"})}),"Open Playground"]}),m.jsxs(ki,{to:"/quickstart",className:"flex items-center gap-3 rounded-xl p-3 text-sm font-medium text-foreground ring-1 ring-foreground/10 hover:bg-accent transition-colors",children:[m.jsx("span",{className:"text-muted-foreground",children:m.jsx(Tfe,{className:"size-4"})}),"Quick Start"]})]}),m.jsx(Sxe,{apiKey:b}),m.jsx(fi,{size:"sm",children:m.jsxs(Lr,{children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"System"}),m.jsxs(ki,{to:"/analytics",search:{tab:"agents"},className:"text-[10px] text-muted-foreground hover:text-foreground transition-colors flex items-center gap-0.5",children:["View analytics",m.jsx(rue,{className:"size-3"})]})]}),m.jsxs("div",{className:"mt-2 flex flex-col gap-1 text-[11px] font-mono",children:[m.jsxs("div",{className:"flex justify-between",children:[m.jsx("span",{className:"text-muted-foreground",children:"requests"}),m.jsxs("span",{className:"text-foreground tabular-nums",children:[q.toLocaleString()," ",m.jsx("span",{className:"text-muted-foreground",children:"(60m)"})]})]}),m.jsxs("div",{className:"flex justify-between",children:[m.jsx("span",{className:"text-muted-foreground",children:"errors"}),m.jsxs("span",{className:\`tabular-nums \${F>0?"text-amber-500":"text-foreground"}\`,children:[F," ",m.jsx("span",{className:"text-muted-foreground",children:"(15m)"})]})]}),m.jsxs("div",{className:"flex justify-between",children:[m.jsx("span",{className:"text-muted-foreground",children:"agents"}),m.jsx("span",{className:"text-foreground tabular-nums",children:f})]}),m.jsxs("div",{className:"flex justify-between",children:[m.jsx("span",{className:"text-muted-foreground",children:"environments"}),m.jsx("span",{className:"text-foreground tabular-nums",children:d})]})]})]})})]})]})})}function Oxe(e){const t=typeof e=="string"?new Date(e).getTime():e,n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return\`\${r}m ago\`;const i=Math.floor(r/60);return i<24?\`\${i}h ago\`:\`\${Math.floor(i/24)}d ago\`}function jxe(e){return e==="active"||e==="running"?m.jsx(an,{variant:"outline",className:"border-lime-400/20 bg-lime-400/10 text-lime-400 text-xs",children:e}):e==="error"||e==="failed"?m.jsx(an,{variant:"outline",className:"border-red-400/20 bg-red-400/10 text-red-400 text-xs",children:e}):m.jsx(an,{variant:"outline",className:"text-muted-foreground text-xs",children:e})}function Txe(){const{data:e}=hw(),{data:t}=Hs(),{data:n}=nf(),r=Bs();return m.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-6 flex flex-col gap-6",children:[m.jsx(Sc,{title:"Sessions",description:"View and manage agent sessions.",actionLabel:"New Session",onAction:()=>r({to:"/quickstart"})}),e&&e.length>0?m.jsx("div",{className:"rounded-lg border border-border",children:m.jsxs(eo,{children:[m.jsx(Jo,{children:m.jsxs(yn,{children:[m.jsx(et,{children:"Title"}),m.jsx(et,{children:"Agent"}),m.jsx(et,{children:"Environment"}),m.jsx(et,{children:"Status"}),m.jsx(et,{children:"Created"})]})}),m.jsx(to,{children:e.map(i=>{const o=t?.find(l=>l.id===i.agent?.id)?.name??i.agent?.id?.slice(0,8)??"\u2014",a=n?.find(l=>l.id===i.environment_id)?.name??i.environment_id?.slice(0,8)??"\u2014";return m.jsxs(yn,{className:"cursor-pointer hover:bg-accent/30",onClick:()=>r({to:"/playground/$sessionId",params:{sessionId:i.id}}),children:[m.jsx(Ue,{className:"font-medium text-foreground",children:i.title??i.id.slice(0,12)+"\u2026"}),m.jsx(Ue,{className:"text-sm text-muted-foreground",children:o}),m.jsx(Ue,{className:"text-sm text-muted-foreground",children:a}),m.jsx(Ue,{children:jxe(i.status)}),m.jsx(Ue,{className:"text-sm text-muted-foreground",children:Oxe(i.created_at)})]},i.id)})})]})}):m.jsx("p",{className:"py-10 text-center text-sm text-muted-foreground",children:"No sessions yet."})]})}function Xq(e){return Bn({queryKey:["events",e],queryFn:()=>Xe(\`/sessions/\${e}/events?limit=500&order=asc\`),enabled:!!e,select:t=>t.data})}const nx={user:"bg-blue-400/10 text-blue-400 border-blue-400/20",agent:"bg-lime-400/10 text-lime-400 border-lime-400/20",error:"bg-red-400/10 text-red-400 border-red-400/20",status:"bg-amber-400/10 text-amber-400 border-amber-400/20"};function Axe(e){return e.startsWith("user")?nx.user:e.startsWith("agent")?nx.agent:e.includes("error")?nx.error:e.includes("status")?nx.status:"bg-muted text-muted-foreground border-border"}function Nxe({event:e,prevEvent:t}){const[n,r]=x.useState(!1),{id:i,session_id:o,seq:a,type:l,processed_at:u,...f}=e,d=t?.processed_at?new Date(t.processed_at).getTime():0,h=e.processed_at?new Date(e.processed_at).getTime():0,g=d&&h?h-d:0,v=Rxe(e.type,e);return m.jsxs("div",{className:"border-b border-border",children:[m.jsxs("button",{className:"flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors hover:bg-muted overflow-hidden min-w-0",onClick:()=>r(!n),children:[m.jsx(ew,{className:Ne("size-3 shrink-0 text-muted-foreground/50 transition-transform",n&&"rotate-90")}),m.jsx("span",{className:"w-5 text-right font-mono text-xs text-muted-foreground",children:e.seq}),m.jsx(an,{variant:"outline",className:Ne("h-4 shrink-0 rounded px-1.5 font-mono text-xs font-medium whitespace-nowrap",Axe(e.type)),children:e.type}),m.jsx("span",{className:"w-0 flex-1 truncate text-xs text-muted-foreground",children:v}),g>0&&m.jsxs("span",{className:"shrink-0 font-mono text-xs text-muted-foreground/50",children:["+",g,"ms"]})]}),n&&m.jsxs("div",{className:"relative border-t border-border bg-muted px-4 py-3",children:[m.jsx(Fe,{variant:"ghost",size:"icon",className:"absolute right-2 top-2 size-5 text-muted-foreground/50 hover:text-muted-foreground",onClick:()=>navigator.clipboard.writeText(JSON.stringify(f,null,2)),children:m.jsx(Du,{className:"size-3"})}),m.jsx("pre",{className:"whitespace-pre-wrap break-all font-mono text-xs leading-relaxed text-muted-foreground",children:JSON.stringify(f,null,2)})]})]})}function Rxe(e,t){if(e==="user.message"||e==="agent.message"){const n=t.content;if(n&&Array.isArray(n))return n.filter(i=>i.type==="text").map(i=>i.text).join("").slice(0,100);if(typeof t.text=="string")return t.text.slice(0,100)}if(e==="agent.tool_use")return t.name||"tool";if(e.includes("error"))return t.error?.message||"";if(e.includes("status")){const n=t.stop_reason;return n&&typeof n=="object"?n.type||"":n||""}return""}function Qq(){const e=bn(i=>i.activeSessionId),{data:t}=Xq(e),n=x.useRef(null),r=t??[];return x.useEffect(()=>{n.current?.scrollIntoView({behavior:"smooth"})},[r.length]),e?m.jsxs("div",{className:"flex flex-col overflow-hidden",children:[m.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-1.5",children:[m.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[r.length," events"]}),m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-5 text-muted-foreground/50 hover:text-muted-foreground",onClick:()=>navigator.clipboard.writeText(JSON.stringify(r,null,2)),children:m.jsx(Du,{className:"size-3"})})]}),m.jsxs("div",{className:"flex-1 overflow-y-auto",children:[r.map((i,o)=>m.jsx(Nxe,{event:i,prevEvent:r[o-1]},i.id)),m.jsx("div",{ref:n})]})]}):m.jsx("p",{className:"p-3 text-xs text-muted-foreground/50",children:"No session selected"})}function Pxe(e){return e==="active"||e==="running"?m.jsx(an,{variant:"outline",className:"border-lime-400/20 bg-lime-400/10 text-lime-400 text-xs",children:e}):e==="error"||e==="failed"?m.jsx(an,{variant:"outline",className:"border-red-400/20 bg-red-400/10 text-red-400 text-xs",children:e}):m.jsx(an,{variant:"outline",className:"text-muted-foreground text-xs",children:e})}function Mxe({id:e}){const{data:t}=yh(e),{data:n}=Hs(),r=bn(o=>o.setActiveSessionId);x.useEffect(()=>{r(e)},[e,r]);const i=n?.find(o=>o.id===t?.agent?.id)?.name??t?.agent?.id?.slice(0,8)??"\u2014";return m.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-6 flex flex-col gap-4",children:[m.jsx("div",{children:m.jsxs(ki,{to:"/sessions",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[m.jsx(GH,{className:"size-3.5"}),"All Sessions"]})}),m.jsxs("div",{className:"flex items-start justify-between gap-4",children:[m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:t?.title??e.slice(0,12)+"\u2026"}),m.jsxs("p",{className:"text-sm text-muted-foreground",children:["Agent: ",m.jsx("span",{className:"text-foreground",children:i})]})]}),t&&Pxe(t.status)]}),m.jsx("div",{className:"rounded-lg border border-border overflow-hidden",style:{minHeight:400},children:m.jsx(Qq,{})})]})}const Zq=x.createContext(void 0);function SA(){const e=x.useContext(Zq);if(e===void 0)throw new Error(Xt(10));return e}const Ixe={value:()=>null},Dxe=x.forwardRef(function(t,n){const{render:r,className:i,disabled:o=!1,hiddenUntilFound:a,keepMounted:l,loopFocus:u=!0,onValueChange:f,multiple:d=!1,orientation:h="vertical",value:g,defaultValue:v,style:b,...w}=t,S=ef(),E=x.useMemo(()=>{if(g===void 0)return v??[]},[g,v]),k=Le(f),O=x.useRef([]),[j,A]=Lu({controlled:g,default:E,name:"Accordion",state:"value"}),T=Le((D,q)=>{const L=ct(Wo);if(d)if(q){const U=j.slice();if(U.push(D),k(U,L),L.isCanceled)return;A(U)}else{const U=j.filter(H=>H!==D);if(k(U,L),L.isCanceled)return;A(U)}else{const U=j[0]===D?[]:[D];if(k(U,L),L.isCanceled)return;A(U)}}),N=x.useMemo(()=>({value:j,disabled:o,orientation:h}),[j,o,h]),P=x.useMemo(()=>({accordionItemRefs:O,direction:S,disabled:o,handleValueChange:T,hiddenUntilFound:a??!1,keepMounted:l??!1,loopFocus:u,orientation:h,state:N,value:j}),[S,o,T,a,l,u,h,N,j]),F=vt("div",t,{state:N,ref:n,props:[{dir:S,role:"region"},w],stateAttributesMapping:Ixe});return m.jsx(Zq.Provider,{value:P,children:m.jsx(Pg,{elementsRef:O,children:F})})});function Lxe(e){const{open:t,defaultOpen:n,onOpenChange:r,disabled:i}=e,o=t!==void 0,[a,l]=Lu({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:u,setMounted:f,transitionStatus:d}=hh(a,!0,!0),[h,g]=x.useState(a),[{height:v,width:b},w]=x.useState({height:void 0,width:void 0}),S=Br(),[E,k]=x.useState(),O=E??S,[j,A]=x.useState(!1),[T,N]=x.useState(!1),P=x.useRef(null),F=x.useRef(null),D=x.useRef(null),q=x.useRef(null),L=H0(q,!1),U=Le(H=>{const B=!a,z=ct(ja,H.nativeEvent);if(r(B,z),z.isCanceled)return;const V=q.current;F.current==="css-animation"&&V!=null&&V.style.removeProperty("animation-name"),!j&&!T&&(F.current!=null&&F.current!=="css-animation"&&!u&&B&&f(!0),F.current==="css-animation"&&(!h&&B&&g(!0),!u&&B&&f(!0))),l(B),F.current==="none"&&u&&!B&&f(!1)});return Pe(()=>{o&&F.current==="none"&&!a&&f(!1)},[o,a,t,f]),x.useMemo(()=>({abortControllerRef:P,animationTypeRef:F,disabled:i,handleTrigger:U,height:v,mounted:u,open:a,panelId:O,panelRef:q,runOnceAnimationsFinish:L,setDimensions:w,setHiddenUntilFound:A,setKeepMounted:N,setMounted:f,setOpen:l,setPanelIdState:k,setVisible:g,transitionDimensionRef:D,transitionStatus:d,visible:h,width:b}),[P,F,i,U,v,u,a,O,q,L,w,A,N,f,l,g,D,d,h,b])}const Jq=x.createContext(void 0);function e9(){const e=x.useContext(Jq);if(e===void 0)throw new Error(Xt(15));return e}const t9=x.createContext(void 0);function EA(){const e=x.useContext(t9);if(e===void 0)throw new Error(Xt(9));return e}let gm=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Ns.startingStyle]="startingStyle",e[e.endingStyle=Ns.endingStyle]="endingStyle",e})({}),zxe=(function(e){return e.panelOpen="data-panel-open",e})({});const Fxe={[gm.open]:""},Bxe={[gm.closed]:""},$xe={open(e){return e?{[zxe.panelOpen]:""}:null}},Uxe={open(e){return e?Fxe:Bxe}};let Hxe=(function(e){return e.index="data-index",e.disabled="data-disabled",e.open="data-open",e})({});const CA={...Uxe,index:e=>Number.isInteger(e)?{[Hxe.index]:String(e)}:null,...$s,value:()=>null},qxe=x.forwardRef(function(t,n){const{className:r,disabled:i=!1,onOpenChange:o,render:a,value:l,style:u,...f}=t,{ref:d,index:h}=Rg(),g=Po(n,d),{disabled:v,handleValueChange:b,state:w,value:S}=SA(),E=Br(),k=l??E,O=i||v,j=x.useMemo(()=>{if(!S)return!1;for(let H=0;H<S.length;H+=1)if(S[H]===k)return!0;return!1},[S,k]),A=Le((H,B)=>{o?.(H,B),!B.isCanceled&&b(k,H)}),T=Lxe({open:j,onOpenChange:A,disabled:O}),N=x.useMemo(()=>({open:T.open,disabled:T.disabled,hidden:!T.mounted,transitionStatus:T.transitionStatus}),[T.open,T.disabled,T.mounted,T.transitionStatus]),P=x.useMemo(()=>({...T,onOpenChange:A,state:N}),[T,N,A]),F=x.useMemo(()=>({...w,index:h,disabled:O,open:j}),[O,h,j,w]),[D,q]=x.useState(Br()),L=x.useMemo(()=>({open:j,state:F,setTriggerId:q,triggerId:D}),[j,F,q,D]),U=vt("div",t,{state:F,ref:g,props:f,stateAttributesMapping:CA});return m.jsx(Jq.Provider,{value:P,children:m.jsx(t9.Provider,{value:L,children:U})})}),Vxe=x.forwardRef(function(t,n){const{render:r,className:i,style:o,...a}=t,{state:l}=EA();return vt("h3",t,{state:l,ref:n,props:a,stateAttributesMapping:CA})}),Kxe=new Set([vs,Jl,ec,zu,gh,vh]);function Yxe(e){const{current:t}=e,n=[];for(let r=0;r<t.length;r+=1){const i=t[r];if(!hO(i)){const o=i?.querySelector('[type="button"], [role="button"]');o&&!hO(o)&&n.push(o)}}return n}const Wxe=x.forwardRef(function(t,n){const{disabled:r,className:i,id:o,render:a,nativeButton:l=!0,style:u,...f}=t,{panelId:d,open:h,handleTrigger:g,disabled:v}=e9(),b=r??v,{getButtonProps:w,buttonRef:S}=Zo({disabled:b,focusableWhenDisabled:!0,native:l,composite:!0}),{accordionItemRefs:E,direction:k,loopFocus:O,orientation:j}=SA(),A=k==="rtl",T=j==="horizontal",{state:N,setTriggerId:P,triggerId:F}=EA();Pe(()=>(o&&P(o),()=>{P(void 0)}),[o,P]);const D=x.useMemo(()=>({"aria-controls":h?d:void 0,"aria-expanded":h,id:F,tabIndex:0,onClick:g,onKeyDown(L){if(!Kxe.has(L.key))return;_i(L);const U=Yxe(E),B=U.length-1;let z=-1;const V=U.indexOf(L.currentTarget);function Q(){O?z=V+1>B?0:V+1:z=Math.min(V+1,B)}function G(){O?z=V===0?B:V-1:z=V-1}switch(L.key){case vs:T||Q();break;case Jl:T||G();break;case ec:T&&(A?G():Q());break;case zu:T&&(A?Q():G());break;case"Home":z=0;break;case"End":z=B;break}z>-1&&U[z].focus()}}),[E,g,F,T,A,O,h,d]);return vt("button",t,{state:N,ref:[n,S],props:[D,f,w],stateAttributesMapping:$xe})});let Gxe=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e})({});function Xxe(e){const{abortControllerRef:t,animationTypeRef:n,externalRef:r,height:i,hiddenUntilFound:o,keepMounted:a,id:l,mounted:u,onOpenChange:f,open:d,panelRef:h,runOnceAnimationsFinish:g,setDimensions:v,setMounted:b,setOpen:w,setVisible:S,transitionDimensionRef:E,visible:k,width:O}=e,j=x.useRef(!1),A=x.useRef(null),T=x.useRef(d),N=x.useRef(d),P=Sg(),F=x.useMemo(()=>n.current==="css-animation"?!k:!d&&!u,[d,u,k,n]),D=Le(L=>{if(!L)return;if(n.current==null||E.current==null){const B=getComputedStyle(L),z=B.animationName!=="none"&&B.animationName!=="",V=B.transitionDuration!=="0s"&&B.transitionDuration!=="";z&&V||(B.animationName==="none"&&B.transitionDuration!=="0s"?n.current="css-transition":B.animationName!=="none"&&B.transitionDuration==="0s"?n.current="css-animation":n.current="none"),L.getAttribute(Gxe.orientation)==="horizontal"||B.transitionProperty.indexOf("width")>-1?E.current="width":E.current="height"}if(n.current!=="css-transition")return;(i===void 0||O===void 0)&&(v({height:L.scrollHeight,width:L.scrollWidth}),N.current&&L.style.setProperty("transition-duration","0s"));let U=-1,H=-1;return U=Vn.request(()=>{N.current=!1,H=Vn.request(()=>{setTimeout(()=>{L.style.removeProperty("transition-duration")})})}),()=>{Vn.cancel(U),Vn.cancel(H)}}),q=Po(r,h,D);return Pe(()=>{if(n.current!=="css-transition")return;const L=h.current;if(!L)return;let U=-1;if(t.current!=null&&(t.current.abort(),t.current=null),d){const H={"justify-content":L.style.justifyContent,"align-items":L.style.alignItems,"align-content":L.style.alignContent,"justify-items":L.style.justifyItems};Object.keys(H).forEach(B=>{L.style.setProperty(B,"initial","important")}),!N.current&&!a&&L.setAttribute(gm.startingStyle,""),v({height:L.scrollHeight,width:L.scrollWidth}),U=Vn.request(()=>{Object.entries(H).forEach(([B,z])=>{z===""?L.style.removeProperty(B):L.style.setProperty(B,z)})})}else{if(L.scrollHeight===0&&L.scrollWidth===0)return;v({height:L.scrollHeight,width:L.scrollWidth});const H=new AbortController;t.current=H;const B=H.signal;let z=null;const V=gm.endingStyle;return z=new MutationObserver(Q=>{Q.some(I=>I.type==="attributes"&&I.attributeName===V)&&(z?.disconnect(),z=null,g(()=>{v({height:0,width:0}),L.style.removeProperty("content-visibility"),b(!1),t.current===H&&(t.current=null)},B))}),z.observe(L,{attributes:!0,attributeFilter:[V]}),()=>{z?.disconnect(),P.cancel(),t.current===H&&(H.abort(),t.current=null)}}return()=>{Vn.cancel(U)}},[t,n,P,o,a,u,d,h,g,v,b]),Pe(()=>{if(n.current!=="css-animation")return;const L=h.current;L&&(A.current=L.style.animationName||A.current,L.style.setProperty("animation-name","none"),v({height:L.scrollHeight,width:L.scrollWidth}),!T.current&&!j.current&&L.style.removeProperty("animation-name"),d?(t.current!=null&&(t.current.abort(),t.current=null),b(!0),S(!0)):(t.current=new AbortController,g(()=>{b(!1),S(!1),t.current=null},t.current.signal)))},[t,n,d,h,g,v,b,S,k]),bg(()=>{const L=Vn.request(()=>{T.current=!1});return()=>Vn.cancel(L)}),Pe(()=>{if(!o)return;const L=h.current;if(!L)return;let U=-1,H=-1;return d&&j.current&&(L.style.transitionDuration="0s",v({height:L.scrollHeight,width:L.scrollWidth}),U=Vn.request(()=>{j.current=!1,H=Vn.request(()=>{setTimeout(()=>{L.style.removeProperty("transition-duration")})})})),()=>{Vn.cancel(U),Vn.cancel(H)}},[o,d,h,v]),Pe(()=>{const L=h.current;L&&o&&F&&(L.setAttribute("hidden","until-found"),n.current==="css-transition"&&L.setAttribute(gm.startingStyle,""))},[o,F,n,h]),x.useEffect(function(){const U=h.current;if(!U)return;function H(B){j.current=!0,w(!0),f(!0,ct(Wo,B))}return kt(U,"beforematch",H)},[f,h,w]),x.useMemo(()=>({props:{hidden:F,id:l,ref:q}}),[F,l,q])}let zz=(function(e){return e.accordionPanelHeight="--accordion-panel-height",e.accordionPanelWidth="--accordion-panel-width",e})({});const Qxe=x.forwardRef(function(t,n){const{className:r,hiddenUntilFound:i,keepMounted:o,id:a,render:l,style:u,...f}=t,{hiddenUntilFound:d,keepMounted:h}=SA(),{abortControllerRef:g,animationTypeRef:v,height:b,mounted:w,onOpenChange:S,open:E,panelId:k,panelRef:O,runOnceAnimationsFinish:j,setDimensions:A,setHiddenUntilFound:T,setKeepMounted:N,setMounted:P,setOpen:F,setVisible:D,transitionDimensionRef:q,visible:L,width:U,setPanelIdState:H,transitionStatus:B}=e9(),z=i??d,V=o??h;Pe(()=>{if(a)return H(a),()=>{H(void 0)}},[a,H]),Pe(()=>{T(z)},[T,z]),Pe(()=>{N(V)},[N,V]),Qo({open:E&&B==="idle",ref:O,onComplete(){E&&A({width:void 0,height:void 0})}});const{props:Q}=Xxe({abortControllerRef:g,animationTypeRef:v,externalRef:n,height:b,hiddenUntilFound:z,id:a??k,keepMounted:V,mounted:w,onOpenChange:S,open:E,panelRef:O,runOnceAnimationsFinish:j,setDimensions:A,setMounted:P,setOpen:F,setVisible:D,transitionDimensionRef:q,visible:L,width:U}),{state:G,triggerId:I}=EA(),K=x.useMemo(()=>({...G,transitionStatus:B}),[G,B]),$=vt("div",t,{state:K,ref:[n,O],props:[Q,{"aria-labelledby":I,role:"region",style:{[zz.accordionPanelHeight]:b===void 0?"auto":\`\${b}px\`,[zz.accordionPanelWidth]:U===void 0?"auto":\`\${U}px\`}},f],stateAttributesMapping:CA});return V||z||w?$:null});function _A({className:e,...t}){return m.jsx(Dxe,{"data-slot":"accordion",className:Ne("flex w-full flex-col",e),...t})}function vm({className:e,...t}){return m.jsx(qxe,{"data-slot":"accordion-item",className:Ne("not-last:border-b",e),...t})}function ym({className:e,children:t,...n}){return m.jsx(Vxe,{className:"flex",children:m.jsxs(Wxe,{"data-slot":"accordion-trigger",className:Ne("group/accordion-trigger relative flex flex-1 items-center justify-between py-2.5 text-left text-sm font-medium transition-colors outline-none hover:text-foreground focus-visible:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground",e),...n,children:[t,m.jsx(Tg,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"}),m.jsx(e8,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"})]})})}function xm({className:e,children:t,...n}){return m.jsx(Qxe,{"data-slot":"accordion-content",className:"overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up",...n,children:m.jsx("div",{className:Ne("h-(--accordion-panel-height) pt-0 pb-2.5 data-ending-style:h-0 data-starting-style:h-0 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",e),children:t})})}function Zxe(e){const t=hn(),n=x.useRef(null),r=x.useRef(0),i=x.useRef(1e3);x.useEffect(()=>{if(!e)return;r.current=0,i.current=1e3;function o(){n.current?.abort();const a=new AbortController;n.current=a;const l=bn.getState().apiKey,u=\`/v1/sessions/\${e}/events/stream?after_seq=\${r.current}\`;fetch(u,{signal:a.signal,headers:{"x-api-key":l}}).then(async f=>{if(!f.ok||!f.body){if(f.status===404){console.warn("[sse] session not found, stopping");return}throw new Error(\`SSE \${f.status}\`)}i.current=1e3;const d=f.body.getReader(),h=new TextDecoder;let g="";for(;;){const{done:v,value:b}=await d.read();if(v)break;g+=h.decode(b,{stream:!0});const w=g.split(\`
|
|
217008
216997
|
\`);g=w.pop()||"";for(const S of w)if(S.startsWith("data:"))try{const E=JSON.parse(S.slice(5).trimStart());r.current=Math.max(r.current,E.seq),t.setQueryData(["events",e],k=>k?k.data.some(j=>j.seq===E.seq)?k:{data:[...k.data,E]}:{data:[E]}),E.type.startsWith("session.status")&&(t.invalidateQueries({queryKey:["sessions",e]}),t.invalidateQueries({queryKey:["sessions"]}))}catch{}}}).catch(f=>{a.signal.aborted||console.warn("[sse] disconnected:",f)}).finally(()=>{if(a.signal.aborted)return;const f=i.current;i.current=Math.min(f*2,3e4),setTimeout(o,f)})}return o(),()=>n.current?.abort()},[e,t])}function Jxe(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const ebe=/^[$_\\p{ID_Start}][$_\\u{200C}\\u{200D}\\p{ID_Continue}]*$/u,tbe=/^[$_\\p{ID_Start}][-$_\\u{200C}\\u{200D}\\p{ID_Continue}]*$/u,nbe={};function Fz(e,t){return(nbe.jsx?tbe:ebe).test(e)}const rbe=/[ \\t\\n\\f\\r]/g;function ibe(e){return typeof e=="object"?e.type==="text"?Bz(e.value):!1:Bz(e)}function Bz(e){return e.replace(rbe,"")===""}class zg{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}zg.prototype.normal={};zg.prototype.property={};zg.prototype.space=void 0;function n9(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new zg(n,r,t)}function EO(e){return e.toLowerCase()}class Ii{constructor(t,n){this.attribute=n,this.property=t}}Ii.prototype.attribute="";Ii.prototype.booleanish=!1;Ii.prototype.boolean=!1;Ii.prototype.commaOrSpaceSeparated=!1;Ii.prototype.commaSeparated=!1;Ii.prototype.defined=!1;Ii.prototype.mustUseProperty=!1;Ii.prototype.number=!1;Ii.prototype.overloadedBoolean=!1;Ii.prototype.property="";Ii.prototype.spaceSeparated=!1;Ii.prototype.space=void 0;let obe=0;const _t=af(),ir=af(),CO=af(),Me=af(),Cn=af(),wd=af(),Vi=af();function af(){return 2**++obe}const _O=Object.freeze(Object.defineProperty({__proto__:null,boolean:_t,booleanish:ir,commaOrSpaceSeparated:Vi,commaSeparated:wd,number:Me,overloadedBoolean:CO,spaceSeparated:Cn},Symbol.toStringTag,{value:"Module"})),_C=Object.keys(_O);class kA extends Ii{constructor(t,n,r,i){let o=-1;if(super(t,n),$z(this,"space",i),typeof r=="number")for(;++o<_C.length;){const a=_C[o];$z(this,_C[o],(r&_O[a])===_O[a])}}}kA.prototype.defined=!0;function $z(e,t,n){n&&(e[t]=n)}function Th(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const o=new kA(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[EO(r)]=r,n[EO(o.attribute)]=r}return new zg(t,n,e.space)}const r9=Th({properties:{ariaActiveDescendant:null,ariaAtomic:ir,ariaAutoComplete:null,ariaBusy:ir,ariaChecked:ir,ariaColCount:Me,ariaColIndex:Me,ariaColSpan:Me,ariaControls:Cn,ariaCurrent:null,ariaDescribedBy:Cn,ariaDetails:null,ariaDisabled:ir,ariaDropEffect:Cn,ariaErrorMessage:null,ariaExpanded:ir,ariaFlowTo:Cn,ariaGrabbed:ir,ariaHasPopup:null,ariaHidden:ir,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Cn,ariaLevel:Me,ariaLive:null,ariaModal:ir,ariaMultiLine:ir,ariaMultiSelectable:ir,ariaOrientation:null,ariaOwns:Cn,ariaPlaceholder:null,ariaPosInSet:Me,ariaPressed:ir,ariaReadOnly:ir,ariaRelevant:null,ariaRequired:ir,ariaRoleDescription:Cn,ariaRowCount:Me,ariaRowIndex:Me,ariaRowSpan:Me,ariaSelected:ir,ariaSetSize:Me,ariaSort:null,ariaValueMax:Me,ariaValueMin:Me,ariaValueNow:Me,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function i9(e,t){return t in e?e[t]:t}function o9(e,t){return i9(e,t.toLowerCase())}const abe=Th({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:wd,acceptCharset:Cn,accessKey:Cn,action:null,allow:null,allowFullScreen:_t,allowPaymentRequest:_t,allowUserMedia:_t,alt:null,as:null,async:_t,autoCapitalize:null,autoComplete:Cn,autoFocus:_t,autoPlay:_t,blocking:Cn,capture:null,charSet:null,checked:_t,cite:null,className:Cn,cols:Me,colSpan:null,content:null,contentEditable:ir,controls:_t,controlsList:Cn,coords:Me|wd,crossOrigin:null,data:null,dateTime:null,decoding:null,default:_t,defer:_t,dir:null,dirName:null,disabled:_t,download:CO,draggable:ir,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:_t,formTarget:null,headers:Cn,height:Me,hidden:CO,high:Me,href:null,hrefLang:null,htmlFor:Cn,httpEquiv:Cn,id:null,imageSizes:null,imageSrcSet:null,inert:_t,inputMode:null,integrity:null,is:null,isMap:_t,itemId:null,itemProp:Cn,itemRef:Cn,itemScope:_t,itemType:Cn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:_t,low:Me,manifest:null,max:null,maxLength:Me,media:null,method:null,min:null,minLength:Me,multiple:_t,muted:_t,name:null,nonce:null,noModule:_t,noValidate:_t,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:_t,optimum:Me,pattern:null,ping:Cn,placeholder:null,playsInline:_t,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:_t,referrerPolicy:null,rel:Cn,required:_t,reversed:_t,rows:Me,rowSpan:Me,sandbox:Cn,scope:null,scoped:_t,seamless:_t,selected:_t,shadowRootClonable:_t,shadowRootDelegatesFocus:_t,shadowRootMode:null,shape:null,size:Me,sizes:null,slot:null,span:Me,spellCheck:ir,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Me,step:null,style:null,tabIndex:Me,target:null,title:null,translate:null,type:null,typeMustMatch:_t,useMap:null,value:ir,width:Me,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Cn,axis:null,background:null,bgColor:null,border:Me,borderColor:null,bottomMargin:Me,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:_t,declare:_t,event:null,face:null,frame:null,frameBorder:null,hSpace:Me,leftMargin:Me,link:null,longDesc:null,lowSrc:null,marginHeight:Me,marginWidth:Me,noResize:_t,noHref:_t,noShade:_t,noWrap:_t,object:null,profile:null,prompt:null,rev:null,rightMargin:Me,rules:null,scheme:null,scrolling:ir,standby:null,summary:null,text:null,topMargin:Me,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Me,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:_t,disableRemotePlayback:_t,prefix:null,property:null,results:Me,security:null,unselectable:null},space:"html",transform:o9}),sbe=Th({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Vi,accentHeight:Me,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Me,amplitude:Me,arabicForm:null,ascent:Me,attributeName:null,attributeType:null,azimuth:Me,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Me,by:null,calcMode:null,capHeight:Me,className:Cn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Me,diffuseConstant:Me,direction:null,display:null,dur:null,divisor:Me,dominantBaseline:null,download:_t,dx:null,dy:null,edgeMode:null,editable:null,elevation:Me,enableBackground:null,end:null,event:null,exponent:Me,externalResourcesRequired:null,fill:null,fillOpacity:Me,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:wd,g2:wd,glyphName:wd,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Me,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Me,horizOriginX:Me,horizOriginY:Me,id:null,ideographic:Me,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Me,k:Me,k1:Me,k2:Me,k3:Me,k4:Me,kernelMatrix:Vi,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Me,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Me,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Me,overlineThickness:Me,paintOrder:null,panose1:null,path:null,pathLength:Me,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Cn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Me,pointsAtY:Me,pointsAtZ:Me,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Vi,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Vi,rev:Vi,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Vi,requiredFeatures:Vi,requiredFonts:Vi,requiredFormats:Vi,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Me,specularExponent:Me,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Me,strikethroughThickness:Me,string:null,stroke:null,strokeDashArray:Vi,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Me,strokeOpacity:Me,strokeWidth:null,style:null,surfaceScale:Me,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Vi,tabIndex:Me,tableValues:null,target:null,targetX:Me,targetY:Me,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Vi,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Me,underlineThickness:Me,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Me,values:null,vAlphabetic:Me,vMathematical:Me,vectorEffect:null,vHanging:Me,vIdeographic:Me,version:null,vertAdvY:Me,vertOriginX:Me,vertOriginY:Me,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Me,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:i9}),a9=Th({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),s9=Th({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:o9}),l9=Th({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),lbe={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},cbe=/[A-Z]/g,Uz=/-[a-z]/g,ube=/^data[-\\w.:]+$/i;function fbe(e,t){const n=EO(t);let r=t,i=Ii;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ube.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Uz,hbe);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Uz.test(o)){let a=o.replace(cbe,dbe);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=kA}return new i(r,t)}function dbe(e){return"-"+e.toLowerCase()}function hbe(e){return e.charAt(1).toUpperCase()}const pbe=n9([r9,abe,a9,s9,l9],"html"),OA=n9([r9,sbe,a9,s9,l9],"svg");function mbe(e){return e.join(" ").trim()}var Jf={},kC,Hz;function gbe(){if(Hz)return kC;Hz=1;var e=/\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//g,t=/\\n/g,n=/^\\s*/,r=/^(\\*?[-#/*\\\\\\w]+(\\[[0-9a-z_-]+\\])?)\\s*/,i=/^:\\s*/,o=/^((?:'(?:\\\\'|.)*?'|"(?:\\\\"|.)*?"|\\([^)]*?\\)|[^};])+)/,a=/^[;\\s]*/,l=/^\\s+|\\s+$/g,u=\`
|
|
217009
216998
|
\`,f="/",d="*",h="",g="comment",v="declaration";function b(S,E){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];E=E||{};var k=1,O=1;function j(H){var B=H.match(t);B&&(k+=B.length);var z=H.lastIndexOf(u);O=~z?H.length-z:O+H.length}function A(){var H={line:k,column:O};return function(B){return B.position=new T(H),F(),B}}function T(H){this.start=H,this.end={line:k,column:O},this.source=E.source}T.prototype.content=S;function N(H){var B=new Error(E.source+":"+k+":"+O+": "+H);if(B.reason=H,B.filename=E.source,B.line=k,B.column=O,B.source=S,!E.silent)throw B}function P(H){var B=H.exec(S);if(B){var z=B[0];return j(z),S=S.slice(z.length),B}}function F(){P(n)}function D(H){var B;for(H=H||[];B=q();)B!==!1&&H.push(B);return H}function q(){var H=A();if(!(f!=S.charAt(0)||d!=S.charAt(1))){for(var B=2;h!=S.charAt(B)&&(d!=S.charAt(B)||f!=S.charAt(B+1));)++B;if(B+=2,h===S.charAt(B-1))return N("End of comment missing");var z=S.slice(2,B-2);return O+=2,j(z),S=S.slice(B),O+=2,H({type:g,comment:z})}}function L(){var H=A(),B=P(r);if(B){if(q(),!P(i))return N("property missing ':'");var z=P(o),V=H({type:v,property:w(B[0].replace(e,h)),value:z?w(z[0].replace(e,h)):h});return P(a),V}}function U(){var H=[];D(H);for(var B;B=L();)B!==!1&&(H.push(B),D(H));return H}return F(),U()}function w(S){return S?S.replace(l,h):h}return kC=b,kC}var qz;function vbe(){if(qz)return Jf;qz=1;var e=Jf&&Jf.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Jf,"__esModule",{value:!0}),Jf.default=n;const t=e(gbe());function n(r,i){let o=null;if(!r||typeof r!="string")return o;const a=(0,t.default)(r),l=typeof i=="function";return a.forEach(u=>{if(u.type!=="declaration")return;const{property:f,value:d}=u;l?i(f,d,u):d&&(o=o||{},o[f]=d)}),o}return Jf}var Hp={},Vz;function ybe(){if(Vz)return Hp;Vz=1,Object.defineProperty(Hp,"__esModule",{value:!0}),Hp.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(f){return!f||n.test(f)||e.test(f)},a=function(f,d){return d.toUpperCase()},l=function(f,d){return"".concat(d,"-")},u=function(f,d){return d===void 0&&(d={}),o(f)?f:(f=f.toLowerCase(),d.reactCompat?f=f.replace(i,l):f=f.replace(r,l),f.replace(t,a))};return Hp.camelCase=u,Hp}var qp,Kz;function xbe(){if(Kz)return qp;Kz=1;var e=qp&&qp.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(vbe()),n=ybe();function r(i,o){var a={};return!i||typeof i!="string"||(0,t.default)(i,function(l,u){l&&u&&(a[(0,n.camelCase)(l,o)]=u)}),a}return r.default=r,qp=r,qp}var bbe=xbe();const wbe=Xo(bbe),c9=u9("end"),jA=u9("start");function u9(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function f9(e){const t=jA(e),n=c9(e);if(t&&n)return{start:t,end:n}}function bm(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Yz(e.position):"start"in e||"end"in e?Yz(e):"line"in e||"column"in e?kO(e):""}function kO(e){return Wz(e&&e.line)+":"+Wz(e&&e.column)}function Yz(e){return kO(e&&e.start)+"-"+kO(e&&e.end)}function Wz(e){return e&&typeof e=="number"?e:1}class Zr extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?i=t:!o.cause&&t&&(a=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?o.ruleId=r:(o.source=r.slice(0,u),o.ruleId=r.slice(u+1))}if(!o.place&&o.ancestors&&o.ancestors){const u=o.ancestors[o.ancestors.length-1];u&&(o.place=u.position)}const l=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=bm(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Zr.prototype.file="";Zr.prototype.name="";Zr.prototype.reason="";Zr.prototype.message="";Zr.prototype.stack="";Zr.prototype.column=void 0;Zr.prototype.line=void 0;Zr.prototype.ancestors=void 0;Zr.prototype.cause=void 0;Zr.prototype.fatal=void 0;Zr.prototype.place=void 0;Zr.prototype.ruleId=void 0;Zr.prototype.source=void 0;const TA={}.hasOwnProperty,Sbe=new Map,Ebe=/[A-Z]/g,Cbe=new Set(["table","tbody","thead","tfoot","tr"]),_be=new Set(["td","th"]),d9="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function kbe(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected \`Fragment\` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected \`jsxDEV\` in options when \`development: true\`");r=Mbe(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected \`jsx\` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected \`jsxs\` in production options");r=Pbe(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?OA:pbe,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=h9(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function h9(e,t,n){if(t.type==="element")return Obe(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return jbe(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Abe(e,t,n);if(t.type==="mdxjsEsm")return Tbe(e,t);if(t.type==="root")return Nbe(e,t,n);if(t.type==="text")return Rbe(e,t)}function Obe(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=OA,e.schema=i),e.ancestors.push(t);const o=m9(e,t.tagName,!1),a=Ibe(e,t);let l=NA(e,t);return Cbe.has(t.tagName)&&(l=l.filter(function(u){return typeof u=="string"?!ibe(u):!0})),p9(e,a,o,t),AA(a,l),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function jbe(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Um(e,t.position)}function Tbe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Um(e,t.position)}function Abe(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=OA,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:m9(e,t.name,!0),a=Dbe(e,t),l=NA(e,t);return p9(e,a,o,t),AA(a,l),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function Nbe(e,t,n){const r={};return AA(r,NA(e,t)),e.create(t,e.Fragment,r,n)}function Rbe(e,t){return t.value}function p9(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function AA(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Pbe(e,t,n){return r;function r(i,o,a,l){const f=Array.isArray(a.children)?n:t;return l?f(o,a,l):f(o,a)}}function Mbe(e,t){return n;function n(r,i,o,a){const l=Array.isArray(o.children),u=jA(r);return t(i,o,a,l,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function Ibe(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&TA.call(t.properties,i)){const o=Lbe(e,i,t.properties[i]);if(o){const[a,l]=o;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&_be.has(t.tagName)?r=l:n[a]=l}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Dbe(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const a=o.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Um(e,t.position);else{const i=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,o=e.evaluater.evaluateExpression(l.expression)}else Um(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function NA(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:Sbe;for(;++r<t.children.length;){const o=t.children[r];let a;if(e.passKeys){const u=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(u){const f=i.get(u)||0;a=u+"-"+f,i.set(u,f+1)}}const l=h9(e,o,a);l!==void 0&&n.push(l)}return n}function Lbe(e,t,n){const r=fbe(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Jxe(n):mbe(n)),r.property==="style"){let i=typeof n=="object"?n:zbe(e,String(n));return e.stylePropertyNameCase==="css"&&(i=Fbe(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?lbe[r.property]||r.property:r.attribute,n]}}function zbe(e,t){try{return wbe(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Zr("Cannot parse \`style\` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=d9+"#cannot-parse-style-attribute",i}}function m9(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let o=-1,a;for(;++o<i.length;){const l=Fz(i[o])?{type:"Identifier",name:i[o]}:{type:"Literal",value:i[o]};a=a?{type:"MemberExpression",object:a,property:l,computed:!!(o&&l.type==="Literal"),optional:!1}:l}r=a}else r=Fz(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return TA.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);Um(e)}function Um(e,t){const n=new Zr("Cannot handle MDX estrees without \`createEvaluater\`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=d9+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Fbe(e){const t={};let n;for(n in e)TA.call(e,n)&&(t[Bbe(n)]=e[n]);return t}function Bbe(e){let t=e.replace(Ebe,$be);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function $be(e){return"-"+e.toLowerCase()}const OC={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Ube={};function RA(e,t){const n=Ube,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return g9(e,r,i)}function g9(e,t,n){if(Hbe(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Gz(e.children,t,n)}return Array.isArray(e)?Gz(e,t,n):""}function Gz(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=g9(e[i],t,n);return r.join("")}function Hbe(e){return!!(e&&typeof e=="object")}const Xz=document.createElement("i");function PA(e){const t="&"+e+";";Xz.innerHTML=t;const n=Xz.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Qi(e,t,n,r){const i=e.length;let o=0,a;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);o<r.length;)a=r.slice(o,o+1e4),a.unshift(t,0),e.splice(...a),o+=1e4,t+=1e4}function So(e,t){return e.length>0?(Qi(e,e.length,0,t),e):t}const Qz={}.hasOwnProperty;function v9(e){const t={};let n=-1;for(;++n<e.length;)qbe(t,e[n]);return t}function qbe(e,t){let n;for(n in t){const i=(Qz.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let a;if(o)for(a in o){Qz.call(i,a)||(i[a]=[]);const l=o[a];Vbe(i[a],Array.isArray(l)?l:l?[l]:[])}}}function Vbe(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Qi(e,0,0,r)}function y9(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"\uFFFD":String.fromCodePoint(n)}function Yo(e){return e.replace(/[\\t\\n\\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const si=Ec(/[A-Za-z]/),Gr=Ec(/[\\dA-Za-z]/),Kbe=Ec(/[#-'*+\\--9=?A-Z^-~]/);function Sb(e){return e!==null&&(e<32||e===127)}const OO=Ec(/\\d/),Ybe=Ec(/[\\dA-Fa-f]/),Wbe=Ec(/[!-/:-@[-\`{-~]/);function ft(e){return e!==null&&e<-2}function Sn(e){return e!==null&&(e<0||e===32)}function Lt(e){return e===-2||e===-1||e===32}const ww=Ec(/\\p{P}|\\p{S}/u),$u=Ec(/\\s/);function Ec(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ah(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let a="";if(o===37&&Gr(e.charCodeAt(n+1))&&Gr(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(a=String.fromCharCode(o));else if(o>55295&&o<57344){const l=e.charCodeAt(n+1);o<56320&&l>56319&&l<57344?(a=String.fromCharCode(o,l),i=1):a="\uFFFD"}else a=String.fromCharCode(o);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Yt(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(u){return Lt(u)?(e.enter(n),l(u)):t(u)}function l(u){return Lt(u)&&o++<i?(e.consume(u),l):(e.exit(n),t(u))}}const Gbe={tokenize:Xbe};function Xbe(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Yt(e,t,"linePrefix")}function i(l){return e.enter("paragraph"),o(l)}function o(l){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,a(l)}function a(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return ft(l)?(e.consume(l),e.exit("chunkText"),o):(e.consume(l),a)}}const Qbe={tokenize:Zbe},Zz={tokenize:Jbe};function Zbe(e){const t=this,n=[];let r=0,i,o,a;return l;function l(O){if(r<n.length){const j=n[r];return t.containerState=j[1],e.attempt(j[0].continuation,u,f)(O)}return f(O)}function u(O){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&k();const j=t.events.length;let A=j,T;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){T=t.events[A][1].end;break}E(r);let N=j;for(;N<t.events.length;)t.events[N][1].end={...T},N++;return Qi(t.events,A+1,0,t.events.slice(j)),t.events.length=N,f(O)}return l(O)}function f(O){if(r===n.length){if(!i)return g(O);if(i.currentConstruct&&i.currentConstruct.concrete)return b(O);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Zz,d,h)(O)}function d(O){return i&&k(),E(r),g(O)}function h(O){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,b(O)}function g(O){return t.containerState={},e.attempt(Zz,v,b)(O)}function v(O){return r++,n.push([t.currentConstruct,t.containerState]),g(O)}function b(O){if(O===null){i&&k(),E(0),e.consume(O);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),w(O)}function w(O){if(O===null){S(e.exit("chunkFlow"),!0),E(0),e.consume(O);return}return ft(O)?(e.consume(O),S(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(O),w)}function S(O,j){const A=t.sliceStream(O);if(j&&A.push(null),O.previous=o,o&&(o.next=O),o=O,i.defineSkip(O.start),i.write(A),t.parser.lazy[O.start.line]){let T=i.events.length;for(;T--;)if(i.events[T][1].start.offset<a&&(!i.events[T][1].end||i.events[T][1].end.offset>a))return;const N=t.events.length;let P=N,F,D;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){if(F){D=t.events[P][1].end;break}F=!0}for(E(r),T=N;T<t.events.length;)t.events[T][1].end={...D},T++;Qi(t.events,P+1,0,t.events.slice(N)),t.events.length=T}}function E(O){let j=n.length;for(;j-- >O;){const A=n[j];t.containerState=A[1],A[0].exit.call(t,e)}n.length=O}function k(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Jbe(e,t,n){return Yt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Qd(e){if(e===null||Sn(e)||$u(e))return 1;if(ww(e))return 2}function Sw(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const jO={name:"attention",resolveAll:e0e,tokenize:t0e};function e0e(e,t){let n=-1,r,i,o,a,l,u,f,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;u=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[r][1].end},g={...e[n][1].start};Jz(h,-u),Jz(g,u),a={type:u>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},l={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:g},o={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:u>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},e[r][1].end={...a.start},e[n][1].start={...l.end},f=[],e[r][1].end.offset-e[r][1].start.offset&&(f=So(f,[["enter",e[r][1],t],["exit",e[r][1],t]])),f=So(f,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",o,t]]),f=So(f,Sw(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),f=So(f,[["exit",o,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,f=So(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Qi(e,r-1,n-r+3,f),n=r+f.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function t0e(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Qd(r);let o;return a;function a(u){return o=u,e.enter("attentionSequence"),l(u)}function l(u){if(u===o)return e.consume(u),l;const f=e.exit("attentionSequence"),d=Qd(u),h=!d||d===2&&i||n.includes(u),g=!i||i===2&&d||n.includes(r);return f._open=!!(o===42?h:h&&(i||!g)),f._close=!!(o===42?g:g&&(d||!h)),t(u)}}function Jz(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const n0e={name:"autolink",tokenize:r0e};function r0e(e,t,n){let r=0;return i;function i(v){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(v){return si(v)?(e.consume(v),a):v===64?n(v):f(v)}function a(v){return v===43||v===45||v===46||Gr(v)?(r=1,l(v)):f(v)}function l(v){return v===58?(e.consume(v),r=0,u):(v===43||v===45||v===46||Gr(v))&&r++<32?(e.consume(v),l):(r=0,f(v))}function u(v){return v===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):v===null||v===32||v===60||Sb(v)?n(v):(e.consume(v),u)}function f(v){return v===64?(e.consume(v),d):Kbe(v)?(e.consume(v),f):n(v)}function d(v){return Gr(v)?h(v):n(v)}function h(v){return v===46?(e.consume(v),r=0,d):v===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):g(v)}function g(v){if((v===45||Gr(v))&&r++<63){const b=v===45?g:h;return e.consume(v),b}return n(v)}}const Fg={partial:!0,tokenize:i0e};function i0e(e,t,n){return r;function r(o){return Lt(o)?Yt(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||ft(o)?t(o):n(o)}}const x9={continuation:{tokenize:a0e},exit:s0e,name:"blockQuote",tokenize:o0e};function o0e(e,t,n){const r=this;return i;function i(a){if(a===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),o}return n(a)}function o(a){return Lt(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function a0e(e,t,n){const r=this;return i;function i(a){return Lt(a)?Yt(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):o(a)}function o(a){return e.attempt(x9,t,n)(a)}}function s0e(e){e.exit("blockQuote")}const b9={name:"characterEscape",tokenize:l0e};function l0e(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return Wbe(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const w9={name:"characterReference",tokenize:c0e};function c0e(e,t,n){const r=this;let i=0,o,a;return l;function l(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),u}function u(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),o=31,a=Gr,d(h))}function f(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,a=Ybe,d):(e.enter("characterReferenceValue"),o=7,a=OO,d(h))}function d(h){if(h===59&&i){const g=e.exit("characterReferenceValue");return a===Gr&&!PA(r.sliceSerialize(g))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(h)&&i++<o?(e.consume(h),d):n(h)}}const e4={partial:!0,tokenize:f0e},t4={concrete:!0,name:"codeFenced",tokenize:u0e};function u0e(e,t,n){const r=this,i={partial:!0,tokenize:A};let o=0,a=0,l;return u;function u(T){return f(T)}function f(T){const N=r.events[r.events.length-1];return o=N&&N[1].type==="linePrefix"?N[2].sliceSerialize(N[1],!0).length:0,l=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(T)}function d(T){return T===l?(a++,e.consume(T),d):a<3?n(T):(e.exit("codeFencedFenceSequence"),Lt(T)?Yt(e,h,"whitespace")(T):h(T))}function h(T){return T===null||ft(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(e4,w,j)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),g(T))}function g(T){return T===null||ft(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(T)):Lt(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Yt(e,v,"whitespace")(T)):T===96&&T===l?n(T):(e.consume(T),g)}function v(T){return T===null||ft(T)?h(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),b(T))}function b(T){return T===null||ft(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(T)):T===96&&T===l?n(T):(e.consume(T),b)}function w(T){return e.attempt(i,j,S)(T)}function S(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),E}function E(T){return o>0&&Lt(T)?Yt(e,k,"linePrefix",o+1)(T):k(T)}function k(T){return T===null||ft(T)?e.check(e4,w,j)(T):(e.enter("codeFlowValue"),O(T))}function O(T){return T===null||ft(T)?(e.exit("codeFlowValue"),k(T)):(e.consume(T),O)}function j(T){return e.exit("codeFenced"),t(T)}function A(T,N,P){let F=0;return D;function D(B){return T.enter("lineEnding"),T.consume(B),T.exit("lineEnding"),q}function q(B){return T.enter("codeFencedFence"),Lt(B)?Yt(T,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):L(B)}function L(B){return B===l?(T.enter("codeFencedFenceSequence"),U(B)):P(B)}function U(B){return B===l?(F++,T.consume(B),U):F>=a?(T.exit("codeFencedFenceSequence"),Lt(B)?Yt(T,H,"whitespace")(B):H(B)):P(B)}function H(B){return B===null||ft(B)?(T.exit("codeFencedFence"),N(B)):P(B)}}}function f0e(e,t,n){const r=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const jC={name:"codeIndented",tokenize:h0e},d0e={partial:!0,tokenize:p0e};function h0e(e,t,n){const r=this;return i;function i(f){return e.enter("codeIndented"),Yt(e,o,"linePrefix",5)(f)}function o(f){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(f):n(f)}function a(f){return f===null?u(f):ft(f)?e.attempt(d0e,a,u)(f):(e.enter("codeFlowValue"),l(f))}function l(f){return f===null||ft(f)?(e.exit("codeFlowValue"),a(f)):(e.consume(f),l)}function u(f){return e.exit("codeIndented"),t(f)}}function p0e(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):ft(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):Yt(e,o,"linePrefix",5)(a)}function o(a){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):ft(a)?i(a):n(a)}}const m0e={name:"codeText",previous:v0e,resolve:g0e,tokenize:y0e};function g0e(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function v0e(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function y0e(e,t,n){let r=0,i,o;return a;function a(h){return e.enter("codeText"),e.enter("codeTextSequence"),l(h)}function l(h){return h===96?(e.consume(h),r++,l):(e.exit("codeTextSequence"),u(h))}function u(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),u):h===96?(o=e.enter("codeTextSequence"),i=0,d(h)):ft(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),u):(e.enter("codeTextData"),f(h))}function f(h){return h===null||h===32||h===96||ft(h)?(e.exit("codeTextData"),u(h)):(e.consume(h),f)}function d(h){return h===96?(e.consume(h),i++,d):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(o.type="codeTextData",f(h))}}class x0e{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index \`"+t+"\` in a splice buffer of size \`"+(this.left.length+this.right.length)+"\`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Vp(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Vp(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Vp(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Vp(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Vp(this.left,n.reverse())}}}function Vp(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function S9(e){const t={};let n=-1,r,i,o,a,l,u,f;const d=new x0e(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,o=0,o<u.length&&u[o][1].type==="lineEndingBlank"&&(o+=2),o<u.length&&u[o][1].type==="content"))for(;++o<u.length&&u[o][1].type!=="content";)u[o][1].type==="chunkText"&&(u[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,b0e(d,n)),n=t[n],f=!0);else if(r[1]._container){for(o=n,i=void 0;o--;)if(a=d.get(o),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=o);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(r[1].end={...d.get(i)[1].start},l=d.slice(i,n),l.unshift(r),d.splice(i,n-i+1,l))}}return Qi(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!f}function b0e(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const o=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const l=a.events,u=[],f={};let d,h,g=-1,v=n,b=0,w=0;const S=[w];for(;v;){for(;e.get(++i)[1]!==v;);o.push(i),v._tokenizer||(d=r.sliceStream(v),v.next||d.push(null),h&&a.defineSkip(v.start),v._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(d),v._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),h=v,v=v.next}for(v=n;++g<l.length;)l[g][0]==="exit"&&l[g-1][0]==="enter"&&l[g][1].type===l[g-1][1].type&&l[g][1].start.line!==l[g][1].end.line&&(w=g+1,S.push(w),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(a.events=[],v?(v._tokenizer=void 0,v.previous=void 0):S.pop(),g=S.length;g--;){const E=l.slice(S[g],S[g+1]),k=o.pop();u.push([k,k+E.length-1]),e.splice(k,2,E)}for(u.reverse(),g=-1;++g<u.length;)f[b+u[g][0]]=b+u[g][1],b+=u[g][1]-u[g][0]-1;return f}const w0e={resolve:E0e,tokenize:C0e},S0e={partial:!0,tokenize:_0e};function E0e(e){return S9(e),e}function C0e(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(l)}function i(l){return l===null?o(l):ft(l)?e.check(S0e,a,o)(l):(e.consume(l),i)}function o(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function a(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function _0e(e,t,n){const r=this;return i;function i(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Yt(e,o,"linePrefix")}function o(a){if(a===null||ft(a))return n(a);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function E9(e,t,n,r,i,o,a,l,u){const f=u||Number.POSITIVE_INFINITY;let d=0;return h;function h(E){return E===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(E),e.exit(o),g):E===null||E===32||E===41||Sb(E)?n(E):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),w(E))}function g(E){return E===62?(e.enter(o),e.consume(E),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),v(E))}function v(E){return E===62?(e.exit("chunkString"),e.exit(l),g(E)):E===null||E===60||ft(E)?n(E):(e.consume(E),E===92?b:v)}function b(E){return E===60||E===62||E===92?(e.consume(E),v):v(E)}function w(E){return!d&&(E===null||E===41||Sn(E))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(E)):d<f&&E===40?(e.consume(E),d++,w):E===41?(e.consume(E),d--,w):E===null||E===32||E===40||Sb(E)?n(E):(e.consume(E),E===92?S:w)}function S(E){return E===40||E===41||E===92?(e.consume(E),w):w(E)}}function C9(e,t,n,r,i,o){const a=this;let l=0,u;return f;function f(v){return e.enter(r),e.enter(i),e.consume(v),e.exit(i),e.enter(o),d}function d(v){return l>999||v===null||v===91||v===93&&!u||v===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(v):v===93?(e.exit(o),e.enter(i),e.consume(v),e.exit(i),e.exit(r),t):ft(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(v))}function h(v){return v===null||v===91||v===93||ft(v)||l++>999?(e.exit("chunkString"),d(v)):(e.consume(v),u||(u=!Lt(v)),v===92?g:h)}function g(v){return v===91||v===92||v===93?(e.consume(v),l++,h):h(v)}}function _9(e,t,n,r,i,o){let a;return l;function l(g){return g===34||g===39||g===40?(e.enter(r),e.enter(i),e.consume(g),e.exit(i),a=g===40?41:g,u):n(g)}function u(g){return g===a?(e.enter(i),e.consume(g),e.exit(i),e.exit(r),t):(e.enter(o),f(g))}function f(g){return g===a?(e.exit(o),u(a)):g===null?n(g):ft(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),Yt(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(g))}function d(g){return g===a||g===null||ft(g)?(e.exit("chunkString"),f(g)):(e.consume(g),g===92?h:d)}function h(g){return g===a||g===92?(e.consume(g),d):d(g)}}function wm(e,t){let n;return r;function r(i){return ft(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Lt(i)?Yt(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const k0e={name:"definition",tokenize:j0e},O0e={partial:!0,tokenize:T0e};function j0e(e,t,n){const r=this;let i;return o;function o(v){return e.enter("definition"),a(v)}function a(v){return C9.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function l(v){return i=Yo(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),u):n(v)}function u(v){return Sn(v)?wm(e,f)(v):f(v)}function f(v){return E9(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function d(v){return e.attempt(O0e,h,h)(v)}function h(v){return Lt(v)?Yt(e,g,"whitespace")(v):g(v)}function g(v){return v===null||ft(v)?(e.exit("definition"),r.parser.defined.push(i),t(v)):n(v)}}function T0e(e,t,n){return r;function r(l){return Sn(l)?wm(e,i)(l):n(l)}function i(l){return _9(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function o(l){return Lt(l)?Yt(e,a,"whitespace")(l):a(l)}function a(l){return l===null||ft(l)?t(l):n(l)}}const A0e={name:"hardBreakEscape",tokenize:N0e};function N0e(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return ft(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const R0e={name:"headingAtx",resolve:P0e,tokenize:M0e};function P0e(e,t){let n=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Qi(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function M0e(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),o(d)}function o(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&r++<6?(e.consume(d),a):d===null||Sn(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),u(d)):d===null||ft(d)?(e.exit("atxHeading"),t(d)):Lt(d)?Yt(e,l,"whitespace")(d):(e.enter("atxHeadingText"),f(d))}function u(d){return d===35?(e.consume(d),u):(e.exit("atxHeadingSequence"),l(d))}function f(d){return d===null||d===35||Sn(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),f)}}const I0e=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],n4=["pre","script","style","textarea"],D0e={concrete:!0,name:"htmlFlow",resolveTo:F0e,tokenize:B0e},L0e={partial:!0,tokenize:U0e},z0e={partial:!0,tokenize:$0e};function F0e(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function B0e(e,t,n){const r=this;let i,o,a,l,u;return f;function f(R){return d(R)}function d(R){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(R),h}function h(R){return R===33?(e.consume(R),g):R===47?(e.consume(R),o=!0,w):R===63?(e.consume(R),i=3,r.interrupt?t:I):si(R)?(e.consume(R),a=String.fromCharCode(R),S):n(R)}function g(R){return R===45?(e.consume(R),i=2,v):R===91?(e.consume(R),i=5,l=0,b):si(R)?(e.consume(R),i=4,r.interrupt?t:I):n(R)}function v(R){return R===45?(e.consume(R),r.interrupt?t:I):n(R)}function b(R){const X="CDATA[";return R===X.charCodeAt(l++)?(e.consume(R),l===X.length?r.interrupt?t:L:b):n(R)}function w(R){return si(R)?(e.consume(R),a=String.fromCharCode(R),S):n(R)}function S(R){if(R===null||R===47||R===62||Sn(R)){const X=R===47,W=a.toLowerCase();return!X&&!o&&n4.includes(W)?(i=1,r.interrupt?t(R):L(R)):I0e.includes(a.toLowerCase())?(i=6,X?(e.consume(R),E):r.interrupt?t(R):L(R)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(R):o?k(R):O(R))}return R===45||Gr(R)?(e.consume(R),a+=String.fromCharCode(R),S):n(R)}function E(R){return R===62?(e.consume(R),r.interrupt?t:L):n(R)}function k(R){return Lt(R)?(e.consume(R),k):D(R)}function O(R){return R===47?(e.consume(R),D):R===58||R===95||si(R)?(e.consume(R),j):Lt(R)?(e.consume(R),O):D(R)}function j(R){return R===45||R===46||R===58||R===95||Gr(R)?(e.consume(R),j):A(R)}function A(R){return R===61?(e.consume(R),T):Lt(R)?(e.consume(R),A):O(R)}function T(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),u=R,N):Lt(R)?(e.consume(R),T):P(R)}function N(R){return R===u?(e.consume(R),u=null,F):R===null||ft(R)?n(R):(e.consume(R),N)}function P(R){return R===null||R===34||R===39||R===47||R===60||R===61||R===62||R===96||Sn(R)?A(R):(e.consume(R),P)}function F(R){return R===47||R===62||Lt(R)?O(R):n(R)}function D(R){return R===62?(e.consume(R),q):n(R)}function q(R){return R===null||ft(R)?L(R):Lt(R)?(e.consume(R),q):n(R)}function L(R){return R===45&&i===2?(e.consume(R),z):R===60&&i===1?(e.consume(R),V):R===62&&i===4?(e.consume(R),K):R===63&&i===3?(e.consume(R),I):R===93&&i===5?(e.consume(R),G):ft(R)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(L0e,$,U)(R)):R===null||ft(R)?(e.exit("htmlFlowData"),U(R)):(e.consume(R),L)}function U(R){return e.check(z0e,H,$)(R)}function H(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),B}function B(R){return R===null||ft(R)?U(R):(e.enter("htmlFlowData"),L(R))}function z(R){return R===45?(e.consume(R),I):L(R)}function V(R){return R===47?(e.consume(R),a="",Q):L(R)}function Q(R){if(R===62){const X=a.toLowerCase();return n4.includes(X)?(e.consume(R),K):L(R)}return si(R)&&a.length<8?(e.consume(R),a+=String.fromCharCode(R),Q):L(R)}function G(R){return R===93?(e.consume(R),I):L(R)}function I(R){return R===62?(e.consume(R),K):R===45&&i===2?(e.consume(R),I):L(R)}function K(R){return R===null||ft(R)?(e.exit("htmlFlowData"),$(R)):(e.consume(R),K)}function $(R){return e.exit("htmlFlow"),t(R)}}function $0e(e,t,n){const r=this;return i;function i(a){return ft(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):n(a)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function U0e(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Fg,t,n)}}const H0e={name:"htmlText",tokenize:q0e};function q0e(e,t,n){const r=this;let i,o,a;return l;function l(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),u}function u(I){return I===33?(e.consume(I),f):I===47?(e.consume(I),A):I===63?(e.consume(I),O):si(I)?(e.consume(I),P):n(I)}function f(I){return I===45?(e.consume(I),d):I===91?(e.consume(I),o=0,b):si(I)?(e.consume(I),k):n(I)}function d(I){return I===45?(e.consume(I),v):n(I)}function h(I){return I===null?n(I):I===45?(e.consume(I),g):ft(I)?(a=h,V(I)):(e.consume(I),h)}function g(I){return I===45?(e.consume(I),v):h(I)}function v(I){return I===62?z(I):I===45?g(I):h(I)}function b(I){const K="CDATA[";return I===K.charCodeAt(o++)?(e.consume(I),o===K.length?w:b):n(I)}function w(I){return I===null?n(I):I===93?(e.consume(I),S):ft(I)?(a=w,V(I)):(e.consume(I),w)}function S(I){return I===93?(e.consume(I),E):w(I)}function E(I){return I===62?z(I):I===93?(e.consume(I),E):w(I)}function k(I){return I===null||I===62?z(I):ft(I)?(a=k,V(I)):(e.consume(I),k)}function O(I){return I===null?n(I):I===63?(e.consume(I),j):ft(I)?(a=O,V(I)):(e.consume(I),O)}function j(I){return I===62?z(I):O(I)}function A(I){return si(I)?(e.consume(I),T):n(I)}function T(I){return I===45||Gr(I)?(e.consume(I),T):N(I)}function N(I){return ft(I)?(a=N,V(I)):Lt(I)?(e.consume(I),N):z(I)}function P(I){return I===45||Gr(I)?(e.consume(I),P):I===47||I===62||Sn(I)?F(I):n(I)}function F(I){return I===47?(e.consume(I),z):I===58||I===95||si(I)?(e.consume(I),D):ft(I)?(a=F,V(I)):Lt(I)?(e.consume(I),F):z(I)}function D(I){return I===45||I===46||I===58||I===95||Gr(I)?(e.consume(I),D):q(I)}function q(I){return I===61?(e.consume(I),L):ft(I)?(a=q,V(I)):Lt(I)?(e.consume(I),q):F(I)}function L(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),i=I,U):ft(I)?(a=L,V(I)):Lt(I)?(e.consume(I),L):(e.consume(I),H)}function U(I){return I===i?(e.consume(I),i=void 0,B):I===null?n(I):ft(I)?(a=U,V(I)):(e.consume(I),U)}function H(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||Sn(I)?F(I):(e.consume(I),H)}function B(I){return I===47||I===62||Sn(I)?F(I):n(I)}function z(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function V(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),Q}function Q(I){return Lt(I)?Yt(e,G,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):G(I)}function G(I){return e.enter("htmlTextData"),a(I)}}const MA={name:"labelEnd",resolveAll:W0e,resolveTo:G0e,tokenize:X0e},V0e={tokenize:Q0e},K0e={tokenize:Z0e},Y0e={tokenize:J0e};function W0e(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&Qi(e,0,e.length,n),e}function G0e(e,t){let n=e.length,r=0,i,o,a,l;for(;n--;)if(i=e[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(a=n);const u={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[o][1].start},end:{...e[a][1].end}},d={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[a-2][1].start}};return l=[["enter",u,t],["enter",f,t]],l=So(l,e.slice(o+1,o+r+3)),l=So(l,[["enter",d,t]]),l=So(l,Sw(t.parser.constructs.insideSpan.null,e.slice(o+r+4,a-3),t)),l=So(l,[["exit",d,t],e[a-2],e[a-1],["exit",f,t]]),l=So(l,e.slice(a+1)),l=So(l,[["exit",u,t]]),Qi(e,o,e.length,l),e}function X0e(e,t,n){const r=this;let i=r.events.length,o,a;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return l;function l(g){return o?o._inactive?h(g):(a=r.parser.defined.includes(Yo(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(g),e.exit("labelMarker"),e.exit("labelEnd"),u):n(g)}function u(g){return g===40?e.attempt(V0e,d,a?d:h)(g):g===91?e.attempt(K0e,d,a?f:h)(g):a?d(g):h(g)}function f(g){return e.attempt(Y0e,d,h)(g)}function d(g){return t(g)}function h(g){return o._balanced=!0,n(g)}}function Q0e(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),i}function i(h){return Sn(h)?wm(e,o)(h):o(h)}function o(h){return h===41?d(h):E9(e,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function a(h){return Sn(h)?wm(e,u)(h):d(h)}function l(h){return n(h)}function u(h){return h===34||h===39||h===40?_9(e,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function f(h){return Sn(h)?wm(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function Z0e(e,t,n){const r=this;return i;function i(l){return C9.call(r,e,o,a,"reference","referenceMarker","referenceString")(l)}function o(l){return r.parser.defined.includes(Yo(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function a(l){return n(l)}}function J0e(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const ewe={name:"labelStartImage",resolveAll:MA.resolveAll,tokenize:twe};function twe(e,t,n){const r=this;return i;function i(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),o}function o(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),a):n(l)}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const nwe={name:"labelStartLink",resolveAll:MA.resolveAll,tokenize:rwe};function rwe(e,t,n){const r=this;return i;function i(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),o}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const TC={name:"lineEnding",tokenize:iwe};function iwe(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Yt(e,t,"linePrefix")}}const Bx={name:"thematicBreak",tokenize:owe};function owe(e,t,n){let r=0,i;return o;function o(f){return e.enter("thematicBreak"),a(f)}function a(f){return i=f,l(f)}function l(f){return f===i?(e.enter("thematicBreakSequence"),u(f)):r>=3&&(f===null||ft(f))?(e.exit("thematicBreak"),t(f)):n(f)}function u(f){return f===i?(e.consume(f),r++,u):(e.exit("thematicBreakSequence"),Lt(f)?Yt(e,l,"whitespace")(f):l(f))}}const wi={continuation:{tokenize:cwe},exit:fwe,name:"list",tokenize:lwe},awe={partial:!0,tokenize:dwe},swe={partial:!0,tokenize:uwe};function lwe(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return l;function l(v){const b=r.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||v===r.containerState.marker:OO(v)){if(r.containerState.type||(r.containerState.type=b,e.enter(b,{_container:!0})),b==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(Bx,n,f)(v):f(v);if(!r.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(v)}return n(v)}function u(v){return OO(v)&&++a<10?(e.consume(v),u):(!r.interrupt||a<2)&&(r.containerState.marker?v===r.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),f(v)):n(v)}function f(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||v,e.check(Fg,r.interrupt?n:d,e.attempt(awe,g,h))}function d(v){return r.containerState.initialBlankLine=!0,o++,g(v)}function h(v){return Lt(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),g):n(v)}function g(v){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(v)}}function cwe(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Fg,i,o);function i(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Yt(e,t,"listItemIndent",r.containerState.size+1)(l)}function o(l){return r.containerState.furtherBlankLines||!Lt(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(swe,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Yt(e,e.attempt(wi,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function uwe(e,t,n){const r=this;return Yt(e,i,"listItemIndent",r.containerState.size+1);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(o):n(o)}}function fwe(e){e.exit(this.containerState.type)}function dwe(e,t,n){const r=this;return Yt(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const a=r.events[r.events.length-1];return!Lt(o)&&a&&a[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const r4={name:"setextUnderline",resolveTo:hwe,tokenize:pwe};function hwe(e,t){let n=e.length,r,i,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",a,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function pwe(e,t,n){const r=this;let i;return o;function o(f){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),i=f,a(f)):n(f)}function a(f){return e.enter("setextHeadingLineSequence"),l(f)}function l(f){return f===i?(e.consume(f),l):(e.exit("setextHeadingLineSequence"),Lt(f)?Yt(e,u,"lineSuffix")(f):u(f))}function u(f){return f===null||ft(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const mwe={tokenize:gwe};function gwe(e){const t=this,n=e.attempt(Fg,r,e.attempt(this.parser.constructs.flowInitial,i,Yt(e,e.attempt(this.parser.constructs.flow,i,e.attempt(w0e,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const vwe={resolveAll:O9()},ywe=k9("string"),xwe=k9("text");function k9(e){return{resolveAll:O9(e==="text"?bwe:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,a,l);return a;function a(d){return f(d)?o(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),u}function u(d){return f(d)?(n.exit("data"),o(d)):(n.consume(d),u)}function f(d){if(d===null)return!0;const h=i[d];let g=-1;if(h)for(;++g<h.length;){const v=h[g];if(!v.previous||v.previous.call(r,r.previous))return!0}return!1}}}function O9(e){return t;function t(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(n,r):n}}function bwe(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let o=i.length,a=-1,l=0,u;for(;o--;){const f=i[o];if(typeof f=="string"){for(a=f.length;f.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(f===-2)u=!0,l++;else if(f!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const f={type:n===e.length||u||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?a:r.start._bufferIndex+a,_index:r.start._index+o,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...f.start},r.start.offset===r.end.offset?Object.assign(r,f):(e.splice(n,0,["enter",f,t],["exit",f,t]),n+=2)}n++}return e}const wwe={42:wi,43:wi,45:wi,48:wi,49:wi,50:wi,51:wi,52:wi,53:wi,54:wi,55:wi,56:wi,57:wi,62:x9},Swe={91:k0e},Ewe={[-2]:jC,[-1]:jC,32:jC},Cwe={35:R0e,42:Bx,45:[r4,Bx],60:D0e,61:r4,95:Bx,96:t4,126:t4},_we={38:w9,92:b9},kwe={[-5]:TC,[-4]:TC,[-3]:TC,33:ewe,38:w9,42:jO,60:[n0e,H0e],91:nwe,92:[A0e,b9],93:MA,95:jO,96:m0e},Owe={null:[jO,vwe]},jwe={null:[42,95]},Twe={null:[]},Awe=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:jwe,contentInitial:Swe,disable:Twe,document:wwe,flow:Cwe,flowInitial:Ewe,insideSpan:Owe,string:_we,text:kwe},Symbol.toStringTag,{value:"Module"}));function Nwe(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},o=[];let a=[],l=[];const u={attempt:N(A),check:N(T),consume:k,enter:O,exit:j,interrupt:N(T,{interrupt:!0})},f={code:null,containerState:{},defineSkip:w,events:[],now:b,parser:e,previous:null,sliceSerialize:g,sliceStream:v,write:h};let d=t.tokenize.call(f,u);return t.resolveAll&&o.push(t),f;function h(q){return a=So(a,q),S(),a[a.length-1]!==null?[]:(P(t,0),f.events=Sw(o,f.events,f),f.events)}function g(q,L){return Pwe(v(q),L)}function v(q){return Rwe(a,q)}function b(){const{_bufferIndex:q,_index:L,line:U,column:H,offset:B}=r;return{_bufferIndex:q,_index:L,line:U,column:H,offset:B}}function w(q){i[q.line]=q.column,D()}function S(){let q;for(;r._index<a.length;){const L=a[r._index];if(typeof L=="string")for(q=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===q&&r._bufferIndex<L.length;)E(L.charCodeAt(r._bufferIndex));else E(L)}}function E(q){d=d(q)}function k(q){ft(q)?(r.line++,r.column=1,r.offset+=q===-3?2:1,D()):q!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),f.previous=q}function O(q,L){const U=L||{};return U.type=q,U.start=b(),f.events.push(["enter",U,f]),l.push(U),U}function j(q){const L=l.pop();return L.end=b(),f.events.push(["exit",L,f]),L}function A(q,L){P(q,L.from)}function T(q,L){L.restore()}function N(q,L){return U;function U(H,B,z){let V,Q,G,I;return Array.isArray(H)?$(H):"tokenize"in H?$([H]):K(H);function K(Z){return oe;function oe(ie){const J=ie!==null&&Z[ie],se=ie!==null&&Z.null,xe=[...Array.isArray(J)?J:J?[J]:[],...Array.isArray(se)?se:se?[se]:[]];return $(xe)(ie)}}function $(Z){return V=Z,Q=0,Z.length===0?z:R(Z[Q])}function R(Z){return oe;function oe(ie){return I=F(),G=Z,Z.partial||(f.currentConstruct=Z),Z.name&&f.parser.constructs.disable.null.includes(Z.name)?W():Z.tokenize.call(L?Object.assign(Object.create(f),L):f,u,X,W)(ie)}}function X(Z){return q(G,I),B}function W(Z){return I.restore(),++Q<V.length?R(V[Q]):z}}}function P(q,L){q.resolveAll&&!o.includes(q)&&o.push(q),q.resolve&&Qi(f.events,L,f.events.length-L,q.resolve(f.events.slice(L),f)),q.resolveTo&&(f.events=q.resolveTo(f.events,f))}function F(){const q=b(),L=f.previous,U=f.currentConstruct,H=f.events.length,B=Array.from(l);return{from:H,restore:z};function z(){r=q,f.previous=L,f.currentConstruct=U,f.events.length=H,l=B,D()}}function D(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Rwe(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let a;if(n===i)a=[e[n].slice(r,o)];else{if(a=e.slice(n,i),r>-1){const l=a[0];typeof l=="string"?a[0]=l.slice(r):a.shift()}o>0&&a.push(e[i].slice(0,o))}return a}function Pwe(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let a;if(typeof o=="string")a=o;else switch(o){case-5:{a="\\r";break}case-4:{a=\`
|
|
@@ -217092,11 +217081,11 @@ agentstep skills install \${n}
|
|
|
217092
217081
|
</body>
|
|
217093
217082
|
</html>
|
|
217094
217083
|
`;
|
|
217095
|
-
UI_VERSION = "
|
|
217084
|
+
UI_VERSION = "d814a8d4";
|
|
217096
217085
|
}
|
|
217097
217086
|
});
|
|
217098
217087
|
|
|
217099
|
-
// ../agent-sdk/dist/chunk-
|
|
217088
|
+
// ../agent-sdk/dist/chunk-FEOW453X.js
|
|
217100
217089
|
function handleAddUpstreamKey(request2) {
|
|
217101
217090
|
return routeWrap(request2, async ({ auth, request: req }) => {
|
|
217102
217091
|
requireFeature("upstream_pool", "upstream key pool");
|
|
@@ -217188,15 +217177,15 @@ function handleDeleteUpstreamKey(request2, id) {
|
|
|
217188
217177
|
});
|
|
217189
217178
|
}
|
|
217190
217179
|
var AddBody, PatchBody2;
|
|
217191
|
-
var
|
|
217192
|
-
"../agent-sdk/dist/chunk-
|
|
217180
|
+
var init_chunk_FEOW453X = __esm({
|
|
217181
|
+
"../agent-sdk/dist/chunk-FEOW453X.js"() {
|
|
217193
217182
|
"use strict";
|
|
217194
217183
|
init_chunk_3LG7DRJL();
|
|
217195
217184
|
init_chunk_BZ6HFTHU();
|
|
217196
217185
|
init_chunk_23UKWXJH();
|
|
217197
217186
|
init_chunk_MHQXDTJB();
|
|
217198
217187
|
init_chunk_2N2KL4KM();
|
|
217199
|
-
|
|
217188
|
+
init_chunk_OYXDU3HX();
|
|
217200
217189
|
init_chunk_EZYKRG4W();
|
|
217201
217190
|
init_zod();
|
|
217202
217191
|
AddBody = external_exports.object({
|
|
@@ -217210,7 +217199,7 @@ var init_chunk_64ZLFLMN = __esm({
|
|
|
217210
217199
|
}
|
|
217211
217200
|
});
|
|
217212
217201
|
|
|
217213
|
-
// ../agent-sdk/dist/chunk-
|
|
217202
|
+
// ../agent-sdk/dist/chunk-NH63FTAL.js
|
|
217214
217203
|
function zeroTotals() {
|
|
217215
217204
|
return {
|
|
217216
217205
|
session_count: 0,
|
|
@@ -217570,12 +217559,12 @@ function handleGetApiMetrics(request2) {
|
|
|
217570
217559
|
});
|
|
217571
217560
|
}
|
|
217572
217561
|
var BUCKET_MS, TOP_N, MAX_POINTS_PER_SERIES, MAX_TOTAL_CELLS;
|
|
217573
|
-
var
|
|
217574
|
-
"../agent-sdk/dist/chunk-
|
|
217562
|
+
var init_chunk_NH63FTAL = __esm({
|
|
217563
|
+
"../agent-sdk/dist/chunk-NH63FTAL.js"() {
|
|
217575
217564
|
"use strict";
|
|
217576
217565
|
init_chunk_23UKWXJH();
|
|
217577
217566
|
init_chunk_2N2KL4KM();
|
|
217578
|
-
|
|
217567
|
+
init_chunk_OYXDU3HX();
|
|
217579
217568
|
init_chunk_D2XITRN6();
|
|
217580
217569
|
init_chunk_5GZEX4HV();
|
|
217581
217570
|
init_chunk_EZYKRG4W();
|
|
@@ -217591,7 +217580,7 @@ var init_chunk_46LBKEBE = __esm({
|
|
|
217591
217580
|
}
|
|
217592
217581
|
});
|
|
217593
217582
|
|
|
217594
|
-
// ../agent-sdk/dist/chunk-
|
|
217583
|
+
// ../agent-sdk/dist/chunk-BXMBMUCK.js
|
|
217595
217584
|
function handleListModels(request2) {
|
|
217596
217585
|
return routeWrap(request2, async ({ request: req }) => {
|
|
217597
217586
|
const url2 = new URL(req.url);
|
|
@@ -217602,15 +217591,15 @@ function handleListModels(request2) {
|
|
|
217602
217591
|
return jsonOk({ data: models });
|
|
217603
217592
|
});
|
|
217604
217593
|
}
|
|
217605
|
-
var
|
|
217606
|
-
"../agent-sdk/dist/chunk-
|
|
217594
|
+
var init_chunk_BXMBMUCK = __esm({
|
|
217595
|
+
"../agent-sdk/dist/chunk-BXMBMUCK.js"() {
|
|
217607
217596
|
"use strict";
|
|
217608
217597
|
init_chunk_R45W644X();
|
|
217609
|
-
|
|
217598
|
+
init_chunk_OYXDU3HX();
|
|
217610
217599
|
}
|
|
217611
217600
|
});
|
|
217612
217601
|
|
|
217613
|
-
// ../agent-sdk/dist/chunk-
|
|
217602
|
+
// ../agent-sdk/dist/chunk-RDGOGAQ5.js
|
|
217614
217603
|
function originFromRequest(request2) {
|
|
217615
217604
|
const headers3 = request2.headers;
|
|
217616
217605
|
const proto3 = headers3.get("x-forwarded-proto") ?? new URL(request2.url).protocol.replace(":", "");
|
|
@@ -217622,14 +217611,14 @@ async function handleGetOpenApiSpec(request2) {
|
|
|
217622
217611
|
const doc = buildOpenApiDocument({ serverUrl });
|
|
217623
217612
|
return Response.json(doc);
|
|
217624
217613
|
}
|
|
217625
|
-
var
|
|
217626
|
-
"../agent-sdk/dist/chunk-
|
|
217614
|
+
var init_chunk_RDGOGAQ5 = __esm({
|
|
217615
|
+
"../agent-sdk/dist/chunk-RDGOGAQ5.js"() {
|
|
217627
217616
|
"use strict";
|
|
217628
|
-
|
|
217617
|
+
init_chunk_D2TRWKVQ();
|
|
217629
217618
|
}
|
|
217630
217619
|
});
|
|
217631
217620
|
|
|
217632
|
-
// ../agent-sdk/dist/chunk-
|
|
217621
|
+
// ../agent-sdk/dist/chunk-CZHJNZAG.js
|
|
217633
217622
|
async function checkLocalProvider(name) {
|
|
217634
217623
|
try {
|
|
217635
217624
|
const provider = await resolveContainerProvider(name);
|
|
@@ -217668,10 +217657,10 @@ async function handleGetProviderStatus(request2) {
|
|
|
217668
217657
|
});
|
|
217669
217658
|
}
|
|
217670
217659
|
var LOCAL_PROVIDERS, CLOUD_PROVIDERS, CLOUD_KEY_MAP;
|
|
217671
|
-
var
|
|
217672
|
-
"../agent-sdk/dist/chunk-
|
|
217660
|
+
var init_chunk_CZHJNZAG = __esm({
|
|
217661
|
+
"../agent-sdk/dist/chunk-CZHJNZAG.js"() {
|
|
217673
217662
|
"use strict";
|
|
217674
|
-
|
|
217663
|
+
init_chunk_OYXDU3HX();
|
|
217675
217664
|
init_chunk_JSLEB2ED();
|
|
217676
217665
|
init_chunk_QH57EOKP();
|
|
217677
217666
|
LOCAL_PROVIDERS = ["docker", "apple-container", "podman"];
|
|
@@ -217687,7 +217676,7 @@ var init_chunk_ENOKSV57 = __esm({
|
|
|
217687
217676
|
}
|
|
217688
217677
|
});
|
|
217689
217678
|
|
|
217690
|
-
// ../agent-sdk/dist/chunk-
|
|
217679
|
+
// ../agent-sdk/dist/chunk-GK4SHVMZ.js
|
|
217691
217680
|
function assertSessionTenant(auth, sessionId) {
|
|
217692
217681
|
const row = getDb().prepare(`SELECT tenant_id FROM sessions WHERE id = ?`).get(sessionId);
|
|
217693
217682
|
if (row) {
|
|
@@ -217762,11 +217751,11 @@ function handleDeleteResource(request2, sessionId, resourceId) {
|
|
|
217762
217751
|
});
|
|
217763
217752
|
}
|
|
217764
217753
|
var MAX_RESOURCES_PER_SESSION, AddResourceSchema;
|
|
217765
|
-
var
|
|
217766
|
-
"../agent-sdk/dist/chunk-
|
|
217754
|
+
var init_chunk_GK4SHVMZ = __esm({
|
|
217755
|
+
"../agent-sdk/dist/chunk-GK4SHVMZ.js"() {
|
|
217767
217756
|
"use strict";
|
|
217768
217757
|
init_chunk_23UKWXJH();
|
|
217769
|
-
|
|
217758
|
+
init_chunk_OYXDU3HX();
|
|
217770
217759
|
init_chunk_NIOWKTIF();
|
|
217771
217760
|
init_chunk_I5ZA45YL();
|
|
217772
217761
|
init_chunk_R5OZHLAD();
|
|
@@ -218087,7 +218076,7 @@ var init_vaults = __esm({
|
|
|
218087
218076
|
}
|
|
218088
218077
|
});
|
|
218089
218078
|
|
|
218090
|
-
// ../agent-sdk/dist/chunk-
|
|
218079
|
+
// ../agent-sdk/dist/chunk-APWMSN3I.js
|
|
218091
218080
|
function getAgentTenantId(id) {
|
|
218092
218081
|
const row = getDb().prepare(`SELECT tenant_id FROM agents WHERE id = ?`).get(id);
|
|
218093
218082
|
return row?.tenant_id;
|
|
@@ -218507,20 +218496,20 @@ function parseMs(v2) {
|
|
|
218507
218496
|
return Number.isFinite(t2) ? t2 : void 0;
|
|
218508
218497
|
}
|
|
218509
218498
|
var ALLOWED_STATUSES, AgentRef, ResourceSchema, CreateSchema, UpdateSchema;
|
|
218510
|
-
var
|
|
218511
|
-
"../agent-sdk/dist/chunk-
|
|
218499
|
+
var init_chunk_APWMSN3I = __esm({
|
|
218500
|
+
"../agent-sdk/dist/chunk-APWMSN3I.js"() {
|
|
218512
218501
|
"use strict";
|
|
218513
218502
|
init_chunk_ZP5VMV5O();
|
|
218514
218503
|
init_chunk_YGAHGTVZ();
|
|
218515
218504
|
init_chunk_23UKWXJH();
|
|
218516
218505
|
init_chunk_DC2UMEQH();
|
|
218517
218506
|
init_chunk_SDLNBA53();
|
|
218518
|
-
|
|
218507
|
+
init_chunk_OYXDU3HX();
|
|
218519
218508
|
init_chunk_QLWA4MJ5();
|
|
218520
218509
|
init_chunk_H6TQGV4L();
|
|
218521
218510
|
init_chunk_NIOWKTIF();
|
|
218522
218511
|
init_chunk_LAWTTG2E();
|
|
218523
|
-
|
|
218512
|
+
init_chunk_ZMCS7MYZ();
|
|
218524
218513
|
init_chunk_BMPB7XJH();
|
|
218525
218514
|
init_chunk_I5ZA45YL();
|
|
218526
218515
|
init_chunk_NUO56TF7();
|
|
@@ -218564,7 +218553,7 @@ var init_chunk_JOZK6G5O = __esm({
|
|
|
218564
218553
|
}
|
|
218565
218554
|
});
|
|
218566
218555
|
|
|
218567
|
-
// ../agent-sdk/dist/chunk-
|
|
218556
|
+
// ../agent-sdk/dist/chunk-3PEVKW47.js
|
|
218568
218557
|
function maskSecret(value) {
|
|
218569
218558
|
if (!value) return "";
|
|
218570
218559
|
if (value.length <= 12) return "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";
|
|
@@ -218599,10 +218588,10 @@ function handleGetSetting(request2, key) {
|
|
|
218599
218588
|
});
|
|
218600
218589
|
}
|
|
218601
218590
|
var NON_SECRET_KEYS, ALLOWED_KEYS, SECRET_KEYS;
|
|
218602
|
-
var
|
|
218603
|
-
"../agent-sdk/dist/chunk-
|
|
218591
|
+
var init_chunk_3PEVKW47 = __esm({
|
|
218592
|
+
"../agent-sdk/dist/chunk-3PEVKW47.js"() {
|
|
218604
218593
|
"use strict";
|
|
218605
|
-
|
|
218594
|
+
init_chunk_OYXDU3HX();
|
|
218606
218595
|
init_chunk_QH57EOKP();
|
|
218607
218596
|
init_chunk_EZYKRG4W();
|
|
218608
218597
|
NON_SECRET_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -218644,7 +218633,7 @@ var init_chunk_PB7LR2AG = __esm({
|
|
|
218644
218633
|
}
|
|
218645
218634
|
});
|
|
218646
218635
|
|
|
218647
|
-
// ../agent-sdk/dist/chunk-
|
|
218636
|
+
// ../agent-sdk/dist/chunk-5X4BWQJP.js
|
|
218648
218637
|
function handleCreateSkill(request2) {
|
|
218649
218638
|
return routeWrap(request2, async () => {
|
|
218650
218639
|
throw new ApiError(
|
|
@@ -218663,15 +218652,15 @@ function handleDeleteSkill(request2, _id) {
|
|
|
218663
218652
|
);
|
|
218664
218653
|
});
|
|
218665
218654
|
}
|
|
218666
|
-
var
|
|
218667
|
-
"../agent-sdk/dist/chunk-
|
|
218655
|
+
var init_chunk_5X4BWQJP = __esm({
|
|
218656
|
+
"../agent-sdk/dist/chunk-5X4BWQJP.js"() {
|
|
218668
218657
|
"use strict";
|
|
218669
|
-
|
|
218658
|
+
init_chunk_OYXDU3HX();
|
|
218670
218659
|
init_chunk_EZYKRG4W();
|
|
218671
218660
|
}
|
|
218672
218661
|
});
|
|
218673
218662
|
|
|
218674
|
-
// ../agent-sdk/dist/chunk-
|
|
218663
|
+
// ../agent-sdk/dist/chunk-UBS4LDDI.js
|
|
218675
218664
|
function getVaultTenantId(id) {
|
|
218676
218665
|
const row = getDb().prepare(`SELECT tenant_id FROM vaults WHERE id = ?`).get(id);
|
|
218677
218666
|
return row?.tenant_id;
|
|
@@ -218779,11 +218768,11 @@ function handleDeleteEntry(request2, vaultId, key) {
|
|
|
218779
218768
|
});
|
|
218780
218769
|
}
|
|
218781
218770
|
var CreateVaultSchema, PutEntrySchema;
|
|
218782
|
-
var
|
|
218783
|
-
"../agent-sdk/dist/chunk-
|
|
218771
|
+
var init_chunk_UBS4LDDI = __esm({
|
|
218772
|
+
"../agent-sdk/dist/chunk-UBS4LDDI.js"() {
|
|
218784
218773
|
"use strict";
|
|
218785
218774
|
init_chunk_23UKWXJH();
|
|
218786
|
-
|
|
218775
|
+
init_chunk_OYXDU3HX();
|
|
218787
218776
|
init_chunk_VIGJQU6V();
|
|
218788
218777
|
init_chunk_JEI7I3EH();
|
|
218789
218778
|
init_chunk_5GZEX4HV();
|
|
@@ -218806,7 +218795,7 @@ var init_chunk_JKUR5MIM = __esm({
|
|
|
218806
218795
|
}
|
|
218807
218796
|
});
|
|
218808
218797
|
|
|
218809
|
-
// ../agent-sdk/dist/chunk-
|
|
218798
|
+
// ../agent-sdk/dist/chunk-URHTKS66.js
|
|
218810
218799
|
function handleCreateCredential(request2, vaultId) {
|
|
218811
218800
|
return routeWrap(request2, async ({ auth }) => {
|
|
218812
218801
|
loadVaultForCaller(auth, vaultId);
|
|
@@ -218888,25 +218877,26 @@ function handleDeleteCredential(request2, vaultId, credentialId) {
|
|
|
218888
218877
|
}
|
|
218889
218878
|
const deleted = deleteCredential(credentialId);
|
|
218890
218879
|
if (!deleted) throw notFound(`credential not found: ${credentialId}`);
|
|
218891
|
-
return jsonOk({ id: credentialId, type: "
|
|
218880
|
+
return jsonOk({ id: credentialId, type: "vault_credential_deleted" });
|
|
218892
218881
|
});
|
|
218893
218882
|
}
|
|
218894
218883
|
var CreateCredentialSchema, UpdateCredentialSchema;
|
|
218895
|
-
var
|
|
218896
|
-
"../agent-sdk/dist/chunk-
|
|
218884
|
+
var init_chunk_URHTKS66 = __esm({
|
|
218885
|
+
"../agent-sdk/dist/chunk-URHTKS66.js"() {
|
|
218897
218886
|
"use strict";
|
|
218898
|
-
|
|
218899
|
-
|
|
218900
|
-
|
|
218887
|
+
init_chunk_UBS4LDDI();
|
|
218888
|
+
init_chunk_OYXDU3HX();
|
|
218889
|
+
init_chunk_ZQGJKPPY();
|
|
218901
218890
|
init_chunk_EZYKRG4W();
|
|
218902
218891
|
init_zod();
|
|
218903
218892
|
CreateCredentialSchema = external_exports.object({
|
|
218904
218893
|
display_name: external_exports.string().min(1).max(200),
|
|
218905
218894
|
auth: external_exports.object({
|
|
218906
218895
|
type: external_exports.enum(["static_bearer"]),
|
|
218907
|
-
|
|
218908
|
-
|
|
218909
|
-
})
|
|
218896
|
+
mcp_server_url: external_exports.string().url().optional(),
|
|
218897
|
+
token: external_exports.string().min(1)
|
|
218898
|
+
}),
|
|
218899
|
+
metadata: external_exports.record(external_exports.string()).optional()
|
|
218910
218900
|
});
|
|
218911
218901
|
UpdateCredentialSchema = external_exports.object({
|
|
218912
218902
|
display_name: external_exports.string().min(1).max(200).optional(),
|
|
@@ -219011,7 +219001,7 @@ var init_chunk_F27XQZ2O = __esm({
|
|
|
219011
219001
|
}
|
|
219012
219002
|
});
|
|
219013
219003
|
|
|
219014
|
-
// ../agent-sdk/dist/chunk-
|
|
219004
|
+
// ../agent-sdk/dist/chunk-Q3GZ6QUQ.js
|
|
219015
219005
|
function getEnvironmentTenantId2(id) {
|
|
219016
219006
|
const row = getDb().prepare(`SELECT tenant_id FROM environments WHERE id = ?`).get(id);
|
|
219017
219007
|
return row?.tenant_id;
|
|
@@ -219163,12 +219153,12 @@ function handleUpdateEnvironment(request2, id) {
|
|
|
219163
219153
|
});
|
|
219164
219154
|
}
|
|
219165
219155
|
var PackagesSchema, NetworkingSchema, ConfigSchema, CreateSchema2, UpdateSchema2;
|
|
219166
|
-
var
|
|
219167
|
-
"../agent-sdk/dist/chunk-
|
|
219156
|
+
var init_chunk_Q3GZ6QUQ = __esm({
|
|
219157
|
+
"../agent-sdk/dist/chunk-Q3GZ6QUQ.js"() {
|
|
219168
219158
|
"use strict";
|
|
219169
219159
|
init_chunk_23UKWXJH();
|
|
219170
219160
|
init_chunk_SDLNBA53();
|
|
219171
|
-
|
|
219161
|
+
init_chunk_OYXDU3HX();
|
|
219172
219162
|
init_chunk_QLWA4MJ5();
|
|
219173
219163
|
init_chunk_NIOWKTIF();
|
|
219174
219164
|
init_chunk_JSLEB2ED();
|
|
@@ -219218,7 +219208,7 @@ var init_chunk_K7KLJ2UJ = __esm({
|
|
|
219218
219208
|
}
|
|
219219
219209
|
});
|
|
219220
219210
|
|
|
219221
|
-
// ../agent-sdk/dist/chunk-
|
|
219211
|
+
// ../agent-sdk/dist/chunk-UWPHCWZO.js
|
|
219222
219212
|
function assertSessionTenant2(auth, sessionId) {
|
|
219223
219213
|
const row = getDb().prepare(`SELECT tenant_id FROM sessions WHERE id = ?`).get(sessionId);
|
|
219224
219214
|
if (row) {
|
|
@@ -219736,18 +219726,18 @@ function handleListEvents(request2, sessionId) {
|
|
|
219736
219726
|
});
|
|
219737
219727
|
}
|
|
219738
219728
|
var teeLog, activeTees, MAX_TEE_REENTRIES, TextBlock2, UserMessage, UserInterrupt, UserToolConfirmation, UserCustomToolResult, UserDefineOutcome, UserEvent, BatchSchema;
|
|
219739
|
-
var
|
|
219740
|
-
"../agent-sdk/dist/chunk-
|
|
219729
|
+
var init_chunk_UWPHCWZO = __esm({
|
|
219730
|
+
"../agent-sdk/dist/chunk-UWPHCWZO.js"() {
|
|
219741
219731
|
"use strict";
|
|
219742
219732
|
init_chunk_3LG7DRJL();
|
|
219743
219733
|
init_chunk_YGAHGTVZ();
|
|
219744
219734
|
init_chunk_23UKWXJH();
|
|
219745
219735
|
init_chunk_DC2UMEQH();
|
|
219746
219736
|
init_chunk_NUINUAXO();
|
|
219747
|
-
|
|
219737
|
+
init_chunk_OYXDU3HX();
|
|
219748
219738
|
init_chunk_QLWA4MJ5();
|
|
219749
219739
|
init_chunk_HECQRMDR();
|
|
219750
|
-
|
|
219740
|
+
init_chunk_ORFFR5UG();
|
|
219751
219741
|
init_chunk_NIOWKTIF();
|
|
219752
219742
|
init_chunk_LAWTTG2E();
|
|
219753
219743
|
init_chunk_BMPB7XJH();
|
|
@@ -219802,7 +219792,7 @@ var init_chunk_F2SDCOHG = __esm({
|
|
|
219802
219792
|
}
|
|
219803
219793
|
});
|
|
219804
219794
|
|
|
219805
|
-
// ../agent-sdk/dist/chunk-
|
|
219795
|
+
// ../agent-sdk/dist/chunk-22KJNZXF.js
|
|
219806
219796
|
function assertFileTenantByScope(auth, scopeType, scopeId) {
|
|
219807
219797
|
if (!scopeId || scopeType !== "session") {
|
|
219808
219798
|
if (!auth.isGlobalAdmin) throw notFound("file not found");
|
|
@@ -219937,34 +219927,34 @@ function handleDeleteFile(request2, fileId) {
|
|
|
219937
219927
|
return jsonOk(result);
|
|
219938
219928
|
});
|
|
219939
219929
|
}
|
|
219940
|
-
var
|
|
219941
|
-
"../agent-sdk/dist/chunk-
|
|
219930
|
+
var init_chunk_22KJNZXF = __esm({
|
|
219931
|
+
"../agent-sdk/dist/chunk-22KJNZXF.js"() {
|
|
219942
219932
|
"use strict";
|
|
219943
219933
|
init_chunk_STPT3SWU();
|
|
219944
219934
|
init_chunk_NXRJ7Z4G();
|
|
219945
219935
|
init_chunk_23UKWXJH();
|
|
219946
|
-
|
|
219936
|
+
init_chunk_OYXDU3HX();
|
|
219947
219937
|
init_chunk_5GZEX4HV();
|
|
219948
219938
|
init_chunk_EZYKRG4W();
|
|
219949
219939
|
init_client();
|
|
219950
219940
|
}
|
|
219951
219941
|
});
|
|
219952
219942
|
|
|
219953
|
-
// ../agent-sdk/dist/chunk-
|
|
219943
|
+
// ../agent-sdk/dist/chunk-2RYJEIG3.js
|
|
219954
219944
|
function handleGetLicense(request2) {
|
|
219955
219945
|
return routeWrap(request2, async () => {
|
|
219956
219946
|
return jsonOk(getLicenseInfo());
|
|
219957
219947
|
});
|
|
219958
219948
|
}
|
|
219959
|
-
var
|
|
219960
|
-
"../agent-sdk/dist/chunk-
|
|
219949
|
+
var init_chunk_2RYJEIG3 = __esm({
|
|
219950
|
+
"../agent-sdk/dist/chunk-2RYJEIG3.js"() {
|
|
219961
219951
|
"use strict";
|
|
219962
219952
|
init_chunk_2N2KL4KM();
|
|
219963
|
-
|
|
219953
|
+
init_chunk_OYXDU3HX();
|
|
219964
219954
|
}
|
|
219965
219955
|
});
|
|
219966
219956
|
|
|
219967
|
-
// ../agent-sdk/dist/chunk-
|
|
219957
|
+
// ../agent-sdk/dist/chunk-E6F2Z3QT.js
|
|
219968
219958
|
function assertStoreTenant(auth, storeAgentId) {
|
|
219969
219959
|
if (storeAgentId == null) {
|
|
219970
219960
|
if (!auth.isGlobalAdmin) throw notFound("memory store not found");
|
|
@@ -220075,12 +220065,12 @@ function handleDeleteMemory(request2, storeId, memId) {
|
|
|
220075
220065
|
});
|
|
220076
220066
|
}
|
|
220077
220067
|
var CreateStoreSchema, CreateMemorySchema, UpdateMemorySchema;
|
|
220078
|
-
var
|
|
220079
|
-
"../agent-sdk/dist/chunk-
|
|
220068
|
+
var init_chunk_E6F2Z3QT = __esm({
|
|
220069
|
+
"../agent-sdk/dist/chunk-E6F2Z3QT.js"() {
|
|
220080
220070
|
"use strict";
|
|
220081
220071
|
init_chunk_23UKWXJH();
|
|
220082
220072
|
init_chunk_NUINUAXO();
|
|
220083
|
-
|
|
220073
|
+
init_chunk_OYXDU3HX();
|
|
220084
220074
|
init_chunk_5GZEX4HV();
|
|
220085
220075
|
init_chunk_EZYKRG4W();
|
|
220086
220076
|
init_zod();
|
|
@@ -220116,7 +220106,7 @@ var init_models = __esm({
|
|
|
220116
220106
|
}
|
|
220117
220107
|
});
|
|
220118
220108
|
|
|
220119
|
-
// ../agent-sdk/dist/chunk-
|
|
220109
|
+
// ../agent-sdk/dist/chunk-KFN4X3GZ.js
|
|
220120
220110
|
function getAgentTenantId3(id) {
|
|
220121
220111
|
const row = getDb().prepare(`SELECT tenant_id FROM agents WHERE id = ?`).get(id);
|
|
220122
220112
|
return row?.tenant_id;
|
|
@@ -220282,11 +220272,11 @@ function handleDeleteAgent(request2, id) {
|
|
|
220282
220272
|
});
|
|
220283
220273
|
}
|
|
220284
220274
|
var SkillSchema, ToolSchema, McpServerSchema, ModelConfigSchema2, CreateSchema3, UpdateSchema3;
|
|
220285
|
-
var
|
|
220286
|
-
"../agent-sdk/dist/chunk-
|
|
220275
|
+
var init_chunk_KFN4X3GZ = __esm({
|
|
220276
|
+
"../agent-sdk/dist/chunk-KFN4X3GZ.js"() {
|
|
220287
220277
|
"use strict";
|
|
220288
220278
|
init_chunk_23UKWXJH();
|
|
220289
|
-
|
|
220279
|
+
init_chunk_OYXDU3HX();
|
|
220290
220280
|
init_chunk_QLWA4MJ5();
|
|
220291
220281
|
init_chunk_NIOWKTIF();
|
|
220292
220282
|
init_chunk_JEI7I3EH();
|
|
@@ -220385,7 +220375,7 @@ var init_chunk_AM7F65IC = __esm({
|
|
|
220385
220375
|
}
|
|
220386
220376
|
});
|
|
220387
220377
|
|
|
220388
|
-
// ../agent-sdk/dist/chunk-
|
|
220378
|
+
// ../agent-sdk/dist/chunk-SQCGHEU7.js
|
|
220389
220379
|
function toView3(row) {
|
|
220390
220380
|
return row;
|
|
220391
220381
|
}
|
|
@@ -220556,13 +220546,13 @@ function handleGetApiKeyActivity(request2, id) {
|
|
|
220556
220546
|
});
|
|
220557
220547
|
}
|
|
220558
220548
|
var ScopeSchema, PermissionsSchema, CreateBody2, PatchBody3;
|
|
220559
|
-
var
|
|
220560
|
-
"../agent-sdk/dist/chunk-
|
|
220549
|
+
var init_chunk_SQCGHEU7 = __esm({
|
|
220550
|
+
"../agent-sdk/dist/chunk-SQCGHEU7.js"() {
|
|
220561
220551
|
"use strict";
|
|
220562
220552
|
init_chunk_23UKWXJH();
|
|
220563
220553
|
init_chunk_MHQXDTJB();
|
|
220564
220554
|
init_chunk_2N2KL4KM();
|
|
220565
|
-
|
|
220555
|
+
init_chunk_OYXDU3HX();
|
|
220566
220556
|
init_chunk_ADK2TYO4();
|
|
220567
220557
|
init_chunk_I5ZA45YL();
|
|
220568
220558
|
init_chunk_5GZEX4HV();
|
|
@@ -220589,7 +220579,7 @@ var init_chunk_ZLUBNJEO = __esm({
|
|
|
220589
220579
|
}
|
|
220590
220580
|
});
|
|
220591
220581
|
|
|
220592
|
-
// ../agent-sdk/dist/chunk-
|
|
220582
|
+
// ../agent-sdk/dist/chunk-7WBVG6D4.js
|
|
220593
220583
|
function parseMs2(v2) {
|
|
220594
220584
|
if (!v2) return void 0;
|
|
220595
220585
|
const n = Number(v2);
|
|
@@ -220638,18 +220628,18 @@ function handleListAudit(request2) {
|
|
|
220638
220628
|
});
|
|
220639
220629
|
}
|
|
220640
220630
|
var VALID_OUTCOMES;
|
|
220641
|
-
var
|
|
220642
|
-
"../agent-sdk/dist/chunk-
|
|
220631
|
+
var init_chunk_7WBVG6D4 = __esm({
|
|
220632
|
+
"../agent-sdk/dist/chunk-7WBVG6D4.js"() {
|
|
220643
220633
|
"use strict";
|
|
220644
220634
|
init_chunk_23UKWXJH();
|
|
220645
220635
|
init_chunk_MHQXDTJB();
|
|
220646
|
-
|
|
220636
|
+
init_chunk_OYXDU3HX();
|
|
220647
220637
|
init_chunk_EZYKRG4W();
|
|
220648
220638
|
VALID_OUTCOMES = /* @__PURE__ */ new Set(["success", "denied", "failure"]);
|
|
220649
220639
|
}
|
|
220650
220640
|
});
|
|
220651
220641
|
|
|
220652
|
-
// ../agent-sdk/dist/chunk-
|
|
220642
|
+
// ../agent-sdk/dist/chunk-4IB3KV7S.js
|
|
220653
220643
|
function handleBatch(request2) {
|
|
220654
220644
|
return routeWrap(request2, async () => {
|
|
220655
220645
|
const body = await request2.json();
|
|
@@ -220676,11 +220666,11 @@ function handleBatch(request2) {
|
|
|
220676
220666
|
});
|
|
220677
220667
|
}
|
|
220678
220668
|
var OperationSchema, BatchSchema2;
|
|
220679
|
-
var
|
|
220680
|
-
"../agent-sdk/dist/chunk-
|
|
220669
|
+
var init_chunk_4IB3KV7S = __esm({
|
|
220670
|
+
"../agent-sdk/dist/chunk-4IB3KV7S.js"() {
|
|
220681
220671
|
"use strict";
|
|
220682
220672
|
init_chunk_S3SKODVV();
|
|
220683
|
-
|
|
220673
|
+
init_chunk_OYXDU3HX();
|
|
220684
220674
|
init_chunk_EZYKRG4W();
|
|
220685
220675
|
init_zod();
|
|
220686
220676
|
OperationSchema = external_exports.object({
|
|
@@ -220794,47 +220784,47 @@ __export(handlers_exports, {
|
|
|
220794
220784
|
var init_handlers3 = __esm({
|
|
220795
220785
|
"../agent-sdk/dist/handlers/index.js"() {
|
|
220796
220786
|
"use strict";
|
|
220797
|
-
|
|
220798
|
-
|
|
220787
|
+
init_chunk_FANJGS3D();
|
|
220788
|
+
init_chunk_5ZZX7JZP();
|
|
220799
220789
|
init_chunk_FB4OSWM2();
|
|
220800
|
-
|
|
220801
|
-
|
|
220802
|
-
|
|
220803
|
-
|
|
220804
|
-
|
|
220805
|
-
|
|
220806
|
-
|
|
220807
|
-
|
|
220790
|
+
init_chunk_KWB3FXD5();
|
|
220791
|
+
init_chunk_4XG3HLXP();
|
|
220792
|
+
init_chunk_DGLW2SSG();
|
|
220793
|
+
init_chunk_ZJFWDMML();
|
|
220794
|
+
init_chunk_HKAW5ATE();
|
|
220795
|
+
init_chunk_FEOW453X();
|
|
220796
|
+
init_chunk_NH63FTAL();
|
|
220797
|
+
init_chunk_BXMBMUCK();
|
|
220808
220798
|
init_chunk_R45W644X();
|
|
220809
|
-
|
|
220810
|
-
|
|
220811
|
-
|
|
220812
|
-
|
|
220799
|
+
init_chunk_RDGOGAQ5();
|
|
220800
|
+
init_chunk_CZHJNZAG();
|
|
220801
|
+
init_chunk_GK4SHVMZ();
|
|
220802
|
+
init_chunk_APWMSN3I();
|
|
220813
220803
|
init_chunk_ZP5VMV5O();
|
|
220814
|
-
|
|
220815
|
-
|
|
220816
|
-
|
|
220817
|
-
|
|
220804
|
+
init_chunk_3PEVKW47();
|
|
220805
|
+
init_chunk_5X4BWQJP();
|
|
220806
|
+
init_chunk_URHTKS66();
|
|
220807
|
+
init_chunk_UBS4LDDI();
|
|
220818
220808
|
init_chunk_F27XQZ2O();
|
|
220819
|
-
|
|
220820
|
-
|
|
220809
|
+
init_chunk_Q3GZ6QUQ();
|
|
220810
|
+
init_chunk_UWPHCWZO();
|
|
220821
220811
|
init_chunk_3LG7DRJL();
|
|
220822
|
-
|
|
220823
|
-
|
|
220824
|
-
|
|
220812
|
+
init_chunk_22KJNZXF();
|
|
220813
|
+
init_chunk_2RYJEIG3();
|
|
220814
|
+
init_chunk_E6F2Z3QT();
|
|
220825
220815
|
init_chunk_BZ6HFTHU();
|
|
220826
220816
|
init_chunk_STPT3SWU();
|
|
220827
|
-
|
|
220828
|
-
|
|
220829
|
-
|
|
220830
|
-
|
|
220817
|
+
init_chunk_KFN4X3GZ();
|
|
220818
|
+
init_chunk_SQCGHEU7();
|
|
220819
|
+
init_chunk_7WBVG6D4();
|
|
220820
|
+
init_chunk_4IB3KV7S();
|
|
220831
220821
|
init_chunk_YGAHGTVZ();
|
|
220832
220822
|
init_chunk_JK5TPJHH();
|
|
220833
220823
|
init_chunk_NXRJ7Z4G();
|
|
220834
220824
|
init_chunk_23UKWXJH();
|
|
220835
220825
|
init_chunk_4TKOEF6X();
|
|
220836
|
-
|
|
220837
|
-
|
|
220826
|
+
init_chunk_D2TRWKVQ();
|
|
220827
|
+
init_chunk_OXWELRJL();
|
|
220838
220828
|
init_chunk_7346CKTF();
|
|
220839
220829
|
init_chunk_DC2UMEQH();
|
|
220840
220830
|
init_chunk_S3SKODVV();
|
|
@@ -220842,31 +220832,31 @@ var init_handlers3 = __esm({
|
|
|
220842
220832
|
init_chunk_SDLNBA53();
|
|
220843
220833
|
init_chunk_MHQXDTJB();
|
|
220844
220834
|
init_chunk_2N2KL4KM();
|
|
220845
|
-
|
|
220835
|
+
init_chunk_OYXDU3HX();
|
|
220846
220836
|
init_chunk_D2XITRN6();
|
|
220847
220837
|
init_chunk_PWWRWR75();
|
|
220848
220838
|
init_chunk_QLWA4MJ5();
|
|
220849
220839
|
init_chunk_W6WKXFHN();
|
|
220850
220840
|
init_chunk_HVUWXUUI();
|
|
220851
|
-
|
|
220841
|
+
init_chunk_4X4KT4CJ();
|
|
220852
220842
|
init_chunk_HECQRMDR();
|
|
220853
|
-
|
|
220843
|
+
init_chunk_ORFFR5UG();
|
|
220854
220844
|
init_chunk_PJZ5TQYW();
|
|
220855
220845
|
init_chunk_AU4NAQGA();
|
|
220856
220846
|
init_chunk_H6TQGV4L();
|
|
220857
220847
|
init_chunk_SV2B3P6B();
|
|
220858
220848
|
init_chunk_72BKGVBE();
|
|
220859
|
-
|
|
220849
|
+
init_chunk_M4CTE7EH();
|
|
220860
220850
|
init_chunk_ACKMNK3C();
|
|
220861
220851
|
init_chunk_TWPTR2C2();
|
|
220862
220852
|
init_chunk_NIOWKTIF();
|
|
220863
|
-
|
|
220853
|
+
init_chunk_ZQGJKPPY();
|
|
220864
220854
|
init_chunk_ADK2TYO4();
|
|
220865
220855
|
init_chunk_3MQ2FWXS();
|
|
220866
|
-
|
|
220867
|
-
|
|
220856
|
+
init_chunk_U7GILP6F();
|
|
220857
|
+
init_chunk_G5CIMVGV();
|
|
220868
220858
|
init_chunk_LAWTTG2E();
|
|
220869
|
-
|
|
220859
|
+
init_chunk_ZMCS7MYZ();
|
|
220870
220860
|
init_chunk_DO4WVWW7();
|
|
220871
220861
|
init_chunk_RMZRSYIJ();
|
|
220872
220862
|
init_chunk_5ZFOKZGR();
|