@lastbrain/ai-ui-react 1.0.41 → 1.0.43

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":"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,SAAS,EACT,QAAQ,EACR,gBAA0C,EAC1C,YAAY,EACZ,aAAa,EACb,OAAO,EAAE,QAAQ,EACjB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,OAAO,EACf,GAAG,WAAW,EACf,EAAE,oBAAoB,2CA2hBtB"}
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,SAAS,EACT,QAAQ,EACR,gBAA0C,EAC1C,YAAY,EACZ,aAAa,EACb,OAAO,EAAE,QAAQ,EACjB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,OAAO,EACf,GAAG,WAAW,EACf,EAAE,oBAAoB,2CAqiBtB"}
@@ -10,7 +10,7 @@ import { aiStyles } from "../styles/inline";
10
10
  import { useAiContext } from "../context/AiProvider";
11
11
  import { handleAIError } from "../utils/errorHandler";
12
12
  import { useLB } from "../context/LBAuthProvider";
13
- import { LBAuthModal } from "./LBConnectButton";
13
+ import { LBSigninModal } from "./LBSigninModal";
14
14
  export function AiContextButton({ baseUrl: propBaseUrl, apiKeyId: propApiKeyId, uiMode = "modal", contextData, contextDescription = "Données à analyser", onResult, onToast, disabled, className, children, resultModalTitle = "Résultat de l'analyse", storeOutputs, artifactTitle, context: _context, model: _model, prompt: _prompt, ...buttonProps }) {
15
15
  const [isOpen, setIsOpen] = useState(false);
16
16
  const [showAuthModal, setShowAuthModal] = useState(false);
@@ -18,7 +18,16 @@ export function AiContextButton({ baseUrl: propBaseUrl, apiKeyId: propApiKeyId,
18
18
  const [analysisResult, setAnalysisResult] = useState(null);
19
19
  const { showUsageToast, toastData, toastKey, clearToast } = useUsageToast();
20
20
  const { showErrorToast, errorData, errorKey, clearError } = useErrorToast();
21
- const { status: lbStatus } = useLB();
21
+ // Rendre l'authentification optionnelle
22
+ let lbStatus;
23
+ try {
24
+ const lbContext = useLB();
25
+ lbStatus = lbContext.status;
26
+ }
27
+ catch {
28
+ // LBProvider n'est pas disponible, ignorer
29
+ lbStatus = undefined;
30
+ }
22
31
  // Récupérer le contexte AiProvider avec fallback sur les props
23
32
  const aiContext = useAiContext();
24
33
  const baseUrl = propBaseUrl ?? aiContext.baseUrl;
@@ -345,5 +354,5 @@ Analyse ces données et réponds de manière structurée et claire.`;
345
354
  ...getThemeStyles().content,
346
355
  }, children: [_jsxs("span", { children: ["Co\u00FBt: $", (apiKeyId?.includes("dev")
347
356
  ? 0
348
- : analysisResult.cost).toFixed(6)] }), _jsxs("span", { children: ["ID: ", analysisResult.requestId?.slice(-8) || "N/A"] })] }) })] })] }) }) })), showAuthModal && (_jsx(LBAuthModal, { onClose: () => setShowAuthModal(false) })), _jsx(ErrorToast, { error: errorData, onComplete: clearError }, errorKey)] }));
357
+ : analysisResult.cost).toFixed(6)] }), _jsxs("span", { children: ["ID: ", analysisResult.requestId?.slice(-8) || "N/A"] })] }) })] })] }) }) })), _jsx(LBSigninModal, { isOpen: showAuthModal, onClose: () => setShowAuthModal(false) }), _jsx(ErrorToast, { error: errorData, onComplete: clearError }, errorKey)] }));
349
358
  }
@@ -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;CACnB;AAED,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,YAAY,EACtB,MAAgB,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,2CAsZpB"}
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;CACnB;AAED,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,YAAY,EACtB,MAAgB,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,2CAgapB"}
@@ -10,14 +10,23 @@ import { aiStyles } from "../styles/inline";
10
10
  import { useAiContext } from "../context/AiProvider";
11
11
  import { handleAIError } from "../utils/errorHandler";
12
12
  import { useLB } from "../context/LBAuthProvider";
13
- import { LBAuthModal } from "./LBConnectButton";
13
+ import { LBSigninModal } from "./LBSigninModal";
14
14
  export function AiImageButton({ baseUrl: propBaseUrl, apiKeyId: propApiKeyId, uiMode = "modal", context: _context, model: _model, prompt: _prompt, onImage, onToast, disabled, className, children, showImageCard = true, onImageSave, storeOutputs, artifactTitle, ...buttonProps }) {
15
15
  const [isOpen, setIsOpen] = useState(false);
16
16
  const [showAuthModal, setShowAuthModal] = useState(false);
17
17
  const [generatedImage, setGeneratedImage] = useState(null);
18
18
  const { showUsageToast, toastData, toastKey, clearToast } = useUsageToast();
19
19
  const { showErrorToast, errorData, errorKey, clearError } = useErrorToast();
20
- const { status: lbStatus } = useLB();
20
+ // Rendre l'authentification optionnelle
21
+ let lbStatus;
22
+ try {
23
+ const lbContext = useLB();
24
+ lbStatus = lbContext.status;
25
+ }
26
+ catch {
27
+ // LBProvider n'est pas disponible, ignorer
28
+ lbStatus = undefined;
29
+ }
21
30
  // Récupérer le contexte AiProvider avec fallback sur les props
22
31
  const aiContext = useAiContext();
23
32
  const baseUrl = propBaseUrl ?? aiContext.baseUrl;
@@ -244,5 +253,5 @@ export function AiImageButton({ baseUrl: propBaseUrl, apiKeyId: propApiKeyId, ui
244
253
  e.currentTarget.style.boxShadow = "";
245
254
  }, title: "T\u00E9l\u00E9charger l'image", children: [_jsx(Download, { size: 16 }), "T\u00E9l\u00E9charger l'image"] }), onImageSave && (_jsxs("button", { onClick: handleSave, className: "flex items-center gap-1 px-3 py-2 text-xs font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-lg transition-colors", title: "Sauvegarder en base", children: [_jsx(ExternalLink, { size: 14 }), "Sauvegarder"] }))] }), _jsx("div", { className: "mt-3 pt-3 text-xs", style: {
246
255
  ...getThemeStyles().metadata,
247
- }, children: _jsx("div", { className: "flex justify-center", children: _jsxs("span", { children: ["ID: ", generatedImage.requestId.slice(-8)] }) }) })] })), showAuthModal && (_jsx(LBAuthModal, { onClose: () => setShowAuthModal(false) })), _jsx(ErrorToast, { error: errorData, onComplete: clearError }, errorKey)] }));
256
+ }, children: _jsx("div", { className: "flex justify-center", children: _jsxs("span", { children: ["ID: ", generatedImage.requestId.slice(-8)] }) }) })] })), _jsx(LBSigninModal, { isOpen: showAuthModal, onClose: () => setShowAuthModal(false) }), _jsx(ErrorToast, { error: errorData, onComplete: clearError }, errorKey)] }));
248
257
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AiInput.d.ts","sourceRoot":"","sources":["../../src/components/AiInput.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAoB,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAU5C,MAAM,WAAW,YACf,SACE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,EACzB,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,SAAS,CAAC;IACxD,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC5B,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,wBAAgB,OAAO,CAAC,EACtB,OAAO,EACP,QAAQ,EACR,MAAgB,EAChB,OAAO,EACP,KAAK,EACL,MAAM,EACN,QAAgB,EAChB,qBAA4B,EAC5B,YAAY,EACZ,aAAa,EACb,OAAO,EACP,OAAO,EACP,QAAQ,EACR,SAAS,EACT,GAAG,UAAU,EACd,EAAE,YAAY,2CA+Md"}
1
+ {"version":3,"file":"AiInput.d.ts","sourceRoot":"","sources":["../../src/components/AiInput.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAoB,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAU5C,MAAM,WAAW,YACf,SACE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,EACzB,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,SAAS,CAAC;IACxD,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC5B,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,wBAAgB,OAAO,CAAC,EACtB,OAAO,EACP,QAAQ,EACR,MAAgB,EAChB,OAAO,EACP,KAAK,EACL,MAAM,EACN,QAAgB,EAChB,qBAA4B,EAC5B,YAAY,EACZ,aAAa,EACb,OAAO,EACP,OAAO,EACP,QAAQ,EACR,SAAS,EACT,GAAG,UAAU,EACd,EAAE,YAAY,2CAyNd"}
@@ -9,7 +9,7 @@ import { UsageToast, useUsageToast } from "./UsageToast";
9
9
  import { aiStyles } from "../styles/inline";
10
10
  import { handleAIError } from "../utils/errorHandler";
11
11
  import { useLB } from "../context/LBAuthProvider";
12
- import { LBAuthModal } from "./LBConnectButton";
12
+ import { LBSigninModal } from "./LBSigninModal";
13
13
  export function AiInput({ baseUrl, apiKeyId, uiMode = "modal", context, model, prompt, editMode = false, enableModelManagement = true, storeOutputs, artifactTitle, onValue, onToast, disabled, className, ...inputProps }) {
14
14
  const [isOpen, setIsOpen] = useState(false);
15
15
  const [showAuthModal, setShowAuthModal] = useState(false);
@@ -18,7 +18,16 @@ export function AiInput({ baseUrl, apiKeyId, uiMode = "modal", context, model, p
18
18
  const [isButtonHovered, setIsButtonHovered] = useState(false);
19
19
  const inputRef = useRef(null);
20
20
  const { showUsageToast, toastData, toastKey, clearToast } = useUsageToast();
21
- const { status: lbStatus } = useLB();
21
+ // Rendre l'authentification optionnelle
22
+ let lbStatus;
23
+ try {
24
+ const lbContext = useLB();
25
+ lbStatus = lbContext.status;
26
+ }
27
+ catch {
28
+ // LBProvider n'est pas disponible, ignorer
29
+ lbStatus = undefined;
30
+ }
22
31
  const { models } = useAiModels({
23
32
  baseUrl,
24
33
  apiKeyId,
@@ -123,5 +132,5 @@ export function AiInput({ baseUrl, apiKeyId, uiMode = "modal", context, model, p
123
132
  ? "Authentication required"
124
133
  : hasConfiguration
125
134
  ? "Generate with AI"
126
- : "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: inputValue || undefined, apiKey: apiKeyId, baseUrl: baseUrl, enableModelManagement: enableModelManagement })), showAuthModal && (_jsx(LBAuthModal, { onClose: () => setShowAuthModal(false) })), Boolean(toastData) && (_jsx(UsageToast, { result: toastData, position: "bottom-right", onComplete: clearToast }, toastKey))] }));
135
+ : "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: inputValue || undefined, apiKey: apiKeyId, baseUrl: baseUrl, enableModelManagement: enableModelManagement })), _jsx(LBSigninModal, { isOpen: showAuthModal, onClose: () => setShowAuthModal(false) }), Boolean(toastData) && (_jsx(UsageToast, { result: toastData, position: "bottom-right", onComplete: clearToast }, toastKey))] }));
127
136
  }
@@ -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;AAYtD,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,2CAiiBrB"}
1
+ {"version":3,"file":"AiStatusButton.d.ts","sourceRoot":"","sources":["../../src/components/AiStatusButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAetD,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,2CA41BrB"}
@@ -1,10 +1,29 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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, } from "lucide-react";
5
+ import { BarChart3, Settings, FileText, History as HistoryIcon, FolderPlus, Power, } from "lucide-react";
6
6
  import { aiStyles, calculateTooltipPosition } from "../styles/inline";
7
+ import { useLB } from "../context/LBAuthProvider";
8
+ import { LBSigninModal } from "./LBSigninModal";
7
9
  export function AiStatusButton({ status, loading = false, className = "", }) {
10
+ // Rendre l'authentification optionnelle
11
+ let lbStatus;
12
+ let user;
13
+ let logout;
14
+ try {
15
+ const lbContext = useLB();
16
+ lbStatus = lbContext.status;
17
+ user = lbContext.user;
18
+ logout = lbContext.logout;
19
+ }
20
+ catch {
21
+ // LBProvider n'est pas disponible, ignorer
22
+ lbStatus = undefined;
23
+ user = undefined;
24
+ logout = undefined;
25
+ }
26
+ const [showSigninModal, setShowSigninModal] = useState(false);
8
27
  const formatNumber = (value) => typeof value === "number" ? value.toLocaleString() : "0";
9
28
  const formatFixed = (value, digits) => typeof value === "number" ? value.toFixed(digits) : "0.00";
10
29
  const formatStorage = (valueMb) => {
@@ -139,17 +158,172 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
139
158
  }, 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" }) }) }));
140
159
  }
141
160
  if (!status) {
142
- return (_jsxs("div", { style: { position: "relative", display: "inline-block" }, children: [_jsx("button", { ref: buttonRef, style: {
143
- ...aiStyles.statusButton,
144
- color: "#ef4444",
145
- ...(isHovered && aiStyles.statusButtonHover),
146
- }, className: className, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: _jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: _jsx("polyline", { points: "22 12 18 12 15 21 9 3 6 12 2 12" }) }) }), showTooltip &&
147
- canPortal &&
148
- createPortal(_jsx("div", { ref: tooltipRef, style: {
149
- ...aiStyles.tooltip,
150
- ...tooltipPosition,
151
- zIndex: 50,
152
- }, onMouseEnter: () => setShowTooltip(true), onMouseLeave: handleMouseLeave, children: "No status available" }), document.body)] }));
161
+ // Si pas de statut API et pas de LBProvider, afficher message simple
162
+ if (!lbStatus && lbStatus !== "ready") {
163
+ return (_jsxs("div", { style: { position: "relative", display: "inline-block" }, children: [_jsx("button", { ref: buttonRef, style: {
164
+ ...aiStyles.statusButton,
165
+ color: "#ef4444",
166
+ ...(isHovered && aiStyles.statusButtonHover),
167
+ }, className: className, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: _jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: _jsx("polyline", { points: "22 12 18 12 15 21 9 3 6 12 2 12" }) }) }), showTooltip &&
168
+ canPortal &&
169
+ createPortal(_jsx("div", { ref: tooltipRef, style: {
170
+ ...aiStyles.tooltip,
171
+ ...tooltipPosition,
172
+ zIndex: 50,
173
+ }, onMouseEnter: () => setShowTooltip(true), onMouseLeave: handleMouseLeave, children: "No status available" }), document.body)] }));
174
+ }
175
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { style: { position: "relative", display: "inline-block" }, children: [_jsx("button", { ref: buttonRef, style: {
176
+ ...aiStyles.statusButton,
177
+ color: lbStatus === "ready" ? "#10b981" : "#ef4444",
178
+ ...(isHovered && aiStyles.statusButtonHover),
179
+ }, className: className, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onClick: () => {
180
+ if (lbStatus !== "ready") {
181
+ setShowSigninModal(true);
182
+ }
183
+ }, children: _jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: _jsx("polyline", { points: "22 12 18 12 15 21 9 3 6 12 2 12" }) }) }), showTooltip &&
184
+ canPortal &&
185
+ createPortal(_jsx("div", { ref: tooltipRef, style: {
186
+ ...aiStyles.tooltip,
187
+ ...tooltipPosition,
188
+ zIndex: 50,
189
+ }, onMouseEnter: () => setShowTooltip(true), onMouseLeave: handleMouseLeave, children: lbStatus === "ready" && user ? (_jsxs(_Fragment, { children: [_jsx("div", { style: aiStyles.tooltipHeader, children: "LastBrain Connected" }), _jsx("div", { style: {
190
+ ...aiStyles.tooltipSection,
191
+ paddingBottom: "8px",
192
+ }, children: _jsxs("div", { style: aiStyles.tooltipRow, children: [_jsx("span", { style: aiStyles.tooltipLabel, children: "User:" }), _jsx("span", { style: aiStyles.tooltipValue, children: user.email })] }) }), _jsxs("div", { style: {
193
+ display: "flex",
194
+ gap: "8px",
195
+ borderTop: "1px solid var(--ai-border-primary, #374151)",
196
+ paddingTop: "12px",
197
+ }, children: [_jsx("button", { onClick: () => window.open("https://lastbrain.io/metrics", "_blank"), style: {
198
+ flex: 1,
199
+ background: "transparent",
200
+ border: "none",
201
+ padding: "14px",
202
+ cursor: "pointer",
203
+ display: "flex",
204
+ alignItems: "center",
205
+ justifyContent: "center",
206
+ color: "#8b5cf6",
207
+ transition: "all 0.2s ease",
208
+ }, onMouseEnter: (e) => {
209
+ Object.assign(e.currentTarget.style, {
210
+ background: "rgba(139, 92, 246, 0.1)",
211
+ });
212
+ }, onMouseLeave: (e) => {
213
+ Object.assign(e.currentTarget.style, {
214
+ background: "transparent",
215
+ });
216
+ }, title: "View Metrics", children: _jsx(BarChart3, { size: 18 }) }), _jsx("button", { onClick: () => window.open("https://lastbrain.io/settings", "_blank"), style: {
217
+ flex: 1,
218
+ background: "transparent",
219
+ border: "none",
220
+ padding: "14px",
221
+ cursor: "pointer",
222
+ display: "flex",
223
+ alignItems: "center",
224
+ justifyContent: "center",
225
+ color: "#8b5cf6",
226
+ transition: "all 0.2s ease",
227
+ }, onMouseEnter: (e) => {
228
+ Object.assign(e.currentTarget.style, {
229
+ background: "rgba(139, 92, 246, 0.1)",
230
+ });
231
+ }, onMouseLeave: (e) => {
232
+ Object.assign(e.currentTarget.style, {
233
+ background: "transparent",
234
+ });
235
+ }, title: "Settings", children: _jsx(Settings, { size: 18 }) }), _jsx("button", { onClick: () => window.open("https://prompt.lastbrain.io/auth/prompts", "_blank"), style: {
236
+ flex: 1,
237
+ background: "transparent",
238
+ border: "none",
239
+ padding: "14px",
240
+ cursor: "pointer",
241
+ display: "flex",
242
+ alignItems: "center",
243
+ justifyContent: "center",
244
+ color: "#8b5cf6",
245
+ transition: "all 0.2s ease",
246
+ }, onMouseEnter: (e) => {
247
+ Object.assign(e.currentTarget.style, {
248
+ background: "rgba(139, 92, 246, 0.1)",
249
+ });
250
+ }, onMouseLeave: (e) => {
251
+ Object.assign(e.currentTarget.style, {
252
+ background: "transparent",
253
+ });
254
+ }, title: "My Prompts", children: _jsx(FileText, { size: 18 }) }), _jsx("button", { onClick: () => window.open("https://prompt.lastbrain.io/auth/folder", "_blank"), style: {
255
+ flex: 1,
256
+ background: "transparent",
257
+ border: "none",
258
+ padding: "14px",
259
+ cursor: "pointer",
260
+ display: "flex",
261
+ alignItems: "center",
262
+ justifyContent: "center",
263
+ color: "#8b5cf6",
264
+ transition: "all 0.2s ease",
265
+ }, onMouseEnter: (e) => {
266
+ Object.assign(e.currentTarget.style, {
267
+ background: "rgba(139, 92, 246, 0.1)",
268
+ });
269
+ }, onMouseLeave: (e) => {
270
+ Object.assign(e.currentTarget.style, {
271
+ background: "transparent",
272
+ });
273
+ }, title: "New Folder", children: _jsx(FolderPlus, { size: 18 }) }), _jsx("button", { onClick: async () => {
274
+ if (logout) {
275
+ await logout();
276
+ }
277
+ setShowTooltip(false);
278
+ }, style: {
279
+ flex: 1,
280
+ background: "transparent",
281
+ border: "none",
282
+ padding: "14px",
283
+ cursor: "pointer",
284
+ display: "flex",
285
+ alignItems: "center",
286
+ justifyContent: "center",
287
+ color: "#ef4444",
288
+ transition: "all 0.2s ease",
289
+ }, onMouseEnter: (e) => {
290
+ Object.assign(e.currentTarget.style, {
291
+ background: "rgba(239, 68, 68, 0.1)",
292
+ });
293
+ }, onMouseLeave: (e) => {
294
+ Object.assign(e.currentTarget.style, {
295
+ background: "transparent",
296
+ });
297
+ }, title: "Logout", children: _jsx(Power, { size: 18 }) })] })] })) : (_jsxs(_Fragment, { children: [_jsx("div", { style: aiStyles.tooltipHeader, children: "LastBrain Authentication" }), _jsx("div", { style: {
298
+ ...aiStyles.tooltipSection,
299
+ paddingBottom: "12px",
300
+ }, children: _jsx("p", { style: {
301
+ margin: 0,
302
+ fontSize: "13px",
303
+ color: "var(--ai-text-secondary, #9ca3af)",
304
+ lineHeight: "1.5",
305
+ }, children: "Connectez-vous pour acc\u00E9der aux fonctionnalit\u00E9s IA" }) }), _jsx("button", { onClick: () => {
306
+ setShowSigninModal(true);
307
+ setShowTooltip(false);
308
+ }, style: {
309
+ width: "100%",
310
+ padding: "10px",
311
+ background: "linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%)",
312
+ border: "none",
313
+ borderRadius: "6px",
314
+ color: "#ffffff",
315
+ fontSize: "13px",
316
+ fontWeight: 600,
317
+ cursor: "pointer",
318
+ transition: "all 0.2s ease",
319
+ }, onMouseEnter: (e) => {
320
+ e.currentTarget.style.transform = "translateY(-1px)";
321
+ e.currentTarget.style.boxShadow =
322
+ "0 4px 12px rgba(139, 92, 246, 0.3)";
323
+ }, onMouseLeave: (e) => {
324
+ e.currentTarget.style.transform = "translateY(0)";
325
+ e.currentTarget.style.boxShadow = "none";
326
+ }, children: "\uD83D\uDD10 Se connecter" })] })) }), document.body)] }), _jsx(LBSigninModal, { isOpen: showSigninModal, onClose: () => setShowSigninModal(false) })] }));
153
327
  }
154
328
  return (_jsxs("div", { style: { position: "relative", display: "inline-block" }, children: [_jsx("button", { ref: buttonRef, style: {
155
329
  ...aiStyles.statusButton,
@@ -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,2CA6NjB"}
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"}
@@ -9,6 +9,7 @@ import { UsageToast, useUsageToast } from "./UsageToast";
9
9
  import { aiStyles } from "../styles/inline";
10
10
  import { handleAIError } from "../utils/errorHandler";
11
11
  import { useLB } from "../context/LBAuthProvider";
12
+ import { LBSigninModal } from "./LBSigninModal";
12
13
  export function AiTextarea({ baseUrl, apiKeyId, uiMode = "modal", context, model, prompt, editMode = false, enableModelManagement, storeOutputs, artifactTitle, onValue, onToast, disabled, className, ...textareaProps }) {
13
14
  const [isOpen, setIsOpen] = useState(false);
14
15
  const [showAuthModal, setShowAuthModal] = useState(false);
@@ -19,7 +20,16 @@ export function AiTextarea({ baseUrl, apiKeyId, uiMode = "modal", context, model
19
20
  const [isButtonHovered, setIsButtonHovered] = useState(false);
20
21
  const textareaRef = useRef(null);
21
22
  const { showUsageToast, toastData, toastKey, clearToast } = useUsageToast();
22
- const { status: lbStatus } = useLB();
23
+ // Rendre l'authentification optionnelle
24
+ let lbStatus;
25
+ try {
26
+ const lbContext = useLB();
27
+ lbStatus = lbContext.status;
28
+ }
29
+ catch {
30
+ // LBProvider n'est pas disponible, ignorer
31
+ lbStatus = undefined;
32
+ }
23
33
  const { models } = useAiModels({
24
34
  baseUrl,
25
35
  apiKeyId,
@@ -136,5 +146,5 @@ export function AiTextarea({ baseUrl, apiKeyId, uiMode = "modal", context, model
136
146
  ? "Authentication required"
137
147
  : hasConfiguration
138
148
  ? "Generate with AI"
139
- : "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))] }));
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) })] }));
140
150
  }
@@ -1 +1 @@
1
- {"version":3,"file":"LBConnectButton.d.ts","sourceRoot":"","sources":["../../src/components/LBConnectButton.tsx"],"names":[],"mappings":"AAUA,UAAU,oBAAoB;IAC5B,sBAAsB;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,yCAAyC;IACzC,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED,wBAAgB,eAAe,CAAC,EAC9B,KAAkC,EAClC,SAAc,EACd,WAAW,EACX,WAAW,GACZ,EAAE,oBAAoB,2CA4CtB;AAED;;GAEG;AACH,UAAU,gBAAgB;IACxB,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACrC;AAED,iBAAS,WAAW,CAAC,EAAE,OAAO,EAAE,EAAE,gBAAgB,2CAsRjD;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"LBConnectButton.d.ts","sourceRoot":"","sources":["../../src/components/LBConnectButton.tsx"],"names":[],"mappings":"AAWA,UAAU,oBAAoB;IAC5B,sBAAsB;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,yCAAyC;IACzC,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED,wBAAgB,eAAe,CAAC,EAC9B,KAAkC,EAClC,SAAc,EACd,WAAW,EACX,WAAW,GACZ,EAAE,oBAAoB,2CA4CtB;AAED;;GAEG;AACH,UAAU,gBAAgB;IACxB,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACrC;AAED,iBAAS,WAAW,CAAC,EAAE,OAAO,EAAE,EAAE,gBAAgB,2CA+RjD;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -36,7 +36,7 @@ export function LBConnectButton({ label = "Se connecter à LastBrain", className
36
36
  : `🔐 ${label}` }), showModal && _jsx(LBAuthModal, { onClose: handleModalClose })] }));
37
37
  }
38
38
  function LBAuthModal({ onClose }) {
39
- const { login, fetchApiKeys, selectApiKey, status } = useLB();
39
+ const { login, fetchApiKeys, selectApiKey } = useLB();
40
40
  const [step, setStep] = React.useState("login");
41
41
  const [email, setEmail] = React.useState("");
42
42
  const [password, setPassword] = React.useState("");
@@ -50,16 +50,13 @@ function LBAuthModal({ onClose }) {
50
50
  setLoading(true);
51
51
  try {
52
52
  const result = await login(email, password);
53
- setAccessToken(result.accessToken);
54
- // Récupérer les clés API
55
- const keys = await fetchApiKeys(result.accessToken);
56
- setApiKeys(keys);
57
- if (keys.length === 0) {
58
- setError("Aucune clé API active trouvée. Créez-en une dans votre dashboard LastBrain.");
53
+ if (!result.success) {
54
+ setError(result.error || "Échec de la connexion");
59
55
  return;
60
56
  }
61
- // Passer à l'étape de sélection
62
- setStep("select-key");
57
+ // Note: avec le nouveau système, login gère automatiquement
58
+ // la récupération et sélection de clé. Ce modal n'est plus nécessaire.
59
+ onClose(true);
63
60
  }
64
61
  catch (err) {
65
62
  setError(err instanceof Error ? err.message : "Échec de la connexion");
@@ -82,9 +79,9 @@ function LBAuthModal({ onClose }) {
82
79
  setLoading(false);
83
80
  }
84
81
  };
85
- return (_jsx("div", { className: "fixed inset-0 bg-gradient-to-br from-slate-900/95 via-purple-900/95 to-slate-900/95 backdrop-blur-sm flex items-center justify-center z-50 p-4", children: _jsxs("div", { className: "bg-white dark:bg-gradient-to-br dark:from-slate-800 dark:to-slate-900 rounded-2xl shadow-2xl max-w-md w-full border border-slate-200 dark:border-slate-700 overflow-hidden", children: [_jsx("div", { className: "bg-gradient-to-r from-violet-500 to-purple-600 p-6 text-white", children: _jsxs("div", { className: "flex justify-between items-center", children: [_jsxs("div", { children: [_jsx("h2", { className: "text-2xl font-bold flex items-center gap-2", children: step === "login" ? "🔐 Connexion" : "🔑 Sélection clé API" }), _jsx("p", { className: "text-violet-100 text-sm mt-1", children: step === "login"
86
- ? "Accédez à vos outils IA"
87
- : "Créez une session sécurisée 72h" })] }), _jsx("button", { onClick: () => onClose(false), className: "text-white/80 hover:text-white hover:bg-white/20 rounded-lg p-2 transition-colors", children: _jsx("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })] }) }), _jsx("div", { className: "p-6", children: step === "login" ? (_jsxs("form", { onSubmit: handleLogin, className: "space-y-4", children: [_jsxs("div", { children: [_jsx("label", { className: "block text-sm font-semibold mb-2 text-slate-700 dark:text-slate-300", children: "\uD83D\uDCE7 Email" }), _jsx("input", { type: "email", value: email, onChange: (e) => setEmail(e.target.value), className: "w-full px-4 py-3 border-2 border-slate-200 dark:border-slate-600 rounded-lg dark:bg-slate-800 dark:text-white focus:border-violet-500 focus:ring-2 focus:ring-violet-200 dark:focus:ring-violet-900 transition-all outline-none", placeholder: "votre@email.com", required: true, autoFocus: true })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-semibold mb-2 text-slate-700 dark:text-slate-300", children: "\uD83D\uDD12 Mot de passe" }), _jsx("input", { type: "password", value: password, onChange: (e) => setPassword(e.target.value), className: "w-full px-4 py-3 border-2 border-slate-200 dark:border-slate-600 rounded-lg dark:bg-slate-800 dark:text-white focus:border-violet-500 focus:ring-2 focus:ring-violet-200 dark:focus:ring-violet-900 transition-all outline-none", placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022", required: true })] }), error && (_jsx("div", { className: "bg-red-50 dark:bg-red-900/20 border-l-4 border-red-500 p-4 rounded", children: _jsxs("div", { className: "flex items-start gap-2", children: [_jsx("span", { className: "text-red-500 text-xl", children: "\u26A0\uFE0F" }), _jsx("p", { className: "text-red-700 dark:text-red-400 text-sm font-medium", children: error })] }) })), _jsx("button", { type: "submit", disabled: loading, className: "w-full px-6 py-3 bg-gradient-to-r from-violet-500 to-purple-600 text-white font-semibold rounded-lg hover:from-violet-600 hover:to-purple-700 disabled:from-slate-400 disabled:to-slate-500 disabled:cursor-not-allowed transition-all duration-200 shadow-lg hover:shadow-xl transform hover:-translate-y-0.5", children: loading ? (_jsxs("span", { className: "flex items-center justify-center gap-2", children: [_jsxs("svg", { className: "animate-spin h-5 w-5", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [_jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), _jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }), "Connexion en cours..."] })) : ("🚀 Se connecter") }), _jsxs("div", { className: "relative my-6", children: [_jsx("div", { className: "absolute inset-0 flex items-center", children: _jsx("div", { className: "w-full border-t border-slate-200 dark:border-slate-700" }) }), _jsx("div", { className: "relative flex justify-center text-sm", children: _jsx("span", { className: "px-4 bg-white dark:bg-slate-800 text-slate-500", children: "ou" }) })] }), _jsxs("div", { className: "bg-gradient-to-r from-violet-50 to-purple-50 dark:from-violet-900/20 dark:to-purple-900/20 rounded-lg p-4 border border-violet-200 dark:border-violet-800", children: [_jsx("p", { className: "text-sm text-slate-700 dark:text-slate-300 text-center", children: "Pas encore de compte ?" }), _jsx("a", { href: "https://lastbrain.io/signup", target: "_blank", rel: "noopener noreferrer", className: "block mt-2 text-center text-violet-600 dark:text-violet-400 hover:text-violet-700 dark:hover:text-violet-300 font-semibold text-sm hover:underline", children: "\u2728 Cr\u00E9er un compte gratuitement" })] })] })) : (_jsxs("div", { className: "space-y-4", children: [_jsx("p", { className: "text-sm text-slate-600 dark:text-slate-400 bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800", children: "\u2139\uFE0F S\u00E9lectionnez une cl\u00E9 API pour cr\u00E9er une session s\u00E9curis\u00E9e de 72h" }), _jsx("div", { className: "space-y-3 max-h-96 overflow-y-auto", children: apiKeys.map((key) => (_jsx("button", { onClick: () => handleSelectKey(key.id), disabled: !key.isActive || loading, className: `w-full text-left px-5 py-4 border-2 rounded-lg transition-all transform hover:scale-[1.02] ${key.isActive
82
+ return (_jsx("div", { className: "fixed inset-0 bg-black/60 dark:bg-black/80 backdrop-blur-md flex items-center justify-center z-50 p-4 animate-in fade-in duration-200", children: _jsxs("div", { className: "bg-white/95 dark:bg-slate-900/95 backdrop-blur-xl rounded-3xl shadow-2xl max-w-md w-full border border-slate-200/50 dark:border-slate-700/50 overflow-hidden animate-in zoom-in-95 duration-200", children: [_jsxs("div", { className: "relative bg-gradient-to-r from-violet-600 via-purple-600 to-fuchsia-600 dark:from-violet-500 dark:via-purple-500 dark:to-fuchsia-500 px-6 py-8 text-white overflow-hidden", children: [_jsx("div", { className: "absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmYiIGZpbGwtb3BhY2l0eT0iMC4wNSI+PHBhdGggZD0iTTM2IDE0YzAtMTEuMDUgOC45NS0yMCAyMC0yMHMyMCA4Ljk1IDIwIDIwLTguOTUgMjAtMjAgMjAtMjAtOC45NS0yMC0yMHoiLz48L2c+PC9nPjwvc3ZnPg==')] opacity-30" }), _jsxs("div", { className: "relative flex justify-between items-start", children: [_jsxs("div", { className: "flex-1", children: [_jsxs("div", { className: "flex items-center gap-3 mb-2", children: [_jsx("div", { className: "w-10 h-10 rounded-xl bg-white/20 backdrop-blur-sm flex items-center justify-center", children: step === "login" ? "🔐" : "🔑" }), _jsx("h2", { className: "text-2xl font-bold tracking-tight", children: step === "login" ? "Connexion" : "Sélection clé" })] }), _jsx("p", { className: "text-white/90 text-sm font-medium mt-1 ml-13", children: step === "login"
83
+ ? "Accédez à vos outils IA"
84
+ : "Session sécurisée 72h" })] }), _jsx("button", { onClick: () => onClose(false), className: "text-white/80 hover:text-white hover:bg-white/20 rounded-lg p-2 transition-all duration-200 backdrop-blur-sm", children: _jsx("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M6 18L18 6M6 6l12 12" }) }) })] })] }), _jsx("div", { className: "p-8", children: step === "login" ? (_jsxs("form", { onSubmit: handleLogin, className: "space-y-5", children: [_jsxs("div", { className: "space-y-2", children: [_jsx("label", { className: "block text-sm font-semibold text-slate-700 dark:text-slate-200 mb-2 tracking-wide", children: "\uD83D\uDCE7 Adresse email" }), _jsx("input", { type: "email", value: email, onChange: (e) => setEmail(e.target.value), className: "w-full px-4 py-3.5 text-base border-2 border-slate-200 dark:border-slate-600 rounded-xl bg-white dark:bg-slate-800 text-slate-900 dark:text-white placeholder:text-slate-400 dark:placeholder:text-slate-500 focus:border-violet-500 dark:focus:border-violet-400 focus:ring-4 focus:ring-violet-100 dark:focus:ring-violet-900/30 transition-all outline-none font-medium tracking-wide", placeholder: "votre@email.com", required: true, autoFocus: true, autoComplete: "email", style: { letterSpacing: "0.01em" } })] }), _jsxs("div", { className: "space-y-2", children: [_jsx("label", { className: "block text-sm font-semibold text-slate-700 dark:text-slate-200 mb-2 tracking-wide", children: "\uD83D\uDD12 Mot de passe" }), _jsx("input", { type: "password", value: password, onChange: (e) => setPassword(e.target.value), className: "w-full px-4 py-3.5 text-base border-2 border-slate-200 dark:border-slate-600 rounded-xl bg-white dark:bg-slate-800 text-slate-900 dark:text-white placeholder:text-slate-400 dark:placeholder:text-slate-500 focus:border-violet-500 dark:focus:border-violet-400 focus:ring-4 focus:ring-violet-100 dark:focus:ring-violet-900/30 transition-all outline-none font-medium tracking-wide", placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022", required: true, autoComplete: "current-password", style: { letterSpacing: "0.15em" } })] }), error && (_jsx("div", { className: "bg-red-50 dark:bg-red-900/20 border-l-4 border-red-500 dark:border-red-400 px-4 py-3.5 rounded-lg animate-in slide-in-from-top-2 duration-200", children: _jsxs("div", { className: "flex items-start gap-3", children: [_jsx("span", { className: "text-red-500 dark:text-red-400 text-xl flex-shrink-0 mt-0.5", children: "\u26A0\uFE0F" }), _jsx("p", { className: "text-red-700 dark:text-red-300 text-sm font-medium leading-relaxed", children: error })] }) })), _jsx("button", { type: "submit", disabled: loading, className: "w-full mt-6 px-6 py-4 bg-gradient-to-r from-violet-600 to-purple-600 hover:from-violet-700 hover:to-purple-700 disabled:from-slate-400 disabled:to-slate-500 text-white font-bold text-base rounded-xl disabled:cursor-not-allowed transition-all duration-200 shadow-lg shadow-violet-500/30 hover:shadow-xl hover:shadow-violet-500/40 disabled:shadow-none transform hover:translate-y-[-2px] active:translate-y-0 disabled:translate-y-0 tracking-wide", children: loading ? (_jsxs("span", { className: "flex items-center justify-center gap-3", children: [_jsxs("svg", { className: "animate-spin h-5 w-5", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [_jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), _jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }), _jsx("span", { className: "font-semibold", children: "Connexion en cours..." })] })) : (_jsxs("span", { className: "flex items-center justify-center gap-2", children: ["\uD83D\uDE80 ", _jsx("span", { children: "Se connecter" })] })) }), _jsxs("div", { className: "relative my-8", children: [_jsx("div", { className: "absolute inset-0 flex items-center", children: _jsx("div", { className: "w-full border-t border-slate-200 dark:border-slate-700" }) }), _jsx("div", { className: "relative flex justify-center text-sm", children: _jsx("span", { className: "px-4 bg-white dark:bg-slate-900 text-slate-500 dark:text-slate-400 font-medium", children: "ou" }) })] }), _jsxs("div", { className: "bg-gradient-to-br from-violet-50 to-purple-50 dark:from-violet-900/20 dark:to-purple-900/20 rounded-xl p-5 border border-violet-200 dark:border-violet-800/50 backdrop-blur-sm", children: [_jsx("p", { className: "text-sm text-slate-700 dark:text-slate-300 text-center font-medium mb-3", children: "Pas encore de compte ?" }), _jsx("a", { href: "https://prompt.lastbrain.io/signup", target: "_blank", rel: "noopener noreferrer", className: "block text-center px-4 py-3 bg-white dark:bg-slate-800 text-violet-600 dark:text-violet-400 hover:text-violet-700 dark:hover:text-violet-300 font-bold text-sm rounded-lg hover:shadow-md transition-all duration-200 border-2 border-violet-200 dark:border-violet-700", children: "\u2728 Cr\u00E9er un compte gratuitement" })] })] })) : (_jsxs("div", { className: "space-y-4", children: [_jsx("p", { className: "text-sm text-slate-600 dark:text-slate-400 bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800", children: "\u2139\uFE0F S\u00E9lectionnez une cl\u00E9 API pour cr\u00E9er une session s\u00E9curis\u00E9e de 72h" }), _jsx("div", { className: "space-y-3 max-h-96 overflow-y-auto", children: apiKeys.map((key) => (_jsx("button", { onClick: () => handleSelectKey(key.id), disabled: !key.isActive || loading, className: `w-full text-left px-5 py-4 border-2 rounded-lg transition-all transform hover:scale-[1.02] ${key.isActive
88
85
  ? "border-slate-200 dark:border-slate-600 hover:border-violet-400 dark:hover:border-violet-500 hover:bg-gradient-to-r hover:from-violet-50 hover:to-purple-50 dark:hover:from-violet-900/20 dark:hover:to-purple-900/20"
89
86
  : "border-slate-200 dark:border-slate-700 bg-slate-50 dark:bg-slate-800/50 opacity-50 cursor-not-allowed"}`, children: _jsxs("div", { className: "flex items-start justify-between gap-2", children: [_jsxs("div", { className: "flex-1", children: [_jsxs("div", { className: "font-semibold text-slate-900 dark:text-white flex items-center gap-2", children: [key.isActive ? "🔑" : "🔒", key.name] }), _jsxs("div", { className: "text-sm text-slate-500 dark:text-slate-400 mt-1 font-mono", children: [key.keyPrefix, "..."] }), key.scopes && (_jsxs("div", { className: "flex gap-1 mt-2 flex-wrap", children: [key.scopes.slice(0, 3).map((scope) => (_jsx("span", { className: "text-xs px-2 py-1 bg-violet-100 dark:bg-violet-900/30 text-violet-700 dark:text-violet-300 rounded", children: scope }, scope))), key.scopes.length > 3 && (_jsxs("span", { className: "text-xs px-2 py-1 bg-slate-100 dark:bg-slate-700 text-slate-600 dark:text-slate-400 rounded", children: ["+", key.scopes.length - 3] }))] }))] }), key.isActive ? (_jsx("svg", { className: "w-5 h-5 text-violet-500 flex-shrink-0 mt-1", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) })) : (_jsx("span", { className: "text-xs text-red-600 dark:text-red-400 font-semibold bg-red-100 dark:bg-red-900/30 px-2 py-1 rounded", children: "Inactive" }))] }) }, key.id))) }), error && (_jsx("div", { className: "bg-red-50 dark:bg-red-900/20 border-l-4 border-red-500 p-4 rounded", children: _jsxs("div", { className: "flex items-start gap-2", children: [_jsx("span", { className: "text-red-500 text-xl", children: "\u26A0\uFE0F" }), _jsx("p", { className: "text-red-700 dark:text-red-400 text-sm font-medium", children: error })] }) }))] })) })] }) }));
90
87
  }
@@ -0,0 +1,6 @@
1
+ export interface LBSigninModalProps {
2
+ isOpen: boolean;
3
+ onClose: () => void;
4
+ }
5
+ export declare function LBSigninModal({ isOpen, onClose }: LBSigninModalProps): import("react/jsx-runtime").JSX.Element | null;
6
+ //# sourceMappingURL=LBSigninModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LBSigninModal.d.ts","sourceRoot":"","sources":["../../src/components/LBSigninModal.tsx"],"names":[],"mappings":"AAKA,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,kDAoYpE"}