wizards 0.2.46 → 0.2.47
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/apps/runtime/dist/app.js +3 -0
- package/apps/runtime/dist/cli/features.js +50 -0
- package/apps/runtime/dist/cli/main.js +4 -1
- package/apps/runtime/dist/features.js +123 -0
- package/apps/runtime/dist/manage.js +13 -0
- package/apps/runtime/dist/plugins/discovery.js +11 -0
- package/apps/runtime/dist/plugins/loader.js +10 -0
- package/apps/runtime/dist/routes/internal.js +3 -0
- package/apps/runtime/dist/routes/studio.js +7 -5
- package/apps/web/dist/assets/{AboutDialog-DkY1j7k6.js → AboutDialog-t7bpiasT.js} +1 -1
- package/apps/web/dist/assets/{ChangelogDialog-820LI5Jt.js → ChangelogDialog-B87yS6aN.js} +1 -1
- package/apps/web/dist/assets/{ChatView-DBl0iRMg.js → ChatView-Dm764bYy.js} +1 -1
- package/apps/web/dist/assets/{EditorPage-BwJ-hqPg.js → EditorPage-BG_Ue2iC.js} +3 -3
- package/apps/web/dist/assets/{Harness-CfUfchNw.js → Harness-zKMptCzB.js} +1 -1
- package/apps/web/dist/assets/HomePage-BXSg5P5k.js +1 -0
- package/apps/web/dist/assets/{ProjectPage-Btf0TeP_.js → ProjectPage-D6Fy7uTV.js} +1 -1
- package/apps/web/dist/assets/{PublicRunner-BxYinn04.js → PublicRunner-ChgJs0C9.js} +1 -1
- package/apps/web/dist/assets/{RunDrawer-DfnEMPTq.js → RunDrawer-CvIKLphz.js} +1 -1
- package/apps/web/dist/assets/{RunnerView-CLrGb-oq.js → RunnerView-Bmayop7s.js} +1 -1
- package/apps/web/dist/assets/SettingsPage-QkwtRFoD.js +1 -0
- package/apps/web/dist/assets/SetupPage-B3IOQLO3.js +1 -0
- package/apps/web/dist/assets/{SharePage-D5AvnhlY.js → SharePage-C3QEzicl.js} +1 -1
- package/apps/web/dist/assets/ThemeSwitch-3IzIOlNz.js +1 -0
- package/apps/web/dist/assets/changelog-Du2gWzlN.js +1 -0
- package/apps/web/dist/assets/{index-CIO9W4pe.js → index-Cz6c1S5g.js} +4 -4
- package/apps/web/dist/index.html +3 -3
- package/node_modules/@engenty-wizards/plugin-sdk/dist/index.d.ts +21 -0
- package/node_modules/@engenty-wizards/shared/dist/feature-flags.d.ts +54 -0
- package/node_modules/@engenty-wizards/shared/dist/feature-flags.js +46 -0
- package/node_modules/@engenty-wizards/shared/dist/features.d.ts +36 -0
- package/node_modules/@engenty-wizards/shared/dist/features.js +78 -0
- package/package.json +1 -1
- package/apps/web/dist/assets/HomePage-BG5OZJkv.js +0 -1
- package/apps/web/dist/assets/SettingsPage-FWH84btd.js +0 -1
- package/apps/web/dist/assets/SetupPage-BI0kUNVW.js +0 -1
- package/apps/web/dist/assets/ThemeSwitch-C1qYFoYP.js +0 -1
- package/apps/web/dist/assets/changelog-B6QMrVxX.js +0 -1
package/apps/web/dist/index.html
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
dispatchEvent(new Event("wizard-install"));
|
|
33
33
|
});
|
|
34
34
|
</script>
|
|
35
|
-
<script type="module" crossorigin src="/studio/assets/index-
|
|
35
|
+
<script type="module" crossorigin src="/studio/assets/index-Cz6c1S5g.js"></script>
|
|
36
36
|
<link rel="modulepreload" crossorigin href="/studio/assets/jsx-runtime-D3jfb0Ew.js">
|
|
37
37
|
<link rel="modulepreload" crossorigin href="/studio/assets/engenty-Cm8yZLON.js">
|
|
38
38
|
<link rel="modulepreload" crossorigin href="/studio/assets/logo-C80CWCDM.js">
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
<link rel="modulepreload" crossorigin href="/studio/assets/sparkles-CP5H-O1E.js">
|
|
47
47
|
<link rel="modulepreload" crossorigin href="/studio/assets/external-link-CpU8aJY2.js">
|
|
48
48
|
<link rel="modulepreload" crossorigin href="/studio/assets/session-miDEdw2c.js">
|
|
49
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/ThemeSwitch-
|
|
50
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/HomePage-
|
|
49
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/ThemeSwitch-3IzIOlNz.js">
|
|
50
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/HomePage-BXSg5P5k.js">
|
|
51
51
|
<link rel="stylesheet" crossorigin href="/studio/assets/index-DKHClEy3.css">
|
|
52
52
|
</head>
|
|
53
53
|
<body>
|
|
@@ -22,6 +22,17 @@ export interface PluginManifest {
|
|
|
22
22
|
studio?: string;
|
|
23
23
|
/** The studio half's styles, built. Default `dist/client.css`. */
|
|
24
24
|
styles?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The plugin's feature switches, by short name; each is known as `<id>.<name>` everywhere
|
|
27
|
+
* (`wizards features`, the `.features` file, the Manage-App's admin). `true`/`false` is the
|
|
28
|
+
* default alone; a `plan` switch is one a plan includes.
|
|
29
|
+
*/
|
|
30
|
+
features?: Record<string, boolean | {
|
|
31
|
+
kind?: "release" | "plan";
|
|
32
|
+
default?: boolean;
|
|
33
|
+
label?: string;
|
|
34
|
+
hint?: string;
|
|
35
|
+
}>;
|
|
25
36
|
}
|
|
26
37
|
export type PluginRole = "owner" | "admin" | "member";
|
|
27
38
|
/** The signed-in person a request acts as. */
|
|
@@ -845,6 +856,16 @@ export interface WizardsPluginApi {
|
|
|
845
856
|
config: {
|
|
846
857
|
get(key: string): string | undefined;
|
|
847
858
|
};
|
|
859
|
+
/**
|
|
860
|
+
* Feature switches of the tenant at hand: the runtime's own (`teamPlans`) and the plugin's,
|
|
861
|
+
* named with its id (`contacts.leadScoring`), as the Manage-App, the install's `.features`
|
|
862
|
+
* file or `FEATURES` set them. Off unless something turned a switch on.
|
|
863
|
+
*/
|
|
864
|
+
features: {
|
|
865
|
+
/** `has("leadScoring")` asks for the plugin's own switch; a full name (`teamPlans`) for any. */
|
|
866
|
+
has(name: string): Promise<boolean>;
|
|
867
|
+
all(): Promise<Record<string, boolean>>;
|
|
868
|
+
};
|
|
848
869
|
log: {
|
|
849
870
|
info(...args: unknown[]): void;
|
|
850
871
|
warn(...args: unknown[]): void;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The feature flags of the core: the parts that ship in the code but are not on for everyone
|
|
3
|
+
* yet (`release`), and the parts a plan includes (`plan`). This file is the list – add a flag
|
|
4
|
+
* here, branch on it with `useFeature("name")` in the studio or `feature("name")` in the
|
|
5
|
+
* runtime, and delete it with its branches once its default became `true`.
|
|
6
|
+
*
|
|
7
|
+
* How a flag gets its value (defaults here → `FEATURES` env → the Manage-App → the `.features`
|
|
8
|
+
* file) lives in features.ts. A plugin's flags are declared in its manifest under `features`
|
|
9
|
+
* and are known as `<plugin id>.<name>`; they do not belong here. No public page lists these.
|
|
10
|
+
*/
|
|
11
|
+
export interface FeatureDeclaration {
|
|
12
|
+
kind: "release" | "plan";
|
|
13
|
+
/** What counts until a layer says otherwise. */
|
|
14
|
+
default: boolean;
|
|
15
|
+
/** A few words for the lists: `wizards features`, the admin's switches. */
|
|
16
|
+
label: string;
|
|
17
|
+
hint?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* One entry per flag. `kind: "release"`: on or off for everyone by default, turned on for a
|
|
21
|
+
* team or a machine before the default flips. `kind: "plan"`: on until a plan says `false`.
|
|
22
|
+
*/
|
|
23
|
+
export declare const FEATURES: {
|
|
24
|
+
readonly account: {
|
|
25
|
+
readonly kind: "release";
|
|
26
|
+
readonly default: true;
|
|
27
|
+
readonly label: "Account in a local install";
|
|
28
|
+
readonly hint: "Linking, Settings → Account, the offer to sign in.";
|
|
29
|
+
};
|
|
30
|
+
readonly unsetConnectors: {
|
|
31
|
+
readonly kind: "release";
|
|
32
|
+
readonly default: false;
|
|
33
|
+
readonly label: "Connectors without an OAuth client";
|
|
34
|
+
readonly hint: "Built-in connectors are shown although their client is not set up.";
|
|
35
|
+
};
|
|
36
|
+
readonly site: {
|
|
37
|
+
readonly kind: "release";
|
|
38
|
+
readonly default: false;
|
|
39
|
+
readonly label: "Link to the website in the setup";
|
|
40
|
+
readonly hint: "The local install's setup links the product's site.";
|
|
41
|
+
};
|
|
42
|
+
readonly teamPlans: {
|
|
43
|
+
readonly kind: "release";
|
|
44
|
+
readonly default: false;
|
|
45
|
+
readonly label: "Team plans";
|
|
46
|
+
readonly hint: "The team page in the cloud studio, and plans that carry this switch on the account pages.";
|
|
47
|
+
};
|
|
48
|
+
readonly ownKeys: {
|
|
49
|
+
readonly kind: "plan";
|
|
50
|
+
readonly default: true;
|
|
51
|
+
readonly label: "Own API keys";
|
|
52
|
+
readonly hint: "The team puts its providers' keys into the cloud studio instead of running on credits.";
|
|
53
|
+
};
|
|
54
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The feature flags of the core: the parts that ship in the code but are not on for everyone
|
|
3
|
+
* yet (`release`), and the parts a plan includes (`plan`). This file is the list – add a flag
|
|
4
|
+
* here, branch on it with `useFeature("name")` in the studio or `feature("name")` in the
|
|
5
|
+
* runtime, and delete it with its branches once its default became `true`.
|
|
6
|
+
*
|
|
7
|
+
* How a flag gets its value (defaults here → `FEATURES` env → the Manage-App → the `.features`
|
|
8
|
+
* file) lives in features.ts. A plugin's flags are declared in its manifest under `features`
|
|
9
|
+
* and are known as `<plugin id>.<name>`; they do not belong here. No public page lists these.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* One entry per flag. `kind: "release"`: on or off for everyone by default, turned on for a
|
|
13
|
+
* team or a machine before the default flips. `kind: "plan"`: on until a plan says `false`.
|
|
14
|
+
*/
|
|
15
|
+
export const FEATURES = {
|
|
16
|
+
account: {
|
|
17
|
+
kind: "release",
|
|
18
|
+
default: true,
|
|
19
|
+
label: "Account in a local install",
|
|
20
|
+
hint: "Linking, Settings → Account, the offer to sign in.",
|
|
21
|
+
},
|
|
22
|
+
unsetConnectors: {
|
|
23
|
+
kind: "release",
|
|
24
|
+
default: false,
|
|
25
|
+
label: "Connectors without an OAuth client",
|
|
26
|
+
hint: "Built-in connectors are shown although their client is not set up.",
|
|
27
|
+
},
|
|
28
|
+
site: {
|
|
29
|
+
kind: "release",
|
|
30
|
+
default: false,
|
|
31
|
+
label: "Link to the website in the setup",
|
|
32
|
+
hint: "The local install's setup links the product's site.",
|
|
33
|
+
},
|
|
34
|
+
teamPlans: {
|
|
35
|
+
kind: "release",
|
|
36
|
+
default: false,
|
|
37
|
+
label: "Team plans",
|
|
38
|
+
hint: "The team page in the cloud studio, and plans that carry this switch on the account pages.",
|
|
39
|
+
},
|
|
40
|
+
ownKeys: {
|
|
41
|
+
kind: "plan",
|
|
42
|
+
default: true,
|
|
43
|
+
label: "Own API keys",
|
|
44
|
+
hint: "The team puts its providers' keys into the cloud studio instead of running on credits.",
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FEATURES, type FeatureDeclaration } from "./feature-flags.js";
|
|
2
|
+
/**
|
|
3
|
+
* Feature switches: how a flag of feature-flags.ts (or a plugin's manifest) gets its value.
|
|
4
|
+
* The runtime resolves them from the defaults, what the Manage-App says for the team or the
|
|
5
|
+
* linked account, and this install's `.features` file; the studio and plugins read the result.
|
|
6
|
+
*/
|
|
7
|
+
export { FEATURES, type FeatureDeclaration };
|
|
8
|
+
export type FeatureName = keyof typeof FEATURES;
|
|
9
|
+
export type FeatureKind = (typeof FEATURES)[FeatureName]["kind"];
|
|
10
|
+
/** A switch by name; a plugin's own switches carry its id: `contacts.leadScoring`. */
|
|
11
|
+
export type Features = Record<string, boolean>;
|
|
12
|
+
/** `teamPlans`, `contacts.leadScoring`. */
|
|
13
|
+
export declare const FEATURE_NAME: RegExp;
|
|
14
|
+
export declare const FEATURE_NAMES: FeatureName[];
|
|
15
|
+
/** What a manifest declares for one switch; what is left out is a release switch, off, named by its key. */
|
|
16
|
+
export interface FeatureDeclarationInput {
|
|
17
|
+
kind?: "release" | "plan";
|
|
18
|
+
default?: boolean;
|
|
19
|
+
label?: string;
|
|
20
|
+
hint?: string;
|
|
21
|
+
}
|
|
22
|
+
/** A plugin's declarations under its id: `contacts` + `leadScoring` → `contacts.leadScoring`. */
|
|
23
|
+
export declare function declaredByPlugin(pluginId: string, features: Record<string, FeatureDeclarationInput | boolean> | undefined): Record<string, FeatureDeclaration>;
|
|
24
|
+
/** The defaults of these declarations; without any, the core's. */
|
|
25
|
+
export declare function defaultFeatures(declared?: Record<string, FeatureDeclaration>): Features;
|
|
26
|
+
/**
|
|
27
|
+
* Switches in the shape of a `.env` file: one `name=on` or `name=off` per line (`true`/`false`
|
|
28
|
+
* and `1`/`0` count too), `#` starts a comment, anything else is skipped. The `FEATURES`
|
|
29
|
+
* environment variable holds the same, comma-separated. Unknown names are kept: a plugin's
|
|
30
|
+
* switches are not known here.
|
|
31
|
+
*/
|
|
32
|
+
export declare function parseFeatures(text: string): Features;
|
|
33
|
+
/** The text of a `.features` file for these switches, one `name=on|off` per line. */
|
|
34
|
+
export declare function formatFeatures(features: Features): string;
|
|
35
|
+
/** Layers laid over each other, the last one winning; null layers are skipped. */
|
|
36
|
+
export declare function resolveFeatures(...layers: (Features | null | undefined)[]): Features;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { FEATURES } from "./feature-flags.js";
|
|
2
|
+
/**
|
|
3
|
+
* Feature switches: how a flag of feature-flags.ts (or a plugin's manifest) gets its value.
|
|
4
|
+
* The runtime resolves them from the defaults, what the Manage-App says for the team or the
|
|
5
|
+
* linked account, and this install's `.features` file; the studio and plugins read the result.
|
|
6
|
+
*/
|
|
7
|
+
export { FEATURES };
|
|
8
|
+
/** `teamPlans`, `contacts.leadScoring`. */
|
|
9
|
+
export const FEATURE_NAME = /^[a-z][a-zA-Z0-9]*(\.[a-z][a-zA-Z0-9]*)?$/;
|
|
10
|
+
export const FEATURE_NAMES = Object.keys(FEATURES);
|
|
11
|
+
/** A plugin's declarations under its id: `contacts` + `leadScoring` → `contacts.leadScoring`. */
|
|
12
|
+
export function declaredByPlugin(pluginId, features) {
|
|
13
|
+
const out = {};
|
|
14
|
+
for (const [key, raw] of Object.entries(features ?? {})) {
|
|
15
|
+
const name = `${pluginId}.${key}`;
|
|
16
|
+
if (!FEATURE_NAME.test(name)) {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
const d = typeof raw === "boolean" ? { default: raw } : raw;
|
|
20
|
+
out[name] = {
|
|
21
|
+
kind: d.kind ?? "release",
|
|
22
|
+
default: d.default ?? false,
|
|
23
|
+
label: d.label ?? key,
|
|
24
|
+
...(d.hint ? { hint: d.hint } : {}),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return out;
|
|
28
|
+
}
|
|
29
|
+
/** The defaults of these declarations; without any, the core's. */
|
|
30
|
+
export function defaultFeatures(declared = FEATURES) {
|
|
31
|
+
const out = {};
|
|
32
|
+
for (const [name, d] of Object.entries(declared)) {
|
|
33
|
+
out[name] = d.default;
|
|
34
|
+
}
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Switches in the shape of a `.env` file: one `name=on` or `name=off` per line (`true`/`false`
|
|
39
|
+
* and `1`/`0` count too), `#` starts a comment, anything else is skipped. The `FEATURES`
|
|
40
|
+
* environment variable holds the same, comma-separated. Unknown names are kept: a plugin's
|
|
41
|
+
* switches are not known here.
|
|
42
|
+
*/
|
|
43
|
+
export function parseFeatures(text) {
|
|
44
|
+
const out = {};
|
|
45
|
+
for (const raw of text.split(/[\n,]/)) {
|
|
46
|
+
const line = raw.replace(/#.*$/, "").trim();
|
|
47
|
+
if (!line) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
const m = /^([A-Za-z0-9.]+)\s*=\s*(\S+)$/.exec(line);
|
|
51
|
+
if (!m?.[1] || !m[2] || !FEATURE_NAME.test(m[1])) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
const value = m[2].toLowerCase();
|
|
55
|
+
if (["on", "true", "1"].includes(value)) {
|
|
56
|
+
out[m[1]] = true;
|
|
57
|
+
}
|
|
58
|
+
else if (["off", "false", "0"].includes(value)) {
|
|
59
|
+
out[m[1]] = false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return out;
|
|
63
|
+
}
|
|
64
|
+
/** The text of a `.features` file for these switches, one `name=on|off` per line. */
|
|
65
|
+
export function formatFeatures(features) {
|
|
66
|
+
const lines = Object.entries(features).map(([name, on]) => `${name}=${on ? "on" : "off"}`);
|
|
67
|
+
return lines.length ? `${lines.join("\n")}\n` : "";
|
|
68
|
+
}
|
|
69
|
+
/** Layers laid over each other, the last one winning; null layers are skipped. */
|
|
70
|
+
export function resolveFeatures(...layers) {
|
|
71
|
+
const out = {};
|
|
72
|
+
for (const layer of layers) {
|
|
73
|
+
if (layer) {
|
|
74
|
+
Object.assign(out, layer);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return out;
|
|
78
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wizards",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.47",
|
|
4
4
|
"description": "Make a wish. Get your wizard. It guides you step by step. Let AI do the work. Runs on your machine, on the AI subscription you already have.",
|
|
5
5
|
"license": "FSL-1.1-MIT",
|
|
6
6
|
"homepage": "https://engenty.ai",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,i as t,n,t as r}from"./jsx-runtime-D3jfb0Ew.js";import{O as i,r as a}from"./logo-C80CWCDM.js";import{b as o,c as s,f as c,m as l,n as u,p as d,x as f}from"./Marketplace-BWhUJ4UX.js";import{t as p}from"./useMutation-DKcIz55V.js";import{A as m,B as ee,C as h,D as g,G as _,I as v,J as y,M as b,P as x,Q as te,R as ne,V as S,_ as C,a as re,c as w,d as ie,f as T,g as ae,i as oe,n as E,nt as D,o as O,r as k,s as A,t as j}from"./ui-D92EkdEB.js";import{n as se,r as M,t as ce}from"./sparkles-CP5H-O1E.js";import{t as N}from"./external-link-CpU8aJY2.js";import{n as le}from"./volume-2-0SfkvOho.js";import{O as ue}from"./definition-CQGiBQ4X.js";import{d as de,f as fe,s as P,t as pe,u as me}from"./session-miDEdw2c.js";import{a as F,i as he,r as I,t as ge}from"./ThemeSwitch-C1qYFoYP.js";var L={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};L.node;var _e=y(L),R={name:`book-open`,size:24,node:[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]};R.node;var z=y(R),B={name:`cloud`,size:24,node:[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]};B.node;var V=y(B),H={name:`fingerprint-pattern`,size:24,node:[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]],aliases:[`fingerprint`]};H.node;var ve=y(H),ye={name:`hard-drive`,size:24,node:[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]};ye.node;var be=y(ye),xe={name:`inbox`,size:24,node:[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]};xe.node;var Se=y(xe),Ce={name:`laptop`,size:24,node:[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]};Ce.node;var U=y(Ce),we={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};we.node;var Te=y(we),Ee={name:`list`,size:24,node:[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]};Ee.node;var De=y(Ee),Oe={name:`log-out`,size:24,node:[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]};Oe.node;var ke=y(Oe),Ae={name:`message-circle-more`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]};Ae.node;var je=y(Ae),W={name:`message-circle`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]};W.node;var Me=y(W),Ne={name:`message-square-text`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]};Ne.node;var Pe=y(Ne),Fe={name:`phone-call`,size:24,node:[[`path`,{d:`M13 2a9 9 0 0 1 9 9`,key:`1itnx2`}],[`path`,{d:`M13 6a5 5 0 0 1 5 5`,key:`11nki7`}],[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]};Fe.node;var Ie=y(Fe),Le={name:`radio`,size:24,node:[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]};Le.node;var Re=y(Le),ze={name:`rows-3`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]],aliases:[`panels-top-bottom`]};ze.node;var Be=y(ze),G=e(n(),1),Ve=e=>[`project-files`,e];function He(e){return a({queryKey:Ve(e),queryFn:()=>h.get(`/api/studio/projects/${e}/files`),refetchInterval:e=>e.state.data?.files.some(e=>e.status===`pending`)?2e3:!1})}function Ue(e,t){return m(`/api/studio/projects/${e}/files/${t}/content`)}function We(e,t=!1){let n=i(),[r,a]=(0,G.useState)(!1),[o,s]=(0,G.useState)(null),c=()=>n.invalidateQueries({queryKey:Ve(e)}),l=async e=>{s(null);try{await e()}catch(e){s(e.message)}finally{await c()}};return{busy:r,error:o,readOnly:t,upload:async(t,n)=>{a(!0),await l(async()=>{for(let r of n)await h.upload(`/api/studio/projects/${e}/files?kind=${t}`,r),await c()}),a(!1)},describe:(t,n)=>l(()=>h.patch(`/api/studio/projects/${e}/files/${t}`,{description:n})),remove:t=>l(()=>h.del(`/api/studio/projects/${e}/files/${t}`)),reindex:t=>l(()=>h.post(`/api/studio/projects/${e}/files/${t}/reindex`)),order:(t,n)=>l(()=>h.put(`/api/studio/projects/${e}/files/order`,{kind:t,ids:n}))}}function Ge(e,t){let n=`wz.layout.${e}`,[r,i]=(0,G.useState)(()=>{try{let e=localStorage.getItem(n);return e===`list`||e===`cards`?e:t}catch{return t}});return[r,()=>i(e=>{let t=e===`list`?`cards`:`list`;try{localStorage.setItem(n,t)}catch{}return t})]}function Ke(e,t,n=700){let[r,i]=(0,G.useState)(`idle`),[a,o]=(0,G.useState)(null),s=JSON.stringify(e),c=(0,G.useRef)(s),l=(0,G.useRef)({value:e,json:s,save:t});l.current={value:e,json:s,save:t};let u=(0,G.useRef)(Promise.resolve()),d=(0,G.useCallback)(()=>{let e=l.current;e.json!==c.current&&(c.current=e.json,i(`saving`),u.current=u.current.then(async()=>{try{await e.save(e.value),o(null),i(`saved`)}catch(e){c.current=``,o(e.message),i(`error`)}}))},[]);return(0,G.useEffect)(()=>{if(s===c.current)return;let e=setTimeout(d,n);return()=>clearTimeout(e)},[s,n,d]),(0,G.useEffect)(()=>d,[d]),{state:r,error:a}}function qe(e){return e<1e6?`${Math.max(1,Math.round(e/1e3))} KB`:`${(e/1e6).toFixed(1)} MB`}var K=e(r(),1);function Je({id:e,children:t}){return(0,K.jsx)(`div`,{id:e,className:`scroll-mt-6 max-md:scroll-mt-20`,children:t})}function q({title:e,hint:t,save:n,action:r,locked:i,plain:a,children:o}){return(0,K.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-1`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`h2`,{className:`font-display font-semibold text-lg leading-tight`,children:e}),n?.state===`saving`?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[0.75rem] text-ink-3`,children:[(0,K.jsx)(T,{className:`size-3`}),` `,x(`project.saving`)]}):n?.state===`saved`?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[0.75rem] text-moss`,children:[(0,K.jsx)(_,{className:`size-3.5`}),` `,x(`settings.saved`)]}):null]}),t?(0,K.jsx)(`p`,{className:`mt-1 text-[0.875rem] text-ink-3 leading-snug`,children:t}):null]}),r?(0,K.jsx)(`div`,{className:`shrink-0`,children:r}):null]}),a?o:(0,K.jsxs)(E,{className:`p-3.5 sm:p-5`,children:[i?(0,K.jsx)(`fieldset`,{disabled:!0,className:`min-w-0`,children:o}):o,n?.state===`error`&&n.error?(0,K.jsx)(`p`,{className:`mt-4 text-[0.875rem] text-rose`,children:n.error}):null]})]})}function Ye({children:e,layout:t,onToggle:n}){return(0,K.jsxs)(`div`,{className:`mb-3 flex items-start gap-2`,children:[(0,K.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,K.jsx)(`div`,{className:`w-56 max-w-full transition-[width] duration-200 focus-within:w-full has-[input:not(:placeholder-shown)]:w-full`,children:e})}),(0,K.jsx)(O,{label:x(t===`list`?`project.viewCards`:`project.viewList`),onClick:n,children:t===`list`?(0,K.jsx)(Te,{className:`size-4`}):(0,K.jsx)(De,{className:`size-4`})})]})}function Xe({value:e,onChange:t,onEnter:n,placeholder:r,busy:i}){return(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsx)(c,{className:`-translate-y-1/2 pointer-events-none absolute top-1/2 left-3 size-4 text-ink-4`}),(0,K.jsx)(`input`,{type:`search`,value:e,placeholder:r,onChange:e=>t(e.target.value),onKeyDown:e=>e.key===`Enter`&&n?.(),className:`h-9 w-full rounded-lg border border-input bg-card pr-3 pl-9 text-[0.875rem] text-ink outline-none transition placeholder:text-ink-4 focus:border-focus focus:ring-4 focus:ring-focus-glow`}),i?(0,K.jsx)(T,{className:`-translate-y-1/2 absolute top-1/2 right-3 size-4 text-ink-3`}):null]})}function Ze({onFiles:e,accept:t,multiple:n=!0,className:r,children:i}){return(0,K.jsxs)(`label`,{onDragOver:e=>{e.preventDefault(),e.currentTarget.dataset.over=`1`},onDragLeave:e=>{delete e.currentTarget.dataset.over},onDrop:t=>{t.preventDefault(),delete t.currentTarget.dataset.over;let r=Array.from(t.dataTransfer.files);r.length&&e(n?r:r.slice(0,1))},className:C(`flex cursor-pointer items-center justify-center gap-2 rounded-lg border border-input border-dashed text-[0.875rem] text-ink-3 transition focus-within:border-focus focus-within:ring-4 focus-within:ring-focus-glow hover:border-ink-4 hover:text-ink data-[over]:border-focus data-[over]:bg-paper-2 data-[over]:text-ink`,r),children:[i,(0,K.jsx)(`input`,{className:`sr-only`,type:`file`,accept:t,multiple:n,onChange:t=>{let n=Array.from(t.target.files??[]);t.target.value=``,n.length&&e(n)}})]})}function J(e){try{return new URL(e).host}catch{return e}}var Y=e=>`${window.location.origin}${g}/w/${e.shareToken}`;function X(e,t,n){if(!e.published)return{kind:`draft`};if(t.mode===`managed`)return{kind:`live`,url:Y(e),runs:e.publishedVersion??0,notes:0,cloud:!1};if(!t.account||n===null)return{kind:`here`};if(n===void 0)return{kind:`unknown`};let{copy:r,error:i}=n,a=r?.publishedVersion??null,o=r&&a!==null?r.shareUrl:null;return i?.again?{kind:`sending`,url:o,runs:a,again:i.again}:i?{kind:`missing`,url:o,runs:a,why:i.message}:!r||r.version<(e.publishedVersion??0)?{kind:`missing`,url:o,runs:a,why:x(`cloud.notSent`)}:!r.runnable||!o||a===null?{kind:`missing`,url:o,runs:a,why:`${x(`cloud.notRunnable`,{v:r.version})} ${a===null?x(`cloud.nothingRuns`):x(`cloud.keepsRunning`,{v:a})}`}:{kind:`live`,url:o,runs:a,notes:r.problems.filter(e=>!e.blocking).length,cloud:!0}}function Qe(e){return e.kind===`live`||e.kind===`sending`||e.kind===`missing`?e.url:null}function $e({where:e,me:t,version:n}){let r=J(t.account?.cloudUrl??``),i=`size-3.5`;switch(e.kind){case`draft`:return null;case`unknown`:return(0,K.jsx)(k,{tone:`live`,children:x(`home.live`)});case`here`:return(0,K.jsx)(k,{icon:(0,K.jsx)(U,{className:i}),title:x(`where.hereHint`),children:n?x(`where.hereVersion`,{v:n}):x(`where.here`)});case`live`:{let t=n?x(`editor.published`,{v:e.runs}):x(`home.live`),a=e.notes===1?x(`where.note`):e.notes>1?x(`where.notes`,{n:e.notes}):null;return(0,K.jsx)(k,{tone:`live`,icon:e.cloud?(0,K.jsx)(V,{className:i}):void 0,title:e.cloud?x(`where.liveHint`,{host:r}):void 0,children:a?`${t} · ${a}`:t})}case`sending`:return(0,K.jsx)(k,{tone:`warn`,icon:(0,K.jsx)(S,{className:i}),title:x(`cloud.again`,{when:new Intl.DateTimeFormat(b,{timeStyle:`short`}).format(new Date(e.again))}),children:x(`where.sending`)});case`missing`:return(0,K.jsx)(k,{tone:`warn`,icon:(0,K.jsx)(f,{className:i}),title:e.why,children:e.runs===null?x(`where.missing`):x(`editor.published`,{v:e.runs})})}}var et=`mt-1.5 text-[0.8125rem] text-ink-3`;function Z(e){let t=i(),[n,r]=(0,G.useState)(!1),a=p({mutationFn:e=>h.post(`/api/studio/account/link`,e),onSuccess:({url:e})=>{I(e),r(!0)}});return(0,G.useEffect)(()=>{if(!n)return;let e=setInterval(()=>void t.invalidateQueries({queryKey:[`me`]}),2e3),i=setTimeout(()=>r(!1),3e5);return()=>{clearInterval(e),clearTimeout(i)}},[n,t]),(0,G.useEffect)(()=>{e&&r(!1)},[e]),{link:a,waiting:n}}function Q({link:e,waiting:t}){return e.isError?(0,K.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:x(`local.accountFailed`)}):t?(0,K.jsxs)(`p`,{className:`flex items-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,K.jsx)(T,{className:`size-3.5`}),` `,x(`local.accountWaiting`)]}):null}function tt(){let e=Z(!1),{link:t}=e,[n,r]=(0,G.useState)(``);return(0,K.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-4 py-5 first:pt-0 last:pb-0`,children:[(0,K.jsx)(`div`,{className:`flex size-11 shrink-0 items-center justify-center rounded-full bg-paper-2 text-ink-2`,children:(0,K.jsx)(be,{className:`size-5`})}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`font-medium text-[0.9375rem]`,children:x(`account.local`)}),(0,K.jsx)(`p`,{className:`mt-1 text-[0.875rem] text-ink-3 leading-relaxed`,children:x(`account.localText`)})]})]}),F.account?(0,K.jsxs)(`div`,{className:`flex flex-col gap-4 py-5 last:pb-0`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`font-medium text-[0.9375rem]`,children:x(`account.with`)}),(0,K.jsxs)(`ul`,{className:`mt-2 flex flex-col gap-2 text-[0.875rem] text-ink-2 leading-snug`,children:[(0,K.jsxs)(`li`,{className:`flex items-start gap-2.5`,children:[(0,K.jsx)(o,{className:`mt-0.5 size-4 shrink-0 text-amber`}),x(`account.withCredits`)]}),(0,K.jsxs)(`li`,{className:`flex items-start gap-2.5`,children:[(0,K.jsx)(V,{className:`mt-0.5 size-4 shrink-0 text-cobalt`}),x(`account.withCloud`)]})]})]}),(0,K.jsx)(`div`,{children:(0,K.jsx)(j,{busy:t.isPending&&!t.variables?.signup,onClick:()=>t.mutate({}),children:x(`account.signIn`)})})]}):null,F.account?(0,K.jsxs)(`form`,{className:`flex flex-col gap-3 py-5 last:pb-0`,onSubmit:e=>{e.preventDefault(),t.mutate({signup:!0,code:n.trim()||void 0})},children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`font-medium text-[0.9375rem]`,children:x(`account.new`)}),(0,K.jsx)(`p`,{className:`mt-1 text-[0.875rem] text-ink-3 leading-relaxed`,children:x(`account.newHint`)})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(A,{value:n,maxLength:64,autoComplete:`off`,spellCheck:!1,placeholder:x(`account.code`),"aria-label":x(`account.code`),onChange:e=>r(e.target.value),className:`w-56 font-mono text-[0.875rem]`}),(0,K.jsx)(j,{type:`submit`,variant:`secondary`,className:`h-11`,busy:t.isPending&&!!t.variables?.signup,children:x(`account.create`)})]}),(0,K.jsx)(Q,{...e})]}):null]})}var nt={start:`account.kind.start`,monthly:`account.kind.monthly`,gift:`account.kind.gift`};function rt({account:e}){let t=i(),n=Z(e.signedIn),r=p({mutationFn:()=>h.del(`/api/studio/account`),onSuccess:()=>t.invalidateQueries({queryKey:[`me`]})}),a=new Intl.DateTimeFormat(b,{dateStyle:`medium`});return(0,K.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3 py-5 first:pt-0`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate font-medium text-[0.9375rem]`,children:e.name||e.email}),e.signedIn?(0,K.jsx)(k,{tone:`live`,children:x(`account.linked`)}):null]}),(0,K.jsx)(`div`,{className:`truncate text-[0.875rem] text-ink-3`,children:e.email})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsxs)(j,{variant:`secondary`,onClick:()=>I(e.url),children:[x(`setup.openAccount`),` `,(0,K.jsx)(N,{className:`size-4`})]}),(0,K.jsxs)(j,{variant:`ghost`,busy:r.isPending,onClick:()=>r.mutate(),children:[(0,K.jsx)(ke,{className:`size-4`}),` `,x(`nav.logout`)]})]})]}),e.signedIn?null:(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 py-5`,children:[(0,K.jsx)(`p`,{className:`text-[0.875rem] text-ink-2`,children:x(`local.accountExpired`)}),(0,K.jsx)(`div`,{children:(0,K.jsx)(j,{busy:n.link.isPending,onClick:()=>n.link.mutate({}),children:x(`account.signInAgain`)})}),(0,K.jsx)(Q,{...n})]}),e.credits===null?null:(0,K.jsxs)(`div`,{className:`py-5`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:x(`account.credits`)}),(0,K.jsx)(`div`,{className:`font-display font-semibold text-[1.375rem] tabular-nums leading-tight`,children:x(`nav.credits`,{n:Math.floor(e.credits).toLocaleString()})})]}),(0,K.jsxs)(j,{variant:`secondary`,onClick:()=>I(`${e.url}/billing`),children:[x(`account.topUp`),` `,(0,K.jsx)(N,{className:`size-4`})]})]}),e.expiring.length?(0,K.jsx)(`ul`,{className:`mt-3 flex flex-col gap-1 text-[0.8125rem] text-ink-3 tabular-nums`,children:e.expiring.map(e=>(0,K.jsxs)(`li`,{children:[x(`account.expires`,{n:Math.floor(e.credits).toLocaleString(),date:a.format(new Date(e.expiresAt))}),nt[e.kind]?(0,K.jsxs)(`span`,{className:`text-ink-4`,children:[` · `,x(nt[e.kind])]}):null]},`${e.kind}:${e.expiresAt}`))}):null]}),(0,K.jsxs)(`div`,{className:`flex items-start gap-2.5 py-5 text-[0.875rem] text-ink-2 leading-snug last:pb-0`,children:[(0,K.jsx)(V,{className:`mt-0.5 size-4 shrink-0 text-cobalt`}),(0,K.jsx)(`p`,{children:x(`account.cloud`,{host:J(e.cloudUrl)})})]})]})}function it({me:e,fromAccount:t}){let n=i(),[r,a]=(0,G.useState)(e.profile),o=e=>a(t=>({...t,...e})),s=Ke(r,async e=>{await h.put(`/api/studio/profile`,e),await n.invalidateQueries({queryKey:[`me`]})});return(0,K.jsx)(q,{title:x(`account.profile`),hint:x(`account.hint`),save:s,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-6 sm:flex-row sm:gap-8`,children:[(0,K.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-2 sm:w-32`,children:[(0,K.jsx)(`div`,{className:`flex size-20 items-center justify-center overflow-hidden rounded-full bg-ember-tint font-semibold text-[1.75rem] text-ember-strong ring-1 ring-border-soft`,children:e.user.image?(0,K.jsx)(`img`,{src:e.user.image,alt:``,className:`size-full object-cover`}):pe(r.name)||`?`}),(0,K.jsx)(`p`,{className:`text-center text-[0.75rem] text-ink-3 leading-snug`,children:x(`account.initials`)})]}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-5`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(w,{children:x(`account.name`)}),(0,K.jsx)(A,{value:r.name,maxLength:80,disabled:t,onChange:e=>o({name:e.target.value})}),(0,K.jsx)(`p`,{className:et,children:x(t?`account.fromAccount`:`account.nameHint`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(w,{children:x(`account.about`)}),(0,K.jsx)(ae,{minRows:3,maxLength:2e3,value:r.about,onChange:e=>o({about:e.target.value})}),(0,K.jsx)(`p`,{className:et,children:x(`account.aboutHint`)})]}),(0,K.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(w,{children:x(`account.email`)}),(0,K.jsx)(A,{type:`email`,value:r.email,maxLength:200,disabled:t,onChange:e=>o({email:e.target.value})})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(w,{children:x(`account.phone`)}),(0,K.jsx)(A,{type:`tel`,value:r.phone,maxLength:40,onChange:e=>o({phone:e.target.value})})]})]})]})]})})}function at({me:e}){let t=e.mode===`managed`,n=t||!!e.account;return(0,K.jsxs)(`div`,{className:`flex flex-col gap-9`,children:[(0,K.jsx)(q,{title:x(`account.connection`),hint:x(`account.connectionHint`),children:t?(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate font-medium text-[0.9375rem]`,children:e.user.name}),(0,K.jsx)(k,{tone:`live`,children:x(`account.linked`)})]}),(0,K.jsx)(`div`,{className:`truncate text-[0.875rem] text-ink-3`,children:e.user.email})]}),e.manageUrl?(0,K.jsxs)(j,{variant:`secondary`,onClick:()=>I(`${e.manageUrl}/account`),children:[x(`setup.openAccount`),` `,(0,K.jsx)(N,{className:`size-4`})]}):null]}):e.account?(0,K.jsx)(rt,{account:e.account}):(0,K.jsx)(tt,{})}),(0,K.jsx)(it,{me:e,fromAccount:n},n?`account`:`own`),(0,K.jsx)(q,{title:x(`account.look`),hint:x(`account.lookHint`),children:(0,K.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pb-4`,children:[(0,K.jsx)(`span`,{className:`font-medium text-[0.875rem]`,children:x(`nav.language`)}),(0,K.jsx)(he,{tone:`surface`})]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pt-4`,children:[(0,K.jsx)(`span`,{className:`font-medium text-[0.875rem]`,children:x(`nav.theme`)}),(0,K.jsx)(ge,{})]})]})})]})}var ot={steps:Be,chat:Me,talk:ee,whatsapp:je,sms:Pe,call:Ie,video:le},st=e=>ot[e]??d,ct=[`steps`,`chat`];function lt(){return a({queryKey:[`runners`],queryFn:()=>h.get(`/api/studio/runners`),staleTime:6e4})}function ut(e,t){let n=new Set(t.map(e=>e.id)),r=(e.runners?.enabled??ct).filter(e=>n.has(e)),i=e.runners?.default??`steps`;return[...r].sort((e,t)=>e===i?-1:+(t===i))}function dt({w:e,runners:t}){let n=ut(e,t),r=e.runners?.default??`steps`;return(0,K.jsx)(`span`,{className:`inline-flex items-center gap-1.5`,children:n.map(e=>{let n=st(e),i=t.find(t=>t.id===e)?.label[b]??e;return(0,K.jsx)(n,{"aria-label":i,className:C(`size-3.5`,e===r?`text-ink-2`:`text-ink-4`),children:(0,K.jsx)(`title`,{children:i})},e)})})}var ft=t({HomePage:()=>Ot,NewSpaceDialog:()=>$,ProjectSwitcher:()=>mt}),pt=[{icon:s,name:()=>x(`nav.wizards`),what:`space.holds.wizards`},{icon:ve,name:()=>x(`space.info`),what:`space.holds.info`},{icon:z,name:()=>`${x(`space.knowledge`)} & ${x(`space.data`)}`,what:`space.holds.knowledge`},{icon:l,name:()=>x(`connectors.title`),what:`space.holds.connectors`},{icon:Se,name:()=>x(`space.results`),what:`space.holds.results`}];function $({open:e,onClose:t}){let{select:n}=P(),r=i(),[a,o]=(0,G.useState)(``),s=p({mutationFn:()=>h.post(`/api/studio/projects`,{name:a}),onSuccess:async({id:e})=>{await r.invalidateQueries({queryKey:[`projects`]}),n(e),o(``),t()}});return(0,K.jsxs)(oe,{open:e,onClose:t,title:x(`home.newProject`),children:[(0,K.jsx)(`p`,{className:`-mt-2 text-[0.875rem] text-ink-2`,children:x(`space.holds.intro`)}),(0,K.jsx)(`dl`,{className:`mt-4 flex flex-col gap-2.5 text-[0.8125rem]`,children:pt.map(e=>(0,K.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,K.jsx)(e.icon,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),(0,K.jsx)(`dt`,{className:`w-28 shrink-0 font-medium text-ink`,children:e.name()}),(0,K.jsx)(`dd`,{className:`min-w-0 text-ink-3`,children:x(e.what)})]},e.what))}),(0,K.jsx)(`p`,{className:`mt-3 text-[0.8125rem] text-ink-4`,children:x(`space.holds.shared`)}),(0,K.jsxs)(`form`,{className:`mt-5`,onSubmit:e=>{e.preventDefault(),a.trim()&&s.mutate()},children:[(0,K.jsx)(A,{autoFocus:!0,placeholder:x(`home.projectName`),value:a,onChange:e=>o(e.target.value)}),(0,K.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,K.jsx)(j,{variant:`ghost`,onClick:t,children:x(`common.cancel`)}),(0,K.jsx)(j,{type:`submit`,busy:s.isPending,disabled:!a.trim(),children:x(`home.newProject`)})]})]})]})}function mt(){let{project:e,projects:t,select:n}=P(),r=fe().data?.limits.projects??1,i=de(),[a,o]=(0,G.useState)(!1);return!e||r!==null&&r<=1?null:(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(ie,{className:`w-56`,value:e.id,onChange:e=>e===`__new`?o(!0):n(e),options:[...t.map(e=>({value:e.id,label:e.name})),...i?[r===null||t.length<r?{value:`__new`,label:`+ ${x(`home.newProject`)}`}:{value:`__new`,label:x(`home.projectLimit`,{n:r}),disabled:!0}]:[]]}),(0,K.jsx)($,{open:a,onClose:()=>o(!1)})]})}function ht({url:e}){let[t,n]=(0,G.useState)(!1);return(0,K.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},className:`inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[0.8125rem] text-ink-3 hover:bg-accent hover:text-ink`,children:[t?(0,K.jsx)(_,{className:`size-3.5`}):(0,K.jsx)(M,{className:`size-3.5`}),x(t?`share.copied`:`share.link`)]})}function gt(){let e=D(),t=Z(!1),[n,r]=(0,G.useState)(!1),i=(0,G.useRef)(null);return(0,G.useEffect)(()=>{if(!n)return;let e=e=>{i.current?.contains(e.target)||r(!1)},t=e=>{e.key===`Escape`&&r(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[n]),(0,K.jsxs)(`div`,{className:`relative`,ref:i,onClick:e=>e.stopPropagation(),children:[(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>r(e=>!e),className:`inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[0.8125rem] text-ink-3 hover:bg-accent hover:text-ink`,children:[(0,K.jsx)(M,{className:`size-3.5`}),` `,x(`share.link`)]}),n?(0,K.jsxs)(`div`,{className:`absolute right-0 bottom-10 z-20 flex w-72 animate-rise flex-col gap-3 rounded-xl bg-card p-3.5 shadow-overlay ring-1 ring-border-soft`,children:[(0,K.jsx)(`p`,{className:`text-[0.8125rem] text-ink-2 leading-relaxed`,children:x(`teaser.link`)}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(j,{size:`sm`,busy:t.link.isPending,onClick:()=>t.link.mutate({}),children:x(`account.signIn`)}),(0,K.jsx)(j,{size:`sm`,variant:`secondary`,onClick:()=>e(`/settings/account`),children:x(`account.create`)})]}),(0,K.jsx)(Q,{...t})]}):null]})}function _t({w:e,me:t,runners:n}){let r=D(),i=X(e,t,e.cloud),a=Qe(i),o=a??(e.published?Y(e):null);return(0,K.jsxs)(`div`,{className:`relative pt-6`,children:[(0,K.jsx)(`div`,{className:`pointer-events-none absolute top-0 left-4 z-10`,children:(0,K.jsx)(ue,{kind:e.avatar,size:52})}),(0,K.jsxs)(E,{className:`relative flex h-full cursor-pointer flex-col px-5 pt-10 pb-3 transition hover:shadow-elevated`,onClick:()=>r(`/edit/${e.id}`),children:[(0,K.jsx)(`div`,{className:`absolute top-3 right-3`,children:e.published?(0,K.jsx)($e,{where:i,me:t}):(0,K.jsx)(k,{children:x(`home.draft`)})}),(0,K.jsx)(`h3`,{className:`font-display font-semibold text-[1.0625rem] leading-snug`,children:e.title}),(0,K.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[0.875rem] text-ink-3`,children:e.description}),(0,K.jsxs)(`div`,{className:`mt-auto flex min-h-8 items-center justify-between pt-3`,children:[(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-2.5 text-[0.75rem] text-ink-4`,children:[x(`home.steps`,{n:e.stepCount}),(0,K.jsx)(dt,{w:e,runners:n})]}),(0,K.jsxs)(`div`,{className:`flex items-center`,children:[a?(0,K.jsx)(ht,{url:a}):i.kind===`here`&&F.account?(0,K.jsx)(gt,{}):null,o?(0,K.jsx)(O,{label:x(a?`share.open`:`share.openHere`),className:`ml-1 size-8`,onClick:e=>{e.stopPropagation(),I(o)},children:(0,K.jsx)(_e,{className:`size-4`})}):null]})]})]})]})}var vt=[`draft`,`here`,`live`,`missing`],yt={draft:se,here:U,live:Re,missing:f},bt=e=>x(e===`draft`?`home.draft`:e===`here`?`where.here`:e===`live`?`home.live`:`where.missing`);function xt(e,t){let{kind:n}=X(e,t,e.cloud);return n===`draft`||n===`here`?n:n===`live`||n===`unknown`?`live`:`missing`}function St({wizards:e,me:t,value:n,onChange:r}){let i=new Map;for(let n of e){let e=xt(n,t);i.set(e,(i.get(e)??0)+1)}if(i.size<2)return null;let a=e=>C(`inline-flex h-8 items-center gap-1.5 rounded-full px-3 font-medium text-[0.8125rem] transition`,e?`bg-paper-2 text-ink`:`text-ink-3 hover:text-ink`);return(0,K.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-1`,children:[(0,K.jsxs)(`button`,{type:`button`,className:a(n===null),onClick:()=>r(null),children:[x(`home.all`),(0,K.jsx)(`span`,{className:`text-[0.75rem] text-ink-4`,children:e.length})]}),vt.filter(e=>i.has(e)).map(e=>{let t=yt[e];return(0,K.jsxs)(`button`,{type:`button`,"aria-pressed":n===e,className:a(n===e),onClick:()=>r(n===e?null:e),children:[(0,K.jsx)(t,{className:`size-3.5`}),bt(e),(0,K.jsx)(`span`,{className:`text-[0.75rem] text-ink-4`,children:i.get(e)})]},e)})]})}var Ct=12,wt=3;function Tt({value:e,onChange:t}){return(0,K.jsxs)(`label`,{className:`relative flex h-10 w-full max-w-md items-center gap-2.5 rounded-full bg-card px-4 shadow-soft ring-1 ring-border-soft transition focus-within:ring-2 focus-within:ring-focus sm:h-11`,children:[(0,K.jsx)(c,{className:`size-4 shrink-0 text-ink-3`}),(0,K.jsx)(`input`,{type:`search`,value:e,onChange:e=>t(e.target.value),placeholder:x(`home.search`),"aria-label":x(`home.search`),className:`min-w-0 flex-1 bg-transparent text-[0.9375rem] outline-none placeholder:text-ink-4 [&::-webkit-search-cancel-button]:hidden`}),e?(0,K.jsx)(`button`,{type:`button`,"aria-label":x(`market.reset`),onClick:()=>t(``),className:`-mr-1.5 flex size-7 shrink-0 items-center justify-center rounded-full text-ink-3 hover:bg-paper-2 hover:text-ink`,children:(0,K.jsx)(v,{className:`size-4`})}):null]})}var Et=`curl -fsSL https://engenty.ai/install.sh | bash`;function Dt(){let[e,t]=(0,G.useState)(!1),n=[x(`home.local.install`),x(`home.local.signIn`),x(`home.local.publish`)];return(0,K.jsxs)(`div`,{className:`mx-auto flex max-w-xl animate-rise flex-col items-center pt-4 text-center`,children:[(0,K.jsx)(ue,{kind:`round`,size:120}),(0,K.jsx)(`h1`,{className:`mt-2 font-display font-semibold text-[1.75rem] leading-tight tracking-tight`,children:x(`home.local.title`)}),(0,K.jsx)(`p`,{className:`mt-3 text-[0.9375rem] text-ink-2 leading-relaxed`,children:x(`home.local.text`)}),(0,K.jsx)(`ol`,{className:`mt-8 flex w-full flex-col gap-4 text-left`,children:n.map((n,r)=>(0,K.jsxs)(`li`,{className:`flex gap-3`,children:[(0,K.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-full bg-paper-2 font-medium text-[0.8125rem] text-ink-2`,children:r+1}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,K.jsx)(`p`,{className:`text-[0.9375rem] leading-snug`,children:n}),r===0?(0,K.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 rounded-lg bg-paper-2 py-1.5 pr-1.5 pl-3`,children:[(0,K.jsx)(`code`,{className:`min-w-0 flex-1 select-all overflow-x-auto whitespace-nowrap font-mono text-[0.8125rem] text-ink-2`,children:Et}),(0,K.jsxs)(j,{variant:`secondary`,size:`sm`,onClick:()=>{navigator.clipboard.writeText(Et),t(!0),setTimeout(()=>t(!1),1500)},children:[e?(0,K.jsx)(_,{className:`size-3.5`}):(0,K.jsx)(M,{className:`size-3.5`}),x(e?`share.copied`:`share.copy`)]})]}):null]})]},n))})]})}function Ot(){let e=D(),t=i(),{project:n,projects:r,loading:o}=P(),s=fe().data,c=me(),l=de(),d=a({queryKey:[`wizards`,n?.id,!!s?.account],queryFn:()=>h.get(`/api/studio/projects/${n.id}/wizards`),enabled:!!n}),f=lt().data??[],[m,ee]=(0,G.useState)(null),[g,_]=(0,G.useState)(``),v=(d.data?.length??0)>Ct,y=v?g.trim().toLowerCase():``,S=(d.data??[]).filter(e=>(!m||!s||xt(e,s)===m)&&(!y||`${e.title} ${e.description}`.toLowerCase().includes(y))),C=!!y&&S.length<wt,w=p({mutationFn:e=>h.post(`/api/studio/wizards`,{projectId:n.id,starterId:e,lang:b}),onSuccess:async({id:n})=>{await t.invalidateQueries({queryKey:[`projects`]}),await t.invalidateQueries({queryKey:[`wizards`]}),e(`/edit/${n}`)}}),ie=r.reduce((e,t)=>e+t.wizardCount,0),T=l&&!n?.readOnly;return!o&&T&&r.length&&ie===0?(0,K.jsx)(te,{to:`/new`,replace:!0}):!o&&!c&&r.length===0?(0,K.jsx)(Dt,{}):(0,K.jsxs)(`div`,{className:`animate-rise`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4`,children:[v?(0,K.jsx)(Tt,{value:g,onChange:_}):(0,K.jsx)(`h1`,{className:`font-display font-semibold text-[1.75rem] tracking-tight`,children:x(`home.title`)}),T?(0,K.jsxs)(j,{onClick:()=>e(`/new`),children:[(0,K.jsx)(ne,{className:`size-4`}),` `,x(`home.new`)]}):null]}),n?.origin===`local`?(0,K.jsxs)(`p`,{className:`mt-2 text-[0.875rem] text-ink-3`,children:[x(`home.fromLocal`),` `,n.syncedAt?x(`home.syncedAt`,{when:new Intl.DateTimeFormat(b,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(n.syncedAt))}):null]}):null,d.data&&d.data.length===0?(0,K.jsxs)(re,{children:[(0,K.jsx)(`p`,{children:x(`home.empty`)}),T?(0,K.jsxs)(j,{className:`mt-5`,onClick:()=>e(`/new`),children:[(0,K.jsx)(ne,{className:`size-4`}),` `,x(`home.new`)]}):null]}):null,d.data?.length&&s?(0,K.jsx)(St,{wizards:d.data,me:s,value:m,onChange:ee}):null,y&&S.length===0?(0,K.jsx)(`p`,{className:`mt-6 text-[0.875rem] text-ink-3`,children:x(`home.noMatch`)}):null,(0,K.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:s?S.map(e=>(0,K.jsx)(_t,{w:e,me:s,runners:f},e.id)):null}),C?(0,K.jsxs)(K.Fragment,{children:[T?(0,K.jsx)(u,{query:g,busy:w.isPending,onUse:e=>n&&!w.isPending&&w.mutate(e.id)}):(0,K.jsx)(u,{query:g}),T?(0,K.jsx)(`div`,{className:`mt-8 flex justify-center`,children:(0,K.jsxs)(j,{variant:`secondary`,onClick:()=>e(`/new?wish=${encodeURIComponent(g.trim())}`),children:[(0,K.jsx)(ce,{className:`size-4`}),` `,x(`home.newFromSearch`,{q:g.trim()})]})}):null]}):null]})}export{z as A,Me as C,Se as D,U as E,ve as O,He as S,Te as T,qe as _,Q as a,We as b,J as c,X as d,Je as f,q as g,Xe as h,at as i,V as k,Y as l,Ye as m,$ as n,Z as o,Ze as p,mt as r,$e as s,ft as t,Qe as u,Ue as v,ke as w,Ge as x,Ke as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r,r as i}from"./logo-C80CWCDM.js";import{S as a,_ as o,b as s,f as c,m as l,v as u,w as d}from"./Marketplace-BWhUJ4UX.js";import{t as f}from"./useMutation-DKcIz55V.js";import{C as p,G as m,J as h,M as g,P as _,Q as v,R as y,W as b,X as x,_ as S,a as ee,d as C,f as w,it as T,l as E,m as D,n as O,nt as te,o as k,r as A,rt as ne,s as j,t as M}from"./ui-D92EkdEB.js";import{t as re}from"./arrow-right-Dpp_mpHe.js";import{E as ie,g as ae,i as oe,r as se}from"./HomePage-BG5OZJkv.js";import{t as ce}from"./circle-alert-CPo3Naay.js";import{r as le}from"./sparkles-CP5H-O1E.js";import{t as N}from"./external-link-CpU8aJY2.js";import{r as ue,t as de}from"./volume-2-0SfkvOho.js";import{n as fe,t as pe}from"./trash-DU-hZpV0.js";import{c as me}from"./definition-CQGiBQ4X.js";import{t as he}from"./refresh-cw-Cli5WGnW.js";import{f as ge,l as _e,s as ve,t as ye}from"./session-miDEdw2c.js";import{a as be,r as xe}from"./ThemeSwitch-C1qYFoYP.js";import{I as Se,M as Ce,P as we,R as Te,n as Ee,r as De,t as Oe,z as ke}from"./index-CIO9W4pe.js";import{a as P,c as Ae,d as je,f as Me,i as F,l as Ne,n as Pe,o as Fe,r as Ie,s as Le,t as Re,u as ze}from"./settings-menu-ROT8Lbbj.js";import{n as Be,t as Ve}from"./ReadOnly-C9P9aiU6.js";import{t as He}from"./Harness-CfUfchNw.js";var Ue={name:`ear`,size:24,node:[[`path`,{d:`M6 8.5a6.5 6.5 0 1 1 13 0c0 6-6 6-6 10a3.5 3.5 0 1 1-7 0`,key:`1dfaln`}],[`path`,{d:`M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4`,key:`1qnva7`}]]};Ue.node;var We=h(Ue),Ge={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};Ge.node;var I=h(Ge),Ke={name:`mail-plus`,size:24,node:[[`path`,{d:`M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8`,key:`12jkf8`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}],[`path`,{d:`M19 16v6`,key:`tddt3s`}],[`path`,{d:`M16 19h6`,key:`xwg31i`}]]};Ke.node;var qe=h(Ke),Je={name:`rotate-cw`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]};Je.node;var Ye=h(Je),Xe={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};Xe.node;var Ze=h(Xe),L=e(t(),1),R=e(n(),1);function Qe(){let e=De(),[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(null),a=async e=>{n(e??`*`),i(null);try{await Ee(e)}catch(e){i(e.message)}finally{n(null)}};return(0,R.jsxs)(ae,{title:_(`plugins.title`),hint:e.canReload?_(`plugins.hint`):_(`plugins.hintManaged`),action:e.canReload?(0,R.jsx)(M,{variant:`secondary`,busy:t===`*`,onClick:()=>void a(),children:_(`plugins.rescan`)}):null,children:[e.plugins.length||e.problems.length?null:(0,R.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:_(`plugins.none`)}),(0,R.jsxs)(`ul`,{className:`divide-y divide-border-soft`,children:[e.plugins.map(n=>{let r=e.failed[n.id];return(0,R.jsxs)(`li`,{className:`flex items-start gap-4 py-4 first:pt-0 last:pb-0`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1`,children:[(0,R.jsx)(`span`,{className:`font-medium text-[0.9375rem]`,children:n.name}),n.name===n.id?null:(0,R.jsxs)(`span`,{className:`font-mono text-[0.75rem] text-ink-4`,children:[n.id,` · `,n.version]})]}),n.description?(0,R.jsx)(`p`,{className:`mt-0.5 text-[0.875rem] text-ink-3`,children:n.description}):null,n.tools.length?(0,R.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[0.75rem] text-ink-3`,children:[_(`plugins.tools`),n.tools.map(e=>(0,R.jsx)(A,{children:e.id},e.id))]}):null,n.error?(0,R.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:_(`plugins.serverFailed`,{error:n.error})}):null,r?(0,R.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:_(`plugins.studioFailed`,{error:r})}):null]}),e.canReload?(0,R.jsx)(k,{label:_(`plugins.reload`),disabled:t!==null,onClick:()=>void a(n.id),children:(0,R.jsx)(Ye,{className:t===n.id?`size-4 animate-spin`:`size-4`})}):null]},n.id)}),e.problems.map(e=>(0,R.jsxs)(`li`,{className:`py-4 first:pt-0 last:pb-0`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1`,children:[(0,R.jsx)(A,{tone:`warn`,children:_(`plugins.problems`)}),(0,R.jsx)(`span`,{className:`break-all font-mono text-[0.75rem] text-ink-3`,children:e.path})]}),(0,R.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:e.message})]},e.path))]}),r?(0,R.jsx)(`p`,{className:`mt-4 text-[0.8125rem] text-rose`,children:r}):null]})}var $e=[`pro-modules`],z=`/api/studio/plugins/-/pro`,et={managed:`pro.held.plan`,not_installed:`pro.held.release`,release:`pro.held.release`,unconfirmed:`pro.held.unconfirmed`,plan:`pro.held.plan`},tt=e=>new Date(e).toLocaleDateString(g===`de`?`de-AT`:`en-GB`,{day:`numeric`,month:`long`});function nt(){let e=r(),{canReload:t}=De(),n=i({queryKey:$e,queryFn:()=>p.get(z),enabled:t}),a=t=>e.setQueryData($e,t),o=f({mutationFn:()=>p.post(`${z}/refresh`),onSuccess:a}),s=f({mutationFn:e=>p.post(`${z}/${e}`),onSuccess:a}),c=f({mutationFn:e=>p.del(`${z}/${e}`),onSuccess:a}),l=n.data,u=s.isPending||c.isPending,d=s.error??c.error??o.error;return t?(0,R.jsx)(ae,{title:_(`pro.title`),hint:_(`pro.hint`),action:l?.linked?(0,R.jsx)(M,{variant:`secondary`,busy:o.isPending,onClick:()=>o.mutate(),children:_(`pro.check`)}):null,children:l?l.linked?(0,R.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 text-[0.8125rem] text-ink-3`,children:[(0,R.jsxs)(`span`,{children:[l.plan?_(`pro.plan`,{plan:l.plan.name}):null,l.plan&&l.expiresAt?` · `:null,l.expiresAt?_(`pro.confirmedUntil`,{date:tt(l.expiresAt)}):null]}),(0,R.jsxs)(M,{variant:`ghost`,onClick:()=>xe(`${l.accountUrl}/billing`),children:[_(`pro.plans`),` `,(0,R.jsx)(N,{className:`size-4`})]})]}),l.error?(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:l.error}):null,l.modules.length?(0,R.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:l.modules.map(e=>(0,R.jsxs)(`li`,{className:`flex items-start gap-4 py-4 first:pt-0 last:pb-0`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1`,children:[(0,R.jsx)(`span`,{className:`font-medium text-[0.9375rem]`,children:e.name}),(0,R.jsxs)(`span`,{className:`font-mono text-[0.75rem] text-ink-4`,children:[e.id,` · `,e.installed?.version??e.version]}),e.loaded?(0,R.jsx)(A,{tone:`live`,children:_(`pro.on`)}):null,e.included?null:(0,R.jsx)(A,{children:_(`pro.notInPlan`)}),e.installed&&e.heldBack&&e.included?(0,R.jsx)(A,{tone:`warn`,children:_(et[e.heldBack])}):null]}),e.description?(0,R.jsx)(`p`,{className:`mt-0.5 text-[0.875rem] text-ink-3`,children:e.description}):null]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[e.included&&(!e.installed||e.update)?(0,R.jsx)(M,{busy:s.isPending&&s.variables===e.id,disabled:u,onClick:()=>s.mutate(e.id),children:e.installed?_(`pro.update`):_(`pro.install`)}):null,e.installed?(0,R.jsx)(M,{variant:`secondary`,busy:c.isPending&&c.variables===e.id,disabled:u,onClick:()=>c.mutate(e.id),children:_(`pro.remove`)}):null]})]},e.id))}):(0,R.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:_(`pro.none`,{runtime:l.runtime})}),d?(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:d.message}):null]}):(0,R.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:_(`pro.notLinked`)}):(0,R.jsx)(w,{})}):null}function rt({connector:e}){let[t,n]=(0,L.useState)(!1);return(0,R.jsxs)(`div`,{className:`rounded-lg bg-paper ring-1 ring-border-soft`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex w-full items-center gap-3 px-3 py-2 text-left`,children:[(0,R.jsx)(`span`,{className:S(`size-2 shrink-0 rounded-full`,e.usable?`bg-moss`:`bg-ink-4`)}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[0.8125rem]`,children:[e.name,` `,(0,R.jsx)(`span`,{className:`font-mono text-[0.6875rem] text-ink-4`,children:e.id})]}),(0,R.jsx)(`span`,{className:`shrink-0 text-[0.75rem] text-ink-3`,children:e.usable?_(`connectors.actions`,{n:e.actions.length,r:e.actions.filter(e=>e.group===`read`).length}):_(`connectors.notSetUp`)})]}),t?(0,R.jsxs)(`div`,{className:`border-border-soft border-t px-3 py-2 text-[0.75rem]`,children:[e.missingSetup?(0,R.jsxs)(`p`,{className:`mb-1 text-ink-3`,children:[_(`connectors.setup`),` `,(0,R.jsx)(`span`,{className:`font-mono text-ink-2`,children:e.missingSetup})]}):null,(0,R.jsx)(`p`,{className:`text-ink-4`,children:e.actions.map(e=>e.group===`read`?e.id:`${e.id} (${_(`connectors.group.${e.group}`)})`).join(` · `)})]}):null]})}var it={none:`connectors.authNone`,oauth2:`connectors.authOauth`,api_key:`connectors.authKey`};function at({projectId:e,connector:t,readOnly:n}){let i=r(),[a,o]=(0,L.useState)(!1),s=()=>i.invalidateQueries({queryKey:[`connectors`,e]}),c=`/api/studio/projects/${e}/connectors/${t.id}`,u=f({mutationFn:()=>p.post(`${c}/refresh`),onSuccess:s}),d=f({mutationFn:()=>p.del(c),onSuccess:s}),m=t.actions.filter(e=>e.group===`read`).length;return(0,R.jsxs)(`div`,{className:`rounded-lg bg-paper ring-1 ring-border-soft`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3 p-3`,children:[(0,R.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-paper-2 text-ink-2`,children:(0,R.jsx)(l,{className:`size-4`})}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),className:`min-w-0 flex-1 text-left`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`truncate font-medium text-[0.875rem]`,children:t.name}),(0,R.jsx)(`span`,{className:`font-mono text-[0.6875rem] text-ink-4`,children:t.id})]}),(0,R.jsxs)(`div`,{className:`truncate text-[0.75rem] text-ink-3`,children:[t.domain,` · `,t.sourceKind===`mcp`?`MCP`:`OpenAPI`,` ·`,` `,_(it[t.auth]),` ·`,` `,t.toolsPending?_(`connectors.pending`):_(`connectors.actions`,{n:t.actions.length,r:m})]})]}),n?null:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(k,{label:_(`connectors.refresh`),onClick:()=>u.mutate(),children:u.isPending?(0,R.jsx)(w,{className:`size-4`}):(0,R.jsx)(he,{className:`size-4`})}),(0,R.jsx)(k,{label:_(`connectors.remove`),className:`hover:text-rose`,onClick:()=>confirm(`${t.name}: ${_(`connectors.remove`)}?`)&&d.mutate(),children:(0,R.jsx)(pe,{className:`size-4`})})]})]}),t.needsOAuthClient?(0,R.jsx)(`p`,{className:`border-border-soft border-t px-3 py-2 text-[0.75rem] text-rose`,children:_(`connectors.needsClient`)}):null,u.error??d.error?(0,R.jsx)(`p`,{className:`border-border-soft border-t px-3 py-2 text-[0.75rem] text-rose`,children:(u.error??d.error).message}):null,a&&t.actions.length?(0,R.jsx)(`ul`,{className:`max-h-64 overflow-y-auto border-border-soft border-t px-3 py-2`,children:t.actions.map(e=>(0,R.jsxs)(`li`,{className:`flex items-baseline gap-2 py-1 text-[0.75rem]`,children:[(0,R.jsx)(`span`,{className:S(`w-14 shrink-0 text-[0.6875rem] uppercase tracking-wide`,e.group===`read`?`text-moss`:e.group===`write`?`text-ink-3`:`text-rose`),children:_(`connectors.group.${e.group}`)}),(0,R.jsx)(`span`,{className:`shrink-0 font-mono text-ink-2`,children:e.id}),(0,R.jsx)(`span`,{className:`min-w-0 truncate text-ink-4`,children:e.summary})]},e.id))}):null]})}function ot({projectId:e,domain:t,source:n,taken:i,onDone:a}){let o=r(),[s,c]=(0,L.useState)({id:``,secret:``}),[l,u]=(0,L.useState)(!1),d=i.includes(n.suggestedId),m=f({mutationFn:()=>p.post(`/api/studio/projects/${e}/connectors`,{domain:t,sourceKind:n.sourceKind,sourceUrl:n.sourceUrl,id:n.suggestedId,toolPrefix:n.suggestedToolPrefix,...n.name?{name:n.name}:{},...s.id&&s.secret?{oauthClientId:s.id,oauthClientSecret:s.secret}:{}}),onSuccess:async t=>{await o.invalidateQueries({queryKey:[`connectors`,e]}),a(t.warnings)}});return(0,R.jsxs)(`div`,{className:`rounded-lg bg-card p-3 ring-1 ring-border-soft`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(A,{tone:n.sourceKind===`mcp`?`ember`:`neutral`,children:n.sourceKind===`mcp`?`MCP`:`OpenAPI`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`truncate text-[0.8125rem]`,children:n.name??n.suggestedId}),(0,R.jsx)(`div`,{className:`truncate font-mono text-[0.6875rem] text-ink-4`,children:n.sourceUrl})]}),n.blocked||d?null:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>u(e=>!e),className:`text-[0.75rem] text-ink-3 hover:text-ink`,children:_(`connectors.ownClient`)}),(0,R.jsx)(M,{size:`sm`,busy:m.isPending,onClick:()=>m.mutate(),children:_(`connectors.import`)})]})]}),n.blocked?(0,R.jsx)(`p`,{className:`mt-2 text-[0.75rem] text-ink-3`,children:n.blocked}):null,d?(0,R.jsx)(`p`,{className:`mt-2 text-[0.75rem] text-ink-3`,children:_(`connectors.exists`)}):null,l?(0,R.jsxs)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:[(0,R.jsx)(j,{placeholder:`OAuth Client-ID`,value:s.id,onChange:e=>c(t=>({...t,id:e.target.value}))}),(0,R.jsx)(j,{type:`password`,autoComplete:`off`,placeholder:`OAuth Client-Secret`,value:s.secret,onChange:e=>c(t=>({...t,secret:e.target.value}))})]}):null,m.error?(0,R.jsx)(`p`,{className:`mt-2 text-[0.75rem] text-rose`,children:m.error.message}):null]})}function st({projectId:e,readOnly:t}){let[n,r]=(0,L.useState)(``),[a,o]=(0,L.useState)(null),[s,l]=(0,L.useState)(null),[u,d]=(0,L.useState)([]),m=i({queryKey:[`connectors`,e],queryFn:()=>p.get(`/api/studio/projects/${e}/connectors`)}),h=f({mutationFn:()=>p.post(`/api/studio/connectors/search`,{query:n}),onSuccess:e=>{o(e),l(null),d([])}}),g=f({mutationFn:e=>p.get(`/api/studio/connectors/registry/${encodeURIComponent(e)}`),onSuccess:l}),v=m.data??[],y=v.filter(e=>e.sourceKind===`builtin`&&(be.unsetConnectors||e.usable)),x=v.filter(e=>e.sourceKind!==`builtin`);return(0,R.jsxs)(O,{className:`p-4 sm:p-6`,children:[(0,R.jsx)(`h2`,{className:`font-display font-semibold text-lg`,children:_(`connectors.title`)}),(0,R.jsx)(`p`,{className:`mt-1 mb-5 text-[0.875rem] text-ink-3`,children:_(`connectors.hint`)}),y.length?(0,R.jsx)(`div`,{className:`mb-5 grid gap-1.5 sm:grid-cols-2`,children:y.map(e=>(0,R.jsx)(rt,{connector:e},e.id))}):null,(0,R.jsx)(`h3`,{className:`mb-2 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.07em]`,children:_(`connectors.imported`)}),x.length?(0,R.jsx)(`div`,{className:`mb-4 flex flex-col gap-2`,children:x.map(n=>(0,R.jsx)(at,{projectId:e,connector:n,readOnly:t},n.id))}):null,t?x.length?null:(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:_(`connectors.noneImported`)}):(0,R.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),n.trim()&&h.mutate()},children:[(0,R.jsx)(j,{value:n,placeholder:_(`connectors.search`),onChange:e=>r(e.target.value)}),(0,R.jsxs)(M,{type:`submit`,variant:`secondary`,busy:h.isPending,children:[(0,R.jsx)(c,{className:`size-4`}),` `,_(`connectors.find`)]})]}),h.error?(0,R.jsx)(`p`,{className:`mt-3 text-[0.8125rem] text-rose`,children:h.error.message}):null,a&&!s?(0,R.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1`,children:[a.length?null:(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:_(`connectors.none`)}),a.map(e=>(0,R.jsxs)(`button`,{type:`button`,disabled:!e.kinds.length,onClick:()=>g.mutate(e.domain),className:`flex items-center gap-3 rounded-lg px-3 py-2 text-left transition hover:bg-paper-2 disabled:opacity-50`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`truncate text-[0.875rem]`,children:e.domain}),(0,R.jsx)(`div`,{className:`truncate text-[0.75rem] text-ink-3`,children:e.description})]}),(0,R.jsx)(`span`,{className:`text-[0.6875rem] text-ink-4 uppercase`,children:e.kinds.join(` · `)}),(0,R.jsx)(b,{className:`-rotate-90 size-4 text-ink-4`})]},e.domain)),g.isPending?(0,R.jsx)(w,{className:`mx-auto mt-2 size-4 text-ink-4`}):null,g.error?(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:g.error.message}):null]}):null,s?(0,R.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,R.jsx)(`div`,{className:`font-medium text-[0.875rem]`,children:s.domain}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>l(null),className:`text-[0.75rem] text-ink-3 hover:text-ink`,children:_(`run.back`)})]}),s.summary?(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:s.summary}):null,s.sources.map(t=>(0,R.jsx)(ot,{projectId:e,domain:s.domain,source:t,taken:v.map(e=>e.id),onDone:d},`${t.sourceKind}:${t.sourceUrl}`)),s.credentials.filter(e=>e.setup||e.url).map(e=>(0,R.jsxs)(`p`,{className:`text-[0.75rem] text-ink-3`,children:[(0,R.jsxs)(`span`,{className:`text-ink-2`,children:[e.label,`:`]}),` `,e.setup,` `,e.url?(0,R.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`text-ember underline`,children:e.url}):null]},e.label)),u.map(e=>(0,R.jsx)(`p`,{className:`text-[0.75rem] text-ink-3`,children:e},e))]}):null]})}var B=`engenty-wizards`,ct=`ENGENTY_WIZARDS_KEY`,lt=[{id:`claude-desktop`,name:`Claude Desktop`,widgets:!0},{id:`claude-code`,name:`Claude Code`,widgets:!1},{id:`codex`,name:`Codex · ChatGPT app`,widgets:!1},{id:`cursor`,name:`Cursor`,widgets:!0},{id:`vscode`,name:`VS Code (Copilot)`,widgets:!0},{id:`windsurf`,name:`Windsurf`,widgets:!1},{id:`gemini`,name:`Gemini CLI`,widgets:!1},{id:`goose`,name:`Goose`,widgets:!0},{id:`openclaw`,name:`OpenClaw`,widgets:!1},{id:`lm-studio`,name:`LM Studio`,widgets:!1},{id:`claude-ai`,name:`claude.ai`,widgets:!0,oauth:!0},{id:`chatgpt`,name:`ChatGPT`,widgets:!0,oauth:!0}];function V({text:e}){let[t,n]=(0,L.useState)(!1);return(0,R.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg bg-paper-2 p-3`,children:[(0,R.jsx)(`code`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-all font-mono text-[0.75rem] leading-relaxed`,children:e}),(0,R.jsx)(k,{label:_(t?`settings.copied`:`settings.copy`),onClick:async()=>{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},children:t?(0,R.jsx)(m,{className:`size-4`}):(0,R.jsx)(le,{className:`size-4`})})]})}function ut(e){try{let t=new URL(e);return t.protocol===`https:`&&!/(^|\.)localhost$/.test(t.hostname)&&!/^(127\.|10\.|192\.168\.|\[::1\])/.test(t.hostname)}catch{return!1}}function H({children:e}){return(0,R.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:e})}function U({title:e,children:t}){return(0,R.jsxs)(`section`,{className:`flex flex-col gap-2.5 border-border-soft border-t pt-5 first:border-t-0 first:pt-0`,children:[(0,R.jsx)(`h3`,{className:`font-medium text-[0.9375rem]`,children:e}),t]})}function dt(e,t){return JSON.stringify({[e]:{[B]:t}},null,2)}function ft({id:e,url:t,apiKey:n}){let r=n?`Authorization: Bearer ${n}`:null,i=n?{headers:{Authorization:`Bearer ${n}`}}:{};switch(e){case`claude-code`:{let e=t.replace(/\/api\/mcp$/,`/api/claude-plugin`);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(H,{children:_(`mcp.terminal`)}),(0,R.jsx)(V,{text:`claude mcp add --transport http --scope user ${B} ${t}${r?` --header "${r}"`:``}`}),!n&&ut(t)?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(H,{children:_(`mcp.ccPlugin`)}),(0,R.jsx)(V,{text:`claude plugin marketplace add ${e}/marketplace.json`}),(0,R.jsx)(V,{text:`claude plugin install ${B}@engenty`})]}):null]})}case`codex`:return n?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(H,{children:_(`mcp.codexKey`)}),(0,R.jsx)(V,{text:`echo 'export ${ct}=${n}' >> ~/.zshrc && source ~/.zshrc`}),(0,R.jsx)(V,{text:`codex mcp add ${B} --url ${t} --bearer-token-env-var ${ct}`})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(H,{children:_(`mcp.terminal`)}),(0,R.jsx)(V,{text:`codex mcp add ${B} --url ${t}`}),(0,R.jsx)(V,{text:`codex mcp login ${B}`})]});case`gemini`:return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(H,{children:_(`mcp.terminal`)}),(0,R.jsx)(V,{text:`gemini mcp add --scope user --transport http ${B} ${t}${r?` -H "${r}"`:``}`})]});case`cursor`:return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(H,{children:_(`integrate.file`,{file:`~/.cursor/mcp.json`})}),(0,R.jsx)(V,{text:dt(`mcpServers`,{url:t,...i})})]});case`vscode`:return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(H,{children:_(`integrate.vscode`)}),(0,R.jsx)(V,{text:dt(`servers`,{type:`http`,url:t,...i})})]});case`windsurf`:return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(H,{children:_(`integrate.file`,{file:`~/.codeium/windsurf/mcp_config.json`})}),(0,R.jsx)(V,{text:dt(`mcpServers`,{serverUrl:t,...i})})]});case`lm-studio`:return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(H,{children:_(`integrate.file`,{file:`~/.lmstudio/mcp.json`})}),(0,R.jsx)(V,{text:dt(`mcpServers`,{url:t,...i})})]});case`claude-desktop`:case`claude-ai`:return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(H,{children:_(`mcp.claudeAi`)}),(0,R.jsx)(V,{text:t})]});case`chatgpt`:return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(H,{children:_(`integrate.chatgpt`)}),(0,R.jsx)(V,{text:t})]});default:return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(H,{children:_(`integrate.generic`)}),(0,R.jsx)(V,{text:t}),r?(0,R.jsx)(V,{text:r}):null]})}}function pt(){let e=r(),t=i({queryKey:[`api-keys`],queryFn:()=>p.get(`/api/studio/api-keys`)}),n=f({mutationFn:e=>p.del(`/api/studio/api-keys/${e}`),onSuccess:()=>e.invalidateQueries({queryKey:[`api-keys`]})});return t.data?.length?(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h2`,{className:`font-display font-semibold text-lg`,children:_(`mcp.keys`)}),(0,R.jsx)(`p`,{className:`mt-1 mb-4 text-[0.875rem] text-ink-3`,children:_(`mcp.keysHint`)}),(0,R.jsx)(O,{className:`flex flex-col gap-2 p-3`,children:t.data.map(e=>(0,R.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg px-3 py-2`,children:[(0,R.jsx)(I,{className:`size-4 shrink-0 text-ink-4`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`truncate text-[0.875rem]`,children:e.name}),(0,R.jsxs)(`div`,{className:`font-mono text-[0.6875rem] text-ink-4`,children:[e.start,`… ·`,` `,e.lastRequest?_(`settings.lastUsed`,{when:new Date(e.lastRequest).toLocaleString()}):_(`settings.neverUsed`)]})]}),(0,R.jsx)(k,{label:_(`settings.revoke`),onClick:()=>n.mutate(e.id),className:`hover:text-rose`,children:(0,R.jsx)(pe,{className:`size-4`})})]},e.id))})]}):null}function mt({state:e,title:t,children:n}){return(0,R.jsxs)(`li`,{className:`grid grid-cols-[22px_minmax(0,1fr)] gap-x-3`,children:[(0,R.jsx)(`span`,{className:S(`mt-0.5 grid size-[22px] place-items-center rounded-full`,e===`done`&&`bg-moss text-white`,e===`now`&&`bg-amber-tint text-ink-2`,e===`later`&&`bg-paper-2 ring-1 ring-border-soft`),children:e===`done`?(0,R.jsx)(m,{className:`size-3.5`,strokeWidth:3}):e===`now`?(0,R.jsx)(w,{className:`size-3`}):null}),(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 pb-4`,children:[(0,R.jsx)(`span`,{className:S(`text-[0.875rem]`,e===`later`?`text-ink-3`:`font-medium`),children:t}),e===`now`?n:null]})]})}function ht({widgets:e}){return(0,R.jsxs)(`p`,{className:`mt-1 flex flex-wrap items-center gap-x-4 gap-y-1 text-[0.8125rem] text-ink-3`,children:[(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:_(`integrate.kindMcp`),children:[(0,R.jsx)(Ze,{className:`size-3.5 text-ember-strong`}),(0,R.jsx)(`span`,{className:`font-medium text-ink-2`,children:`MCP`}),` `,_(`integrate.kindMcpShort`)]}),(0,R.jsxs)(`span`,{className:S(`inline-flex items-center gap-1.5`,e?null:`opacity-60`),title:_(e?`integrate.kindApp`:`integrate.kindAppNo`),children:[(0,R.jsx)(d,{className:S(`size-3.5`,e?`text-ember-strong`:`text-ink-4`)}),(0,R.jsx)(`span`,{className:`font-medium text-ink-2`,children:`MCP App`}),` `,_(e?`integrate.kindAppShort`:`integrate.kindAppNoShort`)]})]})}function gt({at:e,done:t}){let n=[_(`setup.stage.connect`),_(`setup.stage.test`),_(`setup.stage.done`)];return(0,R.jsx)(`ol`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 font-medium text-[0.6875rem] uppercase tracking-[0.14em]`,children:n.map((n,r)=>{let i=t||r<e;return(0,R.jsxs)(`li`,{"aria-current":!i&&r===e?`step`:void 0,className:S(`flex items-center gap-1`,i?`text-moss`:r===e?`text-ember-strong`:`text-ink-4`),children:[i?(0,R.jsx)(m,{className:`size-3`,strokeWidth:3}):null,n]},n)})})}function _t({client:e,local:t,seen:n,managed:i,url:a}){let o=r(),s=ut(a),c=!i&&!!t&&!e.oauth,[l,d]=(0,L.useState)(c&&t?.installed!==!1?`here`:`address`),[h,g]=(0,L.useState)(null),[v,b]=(0,L.useState)(),x=f({mutationFn:t=>p.post(`/api/studio/local/apps/${e.id}`,{connect:t}),onSuccess:e=>g(e),onError:e=>g({ok:!1,message:e.message}),onSettled:()=>o.invalidateQueries({queryKey:[`local-apps`]})}),ee=f({mutationFn:()=>p.post(`/api/studio/api-keys`,{name:e.name.slice(0,32)}),onSuccess:async e=>{b(e.key),await o.invalidateQueries({queryKey:[`api-keys`]})}}),C=e.oauth===!0||e.id===`claude-desktop`,w=l===`address`&&C&&!(i&&s),T=l===`here`?!!t?.connected:i||!!v,E=!!n?.toolAt,D=E?2:T||n?1:0,te=e=>(0,R.jsx)(V,{text:e});return(0,R.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`h2`,{className:`font-display font-semibold text-[1.375rem] leading-tight tracking-tight`,children:e.name}),(0,R.jsx)(ht,{widgets:e.widgets})]}),(0,R.jsx)(gt,{at:D,done:E})]}),(0,R.jsxs)(O,{className:`flex flex-col gap-6 p-3.5 sm:p-5 sm:p-6`,children:[c||!e.oauth?(0,R.jsx)(`fieldset`,{"aria-label":_(`integrate.where`),className:`min-w-0`,children:(0,R.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[`here`,`address`].map(e=>{let t=e===`here`&&!c;return(0,R.jsxs)(`button`,{type:`button`,disabled:t,onClick:()=>d(e),"aria-pressed":l===e,className:S(`flex items-start gap-3 rounded-xl px-3.5 py-2.5 text-left ring-1 transition`,l===e?`bg-ember-tint/50 ring-ember-strong/40`:`ring-border-soft hover:bg-accent`,t&&`cursor-not-allowed opacity-50 hover:bg-transparent`),children:[e===`here`?(0,R.jsx)(ke,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}):(0,R.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),(0,R.jsxs)(`span`,{className:`min-w-0`,children:[(0,R.jsx)(`span`,{className:`block font-medium text-[0.875rem]`,children:_(e===`here`?`integrate.here`:`integrate.address`)}),(0,R.jsx)(`span`,{className:`block text-[0.75rem] text-ink-3`,children:_(e===`here`?i?`integrate.hereManaged`:`integrate.hereHint`:`integrate.addressHint`)})]})]},e)})})}):null,w?(0,R.jsx)(U,{title:_(`mcp.notHere`),children:(0,R.jsx)(H,{children:_(i?`mcp.needsPublic`:`integrate.oauthLocal`)})}):l===`here`?(0,R.jsxs)(U,{title:_(`integrate.connectTitle`),children:[t?.installed===!1&&!t.connected?(0,R.jsx)(H,{children:_(`integrate.notInstalled`,{app:e.name})}):null,t?.connected?(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,R.jsxs)(`span`,{className:`flex items-center gap-2 text-[0.875rem] text-ink-2`,children:[(0,R.jsx)(m,{className:`size-4 text-moss`}),_(`integrate.connected`,{app:e.name})]}),(0,R.jsx)(M,{size:`sm`,variant:`ghost`,busy:x.isPending&&x.variables===!1,onClick:()=>x.mutate(!1),children:_(`mcp.appsDisconnect`)})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(H,{children:_(`integrate.connectHint`,{app:e.name})}),(0,R.jsx)(`div`,{children:(0,R.jsxs)(M,{busy:x.isPending,onClick:()=>x.mutate(!0),children:[(0,R.jsx)(y,{className:`size-4`}),` `,_(`integrate.connect`,{app:e.name})]})})]}),h&&!h.ok?(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:h.message}):null,h?.snippet?(0,R.jsx)(V,{text:h.snippet}):null,t?.where?(0,R.jsx)(`p`,{className:`font-mono text-[0.6875rem] text-ink-4`,children:t.where}):null]}):(0,R.jsxs)(R.Fragment,{children:[i||C?null:(0,R.jsx)(U,{title:_(`mcp.keyTitle`),children:v?(0,R.jsxs)(`p`,{className:`flex items-center gap-2 text-[0.875rem] text-ink-2`,children:[(0,R.jsx)(m,{className:`size-4 text-moss`}),` `,_(`mcp.keyReady`)]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(H,{children:_(`mcp.keyHint`)}),(0,R.jsx)(`div`,{children:(0,R.jsxs)(M,{variant:`secondary`,busy:ee.isPending,onClick:()=>ee.mutate(),children:[(0,R.jsx)(y,{className:`size-4`}),` `,_(`mcp.keyCreate`,{client:e.name})]})})]})}),(0,R.jsxs)(U,{title:_(`mcp.add`),children:[i||v||C?(0,R.jsx)(ft,{id:e.id,url:a,apiKey:v}):(0,R.jsx)(H,{children:_(`mcp.keyFirst`)}),i?(0,R.jsx)(H,{children:_(`mcp.oauth`)}):null,(0,R.jsx)(`p`,{className:`text-[0.75rem] text-ink-4`,children:_(s?`mcp.addressPublic`:`mcp.addressLocal`)})]})]}),w?null:(0,R.jsxs)(U,{title:_(`integrate.test`),children:[(0,R.jsxs)(`ol`,{className:`flex flex-col`,children:[(0,R.jsx)(mt,{state:n?`done`:T?`now`:`later`,title:_(`integrate.seen`,{app:e.name}),children:(0,R.jsx)(H,{children:_(l===`here`?`integrate.restart`:`integrate.reload`,{app:e.name})})}),(0,R.jsxs)(mt,{state:n?.toolAt?`done`:n?`now`:`later`,title:_(`integrate.tool`),children:[(0,R.jsx)(H,{children:_(`integrate.askHint`,{app:e.name})}),te(_(`integrate.askTool`))]}),e.widgets?(0,R.jsxs)(mt,{state:n?.widgetAt?`done`:n?.toolAt?`now`:`later`,title:_(`integrate.widget`),children:[(0,R.jsx)(H,{children:_(`integrate.widgetHint`)}),te(_(`integrate.askWidget`))]}):null]}),E?(0,R.jsxs)(`p`,{className:`flex items-center gap-2 font-medium text-[0.875rem] text-moss`,children:[(0,R.jsx)(m,{className:`size-4`,strokeWidth:3}),_(`integrate.works`,{app:e.name})]}):null]})]})]})}function vt(){let e=ge(),t=e.data?.mode===`managed`,n=i({queryKey:[`local-apps`],queryFn:()=>p.get(`/api/studio/local/apps`),enabled:e.data?.mode===`local`}),r=i({queryKey:[`integrations-seen`],queryFn:()=>p.get(`/api/studio/integrations/seen`),refetchInterval:2500}),[a,o]=T(),{narrow:s}=je(),c=a.get(`show`),l=e=>n.data?.find(t=>t.id===e),f=e=>r.data?.[e],m=e=>{let t=l(e);return t?.installed||t?.connected?0:1},h=[...lt].sort((e,t)=>m(e.id)-m(t.id)),g=h.find(e=>e.id===c)??h[0];if(Ne(c||!s?g.name:null),!e.data||!t&&!n.data)return null;let v=e.data.mcpUrl??``,y=e=>{let t=l(e);return f(e)?.toolAt?{tone:`done`,toneLabel:_(`integrate.stateWorks`)}:t?.connected?{tone:`on`,toneLabel:_(`integrate.stateConnected`)}:t?.installed?{tone:`off`,toneLabel:_(`integrate.stateInstalled`)}:{}},b=e=>!(!c&&s)&&e===g.id;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-10`,children:[(0,R.jsxs)(Le,{children:[(0,R.jsx)(F,{label:_(`integrate.groupApps`),children:h.map(e=>(0,R.jsx)(P,{icon:e.widgets?d:Ze,label:e.name,...y(e.id),selected:b(e.id),onPick:()=>o({show:e.id},{replace:!s})},e.id))}),(0,R.jsxs)(F,{label:_(`integrate.groupShare`),children:[(0,R.jsx)(P,{icon:fe,label:_(`integrate.shareLink`),badge:(0,R.jsx)(`span`,{className:`text-[0.6875rem] text-ink-4`,children:_(`integrate.soon`)}),selected:!1,disabled:!0}),(0,R.jsx)(P,{icon:u,label:_(`integrate.shareSite`),badge:(0,R.jsx)(`span`,{className:`text-[0.6875rem] text-ink-4`,children:_(`integrate.soon`)}),selected:!1,disabled:!0})]})]}),(0,R.jsx)(_t,{client:g,local:l(g.id),seen:f(g.id),managed:t,url:v},g.id),t?null:(0,R.jsx)(pt,{}),(0,R.jsxs)(`p`,{className:`flex items-start gap-2 text-[0.8125rem] text-ink-3`,children:[(0,R.jsx)(fe,{className:`mt-0.5 size-3.5 shrink-0`}),_(`mcp.notReverse`)]})]})}var yt=[`text`,`image`,`video`,`speech`,`listening`],bt={text:[`classifier`,`standard`,`high`,`highest`],image:[`image`],video:[`video`],speech:[`speech`],listening:[`audio`]},xt=`credits`,St=`${xt}:`;function Ct(e){return e===`credits`||!!e?.startsWith(St)}function wt(e){return e?.startsWith(St)&&e.slice(St.length)||null}function Tt(e){return e?`${St}${e}`:xt}function Et(e){return e===`transcription`?`listening`:e}var Dt=[`openai`,`anthropic`,`google`,`fal`,`elevenlabs`,`replicate`,`gateway`],W=(e,t)=>({de:e,en:t}),G=[{id:`openai`,name:`OpenAI`,about:W(`GPT-Modelle, GPT Image und Stimmen.`,`GPT models, GPT Image and voices.`),keyUrl:`https://platform.openai.com/api-keys`,keyPlaceholder:`sk-…`,text:{classifier:`openai:gpt-5.4-mini`,standard:`openai:gpt-5.4-mini`,high:`openai:gpt-5.5`,highest:`openai:gpt-5.5`},models:{text:[{ref:`openai:gpt-5.4-mini`,label:`GPT-5.4 mini`,note:W(`schnell`,`fast`)},{ref:`openai:gpt-5.5`,label:`GPT-5.5`,note:W(`gründlich`,`thorough`)}],image:[{ref:`openai:gpt-image-2`,label:`GPT Image 2`,note:W(`vielseitig`,`versatile`)},{ref:`openai:gpt-image-1-mini`,label:`GPT Image 1 mini`,note:W(`günstig`,`low cost`)}],speech:[{ref:`openai:gpt-4o-mini-tts`,label:`GPT-4o mini TTS`,note:W(`günstig`,`low cost`)}],listening:[{ref:`openai:gpt-4o-mini-transcribe`,label:`GPT-4o mini Transcribe`,note:W(`schnell, günstig`,`fast, low cost`)},{ref:`openai:whisper-1`,label:`Whisper`}]}},{id:`anthropic`,name:`Anthropic`,about:W(`Die Claude-Modelle.`,`The Claude models.`),keyUrl:`https://console.anthropic.com/settings/keys`,keyPlaceholder:`sk-ant-…`,text:{classifier:`anthropic:claude-haiku-4-5`,standard:`anthropic:claude-haiku-4-5`,high:`anthropic:claude-sonnet-5-5`,highest:`anthropic:claude-opus-5-5`},models:{text:[{ref:`anthropic:claude-haiku-4-5`,label:`Claude Haiku 4.5`,note:W(`schnell`,`fast`)},{ref:`anthropic:claude-sonnet-5-5`,label:`Claude Sonnet 5.5`},{ref:`anthropic:claude-opus-5-5`,label:`Claude Opus 5.5`,note:W(`am stärksten`,`strongest`)}]}},{id:`google`,name:`Google Gemini`,about:W(`Gemini, Veo für Videos und Stimmen – ein Key aus dem AI Studio.`,`Gemini, Veo for video and voices – one key from AI Studio.`),keyUrl:`https://aistudio.google.com/apikey`,keyPlaceholder:`AIza…`,text:{classifier:`google:gemini-flash-lite-latest`,standard:`google:gemini-flash-latest`,high:`google:gemini-pro-latest`,highest:`google:gemini-pro-latest`},models:{text:[{ref:`google:gemini-flash-lite-latest`,label:`Gemini Flash-Lite`,note:W(`günstig`,`low cost`)},{ref:`google:gemini-flash-latest`,label:`Gemini Flash`},{ref:`google:gemini-pro-latest`,label:`Gemini Pro`,note:W(`gründlich`,`thorough`)}],image:[{ref:`google:gemini-3.1-flash-image-preview`,label:`Gemini 3.1 Flash Image`,note:W(`schnell, bearbeitet Fotos`,`fast, edits photos`)},{ref:`google:gemini-3-pro-image-preview`,label:`Gemini 3 Pro Image`,note:W(`beste Qualität`,`best quality`)}],video:[{ref:`google:veo-3.1-fast-generate-preview`,label:`Veo 3.1 Fast`,note:W(`mit Ton`,`with sound`)},{ref:`google:veo-3.1-generate-preview`,label:`Veo 3.1`,note:W(`beste Qualität`,`best quality`)}],speech:[{ref:`google:gemini-3.8-flash-tts`,label:`Gemini Flash TTS`}],listening:[{ref:`google:gemini-flash-lite-latest`,label:`Gemini Flash-Lite`}]}},{id:`fal`,name:`fal.ai`,about:W(`Hunderte Bild-, Video- und Audio-Modelle mit einem Key: FLUX, Recraft, Veo, Luma, MiniMax.`,`Hundreds of image, video and audio models with one key: FLUX, Recraft, Veo, Luma, MiniMax.`),keyUrl:`https://fal.ai/dashboard/keys`,keyPlaceholder:`xxxxxxxx-…:…`,models:{image:[{ref:`fal:fal-ai/flux/schnell`,label:`FLUX.1 schnell`,note:W(`schnell, günstig`,`fast, low cost`)},{ref:`fal:fal-ai/flux-pro/v1.1`,label:`FLUX 1.1 pro`,note:W(`hohe Qualität`,`high quality`)},{ref:`fal:fal-ai/recraft/v3/text-to-image`,label:`Recraft V3`,note:W(`Grafiken, Logos, Text im Bild`,`graphics, logos, text in images`)},{ref:`fal:fal-ai/imagen4/preview`,label:`Imagen 4`,note:W(`fotorealistisch`,`photorealistic`)}],video:[{ref:`fal:veo3/fast`,label:`Veo 3 Fast`,note:W(`mit Ton`,`with sound`)},{ref:`fal:luma-ray-2-flash`,label:`Luma Ray 2 Flash`,note:W(`schnell`,`fast`)},{ref:`fal:minimax-video`,label:`MiniMax Hailuo`}],speech:[{ref:`fal:fal-ai/minimax/speech-02-turbo`,label:`MiniMax Speech-02 Turbo`,note:W(`schnell`,`fast`)},{ref:`fal:fal-ai/minimax/speech-02-hd`,label:`MiniMax Speech-02 HD`}],listening:[{ref:`fal:wizper`,label:`Wizper`,note:W(`schnell`,`fast`)},{ref:`fal:whisper`,label:`Whisper`}]}},{id:`elevenlabs`,name:`ElevenLabs`,about:W(`Natürliche Stimmen in vielen Sprachen und genaue Transkripte.`,`Natural voices in many languages and accurate transcripts.`),keyUrl:`https://elevenlabs.io/app/settings/api-keys`,keyPlaceholder:`sk_…`,models:{speech:[{ref:`elevenlabs:eleven_multilingual_v2`,label:`Multilingual v2`,note:W(`natürlich, viele Sprachen`,`natural, many languages`)},{ref:`elevenlabs:eleven_flash_v2_5`,label:`Flash v2.5`,note:W(`schnell, günstig`,`fast, low cost`)},{ref:`elevenlabs:eleven_v3`,label:`Eleven v3`,note:W(`ausdrucksstark`,`expressive`)}],listening:[{ref:`elevenlabs:scribe_v2`,label:`Scribe v2`,note:W(`sehr genau`,`very accurate`)}]}},{id:`replicate`,name:`Replicate`,about:W(`Offene Bild- und Video-Modelle, abgerechnet pro Lauf.`,`Open image and video models, billed per run.`),keyUrl:`https://replicate.com/account/api-tokens`,keyPlaceholder:`r8_…`,models:{image:[{ref:`replicate:black-forest-labs/flux-schnell`,label:`FLUX.1 schnell`,note:W(`schnell, günstig`,`fast, low cost`)},{ref:`replicate:black-forest-labs/flux-1.1-pro`,label:`FLUX 1.1 pro`},{ref:`replicate:recraft-ai/recraft-v3`,label:`Recraft V3`}],video:[{ref:`replicate:minimax/video-01`,label:`MiniMax Video-01`}]}},{id:`gateway`,name:`Vercel AI Gateway`,about:W(`Ein Key für die Modelle vieler Anbieter, abgerechnet bei Vercel.`,`One key for many providers' models, billed by Vercel.`),keyUrl:`https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fapi-keys`,keyPlaceholder:`vck_…`,text:{classifier:`anthropic/claude-haiku-4.5`,standard:`anthropic/claude-haiku-4.5`,high:`anthropic/claude-sonnet-5.5`,highest:`anthropic/claude-sonnet-5.5`},models:{text:[{ref:`anthropic/claude-haiku-4.5`,label:`Claude Haiku 4.5`,note:W(`schnell`,`fast`)},{ref:`anthropic/claude-sonnet-5.5`,label:`Claude Sonnet 5.5`},{ref:`openai/gpt-5.5`,label:`GPT-5.5`},{ref:`google/gemini-3.5-flash`,label:`Gemini 3.5 Flash`}],image:[{ref:`google/gemini-3.1-flash-image`,label:`Gemini 3.1 Flash Image`}],video:[{ref:`google/veo-3.1-fast-generate-001`,label:`Veo 3.1 Fast`,note:W(`mit Ton`,`with sound`)}],speech:[{ref:`google/gemini-3.8-flash-tts`,label:`Gemini Flash TTS`}],listening:[{ref:`google/gemini-3.5-flash-lite`,label:`Gemini 3.5 Flash-Lite`}]}}];function K(e){return G.find(t=>t.id===e)??null}function Ot(e){if(Ct(e))return null;let t=/^([a-z]+):/.exec(e)?.[1];return t?Dt.includes(t)?t:null:e?.includes(`/`)?`gateway`:null}function q(e){for(let t of G)for(let n of Object.values(t.models)){let t=n?.find(t=>t.ref===e);if(t)return t.label}return e.replace(/^[a-z]+:/,``)}function kt(e,t){let n=t===`auto`?e.mode===`managed`:t===`cloud`,r=t===`auto`||t===`linked`?e.account??(t===`linked`?{name:e.user.name,email:e.user.email,credits:1250,expiring:[],url:``,cloudUrl:``,signedIn:!0}:null):null;return{cloud:n,account:n?null:r,credits:n||!!r?.signedIn,balance:n?e.credits??(t===`cloud`?1250:null):r?.credits??null,topUp:Ce(e),harnesses:n?[]:e.harnesses,canEdit:!n||e.tenant.role!==`member`,ownKeys:!n||e.features.ownKeys!==!1}}var J={text:ue,image:o,video:a,speech:de,listening:We},Y={text:`standard`,image:`image`,video:`video`,speech:`speech`,listening:`audio`},X=e=>e===`text`,At=(e,t)=>e?.[t]??``;function jt(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Mt(e,t,n){let r=Y[t];if(X(t)&&!n.cloud){if(e.source===`account`)return{kind:`credits`};if(e.source!==`own`)return{kind:`client`,id:e.source}}let i=e.bindings[r];if(Ct(i))return{kind:`credits`};if(i?.startsWith(`ollama:`))return{kind:`local`};let a=i?Ot(i):null;if(a)return{kind:`key`,provider:a};if(i&&/^(claude|codex|gemini|cursor)\//.test(i))return{kind:`client`,id:i.split(`/`)[0]};let o=e.ways[r];switch(o.kind){case`client`:return{kind:`client`,id:o.by};case`key`:return K(o.by??``)?{kind:`key`,provider:o.by}:null;case`local`:return{kind:`local`};case`credits`:return{kind:`credits`};default:return null}}function Nt(e,t,n){if(X(t)&&e.text)return e.text;let r=Y[t],i=n.bindings[r],a=i&&Ot(i)===e.id?i:e.models[t]?.[0]?.ref;return a?{[r]:a}:{}}function Pt(e){return e.version===null?{note:_(`models.noteMissing`),noteTone:`warn`}:e.auth===`none`?{note:_(`models.noteSignedOut`),noteTone:`warn`}:e.auth===`api_key`?{note:_(`models.noteShellKey`)}:{note:_(`models.noteIncluded`),noteTone:`done`}}function Ft(e,t){switch(e.kind){case`client`:return{text:t.harnesses.find(t=>t.id===e.by)?.name??e.by??``,tone:`done`};case`key`:return{text:K(e.by??``)?.name??e.by??``,tone:`done`};case`local`:return{text:_(`models.way.local`),tone:`done`};case`credits`:return{text:t.cloud?_(`models.way.creditsTeam`):_(`models.way.credits`),tone:`ok`};default:return{text:_(`models.way.none`),tone:`warn`}}}function It(){return i({queryKey:[`models`],queryFn:()=>p.get(`/api/studio/models`)})}function Z(){let e=r();return f({mutationFn:e=>p.put(`/api/studio/models`,e),onSuccess:async t=>{e.setQueryData([`models`],t),await e.invalidateQueries({queryKey:[`me`]})}})}function Q({title:e,aside:t,children:n}){return(0,R.jsxs)(`section`,{className:`flex flex-col gap-3 border-border-soft border-t pt-5 first:border-t-0 first:pt-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,R.jsx)(`h3`,{className:`font-medium text-[0.875rem]`,children:e}),t]}),n]})}function $({children:e}){return(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:e})}function Lt({text:e,tone:t}){return(0,R.jsxs)(`span`,{className:S(`inline-flex h-7 shrink-0 items-center gap-1.5 rounded-full px-3 font-medium text-[0.75rem]`,t===`done`&&`bg-moss-tint text-moss`,t===`ok`&&`bg-amber-tint text-ink-2`,t===`warn`&&`bg-paper-2 text-ink-3`),children:[t===`done`?(0,R.jsx)(m,{className:`size-3.5`,strokeWidth:3}):null,t===`ok`?(0,R.jsx)(s,{className:`size-3.5`}):null,t===`warn`?(0,R.jsx)(ce,{className:`size-3.5`}):null,e]})}function Rt({icon:e,title:t,lead:n,status:r}){return(0,R.jsxs)(`div`,{className:`flex items-start gap-3 sm:gap-4`,children:[(0,R.jsx)(`span`,{className:`grid size-10 shrink-0 place-items-center rounded-xl bg-ember-tint text-ember-strong`,children:(0,R.jsx)(e,{className:`size-5`})}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,R.jsx)(`h2`,{className:`font-display font-semibold text-[1.375rem] leading-tight tracking-tight`,children:t}),r]}),(0,R.jsx)(`p`,{className:`mt-0.5 text-[0.875rem] text-ink-3`,children:n})]})]})}function zt({label:e,children:t}){return(0,R.jsxs)(`div`,{className:`grid items-start gap-x-4 gap-y-1.5 sm:grid-cols-[7.5rem_minmax(0,1fr)]`,children:[(0,R.jsx)(`span`,{className:`pt-2 text-[0.75rem] text-ink-3`,children:e}),(0,R.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t})]})}function Bt({selected:e,title:t,note:n,noteTone:r,disabled:i,onPick:a}){return(0,R.jsxs)(`button`,{type:`button`,onClick:a,disabled:i,"aria-pressed":e,title:n,className:S(`inline-flex h-9 items-center gap-1.5 rounded-full border px-3.5 text-[0.8125rem] transition coarse:h-11`,e?`border-ember bg-ember-tint font-medium text-ink`:r===`done`?`border-input bg-card text-ink hover:border-ink-4`:`border-border-soft border-dashed text-ink-3 hover:border-ink-4 hover:text-ink`,i&&`cursor-not-allowed opacity-50`),children:[r===`done`?(0,R.jsx)(m,{className:`size-3.5 text-moss`,strokeWidth:3}):null,t,(0,R.jsxs)(`span`,{className:`sr-only`,children:[`: `,n]})]})}function Vt({provider:e,stored:t,place:n}){let r=Z(),[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(null),u=f({mutationFn:t=>p.post(`/api/studio/models/keys/${e.id}/check`,t?{key:t}:{})}),d=async()=>{l(null);let t=await u.mutateAsync(i.trim());if(!t.ok){l({ok:!1,message:t.message??_(`models.keyBad`)});return}await r.mutateAsync({keys:{[e.id]:i.trim()}}),a(``),s(!1),l({ok:!0,message:_(`models.keyOk`)})},h=!t||o;return n.ownKeys?(0,R.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[h?(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(j,{type:`password`,autoComplete:`off`,className:`min-w-0 flex-1 font-mono text-[0.8125rem]`,placeholder:e.keyPlaceholder,value:i,disabled:!n.canEdit,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&i.trim()&&d()}}),(0,R.jsx)(M,{busy:u.isPending||r.isPending,disabled:!i.trim()||!n.canEdit,onClick:()=>void d(),children:_(`models.keySave`)}),o?(0,R.jsx)(M,{variant:`ghost`,onClick:()=>s(!1),children:_(`common.cancel`)}):null]}):(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,R.jsxs)(`span`,{className:`flex items-center gap-2 text-[0.875rem] text-ink-2`,children:[(0,R.jsx)(I,{className:`size-4 text-moss`}),` `,_(`models.keyStored`)]}),(0,R.jsx)(M,{size:`sm`,variant:`ghost`,busy:u.isPending,onClick:async()=>{let e=await u.mutateAsync(void 0);l(e.ok?{ok:!0,message:_(`models.keyOk`)}:{ok:!1,message:e.message??_(`models.keyBad`)})},children:_(`models.keyCheck`)}),n.canEdit?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(M,{size:`sm`,variant:`ghost`,onClick:()=>s(!0),children:_(`models.keyReplace`)}),(0,R.jsx)(M,{size:`sm`,variant:`danger`,busy:r.isPending,onClick:()=>{l(null),r.mutate({keys:{[e.id]:``}})},children:_(`models.keyRemove`)})]}):null]}),c?(0,R.jsxs)(`p`,{className:S(`flex items-center gap-1.5 text-[0.8125rem]`,c.ok?`text-moss`:`text-rose`),children:[c.ok?(0,R.jsx)(m,{className:`size-3.5`,strokeWidth:3}):null,c.message]}):null,(0,R.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-[0.75rem] text-ink-4`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>xe(e.keyUrl),className:`inline-flex items-center gap-1 font-medium text-ember-strong hover:underline`,children:[_(`models.keyGet`,{name:e.name}),` `,(0,R.jsx)(N,{className:`size-3`})]}),(0,R.jsx)(`span`,{children:n.cloud?_(`models.keyWhereCloud`):_(`models.keyWhereLocal`)})]})]}):(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:_(`models.ownKeysPlan`)})}var Ht=`__custom__`;function Ut({provider:e,cap:t,value:n,onPick:r,disabled:i}){let a=g,o=e.models[t]??[],s=o.some(e=>e.ref===n),[c,l]=(0,L.useState)(!s&&!!n),[u,d]=(0,L.useState)(s?``:n.replace(/^[a-z]+:/,``)),f=e.id===`gateway`?``:`${e.id}:`;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(C,{value:c?Ht:n,onChange:e=>{if(e===Ht){l(!0);return}l(!1),r(e)},options:[...o.map(e=>({value:e.ref,label:e.note?`${e.label} – ${At(e.note,a)}`:e.label})),{value:Ht,label:_(`models.modelCustom`)}]}),c?(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(j,{className:`min-w-0 flex-1 font-mono text-[0.8125rem]`,value:u,disabled:i,placeholder:o[0]?.ref.replace(/^[a-z]+:/,``)??``,onChange:e=>d(e.target.value)}),(0,R.jsx)(M,{variant:`secondary`,disabled:!u.trim()||i,onClick:()=>r(`${f}${u.trim()}`),children:_(`settings.save`)})]}):null]})}function Wt({provider:e,state:t}){let n=n=>q(t.bindings[n]??e.text?.[n]??``);return(0,R.jsxs)(`dl`,{className:`grid grid-cols-[auto_minmax(0,1fr)] gap-x-4 gap-y-1 text-[0.875rem]`,children:[(0,R.jsx)(`dt`,{className:`text-ink-3`,children:_(`models.textSimple`)}),(0,R.jsx)(`dd`,{className:`truncate font-medium`,children:n(`standard`)}),(0,R.jsx)(`dt`,{className:`text-ink-3`,children:_(`models.textDemanding`)}),(0,R.jsx)(`dd`,{className:`truncate font-medium`,children:n(`high`)})]})}function Gt({provider:e,state:t,onPick:n,disabled:r}){return(0,R.jsxs)(`details`,{className:`group rounded-lg ring-1 ring-border-soft`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer list-none px-3 py-2.5 text-[0.8125rem] text-ink-2 hover:text-ink`,children:(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,R.jsx)(re,{className:`size-3.5 transition group-open:rotate-90`}),_(`models.perClass`)]})}),(0,R.jsx)(`div`,{className:`flex flex-col gap-3 px-3 pt-1 pb-3`,children:me.map(i=>(0,R.jsxs)(`div`,{className:`grid items-center gap-2 sm:grid-cols-[9rem_minmax(0,1fr)]`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-[0.8125rem] text-ink-2`,children:_(`class.${i}`)}),(0,R.jsx)(`div`,{className:`text-[0.6875rem] text-ink-4 leading-snug`,children:_(`class.${i}.hint`)})]}),(0,R.jsx)(Ut,{provider:e,cap:`text`,value:t.bindings[i]??e.text?.[i]??``,disabled:r,onPick:e=>n(i,e)})]},i))})]})}function Kt({cap:e,disabled:t}){let n=Y[e],r=f({mutationFn:()=>p.post(`/api/studio/models/test`,{cls:n,lang:g})}),i=r.data;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,R.jsx)(M,{variant:`secondary`,busy:r.isPending,disabled:t,onClick:()=>r.mutate(),children:_(`models.try.${e}`)}),(0,R.jsx)(`span`,{className:`text-[0.75rem] text-ink-4`,children:e===`video`?_(`models.tryCostVideo`):X(e)?null:_(`models.tryCost`)})]}),r.isPending&&e!==`text`?(0,R.jsxs)(`p`,{className:`flex items-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,R.jsx)(w,{className:`size-3.5`}),` `,_(e===`video`?`models.tryWaitVideo`:`models.tryWait`)]}):null,i?.ok?(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i.media&&e===`image`?(0,R.jsx)(`img`,{src:i.media,alt:``,className:`size-48 rounded-lg object-cover ring-1 ring-border-soft`}):null,i.media&&e===`speech`?(0,R.jsx)(`audio`,{src:i.media,controls:!0,autoPlay:!0,className:`w-full max-w-sm`}):null,i.media&&e===`video`?(0,R.jsx)(`video`,{src:i.media,controls:!0,autoPlay:!0,muted:!0,className:`w-full max-w-md rounded-lg`}):null,(0,R.jsxs)(`p`,{className:`flex items-start gap-2 text-[0.8125rem] text-ink-2`,children:[(0,R.jsx)(m,{className:`mt-0.5 size-3.5 shrink-0 text-moss`,strokeWidth:3}),(0,R.jsx)(`span`,{children:e===`listening`?i.reply?_(`models.tryHeard`,{text:i.reply}):_(`models.tryHeardNothing`):X(e)?_(`local.testOk`,{s:(i.ms/1e3).toFixed(1),ref:q(i.ref??``),reply:i.reply??``}):_(`models.tryOk`,{s:(i.ms/1e3).toFixed(1),model:q(i.ref??``)})})]})]}):null,i&&!i.ok?(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:_(`models.tryFailed`,{error:i.error??``})}):null,r.isError?(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:_(`models.tryFailed`,{error:r.error.message})}):null]})}function qt(e){let t=e=>(e<10?Math.round(e*10)/10:Math.ceil(e)).toLocaleString();return e?.creditsPerImage?_(`models.notePerImage`,{n:t(e.creditsPerImage)}):e?.creditsPerSecond?_(`models.notePerSecond`,{n:t(e.creditsPerSecond)}):e?.creditsPer1kCharacters?_(`models.notePer1k`,{n:t(e.creditsPer1kCharacters)}):e?.creditsPerMinute?_(`models.notePerMinute`,{n:t(e.creditsPerMinute)}):_(`models.noteUsage`)}function Jt(e,t){let n=wt(t.bindings[Y[e]]);return qt((n?t.creditModels.find(e=>e.id===n):null)??t.prices?.[Y[e]])}function Yt(e,t,n){return e.creditModels.filter(e=>Et(e.kind)===t&&(!n||e.source===n||e.provider===n))}function Xt({cap:e,state:t,disabled:n}){let r=Z(),i=Y[e],a=wt(t.bindings[i]),o=Yt(t,e),s=t.prices?.[i]?.model,c=e=>e.source===`ai-gateway`?K(e.provider)?.name??e.provider:K(e.source)?.name??e.source;return(0,R.jsx)(C,{value:a??``,onChange:e=>r.mutate({bindings:{[i]:Tt(e||null)}}),options:[{value:``,label:s?_(`models.creditsAuto`,{model:q(s)}):_(`models.creditsAutoNone`)},...o.map(e=>({value:e.id,label:`${e.name} · ${c(e)} – ${qt(e)}`,disabled:n}))]})}function Zt({models:e,state:t,place:n}){let r=Z();return(0,R.jsx)(`ul`,{className:`flex flex-col divide-y divide-border-soft`,children:e.map(e=>{let i=Et(e.kind),a=Y[i],o=t.bindings[a]===Tt(e.id);return(0,R.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 py-2.5`,children:[(0,R.jsx)(s,{className:`size-4 shrink-0 text-ink-3`}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block font-medium text-[0.875rem]`,children:e.name}),(0,R.jsxs)(`span`,{className:`block text-[0.75rem] text-ink-3`,children:[_(`models.cap.${i}`),` · `,qt(e)]})]}),o?(0,R.jsxs)(`span`,{className:`flex items-center gap-1 font-medium text-[0.75rem] text-moss`,children:[(0,R.jsx)(m,{className:`size-3.5`,strokeWidth:3}),` `,_(`models.inUse`)]}):(0,R.jsx)(M,{size:`sm`,variant:`secondary`,disabled:!n.canEdit||!n.credits,busy:r.isPending&&r.variables?.bindings?.[a]===Tt(e.id),onClick:()=>r.mutate({bindings:{[a]:Tt(e.id)}}),children:_(`models.useFor`)})]},e.id)})})}function Qt({cap:e,state:t,place:n,me:r,onOpen:i}){let a=Z(),o=Y[e],c=t.ways[o],l=Mt(t,e,n),[u,d]=(0,L.useState)(!1),f=Ft(c,n),p=n.harnesses.filter(t=>(X(e)||e===`image`&&t.images)&&(t.version!==null||l?.kind===`client`&&l.id===t.id)),m=G.filter(t=>t.models[e]?.length),h=r=>{if(d(!1),r.kind===`credits`&&!n.credits){d(!0);return}if(jt(r,l))return;let i=bt[e],s=e=>Object.fromEntries(i.map(t=>[t,e]));switch(r.kind){case`client`:a.mutate(X(e)?{source:r.id}:{bindings:{[o]:`${r.id}/image`}});return;case`key`:{let i=K(r.provider);a.mutate({...X(e)&&!n.cloud?{source:`own`}:{},bindings:Nt(i,e,t)});return}case`local`:a.mutate({source:`own`,bindings:s(`ollama:qwen3`)});return;case`credits`:a.mutate(X(e)&&!n.cloud?{source:`account`}:{bindings:s(xt)});return}},g=l?.kind===`key`?K(l.provider):null,v=g?!t.keys[g.id]:!1,y=l?.kind===`client`?n.harnesses.find(e=>e.id===l.id):null,b=c.kind!==`none`;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,R.jsx)(Rt,{icon:J[e],title:_(`models.cap.${e}`),lead:_(`models.cap.${e}.hint`),status:(0,R.jsx)(Lt,{...f})}),(0,R.jsxs)(O,{className:`flex flex-col gap-6 p-3.5 sm:p-5 sm:p-6`,children:[(0,R.jsxs)(Q,{title:_(`models.who`),children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[p.length?(0,R.jsx)(zt,{label:_(`models.optSubscription`),children:p.map(e=>(0,R.jsx)(Bt,{title:e.name,...Pt(e),selected:l?.kind===`client`&&l.id===e.id,disabled:!n.canEdit,onPick:()=>h({kind:`client`,id:e.id})},e.id))}):null,(0,R.jsx)(zt,{label:_(`models.optKey`),children:m.map(e=>(0,R.jsx)(Bt,{title:e.name,note:t.keys[e.id]?_(`models.noteKey`):_(`models.noteNoKey`),noteTone:t.keys[e.id]?`done`:void 0,selected:l?.kind===`key`&&l.provider===e.id,disabled:!n.canEdit,onPick:()=>h({kind:`key`,provider:e.id})},e.id))}),(0,R.jsxs)(zt,{label:X(e)&&!n.cloud?_(`models.optOther`):_(`models.optCreditsGroup`),children:[X(e)&&!n.cloud?(0,R.jsx)(Bt,{title:_(`models.optLocal`),note:_(`models.optLocalNote`),selected:l?.kind===`local`,disabled:!n.canEdit,onPick:()=>h({kind:`local`})}):null,(0,R.jsx)(Bt,{title:n.cloud?_(`models.creditsTeam`):_(`models.creditsName`),note:n.credits?Jt(e,t):_(`models.noteNeedsAccount`),noteTone:n.credits?`done`:void 0,selected:l?.kind===`credits`,disabled:!n.canEdit,onPick:()=>h({kind:`credits`})})]})]}),u?(0,R.jsxs)(`p`,{className:`text-[0.8125rem] text-ink-2`,children:[_(`local.sourceNeedsAccount`),` `,(0,R.jsx)(rn,{})]}):null,a.isError?(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:a.error.message}):null]}),g?(0,R.jsxs)(R.Fragment,{children:[v?(0,R.jsxs)(Q,{title:_(`models.keyFor`,{name:g.name}),children:[(0,R.jsx)(Vt,{provider:g,stored:!1,place:n}),n.credits?(0,R.jsxs)($,{children:[(0,R.jsx)(s,{className:`mr-1 inline size-3.5 align-[-2px]`}),_(`models.keyFallback`)]}):null]}):null,v&&n.credits&&Yt(t,e,g.id).length?(0,R.jsx)(Q,{title:_(`models.viaCredits`,{name:g.name}),children:(0,R.jsx)(Zt,{models:Yt(t,e,g.id),state:t,place:n})}):null,(0,R.jsx)(Q,{title:_(`models.model`),aside:v?null:(0,R.jsx)(`button`,{type:`button`,onClick:()=>i({type:`provider`,id:g.id}),className:`text-[0.75rem] text-ink-3 hover:text-ink`,children:_(`models.manageKey`,{name:g.name})}),children:X(e)&&g.text?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Wt,{provider:g,state:t}),(0,R.jsx)(Gt,{provider:g,state:t,disabled:!n.canEdit,onPick:(e,t)=>a.mutate({bindings:{[e]:t}})})]}):(0,R.jsx)(Ut,{provider:g,cap:e,value:t.bindings[o]??g.models[e]?.[0]?.ref??``,disabled:!n.canEdit,onPick:e=>a.mutate({bindings:{[o]:e}})},`${g.id}:${t.bindings[o]??``}`)})]}):null,l?.kind===`client`&&y?X(e)?(0,R.jsx)(Q,{title:y.name,children:(0,R.jsx)(He,{me:r,id:y.id})}):(0,R.jsx)(Q,{title:y.name,children:(0,R.jsx)($,{children:_(`models.clientImages`,{name:y.name,sub:_(`harness.sub.${y.id}`)})})}):null,l?.kind===`local`?(0,R.jsx)($t,{state:t,disabled:!n.canEdit}):null,l?.kind===`credits`&&n.credits?X(e)?(0,R.jsx)(Q,{title:_(`models.creditsName`),children:(0,R.jsxs)($,{children:[_(`models.creditsPicks`),c.kind===`credits`&&c.ref?` ${_(`models.creditsModel`,{model:q(c.ref)})}`:``]})}):(0,R.jsxs)(Q,{title:_(`models.model`),children:[(0,R.jsx)(Xt,{cap:e,state:t,disabled:!n.canEdit}),(0,R.jsx)($,{children:_(`models.creditsPickHint`)})]}):null,c.problem?(0,R.jsxs)(`p`,{className:`flex items-start gap-2 rounded-lg bg-paper-2 px-3 py-2.5 text-[0.8125rem] text-ink-2`,children:[(0,R.jsx)(ce,{className:`mt-0.5 size-3.5 shrink-0 text-ink-3`}),(0,R.jsx)(`span`,{children:(0,R.jsx)(E,{text:c.problem})})]}):null,l?.kind===`client`&&X(e)?null:(0,R.jsx)(Q,{title:_(`models.try`),children:(0,R.jsx)(Kt,{cap:e,disabled:!b||!n.canEdit},`${e}:${c.ref}`)}),X(e)&&r.subscriptions.includes(`claude`)&&!n.cloud?(0,R.jsx)(en,{me:r}):null]})]})}function $t({state:e,disabled:t}){let n=Z(),[r,i]=(0,L.useState)(e.ollamaUrl),[a,o]=(0,L.useState)((e.bindings.standard??`ollama:qwen3`).replace(/^ollama:/,``));return(0,R.jsxs)(Q,{title:_(`models.optLocal`),children:[(0,R.jsx)($,{children:_(`models.ollamaHint`)}),(0,R.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[minmax(0,1fr)_12rem_auto]`,children:[(0,R.jsx)(j,{className:`font-mono text-[0.8125rem]`,value:r,disabled:t,onChange:e=>i(e.target.value)}),(0,R.jsx)(j,{className:`font-mono text-[0.8125rem]`,value:a,disabled:t,onChange:e=>o(e.target.value)}),(0,R.jsx)(M,{variant:`secondary`,busy:n.isPending,disabled:t||!a.trim(),onClick:()=>n.mutate({ollamaUrl:r,bindings:Object.fromEntries(me.map(e=>[e,`ollama:${a.trim()}`]))}),children:_(`settings.save`)})]})]})}function en({me:e}){let t=r(),n=f({mutationFn:e=>p.put(`/api/studio/local/chat`,{engine:e}),onSuccess:()=>t.invalidateQueries({queryKey:[`me`]})});return(0,R.jsxs)(Q,{title:_(`local.chat`),children:[(0,R.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`models`,`claude`].map(t=>(0,R.jsx)(`button`,{type:`button`,"aria-pressed":e.chatEngine===t,onClick:()=>n.mutate(t),className:S(`h-9 rounded-full border px-3.5 text-[0.8125rem] transition`,e.chatEngine===t?`border-ember bg-ember-tint text-ink`:`border-input bg-card text-ink-2 hover:text-ink`),children:_(t===`claude`?`local.chatClaude`:`local.chatModels`)},t))}),(0,R.jsx)($,{children:_(`local.subscription`)})]})}function tn({provider:e,state:t,place:n,onOpen:r}){let i=Z(),a=yt.filter(t=>e.models[t]?.length),o=t.keys[e.id],s=e.id===`gateway`?[]:t.creditModels.filter(t=>t.source===e.id||t.provider===e.id);return(0,R.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,R.jsx)(Rt,{icon:I,title:e.name,lead:At(e.about,g),status:(0,R.jsx)(Lt,{text:_(o?`models.keyStored`:`models.keyNone`),tone:o?`done`:`warn`})}),(0,R.jsxs)(O,{className:`flex flex-col gap-6 p-3.5 sm:p-5 sm:p-6`,children:[(0,R.jsx)(Q,{title:_(`models.key`),children:(0,R.jsx)(Vt,{provider:e,stored:o,place:n})}),(0,R.jsx)(Q,{title:_(`models.uses`),children:(0,R.jsx)(`ul`,{className:`flex flex-col divide-y divide-border-soft`,children:a.map(a=>{let o=J[a],s=Mt(t,a,n),c=s?.kind===`key`&&s.provider===e.id;return(0,R.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 py-2.5`,children:[(0,R.jsx)(o,{className:`size-4 shrink-0 text-ink-3`}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r({type:`cap`,id:a}),className:`min-w-0 flex-1 text-left`,children:[(0,R.jsx)(`span`,{className:`block font-medium text-[0.875rem]`,children:_(`models.cap.${a}`)}),(0,R.jsx)(`span`,{className:`block truncate text-[0.75rem] text-ink-3`,children:(e.models[a]??[]).map(e=>e.label).join(` · `)})]}),c?(0,R.jsxs)(`span`,{className:`flex items-center gap-1 font-medium text-[0.75rem] text-moss`,children:[(0,R.jsx)(m,{className:`size-3.5`,strokeWidth:3}),` `,_(`models.inUse`)]}):(0,R.jsx)(M,{size:`sm`,variant:`secondary`,disabled:!n.canEdit,busy:i.isPending&&i.variables?.bindings!==void 0,onClick:()=>i.mutate({...X(a)&&!n.cloud?{source:`own`}:{},bindings:Nt(e,a,t)}),children:_(`models.useFor`)})]},a)})})}),s.length?(0,R.jsxs)(Q,{title:_(`models.viaCredits`,{name:e.name}),children:[(0,R.jsx)($,{children:n.credits?_(`models.viaCreditsHint`):_(`models.viaCreditsNeedsAccount`)}),(0,R.jsx)(Zt,{models:s,state:t,place:n})]}):null]})]})}function nn({me:e,id:t,state:n,place:r}){let i=Z(),a=r.harnesses.find(e=>e.id===t);if(!a)return null;let o=n.source===t,s=a.version!==null&&a.auth!==`none`;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,R.jsx)(Rt,{icon:ie,title:a.name,lead:_(`harness.desc.${t}`),status:(0,R.jsx)(Lt,{text:Pt(a).note,tone:s?`done`:`warn`})}),(0,R.jsxs)(O,{className:`flex flex-col gap-6 p-3.5 sm:p-5 sm:p-6`,children:[(0,R.jsx)(Q,{title:_(`models.clientSignIn`),children:(0,R.jsx)(He,{me:e,id:t})}),(0,R.jsxs)(Q,{title:_(`models.uses`),children:[(0,R.jsx)(`ul`,{className:`flex flex-col divide-y divide-border-soft`,children:[`text`,...a.images?[`image`]:[]].map(e=>{let a=J[e],o=Mt(n,e,r),s=o?.kind===`client`&&o.id===t;return(0,R.jsxs)(`li`,{className:`flex items-center gap-3 py-2.5`,children:[(0,R.jsx)(a,{className:`size-4 shrink-0 text-ink-3`}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 font-medium text-[0.875rem]`,children:_(`models.cap.${e}`)}),s?(0,R.jsxs)(`span`,{className:`flex items-center gap-1 font-medium text-[0.75rem] text-moss`,children:[(0,R.jsx)(m,{className:`size-3.5`,strokeWidth:3}),` `,_(`models.inUse`)]}):(0,R.jsx)(M,{size:`sm`,variant:`secondary`,busy:i.isPending,onClick:()=>i.mutate(e===`text`?{source:t}:{bindings:{image:`${t}/image`}}),children:_(`models.useFor`)})]},e)})}),o?null:(0,R.jsx)($,{children:_(`models.clientNotChosen`,{name:a.name})})]})]})]})}function rn(){return(0,R.jsx)(x,{to:`/settings/account`,className:`font-medium text-ember-strong underline-offset-2 hover:underline`,children:_(`local.toAccount`)})}function an({state:e,place:t,onOpen:n}){let r=Z(),i=yt.filter(t=>e.ways[Y[t]].kind===`credits`),a=t.cloud?_(`models.creditsTeam`):_(`models.creditsName`);return(0,R.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,R.jsx)(Rt,{icon:s,title:a,lead:t.cloud?_(`models.creditsCloudHint`):_(`models.creditsLocalLead`),status:t.balance===null?void 0:(0,R.jsx)(`span`,{className:`font-display font-semibold text-[1.25rem] tabular-nums`,children:_(`nav.credits`,{n:Math.floor(t.balance).toLocaleString()})})}),(0,R.jsxs)(O,{className:`flex flex-col gap-6 p-3.5 sm:p-5 sm:p-6`,children:[!t.cloud&&!t.account?(0,R.jsxs)(Q,{title:_(`models.creditsConnectTitle`),children:[(0,R.jsx)($,{children:_(`models.creditsLocalHint`)}),(0,R.jsx)(`div`,{children:(0,R.jsx)(x,{to:`/settings/account`,children:(0,R.jsx)(M,{children:_(`models.creditsConnect`)})})})]}):null,t.account&&!t.account.signedIn?(0,R.jsxs)(`p`,{className:`text-[0.8125rem] text-rose`,children:[_(`local.accountExpired`),` `,(0,R.jsx)(rn,{})]}):null,t.account?(0,R.jsx)(Q,{title:_(`models.creditsFallback`),children:(0,R.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,R.jsx)(D,{checked:e.creditFallback,disabled:!t.canEdit,onChange:e=>r.mutate({creditFallback:e}),label:_(`models.creditsFallback`)}),(0,R.jsx)($,{children:e.creditFallback?_(`models.creditsFallbackOn`):_(`models.creditsFallbackOff`)})]})}):null,t.credits?(0,R.jsx)(Q,{title:_(`models.creditsOn`),aside:t.topUp?(0,R.jsxs)(`a`,{href:t.topUp,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 font-medium text-[0.8125rem] text-ember-strong hover:underline`,children:[_(`models.creditsTopUp`),` `,(0,R.jsx)(N,{className:`size-3`})]}):null,children:i.length?(0,R.jsx)(`ul`,{className:`flex flex-col divide-y divide-border-soft`,children:i.map(t=>{let r=J[t],i=e.ways[Y[t]];return(0,R.jsx)(`li`,{children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>n({type:`cap`,id:t}),className:`flex w-full items-center gap-3 py-2.5 text-left`,children:[(0,R.jsx)(r,{className:`size-4 shrink-0 text-ink-3`}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 font-medium text-[0.875rem]`,children:_(`models.cap.${t}`)}),(0,R.jsxs)(`span`,{className:`truncate text-[0.75rem] text-ink-3`,children:[i.ref?q(i.ref):``,` · `,Jt(t,e)]})]})},t)})}):(0,R.jsx)($,{children:_(`models.creditsNone`)})}):null]})]})}function on(e){return e?e===`credits`?{type:`credits`}:yt.includes(e)?{type:`cap`,id:e}:K(e)?{type:`provider`,id:e}:{type:`client`,id:e}:{type:`cap`,id:`text`}}var sn=e=>e.type===`credits`?`credits`:e.id;function cn({view:e,onView:t}){return null}function ln(e){return e.kind===`none`?`off`:e.kind===`credits`?`credits`:`done`}function un(e,t){switch(e.type){case`cap`:return _(`models.cap.${e.id}`);case`provider`:return K(e.id)?.name??e.id;case`client`:return t?.harnesses.find(t=>t.id===e.id)?.name??e.id;default:return t?.mode===`managed`?_(`models.creditsTeam`):_(`models.creditsName`)}}function dn(){let e=ge(),t=It(),[n,r]=T(),[i,a]=(0,L.useState)(`auto`),{narrow:o}=je(),c=n.get(`show`),l=on(c);if(Ne(c||!o?un(l,e.data):null),!e.data||!t.data)return t.isError?(0,R.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:t.error.message}):null;let u=t.data,d=kt(e.data,i),f=e=>r({show:sn(e)},{replace:!o}),p=e=>!(!c&&o)&&sn(e)===sn(l),m=d.harnesses.filter(e=>e.version!==null||u.source===e.id),h=G.filter(e=>u.keys[e.id]),g=G.filter(e=>!u.keys[e.id]);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(Le,{children:[(0,R.jsx)(F,{label:_(`models.groupCaps`),children:yt.map(e=>{let t=u.ways[Y[e]];return(0,R.jsx)(P,{icon:J[e],label:_(`models.cap.${e}`),tone:ln(t),toneLabel:Ft(t,d).text,selected:p({type:`cap`,id:e}),onPick:()=>f({type:`cap`,id:e})},e)})}),(0,R.jsxs)(F,{label:_(`models.groupAccess`),children:[(0,R.jsx)(P,{icon:s,label:d.cloud?_(`models.creditsTeam`):_(`models.creditsName`),badge:d.balance===null?null:(0,R.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:Math.floor(d.balance).toLocaleString()}),tone:d.credits?void 0:`off`,toneLabel:d.credits?void 0:_(`models.noteNeedsAccount`),selected:p({type:`credits`}),onPick:()=>f({type:`credits`})}),m.map(e=>(0,R.jsx)(P,{icon:ie,label:e.name,tone:e.version!==null&&e.auth===`subscription`?`done`:e.auth===`api_key`?`on`:`off`,toneLabel:Pt(e).note,selected:p({type:`client`,id:e.id}),onPick:()=>f({type:`client`,id:e.id})},e.id)),h.map(e=>(0,R.jsx)(P,{icon:I,label:e.name,tone:`done`,toneLabel:_(`models.noteKey`),selected:p({type:`provider`,id:e.id}),onPick:()=>f({type:`provider`,id:e.id})},e.id))]}),g.length?(0,R.jsx)(F,{label:_(`models.groupMore`),collapsible:!0,open:g.some(e=>p({type:`provider`,id:e.id})),count:g.length,children:g.map(e=>(0,R.jsx)(P,{icon:I,label:e.name,selected:p({type:`provider`,id:e.id}),onPick:()=>f({type:`provider`,id:e.id})},e.id))}):null,(0,R.jsx)(cn,{view:i,onView:a})]}),d.canEdit?null:(0,R.jsx)(`p`,{className:`mb-4 rounded-lg bg-paper-2 px-3 py-2 text-[0.8125rem] text-ink-2`,children:_(`models.readOnly`)}),l.type===`cap`?(0,R.jsx)(Qt,{cap:l.id,state:u,place:d,me:e.data,onOpen:f},l.id):l.type===`provider`&&K(l.id)?(0,R.jsx)(tn,{provider:K(l.id),state:u,place:d,onOpen:f},l.id):l.type===`client`?(0,R.jsx)(nn,{me:e.data,id:l.id,state:u,place:d},l.id):(0,R.jsx)(an,{state:u,place:d,onOpen:f})]})}function fn({name:e,image:t}){return t?(0,R.jsx)(`img`,{src:t,alt:``,className:`size-9 shrink-0 rounded-full object-cover`}):(0,R.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-full bg-paper-2 font-medium text-[0.75rem] text-ink-2`,children:ye(e)})}function pn({me:e}){let t=i({queryKey:[`team`,e.tenant.id],queryFn:()=>p.get(`/api/studio/team`)}),n=t.data,r=n?.plan??e.tenant.plan,a=n?.seats;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-9`,children:[(0,R.jsxs)(ae,{title:_(`team.title`),hint:_(`team.hint`),children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:_(`team.plan`)}),(0,R.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`font-medium text-[0.9375rem]`,children:r?.name??_(`team.planFree`)}),a?(0,R.jsx)(A,{children:a.limit===null?_(`team.seatsUnlimited`):_(`team.seats`,{taken:a.taken,limit:a.limit})}):null]})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsxs)(M,{variant:`secondary`,onClick:()=>xe(`${e.manageUrl}/billing`),children:[_(`team.changePlan`),` `,(0,R.jsx)(N,{className:`size-4`})]}),n?.canManage?(0,R.jsxs)(M,{onClick:()=>xe(`${e.manageUrl}/`),children:[_(`team.manage`),` `,(0,R.jsx)(N,{className:`size-4`})]}):null]})]}),(0,R.jsx)(`p`,{className:`mt-4 text-[0.8125rem] text-ink-3 leading-relaxed`,children:e.tenant.role===`member`?_(`team.memberNote`):_(`team.roles`)})]}),(0,R.jsx)(ae,{title:_(`team.members`),children:t.isPending?(0,R.jsx)(w,{}):t.isError||!n?(0,R.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:_(`team.failed`)}):(0,R.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[n.members.map(t=>(0,R.jsxs)(`div`,{className:`flex items-center gap-3 py-3 first:pt-0 last:pb-0`,children:[(0,R.jsx)(fn,{name:t.name,image:t.image}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`truncate text-[0.9375rem]`,children:[t.name,t.userId===e.user.id?(0,R.jsxs)(`span`,{className:`text-ink-4`,children:[` · `,_(`team.you`)]}):null]}),(0,R.jsx)(`div`,{className:`truncate text-[0.8125rem] text-ink-3`,children:t.email})]}),(0,R.jsx)(A,{tone:t.role===`member`?void 0:`live`,children:_(`team.role.${t.role}`)})]},t.userId)),n.invitations.map(e=>(0,R.jsxs)(`div`,{className:`flex items-center gap-3 py-3 first:pt-0 last:pb-0`,children:[(0,R.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-full bg-paper-2 text-ink-3`,children:(0,R.jsx)(qe,{className:`size-4`})}),(0,R.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[0.9375rem]`,children:e.email}),(0,R.jsxs)(A,{tone:`warn`,children:[_(`team.invited`),` · `,_(`team.role.${e.role}`)]})]},e.id)),n.members.length===0&&n.invitations.length===0?(0,R.jsxs)(`div`,{className:`flex items-center gap-3 text-[0.875rem] text-ink-3`,children:[(0,R.jsx)(Te,{className:`size-4`}),` –`]}):null]})})]})}function mn(e,t){let n=e.toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).replace(/^[^a-z]+/,``).slice(0,24)||`system`,r=n,i=2;for(;t.includes(r);)r=`${n}_${i++}`;return r}function hn({project:e}){let t=r(),[n,i]=(0,L.useState)(e.mcpServers.map(e=>({...e,auth:e.headers?.Authorization??e.headers?.authorization??``}))),[a,o]=(0,L.useState)(!1),s=e.readOnly,c=f({mutationFn:()=>p.patch(`/api/studio/projects/${e.id}`,{mcpServers:n.filter(e=>e.name&&e.url).map(({auth:e,headers:t,...n})=>({...n,headers:e?{...t,Authorization:e}:void 0}))}),onSuccess:async()=>{await t.invalidateQueries({queryKey:[`projects`]}),o(!0),setTimeout(()=>o(!1),1800)}});return(0,R.jsxs)(O,{className:`p-4 sm:p-6`,children:[(0,R.jsx)(`h2`,{className:`font-display font-semibold text-lg`,children:_(`settings.mcp`)}),(0,R.jsx)(`p`,{className:`mt-1 mb-5 text-[0.875rem] text-ink-3`,children:_(`settings.mcpHint`)}),(0,R.jsxs)(`fieldset`,{disabled:s,className:`flex min-w-0 flex-col gap-3`,children:[n.map((e,t)=>(0,R.jsxs)(`div`,{className:`grid gap-2 rounded-lg bg-paper p-3 ring-1 ring-border-soft sm:grid-cols-[1fr_2fr_auto]`,children:[(0,R.jsx)(j,{placeholder:_(`settings.serverName`),value:e.name,onChange:e=>i(n=>n.map((r,i)=>i===t?{...r,name:e.target.value,id:r.id||mn(e.target.value,n.map(e=>e.id))}:r))}),(0,R.jsx)(j,{placeholder:`${_(`settings.serverUrl`)} (https://…/mcp)`,value:e.url,onChange:e=>i(n=>n.map((n,r)=>r===t?{...n,url:e.target.value}:n))}),s?(0,R.jsx)(`span`,{}):(0,R.jsx)(k,{label:`Entfernen`,onClick:()=>i(e=>e.filter((e,n)=>n!==t)),className:`hover:text-rose`,children:(0,R.jsx)(pe,{className:`size-4`})}),(0,R.jsx)(j,{className:`sm:col-span-2`,placeholder:_(`settings.serverHeader`),value:e.auth??``,onChange:e=>i(n=>n.map((n,r)=>r===t?{...n,auth:e.target.value}:n))}),e.id?(0,R.jsx)(`span`,{className:`self-center font-mono text-[0.6875rem] text-ink-4`,children:e.id}):null]},t)),s?null:(0,R.jsxs)(M,{variant:`secondary`,className:`self-start`,onClick:()=>i(e=>[...e,{id:``,name:``,url:``,auth:``}]),children:[(0,R.jsx)(y,{className:`size-4`}),` `,_(`settings.addServer`)]})]}),s?null:(0,R.jsxs)(`div`,{className:`mt-5 flex items-center justify-end gap-3`,children:[c.error?(0,R.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:c.error.message}):null,(0,R.jsx)(M,{busy:c.isPending,onClick:()=>c.mutate(),children:_(a?`settings.saved`:`settings.save`)})]})]})}var gn=new Set([`models`,`integrate`]);function _n(){let{section:e}=ne(),[t]=T(),n=te(),r=ge(),{project:i,loading:a}=ve(),o=_e(),[s,c]=(0,L.useState)(i?.id);(0,L.useEffect)(()=>c(i?.id),[i?.id]);let l=De(),u=ze(),[d,f]=(0,L.useState)(null),[p,m]=(0,L.useState)(null),[h,g]=(0,L.useState)(null),y=Se(r.data,l),b=y.find(t=>t.id===e),x=y.map(e=>({...e,to:`/settings/${e.id}`})),C=x.find(t=>t.id===e),w=b?gn.has(b.id):!1,E=b?w&&!t.get(`show`)?1:2:0,D=u?Math.min(E,1):w&&h!==e?1:0,O=Me(D),k=Me(E),A=(0,L.useMemo)(()=>({slot:d,narrow:u,setDetail:m}),[d,u]);if(we([{label:_(`settings.title`),to:`/settings`},...b?[{label:b.label,to:`/settings/${b.id}`}]:[],...b&&p?[{label:p}]:[]]),!b){if(e===`build`)return(0,R.jsx)(v,{to:`/settings/integrate`,replace:!0});if(e===`project`)return(0,R.jsx)(v,{to:`/space`,replace:!0});if(e!==void 0||!u)return l.status===`ready`||e===void 0?(0,R.jsx)(v,{to:`/settings/account`,replace:!0}):null}let j=b?.id===`connectors`&&o;return(0,R.jsx)(Fe.Provider,{value:A,children:(0,R.jsx)(`div`,{className:`animate-rise`,children:(0,R.jsxs)(`div`,{className:`grid gap-6 md:grid-cols-[13.5rem_minmax(0,1fr)] md:gap-8 lg:grid-cols-[15rem_minmax(0,1fr)] lg:gap-10`,children:[(0,R.jsxs)(`aside`,{className:S(`min-w-0 md:sticky md:top-6 md:self-start`,u&&E===2&&`hidden`,u&&k===`back`&&Ae(`back`)),children:[(0,R.jsx)(Pe,{title:_(`settings.title`),open:D===1?C??null:null,onBack:()=>u?n(`/settings`):g(e??null)}),(0,R.jsx)(`div`,{className:S(Ae(O)),children:D===0?(0,R.jsx)(Ie,{entries:x,current:u?void 0:C,onPick:()=>g(null)}):(0,R.jsx)(`div`,{ref:f})},D)]}),b?(0,R.jsxs)(`div`,{className:S(`min-w-0`,![`integrate`,`models`].includes(b.id)&&`max-w-2xl`,u&&E<2&&`hidden`,u&&k===`deeper`&&Ae(`deeper`)),children:[u?(0,R.jsx)(`div`,{className:`mb-3`,children:(0,R.jsx)(Re,{label:w?b.label:_(`settings.title`),onBack:()=>n(w?`/settings/${b.id}`:`/settings`)})}):null,j?(0,R.jsx)(`div`,{className:`mb-6`,children:(0,R.jsx)(se,{})}):null,b.id===`connectors`&&i?(0,R.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[i.readOnly?(0,R.jsx)(Ve,{children:Be(i)}):null,(0,R.jsx)(st,{projectId:i.id,readOnly:i.readOnly},s),(0,R.jsx)(hn,{project:i},s)]}):null,b.id===`connectors`&&!i&&!a?(0,R.jsx)(ee,{children:_(`settings.noProject`)}):null,b.id===`models`?(0,R.jsx)(dn,{}):null,b.id===`integrate`?(0,R.jsx)(vt,{}):null,b.id===`account`&&r.data?(0,R.jsx)(oe,{me:r.data}):null,b.id===`team`&&r.data?(0,R.jsx)(pn,{me:r.data}):null,b.id===`plugins`?(0,R.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,R.jsx)(Qe,{}),(0,R.jsx)(nt,{})]}):null,b.plugin?(0,R.jsx)(Oe,{of:b.plugin,children:(0,R.jsx)(b.plugin.component,{})}):null]}):null]})})})}export{_n as SettingsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r,r as i,t as a}from"./logo-C80CWCDM.js";import{t as o}from"./useMutation-DKcIz55V.js";import{C as s,G as c,P as l,_ as u,nt as d,q as f,t as ee}from"./ui-D92EkdEB.js";import{t as p}from"./arrow-right-Dpp_mpHe.js";import{M as te,O as m,j as ne}from"./definition-CQGiBQ4X.js";import{t as h}from"./refresh-cw-Cli5WGnW.js";import{f as re}from"./session-miDEdw2c.js";import{a as g,i as ie,n as _,r as v,t as ae}from"./ThemeSwitch-C1qYFoYP.js";import{n as y,t as oe}from"./Harness-CfUfchNw.js";var b=e(t(),1),x=e(n(),1),S=`oklch(50% 0.2 262)`,C=`oklch(32% 0.15 262)`,w=`oklch(90% 0.1 80)`,T=`var(--step-done)`,E=`var(--step-now)`,D=`color-mix(in oklab, var(--on) 38%, transparent)`,O={"--on":`white`,"--tile":`rgb(255 255 255 / 0.1)`,"--tile-hover":`rgb(255 255 255 / 0.15)`,"--tile-ring":`rgb(255 255 255 / 0.15)`,"--panel":`rgb(255 255 255 / 0.07)`,"--panel-ring":`rgb(255 255 255 / 0.12)`,"--pick":`white`,"--pick-ink":C,"--pick-mark":C,"--dot":w,"--step-done":`oklch(88% 0.17 150)`,"--step-now":`oklch(88% 0.14 80)`,"--ready-ink":`oklch(27% 0.09 150)`,"--ink-2":`oklch(96% 0.02 262)`,"--ink-3":`oklch(90% 0.035 262)`,"--ink-4":`oklch(82% 0.05 262)`,"--moss":`oklch(90% 0.14 150)`,"--rose":`oklch(89% 0.09 45)`},k={"--on":`var(--ink)`,"--tile":`var(--card)`,"--tile-hover":`var(--paper-2)`,"--tile-ring":`var(--border-soft)`,"--panel":`var(--card)`,"--panel-ring":`var(--border-soft)`,"--pick":S,"--pick-ink":`white`,"--pick-mark":`white`,"--dot":S,"--step-done":`oklch(52% 0.15 150)`,"--step-now":`oklch(60% 0.15 65)`,"--ready-ink":`white`},A=`ease-[cubic-bezier(0.3,0.7,0.2,1)]`,se=220,ce={codex:`dome`,claude:`oval`,gemini:`wedge`,cursor:`sprout`,own:`bean`,account:`drop`},j=`relative w-fit max-w-full transition-[left,translate] duration-700 ease-[cubic-bezier(0.3,0.7,0.2,1)] motion-reduce:transition-none`,M=`left-1/2 -translate-x-1/2 text-center`,N=`max-lg:left-1/2 max-lg:-translate-x-1/2 max-lg:text-center lg:left-0 lg:translate-x-0 lg:text-left`;function P(){window.matchMedia(`(max-width: 1023px)`).matches&&window.scrollTo({top:0})}var F=`wizards.setup.own`;function I(){try{return sessionStorage.getItem(F)===`1`}catch{return!1}}function L(e){try{e?sessionStorage.setItem(F,`1`):sessionStorage.removeItem(F)}catch{}}function R(){return(0,x.jsxs)(`span`,{className:`inline-flex items-center gap-2.5`,children:[(0,x.jsx)(a,{size:28}),(0,x.jsxs)(`span`,{className:`font-display font-semibold text-[1.0625rem] tracking-tight`,children:[`engenty`,(0,x.jsx)(`span`,{className:`mr-[0.09em] ml-[0.06em] text-(color:--dot)`,children:`.`}),(0,x.jsx)(`span`,{className:`font-normal text-(color:--on)/70`,children:`wizards`})]})]})}function z({selected:e,title:t,description:n,badge:r,note:i,onPick:a}){return(0,x.jsxs)(`button`,{type:`button`,onClick:a,"aria-pressed":e,className:u(`group relative flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left transition-[background-color,color,box-shadow] duration-300`,e?`bg-(color:--pick) text-(color:--pick-ink) shadow-elevated`:`bg-(color:--tile) ring-(color:--tile-ring) ring-1 hover:bg-(color:--tile-hover)`),children:[r?(0,x.jsx)(`span`,{className:`absolute -top-2.5 right-4 rounded-full px-2.5 py-[3px] font-semibold text-[0.6875rem] leading-none tracking-wide shadow-[0_2px_8px_oklch(0%_0_0/0.22)]`,style:{background:w,color:C},children:r}):null,(0,x.jsx)(`span`,{className:u(`flex size-5 shrink-0 items-center justify-center rounded-full border transition-colors duration-300`,e?`border-transparent bg-(color:--pick-mark)`:`border-(color:--on)/40`),children:e?(0,x.jsx)(c,{className:`size-3.5 text-(color:--pick)`}):null}),(0,x.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,x.jsx)(`span`,{className:`block font-medium text-[0.9375rem]`,children:t}),(0,x.jsx)(`span`,{className:u(`mt-0.5 block truncate text-[0.8125rem]`,e?`opacity-70`:`text-(color:--on)/65`),children:n})]}),i?(0,x.jsx)(`span`,{className:u(`shrink-0 text-[0.75rem]`,e?`opacity-70`:`text-(color:--on)/65`),children:i}):null,(0,x.jsx)(p,{className:u(`size-4 shrink-0 transition`,e?`opacity-70`:`text-(color:--on)/40 group-hover:translate-x-0.5 group-hover:text-(color:--on)/80`)})]})}function B({name:e,at:t,done:n}){let r=[l(`setup.stage.connect`),l(`setup.stage.test`),l(`setup.stage.done`)],i=n?r.length:t+1;return(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 font-medium text-[0.75rem] uppercase tracking-[0.14em]`,children:[(0,x.jsx)(`span`,{className:`text-(color:--on)/70`,children:e}),(0,x.jsx)(`ol`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:r.map((e,r)=>{let i=n||r<t;return(0,x.jsxs)(`li`,{"aria-current":!i&&r===t?`step`:void 0,className:`flex items-center gap-1 transition-colors duration-500`,style:{color:i?T:r===t?E:D},children:[i?(0,x.jsx)(c,{className:`size-3.5`,strokeWidth:3}):null,e]},e)})}),(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`flex gap-1.5`,children:r.map((e,t)=>(0,x.jsx)(`span`,{className:`h-[3px] w-5 rounded-full transition-colors duration-500`,style:{background:t<i?n?T:E:`color-mix(in oklab, var(--on) 22%, transparent)`}},e))})]})}function V({href:e,children:t}){return(0,x.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`transition hover:text-(color:--on)`,onClick:t=>{t.preventDefault(),v(e)},children:t})}function H(){let e=te()===`dark`;ne(e?S:null);let t=re(),n=r(),a=d(),p=i({queryKey:[`config`],queryFn:()=>s.get(`/api/config`)}),[v,w]=(0,b.useState)(I),[E,D]=(0,b.useState)(!1),F=o({mutationFn:e=>s.put(`/api/studio/local/models`,{source:e}),onSuccess:async(e,t)=>{await n.invalidateQueries({queryKey:[`me`]}),w(!0),D(!1),P(),L(t===`own`)}}),H=o({mutationFn:()=>Promise.all((t.data?.harnesses??[]).map(e=>s.post(`/api/studio/local/harness/${e.id}/detect`))),onSuccess:()=>n.invalidateQueries({queryKey:[`me`]})});if(!t.data?.models)return null;let U=t.data.models,W=e=>(e.version===null?2:0)+ +!e.app,G=[...t.data.harnesses].sort((e,t)=>W(e)-W(t)),le=G.filter(e=>e.version!==null),K=v||t.data.setupDone||U.source!==`own`?U.source:null,q=t.data.harnesses.find(e=>e.id===K),J=t.data.setupDone,Y=Object.values(U.keys).some(Boolean),ue=J?2:q?q.auth===`none`?0:1:+!!Y,X=J?l(`setup.h.done`):q?q.version===null?l(`setup.h.install`,{name:q.name}):q.auth===`none`?l(`setup.h.signIn`,{name:q.name}):l(`setup.h.test`):l(Y?`setup.h.test`:`setup.h.keys`),Z=g.site?p.data?.site:null,Q=K!==null&&!E,$=F.isPending?F.variables??K:K;return(0,x.jsxs)(`div`,{className:`flex min-h-dvh flex-col px-6 text-(color:--on) sm:px-10`,style:e?O:k,children:[(0,x.jsxs)(`header`,{className:`flex items-center justify-between pt-6 sm:pt-8`,children:[(0,x.jsx)(R,{}),(0,x.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(ae,{tone:e?`ground`:`surface`}),(0,x.jsx)(ie,{tone:e?`ground`:`surface`,ink:C})]})]}),(0,x.jsxs)(`main`,{className:`relative mx-auto flex w-full max-w-6xl flex-1 flex-col pt-6 pb-10 lg:pt-[6vh]`,children:[(0,x.jsx)(`div`,{"aria-hidden":`true`,className:u(`absolute top-6 left-1/2 z-10 origin-top -translate-x-1/2 transition-[opacity,scale,left] duration-500 motion-reduce:transition-none lg:top-[calc(6vh+5.25rem)] lg:origin-center lg:translate-x-0`,A,K?`lg:pointer-events-none lg:left-[calc(50%-560px)] lg:scale-75 lg:opacity-0`:`lg:left-[calc(50%-508px)] lg:scale-100 lg:opacity-100`,Q?`max-lg:pointer-events-none max-lg:scale-[0.4] max-lg:opacity-0`:`max-lg:scale-[0.6] max-lg:opacity-100`),children:(0,x.jsx)(`div`,{className:`animate-rise`,children:(0,x.jsx)(m,{kind:`drop`,size:se,fluffy:!0,coat:`fur`})})}),(0,x.jsx)(`div`,{"aria-hidden":`true`,className:u(`shrink-0 transition-[height] duration-500 motion-reduce:transition-none lg:h-0`,A,Q?`max-lg:h-0`:`max-lg:h-[148px]`)}),(0,x.jsxs)(`div`,{className:`flex flex-col gap-10 lg:flex-row lg:items-start lg:gap-14`,children:[(0,x.jsxs)(`section`,{className:u(`flex w-full shrink-0 animate-rise flex-col lg:w-[32rem] lg:transition-[margin] lg:duration-700 motion-reduce:transition-none`,A,K?`lg:ml-0`:`lg:ml-[calc(50%-16rem)]`,Q?`max-lg:hidden`:``),children:[(0,x.jsxs)(`div`,{className:`flex flex-col lg:min-h-[6.5rem]`,children:[(0,x.jsx)(`p`,{className:u(j,`font-medium text-(color:--on)/70 text-[0.75rem] uppercase tracking-[0.16em]`,K?N:M),children:l(`setup.title`)}),(0,x.jsx)(`h1`,{className:u(j,`mt-2 font-display font-semibold text-[1.625rem] leading-[1.08] tracking-[-0.02em] sm:text-[1.75rem]`,K?N:M),children:l(`setup.source`)}),(0,x.jsx)(`p`,{className:u(j,`mt-2.5 text-(color:--on)/75 text-[0.9375rem] leading-relaxed`,K?N:M),children:l(`setup.sub`)})]}),(0,x.jsxs)(`div`,{className:`mt-5 flex flex-col gap-2.5`,children:[G.map((e,t)=>(0,x.jsx)(z,{selected:$===e.id,title:e.name,description:l(`harness.desc.${e.id}`),badge:t===0?l(`setup.recommended`):void 0,note:e.version===null?l(`harness.notInstalled`):e.auth===`subscription`?l(`harness.ready`):void 0,onPick:()=>F.mutate(e.id)},e.id)),(0,x.jsx)(z,{selected:$===`own`,title:l(`local.sourceOwn`),description:l(`setup.ownDesc`),onPick:()=>F.mutate(`own`)})]}),(0,x.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-center gap-x-2 gap-y-1 text-(color:--on)/60 text-[0.8125rem]`,children:[(0,x.jsx)(`span`,{children:le.length?null:l(`setup.noHarness`)}),(0,x.jsxs)(ee,{variant:`ghost`,size:`sm`,busy:H.isPending,onClick:()=>H.mutate(),children:[(0,x.jsx)(h,{className:`size-3.5`}),` `,l(`local.recheck`)]})]})]}),K?(0,x.jsxs)(`section`,{className:u(`min-w-0 flex-1 animate-settle`,E?`max-lg:hidden`:``),children:[(0,x.jsxs)(`button`,{type:`button`,onClick:()=>{D(!0),P()},className:`-ml-1.5 mb-5 inline-flex items-center gap-1.5 rounded-full px-1.5 py-1 text-(color:--on)/80 text-[0.875rem] transition hover:text-(color:--on) lg:hidden`,children:[(0,x.jsx)(f,{className:`size-4`}),` `,l(`run.back`)]}),(0,x.jsxs)(`div`,{className:`relative`,children:[(0,x.jsx)(`div`,{"aria-hidden":`true`,className:`absolute top-6 right-2 z-10`,children:(0,x.jsx)(m,{kind:ce[K],size:120,fluffy:!0,coat:`fur`})}),(0,x.jsxs)(`div`,{className:`min-h-[6.5rem]`,children:[(0,x.jsx)(B,{name:q?.name??l(`local.sourceOwn`),at:ue,done:J}),(0,x.jsx)(`h2`,{className:`mt-2 animate-rise pr-32 font-display font-semibold text-[clamp(28px,3vw,40px)] leading-[1.06] tracking-[-0.03em]`,children:X},X)]}),(0,x.jsx)(`div`,{className:`mt-5 rounded-2xl bg-(color:--panel) p-5 ring-(color:--panel-ring) ring-1 sm:p-6`,children:q?(0,x.jsx)(oe,{me:t.data,id:q.id,autoTest:!J}):(0,x.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,x.jsx)(_,{models:U}),(0,x.jsx)(y,{})]})}),(0,x.jsxs)(`div`,{className:`mt-9`,children:[J?(0,x.jsxs)(`p`,{className:`mb-3 flex animate-rise items-center gap-2 font-medium text-[0.9375rem]`,style:{color:T},children:[(0,x.jsx)(c,{className:`size-4`,strokeWidth:3}),l(`setup.ready`)]}):null,(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,x.jsxs)(`button`,{type:`button`,disabled:!J,onClick:()=>a(`/`,{replace:!0}),className:u(`group inline-flex h-12 items-center gap-2.5 rounded-full px-6 font-semibold text-[1rem] transition-[background-color,color,box-shadow,filter] duration-300`,J?`shadow-[0_6px_24px_oklch(88%_0.17_150/0.35)] hover:brightness-105`:`cursor-not-allowed bg-(color:--on)/20 text-(color:--on)/65`),style:J?{background:T,color:`var(--ready-ink)`}:void 0,children:[l(`setup.done`),(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`transition-transform group-enabled:group-hover:translate-x-0.5`,children:`→`})]}),J?null:(0,x.jsx)(`span`,{className:`text-(color:--on)/65 text-[0.8125rem]`,children:l(`setup.untilWorks`)})]})]})]})]},K):null]})]}),(0,x.jsxs)(`footer`,{className:`mx-auto flex w-full max-w-6xl items-center justify-between gap-4 pb-6 text-(color:--on)/55 text-[0.75rem] sm:pb-8`,children:[(0,x.jsxs)(`span`,{children:[`© `,new Date().getFullYear(),` engenty · `,l(`setup.local`)]}),(0,x.jsxs)(`span`,{className:`flex items-center gap-5`,children:[Z?(0,x.jsx)(V,{href:Z,children:new URL(Z).host}):null,(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`size-[3px] bg-(color:--dot)`})]})]})]})}export{H as SetupPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r}from"./logo-C80CWCDM.js";import{t as i}from"./useMutation-DKcIz55V.js";import{C as a,F as o,G as s,N as c,P as l,_ as u,c as d,s as f,t as p}from"./ui-D92EkdEB.js";import{A as m,I as h,L as g,M as _,P as v,s as y}from"./definition-CQGiBQ4X.js";var b={account:!0,unsetConnectors:!1,site:!1},x=e(t(),1),S=e(n(),1),C={en:`English`,de:`Deutsch`},w=[`en`,`de`],T=`cubic-bezier(0.3, 0.7, 0.2, 1)`,E=`(max-width: 639px)`;function D(){return(0,x.useSyncExternalStore)(e=>{let t=window.matchMedia(E);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>window.matchMedia(E).matches,()=>!1)}function O({tone:e=`ground`,ink:t}){let n=o(),r=D(),i=(0,x.useRef)({}),[a,s]=(0,x.useState)(null);(0,x.useLayoutEffect)(()=>{let e=()=>{let e={};for(let[t,n]of Object.entries(i.current))e[t]=n?Math.ceil(n.getBoundingClientRect().width):0;s(e)};e(),document.fonts?.ready.then(e)},[]);let d=e=>a?a[e===n&&!r?`${e}-full`:`${e}-short`]+24:void 0,f=a?w.slice(0,w.indexOf(n)).reduce((e,t)=>e+(d(t)??0),0):0,p=`300ms ${T}`,m=e===`ground`;return(0,S.jsxs)(`fieldset`,{className:u(`relative inline-flex items-center rounded-full border-0 p-0.5 ring-1`,m?`bg-white/10 ring-white/15`:`bg-paper-2 ring-border-soft`),children:[(0,S.jsx)(`legend`,{className:`sr-only`,children:l(`nav.language`)}),a?(0,S.jsx)(`span`,{"aria-hidden":`true`,className:u(`absolute top-0.5 bottom-0.5 left-0.5 rounded-full shadow-sm motion-reduce:transition-none`,m?`bg-white`:`bg-card`),style:{width:d(n),transform:`translateX(${f}px)`,transition:`transform ${p}, width ${p}`}}):null,w.map(e=>{let a=e===n;return(0,S.jsxs)(`button`,{"aria-pressed":a,className:u(`relative h-7 cursor-pointer overflow-hidden whitespace-nowrap rounded-full font-medium text-[0.75rem] motion-reduce:transition-none`,m?a?`text-[oklch(32%_0.15_262)]`:`text-white/70`:a?`text-ink`:`text-ink-3`),lang:e,onClick:()=>{c(e)},style:{width:d(e),transition:`width ${p}, color ${p}`,...m&&a&&t?{color:t}:{}},title:C[e],type:`button`,children:[[C[e],e.toUpperCase()].map((e,t)=>{let n=a&&!r?t===0:t===1;return(0,S.jsx)(`span`,{"aria-hidden":!n,className:`absolute inset-0 grid place-items-center motion-reduce:transition-none`,style:{opacity:+!!n,transition:`opacity 220ms ${T}`},children:e},e)}),(0,S.jsx)(`span`,{ref:t=>{i.current[`${e}-full`]=t},"aria-hidden":`true`,className:`invisible absolute`,children:C[e]}),(0,S.jsx)(`span`,{ref:t=>{i.current[`${e}-short`]=t},"aria-hidden":`true`,className:`invisible absolute`,children:e.toUpperCase()}),(0,S.jsx)(`span`,{className:`invisible px-3`,children:a?C[e]:e.toUpperCase()})]},e)})]})}function k(e){let t=window.engentyDesktop;t?t.open(e):window.open(e,`_blank`,`noopener`)}var A={gateway:`Vercel AI Gateway`,anthropic:`Anthropic`,openai:`OpenAI`};function j({models:e}){let t=r(),[n,o]=(0,x.useState)({}),[c,u]=(0,x.useState)(e.bindings),[m,h]=(0,x.useState)(e.ollamaUrl),[g,_]=(0,x.useState)(!1),v=i({mutationFn:()=>a.put(`/api/studio/local/models`,{keys:n,bindings:c,ollamaUrl:m}),onSuccess:async()=>{o({}),_(!0),setTimeout(()=>_(!1),1500),await t.invalidateQueries({queryKey:[`me`]})}});return(0,S.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(d,{children:l(`local.keys`)}),(0,S.jsx)(`p`,{className:`mb-3 text-[0.8125rem] text-ink-3`,children:l(`local.keysHint`)}),(0,S.jsx)(`div`,{className:`flex flex-col gap-2`,children:Object.keys(A).map(r=>(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`w-40 text-[0.875rem] text-ink-2`,children:A[r]}),(0,S.jsx)(f,{type:`password`,autoComplete:`off`,className:`min-w-0 flex-1 font-mono text-[0.8125rem]`,placeholder:e.keys[r]?l(`local.keySet`):l(`local.keyEmpty`),value:n[r]??``,onChange:e=>o({...n,[r]:e.target.value})}),e.keys[r]?(0,S.jsx)(p,{variant:`ghost`,size:`sm`,onClick:()=>{o({...n,[r]:``}),a.put(`/api/studio/local/models`,{keys:{[r]:``}}).then(()=>t.invalidateQueries({queryKey:[`me`]}))},children:l(`local.keyRemove`)}):null]},r))})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(d,{children:l(`local.classes`)}),(0,S.jsx)(`p`,{className:`mb-3 text-[0.8125rem] text-ink-3`,children:l(`local.classesHint`)}),(0,S.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[y.map(e=>(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`w-40 text-[0.875rem] text-ink-2`,children:l(`class.${e}`)}),(0,S.jsx)(f,{className:`min-w-0 flex-1 font-mono text-[0.8125rem]`,value:c[e]??``,onChange:t=>u({...c,[e]:t.target.value})})]},e)),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`w-40 text-[0.875rem] text-ink-2`,children:`Ollama`}),(0,S.jsx)(f,{className:`min-w-0 flex-1 font-mono text-[0.8125rem]`,value:m,onChange:e=>h(e.target.value)})]})]})]}),(0,S.jsx)(`div`,{children:(0,S.jsxs)(p,{variant:`secondary`,busy:v.isPending,onClick:()=>v.mutate(),children:[g?(0,S.jsx)(s,{className:`size-4`}):null,l(g?`local.saved`:`local.save`)]})})]})}var M=[{theme:`light`,icon:h,label:`theme.light`},{theme:`dark`,icon:g,label:`theme.dark`}],N=`cubic-bezier(0.3, 0.7, 0.2, 1)`;function P({tone:e=`surface`}){let t=v(),n=_(),r=e===`ground`,i=r?n:t,a=M.findIndex(e=>e.theme===i);return(0,S.jsxs)(`fieldset`,{className:u(`relative inline-flex items-center rounded-full border-0 p-0.5 ring-1`,r?`bg-white/10 ring-white/15`:`bg-paper-2 ring-border-soft`),children:[(0,S.jsx)(`legend`,{className:`sr-only`,children:l(`nav.theme`)}),(0,S.jsx)(`span`,{"aria-hidden":`true`,className:u(`absolute top-0.5 bottom-0.5 left-0.5 w-9 rounded-full shadow-sm motion-reduce:transition-none`,r?`bg-white`:`bg-card`),style:{transform:`translateX(${a*36}px)`,transition:`transform 300ms ${N}`}}),M.map(({theme:e,icon:t,label:n})=>(0,S.jsx)(`button`,{"aria-label":l(n),"aria-pressed":e===i,className:u(`relative grid h-7 w-9 cursor-pointer place-items-center rounded-full transition-colors motion-reduce:transition-none`,r?e===i?`text-[oklch(32%_0.15_262)]`:`text-white/70 hover:text-white`:e===i?`text-ink`:`text-ink-3 hover:text-ink-2`),onClick:()=>m(e),title:l(n),type:`button`,children:(0,S.jsx)(t,{className:`size-3.5`})},e))]})}export{b as a,O as i,j as n,k as r,P as t};
|