manifest 5.36.4 → 5.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -1
- package/dist/backend/analytics/controllers/agents.controller.js +4 -3
- package/dist/backend/database/database.module.js +2 -0
- package/dist/backend/database/migrations/1774896789000-WidenApiKeyColumn.js +14 -0
- package/dist/backend/entities/agent-api-key.entity.js +1 -1
- package/dist/backend/otlp/services/api-key.service.js +12 -2
- package/dist/backend/routing/proxy/proxy-exception.filter.js +6 -6
- package/dist/backend/routing/proxy/proxy.controller.js +1 -1
- package/dist/backend/routing/proxy/proxy.service.js +3 -3
- package/dist/index.js +5 -4
- package/dist/openclaw.plugin.json +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/public/assets/{Account-howBDlvG.js → Account-BG3IIfK0.js} +1 -1
- package/public/assets/{Limits-CaSluPpI.js → Limits-BwtVg-so.js} +1 -1
- package/public/assets/{Login-m4XBY8ut.js → Login-D5ziTg76.js} +1 -1
- package/public/assets/{MessageLog-DKlKOoyz.js → MessageLog-Drmqnmod.js} +1 -1
- package/public/assets/{ModelPrices-DzvA4Tx9.js → ModelPrices-DSQh_Lab.js} +1 -1
- package/public/assets/{Overview-D66ngg-f.js → Overview-CpDqrM4-.js} +1 -1
- package/public/assets/{Register-nQzqvmBm.js → Register-CKCt4M8z.js} +1 -1
- package/public/assets/{ResetPassword-3tVnih5P.js → ResetPassword-BfH7TQ85.js} +1 -1
- package/public/assets/{Routing-ByUnqYRj.js → Routing-BmkcylCR.js} +1 -1
- package/public/assets/Settings-3DW-MtJA.js +1 -0
- package/public/assets/SetupStepAddProvider-Cp888sYN.js +3 -0
- package/public/assets/{SocialButtons-C4gw7_uX.js → SocialButtons-9QmGwKhz.js} +1 -1
- package/public/assets/index-Cgw0A75I.css +1 -0
- package/public/assets/{index-Ca5I2Nlk.js → index-DhYFMC_u.js} +2 -2
- package/public/assets/{model-display-D41uy_hy.js → model-display-DJPEaCHL.js} +1 -1
- package/public/assets/{overview-CxeNaHB-.js → overview-C73m0GiL.js} +1 -1
- package/public/assets/{routing-CoiHtFLh.js → routing-RJ-kb3bi.js} +1 -1
- package/public/assets/{routing-utils-CXUPRM5D.js → routing-utils-C6mUnWrX.js} +1 -1
- package/public/index.html +2 -2
- package/public/assets/Settings-6gEXAscQ.js +0 -1
- package/public/assets/SetupStepAddProvider-1kzQB5Of.js +0 -3
- package/public/assets/index-8qMFCIBN.css +0 -1
package/README.md
CHANGED
|
@@ -56,9 +56,22 @@ openclaw gateway restart
|
|
|
56
56
|
|
|
57
57
|
Dashboard opens at **http://127.0.0.1:2099**. The plugin starts an embedded server, runs the dashboard locally, and registers itself as a provider automatically. No account or API key needed.
|
|
58
58
|
|
|
59
|
+
### Docker
|
|
60
|
+
|
|
61
|
+
Run the full Manifest stack (app + PostgreSQL) with a single command:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
curl -O https://raw.githubusercontent.com/mnfst/manifest/main/docker-compose.yml
|
|
65
|
+
docker compose up -d
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Open **http://localhost:3001** and log in with `admin@manifest.build` / `manifest`.
|
|
69
|
+
|
|
70
|
+
See the [Docker Hub page](https://hub.docker.com/r/manifestdotbuild/manifest) for more options (custom ports, standalone Docker run, environment variables).
|
|
71
|
+
|
|
59
72
|
### Cloud vs local
|
|
60
73
|
|
|
61
|
-
Pick cloud version for quick setup and multi-device access. Pick local version for keeping all your data on your machine or for using local models like Ollama.
|
|
74
|
+
Pick cloud version for quick setup and multi-device access. Pick local version for keeping all your data on your machine or for using local models like Ollama. Pick Docker for self-hosting on your own infrastructure.
|
|
62
75
|
|
|
63
76
|
Not sure which one to choose? Start with cloud.
|
|
64
77
|
|
|
@@ -82,10 +82,11 @@ let AgentsController = class AgentsController {
|
|
|
82
82
|
const keyData = await this.apiKeyGenerator.getKeyForAgent(user.id, agentName);
|
|
83
83
|
const customEndpoint = this.config.get('app.pluginOtlpEndpoint', '');
|
|
84
84
|
const isLocal = this.config.get('MANIFEST_MODE') === 'local';
|
|
85
|
-
const
|
|
85
|
+
const localKey = isLocal && agentName === local_mode_constants_1.LOCAL_AGENT_NAME ? (0, local_mode_constants_1.readLocalApiKey)() : undefined;
|
|
86
|
+
const apiKey = localKey ?? keyData.fullKey ?? undefined;
|
|
86
87
|
return {
|
|
87
|
-
|
|
88
|
-
...(
|
|
88
|
+
keyPrefix: keyData.keyPrefix,
|
|
89
|
+
...(apiKey ? { apiKey } : {}),
|
|
89
90
|
...(customEndpoint ? { pluginEndpoint: customEndpoint } : {}),
|
|
90
91
|
};
|
|
91
92
|
}
|
|
@@ -72,6 +72,7 @@ const _1773700000000_DropSecurityEventTable_1 = require("./migrations/1773700000
|
|
|
72
72
|
const _1773800000000_FixNegativeCosts_1 = require("./migrations/1773800000000-FixNegativeCosts");
|
|
73
73
|
const _1773900000000_AddKeyPrefixIndex_1 = require("./migrations/1773900000000-AddKeyPrefixIndex");
|
|
74
74
|
const _1774000000000_WidenKeyHashColumn_1 = require("./migrations/1774000000000-WidenKeyHashColumn");
|
|
75
|
+
const _1774896789000_WidenApiKeyColumn_1 = require("./migrations/1774896789000-WidenApiKeyColumn");
|
|
75
76
|
const entities = [
|
|
76
77
|
agent_message_entity_1.AgentMessage,
|
|
77
78
|
llm_call_entity_1.LlmCall,
|
|
@@ -131,6 +132,7 @@ const migrations = [
|
|
|
131
132
|
_1773800000000_FixNegativeCosts_1.FixNegativeCosts1773800000000,
|
|
132
133
|
_1773900000000_AddKeyPrefixIndex_1.AddKeyPrefixIndex1773900000000,
|
|
133
134
|
_1774000000000_WidenKeyHashColumn_1.WidenKeyHashColumn1774000000000,
|
|
135
|
+
_1774896789000_WidenApiKeyColumn_1.WidenApiKeyColumn1774896789000,
|
|
134
136
|
];
|
|
135
137
|
const isLocalMode = process.env['MANIFEST_MODE'] === 'local';
|
|
136
138
|
function buildModeServices() {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WidenApiKeyColumn1774896789000 = void 0;
|
|
4
|
+
class WidenApiKeyColumn1774896789000 {
|
|
5
|
+
name = 'WidenApiKeyColumn1774896789000';
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
await queryRunner.query(`ALTER TABLE "agent_api_keys" ALTER COLUMN "key" TYPE character varying(255)`);
|
|
8
|
+
}
|
|
9
|
+
async down(queryRunner) {
|
|
10
|
+
await queryRunner.query(`ALTER TABLE "agent_api_keys" ALTER COLUMN "key" TYPE character varying(64) USING left("key", 64)`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.WidenApiKeyColumn1774896789000 = WidenApiKeyColumn1774896789000;
|
|
14
|
+
//# sourceMappingURL=1774896789000-WidenApiKeyColumn.js.map
|
|
@@ -35,7 +35,7 @@ __decorate([
|
|
|
35
35
|
__metadata("design:type", String)
|
|
36
36
|
], AgentApiKey.prototype, "id", void 0);
|
|
37
37
|
__decorate([
|
|
38
|
-
(0, typeorm_1.Column)('varchar', { length:
|
|
38
|
+
(0, typeorm_1.Column)('varchar', { length: 255, nullable: true }),
|
|
39
39
|
__metadata("design:type", Object)
|
|
40
40
|
], AgentApiKey.prototype, "key", void 0);
|
|
41
41
|
__decorate([
|
|
@@ -22,6 +22,7 @@ const tenant_entity_1 = require("../../entities/tenant.entity");
|
|
|
22
22
|
const agent_entity_1 = require("../../entities/agent.entity");
|
|
23
23
|
const agent_api_key_entity_1 = require("../../entities/agent-api-key.entity");
|
|
24
24
|
const hash_util_1 = require("../../common/utils/hash.util");
|
|
25
|
+
const crypto_util_1 = require("../../common/utils/crypto.util");
|
|
25
26
|
const api_key_constants_1 = require("../../common/constants/api-key.constants");
|
|
26
27
|
const agent_key_auth_guard_1 = require("../guards/agent-key-auth.guard");
|
|
27
28
|
let ApiKeyGeneratorService = class ApiKeyGeneratorService {
|
|
@@ -69,7 +70,7 @@ let ApiKeyGeneratorService = class ApiKeyGeneratorService {
|
|
|
69
70
|
const keyId = (0, uuid_1.v4)();
|
|
70
71
|
await this.keyRepo.insert({
|
|
71
72
|
id: keyId,
|
|
72
|
-
key:
|
|
73
|
+
key: (0, crypto_util_1.encrypt)(rawKey, (0, crypto_util_1.getEncryptionSecret)()),
|
|
73
74
|
key_hash: (0, hash_util_1.hashKey)(rawKey),
|
|
74
75
|
key_prefix: (0, hash_util_1.keyPrefix)(rawKey),
|
|
75
76
|
label: `${params.agentName} ingest key`,
|
|
@@ -91,6 +92,15 @@ let ApiKeyGeneratorService = class ApiKeyGeneratorService {
|
|
|
91
92
|
if (!keyRecord) {
|
|
92
93
|
throw new common_1.NotFoundException('No active API key found for this agent');
|
|
93
94
|
}
|
|
95
|
+
if (keyRecord.key) {
|
|
96
|
+
try {
|
|
97
|
+
const fullKey = (0, crypto_util_1.decrypt)(keyRecord.key, (0, crypto_util_1.getEncryptionSecret)());
|
|
98
|
+
return { keyPrefix: keyRecord.key_prefix, fullKey };
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return { keyPrefix: keyRecord.key_prefix };
|
|
102
|
+
}
|
|
103
|
+
}
|
|
94
104
|
return { keyPrefix: keyRecord.key_prefix };
|
|
95
105
|
}
|
|
96
106
|
async rotateKey(userId, agentName) {
|
|
@@ -108,7 +118,7 @@ let ApiKeyGeneratorService = class ApiKeyGeneratorService {
|
|
|
108
118
|
const keyId = (0, uuid_1.v4)();
|
|
109
119
|
await this.keyRepo.insert({
|
|
110
120
|
id: keyId,
|
|
111
|
-
key:
|
|
121
|
+
key: (0, crypto_util_1.encrypt)(rawKey, (0, crypto_util_1.getEncryptionSecret)()),
|
|
112
122
|
key_hash: (0, hash_util_1.hashKey)(rawKey),
|
|
113
123
|
key_prefix: (0, hash_util_1.keyPrefix)(rawKey),
|
|
114
124
|
label: `${agent.name} ingest key (rotated)`,
|
|
@@ -14,11 +14,11 @@ const common_1 = require("@nestjs/common");
|
|
|
14
14
|
const config_1 = require("@nestjs/config");
|
|
15
15
|
const proxy_friendly_response_1 = require("./proxy-friendly-response");
|
|
16
16
|
const AUTH_ERROR_MESSAGES = {
|
|
17
|
-
'Authorization header required': '[Manifest] Missing API key. Set your Manifest key (starts with mnfst_) as the Bearer token.',
|
|
18
|
-
'Empty token': '[Manifest] Bearer token is empty — paste your Manifest API key into the authorization field.',
|
|
19
|
-
'Invalid API key format': '[Manifest] That doesn\'t look like a Manifest key. They start with "mnfst_" — check your dashboard.',
|
|
20
|
-
'API key expired': '[Manifest] This API key expired. Generate a new one from your Manifest dashboard',
|
|
21
|
-
'Invalid API key': "[Manifest] This API key wasn't recognized — it may have been rotated or deleted. Check your dashboard for the current key.",
|
|
17
|
+
'Authorization header required': '[🦚 Manifest] Missing API key. Set your Manifest key (starts with mnfst_) as the Bearer token.',
|
|
18
|
+
'Empty token': '[🦚 Manifest] Bearer token is empty — paste your Manifest API key into the authorization field.',
|
|
19
|
+
'Invalid API key format': '[🦚 Manifest] That doesn\'t look like a Manifest key. They start with "mnfst_" — check your dashboard.',
|
|
20
|
+
'API key expired': '[🦚 Manifest] This API key expired. Generate a new one from your Manifest dashboard',
|
|
21
|
+
'Invalid API key': "[🦚 Manifest] This API key wasn't recognized — it may have been rotated or deleted. Check your dashboard for the current key.",
|
|
22
22
|
};
|
|
23
23
|
const PASSTHROUGH_STATUSES = new Set([429]);
|
|
24
24
|
let ProxyExceptionFilter = class ProxyExceptionFilter {
|
|
@@ -54,7 +54,7 @@ let ProxyExceptionFilter = class ProxyExceptionFilter {
|
|
|
54
54
|
(0, proxy_friendly_response_1.sendFriendlyResponse)(res, content, isStream);
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
const content = status >= 500 ? '[Manifest] Something broke on our end. Try again shortly.' : message;
|
|
57
|
+
const content = status >= 500 ? '[🦚 Manifest] Something broke on our end. Try again shortly.' : message;
|
|
58
58
|
(0, proxy_friendly_response_1.sendFriendlyResponse)(res, content, isStream);
|
|
59
59
|
}
|
|
60
60
|
};
|
|
@@ -113,7 +113,7 @@ let ProxyController = ProxyController_1 = class ProxyController {
|
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
115
|
const isStream = req.body?.stream === true;
|
|
116
|
-
const clientMessage = status >= 500 ? '[Manifest] Something broke on our end. Try again shortly.' : message;
|
|
116
|
+
const clientMessage = status >= 500 ? '[🦚 Manifest] Something broke on our end. Try again shortly.' : message;
|
|
117
117
|
(0, proxy_friendly_response_1.sendFriendlyResponse)(res, clientMessage, isStream);
|
|
118
118
|
}
|
|
119
119
|
finally {
|
|
@@ -77,7 +77,7 @@ let ProxyService = ProxyService_1 = class ProxyService {
|
|
|
77
77
|
let apiKey = await this.providerKeyService.getProviderApiKey(agentId, resolved.provider, resolved.auth_type);
|
|
78
78
|
if (apiKey === null) {
|
|
79
79
|
const dashboardUrl = (0, proxy_friendly_response_1.getDashboardUrl)(this.config, agentName);
|
|
80
|
-
const content = `[Manifest] No API key set for ${resolved.provider} yet. Add one here: ${dashboardUrl}`;
|
|
80
|
+
const content = `[🦚 Manifest] No API key set for ${resolved.provider} yet. Add one here: ${dashboardUrl}`;
|
|
81
81
|
return (0, proxy_friendly_response_1.buildFriendlyResponse)(content, body.stream === true, 'no_provider_key');
|
|
82
82
|
}
|
|
83
83
|
const resolvedCredentials = await (0, proxy_fallback_service_1.resolveApiKey)(resolved.provider, apiKey, resolved.auth_type, agentId, userId, this.openaiOauth, this.minimaxOauth);
|
|
@@ -180,7 +180,7 @@ let ProxyService = ProxyService_1 = class ProxyService {
|
|
|
180
180
|
? `$${Number(exceeded.threshold).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`
|
|
181
181
|
: Number(exceeded.threshold).toLocaleString(undefined, { maximumFractionDigits: 0 });
|
|
182
182
|
const dashboardUrl = (0, proxy_friendly_response_1.getDashboardUrl)(this.config, agentName);
|
|
183
|
-
return `[Manifest] Usage limit hit: ${exceeded.metricType} is at ${fmt} (limit: ${threshFmt}/${exceeded.period}). You can adjust it here: ${dashboardUrl}`;
|
|
183
|
+
return `[🦚 Manifest] Usage limit hit: ${exceeded.metricType} is at ${fmt} (limit: ${threshFmt}/${exceeded.period}). You can adjust it here: ${dashboardUrl}`;
|
|
184
184
|
}
|
|
185
185
|
filterScoringMessages(messages) {
|
|
186
186
|
return messages
|
|
@@ -200,7 +200,7 @@ let ProxyService = ProxyService_1 = class ProxyService {
|
|
|
200
200
|
}
|
|
201
201
|
buildNoProviderResult(stream, agentName) {
|
|
202
202
|
const dashboardUrl = (0, proxy_friendly_response_1.getDashboardUrl)(this.config, agentName);
|
|
203
|
-
const content = `[Manifest] Manifest is connected successfully. To start routing requests, connect a model provider: ${dashboardUrl}`;
|
|
203
|
+
const content = `[🦚 Manifest] Manifest is connected successfully. To start routing requests, connect a model provider: ${dashboardUrl}`;
|
|
204
204
|
return (0, proxy_friendly_response_1.buildFriendlyResponse)(content, stream, 'no_provider');
|
|
205
205
|
}
|
|
206
206
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/* manifest-local — OpenClaw Self-Hosted LLM Router */
|
|
2
|
-
"use strict";var f=require("fs"),l=require("path"),
|
|
2
|
+
"use strict";var f=require("fs"),l=require("path"),g=require("os"),u=(0,l.join)((0,g.homedir)(),".openclaw","manifest"),h=3e3;async function d(i,t){try{let e=await fetch(`http://${i}:${t}/api/v1/health`,{signal:AbortSignal.timeout(h)});if(!e.ok)return!1;let n=await e.json();return n!==null&&typeof n=="object"&&"status"in n&&n.status==="healthy"}catch{return!1}}function m(i,t,e,n){(0,f.existsSync)(u)||(0,f.mkdirSync)(u,{recursive:!0,mode:448});let a=(0,l.join)(u,"manifest.db");n.debug("[manifest] Starting embedded server...");let o;try{o=require("./server")}catch(r){let s=r instanceof Error?r.message:String(r);n.error(`[manifest] Failed to load embedded server.
|
|
3
3
|
Error: ${s}
|
|
4
4
|
This is a packaging error \u2014 please reinstall the manifest plugin.`);return}i.registerService({id:"manifest",start:async()=>{if(n.debug("[manifest] Service start callback invoked"),await d(e,t)){n.info(`[manifest] Reusing existing server at http://${e}:${t}`);return}try{await o.start({port:t,host:e,dbPath:a,quiet:!0}),await d(e,t)?(n.info(`[manifest] Dashboard -> http://${e}:${t}`),n.info(`[manifest] DB: ${a}`)):(n.warn??n.info)(`[manifest] Server started but health check failed.
|
|
5
5
|
The dashboard may not be accessible at http://${e}:${t}`)}catch(s){let c=s instanceof Error?s.message:String(s);c.includes("EADDRINUSE")||c.includes("address already in use")?await d(e,t)?n.info(`[manifest] Reusing existing server at http://${e}:${t}`):n.error(`[manifest] Port ${t} is already in use by another process.
|
|
6
6
|
Change it with: openclaw config set plugins.entries.manifest.config.port ${t+1}
|
|
7
7
|
Then restart the gateway.`):n.error(`[manifest] Failed to start local server: ${c}
|
|
8
8
|
Try reinstalling: openclaw plugins install manifest
|
|
9
|
-
Then restart: openclaw gateway restart`)}}})}module.exports={id:"manifest",name:"Manifest Self-Hosted LLM Router",register(i){let t=i.logger||{info:(...r)=>console.log(...r),debug:()=>{},error:(...r)=>console.error(...r),warn:(...r)=>console.warn(...r)},e=i.pluginConfig||{},n=e&&typeof e=="object"&&"config"in e&&e.config!=null&&typeof e.config=="object"?e.config:e,a=typeof n.port=="number"&&n.port>0?n.port:2099,o=typeof n.host=="string"&&n.host.length>0?n.host:"127.0.0.1";t.info(`
|
|
10
|
-
[
|
|
11
|
-
[
|
|
9
|
+
Then restart: openclaw gateway restart`)}}})}module.exports={id:"manifest",name:"Manifest Self-Hosted LLM Router",register(i){let t=i.logger||{info:(...r)=>console.log(...r),debug:()=>{},error:(...r)=>console.error(...r),warn:(...r)=>console.warn(...r)},e=i.pluginConfig||{},n=e&&typeof e=="object"&&"config"in e&&e.config!=null&&typeof e.config=="object"?e.config:e,a=typeof n.port=="number"&&n.port>0?n.port:2099,o=typeof n.host=="string"&&n.host.length>0?n.host:"127.0.0.1";t.info(`
|
|
10
|
+
[\u{1F99A} Manifest] Dashboard: http://${o}:${a}
|
|
11
|
+
[\u{1F99A} Manifest] The plugin starts an embedded server.
|
|
12
|
+
[\u{1F99A} Manifest] Open the dashboard to connect a provider and start routing.`),m(i,a,o,t)}};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "manifest",
|
|
3
3
|
"name": "Manifest Self-Hosted LLM Router",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.37.0",
|
|
5
5
|
"description": "Run the Manifest LLM router locally with SQLite. Zero-config dashboard included.",
|
|
6
6
|
"author": "MNFST Inc.",
|
|
7
7
|
"homepage": "https://manifest.build",
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "manifest",
|
|
3
3
|
"name": "Manifest Self-Hosted LLM Router",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.37.0",
|
|
5
5
|
"description": "Run the Manifest LLM router locally with SQLite. Zero-config dashboard included.",
|
|
6
6
|
"author": "MNFST Inc.",
|
|
7
7
|
"homepage": "https://manifest.build",
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as H,a as b,e as R,i as c,g as d,T as V,M as W,h,m as Z,S as M,t as l,d as F}from"./vendor-pl6Q4jbW.js";import{s as G,u as J,v as K,d as L,w as E}from"./index-
|
|
1
|
+
import{b as H,a as b,e as R,i as c,g as d,T as V,M as W,h,m as Z,S as M,t as l,d as F}from"./vendor-pl6Q4jbW.js";import{s as G,u as J,v as K,d as L,w as E}from"./index-DhYFMC_u.js";import"./auth-DmX5tAfx.js";var O=l("<h3 class=settings-section__title>Profile information"),Q=l('<div class=settings-card><div class=settings-card__row><div class=settings-card__label><span class=settings-card__label-title>Display name</span><span class=settings-card__label-desc>Name shown throughout the dashboard.</span></div><div class=settings-card__control><input class=settings-card__input type=text aria-label="Display name"readonly></div></div><div class=settings-card__row><div class=settings-card__label><span class=settings-card__label-title>Email</span><span class=settings-card__label-desc>Used for account notifications and limit alerts.</span></div><div class=settings-card__control><input class=settings-card__input type=email aria-label=Email readonly></div></div><div class=settings-card__footer><span style=font-size:var(--font-size-xs);color:hsl(var(--muted-foreground))>Profile information is managed through your authentication provider.'),X=l("<h3 class=settings-section__title>Workspace"),ee=l("<div class=settings-card><div class=settings-card__body><p class=settings-card__desc>Your unique workspace identifier. You may need this for support requests or advanced integrations.</p><div class=settings-card__id-row><code class=settings-card__id-value></code><button class=settings-card__copy-btn title=Copy>"),te=l("<h3 class=settings-section__title>Profile"),se=l('<div class=settings-card><div class=settings-card__row><div class=settings-card__label><span class=settings-card__label-title>Display name</span><span class=settings-card__label-desc>Name shown throughout the dashboard.</span></div><div class=settings-card__control><input class=settings-card__input type=text aria-label="Display name"placeholder="Local User">'),ie=l('<div class=account-modal><div class=account-modal__inner><button class=account-modal__back><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="m15 18-6-6 6-6"></path></svg>Back</button><div class=page-header><div><h1>Account Preferences</h1><span class=breadcrumb>Your profile, workspace details, and display preferences</span></div></div><h3 class=settings-section__title>Appearance</h3><div class=settings-card><div class=settings-card__body><p class=settings-card__desc>Choose how Manifest looks for you.</p><div class=theme-picker><button class=theme-picker__option><svg width=18 height=18 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><circle cx=12 cy=12 r=4></circle><path d="M12 2v2"></path><path d="M12 20v2"></path><path d="m4.93 4.93 1.41 1.41"></path><path d="m17.66 17.66 1.41 1.41"></path><path d="M2 12h2"></path><path d="M20 12h2"></path><path d="m6.34 17.66-1.41 1.41"></path><path d="m19.07 4.93-1.41 1.41"></path></svg>Light</button><button class=theme-picker__option><svg width=18 height=18 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"></path></svg>Dark</button><button class=theme-picker__option><svg width=18 height=18 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><rect x=2 y=3 width=20 height=14 rx=2></rect><path d="M8 21h8"></path><path d="M12 17v4"></path></svg>System'),ae=l('<svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><polyline points="20 6 9 17 4 12">'),le=l('<svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><rect x=9 y=9 width=13 height=13 rx=2></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1">');const ce=()=>{const N=H(),p=G.useSession(),[T,w]=b(!1),[_,g]=b("system"),[u,y]=b(""),B=()=>p()?.data?.user?.name??"",D=()=>p()?.data?.user?.email??"",x=()=>p()?.data?.user?.id??"";R(()=>{J(),y(K()||"Local User");const t=localStorage.getItem("theme");g(t==="dark"||t==="light"?t:"system")});const m=t=>{if(g(t),t==="system"){localStorage.removeItem("theme");const o=window.matchMedia("(prefers-color-scheme: dark)").matches;document.documentElement.classList.toggle("dark",o)}else localStorage.setItem("theme",t),document.documentElement.classList.toggle("dark",t==="dark")},j=()=>{navigator.clipboard.writeText(x()),w(!0),setTimeout(()=>w(!1),2e3)};return(()=>{var t=ie(),o=t.firstChild,C=o.firstChild,I=C.nextSibling,v=I.nextSibling,P=v.nextSibling,A=P.firstChild,U=A.firstChild,Y=U.nextSibling,k=Y.firstChild,f=k.nextSibling,S=f.nextSibling;return c(t,d(V,{children:"Account Preferences - Manifest"}),o),c(t,d(W,{name:"description",content:"Manage your profile, workspace, and theme preferences."}),o),C.$$click=()=>N(-1),c(o,d(M,{get when(){return!L()},get children(){return[O(),(()=>{var e=Q(),s=e.firstChild,r=s.firstChild,n=r.nextSibling,i=n.firstChild,a=s.nextSibling,$=a.firstChild,q=$.nextSibling,z=q.firstChild;return h(()=>i.value=B()),h(()=>z.value=D()),e})(),X(),(()=>{var e=ee(),s=e.firstChild,r=s.firstChild,n=r.nextSibling,i=n.firstChild,a=i.nextSibling;return c(i,x),a.$$click=j,c(a,(()=>{var $=Z(()=>!!T());return()=>$()?ae():le()})()),e})()]}}),v),c(o,d(M,{get when(){return L()},get children(){return[te(),(()=>{var e=se(),s=e.firstChild,r=s.firstChild,n=r.nextSibling,i=n.firstChild;return i.$$keydown=a=>{a.key==="Enter"&&(E(u()),a.currentTarget.blur())},i.addEventListener("blur",()=>E(u())),i.$$input=a=>y(a.currentTarget.value),h(()=>i.value=u()),e})()]}}),v),k.$$click=()=>m("light"),f.$$click=()=>m("dark"),S.$$click=()=>m("system"),h(e=>{var s=_()==="light",r=_()==="dark",n=_()==="system";return s!==e.e&&k.classList.toggle("theme-picker__option--active",e.e=s),r!==e.t&&f.classList.toggle("theme-picker__option--active",e.t=r),n!==e.a&&S.classList.toggle("theme-picker__option--active",e.a=n),e},{e:void 0,t:void 0,a:void 0}),t})()};F(["click","input","keydown"]);export{ce as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i,t as d,a as $,f as Le,g as l,S as _,h as w,s as z,m as J,P as ve,d as ie,o as De,F as ge,B as ke,j as de,n as Ke,k as me,T as ze,M as je}from"./vendor-pl6Q4jbW.js";import{e as pe,q as ne,B as le,s as Ne,d as se,t as K,b as $e}from"./index-Ca5I2Nlk.js";import{a as He}from"./provider-api-key-urls-1G6okUJ7.js";import{a as Ge}from"./routing-CoiHtFLh.js";import"./auth-DmX5tAfx.js";function Ve(e){return pe("/notifications/logs",{agent_name:e})}function qe(e){return pe("/notifications",{agent_name:e})}function Ue(e){return ne(`${le}/notifications`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}function Je(e,t){return ne(`${le}/notifications/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}function Fe(e){return ne(`${le}/notifications/${encodeURIComponent(e)}`,{method:"DELETE"})}async function We(){const e=await pe("/notifications/email-provider");return"configured"in e&&e.configured===!1?null:e}function Ze(e){return ne(`${le}/notifications/email-provider`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}function Ye(){return ne(`${le}/notifications/email-provider`,{method:"DELETE"})}function Xe(e){return ne(`${le}/notifications/email-provider/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}function Qe(e){return ne(`${le}/notifications/email-provider/test-saved`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({to:e})})}var et=d('<div class=cloud-email-info><svg class=cloud-email-info__icon width=20 height=20 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg><div><div class=cloud-email-info__title>Email alerts</div><div class=cloud-email-info__desc>Alerts will be sent to <strong>');const tt=e=>(()=>{var t=et(),n=t.firstChild,a=n.nextSibling,s=a.firstChild,o=s.nextSibling,u=o.firstChild,v=u.nextSibling;return i(v,()=>e.email),t})();var it=d("<input class=modal-card__input type=text autocomplete=off autofocus style=-webkit-text-security:disc;text-security:disc>"),we=d("<p class=modal-card__field-error>"),nt=d('<p class=modal-card__field-hint><a class=modal-card__field-link target=_blank rel="noopener noreferrer">Get <!> API key'),lt=d("<label class=modal-card__field-label>Sending domain"),rt=d('<input class=modal-card__input type=text placeholder="e.g. notifications.mycompany.com">'),at=d('<div class=modal-overlay><div class=modal-card role=dialog aria-modal=true aria-labelledby=provider-modal-title><h2 class=modal-card__title id=provider-modal-title></h2><p class=modal-card__desc>Enter your API credentials to enable email alert delivery.</p><label class=modal-card__field-label>Provider</label><div class=provider-modal-picker><button class=provider-modal-option type=button><img src=/logos/resend.svg alt class=provider-modal-option__logo><span>Resend</span></button><button class=provider-modal-option type=button><img src=/logos/mailgun.svg alt class=provider-modal-option__logo><span>Mailgun</span></button><button class=provider-modal-option type=button><img src=/logos/sendgrid.svg alt class=provider-modal-option__logo><span>SendGrid</span></button></div><label class=modal-card__field-label>API Key</label><label class=modal-card__field-label>Notification email</label><input class=modal-card__input type=email><p class=modal-card__field-hint>Where threshold alerts will be sent.</p><div class="modal-card__footer modal-card__footer--split"><button class="btn btn--ghost btn--sm"type=button></button><button class="btn btn--primary btn--sm">'),ot=d('<div class=masked-key><span class=masked-key__value></span><button class="btn btn--ghost btn--sm masked-key__edit"type=button>Change'),st=d("<span class=spinner>");const Ce=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i,Se={resend:"Resend",mailgun:"Mailgun",sendgrid:"SendGrid"},Ae=e=>{const[t,n]=$("resend"),[a,s]=$(""),[o,u]=$(""),[v,h]=$(""),[C,S]=$(!1),[x,T]=$(!1),[R,f]=$(""),[k,m]=$(""),[b,j]=$(!1),M=Ne.useSession(),D=()=>e.editMode&&!!e.existingKeyPrefix&&t()===e.initialProvider,A=()=>(e.existingKeyPrefix??"")+"••••••••";Le(()=>{if(e.open){n(e.initialProvider),s("");const r=e.editMode&&!!e.existingKeyPrefix;j(!r),u(e.existingDomain??"");const p=e.existingNotificationEmail??(se()?"":M()?.data?.user?.email??"");h(p),f(""),m("")}});const H=()=>t()==="mailgun",I=()=>{let r=!0;const p=a().trim(),P=o().trim().toLowerCase();return!b()&&D()?f(""):p?p.length<8?(f("API key must be at least 8 characters"),r=!1):t()==="resend"&&!p.startsWith("re_")?(f("Resend API key must start with re_"),r=!1):t()==="sendgrid"&&!p.startsWith("SG.")?(f("SendGrid API key must start with SG."),r=!1):f(""):(f("API key is required"),r=!1),H()?P?Ce.test(P)?m(""):(m("Invalid domain format"),r=!1):(m("Domain is required"),r=!1):P&&!Ce.test(P)?(m("Invalid domain format"),r=!1):m(""),r},Z=()=>{const r=v().trim();return r||(M()?.data?.user?.email??null)},N=async()=>{const r=a().trim(),p=o().trim().toLowerCase(),P=Z();if(!P)return K.error("Enter a notification email to send the test to"),!1;T(!0);try{const L={provider:t(),apiKey:r,to:P};p&&(L.domain=p);const q=await Xe(L);return q.success?!0:(K.error(q.error??"Email test failed — check your credentials"),!1)}catch{return!1}finally{T(!1)}},re=async()=>{const r=Z();if(!r)return K.error("Enter a notification email to send the test to"),!1;T(!0);try{const p=await Qe(r);return p.success?!0:(K.error(p.error??"Email test failed — check your credentials"),!1)}catch{return!1}finally{T(!1)}},ae=async()=>{if(!I()||X())return;(!b()&&D()?await re():await N())&&K.success(`Test email sent to ${Z()}`)},Y=async()=>{if(!I()||C()||x())return;const r=!b()&&D();if(!(r?await re():await N()))return;const P=o().trim().toLowerCase();S(!0);try{const L={provider:t()};r||(L.apiKey=a().trim()),P&&(L.domain=P);const q=v().trim();q&&(L.notificationEmail=q),await Ze(L);const oe=Se[t()]??t();K.success(`${oe} connected`),e.onSaved(),e.onClose()}catch{}finally{S(!1)}},G=r=>{r.key==="Enter"&&Y(),r.key==="Escape"&&e.onClose()},X=()=>C()||x(),Q=()=>!b()&&D()?!!(H()&&!o().trim()):!!(!a().trim()||H()&&!o().trim()),V=()=>x()?"Testing...":C()?"Saving...":e.editMode?"Test & Save":"Test & Connect",ee=()=>He(t()),te=()=>{switch(t()){case"resend":return"re_xxxx...";case"sendgrid":return"SG.xxxx...";default:return"key-xxxx..."}};return l(ve,{get children(){return l(_,{get when(){return e.open},get children(){var r=at(),p=r.firstChild,P=p.firstChild,L=P.nextSibling,q=L.nextSibling,oe=q.nextSibling,ce=oe.firstChild,g=ce.nextSibling,y=g.nextSibling,ue=oe.nextSibling,O=ue.nextSibling,F=O.nextSibling,he=F.nextSibling,_e=he.nextSibling,B=_e.firstChild,fe=B.nextSibling;return r.$$click=()=>e.onClose(),p.$$click=c=>c.stopPropagation(),i(P,()=>e.editMode?"Edit email provider":"Configure email provider"),ce.$$click=()=>{n("resend"),f("")},g.$$click=()=>{n("mailgun"),f("")},y.$$click=()=>{n("sendgrid"),f("")},i(p,l(_,{get when(){return b()||!D()},get fallback(){return(()=>{var c=ot(),E=c.firstChild,U=E.nextSibling;return i(E,A),U.$$click=()=>{j(!0),s("")},c})()},get children(){var c=it();return c.$$keydown=G,c.$$input=E=>{s(E.currentTarget.value),f("")},w(E=>{var U=!!R(),W=te();return U!==E.e&&c.classList.toggle("modal-card__input--error",E.e=U),W!==E.t&&z(c,"placeholder",E.t=W),E},{e:void 0,t:void 0}),w(()=>c.value=a()),c}}),O),i(p,l(_,{get when(){return R()},get children(){var c=we();return i(c,R),c}}),O),i(p,l(_,{get when(){return ee()},get children(){var c=nt(),E=c.firstChild,U=E.firstChild,W=U.nextSibling;return W.nextSibling,i(E,()=>Se[t()]??t(),W),w(()=>z(E,"href",ee())),c}}),O),i(p,l(_,{get when(){return H()},get children(){return[lt(),(()=>{var c=rt();return c.$$keydown=G,c.$$input=E=>{u(E.currentTarget.value),m("")},w(()=>c.classList.toggle("modal-card__input--error",!!k())),w(()=>c.value=o()),c})(),l(_,{get when(){return k()},get children(){var c=we();return i(c,k),c}})]}}),O),F.$$keydown=G,F.$$input=c=>h(c.currentTarget.value),B.$$click=ae,i(B,(()=>{var c=J(()=>!!x());return()=>c()?st():"Send test email"})()),fe.$$click=Y,i(fe,V),w(c=>{var E=t()==="resend",U=t()==="mailgun",W=t()==="sendgrid",be=se()?"you@example.com":M()?.data?.user?.email??"you@example.com",ye=X()||Q(),xe=X()||Q();return E!==c.e&&ce.classList.toggle("provider-modal-option--active",c.e=E),U!==c.t&&g.classList.toggle("provider-modal-option--active",c.t=U),W!==c.a&&y.classList.toggle("provider-modal-option--active",c.a=W),be!==c.o&&z(F,"placeholder",c.o=be),ye!==c.i&&(B.disabled=c.i=ye),xe!==c.n&&(fe.disabled=c.n=xe),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),w(()=>F.value=v()),r}})}})};ie(["click","input","keydown"]);var dt=d('<div class=provider-card__dropdown><button class=provider-card__dropdown-item><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg>Edit</button><button class="provider-card__dropdown-item provider-card__dropdown-item--danger"><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg>Remove'),ct=d("<span>"),ut=d('<span class=provider-card__email><svg width=12 height=12 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6">'),gt=d('<div class=provider-card><div class=provider-card__header><span class=provider-card__label>Your provider</span><div class=provider-card__menu><button class=provider-card__menu-btn aria-label="Provider options"><svg width=16 height=16 viewBox="0 0 24 24"fill=currentColor><circle cx=12 cy=5 r=2></circle><circle cx=12 cy=12 r=2></circle><circle cx=12 cy=19 r=2></circle></svg></button></div></div><div class=provider-card__body><img alt class=provider-card__logo><div><div class=provider-card__name></div><div class=provider-card__meta><span class=provider-card__key>...');const vt={resend:"/logos/resend.svg",mailgun:"/logos/mailgun.svg",sendgrid:"/logos/sendgrid.svg"},mt={resend:"Resend",mailgun:"Mailgun",sendgrid:"SendGrid"},ht=e=>{const t=()=>vt[e.config.provider]??"/logos/resend.svg",n=()=>mt[e.config.provider]??e.config.provider,[a,s]=$(!1),o=v=>{v.target.closest(".provider-card__menu")||s(!1)},u=()=>{const v=!a();s(v),v&&document.addEventListener("click",o,{once:!0})};return De(()=>document.removeEventListener("click",o)),(()=>{var v=gt(),h=v.firstChild,C=h.firstChild,S=C.nextSibling,x=S.firstChild,T=h.nextSibling,R=T.firstChild,f=R.nextSibling,k=f.firstChild,m=k.nextSibling,b=m.firstChild,j=b.firstChild;return x.$$click=u,i(S,l(_,{get when(){return a()},get children(){var M=dt(),D=M.firstChild,A=D.nextSibling;return D.$$click=()=>{s(!1),e.onEdit()},A.$$click=()=>{s(!1),e.onRemove()},M}}),null),i(k,n),i(m,l(_,{get when(){return e.config.domain},get children(){var M=ct();return i(M,()=>e.config.domain),M}}),b),i(b,()=>e.config.keyPrefix,j),i(m,l(_,{get when(){return e.config.notificationEmail},get children(){var M=ut();return M.firstChild,i(M,()=>e.config.notificationEmail,null),M}}),null),w(()=>z(R,"src",t())),v})()};ie(["click"]);var _t=d("<h3 class=provider-setup__title>Configure email provider"),ft=d("<p class=provider-setup__subtitle>Choose a service to send alert notifications via email."),$t=d("<div class=provider-setup-grid><button class=provider-setup-card><img src=/logos/resend.svg alt class=provider-setup-card__logo><div><div class=provider-setup-card__name>Resend</div><div class=provider-setup-card__desc>Email API</div></div></button><button class=provider-setup-card><img src=/logos/mailgun.svg alt class=provider-setup-card__logo><div><div class=provider-setup-card__name>Mailgun</div><div class=provider-setup-card__desc>Transactional email</div></div></button><button class=provider-setup-card><img src=/logos/sendgrid.svg alt class=provider-setup-card__logo><div><div class=provider-setup-card__name>SendGrid</div><div class=provider-setup-card__desc>Email delivery");const pt=e=>{const[t,n]=$(!1),[a,s]=$("resend"),o=u=>{s(u),n(!0)};return[_t(),ft(),(()=>{var u=$t(),v=u.firstChild,h=v.nextSibling,C=h.nextSibling;return v.$$click=()=>o("resend"),h.$$click=()=>o("mailgun"),C.$$click=()=>o("sendgrid"),u})(),l(Ae,{get open(){return t()},get initialProvider(){return a()},onClose:()=>n(!1),get onSaved(){return e.onConfigured}})]};ie(["click"]);var bt=d("<div style=margin-bottom:var(--gap-lg)>"),yt=d('<div class=provider-card><div class=provider-card__header><span class=provider-card__label>Your provider</span><div class="skeleton skeleton--text"style="width:16px;height:16px;border-radius:calc(var(--radius) - 2px)"></div></div><div class=provider-card__body><div class="skeleton skeleton--rect"style="width:32px;height:32px;border-radius:calc(var(--radius) - 2px);flex-shrink:0"></div><div><div class="skeleton skeleton--text"style=width:80px;height:14px></div><div class="skeleton skeleton--text"style=width:160px;height:12px;margin-top:6px>'),xt=d('<div class=panel><div class="skeleton skeleton--text"style=width:180px;height:16px></div><div class="skeleton skeleton--text"style=width:280px;height:13px;margin-top:6px></div><div style=display:flex;gap:var(--gap-md);margin-top:var(--gap-lg)>'),kt=d('<div class="skeleton skeleton--rect"style=flex:1;height:64px;border-radius:var(--radius)>');const wt=e=>(()=>{var t=bt();return i(t,l(_,{get when(){return!e.loading},get fallback(){return l(_,{get when(){return!!e.emailProvider},get fallback(){return(()=>{var n=xt(),a=n.firstChild,s=a.nextSibling,o=s.nextSibling;return i(o,l(ge,{each:[1,2,3],children:()=>kt()})),n})()},get children(){return yt()}})},get children(){return l(_,{get when(){return e.emailProvider},get fallback(){return l(pt,{get onConfigured(){return e.onConfigured}})},get children(){return l(ht,{get config(){return e.emailProvider},get onEdit(){return e.onEdit},get onRemove(){return e.onRemove}})}})}})),t})();var Ct=d(`<div class=modal-overlay><div class=modal-card role=dialog aria-modal=true aria-labelledby=limit-modal-title><h2 class=modal-card__title id=limit-modal-title></h2><p class=modal-card__desc>You'll receive an email alert when usage exceeds the threshold.</p><label class=modal-card__field-label style=margin-top:0>Metric</label><select class="select notification-modal__select"><option value=tokens>Tokens</option><option value=cost>Cost (USD)</option></select><div class=limit-modal__row><div class=limit-modal__col><label class=modal-card__field-label>Threshold</label><input class=modal-card__input type=number min=0></div><div class=limit-modal__col><label class=modal-card__field-label>Period</label><select class="select notification-modal__select"><option value=hour>Per hour</option><option value=day>Per day</option><option value=week>Per week</option><option value=month>Per month</option></select></div></div><div class=limit-block-toggle><span class=limit-block-toggle__label>Block requests when exceeded</span><label class=notification-toggle><input type=checkbox><span class=notification-toggle__slider></span></label></div><div class=modal-card__footer><button class="btn btn--primary btn--sm">`),St=d("<span class=spinner>");const Et=e=>{const[t,n]=$(!1),[a,s]=$("tokens"),[o,u]=$(""),[v,h]=$("day"),C=()=>t()?"both":"notify",S=()=>{n(!1),s("tokens"),u(""),h("day")};Le(()=>{if(e.open&&e.editData){const m=e.editData;s(m.metric_type),u(String(m.threshold)),h(m.period),n(m.action==="block"||m.action==="both")}else e.open&&S()});const[x,T]=$(!1),R=async()=>{if(x())return;const m=Number(o());if(!(isNaN(m)||m<=0)){T(!0);try{await e.onSave({metric_type:a(),threshold:m,period:v(),action:C()}),S()}finally{T(!1)}}},f=()=>{S(),e.onClose()},k=()=>!!e.editData;return l(ve,{get children(){return l(_,{get when(){return e.open},get children(){var m=Ct(),b=m.firstChild,j=b.firstChild,M=j.nextSibling,D=M.nextSibling,A=D.nextSibling,H=A.nextSibling,I=H.firstChild,Z=I.firstChild,N=Z.nextSibling,re=I.nextSibling,ae=re.firstChild,Y=ae.nextSibling,G=H.nextSibling,X=G.firstChild,Q=X.nextSibling,V=Q.firstChild,ee=G.nextSibling,te=ee.firstChild;return m.$$click=()=>f(),b.$$click=r=>r.stopPropagation(),i(j,()=>k()?"Edit rule":"Create rule"),A.addEventListener("change",r=>s(r.currentTarget.value)),N.$$keydown=r=>{r.key==="Enter"&&R()},N.$$input=r=>u(r.currentTarget.value),Y.addEventListener("change",r=>h(r.currentTarget.value)),V.addEventListener("change",r=>n(r.currentTarget.checked)),te.$$click=R,i(te,(()=>{var r=J(()=>!!x());return()=>r()?St():k()?"Save changes":"Create rule"})()),w(r=>{var p=a()==="cost"?"0.01":"1",P=a()==="cost"?"e.g. 10.00":"e.g. 50000",L=!o()||Number(o())<=0||x();return p!==r.e&&z(N,"step",r.e=p),P!==r.t&&z(N,"placeholder",r.t=P),L!==r.a&&(te.disabled=r.a=L),r},{e:void 0,t:void 0,a:void 0}),w(()=>A.value=a()),w(()=>N.value=o()),w(()=>Y.value=v()),w(()=>V.checked=t()),m}})}})};ie(["click","input","keydown"]);var Pt=d('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor aria-hidden=true><path d="M19.12 12.71a.4.4 0 0 1-.12-.29v-2.41c0-1.91-.75-3.69-2.13-5.02-.86-.84-1.9-1.42-3.02-1.73-.3-.73-1.01-1.24-1.85-1.24s-1.57.53-1.86 1.27C7.19 4.14 5 6.98 5 10.27v2.16c0 .11-.04.22-.12.29l-1.17 1.17a2.411 2.411 0 0 0 1.7 4.12h13.17a2.411 2.411 0 0 0 1.7-4.12l-1.17-1.17ZM18.58 16H5.41a.412.412 0 0 1-.29-.7l1.17-1.17c.46-.46.71-1.06.71-1.71v-2.16c0-2.81 2.17-5.17 4.85-5.25h.16c1.31 0 2.54.5 3.48 1.41.98.95 1.52 2.22 1.52 3.59v2.41c0 .65.25 1.25.71 1.71l1.17 1.17a.412.412 0 0 1-.29.7ZM14.82 20H9.18c.41 1.17 1.51 2 2.82 2s2.41-.83 2.82-2">');const Rt=e=>{const t=()=>e.size??16;return(()=>{var n=Pt();return w(a=>{var s=t(),o=t();return s!==a.e&&z(n,"width",a.e=s),o!==a.t&&z(n,"height",a.t=o),a},{e:void 0,t:void 0}),n})()};var Mt=d('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor aria-hidden=true><path d="M11.5 2c-5.51 0-10 4.49-10 10s4.49 10 10 10 10-4.49 10-10-4.49-10-10-10m-8 10c0-1.85.63-3.54 1.69-4.9L16.4 18.31A8 8 0 0 1 11.5 20c-4.41 0-8-3.59-8-8m14.31 4.9L6.6 5.69A8 8 0 0 1 11.5 4c4.41 0 8 3.59 8 8 0 1.85-.63 3.54-1.69 4.9">');const Tt=e=>{const t=()=>e.size??16;return(()=>{var n=Mt();return w(a=>{var s=t(),o=t();return s!==a.e&&z(n,"width",a.e=s),o!==a.t&&z(n,"height",a.t=o),a},{e:void 0,t:void 0}),n})()};var Ee=d('<table class="notif-table notif-table--flush"><thead><tr><th>Type</th><th>Threshold</th><th>Triggered</th><th style=text-align:right>Actions</th></tr></thead><tbody>'),Lt=d("<div class=panel><div class=panel__title>Rules"),Dt=d('<tr><td><div class="skeleton skeleton--text"style=width:28px></div></td><td><div class="skeleton skeleton--text"style=width:80px></div></td><td><div class="skeleton skeleton--text"style=width:20px></div></td><td style=text-align:right><div class="skeleton skeleton--text"style=width:16px;margin-left:auto>'),Nt=d("<div class=empty-state><div class=empty-state__title>No rules yet</div><p>Set up alerts for usage spikes, or hard limits to block requests over budget."),At=d('<span class=limit-type-icon title="Email Alert">'),It=d('<span class=limit-type-icon title="Hard Limit">'),Ot=d('<span class=limit-warn-tag><svg width=12 height=12 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1=12 y1=9 x2=12 y2=13></line><line x1=12 y1=17 x2=12.01 y2=17></line></svg>No provider'),Bt=d('<tr><td><div class=limit-type-icons></div></td><td><span class=notif-table__mono></span> <span class=notif-table__period></span></td><td class=notif-table__mono></td><td><div class=notif-table__actions><button class=rule-menu__btn aria-label="Rule options"><svg width=16 height=16 viewBox="0 0 24 24"fill=currentColor><circle cx=12 cy=5 r=2></circle><circle cx=12 cy=12 r=2></circle><circle cx=12 cy=19 r=2>');function Ie(e){return e.metric_type==="cost"?`$${Number(e.threshold).toFixed(2)}`:`${Number(e.threshold).toLocaleString()} tokens`}const Oe={hour:"Per hour",day:"Per day",week:"Per week",month:"Per month"},Kt=e=>typeof e.is_active=="number"?!!e.is_active:e.is_active,Pe=e=>e==="notify"||e==="both",zt=e=>e==="block"||e==="both",jt=e=>(()=>{var t=Lt();return t.firstChild,i(t,l(_,{get when(){return!e.loading},get fallback(){return(()=>{var n=Ee(),a=n.firstChild,s=a.nextSibling;return i(s,l(ge,{each:[1,2,3],children:()=>Dt()})),n})()},get children(){return l(_,{get when(){return(e.rules??[]).length>0},get fallback(){return Nt()},get children(){var n=Ee(),a=n.firstChild,s=a.nextSibling;return i(s,l(ge,{get each(){return e.rules},children:o=>(()=>{var u=Bt(),v=u.firstChild,h=v.firstChild,C=v.nextSibling,S=C.firstChild,x=S.nextSibling,T=x.nextSibling,R=C.nextSibling,f=R.nextSibling,k=f.firstChild,m=k.firstChild;return i(h,l(_,{get when(){return Pe(o.action??"notify")},get children(){var b=At();return i(b,l(Rt,{size:14})),b}}),null),i(h,l(_,{get when(){return zt(o.action??"notify")},get children(){var b=It();return i(b,l(Tt,{size:14})),b}}),null),i(h,l(_,{get when(){return J(()=>!!Pe(o.action??"notify"))()&&!e.hasProvider},get children(){return Ot()}}),null),i(S,()=>Ie(o)),i(T,()=>(Oe[o.period]??o.period).toLowerCase()),i(R,()=>o.trigger_count??0),m.$$click=b=>e.onToggleMenu(o.id,b),w(()=>u.classList.toggle("notif-table__row--disabled",!Kt(o))),u})()})),n}})}}),null),t})();ie(["click"]);var Re=d('<table class="notif-table notif-table--flush"><thead><tr><th>Date</th><th>Usage</th><th>Threshold</th><th>Resets at</th></tr></thead><tbody>'),Ht=d("<div class=panel><div class=panel__title>History"),Gt=d('<tr><td><div class="skeleton skeleton--text"style=width:100px></div></td><td><div class="skeleton skeleton--text"style=width:60px></div></td><td><div class="skeleton skeleton--text"style=width:60px></div></td><td><div class="skeleton skeleton--text"style=width:100px>'),Vt=d("<div class=empty-state><div class=empty-state__title>No alerts triggered yet"),qt=d("<tr><td class=notif-table__mono></td><td class=notif-table__mono></td><td class=notif-table__mono></td><td class=notif-table__mono>");function Me(e,t){const n=Number(e[t]);return e.metric_type==="cost"?`$${n.toFixed(2)}`:`${n.toLocaleString()} tokens`}function Te(e){const t=e.endsWith("Z")?e:e.replace(" ","T")+"Z";return new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}const Ut=e=>(()=>{var t=Ht();return t.firstChild,i(t,l(_,{get when(){return!e.loading},get fallback(){return(()=>{var n=Re(),a=n.firstChild,s=a.nextSibling;return i(s,l(ge,{each:[1,2,3],children:()=>Gt()})),n})()},get children(){return l(_,{get when(){return(e.logs??[]).length>0},get fallback(){return Vt()},get children(){var n=Re(),a=n.firstChild,s=a.nextSibling;return i(s,l(ge,{get each(){return e.logs},children:o=>(()=>{var u=qt(),v=u.firstChild,h=v.nextSibling,C=h.nextSibling,S=C.nextSibling;return i(v,()=>Te(o.sent_at)),i(h,()=>Me(o,"actual_value")),i(C,()=>Me(o,"threshold_value")),i(S,()=>Te(o.period_end)),u})()})),n}})}}),null),t})();var Jt=d('<div class=rule-menu__dropdown style=position:fixed;transform:translateX(-100%)><button class=rule-menu__item><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg>Edit</button><button class="rule-menu__item rule-menu__item--danger"><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg>Delete'),Ft=d('<div class=modal-overlay><div class=modal-card role=dialog aria-modal=true style=max-width:440px><h2 class=modal-card__title>Delete rule</h2><p class=modal-card__desc>This will permanently delete the <span style=font-weight:600></span> rule (<!> <!>). This action cannot be undone.</p><label class=confirm-modal__confirm-row><input type=checkbox>I understand this action is irreversible</label><div class=confirm-modal__footer><button class="btn btn--ghost btn--sm">Cancel</button><button class="btn btn--danger btn--sm">'),Be=d("<span class=spinner>"),Wt=d('<div class=modal-overlay><div class=modal-card role=dialog aria-modal=true style=max-width:440px><h2 class=modal-card__title>Remove provider</h2><p class=modal-card__desc>This will disconnect your email provider.</p><div class=confirm-modal__footer><button class="btn btn--ghost btn--sm">Cancel</button><button class="btn btn--danger btn--sm">');const Zt=e=>l(ve,{get children(){return l(_,{get when(){return e.openMenuId},children:t=>{const n=e.rules.find(a=>a.id===e.openMenuId);return n?(()=>{var a=Jt(),s=a.firstChild,o=s.nextSibling;return s.$$click=()=>e.onEdit(n),o.$$click=()=>e.onDelete(n),w(u=>{var v=`${e.menuPos.top}px`,h=`${e.menuPos.left}px`;return v!==u.e&&ke(a,"top",u.e=v),h!==u.t&&ke(a,"left",u.t=h),u},{e:void 0,t:void 0}),a})():null}})}}),Yt=e=>l(ve,{get children(){return l(_,{get when(){return e.target},get children(){var t=Ft(),n=t.firstChild,a=n.firstChild,s=a.nextSibling,o=s.firstChild,u=o.nextSibling,v=u.nextSibling,h=v.nextSibling,C=h.nextSibling,S=C.nextSibling;S.nextSibling;var x=s.nextSibling,T=x.firstChild,R=x.nextSibling,f=R.firstChild,k=f.nextSibling;return de(t,"click",e.onCancel,!0),n.$$click=m=>m.stopPropagation(),i(u,()=>e.target.metric_type==="tokens"?"token":"cost"),i(s,()=>Ie(e.target),h),i(s,()=>Oe[e.target.period]?.toLowerCase()??e.target.period,S),T.addEventListener("change",m=>e.onConfirmChange(m.currentTarget.checked)),de(f,"click",e.onCancel,!0),de(k,"click",e.onDelete,!0),i(k,(()=>{var m=J(()=>!!e.deleting);return()=>m()?Be():"Delete rule"})()),w(()=>k.disabled=!e.confirmed||e.deleting),w(()=>T.checked=e.confirmed),t}})}}),Xt=e=>l(ve,{get children(){return l(_,{get when(){return e.open},get children(){var t=Wt(),n=t.firstChild,a=n.firstChild,s=a.nextSibling;s.firstChild;var o=s.nextSibling,u=o.firstChild,v=u.nextSibling;return de(t,"click",e.onCancel,!0),n.$$click=h=>h.stopPropagation(),i(s,l(_,{get when(){return e.hasEmailRules},get children(){return[" ","Email alerts won't be sent until you set up a new one."]}}),null),de(u,"click",e.onCancel,!0),de(v,"click",e.onRemove,!0),i(v,(()=>{var h=J(()=>!!e.removing);return()=>h()?Be():"Remove"})()),w(()=>v.disabled=e.removing),t}})}});ie(["click"]);var Qt=d('<div class=limits-warning-banner><svg width=20 height=20 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1=12 y1=9 x2=12 y2=13></line><line x1=12 y1=17 x2=12.01 y2=17></line></svg><span>One or more hard limits triggered. New proxy requests for this agent will be blocked until the usage resets in the next period.'),ei=d('<div class=limits-routing-cta><svg width=20 height=20 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><circle cx=12 cy=12 r=10></circle><line x1=12 y1=16 x2=12 y2=12></line><line x1=12 y1=8 x2=12.01 y2=8></line></svg><div><strong>Enable routing to set hard limits</strong><p>Hard limits automatically block proxy requests when usage exceeds a threshold. Email alerts work without routing — only hard limits require it.'),ti=d("<div style=margin-bottom:var(--gap-lg)>"),ii=d("<div style=margin-top:var(--gap-lg)>"),ni=d('<div class=container--sm><div class=page-header><div><h1>Limits</h1><span class=breadcrumb> › Get notified or block requests when token or cost thresholds are exceeded</span></div><button class="btn btn--primary btn--sm">+ Create rule');const di=()=>{const e=Ke(),t=()=>decodeURIComponent(e.agentName),[n,{refetch:a}]=me(()=>t(),g=>qe(g)),[s,{refetch:o}]=me(()=>t(),g=>Ve(g)),[u,{refetch:v}]=me(We),[h]=me(()=>t(),Ge),C=Ne.useSession(),[S,x]=$(!1),[T,R]=$(!1),[f,k]=$(null),[m,b]=$(null),[j,M]=$({top:0,left:0}),[D,A]=$(null),[H,I]=$(!1),[Z,N]=$(!1),[re,ae]=$(!1),[Y,G]=$(!1),X=()=>h()?.enabled??!1,Q=()=>!se()||!!u(),V=()=>b(null),ee=()=>V(),te=(g,y)=>{if(y.stopPropagation(),m()===g)V();else{const O=y.currentTarget.getBoundingClientRect();M({top:O.bottom+4,left:O.right}),b(g),setTimeout(()=>document.addEventListener("click",ee,{once:!0}),0)}};De(()=>document.removeEventListener("click",ee));const r=g=>{V(),k(g),x(!0)},p=async g=>{const y=f();try{y?(await Je(y.id,{...g}),K.success("Rule updated")):(await Ue({agent_name:t(),...g}),K.success("Rule created")),await a(),x(!1),k(null)}catch{}},P=g=>{V(),A(g),I(!1)},L=async()=>{const g=D();if(g){ae(!0);try{await Fe(g.id),await a(),K.success("Rule deleted")}catch{}finally{ae(!1)}A(null),I(!1)}},q=()=>{const g=n();return g?g.some(y=>y.action==="notify"||y.action==="both"):!1},oe=async()=>{G(!0);try{await Ye(),await v(),N(!1),K.success("Email provider removed")}catch{}finally{G(!1)}},ce=()=>{const g=n();return g?g.some(y=>(y.action==="block"||y.action==="both")&&(typeof y.is_active=="number"?!!y.is_active:y.is_active)&&Number(y.trigger_count)>0):!1};return(()=>{var g=ni(),y=g.firstChild,ue=y.firstChild,O=ue.firstChild,F=O.nextSibling,he=F.firstChild,_e=ue.nextSibling;return i(g,l(ze,{get children(){return[J(()=>$e()??t())," Limits - Manifest"]}}),y),i(g,l(je,{name:"description",get content(){return`Configure limits and alerts for ${$e()??t()}.`}}),y),i(F,()=>$e()??t(),he),_e.$$click=()=>{k(null),x(!0)},i(g,l(_,{get when(){return ce()},get children(){return Qt()}}),null),i(g,l(_,{get when(){return J(()=>!!(h()&&!X()))()&&!se()},get children(){return ei()}}),null),i(g,l(_,{get when(){return!se()},get children(){var B=ti();return i(B,l(tt,{get email(){return C().data?.user?.email??""}})),B}}),null),i(g,l(_,{get when(){return se()},get children(){return l(wt,{get emailProvider(){return u()},get loading(){return u.loading},onConfigured:v,onEdit:()=>R(!0),onRemove:()=>N(!0)})}}),null),i(g,l(jt,{get rules(){return n()},get loading(){return n.loading},get hasProvider(){return Q()},onToggleMenu:te}),null),i(g,l(_,{get when(){return J(()=>!s.loading)()&&(s()??[]).length>0},get children(){var B=ii();return i(B,l(Ut,{get logs(){return s()},loading:!1})),B}}),null),i(g,l(Zt,{get openMenuId(){return m()},get menuPos(){return j()},get rules(){return n()??[]},onEdit:r,onDelete:P}),null),i(g,l(Yt,{get target(){return D()},get confirmed(){return H()},get deleting(){return re()},onConfirmChange:I,onCancel:()=>{A(null),I(!1)},onDelete:L}),null),i(g,l(Xt,{get open(){return Z()},get hasEmailRules(){return q()},get removing(){return Y()},onCancel:()=>N(!1),onRemove:oe}),null),i(g,l(Et,{get open(){return S()},onClose:()=>{x(!1),k(null)},onSave:p,get hasProvider(){return Q()},get editData(){return J(()=>!!f())()?{metric_type:f().metric_type,threshold:Number(f().threshold),period:f().period,action:f().action??"notify"}:null}}),null),i(g,l(Ae,{get open(){return T()},get initialProvider(){return u()?.provider??"resend"},editMode:!0,get existingKeyPrefix(){return u()?.keyPrefix??null},get existingDomain(){return u()?.domain??null},get existingNotificationEmail(){return u()?.notificationEmail??null},onClose:()=>R(!1),onSaved:()=>v()}),null),g})()};ie(["click"]);export{di as default};
|
|
1
|
+
import{i,t as d,a as $,f as Le,g as l,S as _,h as w,s as z,m as J,P as ve,d as ie,o as De,F as ge,B as ke,j as de,n as Ke,k as me,T as ze,M as je}from"./vendor-pl6Q4jbW.js";import{e as pe,q as ne,B as le,s as Ne,d as se,t as K,b as $e}from"./index-DhYFMC_u.js";import{a as He}from"./provider-api-key-urls-1G6okUJ7.js";import{a as Ge}from"./routing-RJ-kb3bi.js";import"./auth-DmX5tAfx.js";function Ve(e){return pe("/notifications/logs",{agent_name:e})}function qe(e){return pe("/notifications",{agent_name:e})}function Ue(e){return ne(`${le}/notifications`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}function Je(e,t){return ne(`${le}/notifications/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}function Fe(e){return ne(`${le}/notifications/${encodeURIComponent(e)}`,{method:"DELETE"})}async function We(){const e=await pe("/notifications/email-provider");return"configured"in e&&e.configured===!1?null:e}function Ze(e){return ne(`${le}/notifications/email-provider`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}function Ye(){return ne(`${le}/notifications/email-provider`,{method:"DELETE"})}function Xe(e){return ne(`${le}/notifications/email-provider/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}function Qe(e){return ne(`${le}/notifications/email-provider/test-saved`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({to:e})})}var et=d('<div class=cloud-email-info><svg class=cloud-email-info__icon width=20 height=20 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg><div><div class=cloud-email-info__title>Email alerts</div><div class=cloud-email-info__desc>Alerts will be sent to <strong>');const tt=e=>(()=>{var t=et(),n=t.firstChild,a=n.nextSibling,s=a.firstChild,o=s.nextSibling,u=o.firstChild,v=u.nextSibling;return i(v,()=>e.email),t})();var it=d("<input class=modal-card__input type=text autocomplete=off autofocus style=-webkit-text-security:disc;text-security:disc>"),we=d("<p class=modal-card__field-error>"),nt=d('<p class=modal-card__field-hint><a class=modal-card__field-link target=_blank rel="noopener noreferrer">Get <!> API key'),lt=d("<label class=modal-card__field-label>Sending domain"),rt=d('<input class=modal-card__input type=text placeholder="e.g. notifications.mycompany.com">'),at=d('<div class=modal-overlay><div class=modal-card role=dialog aria-modal=true aria-labelledby=provider-modal-title><h2 class=modal-card__title id=provider-modal-title></h2><p class=modal-card__desc>Enter your API credentials to enable email alert delivery.</p><label class=modal-card__field-label>Provider</label><div class=provider-modal-picker><button class=provider-modal-option type=button><img src=/logos/resend.svg alt class=provider-modal-option__logo><span>Resend</span></button><button class=provider-modal-option type=button><img src=/logos/mailgun.svg alt class=provider-modal-option__logo><span>Mailgun</span></button><button class=provider-modal-option type=button><img src=/logos/sendgrid.svg alt class=provider-modal-option__logo><span>SendGrid</span></button></div><label class=modal-card__field-label>API Key</label><label class=modal-card__field-label>Notification email</label><input class=modal-card__input type=email><p class=modal-card__field-hint>Where threshold alerts will be sent.</p><div class="modal-card__footer modal-card__footer--split"><button class="btn btn--ghost btn--sm"type=button></button><button class="btn btn--primary btn--sm">'),ot=d('<div class=masked-key><span class=masked-key__value></span><button class="btn btn--ghost btn--sm masked-key__edit"type=button>Change'),st=d("<span class=spinner>");const Ce=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i,Se={resend:"Resend",mailgun:"Mailgun",sendgrid:"SendGrid"},Ae=e=>{const[t,n]=$("resend"),[a,s]=$(""),[o,u]=$(""),[v,h]=$(""),[C,S]=$(!1),[x,T]=$(!1),[R,f]=$(""),[k,m]=$(""),[b,j]=$(!1),M=Ne.useSession(),D=()=>e.editMode&&!!e.existingKeyPrefix&&t()===e.initialProvider,A=()=>(e.existingKeyPrefix??"")+"••••••••";Le(()=>{if(e.open){n(e.initialProvider),s("");const r=e.editMode&&!!e.existingKeyPrefix;j(!r),u(e.existingDomain??"");const p=e.existingNotificationEmail??(se()?"":M()?.data?.user?.email??"");h(p),f(""),m("")}});const H=()=>t()==="mailgun",I=()=>{let r=!0;const p=a().trim(),P=o().trim().toLowerCase();return!b()&&D()?f(""):p?p.length<8?(f("API key must be at least 8 characters"),r=!1):t()==="resend"&&!p.startsWith("re_")?(f("Resend API key must start with re_"),r=!1):t()==="sendgrid"&&!p.startsWith("SG.")?(f("SendGrid API key must start with SG."),r=!1):f(""):(f("API key is required"),r=!1),H()?P?Ce.test(P)?m(""):(m("Invalid domain format"),r=!1):(m("Domain is required"),r=!1):P&&!Ce.test(P)?(m("Invalid domain format"),r=!1):m(""),r},Z=()=>{const r=v().trim();return r||(M()?.data?.user?.email??null)},N=async()=>{const r=a().trim(),p=o().trim().toLowerCase(),P=Z();if(!P)return K.error("Enter a notification email to send the test to"),!1;T(!0);try{const L={provider:t(),apiKey:r,to:P};p&&(L.domain=p);const q=await Xe(L);return q.success?!0:(K.error(q.error??"Email test failed — check your credentials"),!1)}catch{return!1}finally{T(!1)}},re=async()=>{const r=Z();if(!r)return K.error("Enter a notification email to send the test to"),!1;T(!0);try{const p=await Qe(r);return p.success?!0:(K.error(p.error??"Email test failed — check your credentials"),!1)}catch{return!1}finally{T(!1)}},ae=async()=>{if(!I()||X())return;(!b()&&D()?await re():await N())&&K.success(`Test email sent to ${Z()}`)},Y=async()=>{if(!I()||C()||x())return;const r=!b()&&D();if(!(r?await re():await N()))return;const P=o().trim().toLowerCase();S(!0);try{const L={provider:t()};r||(L.apiKey=a().trim()),P&&(L.domain=P);const q=v().trim();q&&(L.notificationEmail=q),await Ze(L);const oe=Se[t()]??t();K.success(`${oe} connected`),e.onSaved(),e.onClose()}catch{}finally{S(!1)}},G=r=>{r.key==="Enter"&&Y(),r.key==="Escape"&&e.onClose()},X=()=>C()||x(),Q=()=>!b()&&D()?!!(H()&&!o().trim()):!!(!a().trim()||H()&&!o().trim()),V=()=>x()?"Testing...":C()?"Saving...":e.editMode?"Test & Save":"Test & Connect",ee=()=>He(t()),te=()=>{switch(t()){case"resend":return"re_xxxx...";case"sendgrid":return"SG.xxxx...";default:return"key-xxxx..."}};return l(ve,{get children(){return l(_,{get when(){return e.open},get children(){var r=at(),p=r.firstChild,P=p.firstChild,L=P.nextSibling,q=L.nextSibling,oe=q.nextSibling,ce=oe.firstChild,g=ce.nextSibling,y=g.nextSibling,ue=oe.nextSibling,O=ue.nextSibling,F=O.nextSibling,he=F.nextSibling,_e=he.nextSibling,B=_e.firstChild,fe=B.nextSibling;return r.$$click=()=>e.onClose(),p.$$click=c=>c.stopPropagation(),i(P,()=>e.editMode?"Edit email provider":"Configure email provider"),ce.$$click=()=>{n("resend"),f("")},g.$$click=()=>{n("mailgun"),f("")},y.$$click=()=>{n("sendgrid"),f("")},i(p,l(_,{get when(){return b()||!D()},get fallback(){return(()=>{var c=ot(),E=c.firstChild,U=E.nextSibling;return i(E,A),U.$$click=()=>{j(!0),s("")},c})()},get children(){var c=it();return c.$$keydown=G,c.$$input=E=>{s(E.currentTarget.value),f("")},w(E=>{var U=!!R(),W=te();return U!==E.e&&c.classList.toggle("modal-card__input--error",E.e=U),W!==E.t&&z(c,"placeholder",E.t=W),E},{e:void 0,t:void 0}),w(()=>c.value=a()),c}}),O),i(p,l(_,{get when(){return R()},get children(){var c=we();return i(c,R),c}}),O),i(p,l(_,{get when(){return ee()},get children(){var c=nt(),E=c.firstChild,U=E.firstChild,W=U.nextSibling;return W.nextSibling,i(E,()=>Se[t()]??t(),W),w(()=>z(E,"href",ee())),c}}),O),i(p,l(_,{get when(){return H()},get children(){return[lt(),(()=>{var c=rt();return c.$$keydown=G,c.$$input=E=>{u(E.currentTarget.value),m("")},w(()=>c.classList.toggle("modal-card__input--error",!!k())),w(()=>c.value=o()),c})(),l(_,{get when(){return k()},get children(){var c=we();return i(c,k),c}})]}}),O),F.$$keydown=G,F.$$input=c=>h(c.currentTarget.value),B.$$click=ae,i(B,(()=>{var c=J(()=>!!x());return()=>c()?st():"Send test email"})()),fe.$$click=Y,i(fe,V),w(c=>{var E=t()==="resend",U=t()==="mailgun",W=t()==="sendgrid",be=se()?"you@example.com":M()?.data?.user?.email??"you@example.com",ye=X()||Q(),xe=X()||Q();return E!==c.e&&ce.classList.toggle("provider-modal-option--active",c.e=E),U!==c.t&&g.classList.toggle("provider-modal-option--active",c.t=U),W!==c.a&&y.classList.toggle("provider-modal-option--active",c.a=W),be!==c.o&&z(F,"placeholder",c.o=be),ye!==c.i&&(B.disabled=c.i=ye),xe!==c.n&&(fe.disabled=c.n=xe),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),w(()=>F.value=v()),r}})}})};ie(["click","input","keydown"]);var dt=d('<div class=provider-card__dropdown><button class=provider-card__dropdown-item><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg>Edit</button><button class="provider-card__dropdown-item provider-card__dropdown-item--danger"><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg>Remove'),ct=d("<span>"),ut=d('<span class=provider-card__email><svg width=12 height=12 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6">'),gt=d('<div class=provider-card><div class=provider-card__header><span class=provider-card__label>Your provider</span><div class=provider-card__menu><button class=provider-card__menu-btn aria-label="Provider options"><svg width=16 height=16 viewBox="0 0 24 24"fill=currentColor><circle cx=12 cy=5 r=2></circle><circle cx=12 cy=12 r=2></circle><circle cx=12 cy=19 r=2></circle></svg></button></div></div><div class=provider-card__body><img alt class=provider-card__logo><div><div class=provider-card__name></div><div class=provider-card__meta><span class=provider-card__key>...');const vt={resend:"/logos/resend.svg",mailgun:"/logos/mailgun.svg",sendgrid:"/logos/sendgrid.svg"},mt={resend:"Resend",mailgun:"Mailgun",sendgrid:"SendGrid"},ht=e=>{const t=()=>vt[e.config.provider]??"/logos/resend.svg",n=()=>mt[e.config.provider]??e.config.provider,[a,s]=$(!1),o=v=>{v.target.closest(".provider-card__menu")||s(!1)},u=()=>{const v=!a();s(v),v&&document.addEventListener("click",o,{once:!0})};return De(()=>document.removeEventListener("click",o)),(()=>{var v=gt(),h=v.firstChild,C=h.firstChild,S=C.nextSibling,x=S.firstChild,T=h.nextSibling,R=T.firstChild,f=R.nextSibling,k=f.firstChild,m=k.nextSibling,b=m.firstChild,j=b.firstChild;return x.$$click=u,i(S,l(_,{get when(){return a()},get children(){var M=dt(),D=M.firstChild,A=D.nextSibling;return D.$$click=()=>{s(!1),e.onEdit()},A.$$click=()=>{s(!1),e.onRemove()},M}}),null),i(k,n),i(m,l(_,{get when(){return e.config.domain},get children(){var M=ct();return i(M,()=>e.config.domain),M}}),b),i(b,()=>e.config.keyPrefix,j),i(m,l(_,{get when(){return e.config.notificationEmail},get children(){var M=ut();return M.firstChild,i(M,()=>e.config.notificationEmail,null),M}}),null),w(()=>z(R,"src",t())),v})()};ie(["click"]);var _t=d("<h3 class=provider-setup__title>Configure email provider"),ft=d("<p class=provider-setup__subtitle>Choose a service to send alert notifications via email."),$t=d("<div class=provider-setup-grid><button class=provider-setup-card><img src=/logos/resend.svg alt class=provider-setup-card__logo><div><div class=provider-setup-card__name>Resend</div><div class=provider-setup-card__desc>Email API</div></div></button><button class=provider-setup-card><img src=/logos/mailgun.svg alt class=provider-setup-card__logo><div><div class=provider-setup-card__name>Mailgun</div><div class=provider-setup-card__desc>Transactional email</div></div></button><button class=provider-setup-card><img src=/logos/sendgrid.svg alt class=provider-setup-card__logo><div><div class=provider-setup-card__name>SendGrid</div><div class=provider-setup-card__desc>Email delivery");const pt=e=>{const[t,n]=$(!1),[a,s]=$("resend"),o=u=>{s(u),n(!0)};return[_t(),ft(),(()=>{var u=$t(),v=u.firstChild,h=v.nextSibling,C=h.nextSibling;return v.$$click=()=>o("resend"),h.$$click=()=>o("mailgun"),C.$$click=()=>o("sendgrid"),u})(),l(Ae,{get open(){return t()},get initialProvider(){return a()},onClose:()=>n(!1),get onSaved(){return e.onConfigured}})]};ie(["click"]);var bt=d("<div style=margin-bottom:var(--gap-lg)>"),yt=d('<div class=provider-card><div class=provider-card__header><span class=provider-card__label>Your provider</span><div class="skeleton skeleton--text"style="width:16px;height:16px;border-radius:calc(var(--radius) - 2px)"></div></div><div class=provider-card__body><div class="skeleton skeleton--rect"style="width:32px;height:32px;border-radius:calc(var(--radius) - 2px);flex-shrink:0"></div><div><div class="skeleton skeleton--text"style=width:80px;height:14px></div><div class="skeleton skeleton--text"style=width:160px;height:12px;margin-top:6px>'),xt=d('<div class=panel><div class="skeleton skeleton--text"style=width:180px;height:16px></div><div class="skeleton skeleton--text"style=width:280px;height:13px;margin-top:6px></div><div style=display:flex;gap:var(--gap-md);margin-top:var(--gap-lg)>'),kt=d('<div class="skeleton skeleton--rect"style=flex:1;height:64px;border-radius:var(--radius)>');const wt=e=>(()=>{var t=bt();return i(t,l(_,{get when(){return!e.loading},get fallback(){return l(_,{get when(){return!!e.emailProvider},get fallback(){return(()=>{var n=xt(),a=n.firstChild,s=a.nextSibling,o=s.nextSibling;return i(o,l(ge,{each:[1,2,3],children:()=>kt()})),n})()},get children(){return yt()}})},get children(){return l(_,{get when(){return e.emailProvider},get fallback(){return l(pt,{get onConfigured(){return e.onConfigured}})},get children(){return l(ht,{get config(){return e.emailProvider},get onEdit(){return e.onEdit},get onRemove(){return e.onRemove}})}})}})),t})();var Ct=d(`<div class=modal-overlay><div class=modal-card role=dialog aria-modal=true aria-labelledby=limit-modal-title><h2 class=modal-card__title id=limit-modal-title></h2><p class=modal-card__desc>You'll receive an email alert when usage exceeds the threshold.</p><label class=modal-card__field-label style=margin-top:0>Metric</label><select class="select notification-modal__select"><option value=tokens>Tokens</option><option value=cost>Cost (USD)</option></select><div class=limit-modal__row><div class=limit-modal__col><label class=modal-card__field-label>Threshold</label><input class=modal-card__input type=number min=0></div><div class=limit-modal__col><label class=modal-card__field-label>Period</label><select class="select notification-modal__select"><option value=hour>Per hour</option><option value=day>Per day</option><option value=week>Per week</option><option value=month>Per month</option></select></div></div><div class=limit-block-toggle><span class=limit-block-toggle__label>Block requests when exceeded</span><label class=notification-toggle><input type=checkbox><span class=notification-toggle__slider></span></label></div><div class=modal-card__footer><button class="btn btn--primary btn--sm">`),St=d("<span class=spinner>");const Et=e=>{const[t,n]=$(!1),[a,s]=$("tokens"),[o,u]=$(""),[v,h]=$("day"),C=()=>t()?"both":"notify",S=()=>{n(!1),s("tokens"),u(""),h("day")};Le(()=>{if(e.open&&e.editData){const m=e.editData;s(m.metric_type),u(String(m.threshold)),h(m.period),n(m.action==="block"||m.action==="both")}else e.open&&S()});const[x,T]=$(!1),R=async()=>{if(x())return;const m=Number(o());if(!(isNaN(m)||m<=0)){T(!0);try{await e.onSave({metric_type:a(),threshold:m,period:v(),action:C()}),S()}finally{T(!1)}}},f=()=>{S(),e.onClose()},k=()=>!!e.editData;return l(ve,{get children(){return l(_,{get when(){return e.open},get children(){var m=Ct(),b=m.firstChild,j=b.firstChild,M=j.nextSibling,D=M.nextSibling,A=D.nextSibling,H=A.nextSibling,I=H.firstChild,Z=I.firstChild,N=Z.nextSibling,re=I.nextSibling,ae=re.firstChild,Y=ae.nextSibling,G=H.nextSibling,X=G.firstChild,Q=X.nextSibling,V=Q.firstChild,ee=G.nextSibling,te=ee.firstChild;return m.$$click=()=>f(),b.$$click=r=>r.stopPropagation(),i(j,()=>k()?"Edit rule":"Create rule"),A.addEventListener("change",r=>s(r.currentTarget.value)),N.$$keydown=r=>{r.key==="Enter"&&R()},N.$$input=r=>u(r.currentTarget.value),Y.addEventListener("change",r=>h(r.currentTarget.value)),V.addEventListener("change",r=>n(r.currentTarget.checked)),te.$$click=R,i(te,(()=>{var r=J(()=>!!x());return()=>r()?St():k()?"Save changes":"Create rule"})()),w(r=>{var p=a()==="cost"?"0.01":"1",P=a()==="cost"?"e.g. 10.00":"e.g. 50000",L=!o()||Number(o())<=0||x();return p!==r.e&&z(N,"step",r.e=p),P!==r.t&&z(N,"placeholder",r.t=P),L!==r.a&&(te.disabled=r.a=L),r},{e:void 0,t:void 0,a:void 0}),w(()=>A.value=a()),w(()=>N.value=o()),w(()=>Y.value=v()),w(()=>V.checked=t()),m}})}})};ie(["click","input","keydown"]);var Pt=d('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor aria-hidden=true><path d="M19.12 12.71a.4.4 0 0 1-.12-.29v-2.41c0-1.91-.75-3.69-2.13-5.02-.86-.84-1.9-1.42-3.02-1.73-.3-.73-1.01-1.24-1.85-1.24s-1.57.53-1.86 1.27C7.19 4.14 5 6.98 5 10.27v2.16c0 .11-.04.22-.12.29l-1.17 1.17a2.411 2.411 0 0 0 1.7 4.12h13.17a2.411 2.411 0 0 0 1.7-4.12l-1.17-1.17ZM18.58 16H5.41a.412.412 0 0 1-.29-.7l1.17-1.17c.46-.46.71-1.06.71-1.71v-2.16c0-2.81 2.17-5.17 4.85-5.25h.16c1.31 0 2.54.5 3.48 1.41.98.95 1.52 2.22 1.52 3.59v2.41c0 .65.25 1.25.71 1.71l1.17 1.17a.412.412 0 0 1-.29.7ZM14.82 20H9.18c.41 1.17 1.51 2 2.82 2s2.41-.83 2.82-2">');const Rt=e=>{const t=()=>e.size??16;return(()=>{var n=Pt();return w(a=>{var s=t(),o=t();return s!==a.e&&z(n,"width",a.e=s),o!==a.t&&z(n,"height",a.t=o),a},{e:void 0,t:void 0}),n})()};var Mt=d('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor aria-hidden=true><path d="M11.5 2c-5.51 0-10 4.49-10 10s4.49 10 10 10 10-4.49 10-10-4.49-10-10-10m-8 10c0-1.85.63-3.54 1.69-4.9L16.4 18.31A8 8 0 0 1 11.5 20c-4.41 0-8-3.59-8-8m14.31 4.9L6.6 5.69A8 8 0 0 1 11.5 4c4.41 0 8 3.59 8 8 0 1.85-.63 3.54-1.69 4.9">');const Tt=e=>{const t=()=>e.size??16;return(()=>{var n=Mt();return w(a=>{var s=t(),o=t();return s!==a.e&&z(n,"width",a.e=s),o!==a.t&&z(n,"height",a.t=o),a},{e:void 0,t:void 0}),n})()};var Ee=d('<table class="notif-table notif-table--flush"><thead><tr><th>Type</th><th>Threshold</th><th>Triggered</th><th style=text-align:right>Actions</th></tr></thead><tbody>'),Lt=d("<div class=panel><div class=panel__title>Rules"),Dt=d('<tr><td><div class="skeleton skeleton--text"style=width:28px></div></td><td><div class="skeleton skeleton--text"style=width:80px></div></td><td><div class="skeleton skeleton--text"style=width:20px></div></td><td style=text-align:right><div class="skeleton skeleton--text"style=width:16px;margin-left:auto>'),Nt=d("<div class=empty-state><div class=empty-state__title>No rules yet</div><p>Set up alerts for usage spikes, or hard limits to block requests over budget."),At=d('<span class=limit-type-icon title="Email Alert">'),It=d('<span class=limit-type-icon title="Hard Limit">'),Ot=d('<span class=limit-warn-tag><svg width=12 height=12 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1=12 y1=9 x2=12 y2=13></line><line x1=12 y1=17 x2=12.01 y2=17></line></svg>No provider'),Bt=d('<tr><td><div class=limit-type-icons></div></td><td><span class=notif-table__mono></span> <span class=notif-table__period></span></td><td class=notif-table__mono></td><td><div class=notif-table__actions><button class=rule-menu__btn aria-label="Rule options"><svg width=16 height=16 viewBox="0 0 24 24"fill=currentColor><circle cx=12 cy=5 r=2></circle><circle cx=12 cy=12 r=2></circle><circle cx=12 cy=19 r=2>');function Ie(e){return e.metric_type==="cost"?`$${Number(e.threshold).toFixed(2)}`:`${Number(e.threshold).toLocaleString()} tokens`}const Oe={hour:"Per hour",day:"Per day",week:"Per week",month:"Per month"},Kt=e=>typeof e.is_active=="number"?!!e.is_active:e.is_active,Pe=e=>e==="notify"||e==="both",zt=e=>e==="block"||e==="both",jt=e=>(()=>{var t=Lt();return t.firstChild,i(t,l(_,{get when(){return!e.loading},get fallback(){return(()=>{var n=Ee(),a=n.firstChild,s=a.nextSibling;return i(s,l(ge,{each:[1,2,3],children:()=>Dt()})),n})()},get children(){return l(_,{get when(){return(e.rules??[]).length>0},get fallback(){return Nt()},get children(){var n=Ee(),a=n.firstChild,s=a.nextSibling;return i(s,l(ge,{get each(){return e.rules},children:o=>(()=>{var u=Bt(),v=u.firstChild,h=v.firstChild,C=v.nextSibling,S=C.firstChild,x=S.nextSibling,T=x.nextSibling,R=C.nextSibling,f=R.nextSibling,k=f.firstChild,m=k.firstChild;return i(h,l(_,{get when(){return Pe(o.action??"notify")},get children(){var b=At();return i(b,l(Rt,{size:14})),b}}),null),i(h,l(_,{get when(){return zt(o.action??"notify")},get children(){var b=It();return i(b,l(Tt,{size:14})),b}}),null),i(h,l(_,{get when(){return J(()=>!!Pe(o.action??"notify"))()&&!e.hasProvider},get children(){return Ot()}}),null),i(S,()=>Ie(o)),i(T,()=>(Oe[o.period]??o.period).toLowerCase()),i(R,()=>o.trigger_count??0),m.$$click=b=>e.onToggleMenu(o.id,b),w(()=>u.classList.toggle("notif-table__row--disabled",!Kt(o))),u})()})),n}})}}),null),t})();ie(["click"]);var Re=d('<table class="notif-table notif-table--flush"><thead><tr><th>Date</th><th>Usage</th><th>Threshold</th><th>Resets at</th></tr></thead><tbody>'),Ht=d("<div class=panel><div class=panel__title>History"),Gt=d('<tr><td><div class="skeleton skeleton--text"style=width:100px></div></td><td><div class="skeleton skeleton--text"style=width:60px></div></td><td><div class="skeleton skeleton--text"style=width:60px></div></td><td><div class="skeleton skeleton--text"style=width:100px>'),Vt=d("<div class=empty-state><div class=empty-state__title>No alerts triggered yet"),qt=d("<tr><td class=notif-table__mono></td><td class=notif-table__mono></td><td class=notif-table__mono></td><td class=notif-table__mono>");function Me(e,t){const n=Number(e[t]);return e.metric_type==="cost"?`$${n.toFixed(2)}`:`${n.toLocaleString()} tokens`}function Te(e){const t=e.endsWith("Z")?e:e.replace(" ","T")+"Z";return new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}const Ut=e=>(()=>{var t=Ht();return t.firstChild,i(t,l(_,{get when(){return!e.loading},get fallback(){return(()=>{var n=Re(),a=n.firstChild,s=a.nextSibling;return i(s,l(ge,{each:[1,2,3],children:()=>Gt()})),n})()},get children(){return l(_,{get when(){return(e.logs??[]).length>0},get fallback(){return Vt()},get children(){var n=Re(),a=n.firstChild,s=a.nextSibling;return i(s,l(ge,{get each(){return e.logs},children:o=>(()=>{var u=qt(),v=u.firstChild,h=v.nextSibling,C=h.nextSibling,S=C.nextSibling;return i(v,()=>Te(o.sent_at)),i(h,()=>Me(o,"actual_value")),i(C,()=>Me(o,"threshold_value")),i(S,()=>Te(o.period_end)),u})()})),n}})}}),null),t})();var Jt=d('<div class=rule-menu__dropdown style=position:fixed;transform:translateX(-100%)><button class=rule-menu__item><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg>Edit</button><button class="rule-menu__item rule-menu__item--danger"><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg>Delete'),Ft=d('<div class=modal-overlay><div class=modal-card role=dialog aria-modal=true style=max-width:440px><h2 class=modal-card__title>Delete rule</h2><p class=modal-card__desc>This will permanently delete the <span style=font-weight:600></span> rule (<!> <!>). This action cannot be undone.</p><label class=confirm-modal__confirm-row><input type=checkbox>I understand this action is irreversible</label><div class=confirm-modal__footer><button class="btn btn--ghost btn--sm">Cancel</button><button class="btn btn--danger btn--sm">'),Be=d("<span class=spinner>"),Wt=d('<div class=modal-overlay><div class=modal-card role=dialog aria-modal=true style=max-width:440px><h2 class=modal-card__title>Remove provider</h2><p class=modal-card__desc>This will disconnect your email provider.</p><div class=confirm-modal__footer><button class="btn btn--ghost btn--sm">Cancel</button><button class="btn btn--danger btn--sm">');const Zt=e=>l(ve,{get children(){return l(_,{get when(){return e.openMenuId},children:t=>{const n=e.rules.find(a=>a.id===e.openMenuId);return n?(()=>{var a=Jt(),s=a.firstChild,o=s.nextSibling;return s.$$click=()=>e.onEdit(n),o.$$click=()=>e.onDelete(n),w(u=>{var v=`${e.menuPos.top}px`,h=`${e.menuPos.left}px`;return v!==u.e&&ke(a,"top",u.e=v),h!==u.t&&ke(a,"left",u.t=h),u},{e:void 0,t:void 0}),a})():null}})}}),Yt=e=>l(ve,{get children(){return l(_,{get when(){return e.target},get children(){var t=Ft(),n=t.firstChild,a=n.firstChild,s=a.nextSibling,o=s.firstChild,u=o.nextSibling,v=u.nextSibling,h=v.nextSibling,C=h.nextSibling,S=C.nextSibling;S.nextSibling;var x=s.nextSibling,T=x.firstChild,R=x.nextSibling,f=R.firstChild,k=f.nextSibling;return de(t,"click",e.onCancel,!0),n.$$click=m=>m.stopPropagation(),i(u,()=>e.target.metric_type==="tokens"?"token":"cost"),i(s,()=>Ie(e.target),h),i(s,()=>Oe[e.target.period]?.toLowerCase()??e.target.period,S),T.addEventListener("change",m=>e.onConfirmChange(m.currentTarget.checked)),de(f,"click",e.onCancel,!0),de(k,"click",e.onDelete,!0),i(k,(()=>{var m=J(()=>!!e.deleting);return()=>m()?Be():"Delete rule"})()),w(()=>k.disabled=!e.confirmed||e.deleting),w(()=>T.checked=e.confirmed),t}})}}),Xt=e=>l(ve,{get children(){return l(_,{get when(){return e.open},get children(){var t=Wt(),n=t.firstChild,a=n.firstChild,s=a.nextSibling;s.firstChild;var o=s.nextSibling,u=o.firstChild,v=u.nextSibling;return de(t,"click",e.onCancel,!0),n.$$click=h=>h.stopPropagation(),i(s,l(_,{get when(){return e.hasEmailRules},get children(){return[" ","Email alerts won't be sent until you set up a new one."]}}),null),de(u,"click",e.onCancel,!0),de(v,"click",e.onRemove,!0),i(v,(()=>{var h=J(()=>!!e.removing);return()=>h()?Be():"Remove"})()),w(()=>v.disabled=e.removing),t}})}});ie(["click"]);var Qt=d('<div class=limits-warning-banner><svg width=20 height=20 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1=12 y1=9 x2=12 y2=13></line><line x1=12 y1=17 x2=12.01 y2=17></line></svg><span>One or more hard limits triggered. New proxy requests for this agent will be blocked until the usage resets in the next period.'),ei=d('<div class=limits-routing-cta><svg width=20 height=20 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><circle cx=12 cy=12 r=10></circle><line x1=12 y1=16 x2=12 y2=12></line><line x1=12 y1=8 x2=12.01 y2=8></line></svg><div><strong>Enable routing to set hard limits</strong><p>Hard limits automatically block proxy requests when usage exceeds a threshold. Email alerts work without routing — only hard limits require it.'),ti=d("<div style=margin-bottom:var(--gap-lg)>"),ii=d("<div style=margin-top:var(--gap-lg)>"),ni=d('<div class=container--sm><div class=page-header><div><h1>Limits</h1><span class=breadcrumb> › Get notified or block requests when token or cost thresholds are exceeded</span></div><button class="btn btn--primary btn--sm">+ Create rule');const di=()=>{const e=Ke(),t=()=>decodeURIComponent(e.agentName),[n,{refetch:a}]=me(()=>t(),g=>qe(g)),[s,{refetch:o}]=me(()=>t(),g=>Ve(g)),[u,{refetch:v}]=me(We),[h]=me(()=>t(),Ge),C=Ne.useSession(),[S,x]=$(!1),[T,R]=$(!1),[f,k]=$(null),[m,b]=$(null),[j,M]=$({top:0,left:0}),[D,A]=$(null),[H,I]=$(!1),[Z,N]=$(!1),[re,ae]=$(!1),[Y,G]=$(!1),X=()=>h()?.enabled??!1,Q=()=>!se()||!!u(),V=()=>b(null),ee=()=>V(),te=(g,y)=>{if(y.stopPropagation(),m()===g)V();else{const O=y.currentTarget.getBoundingClientRect();M({top:O.bottom+4,left:O.right}),b(g),setTimeout(()=>document.addEventListener("click",ee,{once:!0}),0)}};De(()=>document.removeEventListener("click",ee));const r=g=>{V(),k(g),x(!0)},p=async g=>{const y=f();try{y?(await Je(y.id,{...g}),K.success("Rule updated")):(await Ue({agent_name:t(),...g}),K.success("Rule created")),await a(),x(!1),k(null)}catch{}},P=g=>{V(),A(g),I(!1)},L=async()=>{const g=D();if(g){ae(!0);try{await Fe(g.id),await a(),K.success("Rule deleted")}catch{}finally{ae(!1)}A(null),I(!1)}},q=()=>{const g=n();return g?g.some(y=>y.action==="notify"||y.action==="both"):!1},oe=async()=>{G(!0);try{await Ye(),await v(),N(!1),K.success("Email provider removed")}catch{}finally{G(!1)}},ce=()=>{const g=n();return g?g.some(y=>(y.action==="block"||y.action==="both")&&(typeof y.is_active=="number"?!!y.is_active:y.is_active)&&Number(y.trigger_count)>0):!1};return(()=>{var g=ni(),y=g.firstChild,ue=y.firstChild,O=ue.firstChild,F=O.nextSibling,he=F.firstChild,_e=ue.nextSibling;return i(g,l(ze,{get children(){return[J(()=>$e()??t())," Limits - Manifest"]}}),y),i(g,l(je,{name:"description",get content(){return`Configure limits and alerts for ${$e()??t()}.`}}),y),i(F,()=>$e()??t(),he),_e.$$click=()=>{k(null),x(!0)},i(g,l(_,{get when(){return ce()},get children(){return Qt()}}),null),i(g,l(_,{get when(){return J(()=>!!(h()&&!X()))()&&!se()},get children(){return ei()}}),null),i(g,l(_,{get when(){return!se()},get children(){var B=ti();return i(B,l(tt,{get email(){return C().data?.user?.email??""}})),B}}),null),i(g,l(_,{get when(){return se()},get children(){return l(wt,{get emailProvider(){return u()},get loading(){return u.loading},onConfigured:v,onEdit:()=>R(!0),onRemove:()=>N(!0)})}}),null),i(g,l(jt,{get rules(){return n()},get loading(){return n.loading},get hasProvider(){return Q()},onToggleMenu:te}),null),i(g,l(_,{get when(){return J(()=>!s.loading)()&&(s()??[]).length>0},get children(){var B=ii();return i(B,l(Ut,{get logs(){return s()},loading:!1})),B}}),null),i(g,l(Zt,{get openMenuId(){return m()},get menuPos(){return j()},get rules(){return n()??[]},onEdit:r,onDelete:P}),null),i(g,l(Yt,{get target(){return D()},get confirmed(){return H()},get deleting(){return re()},onConfirmChange:I,onCancel:()=>{A(null),I(!1)},onDelete:L}),null),i(g,l(Xt,{get open(){return Z()},get hasEmailRules(){return q()},get removing(){return Y()},onCancel:()=>N(!1),onRemove:oe}),null),i(g,l(Et,{get open(){return S()},onClose:()=>{x(!1),k(null)},onSave:p,get hasProvider(){return Q()},get editData(){return J(()=>!!f())()?{metric_type:f().metric_type,threshold:Number(f().threshold),period:f().period,action:f().action??"notify"}:null}}),null),i(g,l(Ae,{get open(){return T()},get initialProvider(){return u()?.provider??"resend"},editMode:!0,get existingKeyPrefix(){return u()?.keyPrefix??null},get existingDomain(){return u()?.domain??null},get existingNotificationEmail(){return u()?.notificationEmail??null},onClose:()=>R(!1),onSaved:()=>v()}),null),g})()};ie(["click"]);export{di as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as n,D as A,e as F,g as r,T as q,M as W,S as f,i,m,h as d,A as R,t as s,d as B}from"./vendor-pl6Q4jbW.js";import{S as U}from"./SocialButtons-
|
|
1
|
+
import{a as n,D as A,e as F,g as r,T as q,M as W,S as f,i,m,h as d,A as R,t as s,d as B}from"./vendor-pl6Q4jbW.js";import{S as U}from"./SocialButtons-9QmGwKhz.js";import{u as j,s as x}from"./index-DhYFMC_u.js";import"./auth-DmX5tAfx.js";var z=s("<div class=auth-header><h1 class=auth-header__title>Connecting...</h1><p class=auth-header__subtitle>Setting up your local session"),G=s("<div class=auth-header><h1 class=auth-header__title>Welcome back</h1><p class=auth-header__subtitle>Take control of your OpenClaw costs"),H=s("<div class=auth-divider><span class=auth-divider__text>or"),J=s("<button type=button class=auth-form__link-btn>"),K=s('<form class=auth-form><label class=auth-form__label>Email<input class=auth-form__input type=email placeholder=you@example.com required></label><label class=auth-form__label>Password<input class=auth-form__input type=password placeholder="Enter your password"required></label><div class=auth-form__actions></div><button class=auth-form__submit type=submit>'),Q=s("<div class=auth-footer><span>Don't have an account? "),X=s("<div class=auth-form__error>"),Y=s("<span class=spinner>");const Z=60,se=()=>{const[h,I]=n(""),[_,D]=n(""),[p,l]=n(""),[g,v]=n(!1),[M,$]=n(!1),[o,b]=n(0),[w,S]=n(!1),[O]=A();F(async()=>{if(O.error&&l("Login failed. Please try again or use a different method."),await j()){S(!0);try{if((await fetch("/api/auth/local-session",{credentials:"include"})).ok){window.location.href="/";return}}catch{}S(!1)}});const P=()=>{b(Z);const e=setInterval(()=>{b(t=>t<=1?(clearInterval(e),0):t-1)},1e3)},T=async e=>{e.preventDefault(),l(""),$(!1),v(!0);const{error:t}=await x.signIn.email({email:h(),password:_()});if(v(!1),t){const c=t.message??"";if(c.toLowerCase().includes("email is not verified")||t.code==="EMAIL_NOT_VERIFIED"){$(!0),l("Please verify your email before signing in.");return}l(c||"Invalid email or password");return}window.location.href="/"},V=async()=>{if(o()>0)return;const{error:e}=await x.sendVerificationEmail({email:h(),callbackURL:"/"});if(e){l(e.message??"Failed to resend verification email");return}P(),l("Verification email sent! Check your inbox.")};return[r(q,{children:"Sign In - Manifest"}),r(W,{name:"description",content:"Sign in to Manifest to monitor your AI agents."}),r(f,{get when(){return w()},get children(){return z()}}),r(f,{get when(){return!w()},get children(){return[G(),r(U,{}),H(),(()=>{var e=K(),t=e.firstChild,c=t.firstChild,y=c.nextSibling,E=t.nextSibling,N=E.firstChild,C=N.nextSibling,k=E.nextSibling,L=k.nextSibling;return e.addEventListener("submit",T),i(e,(()=>{var a=m(()=>!!p());return()=>a()&&(()=>{var u=X();return i(u,p),u})()})(),t),i(e,r(f,{get when(){return M()},get children(){var a=J();return a.$$click=V,i(a,(()=>{var u=m(()=>o()>0);return()=>u()?`Resend in ${o()}s`:"Resend verification email"})()),d(()=>a.disabled=o()>0),a}}),t),y.$$input=a=>I(a.currentTarget.value),C.$$input=a=>D(a.currentTarget.value),i(k,r(R,{href:"/reset-password",class:"auth-form__forgot",children:"Forgot password?"})),i(L,(()=>{var a=m(()=>!!g());return()=>a()?Y():"Sign in"})()),d(()=>L.disabled=g()),d(()=>y.value=h()),d(()=>C.value=_()),e})(),(()=>{var e=Q();return e.firstChild,i(e,r(R,{href:"/register",class:"auth-footer__link",children:"Sign up"}),null),e})()]}})]};B(["click","input"]);export{se as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as b,p as D,n as Y,b as Z,k as U,o as ee,f as O,z as j,i as d,g as a,m as A,T as te,M as se,h as B,S as p,F as ae,t as g,d as re}from"./vendor-pl6Q4jbW.js";import{d as ne,p as le,b as V,E as ie}from"./index-
|
|
1
|
+
import{a as b,p as D,n as Y,b as Z,k as U,o as ee,f as O,z as j,i as d,g as a,m as A,T as te,M as se,h as B,S as p,F as ae,t as g,d as re}from"./vendor-pl6Q4jbW.js";import{d as ne,p as le,b as V,E as ie}from"./index-DhYFMC_u.js";import{g as oe,S as ce,M as de,D as ge,a as ue}from"./overview-C73m0GiL.js";import{P as me}from"./Pagination-Ctujg2Tx.js";import{g as pe,a as ve}from"./routing-RJ-kb3bi.js";import{p as he}from"./model-display-DJPEaCHL.js";import{P as fe}from"./routing-utils-C6mUnWrX.js";import"./auth-DmX5tAfx.js";import"./AuthBadge-zJLfTd7g.js";import"./SetupStepAddProvider-Cp888sYN.js";import"./CopyButton-CZjeoxZT.js";function _e(i=50){const[L,x]=b([void 0]),[y,v]=b(0),[k,h]=b(!1),N=D(()=>y()+1),I=D(()=>L()[y()]),C=D(()=>k());function P(f){f?(h(!0),x(o=>{const S=y()+1,$=[...o];return $[S]=f,$})):h(!1)}function E(){k()&&v(f=>f+1)}function R(){y()<=0||v(f=>f-1)}function M(){x([void 0]),v(0),h(!1)}return{currentPage:N,currentCursor:I,hasNextPage:C,previousPage:R,nextPage:E,recordResponse:P,resetPage:M,pageSize:i}}var be=g('<div class=cost-range-filter><input type=number class=cost-range-filter__input placeholder="Min $"min=0 step=0.01><span class=cost-range-filter__sep>–</span><input type=number class=cost-range-filter__input placeholder="Max $"min=0 step=0.01>'),xe=g('<button class="btn btn--primary btn--sm">Set up agent'),ye=g('<div class=empty-state><div class=empty-state__title>No messages yet</div><p>Connect a provider to start routing LLM calls.</p><button class="btn btn--primary btn--sm"style=margin-top:var(--gap-md)>Enable routing</button><div class=empty-state__img-wrapper><img src=/example-messages.svg alt="Example message log showing LLM call history"class=empty-state__img loading=lazy>',!0,!1,!1),$e=g('<div class=panel><div style=display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--gap-lg)><div class=panel__title style=margin-bottom:0>Messages</div><span style=font-size:var(--font-size-xs);color:hsl(var(--muted-foreground))>0 results</span></div><div class=model-filter__empty><p class=model-filter__empty-title>No messages match your filters</p><p class=model-filter__empty-hint>Try adjusting your provider or cost filters to see more results.</p><button class="btn btn--outline btn--sm"type=button>Clear filters'),ke=g('<div class=waiting-banner><i class="bxd bx-florist"></i><p>No messages yet. They appear seconds after your first LLM call.'),Ce=g("<div class=panel><div style=display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--gap-lg)><div class=panel__title style=margin-bottom:0>Messages</div><span style=font-size:var(--font-size-xs);color:hsl(var(--muted-foreground))> total</span></div><div class=data-table-scroll>"),Me=g("<div class=container--full><div class=page-header><div><h1>Messages</h1><span class=breadcrumb>Full log of every LLM call. Filter by provider or cost.</span></div><div class=header-controls>"),Se=g('<div class=panel><div style=display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--gap-lg)><div class="skeleton skeleton--text"style=width:80px;height:16px></div><div class="skeleton skeleton--text"style=width:60px;height:14px></div></div><div class=data-table-scroll><table class=data-table><thead><tr><th>Date</th><th>Message</th><th>Cost</th><th>Total Tokens</th><th>Input</th><th>Output</th><th>Model</th><th>Cache</th><th>Duration</th><th>Status</th></tr></thead><tbody>'),we=g('<tr><td><div class="skeleton skeleton--text"style=width:90px></div></td><td><div class="skeleton skeleton--text"style=width:55px></div></td><td><div class="skeleton skeleton--text"style=width:40px></div></td><td><div class="skeleton skeleton--text"style=width:40px></div></td><td><div class="skeleton skeleton--text"style=width:35px></div></td><td><div class="skeleton skeleton--text"style=width:35px></div></td><td><div class="skeleton skeleton--text"style=width:110px></div></td><td><div class="skeleton skeleton--text"style=width:90px></div></td><td><div class="skeleton skeleton--text"style=width:35px></div></td><td><div class="skeleton skeleton--text"style=width:50px>'),Ne=g('<div class=empty-state><div class=empty-state__title>No messages yet</div><p>Set up your agent and send a message. Every LLM call shows up here.</p><button class="btn btn--primary btn--sm"style=margin-top:var(--gap-md)>Set up agent</button><div class=empty-state__img-wrapper><img src=/example-messages.svg alt="Example message log showing LLM call history"class=empty-state__img loading=lazy>',!0,!1,!1);const Oe=()=>{const i=Y(),L=Z();he();const[x,y]=b(""),[v,k]=b(""),[h,N]=b(""),[I,C]=b(!1),[P]=b(!!localStorage.getItem(`setup_completed_${i.agentName}`)||ne()===!0),[E]=U(()=>i.agentName,e=>pe(decodeURIComponent(e))),[R]=U(()=>i.agentName,e=>ve(decodeURIComponent(e))),M=()=>R()?.enabled===!0,f=e=>{const s=e.match(/^custom:([^/]+)\//);if(!s)return;const _=s[1];return E()?.find(u=>u.id===_)?.name},o=_e(50);let S,$;ee(()=>{clearTimeout(S),clearTimeout($)});const q=e=>{clearTimeout(S),S=setTimeout(()=>k(e),400)},H=e=>{clearTimeout($),$=setTimeout(()=>N(e),400)};O(j([x,v,h],()=>o.resetPage(),{defer:!0}));const[l,{refetch:G}]=U(()=>({provider:x(),costMin:v(),costMax:h(),agentName:i.agentName,_ping:le(),cursor:o.currentCursor(),limit:o.pageSize}),e=>{const s={};return e.provider&&(s.provider=e.provider),e.costMin&&(s.cost_min=e.costMin),e.costMax&&(s.cost_max=e.costMax),e.agentName&&(s.agent_name=e.agentName),e.cursor&&(s.cursor=e.cursor),s.limit=String(e.limit),oe(s)});O(j(()=>l(),e=>{e&&o.recordResponse(e.next_cursor)}));const F=()=>x()!==""||v()!==""||h()!=="",T=()=>{const e=l();return e&&e.total_count===0},z=()=>T()&&!F()&&!M(),J=()=>T()&&F(),K=()=>!T()||M()&&!F(),Q=()=>{y(""),k(""),N("")},W=e=>fe.find(_=>_.id===e)?.name??e,X=e=>{const s=l()?.items;if(!s)return;const _=s.find(t=>t.fallback_from_model===e&&t.status==="ok");if(!_)return;const u=document.getElementById(`msg-${_.id}`);u&&(u.scrollIntoView({behavior:"smooth",block:"center"}),u.classList.add("msg-highlight"),setTimeout(()=>u.classList.remove("msg-highlight"),2e3))};return(()=>{var e=Me(),s=e.firstChild,_=s.firstChild,u=_.nextSibling;return d(e,a(te,{get children(){return[A(()=>V()??decodeURIComponent(i.agentName))," Messages - Manifest"]}}),s),d(e,a(se,{name:"description",get content(){return`Browse all messages sent and received by ${V()??decodeURIComponent(i.agentName)}. Filter by provider or cost.`}}),s),d(u,a(p,{get when(){return!z()},get children(){return[a(ce,{get value(){return x()},onChange:y,get options(){return[{label:"All providers",value:""},...(l()?.providers??[]).map(t=>({label:W(t),value:t}))]}}),(()=>{var t=be(),r=t.firstChild,c=r.nextSibling,n=c.nextSibling;return r.$$input=m=>q(m.currentTarget.value),n.$$input=m=>H(m.currentTarget.value),B(()=>r.value=v()),B(()=>n.value=h()),t})()]}}),null),d(u,a(p,{get when(){return A(()=>!!z())()&&!P()},get children(){var t=xe();return t.$$click=()=>C(!0),t}}),null),d(e,a(p,{get when(){return l()!==void 0||!l.loading},get fallback(){return(()=>{var t=Se(),r=t.firstChild,c=r.nextSibling,n=c.firstChild,m=n.firstChild,w=m.nextSibling;return d(w,a(ae,{each:[1,2,3,4,5,6,7,8,9,10],children:()=>we()})),t})()},get children(){return a(p,{get when(){return!l.error},get fallback(){return a(ie,{get error(){return l.error},onRetry:G})},get children(){return[a(p,{get when(){return z()},get children(){return a(p,{get when(){return P()},get fallback(){return(()=>{var t=Ne(),r=t.firstChild,c=r.nextSibling,n=c.nextSibling;return n.$$click=()=>C(!0),t})()},get children(){var t=ye(),r=t.firstChild,c=r.nextSibling,n=c.nextSibling;return n.$$click=()=>L(`/agents/${encodeURIComponent(i.agentName)}/routing`,{state:{openProviders:!0}}),t}})}}),a(p,{get when(){return J()},get children(){var t=$e(),r=t.firstChild,c=r.nextSibling,n=c.firstChild,m=n.nextSibling,w=m.nextSibling;return w.$$click=Q,t}}),a(p,{get when(){return K()},get children(){return[a(p,{get when(){return A(()=>!!T())()&&M()},get children(){return ke()}}),(()=>{var t=Ce(),r=t.firstChild,c=r.firstChild,n=c.nextSibling,m=n.firstChild,w=r.nextSibling;return d(n,()=>l()?.total_count??0,m),d(w,a(de,{get items(){return l()?.items??[]},columns:ge,get agentName(){return i.agentName},customProviderName:f,onFallbackErrorClick:X,rowIdPrefix:"msg-",showHeaderTooltips:!0,expandable:!0})),d(t,a(me,{get currentPage(){return o.currentPage},totalItems:()=>l()?.total_count??0,get pageSize(){return o.pageSize},get hasNextPage(){return o.hasNextPage},isLoading:()=>l.loading,get onPrevious(){return o.previousPage},get onNext(){return o.nextPage}}),null),t})()]}})]}})}}),null),d(e,a(ue,{get open(){return I()},get agentName(){return decodeURIComponent(i.agentName)},onClose:()=>C(!1)}),null),e})()};re(["input","click"]);export{Oe as default};
|