apteva 0.4.31 → 0.4.41

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.
Files changed (89) hide show
  1. package/dist/ActivityPage.7907h64p.js +3 -0
  2. package/dist/ApiDocsPage.k3jjenpq.js +4 -0
  3. package/dist/App.01nq20st.js +4 -0
  4. package/dist/App.1maqvamf.js +4 -0
  5. package/dist/App.2yjrh32f.js +4 -0
  6. package/dist/App.3qw8nben.js +20 -0
  7. package/dist/App.7fb3e7mp.js +4 -0
  8. package/dist/App.7sy3wq8c.js +4 -0
  9. package/dist/App.apjrmctz.js +57 -0
  10. package/dist/App.av6t2yhe.js +4 -0
  11. package/dist/App.jqj5a094.js +46 -0
  12. package/dist/App.mc7xf85h.js +4 -0
  13. package/dist/App.myxqcj9x.js +4 -0
  14. package/dist/App.nm91r1mp.js +13 -0
  15. package/dist/App.qcknavjz.js +221 -0
  16. package/dist/App.vc7vfhg4.js +4 -0
  17. package/dist/App.z4s9zkw5.js +4 -0
  18. package/dist/ConnectionsPage.z1pw5xe2.js +3 -0
  19. package/dist/McpPage.8vc97z0b.js +3 -0
  20. package/dist/SettingsPage.p61bz8kd.js +3 -0
  21. package/dist/SkillsPage.r9x43g3g.js +3 -0
  22. package/dist/TasksPage.1e0zkye4.js +3 -0
  23. package/dist/TelemetryPage.p9vbe4gf.js +3 -0
  24. package/dist/TestsPage.d4xy504e.js +3 -0
  25. package/dist/ThreadsPage.m016am3x.js +3 -0
  26. package/dist/index.html +1 -1
  27. package/dist/styles.css +1 -1
  28. package/package.json +8 -7
  29. package/src/crypto.ts +4 -3
  30. package/src/db.ts +153 -28
  31. package/src/integrations/agentdojo.ts +94 -12
  32. package/src/integrations/index.ts +7 -0
  33. package/src/mcp-platform.ts +494 -121
  34. package/src/providers.ts +12 -12
  35. package/src/routes/api/agent-utils.ts +59 -46
  36. package/src/routes/api/agents.ts +52 -1
  37. package/src/routes/api/integrations.ts +11 -5
  38. package/src/routes/api/mcp.ts +5 -4
  39. package/src/routes/api/meta-agent.ts +35 -1
  40. package/src/routes/api/projects.ts +3 -3
  41. package/src/routes/api/providers.ts +121 -30
  42. package/src/routes/api/skills.ts +2 -3
  43. package/src/routes/api/system.ts +8 -13
  44. package/src/server.ts +31 -32
  45. package/src/triggers/agentdojo.ts +2 -2
  46. package/src/web/App.tsx +18 -10
  47. package/src/web/components/activity/ActivityPage.tsx +241 -388
  48. package/src/web/components/agents/AgentCard.tsx +5 -13
  49. package/src/web/components/common/Icons.tsx +8 -0
  50. package/src/web/components/common/Select.tsx +4 -3
  51. package/src/web/components/dashboard/Dashboard.tsx +155 -30
  52. package/src/web/components/index.ts +1 -1
  53. package/src/web/components/layout/Sidebar.tsx +7 -1
  54. package/src/web/components/mcp/IntegrationsPanel.tsx +126 -35
  55. package/src/web/components/mcp/McpPage.tsx +10 -1
  56. package/src/web/components/meta-agent/MetaAgent.tsx +4 -2
  57. package/src/web/components/settings/SettingsPage.tsx +133 -48
  58. package/src/web/components/tasks/TasksPage.tsx +48 -16
  59. package/src/web/components/telemetry/TelemetryPage.tsx +184 -0
  60. package/src/web/components/threads/ThreadsPage.tsx +313 -0
  61. package/src/web/context/AuthContext.tsx +3 -3
  62. package/src/web/context/ProjectContext.tsx +3 -3
  63. package/src/web/context/TelemetryContext.tsx +24 -6
  64. package/src/web/context/index.ts +1 -1
  65. package/src/web/styles.css +20 -4
  66. package/src/web/types.ts +4 -3
  67. package/dist/ActivityPage.41nbye4r.js +0 -3
  68. package/dist/ApiDocsPage.4smnt8m3.js +0 -4
  69. package/dist/App.0sbax9et.js +0 -4
  70. package/dist/App.0ws427h8.js +0 -4
  71. package/dist/App.6q6bar8b.js +0 -4
  72. package/dist/App.80301vdb.js +0 -4
  73. package/dist/App.af2wg84v.js +0 -267
  74. package/dist/App.ca1rz1ph.js +0 -4
  75. package/dist/App.ensa6z0r.js +0 -4
  76. package/dist/App.f8g7tych.js +0 -13
  77. package/dist/App.mvtqv6qc.js +0 -20
  78. package/dist/App.ncgc9cxy.js +0 -4
  79. package/dist/App.p0fb1pds.js +0 -4
  80. package/dist/App.pmaq48sj.js +0 -4
  81. package/dist/App.yv87t9m5.js +0 -4
  82. package/dist/App.zjmfm8p6.js +0 -4
  83. package/dist/ConnectionsPage.anb3rv9a.js +0 -3
  84. package/dist/McpPage.y396h6fy.js +0 -3
  85. package/dist/SettingsPage.p1hc60gk.js +0 -3
  86. package/dist/SkillsPage.yj3xdsay.js +0 -3
  87. package/dist/TasksPage.sjv0khtv.js +0 -3
  88. package/dist/TelemetryPage.2qm4w16r.js +0 -3
  89. package/dist/TestsPage.zzs4qfj8.js +0 -3
@@ -0,0 +1,4 @@
1
+ import{O as V}from"./App.mc7xf85h.js";import{V as D}from"./App.7sy3wq8c.js";import{$ as Kk,X as P,aa as v,da as i,ja as o,ma as d}from"./App.3qw8nben.js";var J=P(Kk(),1);var q=P(v(),1);function Yk(){let{authFetch:K}=o(),{currentProjectId:X}=d(),{confirm:j,ConfirmDialog:E}=V(),[$,x]=J.useState([]),[A,c]=J.useState([]),[a,u]=J.useState(!0),[r,Y]=J.useState(!1),[H,C]=J.useState(null),[T,Q]=J.useState(new Set),[F,R]=J.useState(!1),[y,I]=J.useState(null),[w,f]=J.useState(null),[S,U]=J.useState({}),[M,N]=J.useState(""),[b,L]=J.useState(""),[g,B]=J.useState(""),Z=X&&X!=="all"&&X!=="unassigned"?X:null,n=Z?A.filter((k)=>k.projectId===Z):A,{events:p}=i({category:"test",limit:50}),_=J.useRef(new Set);J.useEffect(()=>{for(let k of p){if(_.current.has(k.id))continue;_.current.add(k.id);let z=k.data?.test_case_id;if(!z)continue;if(k.type==="test_started")U((G)=>({...G,[z]:{phase:"starting"}})),Q((G)=>new Set(G).add(z));else if(k.type==="test_planning")U((G)=>({...G,[z]:{phase:"planning"}}));else if(k.type==="test_executing"){let G=k.data?.agent_name;U((O)=>({...O,[z]:{phase:"executing",detail:G}}))}else if(k.type==="test_judging")U((G)=>({...G,[z]:{phase:"judging"}}));else if(k.type==="test_completed")U((G)=>{let O={...G};return delete O[z],O}),Q((G)=>{let O=new Set(G);return O.delete(z),O}),W()}if(_.current.size>500)_.current=new Set([..._.current].slice(-200))},[p]);let W=async()=>{try{let k=Z?`?project_id=${Z}`:"",z=await K(`/api/tests${k}`);if(z.ok)x(await z.json())}catch{}u(!1)},s=async()=>{try{let k=await K("/api/agents");if(k.ok){let z=await k.json();c((z.agents||z).map((G)=>({id:G.id,name:G.name,status:G.status,provider:G.provider,model:G.model,projectId:G.projectId||null})))}}catch{}};J.useEffect(()=>{Promise.all([W(),s()])},[X]);let l=()=>{C(null),N(""),L(""),B(""),Y(!0)},t=(k)=>{C(k),N(k.name),L(k.behavior||""),B(k.agent_id||""),Y(!0)},e=async()=>{if(!M||!b)return;let k={name:M,behavior:b,agent_id:g||null,project_id:Z||void 0};if(H)await K(`/api/tests/${H.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)});else await K("/api/tests",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)});Y(!1),W()},kk=async(k)=>{if(!await j("Delete this test case? Run history will also be deleted."))return;await K(`/api/tests/${k}`,{method:"DELETE"}),W()},qk=async(k)=>{Q((z)=>new Set(z).add(k));try{await K(`/api/tests/${k}/run`,{method:"POST"}),await W()}catch{}Q((z)=>{let G=new Set(z);return G.delete(k),G}),U((z)=>{let G={...z};return delete G[k],G})},zk=async()=>{R(!0);try{let k=$.map((z)=>z.id);Q(new Set(k)),await K("/api/tests/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({test_case_ids:k})}),await W()}catch{}Q(new Set),R(!1)},Gk=async(k)=>{try{let z=await K(`/api/tests/${k}/runs`);if(z.ok)I({testId:k,runs:await z.json()})}catch{}},h={starting:{label:"Starting",color:"bg-blue-900/50 text-blue-400 border-blue-500/30"},planning:{label:"Planning",color:"bg-purple-900/50 text-purple-400 border-purple-500/30"},executing:{label:"Executing",color:"bg-cyan-900/50 text-cyan-400 border-cyan-500/30"},judging:{label:"Judging",color:"bg-amber-900/50 text-amber-400 border-amber-500/30"}},m=(k)=>{return q.jsxDEV("span",{className:`px-2 py-0.5 rounded text-xs font-medium ${{passed:"bg-green-900/50 text-green-400",failed:"bg-red-900/50 text-red-400",error:"bg-yellow-900/50 text-yellow-400",running:"bg-blue-900/50 text-blue-400"}[k]||"bg-[#222] text-[#666]"}`,children:k.toUpperCase()},void 0,!1,void 0,this)},Jk=(k)=>{let z=S[k];if(!z)return null;let G=h[z.phase]||h.starting;return q.jsxDEV("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded text-xs font-medium border ${G.color} animate-pulse`,children:[q.jsxDEV("span",{className:"w-1.5 h-1.5 rounded-full bg-current"},void 0,!1,void 0,this),G.label,z.detail?` · ${z.detail}`:""]},void 0,!0,void 0,this)};return q.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:[E,q.jsxDEV("div",{className:"flex items-center justify-between mb-6",children:[q.jsxDEV("div",{children:[q.jsxDEV("h1",{className:"text-xl font-bold",children:"Tests"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[#666] mt-1",children:"Describe behavior, AI handles the rest"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex gap-2",children:[$.length>0&&q.jsxDEV("button",{onClick:zk,disabled:F,className:"px-4 py-2 bg-[#1a1a1a] hover:bg-[#222] text-[#e0e0e0] rounded text-sm font-medium transition disabled:opacity-50",children:F?"Running...":"Run All"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:l,className:"px-4 py-2 bg-[#f97316] hover:bg-[#fb923c] text-white rounded text-sm font-medium transition",children:"+ New Test"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),a?q.jsxDEV("div",{className:"text-[#666] text-sm",children:"Loading..."},void 0,!1,void 0,this):$.length===0?q.jsxDEV("div",{className:"text-center py-16",children:[q.jsxDEV("div",{className:"text-[#333] text-4xl mb-4",children:q.jsxDEV("svg",{className:"w-12 h-12 mx-auto",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:q.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-[#666] mb-2",children:"No tests yet"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-xs text-[#555] mb-4",children:"Describe what your agents should do and let AI verify it"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:l,className:"px-4 py-2 bg-[#f97316] hover:bg-[#fb923c] text-white rounded text-sm font-medium transition",children:"Create your first test"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):q.jsxDEV("div",{className:"space-y-3",children:$.map((k)=>q.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-4",children:q.jsxDEV("div",{className:"flex items-start justify-between",children:[q.jsxDEV("div",{className:"flex-1 min-w-0",children:[q.jsxDEV("div",{className:"flex items-center gap-2 mb-1",children:[q.jsxDEV("span",{className:"font-medium text-sm",children:k.name},void 0,!1,void 0,this),S[k.id]?Jk(k.id):k.last_run&&q.jsxDEV(q.Fragment,{children:[m(k.last_run.status),k.last_run.score!=null&&q.jsxDEV("span",{className:"text-xs text-[#888] font-mono",children:[k.last_run.score,"/10"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.behavior&&q.jsxDEV("p",{className:"text-xs text-[#888] mb-1.5 line-clamp-2",children:k.behavior},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-xs text-[#666] space-y-0.5",children:[q.jsxDEV("div",{children:["Agent:"," ",q.jsxDEV("span",{className:"text-[#888]",children:k.agent_name||(k.last_run?.selected_agent_name?`${k.last_run.selected_agent_name} (auto-selected)`:"Auto (AI picks)")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k.last_run?.generated_message&&q.jsxDEV("div",{className:"truncate",children:["Message: ",q.jsxDEV("span",{className:"text-[#888]",children:['"',k.last_run.generated_message,'"']},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.input_message&&!k.last_run?.generated_message&&q.jsxDEV("div",{className:"truncate",children:["Message: ",q.jsxDEV("span",{className:"text-[#888]",children:['"',k.input_message,'"']},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.last_run&&q.jsxDEV("div",{children:["Last run:"," ",q.jsxDEV("span",{className:"text-[#888]",children:[k.last_run.duration_ms?`${(k.last_run.duration_ms/1000).toFixed(1)}s`:"---",k.last_run.judge_reasoning&&` --- "${k.last_run.judge_reasoning.slice(0,80)}${k.last_run.judge_reasoning.length>80?"...":""}"`]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex items-center gap-1 ml-3 shrink-0",children:[q.jsxDEV("button",{onClick:()=>Gk(k.id),className:"px-2 py-1 text-xs text-[#666] hover:text-[#888] hover:bg-[#1a1a1a] rounded transition",title:"View run history",children:"History"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>qk(k.id),disabled:T.has(k.id),className:"px-3 py-1 text-xs bg-[#1a1a1a] hover:bg-[#222] text-[#e0e0e0] rounded transition disabled:opacity-50",children:T.has(k.id)?"Running...":"Run"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>t(k),className:"px-2 py-1 text-xs text-[#666] hover:text-[#888] hover:bg-[#1a1a1a] rounded transition",children:"Edit"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>kk(k.id),className:"px-2 py-1 text-xs text-[#666] hover:text-red-400 hover:bg-[#1a1a1a] rounded transition",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},k.id,!1,void 0,this))},void 0,!1,void 0,this),y&&q.jsxDEV("div",{className:"mt-6",children:[q.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[q.jsxDEV("h2",{className:"text-sm font-bold text-[#888]",children:"Run History"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>{I(null),f(null)},className:"text-xs text-[#666] hover:text-[#888]",children:"Close"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y.runs.length===0?q.jsxDEV("p",{className:"text-sm text-[#666]",children:"No runs yet"},void 0,!1,void 0,this):q.jsxDEV("div",{className:"space-y-2",children:y.runs.map((k)=>q.jsxDEV("div",{className:"bg-[#0d0d0d] border border-[#1a1a1a] rounded p-3",children:[q.jsxDEV("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>f(w===k.id?null:k.id),children:[q.jsxDEV("div",{className:"flex items-center gap-3",children:[m(k.status),q.jsxDEV("span",{className:"text-xs text-[#666]",children:k.duration_ms?`${(k.duration_ms/1000).toFixed(1)}s`:"---"},void 0,!1,void 0,this),k.score!=null&&q.jsxDEV("span",{className:"text-xs text-[#888] font-mono",children:[k.score,"/10"]},void 0,!0,void 0,this),k.selected_agent_name&&q.jsxDEV("span",{className:"text-xs text-[#555]",children:["Agent: ",k.selected_agent_name]},void 0,!0,void 0,this),q.jsxDEV("span",{className:"text-xs text-[#555]",children:new Date(k.created_at).toLocaleString()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("span",{className:"text-xs text-[#555]",children:w===k.id?"---":"+"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w===k.id&&q.jsxDEV("div",{className:"mt-3 space-y-2",children:[k.planner_reasoning&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-[#666] mb-1",children:"Planner:"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-sm text-[#aaa] bg-[#0a0a0a] p-2 rounded",children:[k.selected_agent_name&&q.jsxDEV("span",{className:"text-[#f97316]",children:k.selected_agent_name},void 0,!1,void 0,this),k.selected_agent_name&&" --- ",k.planner_reasoning]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.generated_message&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-[#666] mb-1",children:"Generated Message:"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-sm text-[#aaa] bg-[#0a0a0a] p-2 rounded",children:['"',k.generated_message,'"']},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.judge_reasoning&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-[#666] mb-1",children:"Judge:"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-sm text-[#aaa] bg-[#0a0a0a] p-2 rounded",children:k.judge_reasoning},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k.error&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-red-400 mb-1",children:"Error:"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-sm text-red-300 bg-[#0a0a0a] p-2 rounded",children:k.error},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k.agent_response&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-[#666] mb-1",children:"Agent Response (Thread):"},void 0,!1,void 0,this),q.jsxDEV("pre",{className:"text-xs text-[#888] bg-[#0a0a0a] p-2 rounded overflow-auto max-h-64",children:k.agent_response},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},k.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r&&q.jsxDEV("div",{className:"fixed inset-0 bg-black/60 z-50 flex items-center justify-center",onClick:()=>Y(!1),children:q.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg w-full max-w-lg mx-4 p-6",onClick:(k)=>k.stopPropagation(),children:[q.jsxDEV("h2",{className:"text-lg font-bold mb-4",children:H?"Edit Test":"New Test"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"space-y-4",children:[q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[#666] mb-1",children:"Name"},void 0,!1,void 0,this),q.jsxDEV("input",{value:M,onChange:(k)=>N(k.target.value),placeholder:"e.g. Social Media Posting",className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[#666] mb-1",children:"Behavior"},void 0,!1,void 0,this),q.jsxDEV("textarea",{value:b,onChange:(k)=>L(k.target.value),placeholder:"Describe what should happen, e.g. 'When asked to post on social media, the agent creates a proper post with relevant hashtags and confirms it was published'",rows:3,className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316] resize-none"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:"AI will generate the test message and evaluate results based on this"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[#666] mb-1",children:"Agent"},void 0,!1,void 0,this),q.jsxDEV(D,{value:g,onChange:B,placeholder:"Auto (AI picks the best agent)",options:n.map((k)=>({value:k.id,label:`${k.name} (${k.status})`}))},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:"Leave empty to let AI choose the right agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex justify-end gap-2 mt-6",children:[q.jsxDEV("button",{onClick:()=>Y(!1),className:"px-4 py-2 text-sm text-[#888] hover:text-[#e0e0e0] transition",children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:e,disabled:!M||!b,className:"px-4 py-2 bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-white rounded text-sm font-medium transition",children:H?"Save":"Create"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}
2
+ export{Yk as M};
3
+
4
+ //# debugId=2097C6C5800E8DB164756E2164756E21
@@ -0,0 +1,46 @@
1
+ import{W as eX}from"./App.01nq20st.js";import{$ as q0,X as E,Y as DQ,aa as R$,ca as N$,ea as A$,ja as P$,ma as E$}from"./App.3qw8nben.js";var p=DQ((LQ)=>{var m0=E(q0());(function(){function X(G){if(G==null)return null;if(typeof G==="function")return G.$$typeof===C?null:G.displayName||G.name||null;if(typeof G==="string")return G;switch(G){case W:return"Fragment";case k:return"Profiler";case N:return"StrictMode";case u:return"Suspense";case b:return"SuspenseList";case H0:return"Activity"}if(typeof G==="object")switch(typeof G.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),G.$$typeof){case B:return"Portal";case v:return G.displayName||"Context";case x:return(G._context.displayName||"Context")+".Consumer";case A:var O=G.render;return G=G.displayName,G||(G=O.displayName||O.name||"",G=G!==""?"ForwardRef("+G+")":"ForwardRef"),G;case n:return O=G.displayName||null,O!==null?O:X(G.type)||"Memo";case o:O=G._payload,G=G._init;try{return X(G(O))}catch(w){}}return null}function $(G){return""+G}function Q(G){try{$(G);var O=!1}catch(m){O=!0}if(O){O=console;var w=O.error,j=typeof Symbol==="function"&&Symbol.toStringTag&&G[Symbol.toStringTag]||G.constructor.name||"Object";return w.call(O,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",j),$(G)}}function Y(G){if(G===W)return"<>";if(typeof G==="object"&&G!==null&&G.$$typeof===o)return"<...>";try{var O=X(G);return O?"<"+O+">":"<...>"}catch(w){return"<...>"}}function Z(){var G=g.A;return G===null?null:G.getOwner()}function z(){return Error("react-stack-top-frame")}function H(G){if(f.call(G,"key")){var O=Object.getOwnPropertyDescriptor(G,"key").get;if(O&&O.isReactWarning)return!1}return G.key!==void 0}function J(G,O){function w(){W0||(W0=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",O))}w.isReactWarning=!0,Object.defineProperty(G,"key",{get:w,configurable:!0})}function K(){var G=X(this.type);return L0[G]||(L0[G]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),G=this.props.ref,G!==void 0?G:null}function V(G,O,w,j,m,P0){var i=w.ref;return G={$$typeof:L,type:G,key:O,props:w,_owner:j},(i!==void 0?i:null)!==null?Object.defineProperty(G,"ref",{enumerable:!1,get:K}):Object.defineProperty(G,"ref",{enumerable:!1,value:null}),G._store={},Object.defineProperty(G._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(G,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(G,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:m}),Object.defineProperty(G,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:P0}),Object.freeze&&(Object.freeze(G.props),Object.freeze(G)),G}function q(G,O,w,j,m,P0){var i=O.children;if(i!==void 0)if(j)if(K0(i)){for(j=0;j<i.length;j++)_(i[j]);Object.freeze&&Object.freeze(i)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else _(i);if(f.call(O,"key")){i=X(G);var T0=Object.keys(O).filter(function(E0){return E0!=="key"});j=0<T0.length?"{key: someKey, "+T0.join(": ..., ")+": ...}":"{key: someKey}",U0[i+j]||(T0=0<T0.length?"{"+T0.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
+ let props = %s;
3
+ <%s {...props} />
4
+ React keys must be passed directly to JSX without using spread:
5
+ let props = %s;
6
+ <%s key={someKey} {...props} />`,j,i,T0,i),U0[i+j]=!0)}if(i=null,w!==void 0&&(Q(w),i=""+w),H(O)&&(Q(O.key),i=""+O.key),"key"in O){w={};for(var w0 in O)w0!=="key"&&(w[w0]=O[w0])}else w=O;return i&&J(w,typeof G==="function"?G.displayName||G.name||"Unknown":G),V(G,i,w,Z(),m,P0)}function _(G){U(G)?G._store&&(G._store.validated=1):typeof G==="object"&&G!==null&&G.$$typeof===o&&(G._payload.status==="fulfilled"?U(G._payload.value)&&G._payload.value._store&&(G._payload.value._store.validated=1):G._store&&(G._store.validated=1))}function U(G){return typeof G==="object"&&G!==null&&G.$$typeof===L}var L=Symbol.for("react.transitional.element"),B=Symbol.for("react.portal"),W=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),x=Symbol.for("react.consumer"),v=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),b=Symbol.for("react.suspense_list"),n=Symbol.for("react.memo"),o=Symbol.for("react.lazy"),H0=Symbol.for("react.activity"),C=Symbol.for("react.client.reference"),g=m0.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,f=Object.prototype.hasOwnProperty,K0=Array.isArray,r=console.createTask?console.createTask:function(){return null};m0={react_stack_bottom_frame:function(G){return G()}};var W0,L0={},v0=m0.react_stack_bottom_frame.bind(m0,z)(),R0=r(Y(z)),U0={};LQ.Fragment=W,LQ.jsx=function(G,O,w){var j=1e4>g.recentlyCreatedOwnerStacks++;return q(G,O,w,!1,j?Error("react-stack-top-frame"):v0,j?r(Y(G)):R0)},LQ.jsxs=function(G,O,w){var j=1e4>g.recentlyCreatedOwnerStacks++;return q(G,O,w,!0,j?Error("react-stack-top-frame"):v0,j?r(Y(G)):R0)}})()});var J0=E(q0(),1);var d=E(q0(),1),s0=E(q0(),1),l0=E(q0(),1);var x$=(X)=>{let $=p$(X),{conflictingClassGroups:Q,conflictingClassGroupModifiers:Y}=X;return{getClassGroupId:(H)=>{let J=H.split("-");if(J[0]===""&&J.length!==1)J.shift();return lX(J,$)||g$(H)},getConflictingClassGroupIds:(H,J)=>{let K=Q[H]||[];if(J&&Y[H])return[...K,...Y[H]];return K}}},lX=(X,$)=>{if(X.length===0)return $.classGroupId;let Q=X[0],Y=$.nextPart.get(Q),Z=Y?lX(X.slice(1),Y):void 0;if(Z)return Z;if($.validators.length===0)return;let z=X.join("-");return $.validators.find(({validator:H})=>H(z))?.classGroupId},mX=/^\[(.+)\]$/,g$=(X)=>{if(mX.test(X)){let $=mX.exec(X)[1],Q=$?.substring(0,$.indexOf(":"));if(Q)return"arbitrary.."+Q}},p$=(X)=>{let{theme:$,prefix:Q}=X,Y={nextPart:new Map,validators:[]};return c$(Object.entries(X.classGroups),Q).forEach(([z,H])=>{EX(H,Y,z,$)}),Y},EX=(X,$,Q,Y)=>{X.forEach((Z)=>{if(typeof Z==="string"){let z=Z===""?$:cX($,Z);z.classGroupId=Q;return}if(typeof Z==="function"){if(m$(Z)){EX(Z(Y),$,Q,Y);return}$.validators.push({validator:Z,classGroupId:Q});return}Object.entries(Z).forEach(([z,H])=>{EX(H,cX($,z),Q,Y)})})},cX=(X,$)=>{let Q=X;return $.split("-").forEach((Y)=>{if(!Q.nextPart.has(Y))Q.nextPart.set(Y,{nextPart:new Map,validators:[]});Q=Q.nextPart.get(Y)}),Q},m$=(X)=>X.isThemeGetter,c$=(X,$)=>{if(!$)return X;return X.map(([Q,Y])=>{let Z=Y.map((z)=>{if(typeof z==="string")return $+z;if(typeof z==="object")return Object.fromEntries(Object.entries(z).map(([H,J])=>[$+H,J]));return z});return[Q,Z]})},l$=(X)=>{if(X<1)return{get:()=>{return},set:()=>{}};let $=0,Q=new Map,Y=new Map,Z=(z,H)=>{if(Q.set(z,H),$++,$>X)$=0,Y=Q,Q=new Map};return{get(z){let H=Q.get(z);if(H!==void 0)return H;if((H=Y.get(z))!==void 0)return Z(z,H),H},set(z,H){if(Q.has(z))Q.set(z,H);else Z(z,H)}}};var d$=(X)=>{let{separator:$,experimentalParseClassName:Q}=X,Y=$.length===1,Z=$[0],z=$.length,H=(J)=>{let K=[],V=0,q=0,_;for(let N=0;N<J.length;N++){let k=J[N];if(V===0){if(k===Z&&(Y||J.slice(N,N+z)===$)){K.push(J.slice(q,N)),q=N+z;continue}if(k==="/"){_=N;continue}}if(k==="[")V++;else if(k==="]")V--}let U=K.length===0?J:J.substring(q),L=U.startsWith("!"),B=L?U.substring(1):U,W=_&&_>q?_-q:void 0;return{modifiers:K,hasImportantModifier:L,baseClassName:B,maybePostfixModifierPosition:W}};if(Q)return(J)=>Q({className:J,parseClassName:H});return H},i$=(X)=>{if(X.length<=1)return X;let $=[],Q=[];return X.forEach((Y)=>{if(Y[0]==="[")$.push(...Q.sort(),Y),Q=[];else Q.push(Y)}),$.push(...Q.sort()),$},o$=(X)=>({cache:l$(X.cacheSize),parseClassName:d$(X),...x$(X)}),r$=/\s+/,a$=(X,$)=>{let{parseClassName:Q,getClassGroupId:Y,getConflictingClassGroupIds:Z}=$,z=[],H=X.trim().split(r$),J="";for(let K=H.length-1;K>=0;K-=1){let V=H[K],{modifiers:q,hasImportantModifier:_,baseClassName:U,maybePostfixModifierPosition:L}=Q(V),B=Boolean(L),W=Y(B?U.substring(0,L):U);if(!W){if(!B){J=V+(J.length>0?" "+J:J);continue}if(W=Y(U),!W){J=V+(J.length>0?" "+J:J);continue}B=!1}let N=i$(q).join(":"),k=_?N+"!":N,x=k+W;if(z.includes(x))continue;z.push(x);let v=Z(W,B);for(let A=0;A<v.length;++A){let u=v[A];z.push(k+u)}J=V+(J.length>0?" "+J:J)}return J};function n$(){let X=0,$,Q,Y="";while(X<arguments.length)if($=arguments[X++]){if(Q=dX($))Y&&(Y+=" "),Y+=Q}return Y}var dX=(X)=>{if(typeof X==="string")return X;let $,Q="";for(let Y=0;Y<X.length;Y++)if(X[Y]){if($=dX(X[Y]))Q&&(Q+=" "),Q+=$}return Q};function s$(X,...$){let Q,Y,Z,z=H;function H(K){let V=$.reduce((q,_)=>_(q),X());return Q=o$(V),Y=Q.cache.get,Z=Q.cache.set,z=J,J(K)}function J(K){let V=Y(K);if(V)return V;let q=a$(K,Q);return Z(K,q),q}return function(){return z(n$.apply(null,arguments))}}var Q0=(X)=>{let $=(Q)=>Q[X]||[];return $.isThemeGetter=!0,$},iX=/^\[(?:([a-z-]+):)?(.+)\]$/i,t$=/^\d+\/\d+$/,e$=new Set(["px","full","screen"]),XQ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$Q=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,QQ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,YQ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ZQ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,C0=(X)=>r0(X)||e$.has(X)||t$.test(X),x0=(X)=>a0(X,"length",OQ),r0=(X)=>Boolean(X)&&!Number.isNaN(Number(X)),PX=(X)=>a0(X,"number",r0),HX=(X)=>Boolean(X)&&Number.isInteger(Number(X)),zQ=(X)=>X.endsWith("%")&&r0(X.slice(0,-1)),h=(X)=>iX.test(X),g0=(X)=>XQ.test(X),JQ=new Set(["length","size","percentage"]),HQ=(X)=>a0(X,JQ,oX),GQ=(X)=>a0(X,"position",oX),qQ=new Set(["image","url"]),KQ=(X)=>a0(X,qQ,_Q),VQ=(X)=>a0(X,"",UQ),GX=()=>!0,a0=(X,$,Q)=>{let Y=iX.exec(X);if(Y){if(Y[1])return typeof $==="string"?Y[1]===$:$.has(Y[1]);return Q(Y[2])}return!1},OQ=(X)=>$Q.test(X)&&!QQ.test(X),oX=()=>!1,UQ=(X)=>YQ.test(X),_Q=(X)=>ZQ.test(X);var BQ=()=>{let X=Q0("colors"),$=Q0("spacing"),Q=Q0("blur"),Y=Q0("brightness"),Z=Q0("borderColor"),z=Q0("borderRadius"),H=Q0("borderSpacing"),J=Q0("borderWidth"),K=Q0("contrast"),V=Q0("grayscale"),q=Q0("hueRotate"),_=Q0("invert"),U=Q0("gap"),L=Q0("gradientColorStops"),B=Q0("gradientColorStopPositions"),W=Q0("inset"),N=Q0("margin"),k=Q0("opacity"),x=Q0("padding"),v=Q0("saturate"),A=Q0("scale"),u=Q0("sepia"),b=Q0("skew"),n=Q0("space"),o=Q0("translate"),H0=()=>["auto","contain","none"],C=()=>["auto","hidden","clip","visible","scroll"],g=()=>["auto",h,$],f=()=>[h,$],K0=()=>["",C0,x0],r=()=>["auto",r0,h],W0=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],L0=()=>["solid","dashed","dotted","double","none"],v0=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],R0=()=>["start","end","center","between","around","evenly","stretch"],U0=()=>["","0",h],G=()=>["auto","avoid","all","avoid-page","page","left","right","column"],O=()=>[r0,h];return{cacheSize:500,separator:":",theme:{colors:[GX],spacing:[C0,x0],blur:["none","",g0,h],brightness:O(),borderColor:[X],borderRadius:["none","","full",g0,h],borderSpacing:f(),borderWidth:K0(),contrast:O(),grayscale:U0(),hueRotate:O(),invert:U0(),gap:f(),gradientColorStops:[X],gradientColorStopPositions:[zQ,x0],inset:g(),margin:g(),opacity:O(),padding:f(),saturate:O(),scale:O(),sepia:U0(),skew:O(),space:f(),translate:f()},classGroups:{aspect:[{aspect:["auto","square","video",h]}],container:["container"],columns:[{columns:[g0]}],"break-after":[{"break-after":G()}],"break-before":[{"break-before":G()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...W0(),h]}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:H0()}],"overscroll-x":[{"overscroll-x":H0()}],"overscroll-y":[{"overscroll-y":H0()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[W]}],"inset-x":[{"inset-x":[W]}],"inset-y":[{"inset-y":[W]}],start:[{start:[W]}],end:[{end:[W]}],top:[{top:[W]}],right:[{right:[W]}],bottom:[{bottom:[W]}],left:[{left:[W]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",HX,h]}],basis:[{basis:g()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",h]}],grow:[{grow:U0()}],shrink:[{shrink:U0()}],order:[{order:["first","last","none",HX,h]}],"grid-cols":[{"grid-cols":[GX]}],"col-start-end":[{col:["auto",{span:["full",HX,h]},h]}],"col-start":[{"col-start":r()}],"col-end":[{"col-end":r()}],"grid-rows":[{"grid-rows":[GX]}],"row-start-end":[{row:["auto",{span:[HX,h]},h]}],"row-start":[{"row-start":r()}],"row-end":[{"row-end":r()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",h]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",h]}],gap:[{gap:[U]}],"gap-x":[{"gap-x":[U]}],"gap-y":[{"gap-y":[U]}],"justify-content":[{justify:["normal",...R0()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...R0(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...R0(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[N]}],mx:[{mx:[N]}],my:[{my:[N]}],ms:[{ms:[N]}],me:[{me:[N]}],mt:[{mt:[N]}],mr:[{mr:[N]}],mb:[{mb:[N]}],ml:[{ml:[N]}],"space-x":[{"space-x":[n]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[n]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",h,$]}],"min-w":[{"min-w":[h,$,"min","max","fit"]}],"max-w":[{"max-w":[h,$,"none","full","min","max","fit","prose",{screen:[g0]},g0]}],h:[{h:[h,$,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[h,$,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[h,$,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[h,$,"auto","min","max","fit"]}],"font-size":[{text:["base",g0,x0]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",PX]}],"font-family":[{font:[GX]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",h]}],"line-clamp":[{"line-clamp":["none",r0,PX]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",C0,h]}],"list-image":[{"list-image":["none",h]}],"list-style-type":[{list:["none","disc","decimal",h]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[X]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[X]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...L0(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",C0,x0]}],"underline-offset":[{"underline-offset":["auto",C0,h]}],"text-decoration-color":[{decoration:[X]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:f()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",h]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",h]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...W0(),GQ]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",HQ]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},KQ]}],"bg-color":[{bg:[X]}],"gradient-from-pos":[{from:[B]}],"gradient-via-pos":[{via:[B]}],"gradient-to-pos":[{to:[B]}],"gradient-from":[{from:[L]}],"gradient-via":[{via:[L]}],"gradient-to":[{to:[L]}],rounded:[{rounded:[z]}],"rounded-s":[{"rounded-s":[z]}],"rounded-e":[{"rounded-e":[z]}],"rounded-t":[{"rounded-t":[z]}],"rounded-r":[{"rounded-r":[z]}],"rounded-b":[{"rounded-b":[z]}],"rounded-l":[{"rounded-l":[z]}],"rounded-ss":[{"rounded-ss":[z]}],"rounded-se":[{"rounded-se":[z]}],"rounded-ee":[{"rounded-ee":[z]}],"rounded-es":[{"rounded-es":[z]}],"rounded-tl":[{"rounded-tl":[z]}],"rounded-tr":[{"rounded-tr":[z]}],"rounded-br":[{"rounded-br":[z]}],"rounded-bl":[{"rounded-bl":[z]}],"border-w":[{border:[J]}],"border-w-x":[{"border-x":[J]}],"border-w-y":[{"border-y":[J]}],"border-w-s":[{"border-s":[J]}],"border-w-e":[{"border-e":[J]}],"border-w-t":[{"border-t":[J]}],"border-w-r":[{"border-r":[J]}],"border-w-b":[{"border-b":[J]}],"border-w-l":[{"border-l":[J]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...L0(),"hidden"]}],"divide-x":[{"divide-x":[J]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[J]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:L0()}],"border-color":[{border:[Z]}],"border-color-x":[{"border-x":[Z]}],"border-color-y":[{"border-y":[Z]}],"border-color-s":[{"border-s":[Z]}],"border-color-e":[{"border-e":[Z]}],"border-color-t":[{"border-t":[Z]}],"border-color-r":[{"border-r":[Z]}],"border-color-b":[{"border-b":[Z]}],"border-color-l":[{"border-l":[Z]}],"divide-color":[{divide:[Z]}],"outline-style":[{outline:["",...L0()]}],"outline-offset":[{"outline-offset":[C0,h]}],"outline-w":[{outline:[C0,x0]}],"outline-color":[{outline:[X]}],"ring-w":[{ring:K0()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[X]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[C0,x0]}],"ring-offset-color":[{"ring-offset":[X]}],shadow:[{shadow:["","inner","none",g0,VQ]}],"shadow-color":[{shadow:[GX]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...v0(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":v0()}],filter:[{filter:["","none"]}],blur:[{blur:[Q]}],brightness:[{brightness:[Y]}],contrast:[{contrast:[K]}],"drop-shadow":[{"drop-shadow":["","none",g0,h]}],grayscale:[{grayscale:[V]}],"hue-rotate":[{"hue-rotate":[q]}],invert:[{invert:[_]}],saturate:[{saturate:[v]}],sepia:[{sepia:[u]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[Q]}],"backdrop-brightness":[{"backdrop-brightness":[Y]}],"backdrop-contrast":[{"backdrop-contrast":[K]}],"backdrop-grayscale":[{"backdrop-grayscale":[V]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[q]}],"backdrop-invert":[{"backdrop-invert":[_]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[v]}],"backdrop-sepia":[{"backdrop-sepia":[u]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[H]}],"border-spacing-x":[{"border-spacing-x":[H]}],"border-spacing-y":[{"border-spacing-y":[H]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",h]}],duration:[{duration:O()}],ease:[{ease:["linear","in","out","in-out",h]}],delay:[{delay:O()}],animate:[{animate:["none","spin","ping","pulse","bounce",h]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[A]}],"scale-x":[{"scale-x":[A]}],"scale-y":[{"scale-y":[A]}],rotate:[{rotate:[HX,h]}],"translate-x":[{"translate-x":[o]}],"translate-y":[{"translate-y":[o]}],"skew-x":[{"skew-x":[b]}],"skew-y":[{"skew-y":[b]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",h]}],accent:[{accent:["auto",X]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",h]}],"caret-color":[{caret:[X]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":f()}],"scroll-mx":[{"scroll-mx":f()}],"scroll-my":[{"scroll-my":f()}],"scroll-ms":[{"scroll-ms":f()}],"scroll-me":[{"scroll-me":f()}],"scroll-mt":[{"scroll-mt":f()}],"scroll-mr":[{"scroll-mr":f()}],"scroll-mb":[{"scroll-mb":f()}],"scroll-ml":[{"scroll-ml":f()}],"scroll-p":[{"scroll-p":f()}],"scroll-px":[{"scroll-px":f()}],"scroll-py":[{"scroll-py":f()}],"scroll-ps":[{"scroll-ps":f()}],"scroll-pe":[{"scroll-pe":f()}],"scroll-pt":[{"scroll-pt":f()}],"scroll-pr":[{"scroll-pr":f()}],"scroll-pb":[{"scroll-pb":f()}],"scroll-pl":[{"scroll-pl":f()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",h]}],fill:[{fill:[X,"none"]}],"stroke-w":[{stroke:[C0,x0,PX]}],stroke:[{stroke:[X,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}};var rX=s$(BQ);var Z$=E(q0(),1),b0=E(p(),1),t0=E(q0(),1),D0=E(p(),1),z$=E(p(),1),bX=E(p(),1),e0=E(q0(),1),z0=E(p(),1),J$=E(q0(),1),V0=E(p(),1),KX=E(p(),1),D=E(p(),1),M0=E(p(),1),N0=E(p(),1),BX=E(p(),1),B0=E(p(),1),wX=E(p(),1),P=E(p(),1),Y0=E(p(),1),l=E(p(),1),F=E(p(),1),y=E(p(),1),qX=E(p(),1),k0=E(q0(),1),I=E(p(),1),j0=E(q0(),1),R=E(p(),1),O0=E(p(),1),HY=E(q0(),1),G$=E(p(),1),SX=E(q0(),1),yX=E(p(),1),GY=E(q0(),1),q$=E(p(),1),K$=E(q0(),1),V$=E(p(),1),qY=E(q0(),1),O$=E(p(),1),U$=E(p(),1),_$=E(p(),1),LX=E(q0(),1),KY=E(q0(),1),CX=E(p(),1),B$=E(p(),1),D$=E(p(),1),L$=E(p(),1),F$=E(q0(),1),W$=E(q0(),1),FQ=Object.defineProperty,WQ=(X,$,Q)=>($ in X)?FQ(X,$,{enumerable:!0,configurable:!0,writable:!0,value:Q}):X[$]=Q,RQ=(X,$,Q)=>WQ(X,typeof $!=="symbol"?$+"":$,Q);function e(...X){return rX(eX(X))}var EY=[{id:"msg-1",role:"assistant",content:"Hello! I'm your AI assistant. How can I help you today?",timestamp:new Date(Date.now()-3600000)},{id:"msg-2",role:"user",content:"I want to plan a trip to Europe",timestamp:new Date(Date.now()-3500000)},{id:"msg-3",role:"assistant",content:"Great choice! Europe has amazing destinations. What's your budget and how many days do you have?",timestamp:new Date(Date.now()-3400000)},{id:"msg-4",role:"user",content:"Around $2000 for 5 days",timestamp:new Date(Date.now()-3300000)},{id:"msg-5",role:"assistant",content:"Perfect! I found some great destinations that fit your budget:",widgets:[{type:"list",id:"destinations-1",props:{items:[{id:"paris",title:"Paris, France",subtitle:"5 days • $1,850",description:"The City of Light with iconic landmarks",metadata:{city:"Paris",country:"France",lat:48.8566,lng:2.3522,price:1850,days:5}},{id:"rome",title:"Rome, Italy",subtitle:"5 days • $1,650",description:"Ancient history meets modern culture",metadata:{city:"Rome",country:"Italy",lat:41.9028,lng:12.4964,price:1650,days:5}},{id:"barcelona",title:"Barcelona, Spain",subtitle:"5 days • $1,450",description:"Beautiful beaches and Gaudí architecture",metadata:{city:"Barcelona",country:"Spain",lat:41.3851,lng:2.1734,price:1450,days:5}}]},actions:[{type:"select_destination",label:"Select",handler:"client",payload:{}},{type:"view_details",label:"Details",handler:"server",payload:{}}]}],timestamp:new Date(Date.now()-3200000)}],MY=[{id:"thread-1",title:"Trip to Europe",preview:"Planning a 5-day trip...",createdAt:new Date(Date.now()-86400000),updatedAt:new Date(Date.now()-3600000),messageCount:12},{id:"thread-2",title:"Restaurant Recommendations",preview:"Looking for good places...",createdAt:new Date(Date.now()-172800000),updatedAt:new Date(Date.now()-86400000),messageCount:8},{id:"thread-3",title:"Budget Planning",preview:"Help with monthly budget",createdAt:new Date(Date.now()-259200000),updatedAt:new Date(Date.now()-172800000),messageCount:15}];function NQ(X=1000){return new Promise(($)=>{setTimeout(()=>{$({id:`msg-${Date.now()}`,role:"assistant",content:"This is a mock response. In production, this would come from your AI agent API.",timestamp:new Date})},X)})}function AQ(X){let $=X.toLowerCase();if($.includes("analyze")||$.includes("analysis"))return`Analysis complete for "${X}". Found 247 records with an average value of $1,234. The data shows a 23% increase compared to last quarter. Key insights: Revenue is up, customer satisfaction improved by 15%, and operational costs decreased by 8%.`;if($.includes("sales")||$.includes("revenue"))return"Sales data processed: Q4 2024 revenue reached $2.4M, representing 18% growth year-over-year. Top performing products: Enterprise Plan (+45%), Pro Plan (+32%), Basic Plan (+12%). Regional breakdown: North America (52%), Europe (31%), APAC (17%).";if($.includes("report")||$.includes("summary"))return"Report generated successfully. Executive Summary: Overall performance exceeded targets by 12%. Marketing ROI improved to 3.2x, customer acquisition cost reduced by 18%, and lifetime value increased by 24%. Detailed breakdown available in attached widgets.";if($.includes("data")||$.includes("metrics"))return"Data metrics retrieved: 1,847 active users, 12,394 sessions this month, 94.2% uptime, average response time 127ms. Performance is within acceptable parameters. No critical issues detected.";if($.includes("customer")||$.includes("user"))return"Customer analysis complete: 523 new customers this month, 89% retention rate, average satisfaction score 4.6/5. Top feedback themes: excellent support (87%), easy to use (72%), good value (68%). 3 support tickets pending review.";return"This is a mock response showing how your agent would process and respond to commands. The actual response would be generated by your AI agent based on real data and context."}function PQ(X){let $=AQ(X),Q=X.toLowerCase(),Y=[],Z;if(Q.includes("sales")||Q.includes("revenue")||Q.includes("analyze"))Y.push({type:"card",id:`widget-${Date.now()}-1`,props:{title:"Q4 2024 Performance",description:"Revenue: $2.4M (+18% YoY)",footer:"Updated: "+new Date().toLocaleDateString()},actions:[{type:"view_details",label:"View Details",handler:"client",payload:{reportId:"q4-2024"}}]});if(Q.includes("customer")||Q.includes("user"))Y.push({type:"list",id:`widget-${Date.now()}-2`,props:{items:[{id:"metric-1",title:"Active Users",subtitle:"1,847 users",description:"+12% from last month"},{id:"metric-2",title:"Retention Rate",subtitle:"89%",description:"Above industry average"},{id:"metric-3",title:"Satisfaction Score",subtitle:"4.6/5",description:"Based on 234 reviews"}]}});if(Q.includes("task")||Q.includes("todo")||Q.includes("work")||Q.includes("completed"))Y.push({type:"list",id:`widget-${Date.now()}-tasks`,props:{items:[{id:"task-1",title:"Implement user authentication",subtitle:"Created just now",description:"Added OAuth 2.0 support with Google and GitHub providers",backgroundColor:"rgba(59, 130, 246, 0.15)",metadata:{status:"created",priority:"high",tags:["backend","security"]}},{id:"task-2",title:"Update API documentation",subtitle:"Modified 2 minutes ago",description:"Changed endpoint descriptions and added new examples",backgroundColor:"rgba(234, 179, 8, 0.15)",metadata:{status:"modified",priority:"medium",tags:["docs"]}},{id:"task-3",title:"Fix login redirect bug",subtitle:"Completed 5 minutes ago",description:"Users now properly redirected after successful login",backgroundColor:"rgba(34, 197, 94, 0.15)",metadata:{status:"completed",priority:"urgent",tags:["bugfix","auth"]}}]},actions:[{type:"view_task",label:"View",handler:"client",payload:{}},{type:"undo",label:"Undo",handler:"server",payload:{}}]}),Z={type:"update_database",payload:{table:"tasks",operation:"mark_as_viewed",taskIds:["task-1","task-2","task-3"],timestamp:new Date().toISOString()}};if(Q.includes("analyze")||Q.includes("analysis"))Z={type:"send_notification",payload:{recipient:"team@company.com",subject:"Analysis Complete",message:"Your requested analysis has been completed and is ready for review."}};return{message:$,widgets:Y,action:Z}}function EQ(X,$,Q,Y,Z=30){let{message:z,widgets:H}=PQ(X),J=z.split(" "),K=0,V=setInterval(()=>{try{if(K<J.length)$({type:"token",content:J[K]+" "}),K++;else{clearInterval(V),H.forEach((_)=>{$({type:"widget",widget:_})});let q=`mock_thread_${Date.now()}`;$({type:"complete"}),Q(q)}}catch(q){clearInterval(V),Y(q instanceof Error?q:Error("Mock streaming error"))}},Z)}function MQ(X){return new Promise(($,Q)=>{let Y=new FileReader;Y.onload=()=>{let z=Y.result.split(",")[1];$(z)},Y.onerror=()=>Q(Error("Failed to read file")),Y.readAsDataURL(X)})}function vQ(X){if(X.startsWith("image/"))return"image";return"document"}function TQ(X){return["image/jpeg","image/png","image/gif","image/webp","application/pdf","text/plain","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"].includes(X.type)}async function IQ(X){let $=await MQ(X);return{type:vQ(X.type),source:{type:"base64",media_type:X.type,data:$}}}async function bQ(X){let $=Array.from(X);return await Promise.all($.map((Y)=>IQ(Y)))}async function aX(X,$){if(!$||$.length===0)return X;let Q=[];if(X.trim())Q.push({type:"text",text:X.trim()});let Y=await bQ($);return Q.push(...Y),Q}function DX(X){if(X<1024)return`${X} B`;if(X<1048576)return`${(X/1024).toFixed(1)} KB`;return`${(X/1048576).toFixed(1)} MB`}var nX=10485760;function X$(X){if(!TQ(X))return{valid:!1,error:`Unsupported file type: ${X.type}`};if(X.size>nX)return{valid:!1,error:`File too large: ${DX(X.size)} (max ${DX(nX)})`};return{valid:!0}}var kQ=["list","table"];function wQ(X){let $=[],Q=!1,Y=X.match(/"items"\s*:\s*\[/);if(!Y)return{items:$,isStreaming:!1};let Z=X.indexOf("[",Y.index);if(Z===-1)return{items:$,isStreaming:!0};let z=0,H=!1,J=!1,K=-1;for(let _=Z+1;_<X.length;_++){let U=X[_];if(J){J=!1;continue}if(U==="\\"&&H){J=!0;continue}if(U==='"'){H=!H;continue}if(H)continue;if(U==="{"){if(z===0)K=_;z++}else if(U==="}"){if(z--,z===0&&K!==-1){let L=X.slice(K,_+1);try{let B=JSON.parse(L);if(!B.id)B.id=`item-${$.length}-${TX(L)}`;$.push(B)}catch(B){}K=-1}}else if(U==="]"&&z===0){Q=!1;break}}if(z>0||K!==-1)Q=!0;let V=X.slice(Z);if(IX(V,0)===-1)Q=!0;return{items:$,isStreaming:Q}}function TX(X){let $=0;for(let Q=0;Q<X.length;Q++){let Y=X.charCodeAt(Q);$=($<<5)-$+Y,$=$&$}return Math.abs($).toString(36)}function IX(X,$){let Q=0,Y=!1,Z=!1;for(let z=$;z<X.length;z++){let H=X[z];if(Z){Z=!1;continue}if(H==="\\"&&Y){Z=!0;continue}if(H==='"'){Y=!Y;continue}if(Y)continue;if(H==="["||H==="{")Q++;else if(H==="]"||H==="}"){if(Q--,Q===0)return z}}return-1}function UX(X){let $=[],Q=!1,Y=!1,Z=0,z=null,H=X,J=X.lastIndexOf("@ui:");if(J!==-1){let q=X.slice(J),_=q.match(/^@ui:(\w+)/);if(_){let U=_[1],L=q.indexOf("[");if(L===-1)H=X.slice(0,J),z=U,Y=!0;else{let B=J+L;if(IX(X,B)===-1)if(kQ.includes(U)){let N=X.slice(B+1),{items:k,isStreaming:x}=wQ(N);if(k.length>0){H=X.slice(0,J);let v=`widget-${U}-streaming-${TX(N)}`,A=H.replace(/[\s:;\-–—\.]+$/g,"").trim();if(A)$.push({type:"text",content:A});$.push({type:"widget",widget:{type:U,id:v,props:U==="table"?{rows:k,columns:[]}:{items:k},isStreaming:x}}),Q=!0,Y=!1,H=""}else H=X.slice(0,J),z=U,Y=!0}else H=X.slice(0,J),z=U,Y=!0}}}if(Y)H=H.replace(/[\s:;\-–—\.]+$/g,"");let K=/@ui:(\w+)\[/g,V;while((V=K.exec(H))!==null){let q=V[1],_=V.index+V[0].length-1,U=IX(H,_);if(U===-1)continue;let L=H.slice(_+1,U);if(V.index>Z){let B=H.slice(Z,V.index).trim();if(B)$.push({type:"text",content:B})}try{let B=L.trim(),W=JSON.parse(B),N=`widget-${q}-${TX(B)}`,{metadata:k,actions:x,...v}=W;$.push({type:"widget",widget:{type:q,id:N,props:v,...x&&{actions:x},...k&&{metadata:k}}}),Q=!0}catch(B){}Z=U+1,K.lastIndex=Z}if(Z<H.length){let q=H.slice(Z).trim();if(q)$.push({type:"text",content:q})}if($.length===0&&H.trim())$.push({type:"text",content:H.trim()});if(z)$.push({type:"widget_pending",pendingType:z});return{segments:$,hasWidgets:Q,hasPendingWidget:Y}}var $$={card:{schema:"title, description?, image?, footer?, actions?: [{type, label}]",example:'@ui:card[{"title": "Summary", "description": "Details here"}]'},list:{schema:"items: [{id, title, subtitle?, description?, image?, metadata?: {any extra data}}], actions?: [{type, label}] - metadata is sent as action payload when clicked",example:'@ui:list[{"items": [{"id": "1", "title": "Item", "subtitle": "Info", "metadata": {"key": "value"}}]}]'},button_group:{schema:"buttons: [{id, label, variant?}] - Use for standalone buttons only, NOT for form submits",example:'@ui:button_group[{"buttons": [{"id": "ok", "label": "OK"}]}]'},form:{schema:"title?, fields: [{name, type: text|password|number|select|checkbox|textarea|date, label, required?, placeholder?, options?}], actions: [{type, label}] - Button is built-in via actions, do NOT add separate button",example:'@ui:form[{"title": "Settings", "fields": [{"name": "apiKey", "type": "password", "label": "API Key", "required": true}], "actions": [{"type": "save", "label": "Save"}]}]'},table:{schema:"columns: [{key, label}], rows: [...], striped?, compact?",example:'@ui:table[{"columns": [{"key": "name", "label": "Name"}], "rows": [{"name": "A"}]}]'},image:{schema:"src, alt, caption?",example:'@ui:image[{"src": "url", "alt": "desc"}]'},chart:{schema:"chartType: line|bar|pie, data: {labels, datasets}",example:'@ui:chart[{"chartType": "bar", "data": {"labels": ["A"], "datasets": [{"label": "X", "data": [10]}]}}]'},flow:{schema:"title, subtitle?, icon?: research|schedule|analyze|deploy|recurring|automation|data, steps: [{id, label, type?, color?: blue|purple|cyan|amber|emerald|rose|indigo|orange, status?: pending|active|completed|error|skipped}] - Horizontal pipeline. Use @label for agents. Types auto-detected from label.",example:'@ui:flow[{"title": "Deploy Pipeline", "icon": "deploy", "steps": [{"id": "1", "label": "Test", "color": "cyan"}, {"id": "2", "label": "Build", "color": "amber"}, {"id": "3", "label": "Deploy", "color": "rose"}]}]'}},SQ=Object.keys($$),yQ=["flow"],Q$=SQ.filter((X)=>!yQ.includes(X));function CQ(X){let $=X||Q$,Q=`
7
+ ## UI Widgets
8
+ SYNTAX: @ui:type[{json}] - MUST use SQUARE BRACKETS [] around the JSON object.
9
+ CORRECT: @ui:list[{"items": [...]}]
10
+ WRONG: @ui:list{"items": [...]} (missing square brackets)
11
+
12
+ `;for(let Y of $){let Z=$$[Y];if(!Z)continue;Q+=`${Y}: ${Z.schema} | ${Z.example}
13
+ `}return Q+=`
14
+ Per-item "metadata" is sent as payload on action click.
15
+ `,Q}function fQ(X){return`
16
+ Widgets: @ui:type[{json}] - MUST use square brackets []. Example: @ui:list[{"items": [...]}]. Types: ${(X||Q$).join(", ")}. Per-item "metadata" is sent as action payload.
17
+ `}function Y$(X){let $=[],Q=null;for(let Y=0;Y<X.length;Y++){let Z=X[Y],z=Z.created_at||Z.timestamp?new Date(Z.created_at||Z.timestamp):new Date;if(typeof Z.content==="string"){let H={id:Z.id||`thread-msg-${Y}`,role:Z.role,content:Z.content,timestamp:z};$.push(H),Q=null}else if(Array.isArray(Z.content)){if(Z.role==="assistant"){let H=[],J="";for(let V of Z.content)if(V.type==="text"&&V.text)H.push({type:"text",content:V.text}),J+=V.text;else if(V.type==="tool_use")H.push({type:"tool",id:V.id||`tool-${Y}-${H.length}`,name:V.name||"unknown",status:"completed"});let K={id:Z.id||`thread-msg-${Y}`,role:"assistant",content:J,timestamp:z,metadata:H.length>0?{content_segments:H}:void 0};$.push(K),Q=H}else if(Z.role==="user")if(Z.content.some((J)=>J.type==="tool_result")&&Q){for(let J of Z.content)if(J.type==="tool_result"&&J.tool_use_id){let K=Q.find((V)=>V.type==="tool"&&V.id===J.tool_use_id);if(K&&K.type==="tool")K.result=typeof J.content==="string"?J.content:Array.isArray(J.content)?J.content.map((V)=>V.text||"").join(""):void 0,K.status=J.is_error?"error":"completed"}}else{let J=Z.content.filter((K)=>K.type==="text").map((K)=>K.text||"").join("");if(J)$.push({id:Z.id||`thread-msg-${Y}`,role:"user",content:J,timestamp:z});Q=null}}}return $}function jQ({widget:X,onAction:$}){let{title:Q,description:Y,image:Z,footer:z}=X.props;return b0.jsxs("div",{className:"border border-neutral-200 dark:border-neutral-700 rounded-xl bg-white dark:bg-neutral-900 overflow-hidden",children:[Z&&b0.jsx("img",{src:Z,alt:Q,className:"w-full h-48 object-cover"}),b0.jsxs("div",{className:"p-4",children:[b0.jsx("h3",{className:"!text-lg font-semibold !text-neutral-900 dark:!text-white",children:Q}),Y&&b0.jsx("p",{className:"!text-neutral-600 dark:!text-neutral-400 mt-2",children:Y})]}),(z||X.actions&&X.actions.length>0)&&b0.jsxs("div",{className:"border-t border-neutral-200 dark:border-neutral-700 p-4 flex justify-between items-center",children:[z&&b0.jsx("span",{className:"!text-sm !text-neutral-600 dark:!text-neutral-400",children:z}),X.actions&&X.actions.length>0&&b0.jsx("div",{className:"flex gap-2",children:X.actions.map((H,J)=>b0.jsx("button",{onClick:()=>$?.({type:H.type,payload:H.payload,widgetId:X.id,timestamp:new Date}),className:"px-3 py-1.5 !text-sm rounded-lg font-medium transition-colors bg-blue-500 !text-white hover:bg-blue-600",children:H.label},J))})]})]})}function hQ({widget:X,onAction:$}){let{items:Q}=X.props,Y=X.isStreaming??!1,Z=t0.useRef(new Set),[z,H]=t0.useState(new Set);return t0.useEffect(()=>{let J=new Set(Q.map((V)=>V.id)),K=new Set;if(Q.forEach((V)=>{if(!Z.current.has(V.id))K.add(V.id)}),Q.forEach((V)=>Z.current.add(V.id)),K.size>0){H(K);let V=setTimeout(()=>{H(new Set)},500);return()=>clearTimeout(V)}},[Q]),D0.jsxs("div",{className:"border border-neutral-200 dark:border-neutral-700 rounded-xl bg-white dark:bg-neutral-900 overflow-hidden",children:[Q.map((J,K)=>{let V=z.has(J.id),q=K===Q.length-1;return D0.jsxs("div",{className:`apteva-list-item flex items-center p-4 transition-colors ${!q||Y?"border-b border-neutral-200 dark:border-neutral-700":""} ${!J.backgroundColor?"hover:bg-neutral-50 dark:hover:bg-neutral-800":""} ${V?"apteva-list-item-new":""}`,style:J.backgroundColor?{backgroundColor:J.backgroundColor}:void 0,children:[J.image&&D0.jsx("img",{src:J.image,alt:J.title,className:"w-16 h-16 rounded object-cover"}),D0.jsxs("div",{className:`flex-1 ${J.image?"ml-4":""}`,children:[D0.jsx("h4",{className:"font-semibold !text-neutral-900 dark:!text-white",children:J.title}),J.subtitle&&D0.jsx("p",{className:"!text-sm !text-neutral-600 dark:!text-neutral-400",children:J.subtitle}),J.description&&D0.jsx("p",{className:"!text-xs !text-neutral-500 dark:!text-neutral-500 mt-1",children:J.description})]}),X.actions&&X.actions.length>0&&D0.jsx("div",{className:"flex gap-2",children:X.actions.map((_,U)=>D0.jsx("button",{onClick:()=>$?.({type:_.type,payload:J.metadata||J,widgetId:X.id,timestamp:new Date}),className:"px-3 py-1.5 !text-sm rounded-lg font-medium transition-colors bg-blue-500 !text-white hover:bg-blue-600",children:_.label},U))})]},J.id)}),Y&&D0.jsxs("div",{className:"apteva-list-streaming flex items-center gap-3 p-4 text-neutral-500 dark:text-neutral-400",children:[D0.jsxs("div",{className:"apteva-streaming-dots flex gap-1",children:[D0.jsx("span",{className:"w-2 h-2 bg-current rounded-full animate-pulse",style:{animationDelay:"0ms"}}),D0.jsx("span",{className:"w-2 h-2 bg-current rounded-full animate-pulse",style:{animationDelay:"150ms"}}),D0.jsx("span",{className:"w-2 h-2 bg-current rounded-full animate-pulse",style:{animationDelay:"300ms"}})]}),D0.jsx("span",{className:"text-sm",children:"Loading more..."})]})]})}function uQ({widget:X,onAction:$}){let{label:Q,variant:Y="primary",disabled:Z=!1}=X.props;return z$.jsx("button",{onClick:()=>X.actions?.[0]&&$?.({type:X.actions[0].type,payload:X.actions[0].payload,widgetId:X.id,timestamp:new Date}),disabled:Z,className:e("px-4 py-2 rounded-lg font-medium transition-colors",{primary:"bg-blue-500 !text-white hover:bg-blue-600",secondary:"bg-neutral-500 !text-white hover:bg-neutral-600",outline:"border-2 border-blue-500 !text-blue-500 hover:bg-blue-50 dark:hover:bg-blue-900",ghost:"!text-blue-500 hover:bg-blue-50 dark:hover:bg-blue-900"}[Y],{"opacity-50 cursor-not-allowed":Z}),children:Q})}function xQ({widget:X,onAction:$}){let{layout:Q="horizontal",buttons:Y}=X.props,Z={primary:"bg-blue-500 !text-white hover:bg-blue-600",secondary:"bg-neutral-200 dark:bg-neutral-700 !text-neutral-800 dark:!text-neutral-200 hover:bg-neutral-300 dark:hover:bg-neutral-600",outline:"border border-neutral-300 dark:border-neutral-600 !text-neutral-700 dark:!text-neutral-300 hover:bg-neutral-100 dark:hover:bg-neutral-800"},z=(H)=>{return X.actions?.find((J)=>J.payload?.buttonId===H)||X.actions?.[0]};return bX.jsx("div",{className:e("flex gap-2",Q==="vertical"?"flex-col":"flex-row flex-wrap"),children:Y.map((H)=>{let J=z(H.id);return bX.jsx("button",{onClick:()=>{if(J)$?.({type:J.type,payload:{...J.payload,buttonId:H.id},widgetId:X.id,timestamp:new Date})},className:e("px-4 py-2 rounded-lg font-medium transition-colors text-sm",Z[H.variant||"secondary"]),children:H.label},H.id)})})}function gQ({widget:X,onAction:$}){let{columns:Q,rows:Y,caption:Z,compact:z=!1,striped:H=!1}=X.props,J=X.isStreaming??!1,K=e0.useRef(new Set),[V,q]=e0.useState(new Set);e0.useEffect(()=>{let U=new Set;if(Y.forEach((L,B)=>{let W=L.id||`row-${B}`;if(!K.current.has(W))U.add(W)}),Y.forEach((L,B)=>{let W=L.id||`row-${B}`;K.current.add(W)}),U.size>0){q(U);let L=setTimeout(()=>{q(new Set)},500);return()=>clearTimeout(L)}},[Y]);let _=(U)=>{switch(U){case"center":return"text-center";case"right":return"text-right";default:return"text-left"}};return z0.jsx("div",{className:"border border-neutral-200 dark:border-neutral-700 rounded-xl bg-white dark:bg-neutral-900 overflow-hidden",children:z0.jsx("div",{className:"overflow-x-auto",children:z0.jsxs("table",{className:"w-full",children:[Z&&z0.jsx("caption",{className:"px-4 py-2 text-sm text-neutral-600 dark:text-neutral-400 text-left bg-neutral-50 dark:bg-neutral-800 border-b border-neutral-200 dark:border-neutral-700",children:Z}),z0.jsx("thead",{children:z0.jsx("tr",{className:"bg-neutral-50 dark:bg-neutral-800 border-b border-neutral-200 dark:border-neutral-700",children:Q.map((U)=>z0.jsx("th",{className:e("font-semibold text-neutral-900 dark:text-white",z?"px-3 py-2 text-xs":"px-4 py-3 text-sm",_(U.align)),style:U.width?{width:U.width}:void 0,children:U.label},U.key))})}),z0.jsxs("tbody",{children:[Y.map((U,L)=>{let B=U.id||`row-${L}`,W=V.has(B);return z0.jsx("tr",{className:e("apteva-table-row border-b border-neutral-200 dark:border-neutral-700 last:border-b-0","transition-colors hover:bg-neutral-50 dark:hover:bg-neutral-800",H&&L%2===1&&"bg-neutral-50/50 dark:bg-neutral-800/50",W&&"apteva-table-row-new"),onClick:()=>{if(X.actions&&X.actions.length>0)$?.({type:X.actions[0].type,payload:U,widgetId:X.id,timestamp:new Date})},style:{cursor:X.actions?.length?"pointer":"default"},children:Q.map((N)=>z0.jsx("td",{className:e("text-neutral-700 dark:text-neutral-300",z?"px-3 py-2 text-xs":"px-4 py-3 text-sm",_(N.align)),children:U[N.key]??"—"},N.key))},B)}),Y.length===0&&!J&&z0.jsx("tr",{children:z0.jsx("td",{colSpan:Q.length||1,className:"px-4 py-8 text-center text-sm text-neutral-500 dark:text-neutral-400",children:"No data available"})}),J&&z0.jsx("tr",{className:"apteva-table-streaming",children:z0.jsx("td",{colSpan:Q.length||1,className:"px-4 py-3 text-center",children:z0.jsxs("div",{className:"flex items-center justify-center gap-3 text-neutral-500 dark:text-neutral-400",children:[z0.jsxs("div",{className:"flex gap-1",children:[z0.jsx("span",{className:"w-2 h-2 bg-current rounded-full animate-pulse",style:{animationDelay:"0ms"}}),z0.jsx("span",{className:"w-2 h-2 bg-current rounded-full animate-pulse",style:{animationDelay:"150ms"}}),z0.jsx("span",{className:"w-2 h-2 bg-current rounded-full animate-pulse",style:{animationDelay:"300ms"}})]}),z0.jsx("span",{className:"text-sm",children:"Loading more..."})]})})})]})]})})})}function pQ({widget:X,onAction:$}){let{title:Q,fields:Y}=X.props,[Z,z]=J$.useState(()=>{let q={};return Y.forEach((_)=>{q[_.name]=_.defaultValue??(_.type==="checkbox"?!1:"")}),q}),H=(q,_)=>{z((U)=>({...U,[q]:_}))},J=(q)=>{if(q.preventDefault(),X.actions?.[0]&&$)$({type:X.actions[0].type,payload:{...X.actions[0].payload,formData:Z},widgetId:X.id,timestamp:new Date})},K=(q)=>{switch(q.type){case"text":case"password":case"number":case"date":return V0.jsx("input",{type:q.type,name:q.name,value:Z[q.name]||"",onChange:(U)=>H(q.name,q.type==="number"?Number(U.target.value):U.target.value),placeholder:q.placeholder,required:q.required,className:"w-full px-3 py-2 rounded-lg border transition-colors border-neutral-200 dark:border-neutral-600 bg-neutral-50 dark:bg-neutral-800 !text-neutral-900 dark:!text-neutral-100 placeholder-neutral-400 dark:placeholder-neutral-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"});case"textarea":return V0.jsx("textarea",{name:q.name,value:Z[q.name]||"",onChange:(U)=>H(q.name,U.target.value),placeholder:q.placeholder,required:q.required,rows:3,className:"w-full px-3 py-2 rounded-lg border transition-colors border-neutral-200 dark:border-neutral-600 bg-neutral-50 dark:bg-neutral-800 !text-neutral-900 dark:!text-neutral-100 placeholder-neutral-400 dark:placeholder-neutral-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"});case"select":return V0.jsxs("select",{name:q.name,value:Z[q.name]||"",onChange:(U)=>H(q.name,U.target.value),required:q.required,className:"w-full px-3 py-2 rounded-lg border transition-colors border-neutral-200 dark:border-neutral-600 bg-neutral-50 dark:bg-neutral-800 !text-neutral-900 dark:!text-neutral-100 placeholder-neutral-400 dark:placeholder-neutral-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[V0.jsx("option",{value:"",children:q.placeholder||"Select..."}),q.options?.map((U)=>V0.jsx("option",{value:U.value,children:U.label},U.value))]});case"checkbox":return V0.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[V0.jsx("input",{type:"checkbox",name:q.name,checked:Z[q.name]||!1,onChange:(U)=>H(q.name,U.target.checked),className:"w-4 h-4 rounded border-neutral-300 dark:border-neutral-600 text-blue-500 focus:ring-blue-500"}),V0.jsx("span",{className:"!text-neutral-700 dark:!text-neutral-300",children:q.label})]});default:return null}},V=X.actions?.find((q)=>q.type==="submit")||X.actions?.[0];return V0.jsxs("form",{onSubmit:J,className:"border border-neutral-200 dark:border-neutral-700 rounded-xl bg-white dark:bg-neutral-900 overflow-hidden",children:[V0.jsxs("div",{className:"p-4",children:[Q&&V0.jsx("h3",{className:"!text-lg font-semibold !text-neutral-900 dark:!text-white mb-4",children:Q}),V0.jsx("div",{className:"space-y-3",children:Y.map((q)=>V0.jsxs("div",{className:q.type==="checkbox"?"":"space-y-1",children:[q.type!=="checkbox"&&V0.jsxs("label",{className:"block !text-sm font-medium !text-neutral-600 dark:!text-neutral-400",children:[q.label,q.required&&V0.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),K(q)]},q.name))})]}),V&&V0.jsx("div",{className:"px-4 pb-4",children:V0.jsx("button",{type:"submit",className:"px-3 py-1.5 !text-sm rounded-lg font-medium transition-colors bg-blue-500 !text-white hover:bg-blue-600",children:V.label||"Submit"})})]})}function mQ({widget:X}){let{src:$,alt:Q,caption:Y}=X.props;return KX.jsxs("figure",{className:"overflow-hidden rounded-xl",children:[KX.jsx("img",{src:$,alt:Q,className:"w-full h-auto object-contain bg-neutral-100 dark:bg-neutral-800",loading:"lazy"}),Y&&KX.jsx("figcaption",{className:"mt-2 text-center text-sm text-neutral-600 dark:text-neutral-400",children:Y})]})}function cQ({type:X,status:$}){if($==="completed")return D.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M5 13l4 4L19 7"})});if($==="error")return D.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M6 18L18 6M6 6l12 12"})});if($==="active")return D.jsx("div",{className:"w-3.5 h-3.5 rounded-full bg-current animate-pulse"});let Q="w-4 h-4";if(X==="time"||X==="schedule"||X==="clock")return D.jsx("svg",{className:Q,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})});if(X==="recurring"||X==="repeat")return D.jsx("svg",{className:Q,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})});if(X==="agent"||X?.startsWith("@"))return D.jsx("svg",{className:Q,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z"})});if(X==="email"||X==="mail")return D.jsx("svg",{className:Q,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})});if(X==="slack"||X==="message"||X==="chat")return D.jsx("svg",{className:Q,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})});if(X==="webhook"||X==="api")return D.jsx("svg",{className:Q,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"})});if(X==="build"||X==="compile"||X==="package")return D.jsx("svg",{className:Q,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"})});if(X==="test"||X==="check"||X==="verify")return D.jsx("svg",{className:Q,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})});if(X==="deploy"||X==="rocket"||X==="launch")return D.jsx("svg",{className:Q,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})});if(X==="push"||X==="upload"||X==="cloud")return D.jsx("svg",{className:Q,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})});if(X==="generate"||X==="create"||X==="document"||X==="file")return D.jsx("svg",{className:Q,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})});if(X==="review"||X==="inspect"||X==="eye")return D.jsxs("svg",{className:Q,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]});if(X==="analyze"||X==="research"||X==="chart")return D.jsx("svg",{className:Q,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})});if(X==="scrape"||X==="crawl"||X==="spider")return D.jsx("svg",{className:Q,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"})});if(X==="data"||X==="database"||X==="storage")return D.jsx("svg",{className:Q,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"})});if(X==="notification"||X==="bell"||X==="alert")return D.jsx("svg",{className:Q,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"})});if(X==="transform"||X==="process"||X==="convert")return D.jsx("svg",{className:Q,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"})});return D.jsx("div",{className:"w-2 h-2 rounded-full bg-current opacity-50"})}function lQ({icon:X}){if(X==="research"||X==="multi-agent"||X==="agents")return D.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-100 dark:bg-purple-500/20 flex items-center justify-center",children:D.jsx("svg",{className:"w-6 h-6 text-purple-600 dark:text-purple-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})})});if(X==="schedule"||X==="report"||X==="calendar")return D.jsx("div",{className:"w-10 h-10 rounded-lg bg-amber-100 dark:bg-amber-500/20 flex items-center justify-center",children:D.jsx("svg",{className:"w-6 h-6 text-amber-600 dark:text-amber-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})})});if(X==="recurring"||X==="repeat"||X==="sync")return D.jsx("div",{className:"w-10 h-10 rounded-lg bg-cyan-100 dark:bg-cyan-500/20 flex items-center justify-center",children:D.jsx("svg",{className:"w-6 h-6 text-cyan-600 dark:text-cyan-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})});if(X==="analyze"||X==="analysis"||X==="chart")return D.jsx("div",{className:"w-10 h-10 rounded-lg bg-cyan-100 dark:bg-cyan-500/20 flex items-center justify-center",children:D.jsx("svg",{className:"w-6 h-6 text-cyan-600 dark:text-cyan-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})})});if(X==="deploy"||X==="rocket"||X==="launch")return D.jsx("div",{className:"w-10 h-10 rounded-lg bg-blue-100 dark:bg-blue-500/20 flex items-center justify-center",children:D.jsx("svg",{className:"w-6 h-6 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})})});if(X==="automation"||X==="workflow"||X==="process")return D.jsx("div",{className:"w-10 h-10 rounded-lg bg-indigo-100 dark:bg-indigo-500/20 flex items-center justify-center",children:D.jsx("svg",{className:"w-6 h-6 text-indigo-600 dark:text-indigo-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"})})});if(X==="data"||X==="pipeline"||X==="etl")return D.jsx("div",{className:"w-10 h-10 rounded-lg bg-emerald-100 dark:bg-emerald-500/20 flex items-center justify-center",children:D.jsx("svg",{className:"w-6 h-6 text-emerald-600 dark:text-emerald-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4"})})});return D.jsx("div",{className:"w-10 h-10 rounded-lg bg-neutral-100 dark:bg-neutral-700 flex items-center justify-center",children:D.jsx("svg",{className:"w-6 h-6 text-neutral-600 dark:text-neutral-300",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})})})}function dQ(){return D.jsx("svg",{className:"w-4 h-4 text-neutral-400 dark:text-neutral-500 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}var I0={blue:"bg-blue-100 dark:bg-blue-900/40 !text-blue-700 dark:!text-blue-300 border-blue-300 dark:border-blue-500",purple:"bg-purple-100 dark:bg-purple-900/40 !text-purple-700 dark:!text-purple-300 border-purple-300 dark:border-purple-500",cyan:"bg-cyan-100 dark:bg-cyan-900/40 !text-cyan-700 dark:!text-cyan-300 border-cyan-300 dark:border-cyan-500",amber:"bg-amber-100 dark:bg-amber-900/40 !text-amber-700 dark:!text-amber-300 border-amber-300 dark:border-amber-500",emerald:"bg-emerald-100 dark:bg-emerald-900/40 !text-emerald-700 dark:!text-emerald-300 border-emerald-300 dark:border-emerald-500",rose:"bg-rose-100 dark:bg-rose-900/40 !text-rose-700 dark:!text-rose-300 border-rose-300 dark:border-rose-500",indigo:"bg-indigo-100 dark:bg-indigo-900/40 !text-indigo-700 dark:!text-indigo-300 border-indigo-300 dark:border-indigo-500",orange:"bg-orange-100 dark:bg-orange-900/40 !text-orange-700 dark:!text-orange-300 border-orange-300 dark:border-orange-500",neutral:"bg-neutral-100 dark:bg-neutral-800 !text-neutral-600 dark:!text-neutral-300 border-neutral-300 dark:border-neutral-600"};function iQ(X,$){if(X.color&&I0[X.color])return I0[X.color];if($==="time"||$==="schedule"||$==="clock")return I0.blue;if($==="agent"||$?.startsWith("@"))return I0.purple;if($==="email"||$==="slack"||$==="message"||$==="notification")return I0.cyan;if($==="generate"||$==="document"||$==="create")return I0.amber;if($==="deploy"||$==="rocket"||$==="launch")return I0.rose;if($==="build"||$==="compile"||$==="package")return I0.indigo;if($==="test"||$==="check"||$==="verify")return I0.emerald;if($==="data"||$==="database"||$==="storage")return I0.orange;return I0.blue}function oQ({widget:X}){let{title:$,subtitle:Q,icon:Y,steps:Z}=X.props;return D.jsxs("div",{className:"rounded-xl bg-white dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-700 overflow-hidden",children:[D.jsxs("div",{className:"px-4 py-4 flex items-center gap-4",children:[D.jsx(lQ,{icon:Y}),D.jsxs("div",{className:"flex-1 min-w-0",children:[D.jsx("h3",{className:"font-semibold text-base text-neutral-900 dark:text-white truncate",children:$}),Q&&D.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400 truncate mt-0.5",children:Q})]})]}),D.jsx("div",{className:"px-4 pb-4",children:D.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Z.map((z,H)=>{let J=H===Z.length-1,K=z.status==="active",V=z.status==="completed",q=z.status==="error",_=z.status==="skipped",U=z.label,L=z.type;if(!L)if(U.startsWith("@"))L="agent";else if(/^\d+[ap]m$/i.test(U)||/^(mon|tue|wed|thu|fri|sat|sun)/i.test(U))L="time";else{let N=U.toLowerCase();L={test:"test",build:"build",push:"push",deploy:"deploy",email:"email",slack:"slack",generate:"generate",review:"review",analyze:"analyze",scrape:"scrape",transform:"transform",notify:"notification",alert:"notification",webhook:"webhook",api:"api",data:"data",process:"process"}[N]}let B,W="";if(K)B="bg-blue-100 dark:bg-blue-900/40 !text-blue-700 dark:!text-blue-300 border-blue-400 dark:border-blue-400 ring-2 ring-blue-400";else if(V)B="bg-emerald-100 dark:bg-emerald-900/40 !text-emerald-700 dark:!text-emerald-300 border-emerald-400 dark:border-emerald-400";else if(q)B="bg-red-100 dark:bg-red-900/40 !text-red-700 dark:!text-red-300 border-red-400 dark:border-red-400";else if(_)B="bg-neutral-100 dark:bg-neutral-800 !text-neutral-400 dark:!text-neutral-500 border-neutral-300 dark:border-neutral-600",W="line-through";else B=iQ(z,L);return D.jsxs("div",{className:"flex items-center gap-2",children:[D.jsxs("span",{className:`inline-flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium border transition-colors ${B} ${W}`,children:[D.jsx(cQ,{type:L,status:z.status}),U]}),!J&&D.jsx(dQ,{})]},z.id)})})})]})}var rQ={up:{symbol:"↑",color:"text-emerald-500"},down:{symbol:"↓",color:"text-red-500"},flat:{symbol:"→",color:"text-neutral-400"}};function aQ({widget:X,onAction:$}){let{label:Q="",value:Y="",change:Z,trend:z}=X.props||{},H=z?rQ[z]:null;return M0.jsxs("div",{className:"border border-neutral-200 dark:border-neutral-700 rounded-xl bg-white dark:bg-neutral-900 p-5",children:[M0.jsx("div",{className:"!text-sm font-medium !text-neutral-500 dark:!text-neutral-400 mb-1",children:Q}),M0.jsxs("div",{className:"flex items-end gap-2",children:[M0.jsx("div",{className:"!text-2xl font-bold !text-neutral-900 dark:!text-white",children:Y}),Z&&H&&M0.jsxs("div",{className:`flex items-center gap-0.5 !text-sm font-medium ${H.color} mb-0.5`,children:[M0.jsx("span",{children:H.symbol}),M0.jsx("span",{children:Z})]}),Z&&!H&&M0.jsx("div",{className:"!text-sm font-medium !text-neutral-400 mb-0.5",children:Z})]}),X.actions&&X.actions.length>0&&M0.jsx("div",{className:"flex gap-2 mt-3 pt-3 border-t border-neutral-200 dark:border-neutral-700",children:X.actions.map((J,K)=>M0.jsx("button",{onClick:()=>$?.({type:J.type,payload:J.payload,widgetId:X.id,timestamp:new Date}),className:"px-2 py-1 !text-xs rounded font-medium transition-colors bg-neutral-100 dark:bg-neutral-800 !text-neutral-600 dark:!text-neutral-300 hover:bg-neutral-200 dark:hover:bg-neutral-700",children:J.label},K))})]})}function nQ({widget:X}){let{content:$="",variant:Q="body"}=X.props||{},Y={heading:"!text-xl font-bold !text-neutral-900 dark:!text-white",body:"!text-sm !text-neutral-700 dark:!text-neutral-300 leading-relaxed",caption:"!text-xs !text-neutral-500 dark:!text-neutral-400"},Z=(H)=>{let J=H.split(`
18
+ `),K=[],V=0;while(V<J.length){let q=J[V];if(q.startsWith("### "))K.push(N0.jsx("h3",{className:"!text-base font-semibold !text-neutral-900 dark:!text-white mt-3 mb-1",children:z(q.slice(4))},V));else if(q.startsWith("## "))K.push(N0.jsx("h2",{className:"!text-lg font-bold !text-neutral-900 dark:!text-white mt-4 mb-1",children:z(q.slice(3))},V));else if(/^[-*+]\s/.test(q)){let _=[];while(V<J.length&&/^[-*+]\s/.test(J[V]))_.push(N0.jsx("li",{className:"ml-4 list-disc",children:z(J[V].slice(2))},V)),V++;K.push(N0.jsx("ul",{className:"my-1 space-y-0.5",children:_},`list-${V}`));continue}else if(q.trim()==="")K.push(N0.jsx("div",{className:"h-2"},V));else K.push(N0.jsx("p",{className:"my-0.5",children:z(q)},V));V++}return K},z=(H)=>{let J=[],K=H,V=0;while(K.length>0){let q=K.match(/\*\*(.+?)\*\*/),_=K.match(/`(.+?)`/),U=K.match(/\[(.+?)\]\((.+?)\)/),L=[q?{type:"bold",index:q.index,match:q}:null,_?{type:"code",index:_.index,match:_}:null,U?{type:"link",index:U.index,match:U}:null].filter(Boolean).sort((W,N)=>W.index-N.index);if(L.length===0){J.push(K);break}let B=L[0];if(B.index>0)J.push(K.slice(0,B.index));if(B.type==="bold")J.push(N0.jsx("strong",{className:"font-semibold",children:B.match[1]},V++)),K=K.slice(B.index+B.match[0].length);else if(B.type==="code")J.push(N0.jsx("code",{className:"px-1 py-0.5 bg-neutral-100 dark:bg-neutral-800 rounded text-xs font-mono",children:B.match[1]},V++)),K=K.slice(B.index+B.match[0].length);else if(B.type==="link")J.push(N0.jsx("a",{href:B.match[2],className:"text-blue-500 hover:underline",target:"_blank",rel:"noopener noreferrer",children:B.match[1]},V++)),K=K.slice(B.index+B.match[0].length)}return J.length===1?J[0]:N0.jsx(N0.Fragment,{children:J})};return N0.jsx("div",{className:Y[Q]||Y.body,children:Z($)})}var _X={sm:"h-2",md:"h-4",lg:"h-8"};function sQ({widget:X}){let{height:$="md",variant:Q="space"}=X.props||{};if(Q==="line")return BX.jsx("div",{className:_X[$]||_X.md+" flex items-center",children:BX.jsx("hr",{className:"w-full border-neutral-200 dark:border-neutral-700"})});return BX.jsx("div",{className:_X[$]||_X.md})}function kX({widget:X,onAction:$}){return B0.jsx("div",{className:"apteva-widget",children:(()=>{switch(X.type){case"card":return B0.jsx(jQ,{widget:X,onAction:$});case"list":return B0.jsx(hQ,{widget:X,onAction:$});case"button":return B0.jsx(uQ,{widget:X,onAction:$});case"button_group":return B0.jsx(xQ,{widget:X,onAction:$});case"table":return B0.jsx(gQ,{widget:X,onAction:$});case"form":return B0.jsx(pQ,{widget:X,onAction:$});case"image":return B0.jsx(mQ,{widget:X});case"flow":return B0.jsx(oQ,{widget:X});case"kpi":return B0.jsx(aQ,{widget:X,onAction:$});case"text_block":return B0.jsx(nQ,{widget:X});case"spacer":return B0.jsx(sQ,{widget:X});default:return B0.jsxs("div",{className:"p-4 border border-yellow-300 bg-yellow-50 rounded-lg",children:[B0.jsxs("p",{className:"text-sm text-yellow-800",children:["Unknown widget type: ",X.type]}),B0.jsx("pre",{className:"text-xs mt-2 overflow-auto",children:JSON.stringify(X,null,2)})]})}})()})}function MX({widgets:X,onAction:$,onWidgetMount:Q,layout:Y="stack",spacing:Z="normal",columns:z=3,className:H}){Z$.useEffect(()=>{X.forEach((V)=>{Q?.(V.id)})},[X,Q]);let J={stack:"flex flex-col",grid:`grid grid-cols-1 md:grid-cols-${z}`,masonry:"columns-1 md:columns-2 lg:columns-3"},K={tight:"gap-2",normal:"gap-4",loose:"gap-6"};return wX.jsx("div",{className:e(J[Y],K[Z],H),children:X.map((V)=>wX.jsx(kX,{widget:V,onAction:$},V.id))})}function sX({type:X,className:$}){switch(X){case"card":return P.jsx("div",{className:e("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 overflow-hidden",$),children:P.jsxs("div",{className:"p-4 space-y-3",children:[P.jsx("div",{className:"h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-3/4"}),P.jsx("div",{className:"h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-full"}),P.jsx("div",{className:"h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-5/6"})]})});case"list":return P.jsx("div",{className:e("apteva-widget-skeleton animate-pulse space-y-2",$),children:[1,2,3].map((Q)=>P.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg border border-neutral-200 dark:border-neutral-800",children:[P.jsx("div",{className:"w-10 h-10 bg-neutral-200 dark:bg-neutral-700 rounded-full flex-shrink-0"}),P.jsxs("div",{className:"flex-1 space-y-2",children:[P.jsx("div",{className:"h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-1/2"}),P.jsx("div",{className:"h-2 bg-neutral-200 dark:bg-neutral-700 rounded w-3/4"})]})]},Q))});case"button_group":return P.jsxs("div",{className:e("apteva-widget-skeleton animate-pulse flex gap-2",$),children:[P.jsx("div",{className:"h-9 bg-neutral-200 dark:bg-neutral-700 rounded-lg w-20"}),P.jsx("div",{className:"h-9 bg-neutral-200 dark:bg-neutral-700 rounded-lg w-20"}),P.jsx("div",{className:"h-9 bg-neutral-200 dark:bg-neutral-700 rounded-lg w-20"})]});case"form":return P.jsxs("div",{className:e("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 p-4 space-y-4",$),children:[P.jsx("div",{className:"h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/3"}),P.jsxs("div",{className:"space-y-3",children:[P.jsx("div",{className:"h-10 bg-neutral-200 dark:bg-neutral-700 rounded"}),P.jsx("div",{className:"h-10 bg-neutral-200 dark:bg-neutral-700 rounded"})]}),P.jsx("div",{className:"h-9 bg-neutral-200 dark:bg-neutral-700 rounded w-24"})]});case"chart":return P.jsxs("div",{className:e("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 p-4",$),children:[P.jsx("div",{className:"h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/4 mb-4"}),P.jsxs("div",{className:"flex items-end gap-2 h-32",children:[P.jsx("div",{className:"flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-1/2"}),P.jsx("div",{className:"flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-3/4"}),P.jsx("div",{className:"flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-1/3"}),P.jsx("div",{className:"flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-full"}),P.jsx("div",{className:"flex-1 bg-neutral-200 dark:bg-neutral-700 rounded-t h-2/3"})]})]});case"image":return P.jsx("div",{className:e("apteva-widget-skeleton animate-pulse",$),children:P.jsx("div",{className:"aspect-video bg-neutral-200 dark:bg-neutral-700 rounded-lg"})});case"gallery":return P.jsx("div",{className:e("apteva-widget-skeleton animate-pulse grid grid-cols-3 gap-2",$),children:[1,2,3].map((Q)=>P.jsx("div",{className:"aspect-square bg-neutral-200 dark:bg-neutral-700 rounded-lg"},Q))});case"map":return P.jsx("div",{className:e("apteva-widget-skeleton animate-pulse",$),children:P.jsx("div",{className:"h-48 bg-neutral-200 dark:bg-neutral-700 rounded-lg flex items-center justify-center",children:P.jsxs("svg",{className:"w-8 h-8 text-neutral-400 dark:text-neutral-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[P.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),P.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})]})})});case"table":return P.jsxs("div",{className:e("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 overflow-hidden",$),children:[P.jsxs("div",{className:"flex bg-neutral-100 dark:bg-neutral-800 border-b border-neutral-200 dark:border-neutral-700",children:[P.jsx("div",{className:"flex-1 px-4 py-3",children:P.jsx("div",{className:"h-3 bg-neutral-300 dark:bg-neutral-600 rounded w-16"})}),P.jsx("div",{className:"flex-1 px-4 py-3",children:P.jsx("div",{className:"h-3 bg-neutral-300 dark:bg-neutral-600 rounded w-20"})}),P.jsx("div",{className:"flex-1 px-4 py-3",children:P.jsx("div",{className:"h-3 bg-neutral-300 dark:bg-neutral-600 rounded w-14"})})]}),[1,2,3].map((Q)=>P.jsxs("div",{className:"flex border-b border-neutral-200 dark:border-neutral-800 last:border-b-0",children:[P.jsx("div",{className:"flex-1 px-4 py-3",children:P.jsx("div",{className:"h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-24"})}),P.jsx("div",{className:"flex-1 px-4 py-3",children:P.jsx("div",{className:"h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-16"})}),P.jsx("div",{className:"flex-1 px-4 py-3",children:P.jsx("div",{className:"h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-20"})})]},Q))]});default:return P.jsxs("div",{className:e("apteva-widget-skeleton animate-pulse rounded-lg border border-neutral-200 dark:border-neutral-800 p-4",$),children:[P.jsx("div",{className:"h-4 bg-neutral-200 dark:bg-neutral-700 rounded w-1/2 mb-2"}),P.jsx("div",{className:"h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-full"})]})}}function tQ(X){return/\.(jpg|jpeg|png|gif|webp|svg|bmp|ico)(\?.*)?$/i.test(X)}function c0(X,$=""){let Q=[],Y=/!\[([^\]]*)\]\(([^)]+)\)|\[([^\]]+)\]\(([^)]+)\)|(\*\*|__)(.+?)\5|`([^`]+)`/g,Z=0,z,H=0;while((z=Y.exec(X))!==null){if(z.index>Z)Q.push(X.slice(Z,z.index));if(z[1]!==void 0||z[2]!==void 0){let J=z[1]||"",K=z[2];Q.push(Y0.jsx("img",{src:K,alt:J,className:"apteva-md-img"},`${$}img${H++}`))}else if(z[3]!==void 0||z[4]!==void 0){let J=z[3],K=z[4];if(tQ(K))Q.push(Y0.jsx("img",{src:K,alt:J,className:"apteva-md-img"},`${$}img${H++}`));else Q.push(Y0.jsx("a",{href:K,target:"_blank",rel:"noopener noreferrer",className:"apteva-md-link",children:J},`${$}a${H++}`))}else if(z[5]!==void 0)Q.push(Y0.jsx("strong",{children:z[6]},`${$}b${H++}`));else if(z[7]!==void 0)Q.push(Y0.jsx("code",{className:"apteva-md-inline-code",children:z[7]},`${$}code${H++}`));Z=z.index+z[0].length}if(Z<X.length)Q.push(X.slice(Z));return Q.length>0?Q:[X]}function eQ(X){let $=X.split(`
19
+ `),Q=[],Y=0,Z=0;while(Z<$.length){let z=$[Z],H=z.match(/^##\s+(.*)$/);if(H){Q.push(Y0.jsx("h2",{className:"apteva-md-h2",children:c0(H[1],`${Y}`)},`h2${Y++}`)),Z++;continue}let J=z.match(/^###\s+(.*)$/);if(J){Q.push(Y0.jsx("h3",{className:"apteva-md-h3",children:c0(J[1],`${Y}`)},`h3${Y++}`)),Z++;continue}let K=z.match(/^(\s*)([-*+])\s+(.*)$/);if(K){let _=[],U=K[1].length;while(Z<$.length){let L=$[Z].match(/^(\s*)([-*+])\s+(.*)$/);if(L&&L[1].length===U)_.push(Y0.jsx("li",{className:"apteva-md-li",children:c0(L[3],`${Y}`)},`li${Y++}`)),Z++;else break}Q.push(Y0.jsx("ul",{className:"apteva-md-ul",children:_},`ul${Y++}`));continue}let V=z.match(/^(\s*)(\d+)\.\s+(.*)$/);if(V){let _=[],U=V[1].length;while(Z<$.length){let L=$[Z].match(/^(\s*)(\d+)\.\s+(.*)$/);if(L&&L[1].length===U)_.push(Y0.jsx("li",{className:"apteva-md-li",children:c0(L[3],`${Y}`)},`li${Y++}`)),Z++;else break}Q.push(Y0.jsx("ol",{className:"apteva-md-ol",children:_},`ol${Y++}`));continue}if(z.match(/^\|(.+)\|$/)&&Z+1<$.length){if($[Z+1].match(/^\|([\s:-]+\|)+$/)){let L=z.split("|").filter((W)=>W.trim()!=="").map((W)=>W.trim());Z+=2;let B=[];while(Z<$.length)if($[Z].match(/^\|(.+)\|$/)){let N=$[Z].split("|").filter((k)=>k.trim()!=="").map((k)=>k.trim());B.push(N),Z++}else break;Q.push(Y0.jsx("div",{className:"apteva-md-table-wrapper",children:Y0.jsxs("table",{className:"apteva-md-table",children:[Y0.jsx("thead",{children:Y0.jsx("tr",{children:L.map((W,N)=>Y0.jsx("th",{className:"apteva-md-th",children:c0(W,`th${Y}${N}`)},`th${N}`))})}),Y0.jsx("tbody",{children:B.map((W,N)=>Y0.jsx("tr",{children:W.map((k,x)=>Y0.jsx("td",{className:"apteva-md-td",children:c0(k,`td${Y}${N}${x}`)},`td${x}`))},`tr${N}`))})]})},`table-wrapper${Y++}`));continue}}if(z==="")Q.push(Y0.jsx("br",{},`br${Y++}`));else Q.push(Y0.jsxs("span",{children:[c0(z,`${Y}`),Z<$.length-1?`
20
+ `:""]},`p${Y++}`));Z++}return Q}function f0({content:X,className:$=""}){return Y0.jsx("div",{className:`apteva-md ${$}`,children:eQ(X)})}function XY({name:X,status:$,isReceiving:Q=!1,inputLength:Y=0,streamOutput:Z}){if($==="preparing")return l.jsxs("div",{className:"apteva-tool-card apteva-tool-card-preparing",children:[l.jsxs("svg",{className:"apteva-tool-icon apteva-tool-icon-spin",fill:"none",viewBox:"0 0 24 24",children:[l.jsx("circle",{className:"apteva-tool-spinner-track",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),l.jsx("path",{className:"apteva-tool-spinner-fill",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),l.jsxs("span",{className:"apteva-tool-label",children:[l.jsx("strong",{children:X}),l.jsx("span",{className:"apteva-tool-status-text",children:" preparing..."})]})]});if($==="running")return l.jsxs("div",{className:"apteva-tool-card apteva-tool-card-running",children:[l.jsxs("svg",{className:"apteva-tool-icon apteva-tool-icon-spin",fill:"none",viewBox:"0 0 24 24",children:[l.jsx("circle",{className:"apteva-tool-spinner-track",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),l.jsx("path",{className:"apteva-tool-spinner-fill",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),l.jsxs("span",{className:"apteva-tool-label",children:[l.jsx("strong",{children:X}),Z?l.jsx("span",{className:"apteva-tool-stream-separator",children:" · "}):null,Z?l.jsx("span",{className:"apteva-tool-stream-output",children:Z}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"apteva-tool-status-text",children:" running"}),l.jsxs("span",{className:"apteva-tool-dots",children:[l.jsx("span",{children:"."}),l.jsx("span",{children:"."}),l.jsx("span",{children:"."})]})]})]})]});if($==="completed")return l.jsxs("div",{className:"apteva-tool-card apteva-tool-card-completed",children:[l.jsx("svg",{className:"apteva-tool-icon",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),l.jsx("span",{className:"apteva-tool-label",children:X})]});return l.jsxs("div",{className:"apteva-tool-card apteva-tool-card-error",children:[l.jsx("svg",{className:"apteva-tool-icon",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),l.jsxs("span",{className:"apteva-tool-label",children:[X," failed"]})]})}function $Y({message:X,onAction:$,enableWidgets:Q,onWidgetRender:Y}){let Z=X.role==="user",z=X.metadata?.content_segments,H=X.metadata?.isStreaming===!0,J=X.content||z&&z.length>0,K=l0.useRef(new Set),V=l0.useMemo(()=>{if(!Q||Z||!X.content)return[];return UX(X.content).segments.filter((A)=>A.type==="widget"&&!!A.widget).map((A)=>A.widget)},[Q,Z,X.content]);l0.useEffect(()=>{if(Y&&X.widgets){for(let v of X.widgets)if(!K.current.has(v.id))K.current.add(v.id),Y(v)}},[X.widgets,Y]),l0.useEffect(()=>{if(Y&&V.length>0){for(let v of V)if(!K.current.has(v.id))K.current.add(v.id),Y(v)}},[V,Y]);let q=(v)=>{if(!Q||Z)return F.jsx(f0,{content:v});let u=UX(v).segments.filter((b)=>b.type==="text"&&b.content).map((b)=>b.content).join("");if(!u.trim())return null;return F.jsx(f0,{content:u})},_=()=>{if(!Q||Z||!X.content)return null;let v=UX(X.content),A=[],u="";if(v.segments.forEach((b,n)=>{if(b.type==="text"&&b.content)u+=b.content;else if(b.type==="widget"&&b.widget){if(u.trim())A.push(F.jsx("div",{className:"apteva-message-bubble apteva-message-assistant",children:F.jsx("div",{className:"apteva-message-content-assistant",children:F.jsx(f0,{content:u})})},`text-${n}`)),u="";A.push(F.jsx("div",{className:"apteva-widget-standalone",children:F.jsx(kX,{widget:b.widget,onAction:$})},`widget-${n}`))}else if(b.type==="widget_pending"&&b.pendingType){if(u.trim())A.push(F.jsx("div",{className:"apteva-message-bubble apteva-message-assistant",children:F.jsx("div",{className:"apteva-message-content-assistant",children:F.jsx(f0,{content:u})})},`text-${n}`)),u="";A.push(F.jsx("div",{className:"apteva-widget-standalone",children:F.jsx(sX,{type:b.pendingType})},`pending-${n}`))}}),u.trim())A.push(F.jsx("div",{className:"apteva-message-bubble apteva-message-assistant",children:F.jsx("div",{className:"apteva-message-content-assistant",children:F.jsx(f0,{content:u})})},"text-final"));return A.length>0?A:null},U=X.metadata?.attachments||[],L=U.length>0,B=()=>{if(!L)return null;return F.jsx("div",{className:"apteva-message-attachments flex flex-wrap gap-2 mb-2 justify-end",children:U.map((v,A)=>{let u=v.type.startsWith("image/"),b=v.type==="application/pdf";if(u&&v.preview)return F.jsx("div",{className:"apteva-attachment-image relative rounded-lg overflow-hidden shadow-sm",children:F.jsx("img",{src:v.preview,alt:v.name,className:"max-w-[150px] max-h-[150px] object-cover"})},A);return F.jsxs("div",{className:"apteva-attachment-doc flex items-center gap-3 px-4 py-3 bg-neutral-100 dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 rounded-xl shadow-sm",children:[F.jsx("div",{className:"w-10 h-10 flex items-center justify-center bg-red-100 dark:bg-red-900/30 rounded-lg text-red-600 dark:text-red-400",children:b?F.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:F.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"})}):F.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:F.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),F.jsxs("div",{className:"flex flex-col min-w-0",children:[F.jsx("span",{className:"text-sm font-medium text-neutral-800 dark:text-neutral-200 truncate max-w-[180px]",children:v.name}),F.jsxs("span",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:[b?"PDF":"Document"," · ",DX(v.size)]})]})]},A)})})},W=()=>{if(Z)return F.jsx("div",{className:"apteva-message-text",children:X.content});if(H&&!J)return F.jsxs("div",{className:"apteva-typing-indicator",children:[F.jsx("span",{}),F.jsx("span",{}),F.jsx("span",{})]});if(z&&z.length>0)return null;return q(X.content)},N=(v,A)=>{if(!Q)return F.jsx("div",{className:"apteva-message-bubble apteva-message-assistant",children:F.jsx("div",{className:"apteva-message-content-assistant",children:F.jsx(f0,{content:v})})},A);let u=UX(v),b=[],n="";if(u.segments.forEach((o,H0)=>{if(o.type==="text"&&o.content)n+=o.content;else if(o.type==="widget"&&o.widget){if(n.trim())b.push(F.jsx("div",{className:"apteva-message-bubble apteva-message-assistant",children:F.jsx("div",{className:"apteva-message-content-assistant",children:F.jsx(f0,{content:n})})},`${A}-text-${H0}`)),n="";b.push(F.jsx("div",{className:"apteva-widget-standalone",children:F.jsx(kX,{widget:o.widget,onAction:$})},`${A}-widget-${H0}`))}else if(o.type==="widget_pending"&&o.pendingType){if(n.trim())b.push(F.jsx("div",{className:"apteva-message-bubble apteva-message-assistant",children:F.jsx("div",{className:"apteva-message-content-assistant",children:F.jsx(f0,{content:n})})},`${A}-text-${H0}`)),n="";b.push(F.jsx("div",{className:"apteva-widget-standalone",children:F.jsx(sX,{type:o.pendingType})},`${A}-pending-${H0}`))}}),n.trim())b.push(F.jsx("div",{className:"apteva-message-bubble apteva-message-assistant",children:F.jsx("div",{className:"apteva-message-content-assistant",children:F.jsx(f0,{content:n})})},`${A}-text-final`));return b},k=()=>{if(!z||z.length===0)return null;let v=[];return z.forEach((A,u)=>{if(A.type==="text"&&A.content){let b=N(A.content,`seg-${u}`);if(Array.isArray(b))v.push(...b);else v.push(b)}else if(A.type==="tool")v.push(F.jsx("div",{className:"apteva-tool-call-standalone",children:F.jsx(XY,{name:A.name,status:A.status||(A.result!==void 0?"completed":"running"),isReceiving:A.isReceiving,inputLength:A.inputLength,streamOutput:A.streamOutput})},A.id))}),v};if(!Z&&(z&&z.length>0))return F.jsxs("div",{className:"apteva-message-segmented",children:[k(),X.widgets&&X.widgets.length>0&&F.jsx("div",{className:"apteva-widget-standalone",children:F.jsx(MX,{widgets:X.widgets,onAction:$,layout:"stack"})}),F.jsx("div",{className:"apteva-message-timestamp apteva-message-timestamp-assistant",suppressHydrationWarning:!0,children:X.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]});let x=_();if(!Z&&Q&&x)return F.jsxs("div",{className:"apteva-message-segmented",children:[x,X.widgets&&X.widgets.length>0&&F.jsx("div",{className:"apteva-widget-standalone",children:F.jsx(MX,{widgets:X.widgets,onAction:$,layout:"stack"})}),F.jsx("div",{className:"apteva-message-timestamp apteva-message-timestamp-assistant",suppressHydrationWarning:!0,children:X.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]});if(Z&&L)return F.jsxs("div",{className:"apteva-message-segmented apteva-message-user-with-attachments flex flex-col items-end",children:[B(),X.content&&F.jsx("div",{className:"apteva-message-bubble apteva-message-user",children:F.jsx("div",{className:"apteva-message-content-user",children:F.jsx("div",{className:"apteva-message-text",children:X.content})})}),F.jsx("div",{className:"apteva-message-timestamp apteva-message-timestamp-user",suppressHydrationWarning:!0,children:X.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]});return F.jsxs("div",{className:e("apteva-message-bubble",Z?"apteva-message-user":"apteva-message-assistant"),children:[F.jsx("div",{className:Z?"apteva-message-content-user":"apteva-message-content-assistant",children:W()}),X.widgets&&X.widgets.length>0&&F.jsx("div",{className:"apteva-widget-standalone",children:F.jsx(MX,{widgets:X.widgets,onAction:$,layout:"stack"})}),F.jsx("div",{className:e("apteva-message-timestamp",Z?"apteva-message-timestamp-user":"apteva-message-timestamp-assistant"),suppressHydrationWarning:!0,children:X.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})}var tX=()=>y.jsx("svg",{className:"w-12 h-12 sm:w-16 sm:h-16",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),vX=()=>y.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 7l5 5m0 0l-5 5m5-5H6"})});function QY({title:X,subtitle:$,icon:Q,prompts:Y,variant:Z="centered",chatVariant:z="default",onPromptClick:H}){let J=(Y||[]).map((q)=>typeof q==="string"?{text:q}:q),K=J.length>0,V=X||$||Q;if(!V&&!K)return y.jsx("div",{className:"flex items-center justify-center h-full !text-neutral-500 dark:!text-neutral-400",children:y.jsxs("div",{className:"text-center space-y-2",children:[y.jsx("div",{className:"flex justify-center",children:y.jsx(tX,{})}),y.jsx("p",{className:"text-sm",children:"No messages yet. Start a conversation!"})]})});if(Z==="minimal")return y.jsxs("div",{className:"flex flex-col h-full px-4 py-4",children:[V&&y.jsxs("div",{className:"mb-4",children:[X&&y.jsx("h2",{className:"text-lg font-semibold !text-neutral-900 dark:!text-white",children:X}),$&&y.jsx("p",{className:"text-sm !text-neutral-500 dark:!text-neutral-400 mt-1",children:$})]}),K&&y.jsx("div",{className:"flex-1 space-y-2",children:J.map((q,_)=>y.jsx("button",{onClick:()=>H(q.text),className:e("w-full text-left px-4 py-3 rounded-xl","bg-neutral-50 dark:bg-neutral-800/50","border border-neutral-200 dark:border-neutral-700","hover:bg-neutral-100 dark:hover:bg-neutral-800","hover:border-neutral-300 dark:hover:border-neutral-600","transition-all duration-200","group"),children:y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsx("div",{className:"flex-shrink-0 !text-neutral-400 dark:!text-neutral-500 group-hover:!text-blue-500 dark:group-hover:!text-blue-400 transition-colors",children:q.icon||y.jsx(vX,{})}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsx("p",{className:"text-sm font-medium !text-neutral-900 dark:!text-white truncate",children:q.text}),q.description&&y.jsx("p",{className:"text-xs !text-neutral-500 dark:!text-neutral-400 mt-0.5 truncate",children:q.description})]})]})},_))})]});return y.jsxs("div",{className:"flex flex-col items-center justify-center h-full px-4 py-6 sm:py-8",children:[y.jsxs("div",{className:"text-center mb-6 sm:mb-8 max-w-md",children:[y.jsx("div",{className:"mb-4 !text-neutral-400 dark:!text-neutral-500 flex justify-center",children:Q||y.jsx(tX,{})}),X&&y.jsx("h1",{className:"text-xl sm:text-2xl font-semibold !text-neutral-900 dark:!text-white mb-2",children:X}),$&&y.jsx("p",{className:"text-sm sm:text-base !text-neutral-500 dark:!text-neutral-400",children:$})]}),K&&y.jsxs("div",{className:"w-full max-w-2xl",children:[y.jsx("div",{className:"sm:hidden space-y-2",children:J.map((q,_)=>y.jsx("button",{onClick:()=>H(q.text),className:e("w-full text-left px-4 py-3 rounded-xl","bg-white dark:bg-neutral-800","border border-neutral-200 dark:border-neutral-700","hover:bg-neutral-50 dark:hover:bg-neutral-700","hover:border-blue-300 dark:hover:border-blue-600","active:scale-[0.98]","transition-all duration-200","shadow-sm hover:shadow","group"),children:y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-lg bg-neutral-100 dark:bg-neutral-700 flex items-center justify-center !text-neutral-500 dark:!text-neutral-400 group-hover:bg-blue-100 dark:group-hover:bg-blue-900/30 group-hover:!text-blue-600 dark:group-hover:!text-blue-400 transition-colors",children:q.icon||y.jsx(vX,{})}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsx("p",{className:"text-sm font-medium !text-neutral-900 dark:!text-white",children:q.text}),q.description&&y.jsx("p",{className:"text-xs !text-neutral-500 dark:!text-neutral-400 mt-0.5 line-clamp-1",children:q.description})]}),y.jsx("svg",{className:"w-4 h-4 !text-neutral-400 group-hover:!text-blue-500 transition-colors flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})},_))}),y.jsx("div",{className:"hidden sm:grid sm:grid-cols-2 gap-3",children:J.map((q,_)=>y.jsx("button",{onClick:()=>H(q.text),className:e("text-left p-4 rounded-xl","bg-white dark:bg-neutral-800","border border-neutral-200 dark:border-neutral-700","hover:bg-neutral-50 dark:hover:bg-neutral-700","hover:border-blue-300 dark:hover:border-blue-600","hover:shadow-md","active:scale-[0.98]","transition-all duration-200","group"),children:y.jsxs("div",{className:"flex items-start gap-3",children:[y.jsx("div",{className:"flex-shrink-0 w-9 h-9 rounded-lg bg-neutral-100 dark:bg-neutral-700 flex items-center justify-center !text-neutral-500 dark:!text-neutral-400 group-hover:bg-blue-100 dark:group-hover:bg-blue-900/30 group-hover:!text-blue-600 dark:group-hover:!text-blue-400 transition-colors",children:q.icon||y.jsx(vX,{})}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsx("p",{className:"text-sm font-medium !text-neutral-900 dark:!text-white leading-snug",children:q.text}),q.description&&y.jsx("p",{className:"text-xs !text-neutral-500 dark:!text-neutral-400 mt-1 line-clamp-2",children:q.description})]})]})},_))})]})]})}function YY({messages:X,onAction:$,welcomeTitle:Q,welcomeSubtitle:Y,welcomeIcon:Z,suggestedPrompts:z,welcomeVariant:H,chatVariant:J,onPromptClick:K,enableWidgets:V,onWidgetRender:q}){let _=s0.useRef(null),U=s0.useRef(!0),L=s0.useRef(0),B=()=>{if(_.current){let{scrollTop:W,scrollHeight:N,clientHeight:k}=_.current;U.current=N-W-k<100}};return s0.useEffect(()=>{if(_.current&&U.current){let W=_.current.scrollHeight;if(W!==L.current)_.current.scrollTop=W,L.current=W}},[X]),qX.jsx("div",{ref:_,className:"apteva-message-list apteva-scrollbar-hidden",onScroll:B,children:X.length===0?qX.jsx(QY,{title:Q,subtitle:Y,icon:Z,prompts:z,variant:H,chatVariant:J,onPromptClick:K||(()=>{})}):X.map((W)=>qX.jsx("div",{className:W.role==="user"?"apteva-message-row-user":"apteva-message-row-assistant",children:qX.jsx($Y,{message:W,onAction:$,enableWidgets:V,onWidgetRender:q})},W.id))})}function ZY({onSendMessage:X,placeholder:$="Type a message...",disabled:Q=!1,isLoading:Y=!1,onStop:Z,onFileUpload:z,onSwitchMode:H}){let[J,K]=k0.useState(""),[V,q]=k0.useState(!1),[_,U]=k0.useState([]),[L,B]=k0.useState(null),[W,N]=k0.useState(!1),k=k0.useRef(null),x=k0.useRef(null),v=k0.useRef(null),A=(C)=>{if(C.key==="Enter"&&!C.shiftKey)C.preventDefault(),u()},u=()=>{let C=J.trim(),g=_.length>0;if((C||g)&&!Q){let f=_.map((K0)=>K0.file);if(X(J.trim(),f.length>0?f:void 0),K(""),U([]),B(null),N(!1),k.current)k.current.style.height="auto"}},b=(C)=>{K(C.target.value),C.target.style.height="auto";let g=C.target.scrollHeight;C.target.style.height=`${g}px`;let f=C.target.value.includes(`
21
+ `),r=g>36;if(!W&&(f||r))N(!0);else if(W&&!f&&!r&&C.target.value.length<20)N(!1)},n=(C)=>{if(C.target.files&&C.target.files.length>0){let g=Array.from(C.target.files),f=[],K0=[];if(g.forEach((r)=>{let W0=X$(r);if(W0.valid){let L0={file:r};if(r.type.startsWith("image/"))L0.preview=URL.createObjectURL(r);f.push(L0)}else K0.push(W0.error||"Invalid file")}),f.length>0)U((r)=>[...r,...f]);if(K0.length>0)B(K0.join(", ")),setTimeout(()=>B(null),5000);z?.(C.target.files),q(!1),C.target.value=""}},o=(C)=>{U((g)=>{let f=g[C];if(f.preview)URL.revokeObjectURL(f.preview);return g.filter((K0,r)=>r!==C)})},H0=(C)=>{if(C.startsWith("image/"))return I.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:I.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})});if(C==="application/pdf")return I.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:I.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"})});return I.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:I.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})};return I.jsxs("div",{className:"px-4 py-3 relative",children:[L&&I.jsx("div",{className:"apteva-file-error",children:I.jsxs("div",{className:"apteva-file-error-content",children:[I.jsx("svg",{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:I.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),I.jsx("span",{children:L})]})}),_.length>0&&I.jsx("div",{className:"apteva-file-preview",children:_.map((C,g)=>I.jsxs("div",{className:"apteva-file-item",children:[C.preview?I.jsx("img",{src:C.preview,alt:C.file.name,className:"apteva-file-thumb"}):I.jsx("div",{className:"apteva-file-icon",children:H0(C.file.type)}),I.jsxs("div",{className:"apteva-file-info",children:[I.jsx("span",{className:"apteva-file-name",children:C.file.name}),I.jsx("span",{className:"apteva-file-size",children:DX(C.file.size)})]}),I.jsx("button",{onClick:()=>o(g),className:"apteva-file-remove",title:"Remove file",children:I.jsx("svg",{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:I.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},g))}),I.jsxs("div",{className:"apteva-composer",style:{gridTemplateColumns:"auto 1fr auto",gridTemplateAreas:W?'"textarea textarea textarea" "plus . send"':'"plus textarea send"',alignItems:"end"},children:[I.jsxs("div",{className:"relative flex-shrink-0 self-end",style:{gridArea:"plus"},children:[I.jsx("button",{ref:v,onClick:()=>q(!V),className:"apteva-composer-menu-btn w-8 h-8 rounded-lg flex items-center justify-center transition-all !text-neutral-700 dark:!text-neutral-300 hover:bg-neutral-100 dark:hover:bg-neutral-800",title:"More options",children:I.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:I.jsx("path",{d:"M10 5v10M5 10h10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),V&&I.jsxs(I.Fragment,{children:[I.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>q(!1)}),I.jsxs("div",{className:"apteva-composer-menu fixed bg-neutral-800 dark:bg-neutral-800 rounded-xl shadow-lg overflow-hidden z-[9999] min-w-[200px]",style:{left:v.current?.getBoundingClientRect().left??0,bottom:window.innerHeight-(v.current?.getBoundingClientRect().top??0)+8},children:[I.jsxs("button",{onClick:()=>{x.current?.click(),q(!1)},className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-neutral-700 dark:hover:bg-neutral-700 transition-colors !text-white text-left",children:[I.jsx("svg",{width:"18",height:"18",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:I.jsx("path",{d:"M10.5 3.5L5.5 8.5C4.67157 9.32843 4.67157 10.6716 5.5 11.5C6.32843 12.3284 7.67157 12.3284 8.5 11.5L14.5 5.5C15.8807 4.11929 15.8807 1.88071 14.5 0.5C13.1193 -0.880711 10.8807 -0.880711 9.5 0.5L3.5 6.5C1.56846 8.43154 1.56846 11.5685 3.5 13.5C5.43154 15.4315 8.56846 15.4315 10.5 13.5L15.5 8.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",transform:"translate(2, 3)"})}),I.jsx("span",{className:"!text-sm font-medium",children:"Add photos & files"})]}),H&&I.jsxs("button",{onClick:()=>{H(),q(!1)},className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-neutral-700 dark:hover:bg-neutral-700 transition-colors !text-white text-left border-t border-neutral-700 dark:border-neutral-700",children:[I.jsx("svg",{className:"w-4.5 h-4.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:I.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),I.jsx("span",{className:"!text-sm font-medium",children:"Switch to command mode"})]})]})]})]}),I.jsx("textarea",{ref:k,value:J,onChange:b,onKeyDown:A,placeholder:$,disabled:Q,className:"apteva-composer-textarea resize-none bg-transparent border-none focus:outline-none !text-neutral-900 dark:!text-neutral-100 placeholder-neutral-400 dark:placeholder-neutral-500 py-1 disabled:opacity-50 disabled:cursor-not-allowed overflow-y-auto max-h-[200px]",style:{gridArea:"textarea"},rows:1}),I.jsx("div",{className:"self-end",style:{gridArea:"send"},children:Y&&Z?I.jsx("button",{onClick:Z,className:"apteva-composer-stop-btn",title:"Stop generation",children:I.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:I.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"1",fill:"currentColor"})})}):I.jsx("button",{onClick:u,disabled:!J.trim()&&_.length===0||Q,className:"apteva-composer-send-btn w-8 h-8 rounded-lg flex items-center justify-center font-bold transition-all flex-shrink-0 border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-neutral-800 !text-neutral-700 dark:!text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-700 disabled:opacity-30 disabled:cursor-not-allowed !text-lg",title:"Send message",children:I.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:I.jsx("path",{d:"M8 3L8 13M8 3L4 7M8 3L12 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})})]}),I.jsx("input",{ref:x,type:"file",multiple:!0,onChange:n,className:"hidden",accept:"image/*,application/pdf,.doc,.docx,.txt"})]})}function zY({onExecute:X,state:$,response:Q,error:Y,plan:Z,streamedContent:z,toolName:H,onApprove:J,onReject:K,onReset:V,onStop:q,onExpand:_,placeholder:U="Enter your command...",disabled:L=!1}){let[B,W]=j0.useState(""),[N,k]=j0.useState([]),[x,v]=j0.useState(null),[A,u]=j0.useState(!1),b=j0.useRef(null),n=j0.useRef(null),o=j0.useRef(null),H0=()=>{let G=B.trim(),O=N.length>0;if((G||O)&&!L&&$==="idle"){let w=N.map((j)=>j.file);X(B.trim(),w.length>0?w:void 0),W(""),k([])}},C=(G)=>{if(G.key==="Enter"&&!G.shiftKey)G.preventDefault(),H0()},g=()=>{V?.(),b.current?.focus()},f=(G)=>{if(W(G),b.current)b.current.style.height="auto",b.current.style.height=`${Math.min(b.current.scrollHeight,120)}px`},K0=(G)=>{if(G.target.files&&G.target.files.length>0){let O=Array.from(G.target.files),w=[],j=[];if(O.forEach((m)=>{let P0=X$(m);if(P0.valid){let i={file:m};if(m.type.startsWith("image/"))i.preview=URL.createObjectURL(m);w.push(i)}else j.push(P0.error||"Invalid file")}),w.length>0)k((m)=>[...m,...w]);if(j.length>0)v(j.join(", ")),setTimeout(()=>v(null),5000);u(!1),G.target.value=""}},r=(G)=>{k((O)=>{let w=O[G];if(w.preview)URL.revokeObjectURL(w.preview);return O.filter((j,m)=>m!==G)})},W0=(G)=>{if(G.startsWith("image/"))return R.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:R.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})});if(G==="application/pdf")return R.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:R.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"})});return R.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:R.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})},L0=()=>{if($==="loading"){if(H)return{text:H,isToolCall:!0};if(z)return{text:z,isToolCall:!1};return{text:"Processing...",isToolCall:!1}}if($==="success"&&Q)return{text:Q,isToolCall:!1};if($==="error"&&Y)return{text:Y,isToolCall:!1};if($==="plan-pending"&&Z)return{text:Z,isToolCall:!1};return{text:"",isToolCall:!1}},v0=$!=="idle",{text:R0,isToolCall:U0}=L0();return R.jsxs("div",{className:"w-full relative",children:[x&&R.jsx("div",{className:"apteva-file-error",style:{top:"-3rem",bottom:"auto"},children:R.jsxs("div",{className:"apteva-file-error-content",children:[R.jsx("svg",{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:R.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),R.jsx("span",{children:x})]})}),R.jsxs("div",{className:e("apteva-composer flex items-center gap-2 px-3 py-2 border-2 bg-white dark:bg-neutral-900 transition-all duration-200",$==="idle"&&"border-neutral-200 dark:border-neutral-700",$==="loading"&&"border-blue-400 dark:border-blue-500",$==="plan-pending"&&"border-amber-400 dark:border-amber-500",$==="success"&&"border-green-400 dark:border-green-500",$==="error"&&"border-red-400 dark:border-red-500"),children:[R.jsxs("div",{className:"w-8 h-8 flex items-center justify-center flex-shrink-0",children:[$==="idle"&&R.jsxs("div",{className:"relative",children:[R.jsx("button",{ref:o,onClick:()=>u(!A),className:"apteva-composer-menu-btn w-8 h-8 rounded-lg flex items-center justify-center transition-all !text-neutral-500 dark:!text-neutral-400 hover:!text-neutral-700 dark:hover:!text-neutral-200 hover:bg-neutral-100 dark:hover:bg-neutral-800",title:"More options",children:R.jsx("svg",{width:"18",height:"18",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:R.jsx("path",{d:"M10 5v10M5 10h10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),A&&R.jsxs(R.Fragment,{children:[R.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>u(!1)}),R.jsxs("div",{className:"apteva-composer-menu fixed bg-neutral-800 dark:bg-neutral-800 rounded-xl shadow-lg overflow-hidden z-[9999] min-w-[200px]",style:{left:o.current?.getBoundingClientRect().left??0,top:(o.current?.getBoundingClientRect().bottom??0)+8},children:[R.jsxs("button",{onClick:()=>{n.current?.click(),u(!1)},className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-neutral-700 dark:hover:bg-neutral-700 transition-colors !text-white text-left",children:[R.jsx("svg",{width:"18",height:"18",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:R.jsx("path",{d:"M10.5 3.5L5.5 8.5C4.67157 9.32843 4.67157 10.6716 5.5 11.5C6.32843 12.3284 7.67157 12.3284 8.5 11.5L14.5 5.5C15.8807 4.11929 15.8807 1.88071 14.5 0.5C13.1193 -0.880711 10.8807 -0.880711 9.5 0.5L3.5 6.5C1.56846 8.43154 1.56846 11.5685 3.5 13.5C5.43154 15.4315 8.56846 15.4315 10.5 13.5L15.5 8.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",transform:"translate(2, 3)"})}),R.jsx("span",{className:"!text-sm font-medium",children:"Add photos & files"})]}),_&&R.jsxs("button",{onClick:()=>{_(),u(!1)},className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-neutral-700 dark:hover:bg-neutral-700 transition-colors !text-white text-left border-t border-neutral-700 dark:border-neutral-700",children:[R.jsx("svg",{className:"w-4.5 h-4.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:R.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),R.jsx("span",{className:"!text-sm font-medium",children:"Expand to chat"})]})]})]})]}),$==="loading"&&!H&&R.jsx("div",{className:"w-4 h-4 border-2 border-blue-200 border-t-blue-500 rounded-full animate-spin"}),$==="loading"&&H&&R.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-500 animate-pulse"})]}),N.length>0&&$==="idle"&&R.jsx("div",{className:"apteva-file-badges",children:N.map((G,O)=>R.jsxs("div",{className:"apteva-file-badge",title:G.file.name,children:[G.preview?R.jsx("img",{src:G.preview,alt:G.file.name,className:"apteva-file-badge-img"}):R.jsx("span",{className:"apteva-file-badge-icon",children:W0(G.file.type)}),R.jsx("button",{onClick:()=>r(O),className:"apteva-file-badge-remove",title:"Remove",children:R.jsx("svg",{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:R.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},O))}),$==="idle"?R.jsx("textarea",{ref:b,value:B,onChange:(G)=>f(G.target.value),onKeyDown:C,placeholder:N.length>0?"Add a message...":U,disabled:L,rows:1,className:e("flex-1 resize-none bg-transparent border-none focus:outline-none","!text-neutral-900 dark:!text-neutral-100 placeholder-neutral-400 dark:placeholder-neutral-500","text-sm leading-relaxed py-1","disabled:opacity-50"),style:{minHeight:"24px",maxHeight:"120px"}}):R.jsx("div",{className:e("flex-1 text-sm py-1 truncate flex items-center gap-2",$==="loading"&&!U0&&"!text-neutral-600 dark:!text-neutral-400",$==="loading"&&U0&&"!text-blue-600 dark:!text-blue-400",$==="success"&&"!text-neutral-900 dark:!text-neutral-100",$==="error"&&"!text-red-600 dark:!text-red-400",$==="plan-pending"&&"!text-amber-700 dark:!text-amber-300"),children:U0?R.jsxs(R.Fragment,{children:[R.jsx("span",{className:"font-mono",children:R0}),R.jsx("span",{className:"text-neutral-400 dark:text-neutral-500",children:"Running..."})]}):R0}),R.jsx("div",{className:"w-8 h-8 flex items-center justify-center flex-shrink-0",children:$==="plan-pending"?R.jsxs("div",{className:"flex items-center gap-1",children:[R.jsx("button",{onClick:J,className:"px-2 py-1 bg-amber-500 text-white rounded-lg hover:bg-amber-600 transition-colors text-xs font-medium",children:"Approve"}),R.jsx("button",{onClick:K,className:"px-2 py-1 bg-neutral-200 dark:bg-neutral-700 text-neutral-700 dark:text-neutral-300 rounded-lg hover:bg-neutral-300 dark:hover:bg-neutral-600 transition-colors text-xs font-medium",children:"Modify"})]}):R.jsxs(R.Fragment,{children:[$==="loading"&&q&&R.jsx("button",{onClick:q,className:"apteva-composer-stop-btn",title:"Stop generation",children:R.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:R.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"1",fill:"currentColor"})})}),($==="success"||$==="error")&&R.jsx("button",{onClick:g,className:"w-8 h-8 rounded-lg flex items-center justify-center !text-neutral-400 hover:!text-neutral-600 dark:hover:!text-neutral-300 hover:bg-neutral-100 dark:hover:bg-neutral-800 transition-colors",title:"New command",children:R.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:R.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),$==="idle"&&R.jsx("button",{onClick:H0,disabled:!B.trim()&&N.length===0||L,className:e("apteva-composer-send-btn w-8 h-8 rounded-lg flex items-center justify-center transition-all","border border-neutral-200 dark:border-neutral-700","disabled:opacity-30 disabled:cursor-not-allowed",B.trim()||N.length>0?"bg-neutral-900 dark:bg-white !text-white dark:!text-neutral-900 border-neutral-900 dark:border-white":"bg-white dark:bg-neutral-800 !text-neutral-400"),title:"Execute command",children:R.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:R.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 12h14M12 5l7 7-7 7"})})})]})})]}),R.jsx("input",{ref:n,type:"file",multiple:!0,onChange:K0,className:"hidden",accept:"image/*,application/pdf,.doc,.docx,.txt"})]})}var JY=class{constructor(X){RQ(this,"config"),this.config={apiUrl:X?.apiUrl??"",apiKey:X?.apiKey??""}}configure(X){if(X.apiUrl!==void 0)this.config.apiUrl=X.apiUrl;if(X.apiKey!==void 0)this.config.apiKey=X.apiKey}getConfig(){return{...this.config}}async chat(X){try{console.log("[AptevaClient] Chat request:",{agent_id:X.agent_id,message:typeof X.message==="string"?X.message.substring(0,100)+"...":"[multi-part message]",system:X.system,stream:X.stream});let $=await fetch(`${this.config.apiUrl}/chat`,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.config.apiKey},body:JSON.stringify(X)});if(!$.ok){let Y=await $.json().catch(()=>({error:"Request failed"}));throw Error(Y.error||`Request failed with status ${$.status}`)}let Q=await $.json();return{message:Q.response||Q.message||"",thread_id:Q.thread_id,widgets:Q.widgets}}catch($){throw console.error("Chat API error:",$),$}}async chatStream(X,$,Q,Y){try{console.log("[AptevaClient] Chat stream request:",{agent_id:X.agent_id,message:typeof X.message==="string"?X.message.substring(0,100)+"...":"[multi-part message]",system:X.system,stream:X.stream});let Z=await fetch(`${this.config.apiUrl}/chat`,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.config.apiKey,Accept:"text/event-stream"},body:JSON.stringify({...X,stream:!0})});if(!Z.ok){let V=await Z.json().catch(()=>({error:"Request failed"}));throw Error(V.error||`Request failed with status ${Z.status}`)}let z=Z.body?.getReader();if(!z)throw Error("Response body is not readable");let H=new TextDecoder,J="",K="";while(!0){let{done:V,value:q}=await z.read();if(V)break;J+=H.decode(q,{stream:!0});let _=J.split(`
22
+ `);J=_.pop()||"";for(let U of _){if(!U.trim()||U.startsWith(":"))continue;if(U.startsWith("data: ")){let L=U.slice(6);if(L==="[DONE]"){Q?.(K);return}try{let B=JSON.parse(L);if(B.thread_id)K=B.thread_id;$(B)}catch(B){console.warn("[AptevaClient] Failed to parse SSE data:",L)}}}}Q?.(K)}catch(Z){let z=Z instanceof Error?Z:Error("Unknown error");throw Y?.(z),z}}async createThread(X,$){let Q=await fetch(`${this.config.apiUrl}/agents/${X}/threads`,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.config.apiKey},body:JSON.stringify({metadata:$})});if(!Q.ok){let Z=await Q.json().catch(()=>({error:"Request failed"}));throw Error(Z.error||`Request failed with status ${Q.status}`)}return(await Q.json()).thread_id}async getThreadMessages(X){let $=await fetch(`${this.config.apiUrl}/threads/${X}/messages`,{method:"GET",headers:{"X-API-Key":this.config.apiKey}});if(!$.ok){let Y=await $.json().catch(()=>({error:"Request failed"}));throw Error(Y.error||`Request failed with status ${$.status}`)}return(await $.json()).messages}async cancelRequest(X,$){try{let Q=await fetch(`${this.config.apiUrl}/agents/${X}/requests/${$}/cancel`,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.config.apiKey}});if(!Q.ok){let Y=await Q.json().catch(()=>({error:"Cancel request failed"}));throw Error(Y.error||`Cancel request failed with status ${Q.status}`)}}catch(Q){throw console.error("[AptevaClient] Cancel request error:",Q),Q}}},n0=new JY,H$=d.forwardRef(function({agentId:$,threadId:Q,initialMessages:Y=[],context:Z,apiUrl:z,apiKey:H,useMock:J=!1,initialMode:K="chat",showModeToggle:V=!1,onModeChange:q,commandVariant:_="default",planMode:U=!1,onPlanModeChange:L,enableStreaming:B=!0,showProgress:W=!0,loadingText:N="Processing...",welcomeTitle:k,welcomeSubtitle:x,welcomeIcon:v,suggestedPrompts:A,welcomeVariant:u,onThreadChange:b,onMessageSent:n,onAction:o,onFileUpload:H0,onComplete:C,onError:g,onToolCall:f,onToolResult:K0,variant:r="default",placeholder:W0,showHeader:L0=!0,headerTitle:v0="Chat",onHeaderBack:R0,enableWidgets:U0=!1,availableWidgets:G,compactWidgetContext:O=!1,onWidgetRender:w,className:j},m){let[P0,i]=d.useState(Y),[T0,w0]=d.useState(!1),[E0,FX]=d.useState(Q||null),[VX,M$]=d.useState(K),[WX,OX]=d.useState(null),[RX,_0]=d.useState("idle"),[fX,d0]=d.useState(null),[v$,S0]=d.useState(null),[UY,y0]=d.useState(0),[T$,XX]=d.useState(""),[I$,i0]=d.useState(""),[b$,$X]=d.useState(null),[jX,p0]=d.useState(null),[hX,QX]=d.useState(""),[k$,YX]=d.useState(""),[w$,S$]=d.useState(U),[uX,y$]=d.useState(!1),_Y=d.useRef(null),ZX=d.useRef(null);d.useImperativeHandle(m,()=>({sendMessage:async(X0)=>{if(ZX.current)await ZX.current(X0)},sendSystemMessage:async(X0)=>{if(ZX.current)await ZX.current(X0,void 0,!0)},getMessages:()=>P0,clearMessages:()=>i([])}),[P0]);let o0=d.useMemo(()=>{if(!U0)return Z;let X0=O?fQ(G):CQ(G);return Z?`${Z}
23
+ ${X0}`:X0},[Z,U0,G,O]);d.useEffect(()=>{if(z||H)n0.configure({...z&&{apiUrl:z},...H&&{apiKey:H}})},[z,H]),d.useEffect(()=>{if(Q)b?.(Q)},[Q,b]),d.useEffect(()=>{S$(U)},[U]),d.useEffect(()=>{let X0=(F0)=>{let A0=F0.target;if(uX&&!A0.closest(".settings-menu-container"))y$(!1)};return document.addEventListener("mousedown",X0),()=>document.removeEventListener("mousedown",X0)},[uX]);let xX=(X0)=>{if(M$(X0),q?.(X0),X0==="command")_0("idle"),d0(null),S0(null)},C$=VX==="chat"?"Type a message...":"Enter your command...",NX=async(X0,F0,A0)=>{let G0=F0&&F0.length>0,Z0=G0?F0.map(($0)=>({name:$0.name,type:$0.type,size:$0.size,preview:$0.type.startsWith("image/")?URL.createObjectURL($0):void 0})):[];if(!A0){let $0={id:`msg-${Date.now()}`,role:"user",content:X0,timestamp:new Date,metadata:G0?{attachments:Z0}:void 0};i((a)=>[...a,$0]),n?.($0)}w0(!0);try{let $0=await aX(X0,F0);if(J){let a=await NQ(1000);i((s)=>[...s,a])}else{let a=[],s="",c=[],h0=E0,zX={},AX={},u$=`msg-${Date.now()}-res`,u0=()=>{let M=[...a];if(s){let T=M[M.length-1];if(T&&T.type==="text")T.content=s;else M.push({type:"text",content:s})}i((T)=>{let t=T[T.length-1];if(t&&t.role==="assistant")return[...T.slice(0,-1),{...t,content:s,widgets:c.length>0?c:void 0,metadata:{...t.metadata,content_segments:M,isStreaming:!0}}];else return[...T,{id:u$,role:"assistant",content:s,widgets:c.length>0?c:void 0,timestamp:new Date,metadata:{content_segments:M,isStreaming:!0}}]})};await n0.chatStream({agent_id:$,message:$0,stream:!0,...E0&&{thread_id:E0},...o0&&{system:o0}},(M)=>{switch(M.type){case"thread_id":if(M.thread_id){if(h0=M.thread_id,!E0)FX(M.thread_id),b?.(M.thread_id)}break;case"request_id":if(M.request_id)p0(M.request_id);break;case"content":case"token":if(M.content){if(!s)s=M.content.trimStart();else s+=M.content;if(s)u0()}break;case"tool_call":if(M.tool_id&&M.tool_name){let T=M.tool_display_name||M.tool_name;if(s)a.push({type:"text",content:s.trimEnd()}),s="";a.push({type:"tool",id:M.tool_id,name:T,status:"preparing"}),zX[M.tool_id]="",OX(T),f?.(M.tool_name,M.tool_id),u0()}break;case"tool_input_delta":if(M.tool_id&&M.content){let T=M.tool_id;if(zX[T]===void 0)zX[T]="";zX[T]+=M.content;let t=a.find((JX)=>JX.type==="tool"&&JX.id===T);if(t){if(t.isReceiving=!0,t.inputLength=zX[T].length,u0(),AX[T])clearTimeout(AX[T]);AX[T]=setTimeout(()=>{if(t.status==="preparing")t.isReceiving=!1,u0()},150)}}break;case"tool_use":if(M.tool_id){let T=a.find((t)=>t.type==="tool"&&t.id===M.tool_id);if(T&&T.status==="preparing")T.status="running",T.isReceiving=!1,u0()}break;case"tool_stream":if(M.tool_id){let T=a.find((t)=>t.type==="tool"&&t.id===M.tool_id);if(T){if(M.event==="chunk"&&M.content){if(T.pendingReset)T.streamOutput="",T.pendingReset=!1;T.streamOutput=(T.streamOutput||"")+M.content,u0()}else if(M.event==="log"||M.event==="progress")T.pendingReset=!0}}break;case"tool_result":if(M.tool_id){let T=a.find((t)=>t.type==="tool"&&t.id===M.tool_id);if(T)T.result=M.content,T.status="completed",T.isReceiving=!1,K0?.(T.name,M.content);OX(null),u0()}break;case"widget":if(M.widget)c.push(M.widget),u0();break;case"error":throw Error(M.message||"Stream error")}},(M)=>{if(s=s.trimEnd(),s){let T=a[a.length-1];if(T&&T.type==="text")T.content=s;else a.push({type:"text",content:s})}if(i((T)=>{let t=T[T.length-1];if(t&&t.role==="assistant")return[...T.slice(0,-1),{...t,content:s||"Response received",widgets:c.length>0?c:void 0,metadata:{thread_id:M,content_segments:a,isStreaming:!1}}];return T}),M&&M!==E0)FX(M),b?.(M);w0(!1),p0(null),OX(null)},(M)=>{let T={id:`msg-${Date.now()}-error`,role:"assistant",content:`Error: ${M.message}`,timestamp:new Date,metadata:{error:!0}};i((t)=>{let JX=t[t.length-1];if(JX&&JX.id.includes("streaming"))return[...t.slice(0,-1),T];return[...t,T]}),w0(!1),p0(null),OX(null),g?.(M)})}}catch($0){let a={id:`msg-${Date.now()}-error`,role:"assistant",content:$0 instanceof Error?`Error: ${$0.message}`:"An error occurred",timestamp:new Date,metadata:{error:!0}};i((s)=>[...s,a]),g?.($0 instanceof Error?$0:Error("Unknown error"))}finally{w0(!1)}};ZX.current=NX;let gX=async(X0,F0)=>{let A0=X0||T$;if(!A0.trim()&&(!F0||F0.length===0)){S0(Error("Please enter a command")),_0("error");return}if(w$&&RX!=="plan-pending"){if(_0("loading"),S0(null),XX(""),J)setTimeout(()=>{let G0=`1. Analyze the request: "${A0}"
24
+ 2. Process the data
25
+ 3. Generate response
26
+ 4. Return results`;QX(G0),YX(A0),_0("plan-pending")},800);else try{let Z0=o0?`${o0}
27
+
28
+ CRITICAL PLANNING MODE: You are ONLY creating a plan. Write a numbered list of steps describing what WOULD be done. DO NOT execute anything.`:"CRITICAL PLANNING MODE: You are ONLY creating a plan. Write a numbered list of steps describing what WOULD be done. DO NOT execute anything.",$0=await n0.chat({agent_id:$,message:A0,stream:!1,system:Z0});QX($0.message),YX(A0),_0("plan-pending")}catch(G0){let Z0=G0 instanceof Error?G0:Error("Failed to generate plan");S0(Z0),_0("error"),g?.(Z0)}return}_0("loading"),S0(null),y0(0),i0(""),XX("");try{if(J)if(B){let G0="";EQ(A0,(Z0)=>{if(Z0.type==="token"&&Z0.content){G0+=Z0.content,i0(G0);let $0=Math.min(Math.round(G0.length/10),90);y0($0)}},(Z0)=>{let $0={success:!0,data:{summary:G0,thread_id:Z0},message:G0||"Command executed successfully"};d0($0),_0("success"),y0(100),C?.($0)},(Z0)=>{S0(Z0),_0("error"),g?.(Z0)})}else{await new Promise((Z0)=>setTimeout(Z0,1500));let G0={success:!0,data:{summary:`Executed: ${A0}`},message:"Command executed successfully"};d0(G0),_0("success"),y0(100),C?.(G0)}else{let Z0=o0?`${o0}
29
+
30
+ CRITICAL COMMAND MODE: Maximum 10 words per response. Execute the command immediately. Make reasonable assumptions based on context. Use sensible defaults for missing details. DO NOT ask questions unless something is truly impossible without user input (e.g., missing required password). State what you're doing or the result. Examples: "Analyzing customer data from last quarter..." or "Created 5 new database entries successfully" or "Search complete: found 12 matching results". NO greetings, NO filler words, NO clarification requests. Action/result only.`:`CRITICAL COMMAND MODE: Maximum 10 words per response. Execute the command immediately. Make reasonable assumptions based on context. Use sensible defaults for missing details. DO NOT ask questions unless something is truly impossible without user input (e.g., missing required password). State what you're doing or the result. Examples: "Analyzing customer data from last quarter..." or "Created 5 new database entries successfully" or "Search complete: found 12 matching results". NO greetings, NO filler words, NO clarification requests. Action/result only.`,$0=F0&&F0.length>0?await aX(A0,F0):A0;if(B){let a="",s="";await n0.chatStream({agent_id:$,message:$0,stream:!0,...E0&&{thread_id:E0},system:Z0},(c)=>{if((c.type==="token"||c.type==="content")&&c.content){a+=c.content,i0(a),$X(null);let h0=Math.min(Math.round(a.length/10),90);y0(h0)}else if(c.type==="tool_call"&&c.tool_name){let h0=c.tool_display_name||c.tool_name;s=c.tool_name,$X(h0),f?.(c.tool_name,c.tool_id||""),a="",i0("")}else if(c.type==="tool_result")K0?.(s,c.content),$X(null);else if(c.type==="thread_id"&&c.thread_id){if(!E0)FX(c.thread_id),b?.(c.thread_id)}else if(c.type==="request_id"&&c.request_id)p0(c.request_id)},(c)=>{let h0={success:!0,data:{summary:a,thread_id:c},message:a||"Command executed successfully"};d0(h0),_0("success"),y0(100),p0(null),C?.(h0)},(c)=>{S0(c),_0("error"),p0(null),g?.(c)})}else{let a=await n0.chat({agent_id:$,message:$0,stream:!1,...E0&&{thread_id:E0},system:Z0}),s={success:!0,data:{summary:a.message,thread_id:a.thread_id},widgets:a.widgets,message:a.message};d0(s),_0("success"),y0(100),C?.(s)}}}catch(G0){let Z0=G0 instanceof Error?G0:Error("Unknown error");S0(Z0),_0("error"),g?.(Z0)}},f$=()=>{_0("idle"),d0(null),S0(null),y0(0),XX(""),QX(""),YX(""),i0(""),$X(null)},j$=()=>{let X0=hX;QX(""),YX("");let F0=`Execute this plan now:
31
+
32
+ ${X0}`;gX(F0)},h$=()=>{XX(k$),QX(""),YX(""),_0("idle")},pX=async()=>{if(jX&&$)try{await n0.cancelRequest($,jX)}catch(X0){console.error("Failed to cancel request:",X0)}if(w0(!1),RX==="loading")_0("idle"),i0(""),$X(null),y0(0);p0(null)},BY=_==="compact";return O0.jsxs("div",{className:e("apteva-chat flex flex-col h-full",r!=="default"&&`apteva-chat-${r}`,j),children:[L0&&VX==="chat"&&O0.jsx("div",{className:"apteva-chat-header px-4 py-3",children:O0.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[R0&&O0.jsx("button",{onClick:R0,className:"apteva-chat-back",style:{flexShrink:0},children:O0.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:O0.jsx("path",{d:"M10 12L6 8l4-4"})})}),O0.jsxs("div",{children:[O0.jsx("div",{className:"apteva-chat-title",children:v0}),O0.jsx("div",{className:e("apteva-chat-status",T0?WX?"apteva-chat-status-tool":"apteva-chat-status-thinking":"apteva-chat-status-ready"),children:T0?WX?`Using ${WX}...`:"Thinking...":"Ready"})]})]})}),VX==="chat"&&O0.jsxs(O0.Fragment,{children:[O0.jsx(YY,{messages:P0,onAction:o,welcomeTitle:k,welcomeSubtitle:x,welcomeIcon:v,suggestedPrompts:A,welcomeVariant:u,chatVariant:r,onPromptClick:(X0)=>NX(X0),enableWidgets:U0,onWidgetRender:w}),O0.jsx(ZY,{onSendMessage:NX,placeholder:W0||C$,disabled:T0,isLoading:T0,onStop:pX,onFileUpload:H0,onSwitchMode:V?()=>xX("command"):void 0})]}),VX==="command"&&O0.jsx("div",{className:"w-full",children:O0.jsx(zY,{onExecute:(X0,F0)=>{XX(X0),gX(X0,F0)},state:RX,response:fX?.data?.summary||fX?.message,error:v$?.message,plan:hX,streamedContent:I$,toolName:b$,onApprove:j$,onReject:h$,onReset:f$,onStop:pX,onExpand:V?()=>xX("chat"):void 0,placeholder:W0||"Enter your command..."})}),O0.jsx("style",{dangerouslySetInnerHTML:{__html:`
33
+ @keyframes pulse-border {
34
+ 0%, 100% { border-color: rgb(59, 130, 246); }
35
+ 50% { border-color: rgb(147, 197, 253); }
36
+ }
37
+ .animate-pulse-border {
38
+ animation: pulse-border 2s ease-in-out infinite;
39
+ }
40
+ .apteva-composer {
41
+ border-radius: var(--apteva-border-radius, 1rem) !important;
42
+ }
43
+ `}})]})});var S=E(R$(),1);function wY({agents:X,onNavigate:$}){let{authFetch:Q}=P$(),{currentProjectId:Y}=E$(),{events:Z,statusChangeCounter:z}=N$(),[H,J]=J0.useState([]),[K,V]=J0.useState(null),[q,_]=J0.useState(null),[U,L]=J0.useState([]),[B,W]=J0.useState(!0),[N,k]=J0.useState(!1),[x,v]=J0.useState([]),[A,u]=J0.useState(!1),[b,n]=J0.useState(0),o=J0.useMemo(()=>{if(Y===null)return X;if(Y==="unassigned")return X.filter((O)=>!O.projectId);return X.filter((O)=>O.projectId===Y)},[X,Y]),H0=J0.useMemo(()=>o.filter((O)=>O.status==="running"),[o]),C=J0.useMemo(()=>new Set(o.map((O)=>O.id)),[o]),g=J0.useCallback(async()=>{try{let O=Y?`?project_id=${encodeURIComponent(Y)}`:"",[w,j]=await Promise.all([Q(`/api/threads${O}`).catch(()=>null),Q(`/api/telemetry/events?type=thread_activity&limit=100${O?`&${O}`:""}`).catch(()=>null)]);if(w?.ok){let m=await w.json();J(m.threads||[])}if(j?.ok){let m=await j.json();v(m.events||[])}}catch(O){console.error("Failed to fetch threads:",O)}finally{W(!1)}},[Q,Y]);J0.useEffect(()=>{g()},[g,z]),J0.useEffect(()=>{let O=setInterval(g,15000);return()=>clearInterval(O)},[g]);let f=J0.useCallback(async(O)=>{_(null),k(!0),V(O);try{let w=await Q(`/api/agents/${O.agent_id}/threads/${O.id}/messages`);if(w.ok){let j=await w.json();L(Y$(j.messages||[]))}else L([])}catch{L([])}k(!1)},[Q]),K0=(O)=>{V(null),L([]),_(O),n((w)=>w+1),u(!1)},r=J0.useMemo(()=>{let O=Z.filter((m)=>m.type==="thread_activity"&&!m.data?.parent_id),w=new Set(O.map((m)=>m.id)),j=[...O];for(let m of x)if(!w.has(m.id)&&!m.data?.parent_id)j.push(m),w.add(m.id);return j.filter((m)=>C.has(m.agent_id)).sort((m,P0)=>new Date(P0.timestamp).getTime()-new Date(m.timestamp).getTime()).slice(0,100)},[Z,x,C]),W0=J0.useMemo(()=>{let O=new Map;for(let w of r){let j=w.thread_id||w.data?.thread_id;if(j){if(!O.has(j))O.set(j,[]);O.get(j).push(w)}}return O},[r]),L0=H0.length,v0=K?.agent_id||q?.id,R0=K?.agent_name||q?.name,U0=K?.id,G=K?`${K.agent_id}-${K.id}`:q?`new-${q.id}-${b}`:null;return S.jsxDEV("div",{className:"flex-1 flex flex-col overflow-hidden",children:[S.jsxDEV("div",{className:"px-6 pt-6 pb-4 shrink-0",children:S.jsxDEV("div",{className:"flex items-center justify-between",children:[S.jsxDEV("h1",{className:"text-xl font-semibold",children:"Threads"},void 0,!1,void 0,this),S.jsxDEV("span",{className:"text-sm text-[#666]",children:[H.length," threads from ",L0," running agents"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),S.jsxDEV("div",{className:"flex-1 flex min-h-0 overflow-hidden",children:[S.jsxDEV("div",{className:"w-1/4 min-w-[260px] max-w-[360px] flex flex-col overflow-hidden",children:[S.jsxDEV("div",{className:"p-2 shrink-0",children:S.jsxDEV("div",{className:"relative",children:[S.jsxDEV("button",{onClick:()=>u(!A),disabled:H0.length===0,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg bg-[#f97316]/10 text-[#f97316] text-sm font-medium hover:bg-[#f97316]/20 transition disabled:opacity-30 disabled:cursor-not-allowed",children:[S.jsxDEV("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:S.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"},void 0,!1,void 0,this)},void 0,!1,void 0,this),"New conversation"]},void 0,!0,void 0,this),A&&S.jsxDEV(S.Fragment,{children:[S.jsxDEV("div",{className:"fixed inset-0 z-40",onClick:()=>u(!1)},void 0,!1,void 0,this),S.jsxDEV("div",{className:"absolute top-full left-0 right-0 mt-1 bg-[#111] border border-[#222] rounded-lg shadow-xl z-50 max-h-60 overflow-auto",children:H0.map((O)=>S.jsxDEV("button",{onClick:()=>K0(O),className:"w-full text-left px-3 py-2.5 hover:bg-[#1a1a1a] transition",children:[S.jsxDEV("p",{className:"text-sm font-medium truncate",children:O.name},void 0,!1,void 0,this),S.jsxDEV("p",{className:"text-[10px] text-[#555]",children:[O.provider," · ",O.model]},void 0,!0,void 0,this)]},O.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),S.jsxDEV("div",{className:"flex-1 overflow-auto px-2 pb-2",children:B?S.jsxDEV("div",{className:"p-6 text-center text-[#555] text-sm",children:"Loading threads..."},void 0,!1,void 0,this):H.length===0?S.jsxDEV("div",{className:"p-6 text-center text-[#555] text-sm",children:[S.jsxDEV("p",{children:"No threads yet"},void 0,!1,void 0,this),S.jsxDEV("p",{className:"mt-1 text-[#444]",children:"Start a conversation or wait for agents"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):S.jsxDEV("div",{className:"space-y-0.5",children:H.map((O)=>S.jsxDEV(VY,{thread:O,selected:K?.id===O.id&&K?.agent_id===O.agent_id,activities:W0.get(O.id)||[],onSelect:()=>f(O)},`${O.agent_id}-${O.id}`,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S.jsxDEV("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:v0&&G?N?S.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:"Loading messages..."},void 0,!1,void 0,this):S.jsxDEV(H$,{agentId:"default",apiUrl:`/api/agents/${v0}`,threadId:U0,initialMessages:U,placeholder:`Message ${R0}...`,headerTitle:R0,variant:"terminal",showHeader:!0},G,!1,void 0,this):S.jsxDEV("div",{className:"flex-1 flex items-center justify-center",children:S.jsxDEV("div",{className:"text-center text-[#555]",children:[S.jsxDEV("svg",{className:"w-12 h-12 mx-auto mb-3 text-[#333]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:S.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),S.jsxDEV("p",{className:"text-sm",children:"Select a thread or start a new conversation"},void 0,!1,void 0,this),S.jsxDEV("p",{className:"text-xs text-[#444] mt-1",children:"Chat with any running agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function VY({thread:X,selected:$,activities:Q,onSelect:Y}){let{isActive:Z}=A$(X.agent_id),H=Q[0]?.data?.activity;return S.jsxDEV("button",{onClick:Y,className:`w-full text-left px-3 py-2.5 rounded-lg transition ${$?"bg-[#f97316]/10":"hover:bg-[#151515]"}`,children:[S.jsxDEV("div",{className:"flex items-center justify-between gap-2 mb-1",children:[S.jsxDEV("span",{className:"text-sm font-medium truncate",children:X.title||`Thread ${X.id.slice(0,8)}`},void 0,!1,void 0,this),S.jsxDEV("span",{className:"text-[10px] text-[#555] shrink-0",children:OY(X.updated_at)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S.jsxDEV("div",{className:"flex items-center gap-1.5",children:[S.jsxDEV("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${Z?"bg-green-400 animate-pulse":"bg-[#444]"}`},void 0,!1,void 0,this),S.jsxDEV("span",{className:"text-[11px] text-[#f97316]",children:X.agent_name},void 0,!1,void 0,this),X.message_count!=null&&S.jsxDEV(S.Fragment,{children:[S.jsxDEV("span",{className:"text-[#333]",children:"·"},void 0,!1,void 0,this),S.jsxDEV("span",{className:"text-[10px] text-[#555]",children:[X.message_count," msgs"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H&&S.jsxDEV("p",{className:"text-[11px] text-[#555] truncate mt-1",children:H},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function OY(X){let $=Math.floor((Date.now()-new Date(X).getTime())/1000);if($<5)return"just now";if($<60)return`${$}s ago`;let Q=Math.floor($/60);if(Q<60)return`${Q}m ago`;let Y=Math.floor(Q/60);if(Y<24)return`${Y}h ago`;return`${Math.floor(Y/24)}d ago`}
44
+ export{Y$ as Q,H$ as R,wY as S};
45
+
46
+ //# debugId=82A3FCBD4CED815F64756E2164756E21
@@ -0,0 +1,4 @@
1
+ import{$ as P,X as L,aa as N}from"./App.3qw8nben.js";var z=L(P(),1),w=L(N(),1);function U({children:q,onClose:y}){return w.jsxDEV("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",children:w.jsxDEV("div",{className:"bg-[#111] rounded p-6 w-full max-w-xl lg:max-w-2xl border border-[#1a1a1a] max-h-[90vh] overflow-y-auto",children:q},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Q({title:q,message:y,confirmText:F="Confirm",cancelText:B="Cancel",confirmVariant:G="danger",onConfirm:I,onCancel:J}){return w.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:w.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-sm",children:[q&&w.jsxDEV("h3",{className:"font-medium mb-2",children:q},void 0,!1,void 0,this),w.jsxDEV("p",{className:"text-sm text-[#ccc] mb-4",children:y},void 0,!1,void 0,this),w.jsxDEV("div",{className:"flex gap-2",children:[w.jsxDEV("button",{onClick:J,className:"flex-1 text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] px-4 py-2 rounded transition",children:B},void 0,!1,void 0,this),w.jsxDEV("button",{onClick:I,className:`flex-1 text-sm text-white px-4 py-2 rounded transition ${G==="danger"?"bg-red-500 hover:bg-red-600":"bg-[#f97316] hover:bg-[#ea580c]"}`,children:F},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function R({title:q,message:y,buttonText:F="OK",variant:B="info",onClose:G}){let I={error:"bg-red-500/20 text-red-400",success:"bg-green-500/20 text-green-400",info:"bg-blue-500/20 text-blue-400"},J={error:"✕",success:"✓",info:"ℹ"};return w.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:w.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-sm text-center",children:[w.jsxDEV("div",{className:`w-12 h-12 rounded-full flex items-center justify-center mx-auto mb-3 ${I[B]}`,children:w.jsxDEV("span",{className:"text-xl",children:J[B]},void 0,!1,void 0,this)},void 0,!1,void 0,this),q&&w.jsxDEV("h3",{className:"font-medium mb-2",children:q},void 0,!1,void 0,this),w.jsxDEV("p",{className:"text-sm text-[#ccc] mb-4",children:y},void 0,!1,void 0,this),w.jsxDEV("button",{onClick:G,className:"w-full text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] px-4 py-2 rounded transition",children:F},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function W(){let[q,y]=z.useState(null),F=z.useCallback((J,K={})=>{return new Promise((O)=>{y({message:J,options:K,resolve:O})})},[]),B=z.useCallback(()=>{q?.resolve(!0),y(null)},[q]),G=z.useCallback(()=>{q?.resolve(!1),y(null)},[q]),I=q?w.jsxDEV(Q,{title:q.options.title,message:q.message,confirmText:q.options.confirmText,cancelText:q.options.cancelText,confirmVariant:q.options.confirmVariant,onConfirm:B,onCancel:G},void 0,!1,void 0,this):null;return{confirm:F,ConfirmDialog:I}}function X(){let[q,y]=z.useState(null),F=z.useCallback((I,J={})=>{return new Promise((K)=>{y({message:I,options:J,resolve:K})})},[]),B=z.useCallback(()=>{q?.resolve(),y(null)},[q]),G=q?w.jsxDEV(R,{title:q.options.title,message:q.message,buttonText:q.options.buttonText,variant:q.options.variant,onClose:B},void 0,!1,void 0,this):null;return{alert:F,AlertDialog:G}}
2
+ export{U as N,W as O,X as P};
3
+
4
+ //# debugId=018AC1612153677D64756E2164756E21
@@ -0,0 +1,4 @@
1
+ import{$ as Rq,X as c,aa as Gq,ja as Jq}from"./App.3qw8nben.js";var Q=c(Rq(),1);var q=c(Gq(),1);function C(H){return H.authSchemes.some((J)=>J.toUpperCase()==="API_KEY")}function Qq(H){return H.authSchemes.some((J)=>J.toUpperCase()==="OAUTH2")}function Lq(H){return C(H)&&Qq(H)}function wq({providerId:H="composio",projectId:J,onConnectionComplete:U,onBrowseTriggers:F,hideMcpConfig:y}){let{authFetch:Z}=Jq(),[A,I]=Q.useState([]),[k,P]=Q.useState([]),[S,h]=Q.useState(!0),[R,Wq]=Q.useState(""),[g,O]=Q.useState(null),[b,D]=Q.useState(null),[s,_]=Q.useState(null),[L,M]=Q.useState(null),[X,w]=Q.useState(null),[f,u]=Q.useState(""),[V,x]=Q.useState({}),[T,E]=Q.useState(null),[v,n]=Q.useState(""),[o,l]=Q.useState(!1),[t,j]=Q.useState(null),[r,i]=Q.useState(null),N=Q.useCallback(async()=>{h(!0),_(null);let z=J&&J!=="unassigned"?`?project_id=${J}`:"";try{let[G,W]=await Promise.all([Z(`/api/integrations/${H}/apps${z}`),Z(`/api/integrations/${H}/connected${z}`)]),Y=await G.json(),$=await W.json();I(Y.apps||[]),P($.accounts||[])}catch(G){console.error("Failed to fetch integrations:",G),_("Failed to load integrations")}h(!1)},[Z,H,J]);Q.useEffect(()=>{N()},[N]),Q.useEffect(()=>{if(new URLSearchParams(window.location.search).get("connected"))window.history.replaceState({},"",window.location.pathname),N(),U?.()},[N,U]),Q.useEffect(()=>{if(!b?.connectionId)return;let z=J&&J!=="unassigned"?`?project_id=${J}`:"",G=setInterval(async()=>{try{let Y=await(await Z(`/api/integrations/${H}/connection/${b.connectionId}${z}`)).json();if(Y.connection?.status==="active")D(null),O(null),N(),U?.();else if(Y.connection?.status==="failed")D(null),O(null),_(`Connection to ${b.appSlug} failed`)}catch(W){}},2000);return()=>clearInterval(G)},[b,Z,H,J,N,U]);let m=async(z,G,W,Y)=>{if(Lq(z)&&!G&&!Y&&!W){M({app:z});return}if(C(z)&&!G&&!Y&&!W){w({app:z}),u(""),x({});return}O(z.slug),_(null);try{let $={appSlug:z.slug};if(Y&&Object.keys(Y).length>0)$.credentials={authScheme:"API_KEY",fields:Y};else if(G)$.credentials={authScheme:"API_KEY",apiKey:G};let kq=J&&J!=="unassigned"?`?project_id=${J}`:"",qq=await Z(`/api/integrations/${H}/connect${kq}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)}),B=await qq.json();if(!qq.ok){_(B.error||"Failed to initiate connection"),O(null),w(null);return}if(B.status==="active"||!B.redirectUrl){O(null),w(null),N(),U?.();return}if(B.redirectUrl){D({appSlug:z.slug,connectionId:B.connectionId});let zq=window.open(B.redirectUrl,`connect-${z.slug}`,"width=600,height=700,left=200,top=100");if(!zq||zq.closed)window.location.href=B.redirectUrl}}catch($){_(`Failed to connect: ${$}`),O(null),w(null)}},Xq=(z)=>{if(z.preventDefault(),!X)return;if(X.app.credentialFields&&X.app.credentialFields.length>0){if(!X.app.credentialFields.filter(($)=>$.required!==!1).every(($)=>V[$.name]?.trim()))return;m(X.app,void 0,!1,V)}else{if(!f.trim())return;m(X.app,f.trim())}},Yq=async(z)=>{let G=J&&J!=="unassigned"?`?project_id=${J}`:"";try{let W=await Z(`/api/integrations/${H}/connection/${z.id}${G}`,{method:"DELETE"});if(W.ok)N();else{let Y=await W.json();_(Y.error||"Failed to disconnect")}}catch(W){_(`Failed to disconnect: ${W}`)}},Zq=(z)=>{E({app:z}),n(`${z.name} MCP`),j(null)},_q=async()=>{if(!T||!v.trim())return;l(!0),_(null);try{let z=J&&J!=="unassigned"?`?project_id=${J}`:"",G=await Z(`/api/integrations/${H}/configs${z}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:v.replace(/[^a-zA-Z0-9\s-]/g,"").substring(0,30),toolkitSlug:T.app.slug})}),W=await G.json();if(!G.ok){_(W.error||"Failed to create MCP config"),l(!1);return}let Y=!1;if(W.config?.id)try{Y=(await Z(`/api/integrations/${H}/configs/${W.config.id}/add${z}`,{method:"POST"})).ok}catch{}j(v),U?.()}catch(z){_(`Failed to create MCP config: ${z}`)}finally{l(!1)}},$q=(z)=>{i({message:`Disconnect ${z.appName}?`,onConfirm:()=>{Yq(z),i(null)}})},a=(z)=>{return k.some((G)=>G.status==="active"&&(G.appId===z.slug||z.providerSlug&&G.appId===z.providerSlug))},p=(z)=>{return k.find((G)=>G.appId===z.slug&&G.status==="active")||z.providerSlug&&k.find((G)=>G.appId===z.providerSlug&&G.status==="active")||k.find((G)=>G.appId===z.slug)||z.providerSlug&&k.find((G)=>G.appId===z.providerSlug)||void 0},e=A.filter((z)=>{if(!R)return!0;let G=R.toLowerCase();return z.name.toLowerCase().includes(G)||z.slug.toLowerCase().includes(G)||z.description?.toLowerCase().includes(G)||z.categories.some((W)=>W.toLowerCase().includes(G))}),d=e.filter((z)=>a(z)),K=e.filter((z)=>!a(z));if(S)return q.jsxDEV("div",{className:"text-center py-8 text-[#666]",children:"Loading apps..."},void 0,!1,void 0,this);return q.jsxDEV("div",{className:"space-y-6",children:[L&&q.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:q.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-md mx-4",children:[q.jsxDEV("div",{className:"flex items-center gap-3 mb-4",children:[L.app.logo&&q.jsxDEV("img",{src:L.app.logo,alt:L.app.name,className:"w-10 h-10 object-contain"},void 0,!1,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("h3",{className:"font-medium",children:["Connect ",L.app.name]},void 0,!0,void 0,this),q.jsxDEV("p",{className:"text-xs text-[#666]",children:"Choose how to authenticate"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"space-y-3",children:[q.jsxDEV("button",{onClick:()=>{M(null),w({app:L.app}),u(""),x({})},className:"w-full text-left p-3 bg-[#0a0a0a] hover:bg-[#1a1a1a] border border-[#333] hover:border-[#f97316] rounded-lg transition",children:[q.jsxDEV("div",{className:"font-medium text-sm",children:"API Key"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-xs text-[#666] mt-0.5",children:["Enter your ",L.app.name," API key directly"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:()=>{M(null),m(L.app,void 0,!0)},className:"w-full text-left p-3 bg-[#0a0a0a] hover:bg-[#1a1a1a] border border-[#333] hover:border-[#f97316] rounded-lg transition",children:[q.jsxDEV("div",{className:"font-medium text-sm",children:"OAuth"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-xs text-[#666] mt-0.5",children:["Sign in with your ",L.app.name," account"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:()=>M(null),className:"w-full text-sm text-[#666] hover:text-white mt-4 py-2 transition",children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),X&&q.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:q.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-md mx-4",children:[q.jsxDEV("div",{className:"flex items-center gap-3 mb-4",children:[X.app.logo&&q.jsxDEV("img",{src:X.app.logo,alt:X.app.name,className:"w-10 h-10 object-contain"},void 0,!1,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("h3",{className:"font-medium",children:["Connect ",X.app.name]},void 0,!0,void 0,this),q.jsxDEV("p",{className:"text-xs text-[#666]",children:X.app.credentialFields?.length?"Enter your credentials to connect":"Enter your API key to connect"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("form",{onSubmit:Xq,children:[X.app.credentialFields&&X.app.credentialFields.length>0?q.jsxDEV("div",{className:"space-y-3 mb-4",children:X.app.credentialFields.map((z,G)=>q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[#888] mb-1",children:[z.name.replace(/([A-Z])/g," $1").replace(/[-_]/g," ").replace(/\b\w/g,(W)=>W.toUpperCase()).trim(),z.required!==!1&&q.jsxDEV("span",{className:"text-red-400 ml-0.5",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.description&&q.jsxDEV("p",{className:"text-[10px] text-[#555] mb-1",children:z.description},void 0,!1,void 0,this),q.jsxDEV("input",{type:"password",value:V[z.name]||"",onChange:(W)=>x((Y)=>({...Y,[z.name]:W.target.value})),placeholder:`Enter ${z.name}...`,className:"w-full bg-[#0a0a0a] border border-[#333] rounded-lg px-4 py-2 focus:outline-none focus:border-[#f97316]",autoFocus:G===0},void 0,!1,void 0,this)]},z.name,!0,void 0,this))},void 0,!1,void 0,this):q.jsxDEV("input",{type:"password",value:f,onChange:(z)=>u(z.target.value),placeholder:"Enter API Key...",className:"w-full bg-[#0a0a0a] border border-[#333] rounded-lg px-4 py-2 mb-4 focus:outline-none focus:border-[#f97316]",autoFocus:!0},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex gap-2",children:[q.jsxDEV("button",{type:"button",onClick:()=>w(null),className:"flex-1 text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] px-4 py-2 rounded transition",children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV("button",{type:"submit",disabled:g===X.app.slug||(X.app.credentialFields?.length?!X.app.credentialFields.filter((z)=>z.required!==!1).every((z)=>V[z.name]?.trim()):!f.trim()),className:"flex-1 text-sm bg-[#f97316] hover:bg-[#ea580c] text-white px-4 py-2 rounded transition disabled:opacity-50",children:g===X.app.slug?"Connecting...":"Connect"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),T&&q.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:q.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-md mx-4",children:t?q.jsxDEV(q.Fragment,{children:[q.jsxDEV("div",{className:"text-center mb-4",children:[q.jsxDEV("div",{className:"w-12 h-12 bg-green-500/20 rounded-full flex items-center justify-center mx-auto mb-3",children:q.jsxDEV("span",{className:"text-green-400 text-2xl",children:"✓"},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("h3",{className:"font-medium text-lg",children:"MCP Config Created!"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[#888] mt-2",children:['"',t,'" has been created and added to your servers.']},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:()=>{E(null),j(null)},className:"w-full text-sm bg-[#f97316] hover:bg-[#ea580c] text-white px-4 py-2 rounded transition",children:"Done"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):q.jsxDEV(q.Fragment,{children:[q.jsxDEV("div",{className:"flex items-center gap-3 mb-4",children:[T.app.logo&&q.jsxDEV("img",{src:T.app.logo,alt:T.app.name,className:"w-10 h-10 object-contain"},void 0,!1,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("h3",{className:"font-medium",children:"Create MCP Config"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-xs text-[#666]",children:["Create an MCP config for ",T.app.name]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("form",{onSubmit:(z)=>{z.preventDefault(),_q()},children:[q.jsxDEV("label",{className:"block text-xs text-[#888] mb-1",children:"Config Name"},void 0,!1,void 0,this),q.jsxDEV("input",{type:"text",value:v,onChange:(z)=>n(z.target.value),placeholder:"Enter config name...",className:"w-full bg-[#0a0a0a] border border-[#333] rounded-lg px-4 py-2 mb-4 focus:outline-none focus:border-[#f97316]",autoFocus:!0,maxLength:30},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex gap-2",children:[q.jsxDEV("button",{type:"button",onClick:()=>E(null),className:"flex-1 text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] px-4 py-2 rounded transition",children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV("button",{type:"submit",disabled:!v.trim()||o,className:"flex-1 text-sm bg-[#f97316] hover:bg-[#ea580c] text-white px-4 py-2 rounded transition disabled:opacity-50",children:o?"Creating...":"Create Config"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),r&&q.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:q.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-sm mx-4",children:[q.jsxDEV("p",{className:"text-center mb-4",children:r.message},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex gap-2",children:[q.jsxDEV("button",{onClick:()=>i(null),className:"flex-1 text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] px-4 py-2 rounded transition",children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:r.onConfirm,className:"flex-1 text-sm bg-red-500 hover:bg-red-600 text-white px-4 py-2 rounded transition",children:"Confirm"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),s&&q.jsxDEV("div",{className:"text-red-400 text-sm p-3 bg-red-500/10 border border-red-500/20 rounded-lg flex items-center justify-between",children:[q.jsxDEV("span",{children:s},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>_(null),className:"text-red-400 hover:text-red-300",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b&&q.jsxDEV("div",{className:"text-yellow-400 text-sm p-3 bg-yellow-500/10 border border-yellow-500/20 rounded-lg flex items-center gap-2",children:[q.jsxDEV("span",{className:"animate-spin",children:"⟳"},void 0,!1,void 0,this),q.jsxDEV("span",{children:["Waiting for ",b.appSlug," authorization..."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:q.jsxDEV("input",{type:"text",value:R,onChange:(z)=>Wq(z.target.value),placeholder:"Search apps...",className:"w-full bg-[#111] border border-[#333] rounded-lg px-4 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)},void 0,!1,void 0,this),d.length>0&&q.jsxDEV("div",{children:[q.jsxDEV("h3",{className:"text-sm font-medium text-[#888] mb-3",children:["Connected (",d.length,")"]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:d.map((z)=>q.jsxDEV(Hq,{app:z,connection:p(z),onConnect:()=>m(z),onDisconnect:()=>{let G=p(z);if(G)$q(G)},onCreateMcpConfig:y?void 0:()=>Zq(z),onBrowseTriggers:F?()=>F(z.slug):void 0,onUpdateKey:C(z)?()=>{w({app:z}),u(""),x({})}:void 0,connecting:g===z.slug},z.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("h3",{className:"text-sm font-medium text-[#888] mb-3",children:["Available Apps (",K.length,")"]},void 0,!0,void 0,this),K.length===0?q.jsxDEV("p",{className:"text-[#666] text-sm",children:R?"No apps match your search":"No apps available"},void 0,!1,void 0,this):q.jsxDEV("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:K.slice(0,50).map((z)=>q.jsxDEV(Hq,{app:z,onConnect:()=>m(z),connecting:g===z.slug},z.id,!1,void 0,this))},void 0,!1,void 0,this),K.length>50&&q.jsxDEV("p",{className:"text-xs text-[#555] mt-3 text-center",children:["Showing first 50 of ",K.length," apps. Use search to find more."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Hq({app:H,connection:J,onConnect:U,onDisconnect:F,onCreateMcpConfig:y,onBrowseTriggers:Z,onUpdateKey:A,connecting:I}){let k=J?.status==="active",P=C(H),S=Qq(H),h=P&&S;return q.jsxDEV("div",{className:`bg-[#111] border rounded-lg p-3 transition ${k?"border-green-500/30":"border-[#1a1a1a] hover:border-[#333]"}`,children:[q.jsxDEV("div",{className:"flex items-start gap-3",children:[q.jsxDEV("div",{className:"w-10 h-10 rounded bg-[#1a1a1a] flex items-center justify-center flex-shrink-0 overflow-hidden",children:H.logo?q.jsxDEV("img",{src:H.logo,alt:H.name,className:"w-8 h-8 object-contain",onError:(R)=>{R.target.style.display="none"}},void 0,!1,void 0,this):q.jsxDEV("span",{className:"text-lg",children:H.name[0]?.toUpperCase()},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex-1 min-w-0",children:[q.jsxDEV("div",{className:"flex items-center gap-2",children:[q.jsxDEV("h4",{className:"font-medium text-sm truncate",children:H.name},void 0,!1,void 0,this),k&&q.jsxDEV("span",{className:"text-xs text-green-400",children:"✓"},void 0,!1,void 0,this),!k&&P&&!S&&q.jsxDEV("span",{className:"text-[10px] bg-[#222] text-[#888] px-1.5 py-0.5 rounded",title:"Requires API Key",children:"API Key"},void 0,!1,void 0,this),!k&&h&&q.jsxDEV("span",{className:"text-[10px] bg-[#1a2a1a] text-[#6a6] px-1.5 py-0.5 rounded",title:"Supports API Key or OAuth",children:"API Key / OAuth"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.description&&q.jsxDEV("p",{className:"text-xs text-[#666] line-clamp-2 mt-0.5",children:H.description},void 0,!1,void 0,this),H.categories.length>0&&q.jsxDEV("div",{className:"flex flex-wrap gap-1 mt-1",children:H.categories.slice(0,2).map((R)=>q.jsxDEV("span",{className:"text-[10px] bg-[#1a1a1a] text-[#555] px-1.5 py-0.5 rounded",children:R},R,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"mt-3 flex gap-2",children:k?q.jsxDEV(q.Fragment,{children:[y&&q.jsxDEV("button",{onClick:y,className:"flex-1 text-xs bg-[#1a2a1a] hover:bg-[#1a3a1a] border border-green-500/30 hover:border-green-500/50 text-green-400 px-3 py-1.5 rounded transition",children:"Create MCP Config"},void 0,!1,void 0,this),Z&&q.jsxDEV("button",{onClick:Z,className:"flex-1 text-xs bg-[#1a1a2a] hover:bg-[#1a1a3a] border border-blue-500/30 hover:border-blue-500/50 text-blue-400 px-3 py-1.5 rounded transition",children:"Browse Triggers"},void 0,!1,void 0,this),A&&q.jsxDEV("button",{onClick:A,className:"text-xs text-[#666] hover:text-[#f97316] transition px-2",title:"Update API Key",children:"Key"},void 0,!1,void 0,this),F&&q.jsxDEV("button",{onClick:F,className:"text-xs text-[#666] hover:text-red-400 transition px-2",title:"Disconnect",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):q.jsxDEV("button",{onClick:U,disabled:I,className:"w-full text-xs bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-3 py-1.5 rounded transition disabled:opacity-50",children:I?"Connecting...":P&&!S?"Enter API Key":"Connect"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}
2
+ export{wq as j};
3
+
4
+ //# debugId=A61D71DAA9DF5C0964756E2164756E21