@lastbrain/ai-ui-react 1.0.48 → 1.0.51

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.
@@ -1 +1 @@
1
- {"version":3,"file":"AiChipLabel.d.ts","sourceRoot":"","sources":["../../src/components/AiChipLabel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAS/D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,OAAmB,EACnB,SAAS,EACT,KAAK,EAAE,WAAW,GACnB,EAAE,gBAAgB,2CAgClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,WAAW,CAAC,EAC1B,KAAU,EACV,QAAQ,EACR,WAAoE,EACpE,OAAO,EACP,QAAQ,EACR,eAAuB,EACvB,SAAS,EACT,YAAY,EACZ,aAAa,EACb,OAAO,EAA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
@@ -1,12 +1,14 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState, useRef } from "react";
4
- import { X, Sparkles } from "lucide-react";
4
+ import { X, Sparkles, Lock } from "lucide-react";
5
5
  import { aiStyles } from "../styles/inline";
6
6
  import { AiPromptPanel } from "./AiPromptPanel";
7
+ import { LBSigninModal } from "./LBSigninModal";
7
8
  import { useAiCallText } from "../hooks/useAiCallText";
8
9
  import { useAiModels } from "../hooks/useAiModels";
9
10
  import { useAiContext } from "../context/AiProvider";
11
+ import { useLB } from "../context/LBAuthProvider";
10
12
  import { handleAIError } from "../utils/errorHandler";
11
13
  export function AiChipLabel({ children, variant = "default", className, style: customStyle, }) {
12
14
  const variantStyles = {
@@ -36,11 +38,22 @@ export function AiChipLabel({ children, variant = "default", className, style: c
36
38
  export function AiChipInput({ value = [], onChange, placeholder = "Tapez et appuyez sur Entrée pour ajouter des tags...", context, maxChips, allowDuplicates = false, className, storeOutputs, artifactTitle, baseUrl: propBaseUrl, apiKeyId: propApiKeyId, }) {
37
39
  const [inputValue, setInputValue] = useState("");
38
40
  const [showPromptPanel, setShowPromptPanel] = useState(false);
41
+ const [showSigninModal, setShowSigninModal] = useState(false);
39
42
  const inputRef = useRef(null);
40
43
  // Récupérer le contexte AiProvider avec fallback sur les props
41
44
  const aiContext = useAiContext();
42
45
  const baseUrl = propBaseUrl ?? aiContext.baseUrl;
43
46
  const apiKeyId = propApiKeyId ?? aiContext.apiKeyId;
47
+ // Vérifier si l'utilisateur est connecté (session LB)
48
+ let isAuthenticated = false;
49
+ try {
50
+ const lbContext = useLB();
51
+ isAuthenticated = lbContext.status === "ready";
52
+ }
53
+ catch {
54
+ // LBProvider n'est pas disponible, considérer non connecté
55
+ isAuthenticated = false;
56
+ }
44
57
  // Hooks pour l'IA avec les valeurs du contexte
45
58
  const { models } = useAiModels({
46
59
  baseUrl,
@@ -129,7 +142,14 @@ Exemple de réponse attendue: javascript, react, frontend, api, development`;
129
142
  return (_jsxs("div", { className: className, children: [_jsxs("div", { style: { position: "relative", marginBottom: "8px" }, children: [_jsx("input", { ref: inputRef, type: "text", value: inputValue, onChange: (e) => setInputValue(e.target.value), onKeyDown: handleKeyDown, placeholder: placeholder, style: {
130
143
  ...aiStyles.input,
131
144
  paddingRight: "40px", // Space for button
132
- } }), _jsx("button", { onClick: handleGenerateChips, style: {
145
+ } }), _jsx("button", { onClick: () => {
146
+ if (isAuthenticated) {
147
+ handleGenerateChips();
148
+ }
149
+ else {
150
+ setShowSigninModal(true);
151
+ }
152
+ }, style: {
133
153
  position: "absolute",
134
154
  right: "8px",
135
155
  top: "50%",
@@ -141,8 +161,10 @@ Exemple de réponse attendue: javascript, react, frontend, api, development`;
141
161
  borderRadius: "4px",
142
162
  display: "flex",
143
163
  alignItems: "center",
144
- color: "#6366f1",
145
- }, title: "G\u00E9n\u00E9rer des tags avec l'IA", children: _jsx(Sparkles, { size: 16 }) })] }), value.length > 0 && (_jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "6px" }, children: value.map((chip, index) => {
164
+ color: isAuthenticated ? "#6366f1" : "#ef4444",
165
+ }, title: isAuthenticated
166
+ ? "Générer des tags avec l'IA"
167
+ : "Se connecter pour utiliser l'IA", children: isAuthenticated ? _jsx(Sparkles, { size: 16 }) : _jsx(Lock, { size: 16 }) })] }), value.length > 0 && (_jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "6px" }, children: value.map((chip, index) => {
146
168
  console.log("Rendering chip:", chip, "at index:", index);
147
169
  return (_jsxs("div", { style: {
148
170
  ...aiStyles.chip,
@@ -160,5 +182,5 @@ Exemple de réponse attendue: javascript, react, frontend, api, development`;
160
182
  color: "currentColor",
161
183
  opacity: 0.7,
162
184
  }, title: "Supprimer", children: _jsx(X, { size: 14 }) })] }, index));
163
- }) })), _jsx(AiPromptPanel, { isOpen: showPromptPanel, onClose: () => setShowPromptPanel(false), onSubmit: handlePromptSubmit, models: models || undefined, baseUrl: baseUrl, sourceText: context ? `Contexte: ${context}` : undefined })] }));
185
+ }) })), _jsx(AiPromptPanel, { isOpen: showPromptPanel, onClose: () => setShowPromptPanel(false), onSubmit: handlePromptSubmit, models: models || undefined, baseUrl: baseUrl, sourceText: context ? `Contexte: ${context}` : undefined }), _jsx(LBSigninModal, { isOpen: showSigninModal, onClose: () => setShowSigninModal(false) })] }));
164
186
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AiContextButton.d.ts","sourceRoot":"","sources":["../../src/components/AiContextButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAW5C,MAAM,WAAW,oBACf,SACE,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAAC,EACrC,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IAEvE,WAAW,EAAE,GAAG,CAAC;IACjB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,CACT,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAC7C,IAAI,CAAC;IACV,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,eAAe,CAAC,EAC9B,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,YAAY,EACtB,MAAgB,EAChB,WAAW,EACX,kBAAyC,EACzC,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,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EACjB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,OAAO,EACf,GAAG,WAAW,EACf,EAAE,oBAAoB,2CAiiBtB"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
- import { Loader2, X, FileText, Sparkle, Download } from "lucide-react";
4
+ import { Loader2, X, FileText, Sparkle, Download, Lock } from "lucide-react";
5
5
  import { useAiCallText } from "../hooks/useAiCallText";
6
6
  import { AiPromptPanel } from "./AiPromptPanel";
7
7
  import { useUsageToast } from "./UsageToast";
@@ -194,7 +194,6 @@ Analyse ces données et réponds de manière structurée et claire.`;
194
194
  border: "none",
195
195
  borderRadius: "12px",
196
196
  // padding: "12px 20px",
197
- margin: "0px 8px",
198
197
  fontSize: "14px",
199
198
  fontWeight: "600",
200
199
  minWidth: "20px",
@@ -233,7 +232,10 @@ Analyse ces données et réponds de manière structurée et claire.`;
233
232
  }, "data-ai-context-button": true, title: !isAuthReady ? "Authentication required" : "Analyser avec l'IA", children: loading ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { size: 18, className: "animate-spin", style: {
234
233
  color: "white",
235
234
  filter: "drop-shadow(0 0 2px rgba(255,255,255,0.3))",
236
- } }), _jsx("span", { style: { letterSpacing: "0.025em" }, children: "Analyse..." })] })) : !isAuthReady ? (_jsxs(_Fragment, { children: [_jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2", ry: "2" }), _jsx("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })] }), children || _jsx("span", { children: "Connexion requise" })] })) : (_jsx(_Fragment, { children: _jsx(Sparkle, { size: 18, style: {
235
+ } }), _jsx("span", { style: { letterSpacing: "0.025em" }, children: "Analyse..." })] })) : !isAuthReady ? (_jsxs(_Fragment, { children: [_jsx(Lock, { size: 18, style: {
236
+ color: "white",
237
+ filter: "drop-shadow(0 0 2px rgba(255,255,255,0.2))",
238
+ } }), children || _jsx("span", { children: "Connexion requise" })] })) : (_jsx(_Fragment, { children: _jsx(Sparkle, { size: 18, style: {
237
239
  color: "white",
238
240
  filter: "drop-shadow(0 0 2px rgba(255,255,255,0.2))",
239
241
  } }) })) }), isOpen && (_jsx(AiPromptPanel, { isOpen: isOpen, onClose: handleClosePanel, onSubmit: handleSubmit, uiMode: uiMode, models: [], enableModelManagement: true, modelCategory: "text", baseUrl: baseUrl, apiKey: apiKeyId }))] }), isResultOpen && analysisResult && (_jsx("div", { style: {
@@ -1 +1 @@
1
- {"version":3,"file":"AiImageButton.d.ts","sourceRoot":"","sources":["../../src/components/AiImageButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAW5C,MAAM,WAAW,kBACf,SACE,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAAC,EACrC,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IACvE,OAAO,CAAC,EAAE,CACR,QAAQ,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAC7C,IAAI,CAAC;IACV,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC5B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC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gB,EAChB,OAAO,EAAE,QAAQ,EACjB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,OAAO,EACf,OAAO,EACP,OAAO,EACP,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,aAAoB,EACpB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,GAAG,WAAW,EACf,EAAE,kBAAkB,2CA4ZpB"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
- import { ImageIcon, Loader2, Download, ExternalLink, X } from "lucide-react";
4
+ import { ImageIcon, Loader2, Download, ExternalLink, X, Lock, } from "lucide-react";
5
5
  import { useAiCallImage } from "../hooks/useAiCallImage";
6
6
  import { AiPromptPanel } from "./AiPromptPanel";
7
7
  import { useUsageToast } from "./UsageToast";
@@ -206,7 +206,10 @@ export function AiImageButton({ baseUrl: propBaseUrl, apiKeyId: propApiKeyId, ui
206
206
  }, "data-ai-image-button": true, title: !isAuthReady ? "Authentication required" : "Générer une image", children: loading ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { size: 18, className: "animate-spin", style: {
207
207
  color: "white",
208
208
  filter: "drop-shadow(0 0 2px rgba(255,255,255,0.3))",
209
- } }), _jsx("span", { style: { letterSpacing: "0.025em" }, children: "G\u00E9n\u00E9ration..." })] })) : !isAuthReady ? (_jsxs(_Fragment, { children: [_jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2", ry: "2" }), _jsx("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })] }), children || _jsx("span", { children: "Connexion requise" })] })) : (_jsxs(_Fragment, { children: [_jsx(ImageIcon, { size: 18, style: {
209
+ } }), _jsx("span", { style: { letterSpacing: "0.025em" }, children: "G\u00E9n\u00E9ration..." })] })) : !isAuthReady ? (_jsxs(_Fragment, { children: [_jsx(Lock, { size: 18, style: {
210
+ color: "white",
211
+ filter: "drop-shadow(0 0 2px rgba(255,255,255,0.2))",
212
+ } }), children || _jsx("span", { children: "Connexion requise" })] })) : (_jsxs(_Fragment, { children: [_jsx(ImageIcon, { size: 18, style: {
210
213
  color: "white",
211
214
  filter: "drop-shadow(0 0 2px rgba(255,255,255,0.2))",
212
215
  } }), _jsx("span", { style: { letterSpacing: "0.025em" }, children: children || "Générer une image" })] })) }), isOpen && (_jsx(AiPromptPanel, { isOpen: isOpen, onClose: handleClosePanel, onSubmit: handleSubmit, uiMode: uiMode, enableModelManagement: true, modelCategory: "image", baseUrl: baseUrl, apiKey: apiKeyId, models: [] }))] }), showImageCard && generatedImage && (_jsxs("div", { className: "relative", style: {
@@ -1 +1 @@
1
- {"version":3,"file":"AiSelect.d.ts","sourceRoot":"","sources":["../../src/components/AiSelect.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAY,KAAK,oBAAoB,EAAE,MAAM,OAAO,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAQ5C,MAAM,WAAW,aACf,SACE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,EACzB,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC1D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC7B;AAED,wBAAgB,QAAQ,CAAC,EACvB,OAAO,EACP,QAAQ,EACR,MAAgB,EAChB,OAAO,EACP,KAAK,EACL,MAAM,EACN,YAAY,EACZ,aAAa,EACb,OAAO,EACP,OAAO,EACP,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,GAAG,WAAW,EACf,EAAE,aAAa,2CAqFf"}
1
+ {"version":3,"file":"AiSelect.d.ts","sourceRoot":"","sources":["../../src/components/AiSelect.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAY,KAAK,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAEnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAU5C,MAAM,WAAW,aACf,SACE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,EACzB,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC1D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC7B;AAED,wBAAgB,QAAQ,CAAC,EACvB,OAAO,EACP,QAAQ,EACR,MAAgB,EAChB,OAAO,EACP,KAAK,EACL,MAAM,EACN,YAAY,EACZ,aAAa,EACb,OAAO,EACP,OAAO,EACP,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,GAAG,WAAW,EACf,EAAE,aAAa,2CAwJf"}
@@ -1,23 +1,43 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
+ import { Sparkles, Lock } from "lucide-react";
4
5
  import { useAiCallText } from "../hooks/useAiCallText";
5
6
  import { useAiModels } from "../hooks/useAiModels";
6
7
  import { AiPromptPanel } from "./AiPromptPanel";
7
8
  import { UsageToast, useUsageToast } from "./UsageToast";
9
+ import { LBSigninModal } from "./LBSigninModal";
8
10
  import { aiStyles } from "../styles/inline";
9
11
  import { handleAIError } from "../utils/errorHandler";
12
+ import { useLB } from "../context/LBAuthProvider";
10
13
  export function AiSelect({ baseUrl, apiKeyId, uiMode = "modal", context, model, prompt, storeOutputs, artifactTitle, onValue, onToast, disabled, className, children, ...selectProps }) {
11
14
  const [isOpen, setIsOpen] = useState(false);
15
+ const [showAuthModal, setShowAuthModal] = useState(false);
12
16
  const [isFocused, setIsFocused] = useState(false);
13
17
  const { showUsageToast, toastData, toastKey, clearToast } = useUsageToast();
18
+ // Rendre l'authentification optionnelle
19
+ let lbStatus;
20
+ try {
21
+ const lbContext = useLB();
22
+ lbStatus = lbContext.status;
23
+ }
24
+ catch {
25
+ // LBProvider n'est pas disponible, ignorer
26
+ lbStatus = undefined;
27
+ }
14
28
  const { models } = useAiModels({
15
29
  baseUrl,
16
30
  apiKeyId,
17
31
  modelType: "text-or-language",
18
32
  });
19
33
  const { generateText, loading } = useAiCallText({ baseUrl, apiKeyId });
34
+ const isAuthReady = lbStatus === "ready" || Boolean(process.env.LB_API_KEY);
35
+ const shouldShowSparkles = isAuthReady && !disabled;
20
36
  const handleOpenPanel = () => {
37
+ if (!isAuthReady) {
38
+ setShowAuthModal(true);
39
+ return;
40
+ }
21
41
  setIsOpen(true);
22
42
  };
23
43
  const handleClosePanel = () => {
@@ -46,14 +66,30 @@ export function AiSelect({ baseUrl, apiKeyId, uiMode = "modal", context, model,
46
66
  setIsOpen(false);
47
67
  }
48
68
  };
49
- return (_jsxs("div", { style: { width: "100%" }, className: className, children: [_jsx("select", { ...selectProps, style: {
69
+ return (_jsxs("div", { style: { width: "100%", position: "relative" }, className: className, children: [_jsx("select", { ...selectProps, style: {
50
70
  ...aiStyles.select,
51
71
  ...(isFocused && aiStyles.selectFocus),
72
+ paddingRight: "40px", // Space for AI button
52
73
  }, onFocus: (e) => {
53
74
  setIsFocused(true);
54
75
  selectProps.onFocus?.(e);
55
76
  }, onBlur: (e) => {
56
77
  setIsFocused(false);
57
78
  selectProps.onBlur?.(e);
58
- }, disabled: disabled || loading, children: children }), isOpen && (_jsx(AiPromptPanel, { isOpen: isOpen, onClose: handleClosePanel, onSubmit: handleSubmit, uiMode: uiMode, models: models || [] })), Boolean(toastData) && (_jsx(UsageToast, { result: toastData, position: "bottom-right", onComplete: clearToast }, toastKey))] }));
79
+ }, disabled: disabled || loading, children: children }), _jsx("button", { onClick: handleOpenPanel, style: {
80
+ position: "absolute",
81
+ right: "8px",
82
+ top: "50%",
83
+ transform: "translateY(-50%)",
84
+ background: "none",
85
+ border: "none",
86
+ cursor: "pointer",
87
+ padding: "4px",
88
+ borderRadius: "4px",
89
+ display: "flex",
90
+ alignItems: "center",
91
+ color: shouldShowSparkles ? "#6366f1" : "#ef4444",
92
+ }, title: shouldShowSparkles
93
+ ? "Générer avec l'IA"
94
+ : "Se connecter pour utiliser l'IA", disabled: disabled || loading, children: loading ? (_jsx("svg", { style: aiStyles.spinner, width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: _jsx("path", { d: "M12 2v4m0 12v4M4.93 4.93l2.83 2.83m8.48 8.48l2.83 2.83M2 12h4m12 0h4M4.93 19.07l2.83-2.83m8.48-8.48l2.83-2.83" }) })) : shouldShowSparkles ? (_jsx(Sparkles, { size: 16 })) : (_jsx(Lock, { size: 16 })) }), isOpen && (_jsx(AiPromptPanel, { isOpen: isOpen, onClose: handleClosePanel, onSubmit: handleSubmit, uiMode: uiMode, models: models || [] })), Boolean(toastData) && (_jsx(UsageToast, { result: toastData, position: "bottom-right", onComplete: clearToast }, toastKey)), _jsx(LBSigninModal, { isOpen: showAuthModal, onClose: () => setShowAuthModal(false) })] }));
59
95
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AiStatusButton.d.ts","sourceRoot":"","sources":["../../src/components/AiStatusButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAoBtD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,OAAe,EACf,SAAc,GACf,EAAE,mBAAmB,2CAiiCrB"}
1
+ {"version":3,"file":"AiStatusButton.d.ts","sourceRoot":"","sources":["../../src/components/AiStatusButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAoBtD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,OAAe,EACf,SAAc,GACf,EAAE,mBAAmB,2CA8iCrB"}
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { useState, useRef, useLayoutEffect } from "react";
4
4
  import { createPortal } from "react-dom";
5
- import { BarChart3, Settings, FileText, History as HistoryIcon, FolderPlus, Power, LogOut, Key, RefreshCw, } from "lucide-react";
5
+ import { BarChart3, Settings, FileText, History as HistoryIcon, FolderPlus, Power, LogOut, Key, ArrowRightLeft, } from "lucide-react";
6
6
  import { aiStyles, calculateTooltipPosition } from "../styles/inline";
7
7
  import { useLB } from "../context/LBAuthProvider";
8
8
  import { useAiContext } from "../context/AiProvider";
@@ -16,6 +16,7 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
16
16
  let apiKeys = [];
17
17
  let accessToken;
18
18
  let selectApiKeyWithToken;
19
+ let lbApiStatus = null;
19
20
  try {
20
21
  const lbContext = useLB();
21
22
  lbStatus = lbContext.status;
@@ -24,6 +25,7 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
24
25
  apiKeys = lbContext.apiKeys || [];
25
26
  accessToken = lbContext.accessToken;
26
27
  selectApiKeyWithToken = lbContext.selectApiKeyWithToken;
28
+ lbApiStatus = lbContext.apiStatus;
27
29
  }
28
30
  catch {
29
31
  // LBProvider n'est pas disponible, ignorer
@@ -31,6 +33,8 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
31
33
  user = undefined;
32
34
  logout = undefined;
33
35
  }
36
+ // Utiliser le status du contexte LB si pas de prop status
37
+ const effectiveStatus = status || lbApiStatus;
34
38
  // Récupérer refetchProviders depuis AiProvider si disponible
35
39
  let refetchProviders;
36
40
  try {
@@ -74,8 +78,8 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
74
78
  const color = getUsageColor(percentage);
75
79
  return (_jsxs("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, children: [_jsx("circle", { cx: size / 2, cy: size / 2, r: radius, stroke: aiStyles.tooltipLabel.color, strokeWidth: stroke, fill: "transparent", opacity: 0.3 }), _jsx("circle", { cx: size / 2, cy: size / 2, r: radius, stroke: color, strokeWidth: stroke, fill: "transparent", strokeDasharray: circumference, strokeDashoffset: offset, strokeLinecap: "round", transform: `rotate(-90 ${size / 2} ${size / 2})` }), _jsxs("text", { x: size / 2, y: size / 2, textAnchor: "middle", dominantBaseline: "central", fontSize: "7px", fill: color, fontWeight: "600", children: [percentage.toFixed(0), "%"] })] }));
76
80
  };
77
- const balanceUsage = status?.balance;
78
- const storageUsage = status?.storage;
81
+ const balanceUsage = effectiveStatus?.balance;
82
+ const storageUsage = effectiveStatus?.storage;
79
83
  const balanceTotal = balanceUsage?.total ??
80
84
  safeNumber(balanceUsage?.purchased) + safeNumber(balanceUsage?.quota);
81
85
  const balanceUsed = balanceUsage?.used ?? balanceUsage?.total ?? 0;
@@ -176,7 +180,7 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
176
180
  ...aiStyles.statusButtonDisabled,
177
181
  }, className: className, disabled: true, children: _jsx("svg", { style: aiStyles.spinner, width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: _jsx("path", { d: "M12 2v4m0 12v4M4.93 4.93l2.83 2.83m8.48 8.48l2.83 2.83M2 12h4m12 0h4M4.93 19.07l2.83-2.83m8.48-8.48l2.83-2.83" }) }) }));
178
182
  }
179
- if (!status) {
183
+ if (!effectiveStatus) {
180
184
  // Si pas de statut API et pas de LBProvider, afficher message simple
181
185
  if (!lbStatus && lbStatus !== "ready") {
182
186
  return (_jsxs("div", { style: { position: "relative", display: "inline-block" }, children: [_jsx("button", { ref: buttonRef, style: {
@@ -213,7 +217,7 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
213
217
  gap: "8px",
214
218
  borderTop: "1px solid var(--ai-border-primary, #374151)",
215
219
  paddingTop: "12px",
216
- }, children: [_jsx("button", { onClick: () => window.open("https://prompt.lastbrain.io/metrics", "_blank"), style: {
220
+ }, children: [_jsx("button", { onClick: () => window.open("https://prompt.lastbrain.io/auth/dashboard", "_blank"), style: {
217
221
  flex: 1,
218
222
  background: "transparent",
219
223
  border: "none",
@@ -232,7 +236,7 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
232
236
  Object.assign(e.currentTarget.style, {
233
237
  background: "transparent",
234
238
  });
235
- }, title: "View Metrics", children: _jsx(BarChart3, { size: 18 }) }), _jsx("button", { onClick: () => window.open("https://prompt.lastbrain.io/settings", "_blank"), style: {
239
+ }, title: "View Metrics", children: _jsx(BarChart3, { size: 18 }) }), _jsx("button", { onClick: () => window.open("https://prompt.lastbrain.io/auth/ai/settings", "_blank"), style: {
236
240
  flex: 1,
237
241
  background: "transparent",
238
242
  border: "none",
@@ -251,7 +255,7 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
251
255
  Object.assign(e.currentTarget.style, {
252
256
  background: "transparent",
253
257
  });
254
- }, title: "Settings", children: _jsx(Settings, { size: 18 }) }), _jsx("button", { onClick: () => window.open("https://prompt.lastbrain.io/auth/prompts", "_blank"), style: {
258
+ }, title: "Settings", children: _jsx(Settings, { size: 18 }) }), _jsx("button", { onClick: () => window.open("https://prompt.lastbrain.io/auth/ai/prompts", "_blank"), style: {
255
259
  flex: 1,
256
260
  background: "transparent",
257
261
  border: "none",
@@ -318,7 +322,6 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
318
322
  background: "transparent",
319
323
  });
320
324
  }, title: "Logout", children: _jsx(Power, { size: 18 }) })] })] })) : (_jsxs(_Fragment, { children: [_jsx("div", { style: aiStyles.tooltipHeader, children: "LastBrain Authentication" }), _jsx("div", { style: {
321
- ...aiStyles.tooltipSection,
322
325
  paddingBottom: "12px",
323
326
  }, children: _jsx("p", { style: {
324
327
  margin: 0,
@@ -358,7 +361,7 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
358
361
  ...aiStyles.tooltip,
359
362
  ...tooltipPosition,
360
363
  zIndex: 50,
361
- }, onMouseEnter: () => setShowTooltip(true), onMouseLeave: handleMouseLeave, children: [_jsx("div", { style: aiStyles.tooltipHeader, children: "API Status" }), status.user?.email && (_jsx("div", { style: {
364
+ }, onMouseEnter: () => setShowTooltip(true), onMouseLeave: handleMouseLeave, children: [_jsx("div", { style: aiStyles.tooltipHeader, children: "API Status" }), effectiveStatus.user?.email && (_jsx("div", { style: {
362
365
  ...aiStyles.tooltipSection,
363
366
  ...aiStyles.tooltipSectionFirst,
364
367
  }, children: _jsxs("div", { style: aiStyles.tooltipRow, children: [_jsx("span", { style: aiStyles.tooltipLabel, children: "User:" }), _jsx("span", { style: {
@@ -367,15 +370,20 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
367
370
  maxWidth: "200px",
368
371
  overflow: "hidden",
369
372
  textOverflow: "ellipsis",
370
- }, children: status.user.email })] }) })), _jsxs("div", { style: {
373
+ }, children: effectiveStatus.user.email })] }) })), _jsxs("div", { style: {
371
374
  ...aiStyles.tooltipSection,
372
- ...(status.user?.email ? {} : aiStyles.tooltipSectionFirst),
375
+ ...(effectiveStatus.user?.email
376
+ ? {}
377
+ : aiStyles.tooltipSectionFirst),
373
378
  }, children: [_jsxs("div", { style: aiStyles.tooltipRow, children: [_jsx("span", { style: aiStyles.tooltipLabel, children: "API Key:" }), _jsxs("div", { style: {
374
379
  display: "flex",
375
380
  alignItems: "center",
376
381
  gap: "8px",
377
- }, children: [_jsx("span", { style: aiStyles.tooltipValue, children: status.apiKey?.name || status.api_key?.name || "Unknown" }), apiKeys.length > 1 && selectApiKeyWithToken && (_jsx("button", { onClick: (e) => {
382
+ }, children: [_jsx("span", { style: aiStyles.tooltipValue, children: effectiveStatus.apiKey?.name ||
383
+ effectiveStatus.api_key?.name ||
384
+ "Unknown" }), selectApiKeyWithToken && (_jsx("button", { onClick: (e) => {
378
385
  e.stopPropagation();
386
+ setShowTooltip(false);
379
387
  setShowApiKeySelector(true);
380
388
  }, style: {
381
389
  background: "rgba(139, 92, 246, 0.1)",
@@ -399,9 +407,11 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
399
407
  "rgba(139, 92, 246, 0.1)";
400
408
  e.currentTarget.style.borderColor =
401
409
  "rgba(139, 92, 246, 0.3)";
402
- }, title: "Change API Key", children: _jsx(RefreshCw, { size: 12, style: { color: "rgba(139, 92, 246, 1)" } }) }))] })] }), _jsxs("div", { style: aiStyles.tooltipRow, children: [_jsx("span", { style: aiStyles.tooltipLabel, children: "Env:" }), _jsx("span", { style: aiStyles.tooltipValue, children: status.apiKey?.env || status.api_key?.env || "N/A" })] }), _jsxs("div", { style: aiStyles.tooltipRow, children: [_jsx("span", { style: aiStyles.tooltipLabel, children: "Rate Limit:" }), _jsxs("span", { style: aiStyles.tooltipValue, children: [status.apiKey?.rate_limit_rpm ||
403
- status.api_key?.rate_limit_rpm ||
404
- 0, " ", "req/min"] })] })] }), _jsxs("div", { style: aiStyles.tooltipSection, children: [_jsx("div", { style: aiStyles.tooltipSubtitle, children: "Balance" }), _jsxs("div", { style: aiStyles.tooltipRow, children: [_jsx("span", { style: aiStyles.tooltipLabel, children: "Total:" }), _jsxs("span", { style: aiStyles.tooltipValue, children: ["$", formatFixed(balanceUsed, 6), " / $", formatNumber(balanceTotal)] }), renderUsageCircle(balancePercentage)] })] }), _jsxs("div", { style: aiStyles.tooltipSection, children: [_jsx("div", { style: aiStyles.tooltipSubtitle, children: "Storage" }), _jsxs("div", { style: aiStyles.tooltipRow, children: [_jsx("span", { style: aiStyles.tooltipLabel, children: "Total:" }), _jsxs("span", { style: aiStyles.tooltipValue, children: [formatStorage(storageUsed), " /", " ", formatStorage(storageAllocated)] }), renderUsageCircle(storagePercentage)] })] }), _jsxs("div", { style: {
410
+ }, title: "Change API Key", children: _jsx(ArrowRightLeft, { size: 12, style: { color: "rgba(139, 92, 246, 1)" } }) }))] })] }), _jsxs("div", { style: aiStyles.tooltipRow, children: [_jsx("span", { style: aiStyles.tooltipLabel, children: "Env:" }), _jsx("span", { style: aiStyles.tooltipValue, children: effectiveStatus.apiKey?.env ||
411
+ effectiveStatus.api_key?.env ||
412
+ "N/A" })] }), _jsxs("div", { style: aiStyles.tooltipRow, children: [_jsx("span", { style: aiStyles.tooltipLabel, children: "Rate Limit:" }), _jsxs("span", { style: aiStyles.tooltipValue, children: [effectiveStatus.apiKey?.rate_limit_rpm ||
413
+ effectiveStatus.api_key?.rate_limit_rpm ||
414
+ 0, " ", "req/min"] })] })] }), _jsxs("div", { style: aiStyles.tooltipSection, children: [_jsx("div", { style: aiStyles.tooltipSubtitle, children: "Wallet" }), _jsxs("div", { style: aiStyles.tooltipRow, children: [_jsx("span", { style: aiStyles.tooltipLabel, children: "Total:" }), _jsxs("span", { style: aiStyles.tooltipValue, children: ["$", formatFixed(balanceUsed, 6), " / $", formatNumber(balanceTotal)] }), renderUsageCircle(balancePercentage)] })] }), _jsxs("div", { style: aiStyles.tooltipSection, children: [_jsx("div", { style: aiStyles.tooltipSubtitle, children: "Storage" }), _jsxs("div", { style: aiStyles.tooltipRow, children: [_jsx("span", { style: aiStyles.tooltipLabel, children: "Total:" }), _jsxs("span", { style: aiStyles.tooltipValue, children: [formatStorage(storageUsed), " /", " ", formatStorage(storageAllocated)] }), renderUsageCircle(storagePercentage)] })] }), _jsxs("div", { style: {
405
415
  ...aiStyles.tooltipActions,
406
416
  width: "100%",
407
417
  flexDirection: "row",
@@ -509,6 +519,7 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
509
519
  justifyContent: "center",
510
520
  color: "#8b5cf6",
511
521
  transition: "all 0.2s ease",
522
+ borderRadius: "4px",
512
523
  }, onMouseEnter: (e) => {
513
524
  Object.assign(e.currentTarget.style, {
514
525
  background: "rgba(139, 92, 246, 0.1)",
@@ -539,6 +550,7 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
539
550
  justifyContent: "center",
540
551
  color: "#ef4444",
541
552
  transition: "all 0.2s ease",
553
+ borderRadius: "4px",
542
554
  }, onMouseEnter: (e) => {
543
555
  Object.assign(e.currentTarget.style, {
544
556
  background: "rgba(239, 68, 68, 0.1)",
@@ -1 +1 @@
1
- {"version":3,"file":"AiTextarea.d.ts","sourceRoot":"","sources":["../../src/components/AiTextarea.tsx"],"names":[],"mappings":"AAEA,OAAc,EAIZ,KAAK,sBAAsB,EAC5B,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAU5C,MAAM,WAAW,eACf,SACE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,EACzB,IAAI,CAAC,sBAAsB,CAAC,mBAAmB,CAAC,EAAE,SAAS,CAAC;IAC9D,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC7B;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,QAAQ,EACR,MAAgB,EAChB,OAAO,EACP,KAAK,EACL,MAAM,EACN,QAAgB,EAChB,qBAAqB,EACrB,YAAY,EACZ,aAAa,EACb,OAAO,EACP,OAAO,EACP,QAAQ,EACR,SAAS,EACT,GAAG,aAAa,EACjB,EAAE,eAAe,2CA0OjB"}
1
+ {"version":3,"file":"AiTextarea.d.ts","sourceRoot":"","sources":["../../src/components/AiTextarea.tsx"],"names":[],"mappings":"AAEA,OAAc,EAIZ,KAAK,sBAAsB,EAC5B,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAU5C,MAAM,WAAW,eACf,SACE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,EACzB,IAAI,CAAC,sBAAsB,CAAC,mBAAmB,CAAC,EAAE,SAAS,CAAC;IAC9D,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC7B;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,QAAQ,EACR,MAAgB,EAChB,OAAO,EACP,KAAK,EACL,MAAM,EACN,QAAgB,EAChB,qBAAqB,EACrB,YAAY,EACZ,aAAa,EACb,OAAO,EACP,OAAO,EACP,QAAQ,EACR,SAAS,EACT,GAAG,aAAa,EACjB,EAAE,eAAe,2CAgOjB"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState, useRef, useLayoutEffect, } from "react";
4
- import { Sparkles } from "lucide-react";
4
+ import { Sparkles, Lock } from "lucide-react";
5
5
  import { useAiCallText } from "../hooks/useAiCallText";
6
6
  import { useAiModels } from "../hooks/useAiModels";
7
7
  import { AiPromptPanel } from "./AiPromptPanel";
@@ -146,5 +146,5 @@ export function AiTextarea({ baseUrl, apiKeyId, uiMode = "modal", context, model
146
146
  ? "Authentication required"
147
147
  : hasConfiguration
148
148
  ? "Generate with AI"
149
- : "Setup AI", children: loading ? (_jsx("svg", { style: aiStyles.spinner, width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: _jsx("path", { d: "M12 2v4m0 12v4M4.93 4.93l2.83 2.83m8.48 8.48l2.83 2.83M2 12h4m12 0h4M4.93 19.07l2.83-2.83m8.48-8.48l2.83-2.83" }) })) : shouldShowSparkles ? (_jsx(Sparkles, { size: 16 })) : (_jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2", ry: "2" }), _jsx("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })] })) }), isOpen && (_jsx(AiPromptPanel, { isOpen: isOpen, onClose: handleClosePanel, onSubmit: handleSubmit, uiMode: uiMode, models: [], modelCategory: "text", sourceText: textareaValue || undefined, baseUrl: baseUrl, apiKey: apiKeyId, enableModelManagement: enableModelManagement })), Boolean(toastData) && (_jsx(UsageToast, { result: toastData, position: "bottom-right", onComplete: clearToast }, toastKey)), _jsx(LBSigninModal, { isOpen: showAuthModal, onClose: () => setShowAuthModal(false) })] }));
149
+ : "Setup AI", children: loading ? (_jsx("svg", { style: aiStyles.spinner, width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: _jsx("path", { d: "M12 2v4m0 12v4M4.93 4.93l2.83 2.83m8.48 8.48l2.83 2.83M2 12h4m12 0h4M4.93 19.07l2.83-2.83m8.48-8.48l2.83-2.83" }) })) : shouldShowSparkles ? (_jsx(Sparkles, { size: 16 })) : (_jsx(Lock, { size: 16 })) }), isOpen && (_jsx(AiPromptPanel, { isOpen: isOpen, onClose: handleClosePanel, onSubmit: handleSubmit, uiMode: uiMode, models: [], modelCategory: "text", sourceText: textareaValue || undefined, baseUrl: baseUrl, apiKey: apiKeyId, enableModelManagement: enableModelManagement })), Boolean(toastData) && (_jsx(UsageToast, { result: toastData, position: "bottom-right", onComplete: clearToast }, toastKey)), _jsx(LBSigninModal, { isOpen: showAuthModal, onClose: () => setShowAuthModal(false) })] }));
150
150
  }
@@ -39,12 +39,12 @@ export function LBApiKeySelector({ apiKeys, onSelect, onCancel, isOpen, }) {
39
39
  left: 0,
40
40
  right: 0,
41
41
  bottom: 0,
42
- background: "var(--ai-overlay-bg, rgba(0, 0, 0, 0.75))",
42
+ background: "rgba(0, 0, 0, 0.75)",
43
43
  backdropFilter: "blur(8px)",
44
44
  } }), _jsxs("div", { style: {
45
45
  position: "relative",
46
- background: "var(--ai-modal-bg, #1f2937)",
47
- border: "1px solid var(--ai-border-primary, #374151)",
46
+ background: "light-dark(#ffffff, #1e293b)",
47
+ border: "1px solid light-dark(#e2e8f0, #334155)",
48
48
  borderRadius: "12px",
49
49
  padding: "24px",
50
50
  maxWidth: "500px",
@@ -54,12 +54,12 @@ export function LBApiKeySelector({ apiKeys, onSelect, onCancel, isOpen, }) {
54
54
  margin: "0 0 8px 0",
55
55
  fontSize: "20px",
56
56
  fontWeight: 600,
57
- color: "var(--ai-text-primary, #f9fafb)",
57
+ color: "light-dark(#1e293b, #f8fafc)",
58
58
  textAlign: "center",
59
59
  }, children: "S\u00E9lectionnez une cl\u00E9 API" }), _jsx("p", { style: {
60
60
  margin: "0 0 24px 0",
61
61
  fontSize: "14px",
62
- color: "var(--ai-text-secondary, #9ca3af)",
62
+ color: "light-dark(#64748b, #94a3b8)",
63
63
  textAlign: "center",
64
64
  lineHeight: "1.5",
65
65
  }, children: "Choisissez la cl\u00E9 API \u00E0 utiliser pour vos requ\u00EAtes IA" }), _jsxs("form", { onSubmit: handleSubmit, children: [_jsx("div", { style: {
@@ -77,11 +77,11 @@ export function LBApiKeySelector({ apiKeys, onSelect, onCancel, isOpen, }) {
77
77
  alignItems: "center",
78
78
  padding: "12px 16px",
79
79
  background: isSelected
80
- ? "var(--ai-input-bg-focus, #374151)"
81
- : "var(--ai-input-bg, #111827)",
80
+ ? "light-dark(#f1f5f9, #334155)"
81
+ : "light-dark(#f8fafc, #0f172a)",
82
82
  border: `2px solid ${isSelected
83
- ? "var(--ai-accent-primary, #8b5cf6)"
84
- : "var(--ai-border-primary, #374151)"}`,
83
+ ? "#8b5cf6"
84
+ : "light-dark(#e2e8f0, #334155)"}`,
85
85
  borderRadius: "8px",
86
86
  cursor: isActive ? "pointer" : "not-allowed",
87
87
  opacity: isActive ? 1 : 0.5,
@@ -89,29 +89,29 @@ export function LBApiKeySelector({ apiKeys, onSelect, onCancel, isOpen, }) {
89
89
  }, onMouseEnter: (e) => {
90
90
  if (isActive && !isSelected) {
91
91
  e.currentTarget.style.borderColor =
92
- "var(--ai-border-hover, #4b5563)";
92
+ "light-dark(#cbd5e1, #475569)";
93
93
  e.currentTarget.style.background =
94
- "var(--ai-input-bg-focus, #374151)";
94
+ "light-dark(#f1f5f9, #334155)";
95
95
  }
96
96
  }, onMouseLeave: (e) => {
97
97
  if (isActive && !isSelected) {
98
98
  e.currentTarget.style.borderColor =
99
- "var(--ai-border-primary, #374151)";
99
+ "light-dark(#e2e8f0, #334155)";
100
100
  e.currentTarget.style.background =
101
- "var(--ai-input-bg, #111827)";
101
+ "light-dark(#f8fafc, #0f172a)";
102
102
  }
103
103
  }, children: [_jsx("input", { type: "radio", name: "apiKey", value: key.id, checked: isSelected, disabled: !isActive, onChange: (e) => setSelectedKeyId(e.target.value), style: {
104
104
  marginRight: "12px",
105
- accentColor: "var(--ai-accent-primary, #8b5cf6)",
105
+ accentColor: "#8b5cf6",
106
106
  cursor: isActive ? "pointer" : "not-allowed",
107
107
  } }), _jsxs("div", { style: { flex: 1 }, children: [_jsx("div", { style: {
108
108
  fontSize: "14px",
109
109
  fontWeight: 500,
110
- color: "var(--ai-text-primary, #f9fafb)",
110
+ color: "light-dark(#1e293b, #f8fafc)",
111
111
  marginBottom: "4px",
112
112
  }, children: key.name }), _jsx("div", { style: {
113
113
  fontSize: "12px",
114
- color: "var(--ai-text-secondary, #9ca3af)",
114
+ color: "light-dark(#64748b, #94a3b8)",
115
115
  fontFamily: "monospace",
116
116
  }, children: key.keyPrefix || key.id.substring(0, 12) + "..." })] }), isActive ? (_jsx("div", { style: {
117
117
  fontSize: "11px",
@@ -143,9 +143,9 @@ export function LBApiKeySelector({ apiKeys, onSelect, onCancel, isOpen, }) {
143
143
  flex: 1,
144
144
  padding: "12px",
145
145
  background: "transparent",
146
- border: "1px solid var(--ai-border-primary, #374151)",
146
+ border: "1px solid light-dark(#e2e8f0, #334155)",
147
147
  borderRadius: "8px",
148
- color: "var(--ai-text-secondary, #9ca3af)",
148
+ color: "light-dark(#64748b, #94a3b8)",
149
149
  fontSize: "14px",
150
150
  fontWeight: 600,
151
151
  cursor: loading ? "not-allowed" : "pointer",
@@ -154,21 +154,21 @@ export function LBApiKeySelector({ apiKeys, onSelect, onCancel, isOpen, }) {
154
154
  }, onMouseEnter: (e) => {
155
155
  if (!loading) {
156
156
  e.currentTarget.style.background =
157
- "var(--ai-input-bg, #111827)";
157
+ "light-dark(#f8fafc, #0f172a)";
158
158
  e.currentTarget.style.borderColor =
159
- "var(--ai-border-hover, #4b5563)";
159
+ "light-dark(#cbd5e1, #475569)";
160
160
  }
161
161
  }, onMouseLeave: (e) => {
162
162
  if (!loading) {
163
163
  e.currentTarget.style.background = "transparent";
164
164
  e.currentTarget.style.borderColor =
165
- "var(--ai-border-primary, #374151)";
165
+ "light-dark(#e2e8f0, #334155)";
166
166
  }
167
167
  }, children: "Annuler" }), _jsx("button", { type: "submit", disabled: loading || !selectedKeyId, style: {
168
168
  flex: 1,
169
169
  padding: "12px",
170
170
  background: loading
171
- ? "var(--ai-input-bg, #111827)"
171
+ ? "light-dark(#e2e8f0, #0f172a)"
172
172
  : "linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%)",
173
173
  border: "none",
174
174
  borderRadius: "8px",
@@ -1 +1 @@
1
- {"version":3,"file":"LBSigninModal.d.ts","sourceRoot":"","sources":["../../src/components/LBSigninModal.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,kBAAkB,kDA8bpE"}
1
+ {"version":3,"file":"LBSigninModal.d.ts","sourceRoot":"","sources":["../../src/components/LBSigninModal.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,kBAAkB,kDAojBpE"}