@kite-copilot/chat-panel 0.2.34 → 0.2.36

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.
@@ -883,8 +883,39 @@ function DataRenderer({ type, data }) {
883
883
 
884
884
  // src/ChatPanel.tsx
885
885
  import * as React4 from "react";
886
+ import { createClient } from "@supabase/supabase-js";
886
887
  import { ArrowLeft, ArrowUp, Command, CornerDownLeft, CheckCircle2 as CheckCircle23, SquarePen, Paperclip, X, FileSpreadsheet, Loader2 as Loader22, ChevronLeft, ChevronRight, Sparkles, Minus } from "lucide-react";
887
- import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
888
+
889
+ // src/components/TypingIndicator.tsx
890
+ import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
891
+ function TypingIndicator({ className = "" }) {
892
+ return /* @__PURE__ */ jsx9("div", { className: `flex items-center gap-1 px-4 py-3 ${className}`, children: /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-1", children: [
893
+ /* @__PURE__ */ jsx9(
894
+ "span",
895
+ {
896
+ className: "w-2 h-2 bg-gray-400 rounded-full animate-bounce",
897
+ style: { animationDelay: "0ms", animationDuration: "600ms" }
898
+ }
899
+ ),
900
+ /* @__PURE__ */ jsx9(
901
+ "span",
902
+ {
903
+ className: "w-2 h-2 bg-gray-400 rounded-full animate-bounce",
904
+ style: { animationDelay: "150ms", animationDuration: "600ms" }
905
+ }
906
+ ),
907
+ /* @__PURE__ */ jsx9(
908
+ "span",
909
+ {
910
+ className: "w-2 h-2 bg-gray-400 rounded-full animate-bounce",
911
+ style: { animationDelay: "300ms", animationDuration: "600ms" }
912
+ }
913
+ )
914
+ ] }) });
915
+ }
916
+
917
+ // src/ChatPanel.tsx
918
+ import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
888
919
  var DEFAULT_AGENT_URL = "http://localhost:5002";
889
920
  var PANEL_WIDTH = 340;
890
921
  function unescapeJsonString(str) {
@@ -906,7 +937,7 @@ function renderMarkdown(text) {
906
937
  const codeMatch = remaining.match(/^`([^`]+)`/);
907
938
  if (codeMatch) {
908
939
  parts.push(
909
- /* @__PURE__ */ jsx9(
940
+ /* @__PURE__ */ jsx10(
910
941
  "code",
911
942
  {
912
943
  className: "bg-gray-100 px-1 py-0.5 rounded text-xs font-mono",
@@ -920,20 +951,20 @@ function renderMarkdown(text) {
920
951
  }
921
952
  const boldMatch = remaining.match(/^\*\*([^*]+)\*\*/);
922
953
  if (boldMatch) {
923
- parts.push(/* @__PURE__ */ jsx9("strong", { children: boldMatch[1] }, keyIndex++));
954
+ parts.push(/* @__PURE__ */ jsx10("strong", { children: boldMatch[1] }, keyIndex++));
924
955
  remaining = remaining.slice(boldMatch[0].length);
925
956
  continue;
926
957
  }
927
958
  const italicMatch = remaining.match(/^\*([^*]+)\*/);
928
959
  if (italicMatch) {
929
- parts.push(/* @__PURE__ */ jsx9("em", { children: italicMatch[1] }, keyIndex++));
960
+ parts.push(/* @__PURE__ */ jsx10("em", { children: italicMatch[1] }, keyIndex++));
930
961
  remaining = remaining.slice(italicMatch[0].length);
931
962
  continue;
932
963
  }
933
964
  const linkMatch = remaining.match(/^\[([^\]]+)\]\(([^)]+)\)/);
934
965
  if (linkMatch) {
935
966
  parts.push(
936
- /* @__PURE__ */ jsx9(
967
+ /* @__PURE__ */ jsx10(
937
968
  "a",
938
969
  {
939
970
  href: linkMatch[2],
@@ -953,7 +984,7 @@ function renderMarkdown(text) {
953
984
  const url = urlMatch[1];
954
985
  const href = url.startsWith("www.") ? `https://${url}` : url;
955
986
  parts.push(
956
- /* @__PURE__ */ jsx9(
987
+ /* @__PURE__ */ jsx10(
957
988
  "a",
958
989
  {
959
990
  href,
@@ -972,7 +1003,7 @@ function renderMarkdown(text) {
972
1003
  if (emailMatch) {
973
1004
  const email = emailMatch[1];
974
1005
  parts.push(
975
- /* @__PURE__ */ jsx9(
1006
+ /* @__PURE__ */ jsx10(
976
1007
  "a",
977
1008
  {
978
1009
  href: `mailto:${email}`,
@@ -997,17 +1028,17 @@ function renderMarkdown(text) {
997
1028
  remaining = remaining.slice(nextSpecial);
998
1029
  }
999
1030
  }
1000
- return parts.length === 1 ? parts[0] : /* @__PURE__ */ jsx9(Fragment2, { children: parts });
1031
+ return parts.length === 1 ? parts[0] : /* @__PURE__ */ jsx10(Fragment2, { children: parts });
1001
1032
  };
1002
1033
  const flushList = () => {
1003
1034
  if (currentList) {
1004
1035
  const ListTag = currentList.type === "ul" ? "ul" : "ol";
1005
1036
  elements.push(
1006
- /* @__PURE__ */ jsx9(
1037
+ /* @__PURE__ */ jsx10(
1007
1038
  ListTag,
1008
1039
  {
1009
1040
  className: `${currentList.type === "ul" ? "list-disc" : "list-decimal"} ml-4 my-1`,
1010
- children: currentList.items.map((item, i) => /* @__PURE__ */ jsx9("li", { className: "ml-2", children: item }, i))
1041
+ children: currentList.items.map((item, i) => /* @__PURE__ */ jsx10("li", { className: "ml-2", children: item }, i))
1011
1042
  },
1012
1043
  elements.length
1013
1044
  )
@@ -1020,11 +1051,11 @@ function renderMarkdown(text) {
1020
1051
  if (line.startsWith("```")) {
1021
1052
  if (inCodeBlock) {
1022
1053
  elements.push(
1023
- /* @__PURE__ */ jsx9(
1054
+ /* @__PURE__ */ jsx10(
1024
1055
  "pre",
1025
1056
  {
1026
1057
  className: "bg-gray-100 rounded p-2 my-1 overflow-x-auto",
1027
- children: /* @__PURE__ */ jsx9("code", { className: "text-xs font-mono", children: codeContent.join("\n") })
1058
+ children: /* @__PURE__ */ jsx10("code", { className: "text-xs font-mono", children: codeContent.join("\n") })
1028
1059
  },
1029
1060
  elements.length
1030
1061
  )
@@ -1050,7 +1081,7 @@ function renderMarkdown(text) {
1050
1081
  const content = processInlineFormatting(headerMatch[2]);
1051
1082
  const className = level === 1 ? "text-lg font-bold my-1" : level === 2 ? "text-base font-bold my-1" : "text-sm font-semibold my-1";
1052
1083
  elements.push(
1053
- /* @__PURE__ */ jsx9("div", { className, children: content }, elements.length)
1084
+ /* @__PURE__ */ jsx10("div", { className, children: content }, elements.length)
1054
1085
  );
1055
1086
  continue;
1056
1087
  }
@@ -1074,23 +1105,23 @@ function renderMarkdown(text) {
1074
1105
  }
1075
1106
  if (line.trim() === "") {
1076
1107
  flushList();
1077
- elements.push(/* @__PURE__ */ jsx9("div", { className: "h-2" }, elements.length));
1108
+ elements.push(/* @__PURE__ */ jsx10("div", { className: "h-2" }, elements.length));
1078
1109
  continue;
1079
1110
  }
1080
1111
  if (line.match(/^[-*_]{3,}$/)) {
1081
1112
  flushList();
1082
1113
  elements.push(
1083
- /* @__PURE__ */ jsx9("hr", { className: "my-2 border-gray-200" }, elements.length)
1114
+ /* @__PURE__ */ jsx10("hr", { className: "my-2 border-gray-200" }, elements.length)
1084
1115
  );
1085
1116
  continue;
1086
1117
  }
1087
1118
  flushList();
1088
1119
  elements.push(
1089
- /* @__PURE__ */ jsx9("div", { children: processInlineFormatting(line) }, elements.length)
1120
+ /* @__PURE__ */ jsx10("div", { children: processInlineFormatting(line) }, elements.length)
1090
1121
  );
1091
1122
  }
1092
1123
  flushList();
1093
- return /* @__PURE__ */ jsx9(Fragment2, { children: elements });
1124
+ return /* @__PURE__ */ jsx10(Fragment2, { children: elements });
1094
1125
  }
1095
1126
  var defaultStartingQuestions = [
1096
1127
  {
@@ -1317,21 +1348,155 @@ function ChatPanel({
1317
1348
  orgId,
1318
1349
  userName,
1319
1350
  userEmail,
1320
- userOrganization
1351
+ userOrganization,
1352
+ supabaseUrl,
1353
+ supabaseAnonKey
1321
1354
  } = {}) {
1322
1355
  const [messages, setMessages] = React4.useState(initialMessages);
1323
1356
  const [input, setInput] = React4.useState("");
1324
1357
  const [sessionId, setSessionId] = React4.useState(() => crypto.randomUUID());
1325
1358
  const [isEscalated, setIsEscalated] = React4.useState(false);
1326
1359
  const escalationWsRef = React4.useRef(null);
1360
+ const [agentIsTyping, setAgentIsTyping] = React4.useState(false);
1361
+ const supabaseRef = React4.useRef(null);
1362
+ const typingChannelRef = React4.useRef(null);
1363
+ const typingTimeoutRef = React4.useRef(null);
1327
1364
  const resetSession = React4.useCallback(() => {
1365
+ if (isEscalated && supabaseRef.current && sessionId) {
1366
+ supabaseRef.current.from("escalations").update({
1367
+ customer_status: "disconnected",
1368
+ customer_last_seen: (/* @__PURE__ */ new Date()).toISOString()
1369
+ }).eq("session_id", sessionId);
1370
+ }
1328
1371
  setSessionId(crypto.randomUUID());
1329
1372
  setIsEscalated(false);
1330
1373
  if (escalationWsRef.current) {
1331
1374
  escalationWsRef.current.close();
1332
1375
  escalationWsRef.current = null;
1333
1376
  }
1334
- }, []);
1377
+ setAgentIsTyping(false);
1378
+ if (typingChannelRef.current) {
1379
+ typingChannelRef.current.unsubscribe();
1380
+ typingChannelRef.current = null;
1381
+ }
1382
+ }, [isEscalated, sessionId]);
1383
+ React4.useEffect(() => {
1384
+ if (supabaseUrl && supabaseAnonKey && !supabaseRef.current) {
1385
+ supabaseRef.current = createClient(supabaseUrl, supabaseAnonKey);
1386
+ }
1387
+ }, [supabaseUrl, supabaseAnonKey]);
1388
+ React4.useEffect(() => {
1389
+ if (!isEscalated || !sessionId || !supabaseRef.current) {
1390
+ return;
1391
+ }
1392
+ const channelName = `typing:${sessionId}`;
1393
+ const channel = supabaseRef.current.channel(channelName);
1394
+ channel.on("broadcast", { event: "typing" }, (payload) => {
1395
+ const { sender, isTyping } = payload.payload;
1396
+ if (sender === "agent") {
1397
+ setAgentIsTyping(isTyping);
1398
+ if (isTyping) {
1399
+ if (typingTimeoutRef.current) {
1400
+ window.clearTimeout(typingTimeoutRef.current);
1401
+ }
1402
+ typingTimeoutRef.current = window.setTimeout(() => {
1403
+ setAgentIsTyping(false);
1404
+ }, 5e3);
1405
+ }
1406
+ }
1407
+ }).subscribe((status) => {
1408
+ if (status === "SUBSCRIBED") {
1409
+ typingChannelRef.current = channel;
1410
+ }
1411
+ });
1412
+ return () => {
1413
+ channel.unsubscribe();
1414
+ typingChannelRef.current = null;
1415
+ if (typingTimeoutRef.current) {
1416
+ window.clearTimeout(typingTimeoutRef.current);
1417
+ }
1418
+ };
1419
+ }, [isEscalated, sessionId]);
1420
+ const heartbeatIntervalRef = React4.useRef(null);
1421
+ const updateCustomerStatus = React4.useCallback(async (status) => {
1422
+ if (!supabaseRef.current || !sessionId) return;
1423
+ try {
1424
+ await supabaseRef.current.from("escalations").update({
1425
+ customer_status: status,
1426
+ customer_last_seen: (/* @__PURE__ */ new Date()).toISOString()
1427
+ }).eq("session_id", sessionId);
1428
+ } catch (err) {
1429
+ console.error("[KiteChat] Failed to update customer status:", err);
1430
+ }
1431
+ }, [sessionId]);
1432
+ React4.useEffect(() => {
1433
+ if (!isEscalated || !sessionId || !supabaseRef.current) {
1434
+ return;
1435
+ }
1436
+ const currentSessionId = sessionId;
1437
+ const supabase = supabaseRef.current;
1438
+ updateCustomerStatus("active");
1439
+ heartbeatIntervalRef.current = window.setInterval(() => {
1440
+ updateCustomerStatus("active");
1441
+ }, 6e4);
1442
+ const handleBeforeUnload = () => {
1443
+ supabase.from("escalations").update({
1444
+ customer_status: "disconnected",
1445
+ customer_last_seen: (/* @__PURE__ */ new Date()).toISOString()
1446
+ }).eq("session_id", currentSessionId);
1447
+ };
1448
+ const handleVisibilityChange = () => {
1449
+ if (document.visibilityState === "hidden") {
1450
+ supabase.from("escalations").update({
1451
+ customer_status: "disconnected",
1452
+ customer_last_seen: (/* @__PURE__ */ new Date()).toISOString()
1453
+ }).eq("session_id", currentSessionId);
1454
+ } else if (document.visibilityState === "visible") {
1455
+ updateCustomerStatus("active");
1456
+ }
1457
+ };
1458
+ window.addEventListener("beforeunload", handleBeforeUnload);
1459
+ document.addEventListener("visibilitychange", handleVisibilityChange);
1460
+ return () => {
1461
+ window.removeEventListener("beforeunload", handleBeforeUnload);
1462
+ document.removeEventListener("visibilitychange", handleVisibilityChange);
1463
+ supabase.from("escalations").update({
1464
+ customer_status: "disconnected",
1465
+ customer_last_seen: (/* @__PURE__ */ new Date()).toISOString()
1466
+ }).eq("session_id", currentSessionId).then(
1467
+ () => {
1468
+ console.log("[KiteChat] Marked customer as disconnected");
1469
+ },
1470
+ (err) => {
1471
+ console.error("[KiteChat] Failed to mark disconnected:", err);
1472
+ }
1473
+ );
1474
+ if (heartbeatIntervalRef.current) {
1475
+ window.clearInterval(heartbeatIntervalRef.current);
1476
+ heartbeatIntervalRef.current = null;
1477
+ }
1478
+ };
1479
+ }, [isEscalated, sessionId, updateCustomerStatus]);
1480
+ const sendTypingIndicator = React4.useCallback((isTyping) => {
1481
+ if (!typingChannelRef.current || !isEscalated) return;
1482
+ typingChannelRef.current.send({
1483
+ type: "broadcast",
1484
+ event: "typing",
1485
+ payload: { sender: "user", isTyping }
1486
+ });
1487
+ }, [isEscalated]);
1488
+ const userTypingTimeoutRef = React4.useRef(null);
1489
+ const handleTypingStart = React4.useCallback(() => {
1490
+ if (!isEscalated || !supabaseRef.current) return;
1491
+ sendTypingIndicator(true);
1492
+ updateCustomerStatus("active");
1493
+ if (userTypingTimeoutRef.current) {
1494
+ window.clearTimeout(userTypingTimeoutRef.current);
1495
+ }
1496
+ userTypingTimeoutRef.current = window.setTimeout(() => {
1497
+ sendTypingIndicator(false);
1498
+ }, 1500);
1499
+ }, [isEscalated, sendTypingIndicator, updateCustomerStatus]);
1335
1500
  const streamIntervals = React4.useRef({});
1336
1501
  const isEmpty = messages.length === 0;
1337
1502
  const [phase, setPhase] = React4.useState("idle");
@@ -1606,12 +1771,13 @@ function ChatPanel({
1606
1771
  type: "user_message",
1607
1772
  content
1608
1773
  }));
1774
+ updateCustomerStatus("active");
1609
1775
  return true;
1610
1776
  } catch (err) {
1611
1777
  console.error("[KiteChat] Failed to send escalated message:", err);
1612
1778
  return false;
1613
1779
  }
1614
- }, []);
1780
+ }, [updateCustomerStatus]);
1615
1781
  React4.useEffect(() => {
1616
1782
  return () => {
1617
1783
  if (escalationWsRef.current) {
@@ -1742,6 +1908,11 @@ function ChatPanel({
1742
1908
  };
1743
1909
  setMessages((prev) => [...prev, userMessage]);
1744
1910
  sendEscalatedMessage(trimmed);
1911
+ sendTypingIndicator(false);
1912
+ if (userTypingTimeoutRef.current) {
1913
+ window.clearTimeout(userTypingTimeoutRef.current);
1914
+ userTypingTimeoutRef.current = null;
1915
+ }
1745
1916
  setInput("");
1746
1917
  return;
1747
1918
  }
@@ -2760,8 +2931,8 @@ ${userText}`
2760
2931
  }
2761
2932
  }
2762
2933
  if (!isOpen) {
2763
- return /* @__PURE__ */ jsx9("div", { className: "fixed bottom-6 left-1/2 -translate-x-1/2 z-50", children: /* @__PURE__ */ jsx9("div", { className: `flex items-center gap-3 rounded-2xl bg-white border border-gray-200 shadow-lg px-4 py-2 hover:shadow-xl transition-all duration-300 ease-out focus-within:border-gray-700 ${searchExpanded ? "w-[480px]" : "w-[320px]"}`, children: !searchExpanded ? /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3 w-full", children: [
2764
- /* @__PURE__ */ jsxs5(
2934
+ return /* @__PURE__ */ jsx10("div", { className: "fixed bottom-6 left-1/2 -translate-x-1/2 z-50", children: /* @__PURE__ */ jsx10("div", { className: `flex items-center gap-3 rounded-2xl bg-white border border-gray-200 shadow-lg px-4 py-2 hover:shadow-xl transition-all duration-300 ease-out focus-within:border-gray-700 ${searchExpanded ? "w-[480px]" : "w-[320px]"}`, children: !searchExpanded ? /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-3 w-full", children: [
2935
+ /* @__PURE__ */ jsxs6(
2765
2936
  "button",
2766
2937
  {
2767
2938
  onClick: () => {
@@ -2770,23 +2941,23 @@ ${userText}`
2770
2941
  },
2771
2942
  className: "flex items-center gap-3 flex-1 group",
2772
2943
  children: [
2773
- /* @__PURE__ */ jsx9("span", { className: "text-sm text-gray-500 flex-1 text-left", children: "Ask a question..." }),
2774
- /* @__PURE__ */ jsx9("span", { className: "text-xs text-gray-400 font-medium", children: "\u2318I" })
2944
+ /* @__PURE__ */ jsx10("span", { className: "text-sm text-gray-500 flex-1 text-left", children: "Ask a question..." }),
2945
+ /* @__PURE__ */ jsx10("span", { className: "text-xs text-gray-400 font-medium", children: "\u2318I" })
2775
2946
  ]
2776
2947
  }
2777
2948
  ),
2778
- /* @__PURE__ */ jsx9(
2949
+ /* @__PURE__ */ jsx10(
2779
2950
  "button",
2780
2951
  {
2781
2952
  onClick: () => {
2782
2953
  onOpen?.();
2783
2954
  },
2784
2955
  className: "h-7 w-7 rounded-lg bg-gray-100 hover:bg-gray-200 flex items-center justify-center transition-colors",
2785
- children: /* @__PURE__ */ jsx9(Sparkles, { className: "h-3.5 w-3.5 text-black", fill: "currentColor" })
2956
+ children: /* @__PURE__ */ jsx10(Sparkles, { className: "h-3.5 w-3.5 text-black", fill: "currentColor" })
2786
2957
  }
2787
2958
  )
2788
- ] }) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
2789
- /* @__PURE__ */ jsx9(
2959
+ ] }) : /* @__PURE__ */ jsxs6(Fragment2, { children: [
2960
+ /* @__PURE__ */ jsx10(
2790
2961
  "input",
2791
2962
  {
2792
2963
  ref: searchInputRef,
@@ -2814,9 +2985,9 @@ ${userText}`
2814
2985
  className: "flex-1 text-sm text-gray-700 outline-none bg-transparent"
2815
2986
  }
2816
2987
  ),
2817
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2", children: [
2818
- /* @__PURE__ */ jsx9("span", { className: "text-xs text-gray-400 font-medium", children: "\u21B5 Enter" }),
2819
- /* @__PURE__ */ jsx9(
2988
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
2989
+ /* @__PURE__ */ jsx10("span", { className: "text-xs text-gray-400 font-medium", children: "\u21B5 Enter" }),
2990
+ /* @__PURE__ */ jsx10(
2820
2991
  "button",
2821
2992
  {
2822
2993
  onClick: () => {
@@ -2828,25 +2999,25 @@ ${userText}`
2828
2999
  setSearchExpanded(false);
2829
3000
  },
2830
3001
  className: "h-7 w-7 rounded-lg bg-gray-100 hover:bg-gray-200 flex items-center justify-center transition-colors cursor-pointer",
2831
- children: /* @__PURE__ */ jsx9(Sparkles, { className: "h-3.5 w-3.5 text-black", fill: "currentColor" })
3002
+ children: /* @__PURE__ */ jsx10(Sparkles, { className: "h-3.5 w-3.5 text-black", fill: "currentColor" })
2832
3003
  }
2833
3004
  )
2834
3005
  ] })
2835
3006
  ] }) }) });
2836
3007
  }
2837
- return /* @__PURE__ */ jsxs5(
3008
+ return /* @__PURE__ */ jsxs6(
2838
3009
  "section",
2839
3010
  {
2840
3011
  className: `fixed top-0 right-0 z-40 flex flex-col bg-white border-l border-gray-200 h-full overflow-hidden transition-transform duration-300 ${isOpen ? "translate-x-0" : "translate-x-full"}`,
2841
3012
  style: { width: `${PANEL_WIDTH}px` },
2842
3013
  children: [
2843
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-100 bg-gradient-to-r from-gray-50 to-white shrink-0", children: [
2844
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2.5", children: [
2845
- /* @__PURE__ */ jsx9(Sparkles, { className: "h-3.5 w-3.5 text-black", fill: "currentColor" }),
2846
- /* @__PURE__ */ jsx9("h3", { className: "text-sm font-semibold text-gray-800", children: "Copilot" })
3014
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-100 bg-gradient-to-r from-gray-50 to-white shrink-0", children: [
3015
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2.5", children: [
3016
+ /* @__PURE__ */ jsx10(Sparkles, { className: "h-3.5 w-3.5 text-black", fill: "currentColor" }),
3017
+ /* @__PURE__ */ jsx10("h3", { className: "text-sm font-semibold text-gray-800", children: "Copilot" })
2847
3018
  ] }),
2848
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-1", children: [
2849
- /* @__PURE__ */ jsx9(
3019
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1", children: [
3020
+ /* @__PURE__ */ jsx10(
2850
3021
  Button,
2851
3022
  {
2852
3023
  variant: "ghost",
@@ -2861,29 +3032,40 @@ ${userText}`
2861
3032
  activeGuideRef.current = void 0;
2862
3033
  setGuideComplete(false);
2863
3034
  },
2864
- children: /* @__PURE__ */ jsx9(SquarePen, { className: "h-3 w-3" })
3035
+ children: /* @__PURE__ */ jsx10(SquarePen, { className: "h-3 w-3" })
2865
3036
  }
2866
3037
  ),
2867
- /* @__PURE__ */ jsx9(
3038
+ /* @__PURE__ */ jsx10(
2868
3039
  Button,
2869
3040
  {
2870
3041
  variant: "ghost",
2871
3042
  size: "sm",
2872
3043
  className: "h-7 w-7 p-0 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-full",
2873
- onClick: () => onClose?.(),
2874
- children: /* @__PURE__ */ jsx9(Minus, { className: "h-3.5 w-3.5" })
3044
+ onClick: () => {
3045
+ if (isEscalated) {
3046
+ resetSession();
3047
+ setMessages([]);
3048
+ setPanelView("landing");
3049
+ setCurrentFolderId(void 0);
3050
+ setActiveGuide(void 0);
3051
+ activeGuideRef.current = void 0;
3052
+ setGuideComplete(false);
3053
+ }
3054
+ onClose?.();
3055
+ },
3056
+ children: /* @__PURE__ */ jsx10(Minus, { className: "h-3.5 w-3.5" })
2875
3057
  }
2876
3058
  )
2877
3059
  ] })
2878
3060
  ] }),
2879
- /* @__PURE__ */ jsx9(
3061
+ /* @__PURE__ */ jsx10(
2880
3062
  "div",
2881
3063
  {
2882
3064
  className: isEmpty ? "grid flex-1 place-items-center transition-all duration-300" : "flex flex-1 flex-col transition-all duration-300 min-h-0 overflow-hidden",
2883
- children: isEmpty ? /* @__PURE__ */ jsxs5("div", { className: "w-full overflow-y-auto px-4", children: [
2884
- /* @__PURE__ */ jsx9("div", { className: "py-3 transition-all duration-300", children: /* @__PURE__ */ jsx9("h2", { className: "text-center text-2xl font-semibold text-gray-900", children: panelView === "folder" ? folders.find((f) => f.id === currentFolderId)?.title || "" : "How can I help?" }) }),
2885
- /* @__PURE__ */ jsxs5("div", { className: "pb-4 px-4", children: [
2886
- panelView === "landing" && /* @__PURE__ */ jsx9(Fragment2, { children: /* @__PURE__ */ jsx9("div", { className: "flex flex-col gap-1", children: loadingQuestions ? /* @__PURE__ */ jsx9("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ jsx9(Loader22, { className: "h-4 w-4 animate-spin text-gray-400" }) }) : startingQuestions.map((question, index) => {
3065
+ children: isEmpty ? /* @__PURE__ */ jsxs6("div", { className: "w-full overflow-y-auto px-4", children: [
3066
+ /* @__PURE__ */ jsx10("div", { className: "py-3 transition-all duration-300", children: /* @__PURE__ */ jsx10("h2", { className: "text-center text-2xl font-semibold text-gray-900", children: panelView === "folder" ? folders.find((f) => f.id === currentFolderId)?.title || "" : "How can I help?" }) }),
3067
+ /* @__PURE__ */ jsxs6("div", { className: "pb-4 px-4", children: [
3068
+ panelView === "landing" && /* @__PURE__ */ jsx10(Fragment2, { children: /* @__PURE__ */ jsx10("div", { className: "flex flex-col gap-1", children: loadingQuestions ? /* @__PURE__ */ jsx10("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ jsx10(Loader22, { className: "h-4 w-4 animate-spin text-gray-400" }) }) : startingQuestions.map((question, index) => {
2887
3069
  const iconColors = [
2888
3070
  "bg-blue-400",
2889
3071
  "bg-green-400",
@@ -2891,7 +3073,7 @@ ${userText}`
2891
3073
  "bg-orange-400",
2892
3074
  "bg-pink-400"
2893
3075
  ];
2894
- return /* @__PURE__ */ jsxs5(
3076
+ return /* @__PURE__ */ jsxs6(
2895
3077
  Button,
2896
3078
  {
2897
3079
  type: "button",
@@ -2900,7 +3082,7 @@ ${userText}`
2900
3082
  className: "w-full justify-start rounded-lg px-3 py-1.5 text-xs text-gray-700 hover:bg-gray-100 h-auto",
2901
3083
  onClick: () => sendTopic(question.prompt),
2902
3084
  children: [
2903
- /* @__PURE__ */ jsx9(
3085
+ /* @__PURE__ */ jsx10(
2904
3086
  "span",
2905
3087
  {
2906
3088
  className: `mr-2 inline-block h-1.5 w-1.5 rounded-full ${iconColors[index % iconColors.length]}`
@@ -2912,9 +3094,9 @@ ${userText}`
2912
3094
  question.id
2913
3095
  );
2914
3096
  }) }) }),
2915
- panelView === "folder" && /* @__PURE__ */ jsxs5(Fragment2, { children: [
2916
- /* @__PURE__ */ jsxs5("div", { className: "mb-3 flex items-center gap-2", children: [
2917
- /* @__PURE__ */ jsx9(
3097
+ panelView === "folder" && /* @__PURE__ */ jsxs6(Fragment2, { children: [
3098
+ /* @__PURE__ */ jsxs6("div", { className: "mb-3 flex items-center gap-2", children: [
3099
+ /* @__PURE__ */ jsx10(
2918
3100
  Button,
2919
3101
  {
2920
3102
  type: "button",
@@ -2923,12 +3105,12 @@ ${userText}`
2923
3105
  className: "h-7 w-7 rounded-full hover:bg-gray-100",
2924
3106
  onClick: closeFolder,
2925
3107
  "aria-label": "Back to suggestions",
2926
- children: /* @__PURE__ */ jsx9(ArrowLeft, { className: "h-4 w-4 text-gray-500" })
3108
+ children: /* @__PURE__ */ jsx10(ArrowLeft, { className: "h-4 w-4 text-gray-500" })
2927
3109
  }
2928
3110
  ),
2929
- /* @__PURE__ */ jsx9("span", { className: "text-xs font-medium uppercase tracking-wide text-gray-400", children: "Topics" })
3111
+ /* @__PURE__ */ jsx10("span", { className: "text-xs font-medium uppercase tracking-wide text-gray-400", children: "Topics" })
2930
3112
  ] }),
2931
- /* @__PURE__ */ jsx9("div", { className: "flex flex-col gap-1.5", children: folders.find((f) => f.id === currentFolderId)?.topics.map((topic) => /* @__PURE__ */ jsx9(
3113
+ /* @__PURE__ */ jsx10("div", { className: "flex flex-col gap-1.5", children: folders.find((f) => f.id === currentFolderId)?.topics.map((topic) => /* @__PURE__ */ jsx10(
2932
3114
  Button,
2933
3115
  {
2934
3116
  type: "button",
@@ -2942,7 +3124,7 @@ ${userText}`
2942
3124
  )) })
2943
3125
  ] })
2944
3126
  ] })
2945
- ] }) : /* @__PURE__ */ jsx9(Fragment2, { children: /* @__PURE__ */ jsx9("div", { className: "flex-1 min-h-0 overflow-hidden", children: /* @__PURE__ */ jsx9(ScrollArea, { ref: messagesContainerRef, className: "h-full", children: /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2 px-4 py-3", children: [
3127
+ ] }) : /* @__PURE__ */ jsx10(Fragment2, { children: /* @__PURE__ */ jsx10("div", { className: "flex-1 min-h-0 overflow-hidden", children: /* @__PURE__ */ jsx10(ScrollArea, { ref: messagesContainerRef, className: "h-full", children: /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-2 px-4 py-3", children: [
2946
3128
  messages.map((message, index) => {
2947
3129
  const isUser = message.role === "user";
2948
3130
  const previousRole = index > 0 ? messages[index - 1].role : void 0;
@@ -2962,17 +3144,20 @@ ${userText}`
2962
3144
  return null;
2963
3145
  }
2964
3146
  if (isUser) {
2965
- return /* @__PURE__ */ jsx9("div", { className: `flex justify-end ${isRoleChange ? "mt-3" : ""}`, children: /* @__PURE__ */ jsx9("div", { className: "max-w-[260px] rounded-2xl rounded-br-md bg-gray-900 px-3.5 py-2.5 text-sm text-white shadow-sm", children: message.content }) }, message.id);
3147
+ return /* @__PURE__ */ jsx10("div", { className: `flex justify-end ${isRoleChange ? "mt-3" : ""}`, children: /* @__PURE__ */ jsx10("div", { className: "max-w-[260px] rounded-2xl rounded-br-md bg-gray-900 px-3 py-2 text-xs text-white shadow-sm", children: message.content }) }, message.id);
2966
3148
  }
2967
3149
  if (message.role === "agent") {
2968
- return /* @__PURE__ */ jsx9("div", { className: `flex justify-start ${isRoleChange ? "mt-3" : ""}`, children: /* @__PURE__ */ jsx9("div", { className: "max-w-[260px] rounded-2xl rounded-bl-md bg-blue-500 px-3.5 py-2.5 text-sm text-white shadow-sm", children: /* @__PURE__ */ jsx9("div", { className: "whitespace-pre-wrap leading-relaxed", children: renderMarkdown(message.content || "") }) }) }, message.id);
3150
+ return /* @__PURE__ */ jsxs6("div", { className: `flex flex-col items-start ${isRoleChange ? "mt-3" : ""}`, children: [
3151
+ isRoleChange && /* @__PURE__ */ jsx10("span", { className: "text-[10px] text-gray-500 mb-1 ml-1", children: "Agent" }),
3152
+ /* @__PURE__ */ jsx10("div", { className: "max-w-[260px] rounded-2xl rounded-bl-md bg-white border border-gray-200 px-3 py-2 text-xs text-gray-800 shadow-sm", children: message.content })
3153
+ ] }, message.id);
2969
3154
  }
2970
3155
  if (message.kind === "searchSummary") {
2971
- return /* @__PURE__ */ jsx9(
3156
+ return /* @__PURE__ */ jsx10(
2972
3157
  "div",
2973
3158
  {
2974
3159
  className: `${isRoleChange ? "mt-3" : ""}`,
2975
- children: /* @__PURE__ */ jsx9(
3160
+ children: /* @__PURE__ */ jsx10(
2976
3161
  AssistantSearchSummary,
2977
3162
  {
2978
3163
  title: message.title ?? "Search results",
@@ -2984,27 +3169,27 @@ ${userText}`
2984
3169
  );
2985
3170
  }
2986
3171
  if (message.kind === "guideComplete") {
2987
- return /* @__PURE__ */ jsx9(
3172
+ return /* @__PURE__ */ jsx10(
2988
3173
  "div",
2989
3174
  {
2990
3175
  ref: isCurrentGuideStep ? currentStepRef : null,
2991
3176
  className: `${isRoleChange ? "mt-3" : ""}`,
2992
- children: /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2 rounded-xl bg-green-50 border border-green-200 px-3 py-2.5 text-sm leading-6", children: [
2993
- /* @__PURE__ */ jsx9(CheckCircle23, { className: "h-5 w-5 text-green-600 flex-shrink-0" }),
2994
- /* @__PURE__ */ jsx9("span", { className: "font-medium text-green-800", children: message.content })
3177
+ children: /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2 rounded-xl bg-green-50 border border-green-200 px-3 py-2.5 text-sm leading-6", children: [
3178
+ /* @__PURE__ */ jsx10(CheckCircle23, { className: "h-5 w-5 text-green-600 flex-shrink-0" }),
3179
+ /* @__PURE__ */ jsx10("span", { className: "font-medium text-green-800", children: message.content })
2995
3180
  ] })
2996
3181
  },
2997
3182
  message.id
2998
3183
  );
2999
3184
  }
3000
3185
  if (message.kind === "navigationAction") {
3001
- return /* @__PURE__ */ jsxs5(
3186
+ return /* @__PURE__ */ jsxs6(
3002
3187
  "div",
3003
3188
  {
3004
3189
  className: `${isRoleChange ? "mt-3" : ""}`,
3005
3190
  children: [
3006
- /* @__PURE__ */ jsx9("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-2 text-gray-700", children: message.content || "" }),
3007
- message.navigationTarget && /* @__PURE__ */ jsx9("div", { className: "mt-2", children: /* @__PURE__ */ jsxs5(
3191
+ /* @__PURE__ */ jsx10("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-2 text-gray-700", children: message.content || "" }),
3192
+ message.navigationTarget && /* @__PURE__ */ jsx10("div", { className: "mt-2", children: /* @__PURE__ */ jsxs6(
3008
3193
  Button,
3009
3194
  {
3010
3195
  type: "button",
@@ -3015,10 +3200,10 @@ ${userText}`
3015
3200
  message.navigationTarget
3016
3201
  ),
3017
3202
  children: [
3018
- /* @__PURE__ */ jsx9("span", { children: "Confirm" }),
3019
- /* @__PURE__ */ jsxs5("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
3020
- /* @__PURE__ */ jsx9(Command, { className: "h-3 w-3" }),
3021
- /* @__PURE__ */ jsx9(CornerDownLeft, { className: "h-3 w-3" })
3203
+ /* @__PURE__ */ jsx10("span", { children: "Confirm" }),
3204
+ /* @__PURE__ */ jsxs6("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
3205
+ /* @__PURE__ */ jsx10(Command, { className: "h-3 w-3" }),
3206
+ /* @__PURE__ */ jsx10(CornerDownLeft, { className: "h-3 w-3" })
3022
3207
  ] })
3023
3208
  ]
3024
3209
  }
@@ -3076,26 +3261,26 @@ ${userText}`
3076
3261
  } else {
3077
3262
  successContent = "Action completed successfully.";
3078
3263
  }
3079
- return /* @__PURE__ */ jsx9(
3264
+ return /* @__PURE__ */ jsx10(
3080
3265
  "div",
3081
3266
  {
3082
3267
  className: `${isRoleChange ? "mt-3" : ""}`,
3083
- children: /* @__PURE__ */ jsx9("div", { className: "whitespace-pre-wrap text-sm leading-6 text-gray-700", children: successContent })
3268
+ children: /* @__PURE__ */ jsx10("div", { className: "whitespace-pre-wrap text-sm leading-6 text-gray-700", children: successContent })
3084
3269
  },
3085
3270
  message.id
3086
3271
  );
3087
3272
  }
3088
- return /* @__PURE__ */ jsxs5(
3273
+ return /* @__PURE__ */ jsxs6(
3089
3274
  "div",
3090
3275
  {
3091
3276
  className: `min-w-0 ${isRoleChange ? "mt-3" : ""}`,
3092
3277
  children: [
3093
- /* @__PURE__ */ jsx9("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700", children: message.content || "" }),
3094
- actionType === "updateCompanyInfo" && /* @__PURE__ */ jsxs5("div", { className: "space-y-2 bg-gray-50 rounded-lg p-2 border border-gray-200 overflow-hidden", children: [
3095
- /* @__PURE__ */ jsxs5("div", { className: "grid grid-cols-2 gap-2", children: [
3096
- /* @__PURE__ */ jsxs5("div", { children: [
3097
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
3098
- /* @__PURE__ */ jsx9(
3278
+ /* @__PURE__ */ jsx10("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700", children: message.content || "" }),
3279
+ actionType === "updateCompanyInfo" && /* @__PURE__ */ jsxs6("div", { className: "space-y-2 bg-gray-50 rounded-lg p-2 border border-gray-200 overflow-hidden", children: [
3280
+ /* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-2 gap-2", children: [
3281
+ /* @__PURE__ */ jsxs6("div", { children: [
3282
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
3283
+ /* @__PURE__ */ jsx10(
3099
3284
  Input,
3100
3285
  {
3101
3286
  placeholder: "Acme Corporation",
@@ -3108,9 +3293,9 @@ ${userText}`
3108
3293
  }
3109
3294
  )
3110
3295
  ] }),
3111
- /* @__PURE__ */ jsxs5("div", { children: [
3112
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Email" }),
3113
- /* @__PURE__ */ jsx9(
3296
+ /* @__PURE__ */ jsxs6("div", { children: [
3297
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Email" }),
3298
+ /* @__PURE__ */ jsx10(
3114
3299
  Input,
3115
3300
  {
3116
3301
  type: "email",
@@ -3125,9 +3310,9 @@ ${userText}`
3125
3310
  )
3126
3311
  ] })
3127
3312
  ] }),
3128
- /* @__PURE__ */ jsxs5("div", { children: [
3129
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Address" }),
3130
- /* @__PURE__ */ jsx9(
3313
+ /* @__PURE__ */ jsxs6("div", { children: [
3314
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Address" }),
3315
+ /* @__PURE__ */ jsx10(
3131
3316
  Input,
3132
3317
  {
3133
3318
  placeholder: "123 Main St, San Francisco, CA",
@@ -3140,10 +3325,10 @@ ${userText}`
3140
3325
  }
3141
3326
  )
3142
3327
  ] }),
3143
- /* @__PURE__ */ jsxs5("div", { className: "grid grid-cols-2 gap-2", children: [
3144
- /* @__PURE__ */ jsxs5("div", { children: [
3145
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Phone" }),
3146
- /* @__PURE__ */ jsx9(
3328
+ /* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-2 gap-2", children: [
3329
+ /* @__PURE__ */ jsxs6("div", { children: [
3330
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Phone" }),
3331
+ /* @__PURE__ */ jsx10(
3147
3332
  Input,
3148
3333
  {
3149
3334
  type: "tel",
@@ -3157,9 +3342,9 @@ ${userText}`
3157
3342
  }
3158
3343
  )
3159
3344
  ] }),
3160
- /* @__PURE__ */ jsxs5("div", { children: [
3161
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Website" }),
3162
- /* @__PURE__ */ jsx9(
3345
+ /* @__PURE__ */ jsxs6("div", { children: [
3346
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Website" }),
3347
+ /* @__PURE__ */ jsx10(
3163
3348
  Input,
3164
3349
  {
3165
3350
  type: "url",
@@ -3175,9 +3360,9 @@ ${userText}`
3175
3360
  ] })
3176
3361
  ] })
3177
3362
  ] }),
3178
- actionType === "addApiKey" && /* @__PURE__ */ jsx9("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ jsxs5("div", { children: [
3179
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name" }),
3180
- /* @__PURE__ */ jsx9(
3363
+ actionType === "addApiKey" && /* @__PURE__ */ jsx10("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ jsxs6("div", { children: [
3364
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name" }),
3365
+ /* @__PURE__ */ jsx10(
3181
3366
  Input,
3182
3367
  {
3183
3368
  placeholder: "Production Key",
@@ -3190,11 +3375,11 @@ ${userText}`
3190
3375
  }
3191
3376
  )
3192
3377
  ] }) }),
3193
- actionType === "addCustomer" && /* @__PURE__ */ jsxs5("div", { className: "space-y-2 bg-gray-50 rounded-lg p-2 border border-gray-200 overflow-hidden", children: [
3194
- /* @__PURE__ */ jsxs5("div", { className: "grid grid-cols-2 gap-2", children: [
3195
- /* @__PURE__ */ jsxs5("div", { children: [
3196
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
3197
- /* @__PURE__ */ jsx9(
3378
+ actionType === "addCustomer" && /* @__PURE__ */ jsxs6("div", { className: "space-y-2 bg-gray-50 rounded-lg p-2 border border-gray-200 overflow-hidden", children: [
3379
+ /* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-2 gap-2", children: [
3380
+ /* @__PURE__ */ jsxs6("div", { children: [
3381
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Company Name" }),
3382
+ /* @__PURE__ */ jsx10(
3198
3383
  Input,
3199
3384
  {
3200
3385
  placeholder: "Acme Corporation",
@@ -3207,9 +3392,9 @@ ${userText}`
3207
3392
  }
3208
3393
  )
3209
3394
  ] }),
3210
- /* @__PURE__ */ jsxs5("div", { children: [
3211
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Email" }),
3212
- /* @__PURE__ */ jsx9(
3395
+ /* @__PURE__ */ jsxs6("div", { children: [
3396
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Email" }),
3397
+ /* @__PURE__ */ jsx10(
3213
3398
  Input,
3214
3399
  {
3215
3400
  type: "email",
@@ -3224,9 +3409,9 @@ ${userText}`
3224
3409
  )
3225
3410
  ] })
3226
3411
  ] }),
3227
- /* @__PURE__ */ jsxs5("div", { children: [
3228
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Location" }),
3229
- /* @__PURE__ */ jsx9(
3412
+ /* @__PURE__ */ jsxs6("div", { children: [
3413
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Location" }),
3414
+ /* @__PURE__ */ jsx10(
3230
3415
  Input,
3231
3416
  {
3232
3417
  placeholder: "San Francisco, CA",
@@ -3239,9 +3424,9 @@ ${userText}`
3239
3424
  }
3240
3425
  )
3241
3426
  ] }),
3242
- /* @__PURE__ */ jsxs5("div", { children: [
3243
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Subscription Tier" }),
3244
- /* @__PURE__ */ jsxs5(
3427
+ /* @__PURE__ */ jsxs6("div", { children: [
3428
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Subscription Tier" }),
3429
+ /* @__PURE__ */ jsxs6(
3245
3430
  "select",
3246
3431
  {
3247
3432
  value: formData.subscription || "Starter",
@@ -3251,19 +3436,19 @@ ${userText}`
3251
3436
  }),
3252
3437
  className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
3253
3438
  children: [
3254
- /* @__PURE__ */ jsx9("option", { value: "Starter", children: "Starter" }),
3255
- /* @__PURE__ */ jsx9("option", { value: "Professional", children: "Professional" }),
3256
- /* @__PURE__ */ jsx9("option", { value: "Enterprise", children: "Enterprise" })
3439
+ /* @__PURE__ */ jsx10("option", { value: "Starter", children: "Starter" }),
3440
+ /* @__PURE__ */ jsx10("option", { value: "Professional", children: "Professional" }),
3441
+ /* @__PURE__ */ jsx10("option", { value: "Enterprise", children: "Enterprise" })
3257
3442
  ]
3258
3443
  }
3259
3444
  )
3260
3445
  ] })
3261
3446
  ] }),
3262
- (actionType === "enable2FA" || actionType === "disable2FA") && /* @__PURE__ */ jsx9("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ jsx9("p", { className: "text-xs text-black", children: actionType === "enable2FA" ? "This will enable two-factor authentication for your account. You'll need to set up an authenticator app." : "This will disable two-factor authentication for your account. Your account will be less secure." }) }),
3263
- actionType === "changePassword" && /* @__PURE__ */ jsxs5("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3264
- /* @__PURE__ */ jsxs5("div", { children: [
3265
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Current Password" }),
3266
- /* @__PURE__ */ jsx9(
3447
+ (actionType === "enable2FA" || actionType === "disable2FA") && /* @__PURE__ */ jsx10("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ jsx10("p", { className: "text-xs text-black", children: actionType === "enable2FA" ? "This will enable two-factor authentication for your account. You'll need to set up an authenticator app." : "This will disable two-factor authentication for your account. Your account will be less secure." }) }),
3448
+ actionType === "changePassword" && /* @__PURE__ */ jsxs6("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3449
+ /* @__PURE__ */ jsxs6("div", { children: [
3450
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Current Password" }),
3451
+ /* @__PURE__ */ jsx10(
3267
3452
  Input,
3268
3453
  {
3269
3454
  type: "password",
@@ -3276,9 +3461,9 @@ ${userText}`
3276
3461
  }
3277
3462
  )
3278
3463
  ] }),
3279
- /* @__PURE__ */ jsxs5("div", { children: [
3280
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "New Password" }),
3281
- /* @__PURE__ */ jsx9(
3464
+ /* @__PURE__ */ jsxs6("div", { children: [
3465
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "New Password" }),
3466
+ /* @__PURE__ */ jsx10(
3282
3467
  Input,
3283
3468
  {
3284
3469
  type: "password",
@@ -3291,9 +3476,9 @@ ${userText}`
3291
3476
  }
3292
3477
  )
3293
3478
  ] }),
3294
- /* @__PURE__ */ jsxs5("div", { children: [
3295
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Confirm New Password" }),
3296
- /* @__PURE__ */ jsx9(
3479
+ /* @__PURE__ */ jsxs6("div", { children: [
3480
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Confirm New Password" }),
3481
+ /* @__PURE__ */ jsx10(
3297
3482
  Input,
3298
3483
  {
3299
3484
  type: "password",
@@ -3307,10 +3492,10 @@ ${userText}`
3307
3492
  )
3308
3493
  ] })
3309
3494
  ] }),
3310
- actionType === "toggleNotification" && /* @__PURE__ */ jsxs5("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3311
- /* @__PURE__ */ jsxs5("div", { children: [
3312
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Notification Type" }),
3313
- /* @__PURE__ */ jsxs5(
3495
+ actionType === "toggleNotification" && /* @__PURE__ */ jsxs6("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3496
+ /* @__PURE__ */ jsxs6("div", { children: [
3497
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Notification Type" }),
3498
+ /* @__PURE__ */ jsxs6(
3314
3499
  "select",
3315
3500
  {
3316
3501
  value: formData.notificationType || "paymentReceived",
@@ -3320,17 +3505,17 @@ ${userText}`
3320
3505
  }),
3321
3506
  className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
3322
3507
  children: [
3323
- /* @__PURE__ */ jsx9("option", { value: "paymentReceived", children: "Payment Received" }),
3324
- /* @__PURE__ */ jsx9("option", { value: "paymentFailed", children: "Payment Failed" }),
3325
- /* @__PURE__ */ jsx9("option", { value: "invoicePaid", children: "Invoice Paid" }),
3326
- /* @__PURE__ */ jsx9("option", { value: "monthlySummary", children: "Monthly Summary" }),
3327
- /* @__PURE__ */ jsx9("option", { value: "productUpdates", children: "Product Updates" })
3508
+ /* @__PURE__ */ jsx10("option", { value: "paymentReceived", children: "Payment Received" }),
3509
+ /* @__PURE__ */ jsx10("option", { value: "paymentFailed", children: "Payment Failed" }),
3510
+ /* @__PURE__ */ jsx10("option", { value: "invoicePaid", children: "Invoice Paid" }),
3511
+ /* @__PURE__ */ jsx10("option", { value: "monthlySummary", children: "Monthly Summary" }),
3512
+ /* @__PURE__ */ jsx10("option", { value: "productUpdates", children: "Product Updates" })
3328
3513
  ]
3329
3514
  }
3330
3515
  )
3331
3516
  ] }),
3332
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2", children: [
3333
- /* @__PURE__ */ jsx9(
3517
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
3518
+ /* @__PURE__ */ jsx10(
3334
3519
  "input",
3335
3520
  {
3336
3521
  type: "checkbox",
@@ -3342,12 +3527,12 @@ ${userText}`
3342
3527
  className: "h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
3343
3528
  }
3344
3529
  ),
3345
- /* @__PURE__ */ jsx9("label", { className: "text-xs text-black", children: "Enable this notification" })
3530
+ /* @__PURE__ */ jsx10("label", { className: "text-xs text-black", children: "Enable this notification" })
3346
3531
  ] })
3347
3532
  ] }),
3348
- (actionType === "connectIntegration" || actionType === "disconnectIntegration") && /* @__PURE__ */ jsx9("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ jsxs5("div", { children: [
3349
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Integration" }),
3350
- /* @__PURE__ */ jsxs5(
3533
+ (actionType === "connectIntegration" || actionType === "disconnectIntegration") && /* @__PURE__ */ jsx10("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ jsxs6("div", { children: [
3534
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Integration" }),
3535
+ /* @__PURE__ */ jsxs6(
3351
3536
  "select",
3352
3537
  {
3353
3538
  value: formData.integrationName || "Slack",
@@ -3357,17 +3542,17 @@ ${userText}`
3357
3542
  }),
3358
3543
  className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
3359
3544
  children: [
3360
- /* @__PURE__ */ jsx9("option", { value: "Slack", children: "Slack" }),
3361
- /* @__PURE__ */ jsx9("option", { value: "Zapier", children: "Zapier" }),
3362
- /* @__PURE__ */ jsx9("option", { value: "Webhook", children: "Webhook" })
3545
+ /* @__PURE__ */ jsx10("option", { value: "Slack", children: "Slack" }),
3546
+ /* @__PURE__ */ jsx10("option", { value: "Zapier", children: "Zapier" }),
3547
+ /* @__PURE__ */ jsx10("option", { value: "Webhook", children: "Webhook" })
3363
3548
  ]
3364
3549
  }
3365
3550
  )
3366
3551
  ] }) }),
3367
- actionType === "addPaymentMethod" && /* @__PURE__ */ jsxs5("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3368
- /* @__PURE__ */ jsxs5("div", { children: [
3369
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Card Number" }),
3370
- /* @__PURE__ */ jsx9(
3552
+ actionType === "addPaymentMethod" && /* @__PURE__ */ jsxs6("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3553
+ /* @__PURE__ */ jsxs6("div", { children: [
3554
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Card Number" }),
3555
+ /* @__PURE__ */ jsx10(
3371
3556
  Input,
3372
3557
  {
3373
3558
  placeholder: "1234 5678 9012 3456",
@@ -3380,9 +3565,9 @@ ${userText}`
3380
3565
  }
3381
3566
  )
3382
3567
  ] }),
3383
- /* @__PURE__ */ jsxs5("div", { children: [
3384
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Expiry Date" }),
3385
- /* @__PURE__ */ jsx9(
3568
+ /* @__PURE__ */ jsxs6("div", { children: [
3569
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Expiry Date" }),
3570
+ /* @__PURE__ */ jsx10(
3386
3571
  Input,
3387
3572
  {
3388
3573
  placeholder: "MM/YY",
@@ -3396,11 +3581,11 @@ ${userText}`
3396
3581
  )
3397
3582
  ] })
3398
3583
  ] }),
3399
- actionType === "removePaymentMethod" && /* @__PURE__ */ jsx9("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ jsx9("p", { className: "text-xs text-black", children: "This will remove the default payment method from your account." }) }),
3400
- actionType === "refundPayment" && /* @__PURE__ */ jsxs5("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3401
- /* @__PURE__ */ jsxs5("div", { children: [
3402
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Transaction ID or Customer Name" }),
3403
- /* @__PURE__ */ jsx9(
3584
+ actionType === "removePaymentMethod" && /* @__PURE__ */ jsx10("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ jsx10("p", { className: "text-xs text-black", children: "This will remove the default payment method from your account." }) }),
3585
+ actionType === "refundPayment" && /* @__PURE__ */ jsxs6("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3586
+ /* @__PURE__ */ jsxs6("div", { children: [
3587
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Transaction ID or Customer Name" }),
3588
+ /* @__PURE__ */ jsx10(
3404
3589
  Input,
3405
3590
  {
3406
3591
  placeholder: "e.g., txn_1234 or Acme Corp",
@@ -3425,9 +3610,9 @@ ${userText}`
3425
3610
  }
3426
3611
  )
3427
3612
  ] }),
3428
- /* @__PURE__ */ jsxs5("div", { children: [
3429
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Amount (optional)" }),
3430
- /* @__PURE__ */ jsx9(
3613
+ /* @__PURE__ */ jsxs6("div", { children: [
3614
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Amount (optional)" }),
3615
+ /* @__PURE__ */ jsx10(
3431
3616
  Input,
3432
3617
  {
3433
3618
  placeholder: "$0.00",
@@ -3440,9 +3625,9 @@ ${userText}`
3440
3625
  }
3441
3626
  )
3442
3627
  ] }),
3443
- /* @__PURE__ */ jsxs5("div", { children: [
3444
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Reason (optional)" }),
3445
- /* @__PURE__ */ jsx9(
3628
+ /* @__PURE__ */ jsxs6("div", { children: [
3629
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Reason (optional)" }),
3630
+ /* @__PURE__ */ jsx10(
3446
3631
  Input,
3447
3632
  {
3448
3633
  placeholder: "e.g., Customer request",
@@ -3456,10 +3641,10 @@ ${userText}`
3456
3641
  )
3457
3642
  ] })
3458
3643
  ] }),
3459
- actionType === "deleteApiKey" && /* @__PURE__ */ jsxs5("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3460
- /* @__PURE__ */ jsxs5("div", { children: [
3461
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name or ID" }),
3462
- /* @__PURE__ */ jsx9(
3644
+ actionType === "deleteApiKey" && /* @__PURE__ */ jsxs6("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3645
+ /* @__PURE__ */ jsxs6("div", { children: [
3646
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "API Key Name or ID" }),
3647
+ /* @__PURE__ */ jsx10(
3463
3648
  Input,
3464
3649
  {
3465
3650
  placeholder: "Production Key",
@@ -3473,12 +3658,12 @@ ${userText}`
3473
3658
  }
3474
3659
  )
3475
3660
  ] }),
3476
- /* @__PURE__ */ jsx9("p", { className: "text-xs text-red-600", children: "Warning: This action cannot be undone. The API key will be permanently deleted." })
3661
+ /* @__PURE__ */ jsx10("p", { className: "text-xs text-red-600", children: "Warning: This action cannot be undone. The API key will be permanently deleted." })
3477
3662
  ] }),
3478
- actionType === "addWebhook" && /* @__PURE__ */ jsxs5("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3479
- /* @__PURE__ */ jsxs5("div", { children: [
3480
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Webhook URL" }),
3481
- /* @__PURE__ */ jsx9(
3663
+ actionType === "addWebhook" && /* @__PURE__ */ jsxs6("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3664
+ /* @__PURE__ */ jsxs6("div", { children: [
3665
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Webhook URL" }),
3666
+ /* @__PURE__ */ jsx10(
3482
3667
  Input,
3483
3668
  {
3484
3669
  type: "url",
@@ -3492,9 +3677,9 @@ ${userText}`
3492
3677
  }
3493
3678
  )
3494
3679
  ] }),
3495
- /* @__PURE__ */ jsxs5("div", { children: [
3496
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Name (optional)" }),
3497
- /* @__PURE__ */ jsx9(
3680
+ /* @__PURE__ */ jsxs6("div", { children: [
3681
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Name (optional)" }),
3682
+ /* @__PURE__ */ jsx10(
3498
3683
  Input,
3499
3684
  {
3500
3685
  placeholder: "Production Webhook",
@@ -3508,9 +3693,9 @@ ${userText}`
3508
3693
  )
3509
3694
  ] })
3510
3695
  ] }),
3511
- actionType === "updateCurrency" && /* @__PURE__ */ jsx9("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ jsxs5("div", { children: [
3512
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Currency" }),
3513
- /* @__PURE__ */ jsxs5(
3696
+ actionType === "updateCurrency" && /* @__PURE__ */ jsx10("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ jsxs6("div", { children: [
3697
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Currency" }),
3698
+ /* @__PURE__ */ jsxs6(
3514
3699
  "select",
3515
3700
  {
3516
3701
  value: formData.currency || "USD",
@@ -3520,17 +3705,17 @@ ${userText}`
3520
3705
  }),
3521
3706
  className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
3522
3707
  children: [
3523
- /* @__PURE__ */ jsx9("option", { value: "USD", children: "USD ($)" }),
3524
- /* @__PURE__ */ jsx9("option", { value: "EUR", children: "EUR (\u20AC)" }),
3525
- /* @__PURE__ */ jsx9("option", { value: "GBP", children: "GBP (\xA3)" }),
3526
- /* @__PURE__ */ jsx9("option", { value: "JPY", children: "JPY (\xA5)" })
3708
+ /* @__PURE__ */ jsx10("option", { value: "USD", children: "USD ($)" }),
3709
+ /* @__PURE__ */ jsx10("option", { value: "EUR", children: "EUR (\u20AC)" }),
3710
+ /* @__PURE__ */ jsx10("option", { value: "GBP", children: "GBP (\xA3)" }),
3711
+ /* @__PURE__ */ jsx10("option", { value: "JPY", children: "JPY (\xA5)" })
3527
3712
  ]
3528
3713
  }
3529
3714
  )
3530
3715
  ] }) }),
3531
- actionType === "updateTimezone" && /* @__PURE__ */ jsx9("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ jsxs5("div", { children: [
3532
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Timezone" }),
3533
- /* @__PURE__ */ jsxs5(
3716
+ actionType === "updateTimezone" && /* @__PURE__ */ jsx10("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: /* @__PURE__ */ jsxs6("div", { children: [
3717
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Timezone" }),
3718
+ /* @__PURE__ */ jsxs6(
3534
3719
  "select",
3535
3720
  {
3536
3721
  value: formData.timezone || "America/Los_Angeles",
@@ -3540,18 +3725,18 @@ ${userText}`
3540
3725
  }),
3541
3726
  className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
3542
3727
  children: [
3543
- /* @__PURE__ */ jsx9("option", { value: "America/Los_Angeles", children: "Pacific Time (PT)" }),
3544
- /* @__PURE__ */ jsx9("option", { value: "America/New_York", children: "Eastern Time (ET)" }),
3545
- /* @__PURE__ */ jsx9("option", { value: "Europe/London", children: "GMT" }),
3546
- /* @__PURE__ */ jsx9("option", { value: "Asia/Tokyo", children: "JST" })
3728
+ /* @__PURE__ */ jsx10("option", { value: "America/Los_Angeles", children: "Pacific Time (PT)" }),
3729
+ /* @__PURE__ */ jsx10("option", { value: "America/New_York", children: "Eastern Time (ET)" }),
3730
+ /* @__PURE__ */ jsx10("option", { value: "Europe/London", children: "GMT" }),
3731
+ /* @__PURE__ */ jsx10("option", { value: "Asia/Tokyo", children: "JST" })
3547
3732
  ]
3548
3733
  }
3549
3734
  )
3550
3735
  ] }) }),
3551
- actionType === "revokeSession" && /* @__PURE__ */ jsxs5("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3552
- /* @__PURE__ */ jsxs5("div", { children: [
3553
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Device/Session" }),
3554
- /* @__PURE__ */ jsx9(
3736
+ actionType === "revokeSession" && /* @__PURE__ */ jsxs6("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3737
+ /* @__PURE__ */ jsxs6("div", { children: [
3738
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Device/Session" }),
3739
+ /* @__PURE__ */ jsx10(
3555
3740
  Input,
3556
3741
  {
3557
3742
  placeholder: "MacBook Pro",
@@ -3564,12 +3749,12 @@ ${userText}`
3564
3749
  }
3565
3750
  )
3566
3751
  ] }),
3567
- /* @__PURE__ */ jsx9("p", { className: "text-xs text-black", children: "This will sign out the device and invalidate its session." })
3752
+ /* @__PURE__ */ jsx10("p", { className: "text-xs text-black", children: "This will sign out the device and invalidate its session." })
3568
3753
  ] }),
3569
- actionType === "createSubscription" && /* @__PURE__ */ jsxs5("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3570
- /* @__PURE__ */ jsxs5("div", { children: [
3571
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Customer Email" }),
3572
- /* @__PURE__ */ jsx9(
3754
+ actionType === "createSubscription" && /* @__PURE__ */ jsxs6("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3755
+ /* @__PURE__ */ jsxs6("div", { children: [
3756
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Customer Email" }),
3757
+ /* @__PURE__ */ jsx10(
3573
3758
  Input,
3574
3759
  {
3575
3760
  type: "email",
@@ -3583,9 +3768,9 @@ ${userText}`
3583
3768
  }
3584
3769
  )
3585
3770
  ] }),
3586
- /* @__PURE__ */ jsxs5("div", { children: [
3587
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Plan" }),
3588
- /* @__PURE__ */ jsxs5(
3771
+ /* @__PURE__ */ jsxs6("div", { children: [
3772
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Plan" }),
3773
+ /* @__PURE__ */ jsxs6(
3589
3774
  "select",
3590
3775
  {
3591
3776
  value: formData.plan || "Starter",
@@ -3595,16 +3780,16 @@ ${userText}`
3595
3780
  }),
3596
3781
  className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
3597
3782
  children: [
3598
- /* @__PURE__ */ jsx9("option", { value: "Starter", children: "Starter ($29/mo)" }),
3599
- /* @__PURE__ */ jsx9("option", { value: "Professional", children: "Professional ($99/mo)" }),
3600
- /* @__PURE__ */ jsx9("option", { value: "Enterprise", children: "Enterprise ($299/mo)" })
3783
+ /* @__PURE__ */ jsx10("option", { value: "Starter", children: "Starter ($29/mo)" }),
3784
+ /* @__PURE__ */ jsx10("option", { value: "Professional", children: "Professional ($99/mo)" }),
3785
+ /* @__PURE__ */ jsx10("option", { value: "Enterprise", children: "Enterprise ($299/mo)" })
3601
3786
  ]
3602
3787
  }
3603
3788
  )
3604
3789
  ] }),
3605
- /* @__PURE__ */ jsxs5("div", { children: [
3606
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Billing Cycle" }),
3607
- /* @__PURE__ */ jsxs5(
3790
+ /* @__PURE__ */ jsxs6("div", { children: [
3791
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Billing Cycle" }),
3792
+ /* @__PURE__ */ jsxs6(
3608
3793
  "select",
3609
3794
  {
3610
3795
  value: formData.billingCycle || "monthly",
@@ -3614,18 +3799,18 @@ ${userText}`
3614
3799
  }),
3615
3800
  className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
3616
3801
  children: [
3617
- /* @__PURE__ */ jsx9("option", { value: "monthly", children: "Monthly" }),
3618
- /* @__PURE__ */ jsx9("option", { value: "yearly", children: "Yearly (Save 15%)" })
3802
+ /* @__PURE__ */ jsx10("option", { value: "monthly", children: "Monthly" }),
3803
+ /* @__PURE__ */ jsx10("option", { value: "yearly", children: "Yearly (Save 15%)" })
3619
3804
  ]
3620
3805
  }
3621
3806
  )
3622
3807
  ] })
3623
3808
  ] }),
3624
- actionType === "exportCertificate" && /* @__PURE__ */ jsxs5("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3625
- /* @__PURE__ */ jsx9("p", { className: "text-xs text-black", children: "This will export your certificate of incorporation document." }),
3626
- /* @__PURE__ */ jsxs5("div", { children: [
3627
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Format" }),
3628
- /* @__PURE__ */ jsxs5(
3809
+ actionType === "exportCertificate" && /* @__PURE__ */ jsxs6("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3810
+ /* @__PURE__ */ jsx10("p", { className: "text-xs text-black", children: "This will export your certificate of incorporation document." }),
3811
+ /* @__PURE__ */ jsxs6("div", { children: [
3812
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Format" }),
3813
+ /* @__PURE__ */ jsxs6(
3629
3814
  "select",
3630
3815
  {
3631
3816
  value: formData.format || "pdf",
@@ -3635,17 +3820,17 @@ ${userText}`
3635
3820
  }),
3636
3821
  className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
3637
3822
  children: [
3638
- /* @__PURE__ */ jsx9("option", { value: "pdf", children: "PDF" }),
3639
- /* @__PURE__ */ jsx9("option", { value: "json", children: "JSON" })
3823
+ /* @__PURE__ */ jsx10("option", { value: "pdf", children: "PDF" }),
3824
+ /* @__PURE__ */ jsx10("option", { value: "json", children: "JSON" })
3640
3825
  ]
3641
3826
  }
3642
3827
  )
3643
3828
  ] })
3644
3829
  ] }),
3645
- (actionType === "toggleBlockRule" || actionType === "enableBlockRule" || actionType === "disableBlockRule") && /* @__PURE__ */ jsxs5("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3646
- /* @__PURE__ */ jsxs5("div", { children: [
3647
- /* @__PURE__ */ jsx9("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Block Rule" }),
3648
- /* @__PURE__ */ jsxs5(
3830
+ (actionType === "toggleBlockRule" || actionType === "enableBlockRule" || actionType === "disableBlockRule") && /* @__PURE__ */ jsxs6("div", { className: "space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200", children: [
3831
+ /* @__PURE__ */ jsxs6("div", { children: [
3832
+ /* @__PURE__ */ jsx10("label", { className: "text-xs font-medium text-black mb-1.5 block", children: "Block Rule" }),
3833
+ /* @__PURE__ */ jsxs6(
3649
3834
  "select",
3650
3835
  {
3651
3836
  value: formData.ruleId || "rule_1",
@@ -3655,17 +3840,17 @@ ${userText}`
3655
3840
  }),
3656
3841
  className: "h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",
3657
3842
  children: [
3658
- /* @__PURE__ */ jsx9("option", { value: "rule_1", children: "Block if risk level = 'highest'" }),
3659
- /* @__PURE__ */ jsx9("option", { value: "rule_2", children: "Block if matches Stripe block lists" }),
3660
- /* @__PURE__ */ jsx9("option", { value: "rule_3", children: "Block if CVC verification fails" }),
3661
- /* @__PURE__ */ jsx9("option", { value: "rule_4", children: "Block if Postal code verification fails" })
3843
+ /* @__PURE__ */ jsx10("option", { value: "rule_1", children: "Block if risk level = 'highest'" }),
3844
+ /* @__PURE__ */ jsx10("option", { value: "rule_2", children: "Block if matches Stripe block lists" }),
3845
+ /* @__PURE__ */ jsx10("option", { value: "rule_3", children: "Block if CVC verification fails" }),
3846
+ /* @__PURE__ */ jsx10("option", { value: "rule_4", children: "Block if Postal code verification fails" })
3662
3847
  ]
3663
3848
  }
3664
3849
  )
3665
3850
  ] }),
3666
- /* @__PURE__ */ jsx9("p", { className: "text-xs text-black", children: actionType === "enableBlockRule" ? "This will enable the selected block rule to actively block matching payments." : actionType === "disableBlockRule" ? "This will disable the selected block rule. Matching payments will no longer be blocked." : "This will toggle the selected block rule's state." })
3851
+ /* @__PURE__ */ jsx10("p", { className: "text-xs text-black", children: actionType === "enableBlockRule" ? "This will enable the selected block rule to actively block matching payments." : actionType === "disableBlockRule" ? "This will disable the selected block rule. Matching payments will no longer be blocked." : "This will toggle the selected block rule's state." })
3667
3852
  ] }),
3668
- /* @__PURE__ */ jsx9("div", { className: "mt-3", children: /* @__PURE__ */ jsxs5(
3853
+ /* @__PURE__ */ jsx10("div", { className: "mt-3", children: /* @__PURE__ */ jsxs6(
3669
3854
  Button,
3670
3855
  {
3671
3856
  type: "button",
@@ -3674,10 +3859,10 @@ ${userText}`
3674
3859
  className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
3675
3860
  onClick: handleActionSubmit,
3676
3861
  children: [
3677
- /* @__PURE__ */ jsx9("span", { children: "Confirm" }),
3678
- /* @__PURE__ */ jsxs5("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
3679
- /* @__PURE__ */ jsx9(Command, { className: "h-3 w-3" }),
3680
- /* @__PURE__ */ jsx9(CornerDownLeft, { className: "h-3 w-3" })
3862
+ /* @__PURE__ */ jsx10("span", { children: "Confirm" }),
3863
+ /* @__PURE__ */ jsxs6("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
3864
+ /* @__PURE__ */ jsx10(Command, { className: "h-3 w-3" }),
3865
+ /* @__PURE__ */ jsx10(CornerDownLeft, { className: "h-3 w-3" })
3681
3866
  ] })
3682
3867
  ]
3683
3868
  }
@@ -3688,25 +3873,25 @@ ${userText}`
3688
3873
  );
3689
3874
  }
3690
3875
  if (message.kind === "bulkPreview" && message.csvData) {
3691
- return /* @__PURE__ */ jsxs5(
3876
+ return /* @__PURE__ */ jsxs6(
3692
3877
  "div",
3693
3878
  {
3694
3879
  className: `${isRoleChange ? "mt-3" : ""}`,
3695
3880
  children: [
3696
- /* @__PURE__ */ jsx9("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700", children: message.content || "" }),
3697
- /* @__PURE__ */ jsxs5("div", { className: "bg-gray-50 rounded-lg border border-gray-200 overflow-hidden", children: [
3698
- /* @__PURE__ */ jsxs5("div", { className: "bg-gray-100 px-3 py-2 border-b border-gray-200 flex items-center gap-2", children: [
3699
- /* @__PURE__ */ jsx9(FileSpreadsheet, { className: "h-4 w-4 text-gray-600" }),
3700
- /* @__PURE__ */ jsx9("span", { className: "text-xs font-medium text-gray-700", children: message.csvData.fileName }),
3701
- /* @__PURE__ */ jsxs5("span", { className: "text-xs text-gray-500", children: [
3881
+ /* @__PURE__ */ jsx10("div", { className: "whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700", children: message.content || "" }),
3882
+ /* @__PURE__ */ jsxs6("div", { className: "bg-gray-50 rounded-lg border border-gray-200 overflow-hidden", children: [
3883
+ /* @__PURE__ */ jsxs6("div", { className: "bg-gray-100 px-3 py-2 border-b border-gray-200 flex items-center gap-2", children: [
3884
+ /* @__PURE__ */ jsx10(FileSpreadsheet, { className: "h-4 w-4 text-gray-600" }),
3885
+ /* @__PURE__ */ jsx10("span", { className: "text-xs font-medium text-gray-700", children: message.csvData.fileName }),
3886
+ /* @__PURE__ */ jsxs6("span", { className: "text-xs text-gray-500", children: [
3702
3887
  "\u2022 ",
3703
3888
  message.csvData.rowCount,
3704
3889
  " rows"
3705
3890
  ] })
3706
3891
  ] }),
3707
- /* @__PURE__ */ jsxs5("div", { className: "px-3 py-2 border-b border-gray-100", children: [
3708
- /* @__PURE__ */ jsx9("div", { className: "text-[10px] uppercase tracking-wider text-gray-500 mb-1", children: "Columns" }),
3709
- /* @__PURE__ */ jsx9("div", { className: "flex flex-wrap gap-1", children: message.csvData.columns.map((col, i) => /* @__PURE__ */ jsx9(
3892
+ /* @__PURE__ */ jsxs6("div", { className: "px-3 py-2 border-b border-gray-100", children: [
3893
+ /* @__PURE__ */ jsx10("div", { className: "text-[10px] uppercase tracking-wider text-gray-500 mb-1", children: "Columns" }),
3894
+ /* @__PURE__ */ jsx10("div", { className: "flex flex-wrap gap-1", children: message.csvData.columns.map((col, i) => /* @__PURE__ */ jsx10(
3710
3895
  "span",
3711
3896
  {
3712
3897
  className: "text-xs bg-blue-100 text-blue-700 px-1.5 py-0.5 rounded",
@@ -3715,23 +3900,23 @@ ${userText}`
3715
3900
  i
3716
3901
  )) })
3717
3902
  ] }),
3718
- message.csvData.sampleRows.length > 0 && /* @__PURE__ */ jsxs5("div", { className: "px-3 py-2", children: [
3719
- /* @__PURE__ */ jsx9("div", { className: "text-[10px] uppercase tracking-wider text-gray-500 mb-1", children: "Sample Data" }),
3720
- /* @__PURE__ */ jsx9("div", { className: "space-y-1", children: message.csvData.sampleRows.slice(0, 3).map((row, i) => /* @__PURE__ */ jsxs5(
3903
+ message.csvData.sampleRows.length > 0 && /* @__PURE__ */ jsxs6("div", { className: "px-3 py-2", children: [
3904
+ /* @__PURE__ */ jsx10("div", { className: "text-[10px] uppercase tracking-wider text-gray-500 mb-1", children: "Sample Data" }),
3905
+ /* @__PURE__ */ jsx10("div", { className: "space-y-1", children: message.csvData.sampleRows.slice(0, 3).map((row, i) => /* @__PURE__ */ jsxs6(
3721
3906
  "div",
3722
3907
  {
3723
3908
  className: "text-xs text-gray-600 bg-white rounded px-2 py-1 border border-gray-100",
3724
3909
  children: [
3725
- Object.entries(row).slice(0, 3).map(([key, val], j) => /* @__PURE__ */ jsxs5("span", { children: [
3910
+ Object.entries(row).slice(0, 3).map(([key, val], j) => /* @__PURE__ */ jsxs6("span", { children: [
3726
3911
  j > 0 && " \u2022 ",
3727
- /* @__PURE__ */ jsxs5("span", { className: "text-gray-400", children: [
3912
+ /* @__PURE__ */ jsxs6("span", { className: "text-gray-400", children: [
3728
3913
  key,
3729
3914
  ":"
3730
3915
  ] }),
3731
3916
  " ",
3732
3917
  val
3733
3918
  ] }, key)),
3734
- Object.keys(row).length > 3 && /* @__PURE__ */ jsxs5("span", { className: "text-gray-400", children: [
3919
+ Object.keys(row).length > 3 && /* @__PURE__ */ jsxs6("span", { className: "text-gray-400", children: [
3735
3920
  " ",
3736
3921
  "..."
3737
3922
  ] })
@@ -3740,14 +3925,14 @@ ${userText}`
3740
3925
  i
3741
3926
  )) })
3742
3927
  ] }),
3743
- message.suggestedAction && /* @__PURE__ */ jsx9("div", { className: "px-3 py-2 bg-blue-50 border-t border-blue-100", children: /* @__PURE__ */ jsxs5("span", { className: "text-xs text-blue-700", children: [
3928
+ message.suggestedAction && /* @__PURE__ */ jsx10("div", { className: "px-3 py-2 bg-blue-50 border-t border-blue-100", children: /* @__PURE__ */ jsxs6("span", { className: "text-xs text-blue-700", children: [
3744
3929
  "Suggested action:",
3745
3930
  " ",
3746
- /* @__PURE__ */ jsx9("strong", { children: message.suggestedAction.replace(/_/g, " ") })
3931
+ /* @__PURE__ */ jsx10("strong", { children: message.suggestedAction.replace(/_/g, " ") })
3747
3932
  ] }) })
3748
3933
  ] }),
3749
- message.bulkSessionId && /* @__PURE__ */ jsxs5("div", { className: "mt-3 flex items-center gap-2", children: [
3750
- /* @__PURE__ */ jsxs5(
3934
+ message.bulkSessionId && /* @__PURE__ */ jsxs6("div", { className: "mt-3 flex items-center gap-2", children: [
3935
+ /* @__PURE__ */ jsxs6(
3751
3936
  Button,
3752
3937
  {
3753
3938
  type: "button",
@@ -3756,19 +3941,19 @@ ${userText}`
3756
3941
  className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
3757
3942
  onClick: () => message.bulkSessionId && confirmBulkOperation(message.bulkSessionId),
3758
3943
  children: [
3759
- /* @__PURE__ */ jsxs5("span", { children: [
3944
+ /* @__PURE__ */ jsxs6("span", { children: [
3760
3945
  "Process ",
3761
3946
  message.csvData.rowCount,
3762
3947
  " rows"
3763
3948
  ] }),
3764
- /* @__PURE__ */ jsxs5("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
3765
- /* @__PURE__ */ jsx9(Command, { className: "h-3 w-3" }),
3766
- /* @__PURE__ */ jsx9(CornerDownLeft, { className: "h-3 w-3" })
3949
+ /* @__PURE__ */ jsxs6("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
3950
+ /* @__PURE__ */ jsx10(Command, { className: "h-3 w-3" }),
3951
+ /* @__PURE__ */ jsx10(CornerDownLeft, { className: "h-3 w-3" })
3767
3952
  ] })
3768
3953
  ]
3769
3954
  }
3770
3955
  ),
3771
- /* @__PURE__ */ jsx9(
3956
+ /* @__PURE__ */ jsx10(
3772
3957
  Button,
3773
3958
  {
3774
3959
  type: "button",
@@ -3788,35 +3973,35 @@ ${userText}`
3788
3973
  if (message.kind === "bulkProgress" && message.bulkProgress) {
3789
3974
  const { processed, total, successes, failures } = message.bulkProgress;
3790
3975
  const percentage = Math.round(processed / total * 100);
3791
- return /* @__PURE__ */ jsx9(
3976
+ return /* @__PURE__ */ jsx10(
3792
3977
  "div",
3793
3978
  {
3794
3979
  className: `${isRoleChange ? "mt-3" : ""}`,
3795
- children: /* @__PURE__ */ jsxs5("div", { className: "bg-gray-50 rounded-lg border border-gray-200 p-3", children: [
3796
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2 mb-2", children: [
3797
- /* @__PURE__ */ jsx9(Loader22, { className: "h-4 w-4 animate-spin text-blue-600" }),
3798
- /* @__PURE__ */ jsxs5("span", { className: "text-sm font-medium text-gray-700", children: [
3980
+ children: /* @__PURE__ */ jsxs6("div", { className: "bg-gray-50 rounded-lg border border-gray-200 p-3", children: [
3981
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2 mb-2", children: [
3982
+ /* @__PURE__ */ jsx10(Loader22, { className: "h-4 w-4 animate-spin text-blue-600" }),
3983
+ /* @__PURE__ */ jsxs6("span", { className: "text-sm font-medium text-gray-700", children: [
3799
3984
  "Processing... ",
3800
3985
  processed,
3801
3986
  " of ",
3802
3987
  total
3803
3988
  ] })
3804
3989
  ] }),
3805
- /* @__PURE__ */ jsx9("div", { className: "h-2 bg-gray-200 rounded-full overflow-hidden mb-2", children: /* @__PURE__ */ jsx9(
3990
+ /* @__PURE__ */ jsx10("div", { className: "h-2 bg-gray-200 rounded-full overflow-hidden mb-2", children: /* @__PURE__ */ jsx10(
3806
3991
  "div",
3807
3992
  {
3808
3993
  className: "h-full bg-blue-600 transition-all duration-300",
3809
3994
  style: { width: `${percentage}%` }
3810
3995
  }
3811
3996
  ) }),
3812
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3 text-xs text-gray-600", children: [
3813
- /* @__PURE__ */ jsxs5("span", { className: "flex items-center gap-1", children: [
3814
- /* @__PURE__ */ jsx9(CheckCircle23, { className: "h-3 w-3 text-green-600" }),
3997
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-3 text-xs text-gray-600", children: [
3998
+ /* @__PURE__ */ jsxs6("span", { className: "flex items-center gap-1", children: [
3999
+ /* @__PURE__ */ jsx10(CheckCircle23, { className: "h-3 w-3 text-green-600" }),
3815
4000
  successes,
3816
4001
  " successful"
3817
4002
  ] }),
3818
- failures > 0 && /* @__PURE__ */ jsxs5("span", { className: "flex items-center gap-1 text-red-600", children: [
3819
- /* @__PURE__ */ jsx9(X, { className: "h-3 w-3" }),
4003
+ failures > 0 && /* @__PURE__ */ jsxs6("span", { className: "flex items-center gap-1 text-red-600", children: [
4004
+ /* @__PURE__ */ jsx10(X, { className: "h-3 w-3" }),
3820
4005
  failures,
3821
4006
  " failed"
3822
4007
  ] })
@@ -3830,41 +4015,41 @@ ${userText}`
3830
4015
  const { total, successes, failures, navigationPage } = message.bulkSummary;
3831
4016
  const hasFailures = failures.length > 0;
3832
4017
  const pageLabel = navigationPage?.page === "customers" ? "Customers" : navigationPage?.page === "dashboard" ? "Dashboard" : navigationPage?.page === "settings" ? "Settings" : "Results";
3833
- return /* @__PURE__ */ jsx9(
4018
+ return /* @__PURE__ */ jsx10(
3834
4019
  "div",
3835
4020
  {
3836
4021
  className: `${isRoleChange ? "mt-3" : ""}`,
3837
- children: /* @__PURE__ */ jsxs5(
4022
+ children: /* @__PURE__ */ jsxs6(
3838
4023
  "div",
3839
4024
  {
3840
4025
  className: `rounded-lg border p-3 ${hasFailures ? "bg-amber-50 border-amber-200" : "bg-green-50 border-green-200"}`,
3841
4026
  children: [
3842
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2 mb-2", children: [
3843
- /* @__PURE__ */ jsx9(
4027
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2 mb-2", children: [
4028
+ /* @__PURE__ */ jsx10(
3844
4029
  CheckCircle23,
3845
4030
  {
3846
4031
  className: `h-5 w-5 ${hasFailures ? "text-amber-600" : "text-green-600"}`
3847
4032
  }
3848
4033
  ),
3849
- /* @__PURE__ */ jsx9("span", { className: "text-sm font-medium text-gray-800", children: "Bulk operation complete" })
4034
+ /* @__PURE__ */ jsx10("span", { className: "text-sm font-medium text-gray-800", children: "Bulk operation complete" })
3850
4035
  ] }),
3851
- /* @__PURE__ */ jsx9("div", { className: "text-sm text-gray-600 mb-2", children: message.content || `Processed ${total} rows: ${successes} successful${hasFailures ? `, ${failures.length} failed` : ""}.` }),
3852
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-4 text-xs", children: [
3853
- /* @__PURE__ */ jsxs5("span", { className: "flex items-center gap-1 text-green-700", children: [
3854
- /* @__PURE__ */ jsx9(CheckCircle23, { className: "h-3 w-3" }),
4036
+ /* @__PURE__ */ jsx10("div", { className: "text-sm text-gray-600 mb-2", children: message.content || `Processed ${total} rows: ${successes} successful${hasFailures ? `, ${failures.length} failed` : ""}.` }),
4037
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-4 text-xs", children: [
4038
+ /* @__PURE__ */ jsxs6("span", { className: "flex items-center gap-1 text-green-700", children: [
4039
+ /* @__PURE__ */ jsx10(CheckCircle23, { className: "h-3 w-3" }),
3855
4040
  successes,
3856
4041
  " successful"
3857
4042
  ] }),
3858
- hasFailures && /* @__PURE__ */ jsxs5("span", { className: "flex items-center gap-1 text-red-600", children: [
3859
- /* @__PURE__ */ jsx9(X, { className: "h-3 w-3" }),
4043
+ hasFailures && /* @__PURE__ */ jsxs6("span", { className: "flex items-center gap-1 text-red-600", children: [
4044
+ /* @__PURE__ */ jsx10(X, { className: "h-3 w-3" }),
3860
4045
  failures.length,
3861
4046
  " failed"
3862
4047
  ] })
3863
4048
  ] }),
3864
- hasFailures && /* @__PURE__ */ jsxs5("div", { className: "mt-3 pt-2 border-t border-amber-200", children: [
3865
- /* @__PURE__ */ jsx9("div", { className: "text-[10px] uppercase tracking-wider text-amber-700 mb-1", children: "Failed Rows" }),
3866
- /* @__PURE__ */ jsxs5("div", { className: "space-y-1 max-h-32 overflow-y-auto", children: [
3867
- failures.slice(0, 5).map((failure, i) => /* @__PURE__ */ jsxs5(
4049
+ hasFailures && /* @__PURE__ */ jsxs6("div", { className: "mt-3 pt-2 border-t border-amber-200", children: [
4050
+ /* @__PURE__ */ jsx10("div", { className: "text-[10px] uppercase tracking-wider text-amber-700 mb-1", children: "Failed Rows" }),
4051
+ /* @__PURE__ */ jsxs6("div", { className: "space-y-1 max-h-32 overflow-y-auto", children: [
4052
+ failures.slice(0, 5).map((failure, i) => /* @__PURE__ */ jsxs6(
3868
4053
  "div",
3869
4054
  {
3870
4055
  className: "text-xs text-red-700 bg-red-50 rounded px-2 py-1",
@@ -3878,14 +4063,14 @@ ${userText}`
3878
4063
  },
3879
4064
  i
3880
4065
  )),
3881
- failures.length > 5 && /* @__PURE__ */ jsxs5("div", { className: "text-xs text-amber-600", children: [
4066
+ failures.length > 5 && /* @__PURE__ */ jsxs6("div", { className: "text-xs text-amber-600", children: [
3882
4067
  "...and ",
3883
4068
  failures.length - 5,
3884
4069
  " more"
3885
4070
  ] })
3886
4071
  ] })
3887
4072
  ] }),
3888
- navigationPage && successes > 0 && /* @__PURE__ */ jsx9("div", { className: "mt-3 pt-2 border-t border-gray-200", children: /* @__PURE__ */ jsxs5(
4073
+ navigationPage && successes > 0 && /* @__PURE__ */ jsx10("div", { className: "mt-3 pt-2 border-t border-gray-200", children: /* @__PURE__ */ jsxs6(
3889
4074
  "button",
3890
4075
  {
3891
4076
  type: "button",
@@ -3918,12 +4103,12 @@ ${userText}`
3918
4103
  },
3919
4104
  className: "flex items-center gap-2 text-xs text-gray-500 hover:text-gray-700 transition-colors group cursor-pointer",
3920
4105
  children: [
3921
- /* @__PURE__ */ jsxs5("span", { className: "flex items-center gap-1 px-1.5 py-0.5 bg-gray-100 rounded text-[10px] font-medium text-gray-600 group-hover:bg-gray-200", children: [
3922
- /* @__PURE__ */ jsx9(Command, { className: "h-2.5 w-2.5" }),
3923
- /* @__PURE__ */ jsx9("span", { children: "+" }),
3924
- /* @__PURE__ */ jsx9(CornerDownLeft, { className: "h-2.5 w-2.5" })
4106
+ /* @__PURE__ */ jsxs6("span", { className: "flex items-center gap-1 px-1.5 py-0.5 bg-gray-100 rounded text-[10px] font-medium text-gray-600 group-hover:bg-gray-200", children: [
4107
+ /* @__PURE__ */ jsx10(Command, { className: "h-2.5 w-2.5" }),
4108
+ /* @__PURE__ */ jsx10("span", { children: "+" }),
4109
+ /* @__PURE__ */ jsx10(CornerDownLeft, { className: "h-2.5 w-2.5" })
3925
4110
  ] }),
3926
- /* @__PURE__ */ jsxs5("span", { children: [
4111
+ /* @__PURE__ */ jsxs6("span", { children: [
3927
4112
  "View ",
3928
4113
  pageLabel
3929
4114
  ] })
@@ -3937,19 +4122,19 @@ ${userText}`
3937
4122
  message.id
3938
4123
  );
3939
4124
  }
3940
- return /* @__PURE__ */ jsx9(React4.Fragment, { children: /* @__PURE__ */ jsxs5(
4125
+ return /* @__PURE__ */ jsx10(React4.Fragment, { children: /* @__PURE__ */ jsxs6(
3941
4126
  "div",
3942
4127
  {
3943
4128
  ref: isCurrentGuideStep ? currentStepRef : null,
3944
4129
  className: `${isRoleChange ? "mt-3" : ""}`,
3945
4130
  children: [
3946
- /* @__PURE__ */ jsx9("div", { className: "text-sm leading-6 text-gray-700", children: (() => {
4131
+ /* @__PURE__ */ jsx10("div", { className: "text-sm leading-6 text-gray-700", children: (() => {
3947
4132
  const text = message.content || "";
3948
4133
  if (message.kind === "guideStep") {
3949
4134
  const m = text.match(/^(Step\s+\d+:)([\s\S]*)/);
3950
4135
  if (m) {
3951
- return /* @__PURE__ */ jsxs5(Fragment2, { children: [
3952
- /* @__PURE__ */ jsx9("strong", { children: m[1] }),
4136
+ return /* @__PURE__ */ jsxs6(Fragment2, { children: [
4137
+ /* @__PURE__ */ jsx10("strong", { children: m[1] }),
3953
4138
  m[2]
3954
4139
  ] });
3955
4140
  }
@@ -3957,16 +4142,16 @@ ${userText}`
3957
4142
  if (message.role === "assistant" && text) {
3958
4143
  return renderMarkdown(text);
3959
4144
  }
3960
- return text || /* @__PURE__ */ jsx9("span", { className: "opacity-70", children: "Thinking\u2026" });
4145
+ return text || /* @__PURE__ */ jsx10("span", { className: "opacity-70", children: "Thinking\u2026" });
3961
4146
  })() }),
3962
- message.role === "assistant" && message.structuredData && /* @__PURE__ */ jsx9("div", { className: "mt-3", children: /* @__PURE__ */ jsx9(
4147
+ message.role === "assistant" && message.structuredData && /* @__PURE__ */ jsx10("div", { className: "mt-3", children: /* @__PURE__ */ jsx10(
3963
4148
  DataRenderer,
3964
4149
  {
3965
4150
  type: message.structuredData.type,
3966
4151
  data: message.structuredData.data
3967
4152
  }
3968
4153
  ) }),
3969
- message.role === "assistant" && message.followups && message.followups.length > 0 && !message.followupSelected && /* @__PURE__ */ jsx9("div", { className: "mt-3 flex flex-wrap gap-1.5", children: message.followups.map((followup) => /* @__PURE__ */ jsx9(
4154
+ message.role === "assistant" && message.followups && message.followups.length > 0 && !message.followupSelected && /* @__PURE__ */ jsx10("div", { className: "mt-3 flex flex-wrap gap-1.5", children: message.followups.map((followup) => /* @__PURE__ */ jsx10(
3970
4155
  "button",
3971
4156
  {
3972
4157
  type: "button",
@@ -3980,8 +4165,8 @@ ${userText}`
3980
4165
  }
3981
4166
  ) }, message.id);
3982
4167
  }),
3983
- (activeGuide || guideComplete) && /* @__PURE__ */ jsxs5("div", { className: "mt-3 flex items-center gap-2", children: [
3984
- activeGuide && activeGuide.stepIndex > 0 && /* @__PURE__ */ jsx9(
4168
+ (activeGuide || guideComplete) && /* @__PURE__ */ jsxs6("div", { className: "mt-3 flex items-center gap-2", children: [
4169
+ activeGuide && activeGuide.stepIndex > 0 && /* @__PURE__ */ jsx10(
3985
4170
  Button,
3986
4171
  {
3987
4172
  type: "button",
@@ -3989,10 +4174,10 @@ ${userText}`
3989
4174
  variant: "secondary",
3990
4175
  className: "h-7 w-7 rounded-full p-0 bg-gray-100 hover:bg-gray-200 border border-gray-200",
3991
4176
  onClick: goBackGuide,
3992
- children: /* @__PURE__ */ jsx9(ArrowLeft, { className: "h-3.5 w-3.5 text-gray-600" })
4177
+ children: /* @__PURE__ */ jsx10(ArrowLeft, { className: "h-3.5 w-3.5 text-gray-600" })
3993
4178
  }
3994
4179
  ),
3995
- /* @__PURE__ */ jsxs5(
4180
+ /* @__PURE__ */ jsxs6(
3996
4181
  Button,
3997
4182
  {
3998
4183
  type: "button",
@@ -4001,31 +4186,32 @@ ${userText}`
4001
4186
  className: "h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",
4002
4187
  onClick: guideComplete ? handleBack : advanceGuide,
4003
4188
  children: [
4004
- /* @__PURE__ */ jsx9("span", { children: guideComplete ? "Done" : "Next" }),
4005
- /* @__PURE__ */ jsxs5("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
4006
- /* @__PURE__ */ jsx9(Command, { className: "h-3 w-3" }),
4007
- /* @__PURE__ */ jsx9(CornerDownLeft, { className: "h-3 w-3" })
4189
+ /* @__PURE__ */ jsx10("span", { children: guideComplete ? "Done" : "Next" }),
4190
+ /* @__PURE__ */ jsxs6("span", { className: "flex items-center gap-0.5 text-gray-400", children: [
4191
+ /* @__PURE__ */ jsx10(Command, { className: "h-3 w-3" }),
4192
+ /* @__PURE__ */ jsx10(CornerDownLeft, { className: "h-3 w-3" })
4008
4193
  ] })
4009
4194
  ]
4010
4195
  }
4011
4196
  )
4012
4197
  ] }),
4013
- (phase === "thinking" || phase === "searching" || phase === "executing" || phase === "responding") && /* @__PURE__ */ jsx9("div", { className: `${lastRole === "user" ? "mt-3" : ""}`, children: /* @__PURE__ */ jsx9(
4198
+ (phase === "thinking" || phase === "searching" || phase === "executing" || phase === "responding") && /* @__PURE__ */ jsx10("div", { className: `${lastRole === "user" ? "mt-3" : ""}`, children: /* @__PURE__ */ jsx10(
4014
4199
  AssistantActivity,
4015
4200
  {
4016
4201
  phase,
4017
4202
  progressSteps
4018
4203
  }
4019
4204
  ) }),
4020
- !activeGuide && /* @__PURE__ */ jsx9("div", { ref: messagesEndRef })
4205
+ isEscalated && agentIsTyping && phase === "idle" && /* @__PURE__ */ jsx10("div", { className: "mt-2", children: /* @__PURE__ */ jsx10(TypingIndicator, {}) }),
4206
+ !activeGuide && /* @__PURE__ */ jsx10("div", { ref: messagesEndRef })
4021
4207
  ] }) }) }) })
4022
4208
  }
4023
4209
  ),
4024
- /* @__PURE__ */ jsxs5("div", { className: "px-4 py-3 border-t border-gray-100 bg-gray-50/50 shrink-0", children: [
4025
- pendingFile && /* @__PURE__ */ jsxs5("div", { className: "mb-2 flex items-center gap-2 rounded-xl bg-blue-50 border border-blue-200 px-3 py-2", children: [
4026
- /* @__PURE__ */ jsx9(FileSpreadsheet, { className: "h-4 w-4 text-blue-600" }),
4027
- /* @__PURE__ */ jsx9("span", { className: "text-xs text-blue-700 flex-1 truncate", children: pendingFile.name }),
4028
- /* @__PURE__ */ jsx9(
4210
+ /* @__PURE__ */ jsxs6("div", { className: "px-4 py-3 border-t border-gray-100 bg-gray-50/50 shrink-0", children: [
4211
+ pendingFile && /* @__PURE__ */ jsxs6("div", { className: "mb-2 flex items-center gap-2 rounded-xl bg-blue-50 border border-blue-200 px-3 py-2", children: [
4212
+ /* @__PURE__ */ jsx10(FileSpreadsheet, { className: "h-4 w-4 text-blue-600" }),
4213
+ /* @__PURE__ */ jsx10("span", { className: "text-xs text-blue-700 flex-1 truncate", children: pendingFile.name }),
4214
+ /* @__PURE__ */ jsx10(
4029
4215
  "button",
4030
4216
  {
4031
4217
  type: "button",
@@ -4034,12 +4220,12 @@ ${userText}`
4034
4220
  if (fileInputRef.current) fileInputRef.current.value = "";
4035
4221
  },
4036
4222
  className: "text-blue-600 hover:text-blue-800",
4037
- children: /* @__PURE__ */ jsx9(X, { className: "h-4 w-4" })
4223
+ children: /* @__PURE__ */ jsx10(X, { className: "h-4 w-4" })
4038
4224
  }
4039
4225
  )
4040
4226
  ] }),
4041
- /* @__PURE__ */ jsxs5("form", { onSubmit: handleSubmit, className: "w-full", children: [
4042
- /* @__PURE__ */ jsx9(
4227
+ /* @__PURE__ */ jsxs6("form", { onSubmit: handleSubmit, className: "w-full", children: [
4228
+ /* @__PURE__ */ jsx10(
4043
4229
  "input",
4044
4230
  {
4045
4231
  ref: fileInputRef,
@@ -4054,8 +4240,8 @@ ${userText}`
4054
4240
  }
4055
4241
  }
4056
4242
  ),
4057
- /* @__PURE__ */ jsxs5("div", { className: "flex w-full items-start gap-2 rounded-xl border border-gray-200 bg-white px-3 py-2 shadow-sm", children: [
4058
- /* @__PURE__ */ jsx9(
4243
+ /* @__PURE__ */ jsxs6("div", { className: "flex w-full items-start gap-2 rounded-xl border border-gray-200 bg-white px-3 py-2 shadow-sm", children: [
4244
+ /* @__PURE__ */ jsx10(
4059
4245
  Button,
4060
4246
  {
4061
4247
  type: "button",
@@ -4064,15 +4250,20 @@ ${userText}`
4064
4250
  onClick: () => fileInputRef.current?.click(),
4065
4251
  className: "h-5 w-5 rounded-full text-gray-400 hover:text-gray-600 hover:bg-gray-100",
4066
4252
  title: "Upload CSV for bulk operations",
4067
- children: /* @__PURE__ */ jsx9(Paperclip, { className: "h-2.5 w-2.5" })
4253
+ children: /* @__PURE__ */ jsx10(Paperclip, { className: "h-2.5 w-2.5" })
4068
4254
  }
4069
4255
  ),
4070
- /* @__PURE__ */ jsx9(
4256
+ /* @__PURE__ */ jsx10(
4071
4257
  "textarea",
4072
4258
  {
4073
4259
  placeholder: pendingFile ? "Describe what to do with this CSV..." : "Ask anything...",
4074
4260
  value: input,
4075
- onChange: (e) => setInput(e.target.value),
4261
+ onChange: (e) => {
4262
+ setInput(e.target.value);
4263
+ if (e.target.value.length > 0) {
4264
+ handleTypingStart();
4265
+ }
4266
+ },
4076
4267
  rows: 1,
4077
4268
  className: "flex-1 border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 text-sm placeholder:text-gray-400 resize-none overflow-hidden outline-none",
4078
4269
  style: { minHeight: "20px", maxHeight: "120px" },
@@ -4123,20 +4314,20 @@ ${userText}`
4123
4314
  }
4124
4315
  }
4125
4316
  ),
4126
- /* @__PURE__ */ jsx9(
4317
+ /* @__PURE__ */ jsx10(
4127
4318
  Button,
4128
4319
  {
4129
4320
  type: "submit",
4130
4321
  size: "icon",
4131
4322
  disabled: !input.trim() && !pendingFile,
4132
4323
  className: "h-6 w-6 rounded-full bg-gray-900 hover:bg-gray-800 disabled:bg-gray-300",
4133
- children: /* @__PURE__ */ jsx9(ArrowUp, { className: "h-2.5 w-2.5" })
4324
+ children: /* @__PURE__ */ jsx10(ArrowUp, { className: "h-2.5 w-2.5" })
4134
4325
  }
4135
4326
  )
4136
4327
  ] })
4137
4328
  ] })
4138
4329
  ] }),
4139
- /* @__PURE__ */ jsx9(
4330
+ /* @__PURE__ */ jsx10(
4140
4331
  GuideCursor,
4141
4332
  {
4142
4333
  x: cursorState.x,
@@ -4154,7 +4345,7 @@ function PanelToggle({
4154
4345
  onClick,
4155
4346
  className = ""
4156
4347
  }) {
4157
- return /* @__PURE__ */ jsx9(
4348
+ return /* @__PURE__ */ jsx10(
4158
4349
  "button",
4159
4350
  {
4160
4351
  type: "button",
@@ -4165,7 +4356,7 @@ function PanelToggle({
4165
4356
  right: isOpen ? `${PANEL_WIDTH}px` : "0px",
4166
4357
  transform: "translateY(-50%)"
4167
4358
  },
4168
- children: isOpen ? /* @__PURE__ */ jsx9(ChevronRight, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx9(ChevronLeft, { className: "h-4 w-4" })
4359
+ children: isOpen ? /* @__PURE__ */ jsx10(ChevronRight, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx10(ChevronLeft, { className: "h-4 w-4" })
4169
4360
  }
4170
4361
  );
4171
4362
  }
@@ -4183,7 +4374,9 @@ function ChatPanelWithToggle({
4183
4374
  orgId,
4184
4375
  userName,
4185
4376
  userEmail,
4186
- userOrganization
4377
+ userOrganization,
4378
+ supabaseUrl,
4379
+ supabaseAnonKey
4187
4380
  }) {
4188
4381
  const [internalIsOpen, setInternalIsOpen] = React4.useState(defaultOpen);
4189
4382
  const isOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalIsOpen;
@@ -4203,7 +4396,7 @@ function ChatPanelWithToggle({
4203
4396
  document.body.style.transition = originalTransition;
4204
4397
  };
4205
4398
  }, [isOpen]);
4206
- return /* @__PURE__ */ jsx9(
4399
+ return /* @__PURE__ */ jsx10(
4207
4400
  ChatPanel,
4208
4401
  {
4209
4402
  isOpen,
@@ -4219,19 +4412,21 @@ function ChatPanelWithToggle({
4219
4412
  orgId,
4220
4413
  userName,
4221
4414
  userEmail,
4222
- userOrganization
4415
+ userOrganization,
4416
+ supabaseUrl,
4417
+ supabaseAnonKey
4223
4418
  }
4224
4419
  );
4225
4420
  }
4226
4421
  function HelpButton({ onClick, className = "" }) {
4227
- return /* @__PURE__ */ jsx9(
4422
+ return /* @__PURE__ */ jsx10(
4228
4423
  "button",
4229
4424
  {
4230
4425
  type: "button",
4231
4426
  onClick,
4232
4427
  className: `flex items-center justify-center w-6 h-16 bg-gray-100 hover:bg-gray-200 border border-gray-200 border-r-0 rounded-l-lg text-gray-600 hover:text-gray-800 transition-all duration-200 shadow-sm ${className}`,
4233
4428
  "aria-label": "Open help",
4234
- children: /* @__PURE__ */ jsx9(ChevronLeft, { className: "h-4 w-4" })
4429
+ children: /* @__PURE__ */ jsx10(ChevronLeft, { className: "h-4 w-4" })
4235
4430
  }
4236
4431
  );
4237
4432
  }
@@ -4239,7 +4434,7 @@ function HelpButton({ onClick, className = "" }) {
4239
4434
  // src/createKiteChat.tsx
4240
4435
  import React5 from "react";
4241
4436
  import { createRoot } from "react-dom/client";
4242
- import { jsx as jsx10 } from "react/jsx-runtime";
4437
+ import { jsx as jsx11 } from "react/jsx-runtime";
4243
4438
  function KiteChatWrapper({
4244
4439
  initialConfig,
4245
4440
  onConfigUpdate,
@@ -4276,7 +4471,7 @@ function KiteChatWrapper({
4276
4471
  container.classList.toggle("dark", prefersDark);
4277
4472
  }
4278
4473
  }, [config.theme]);
4279
- return /* @__PURE__ */ jsx10(
4474
+ return /* @__PURE__ */ jsx11(
4280
4475
  ChatPanelWithToggle,
4281
4476
  {
4282
4477
  isOpen,
@@ -4291,7 +4486,9 @@ function KiteChatWrapper({
4291
4486
  orgId: config.orgId,
4292
4487
  userName: config.userName,
4293
4488
  userEmail: config.userEmail,
4294
- userOrganization: config.userOrganization
4489
+ userOrganization: config.userOrganization,
4490
+ supabaseUrl: config.supabaseUrl,
4491
+ supabaseAnonKey: config.supabaseAnonKey
4295
4492
  }
4296
4493
  );
4297
4494
  }
@@ -4321,7 +4518,7 @@ function createKiteChat(config) {
4321
4518
  }
4322
4519
  root = createRoot(containerElement);
4323
4520
  root.render(
4324
- /* @__PURE__ */ jsx10(
4521
+ /* @__PURE__ */ jsx11(
4325
4522
  KiteChatWrapper,
4326
4523
  {
4327
4524
  initialConfig: currentConfig,