@apteva/apteva-darwin-arm64 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 (86) hide show
  1. package/apteva +0 -0
  2. package/dist/ActivityPage.7907h64p.js +3 -0
  3. package/dist/ActivityPage.7907h64p.js.map +10 -0
  4. package/dist/ApiDocsPage.k3jjenpq.js +4 -0
  5. package/dist/{ApiDocsPage.4smnt8m3.js.map → ApiDocsPage.k3jjenpq.js.map} +2 -2
  6. package/dist/App.01nq20st.js +4 -0
  7. package/dist/App.01nq20st.js.map +10 -0
  8. package/dist/App.1maqvamf.js +4 -0
  9. package/dist/{App.ca1rz1ph.js.map → App.1maqvamf.js.map} +2 -2
  10. package/dist/App.2yjrh32f.js +4 -0
  11. package/dist/App.2yjrh32f.js.map +10 -0
  12. package/dist/App.3qw8nben.js +20 -0
  13. package/dist/{App.mvtqv6qc.js.map → App.3qw8nben.js.map} +5 -5
  14. package/dist/App.7fb3e7mp.js +4 -0
  15. package/dist/{App.ncgc9cxy.js.map → App.7fb3e7mp.js.map} +3 -3
  16. package/dist/App.7sy3wq8c.js +4 -0
  17. package/dist/App.7sy3wq8c.js.map +10 -0
  18. package/dist/App.apjrmctz.js +57 -0
  19. package/dist/App.apjrmctz.js.map +383 -0
  20. package/dist/App.av6t2yhe.js +4 -0
  21. package/dist/{App.0sbax9et.js.map → App.av6t2yhe.js.map} +2 -2
  22. package/dist/App.jqj5a094.js +46 -0
  23. package/dist/App.jqj5a094.js.map +13 -0
  24. package/dist/App.mc7xf85h.js +4 -0
  25. package/dist/{App.yv87t9m5.js.map → App.mc7xf85h.js.map} +2 -2
  26. package/dist/App.myxqcj9x.js +4 -0
  27. package/dist/App.myxqcj9x.js.map +10 -0
  28. package/dist/App.nm91r1mp.js +13 -0
  29. package/dist/{App.f8g7tych.js.map → App.nm91r1mp.js.map} +2 -2
  30. package/dist/App.qcknavjz.js +221 -0
  31. package/dist/{App.af2wg84v.js.map → App.qcknavjz.js.map} +9 -15
  32. package/dist/App.vc7vfhg4.js +4 -0
  33. package/dist/App.vc7vfhg4.js.map +10 -0
  34. package/dist/App.z4s9zkw5.js +4 -0
  35. package/dist/App.z4s9zkw5.js.map +10 -0
  36. package/dist/ConnectionsPage.z1pw5xe2.js +3 -0
  37. package/dist/McpPage.8vc97z0b.js +3 -0
  38. package/dist/{ActivityPage.41nbye4r.js.map → McpPage.8vc97z0b.js.map} +1 -1
  39. package/dist/SettingsPage.p61bz8kd.js +3 -0
  40. package/dist/SkillsPage.r9x43g3g.js +3 -0
  41. package/dist/TasksPage.1e0zkye4.js +3 -0
  42. package/dist/{McpPage.y396h6fy.js.map → TasksPage.1e0zkye4.js.map} +1 -1
  43. package/dist/TelemetryPage.p9vbe4gf.js +3 -0
  44. package/dist/TelemetryPage.p9vbe4gf.js.map +9 -0
  45. package/dist/TestsPage.d4xy504e.js +3 -0
  46. package/dist/ThreadsPage.m016am3x.js +3 -0
  47. package/dist/ThreadsPage.m016am3x.js.map +9 -0
  48. package/dist/index.html +1 -1
  49. package/dist/styles.css +1 -1
  50. package/package.json +1 -1
  51. package/dist/ActivityPage.41nbye4r.js +0 -3
  52. package/dist/ApiDocsPage.4smnt8m3.js +0 -4
  53. package/dist/App.0sbax9et.js +0 -4
  54. package/dist/App.0ws427h8.js +0 -4
  55. package/dist/App.0ws427h8.js.map +0 -10
  56. package/dist/App.6q6bar8b.js +0 -4
  57. package/dist/App.6q6bar8b.js.map +0 -10
  58. package/dist/App.80301vdb.js +0 -4
  59. package/dist/App.80301vdb.js.map +0 -10
  60. package/dist/App.af2wg84v.js +0 -267
  61. package/dist/App.ca1rz1ph.js +0 -4
  62. package/dist/App.ensa6z0r.js +0 -4
  63. package/dist/App.ensa6z0r.js.map +0 -10
  64. package/dist/App.f8g7tych.js +0 -13
  65. package/dist/App.mvtqv6qc.js +0 -20
  66. package/dist/App.ncgc9cxy.js +0 -4
  67. package/dist/App.p0fb1pds.js +0 -4
  68. package/dist/App.p0fb1pds.js.map +0 -10
  69. package/dist/App.pmaq48sj.js +0 -4
  70. package/dist/App.pmaq48sj.js.map +0 -10
  71. package/dist/App.yv87t9m5.js +0 -4
  72. package/dist/App.zjmfm8p6.js +0 -4
  73. package/dist/App.zjmfm8p6.js.map +0 -10
  74. package/dist/ConnectionsPage.anb3rv9a.js +0 -3
  75. package/dist/McpPage.y396h6fy.js +0 -3
  76. package/dist/SettingsPage.p1hc60gk.js +0 -3
  77. package/dist/SkillsPage.yj3xdsay.js +0 -3
  78. package/dist/TasksPage.sjv0khtv.js +0 -3
  79. package/dist/TasksPage.sjv0khtv.js.map +0 -9
  80. package/dist/TelemetryPage.2qm4w16r.js +0 -3
  81. package/dist/TelemetryPage.2qm4w16r.js.map +0 -9
  82. package/dist/TestsPage.zzs4qfj8.js +0 -3
  83. /package/dist/{ConnectionsPage.anb3rv9a.js.map → ConnectionsPage.z1pw5xe2.js.map} +0 -0
  84. /package/dist/{SettingsPage.p1hc60gk.js.map → SettingsPage.p61bz8kd.js.map} +0 -0
  85. /package/dist/{SkillsPage.yj3xdsay.js.map → SkillsPage.r9x43g3g.js.map} +0 -0
  86. /package/dist/{TestsPage.zzs4qfj8.js.map → TestsPage.d4xy504e.js.map} +0 -0
@@ -1,4 +0,0 @@
1
- import{k as _0}from"./App.ensa6z0r.js";import{R as x}from"./App.p0fb1pds.js";import{S as O,V as X1,W as n,ca as g,fa as j}from"./App.mvtqv6qc.js";var $0=O(X1(),1);var D=O(X1(),1);var U=O(n(),1);function m0(){let{authFetch:R}=g(),{currentProjectId:H}=j(),[J,F]=D.useState([]),[Q,V]=D.useState([]),[W,T]=D.useState(!0);if(D.useEffect(()=>{(async()=>{T(!0);let y=H&&H!=="unassigned"?`?project_id=${H}`:"";try{let[I,a]=await Promise.all([R(`/api/subscriptions${y}`).catch(()=>null),R("/api/agents").catch(()=>null)]);if(I?.ok){let G=await I.json();F(G.subscriptions||[])}if(a?.ok){let G=await a.json();V(G.agents||[])}}catch(I){console.error("Failed to fetch overview data:",I)}T(!1)})()},[R,H]),W)return U.jsxDEV("div",{className:"text-center py-12 text-[#666]",children:"Loading..."},void 0,!1,void 0,this);let A=J.filter((Y)=>Y.enabled),S=J.filter((Y)=>!Y.enabled),l=new Map(Q.map((Y)=>[Y.id,Y]));return U.jsxDEV("div",{className:"space-y-6",children:[U.jsxDEV("div",{className:"grid grid-cols-3 gap-4",children:[U.jsxDEV(C1,{label:"Active",value:A.length},void 0,!1,void 0,this),U.jsxDEV(C1,{label:"Disabled",value:S.length},void 0,!1,void 0,this),U.jsxDEV(C1,{label:"Total",value:J.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U.jsxDEV("section",{children:[U.jsxDEV("h3",{className:"text-sm font-medium text-[#888] mb-3",children:["Subscriptions (",J.length,")"]},void 0,!0,void 0,this),J.length===0?U.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-6 text-center text-[#666] text-sm",children:"No subscriptions yet. Go to the Triggers tab to create one."},void 0,!1,void 0,this):U.jsxDEV("div",{className:"space-y-2",children:J.map((Y)=>{let y=l.get(Y.agent_id);return U.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-3 flex items-center gap-3",children:[U.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${Y.enabled?"bg-green-400":"bg-[#555]"}`},void 0,!1,void 0,this),U.jsxDEV("div",{className:"flex-1 min-w-0",children:[U.jsxDEV("div",{className:"text-sm font-medium truncate",children:Y.trigger_slug.replace(/_/g," ").replace(/-/g," ")},void 0,!1,void 0,this),U.jsxDEV("div",{className:"text-xs text-[#666]",children:Y.trigger_instance_id?`ID: ${Y.trigger_instance_id.slice(0,12)}...`:"All instances"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U.jsxDEV("div",{className:"text-xs text-[#888] flex-shrink-0",children:[U.jsxDEV("span",{className:"text-[#555]",children:"→"},void 0,!1,void 0,this)," ",U.jsxDEV("span",{className:"text-[#f97316]",children:y?.name||"Unknown Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U.jsxDEV("span",{className:`text-xs px-2 py-0.5 rounded flex-shrink-0 ${Y.enabled?"bg-green-500/10 text-green-400":"bg-[#1a1a1a] text-[#555]"}`,children:Y.enabled?"active":"disabled"},void 0,!1,void 0,this)]},Y.id,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function C1({label:R,value:H,valueColor:J}){return U.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-4",children:[U.jsxDEV("div",{className:"text-xs text-[#666] mb-1",children:R},void 0,!1,void 0,this),U.jsxDEV("div",{className:`text-2xl font-bold ${J||"text-[#e0e0e0]"}`,children:H},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var $=O(X1(),1);var i=O(n(),1);function I0({message:R="Loading...",fullScreen:H=!1}){let J=i.jsxDEV("div",{className:"flex items-center gap-3 text-[#666]",children:[i.jsxDEV("svg",{className:"animate-spin h-5 w-5",viewBox:"0 0 24 24",children:[i.jsxDEV("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"},void 0,!1,void 0,this),i.jsxDEV("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i.jsxDEV("span",{children:R},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(H)return i.jsxDEV("div",{className:"min-h-screen bg-[#0a0a0a] text-[#e0e0e0] font-mono flex items-center justify-center",children:J},void 0,!1,void 0,this);return i.jsxDEV("div",{className:"flex items-center justify-center py-20",children:J},void 0,!1,void 0,this)}var m=O(n(),1);function v0(){let{authFetch:R}=g(),{currentProjectId:H}=j(),[J,F]=$.useState([]),[Q,V]=$.useState(""),[W,T]=$.useState([]),[A,S]=$.useState(!0),[l,Y]=$.useState([]),[y,I]=$.useState([]),[a,G]=$.useState(!1),[b,k]=$.useState(""),[o,F1]=$.useState(""),[R0,v1]=$.useState(!1),[B,_1]=$.useState(null),[f1,z0]=$.useState([]),[$1,I1]=$.useState(""),[Y1,R1]=$.useState(!1),[r,n1]=$.useState(""),[Z1,P1]=$.useState({}),[l1,G0]=$.useState(""),[H0,q1]=$.useState(!1),[p,J0]=$.useState([]),[K0,k1]=$.useState(!1),[A1,U0]=$.useState([]),[Q1,X0]=$.useState([]),[s,y1]=$.useState(""),[t,W1]=$.useState(""),[e,h1]=$.useState(""),[i1,T1]=$.useState(!1),[B1,z1]=$.useState({}),[S1,Y0]=$.useState(""),[a1,G1]=$.useState(!1),[M1,p1]=$.useState(""),[u1,H1]=$.useState(!1),[O1,x1]=$.useState(""),[Z0,J1]=$.useState(!1),[c,L1]=$.useState(""),[K1,b1]=$.useState(""),[V1,c1]=$.useState(!1),[h,q0]=$.useState([]),[d1,Z]=$.useState(null),X=H&&H!=="unassigned"?`?project_id=${H}`:"",E1=$.useCallback(async()=>{try{let N=await R(`/api/triggers/providers${X}`);if(N.ok){let _=((await N.json()).providers||[]).filter((f)=>f.connected);if(F(_),_.length>0)V((f)=>{if(!f||!_.find((K)=>K.id===f))return _[0].id;return f})}}catch(N){console.error("Failed to fetch providers:",N)}},[R]),u=$.useCallback(async()=>{S(!0);try{let N=`provider=${Q}`,v=X?"&":"?",_=X?`/api/triggers${X}&${N}`:`/api/triggers?${N}`,f=await R(_);if(f.ok){let K=await f.json();T(K.triggers||[])}}catch(N){console.error("Failed to fetch triggers:",N)}S(!1)},[R,X,Q]),N1=$.useCallback(async()=>{try{let N=await R(`/api/subscriptions${X}`);if(N.ok){let v=await N.json();Y(v.subscriptions||[])}}catch(N){console.error("Failed to fetch subscriptions:",N)}},[R,X]),D1=$.useCallback(async()=>{try{let N=await R(`/api/agents${X}`);if(N.ok){let v=await N.json();q0(v.agents||[])}}catch(N){}},[R,X]);$.useEffect(()=>{E1(),u(),N1(),D1()},[E1,u,N1,D1]);let Q0=async(N)=>{G(!0);try{let v=`/api/triggers/types?provider=${Q}`;if(N)v+=`&toolkit_slugs=${N}`;if(H&&H!=="unassigned")v+=`&project_id=${H}`;let _=await R(v);if(_.ok){let f=await _.json();I(f.types||[])}else{let f=await _.json();Z(f.error||"Failed to fetch trigger types")}}catch(v){Z("Failed to fetch trigger types")}G(!1)},W0=async()=>{try{let N=await R(`/api/integrations/${Q}/connected${X}`);if(N.ok){let v=await N.json();z0((v.accounts||[]).filter((_)=>_.status==="active"))}}catch(N){}},B0=(N)=>{_1(N),I1(""),n1(""),P1({}),G0(""),v1(!0),W0()},C=Q==="agentdojo",M0=async()=>{q1(!0),W1(""),y1(""),h1(""),z1({}),Y0("");let N=async()=>{if(p.length>0)return;k1(!0);try{let f="/api/triggers/types?provider=agentdojo";if(H&&H!=="unassigned")f+=`&project_id=${H}`;let L=await(await R(f)).json();J0(L.types||[])}catch(f){console.error("Failed to load trigger types:",f)}k1(!1)},v=async()=>{try{let f=`/api/integrations/agentdojo/connected${X}`,q=((await(await R(f)).json()).accounts||[]).filter((E)=>E.status==="active");U0(q)}catch(f){console.error("Failed to load connected accounts:",f)}},_=async()=>{if(Q1.length>0)return;try{let f=`/api/integrations/agentdojo/apps${X}`,L=await(await R(f)).json();X0((L.apps||[]).map((q)=>({id:q.id,name:q.name,slug:q.slug,logo:q.logo})))}catch(f){console.error("Failed to load apps:",f)}};await Promise.all([N(),v(),_()])},O0=async()=>{let N=p.find((_)=>_.slug===t),v=U1;if(!N||!e||!v)return;T1(!0),Z(null);try{let _=h.find((F0)=>F0.id===e),f="provider=agentdojo",K=X?`/api/triggers${X}&provider=agentdojo`:"/api/triggers?provider=agentdojo",L={callback_url:`${window.location.origin}/api/webhooks/agentdojo`,title:`${N.name} → ${_?.name||"Agent"}`,server:N.toolkit_slug,agent_id:e,...B1},q=await R(K,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:N.slug,connectedAccountId:v.id,config:L})}),E=await q.json();if(!q.ok)Z(E.error||"Failed to create subscription");else q1(!1),u()}catch(_){Z(_.message||"Failed to create subscription")}T1(!1)},L0=async()=>{if(!B)return;if(C){if(!r||!m1)return;R1(!0),Z(null);try{let N=h.find((q)=>q.id===r),v=window.location.origin,_=`provider=${Q}`,f=X?`/api/triggers${X}&${_}`:`/api/triggers?${_}`,K=await R(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:B.slug,connectedAccountId:m1.id,config:{callback_url:`${v}/api/webhooks/agentdojo`,title:`${B.name} → ${N?.name||"Agent"}`,server:B.toolkit_slug,agent_id:r,...Z1}})}),L=await K.json();if(!K.ok)Z(L.error||"Failed to create subscription");else v1(!1),_1(null),u()}catch(N){Z(N.message||"Failed to create subscription")}R1(!1);return}if(!$1)return;R1(!0),Z(null);try{let N=`provider=${Q}`,v=X?`/api/triggers${X}&${N}`:`/api/triggers?${N}`,_=await R(v,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:B.slug,connectedAccountId:$1})}),f=await _.json();if(!_.ok)Z(f.error||"Failed to create trigger");else v1(!1),_1(null),u()}catch(N){Z(N.message||"Failed to create trigger")}R1(!1)},g1=async(N,v)=>{let _=v==="active"?"disable":"enable";try{let f=X?`&provider=${Q}`:`?provider=${Q}`,K=await R(`/api/triggers/${N}/${_}${X}${f}`,{method:"POST"});if(K.ok)u();else{let L=await K.json();Z(L.error||`Failed to ${_} trigger`)}}catch(f){Z(`Failed to ${_} trigger`)}},j1=async(N)=>{try{let v=X?`&provider=${Q}`:`?provider=${Q}`,_=await R(`/api/triggers/${N}${X}${v}`,{method:"DELETE"});if(_.ok)u();else{let f=await _.json();Z(f.error||"Failed to delete trigger")}}catch(v){Z("Failed to delete trigger")}},b0=async()=>{if(!c||!K1)return;let N=W.find((v)=>v.id===c);if(!N)return;c1(!0),Z(null);try{let v=await R("/api/subscriptions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({trigger_slug:N.trigger_slug,trigger_instance_id:N.id,agent_id:K1,provider:Q,project_id:H&&H!=="unassigned"?H:null,public_url:window.location.origin})}),_=await v.json();if(!v.ok)Z(_.error||"Failed to create subscription");else J1(!1),L1(""),b1(""),N1()}catch(v){Z(v.message||"Failed to create subscription")}c1(!1)},w0=async(N)=>{let v=N.enabled?"disable":"enable";try{if((await R(`/api/subscriptions/${N.id}/${v}`,{method:"POST"})).ok)N1()}catch(_){Z(`Failed to ${v} subscription`)}},C0=async(N)=>{try{if((await R(`/api/subscriptions/${N}`,{method:"DELETE"})).ok)N1()}catch(v){Z("Failed to delete subscription")}},w1=y.filter((N)=>{if(!o)return!0;let v=o.toLowerCase();return N.name.toLowerCase().includes(v)||N.slug.toLowerCase().includes(v)||N.description.toLowerCase().includes(v)}),o1=(N,v)=>{if(!v||N.length===0)return null;let _=v.toLowerCase().replace(/[-_]/g," "),f=N.find((q)=>q.appId?.toLowerCase()===v.toLowerCase()||q.appName?.toLowerCase()===v.toLowerCase());if(f)return f;let K=N.find((q)=>q.appId?.toLowerCase().includes(_)||q.appName?.toLowerCase().replace(/[-_]/g," ").includes(_)||_.includes(q.appId?.toLowerCase()||"")||_.includes(q.appName?.toLowerCase().replace(/[-_]/g," ")||""));if(K)return K;let L=_.split(/\s+/);return N.find((q)=>{let E=(q.appName||"").toLowerCase().replace(/[-_]/g," ").split(/\s+/);return L[0]&&E[0]&&L[0]===E[0]})||null},M=p.find((N)=>N.slug===t),r1=M?o1(A1,M.toolkit_slug):null,U1=S1?A1.find((N)=>N.id===S1)||r1:r1,s1=B&&C?o1(f1,B.toolkit_slug):null,m1=l1?f1.find((N)=>N.id===l1)||s1:s1,t1=$.default.useMemo(()=>{let N=new Map;for(let _ of Q1)if(_.logo)N.set(_.slug,_.logo);let v=new Map;for(let _ of p){let f=v.get(_.toolkit_slug);if(f)f.count++;else{let K=N.get(_.toolkit_slug)||_.logo||null;v.set(_.toolkit_slug,{slug:_.toolkit_slug,name:_.toolkit_name,logo:K,count:1})}}return Array.from(v.values()).sort((_,f)=>_.name.localeCompare(f.name))},[p,Q1]),e1=s?p.filter((N)=>N.toolkit_slug===s):[],d=t1.find((N)=>N.slug===s),N0=new Map(h.map((N)=>[N.id,N]));if(J.length===0&&!A)return m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-8 text-center",children:[m.jsxDEV("p",{className:"text-[#666]",children:"No trigger providers configured."},void 0,!1,void 0,this),m.jsxDEV("p",{className:"text-sm text-[#555] mt-1",children:"Add API keys for Composio or AgentDojo in Settings to enable triggers."},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return m.jsxDEV("div",{className:"space-y-6",children:[d1&&m.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:[m.jsxDEV("span",{children:d1},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:()=>Z(null),className:"text-red-400 hover:text-red-300",children:"x"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.length>1&&m.jsxDEV("div",{className:"flex items-center gap-2",children:[m.jsxDEV("span",{className:"text-xs text-[#666]",children:"Provider:"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex gap-1 bg-[#111] border border-[#1a1a1a] rounded-lg p-0.5",children:J.map((N)=>m.jsxDEV("button",{onClick:()=>{V(N.id),I([]),k(""),F1("")},className:`px-3 py-1 rounded text-xs font-medium transition ${Q===N.id?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:N.name},N.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!C&&m.jsxDEV("section",{children:[m.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[m.jsxDEV("h3",{className:"text-sm font-medium text-[#888]",children:["Subscriptions (",l.length,")"]},void 0,!0,void 0,this),m.jsxDEV("button",{onClick:()=>J1(!0),className:"text-xs bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-3 py-1.5 rounded transition",children:"+ Add Subscription"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l.length===0?m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-6 text-center text-[#666] text-sm",children:"No subscriptions yet. Add one to route trigger events to an agent."},void 0,!1,void 0,this):m.jsxDEV("div",{className:"space-y-2",children:l.map((N)=>{let v=N0.get(N.agent_id);return m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-3 flex items-center gap-3",children:[m.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${N.enabled?"bg-green-400":"bg-[#666]"}`},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex-1 min-w-0",children:[m.jsxDEV("div",{className:"text-sm font-medium truncate",children:[N.trigger_slug.replace(/_/g," "),m.jsxDEV("span",{className:"text-[#555] mx-1.5",children:"→"},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[#f97316]",children:v?.name||"Unknown Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"text-xs text-[#666]",children:N.trigger_instance_id?`Instance: ${N.trigger_instance_id.slice(0,12)}...`:"All instances"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex items-center gap-2 flex-shrink-0",children:[m.jsxDEV("button",{onClick:()=>w0(N),className:`text-xs px-3 py-1 rounded transition ${N.enabled?"bg-yellow-500/10 text-yellow-400 hover:bg-yellow-500/20":"bg-green-500/10 text-green-400 hover:bg-green-500/20"}`,children:N.enabled?"Disable":"Enable"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:()=>C0(N.id),className:"text-xs text-[#666] hover:text-red-400 transition px-2",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},N.id,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!C&&m.jsxDEV("section",{children:[m.jsxDEV("h3",{className:"text-sm font-medium text-[#888] mb-3",children:["Trigger Instances (",W.length,")"]},void 0,!0,void 0,this),A?m.jsxDEV("div",{className:"text-center py-6 text-[#666] text-sm",children:"Loading triggers..."},void 0,!1,void 0,this):W.length===0?m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-6 text-center text-[#666] text-sm",children:"No trigger instances. Browse trigger types below to create one."},void 0,!1,void 0,this):m.jsxDEV("div",{className:"space-y-2",children:W.map((N)=>m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-3 flex items-center gap-3",children:[m.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${N.status==="active"?"bg-green-400":"bg-[#666]"}`},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex-1 min-w-0",children:[m.jsxDEV("div",{className:"text-sm font-medium truncate",children:N.trigger_slug.replace(/_/g," ")},void 0,!1,void 0,this),m.jsxDEV("div",{className:"text-xs text-[#666]",children:["ID: ",N.id.slice(0,12),"... | Created: ",new Date(N.created_at).toLocaleDateString()]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex items-center gap-2 flex-shrink-0",children:[m.jsxDEV("button",{onClick:()=>g1(N.id,N.status),className:`text-xs px-3 py-1 rounded transition ${N.status==="active"?"bg-yellow-500/10 text-yellow-400 hover:bg-yellow-500/20":"bg-green-500/10 text-green-400 hover:bg-green-500/20"}`,children:N.status==="active"?"Disable":"Enable"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:()=>j1(N.id),className:"text-xs text-[#666] hover:text-red-400 transition px-2",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},N.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C&&m.jsxDEV("section",{children:[m.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[m.jsxDEV("h3",{className:"text-sm font-medium text-[#888]",children:["Active Subscriptions (",W.length,")"]},void 0,!0,void 0,this),m.jsxDEV("button",{onClick:M0,className:"text-xs bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-3 py-1.5 rounded transition",children:"+ Add Subscription"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A?m.jsxDEV("div",{className:"text-center py-6 text-[#666] text-sm",children:"Loading subscriptions..."},void 0,!1,void 0,this):W.length===0?m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-6 text-center text-[#666] text-sm",children:"No active subscriptions. Browse trigger types below to create one."},void 0,!1,void 0,this):m.jsxDEV("div",{className:"space-y-2",children:W.map((N)=>{let v=l.find((f)=>f.trigger_instance_id===N.id),_=v?N0.get(v.agent_id):null;return m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-3 flex items-center gap-3",children:[m.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${N.status==="active"?"bg-green-400":"bg-[#666]"}`},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex-1 min-w-0",children:[m.jsxDEV("div",{className:"text-sm font-medium truncate",children:[N.config?.title||N.trigger_slug.replace(/_/g," "),_&&m.jsxDEV(m.Fragment,{children:[m.jsxDEV("span",{className:"text-[#555] mx-1.5",children:"→"},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[#f97316]",children:_.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"text-xs text-[#666]",children:[N.config?.server&&m.jsxDEV("span",{children:[String(N.config.server)," | "]},void 0,!0,void 0,this),"ID: ",String(N.id).slice(0,8)," | Created: ",new Date(N.created_at).toLocaleDateString()]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex items-center gap-2 flex-shrink-0",children:[m.jsxDEV("button",{onClick:()=>g1(N.id,N.status),className:`text-xs px-3 py-1 rounded transition ${N.status==="active"?"bg-yellow-500/10 text-yellow-400 hover:bg-yellow-500/20":"bg-green-500/10 text-green-400 hover:bg-green-500/20"}`,children:N.status==="active"?"Disable":"Enable"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:()=>j1(N.id),className:"text-xs text-[#666] hover:text-red-400 transition px-2",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},N.id,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("section",{children:[m.jsxDEV("h3",{className:"text-sm font-medium text-[#888] mb-3",children:"Browse Trigger Types"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex gap-2 mb-3",children:[m.jsxDEV("input",{type:"text",value:b,onChange:(N)=>k(N.target.value),placeholder:"Toolkit filter (e.g. github, gmail, slack)",className:"flex-1 bg-[#111] border border-[#333] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:()=>Q0(b||void 0),disabled:a,className:"text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-4 py-2 rounded transition disabled:opacity-50",children:a?"Loading...":"Browse"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y.length>0&&m.jsxDEV(m.Fragment,{children:[m.jsxDEV("input",{type:"text",value:o,onChange:(N)=>F1(N.target.value),placeholder:"Search trigger types...",className:"w-full bg-[#111] border border-[#333] rounded px-3 py-2 text-sm mb-3 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:w1.slice(0,30).map((N)=>m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] hover:border-[#333] rounded-lg p-3 transition",children:[m.jsxDEV("div",{className:"flex items-start gap-3",children:[N.logo?m.jsxDEV("img",{src:N.logo,alt:N.toolkit_name,className:"w-8 h-8 rounded object-contain flex-shrink-0"},void 0,!1,void 0,this):m.jsxDEV("div",{className:"w-8 h-8 rounded bg-[#1a1a1a] flex items-center justify-center text-xs flex-shrink-0",children:N.toolkit_name?.[0]?.toUpperCase()||"?"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex-1 min-w-0",children:[m.jsxDEV("div",{className:"text-sm font-medium truncate",children:N.name},void 0,!1,void 0,this),m.jsxDEV("div",{className:"text-xs text-[#666]",children:N.toolkit_name},void 0,!1,void 0,this),m.jsxDEV("div",{className:"text-xs text-[#555] mt-1 line-clamp-2",children:N.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("button",{onClick:()=>B0(N),className:"w-full mt-3 text-xs bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-3 py-1.5 rounded transition",children:C?"Subscribe":"Create Trigger"},void 0,!1,void 0,this)]},N.slug,!0,void 0,this))},void 0,!1,void 0,this),w1.length>30&&m.jsxDEV("p",{className:"text-xs text-[#555] mt-3 text-center",children:["Showing first 30 of ",w1.length," types. Use search to filter."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),R0&&B&&m.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:m.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-md mx-4",children:[m.jsxDEV("h3",{className:"font-medium mb-1",children:C?"Create Subscription":"Create Trigger"},void 0,!1,void 0,this),m.jsxDEV("p",{className:"text-xs text-[#666] mb-4",children:[B.name,B.toolkit_name&&m.jsxDEV("span",{className:"text-[#555]",children:[" (",B.toolkit_name,")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"space-y-4",children:[!C&&m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Connected Account"},void 0,!1,void 0,this),f1.length===0?m.jsxDEV("div",{className:"text-xs text-[#666] bg-[#0a0a0a] rounded p-3",children:"No connected accounts available. Connect an app first in the Integrations tab."},void 0,!1,void 0,this):m.jsxDEV(x,{value:$1,onChange:I1,placeholder:"Select account...",options:f1.map((N)=>({value:N.id,label:`${N.appName} (${N.id.slice(0,8)}...)`}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C&&m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Route to Agent"},void 0,!1,void 0,this),h.length===0?m.jsxDEV("div",{className:"text-xs text-[#666] bg-[#0a0a0a] rounded p-3",children:"No agents available. Create an agent first."},void 0,!1,void 0,this):m.jsxDEV(x,{value:r,onChange:n1,placeholder:"Select agent...",options:h.map((N)=>({value:N.id,label:`${N.name} (${N.status})`}))},void 0,!1,void 0,this),m.jsxDEV("div",{className:"mt-3",children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Connected Account"},void 0,!1,void 0,this),m1?m.jsxDEV("div",{className:"text-xs text-green-400 bg-green-500/10 border border-green-500/20 rounded p-3",children:["Connected: ",m1.appName]},void 0,!0,void 0,this):m.jsxDEV("div",{className:"text-xs text-yellow-400 bg-yellow-500/10 border border-yellow-500/20 rounded p-3",children:["No connected account for ",B?.toolkit_name||"this app",". Connect it first in the Integrations tab."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),B.config_schema&&Object.keys(B.config_schema.properties||{}).length>0&&m.jsxDEV("div",{className:"mt-3",children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Configuration"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"space-y-2",children:Object.entries(B.config_schema.properties||{}).map(([N,v])=>{let _=(B.config_schema.required||[]).includes(N);return m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-[11px] text-[#888] mb-1",children:[v.title||N,_&&m.jsxDEV("span",{className:"text-red-400 ml-0.5",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("input",{type:"text",value:Z1[N]||"",onChange:(f)=>P1((K)=>({...K,[N]:f.target.value})),placeholder:v.description||`Enter ${v.title||N}...`,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},N,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex gap-2 mt-4",children:[m.jsxDEV("button",{onClick:()=>{v1(!1),_1(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),m.jsxDEV("button",{onClick:L0,disabled:C?!r||!m1||Y1||B?.config_schema&&(B.config_schema.required||[]).some((N)=>!Z1[N]?.trim()):!$1||Y1,className:"flex-1 text-sm bg-[#f97316] hover:bg-[#ea580c] text-white px-4 py-2 rounded transition disabled:opacity-50",children:Y1?"Creating...":C?"Subscribe":"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),Z0&&m.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:m.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-md mx-4",children:[m.jsxDEV("h3",{className:"font-medium mb-1",children:"Route Trigger to Agent"},void 0,!1,void 0,this),m.jsxDEV("p",{className:"text-xs text-[#666] mb-4",children:W.length===0?"No trigger instances yet. Create one first from the Browse section below.":"Select a trigger instance and the agent that should handle its events."},void 0,!1,void 0,this),W.length>0?m.jsxDEV(m.Fragment,{children:[m.jsxDEV("div",{className:"space-y-4",children:[m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Trigger Instance"},void 0,!1,void 0,this),m.jsxDEV(x,{value:c,onChange:L1,placeholder:"Select trigger...",options:W.map((N)=>({value:N.id,label:`${N.trigger_slug.replace(/_/g," ")}`}))},void 0,!1,void 0,this),c&&m.jsxDEV("div",{className:"text-xs text-[#555] mt-1 font-mono",children:["ID: ",c.slice(0,16),"..."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Target Agent"},void 0,!1,void 0,this),m.jsxDEV(x,{value:K1,onChange:b1,placeholder:"Select agent...",options:h.map((N)=>({value:N.id,label:`${N.name} (${N.status})`}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex gap-2 mt-5",children:[m.jsxDEV("button",{onClick:()=>{J1(!1),L1(""),b1("")},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),m.jsxDEV("button",{onClick:b0,disabled:!c||!K1||V1,className:"flex-1 text-sm bg-[#f97316] hover:bg-[#ea580c] text-white px-4 py-2 rounded transition disabled:opacity-50",children:V1?"Adding...":"Add"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):m.jsxDEV("div",{className:"flex gap-2 mt-4",children:m.jsxDEV("button",{onClick:()=>J1(!1),className:"flex-1 text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] px-4 py-2 rounded transition",children:"Close"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H0&&m.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:m.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-lg mx-4",children:[m.jsxDEV("h3",{className:"font-medium mb-1",children:"Add Subscription"},void 0,!1,void 0,this),m.jsxDEV("p",{className:"text-xs text-[#666] mb-4",children:"Select an app and trigger, then route it to an agent."},void 0,!1,void 0,this),K0?m.jsxDEV("div",{className:"text-center py-8 text-[#666] text-sm",children:"Loading..."},void 0,!1,void 0,this):p.length===0?m.jsxDEV("div",{className:"text-center py-8 text-[#666] text-sm",children:"No triggers available. Connect an app first in the Integrations tab."},void 0,!1,void 0,this):m.jsxDEV("div",{className:"space-y-4",children:[m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"App"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"relative",children:[m.jsxDEV("button",{onClick:()=>{G1(!a1),H1(!1),p1("")},className:"w-full flex items-center gap-2 bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 text-sm text-left hover:border-[#555] transition",children:[d?m.jsxDEV(m.Fragment,{children:[d.logo?m.jsxDEV("img",{src:d.logo,alt:"",className:"w-5 h-5 rounded object-contain flex-shrink-0"},void 0,!1,void 0,this):m.jsxDEV("div",{className:"w-5 h-5 rounded bg-[#1a1a1a] flex items-center justify-center text-[10px] flex-shrink-0",children:d.name?.[0]?.toUpperCase()||"?"},void 0,!1,void 0,this),m.jsxDEV("span",{className:"flex-1 truncate",children:d.name},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[10px] text-[#666]",children:[d.count," triggers"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):m.jsxDEV("span",{className:"text-[#666] flex-1",children:"Select app..."},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[#666] text-xs ml-1",children:"▾"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a1&&m.jsxDEV(m.Fragment,{children:[m.jsxDEV("div",{className:"fixed inset-0 z-10",onClick:()=>G1(!1)},void 0,!1,void 0,this),m.jsxDEV("div",{className:"absolute left-0 right-0 top-full mt-1 bg-[#0a0a0a] border border-[#333] rounded-lg shadow-xl z-20 max-h-64 flex flex-col",children:[m.jsxDEV("div",{className:"p-2 border-b border-[#1a1a1a] flex-shrink-0",children:m.jsxDEV("input",{type:"text",value:M1,onChange:(N)=>p1(N.target.value),placeholder:"Search apps...",className:"w-full bg-[#111] border border-[#333] rounded px-2 py-1.5 text-sm focus:outline-none focus:border-[#f97316]",autoFocus:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),m.jsxDEV("div",{className:"overflow-y-auto flex-1",children:t1.filter((N)=>{if(!M1)return!0;let v=M1.toLowerCase();return N.name.toLowerCase().includes(v)||N.slug.toLowerCase().includes(v)}).map((N)=>m.jsxDEV("button",{onClick:()=>{y1(N.slug),W1(""),z1({}),G1(!1)},className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition hover:bg-[#1a1a1a] ${s===N.slug?"bg-[#1a1a1a] text-[#f97316]":""}`,children:[N.logo?m.jsxDEV("img",{src:N.logo,alt:"",className:"w-5 h-5 rounded object-contain flex-shrink-0"},void 0,!1,void 0,this):m.jsxDEV("div",{className:"w-5 h-5 rounded bg-[#1a1a1a] flex items-center justify-center text-[10px] flex-shrink-0",children:N.name?.[0]?.toUpperCase()||"?"},void 0,!1,void 0,this),m.jsxDEV("span",{className:"flex-1 truncate",children:N.name},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[10px] text-[#666]",children:N.count},void 0,!1,void 0,this)]},N.slug,!0,void 0,this))},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,!0,void 0,this),s&&m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Trigger"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"relative",children:[m.jsxDEV("button",{onClick:()=>{H1(!u1),G1(!1),x1("")},className:"w-full flex items-center gap-2 bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 text-sm text-left hover:border-[#555] transition",children:[M?m.jsxDEV(m.Fragment,{children:[m.jsxDEV("span",{className:"flex-1 truncate",children:M.name},void 0,!1,void 0,this),m.jsxDEV("span",{className:`text-[10px] px-1.5 py-0.5 rounded flex-shrink-0 ${M.type==="webhook"?"bg-blue-500/10 text-blue-400":"bg-yellow-500/10 text-yellow-400"}`,children:M.type},void 0,!1,void 0,this)]},void 0,!0,void 0,this):m.jsxDEV("span",{className:"text-[#666] flex-1",children:"Select trigger..."},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[#666] text-xs ml-1",children:"▾"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u1&&m.jsxDEV(m.Fragment,{children:[m.jsxDEV("div",{className:"fixed inset-0 z-10",onClick:()=>H1(!1)},void 0,!1,void 0,this),m.jsxDEV("div",{className:"absolute left-0 right-0 top-full mt-1 bg-[#0a0a0a] border border-[#333] rounded-lg shadow-xl z-20 max-h-64 flex flex-col",children:[e1.length>3&&m.jsxDEV("div",{className:"p-2 border-b border-[#1a1a1a] flex-shrink-0",children:m.jsxDEV("input",{type:"text",value:O1,onChange:(N)=>x1(N.target.value),placeholder:"Search triggers...",className:"w-full bg-[#111] border border-[#333] rounded px-2 py-1.5 text-sm focus:outline-none focus:border-[#f97316]",autoFocus:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),m.jsxDEV("div",{className:"overflow-y-auto flex-1",children:e1.filter((N)=>{if(!O1)return!0;let v=O1.toLowerCase();return N.name.toLowerCase().includes(v)||N.slug.toLowerCase().includes(v)||N.description.toLowerCase().includes(v)}).map((N)=>m.jsxDEV("button",{onClick:()=>{W1(N.slug),z1({}),H1(!1)},className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition hover:bg-[#1a1a1a] ${t===N.slug?"bg-[#1a1a1a] text-[#f97316]":""}`,children:[m.jsxDEV("div",{className:"flex-1 min-w-0",children:[m.jsxDEV("div",{className:"truncate",children:N.name},void 0,!1,void 0,this),m.jsxDEV("div",{className:"text-[10px] text-[#666] truncate",children:N.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("span",{className:`text-[10px] px-1.5 py-0.5 rounded flex-shrink-0 ${N.type==="webhook"?"bg-blue-500/10 text-blue-400":"bg-yellow-500/10 text-yellow-400"}`,children:N.type},void 0,!1,void 0,this)]},N.slug,!0,void 0,this))},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,!0,void 0,this),t&&m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Connected Account"},void 0,!1,void 0,this),U1?m.jsxDEV("div",{className:"text-xs text-green-400 bg-green-500/10 border border-green-500/20 rounded p-3",children:["Connected: ",U1.appName]},void 0,!0,void 0,this):m.jsxDEV("div",{className:"text-xs text-yellow-400 bg-yellow-500/10 border border-yellow-500/20 rounded p-3",children:["No connected account for ",M?.toolkit_name||"this app",". Connect it first in the Integrations tab."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),M&&M.config_schema&&Object.keys(M.config_schema.properties||{}).length>0&&m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Configuration"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"space-y-2",children:Object.entries(M.config_schema.properties||{}).map(([N,v])=>{let _=(M.config_schema.required||[]).includes(N);return m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-[11px] text-[#888] mb-1",children:[v.title||N,_&&m.jsxDEV("span",{className:"text-red-400 ml-0.5",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("input",{type:"text",value:B1[N]||"",onChange:(f)=>z1((K)=>({...K,[N]:f.target.value})),placeholder:v.description||`Enter ${v.title||N}...`,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},N,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Target Agent"},void 0,!1,void 0,this),h.length===0?m.jsxDEV("div",{className:"text-xs text-[#666] bg-[#0a0a0a] rounded p-3",children:"No agents available. Create an agent first."},void 0,!1,void 0,this):m.jsxDEV(x,{value:e,onChange:h1,placeholder:"Select agent...",options:h.map((N)=>({value:N.id,label:`${N.name} (${N.status})`}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex gap-2 mt-5",children:[m.jsxDEV("button",{onClick:()=>q1(!1),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),m.jsxDEV("button",{onClick:O0,disabled:!t||!e||!U1||i1||M?.config_schema&&(M.config_schema.required||[]).some((N)=>!B1[N]?.trim()),className:"flex-1 text-sm bg-[#f97316] hover:bg-[#ea580c] text-white px-4 py-2 rounded transition disabled:opacity-50",children:i1?"Creating...":"Subscribe"},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)}var P=O(X1(),1);var z=O(n(),1);function f0(){let{authFetch:R}=g(),{currentProjectId:H}=j(),J=H&&H!=="unassigned"?H:null,F=J?`?project_id=${J}`:"",[Q,V]=P.useState([]),[W,T]=P.useState("");P.useEffect(()=>{R(`/api/triggers/providers${F}`).then((G)=>G.json()).then((G)=>{let b=(G.providers||[]).filter((k)=>k.connected);if(V(b),b.length>0&&!b.find((k)=>k.id===W))T(b[0].id)}).catch(()=>{})},[R]);let[A,S]=P.useState(null),[l,Y]=P.useState([]),[y,I]=P.useState(!1),a=P.useCallback(async(G)=>{S(G),I(!0);try{let b=`/api/triggers/types?provider=${W}&toolkit_slugs=${G}`;if(J)b+=`&project_id=${J}`;let k=await R(b);if(k.ok){let o=await k.json();Y(o.types||[])}}catch(b){console.error("Failed to fetch trigger types:",b)}I(!1)},[R,J,W]);return z.jsxDEV("div",{children:[z.jsxDEV("p",{className:"text-sm text-[#666] mb-4",children:"Connect external apps via OAuth or API Key. Connected apps can be used for triggers and MCP integrations."},void 0,!1,void 0,this),Q.length>1&&z.jsxDEV("div",{className:"flex items-center gap-2 mb-4",children:[z.jsxDEV("span",{className:"text-xs text-[#666]",children:"Provider:"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex gap-1 bg-[#111] border border-[#1a1a1a] rounded-lg p-0.5",children:Q.map((G)=>z.jsxDEV("button",{onClick:()=>T(G.id),className:`px-3 py-1 rounded text-xs font-medium transition ${W===G.id?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:G.name},G.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q.length===0?z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-8 text-center",children:[z.jsxDEV("p",{className:"text-[#666]",children:"No integration providers configured."},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-[#555] mt-1",children:"Add API keys for Composio or AgentDojo in Settings."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):z.jsxDEV(_0,{providerId:W,projectId:J,hideMcpConfig:!0,onBrowseTriggers:a},void 0,!1,void 0,this),A&&z.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:z.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg w-full max-w-2xl mx-4 max-h-[80vh] flex flex-col",children:[z.jsxDEV("div",{className:"p-4 border-b border-[#1a1a1a] flex items-center justify-between",children:[z.jsxDEV("div",{children:[z.jsxDEV("h3",{className:"font-medium",children:"Trigger Types"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#666]",children:A},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("button",{onClick:()=>{S(null),Y([])},className:"text-[#666] hover:text-white transition text-lg px-2",children:"x"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex-1 overflow-auto p-4",children:y?z.jsxDEV("div",{className:"text-center py-8 text-[#666]",children:"Loading trigger types..."},void 0,!1,void 0,this):l.length===0?z.jsxDEV("div",{className:"text-center py-8 text-[#666]",children:"No trigger types available for this app."},void 0,!1,void 0,this):z.jsxDEV("div",{className:"space-y-2",children:l.map((G)=>z.jsxDEV("div",{className:"bg-[#0a0a0a] border border-[#1a1a1a] rounded-lg p-3",children:z.jsxDEV("div",{className:"flex items-start gap-3",children:[G.logo?z.jsxDEV("img",{src:G.logo,alt:G.toolkit_name,className:"w-6 h-6 rounded object-contain flex-shrink-0 mt-0.5"},void 0,!1,void 0,this):z.jsxDEV("div",{className:"w-6 h-6 rounded bg-[#1a1a1a] flex items-center justify-center text-[10px] flex-shrink-0 mt-0.5",children:G.toolkit_name?.[0]?.toUpperCase()||"?"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex-1 min-w-0",children:[z.jsxDEV("div",{className:"text-sm font-medium",children:G.name},void 0,!1,void 0,this),z.jsxDEV("div",{className:"text-xs text-[#666] mt-0.5",children:G.description},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-2 mt-1.5",children:[z.jsxDEV("span",{className:"text-[10px] bg-[#1a1a1a] text-[#555] px-1.5 py-0.5 rounded font-mono",children:G.slug},void 0,!1,void 0,this),z.jsxDEV("span",{className:`text-[10px] px-1.5 py-0.5 rounded ${G.type==="webhook"?"bg-blue-500/10 text-blue-400":"bg-yellow-500/10 text-yellow-400"}`,children:G.type},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},G.slug,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var w=O(n(),1);function JN(){let[R,H]=$0.useState("overview");return w.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:w.jsxDEV("div",{className:"max-w-6xl",children:[w.jsxDEV("div",{className:"flex items-center justify-between mb-6",children:w.jsxDEV("div",{children:[w.jsxDEV("h1",{className:"text-2xl font-semibold mb-1",children:"Connections"},void 0,!1,void 0,this),w.jsxDEV("p",{className:"text-[#666]",children:"Manage external app connections, triggers, and webhooks."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),w.jsxDEV("div",{className:"flex gap-1 mb-6 bg-[#111] border border-[#1a1a1a] rounded-lg p-1 w-fit",children:[{id:"overview",label:"Overview"},{id:"triggers",label:"Triggers"},{id:"integrations",label:"Integrations"}].map((F)=>w.jsxDEV("button",{onClick:()=>H(F.id),className:`px-4 py-2 rounded text-sm font-medium transition ${R===F.id?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:F.label},F.id,!1,void 0,this))},void 0,!1,void 0,this),R==="overview"&&w.jsxDEV(m0,{},void 0,!1,void 0,this),R==="triggers"&&w.jsxDEV(v0,{},void 0,!1,void 0,this),R==="integrations"&&w.jsxDEV(f0,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}
2
- export{I0 as a,JN as b};
3
-
4
- //# debugId=59BAB8E2425680DC64756E2164756E21
@@ -1,4 +0,0 @@
1
- import{S as d,V as _q,W as qq,ca as Hq}from"./App.mvtqv6qc.js";var U=d(_q(),1);var q=d(qq(),1);function i(J){return J.authSchemes.some((Q)=>Q.toUpperCase()==="API_KEY")}function Jq(J){return J.authSchemes.some((Q)=>Q.toUpperCase()==="OAUTH2")}function $q(J){return i(J)&&Jq(J)}function Rq({providerId:J="composio",projectId:Q,onConnectionComplete:k,onBrowseTriggers:F,hideMcpConfig:K}){let{authFetch:Y}=Hq(),[y,R]=U.useState([]),[L,P]=U.useState([]),[M,N]=U.useState(!0),[m,Qq]=U.useState(""),[A,B]=U.useState(null),[O,l]=U.useState(null),[r,X]=U.useState(null),[_,I]=U.useState(null),[$,b]=U.useState(null),[f,u]=U.useState(""),[w,V]=U.useState(null),[v,c]=U.useState(""),[s,g]=U.useState(!1),[n,x]=U.useState(null),[C,D]=U.useState(null),G=U.useCallback(async()=>{N(!0),X(null);let z=Q&&Q!=="unassigned"?`?project_id=${Q}`:"";try{let[H,W]=await Promise.all([Y(`/api/integrations/${J}/apps${z}`),Y(`/api/integrations/${J}/connected${z}`)]),Z=await H.json(),j=await W.json();R(Z.apps||[]),P(j.accounts||[])}catch(H){console.error("Failed to fetch integrations:",H),X("Failed to load integrations")}N(!1)},[Y,J,Q]);U.useEffect(()=>{G()},[G]),U.useEffect(()=>{if(new URLSearchParams(window.location.search).get("connected"))window.history.replaceState({},"",window.location.pathname),G(),k?.()},[G,k]),U.useEffect(()=>{if(!O?.connectionId)return;let z=Q&&Q!=="unassigned"?`?project_id=${Q}`:"",H=setInterval(async()=>{try{let Z=await(await Y(`/api/integrations/${J}/connection/${O.connectionId}${z}`)).json();if(Z.connection?.status==="active")l(null),B(null),G(),k?.();else if(Z.connection?.status==="failed")l(null),B(null),X(`Connection to ${O.appSlug} failed`)}catch(W){}},2000);return()=>clearInterval(H)},[O,Y,J,Q,G,k]);let h=async(z,H,W)=>{if($q(z)&&!H&&!W){I({app:z});return}if(i(z)&&!H&&!W){b({app:z}),u("");return}B(z.slug),X(null);try{let Z={appSlug:z.slug};if(H)Z.credentials={authScheme:"API_KEY",apiKey:H};let j=Q&&Q!=="unassigned"?`?project_id=${Q}`:"",p=await Y(`/api/integrations/${J}/connect${j}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Z)}),T=await p.json();if(!p.ok){X(T.error||"Failed to initiate connection"),B(null),b(null);return}if(T.status==="active"||!T.redirectUrl){B(null),b(null),G(),k?.();return}if(T.redirectUrl){l({appSlug:z.slug,connectionId:T.connectionId});let e=window.open(T.redirectUrl,`connect-${z.slug}`,"width=600,height=700,left=200,top=100");if(!e||e.closed)window.location.href=T.redirectUrl}}catch(Z){X(`Failed to connect: ${Z}`),B(null),b(null)}},Uq=(z)=>{if(z.preventDefault(),!$||!f.trim())return;h($.app,f.trim())},Wq=async(z)=>{let H=Q&&Q!=="unassigned"?`?project_id=${Q}`:"";try{let W=await Y(`/api/integrations/${J}/connection/${z.id}${H}`,{method:"DELETE"});if(W.ok)G();else{let Z=await W.json();X(Z.error||"Failed to disconnect")}}catch(W){X(`Failed to disconnect: ${W}`)}},Xq=(z)=>{V({app:z}),c(`${z.name} MCP`),x(null)},Yq=async()=>{if(!w||!v.trim())return;g(!0),X(null);try{let z=Q&&Q!=="unassigned"?`?project_id=${Q}`:"",H=await Y(`/api/integrations/${J}/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:w.app.slug})}),W=await H.json();if(!H.ok){X(W.error||"Failed to create MCP config"),g(!1);return}x(v),k?.()}catch(z){X(`Failed to create MCP config: ${z}`)}finally{g(!1)}},Zq=(z)=>{D({message:`Disconnect ${z.appName}?`,onConfirm:()=>{Wq(z),D(null)}})},a=(z)=>{return L.some((H)=>H.appId===z&&H.status==="active")},t=(z)=>{return L.find((H)=>H.appId===z&&H.status==="active")||L.find((H)=>H.appId===z)},o=y.filter((z)=>{if(!m)return!0;let H=m.toLowerCase();return z.name.toLowerCase().includes(H)||z.slug.toLowerCase().includes(H)||z.description?.toLowerCase().includes(H)||z.categories.some((W)=>W.toLowerCase().includes(H))}),E=o.filter((z)=>a(z.slug)),S=o.filter((z)=>!a(z.slug));if(M)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:[_&&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:[_.app.logo&&q.jsxDEV("img",{src:_.app.logo,alt:_.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 ",_.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:()=>{I(null),b({app:_.app}),u("")},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 ",_.app.name," API key directly"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:()=>{I(null),h(_.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 ",_.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:()=>I(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),$&&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:[$.app.logo&&q.jsxDEV("img",{src:$.app.logo,alt:$.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 ",$.app.name]},void 0,!0,void 0,this),q.jsxDEV("p",{className:"text-xs text-[#666]",children:"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:Uq,children:[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:()=>b(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:!f.trim()||A===$.app.slug,className:"flex-1 text-sm bg-[#f97316] hover:bg-[#ea580c] text-white px-4 py-2 rounded transition disabled:opacity-50",children:A===$.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),w&&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:n?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:['"',n,'" has been created successfully.']},void 0,!0,void 0,this),q.jsxDEV("p",{className:"text-xs text-[#666] mt-2",children:"You can now add it to your agents from the MCP Configs tab."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:()=>{V(null),x(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:[w.app.logo&&q.jsxDEV("img",{src:w.app.logo,alt:w.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 ",w.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(),Yq()},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)=>c(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:()=>V(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()||s,className:"flex-1 text-sm bg-[#f97316] hover:bg-[#ea580c] text-white px-4 py-2 rounded transition disabled:opacity-50",children:s?"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),C&&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:C.message},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex gap-2",children:[q.jsxDEV("button",{onClick:()=>D(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:C.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),r&&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:r},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>X(null),className:"text-red-400 hover:text-red-300",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),O&&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 ",O.appSlug," authorization..."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:q.jsxDEV("input",{type:"text",value:m,onChange:(z)=>Qq(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),E.length>0&&q.jsxDEV("div",{children:[q.jsxDEV("h3",{className:"text-sm font-medium text-[#888] mb-3",children:["Connected (",E.length,")"]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:E.map((z)=>q.jsxDEV(zq,{app:z,connection:t(z.slug),onConnect:()=>h(z),onDisconnect:()=>{let H=t(z.slug);if(H)Zq(H)},onCreateMcpConfig:K?void 0:()=>Xq(z),onBrowseTriggers:F?()=>F(z.slug):void 0,connecting:A===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 (",S.length,")"]},void 0,!0,void 0,this),S.length===0?q.jsxDEV("p",{className:"text-[#666] text-sm",children:m?"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:S.slice(0,50).map((z)=>q.jsxDEV(zq,{app:z,onConnect:()=>h(z),connecting:A===z.slug},z.id,!1,void 0,this))},void 0,!1,void 0,this),S.length>50&&q.jsxDEV("p",{className:"text-xs text-[#555] mt-3 text-center",children:["Showing first 50 of ",S.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 zq({app:J,connection:Q,onConnect:k,onDisconnect:F,onCreateMcpConfig:K,onBrowseTriggers:Y,connecting:y}){let R=Q?.status==="active",L=i(J),P=Jq(J),M=L&&P;return q.jsxDEV("div",{className:`bg-[#111] border rounded-lg p-3 transition ${R?"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:J.logo?q.jsxDEV("img",{src:J.logo,alt:J.name,className:"w-8 h-8 object-contain",onError:(N)=>{N.target.style.display="none"}},void 0,!1,void 0,this):q.jsxDEV("span",{className:"text-lg",children:J.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:J.name},void 0,!1,void 0,this),R&&q.jsxDEV("span",{className:"text-xs text-green-400",children:"✓"},void 0,!1,void 0,this),!R&&L&&!P&&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),!R&&M&&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),J.description&&q.jsxDEV("p",{className:"text-xs text-[#666] line-clamp-2 mt-0.5",children:J.description},void 0,!1,void 0,this),J.categories.length>0&&q.jsxDEV("div",{className:"flex flex-wrap gap-1 mt-1",children:J.categories.slice(0,2).map((N)=>q.jsxDEV("span",{className:"text-[10px] bg-[#1a1a1a] text-[#555] px-1.5 py-0.5 rounded",children:N},N,!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:R?q.jsxDEV(q.Fragment,{children:[K&&q.jsxDEV("button",{onClick:K,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),Y&&q.jsxDEV("button",{onClick:Y,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),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:k,disabled:y,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:y?"Connecting...":L&&!P?"Enter API Key":"Connect"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}
2
- export{Rq as k};
3
-
4
- //# debugId=879C1544186FFE2D64756E2164756E21
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/web/components/mcp/IntegrationsPanel.tsx"],
4
- "sourcesContent": [
5
- "import React, { useState, useEffect, useCallback } from \"react\";\nimport { useAuth } from \"../../context\";\n\n// Types\ninterface IntegrationApp {\n id: string;\n name: string;\n slug: string;\n description: string | null;\n logo: string | null;\n categories: string[];\n authSchemes: string[];\n}\n\ninterface ConnectedAccount {\n id: string;\n appId: string;\n appName: string;\n status: \"active\" | \"pending\" | \"failed\" | \"expired\";\n createdAt: string;\n}\n\ninterface IntegrationProvider {\n id: string;\n name: string;\n connected: boolean;\n}\n\n// Check if app supports API_KEY auth\nfunction supportsApiKey(app: IntegrationApp): boolean {\n return app.authSchemes.some(s => s.toUpperCase() === \"API_KEY\");\n}\n\n// Check if app supports OAuth\nfunction supportsOAuth(app: IntegrationApp): boolean {\n return app.authSchemes.some(s => s.toUpperCase() === \"OAUTH2\");\n}\n\n// Check if app supports multiple auth methods\nfunction hasMultipleAuthMethods(app: IntegrationApp): boolean {\n return supportsApiKey(app) && supportsOAuth(app);\n}\n\n// Main component\nexport function IntegrationsPanel({\n providerId = \"composio\",\n projectId,\n onConnectionComplete,\n onBrowseTriggers,\n hideMcpConfig,\n}: {\n providerId?: string;\n projectId?: string | null;\n onConnectionComplete?: () => void;\n onBrowseTriggers?: (toolkitSlug: string) => void;\n hideMcpConfig?: boolean;\n}) {\n const { authFetch } = useAuth();\n const [apps, setApps] = useState<IntegrationApp[]>([]);\n const [connectedAccounts, setConnectedAccounts] = useState<ConnectedAccount[]>([]);\n const [loading, setLoading] = useState(true);\n const [search, setSearch] = useState(\"\");\n const [connecting, setConnecting] = useState<string | null>(null);\n const [pendingConnection, setPendingConnection] = useState<{\n appSlug: string;\n connectionId?: string;\n } | null>(null);\n const [error, setError] = useState<string | null>(null);\n // For auth method selection (when app supports both OAuth and API Key)\n const [authMethodModal, setAuthMethodModal] = useState<{ app: IntegrationApp } | null>(null);\n // For API Key modal\n const [apiKeyModal, setApiKeyModal] = useState<{ app: IntegrationApp } | null>(null);\n const [apiKeyInput, setApiKeyInput] = useState(\"\");\n // For MCP config creation modal\n const [mcpConfigModal, setMcpConfigModal] = useState<{ app: IntegrationApp } | null>(null);\n const [mcpConfigName, setMcpConfigName] = useState(\"\");\n const [mcpConfigCreating, setMcpConfigCreating] = useState(false);\n const [mcpConfigSuccess, setMcpConfigSuccess] = useState<string | null>(null);\n // For confirmation modal\n const [confirmModal, setConfirmModal] = useState<{\n message: string;\n onConfirm: () => void;\n } | null>(null);\n\n // Fetch apps and connected accounts\n const fetchData = useCallback(async () => {\n setLoading(true);\n setError(null);\n const projectParam = projectId && projectId !== \"unassigned\" ? `?project_id=${projectId}` : \"\";\n try {\n const [appsRes, connectedRes] = await Promise.all([\n authFetch(`/api/integrations/${providerId}/apps${projectParam}`),\n authFetch(`/api/integrations/${providerId}/connected${projectParam}`),\n ]);\n\n const appsData = await appsRes.json();\n const connectedData = await connectedRes.json();\n\n setApps(appsData.apps || []);\n setConnectedAccounts(connectedData.accounts || []);\n } catch (e) {\n console.error(\"Failed to fetch integrations:\", e);\n setError(\"Failed to load integrations\");\n }\n setLoading(false);\n }, [authFetch, providerId, projectId]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n // Check for connection completion from URL params\n useEffect(() => {\n const params = new URLSearchParams(window.location.search);\n const connectedApp = params.get(\"connected\");\n if (connectedApp) {\n // Remove the query param\n window.history.replaceState({}, \"\", window.location.pathname);\n // Refresh to show new connection\n fetchData();\n onConnectionComplete?.();\n }\n }, [fetchData, onConnectionComplete]);\n\n // Poll for pending connection status\n useEffect(() => {\n if (!pendingConnection?.connectionId) return;\n const projectParam = projectId && projectId !== \"unassigned\" ? `?project_id=${projectId}` : \"\";\n\n const pollInterval = setInterval(async () => {\n try {\n const res = await authFetch(\n `/api/integrations/${providerId}/connection/${pendingConnection.connectionId}${projectParam}`\n );\n const data = await res.json();\n\n if (data.connection?.status === \"active\") {\n setPendingConnection(null);\n setConnecting(null);\n fetchData();\n onConnectionComplete?.();\n } else if (data.connection?.status === \"failed\") {\n setPendingConnection(null);\n setConnecting(null);\n setError(`Connection to ${pendingConnection.appSlug} failed`);\n }\n } catch (e) {\n // Keep polling\n }\n }, 2000);\n\n return () => clearInterval(pollInterval);\n }, [pendingConnection, authFetch, providerId, projectId, fetchData, onConnectionComplete]);\n\n // Initiate connection\n const connectApp = async (app: IntegrationApp, apiKey?: string, forceOAuth?: boolean) => {\n // If app supports multiple auth methods and user hasn't chosen, show choice\n if (hasMultipleAuthMethods(app) && !apiKey && !forceOAuth) {\n setAuthMethodModal({ app });\n return;\n }\n\n // If app supports API key (and user didn't choose OAuth), show API key modal\n if (supportsApiKey(app) && !apiKey && !forceOAuth) {\n setApiKeyModal({ app });\n setApiKeyInput(\"\");\n return;\n }\n\n setConnecting(app.slug);\n setError(null);\n\n try {\n // Build request body\n const body: any = { appSlug: app.slug };\n if (apiKey) {\n body.credentials = {\n authScheme: \"API_KEY\",\n apiKey,\n };\n }\n\n const projectParam = projectId && projectId !== \"unassigned\" ? `?project_id=${projectId}` : \"\";\n const res = await authFetch(`/api/integrations/${providerId}/connect${projectParam}`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(body),\n });\n\n const data = await res.json();\n\n if (!res.ok) {\n setError(data.error || \"Failed to initiate connection\");\n setConnecting(null);\n setApiKeyModal(null);\n return;\n }\n\n // API_KEY connections are immediately active (no redirect)\n if (data.status === \"active\" || !data.redirectUrl) {\n setConnecting(null);\n setApiKeyModal(null);\n fetchData();\n onConnectionComplete?.();\n return;\n }\n\n if (data.redirectUrl) {\n // Store pending connection for polling\n setPendingConnection({\n appSlug: app.slug,\n connectionId: data.connectionId,\n });\n\n // Open OAuth in popup\n const popup = window.open(\n data.redirectUrl,\n `connect-${app.slug}`,\n \"width=600,height=700,left=200,top=100\"\n );\n\n // If popup blocked, redirect instead\n if (!popup || popup.closed) {\n window.location.href = data.redirectUrl;\n }\n }\n } catch (e) {\n setError(`Failed to connect: ${e}`);\n setConnecting(null);\n setApiKeyModal(null);\n }\n };\n\n // Handle API key form submission\n const handleApiKeySubmit = (e: React.FormEvent) => {\n e.preventDefault();\n if (!apiKeyModal || !apiKeyInput.trim()) return;\n connectApp(apiKeyModal.app, apiKeyInput.trim());\n };\n\n // Disconnect (called after confirmation)\n const disconnectApp = async (account: ConnectedAccount) => {\n const projectParam = projectId && projectId !== \"unassigned\" ? `?project_id=${projectId}` : \"\";\n try {\n const res = await authFetch(\n `/api/integrations/${providerId}/connection/${account.id}${projectParam}`,\n { method: \"DELETE\" }\n );\n\n if (res.ok) {\n fetchData();\n } else {\n const data = await res.json();\n setError(data.error || \"Failed to disconnect\");\n }\n } catch (e) {\n setError(`Failed to disconnect: ${e}`);\n }\n };\n\n // Open MCP config creation modal\n const openMcpConfigModal = (app: IntegrationApp) => {\n setMcpConfigModal({ app });\n setMcpConfigName(`${app.name} MCP`);\n setMcpConfigSuccess(null);\n };\n\n // Create MCP config from connected app\n const createMcpConfig = async () => {\n if (!mcpConfigModal || !mcpConfigName.trim()) return;\n\n setMcpConfigCreating(true);\n setError(null);\n\n try {\n const projectParam = projectId && projectId !== \"unassigned\" ? `?project_id=${projectId}` : \"\";\n const res = await authFetch(`/api/integrations/${providerId}/configs${projectParam}`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n name: mcpConfigName.replace(/[^a-zA-Z0-9\\s-]/g, \"\").substring(0, 30),\n toolkitSlug: mcpConfigModal.app.slug,\n }),\n });\n\n const data = await res.json();\n\n if (!res.ok) {\n setError(data.error || \"Failed to create MCP config\");\n setMcpConfigCreating(false);\n return;\n }\n\n setMcpConfigSuccess(mcpConfigName);\n onConnectionComplete?.();\n } catch (e) {\n setError(`Failed to create MCP config: ${e}`);\n } finally {\n setMcpConfigCreating(false);\n }\n };\n\n // Handle disconnect with confirmation modal\n const handleDisconnect = (account: ConnectedAccount) => {\n setConfirmModal({\n message: `Disconnect ${account.appName}?`,\n onConfirm: () => {\n disconnectApp(account);\n setConfirmModal(null);\n },\n });\n };\n\n // Check if app is connected\n const isConnected = (appSlug: string) => {\n return connectedAccounts.some(\n (a) => a.appId === appSlug && a.status === \"active\"\n );\n };\n\n // Get connection for app (prefer active account)\n const getConnection = (appSlug: string) => {\n return connectedAccounts.find((a) => a.appId === appSlug && a.status === \"active\")\n || connectedAccounts.find((a) => a.appId === appSlug);\n };\n\n // Filter apps\n const filteredApps = apps.filter((app) => {\n if (!search) return true;\n const s = search.toLowerCase();\n return (\n app.name.toLowerCase().includes(s) ||\n app.slug.toLowerCase().includes(s) ||\n app.description?.toLowerCase().includes(s) ||\n app.categories.some((c) => c.toLowerCase().includes(s))\n );\n });\n\n // Group by connected/not connected\n const connectedApps = filteredApps.filter((app) => isConnected(app.slug));\n const availableApps = filteredApps.filter((app) => !isConnected(app.slug));\n\n if (loading) {\n return <div className=\"text-center py-8 text-[#666]\">Loading apps...</div>;\n }\n\n return (\n <div className=\"space-y-6\">\n {/* Auth Method Choice Modal */}\n {authMethodModal && (\n <div className=\"fixed inset-0 bg-black/50 flex items-center justify-center z-50\">\n <div className=\"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-md mx-4\">\n <div className=\"flex items-center gap-3 mb-4\">\n {authMethodModal.app.logo && (\n <img\n src={authMethodModal.app.logo}\n alt={authMethodModal.app.name}\n className=\"w-10 h-10 object-contain\"\n />\n )}\n <div>\n <h3 className=\"font-medium\">Connect {authMethodModal.app.name}</h3>\n <p className=\"text-xs text-[#666]\">Choose how to authenticate</p>\n </div>\n </div>\n <div className=\"space-y-3\">\n <button\n onClick={() => {\n setAuthMethodModal(null);\n setApiKeyModal({ app: authMethodModal.app });\n setApiKeyInput(\"\");\n }}\n className=\"w-full text-left p-3 bg-[#0a0a0a] hover:bg-[#1a1a1a] border border-[#333] hover:border-[#f97316] rounded-lg transition\"\n >\n <div className=\"font-medium text-sm\">API Key</div>\n <div className=\"text-xs text-[#666] mt-0.5\">\n Enter your {authMethodModal.app.name} API key directly\n </div>\n </button>\n <button\n onClick={() => {\n setAuthMethodModal(null);\n connectApp(authMethodModal.app, undefined, true);\n }}\n className=\"w-full text-left p-3 bg-[#0a0a0a] hover:bg-[#1a1a1a] border border-[#333] hover:border-[#f97316] rounded-lg transition\"\n >\n <div className=\"font-medium text-sm\">OAuth</div>\n <div className=\"text-xs text-[#666] mt-0.5\">\n Sign in with your {authMethodModal.app.name} account\n </div>\n </button>\n </div>\n <button\n onClick={() => setAuthMethodModal(null)}\n className=\"w-full text-sm text-[#666] hover:text-white mt-4 py-2 transition\"\n >\n Cancel\n </button>\n </div>\n </div>\n )}\n\n {/* API Key Modal */}\n {apiKeyModal && (\n <div className=\"fixed inset-0 bg-black/50 flex items-center justify-center z-50\">\n <div className=\"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-md mx-4\">\n <div className=\"flex items-center gap-3 mb-4\">\n {apiKeyModal.app.logo && (\n <img\n src={apiKeyModal.app.logo}\n alt={apiKeyModal.app.name}\n className=\"w-10 h-10 object-contain\"\n />\n )}\n <div>\n <h3 className=\"font-medium\">Connect {apiKeyModal.app.name}</h3>\n <p className=\"text-xs text-[#666]\">Enter your API key to connect</p>\n </div>\n </div>\n <form onSubmit={handleApiKeySubmit}>\n <input\n type=\"password\"\n value={apiKeyInput}\n onChange={(e) => setApiKeyInput(e.target.value)}\n placeholder=\"Enter API Key...\"\n className=\"w-full bg-[#0a0a0a] border border-[#333] rounded-lg px-4 py-2 mb-4 focus:outline-none focus:border-[#f97316]\"\n autoFocus\n />\n <div className=\"flex gap-2\">\n <button\n type=\"button\"\n onClick={() => setApiKeyModal(null)}\n className=\"flex-1 text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] px-4 py-2 rounded transition\"\n >\n Cancel\n </button>\n <button\n type=\"submit\"\n disabled={!apiKeyInput.trim() || connecting === apiKeyModal.app.slug}\n className=\"flex-1 text-sm bg-[#f97316] hover:bg-[#ea580c] text-white px-4 py-2 rounded transition disabled:opacity-50\"\n >\n {connecting === apiKeyModal.app.slug ? \"Connecting...\" : \"Connect\"}\n </button>\n </div>\n </form>\n </div>\n </div>\n )}\n\n {/* MCP Config Creation Modal */}\n {mcpConfigModal && (\n <div className=\"fixed inset-0 bg-black/50 flex items-center justify-center z-50\">\n <div className=\"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-md mx-4\">\n {mcpConfigSuccess ? (\n <>\n <div className=\"text-center mb-4\">\n <div className=\"w-12 h-12 bg-green-500/20 rounded-full flex items-center justify-center mx-auto mb-3\">\n <span className=\"text-green-400 text-2xl\">✓</span>\n </div>\n <h3 className=\"font-medium text-lg\">MCP Config Created!</h3>\n <p className=\"text-sm text-[#888] mt-2\">\n \"{mcpConfigSuccess}\" has been created successfully.\n </p>\n <p className=\"text-xs text-[#666] mt-2\">\n You can now add it to your agents from the MCP Configs tab.\n </p>\n </div>\n <button\n onClick={() => {\n setMcpConfigModal(null);\n setMcpConfigSuccess(null);\n }}\n className=\"w-full text-sm bg-[#f97316] hover:bg-[#ea580c] text-white px-4 py-2 rounded transition\"\n >\n Done\n </button>\n </>\n ) : (\n <>\n <div className=\"flex items-center gap-3 mb-4\">\n {mcpConfigModal.app.logo && (\n <img\n src={mcpConfigModal.app.logo}\n alt={mcpConfigModal.app.name}\n className=\"w-10 h-10 object-contain\"\n />\n )}\n <div>\n <h3 className=\"font-medium\">Create MCP Config</h3>\n <p className=\"text-xs text-[#666]\">\n Create an MCP config for {mcpConfigModal.app.name}\n </p>\n </div>\n </div>\n <form onSubmit={(e) => { e.preventDefault(); createMcpConfig(); }}>\n <label className=\"block text-xs text-[#888] mb-1\">Config Name</label>\n <input\n type=\"text\"\n value={mcpConfigName}\n onChange={(e) => setMcpConfigName(e.target.value)}\n placeholder=\"Enter config name...\"\n className=\"w-full bg-[#0a0a0a] border border-[#333] rounded-lg px-4 py-2 mb-4 focus:outline-none focus:border-[#f97316]\"\n autoFocus\n maxLength={30}\n />\n <div className=\"flex gap-2\">\n <button\n type=\"button\"\n onClick={() => setMcpConfigModal(null)}\n className=\"flex-1 text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] px-4 py-2 rounded transition\"\n >\n Cancel\n </button>\n <button\n type=\"submit\"\n disabled={!mcpConfigName.trim() || mcpConfigCreating}\n className=\"flex-1 text-sm bg-[#f97316] hover:bg-[#ea580c] text-white px-4 py-2 rounded transition disabled:opacity-50\"\n >\n {mcpConfigCreating ? \"Creating...\" : \"Create Config\"}\n </button>\n </div>\n </form>\n </>\n )}\n </div>\n </div>\n )}\n\n {/* Confirmation Modal */}\n {confirmModal && (\n <div className=\"fixed inset-0 bg-black/50 flex items-center justify-center z-50\">\n <div className=\"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-sm mx-4\">\n <p className=\"text-center mb-4\">{confirmModal.message}</p>\n <div className=\"flex gap-2\">\n <button\n onClick={() => setConfirmModal(null)}\n className=\"flex-1 text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] px-4 py-2 rounded transition\"\n >\n Cancel\n </button>\n <button\n onClick={confirmModal.onConfirm}\n className=\"flex-1 text-sm bg-red-500 hover:bg-red-600 text-white px-4 py-2 rounded transition\"\n >\n Confirm\n </button>\n </div>\n </div>\n </div>\n )}\n\n {/* Error */}\n {error && (\n <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\">\n <span>{error}</span>\n <button onClick={() => setError(null)} className=\"text-red-400 hover:text-red-300\">\n ×\n </button>\n </div>\n )}\n\n {/* Pending connection notice */}\n {pendingConnection && (\n <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\">\n <span className=\"animate-spin\">⟳</span>\n <span>Waiting for {pendingConnection.appSlug} authorization...</span>\n </div>\n )}\n\n {/* Search */}\n <div>\n <input\n type=\"text\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n placeholder=\"Search apps...\"\n className=\"w-full bg-[#111] border border-[#333] rounded-lg px-4 py-2 focus:outline-none focus:border-[#f97316]\"\n />\n </div>\n\n {/* Connected Apps */}\n {connectedApps.length > 0 && (\n <div>\n <h3 className=\"text-sm font-medium text-[#888] mb-3\">\n Connected ({connectedApps.length})\n </h3>\n <div className=\"grid gap-3 sm:grid-cols-2 lg:grid-cols-3\">\n {connectedApps.map((app) => (\n <AppCard\n key={app.id}\n app={app}\n connection={getConnection(app.slug)}\n onConnect={() => connectApp(app)}\n onDisconnect={() => {\n const conn = getConnection(app.slug);\n if (conn) handleDisconnect(conn);\n }}\n onCreateMcpConfig={hideMcpConfig ? undefined : () => openMcpConfigModal(app)}\n onBrowseTriggers={onBrowseTriggers ? () => onBrowseTriggers(app.slug) : undefined}\n connecting={connecting === app.slug}\n />\n ))}\n </div>\n </div>\n )}\n\n {/* Available Apps */}\n <div>\n <h3 className=\"text-sm font-medium text-[#888] mb-3\">\n Available Apps ({availableApps.length})\n </h3>\n {availableApps.length === 0 ? (\n <p className=\"text-[#666] text-sm\">\n {search ? \"No apps match your search\" : \"No apps available\"}\n </p>\n ) : (\n <div className=\"grid gap-3 sm:grid-cols-2 lg:grid-cols-3\">\n {availableApps.slice(0, 50).map((app) => (\n <AppCard\n key={app.id}\n app={app}\n onConnect={() => connectApp(app)}\n connecting={connecting === app.slug}\n />\n ))}\n </div>\n )}\n {availableApps.length > 50 && (\n <p className=\"text-xs text-[#555] mt-3 text-center\">\n Showing first 50 of {availableApps.length} apps. Use search to find more.\n </p>\n )}\n </div>\n </div>\n );\n}\n\n// App card component\nfunction AppCard({\n app,\n connection,\n onConnect,\n onDisconnect,\n onCreateMcpConfig,\n onBrowseTriggers,\n connecting,\n}: {\n app: IntegrationApp;\n connection?: ConnectedAccount;\n onConnect: () => void;\n onDisconnect?: () => void;\n onCreateMcpConfig?: () => void;\n onBrowseTriggers?: () => void;\n connecting: boolean;\n}) {\n const isConnected = connection?.status === \"active\";\n const hasApiKey = supportsApiKey(app);\n const hasOAuth = supportsOAuth(app);\n const hasBothMethods = hasApiKey && hasOAuth;\n\n return (\n <div\n className={`bg-[#111] border rounded-lg p-3 transition ${\n isConnected ? \"border-green-500/30\" : \"border-[#1a1a1a] hover:border-[#333]\"\n }`}\n >\n <div className=\"flex items-start gap-3\">\n {/* Logo */}\n <div className=\"w-10 h-10 rounded bg-[#1a1a1a] flex items-center justify-center flex-shrink-0 overflow-hidden\">\n {app.logo ? (\n <img\n src={app.logo}\n alt={app.name}\n className=\"w-8 h-8 object-contain\"\n onError={(e) => {\n (e.target as HTMLImageElement).style.display = \"none\";\n }}\n />\n ) : (\n <span className=\"text-lg\">{app.name[0]?.toUpperCase()}</span>\n )}\n </div>\n\n {/* Info */}\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2\">\n <h4 className=\"font-medium text-sm truncate\">{app.name}</h4>\n {isConnected && (\n <span className=\"text-xs text-green-400\">✓</span>\n )}\n {!isConnected && hasApiKey && !hasOAuth && (\n <span className=\"text-[10px] bg-[#222] text-[#888] px-1.5 py-0.5 rounded\" title=\"Requires API Key\">\n API Key\n </span>\n )}\n {!isConnected && hasBothMethods && (\n <span className=\"text-[10px] bg-[#1a2a1a] text-[#6a6] px-1.5 py-0.5 rounded\" title=\"Supports API Key or OAuth\">\n API Key / OAuth\n </span>\n )}\n </div>\n {app.description && (\n <p className=\"text-xs text-[#666] line-clamp-2 mt-0.5\">\n {app.description}\n </p>\n )}\n {app.categories.length > 0 && (\n <div className=\"flex flex-wrap gap-1 mt-1\">\n {app.categories.slice(0, 2).map((cat) => (\n <span\n key={cat}\n className=\"text-[10px] bg-[#1a1a1a] text-[#555] px-1.5 py-0.5 rounded\"\n >\n {cat}\n </span>\n ))}\n </div>\n )}\n </div>\n </div>\n\n {/* Actions */}\n <div className=\"mt-3 flex gap-2\">\n {isConnected ? (\n <>\n {onCreateMcpConfig && (\n <button\n onClick={onCreateMcpConfig}\n 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\"\n >\n Create MCP Config\n </button>\n )}\n {onBrowseTriggers && (\n <button\n onClick={onBrowseTriggers}\n 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\"\n >\n Browse Triggers\n </button>\n )}\n {onDisconnect && (\n <button\n onClick={onDisconnect}\n className=\"text-xs text-[#666] hover:text-red-400 transition px-2\"\n title=\"Disconnect\"\n >\n ×\n </button>\n )}\n </>\n ) : (\n <button\n onClick={onConnect}\n disabled={connecting}\n 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\"\n >\n {connecting ? \"Connecting...\" : (hasApiKey && !hasOAuth) ? \"Enter API Key\" : \"Connect\"}\n </button>\n )}\n </div>\n </div>\n );\n}\n\nexport default IntegrationsPanel;\n"
6
- ],
7
- "mappings": "+DAAA,gCA6BA,SAAS,CAAc,CAAC,EAA8B,CACpD,OAAO,EAAI,YAAY,KAAK,KAAK,EAAE,YAAY,IAAM,SAAS,EAIhE,SAAS,EAAa,CAAC,EAA8B,CACnD,OAAO,EAAI,YAAY,KAAK,KAAK,EAAE,YAAY,IAAM,QAAQ,EAI/D,SAAS,EAAsB,CAAC,EAA8B,CAC5D,OAAO,EAAe,CAAG,GAAK,GAAc,CAAG,EAI1C,SAAS,EAAiB,EAC/B,aAAa,WACb,YACA,uBACA,mBACA,iBAOC,CACD,IAAQ,aAAc,GAAQ,GACvB,EAAM,GAAW,WAA2B,CAAC,CAAC,GAC9C,EAAmB,GAAwB,WAA6B,CAAC,CAAC,GAC1E,EAAS,GAAc,WAAS,EAAI,GACpC,EAAQ,IAAa,WAAS,EAAE,GAChC,EAAY,GAAiB,WAAwB,IAAI,GACzD,EAAmB,GAAwB,WAGxC,IAAI,GACP,EAAO,GAAY,WAAwB,IAAI,GAE/C,EAAiB,GAAsB,WAAyC,IAAI,GAEpF,EAAa,GAAkB,WAAyC,IAAI,GAC5E,EAAa,GAAkB,WAAS,EAAE,GAE1C,EAAgB,GAAqB,WAAyC,IAAI,GAClF,EAAe,GAAoB,WAAS,EAAE,GAC9C,EAAmB,GAAwB,WAA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AAM,UAAU,6DAA6D,MAAM,4BAAnF,iDAEE,IAbN,qBAeE,EACD,EAAI,aACH,SAEE,IAFF,CAAG,UAAU,0CAAb,SACG,EAAI,aADP,qBAEE,EAEH,EAAI,WAAW,OAAS,GACvB,SASE,MATF,CAAK,UAAU,4BAAf,SACG,EAAI,WAAW,MAAM,EAAG,CAAC,EAAE,IAAI,CAAC,IAC/B,SAKE,OALF,CAEE,UAAU,6DAFZ,SAIG,GAHI,EADP,cAKE,CACH,GARH,qBASE,IAhCN,qBAkCE,IApDJ,qBAqDE,EAGF,SAsCE,MAtCF,CAAK,UAAU,kBAAf,SACG,EACC,8BA0BE,CAzBC,GACC,SAKE,SALF,CACE,QAAS,EACT,UAAU,oJAFZ,mDAKE,EAEH,GACC,SAKE,SALF,CACE,QAAS,EACT,UAAU,iJAFZ,iDAKE,EAEH,GACC,SAME,SANF,CACE,QAAS,EACT,UAAU,yDACV,MAAM,aAHR,mCAME,IAxBN,qBA0BE,EAEF,SAME,SANF,CACE,QAAS,EACT,SAAU,EACV,UAAU,6IAHZ,SAKG,EAAa,gBAAmB,GAAa,CAAC,EAAY,gBAAkB,WAL/E,qBAME,GApCN,qBAsCE,IAnGJ,qBAoGE",
8
- "debugId": "879C1544186FFE2D64756E2164756E21",
9
- "names": []
10
- }
@@ -1,13 +0,0 @@
1
- import{O as Oz,P as Wz}from"./App.yv87t9m5.js";import{R as j}from"./App.p0fb1pds.js";import{S as n,V as Qz,W as zz,ca as Jz,fa as Kz}from"./App.mvtqv6qc.js";var W=n(Qz(),1);var z=n(zz(),1);function Rz(){let{authFetch:K}=Jz(),{projects:Z,currentProjectId:Y}=Kz(),[B,N]=W.useState([]),[y,M]=W.useState(!0),[X,U]=W.useState("installed"),[G,Q]=W.useState(!1),[C,H]=W.useState(!1),[v,T]=W.useState(null),{confirm:f,ConfirmDialog:w}=Oz(),{alert:P,AlertDialog:d}=Wz(),_=Z.length>0,[m,p]=W.useState(""),[h,Xz]=W.useState([]),[c,r]=W.useState(!1),[Yz,o]=W.useState(null),[a,i]=W.useState(""),[R,t]=W.useState([]),[I,u]=W.useState(!1),[V,b]=W.useState(null),[q,l]=W.useState(null),[e,S]=W.useState(null),[x,Zz]=W.useState(Y&&Y!=="unassigned"?Y:null),D=B.filter((J)=>{if(!Y)return!0;if(Y==="unassigned")return J.project_id===null;return J.project_id===null||J.project_id===Y}),F=async()=>{try{let O=await(await K("/api/skills")).json();N(O.skills||[])}catch(J){console.error("Failed to fetch skills:",J)}M(!1)},E=async(J)=>{r(!0);try{let O=J!==void 0?J:m,$=O?`/api/skills/marketplace/search?q=${encodeURIComponent(O)}`:"/api/skills/marketplace/featured",A=await(await K($)).json();Xz(A.skills||[])}catch(O){console.error("Failed to search marketplace:",O)}r(!1)};W.useEffect(()=>{F()},[K]),W.useEffect(()=>{if(X==="marketplace"&&h.length===0)E("")},[X]);let _z=async(J)=>{try{await K(`/api/skills/${J}/toggle`,{method:"POST"}),F()}catch(O){console.error("Failed to toggle skill:",O)}},$z=async(J)=>{if(!await f("Delete this skill?",{confirmText:"Delete",title:"Delete Skill"}))return;try{if(await K(`/api/skills/${J}`,{method:"DELETE"}),v?.id===J)T(null);F()}catch($){console.error("Failed to delete skill:",$)}},Bz=async(J)=>{o(J.id);try{let O=await K(`/api/skills/marketplace/${J.id}/install`,{method:"POST"}),$=await O.json();if(O.ok)await P(`Installed "${J.name}" successfully!`,{title:"Skill Installed"}),F(),U("installed");else await P($.error||"Failed to install skill",{title:"Installation Failed"})}catch(O){console.error("Failed to install skill:",O),await P("Failed to install skill",{title:"Error"})}o(null)},g=(J)=>B.some((O)=>O.name===J),s=async(J)=>{let O=J||a;if(!O.trim())return;let $="",L="";if(O.includes("github.com")){let A=O.match(/github\.com\/([^/]+)\/([^/]+)/);if(A)$=A[1],L=A[2].replace(/\.git$/,"")}else if(O.includes("/")){let A=O.split("/");$=A[0],L=A[1]}if(!$||!L){b("Invalid repo format. Use 'owner/repo' or GitHub URL");return}u(!0),b(null),t([]),l(null);try{let A=await K(`/api/skills/github/${$}/${L}`),k=await A.json();if(!A.ok){b(k.error||"Failed to fetch repository"),u(!1);return}t(k.skills||[]),l(k.repo||null)}catch(A){b("Failed to fetch repository")}u(!1)},Nz=async(J)=>{if(!q)return;S(J.name);try{let O=await K("/api/skills/github/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({owner:q.owner,repo:q.repo,skillName:J.name,downloadUrl:J.downloadUrl,projectId:x})}),$=await O.json();if(O.ok)await P(`Installed "${J.name}" successfully!`,{title:"Skill Installed"}),F();else await P($.error||"Failed to install skill",{title:"Installation Failed",variant:"error"})}catch(O){await P("Failed to install skill",{title:"Error",variant:"error"})}S(null)},Uz=async()=>{if(!q||R.length===0)return;let J=R.filter((L)=>!g(L.name));if(J.length===0){await P("All skills are already installed",{title:"Info"});return}if(!await f(`Install ${J.length} skill(s) from ${q.owner}/${q.repo}?`,{confirmText:"Install All",title:"Install Skills"}))return;let $=0;for(let L of J){S(L.name);try{if((await K("/api/skills/github/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({owner:q.owner,repo:q.repo,skillName:L.name,downloadUrl:L.downloadUrl,projectId:x})})).ok)$++}catch(A){}}S(null),F(),await P(`Installed ${$} of ${J.length} skills`,{title:"Installation Complete"})};return z.jsxDEV(z.Fragment,{children:[w,d,z.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:z.jsxDEV("div",{className:"max-w-6xl",children:[z.jsxDEV("div",{className:"flex items-center justify-between mb-6",children:[z.jsxDEV("div",{children:[z.jsxDEV("h1",{className:"text-2xl font-semibold mb-1",children:"Skills"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-[#666]",children:"Manage agent skills - instructions that teach agents how to perform tasks."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X==="installed"&&z.jsxDEV("div",{className:"flex gap-2",children:[z.jsxDEV("button",{onClick:()=>H(!0),className:"bg-[#1a1a1a] hover:bg-[#222] text-white px-4 py-2 rounded font-medium transition border border-[#333]",children:"Import"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>Q(!0),className:"bg-[#f97316] hover:bg-[#fb923c] text-black px-4 py-2 rounded font-medium transition",children:"+ Create Skill"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex gap-1 mb-6 bg-[#111] border border-[#1a1a1a] rounded-lg p-1 w-fit",children:[z.jsxDEV("button",{onClick:()=>U("installed"),className:`px-4 py-2 rounded text-sm font-medium transition ${X==="installed"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:["Installed (",D.length,")"]},void 0,!0,void 0,this),z.jsxDEV("button",{onClick:()=>U("github"),className:`px-4 py-2 rounded text-sm font-medium transition ${X==="github"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"Browse GitHub"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>U("marketplace"),className:`px-4 py-2 rounded text-sm font-medium transition ${X==="marketplace"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"Marketplace"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X==="installed"&&z.jsxDEV(z.Fragment,{children:y?z.jsxDEV("div",{className:"text-[#666]",children:"Loading skills..."},void 0,!1,void 0,this):B.length===0?z.jsxDEV("div",{className:"text-center py-20 text-[#666]",children:[z.jsxDEV("p",{className:"text-lg",children:"No skills installed"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm mt-1",children:"Create a skill or browse the marketplace"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>U("marketplace"),className:"mt-4 bg-[#f97316] hover:bg-[#fb923c] text-black px-4 py-2 rounded font-medium transition",children:"Browse Marketplace"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):D.length===0?z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-6 text-center",children:z.jsxDEV("p",{className:"text-[#666]",children:"No skills match this filter."},void 0,!1,void 0,this)},void 0,!1,void 0,this):z.jsxDEV("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:D.map((J)=>{let O=_&&J.project_id?Z.find(($)=>$.id===J.project_id):null;return z.jsxDEV(Hz,{skill:J,project:O,onToggle:()=>_z(J.id),onDelete:()=>$z(J.id),onView:()=>T(J)},J.id,!1,void 0,this)})},void 0,!1,void 0,this)},void 0,!1,void 0,this),X==="github"&&z.jsxDEV("div",{className:"space-y-6",children:[z.jsxDEV("form",{onSubmit:(J)=>{J.preventDefault(),s()},className:"flex gap-2",children:[z.jsxDEV("input",{type:"text",value:a,onChange:(J)=>i(J.target.value),placeholder:"Enter GitHub repo (e.g., WordPress/agent-skills)",className:"flex-1 bg-[#111] border border-[#333] rounded-lg px-4 py-3 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("button",{type:"submit",disabled:I,className:"bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black px-6 py-3 rounded-lg font-medium transition",children:I?"...":"Browse"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_&&R.length>0&&z.jsxDEV("div",{className:"flex items-center gap-3 p-3 bg-[#0a0a0a] border border-[#222] rounded-lg",children:[z.jsxDEV("span",{className:"text-sm text-[#666]",children:"Install to:"},void 0,!1,void 0,this),z.jsxDEV(j,{value:x||"",onChange:(J)=>Zz(J||null),options:[{value:"",label:"Global (all projects)"},...Z.map((J)=>({value:J.id,label:J.name}))],placeholder:"Select scope..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),V&&z.jsxDEV("div",{className:"text-red-400 text-sm p-3 bg-red-500/10 border border-red-500/20 rounded-lg",children:V},void 0,!1,void 0,this),q&&R.length>0&&z.jsxDEV("div",{className:"flex items-center justify-between",children:[z.jsxDEV("div",{className:"flex items-center gap-3",children:[z.jsxDEV("a",{href:q.url,target:"_blank",rel:"noopener noreferrer",className:"text-[#f97316] hover:underline font-medium",children:[q.owner,"/",q.repo]},void 0,!0,void 0,this),z.jsxDEV("span",{className:"text-sm text-[#666]",children:[R.length," skill",R.length!==1?"s":""," found"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),R.some((J)=>!g(J.name))&&z.jsxDEV("button",{onClick:Uz,disabled:!!e,className:"text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-4 py-2 rounded transition disabled:opacity-50",children:"Install All"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),I&&z.jsxDEV("div",{className:"text-center py-8 text-[#666]",children:"Fetching skills from repository..."},void 0,!1,void 0,this),!I&&!q&&!V&&z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-8 text-center",children:[z.jsxDEV("div",{className:"text-4xl mb-4",children:"\uD83D\uDCE6"},void 0,!1,void 0,this),z.jsxDEV("h3",{className:"text-lg font-medium mb-2",children:"Browse Skills from GitHub"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-[#666] mb-6 max-w-md mx-auto",children:"Enter a GitHub repository to browse and install skills. Skills are markdown files with instructions that teach agents how to perform specific tasks."},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex flex-wrap gap-2 justify-center",children:[{label:"WordPress Skills",repo:"WordPress/agent-skills"}].map(({label:J,repo:O})=>z.jsxDEV("button",{onClick:()=>{i(O),s(O)},className:"text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-3 py-1.5 rounded transition",children:J},O,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!I&&q&&R.length===0&&z.jsxDEV("div",{className:"text-center py-8 text-[#666]",children:"No skills found in this repository. Skills should be in subdirectories with a SKILL.md file."},void 0,!1,void 0,this),R.length>0&&z.jsxDEV("div",{className:"grid gap-4 md:grid-cols-2",children:R.map((J)=>{let O=g(J.name),$=e===J.name;return z.jsxDEV("div",{className:`bg-[#111] border rounded-lg p-4 transition ${O?"border-green-500/30":"border-[#1a1a1a] hover:border-[#333]"}`,children:z.jsxDEV("div",{className:"flex items-start justify-between gap-3",children:[z.jsxDEV("div",{className:"flex-1 min-w-0",children:[z.jsxDEV("div",{className:"flex items-center gap-2",children:[z.jsxDEV("h3",{className:"font-medium truncate",children:J.name},void 0,!1,void 0,this),O&&z.jsxDEV("span",{className:"text-xs text-green-400",children:"✓ Installed"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("p",{className:"text-sm text-[#666] mt-1 line-clamp-2",children:J.description||"No description"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-2 mt-2 text-xs text-[#555]",children:[z.jsxDEV("span",{children:[(J.size/1024).toFixed(1),"KB"]},void 0,!0,void 0,this),z.jsxDEV("span",{className:"px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-400",children:"GitHub"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex-shrink-0",children:O?z.jsxDEV("span",{className:"text-xs text-[#555] px-3 py-1.5",children:"Added"},void 0,!1,void 0,this):z.jsxDEV("button",{onClick:()=>Nz(J),disabled:$,className:"text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-3 py-1.5 rounded transition disabled:opacity-50",children:$?"Installing...":"Install"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},J.name,!1,void 0,this)})},void 0,!1,void 0,this),z.jsxDEV("div",{className:"p-4 bg-[#111] border border-[#1a1a1a] rounded-lg text-sm text-[#666]",children:z.jsxDEV("p",{children:["Skills are sourced from GitHub repositories. Each skill should be in its own directory with a"," ",z.jsxDEV("code",{className:"text-[#888] bg-[#0a0a0a] px-1 rounded",children:"SKILL.md"},void 0,!1,void 0,this)," file containing instructions."]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X==="marketplace"&&z.jsxDEV(z.Fragment,{children:[z.jsxDEV("div",{className:"mb-6",children:z.jsxDEV("div",{className:"flex gap-2",children:[z.jsxDEV("input",{type:"text",value:m,onChange:(J)=>p(J.target.value),onKeyDown:(J)=>J.key==="Enter"&&E(),placeholder:"Search skills...",className:"flex-1 bg-[#111] border border-[#1a1a1a] rounded px-4 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>E(),disabled:c,className:"bg-[#1a1a1a] hover:bg-[#222] text-white px-4 py-2 rounded font-medium transition border border-[#333]",children:c?"...":"Search"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),c?z.jsxDEV("div",{className:"text-[#666]",children:"Loading..."},void 0,!1,void 0,this):h.length===0?z.jsxDEV("div",{className:"text-center py-20 text-[#666]",children:[z.jsxDEV("p",{className:"text-lg",children:"No skills found"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm mt-1",children:"Try a different search term"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):z.jsxDEV("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:h.map((J)=>z.jsxDEV(qz,{skill:J,installed:g(J.name),installing:Yz===J.id,onInstall:()=>Bz(J)},J.id,!1,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),G&&z.jsxDEV(Az,{authFetch:K,onClose:()=>Q(!1),onCreated:()=>{Q(!1),F()},projects:_?Z:void 0,defaultProjectId:Y&&Y!=="unassigned"?Y:null},void 0,!1,void 0,this),C&&z.jsxDEV(yz,{authFetch:K,onClose:()=>H(!1),onImported:()=>{H(!1),F()}},void 0,!1,void 0,this),v&&z.jsxDEV(Mz,{skill:v,authFetch:K,onClose:()=>T(null),onUpdated:()=>{T(null),F()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Hz({skill:K,project:Z,onToggle:Y,onDelete:B,onView:N}){let y={local:"Local",skillsmp:"SkillsMP",github:"GitHub",import:"Imported"}[K.source],M=()=>{if(Z)return z.jsxDEV("span",{className:"text-xs px-1.5 py-0.5 rounded",style:{backgroundColor:`${Z.color}20`,color:Z.color},children:Z.name},void 0,!1,void 0,this);if(K.project_id===null)return z.jsxDEV("span",{className:"text-xs text-[#666] bg-[#1a1a1a] px-1.5 py-0.5 rounded",children:"Global"},void 0,!1,void 0,this);return null};return z.jsxDEV("div",{className:`bg-[#111] rounded-lg p-5 border transition cursor-pointer ${K.enabled?"border-[#1a1a1a]":"border-[#1a1a1a] opacity-60"} hover:border-[#333]`,onClick:N,children:[z.jsxDEV("div",{className:"flex items-start justify-between mb-3",children:[z.jsxDEV("div",{className:"flex-1 min-w-0",children:[z.jsxDEV("div",{className:"flex items-center gap-2",children:[z.jsxDEV("h3",{className:"font-semibold text-lg truncate",children:K.name},void 0,!1,void 0,this),M()]},void 0,!0,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#666] flex items-center gap-2 mt-0.5",children:[z.jsxDEV("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${K.source==="skillsmp"?"bg-purple-500/20 text-purple-400":K.source==="github"?"bg-blue-500/20 text-blue-400":"bg-[#222] text-[#888]"}`,children:y},void 0,!1,void 0,this),K.metadata?.version&&z.jsxDEV("span",{children:["v",K.metadata.version]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("button",{onClick:(X)=>{X.stopPropagation(),Y()},className:`w-10 h-5 rounded-full transition-colors relative ${K.enabled?"bg-[#f97316]":"bg-[#333]"}`,children:z.jsxDEV("span",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white transition-transform ${K.enabled?"left-5":"left-0.5"}`},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("p",{className:"text-sm text-[#888] line-clamp-2 mb-4",children:K.description},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex items-center justify-between",children:[z.jsxDEV("div",{className:"flex gap-1 flex-wrap",children:[K.allowed_tools.slice(0,2).map((X)=>z.jsxDEV("span",{className:"text-xs bg-[#222] px-2 py-0.5 rounded text-[#666]",children:X},X,!1,void 0,this)),K.allowed_tools.length>2&&z.jsxDEV("span",{className:"text-xs text-[#666]",children:["+",K.allowed_tools.length-2]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("button",{onClick:(X)=>{X.stopPropagation(),B()},className:"text-red-400 hover:text-red-300 text-sm",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function qz({skill:K,installed:Z,installing:Y,onInstall:B}){return z.jsxDEV("div",{className:"bg-[#111] rounded-lg p-5 border border-[#1a1a1a] hover:border-[#333] transition",children:[z.jsxDEV("div",{className:"flex items-start justify-between mb-3",children:[z.jsxDEV("div",{className:"flex-1 min-w-0",children:[z.jsxDEV("h3",{className:"font-semibold text-lg truncate",children:K.name},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#666] mt-0.5",children:["by ",K.author," · v",K.version]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-1 text-yellow-500 text-sm",children:["★ ",K.rating.toFixed(1)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("p",{className:"text-sm text-[#888] line-clamp-2 mb-4",children:K.description},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex items-center justify-between",children:[z.jsxDEV("div",{className:"flex gap-1 flex-wrap",children:K.tags.slice(0,3).map((N)=>z.jsxDEV("span",{className:"text-xs bg-[#222] px-2 py-0.5 rounded text-[#666]",children:N},N,!1,void 0,this))},void 0,!1,void 0,this),Z?z.jsxDEV("span",{className:"text-green-400 text-sm",children:"✓ Installed"},void 0,!1,void 0,this):z.jsxDEV("button",{onClick:B,disabled:Y,className:"bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black px-3 py-1 rounded text-sm font-medium transition",children:Y?"Installing...":"Install"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"mt-3 text-xs text-[#555]",children:[K.downloads.toLocaleString()," downloads"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Az({authFetch:K,onClose:Z,onCreated:Y,projects:B,defaultProjectId:N}){let[y,M]=W.useState(""),[X,U]=W.useState(""),[G,Q]=W.useState(""),[C,H]=W.useState(N||null),[v,T]=W.useState(!1),[f,w]=W.useState(null),P=B&&B.length>0,d=async()=>{if(!y||!X||!G){w("All fields are required");return}T(!0),w(null);try{let _={name:y,description:X,content:G,source:"local"};if(C)_.project_id=C;let m=await K("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_)}),p=await m.json();if(!m.ok){w(p.error||"Failed to create skill"),T(!1);return}Y()}catch(_){w("Failed to create skill"),T(!1)}};return z.jsxDEV("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50 p-4",onClick:Z,children:z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg w-full max-w-2xl max-h-[90vh] overflow-auto",onClick:(_)=>_.stopPropagation(),children:[z.jsxDEV("div",{className:"p-6 border-b border-[#1a1a1a]",children:z.jsxDEV("h2",{className:"text-xl font-semibold",children:"Create Skill"},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV("div",{className:"p-6 space-y-4",children:[f&&z.jsxDEV("div",{className:"bg-red-500/10 border border-red-500/30 rounded p-3 text-red-400 text-sm",children:f},void 0,!1,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#888] mb-1",children:"Name"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:y,onChange:(_)=>M(_.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"-")),placeholder:"my-skill-name",className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:"Lowercase letters, numbers, and hyphens only"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#888] mb-1",children:"Description"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:X,onChange:(_)=>U(_.target.value),placeholder:"What this skill does and when to use it...",className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P&&z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#888] mb-1",children:"Scope"},void 0,!1,void 0,this),z.jsxDEV(j,{value:C||"",onChange:(_)=>H(_||null),options:[{value:"",label:"Global (all projects)"},...B.map((_)=>({value:_.id,label:_.name}))],placeholder:"Select scope..."},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:"Global skills are available to all agents. Project-scoped skills are only available to agents in that project."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#888] mb-1",children:"Instructions (Markdown)"},void 0,!1,void 0,this),z.jsxDEV("textarea",{value:G,onChange:(_)=>Q(_.target.value),placeholder:`# Skill Instructions
2
-
3
- Write detailed instructions here...`,rows:12,className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 focus:outline-none focus:border-[#f97316] font-mono text-sm"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"p-6 border-t border-[#1a1a1a] flex justify-end gap-3",children:[z.jsxDEV("button",{onClick:Z,className:"px-4 py-2 text-[#888] hover:text-white transition",children:"Cancel"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:d,disabled:v,className:"bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black px-4 py-2 rounded font-medium transition",children:v?"Creating...":"Create Skill"},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 yz({authFetch:K,onClose:Z,onImported:Y}){let[B,N]=W.useState(""),[y,M]=W.useState(!1),[X,U]=W.useState(null);return z.jsxDEV("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50 p-4",onClick:Z,children:z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg w-full max-w-2xl max-h-[90vh] overflow-auto",onClick:(Q)=>Q.stopPropagation(),children:[z.jsxDEV("div",{className:"p-6 border-b border-[#1a1a1a]",children:[z.jsxDEV("h2",{className:"text-xl font-semibold",children:"Import Skill"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-[#666] mt-1",children:"Paste the contents of a SKILL.md file"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"p-6 space-y-4",children:[X&&z.jsxDEV("div",{className:"bg-red-500/10 border border-red-500/30 rounded p-3 text-red-400 text-sm",children:X},void 0,!1,void 0,this),z.jsxDEV("textarea",{value:B,onChange:(Q)=>N(Q.target.value),placeholder:`---
4
- name: skill-name
5
- description: What this skill does...
6
- ---
7
-
8
- # Instructions
9
-
10
- Your skill instructions here...`,rows:16,className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 focus:outline-none focus:border-[#f97316] font-mono text-sm"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"p-6 border-t border-[#1a1a1a] flex justify-end gap-3",children:[z.jsxDEV("button",{onClick:Z,className:"px-4 py-2 text-[#888] hover:text-white transition",children:"Cancel"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:async()=>{if(!B.trim()){U("Paste SKILL.md content");return}M(!0),U(null);try{let Q=await K("/api/skills/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:B})}),C=await Q.json();if(!Q.ok){U(C.error||"Failed to import skill"),M(!1);return}Y()}catch(Q){U("Failed to import skill"),M(!1)}},disabled:y,className:"bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black px-4 py-2 rounded font-medium transition",children:y?"Importing...":"Import Skill"},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 Mz({skill:K,authFetch:Z,onClose:Y,onUpdated:B}){let[N,y]=W.useState(!1),[M,X]=W.useState(K.content),[U,G]=W.useState(!1),Q=async()=>{G(!0);try{await Z(`/api/skills/${K.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:M})}),B()}catch(H){console.error("Failed to save:",H)}G(!1)},C=async()=>{try{let v=await(await Z(`/api/skills/${K.id}/export`)).text(),T=new Blob([v],{type:"text/markdown"}),f=URL.createObjectURL(T),w=document.createElement("a");w.href=f,w.download=`${K.name}-SKILL.md`,w.click(),URL.revokeObjectURL(f)}catch(H){console.error("Failed to export:",H)}};return z.jsxDEV("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50 p-4",onClick:Y,children:z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg w-full max-w-3xl max-h-[90vh] overflow-auto",onClick:(H)=>H.stopPropagation(),children:[z.jsxDEV("div",{className:"p-6 border-b border-[#1a1a1a] flex items-center justify-between",children:[z.jsxDEV("div",{children:[z.jsxDEV("h2",{className:"text-xl font-semibold",children:K.name},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-[#666] mt-0.5",children:K.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex gap-2",children:[z.jsxDEV("button",{onClick:C,className:"text-sm text-[#888] hover:text-white transition px-3 py-1 rounded border border-[#333]",children:"Export"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>y(!N),className:"text-sm text-[#888] hover:text-white transition px-3 py-1 rounded border border-[#333]",children:N?"View":"Edit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"p-6",children:N?z.jsxDEV("textarea",{value:M,onChange:(H)=>X(H.target.value),rows:20,className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 focus:outline-none focus:border-[#f97316] font-mono text-sm"},void 0,!1,void 0,this):z.jsxDEV("pre",{className:"bg-[#0a0a0a] border border-[#222] rounded p-4 font-mono text-sm overflow-auto max-h-[60vh] whitespace-pre-wrap",children:K.content},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV("div",{className:"p-6 border-t border-[#1a1a1a] flex justify-between",children:[z.jsxDEV("div",{className:"text-xs text-[#555]",children:K.source!=="local"&&K.source_url&&z.jsxDEV("a",{href:K.source_url,target:"_blank",rel:"noopener noreferrer",className:"text-[#f97316] hover:underline",children:"View source →"},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex gap-3",children:[z.jsxDEV("button",{onClick:Y,className:"px-4 py-2 text-[#888] hover:text-white transition",children:"Close"},void 0,!1,void 0,this),N&&z.jsxDEV("button",{onClick:Q,disabled:U,className:"bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black px-4 py-2 rounded font-medium transition",children:U?"Saving...":"Save Changes"},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)}
11
- export{Rz as L};
12
-
13
- //# debugId=AAB8FFD9C3B0D3B464756E2164756E21
@@ -1,20 +0,0 @@
1
- var rW=Object.create;var{getPrototypeOf:aW,defineProperty:bW,getOwnPropertyNames:tW}=Object;var eW=Object.prototype.hasOwnProperty;var r=(H,w,q)=>{q=H!=null?rW(aW(H)):{};let R=w||!H||!H.__esModule?bW(q,"default",{value:H,enumerable:!0}):q;for(let m of tW(H))if(!eW.call(R,m))bW(R,m,{get:()=>H[m],enumerable:!0});return R};var fW=(H,w)=>()=>(w||H((w={exports:{}}).exports,w),w.exports);var JZ=((H)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(H,{get:(w,q)=>(typeof require<"u"?require:w)[q]}):H)(function(H){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+H+'" is not supported')});var UW=fW((WZ,RW)=>{(function(){function H(W,Z){Object.defineProperty(R.prototype,W,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",Z[0],Z[1])}})}function w(W){if(W===null||typeof W!=="object")return null;return W=PW&&W[PW]||W["@@iterator"],typeof W==="function"?W:null}function q(W,Z){W=(W=W.constructor)&&(W.displayName||W.name)||"ReactClass";var B=W+"."+Z;EW[B]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",Z,W),EW[B]=!0)}function R(W,Z,B){this.props=W,this.context=Z,this.refs=FW,this.updater=B||xW}function m(){}function S(W,Z,B){this.props=W,this.context=Z,this.refs=FW,this.updater=B||xW}function j(){}function T(W){return""+W}function g(W){try{T(W);var Z=!1}catch(Y){Z=!0}if(Z){Z=console;var B=Z.error,G=typeof Symbol==="function"&&Symbol.toStringTag&&W[Symbol.toStringTag]||W.constructor.name||"Object";return B.call(Z,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",G),T(W)}}function u(W){if(W==null)return null;if(typeof W==="function")return W.$$typeof===iW?null:W.displayName||W.name||null;if(typeof W==="string")return W;switch(W){case HW:return"Fragment";case U:return"Profiler";case X:return"StrictMode";case MW:return"Suspense";case A:return"SuspenseList";case DW:return"Activity"}if(typeof W==="object")switch(typeof W.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),W.$$typeof){case OW:return"Portal";case f:return W.displayName||"Context";case P:return(W._context.displayName||"Context")+".Consumer";case l:var Z=W.render;return W=W.displayName,W||(W=Z.displayName||Z.name||"",W=W!==""?"ForwardRef("+W+")":"ForwardRef"),W;case n:return Z=W.displayName||null,Z!==null?Z:u(W.type)||"Memo";case t:Z=W._payload,W=W._init;try{return u(W(Z))}catch(B){}}return null}function c(W){if(W===HW)return"<>";if(typeof W==="object"&&W!==null&&W.$$typeof===t)return"<...>";try{var Z=u(W);return Z?"<"+Z+">":"<...>"}catch(B){return"<...>"}}function p(){var W=O.A;return W===null?null:W.getOwner()}function d(){return Error("react-stack-top-frame")}function s(W){if(JW.call(W,"key")){var Z=Object.getOwnPropertyDescriptor(W,"key").get;if(Z&&Z.isReactWarning)return!1}return W.key!==void 0}function y(W,Z){function B(){jW||(jW=!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)",Z))}B.isReactWarning=!0,Object.defineProperty(W,"key",{get:B,configurable:!0})}function k(){var W=u(this.type);return vW[W]||(vW[W]=!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.")),W=this.props.ref,W!==void 0?W:null}function F(W,Z,B,G,Y,D){var $=B.ref;return W={$$typeof:QW,type:W,key:Z,props:B,_owner:G},($!==void 0?$:null)!==null?Object.defineProperty(W,"ref",{enumerable:!1,get:k}):Object.defineProperty(W,"ref",{enumerable:!1,value:null}),W._store={},Object.defineProperty(W._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(W,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(W,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Y}),Object.defineProperty(W,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:D}),Object.freeze&&(Object.freeze(W.props),Object.freeze(W)),W}function b(W,Z){return Z=F(W.type,Z,W.props,W._owner,W._debugStack,W._debugTask),W._store&&(Z._store.validated=W._store.validated),Z}function h(W){v(W)?W._store&&(W._store.validated=1):typeof W==="object"&&W!==null&&W.$$typeof===t&&(W._payload.status==="fulfilled"?v(W._payload.value)&&W._payload.value._store&&(W._payload.value._store.validated=1):W._store&&(W._store.validated=1))}function v(W){return typeof W==="object"&&W!==null&&W.$$typeof===QW}function _(W){var Z={"=":"=0",":":"=2"};return"$"+W.replace(/[=:]/g,function(B){return Z[B]})}function C(W,Z){return typeof W==="object"&&W!==null&&W.key!=null?(g(W.key),_(""+W.key)):Z.toString(36)}function L(W){switch(W.status){case"fulfilled":return W.value;case"rejected":throw W.reason;default:switch(typeof W.status==="string"?W.then(j,j):(W.status="pending",W.then(function(Z){W.status==="pending"&&(W.status="fulfilled",W.value=Z)},function(Z){W.status==="pending"&&(W.status="rejected",W.reason=Z)})),W.status){case"fulfilled":return W.value;case"rejected":throw W.reason}}throw W}function x(W,Z,B,G,Y){var D=typeof W;if(D==="undefined"||D==="boolean")W=null;var $=!1;if(W===null)$=!0;else switch(D){case"bigint":case"string":case"number":$=!0;break;case"object":switch(W.$$typeof){case QW:case OW:$=!0;break;case t:return $=W._init,x($(W._payload),Z,B,G,Y)}}if($){$=W,Y=Y($);var K=G===""?"."+C($,0):G;return AW(Y)?(B="",K!=null&&(B=K.replace(SW,"$&/")+"/"),x(Y,Z,B,"",function(e){return e})):Y!=null&&(v(Y)&&(Y.key!=null&&($&&$.key===Y.key||g(Y.key)),B=b(Y,B+(Y.key==null||$&&$.key===Y.key?"":(""+Y.key).replace(SW,"$&/")+"/")+K),G!==""&&$!=null&&v($)&&$.key==null&&$._store&&!$._store.validated&&(B._store.validated=2),Y=B),Z.push(Y)),1}if($=0,K=G===""?".":G+":",AW(W))for(var J=0;J<W.length;J++)G=W[J],D=K+C(G,J),$+=x(G,Z,B,D,Y);else if(J=w(W),typeof J==="function")for(J===W.entries&&(CW||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),CW=!0),W=J.call(W),J=0;!(G=W.next()).done;)G=G.value,D=K+C(G,J++),$+=x(G,Z,B,D,Y);else if(D==="object"){if(typeof W.then==="function")return x(L(W),Z,B,G,Y);throw Z=String(W),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(W).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return $}function z(W,Z,B){if(W==null)return W;var G=[],Y=0;return x(W,G,"","",function(D){return Z.call(B,D,Y++)}),G}function Q(W){if(W._status===-1){var Z=W._ioInfo;Z!=null&&(Z.start=Z.end=performance.now()),Z=W._result;var B=Z();if(B.then(function(Y){if(W._status===0||W._status===-1){W._status=1,W._result=Y;var D=W._ioInfo;D!=null&&(D.end=performance.now()),B.status===void 0&&(B.status="fulfilled",B.value=Y)}},function(Y){if(W._status===0||W._status===-1){W._status=2,W._result=Y;var D=W._ioInfo;D!=null&&(D.end=performance.now()),B.status===void 0&&(B.status="rejected",B.reason=Y)}}),Z=W._ioInfo,Z!=null){Z.value=B;var G=B.displayName;typeof G==="string"&&(Z.name=G)}W._status===-1&&(W._status=0,W._result=B)}if(W._status===1)return Z=W._result,Z===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
2
-
3
- Your code should look like:
4
- const MyComponent = lazy(() => import('./MyComponent'))
5
-
6
- Did you accidentally put curly braces around the import?`,Z),"default"in Z||console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
7
-
8
- Your code should look like:
9
- const MyComponent = lazy(() => import('./MyComponent'))`,Z),Z.default;throw W._result}function M(){var W=O.H;return W===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
10
- 1. You might have mismatching versions of React and the renderer (such as React DOM)
11
- 2. You might be breaking the Rules of Hooks
12
- 3. You might have more than one copy of React in the same app
13
- See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),W}function N(){O.asyncTransitions--}function o(W){if(LW===null)try{var Z=("require"+Math.random()).slice(0,7);LW=(RW&&RW[Z]).call(RW,"timers").setImmediate}catch(B){LW=function(G){kW===!1&&(kW=!0,typeof MessageChannel>"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var Y=new MessageChannel;Y.port1.onmessage=G,Y.port2.postMessage(void 0)}}return LW(W)}function a(W){return 1<W.length&&typeof AggregateError==="function"?AggregateError(W):W[0]}function WW(W,Z){Z!==qW-1&&console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),qW=Z}function BW(W,Z,B){var G=O.actQueue;if(G!==null)if(G.length!==0)try{GW(G),o(function(){return BW(W,Z,B)});return}catch(Y){O.thrownErrors.push(Y)}else O.actQueue=null;0<O.thrownErrors.length?(G=a(O.thrownErrors),O.thrownErrors.length=0,B(G)):Z(W)}function GW(W){if(!VW){VW=!0;var Z=0;try{for(;Z<W.length;Z++){var B=W[Z];do{O.didUsePromise=!1;var G=B(!1);if(G!==null){if(O.didUsePromise){W[Z]=B,W.splice(0,Z);return}B=G}else break}while(1)}W.length=0}catch(Y){W.splice(0,Z+1),O.thrownErrors.push(Y)}finally{VW=!1}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var QW=Symbol.for("react.transitional.element"),OW=Symbol.for("react.portal"),HW=Symbol.for("react.fragment"),X=Symbol.for("react.strict_mode"),U=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),f=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),MW=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),n=Symbol.for("react.memo"),t=Symbol.for("react.lazy"),DW=Symbol.for("react.activity"),PW=Symbol.iterator,EW={},xW={isMounted:function(){return!1},enqueueForceUpdate:function(W){q(W,"forceUpdate")},enqueueReplaceState:function(W){q(W,"replaceState")},enqueueSetState:function(W){q(W,"setState")}},_W=Object.assign,FW={};Object.freeze(FW),R.prototype.isReactComponent={},R.prototype.setState=function(W,Z){if(typeof W!=="object"&&typeof W!=="function"&&W!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,W,Z,"setState")},R.prototype.forceUpdate=function(W){this.updater.enqueueForceUpdate(this,W,"forceUpdate")};var i={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]};for($W in i)i.hasOwnProperty($W)&&H($W,i[$W]);m.prototype=R.prototype,i=S.prototype=new m,i.constructor=S,_W(i,R.prototype),i.isPureReactComponent=!0;var AW=Array.isArray,iW=Symbol.for("react.client.reference"),O={H:null,A:null,T:null,S:null,actQueue:null,asyncTransitions:0,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1,didUsePromise:!1,thrownErrors:[],getCurrentStack:null,recentlyCreatedOwnerStacks:0},JW=Object.prototype.hasOwnProperty,IW=console.createTask?console.createTask:function(){return null};i={react_stack_bottom_frame:function(W){return W()}};var jW,TW,vW={},oW=i.react_stack_bottom_frame.bind(i,d)(),cW=IW(c(d)),CW=!1,SW=/\/+/g,gW=typeof reportError==="function"?reportError:function(W){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var Z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof W==="object"&&W!==null&&typeof W.message==="string"?String(W.message):String(W),error:W});if(!window.dispatchEvent(Z))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",W);return}console.error(W)},kW=!1,LW=null,qW=0,wW=!1,VW=!1,mW=typeof queueMicrotask==="function"?function(W){queueMicrotask(function(){return queueMicrotask(W)})}:o;i=Object.freeze({__proto__:null,c:function(W){return M().useMemoCache(W)}});var $W={map:z,forEach:function(W,Z,B){z(W,function(){Z.apply(this,arguments)},B)},count:function(W){var Z=0;return z(W,function(){Z++}),Z},toArray:function(W){return z(W,function(Z){return Z})||[]},only:function(W){if(!v(W))throw Error("React.Children.only expected to receive a single React element child.");return W}};WZ.Activity=DW,WZ.Children=$W,WZ.Component=R,WZ.Fragment=HW,WZ.Profiler=U,WZ.PureComponent=S,WZ.StrictMode=X,WZ.Suspense=MW,WZ.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,WZ.__COMPILER_RUNTIME=i,WZ.act=function(W){var Z=O.actQueue,B=qW;qW++;var G=O.actQueue=Z!==null?Z:[],Y=!1;try{var D=W()}catch(J){O.thrownErrors.push(J)}if(0<O.thrownErrors.length)throw WW(Z,B),W=a(O.thrownErrors),O.thrownErrors.length=0,W;if(D!==null&&typeof D==="object"&&typeof D.then==="function"){var $=D;return mW(function(){Y||wW||(wW=!0,console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(J,e){Y=!0,$.then(function(YW){if(WW(Z,B),B===0){try{GW(G),o(function(){return BW(YW,J,e)})}catch(nW){O.thrownErrors.push(nW)}if(0<O.thrownErrors.length){var lW=a(O.thrownErrors);O.thrownErrors.length=0,e(lW)}}else J(YW)},function(YW){WW(Z,B),0<O.thrownErrors.length?(YW=a(O.thrownErrors),O.thrownErrors.length=0,e(YW)):e(YW)})}}}var K=D;if(WW(Z,B),B===0&&(GW(G),G.length!==0&&mW(function(){Y||wW||(wW=!0,console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"))}),O.actQueue=null),0<O.thrownErrors.length)throw W=a(O.thrownErrors),O.thrownErrors.length=0,W;return{then:function(J,e){Y=!0,B===0?(O.actQueue=G,o(function(){return BW(K,J,e)})):J(K)}}},WZ.cache=function(W){return function(){return W.apply(null,arguments)}},WZ.cacheSignal=function(){return null},WZ.captureOwnerStack=function(){var W=O.getCurrentStack;return W===null?null:W()},WZ.cloneElement=function(W,Z,B){if(W===null||W===void 0)throw Error("The argument must be a React element, but you passed "+W+".");var G=_W({},W.props),Y=W.key,D=W._owner;if(Z!=null){var $;W:{if(JW.call(Z,"ref")&&($=Object.getOwnPropertyDescriptor(Z,"ref").get)&&$.isReactWarning){$=!1;break W}$=Z.ref!==void 0}$&&(D=p()),s(Z)&&(g(Z.key),Y=""+Z.key);for(K in Z)!JW.call(Z,K)||K==="key"||K==="__self"||K==="__source"||K==="ref"&&Z.ref===void 0||(G[K]=Z[K])}var K=arguments.length-2;if(K===1)G.children=B;else if(1<K){$=Array(K);for(var J=0;J<K;J++)$[J]=arguments[J+2];G.children=$}G=F(W.type,Y,G,D,W._debugStack,W._debugTask);for(Y=2;Y<arguments.length;Y++)h(arguments[Y]);return G},WZ.createContext=function(W){return W={$$typeof:f,_currentValue:W,_currentValue2:W,_threadCount:0,Provider:null,Consumer:null},W.Provider=W,W.Consumer={$$typeof:P,_context:W},W._currentRenderer=null,W._currentRenderer2=null,W},WZ.createElement=function(W,Z,B){for(var G=2;G<arguments.length;G++)h(arguments[G]);G={};var Y=null;if(Z!=null)for(J in TW||!("__self"in Z)||"key"in Z||(TW=!0,console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")),s(Z)&&(g(Z.key),Y=""+Z.key),Z)JW.call(Z,J)&&J!=="key"&&J!=="__self"&&J!=="__source"&&(G[J]=Z[J]);var D=arguments.length-2;if(D===1)G.children=B;else if(1<D){for(var $=Array(D),K=0;K<D;K++)$[K]=arguments[K+2];Object.freeze&&Object.freeze($),G.children=$}if(W&&W.defaultProps)for(J in D=W.defaultProps,D)G[J]===void 0&&(G[J]=D[J]);Y&&y(G,typeof W==="function"?W.displayName||W.name||"Unknown":W);var J=1e4>O.recentlyCreatedOwnerStacks++;return F(W,Y,G,p(),J?Error("react-stack-top-frame"):oW,J?IW(c(W)):cW)},WZ.createRef=function(){var W={current:null};return Object.seal(W),W},WZ.forwardRef=function(W){W!=null&&W.$$typeof===n?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof W!=="function"?console.error("forwardRef requires a render function but was given %s.",W===null?"null":typeof W):W.length!==0&&W.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",W.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),W!=null&&W.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var Z={$$typeof:l,render:W},B;return Object.defineProperty(Z,"displayName",{enumerable:!1,configurable:!0,get:function(){return B},set:function(G){B=G,W.name||W.displayName||(Object.defineProperty(W,"name",{value:G}),W.displayName=G)}}),Z},WZ.isValidElement=v,WZ.lazy=function(W){W={_status:-1,_result:W};var Z={$$typeof:t,_payload:W,_init:Q},B={name:"lazy",start:-1,end:-1,value:null,owner:null,debugStack:Error("react-stack-top-frame"),debugTask:console.createTask?console.createTask("lazy()"):null};return W._ioInfo=B,Z._debugInfo=[{awaited:B}],Z},WZ.memo=function(W,Z){W==null&&console.error("memo: The first argument must be a component. Instead received: %s",W===null?"null":typeof W),Z={$$typeof:n,type:W,compare:Z===void 0?null:Z};var B;return Object.defineProperty(Z,"displayName",{enumerable:!1,configurable:!0,get:function(){return B},set:function(G){B=G,W.name||W.displayName||(Object.defineProperty(W,"name",{value:G}),W.displayName=G)}}),Z},WZ.startTransition=function(W){var Z=O.T,B={};B._updatedFibers=new Set,O.T=B;try{var G=W(),Y=O.S;Y!==null&&Y(B,G),typeof G==="object"&&G!==null&&typeof G.then==="function"&&(O.asyncTransitions++,G.then(N,N),G.then(j,gW))}catch(D){gW(D)}finally{Z===null&&B._updatedFibers&&(W=B._updatedFibers.size,B._updatedFibers.clear(),10<W&&console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")),Z!==null&&B.types!==null&&(Z.types!==null&&Z.types!==B.types&&console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."),Z.types=B.types),O.T=Z}},WZ.unstable_useCacheRefresh=function(){return M().useCacheRefresh()},WZ.use=function(W){return M().use(W)},WZ.useActionState=function(W,Z,B){return M().useActionState(W,Z,B)},WZ.useCallback=function(W,Z){return M().useCallback(W,Z)},WZ.useContext=function(W){var Z=M();return W.$$typeof===P&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),Z.useContext(W)},WZ.useDebugValue=function(W,Z){return M().useDebugValue(W,Z)},WZ.useDeferredValue=function(W,Z){return M().useDeferredValue(W,Z)},WZ.useEffect=function(W,Z){return W==null&&console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"),M().useEffect(W,Z)},WZ.useEffectEvent=function(W){return M().useEffectEvent(W)},WZ.useId=function(){return M().useId()},WZ.useImperativeHandle=function(W,Z,B){return M().useImperativeHandle(W,Z,B)},WZ.useInsertionEffect=function(W,Z){return W==null&&console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"),M().useInsertionEffect(W,Z)},WZ.useLayoutEffect=function(W,Z){return W==null&&console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"),M().useLayoutEffect(W,Z)},WZ.useMemo=function(W,Z){return M().useMemo(W,Z)},WZ.useOptimistic=function(W,Z){return M().useOptimistic(W,Z)},WZ.useReducer=function(W,Z,B){return M().useReducer(W,Z,B)},WZ.useRef=function(W){return M().useRef(W)},WZ.useState=function(W){return M().useState(W)},WZ.useSyncExternalStore=function(W,Z,B){return M().useSyncExternalStore(W,Z,B)},WZ.useTransition=function(){return M().useTransition()},WZ.version="19.2.4",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var XW=fW((ZZ)=>{var ZW=r(UW());(function(){function H(X){if(X==null)return null;if(typeof X==="function")return X.$$typeof===M?null:X.displayName||X.name||null;if(typeof X==="string")return X;switch(X){case k:return"Fragment";case b:return"Profiler";case F:return"StrictMode";case C:return"Suspense";case L:return"SuspenseList";case Q:return"Activity"}if(typeof X==="object")switch(typeof X.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),X.$$typeof){case y:return"Portal";case v:return X.displayName||"Context";case h:return(X._context.displayName||"Context")+".Consumer";case _:var U=X.render;return X=X.displayName,X||(X=U.displayName||U.name||"",X=X!==""?"ForwardRef("+X+")":"ForwardRef"),X;case x:return U=X.displayName||null,U!==null?U:H(X.type)||"Memo";case z:U=X._payload,X=X._init;try{return H(X(U))}catch(P){}}return null}function w(X){return""+X}function q(X){try{w(X);var U=!1}catch(l){U=!0}if(U){U=console;var P=U.error,f=typeof Symbol==="function"&&Symbol.toStringTag&&X[Symbol.toStringTag]||X.constructor.name||"Object";return P.call(U,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",f),w(X)}}function R(X){if(X===k)return"<>";if(typeof X==="object"&&X!==null&&X.$$typeof===z)return"<...>";try{var U=H(X);return U?"<"+U+">":"<...>"}catch(P){return"<...>"}}function m(){var X=N.A;return X===null?null:X.getOwner()}function S(){return Error("react-stack-top-frame")}function j(X){if(o.call(X,"key")){var U=Object.getOwnPropertyDescriptor(X,"key").get;if(U&&U.isReactWarning)return!1}return X.key!==void 0}function T(X,U){function P(){BW||(BW=!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)",U))}P.isReactWarning=!0,Object.defineProperty(X,"key",{get:P,configurable:!0})}function g(){var X=H(this.type);return GW[X]||(GW[X]=!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.")),X=this.props.ref,X!==void 0?X:null}function u(X,U,P,f,l,MW){var A=P.ref;return X={$$typeof:s,type:X,key:U,props:P,_owner:f},(A!==void 0?A:null)!==null?Object.defineProperty(X,"ref",{enumerable:!1,get:g}):Object.defineProperty(X,"ref",{enumerable:!1,value:null}),X._store={},Object.defineProperty(X._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(X,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(X,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:l}),Object.defineProperty(X,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:MW}),Object.freeze&&(Object.freeze(X.props),Object.freeze(X)),X}function c(X,U,P,f,l,MW){var A=U.children;if(A!==void 0)if(f)if(a(A)){for(f=0;f<A.length;f++)p(A[f]);Object.freeze&&Object.freeze(A)}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 p(A);if(o.call(U,"key")){A=H(X);var n=Object.keys(U).filter(function(DW){return DW!=="key"});f=0<n.length?"{key: someKey, "+n.join(": ..., ")+": ...}":"{key: someKey}",HW[A+f]||(n=0<n.length?"{"+n.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
14
- let props = %s;
15
- <%s {...props} />
16
- React keys must be passed directly to JSX without using spread:
17
- let props = %s;
18
- <%s key={someKey} {...props} />`,f,A,n,A),HW[A+f]=!0)}if(A=null,P!==void 0&&(q(P),A=""+P),j(U)&&(q(U.key),A=""+U.key),"key"in U){P={};for(var t in U)t!=="key"&&(P[t]=U[t])}else P=U;return A&&T(P,typeof X==="function"?X.displayName||X.name||"Unknown":X),u(X,A,P,m(),l,MW)}function p(X){d(X)?X._store&&(X._store.validated=1):typeof X==="object"&&X!==null&&X.$$typeof===z&&(X._payload.status==="fulfilled"?d(X._payload.value)&&X._payload.value._store&&(X._payload.value._store.validated=1):X._store&&(X._store.validated=1))}function d(X){return typeof X==="object"&&X!==null&&X.$$typeof===s}var s=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),v=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),x=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),M=Symbol.for("react.client.reference"),N=ZW.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,o=Object.prototype.hasOwnProperty,a=Array.isArray,WW=console.createTask?console.createTask:function(){return null};ZW={react_stack_bottom_frame:function(X){return X()}};var BW,GW={},QW=ZW.react_stack_bottom_frame.bind(ZW,S)(),OW=WW(R(S)),HW={};ZZ.Fragment=k,ZZ.jsxDEV=function(X,U,P,f){var l=1e4>N.recentlyCreatedOwnerStacks++;return c(X,U,P,f,l?Error("react-stack-top-frame"):QW,l?WW(R(X)):OW)}})()});var E=r(UW(),1),yW=r(XW(),1),hW=E.createContext(null),XZ=200;function BZ({children:H}){let[w,q]=E.useState(!1),[R,m]=E.useState([]),[S,j]=E.useState({}),[T,g]=E.useState({}),[u,c]=E.useState(0),[p,d]=E.useState(0),[s,y]=E.useState(0),k=E.useRef(null),F=E.useRef(null);E.useEffect(()=>{let v=setInterval(()=>{let _=Date.now();g((C)=>{let L={};for(let[x,z]of Object.entries(C))if(z.expiresAt>_)L[x]=z;return L})},500);return()=>clearInterval(v)},[]);let b=E.useCallback(()=>{if(k.current)k.current.close(),k.current=null;try{let v=new EventSource("/api/telemetry/stream");k.current=v,v.onopen=()=>{q(!0)},v.onmessage=(_)=>{if(!_.data||_.data.trim()==="")return;try{let C=JSON.parse(_.data);if(C.connected){q(!0);return}if(Array.isArray(C)){if(m((L)=>{return[...C,...L].slice(0,XZ)}),j((L)=>{let x={...L};for(let z of C){let Q=x[z.agent_id];if(!Q||new Date(z.timestamp)>new Date(Q.timestamp))x[z.agent_id]={timestamp:z.timestamp,category:z.category,type:z.type}}return x}),g((L)=>{let x={...L},z=Date.now()+3000;for(let Q of C)x[Q.agent_id]={type:Q.type,expiresAt:z};return x}),C.some((L)=>L.category==="system"&&(L.type==="agent_started"||L.type==="agent_stopped")))c((L)=>L+1);if(C.some((L)=>L.category==="TASK"&&(L.type==="task_created"||L.type==="task_updated"||L.type==="task_deleted")))d((L)=>L+1);if(C.some((L)=>L.level==="error"||L.category==="ERROR"||L.category==="system"&&L.type==="agent_stopped"))y((L)=>L+1)}}catch{}},v.onerror=()=>{if(q(!1),v.close(),k.current=null,F.current)clearTimeout(F.current);F.current=setTimeout(b,2000)}}catch{if(q(!1),F.current)clearTimeout(F.current);F.current=setTimeout(b,2000)}},[]);E.useEffect(()=>{return b(),()=>{if(k.current)k.current.close();if(F.current)clearTimeout(F.current)}},[b]);let h=E.useCallback(()=>{m([])},[]);return yW.jsxDEV(hW.Provider,{value:{connected:w,events:R,lastActivityByAgent:S,activeAgents:T,statusChangeCounter:u,taskChangeCounter:p,notificationCounter:s,clearEvents:h},children:H},void 0,!1,void 0,this)}function zW(){let H=E.useContext(hW);if(!H)throw Error("useTelemetryContext must be used within TelemetryProvider");return H}function GZ(H){let{connected:w,events:q,lastActivityByAgent:R}=zW(),m=E.default.useMemo(()=>{let T=q;if(H?.agent_id)T=T.filter((g)=>g.agent_id===H.agent_id);if(H?.category)T=T.filter((g)=>g.category===H.category);if(H?.limit)T=T.slice(0,H.limit);return T},[q,H?.agent_id,H?.category,H?.limit]),S=H?.agent_id?R[H.agent_id]:void 0,j=E.default.useMemo(()=>{if(!S)return!1;let T=new Date(S.timestamp).getTime();return Date.now()-T<1e4},[S]);return{connected:w,events:m,lastActivity:S,isActive:j}}function HZ(H){switch(H){case"llm_request":return"Thinking";case"tool_invocation":return"Using tools";case"tool_result":return"Using tools";case"thread_activity":return"Working";case"agent_started":return"Starting";case"agent_stopped":return"Stopped";default:return"Working"}}function MZ(H){let{activeAgents:w}=zW(),q=w[H];return{isActive:!!q,type:q?.type,label:q?HZ(q.type):void 0}}function YZ(){let{statusChangeCounter:H}=zW();return H}function zZ(){let{taskChangeCounter:H}=zW();return H}function QZ(){let{notificationCounter:H}=zW();return H}var V=r(UW(),1),sW=r(XW(),1),uW=V.createContext(null);function KW(){let H=V.useContext(uW);if(!H)throw Error("useAuth must be used within an AuthProvider");return H}function $Z({children:H}){let[w,q]=V.useState(null),[R,m]=V.useState(null),[S,j]=V.useState(!0),[T,g]=V.useState(null),[u,c]=V.useState(!1),[p,d]=V.useState(null),s=V.useRef(null),y=V.useRef(!1),k=V.useRef(!1),F=V.useCallback((z)=>{s.current=z,m(z)},[]),b=V.useCallback(async()=>{if(y.current)return!1;y.current=!0;try{let z=await fetch("/api/auth/refresh",{method:"POST",credentials:"include"});if(!z.ok)return!1;let Q=await z.json();if(F(Q.accessToken),Q.user)q(Q.user);if(Q.onboarding)d(Q.onboarding.completed||Q.onboarding.has_any_keys);return!!Q.user}catch(z){return console.error("Token refresh failed:",z),!1}finally{y.current=!1}},[F]),h=V.useCallback(async()=>{try{let z=s.current,M=await(await fetch("/api/auth/check",{headers:z?{Authorization:`Bearer ${z}`}:{}})).json();if(g(M.hasUsers),c(M.isDev??!1),M.onboarding)d(M.onboarding.completed||M.onboarding.has_any_keys);if(M.authenticated&&M.user)q(M.user);else if(q(null),M.hasUsers){if(!await b())F(null)}}catch(z){console.error("Auth check failed:",z),q(null),F(null)}finally{j(!1)}},[b,F]),v=V.useCallback(async(z,Q)=>{try{let M=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({username:z,password:Q})}),N=await M.json();if(!M.ok)return{success:!1,error:N.error||"Login failed"};return F(N.accessToken),q(N.user),g(!0),{success:!0}}catch(M){return console.error("Login failed:",M),{success:!1,error:"Login failed"}}},[F]),_=V.useCallback(async()=>{try{let z=s.current;await fetch("/api/auth/logout",{method:"POST",credentials:"include",headers:z?{Authorization:`Bearer ${z}`}:{}})}catch(z){console.error("Logout failed:",z)}finally{q(null),F(null)}},[F]),C=V.useCallback(async(z,Q={})=>{let M=new Headers(Q.headers),N=s.current;if(N)M.set("Authorization",`Bearer ${N}`);return fetch(z,{...Q,headers:M})},[]),L=V.useCallback(async()=>{return b()},[b]);V.useEffect(()=>{if(k.current)return;k.current=!0,h()},[h]),V.useEffect(()=>{if(!R)return;let z=setInterval(()=>{b()},840000);return()=>clearInterval(z)},[R,b]);let x={user:w,isAuthenticated:!!w,isLoading:S,hasUsers:T,isDev:u,accessToken:R,onboardingComplete:p,setOnboardingComplete:d,login:v,logout:_,refreshToken:L,checkAuth:h,authFetch:C};return sW.jsxDEV(uW.Provider,{value:x,children:H},void 0,!1,void 0,this)}function UZ(){let{accessToken:H}=KW();return H?{Authorization:`Bearer ${H}`}:{}}var I=r(UW(),1);var pW=r(XW(),1),dW=I.createContext(null);function OZ(){let H=I.useContext(dW);if(!H)throw Error("useProjects must be used within a ProjectProvider");return H}var NW="apteva_current_project";function DZ({children:H}){let{authFetch:w,isAuthenticated:q,isLoading:R}=KW(),[m,S]=I.useState([]),[j,T]=I.useState(()=>{if(typeof window<"u")return localStorage.getItem(NW);return null}),[g,u]=I.useState(!0),[c,p]=I.useState(null),[d,s]=I.useState(0),[y,k]=I.useState(!1),[F,b]=I.useState(!1);I.useEffect(()=>{fetch("/api/features").then((Q)=>Q.json()).then((Q)=>{k(Q.projects===!0),b(Q.metaAgent===!0)}).catch(()=>{k(!1),b(!1)})},[]);let h=I.useCallback((Q)=>{if(T(Q),typeof window<"u")if(Q===null)localStorage.removeItem(NW);else localStorage.setItem(NW,Q)},[]),v=m.find((Q)=>Q.id===j)||null,_=I.useCallback(async()=>{if(!y){S([]),u(!1);return}if(!q&&!R){S([]),u(!1);return}try{p(null);let Q=await w("/api/projects");if(!Q.ok)throw Error("Failed to fetch projects");let M=await Q.json();if(S(M.projects||[]),s(M.unassignedCount||0),j&&j!=="unassigned"&&!M.projects.find((N)=>N.id===j))h(null)}catch(Q){console.error("Failed to fetch projects:",Q),p("Failed to load projects")}finally{u(!1)}},[w,q,R,j,h,y]),C=I.useCallback(async(Q)=>{try{let M=await w("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Q)});if(!M.ok){let o=await M.json();throw Error(o.error||"Failed to create project")}let N=await M.json();return await _(),N.project}catch(M){return console.error("Failed to create project:",M),null}},[w,_]),L=I.useCallback(async(Q,M)=>{try{let N=await w(`/api/projects/${Q}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(M)});if(!N.ok){let a=await N.json();throw Error(a.error||"Failed to update project")}let o=await N.json();return await _(),o.project}catch(N){return console.error("Failed to update project:",N),null}},[w,_]),x=I.useCallback(async(Q)=>{try{let M=await w(`/api/projects/${Q}`,{method:"DELETE"});if(!M.ok){let N=await M.json();throw Error(N.error||"Failed to delete project")}if(j===Q)h(null);return await _(),!0}catch(M){return console.error("Failed to delete project:",M),!1}},[w,j,h,_]);I.useEffect(()=>{if(!R&&y)_()},[R,y,_]);let z={projects:m,currentProjectId:j,currentProject:v,isLoading:g,error:c,unassignedCount:d,projectsEnabled:y,metaAgentEnabled:F,setCurrentProjectId:h,createProject:C,updateProject:L,deleteProject:x,refreshProjects:_};return pW.jsxDEV(dW.Provider,{value:z,children:H},void 0,!1,void 0,this)}export{r as S,fW as T,JZ as U,UW as V,XW as W,BZ as X,zW as Y,GZ as Z,MZ as _,YZ as $,zZ as aa,QZ as ba,KW as ca,$Z as da,UZ as ea,OZ as fa,DZ as ga};
19
-
20
- //# debugId=61F021475A28EB1464756E2164756E21
@@ -1,4 +0,0 @@
1
- import{S as n,W as e}from"./App.mvtqv6qc.js";var o=n(e(),1);function t({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function i({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function a({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("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"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function s({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function c({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"},void 0,!1,void 0,this),o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function l({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function u({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("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"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function h({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"},void 0,!1,void 0,this),o.jsxDEV("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"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function d({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function k({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("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"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function p({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function v({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function L({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("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"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function M({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function m({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function g({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("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 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function f({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function w({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function I({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("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"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function C({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function W({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function P({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function B({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h5M20 20v-5h-5"},void 0,!1,void 0,this),o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20.49 9A9 9 0 005.64 5.64L4 4m16 16l-1.64-1.64A9 9 0 013.51 15"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function N({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3"},void 0,!1,void 0,this),o.jsxDEV("circle",{cx:"12",cy:"12",r:"9",strokeWidth:2},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function z({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsxDEV("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"},void 0,!1,void 0,this),o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 14l2 2 4-4"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function H({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("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"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}
2
- export{t as l,i as m,a as n,s as o,c as p,l as q,u as r,h as s,d as t,k as u,p as v,v as w,L as x,M as y,m as z,g as A,f as B,w as C,I as D,C as E,W as F,P as G,B as H,N as I,z as J,H as K};
3
-
4
- //# debugId=63EA8B1BF349157264756E2164756E21
@@ -1,4 +0,0 @@
1
- import{S as i,V as p,W as u}from"./App.mvtqv6qc.js";var n=i(p(),1),e=i(u(),1);function g({value:o,options:c,onChange:d,placeholder:f="Select..."}){let[a,l]=n.useState(!1),s=n.useRef(null),r=c.find((t)=>t.value===o);return n.useEffect(()=>{function t(m){if(s.current&&!s.current.contains(m.target))l(!1)}return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[]),e.jsxDEV("div",{ref:s,className:"relative",children:[e.jsxDEV("button",{type:"button",onClick:()=>l(!a),className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 text-left flex items-center justify-between focus:outline-none focus:border-[#f97316] text-[#e0e0e0] hover:border-[#333] transition",children:[e.jsxDEV("span",{className:r?"text-[#e0e0e0]":"text-[#666]",children:r?e.jsxDEV(e.Fragment,{children:[r.label,r.recommended&&e.jsxDEV("span",{className:"text-[#f97316] text-xs ml-2",children:"(Recommended)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):f},void 0,!1,void 0,this),e.jsxDEV(v,{isOpen:a},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a&&e.jsxDEV("div",{className:"absolute z-50 w-full min-w-max mt-1 bg-[#111] border border-[#222] rounded shadow-lg max-h-60 overflow-y-auto scrollbar-hide",children:c.map((t)=>e.jsxDEV("button",{type:"button",onClick:()=>{d(t.value),l(!1)},className:`w-full px-3 py-2 text-left flex items-center justify-between hover:bg-[#1a1a1a] transition ${t.value===o?"bg-[#1a1a1a] text-[#f97316]":"text-[#e0e0e0]"}`,children:[e.jsxDEV("span",{children:[t.label,t.recommended&&e.jsxDEV("span",{className:"text-[#f97316] text-xs ml-2",children:"(Recommended)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t.value===o&&e.jsxDEV("svg",{className:"w-4 h-4 text-[#f97316]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},t.value,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function v({isOpen:o}){return e.jsxDEV("svg",{className:`w-4 h-4 text-[#666] transition-transform ${o?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}
2
- export{g as R};
3
-
4
- //# debugId=B9FC446FE21094E364756E2164756E21
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/web/components/common/Select.tsx"],
4
- "sourcesContent": [
5
- "import React, { useState, useRef, useEffect } from \"react\";\n\ninterface SelectOption {\n value: string;\n label: string;\n recommended?: boolean;\n}\n\ninterface SelectProps {\n value: string;\n options: SelectOption[];\n onChange: (value: string) => void;\n placeholder?: string;\n}\n\nexport function Select({ value, options, onChange, placeholder = \"Select...\" }: SelectProps) {\n const [isOpen, setIsOpen] = useState(false);\n const ref = useRef<HTMLDivElement>(null);\n\n const selectedOption = options.find(o => o.value === value);\n\n useEffect(() => {\n function handleClickOutside(event: MouseEvent) {\n if (ref.current && !ref.current.contains(event.target as Node)) {\n setIsOpen(false);\n }\n }\n document.addEventListener(\"mousedown\", handleClickOutside);\n return () => document.removeEventListener(\"mousedown\", handleClickOutside);\n }, []);\n\n return (\n <div ref={ref} className=\"relative\">\n <button\n type=\"button\"\n onClick={() => setIsOpen(!isOpen)}\n className=\"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 text-left flex items-center justify-between focus:outline-none focus:border-[#f97316] text-[#e0e0e0] hover:border-[#333] transition\"\n >\n <span className={selectedOption ? \"text-[#e0e0e0]\" : \"text-[#666]\"}>\n {selectedOption ? (\n <>\n {selectedOption.label}\n {selectedOption.recommended && (\n <span className=\"text-[#f97316] text-xs ml-2\">(Recommended)</span>\n )}\n </>\n ) : placeholder}\n </span>\n <ChevronIcon isOpen={isOpen} />\n </button>\n\n {isOpen && (\n <div className=\"absolute z-50 w-full min-w-max mt-1 bg-[#111] border border-[#222] rounded shadow-lg max-h-60 overflow-y-auto scrollbar-hide\">\n {options.map((option) => (\n <button\n key={option.value}\n type=\"button\"\n onClick={() => {\n onChange(option.value);\n setIsOpen(false);\n }}\n className={`w-full px-3 py-2 text-left flex items-center justify-between hover:bg-[#1a1a1a] transition ${\n option.value === value ? \"bg-[#1a1a1a] text-[#f97316]\" : \"text-[#e0e0e0]\"\n }`}\n >\n <span>\n {option.label}\n {option.recommended && (\n <span className=\"text-[#f97316] text-xs ml-2\">(Recommended)</span>\n )}\n </span>\n {option.value === value && (\n <svg className=\"w-4 h-4 text-[#f97316]\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M5 13l4 4L19 7\" />\n </svg>\n )}\n </button>\n ))}\n </div>\n )}\n </div>\n );\n}\n\nfunction ChevronIcon({ isOpen }: { isOpen: boolean }) {\n return (\n <svg\n className={`w-4 h-4 text-[#666] transition-transform ${isOpen ? \"rotate-180\" : \"\"}`}\n fill=\"none\"\n stroke=\"currentColor\"\n viewBox=\"0 0 24 24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M19 9l-7 7-7-7\" />\n </svg>\n );\n}\n"
6
- ],
7
- "mappings": "oDAAA,0BAeO,SAAS,CAAM,EAAG,QAAO,UAAS,WAAU,cAAc,aAA4B,CAC3F,IAAO,EAAQ,GAAa,WAAS,EAAK,EACpC,EAAM,SAAuB,IAAI,EAEjC,EAAiB,EAAQ,KAAK,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