@johpaz/hive-agents 1.0.1 → 1.0.2
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.
- package/README.md +3 -3
- package/dist/hive.js +521 -369
- package/dist/ui/assets/A2UIPage-BRpjnMss.js +8 -0
- package/dist/ui/assets/{AgentCreateForm-M2RhjeA1.js → AgentCreateForm-ASjKD7Js.js} +1 -1
- package/dist/ui/assets/{AgentDetailPage-DkFRtj8g.js → AgentDetailPage-bqJ-MS40.js} +1 -1
- package/dist/ui/assets/AgentNewPage-CPaf2C3u.js +1 -0
- package/dist/ui/assets/{AgentsPage-Ctzq2LWx.js → AgentsPage-BIpLG0V6.js} +1 -1
- package/dist/ui/assets/{ApiClientPage-DKbGO1QW.js → ApiClientPage-dRckcgrN.js} +1 -1
- package/dist/ui/assets/{ChannelsPage-H6rgr8DQ.js → ChannelsPage-BX_hPtiN.js} +1 -1
- package/dist/ui/assets/{DashboardPage-BIjYGf4m.js → DashboardPage-KMaMaFf4.js} +1 -1
- package/dist/ui/assets/{LoginPage-DazoxtBJ.js → LoginPage-Zchu-f16.js} +1 -1
- package/dist/ui/assets/{LogsPage-DMZ6KtQ3.js → LogsPage-6Po7_T2u.js} +1 -1
- package/dist/ui/assets/{MeetingPage-CSLFvHL7.js → MeetingPage-qrpYGVD-.js} +1 -1
- package/dist/ui/assets/{ModelSelector-BCfvugHB.js → ModelSelector-C8ny_pxu.js} +1 -1
- package/dist/ui/assets/{Office3DPage-BE6Epe0d.js → Office3DPage-BYwLMTCl.js} +1 -1
- package/dist/ui/assets/{ProvidersPage-D0cApfM1.js → ProvidersPage-DP9v_1ko.js} +1 -1
- package/dist/ui/assets/{RecoverPage-BVUPHG9z.js → RecoverPage-BXwjLfap.js} +1 -1
- package/dist/ui/assets/SettingsPage-DD7GKtS6.js +9 -0
- package/dist/ui/assets/{SetupPage-In19p30M.js → SetupPage-D7YX2io-.js} +1 -1
- package/dist/ui/assets/{WebChatPage-ByVBSzxL.js → WebChatPage-C3cgimxd.js} +1 -1
- package/dist/ui/assets/{activity-BIIli7ET.js → activity-DZKL7dg4.js} +1 -1
- package/dist/ui/assets/{agentCapabilities-D1PD9yFH.js → agentCapabilities-DuGs07XP.js} +1 -1
- package/dist/ui/assets/arrow-left-12JaXVoH.js +1 -0
- package/dist/ui/assets/arrow-right-Dbui5p0d.js +1 -0
- package/dist/ui/assets/arrow-up-right-CJBtXRrp.js +1 -0
- package/dist/ui/assets/{calendar-S9-_Q6QR.js → calendar-CkDsc4OJ.js} +1 -1
- package/dist/ui/assets/check-DxOMIDcl.js +1 -0
- package/dist/ui/assets/chevron-down-CObv-xyx.js +1 -0
- package/dist/ui/assets/chevron-left-C0mqwhLU.js +1 -0
- package/dist/ui/assets/chevron-right-jCt1h8Kw.js +1 -0
- package/dist/ui/assets/chevron-up-DX_5iw7O.js +1 -0
- package/dist/ui/assets/{circle-alert-DTVW4R94.js → circle-alert-BkP6x0zQ.js} +1 -1
- package/dist/ui/assets/circle-check-CXC2AiMS.js +1 -0
- package/dist/ui/assets/{circle-x-CJXbXzRh.js → circle-x-h4OJiHV3.js} +1 -1
- package/dist/ui/assets/{copy-X_TPpA-A.js → copy-BtpYEEvV.js} +1 -1
- package/dist/ui/assets/{dialog-uUBz_NIB.js → dialog-CO1WrPJc.js} +1 -1
- package/dist/ui/assets/{download-C-fXu08w.js → download-aPuVaZik.js} +1 -1
- package/dist/ui/assets/{earth-CTsVjCmp.js → earth-sc8YJMc0.js} +1 -1
- package/dist/ui/assets/{ellipsis-vertical-5zBh5yzc.js → ellipsis-vertical-DEBZJGzY.js} +1 -1
- package/dist/ui/assets/{external-link-CvpRhwC_.js → external-link-D_C_678M.js} +1 -1
- package/dist/ui/assets/{eye-CM-HQEWU.js → eye-BfN613fx.js} +1 -1
- package/dist/ui/assets/{file-text-lwkvYGtA.js → file-text-Bth5pPZX.js} +1 -1
- package/dist/ui/assets/gauge-DypSzSOE.js +1 -0
- package/dist/ui/assets/{history-eSHspWRr.js → history-njH_sPSo.js} +1 -1
- package/dist/ui/assets/{index-ZjAc-KQS.js → index-D-9yCvjP.js} +2 -2
- package/dist/ui/assets/index-wML8DaUo.css +2 -0
- package/dist/ui/assets/{info-DTgFQ_jA.js → info-Def2ZFeP.js} +1 -1
- package/dist/ui/assets/{key-CeM9JJkq.js → key-D8bkDl83.js} +1 -1
- package/dist/ui/assets/loader-circle-wLVzSdML.js +1 -0
- package/dist/ui/assets/{lock-open-B089GUAJ.js → lock-open-Cdopbw1b.js} +1 -1
- package/dist/ui/assets/{mail--gNFIe4M.js → mail-BQ_YA9_b.js} +1 -1
- package/dist/ui/assets/{pause-DjT1nwQM.js → pause-CvS_LzKx.js} +1 -1
- package/dist/ui/assets/{pencil-6PRgdjiU.js → pencil-C3tPvnCk.js} +1 -1
- package/dist/ui/assets/play-C-oR-PMH.js +1 -0
- package/dist/ui/assets/plus-CF9No2td.js +1 -0
- package/dist/ui/assets/{radio-D-joO9J0.js → radio-dsaiFxuT.js} +1 -1
- package/dist/ui/assets/{refresh-cw-BRrzoHQW.js → refresh-cw-BmYQwOhh.js} +1 -1
- package/dist/ui/assets/search-CTONpTyl.js +1 -0
- package/dist/ui/assets/{select-BOR8MsSL.js → select-BfRyBbi9.js} +1 -1
- package/dist/ui/assets/{send-DIlj81PT.js → send-C3o2wpLi.js} +1 -1
- package/dist/ui/assets/{settings-CkBjgAEm.js → settings-DEpdBuf2.js} +1 -1
- package/dist/ui/assets/{shield-U0hIjGzm.js → shield-gbUkSqfi.js} +1 -1
- package/dist/ui/assets/{sparkles-VXHGDbNh.js → sparkles-Ccd1JZ3s.js} +1 -1
- package/dist/ui/assets/{square-OHeetvN3.js → square-BrwQ6Mun.js} +1 -1
- package/dist/ui/assets/terminal-DP9j3HjM.js +1 -0
- package/dist/ui/assets/{trash-2-DQxm7DUM.js → trash-2-CfCs7RhJ.js} +1 -1
- package/dist/ui/assets/{triangle-alert-Dj8ZhmWj.js → triangle-alert-C3lWSnRr.js} +1 -1
- package/dist/ui/assets/{useHiveAgentsModelLoad-COLvs-Ho.js → useHiveAgentsModelLoad-D3s2U82M.js} +1 -1
- package/dist/ui/assets/{useProviders-q6iROeWE.js → useProviders-B3rT_xU9.js} +1 -1
- package/dist/ui/assets/{volume-x-Bm735CXN.js → volume-x-D2h9cyml.js} +1 -1
- package/dist/ui/assets/{wifi-DklBfOZ6.js → wifi-CGQECzu2.js} +1 -1
- package/dist/ui/assets/{zap-BEZNJ0i0.js → zap-B1azpiE7.js} +1 -1
- package/dist/ui/index.html +2 -2
- package/package.json +1 -1
- package/packages/cli/src/index.ts +23 -17
- package/packages/core/src/canvas/canvas-manager.ts +36 -7
- package/packages/core/src/gateway/routes/a2ui.ts +43 -0
- package/packages/core/src/gateway/routes/runtime.ts +58 -0
- package/packages/core/src/gateway/routes/setup.ts +127 -108
- package/packages/core/src/gateway/server.ts +16 -0
- package/packages/core/src/storage/onboarding.ts +23 -7
- package/packages/core/src/storage/seed.ts +31 -2
- package/dist/ui/assets/A2UIPage-D4nzp5NV.js +0 -8
- package/dist/ui/assets/AgentNewPage-CfBU7puz.js +0 -1
- package/dist/ui/assets/SettingsPage-DCZ4nql4.js +0 -9
- package/dist/ui/assets/arrow-left-BfcnX8Er.js +0 -1
- package/dist/ui/assets/arrow-right-Q-dzAn8k.js +0 -1
- package/dist/ui/assets/arrow-up-right-Bf-8wrUQ.js +0 -1
- package/dist/ui/assets/check-CryV78SQ.js +0 -1
- package/dist/ui/assets/chevron-down-QCtMs-Af.js +0 -1
- package/dist/ui/assets/chevron-left-dTGbyl5G.js +0 -1
- package/dist/ui/assets/chevron-right-D0GjXbnO.js +0 -1
- package/dist/ui/assets/chevron-up-Cg0jO8uT.js +0 -1
- package/dist/ui/assets/circle-check-BAolxswA.js +0 -1
- package/dist/ui/assets/gauge-CB-cas-h.js +0 -1
- package/dist/ui/assets/index-D489S18g.css +0 -2
- package/dist/ui/assets/loader-circle-Dtfz4FWw.js +0 -1
- package/dist/ui/assets/play-tOrP0xUJ.js +0 -1
- package/dist/ui/assets/plus-Cnom3j47.js +0 -1
- package/dist/ui/assets/search-D277MUP0.js +0 -1
- package/dist/ui/assets/terminal-C6YPcJl_.js +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{f as t}from"./vendor-charts-K3xcRl0X.js";import{o as n}from"./vendor-query-Dj8xYhQD.js";import{t as r}from"./arrow-left-12JaXVoH.js";import{t as i}from"./arrow-right-Dbui5p0d.js";import{t as a}from"./calendar-CkDsc4OJ.js";import{t as o}from"./check-DxOMIDcl.js";import{t as s}from"./circle-alert-BkP6x0zQ.js";import{t as c}from"./download-aPuVaZik.js";import{t as l}from"./ellipsis-vertical-DEBZJGzY.js";import{n as u,t as d}from"./eye-BfN613fx.js";import{t as f}from"./info-Def2ZFeP.js";import{t as p}from"./lock-open-Cdopbw1b.js";import{n as m,t as h}from"./pencil-C3tPvnCk.js";import{t as ee}from"./mail-BQ_YA9_b.js";import{t as te}from"./plus-CF9No2td.js";import{t as ne}from"./refresh-cw-BmYQwOhh.js";import{t as re}from"./search-CTONpTyl.js";import{t as g}from"./send-C3o2wpLi.js";import{t as _}from"./settings-DEpdBuf2.js";import{t as v}from"./trash-2-CfCs7RhJ.js";import{t as ie}from"./triangle-alert-C3lWSnRr.js";import{n as ae,t as oe}from"./wifi-CGQECzu2.js";import{l as se}from"./vendor-router-zpB-76nT.js";import{B as y,C as b,F as x,G as ce,K as S,M as le,S as C,T as w,_ as T,b as E,d as D,f as O,v as k,w as A,x as j,y as M}from"./index-D-9yCvjP.js";import{t as N}from"./badge-DKGZbVZJ.js";import{t as P}from"./scroll-area-CfHn94Vb.js";import{t as F}from"./slider-CmE_z1Ii.js";import{i as I,n as L,r as R,t as z}from"./tabs-CxiybXcw.js";import{c as B,i as V,r as H,s as U,t as W}from"./dialog-CO1WrPJc.js";var ue=S(`Camera`,[[`path`,{d:`M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z`,key:`1tc9qg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),G=S(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),de=S(`CreditCard`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`2`,key:`ynyp8z`}],[`line`,{x1:`2`,x2:`22`,y1:`10`,y2:`10`,key:`1b3vmo`}]]),fe=S(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),pe=S(`Folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),K=S(`Heart`,[[`path`,{d:`M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z`,key:`c3ymky`}]]),me=S(`House`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`1d0kgt`}]]),he=S(`Image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),ge=S(`MapPin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),_e=S(`Phone`,[[`path`,{d:`M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z`,key:`foiqr5`}]]),ve=S(`Printer`,[[`path`,{d:`M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2`,key:`143wyd`}],[`path`,{d:`M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6`,key:`1itne7`}],[`rect`,{x:`6`,y:`14`,width:`12`,height:`8`,rx:`1`,key:`1ue0tg`}]]),ye=S(`Share2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),be=S(`ShoppingCart`,[[`circle`,{cx:`8`,cy:`21`,r:`1`,key:`jimo8o`}],[`circle`,{cx:`19`,cy:`21`,r:`1`,key:`13723u`}],[`path`,{d:`M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12`,key:`9zh506`}]]),xe=S(`Star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),Se=S(`Upload`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`17 8 12 3 7 8`,key:`t8dd8p`}],[`line`,{x1:`12`,x2:`12`,y1:`3`,y2:`15`,key:`widbto`}]]),q=e(t(),1),J=n(),Y={h1:`text-2xl font-black text-white`,h2:`text-xl font-bold text-white`,h3:`text-base font-bold text-white`,h4:`text-sm font-semibold text-white/90`,h5:`text-xs font-semibold text-white/80`,body:`text-sm text-white/70 leading-relaxed`,caption:`text-xs text-white/40`,label:`text-xs font-semibold text-white/50 uppercase tracking-wider`,code:`font-mono text-xs text-green-300 bg-black/40 rounded-lg p-3 leading-relaxed whitespace-pre-wrap break-all`};function Ce({def:e,ctx:t}){let n=b(e.text,t.dataModel,t.scopeData),r=e.variant??e.usageHint??`body`,i=Y[r]??Y.body;if(r===`code`)return(0,J.jsx)(`pre`,{className:i,children:n});let a=n.split(/(\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`|\n)/g);return(0,J.jsx)(`p`,{className:i,style:e.weight?{flex:e.weight}:void 0,children:a.map((e,t)=>e.startsWith(`**`)&&e.endsWith(`**`)?(0,J.jsx)(`strong`,{className:`font-bold`,children:e.slice(2,-2)},t):e.startsWith(`*`)&&e.endsWith(`*`)?(0,J.jsx)(`em`,{className:`italic`,children:e.slice(1,-1)},t):e.startsWith("`")&&e.endsWith("`")?(0,J.jsx)(`code`,{className:`font-mono text-green-300 bg-black/30 px-1 rounded text-[0.9em]`,children:e.slice(1,-1)},t):e===`
|
|
2
|
+
`?(0,J.jsx)(`br`,{},t):e)})}function we(e,t,n,r){let i=[];for(let a of e)X(a,t,n,r)||i.push({message:a.message??`Validation failed: ${a.call}`});return{valid:i.length===0,errors:i}}function X(e,t,n,r){if(e.condition)return k(e.condition,t,n,r)===!0;let i=k({call:e.call,args:e.args??{}},t,n,r);return i===!0||i===`true`}function Te(e,t,n,r){if(!e||e.length===0)return!1;for(let i of e)if(!X(i,t,n,r))return!0;return!1}function Ee({def:e,ctx:t}){let n=e.action,r=e.variant??`primary`,i=e.disabled===!0||Te(e.checks,t.dataModel,t.scopeData),a=r===`primary`?`bg-blue-600 hover:bg-blue-500 text-white font-bold`:r===`borderless`?`text-white/70 hover:text-white hover:bg-white/5`:`bg-white/5 hover:bg-white/10 text-white/70 border border-white/10`;return(0,J.jsx)(`button`,{onClick:()=>{if(i)return;let r=n?.event??n,a=r?.name;if(!a)return;let o={},s=r.context??{};for(let[e,n]of Object.entries(s))E(n)?o[e]=w(n.path,t.dataModel,t.scopeData):M(n)?o[e]=k(n,t.dataModel,t.scopeData):o[e]=n;t.onAction(a,o,e.id)},disabled:i,className:`w-full py-2.5 rounded-xl text-sm transition-all disabled:opacity-40 disabled:cursor-not-allowed flex items-center justify-center gap-2 ${a}`,style:e.weight?{flex:e.weight}:void 0,children:e.child?(0,J.jsx)(Q,{...t,id:e.child}):b(e.text,t.dataModel,t.scopeData)||`Button`})}var De={start:`flex-start`,end:`flex-end`,center:`center`,spaceBetween:`space-between`,spaceAround:`space-around`,spaceEvenly:`space-evenly`};function Oe({def:e,ctx:t}){return(0,J.jsx)(`div`,{className:`flex flex-row gap-2`,style:{justifyContent:De[String(e.justify??e.distribution??`start`)]??`flex-start`,alignItems:(()=>{let t=e.align??e.alignment;return t===`center`?`center`:t===`end`?`flex-end`:t===`stretch`?`stretch`:`flex-start`})(),...e.weight?{flex:e.weight}:{}},children:$(e.children,t)})}var ke={start:`flex-start`,end:`flex-end`,center:`center`,spaceBetween:`space-between`,spaceAround:`space-around`,spaceEvenly:`space-evenly`};function Ae({def:e,ctx:t}){return(0,J.jsx)(`div`,{className:`flex flex-col gap-3`,style:{justifyContent:ke[String(e.justify??e.distribution??`start`)]??`flex-start`,alignItems:(()=>{let t=e.align??e.alignment;return t===`center`?`center`:t===`end`?`flex-end`:t===`stretch`?`stretch`:`flex-start`})(),...e.weight?{flex:e.weight}:{}},children:$(e.children,t)})}function je({def:e,ctx:t}){return(0,J.jsx)(`div`,{className:`rounded-xl border p-4`,style:{background:`rgba(255,255,255,0.03)`,borderColor:`rgba(255,255,255,0.08)`,...e.weight?{flex:e.weight}:{}},children:e.child&&(0,J.jsx)(Q,{...t,id:e.child})})}function Me({def:e,ctx:t}){let n=e.direction===`horizontal`?`flex-row`:`flex-col`;return e.children?(0,J.jsx)(`div`,{className:`flex ${n} gap-2 overflow-x-auto pb-1`,style:e.weight?{flex:e.weight}:void 0,children:$(e.children,t)}):e.child?(0,J.jsx)(Q,{...t,id:e.child}):null}function Ne({def:e}){return(0,J.jsx)(`div`,{className:e.axis===`vertical`?`w-px bg-white/[0.06] self-stretch`:`h-px bg-white/[0.06] w-full`,style:e.weight?{flex:e.weight}:void 0})}var Pe={contain:`contain`,cover:`cover`,fill:`fill`,none:`none`,"scale-down":`scale-down`},Fe={icon:`w-8 h-8`,avatar:`w-12 h-12 rounded-full`,smallFeature:`w-24 h-24`,mediumFeature:`w-48 h-48`,largeFeature:`w-64 h-64`,header:`w-full h-48`};function Ie({def:e,ctx:t}){let n=b(e.url,t.dataModel,t.scopeData);if(!n)return null;let r=Pe[e.fit??`contain`]??`contain`,i=Fe[e.usageHint??``]??``,a=typeof e.alt==`string`?e.alt:``;return(0,J.jsx)(`div`,{className:`rounded-xl overflow-hidden border border-white/[0.08] ${i}`,style:e.weight?{flex:e.weight}:void 0,children:(0,J.jsx)(`img`,{src:n,alt:a,className:`w-full max-h-64 block`,style:{objectFit:r}})})}var Le={settings:_,home:me,search:re,mail:ee,call:_e,camera:ue,calendarToday:a,star:xe,check:o,close:le,delete:v,download:c,upload:Se,edit:h,refresh:ne,send:g,share:ye,shoppingCart:be,warning:ie,info:f,error:s,favorite:K,favoriteOff:K,folder:pe,help:G,lock:m,lockOpen:p,visibility:d,visibilityOff:u,add:te,arrowBack:r,arrowForward:i,accountCircle:x,notifications:ce,moreVert:l,moreHoriz:fe,locationOn:ge,payment:de,photo:he,print:ve,person:x};function Re({def:e,ctx:t}){return(0,J.jsx)(Le[b(e.name,t.dataModel,t.scopeData)]??G,{className:`text-white/70`,style:e.weight?{flex:e.weight}:void 0})}function ze({def:e,ctx:t}){let[n,r]=(0,q.useState)(b((typeof e.value==`object`&&e.value,e.value),t.dataModel,t.scopeData)),i=b(e.label,t.dataModel,t.scopeData),a=b(e.placeholder,t.dataModel,t.scopeData),o=e.variant??e.textFieldType??`shortText`,s=o===`code`||o===`multiline_code`,c=o===`longText`||s||o===`multiline`,l=e.checks?we(e.checks,t.dataModel,t.scopeData):e.validationRegexp&&n?new RegExp(e.validationRegexp).test(n)?{valid:!0,errors:[]}:{valid:!1,errors:[{message:`Formato inválido`}]}:{valid:!0,errors:[]},u=n=>{if(r(n.target.value),typeof e.value==`object`&&e.value!==null&&`path`in e.value){let r=e.value.path;t.setDataModel(e=>{let t=structuredClone(e),i=r.replace(/^\//,``).split(`/`),a=t;for(let e=0;e<i.length-1;e++)a[i[e]]??(a[i[e]]={}),a=a[i[e]];return a[i[i.length-1]]=n.target.value,t})}},d=n=>{let r=e.action,i=(r?.event??r)?.name;i&&t.onAction(i,{value:n},e.id)},f=e=>{d(e.target.value)},p=e=>{e.key===`Enter`&&!c&&d(e.target.value)},m=`w-full rounded-xl border px-3 py-2.5 text-sm resize-none outline-none transition-all
|
|
3
|
+
bg-white/[0.04] border-white/[0.08] focus:border-blue-500/50 focus:bg-white/[0.06]
|
|
4
|
+
disabled:opacity-50 placeholder:text-white/20
|
|
5
|
+
${s?`font-mono text-green-300 leading-relaxed`:`text-white/80 leading-relaxed`}
|
|
6
|
+
${l.valid?``:`border-red-500/50`}`;return(0,J.jsxs)(`div`,{className:`space-y-1.5`,style:e.weight?{flex:e.weight}:void 0,children:[i&&(0,J.jsx)(`label`,{className:`text-xs font-semibold text-white/45 uppercase tracking-wider`,children:i}),c?(0,J.jsx)(`textarea`,{value:n,onChange:u,onBlur:f,onKeyDown:p,placeholder:a,rows:s?5:3,className:m}):(0,J.jsx)(`input`,{type:o===`obscured`?`password`:o===`number`?`number`:`text`,value:n,onChange:u,onBlur:f,onKeyDown:p,placeholder:a,className:m}),!l.valid&&l.errors.length>0&&(0,J.jsx)(`p`,{className:`text-xs text-red-400`,children:l.errors[0].message})]})}function Be({def:e,ctx:t}){let n=b(e.label,t.dataModel,t.scopeData),[r,i]=(0,q.useState)(j(e.value,t.dataModel,t.scopeData));return(0,J.jsxs)(`label`,{className:`flex items-center gap-2.5 cursor-pointer`,style:e.weight?{flex:e.weight}:void 0,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:r,onChange:n=>{if(i(n.target.checked),typeof e.value==`object`&&e.value!==null&&`path`in e.value){let r=e.value.path;t.setDataModel(e=>{let t=structuredClone(e),i=r.replace(/^\//,``).split(`/`),a=t;for(let e=0;e<i.length-1;e++)a[i[e]]??(a[i[e]]={}),a=a[i[e]];return a[i[i.length-1]]=n.target.checked,t})}},className:`w-4 h-4 rounded border-white/20 bg-white/5 text-blue-500 focus:ring-blue-500/30`}),(0,J.jsx)(`span`,{className:`text-sm text-white/70`,children:n})]})}function Ve({def:e,ctx:t}){let n=e.variant===`mutuallyExclusive`?`single`:`multi`,r=e.maxAllowedSelections??(n===`single`?1:5),[i,a]=(0,q.useState)(A(e.selections??e.value,t.dataModel,t.scopeData)),o=e.options??[],s=i=>{a(a=>{let o;o=n===`single`?[i]:a.includes(i)?a.filter(e=>e!==i):a.length>=r?a:[...a,i];let s=e.selections??e.value;if(typeof s==`object`&&s&&`path`in s){let e=s.path;t.setDataModel(t=>{let n=structuredClone(t),r=e.replace(/^\//,``).split(`/`),i=n;for(let e=0;e<r.length-1;e++)i[r[e]]??(i[r[e]]={}),i=i[r[e]];return i[r[r.length-1]]=o,n})}let c=e.action,l=(c?.event??c)?.name;return l&&t.onAction(l,{selections:o,selected:o[0]??null},e.id),o})};return(0,J.jsx)(`div`,{className:`space-y-2`,style:e.weight?{flex:e.weight}:void 0,children:o.map((e,n)=>{let r=b(e.label,t.dataModel,t.scopeData),a=e.value??r,o=i.includes(a),c=String.fromCharCode(65+n);return(0,J.jsxs)(`button`,{type:`button`,onClick:()=>s(a),className:`w-full text-left px-3 py-2.5 rounded-xl border text-sm transition-all flex items-center gap-2.5
|
|
7
|
+
${o?`bg-blue-500/15 border-blue-500/50 text-blue-100`:`bg-white/[0.03] border-white/[0.08] text-white/65 hover:border-white/20 hover:bg-white/[0.06]`}`,children:[(0,J.jsx)(`span`,{className:`text-xs font-bold w-6 h-6 rounded-lg flex items-center justify-center flex-shrink-0 transition-colors
|
|
8
|
+
${o?`bg-blue-500/40 text-blue-200`:`bg-white/5 text-white/40`}`,children:o?`✓`:c}),(0,J.jsx)(`span`,{className:`leading-snug`,children:r})]},n)})})}function He({def:e,ctx:t}){let n=typeof e.min==`number`?e.min:e.minValue??0,r=typeof e.max==`number`?e.max:e.maxValue??100,i=typeof e.step==`number`?e.step:1,a=e.label,[o,s]=(0,q.useState)(C(e.value,t.dataModel,t.scopeData)),c=n=>{if(typeof e.value==`object`&&e.value!==null&&`path`in e.value){let r=e.value.path;t.setDataModel(e=>{let t=structuredClone(e),i=r.replace(/^\//,``).split(`/`),a=t;for(let e=0;e<i.length-1;e++)a[i[e]]??(a[i[e]]={}),a=a[i[e]];return a[i[i.length-1]]=n,t})}};return(0,J.jsxs)(`div`,{className:`space-y-2`,style:e.weight?{flex:e.weight}:void 0,children:[a&&(0,J.jsx)(`span`,{className:`text-xs font-semibold text-white/45 uppercase tracking-wider`,children:a}),(0,J.jsxs)(`div`,{className:`flex justify-between text-xs text-white/40`,children:[(0,J.jsx)(`span`,{children:n}),(0,J.jsx)(`span`,{className:`text-white/70 font-mono`,children:o}),(0,J.jsx)(`span`,{children:r})]}),(0,J.jsx)(F,{value:[o],min:n,max:r,step:i,onValueChange:e=>{s(e[0]),c(e[0])},onValueCommit:n=>{let r=n[0],i=e.action,a=(i?.event??i)?.name;a&&t.onAction(a,{value:r},e.id)},className:`w-full`})]})}function Ue({def:e,ctx:t}){let[n,r]=(0,q.useState)(``),i=n=>{if(r(n.target.value),typeof e.value==`object`&&e.value!==null&&`path`in e.value){let r=e.value.path;t.setDataModel(e=>{let t=structuredClone(e),i=r.replace(/^\//,``).split(`/`),a=t;for(let e=0;e<i.length-1;e++)a[i[e]]??(a[i[e]]={}),a=a[i[e]];return a[i[i.length-1]]=n.target.value,t})}},a=e.enableTime&&e.enableDate?`datetime-local`:e.enableDate?`date`:`time`;return(0,J.jsxs)(`div`,{className:`space-y-1.5`,style:e.weight?{flex:e.weight}:void 0,children:[e.label&&(0,J.jsx)(`label`,{className:`text-xs font-semibold text-white/45 uppercase tracking-wider`,children:typeof e.label==`string`?e.label:String(e.label)}),(0,J.jsx)(`input`,{type:a,value:n,onChange:i,className:`w-full rounded-xl border px-3 py-2.5 text-sm bg-white/[0.04] border-white/[0.08] focus:border-blue-500/50 focus:bg-white/[0.06] outline-none text-white/80`})]})}function Z({def:e,ctx:t}){let n=Array.isArray(e.tabs)?e.tabs:e.tabItems??[];return(0,J.jsxs)(z,{defaultValue:n[0]?.title?b(n[0].title,t.dataModel,t.scopeData):``,style:e.weight?{flex:e.weight}:void 0,children:[(0,J.jsx)(R,{className:`w-full`,children:n.map((e,n)=>(0,J.jsx)(I,{value:b(e.title,t.dataModel,t.scopeData),children:b(e.title,t.dataModel,t.scopeData)},n))}),n.map((e,n)=>(0,J.jsx)(L,{value:b(e.title,t.dataModel,t.scopeData),children:(0,J.jsx)(Q,{...t,id:e.child})},n))]})}function We({def:e,ctx:t}){let[n,r]=(0,q.useState)(!1);return(0,J.jsxs)(W,{open:n,onOpenChange:r,children:[(e.trigger??e.entryPointChild)&&(0,J.jsx)(B,{asChild:!0,children:(0,J.jsx)(`div`,{className:`cursor-pointer`,children:(0,J.jsx)(Q,{...t,id:e.trigger??e.entryPointChild})})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(U,{className:`sr-only`,children:`Interactive modal`}),(0,J.jsx)(V,{className:`sr-only`,children:`Interactive modal content generated by the agent.`}),(e.content??e.contentChild)&&(0,J.jsx)(Q,{...t,id:e.content??e.contentChild})]})]})}function Ge({def:e,ctx:t}){let n=b(e.url,t.dataModel,t.scopeData);return n?(0,J.jsx)(`div`,{className:`rounded-xl overflow-hidden border border-white/[0.08]`,style:e.weight?{flex:e.weight}:void 0,children:(0,J.jsx)(`video`,{src:n,controls:!0,className:`w-full max-h-96`,children:`Tu navegador no soporta video.`})}):null}function Ke({def:e,ctx:t}){let n=b(e.url,t.dataModel,t.scopeData),r=b(e.description,t.dataModel,t.scopeData);return n?(0,J.jsxs)(`div`,{className:`rounded-xl border border-white/[0.08] p-4 bg-white/[0.02]`,style:e.weight?{flex:e.weight}:void 0,children:[r&&(0,J.jsx)(`p`,{className:`text-xs text-white/40 mb-2`,children:r}),(0,J.jsx)(`audio`,{src:n,controls:!0,className:`w-full`,style:{height:40},children:`Tu navegador no soporta audio.`})]}):null}function qe({surface:e,onAction:t,isLoading:n}){let{components:r,dataModel:i,rootId:a,theme:o}=e,[s,c]=(0,q.useState)(()=>structuredClone(i));(0,q.useEffect)(()=>{c(structuredClone(i))},[i]);let l=(0,q.useMemo)(()=>{let e=new Map;for(let t of r)e.set(t.id,t);return e},[r]),u=o?.primaryColor||`#3B82F6`,d=(0,q.useCallback)((n,r,i)=>{t&&t({name:n,surfaceId:e.surfaceId,sourceComponentId:i,timestamp:new Date().toISOString(),context:r})},[t,e.surfaceId]);return n?(0,J.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,J.jsx)(`span`,{className:`text-white/30 text-sm animate-pulse`,children:`Cargando superficie...`})}):!a||!l.has(a)?(0,J.jsx)(`div`,{className:`flex items-center justify-center py-8 text-white/20 text-sm`,children:`Sin contenido disponible`}):(0,J.jsx)(`div`,{className:`a2ui-surface`,style:{"--a2ui-primary":u},children:(0,J.jsx)(Q,{id:a,compMap:l,dataModel:s,setDataModel:c,scopeData:void 0,onAction:d})})}function Q(e){let t=e.compMap.get(e.id);if(!t)return null;let n=t.component?.replace(/[^\x00-\x7F]/g,``).trim();switch(n){case`Text`:return(0,J.jsx)(Ce,{def:t,ctx:e});case`Button`:return(0,J.jsx)(Ee,{def:t,ctx:e});case`Row`:return(0,J.jsx)(Oe,{def:t,ctx:e});case`Column`:return(0,J.jsx)(Ae,{def:t,ctx:e});case`Card`:return(0,J.jsx)(je,{def:t,ctx:e});case`List`:return(0,J.jsx)(Me,{def:t,ctx:e});case`Divider`:return(0,J.jsx)(Ne,{def:t,ctx:e});case`Image`:return(0,J.jsx)(Ie,{def:t,ctx:e});case`Icon`:return(0,J.jsx)(Re,{def:t,ctx:e});case`TextField`:return(0,J.jsx)(ze,{def:t,ctx:e});case`CheckBox`:return(0,J.jsx)(Be,{def:t,ctx:e});case`ChoicePicker`:return(0,J.jsx)(Ve,{def:t,ctx:e});case`Slider`:return(0,J.jsx)(He,{def:t,ctx:e});case`DateTimeInput`:return(0,J.jsx)(Ue,{def:t,ctx:e});case`Tabs`:return(0,J.jsx)(Z,{def:t,ctx:e});case`Modal`:return(0,J.jsx)(We,{def:t,ctx:e});case`Video`:return(0,J.jsx)(Ge,{def:t,ctx:e});case`AudioPlayer`:return(0,J.jsx)(Ke,{def:t,ctx:e});default:return(0,J.jsxs)(`div`,{className:`rounded-md border border-dashed border-white/10 px-3 py-2 text-xs text-white/30`,children:[`Unknown component: `,n]})}}function $(e,t){if(!e)return[];if(typeof e==`string`)return[(0,J.jsx)(Q,{...t,id:e},e)];if(Array.isArray(e))return e.map(e=>(0,J.jsx)(Q,{...t,id:e},e));if(`explicitList`in e||`array`in e)return(`explicitList`in e?e.explicitList:e.array).map(e=>(0,J.jsx)(Q,{...t,id:e},e));if(`path`in e&&`componentId`in e){let n=e,r=w(n.path,t.dataModel,t.scopeData);return Array.isArray(r)?r.map((e,r)=>{let i=typeof e==`object`&&e?e:{value:e,index:r};return(0,J.jsx)(Q,{...t,id:n.componentId,scopeData:i},`${n.componentId}_${r}`)}):[]}if(`template`in e){let n=e.template,r=w(n.dataBinding,t.dataModel,t.scopeData);return Array.isArray(r)?r.map((e,r)=>{let i=typeof e==`object`&&e?e:{value:e,index:r};return(0,J.jsx)(Q,{...t,id:n.componentId,scopeData:i},`${n.componentId}_${r}`)}):[]}return[]}function Je(){let e=T(e=>e.a2uiSurfaces),t=T(e=>e.sendA2UIAction),n=T(e=>e.deleteA2UISurface),[r,i]=(0,q.useState)(null),a=(0,q.useCallback)(e=>{t(e)},[t]),o=async e=>{i(e);try{await O(`/api/a2ui/surfaces/${encodeURIComponent(e)}`,{method:`DELETE`,showError:!0}),n(e)}catch{}finally{i(null)}},s=Array.from(e.values());return(0,J.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,style:{backgroundImage:`radial-gradient(circle, rgba(59,130,246,0.03) 1px, transparent 1px)`,backgroundSize:`40px 40px`},children:[s.length===0?(0,J.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-white/20`,children:[(0,J.jsx)(y,{className:`h-10 w-10 opacity-30`}),(0,J.jsx)(`p`,{className:`text-sm`,children:`Sin paneles interactivos activos`}),(0,J.jsx)(`p`,{className:`text-xs text-white/15`,children:`Los resultados y formularios creados por los agentes aparecerán aquí.`})]}):(0,J.jsx)(P,{className:`flex-1 p-6`,children:s.length>0&&(0,J.jsx)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2`,children:s.map(e=>(0,J.jsxs)(`div`,{className:`rounded-xl border border-blue-500/20 bg-[rgba(255,255,255,0.02)] backdrop-blur-sm p-4`,style:e.theme?.primaryColor?{borderColor:`${e.theme.primaryColor}33`}:void 0,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 mb-3 pb-3 border-b border-white/5`,children:[e.theme?.agentDisplayName?(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.theme.iconUrl&&(0,J.jsx)(`img`,{src:e.theme.iconUrl,alt:``,className:`w-5 h-5 rounded-full`}),(0,J.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider`,style:{color:e.theme.primaryColor??`#93c5fd`},children:e.theme.agentDisplayName})]}):(0,J.jsx)(`span`,{className:`font-mono text-[10px] text-white/40`,children:e.surfaceId}),(0,J.jsx)(`button`,{type:`button`,title:`Eliminar superficie ${e.surfaceId}`,"aria-label":`Eliminar superficie ${e.surfaceId}`,disabled:r===e.surfaceId,onClick:()=>o(e.surfaceId),className:`rounded-md p-1.5 text-white/25 transition hover:bg-red-500/10 hover:text-red-300 disabled:opacity-40`,children:(0,J.jsx)(v,{className:`h-3.5 w-3.5`})})]}),(0,J.jsx)(qe,{surface:e,onAction:a})]},e.surfaceId))})}),(0,J.jsx)(`div`,{className:`border-t border-white/5 bg-white/[0.02] px-6 py-2.5`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(y,{className:`h-3 w-3 text-blue-400/50`}),(0,J.jsx)(`span`,{className:`hive-mono`,children:s.length>0?`${s.length} superficie${s.length>1?`s`:``} A2UI activa${s.length>1?`s`:``}`:`Panel interactivo · sin superficies`})]})})]})}function Ye(){let{sessionId:e}=se(),{currentUser:t}=D(),n=T(e=>e.isConnected),r=T(e=>e.markA2UISeen),i=e&&e!==`default`?e:t?.id;return(0,q.useEffect)(()=>{r()},[r]),i?(0,J.jsx)(`div`,{className:`flex h-[calc(100vh-4rem)] flex-col bg-background/50 backdrop-blur-sm`,children:(0,J.jsx)(`div`,{className:`flex-1 overflow-hidden p-4 lg:p-8`,children:(0,J.jsx)(`div`,{className:`mx-auto h-full max-w-7xl`,children:(0,J.jsxs)(`div`,{className:`hive-card flex h-full flex-col shadow-2xl`,children:[(0,J.jsxs)(`div`,{className:`flex flex-row items-center justify-between space-y-0 border-b border-white/5 bg-white/5 px-6 py-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(`div`,{className:`hive-icon-wrap hive-icon-wrap--primary`,children:(0,J.jsx)(y,{className:`h-5 w-5`})}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`hive-title-page !text-lg`,children:`Panel interactivo`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-white/40 mt-0.5`,children:[(0,J.jsx)(x,{className:`h-3 w-3`}),(0,J.jsx)(`span`,{className:`font-mono`,children:i})]})]})]}),(0,J.jsx)(N,{variant:`outline`,className:`flex items-center gap-1.5 px-3 py-1 transition-all duration-500 border ${n?`bg-emerald-500/15 text-emerald-500 border-emerald-500/20 hover:bg-emerald-500/20`:`bg-red-500/15 text-red-500 border-red-500/20 hover:bg-red-500/20`}`,children:n?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(oe,{className:`h-3.5 w-3.5 animate-pulse`}),(0,J.jsx)(`span`,{className:`font-semibold uppercase tracking-wider text-[10px]`,children:`Live`})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(ae,{className:`h-3.5 w-3.5`}),(0,J.jsx)(`span`,{className:`font-semibold uppercase tracking-wider text-[10px]`,children:`Offline`})]})})]}),(0,J.jsx)(Je,{})]})})})}):(0,J.jsx)(`div`,{className:`flex h-[calc(100vh-4rem)] items-center justify-center`,children:(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,J.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Cargando sesión...`})]})})}export{Ye as A2UIPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{f as t}from"./vendor-charts-K3xcRl0X.js";import{o as n}from"./vendor-query-Dj8xYhQD.js";import{t as r}from"./check-CryV78SQ.js";import{t as i}from"./circle-alert-DTVW4R94.js";import{t as a}from"./useProviders-q6iROeWE.js";import{t as o}from"./external-link-CvpRhwC_.js";import{n as s,r as c,t as l}from"./ModelSelector-BCfvugHB.js";import{t as u}from"./loader-circle-Dtfz4FWw.js";import{t as d}from"./shield-U0hIjGzm.js";import{t as f}from"./sparkles-VXHGDbNh.js";import{t as p}from"./utils-Dyb7SC2_.js";import{M as m,O as h,f as g,k as _,m as v,s as y,t as b}from"./index-ZjAc-KQS.js";import{a as x,c as S,i as C,n as w,o as T,r as E,s as ee,t as D}from"./dialog-uUBz_NIB.js";import{t as O}from"./label-k0jYxoWW.js";import{t as k}from"./textarea-rp6vsOZl.js";import{i as A,n as j,o as M,s as N,t as P}from"./select-BOR8MsSL.js";import{t as F}from"./switch-DXcELPsM.js";import{a as I,i as L,n as R,r as z,t as B}from"./card-D3Nw3kh3.js";var V=e(t(),1),H=n(),U=[{value:`friendly`,label:`Amigable`},{value:`professional`,label:`Profesional`},{value:`casual`,label:`Casual`},{value:`formal`,label:`Formal`},{value:`creative`,label:`Creativo`}];function W({initialData:e,onSuccess:t,onCancel:n}){let{createAgent:W,updateAgent:G,isLoading:K,error:q}=b(),{activeProviders:te}=y(),[J,Y]=(0,V.useState)({isValidating:!1,exists:!1,accessible:!1}),[X,Z]=(0,V.useState)({name:``,description:``,tone:`professional`,provider_id:``,model_id:``,role:`coordinator`,enabled:!0,systemPrompt:``,workspace:e?.workspace||``});(0,V.useEffect)(()=>{e&&Z({...e,provider_id:e.provider_id||e.providerId||``,model_id:e.model_id||e.modelId||``})},[e]);let Q=async e=>{if(!e||e.trim()===``){Y({isValidating:!1,exists:!1,accessible:!1});return}Y({isValidating:!0,exists:!1,accessible:!1});try{let t=await g(`/api/workspace/validate`,{method:`POST`,body:{path:e}});Y({isValidating:!1,exists:t.exists,accessible:t.accessible,error:t.error,message:t.message})}catch(e){Y({isValidating:!1,exists:!1,accessible:!1,error:e.message})}},ne=async()=>{if(X.workspace)try{await g(`/api/workspace/create`,{method:`POST`,body:{path:X.workspace},showLoader:`Creando directorio...`,showSuccess:`Directorio creado exitosamente`}),await Q(X.workspace)}catch(e){v.fire(`Error`,e.message,`error`)}},re=async()=>{if(X.workspace)try{await g(`/api/workspace/open?path=${encodeURIComponent(X.workspace)}`,{method:`GET`})}catch(e){v.fire(`Error`,e.message,`error`)}},ie=async n=>{if(n.preventDefault(),!X.provider_id||!X.model_id){v.fire(`Incompleto`,`Por favor selecciona un proveedor y modelo`,`warning`);return}try{e?.id?await G(e.id,X):await W(X),t&&t()}catch(e){console.error(e)}},$=!!e?.id;return(0,H.jsxs)(B,{className:`hive-card--form group`,children:[(0,H.jsx)(`div`,{className:`hive-glow-blob--card absolute -top-24 -right-24 h-48 w-48 bg-blue-600/10 group-hover:bg-blue-600/20`,style:{borderRadius:`50%`,filter:`blur(80px)`}}),(0,H.jsx)(L,{className:`relative`,children:(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`hive-icon-wrap hive-icon-wrap--primary`,children:$?(0,H.jsx)(s,{className:`h-5 w-5`}):(0,H.jsx)(f,{className:`h-5 w-5`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(I,{className:`text-xl font-bold text-white/90`,children:$?`Configurar Nodo`:`Desplegar Nuevo Nodo`}),(0,H.jsx)(z,{className:`text-white/40`,children:$?`Ajusta los parámetros de tu agente inteligente.`:`Crea una nueva entidad inteligente para tu colmena.`})]})]}),n&&(0,H.jsx)(_,{variant:`ghost`,size:`icon`,onClick:n,className:`text-white/40 hover:text-white hover:bg-white/5`,children:(0,H.jsx)(m,{className:`h-5 w-5`})})]})}),(0,H.jsx)(R,{className:`relative space-y-6 pt-2`,children:(0,H.jsxs)(`form`,{onSubmit:ie,className:`space-y-8`,children:[(0,H.jsxs)(`div`,{className:`grid gap-6`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(O,{htmlFor:`name`,className:`hive-label--field`,children:`Nombre del Agente`}),(0,H.jsx)(h,{id:`name`,placeholder:`Ej: Analista de Mercado`,className:`hive-input`,value:X.name,onChange:e=>Z({...X,name:e.target.value}),disabled:K,required:!0})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(O,{htmlFor:`description`,className:`hive-label--field`,children:`Descripción / Rol`}),(0,H.jsx)(k,{id:`description`,placeholder:`Describe qué hace este agente y cuáles son sus objetivos...`,className:`hive-textarea`,value:X.description,onChange:e=>Z({...X,description:e.target.value}),disabled:K})]})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(O,{htmlFor:`systemPrompt`,className:`hive-label--field`,children:`System Prompt`}),(0,H.jsxs)(D,{children:[(0,H.jsx)(S,{asChild:!0,children:(0,H.jsx)(_,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 px-3 text-xs bg-blue-500/10 hover:bg-blue-500/20 text-blue-400 border-blue-500/30 transition-colors`,children:`Modifica acá el System Prompt`})}),(0,H.jsxs)(E,{className:`sm:max-w-3xl bg-[#0a0a0c] border-white/10 text-white shadow-2xl [&>button]:text-white/50 hover:[&>button]:text-white`,children:[(0,H.jsxs)(T,{children:[(0,H.jsx)(ee,{className:`text-xl`,children:`Editar System Prompt`}),(0,H.jsx)(C,{className:`text-sm text-white/50`,children:`El prompt base de comportamiento del agente. Se recomienda formato Markdown.`})]}),(0,H.jsx)(`div`,{className:`py-2`,children:(0,H.jsx)(k,{value:X.systemPrompt||``,onChange:e=>Z({...X,systemPrompt:e.target.value}),className:`min-h-[400px] font-mono text-sm bg-black/40 border-white/10 text-white/90 focus-visible:ring-blue-500/50 resize-y`,placeholder:`Escribe el system prompt detallado aquí...`,disabled:K})}),(0,H.jsx)(x,{children:(0,H.jsx)(w,{asChild:!0,children:(0,H.jsx)(_,{type:`button`,className:`bg-blue-600 hover:bg-blue-500 text-white shadow-[0_0_15px_rgba(37,99,235,0.3)]`,children:`Guardar Cambios`})})})]})]})]}),X.systemPrompt?(0,H.jsxs)(`p`,{className:`text-xs text-white/40 line-clamp-1 italic border border-white/5 bg-white/[0.02] p-2 rounded-md`,children:[`"`,X.systemPrompt,`"`]}):(0,H.jsx)(`p`,{className:`text-xs text-white/30 italic`,children:`Sin system prompt configurado...`})]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,H.jsx)(c,{className:`h-4 w-4 text-emerald-400`}),(0,H.jsx)(`h3`,{className:`hive-title-section`,children:`Workspace Directory`})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(O,{htmlFor:`workspace`,className:`hive-label--field`,children:`Directorio de Trabajo del Agente`}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(h,{id:`workspace`,placeholder:`Ej: /home/user/proyectos, D:\\Work, /Volumes/USB`,className:`hive-input flex-1 font-mono text-sm`,value:X.workspace,onChange:e=>{Z({...X,workspace:e.target.value}),Q(e.target.value)},disabled:K}),X.workspace&&J.exists&&J.accessible&&(0,H.jsx)(_,{type:`button`,variant:`outline`,size:`icon`,onClick:re,className:`shrink-0 border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10`,title:`Abrir en el explorador`,children:(0,H.jsx)(o,{className:`h-4 w-4`})})]}),(0,H.jsx)(`p`,{className:`text-xs text-white/40 leading-relaxed`,children:`Directorio donde el agente creará archivos, carpetas y ejecutará comandos. Puede ser cualquier ubicación en tu sistema (disco duro, USB, red, etc.).`}),X.workspace&&X.workspace.trim()!==``&&(0,H.jsxs)(`div`,{className:p(`flex items-center gap-2 text-xs p-2.5 rounded-lg border backdrop-blur-md transition-all`,J.isValidating&&`bg-blue-500/10 border-blue-500/20 text-blue-400`,!J.isValidating&&J.exists&&J.accessible&&`bg-emerald-500/10 border-emerald-500/20 text-emerald-400`,!J.isValidating&&J.exists&&!J.accessible&&`bg-amber-500/10 border-amber-500/20 text-amber-400`,!J.isValidating&&!J.exists&&`bg-purple-500/10 border-purple-500/20 text-purple-400`),children:[J.isValidating&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u,{className:`h-3.5 w-3.5 animate-spin`}),(0,H.jsx)(`span`,{children:`Validando directorio...`})]}),!J.isValidating&&J.exists&&J.accessible&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(r,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:J.message||`Directorio válido y accesible`})]}),!J.isValidating&&J.exists&&!J.accessible&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(i,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:J.message||`El directorio existe pero no tiene permisos de lectura/escritura`})]}),!J.isValidating&&!J.exists&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(c,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:J.message||`El directorio no existe`}),!J.error&&(0,H.jsx)(_,{type:`button`,variant:`outline`,size:`sm`,onClick:ne,className:`ml-auto h-6 px-2 text-xs bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 border-purple-500/30`,children:`Crear directorio`})]})]})]})]}),(0,H.jsx)(`div`,{className:`hive-card-divider`}),(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,H.jsx)(a,{className:`h-4 w-4 text-blue-400`}),(0,H.jsx)(`h3`,{className:`hive-title-section`,children:`Motor de Inteligencia`})]}),(0,H.jsx)(l,{selectedProviderId:X.provider_id||void 0,selectedModelId:X.model_id||void 0,onProviderChange:e=>Z({...X,provider_id:e,model_id:``}),onModelChange:e=>Z({...X,model_id:e}),disabled:K,typeFilter:`llm`})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(O,{htmlFor:`tone`,className:`hive-label--field`,children:`Tono de Voz`}),(0,H.jsxs)(P,{value:X.tone,onValueChange:e=>Z({...X,tone:e}),disabled:K,children:[(0,H.jsx)(M,{className:`hive-select-trigger`,children:(0,H.jsx)(N,{placeholder:`Selecciona un tono`})}),(0,H.jsx)(j,{className:`hive-select-content`,children:U.map(e=>(0,H.jsx)(A,{value:e.value,className:`hive-select-item`,children:e.label},e.value))})]})]}),(0,H.jsxs)(`div`,{className:`hive-toggle-panel`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(d,{className:`h-3.5 w-3.5 text-purple-400`}),(0,H.jsx)(O,{htmlFor:`role`,className:`text-xs font-medium text-white/70`,children:`Rol`})]}),(0,H.jsxs)(P,{value:X.role,onValueChange:e=>Z({...X,role:e}),disabled:K,children:[(0,H.jsx)(M,{className:`w-[120px] bg-white/5 border-white/10 text-white`,children:(0,H.jsx)(N,{})}),(0,H.jsxs)(j,{className:`bg-zinc-900 border-white/10`,children:[(0,H.jsx)(A,{value:`coordinator`,children:`Coordinador`}),(0,H.jsx)(A,{value:`worker`,children:`Worker`})]})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`div`,{className:`h-2 w-2 rounded-full ${X.enabled?`bg-blue-400`:`bg-zinc-600`}`}),(0,H.jsx)(O,{htmlFor:`enabled`,className:`text-xs font-medium text-white/70`,children:`Habilitado`})]}),(0,H.jsx)(F,{id:`enabled`,checked:X.enabled,onCheckedChange:e=>Z({...X,enabled:e}),disabled:K})]})]})]}),q&&(0,H.jsx)(`div`,{className:`hive-form-error`,children:q}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 pt-4`,children:[n&&(0,H.jsx)(_,{type:`button`,variant:`outline`,onClick:n,disabled:K,className:`hive-btn--form-cancel`,children:`Cancelar`}),(0,H.jsx)(_,{type:`submit`,disabled:K,className:`hive-btn--form-submit`,children:K?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u,{className:`mr-2 h-4 w-4 animate-spin`}),`Procesando...`]}):(0,H.jsx)(H.Fragment,{children:$?`Actualizar Agente`:`Desplegar Agente`})})]})]})})]})}export{W as t};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{f as t}from"./vendor-charts-K3xcRl0X.js";import{o as n}from"./vendor-query-Dj8xYhQD.js";import{t as r}from"./check-DxOMIDcl.js";import{t as i}from"./circle-alert-BkP6x0zQ.js";import{t as a}from"./useProviders-B3rT_xU9.js";import{t as o}from"./external-link-D_C_678M.js";import{n as s,r as c,t as l}from"./ModelSelector-C8ny_pxu.js";import{t as u}from"./loader-circle-wLVzSdML.js";import{t as d}from"./shield-gbUkSqfi.js";import{t as f}from"./sparkles-Ccd1JZ3s.js";import{t as p}from"./utils-Dyb7SC2_.js";import{M as m,O as h,f as g,k as _,m as v,s as y,t as b}from"./index-D-9yCvjP.js";import{a as x,c as S,i as C,n as w,o as T,r as E,s as ee,t as D}from"./dialog-CO1WrPJc.js";import{t as O}from"./label-k0jYxoWW.js";import{t as k}from"./textarea-rp6vsOZl.js";import{i as A,n as j,o as M,s as N,t as P}from"./select-BfRyBbi9.js";import{t as F}from"./switch-DXcELPsM.js";import{a as I,i as L,n as R,r as z,t as B}from"./card-D3Nw3kh3.js";var V=e(t(),1),H=n(),U=[{value:`friendly`,label:`Amigable`},{value:`professional`,label:`Profesional`},{value:`casual`,label:`Casual`},{value:`formal`,label:`Formal`},{value:`creative`,label:`Creativo`}];function W({initialData:e,onSuccess:t,onCancel:n}){let{createAgent:W,updateAgent:G,isLoading:K,error:q}=b(),{activeProviders:te}=y(),[J,Y]=(0,V.useState)({isValidating:!1,exists:!1,accessible:!1}),[X,Z]=(0,V.useState)({name:``,description:``,tone:`professional`,provider_id:``,model_id:``,role:`coordinator`,enabled:!0,systemPrompt:``,workspace:e?.workspace||``});(0,V.useEffect)(()=>{e&&Z({...e,provider_id:e.provider_id||e.providerId||``,model_id:e.model_id||e.modelId||``})},[e]);let Q=async e=>{if(!e||e.trim()===``){Y({isValidating:!1,exists:!1,accessible:!1});return}Y({isValidating:!0,exists:!1,accessible:!1});try{let t=await g(`/api/workspace/validate`,{method:`POST`,body:{path:e}});Y({isValidating:!1,exists:t.exists,accessible:t.accessible,error:t.error,message:t.message})}catch(e){Y({isValidating:!1,exists:!1,accessible:!1,error:e.message})}},ne=async()=>{if(X.workspace)try{await g(`/api/workspace/create`,{method:`POST`,body:{path:X.workspace},showLoader:`Creando directorio...`,showSuccess:`Directorio creado exitosamente`}),await Q(X.workspace)}catch(e){v.fire(`Error`,e.message,`error`)}},re=async()=>{if(X.workspace)try{await g(`/api/workspace/open?path=${encodeURIComponent(X.workspace)}`,{method:`GET`})}catch(e){v.fire(`Error`,e.message,`error`)}},ie=async n=>{if(n.preventDefault(),!X.provider_id||!X.model_id){v.fire(`Incompleto`,`Por favor selecciona un proveedor y modelo`,`warning`);return}try{e?.id?await G(e.id,X):await W(X),t&&t()}catch(e){console.error(e)}},$=!!e?.id;return(0,H.jsxs)(B,{className:`hive-card--form group`,children:[(0,H.jsx)(`div`,{className:`hive-glow-blob--card absolute -top-24 -right-24 h-48 w-48 bg-blue-600/10 group-hover:bg-blue-600/20`,style:{borderRadius:`50%`,filter:`blur(80px)`}}),(0,H.jsx)(L,{className:`relative`,children:(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`hive-icon-wrap hive-icon-wrap--primary`,children:$?(0,H.jsx)(s,{className:`h-5 w-5`}):(0,H.jsx)(f,{className:`h-5 w-5`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(I,{className:`text-xl font-bold text-white/90`,children:$?`Configurar Nodo`:`Desplegar Nuevo Nodo`}),(0,H.jsx)(z,{className:`text-white/40`,children:$?`Ajusta los parámetros de tu agente inteligente.`:`Crea una nueva entidad inteligente para tu colmena.`})]})]}),n&&(0,H.jsx)(_,{variant:`ghost`,size:`icon`,onClick:n,className:`text-white/40 hover:text-white hover:bg-white/5`,children:(0,H.jsx)(m,{className:`h-5 w-5`})})]})}),(0,H.jsx)(R,{className:`relative space-y-6 pt-2`,children:(0,H.jsxs)(`form`,{onSubmit:ie,className:`space-y-8`,children:[(0,H.jsxs)(`div`,{className:`grid gap-6`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(O,{htmlFor:`name`,className:`hive-label--field`,children:`Nombre del Agente`}),(0,H.jsx)(h,{id:`name`,placeholder:`Ej: Analista de Mercado`,className:`hive-input`,value:X.name,onChange:e=>Z({...X,name:e.target.value}),disabled:K,required:!0})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(O,{htmlFor:`description`,className:`hive-label--field`,children:`Descripción / Rol`}),(0,H.jsx)(k,{id:`description`,placeholder:`Describe qué hace este agente y cuáles son sus objetivos...`,className:`hive-textarea`,value:X.description,onChange:e=>Z({...X,description:e.target.value}),disabled:K})]})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(O,{htmlFor:`systemPrompt`,className:`hive-label--field`,children:`System Prompt`}),(0,H.jsxs)(D,{children:[(0,H.jsx)(S,{asChild:!0,children:(0,H.jsx)(_,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 px-3 text-xs bg-blue-500/10 hover:bg-blue-500/20 text-blue-400 border-blue-500/30 transition-colors`,children:`Modifica acá el System Prompt`})}),(0,H.jsxs)(E,{className:`sm:max-w-3xl bg-[#0a0a0c] border-white/10 text-white shadow-2xl [&>button]:text-white/50 hover:[&>button]:text-white`,children:[(0,H.jsxs)(T,{children:[(0,H.jsx)(ee,{className:`text-xl`,children:`Editar System Prompt`}),(0,H.jsx)(C,{className:`text-sm text-white/50`,children:`El prompt base de comportamiento del agente. Se recomienda formato Markdown.`})]}),(0,H.jsx)(`div`,{className:`py-2`,children:(0,H.jsx)(k,{value:X.systemPrompt||``,onChange:e=>Z({...X,systemPrompt:e.target.value}),className:`min-h-[400px] font-mono text-sm bg-black/40 border-white/10 text-white/90 focus-visible:ring-blue-500/50 resize-y`,placeholder:`Escribe el system prompt detallado aquí...`,disabled:K})}),(0,H.jsx)(x,{children:(0,H.jsx)(w,{asChild:!0,children:(0,H.jsx)(_,{type:`button`,className:`bg-blue-600 hover:bg-blue-500 text-white shadow-[0_0_15px_rgba(37,99,235,0.3)]`,children:`Guardar Cambios`})})})]})]})]}),X.systemPrompt?(0,H.jsxs)(`p`,{className:`text-xs text-white/40 line-clamp-1 italic border border-white/5 bg-white/[0.02] p-2 rounded-md`,children:[`"`,X.systemPrompt,`"`]}):(0,H.jsx)(`p`,{className:`text-xs text-white/30 italic`,children:`Sin system prompt configurado...`})]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,H.jsx)(c,{className:`h-4 w-4 text-emerald-400`}),(0,H.jsx)(`h3`,{className:`hive-title-section`,children:`Workspace Directory`})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(O,{htmlFor:`workspace`,className:`hive-label--field`,children:`Directorio de Trabajo del Agente`}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(h,{id:`workspace`,placeholder:`Ej: /home/user/proyectos, D:\\Work, /Volumes/USB`,className:`hive-input flex-1 font-mono text-sm`,value:X.workspace,onChange:e=>{Z({...X,workspace:e.target.value}),Q(e.target.value)},disabled:K}),X.workspace&&J.exists&&J.accessible&&(0,H.jsx)(_,{type:`button`,variant:`outline`,size:`icon`,onClick:re,className:`shrink-0 border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10`,title:`Abrir en el explorador`,children:(0,H.jsx)(o,{className:`h-4 w-4`})})]}),(0,H.jsx)(`p`,{className:`text-xs text-white/40 leading-relaxed`,children:`Directorio donde el agente creará archivos, carpetas y ejecutará comandos. Puede ser cualquier ubicación en tu sistema (disco duro, USB, red, etc.).`}),X.workspace&&X.workspace.trim()!==``&&(0,H.jsxs)(`div`,{className:p(`flex items-center gap-2 text-xs p-2.5 rounded-lg border backdrop-blur-md transition-all`,J.isValidating&&`bg-blue-500/10 border-blue-500/20 text-blue-400`,!J.isValidating&&J.exists&&J.accessible&&`bg-emerald-500/10 border-emerald-500/20 text-emerald-400`,!J.isValidating&&J.exists&&!J.accessible&&`bg-amber-500/10 border-amber-500/20 text-amber-400`,!J.isValidating&&!J.exists&&`bg-purple-500/10 border-purple-500/20 text-purple-400`),children:[J.isValidating&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u,{className:`h-3.5 w-3.5 animate-spin`}),(0,H.jsx)(`span`,{children:`Validando directorio...`})]}),!J.isValidating&&J.exists&&J.accessible&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(r,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:J.message||`Directorio válido y accesible`})]}),!J.isValidating&&J.exists&&!J.accessible&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(i,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:J.message||`El directorio existe pero no tiene permisos de lectura/escritura`})]}),!J.isValidating&&!J.exists&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(c,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:J.message||`El directorio no existe`}),!J.error&&(0,H.jsx)(_,{type:`button`,variant:`outline`,size:`sm`,onClick:ne,className:`ml-auto h-6 px-2 text-xs bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 border-purple-500/30`,children:`Crear directorio`})]})]})]})]}),(0,H.jsx)(`div`,{className:`hive-card-divider`}),(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,H.jsx)(a,{className:`h-4 w-4 text-blue-400`}),(0,H.jsx)(`h3`,{className:`hive-title-section`,children:`Motor de Inteligencia`})]}),(0,H.jsx)(l,{selectedProviderId:X.provider_id||void 0,selectedModelId:X.model_id||void 0,onProviderChange:e=>Z({...X,provider_id:e,model_id:``}),onModelChange:e=>Z({...X,model_id:e}),disabled:K,typeFilter:`llm`})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(O,{htmlFor:`tone`,className:`hive-label--field`,children:`Tono de Voz`}),(0,H.jsxs)(P,{value:X.tone,onValueChange:e=>Z({...X,tone:e}),disabled:K,children:[(0,H.jsx)(M,{className:`hive-select-trigger`,children:(0,H.jsx)(N,{placeholder:`Selecciona un tono`})}),(0,H.jsx)(j,{className:`hive-select-content`,children:U.map(e=>(0,H.jsx)(A,{value:e.value,className:`hive-select-item`,children:e.label},e.value))})]})]}),(0,H.jsxs)(`div`,{className:`hive-toggle-panel`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(d,{className:`h-3.5 w-3.5 text-purple-400`}),(0,H.jsx)(O,{htmlFor:`role`,className:`text-xs font-medium text-white/70`,children:`Rol`})]}),(0,H.jsxs)(P,{value:X.role,onValueChange:e=>Z({...X,role:e}),disabled:K,children:[(0,H.jsx)(M,{className:`w-[120px] bg-white/5 border-white/10 text-white`,children:(0,H.jsx)(N,{})}),(0,H.jsxs)(j,{className:`bg-zinc-900 border-white/10`,children:[(0,H.jsx)(A,{value:`coordinator`,children:`Coordinador`}),(0,H.jsx)(A,{value:`worker`,children:`Worker`})]})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`div`,{className:`h-2 w-2 rounded-full ${X.enabled?`bg-blue-400`:`bg-zinc-600`}`}),(0,H.jsx)(O,{htmlFor:`enabled`,className:`text-xs font-medium text-white/70`,children:`Habilitado`})]}),(0,H.jsx)(F,{id:`enabled`,checked:X.enabled,onCheckedChange:e=>Z({...X,enabled:e}),disabled:K})]})]})]}),q&&(0,H.jsx)(`div`,{className:`hive-form-error`,children:q}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 pt-4`,children:[n&&(0,H.jsx)(_,{type:`button`,variant:`outline`,onClick:n,disabled:K,className:`hive-btn--form-cancel`,children:`Cancelar`}),(0,H.jsx)(_,{type:`submit`,disabled:K,className:`hive-btn--form-submit`,children:K?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u,{className:`mr-2 h-4 w-4 animate-spin`}),`Procesando...`]}):(0,H.jsx)(H.Fragment,{children:$?`Actualizar Agente`:`Desplegar Agente`})})]})]})})]})}export{W as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{f as t}from"./vendor-charts-K3xcRl0X.js";import{o as n}from"./vendor-query-Dj8xYhQD.js";import{t as r}from"./activity-BIIli7ET.js";import{t as i}from"./calendar-S9-_Q6QR.js";import{t as a}from"./check-CryV78SQ.js";import{t as o}from"./chevron-left-dTGbyl5G.js";import{t as s}from"./circle-alert-DTVW4R94.js";import{t as c}from"./circle-check-BAolxswA.js";import{n as l,t as u}from"./earth-CTsVjCmp.js";import{t as d}from"./useProviders-q6iROeWE.js";import{t as f}from"./external-link-CvpRhwC_.js";import{n as p,r as m,t as h}from"./ModelSelector-BCfvugHB.js";import{t as g}from"./loader-circle-Dtfz4FWw.js";import{a as _,i as v,o as y,r as b,s as x}from"./agentCapabilities-D1PD9yFH.js";import{t as ee}from"./shield-U0hIjGzm.js";import{t as S}from"./sparkles-VXHGDbNh.js";import{t as C}from"./terminal-C6YPcJl_.js";import{t as te}from"./zap-BEZNJ0i0.js";import{t as ne}from"./utils-Dyb7SC2_.js";import{c as re,l as ie}from"./vendor-router-zpB-76nT.js";import{F as ae,H as oe,K as w,N as T,O as E,W as se,c as ce,f as D,h as O,k,l as le,o as A,p as j,s as M,t as N}from"./index-ZjAc-KQS.js";import{t as ue}from"./badge-DKGZbVZJ.js";import{a as de,c as P,i as F,n as I,o as L,r as R,s as z,t as B}from"./dialog-uUBz_NIB.js";import{t as V}from"./label-k0jYxoWW.js";import{t as H}from"./textarea-rp6vsOZl.js";import{i as U,n as fe,o as pe,s as me,t as he}from"./select-BOR8MsSL.js";import{t as ge}from"./switch-DXcELPsM.js";var W=w(`BookOpenCheck`,[[`path`,{d:`M12 21V7`,key:`gj6g52`}],[`path`,{d:`m16 12 2 2 4-4`,key:`mdajum`}],[`path`,{d:`M22 6V4a1 1 0 0 0-1-1h-5a4 4 0 0 0-4 4 4 4 0 0 0-4-4H3a1 1 0 0 0-1 1v13a1 1 0 0 0 1 1h6a3 3 0 0 1 3 3 3 3 0 0 1 3-3h6a1 1 0 0 0 1-1v-1.3`,key:`8arnkb`}]]),_e=w(`CalendarClock`,[[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M17.5 17.5 16 16.3V14`,key:`akvzfd`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),G=w(`FileStack`,[[`path`,{d:`M21 7h-3a2 2 0 0 1-2-2V2`,key:`9rb54x`}],[`path`,{d:`M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17Z`,key:`1059l0`}],[`path`,{d:`M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15`,key:`16874u`}],[`path`,{d:`M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11`,key:`k2ox98`}]]),ve=w(`Fingerprint`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),ye=w(`LayoutGrid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),be=w(`PackageOpen`,[[`path`,{d:`M12 22v-9`,key:`x3hkom`}],[`path`,{d:`M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z`,key:`2ntwy6`}],[`path`,{d:`M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13`,key:`1pmm1c`}],[`path`,{d:`M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z`,key:`12ttoo`}]]),K=e(t(),1),q=n();function J({icon:e,...t}){return(0,q.jsx)(e,{...t})}function xe({agentId:e}){let{agents:t,updateAgent:n,fetchAgents:i}=N(),{fetchProviders:o}=M(),{fetchModels:c}=A();(0,K.useEffect)(()=>{i(),o(),c()},[i,o,c]);let l=t.find(t=>t.id===e),[u,d]=(0,K.useState)({name:``,description:``,provider_id:``,model_id:``,tone:``,role:`coordinator`,enabled:!0,headers:``,systemPrompt:``,workspace:``}),[_,v]=(0,K.useState)({isValidating:!1,exists:!1,accessible:!1});(0,K.useEffect)(()=>{l&&(d({name:l.name||``,description:l.description||``,provider_id:l.provider_id||l.providerId||``,model_id:l.model_id||l.modelId||``,tone:l.tone||``,role:l.role||`coordinator`,enabled:!!l.enabled,headers:``,systemPrompt:l.systemPrompt||``,workspace:l.workspace||``}),l.workspace&&y(l.workspace))},[l]);let y=async e=>{if(!e||e.trim()===``){v({isValidating:!1,exists:!1,accessible:!1});return}v({isValidating:!0,exists:!1,accessible:!1});try{let t=await D(`/api/workspace/validate`,{method:`POST`,body:{path:e}});v({isValidating:!1,exists:t.exists,accessible:t.accessible,error:t.error,message:t.message})}catch(e){v({isValidating:!1,exists:!1,accessible:!1,error:e.message})}};return l?(0,q.jsx)(`div`,{className:`space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500`,children:(0,q.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-8`,children:[(0,q.jsxs)(`div`,{className:`lg:col-span-1 space-y-6`,children:[(0,q.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`p-2 rounded-xl bg-blue-500/10 border border-blue-500/20`,children:(0,q.jsx)(J,{icon:ae,className:`h-4 w-4 text-blue-400`})}),(0,q.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Identidad Base`})]}),(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(V,{htmlFor:`name`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Nombre Público`}),(0,q.jsx)(E,{id:`name`,value:u.name,onChange:e=>d(t=>({...t,name:e.target.value})),className:`bg-white/5 border-white/10 focus:border-blue-500/50 rounded-xl h-11`,placeholder:`Nombre del nodo`})]}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(V,{htmlFor:`tone`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Tono Cognitivo`}),(0,q.jsx)(E,{id:`tone`,value:u.tone,onChange:e=>d(t=>({...t,tone:e.target.value})),className:`bg-white/5 border-white/10 focus:border-blue-500/50 rounded-xl h-11`,placeholder:`Ej: Analítico, Conciso...`})]})]})]}),(0,q.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`p-2 rounded-xl bg-purple-500/10 border border-purple-500/20`,children:(0,q.jsx)(J,{icon:ee,className:`h-4 w-4 text-purple-400`})}),(0,q.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Permisos de Red`})]}),(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-2xl bg-white/5 hover:bg-white/10 transition-colors`,children:[(0,q.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,q.jsx)(V,{className:`text-sm font-semibold`,children:`Rol`}),(0,q.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Coordinador o Worker`})]}),(0,q.jsxs)(he,{value:u.role,onValueChange:e=>d(t=>({...t,role:e})),children:[(0,q.jsx)(pe,{className:`w-[120px] bg-white/5 border-white/10 text-white`,children:(0,q.jsx)(me,{})}),(0,q.jsxs)(fe,{className:`bg-zinc-900 border-white/10`,children:[(0,q.jsx)(U,{value:`coordinator`,children:`Coordinador`}),(0,q.jsx)(U,{value:`worker`,children:`Worker`})]})]})]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-2xl bg-white/5 hover:bg-white/10 transition-colors`,children:[(0,q.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,q.jsx)(V,{className:`text-sm font-semibold`,children:`Nodo Activo`}),(0,q.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Disponible para la colmena`})]}),(0,q.jsx)(ge,{checked:u.enabled,onCheckedChange:e=>d(t=>({...t,enabled:e}))})]})]})]}),(0,q.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`p-2 rounded-xl bg-emerald-500/10 border border-emerald-500/20`,children:(0,q.jsx)(J,{icon:m,className:`h-4 w-4 text-emerald-400`})}),(0,q.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Workspace Directory`})]}),(0,q.jsx)(`div`,{className:`space-y-4`,children:(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(V,{htmlFor:`workspace`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Directorio de Trabajo`}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(E,{id:`workspace`,value:u.workspace,onChange:e=>{d(t=>({...t,workspace:e.target.value})),y(e.target.value)},className:`bg-white/5 border-white/10 focus:border-emerald-500/50 rounded-xl h-11 font-mono text-sm flex-1`,placeholder:`Ej: /home/user/proyectos, D:\\Work`}),u.workspace&&_.exists&&_.accessible&&(0,q.jsx)(k,{type:`button`,variant:`outline`,size:`icon`,onClick:async()=>{if(u.workspace)try{await D(`/api/workspace/open?path=${encodeURIComponent(u.workspace)}`,{method:`GET`})}catch(e){j.fire({icon:`error`,title:e.message})}},className:`shrink-0 border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10 h-11 w-11`,title:`Abrir en el explorador`,children:(0,q.jsx)(f,{className:`h-4 w-4`})})]}),(0,q.jsx)(`p`,{className:`text-xs text-white/40 leading-relaxed`,children:`Directorio donde el agente operará. Puede ser cualquier ubicación (disco, USB, red).`}),u.workspace&&u.workspace.trim()!==``&&(0,q.jsxs)(`div`,{className:ne(`flex items-center gap-2 text-xs p-2.5 rounded-lg border backdrop-blur-md transition-all`,_.isValidating&&`bg-blue-500/10 border-blue-500/20 text-blue-400`,!_.isValidating&&_.exists&&_.accessible&&`bg-emerald-500/10 border-emerald-500/20 text-emerald-400`,!_.isValidating&&_.exists&&!_.accessible&&`bg-amber-500/10 border-amber-500/20 text-amber-400`,!_.isValidating&&!_.exists&&`bg-purple-500/10 border-purple-500/20 text-purple-400`),children:[_.isValidating&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(g,{className:`h-3.5 w-3.5 animate-spin`}),(0,q.jsx)(`span`,{children:`Validando directorio...`})]}),!_.isValidating&&_.exists&&_.accessible&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(a,{className:`h-3.5 w-3.5`}),(0,q.jsx)(`span`,{children:_.message||`Directorio válido y accesible`})]}),!_.isValidating&&_.exists&&!_.accessible&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(s,{className:`h-3.5 w-3.5`}),(0,q.jsx)(`span`,{children:_.message||`Sin permisos de lectura/escritura`})]}),!_.isValidating&&!_.exists&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(m,{className:`h-3.5 w-3.5`}),(0,q.jsx)(`span`,{children:_.message||`El directorio no existe`}),!_.error&&(0,q.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,onClick:async()=>{if(u.workspace)try{await D(`/api/workspace/create`,{method:`POST`,body:{path:u.workspace},showLoader:`Creando directorio...`,showSuccess:`Directorio creado exitosamente`}),await y(u.workspace)}catch(e){j.fire({icon:`error`,title:e.message})}},className:`ml-auto h-6 px-2 text-xs bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 border-purple-500/30`,children:`Crear`})]})]})]})})]})]}),(0,q.jsx)(`div`,{className:`lg:col-span-2 space-y-6`,children:(0,q.jsxs)(`div`,{className:`p-8 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-8`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`p-2 rounded-xl bg-amber-500/10 border border-amber-500/20`,children:(0,q.jsx)(J,{icon:S,className:`h-4 w-4 text-amber-400`})}),(0,q.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Configuración Cognitiva`})]}),(0,q.jsxs)(k,{onClick:async()=>{O.show(`Sincronizando configuración del agente...`);try{await n(e,{...u,role:u.role,enabled:+!!u.enabled,workspace:u.workspace||null}),j.fire({icon:`success`,title:`Cambios sincronizados correctamente`})}catch(e){j.fire({icon:`error`,title:e instanceof Error?e.message:`Error al sincronizar cambios`})}finally{O.hide()}},className:`bg-blue-600 hover:bg-blue-500 text-white font-bold rounded-xl px-6 shadow-[0_4px_15px_rgba(37,99,235,0.3)] transition-all active:scale-95 gap-2`,children:[(0,q.jsx)(J,{icon:p,className:`h-4 w-4`}),`Sincronizar Cambios`]})]}),(0,q.jsxs)(`div`,{className:`space-y-6`,children:[(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(V,{htmlFor:`description`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Directiva de Misión (Descripción)`}),(0,q.jsx)(H,{id:`description`,value:u.description,onChange:e=>d(t=>({...t,description:e.target.value})),className:`bg-white/5 border-white/10 focus:border-blue-500/50 rounded-2xl min-h-[80px] resize-none`,placeholder:`Define el propósito general de este nodo...`})]}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between pl-1`,children:[(0,q.jsx)(V,{className:`text-xs text-white/40 uppercase tracking-widest`,children:`System Prompt (Markdown)`}),(0,q.jsxs)(B,{children:[(0,q.jsx)(P,{asChild:!0,children:(0,q.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 px-3 text-xs bg-blue-500/10 hover:bg-blue-500/20 text-blue-400 border-blue-500/30 transition-colors`,children:`Modifica acá el System Prompt`})}),(0,q.jsxs)(R,{className:`sm:max-w-3xl bg-[#0a0a0c] border-white/10 text-white shadow-2xl [&>button]:text-white/50 hover:[&>button]:text-white`,children:[(0,q.jsxs)(L,{children:[(0,q.jsx)(z,{className:`text-xl`,children:`Editar System Prompt`}),(0,q.jsx)(F,{className:`text-sm text-white/50`,children:`El comportamiento principal del agente. Se recomienda usar Markdown.`})]}),(0,q.jsx)(`div`,{className:`py-2`,children:(0,q.jsx)(H,{value:u.systemPrompt,onChange:e=>d(t=>({...t,systemPrompt:e.target.value})),className:`min-h-[400px] font-mono text-sm bg-black/40 border-white/10 text-white/90 focus-visible:ring-blue-500/50 resize-y`,placeholder:`Escribe el system prompt detallado aquí...`})}),(0,q.jsx)(de,{children:(0,q.jsx)(I,{asChild:!0,children:(0,q.jsx)(k,{type:`button`,className:`bg-blue-600 hover:bg-blue-500 text-white shadow-[0_0_15px_rgba(37,99,235,0.3)]`,children:`Listo`})})})]})]})]}),u.systemPrompt?(0,q.jsx)(`div`,{className:`bg-white/[0.02] border border-white/5 rounded-2xl p-4 max-h-[120px] overflow-y-auto custom-scrollbar`,children:(0,q.jsx)(`p`,{className:`text-xs text-white/60 font-mono whitespace-pre-wrap italic`,children:u.systemPrompt})}):(0,q.jsx)(`div`,{className:`bg-white/[0.02] border border-white/5 rounded-2xl p-4`,children:(0,q.jsx)(`p`,{className:`text-xs text-white/30 italic`,children:`Sin system prompt configurado...`})})]}),(0,q.jsx)(h,{selectedProviderId:u.provider_id||void 0,selectedModelId:u.model_id||void 0,onProviderChange:e=>d(t=>({...t,provider_id:e,model_id:``})),onModelChange:e=>d(t=>({...t,model_id:e})),typeFilter:`llm`})]}),(0,q.jsxs)(`div`,{className:`mt-8 p-4 rounded-2xl bg-white/[0.03] border border-white/5 flex items-start gap-4 italic`,children:[(0,q.jsx)(J,{icon:oe,className:`h-5 w-5 text-white/20 mt-0.5`}),(0,q.jsx)(`p`,{className:`text-[11px] text-white/30 leading-relaxed`,children:`Las credenciales de acceso y llaves de cifrado para los headers personalizados se gestionan en una capa segura y no son visibles en texto plano para mantener la integridad de la red.`})]})]})})]})}):(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center p-12 text-center space-y-4 rounded-3xl border border-dashed border-white/10 bg-white/5`,children:[(0,q.jsx)(J,{icon:r,className:`h-12 w-12 text-white/10 animate-pulse`}),(0,q.jsx)(`p`,{className:`text-white/40 font-medium`,children:`Buscando nodo en la colmena...`})]})}function Se({agent:e}){let{providers:t}=M(),{models:n}=A(),a=e.role===`coordinator`,o=e.provider_id||e.providerId,s=e.model_id||e.modelId,c=e.created_at||e.createdAt,l=c?_(typeof c==`string`?new Date(c):new Date(c*1e3),`PPP`,{locale:v}):`Fecha desconocida`,u=t.find(e=>e.id===o)?.name||o,f=n.find(e=>e.id===s)?.name||s;return(0,q.jsxs)(`div`,{className:`hive-card--internal group ${e.enabled?`hive-card--internal-active`:`hive-card--internal-disabled`}`,children:[e.enabled&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`absolute -top-24 -right-24 h-64 w-64 bg-blue-600/10 rounded-full blur-[100px] pointer-events-none group-hover:bg-blue-600/20 transition-all duration-700`}),(0,q.jsx)(`div`,{className:`absolute -bottom-24 -left-24 h-64 w-64 bg-purple-600/10 rounded-full blur-[100px] pointer-events-none group-hover:bg-purple-600/20 transition-all duration-700`})]}),(0,q.jsxs)(`div`,{className:`relative flex flex-col md:flex-row gap-8 items-start justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex-1 space-y-6`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`hive-icon-wrap--internal ${e.enabled?`hive-icon-wrap--internal-active`:`hive-icon-wrap--internal-disabled`}`,children:(0,q.jsx)(ve,{className:`h-6 w-6 ${e.enabled?`text-blue-400`:`text-white/20`}`})}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,q.jsx)(`span`,{className:`hive-page-header__label ${!e.enabled&&`text-white/20`}`,children:`Identidad de Nodo`}),a&&(0,q.jsx)(ue,{className:`hive-tag--coordinator ${!e.enabled&&`bg-white/5 text-white/20 border-white/10`}`,children:`Coordinador`})]}),(0,q.jsx)(`h1`,{className:`text-4xl font-black tracking-tighter ${e.enabled?`text-white`:`text-white/40`}`,children:e.name})]})]}),(0,q.jsxs)(`p`,{className:`text-lg leading-relaxed max-w-2xl font-light italic ${e.enabled?`text-white/60`:`text-white/20`}`,children:[`"`,e.description||`Este agente no tiene una descripción definida aún.`,`"`]})]}),(0,q.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4`,children:[(0,q.jsx)(Y,{icon:d,label:`Infraestructura`,value:u,subValue:f,color:e.enabled?`text-blue-400`:`text-white/20`,enabled:e.enabled}),(0,q.jsx)(Y,{icon:te,label:`Personalidad`,value:e.tone||`Neutral`,color:e.enabled?`text-purple-400`:`text-white/20`,enabled:e.enabled}),(0,q.jsx)(Y,{icon:i,label:`Desplegado el`,value:l,color:e.enabled?`text-emerald-400`:`text-white/20`,enabled:e.enabled})]})]}),(0,q.jsxs)(`div`,{className:`flex flex-col items-center md:items-end gap-6 min-w-[200px]`,children:[(0,q.jsxs)(`div`,{className:`text-center md:text-right space-y-2`,children:[(0,q.jsx)(`span`,{className:`hive-label block`,children:`Estado Operativo`}),(0,q.jsx)(y,{status:e.enabled?e.status:`hibernated`,className:`px-6 py-2 text-sm border-2`})]}),(0,q.jsxs)(`div`,{className:`hive-network-panel md:w-auto`,children:[(0,q.jsxs)(`div`,{className:`flex-1`,children:[(0,q.jsx)(`p`,{className:`hive-label mb-1`,children:`Carga de Red`}),(0,q.jsx)(`div`,{className:`hive-network-track`,children:e.enabled&&(0,q.jsx)(`div`,{className:`hive-network-fill`})})]}),(0,q.jsx)(r,{className:`h-5 w-5 ${e.enabled?`text-blue-400 animate-pulse`:`text-white/10`}`})]})]})]}),(0,q.jsx)(`div`,{className:`hive-strip--bottom ${!e.enabled&&`opacity-20`}`}),(0,q.jsxs)(`div`,{className:`absolute top-4 right-8 hive-mono hidden md:block`,children:[`NODE_UID: `,e.id]})]})}function Y({icon:e,label:t,value:n,subValue:r,color:i,enabled:a}){return(0,q.jsxs)(`div`,{className:`hive-info-card ${a?`hive-info-card--active`:`hive-info-card--disabled`}`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,q.jsx)(e,{className:`h-3.5 w-3.5 ${i}`}),(0,q.jsx)(`span`,{className:`hive-info-card__label`,children:t})]}),(0,q.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,q.jsx)(`p`,{className:`hive-info-card__value ${a?`text-white/80 group-hover/item:text-white`:`text-white/20`}`,children:n}),r&&(0,q.jsx)(`p`,{className:`hive-info-card__sub ${a?`text-white/40`:`text-white/10`}`,children:r})]})]})}var Ce={filesystem:`Archivos`,web:`Web`,cron:`Automatización`,cli:`Terminal`,agents:`Agentes`,canvas:`Canvas`,office:`Office`,mcp:`MCP`,core:`Sistema`};function X(e){return e.startsWith(`fs_`)?`filesystem`:e.startsWith(`browser_`)||e.startsWith(`web_`)||e===`search_knowledge`?`web`:e.startsWith(`cron`)?`cron`:e.startsWith(`office_`)?`office`:e.startsWith(`mcp`)||e.includes(`_mcp`)?`mcp`:e.startsWith(`canvas_`)||e.startsWith(`a2ui_`)?`canvas`:e.startsWith(`cli_`)?`cli`:e.includes(`agent`)||e.includes(`task_`)||e.includes(`acceptance`)?`agents`:`core`}function Z(e){return e.split(`_`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function we({agent:e}){let{tools:t,isLoading:n,fetchTools:r}=le(),{skills:i,isLoading:a,fetchSkills:o}=ce();(0,K.useEffect)(()=>{t.length===0&&r(),i.length===0&&o()},[o,r,i.length,t.length]);let s=(0,K.useMemo)(()=>b(e.toolsJson),[e.toolsJson]),l=(0,K.useMemo)(()=>b(e.skillsJson),[e.skillsJson]),u=(0,K.useMemo)(()=>e.role===`coordinator`?e.minimalTools??[]:[],[e.minimalTools,e.role]),d=(0,K.useMemo)(()=>e.role===`coordinator`?e.minimalSkills??[]:[],[e.minimalSkills,e.role]),f=(0,K.useMemo)(()=>{let e=new Map;return u.forEach(t=>e.set(t,{id:t,source:`base`})),s.forEach(t=>{let n=e.get(t.id);e.set(t.id,{...t,source:n?.source??`assigned`})}),Array.from(e.values()).map(e=>{let n=t.find(t=>t.id===e.id);return{id:e.id,name:n?.name||e.suppliedName||Z(e.id),description:n?.description||`Capacidad disponible en el loadout operativo de este agente.`,category:n?.category||X(e.id),available:n?n.enabled&&n.active!==!1:!0,source:e.source}})},[u,s,t]),p=(0,K.useMemo)(()=>{let e=new Map;return d.forEach(t=>e.set(t.id,{id:t.id,suppliedName:t.name,source:`base`})),l.forEach(t=>{let n=e.get(t.id);e.set(t.id,{...t,source:n?.source??`assigned`})}),Array.from(e.values()).map(e=>{let t=i.find(t=>t.id===e.id),n=d.find(t=>t.id===e.id);return{id:e.id,name:t?.name||n?.name||e.suppliedName||Z(e.id),description:t?.description||n?.description||`Conocimiento operativo incluido en el contexto de este agente.`,category:t?.category||n?.category||`core`,source:e.source}})},[d,l,i]),m=new Set(f.map(e=>e.category)).size,h=e.mcpServers??(e.mcpServerIds??[]).map(e=>({id:e,name:e,status:`unknown`,enabled:!0,toolsCount:0})),_=n&&t.length===0||a&&i.length===0;return(0,q.jsxs)(`section`,{className:`mb-8 overflow-hidden rounded-2xl border border-white/[0.08] bg-[#0b0e14]/75`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-4 border-b border-white/[0.07] px-5 py-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg border border-emerald-500/20 bg-emerald-500/10`,children:(0,q.jsx)(T,{className:`h-4 w-4 text-emerald-400`})}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h2`,{className:`text-sm font-black uppercase tracking-[0.12em] text-white/85`,children:`Loadout operativo`}),(0,q.jsx)(`p`,{className:`mt-0.5 text-[11px] text-white/35`,children:e.role===`coordinator`?`Capacidades mínimas del coordinador y asignaciones adicionales`:`Tools y skills asignadas para ejecutar tareas`})]})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,q.jsx)($,{value:f.length,label:`tools`,color:`text-emerald-400`}),(0,q.jsx)(`div`,{className:`h-7 w-px bg-white/[0.08]`}),(0,q.jsx)($,{value:p.length,label:`skills`,color:`text-amber-400`}),h.length>0&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`h-7 w-px bg-white/[0.08]`}),(0,q.jsx)($,{value:h.length,label:`MCP`,color:`text-violet-400`})]}),(0,q.jsx)(`div`,{className:`hidden h-7 w-px bg-white/[0.08] sm:block`}),(0,q.jsx)(`div`,{className:`hidden sm:block`,children:(0,q.jsx)($,{value:m,label:`categorías`,color:`text-blue-400`})})]})]}),_&&f.length===0&&p.length===0&&h.length===0?(0,q.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-14 text-xs text-white/35`,children:[(0,q.jsx)(g,{className:`h-4 w-4 animate-spin text-emerald-400`}),`Sincronizando loadout…`]}):f.length===0&&p.length===0&&h.length===0?(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center px-5 py-14 text-center`,children:[(0,q.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-xl border border-dashed border-white/10 bg-white/[0.025]`,children:(0,q.jsx)(be,{className:`h-5 w-5 text-white/20`})}),(0,q.jsx)(`p`,{className:`mt-3 text-sm font-semibold text-white/60`,children:`Este agente no tiene capacidades asignadas`}),(0,q.jsx)(`p`,{className:`mt-1 text-xs text-white/30`,children:`Su loadout operativo está vacío.`})]}):(0,q.jsxs)(q.Fragment,{children:[f.length>0&&(0,q.jsxs)(`div`,{className:`p-4`,children:[(0,q.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,q.jsx)(T,{className:`h-3.5 w-3.5 text-emerald-400`}),(0,q.jsx)(`h3`,{className:`text-[10px] font-black uppercase tracking-[0.16em] text-white/50`,children:`Tools disponibles`})]}),(0,q.jsx)(`div`,{className:`grid gap-2.5 sm:grid-cols-2 xl:grid-cols-3`,children:f.map(e=>(0,q.jsxs)(`article`,{className:`group rounded-xl border border-white/[0.07] bg-black/20 p-3.5 transition-colors hover:border-emerald-500/20 hover:bg-emerald-500/[0.025]`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-white/[0.07] bg-white/[0.035]`,children:(0,q.jsx)(Te(e.category),{className:`h-3.5 w-3.5 text-emerald-400/80`})}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,q.jsx)(`h4`,{className:`truncate text-xs font-bold text-white/80`,title:e.name,children:e.name}),(0,q.jsx)(`span`,{title:e.available?`Disponible`:`No disponible`,children:(0,q.jsx)(c,{className:`h-3.5 w-3.5 shrink-0 ${e.available?`text-emerald-400`:`text-white/15`}`})})]}),(0,q.jsx)(`p`,{className:`mt-1 line-clamp-2 min-h-8 text-[10px] leading-4 text-white/30`,children:e.description})]})]}),(0,q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-white/[0.05] pt-2`,children:[(0,q.jsx)(`span`,{className:`text-[8px] font-bold uppercase tracking-[0.14em] text-emerald-400/65`,children:Ce[e.category]||e.category}),(0,q.jsx)(Q,{source:e.source})]})]},e.id))})]}),h.length>0&&(0,q.jsxs)(`div`,{className:`border-t border-white/[0.07] p-4`,children:[(0,q.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,q.jsx)(x,{className:`h-3.5 w-3.5 text-violet-400`}),(0,q.jsx)(`h3`,{className:`text-[10px] font-black uppercase tracking-[0.16em] text-white/50`,children:`Integraciones MCP asignadas`})]}),(0,q.jsx)(`div`,{className:`grid gap-2.5 sm:grid-cols-2 xl:grid-cols-3`,children:h.map(e=>(0,q.jsxs)(`article`,{className:`rounded-xl border border-violet-500/15 bg-violet-500/[0.035] p-3.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-violet-500/20 bg-violet-500/[0.08]`,children:(0,q.jsx)(x,{className:`h-3.5 w-3.5 text-violet-300`})}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,q.jsx)(`h4`,{className:`truncate text-xs font-bold text-white/80`,title:e.name,children:e.name}),(0,q.jsx)(`span`,{className:`mt-1 h-2 w-2 shrink-0 rounded-full ${e.enabled?`bg-emerald-400`:`bg-white/20`}`})]}),(0,q.jsxs)(`p`,{className:`mt-1 text-[10px] leading-4 text-white/30`,children:[`Servidor completo · `,e.toolsCount,` tools sincronizadas`]})]})]}),(0,q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-white/[0.05] pt-2`,children:[(0,q.jsx)(`span`,{className:`text-[8px] font-bold uppercase tracking-[0.14em] text-violet-300/70`,children:e.status}),(0,q.jsx)(`span`,{className:`rounded bg-violet-500/10 px-1.5 py-0.5 text-[7px] font-black uppercase tracking-wider text-violet-200/70`,children:`Persistente`})]})]},e.id))})]}),p.length>0&&(0,q.jsxs)(`div`,{className:`border-t border-white/[0.07] p-4`,children:[(0,q.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,q.jsx)(W,{className:`h-3.5 w-3.5 text-amber-400`}),(0,q.jsx)(`h3`,{className:`text-[10px] font-black uppercase tracking-[0.16em] text-white/50`,children:`Skills en contexto`})]}),(0,q.jsx)(`div`,{className:`grid gap-2.5 sm:grid-cols-2 xl:grid-cols-3`,children:p.map(e=>(0,q.jsxs)(`article`,{className:`rounded-xl border border-amber-500/10 bg-amber-500/[0.025] p-3.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-amber-500/15 bg-amber-500/[0.07]`,children:(0,q.jsx)(W,{className:`h-3.5 w-3.5 text-amber-400`})}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`h4`,{className:`truncate text-xs font-bold text-white/80`,title:e.name,children:e.name}),(0,q.jsx)(`p`,{className:`mt-1 line-clamp-2 min-h-8 text-[10px] leading-4 text-white/30`,children:e.description})]})]}),(0,q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-white/[0.05] pt-2`,children:[(0,q.jsx)(`span`,{className:`text-[8px] font-bold uppercase tracking-[0.14em] text-amber-400/65`,children:e.category}),(0,q.jsx)(Q,{source:e.source})]})]},e.id))})]})]})]})}function Q({source:e}){return(0,q.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[7px] font-black uppercase tracking-wider ${e===`base`?`bg-blue-500/10 text-blue-300/70`:`bg-white/5 text-white/25`}`,children:e===`base`?`Minimal · base`:`Asignada`})}function $({value:e,label:t,color:n}){return(0,q.jsxs)(`div`,{className:`text-right`,children:[(0,q.jsx)(`p`,{className:`text-base font-black tabular-nums ${n}`,children:e}),(0,q.jsx)(`p`,{className:`text-[8px] font-bold uppercase tracking-wider text-white/25`,children:t})]})}function Te(e){switch(e){case`filesystem`:return G;case`web`:return u;case`cron`:return _e;case`cli`:return C;case`agents`:return se;case`canvas`:return l;case`mcp`:return x;case`office`:return G;default:return T}}function Ee(){let{id:e}=ie(),t=re(),n=e??`unknown`,{agents:i,fetchAgents:a}=N();(0,K.useEffect)(()=>{a()},[a]);let s=i.find(e=>e.id===n);return(0,q.jsx)(`div`,{className:`min-h-screen bg-transparent pb-20`,children:(0,q.jsxs)(`div`,{className:`max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8 animate-fade-in`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between mb-8`,children:[(0,q.jsxs)(k,{variant:`ghost`,onClick:()=>t(`/agents`),className:`group flex items-center gap-2 text-white/40 hover:text-white hover:bg-white/5 px-4 py-2 rounded-xl transition-colors`,children:[(0,q.jsx)(o,{className:`h-4 w-4 transition-transform group-hover:-translate-x-1`}),(0,q.jsx)(`span`,{className:`text-sm font-bold uppercase tracking-widest`,children:`Volver a la Colmena`})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-4 text-white/20`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(ye,{className:`h-4 w-4`}),(0,q.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`Agentes`})]}),(0,q.jsx)(`div`,{className:`h-4 w-px bg-white/10`}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(r,{className:`h-4 w-4`}),(0,q.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`Detalles Operativos`})]})]})]}),s?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Se,{agent:s}),(0,q.jsx)(we,{agent:s}),(0,q.jsx)(`div`,{className:`grid grid-cols-1 gap-8`,children:(0,q.jsx)(xe,{agentId:n})})]}):(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-[60vh] text-center space-y-6`,children:[(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(`div`,{className:`h-24 w-24 rounded-full border-4 border-t-blue-500 border-white/5 animate-spin`}),(0,q.jsx)(r,{className:`absolute inset-0 m-auto h-8 w-8 text-blue-400 animate-pulse`})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{className:`text-xl font-bold text-white mb-2`,children:`Sincronizando con el Nodo`}),(0,q.jsx)(`p`,{className:`text-white/40 max-w-xs mx-auto`,children:`Estamos recuperando la configuración cuántica de este agente desde la base de datos central.`})]})]})]})})}export{Ee as AgentDetailPage};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{f as t}from"./vendor-charts-K3xcRl0X.js";import{o as n}from"./vendor-query-Dj8xYhQD.js";import{t as r}from"./activity-DZKL7dg4.js";import{t as i}from"./calendar-CkDsc4OJ.js";import{t as a}from"./check-DxOMIDcl.js";import{t as o}from"./chevron-left-C0mqwhLU.js";import{t as s}from"./circle-alert-BkP6x0zQ.js";import{t as c}from"./circle-check-CXC2AiMS.js";import{n as l,t as u}from"./earth-sc8YJMc0.js";import{t as d}from"./useProviders-B3rT_xU9.js";import{t as f}from"./external-link-D_C_678M.js";import{n as p,r as m,t as h}from"./ModelSelector-C8ny_pxu.js";import{t as g}from"./loader-circle-wLVzSdML.js";import{a as _,i as v,o as y,r as b,s as x}from"./agentCapabilities-DuGs07XP.js";import{t as ee}from"./shield-gbUkSqfi.js";import{t as S}from"./sparkles-Ccd1JZ3s.js";import{t as C}from"./terminal-DP9j3HjM.js";import{t as te}from"./zap-B1azpiE7.js";import{t as ne}from"./utils-Dyb7SC2_.js";import{c as re,l as ie}from"./vendor-router-zpB-76nT.js";import{F as ae,H as oe,K as w,N as T,O as E,W as se,c as ce,f as D,h as O,k,l as le,o as A,p as j,s as M,t as N}from"./index-D-9yCvjP.js";import{t as ue}from"./badge-DKGZbVZJ.js";import{a as de,c as P,i as F,n as I,o as L,r as R,s as z,t as B}from"./dialog-CO1WrPJc.js";import{t as V}from"./label-k0jYxoWW.js";import{t as H}from"./textarea-rp6vsOZl.js";import{i as U,n as fe,o as pe,s as me,t as he}from"./select-BfRyBbi9.js";import{t as ge}from"./switch-DXcELPsM.js";var W=w(`BookOpenCheck`,[[`path`,{d:`M12 21V7`,key:`gj6g52`}],[`path`,{d:`m16 12 2 2 4-4`,key:`mdajum`}],[`path`,{d:`M22 6V4a1 1 0 0 0-1-1h-5a4 4 0 0 0-4 4 4 4 0 0 0-4-4H3a1 1 0 0 0-1 1v13a1 1 0 0 0 1 1h6a3 3 0 0 1 3 3 3 3 0 0 1 3-3h6a1 1 0 0 0 1-1v-1.3`,key:`8arnkb`}]]),_e=w(`CalendarClock`,[[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M17.5 17.5 16 16.3V14`,key:`akvzfd`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),G=w(`FileStack`,[[`path`,{d:`M21 7h-3a2 2 0 0 1-2-2V2`,key:`9rb54x`}],[`path`,{d:`M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17Z`,key:`1059l0`}],[`path`,{d:`M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15`,key:`16874u`}],[`path`,{d:`M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11`,key:`k2ox98`}]]),ve=w(`Fingerprint`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),ye=w(`LayoutGrid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),be=w(`PackageOpen`,[[`path`,{d:`M12 22v-9`,key:`x3hkom`}],[`path`,{d:`M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z`,key:`2ntwy6`}],[`path`,{d:`M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13`,key:`1pmm1c`}],[`path`,{d:`M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z`,key:`12ttoo`}]]),K=e(t(),1),q=n();function J({icon:e,...t}){return(0,q.jsx)(e,{...t})}function xe({agentId:e}){let{agents:t,updateAgent:n,fetchAgents:i}=N(),{fetchProviders:o}=M(),{fetchModels:c}=A();(0,K.useEffect)(()=>{i(),o(),c()},[i,o,c]);let l=t.find(t=>t.id===e),[u,d]=(0,K.useState)({name:``,description:``,provider_id:``,model_id:``,tone:``,role:`coordinator`,enabled:!0,headers:``,systemPrompt:``,workspace:``}),[_,v]=(0,K.useState)({isValidating:!1,exists:!1,accessible:!1});(0,K.useEffect)(()=>{l&&(d({name:l.name||``,description:l.description||``,provider_id:l.provider_id||l.providerId||``,model_id:l.model_id||l.modelId||``,tone:l.tone||``,role:l.role||`coordinator`,enabled:!!l.enabled,headers:``,systemPrompt:l.systemPrompt||``,workspace:l.workspace||``}),l.workspace&&y(l.workspace))},[l]);let y=async e=>{if(!e||e.trim()===``){v({isValidating:!1,exists:!1,accessible:!1});return}v({isValidating:!0,exists:!1,accessible:!1});try{let t=await D(`/api/workspace/validate`,{method:`POST`,body:{path:e}});v({isValidating:!1,exists:t.exists,accessible:t.accessible,error:t.error,message:t.message})}catch(e){v({isValidating:!1,exists:!1,accessible:!1,error:e.message})}};return l?(0,q.jsx)(`div`,{className:`space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500`,children:(0,q.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-8`,children:[(0,q.jsxs)(`div`,{className:`lg:col-span-1 space-y-6`,children:[(0,q.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`p-2 rounded-xl bg-blue-500/10 border border-blue-500/20`,children:(0,q.jsx)(J,{icon:ae,className:`h-4 w-4 text-blue-400`})}),(0,q.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Identidad Base`})]}),(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(V,{htmlFor:`name`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Nombre Público`}),(0,q.jsx)(E,{id:`name`,value:u.name,onChange:e=>d(t=>({...t,name:e.target.value})),className:`bg-white/5 border-white/10 focus:border-blue-500/50 rounded-xl h-11`,placeholder:`Nombre del nodo`})]}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(V,{htmlFor:`tone`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Tono Cognitivo`}),(0,q.jsx)(E,{id:`tone`,value:u.tone,onChange:e=>d(t=>({...t,tone:e.target.value})),className:`bg-white/5 border-white/10 focus:border-blue-500/50 rounded-xl h-11`,placeholder:`Ej: Analítico, Conciso...`})]})]})]}),(0,q.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`p-2 rounded-xl bg-purple-500/10 border border-purple-500/20`,children:(0,q.jsx)(J,{icon:ee,className:`h-4 w-4 text-purple-400`})}),(0,q.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Permisos de Red`})]}),(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-2xl bg-white/5 hover:bg-white/10 transition-colors`,children:[(0,q.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,q.jsx)(V,{className:`text-sm font-semibold`,children:`Rol`}),(0,q.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Coordinador o Worker`})]}),(0,q.jsxs)(he,{value:u.role,onValueChange:e=>d(t=>({...t,role:e})),children:[(0,q.jsx)(pe,{className:`w-[120px] bg-white/5 border-white/10 text-white`,children:(0,q.jsx)(me,{})}),(0,q.jsxs)(fe,{className:`bg-zinc-900 border-white/10`,children:[(0,q.jsx)(U,{value:`coordinator`,children:`Coordinador`}),(0,q.jsx)(U,{value:`worker`,children:`Worker`})]})]})]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-2xl bg-white/5 hover:bg-white/10 transition-colors`,children:[(0,q.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,q.jsx)(V,{className:`text-sm font-semibold`,children:`Nodo Activo`}),(0,q.jsx)(`p`,{className:`text-[10px] text-white/30`,children:`Disponible para la colmena`})]}),(0,q.jsx)(ge,{checked:u.enabled,onCheckedChange:e=>d(t=>({...t,enabled:e}))})]})]})]}),(0,q.jsxs)(`div`,{className:`p-6 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-6`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`p-2 rounded-xl bg-emerald-500/10 border border-emerald-500/20`,children:(0,q.jsx)(J,{icon:m,className:`h-4 w-4 text-emerald-400`})}),(0,q.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Workspace Directory`})]}),(0,q.jsx)(`div`,{className:`space-y-4`,children:(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(V,{htmlFor:`workspace`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Directorio de Trabajo`}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(E,{id:`workspace`,value:u.workspace,onChange:e=>{d(t=>({...t,workspace:e.target.value})),y(e.target.value)},className:`bg-white/5 border-white/10 focus:border-emerald-500/50 rounded-xl h-11 font-mono text-sm flex-1`,placeholder:`Ej: /home/user/proyectos, D:\\Work`}),u.workspace&&_.exists&&_.accessible&&(0,q.jsx)(k,{type:`button`,variant:`outline`,size:`icon`,onClick:async()=>{if(u.workspace)try{await D(`/api/workspace/open?path=${encodeURIComponent(u.workspace)}`,{method:`GET`})}catch(e){j.fire({icon:`error`,title:e.message})}},className:`shrink-0 border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10 h-11 w-11`,title:`Abrir en el explorador`,children:(0,q.jsx)(f,{className:`h-4 w-4`})})]}),(0,q.jsx)(`p`,{className:`text-xs text-white/40 leading-relaxed`,children:`Directorio donde el agente operará. Puede ser cualquier ubicación (disco, USB, red).`}),u.workspace&&u.workspace.trim()!==``&&(0,q.jsxs)(`div`,{className:ne(`flex items-center gap-2 text-xs p-2.5 rounded-lg border backdrop-blur-md transition-all`,_.isValidating&&`bg-blue-500/10 border-blue-500/20 text-blue-400`,!_.isValidating&&_.exists&&_.accessible&&`bg-emerald-500/10 border-emerald-500/20 text-emerald-400`,!_.isValidating&&_.exists&&!_.accessible&&`bg-amber-500/10 border-amber-500/20 text-amber-400`,!_.isValidating&&!_.exists&&`bg-purple-500/10 border-purple-500/20 text-purple-400`),children:[_.isValidating&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(g,{className:`h-3.5 w-3.5 animate-spin`}),(0,q.jsx)(`span`,{children:`Validando directorio...`})]}),!_.isValidating&&_.exists&&_.accessible&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(a,{className:`h-3.5 w-3.5`}),(0,q.jsx)(`span`,{children:_.message||`Directorio válido y accesible`})]}),!_.isValidating&&_.exists&&!_.accessible&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(s,{className:`h-3.5 w-3.5`}),(0,q.jsx)(`span`,{children:_.message||`Sin permisos de lectura/escritura`})]}),!_.isValidating&&!_.exists&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(m,{className:`h-3.5 w-3.5`}),(0,q.jsx)(`span`,{children:_.message||`El directorio no existe`}),!_.error&&(0,q.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,onClick:async()=>{if(u.workspace)try{await D(`/api/workspace/create`,{method:`POST`,body:{path:u.workspace},showLoader:`Creando directorio...`,showSuccess:`Directorio creado exitosamente`}),await y(u.workspace)}catch(e){j.fire({icon:`error`,title:e.message})}},className:`ml-auto h-6 px-2 text-xs bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 border-purple-500/30`,children:`Crear`})]})]})]})})]})]}),(0,q.jsx)(`div`,{className:`lg:col-span-2 space-y-6`,children:(0,q.jsxs)(`div`,{className:`p-8 rounded-3xl border border-white/10 bg-black/20 backdrop-blur-md space-y-8`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`p-2 rounded-xl bg-amber-500/10 border border-amber-500/20`,children:(0,q.jsx)(J,{icon:S,className:`h-4 w-4 text-amber-400`})}),(0,q.jsx)(`h3`,{className:`font-bold text-white uppercase tracking-wider text-xs`,children:`Configuración Cognitiva`})]}),(0,q.jsxs)(k,{onClick:async()=>{O.show(`Sincronizando configuración del agente...`);try{await n(e,{...u,role:u.role,enabled:+!!u.enabled,workspace:u.workspace||null}),j.fire({icon:`success`,title:`Cambios sincronizados correctamente`})}catch(e){j.fire({icon:`error`,title:e instanceof Error?e.message:`Error al sincronizar cambios`})}finally{O.hide()}},className:`bg-blue-600 hover:bg-blue-500 text-white font-bold rounded-xl px-6 shadow-[0_4px_15px_rgba(37,99,235,0.3)] transition-all active:scale-95 gap-2`,children:[(0,q.jsx)(J,{icon:p,className:`h-4 w-4`}),`Sincronizar Cambios`]})]}),(0,q.jsxs)(`div`,{className:`space-y-6`,children:[(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(V,{htmlFor:`description`,className:`text-xs text-white/40 uppercase tracking-widest pl-1`,children:`Directiva de Misión (Descripción)`}),(0,q.jsx)(H,{id:`description`,value:u.description,onChange:e=>d(t=>({...t,description:e.target.value})),className:`bg-white/5 border-white/10 focus:border-blue-500/50 rounded-2xl min-h-[80px] resize-none`,placeholder:`Define el propósito general de este nodo...`})]}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between pl-1`,children:[(0,q.jsx)(V,{className:`text-xs text-white/40 uppercase tracking-widest`,children:`System Prompt (Markdown)`}),(0,q.jsxs)(B,{children:[(0,q.jsx)(P,{asChild:!0,children:(0,q.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 px-3 text-xs bg-blue-500/10 hover:bg-blue-500/20 text-blue-400 border-blue-500/30 transition-colors`,children:`Modifica acá el System Prompt`})}),(0,q.jsxs)(R,{className:`sm:max-w-3xl bg-[#0a0a0c] border-white/10 text-white shadow-2xl [&>button]:text-white/50 hover:[&>button]:text-white`,children:[(0,q.jsxs)(L,{children:[(0,q.jsx)(z,{className:`text-xl`,children:`Editar System Prompt`}),(0,q.jsx)(F,{className:`text-sm text-white/50`,children:`El comportamiento principal del agente. Se recomienda usar Markdown.`})]}),(0,q.jsx)(`div`,{className:`py-2`,children:(0,q.jsx)(H,{value:u.systemPrompt,onChange:e=>d(t=>({...t,systemPrompt:e.target.value})),className:`min-h-[400px] font-mono text-sm bg-black/40 border-white/10 text-white/90 focus-visible:ring-blue-500/50 resize-y`,placeholder:`Escribe el system prompt detallado aquí...`})}),(0,q.jsx)(de,{children:(0,q.jsx)(I,{asChild:!0,children:(0,q.jsx)(k,{type:`button`,className:`bg-blue-600 hover:bg-blue-500 text-white shadow-[0_0_15px_rgba(37,99,235,0.3)]`,children:`Listo`})})})]})]})]}),u.systemPrompt?(0,q.jsx)(`div`,{className:`bg-white/[0.02] border border-white/5 rounded-2xl p-4 max-h-[120px] overflow-y-auto custom-scrollbar`,children:(0,q.jsx)(`p`,{className:`text-xs text-white/60 font-mono whitespace-pre-wrap italic`,children:u.systemPrompt})}):(0,q.jsx)(`div`,{className:`bg-white/[0.02] border border-white/5 rounded-2xl p-4`,children:(0,q.jsx)(`p`,{className:`text-xs text-white/30 italic`,children:`Sin system prompt configurado...`})})]}),(0,q.jsx)(h,{selectedProviderId:u.provider_id||void 0,selectedModelId:u.model_id||void 0,onProviderChange:e=>d(t=>({...t,provider_id:e,model_id:``})),onModelChange:e=>d(t=>({...t,model_id:e})),typeFilter:`llm`})]}),(0,q.jsxs)(`div`,{className:`mt-8 p-4 rounded-2xl bg-white/[0.03] border border-white/5 flex items-start gap-4 italic`,children:[(0,q.jsx)(J,{icon:oe,className:`h-5 w-5 text-white/20 mt-0.5`}),(0,q.jsx)(`p`,{className:`text-[11px] text-white/30 leading-relaxed`,children:`Las credenciales de acceso y llaves de cifrado para los headers personalizados se gestionan en una capa segura y no son visibles en texto plano para mantener la integridad de la red.`})]})]})})]})}):(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center p-12 text-center space-y-4 rounded-3xl border border-dashed border-white/10 bg-white/5`,children:[(0,q.jsx)(J,{icon:r,className:`h-12 w-12 text-white/10 animate-pulse`}),(0,q.jsx)(`p`,{className:`text-white/40 font-medium`,children:`Buscando nodo en la colmena...`})]})}function Se({agent:e}){let{providers:t}=M(),{models:n}=A(),a=e.role===`coordinator`,o=e.provider_id||e.providerId,s=e.model_id||e.modelId,c=e.created_at||e.createdAt,l=c?_(typeof c==`string`?new Date(c):new Date(c*1e3),`PPP`,{locale:v}):`Fecha desconocida`,u=t.find(e=>e.id===o)?.name||o,f=n.find(e=>e.id===s)?.name||s;return(0,q.jsxs)(`div`,{className:`hive-card--internal group ${e.enabled?`hive-card--internal-active`:`hive-card--internal-disabled`}`,children:[e.enabled&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`absolute -top-24 -right-24 h-64 w-64 bg-blue-600/10 rounded-full blur-[100px] pointer-events-none group-hover:bg-blue-600/20 transition-all duration-700`}),(0,q.jsx)(`div`,{className:`absolute -bottom-24 -left-24 h-64 w-64 bg-purple-600/10 rounded-full blur-[100px] pointer-events-none group-hover:bg-purple-600/20 transition-all duration-700`})]}),(0,q.jsxs)(`div`,{className:`relative flex flex-col md:flex-row gap-8 items-start justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex-1 space-y-6`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`hive-icon-wrap--internal ${e.enabled?`hive-icon-wrap--internal-active`:`hive-icon-wrap--internal-disabled`}`,children:(0,q.jsx)(ve,{className:`h-6 w-6 ${e.enabled?`text-blue-400`:`text-white/20`}`})}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,q.jsx)(`span`,{className:`hive-page-header__label ${!e.enabled&&`text-white/20`}`,children:`Identidad de Nodo`}),a&&(0,q.jsx)(ue,{className:`hive-tag--coordinator ${!e.enabled&&`bg-white/5 text-white/20 border-white/10`}`,children:`Coordinador`})]}),(0,q.jsx)(`h1`,{className:`text-4xl font-black tracking-tighter ${e.enabled?`text-white`:`text-white/40`}`,children:e.name})]})]}),(0,q.jsxs)(`p`,{className:`text-lg leading-relaxed max-w-2xl font-light italic ${e.enabled?`text-white/60`:`text-white/20`}`,children:[`"`,e.description||`Este agente no tiene una descripción definida aún.`,`"`]})]}),(0,q.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4`,children:[(0,q.jsx)(Y,{icon:d,label:`Infraestructura`,value:u,subValue:f,color:e.enabled?`text-blue-400`:`text-white/20`,enabled:e.enabled}),(0,q.jsx)(Y,{icon:te,label:`Personalidad`,value:e.tone||`Neutral`,color:e.enabled?`text-purple-400`:`text-white/20`,enabled:e.enabled}),(0,q.jsx)(Y,{icon:i,label:`Desplegado el`,value:l,color:e.enabled?`text-emerald-400`:`text-white/20`,enabled:e.enabled})]})]}),(0,q.jsxs)(`div`,{className:`flex flex-col items-center md:items-end gap-6 min-w-[200px]`,children:[(0,q.jsxs)(`div`,{className:`text-center md:text-right space-y-2`,children:[(0,q.jsx)(`span`,{className:`hive-label block`,children:`Estado Operativo`}),(0,q.jsx)(y,{status:e.enabled?e.status:`hibernated`,className:`px-6 py-2 text-sm border-2`})]}),(0,q.jsxs)(`div`,{className:`hive-network-panel md:w-auto`,children:[(0,q.jsxs)(`div`,{className:`flex-1`,children:[(0,q.jsx)(`p`,{className:`hive-label mb-1`,children:`Carga de Red`}),(0,q.jsx)(`div`,{className:`hive-network-track`,children:e.enabled&&(0,q.jsx)(`div`,{className:`hive-network-fill`})})]}),(0,q.jsx)(r,{className:`h-5 w-5 ${e.enabled?`text-blue-400 animate-pulse`:`text-white/10`}`})]})]})]}),(0,q.jsx)(`div`,{className:`hive-strip--bottom ${!e.enabled&&`opacity-20`}`}),(0,q.jsxs)(`div`,{className:`absolute top-4 right-8 hive-mono hidden md:block`,children:[`NODE_UID: `,e.id]})]})}function Y({icon:e,label:t,value:n,subValue:r,color:i,enabled:a}){return(0,q.jsxs)(`div`,{className:`hive-info-card ${a?`hive-info-card--active`:`hive-info-card--disabled`}`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,q.jsx)(e,{className:`h-3.5 w-3.5 ${i}`}),(0,q.jsx)(`span`,{className:`hive-info-card__label`,children:t})]}),(0,q.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,q.jsx)(`p`,{className:`hive-info-card__value ${a?`text-white/80 group-hover/item:text-white`:`text-white/20`}`,children:n}),r&&(0,q.jsx)(`p`,{className:`hive-info-card__sub ${a?`text-white/40`:`text-white/10`}`,children:r})]})]})}var Ce={filesystem:`Archivos`,web:`Web`,cron:`Automatización`,cli:`Terminal`,agents:`Agentes`,canvas:`Canvas`,office:`Office`,mcp:`MCP`,core:`Sistema`};function X(e){return e.startsWith(`fs_`)?`filesystem`:e.startsWith(`browser_`)||e.startsWith(`web_`)||e===`search_knowledge`?`web`:e.startsWith(`cron`)?`cron`:e.startsWith(`office_`)?`office`:e.startsWith(`mcp`)||e.includes(`_mcp`)?`mcp`:e.startsWith(`canvas_`)||e.startsWith(`a2ui_`)?`canvas`:e.startsWith(`cli_`)?`cli`:e.includes(`agent`)||e.includes(`task_`)||e.includes(`acceptance`)?`agents`:`core`}function Z(e){return e.split(`_`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function we({agent:e}){let{tools:t,isLoading:n,fetchTools:r}=le(),{skills:i,isLoading:a,fetchSkills:o}=ce();(0,K.useEffect)(()=>{t.length===0&&r(),i.length===0&&o()},[o,r,i.length,t.length]);let s=(0,K.useMemo)(()=>b(e.toolsJson),[e.toolsJson]),l=(0,K.useMemo)(()=>b(e.skillsJson),[e.skillsJson]),u=(0,K.useMemo)(()=>e.role===`coordinator`?e.minimalTools??[]:[],[e.minimalTools,e.role]),d=(0,K.useMemo)(()=>e.role===`coordinator`?e.minimalSkills??[]:[],[e.minimalSkills,e.role]),f=(0,K.useMemo)(()=>{let e=new Map;return u.forEach(t=>e.set(t,{id:t,source:`base`})),s.forEach(t=>{let n=e.get(t.id);e.set(t.id,{...t,source:n?.source??`assigned`})}),Array.from(e.values()).map(e=>{let n=t.find(t=>t.id===e.id);return{id:e.id,name:n?.name||e.suppliedName||Z(e.id),description:n?.description||`Capacidad disponible en el loadout operativo de este agente.`,category:n?.category||X(e.id),available:n?n.enabled&&n.active!==!1:!0,source:e.source}})},[u,s,t]),p=(0,K.useMemo)(()=>{let e=new Map;return d.forEach(t=>e.set(t.id,{id:t.id,suppliedName:t.name,source:`base`})),l.forEach(t=>{let n=e.get(t.id);e.set(t.id,{...t,source:n?.source??`assigned`})}),Array.from(e.values()).map(e=>{let t=i.find(t=>t.id===e.id),n=d.find(t=>t.id===e.id);return{id:e.id,name:t?.name||n?.name||e.suppliedName||Z(e.id),description:t?.description||n?.description||`Conocimiento operativo incluido en el contexto de este agente.`,category:t?.category||n?.category||`core`,source:e.source}})},[d,l,i]),m=new Set(f.map(e=>e.category)).size,h=e.mcpServers??(e.mcpServerIds??[]).map(e=>({id:e,name:e,status:`unknown`,enabled:!0,toolsCount:0})),_=n&&t.length===0||a&&i.length===0;return(0,q.jsxs)(`section`,{className:`mb-8 overflow-hidden rounded-2xl border border-white/[0.08] bg-[#0b0e14]/75`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-4 border-b border-white/[0.07] px-5 py-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg border border-emerald-500/20 bg-emerald-500/10`,children:(0,q.jsx)(T,{className:`h-4 w-4 text-emerald-400`})}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h2`,{className:`text-sm font-black uppercase tracking-[0.12em] text-white/85`,children:`Loadout operativo`}),(0,q.jsx)(`p`,{className:`mt-0.5 text-[11px] text-white/35`,children:e.role===`coordinator`?`Capacidades mínimas del coordinador y asignaciones adicionales`:`Tools y skills asignadas para ejecutar tareas`})]})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,q.jsx)($,{value:f.length,label:`tools`,color:`text-emerald-400`}),(0,q.jsx)(`div`,{className:`h-7 w-px bg-white/[0.08]`}),(0,q.jsx)($,{value:p.length,label:`skills`,color:`text-amber-400`}),h.length>0&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`h-7 w-px bg-white/[0.08]`}),(0,q.jsx)($,{value:h.length,label:`MCP`,color:`text-violet-400`})]}),(0,q.jsx)(`div`,{className:`hidden h-7 w-px bg-white/[0.08] sm:block`}),(0,q.jsx)(`div`,{className:`hidden sm:block`,children:(0,q.jsx)($,{value:m,label:`categorías`,color:`text-blue-400`})})]})]}),_&&f.length===0&&p.length===0&&h.length===0?(0,q.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-14 text-xs text-white/35`,children:[(0,q.jsx)(g,{className:`h-4 w-4 animate-spin text-emerald-400`}),`Sincronizando loadout…`]}):f.length===0&&p.length===0&&h.length===0?(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center px-5 py-14 text-center`,children:[(0,q.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-xl border border-dashed border-white/10 bg-white/[0.025]`,children:(0,q.jsx)(be,{className:`h-5 w-5 text-white/20`})}),(0,q.jsx)(`p`,{className:`mt-3 text-sm font-semibold text-white/60`,children:`Este agente no tiene capacidades asignadas`}),(0,q.jsx)(`p`,{className:`mt-1 text-xs text-white/30`,children:`Su loadout operativo está vacío.`})]}):(0,q.jsxs)(q.Fragment,{children:[f.length>0&&(0,q.jsxs)(`div`,{className:`p-4`,children:[(0,q.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,q.jsx)(T,{className:`h-3.5 w-3.5 text-emerald-400`}),(0,q.jsx)(`h3`,{className:`text-[10px] font-black uppercase tracking-[0.16em] text-white/50`,children:`Tools disponibles`})]}),(0,q.jsx)(`div`,{className:`grid gap-2.5 sm:grid-cols-2 xl:grid-cols-3`,children:f.map(e=>(0,q.jsxs)(`article`,{className:`group rounded-xl border border-white/[0.07] bg-black/20 p-3.5 transition-colors hover:border-emerald-500/20 hover:bg-emerald-500/[0.025]`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-white/[0.07] bg-white/[0.035]`,children:(0,q.jsx)(Te(e.category),{className:`h-3.5 w-3.5 text-emerald-400/80`})}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,q.jsx)(`h4`,{className:`truncate text-xs font-bold text-white/80`,title:e.name,children:e.name}),(0,q.jsx)(`span`,{title:e.available?`Disponible`:`No disponible`,children:(0,q.jsx)(c,{className:`h-3.5 w-3.5 shrink-0 ${e.available?`text-emerald-400`:`text-white/15`}`})})]}),(0,q.jsx)(`p`,{className:`mt-1 line-clamp-2 min-h-8 text-[10px] leading-4 text-white/30`,children:e.description})]})]}),(0,q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-white/[0.05] pt-2`,children:[(0,q.jsx)(`span`,{className:`text-[8px] font-bold uppercase tracking-[0.14em] text-emerald-400/65`,children:Ce[e.category]||e.category}),(0,q.jsx)(Q,{source:e.source})]})]},e.id))})]}),h.length>0&&(0,q.jsxs)(`div`,{className:`border-t border-white/[0.07] p-4`,children:[(0,q.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,q.jsx)(x,{className:`h-3.5 w-3.5 text-violet-400`}),(0,q.jsx)(`h3`,{className:`text-[10px] font-black uppercase tracking-[0.16em] text-white/50`,children:`Integraciones MCP asignadas`})]}),(0,q.jsx)(`div`,{className:`grid gap-2.5 sm:grid-cols-2 xl:grid-cols-3`,children:h.map(e=>(0,q.jsxs)(`article`,{className:`rounded-xl border border-violet-500/15 bg-violet-500/[0.035] p-3.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-violet-500/20 bg-violet-500/[0.08]`,children:(0,q.jsx)(x,{className:`h-3.5 w-3.5 text-violet-300`})}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,q.jsx)(`h4`,{className:`truncate text-xs font-bold text-white/80`,title:e.name,children:e.name}),(0,q.jsx)(`span`,{className:`mt-1 h-2 w-2 shrink-0 rounded-full ${e.enabled?`bg-emerald-400`:`bg-white/20`}`})]}),(0,q.jsxs)(`p`,{className:`mt-1 text-[10px] leading-4 text-white/30`,children:[`Servidor completo · `,e.toolsCount,` tools sincronizadas`]})]})]}),(0,q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-white/[0.05] pt-2`,children:[(0,q.jsx)(`span`,{className:`text-[8px] font-bold uppercase tracking-[0.14em] text-violet-300/70`,children:e.status}),(0,q.jsx)(`span`,{className:`rounded bg-violet-500/10 px-1.5 py-0.5 text-[7px] font-black uppercase tracking-wider text-violet-200/70`,children:`Persistente`})]})]},e.id))})]}),p.length>0&&(0,q.jsxs)(`div`,{className:`border-t border-white/[0.07] p-4`,children:[(0,q.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,q.jsx)(W,{className:`h-3.5 w-3.5 text-amber-400`}),(0,q.jsx)(`h3`,{className:`text-[10px] font-black uppercase tracking-[0.16em] text-white/50`,children:`Skills en contexto`})]}),(0,q.jsx)(`div`,{className:`grid gap-2.5 sm:grid-cols-2 xl:grid-cols-3`,children:p.map(e=>(0,q.jsxs)(`article`,{className:`rounded-xl border border-amber-500/10 bg-amber-500/[0.025] p-3.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-amber-500/15 bg-amber-500/[0.07]`,children:(0,q.jsx)(W,{className:`h-3.5 w-3.5 text-amber-400`})}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`h4`,{className:`truncate text-xs font-bold text-white/80`,title:e.name,children:e.name}),(0,q.jsx)(`p`,{className:`mt-1 line-clamp-2 min-h-8 text-[10px] leading-4 text-white/30`,children:e.description})]})]}),(0,q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-white/[0.05] pt-2`,children:[(0,q.jsx)(`span`,{className:`text-[8px] font-bold uppercase tracking-[0.14em] text-amber-400/65`,children:e.category}),(0,q.jsx)(Q,{source:e.source})]})]},e.id))})]})]})]})}function Q({source:e}){return(0,q.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[7px] font-black uppercase tracking-wider ${e===`base`?`bg-blue-500/10 text-blue-300/70`:`bg-white/5 text-white/25`}`,children:e===`base`?`Minimal · base`:`Asignada`})}function $({value:e,label:t,color:n}){return(0,q.jsxs)(`div`,{className:`text-right`,children:[(0,q.jsx)(`p`,{className:`text-base font-black tabular-nums ${n}`,children:e}),(0,q.jsx)(`p`,{className:`text-[8px] font-bold uppercase tracking-wider text-white/25`,children:t})]})}function Te(e){switch(e){case`filesystem`:return G;case`web`:return u;case`cron`:return _e;case`cli`:return C;case`agents`:return se;case`canvas`:return l;case`mcp`:return x;case`office`:return G;default:return T}}function Ee(){let{id:e}=ie(),t=re(),n=e??`unknown`,{agents:i,fetchAgents:a}=N();(0,K.useEffect)(()=>{a()},[a]);let s=i.find(e=>e.id===n);return(0,q.jsx)(`div`,{className:`min-h-screen bg-transparent pb-20`,children:(0,q.jsxs)(`div`,{className:`max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8 animate-fade-in`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between mb-8`,children:[(0,q.jsxs)(k,{variant:`ghost`,onClick:()=>t(`/agents`),className:`group flex items-center gap-2 text-white/40 hover:text-white hover:bg-white/5 px-4 py-2 rounded-xl transition-colors`,children:[(0,q.jsx)(o,{className:`h-4 w-4 transition-transform group-hover:-translate-x-1`}),(0,q.jsx)(`span`,{className:`text-sm font-bold uppercase tracking-widest`,children:`Volver a la Colmena`})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-4 text-white/20`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(ye,{className:`h-4 w-4`}),(0,q.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`Agentes`})]}),(0,q.jsx)(`div`,{className:`h-4 w-px bg-white/10`}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(r,{className:`h-4 w-4`}),(0,q.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`Detalles Operativos`})]})]})]}),s?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Se,{agent:s}),(0,q.jsx)(we,{agent:s}),(0,q.jsx)(`div`,{className:`grid grid-cols-1 gap-8`,children:(0,q.jsx)(xe,{agentId:n})})]}):(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-[60vh] text-center space-y-6`,children:[(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(`div`,{className:`h-24 w-24 rounded-full border-4 border-t-blue-500 border-white/5 animate-spin`}),(0,q.jsx)(r,{className:`absolute inset-0 m-auto h-8 w-8 text-blue-400 animate-pulse`})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{className:`text-xl font-bold text-white mb-2`,children:`Sincronizando con el Nodo`}),(0,q.jsx)(`p`,{className:`text-white/40 max-w-xs mx-auto`,children:`Estamos recuperando la configuración cuántica de este agente desde la base de datos central.`})]})]})]})})}export{Ee as AgentDetailPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./vendor-query-Dj8xYhQD.js";import{t}from"./AgentCreateForm-ASjKD7Js.js";var n=e();function r(){return(0,n.jsx)(t,{})}export{r as AgentNewPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{f as t}from"./vendor-charts-K3xcRl0X.js";import{C as n,D as r,E as i,O as a,S as o,T as s,b as c,k as l,v as u,w as d,x as f,y as p}from"./vendor-radix-D0s_k6Gp.js";import{o as m}from"./vendor-query-Dj8xYhQD.js";import{t as h}from"./activity-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{f as t}from"./vendor-charts-K3xcRl0X.js";import{C as n,D as r,E as i,O as a,S as o,T as s,b as c,k as l,v as u,w as d,x as f,y as p}from"./vendor-radix-D0s_k6Gp.js";import{o as m}from"./vendor-query-Dj8xYhQD.js";import{t as h}from"./activity-DZKL7dg4.js";import{t as g}from"./arrow-up-right-CJBtXRrp.js";import{t as _}from"./calendar-CkDsc4OJ.js";import{t as v}from"./check-DxOMIDcl.js";import{t as y}from"./chevron-right-jCt1h8Kw.js";import{t as b}from"./useProviders-B3rT_xU9.js";import{t as x}from"./ellipsis-vertical-DEBZJGzY.js";import{t as S}from"./file-text-Bth5pPZX.js";import{r as C}from"./ModelSelector-C8ny_pxu.js";import{t as ee}from"./gauge-DypSzSOE.js";import{n as te,t as w}from"./pencil-C3tPvnCk.js";import{a as ne,i as re,n as T,o as ie,s as ae,t as E}from"./agentCapabilities-DuGs07XP.js";import{t as D}from"./plus-CF9No2td.js";import{t as oe}from"./refresh-cw-BmYQwOhh.js";import{t as O}from"./shield-gbUkSqfi.js";import{t as se}from"./sparkles-Ccd1JZ3s.js";import{t as k}from"./trash-2-CfCs7RhJ.js";import{t as A}from"./zap-B1azpiE7.js";import{t as j}from"./utils-Dyb7SC2_.js";import{c as M}from"./vendor-router-zpB-76nT.js";import{K as N,M as ce,N as P,W as le,k as ue,m as F,o as I,s as L,t as R}from"./index-D-9yCvjP.js";import{t as de}from"./AgentCreateForm-ASjKD7Js.js";var z=N(`BrainCircuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),fe=N(`Circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),pe=N(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),B=N(`Pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),V=e(t(),1),H=m(),me=s,he=l,ge=V.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,H.jsxs)(a,{ref:i,className:j(`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent`,t&&`pl-8`,e),...r,children:[n,(0,H.jsx)(y,{className:`ml-auto h-4 w-4`})]}));ge.displayName=a.displayName;var _e=V.forwardRef(({className:e,...t},n)=>(0,H.jsx)(r,{ref:n,className:j(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...t}));_e.displayName=r.displayName;var U=V.forwardRef(({className:e,sideOffset:t=4,...r},i)=>(0,H.jsx)(n,{children:(0,H.jsx)(p,{ref:i,sideOffset:t,className:j(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...r})}));U.displayName=p.displayName;var W=V.forwardRef(({className:e,inset:t,...n},r)=>(0,H.jsx)(c,{ref:r,className:j(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground`,t&&`pl-8`,e),...n}));W.displayName=c.displayName;var ve=V.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,H.jsxs)(u,{ref:i,className:j(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground`,e),checked:n,...r,children:[(0,H.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,H.jsx)(f,{children:(0,H.jsx)(v,{className:`h-4 w-4`})})}),t]}));ve.displayName=u.displayName;var ye=V.forwardRef(({className:e,children:t,...n},r)=>(0,H.jsxs)(d,{ref:r,className:j(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground`,e),...n,children:[(0,H.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,H.jsx)(f,{children:(0,H.jsx)(fe,{className:`h-2 w-2 fill-current`})})}),t]}));ye.displayName=d.displayName;var be=V.forwardRef(({className:e,inset:t,...n},r)=>(0,H.jsx)(o,{ref:r,className:j(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));be.displayName=o.displayName;var xe=V.forwardRef(({className:e,...t},n)=>(0,H.jsx)(i,{ref:n,className:j(`-mx-1 my-1 h-px bg-muted`,e),...t}));xe.displayName=i.displayName;var Se=({className:e,...t})=>(0,H.jsx)(`span`,{className:j(`ml-auto text-xs tracking-widest opacity-60`,e),...t});Se.displayName=`DropdownMenuShortcut`;function Ce(e){if(!e)return null;try{return ne(new Date(e),`dd MMM yyyy`,{locale:re})}catch{return null}}function we({agent:e,onEdit:t}){let n=M(),{deleteAgent:r}=R(),{providers:i}=L(),{models:a}=I(),o=t=>{t.target.closest(`[role="menuitem"]`)||t.target.closest(`button`)||n(`/agents/${e.id}`)},s=async t=>{if(t.stopPropagation(),(await F.fire({title:`¿Eliminar Agente?`,text:`¿Estás seguro de que deseas eliminar al agente "${e.name}"? Esta acción eliminará permanentemente su configuración.`,icon:`warning`,showCancelButton:!0,confirmButtonText:`Sí, eliminar`,cancelButtonText:`Cancelar`,reverseButtons:!0,background:`#09090b`,color:`#fff`,customClass:{popup:`border border-white/10 rounded-xl`,confirmButton:`bg-red-500 hover:bg-red-600 text-white`,cancelButton:`bg-white/10 hover:bg-white/20 text-white`}})).isConfirmed)try{await r(e.id)}catch(e){console.error(e)}},c=e.role===`coordinator`,l=e.provider_id||e.providerId,u=e.model_id||e.modelId,d=i.find(e=>e.id===l)?.name||l,f=a.find(e=>e.id===u)?.name||u,p=e.enabled?e.status:`hibernated`,m=T(e).length,g=E(e).length,v=!!e.systemPrompt,y=e.maxIterations||10,w=Ce(e.created_at||e.createdAt);return(0,H.jsxs)(`div`,{role:`button`,tabIndex:0,className:`group relative overflow-hidden rounded-2xl border bg-black/40 backdrop-blur-xl transition-all duration-500 cursor-pointer flex flex-col h-full
|
|
2
2
|
${e.enabled?c?`border-purple-500/20 hover:border-purple-500/50 hover:bg-white/[0.03] hover:shadow-[0_0_30px_rgba(168,85,247,0.15)]`:`border-white/10 hover:border-blue-500/50 hover:bg-white/[0.03] hover:shadow-[0_0_30px_rgba(59,130,246,0.15)]`:`border-white/5 opacity-70 grayscale hover:grayscale-0`}
|
|
3
3
|
`,onClick:o,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&n(`/agents/${e.id}`)},children:[e.enabled&&(0,H.jsx)(`div`,{className:`absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent ${c?`via-purple-500/60`:`via-blue-500/50`} to-transparent`}),e.enabled&&(0,H.jsx)(`div`,{className:`absolute inset-0 bg-gradient-to-br ${c?`from-purple-500/10 via-transparent to-blue-500/5`:`from-blue-500/10 via-transparent to-purple-500/10`} opacity-0 transition-opacity duration-500 group-hover:opacity-100 pointer-events-none`}),(0,H.jsxs)(`div`,{className:`p-5 flex flex-col flex-1 relative z-10`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3 mb-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`w-11 h-11 rounded-xl flex items-center justify-center shrink-0 border transition-colors
|
|
4
4
|
${c?`bg-purple-500/10 border-purple-500/20 group-hover:border-purple-500/40`:`bg-blue-500/10 border-blue-500/20 group-hover:border-blue-500/40`}`,children:c?(0,H.jsx)(O,{className:`h-5 w-5 text-purple-400`}):(0,H.jsx)(b,{className:`h-5 w-5 text-blue-400`})}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h3`,{className:`text-base font-bold tracking-tight transition-colors truncate ${e.enabled?`text-white/95 group-hover:text-white`:`text-white/40`}`,children:e.name}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-0.5 flex-wrap`,children:[(0,H.jsx)(`span`,{className:`text-[9px] px-2 py-0.5 rounded-full font-bold uppercase border
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{f as t}from"./vendor-charts-K3xcRl0X.js";import{o as n}from"./vendor-query-Dj8xYhQD.js";import{t as r}from"./chevron-down-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{f as t}from"./vendor-charts-K3xcRl0X.js";import{o as n}from"./vendor-query-Dj8xYhQD.js";import{t as r}from"./chevron-down-CObv-xyx.js";import{t as i}from"./chevron-right-jCt1h8Kw.js";import{t as a}from"./circle-check-CXC2AiMS.js";import{t as o}from"./circle-x-h4OJiHV3.js";import{t as s}from"./copy-BtpYEEvV.js";import{t as c}from"./history-njH_sPSo.js";import{t as l}from"./plus-CF9No2td.js";import{t as u}from"./send-C3o2wpLi.js";import{t as d}from"./trash-2-CfCs7RhJ.js";import{t as f}from"./utils-Dyb7SC2_.js";import{H as ee,O as p,U as m,f as h,k as g}from"./index-D-9yCvjP.js";import{t as te}from"./badge-DKGZbVZJ.js";import{t as _}from"./scroll-area-CfHn94Vb.js";import{i as v,n as y,r as b,t as x}from"./tabs-CxiybXcw.js";import{t as S}from"./textarea-rp6vsOZl.js";import{i as C,n as ne,o as re,s as w,t as T}from"./select-BfRyBbi9.js";import{a as E,i as D,n as O,t as k}from"./card-D3Nw3kh3.js";var A=e(t(),1),j=n(),ie=[`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`];function M(){return Math.random().toString(36).substring(2,9)}function N(){return{id:M(),key:``,value:``,enabled:!0}}function P(){let[e,t]=(0,A.useState)(`GET`),[n,P]=(0,A.useState)(``),[F,I]=(0,A.useState)([N()]),[L,R]=(0,A.useState)([N()]),[z,B]=(0,A.useState)(``),[V,H]=(0,A.useState)(null),[U,W]=(0,A.useState)(!1),[G,K]=(0,A.useState)(0),[q,J]=(0,A.useState)([]),[Y,ae]=(0,A.useState)(!1),[oe,se]=(0,A.useState)(`body`);(0,A.useEffect)(()=>{try{let e=localStorage.getItem(`hive-api-client-history`);e&&J(JSON.parse(e))}catch{}},[]);let ce=(0,A.useCallback)(e=>{localStorage.setItem(`hive-api-client-history`,JSON.stringify(e.slice(0,50)))},[]),X=(e,t,n,r,i)=>{t(e.map(e=>e.id===n?{...e,[r]:i}:e))},Z=(e,t)=>{t([...e,N()])},le=(e,t,n)=>{e.length===1?t([N()]):t(e.filter(e=>e.id!==n))},ue=()=>{let e={};for(let t of F)t.enabled&&t.key.trim()&&(e[t.key.trim()]=t.value);return e},de=()=>{let e={};for(let t of L)t.enabled&&t.key.trim()&&(e[t.key.trim()]=t.value);return e},Q=async()=>{if(!n.trim())return;W(!0),H(null);let t=performance.now();try{let r={method:e,url:n.trim(),headers:ue(),query_params:de()};z.trim()&&e!==`GET`&&e!==`HEAD`&&(r.body=z.trim());let i=await h(`/api/http-request`,{method:`POST`,body:r,showError:!1});K(Math.round(performance.now()-t)),H(i);let a=[{id:M(),method:e,url:n.trim(),timestamp:Date.now(),status:i.status,ok:i.ok},...q];J(a),ce(a)}catch(e){K(Math.round(performance.now()-t)),H({ok:!1,error:e.message||`Request failed`})}finally{W(!1)}},fe=e=>{t(e.method),P(e.url),H(null)},pe=e=>{navigator.clipboard.writeText(e)},me=e=>{if(e==null)return``;if(typeof e==`string`)try{let t=JSON.parse(e);return JSON.stringify(t,null,2)}catch{return e}return JSON.stringify(e,null,2)},he=e=>e?e>=200&&e<300?`bg-green-500`:e>=300&&e<400?`bg-yellow-500`:e>=400&&e<500?`bg-orange-500`:`bg-red-500`:`bg-gray-500`,$=(e,t,n,r)=>(0,j.jsxs)(`div`,{className:`space-y-2`,children:[e.map(i=>(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`input`,{type:`checkbox`,checked:i.enabled,onChange:n=>X(e,t,i.id,`enabled`,n.target.checked),className:`h-4 w-4 rounded border-white/20 bg-background`}),(0,j.jsx)(p,{placeholder:n,value:i.key,onChange:n=>X(e,t,i.id,`key`,n.target.value),className:`h-8 text-xs bg-background/50`}),(0,j.jsx)(p,{placeholder:r,value:i.value,onChange:n=>X(e,t,i.id,`value`,n.target.value),className:`h-8 text-xs bg-background/50`}),(0,j.jsx)(g,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground hover:text-red-400`,onClick:()=>le(e,t,i.id),children:(0,j.jsx)(d,{className:`h-3.5 w-3.5`})})]},i.id)),(0,j.jsxs)(g,{variant:`ghost`,size:`sm`,className:`text-xs text-muted-foreground hover:text-primary`,onClick:()=>Z(e,t),children:[(0,j.jsx)(l,{className:`h-3.5 w-3.5 mr-1`}),`Agregar`]})]});return(0,j.jsxs)(`div`,{className:`hive-page-container animate-fade-in mt-10`,children:[(0,j.jsx)(`div`,{className:`hive-page-header mb-6`,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,j.jsx)(`div`,{className:`h-10 w-10 rounded-xl bg-purple-500/10 border border-purple-500/20 flex items-center justify-center text-purple-400`,children:(0,j.jsx)(ee,{className:`h-6 w-6`})}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h1`,{className:`text-3xl font-black text-white uppercase tracking-tighter`,children:`API Client`}),(0,j.jsx)(`p`,{className:`hive-subtitle`,children:`Cliente HTTP para probar endpoints REST directamente desde Hive.`})]})]})}),(0,j.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-[1fr_320px] gap-6`,children:[(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsx)(k,{className:`border-white/10 bg-card/50`,children:(0,j.jsx)(O,{className:`p-4`,children:(0,j.jsxs)(`div`,{className:`flex gap-2`,children:[(0,j.jsxs)(T,{value:e,onValueChange:t,children:[(0,j.jsx)(re,{className:`w-[110px] h-10 text-xs font-bold tracking-wider`,children:(0,j.jsx)(w,{})}),(0,j.jsx)(ne,{children:ie.map(e=>(0,j.jsx)(C,{value:e,className:`text-xs font-bold`,children:e},e))})]}),(0,j.jsx)(p,{placeholder:`https://api.example.com/endpoint`,value:n,onChange:e=>P(e.target.value),onKeyDown:e=>e.key===`Enter`&&Q(),className:`h-10 text-sm bg-background/50 font-mono`}),(0,j.jsxs)(g,{onClick:Q,disabled:U||!n.trim(),className:`h-10 px-6 bg-purple-600 hover:bg-purple-500 text-white font-bold text-xs tracking-wider`,children:[U?(0,j.jsx)(m,{className:`h-4 w-4 animate-spin mr-2`}):(0,j.jsx)(u,{className:`h-4 w-4 mr-2`}),`ENVIAR`]})]})})}),(0,j.jsx)(k,{className:`border-white/10 bg-card/50`,children:(0,j.jsx)(O,{className:`p-4`,children:(0,j.jsxs)(x,{defaultValue:`headers`,className:`w-full`,children:[(0,j.jsxs)(b,{className:`bg-background/50 h-8`,children:[(0,j.jsxs)(v,{value:`headers`,className:`text-xs h-7`,children:[`Headers (`,F.filter(e=>e.enabled&&e.key.trim()).length,`)`]}),(0,j.jsxs)(v,{value:`query`,className:`text-xs h-7`,children:[`Query Params (`,L.filter(e=>e.enabled&&e.key.trim()).length,`)`]}),(0,j.jsx)(v,{value:`body`,className:`text-xs h-7`,children:`Body`})]}),(0,j.jsx)(y,{value:`headers`,className:`mt-3`,children:$(F,I,`Header`,`Value`)}),(0,j.jsx)(y,{value:`query`,className:`mt-3`,children:$(L,R,`Key`,`Value`)}),(0,j.jsxs)(y,{value:`body`,className:`mt-3`,children:[(0,j.jsx)(S,{placeholder:`{
|
|
2
2
|
"key": "value"
|
|
3
3
|
}`,value:z,onChange:e=>B(e.target.value),className:`min-h-[140px] font-mono text-xs bg-background/50`}),(0,j.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-2`,children:`Se enviará como string crudo. Para JSON, asegurate de que sea válido.`})]})]})})}),V&&(0,j.jsxs)(k,{className:f(`border-white/10`,V.ok?`bg-green-500/[0.02]`:`bg-red-500/[0.02]`),children:[(0,j.jsx)(D,{className:`pb-3`,children:(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(E,{className:`text-sm font-bold tracking-wider`,children:`RESPUESTA`}),V.status!==void 0&&(0,j.jsxs)(te,{variant:`outline`,className:f(`text-xs font-bold border-none`,he(V.status),`text-white`),children:[V.status,` `,V.statusText||``]}),V.ok?(0,j.jsx)(a,{className:`h-4 w-4 text-green-500`}):(0,j.jsx)(o,{className:`h-4 w-4 text-red-500`}),(0,j.jsxs)(`span`,{className:`text-[10px] text-muted-foreground font-mono`,children:[G,`ms`]})]}),(0,j.jsxs)(g,{variant:`ghost`,size:`sm`,className:`h-7 text-xs`,onClick:()=>pe(JSON.stringify(V,null,2)),children:[(0,j.jsx)(s,{className:`h-3 w-3 mr-1`}),`Copiar`]})]})}),(0,j.jsx)(O,{className:`pt-0`,children:(0,j.jsxs)(x,{value:oe,onValueChange:se,children:[(0,j.jsxs)(b,{className:`bg-background/50 h-8`,children:[(0,j.jsx)(v,{value:`body`,className:`text-xs h-7`,children:`Body`}),(0,j.jsx)(v,{value:`headers`,className:`text-xs h-7`,children:`Headers`}),(0,j.jsx)(v,{value:`raw`,className:`text-xs h-7`,children:`Raw`})]}),(0,j.jsx)(y,{value:`body`,className:`mt-3`,children:(0,j.jsx)(_,{className:`h-[300px] w-full rounded-md border bg-black/40 p-3`,children:(0,j.jsx)(`pre`,{className:`font-mono text-xs text-green-400 whitespace-pre-wrap`,children:me(V.body??V)})})}),(0,j.jsx)(y,{value:`headers`,className:`mt-3`,children:(0,j.jsx)(_,{className:`h-[300px] w-full rounded-md border bg-black/40 p-3`,children:V.headers?(0,j.jsx)(`div`,{className:`space-y-1`,children:Object.entries(V.headers).map(([e,t])=>(0,j.jsxs)(`div`,{className:`flex gap-2 text-xs font-mono`,children:[(0,j.jsxs)(`span`,{className:`text-purple-400 shrink-0`,children:[e,`:`]}),(0,j.jsx)(`span`,{className:`text-white/70`,children:String(t)})]},e))}):(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No headers disponibles`})})}),(0,j.jsx)(y,{value:`raw`,className:`mt-3`,children:(0,j.jsx)(_,{className:`h-[300px] w-full rounded-md border bg-black/40 p-3`,children:(0,j.jsx)(`pre`,{className:`font-mono text-xs text-white/60 whitespace-pre-wrap`,children:JSON.stringify(V,null,2)})})})]})})]})]}),(0,j.jsx)(`div`,{children:(0,j.jsxs)(k,{className:`border-white/10 bg-card/50`,children:[(0,j.jsx)(D,{className:`pb-3`,children:(0,j.jsxs)(`button`,{onClick:()=>ae(!Y),className:`flex items-center justify-between w-full`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(c,{className:`h-4 w-4 text-muted-foreground`}),(0,j.jsx)(E,{className:`text-xs font-bold tracking-wider`,children:`HISTORIAL`})]}),Y?(0,j.jsx)(r,{className:`h-4 w-4 text-muted-foreground`}):(0,j.jsx)(i,{className:`h-4 w-4 text-muted-foreground`})]})}),Y&&(0,j.jsxs)(O,{className:`pt-0`,children:[q.length===0?(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground text-center py-4`,children:`No hay requests en el historial`}):(0,j.jsx)(_,{className:`h-[calc(100vh-300px)]`,children:(0,j.jsx)(`div`,{className:`space-y-1`,children:q.map(e=>(0,j.jsxs)(`button`,{onClick:()=>fe(e),className:`w-full text-left p-2 rounded-lg hover:bg-white/5 transition-colors group`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:f(`text-[10px] font-bold px-1.5 py-0.5 rounded`,e.ok?`bg-green-500/20 text-green-400`:`bg-red-500/20 text-red-400`),children:e.method}),e.status&&(0,j.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.status})]}),(0,j.jsx)(`p`,{className:`text-[10px] text-white/50 truncate mt-1 font-mono`,children:e.url}),(0,j.jsx)(`p`,{className:`text-[9px] text-white/30 mt-0.5`,children:new Date(e.timestamp).toLocaleTimeString()})]},e.id))})}),q.length>0&&(0,j.jsxs)(g,{variant:`ghost`,size:`sm`,className:`w-full mt-2 text-[10px] text-muted-foreground hover:text-red-400`,onClick:()=>{J([]),localStorage.removeItem(`hive-api-client-history`)},children:[(0,j.jsx)(d,{className:`h-3 w-3 mr-1`}),`Limpiar historial`]})]})]})})]})]})}export{P as ApiClientPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e,t}from"./rolldown-runtime-S-ySWqyJ.js";import{f as n}from"./vendor-charts-K3xcRl0X.js";import{o as r}from"./vendor-query-Dj8xYhQD.js";import{t as i}from"./circle-alert-DTVW4R94.js";import{t as a}from"./circle-check-BAolxswA.js";import{n as o,t as s}from"./eye-CM-HQEWU.js";import{t as c}from"./loader-circle-Dtfz4FWw.js";import{t as l}from"./plus-Cnom3j47.js";import{t as u}from"./refresh-cw-BRrzoHQW.js";import{t as d}from"./settings-CkBjgAEm.js";import{t as f}from"./zap-BEZNJ0i0.js";import{c as p}from"./vendor-router-zpB-76nT.js";import{B as m,K as h,M as g,O as _,f as v,k as y,n as b,o as ee,s as x,u as S,z as te}from"./index-ZjAc-KQS.js";import{t as C}from"./label-k0jYxoWW.js";import{a as ne,i as w,n as T,o as E,r as re,s as D,t as O}from"./select-BOR8MsSL.js";import{t as k}from"./switch-DXcELPsM.js";import{n as ie,t as ae}from"./alert-CQlRq6sv.js";var oe=h(`QrCode`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),A=e(n(),1),j=r();function M({channel:e,onEdit:t,onToggle:n}){e.status;let r=e.isConfigured===!1,i=e.status===`connected`||e.status===`connecting`;return(0,j.jsxs)(`div`,{onClick:()=>t(e),className:`hive-card group transition-all duration-500 cursor-pointer ${i?`hive-card--active border-emerald-500/20`:r?`opacity-50 border-dashed hover:opacity-80 hover:border-blue-500/30`:`opacity-60 grayscale-[0.8] hover:opacity-100 hover:grayscale-0`}`,children:[(0,j.jsxs)(`div`,{className:`hive-card-body relative overflow-hidden`,children:[(0,j.jsxs)(`div`,{className:`flex items-start justify-between mb-8`,children:[(0,j.jsx)(`div`,{className:`h-12 w-12 rounded-xl flex items-center justify-center border transition-all duration-500 ${i?`bg-emerald-500/10 border-emerald-500/30 text-emerald-400 shadow-[0_0_15px_rgba(16,185,129,0.2)]`:r?`bg-blue-500/5 border-blue-500/20 text-blue-400/40`:`bg-white/5 border-white/10 text-white/30`}`,children:(0,j.jsx)(te,{className:`h-6 w-6`})}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i&&(0,j.jsx)(`span`,{className:`text-[9px] font-black tracking-widest text-emerald-500 shadow-emerald-glow`,children:e.status===`connecting`?`CONECTANDO`:`CONECTADO`}),r?(0,j.jsx)(`span`,{className:`text-[9px] font-black tracking-widest text-blue-400/60 uppercase`,children:`DISPONIBLE`}):(0,j.jsx)(k,{checked:e.enabled,onCheckedChange:t=>n(e.id,t),onClick:e=>e.stopPropagation(),className:`data-[state=checked]:bg-emerald-500 scale-75 origin-right`})]})]}),(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h3`,{className:`text-xl font-black text-white uppercase tracking-tighter mb-1 line-clamp-1 group-hover:text-emerald-400 transition-colors`,children:e.type}),(0,j.jsx)(`p`,{className:`text-[10px] text-white/20 font-black tracking-[0.2em] mb-4`,children:r?`CLICK PARA CONFIGURAR`:`ID: ${e.id.substring(0,12).toUpperCase()}`})]}),(0,j.jsxs)(`div`,{className:`pt-4 border-t border-white/5 flex items-center gap-6`,children:[(0,j.jsxs)(`div`,{className:`hive-stat`,children:[(0,j.jsx)(`span`,{className:`hive-stat__label`,children:`VOZ`}),(0,j.jsx)(`span`,{className:`hive-stat__value ${e.voice_enabled?`text-emerald-500`:`text-white/20`}`,children:e.voice_enabled?`ON`:`OFF`})]}),(0,j.jsxs)(`div`,{className:`hive-stat`,children:[(0,j.jsx)(`span`,{className:`hive-stat__label`,children:`SÍNTESIS`}),(0,j.jsx)(`span`,{className:`hive-stat__value ${e.tts_enabled?`text-emerald-500`:`text-white/20`}`,children:e.tts_enabled?`ON`:`OFF`})]})]})]}),i&&(0,j.jsx)(`div`,{className:`hive-glow-blob hive-glow-blob--emerald -bottom-10 -right-10 h-24 w-24 opacity-20`})]}),(0,j.jsx)(`div`,{className:`hive-strip--bottom ${i?`bg-emerald-500`:r?`bg-blue-500/30`:`bg-white/10`}`})]})}var se=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),N=t((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),P=t((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),ce=t(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),le=t(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),ue=t((e=>{var t=N().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),de=t((e=>{var t=N().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),F=t((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),I=t((e=>{var t=P(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),L=t((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),fe=t((e=>{var t=L();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),R=t(((e,t)=>{var n=fe();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),z=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),B=t((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
1
|
+
import{r as e,t}from"./rolldown-runtime-S-ySWqyJ.js";import{f as n}from"./vendor-charts-K3xcRl0X.js";import{o as r}from"./vendor-query-Dj8xYhQD.js";import{t as i}from"./circle-alert-BkP6x0zQ.js";import{t as a}from"./circle-check-CXC2AiMS.js";import{n as o,t as s}from"./eye-BfN613fx.js";import{t as c}from"./loader-circle-wLVzSdML.js";import{t as l}from"./plus-CF9No2td.js";import{t as u}from"./refresh-cw-BmYQwOhh.js";import{t as d}from"./settings-DEpdBuf2.js";import{t as f}from"./zap-B1azpiE7.js";import{c as p}from"./vendor-router-zpB-76nT.js";import{B as m,K as h,M as g,O as _,f as v,k as y,n as b,o as ee,s as x,u as S,z as te}from"./index-D-9yCvjP.js";import{t as C}from"./label-k0jYxoWW.js";import{a as ne,i as w,n as T,o as E,r as re,s as D,t as O}from"./select-BfRyBbi9.js";import{t as k}from"./switch-DXcELPsM.js";import{n as ie,t as ae}from"./alert-CQlRq6sv.js";var oe=h(`QrCode`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),A=e(n(),1),j=r();function M({channel:e,onEdit:t,onToggle:n}){e.status;let r=e.isConfigured===!1,i=e.status===`connected`||e.status===`connecting`;return(0,j.jsxs)(`div`,{onClick:()=>t(e),className:`hive-card group transition-all duration-500 cursor-pointer ${i?`hive-card--active border-emerald-500/20`:r?`opacity-50 border-dashed hover:opacity-80 hover:border-blue-500/30`:`opacity-60 grayscale-[0.8] hover:opacity-100 hover:grayscale-0`}`,children:[(0,j.jsxs)(`div`,{className:`hive-card-body relative overflow-hidden`,children:[(0,j.jsxs)(`div`,{className:`flex items-start justify-between mb-8`,children:[(0,j.jsx)(`div`,{className:`h-12 w-12 rounded-xl flex items-center justify-center border transition-all duration-500 ${i?`bg-emerald-500/10 border-emerald-500/30 text-emerald-400 shadow-[0_0_15px_rgba(16,185,129,0.2)]`:r?`bg-blue-500/5 border-blue-500/20 text-blue-400/40`:`bg-white/5 border-white/10 text-white/30`}`,children:(0,j.jsx)(te,{className:`h-6 w-6`})}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i&&(0,j.jsx)(`span`,{className:`text-[9px] font-black tracking-widest text-emerald-500 shadow-emerald-glow`,children:e.status===`connecting`?`CONECTANDO`:`CONECTADO`}),r?(0,j.jsx)(`span`,{className:`text-[9px] font-black tracking-widest text-blue-400/60 uppercase`,children:`DISPONIBLE`}):(0,j.jsx)(k,{checked:e.enabled,onCheckedChange:t=>n(e.id,t),onClick:e=>e.stopPropagation(),className:`data-[state=checked]:bg-emerald-500 scale-75 origin-right`})]})]}),(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h3`,{className:`text-xl font-black text-white uppercase tracking-tighter mb-1 line-clamp-1 group-hover:text-emerald-400 transition-colors`,children:e.type}),(0,j.jsx)(`p`,{className:`text-[10px] text-white/20 font-black tracking-[0.2em] mb-4`,children:r?`CLICK PARA CONFIGURAR`:`ID: ${e.id.substring(0,12).toUpperCase()}`})]}),(0,j.jsxs)(`div`,{className:`pt-4 border-t border-white/5 flex items-center gap-6`,children:[(0,j.jsxs)(`div`,{className:`hive-stat`,children:[(0,j.jsx)(`span`,{className:`hive-stat__label`,children:`VOZ`}),(0,j.jsx)(`span`,{className:`hive-stat__value ${e.voice_enabled?`text-emerald-500`:`text-white/20`}`,children:e.voice_enabled?`ON`:`OFF`})]}),(0,j.jsxs)(`div`,{className:`hive-stat`,children:[(0,j.jsx)(`span`,{className:`hive-stat__label`,children:`SÍNTESIS`}),(0,j.jsx)(`span`,{className:`hive-stat__value ${e.tts_enabled?`text-emerald-500`:`text-white/20`}`,children:e.tts_enabled?`ON`:`OFF`})]})]})]}),i&&(0,j.jsx)(`div`,{className:`hive-glow-blob hive-glow-blob--emerald -bottom-10 -right-10 h-24 w-24 opacity-20`})]}),(0,j.jsx)(`div`,{className:`hive-strip--bottom ${i?`bg-emerald-500`:r?`bg-blue-500/30`:`bg-white/10`}`})]})}var se=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),N=t((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),P=t((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),ce=t(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),le=t(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),ue=t((e=>{var t=N().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),de=t((e=>{var t=N().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),F=t((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),I=t((e=>{var t=P(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),L=t((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),fe=t((e=>{var t=L();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),R=t(((e,t)=>{var n=fe();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),z=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),B=t((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
2
2
|
]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^`+t+`$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),V=t((e=>{var t=z(),n=B();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),pe=t((e=>{var t=N(),n=I(),r=P(),i=V(),a=z(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),me=t((e=>{var t=N(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),he=t(((e,t)=>{var n=V();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),ge=t(((e,t)=>{var n=V(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),H=t(((e,t)=>{var n=V();function r(e){this.mode=n.BYTE,typeof e==`string`?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),_e=t(((e,t)=>{var n=V(),r=N();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
|
|
3
3
|
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),ve=t(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),ye=t((e=>{var t=V(),n=he(),r=ge(),i=H(),a=_e(),o=B(),s=N(),c=ve();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
|
|
4
4
|
Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),be=t((e=>{var t=N(),n=P(),r=ce(),i=le(),a=ue(),o=de(),s=F(),c=I(),l=R(),u=pe(),d=me(),f=V(),p=ye();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return ee(a,e,n)}function ee(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),ee=0,x,S;for(x=0;x<v;x++)for(S=0;S<o;S++)x<g[S].length&&(b[ee++]=g[S][x]);for(x=0;x<p;x++)for(S=0;S<o;S++)b[ee++]=_[S][x];return b}function x(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{a as t,c as n,f as r,i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"./vendor-charts-K3xcRl0X.js";import{_ as f,d as p,f as m,g as h,h as g,m as _,p as v,u as y}from"./vendor-radix-D0s_k6Gp.js";import{i as b,n as x,o as ee,t as te}from"./vendor-query-Dj8xYhQD.js";import{t as S}from"./activity-BIIli7ET.js";import{t as C}from"./arrow-up-right-Bf-8wrUQ.js";import{t as ne}from"./circle-check-BAolxswA.js";import{t as w}from"./download-C-fXu08w.js";import{t as re}from"./external-link-CvpRhwC_.js";import{t as ie}from"./gauge-CB-cas-h.js";import{t as ae}from"./info-DTgFQ_jA.js";import{t as T}from"./loader-circle-Dtfz4FWw.js";import{t as oe}from"./triangle-alert-Dj8ZhmWj.js";import{t as E}from"./zap-BEZNJ0i0.js";import{t as D}from"./utils-Dyb7SC2_.js";import{A as se,B as ce,E as le,K as O,R as k,W as A,_ as ue,f as j,k as de,m as M,t as fe,z as pe}from"./index-ZjAc-KQS.js";import{t as me}from"./useOfficeModel-Cy7cAyEn.js";import{t as N}from"./badge-DKGZbVZJ.js";import{a as P,i as F,n as I,r as he,t as L}from"./card-D3Nw3kh3.js";import{t as ge}from"./progress-DrI2UDu-.js";var _e=O(`CircleArrowUp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]]),R=O(`DollarSign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]),ve=O(`HardDrive`,[[`line`,{x1:`22`,x2:`2`,y1:`12`,y2:`12`,key:`1y58io`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}],[`line`,{x1:`6`,x2:`6.01`,y1:`16`,y2:`16`,key:`sgf278`}],[`line`,{x1:`10`,x2:`10.01`,y1:`16`,y2:`16`,key:`1l4acy`}]]),ye=O(`Hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),be=O(`MemoryStick`,[[`path`,{d:`M6 19v-3`,key:`1nvgqn`}],[`path`,{d:`M10 19v-3`,key:`iu8nkm`}],[`path`,{d:`M14 19v-3`,key:`kcehxu`}],[`path`,{d:`M18 19v-3`,key:`1vh91z`}],[`path`,{d:`M8 11V9`,key:`63erz4`}],[`path`,{d:`M16 11V9`,key:`fru6f3`}],[`path`,{d:`M12 11V9`,key:`ha00sb`}],[`path`,{d:`M2 15h20`,key:`16ne18`}],[`path`,{d:`M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z`,key:`lhddv3`}]]),xe=O(`TrendingUp`,[[`polyline`,{points:`22 7 13.5 15.5 8.5 10.5 2 17`,key:`126l90`}],[`polyline`,{points:`16 7 22 7 22 13`,key:`kwv8wd`}]]),z=e(r(),1);function Se(){let{agents:e,isLoading:t,error:n,fetchAgents:r,createAgent:i,updateAgent:a,deleteAgent:o}=fe(),[s,c]=(0,z.useState)(`all`);return(0,z.useEffect)(()=>{r()},[r]),{agents:(0,z.useMemo)(()=>Array.isArray(e)?s===`all`?e:e.filter(e=>e.status===s):[],[e,s]),allAgents:e||[],filter:s,setFilter:c,createAgent:i,updateAgent:a,deleteAgent:o,isLoading:t,error:n,refreshAgents:r}}var B=ee();function V(e){return e<50?`#22c55e`:e<80?`#eab308`:`#ef4444`}function Ce(){let[e,n]=(0,z.useState)(()=>{let e=new Date;return Array.from({length:12},(t,n)=>({time:new Date(e.getTime()-(11-n)*5e3).toLocaleTimeString(`es`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),msgs:0,rss:0}))}),[r,o]=(0,z.useState)([]),{data:s}=x({queryKey:[`system-stats`],queryFn:()=>j(`/api/system-stats`),refetchInterval:5e3}),l=(0,z.useRef)(s);(0,z.useEffect)(()=>{l.current=s},[s]),(0,z.useEffect)(()=>{let e=setInterval(()=>{let e=l.current;if(!e)return;let t=new Date().toLocaleTimeString(`es`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`});n(n=>[...n,{time:t,msgs:e.recentMessages,rss:e.memory.rss}].slice(-20))},5e3);return()=>clearInterval(e)},[]);let d=s?.memory.rss??0,f=s?.memory.heapUsed??0,p=s?.memory.external??0,m=s?.recentMessages??0;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4 mb-4`,children:[(0,B.jsxs)(L,{className:`overflow-hidden border-primary/10`,children:[(0,B.jsx)(F,{className:`pb-2 bg-gradient-to-r from-primary/5 to-transparent`,children:(0,B.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,B.jsxs)(P,{className:`text-base flex items-center gap-2`,children:[(0,B.jsx)(ie,{className:`h-4 w-4 text-primary`}),`Monitor del Proceso Hive`]})})}),(0,B.jsxs)(I,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-5 pt-4`,children:[(0,B.jsx)(H,{icon:E,label:`CPU del proceso`,value:`${s?.cpu??0}%`,subValue:`${s?.cores??1} núcleos disponibles`,color:V(s?.cpu??0),progress:Math.min(100,s?.cpu??0)}),(0,B.jsx)(H,{icon:pe,label:`Actividad reciente`,value:`${m}`,subValue:`mensajes últimos 5 min`,color:m>0?`#22c55e`:`hsl(var(--muted-foreground))`,progress:Math.min(100,m*10)}),(0,B.jsx)(H,{icon:ve,label:`Memoria Hive (RSS)`,value:`${d} MB`,subValue:`Heap JS: ${f} MB usados`,color:V(Math.min(100,Math.round(d/1024*100))),progress:Math.min(100,Math.round(d/1024*100))}),(0,B.jsx)(H,{icon:be,label:`Heap JS`,value:`${f} MB`,subValue:`External: ${p} MB`,color:`#3b82f6`,progress:Math.min(100,Math.round(f/512*100))}),(0,B.jsx)(H,{icon:k,label:`Sesiones WS activas`,value:`${s?.connections??0}`,subValue:`conexiones WebSocket`,color:`#a855f7`,progress:Math.min(100,(s?.connections??0)*10)})]})]}),(0,B.jsxs)(L,{className:`border-primary/10`,children:[(0,B.jsx)(F,{className:`pb-2`,children:(0,B.jsxs)(P,{className:`text-sm flex items-center gap-2`,children:[(0,B.jsx)(S,{className:`h-4 w-4 text-primary`}),`Historial — `,(0,B.jsx)(`span`,{className:`text-green-400`,children:`Mensajes`}),` · `,(0,B.jsx)(`span`,{className:`text-purple-400`,children:`RSS MB`})]})}),(0,B.jsx)(I,{className:`h-[160px]`,children:(0,B.jsx)(a,{width:`100%`,height:`100%`,children:(0,B.jsxs)(u,{data:e,children:[(0,B.jsxs)(`defs`,{children:[(0,B.jsxs)(`linearGradient`,{id:`gMsgs`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,B.jsx)(`stop`,{offset:`5%`,stopColor:`#22c55e`,stopOpacity:.3}),(0,B.jsx)(`stop`,{offset:`95%`,stopColor:`#22c55e`,stopOpacity:0})]}),(0,B.jsxs)(`linearGradient`,{id:`gHeap`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,B.jsx)(`stop`,{offset:`5%`,stopColor:`#8b5cf6`,stopOpacity:.3}),(0,B.jsx)(`stop`,{offset:`95%`,stopColor:`#8b5cf6`,stopOpacity:0})]})]}),(0,B.jsx)(i,{dataKey:`time`,axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:9},interval:`preserveStartEnd`}),(0,B.jsx)(c,{axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:9}}),(0,B.jsx)(t,{type:`monotone`,dataKey:`msgs`,stroke:`#22c55e`,strokeWidth:2,fillOpacity:1,fill:`url(#gMsgs)`,name:`Mensajes`}),(0,B.jsx)(t,{type:`monotone`,dataKey:`rss`,stroke:`#8b5cf6`,strokeWidth:2,fillOpacity:1,fill:`url(#gHeap)`,name:`RSS MB`})]})})})]})]})}function H({icon:e,label:t,value:n,subValue:r,color:i,progress:a}){return(0,B.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3 space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{style:{color:i},children:(0,B.jsx)(e,{className:`h-4 w-4`})}),(0,B.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:t})]}),(0,B.jsx)(`span`,{className:`text-lg font-bold font-mono`,style:{color:i},children:n})]}),(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsx)(`div`,{className:`h-1.5 w-full rounded-full bg-muted overflow-hidden`,children:(0,B.jsx)(`div`,{className:`h-full rounded-full transition-all duration-500`,style:{width:`${Math.min(a,100)}%`,backgroundColor:i}})}),(0,B.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r})]})]})}var U={anthropic:`#d97706`,openai:`#10b981`,google:`#3b82f6`,gemini:`#3b82f6`,deepseek:`#8b5cf6`,kimi:`#ec4899`,ollama:`#14b8a6`,openrouter:`#f59e0b`,mistral:`#6366f1`};function W(e){return e>=1e6?(e/1e6).toFixed(2)+`M`:e>=1e3?(e/1e3).toFixed(1)+`K`:e.toString()}function G(e){return e>=1?`$`+e.toFixed(2):e>=.01?`$`+e.toFixed(3):e>0?`$`+e.toFixed(5):`$0.00`}function K(e){return e>=10?e.toFixed(1)+`%`:e>=1?e.toFixed(2)+`%`:e>0?e.toFixed(3)+`%`:`0%`}function we(){let[e,t]=(0,z.useState)(24),{data:r,isLoading:s}=x({queryKey:[`usage-stats`,e],queryFn:async()=>await j(`/api/usage-stats?hours=${e}`),refetchInterval:6e4});if(s&&!r)return(0,B.jsxs)(L,{className:`border-primary/10`,children:[(0,B.jsx)(F,{children:(0,B.jsxs)(P,{className:`flex items-center gap-2`,children:[(0,B.jsx)(R,{className:`h-5 w-5 text-primary`}),`Uso y Costos de API`]})}),(0,B.jsx)(I,{children:(0,B.jsx)(`div`,{className:`h-40 flex items-center justify-center text-muted-foreground animate-pulse`,children:`Cargando estadísticas de uso...`})})]});let u=r&&(r.totalTokens>0||r.totalCostUsd>0),f=r?Object.entries(r.byProvider).map(([e,t])=>({name:e.charAt(0).toUpperCase()+e.slice(1),value:t.tokens,cost:t.costUsd,color:U[e.toLowerCase()]||`#6b7280`})):[],p=r?Object.entries(r.byModel).slice(0,8).map(([e,t])=>({name:e.length>20?e.slice(0,18)+`...`:e,tokens:t.tokens,cost:t.costUsd,fullName:e})):[];return(0,B.jsxs)(L,{className:`border-primary/10`,children:[(0,B.jsx)(F,{className:`pb-2`,children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(P,{className:`text-base flex items-center gap-2`,children:[(0,B.jsx)(R,{className:`h-5 w-5 text-primary`}),`Uso y Costos de API`]}),(0,B.jsx)(he,{children:`Tokens consumidos y costos por provider/modelo`})]}),(0,B.jsx)(`div`,{className:`flex gap-1`,children:[6,24,168].map(n=>(0,B.jsx)(`button`,{onClick:()=>t(n),className:`px-2 py-1 text-xs rounded-md transition-colors ${e===n?`bg-primary text-primary-foreground`:`bg-muted hover:bg-muted/80`}`,children:n===6?`6h`:n===24?`24h`:`7d`},n))})]})}),(0,B.jsxs)(I,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`rounded-lg border p-3 ${r?.toonSavedTokens?`border-emerald-500/30 bg-emerald-500/5`:`bg-card/50`}`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,B.jsx)(E,{className:`h-3 w-3 ${r?.toonSavedTokens?`text-emerald-400`:``}`}),(0,B.jsx)(`span`,{className:`font-medium`,children:`TOON Optimización de Tokens`})]}),r?.toonSavingsPercent&&r.toonSavingsPercent>0?(0,B.jsxs)(`span`,{className:`text-xs font-bold text-emerald-400`,children:[K(r.toonSavingsPercent),` reducción`]}):null]}),(0,B.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 md:grid-cols-4 gap-3`,children:[(0,B.jsxs)(`div`,{className:`bg-emerald-500/5 rounded-md p-2`,children:[(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Tokens Ahorrados`}),(0,B.jsx)(`div`,{className:`text-lg font-bold ${r?.toonSavedTokens?`text-emerald-400`:`text-muted-foreground`}`,children:r?W(r.toonSavedTokens):`—`})]}),(0,B.jsxs)(`div`,{className:`bg-emerald-500/5 rounded-md p-2`,children:[(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Costo Ahorrado`}),(0,B.jsx)(`div`,{className:`text-lg font-bold text-emerald-400`,children:r?G(r.toonSavedCost):`—`})]}),(0,B.jsxs)(`div`,{className:`bg-emerald-500/5 rounded-md p-2`,children:[(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Bytes Ahorrados`}),(0,B.jsx)(`div`,{className:`text-lg font-bold text-emerald-400`,children:r&&r.toonSavedBytes>0?W(r.toonSavedBytes):`—`})]}),(0,B.jsxs)(`div`,{className:`bg-emerald-500/5 rounded-md p-2`,children:[(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Reducción Bytes`}),(0,B.jsx)(`div`,{className:`text-lg font-bold text-emerald-400`,children:r?.toonSavedBytesPercent&&r.toonSavedBytesPercent>0?K(r.toonSavedBytesPercent):`—`})]})]}),r&&(r.toonJsonTokens>0||r.toonToonTokens>0)&&(0,B.jsx)(`div`,{className:`mt-3 pt-3 border-t border-emerald-500/20`,children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsxs)(`span`,{className:`text-muted-foreground`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`JSON:`}),` `,(0,B.jsx)(`span`,{className:`font-medium`,children:r.toonJsonTokens>0?W(r.toonJsonTokens):`—`}),` `,(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`tokens`})]}),(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,B.jsxs)(`span`,{className:`text-muted-foreground`,children:[(0,B.jsx)(`span`,{className:`text-emerald-400`,children:`TOON:`}),` `,(0,B.jsx)(`span`,{className:`font-medium text-emerald-400`,children:r.toonToonTokens>0?W(r.toonToonTokens):`—`}),` `,(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`tokens`})]})]}),r?.toonSavingsPercent&&r.toonSavingsPercent>0?(0,B.jsxs)(`span`,{className:`text-xs font-bold text-emerald-400`,children:[K(r.toonSavingsPercent),` menos tokens`]}):null]})}),r&&!r.toonSavedTokens&&(0,B.jsx)(`div`,{className:`mt-2 text-xs text-muted-foreground italic`,children:`Sin optimizaciones TOON registradas aún`})]}),u?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,B.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,B.jsx)(R,{className:`h-3 w-3`}),`Costo Total`]}),(0,B.jsx)(`div`,{className:`text-2xl font-bold text-green-500`,children:G(r.totalCostUsd)})]}),(0,B.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,B.jsx)(ye,{className:`h-3 w-3`}),`Total Tokens`]}),(0,B.jsx)(`div`,{className:`text-2xl font-bold`,children:W(r.totalTokens)})]}),(0,B.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,B.jsx)(xe,{className:`h-3 w-3`}),`Input / Output`]}),(0,B.jsxs)(`div`,{className:`text-lg font-semibold`,children:[(0,B.jsx)(`span`,{className:`text-blue-500`,children:W(r.totalInputTokens)}),(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:` / `}),(0,B.jsx)(`span`,{className:`text-purple-500`,children:W(r.totalOutputTokens)})]})]}),(0,B.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,B.jsx)(k,{className:`h-3 w-3`}),`Providers`]}),(0,B.jsx)(`div`,{className:`text-2xl font-bold`,children:Object.keys(r.byProvider).length})]})]}),(0,B.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`h4`,{className:`text-sm font-medium mb-2 flex items-center gap-2`,children:[(0,B.jsx)(k,{className:`h-4 w-4 text-muted-foreground`}),`Por Provider`]}),(0,B.jsx)(`div`,{className:`h-[180px]`,children:(0,B.jsx)(a,{width:`100%`,height:`100%`,children:(0,B.jsxs)(o,{data:f,layout:`vertical`,children:[(0,B.jsx)(i,{type:`number`,hide:!0}),(0,B.jsx)(c,{type:`category`,dataKey:`name`,axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:11},width:70}),(0,B.jsx)(d,{contentStyle:{backgroundColor:`hsl(var(--card))`,border:`1px solid hsl(var(--border))`,borderRadius:`8px`},formatter:(e,t)=>[t===`cost`?G(e):W(e),t===`cost`?`Costo`:`Tokens`]}),(0,B.jsx)(l,{dataKey:`value`,radius:[0,4,4,0],barSize:16,children:f.map(e=>(0,B.jsx)(n,{fill:e.color},e.name))})]})})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`h4`,{className:`text-sm font-medium mb-2 flex items-center gap-2`,children:[(0,B.jsx)(A,{className:`h-4 w-4 text-muted-foreground`}),`Por Modelo (Top 8)`]}),(0,B.jsx)(`div`,{className:`h-[180px]`,children:(0,B.jsx)(a,{width:`100%`,height:`100%`,children:(0,B.jsxs)(o,{data:p,children:[(0,B.jsx)(i,{dataKey:`name`,axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:10},angle:-45,textAnchor:`end`,height:60}),(0,B.jsx)(c,{axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:10}}),(0,B.jsx)(d,{contentStyle:{backgroundColor:`hsl(var(--card))`,border:`1px solid hsl(var(--border))`,borderRadius:`8px`},formatter:e=>G(e),labelFormatter:e=>p.find(t=>t.name===e)?.fullName||e}),(0,B.jsx)(l,{dataKey:`cost`,radius:[4,4,0,0],children:p.map(e=>(0,B.jsx)(n,{fill:U[e.fullName.split(`-`)[0]?.toLowerCase()]||`#6b7280`},e.fullName))})]})})})]})]}),f.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h4`,{className:`text-sm font-medium mb-2`,children:`Detalle por Provider`}),(0,B.jsx)(`div`,{className:`rounded-lg border overflow-hidden`,children:(0,B.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,B.jsx)(`thead`,{className:`bg-muted/50`,children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{className:`text-left p-2 font-medium`,children:`Provider`}),(0,B.jsx)(`th`,{className:`text-right p-2 font-medium`,children:`Input`}),(0,B.jsx)(`th`,{className:`text-right p-2 font-medium`,children:`Output`}),(0,B.jsx)(`th`,{className:`text-right p-2 font-medium`,children:`Total`}),(0,B.jsx)(`th`,{className:`text-right p-2 font-medium`,children:`Costo`})]})}),(0,B.jsx)(`tbody`,{children:Object.entries(r.byProvider).map(([e,t])=>(0,B.jsxs)(`tr`,{className:`border-t`,children:[(0,B.jsx)(`td`,{className:`p-2 font-medium`,children:e}),(0,B.jsx)(`td`,{className:`p-2 text-right text-blue-500`,children:W(t.inputTokens)}),(0,B.jsx)(`td`,{className:`p-2 text-right text-purple-500`,children:W(t.outputTokens)}),(0,B.jsx)(`td`,{className:`p-2 text-right`,children:W(t.tokens)}),(0,B.jsx)(`td`,{className:`p-2 text-right font-medium text-green-500`,children:G(t.costUsd)})]},e))})]})})]})]}):(0,B.jsx)(`div`,{className:`h-32 flex items-center justify-center text-muted-foreground`,children:(0,B.jsxs)(`div`,{className:`text-center`,children:[(0,B.jsx)(S,{className:`h-8 w-8 mx-auto mb-2 opacity-50`}),(0,B.jsx)(`p`,{children:`No hay datos de uso aún`}),(0,B.jsx)(`p`,{className:`text-xs`,children:`Los tokens se registrarán automáticamente`})]})})]})]})}var Te=h,Ee=g,De=z.forwardRef(({className:e,...t},n)=>(0,B.jsx)(_,{className:D(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t,ref:n}));De.displayName=_.displayName;var q=z.forwardRef(({className:e,...t},n)=>(0,B.jsxs)(Ee,{children:[(0,B.jsx)(De,{}),(0,B.jsx)(m,{ref:n,className:D(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...t})]}));q.displayName=m.displayName;var J=({className:e,...t})=>(0,B.jsx)(`div`,{className:D(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});J.displayName=`AlertDialogHeader`;var Y=({className:e,...t})=>(0,B.jsx)(`div`,{className:D(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Y.displayName=`AlertDialogFooter`;var X=z.forwardRef(({className:e,...t},n)=>(0,B.jsx)(f,{ref:n,className:D(`text-lg font-semibold`,e),...t}));X.displayName=f.displayName;var Z=z.forwardRef(({className:e,...t},n)=>(0,B.jsx)(v,{ref:n,className:D(`text-sm text-muted-foreground`,e),...t}));Z.displayName=v.displayName;var Q=z.forwardRef(({className:e,...t},n)=>(0,B.jsx)(y,{ref:n,className:D(se(),e),...t}));Q.displayName=y.displayName;var $=z.forwardRef(({className:e,...t},n)=>(0,B.jsx)(p,{ref:n,className:D(se({variant:`outline`}),`mt-2 sm:mt-0`,e),...t}));$.displayName=p.displayName;function Oe(){let[e,t]=(0,z.useState)(!1),[n,r]=(0,z.useState)(0),[i,a]=(0,z.useState)([]),o=b(),{data:s,isLoading:c}=x({queryKey:[`version-check`],queryFn:()=>j(`/api/version`),refetchInterval:3e5,retry:2}),l=te({mutationFn:()=>j(`/api/update`,{method:`POST`,showLoader:`Actualizando Hive...`}),onSuccess:e=>{r(100),e.success?(a(e.instructions||[]),M.fire({title:`¡Actualización Completada!`,text:e.message||`Hive ha sido actualizado exitosamente.`,icon:`success`,confirmButtonText:`Continuar`})):(e.instructions&&a(e.instructions),M.fire({title:`Información de Actualización`,html:`
|
|
1
|
+
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{a as t,c as n,f as r,i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"./vendor-charts-K3xcRl0X.js";import{_ as f,d as p,f as m,g as h,h as g,m as _,p as v,u as y}from"./vendor-radix-D0s_k6Gp.js";import{i as b,n as x,o as ee,t as te}from"./vendor-query-Dj8xYhQD.js";import{t as S}from"./activity-DZKL7dg4.js";import{t as C}from"./arrow-up-right-CJBtXRrp.js";import{t as ne}from"./circle-check-CXC2AiMS.js";import{t as w}from"./download-aPuVaZik.js";import{t as re}from"./external-link-D_C_678M.js";import{t as ie}from"./gauge-DypSzSOE.js";import{t as ae}from"./info-Def2ZFeP.js";import{t as T}from"./loader-circle-wLVzSdML.js";import{t as oe}from"./triangle-alert-C3lWSnRr.js";import{t as E}from"./zap-B1azpiE7.js";import{t as D}from"./utils-Dyb7SC2_.js";import{A as se,B as ce,E as le,K as O,R as k,W as A,_ as ue,f as j,k as de,m as M,t as fe,z as pe}from"./index-D-9yCvjP.js";import{t as me}from"./useOfficeModel-Cy7cAyEn.js";import{t as N}from"./badge-DKGZbVZJ.js";import{a as P,i as F,n as I,r as he,t as L}from"./card-D3Nw3kh3.js";import{t as ge}from"./progress-DrI2UDu-.js";var _e=O(`CircleArrowUp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]]),R=O(`DollarSign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]),ve=O(`HardDrive`,[[`line`,{x1:`22`,x2:`2`,y1:`12`,y2:`12`,key:`1y58io`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}],[`line`,{x1:`6`,x2:`6.01`,y1:`16`,y2:`16`,key:`sgf278`}],[`line`,{x1:`10`,x2:`10.01`,y1:`16`,y2:`16`,key:`1l4acy`}]]),ye=O(`Hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),be=O(`MemoryStick`,[[`path`,{d:`M6 19v-3`,key:`1nvgqn`}],[`path`,{d:`M10 19v-3`,key:`iu8nkm`}],[`path`,{d:`M14 19v-3`,key:`kcehxu`}],[`path`,{d:`M18 19v-3`,key:`1vh91z`}],[`path`,{d:`M8 11V9`,key:`63erz4`}],[`path`,{d:`M16 11V9`,key:`fru6f3`}],[`path`,{d:`M12 11V9`,key:`ha00sb`}],[`path`,{d:`M2 15h20`,key:`16ne18`}],[`path`,{d:`M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z`,key:`lhddv3`}]]),xe=O(`TrendingUp`,[[`polyline`,{points:`22 7 13.5 15.5 8.5 10.5 2 17`,key:`126l90`}],[`polyline`,{points:`16 7 22 7 22 13`,key:`kwv8wd`}]]),z=e(r(),1);function Se(){let{agents:e,isLoading:t,error:n,fetchAgents:r,createAgent:i,updateAgent:a,deleteAgent:o}=fe(),[s,c]=(0,z.useState)(`all`);return(0,z.useEffect)(()=>{r()},[r]),{agents:(0,z.useMemo)(()=>Array.isArray(e)?s===`all`?e:e.filter(e=>e.status===s):[],[e,s]),allAgents:e||[],filter:s,setFilter:c,createAgent:i,updateAgent:a,deleteAgent:o,isLoading:t,error:n,refreshAgents:r}}var B=ee();function V(e){return e<50?`#22c55e`:e<80?`#eab308`:`#ef4444`}function Ce(){let[e,n]=(0,z.useState)(()=>{let e=new Date;return Array.from({length:12},(t,n)=>({time:new Date(e.getTime()-(11-n)*5e3).toLocaleTimeString(`es`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),msgs:0,rss:0}))}),[r,o]=(0,z.useState)([]),{data:s}=x({queryKey:[`system-stats`],queryFn:()=>j(`/api/system-stats`),refetchInterval:5e3}),l=(0,z.useRef)(s);(0,z.useEffect)(()=>{l.current=s},[s]),(0,z.useEffect)(()=>{let e=setInterval(()=>{let e=l.current;if(!e)return;let t=new Date().toLocaleTimeString(`es`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`});n(n=>[...n,{time:t,msgs:e.recentMessages,rss:e.memory.rss}].slice(-20))},5e3);return()=>clearInterval(e)},[]);let d=s?.memory.rss??0,f=s?.memory.heapUsed??0,p=s?.memory.external??0,m=s?.recentMessages??0;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4 mb-4`,children:[(0,B.jsxs)(L,{className:`overflow-hidden border-primary/10`,children:[(0,B.jsx)(F,{className:`pb-2 bg-gradient-to-r from-primary/5 to-transparent`,children:(0,B.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,B.jsxs)(P,{className:`text-base flex items-center gap-2`,children:[(0,B.jsx)(ie,{className:`h-4 w-4 text-primary`}),`Monitor del Proceso Hive`]})})}),(0,B.jsxs)(I,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-5 pt-4`,children:[(0,B.jsx)(H,{icon:E,label:`CPU del proceso`,value:`${s?.cpu??0}%`,subValue:`${s?.cores??1} núcleos disponibles`,color:V(s?.cpu??0),progress:Math.min(100,s?.cpu??0)}),(0,B.jsx)(H,{icon:pe,label:`Actividad reciente`,value:`${m}`,subValue:`mensajes últimos 5 min`,color:m>0?`#22c55e`:`hsl(var(--muted-foreground))`,progress:Math.min(100,m*10)}),(0,B.jsx)(H,{icon:ve,label:`Memoria Hive (RSS)`,value:`${d} MB`,subValue:`Heap JS: ${f} MB usados`,color:V(Math.min(100,Math.round(d/1024*100))),progress:Math.min(100,Math.round(d/1024*100))}),(0,B.jsx)(H,{icon:be,label:`Heap JS`,value:`${f} MB`,subValue:`External: ${p} MB`,color:`#3b82f6`,progress:Math.min(100,Math.round(f/512*100))}),(0,B.jsx)(H,{icon:k,label:`Sesiones WS activas`,value:`${s?.connections??0}`,subValue:`conexiones WebSocket`,color:`#a855f7`,progress:Math.min(100,(s?.connections??0)*10)})]})]}),(0,B.jsxs)(L,{className:`border-primary/10`,children:[(0,B.jsx)(F,{className:`pb-2`,children:(0,B.jsxs)(P,{className:`text-sm flex items-center gap-2`,children:[(0,B.jsx)(S,{className:`h-4 w-4 text-primary`}),`Historial — `,(0,B.jsx)(`span`,{className:`text-green-400`,children:`Mensajes`}),` · `,(0,B.jsx)(`span`,{className:`text-purple-400`,children:`RSS MB`})]})}),(0,B.jsx)(I,{className:`h-[160px]`,children:(0,B.jsx)(a,{width:`100%`,height:`100%`,children:(0,B.jsxs)(u,{data:e,children:[(0,B.jsxs)(`defs`,{children:[(0,B.jsxs)(`linearGradient`,{id:`gMsgs`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,B.jsx)(`stop`,{offset:`5%`,stopColor:`#22c55e`,stopOpacity:.3}),(0,B.jsx)(`stop`,{offset:`95%`,stopColor:`#22c55e`,stopOpacity:0})]}),(0,B.jsxs)(`linearGradient`,{id:`gHeap`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,B.jsx)(`stop`,{offset:`5%`,stopColor:`#8b5cf6`,stopOpacity:.3}),(0,B.jsx)(`stop`,{offset:`95%`,stopColor:`#8b5cf6`,stopOpacity:0})]})]}),(0,B.jsx)(i,{dataKey:`time`,axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:9},interval:`preserveStartEnd`}),(0,B.jsx)(c,{axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:9}}),(0,B.jsx)(t,{type:`monotone`,dataKey:`msgs`,stroke:`#22c55e`,strokeWidth:2,fillOpacity:1,fill:`url(#gMsgs)`,name:`Mensajes`}),(0,B.jsx)(t,{type:`monotone`,dataKey:`rss`,stroke:`#8b5cf6`,strokeWidth:2,fillOpacity:1,fill:`url(#gHeap)`,name:`RSS MB`})]})})})]})]})}function H({icon:e,label:t,value:n,subValue:r,color:i,progress:a}){return(0,B.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3 space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{style:{color:i},children:(0,B.jsx)(e,{className:`h-4 w-4`})}),(0,B.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:t})]}),(0,B.jsx)(`span`,{className:`text-lg font-bold font-mono`,style:{color:i},children:n})]}),(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsx)(`div`,{className:`h-1.5 w-full rounded-full bg-muted overflow-hidden`,children:(0,B.jsx)(`div`,{className:`h-full rounded-full transition-all duration-500`,style:{width:`${Math.min(a,100)}%`,backgroundColor:i}})}),(0,B.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r})]})]})}var U={anthropic:`#d97706`,openai:`#10b981`,google:`#3b82f6`,gemini:`#3b82f6`,deepseek:`#8b5cf6`,kimi:`#ec4899`,ollama:`#14b8a6`,openrouter:`#f59e0b`,mistral:`#6366f1`};function W(e){return e>=1e6?(e/1e6).toFixed(2)+`M`:e>=1e3?(e/1e3).toFixed(1)+`K`:e.toString()}function G(e){return e>=1?`$`+e.toFixed(2):e>=.01?`$`+e.toFixed(3):e>0?`$`+e.toFixed(5):`$0.00`}function K(e){return e>=10?e.toFixed(1)+`%`:e>=1?e.toFixed(2)+`%`:e>0?e.toFixed(3)+`%`:`0%`}function we(){let[e,t]=(0,z.useState)(24),{data:r,isLoading:s}=x({queryKey:[`usage-stats`,e],queryFn:async()=>await j(`/api/usage-stats?hours=${e}`),refetchInterval:6e4});if(s&&!r)return(0,B.jsxs)(L,{className:`border-primary/10`,children:[(0,B.jsx)(F,{children:(0,B.jsxs)(P,{className:`flex items-center gap-2`,children:[(0,B.jsx)(R,{className:`h-5 w-5 text-primary`}),`Uso y Costos de API`]})}),(0,B.jsx)(I,{children:(0,B.jsx)(`div`,{className:`h-40 flex items-center justify-center text-muted-foreground animate-pulse`,children:`Cargando estadísticas de uso...`})})]});let u=r&&(r.totalTokens>0||r.totalCostUsd>0),f=r?Object.entries(r.byProvider).map(([e,t])=>({name:e.charAt(0).toUpperCase()+e.slice(1),value:t.tokens,cost:t.costUsd,color:U[e.toLowerCase()]||`#6b7280`})):[],p=r?Object.entries(r.byModel).slice(0,8).map(([e,t])=>({name:e.length>20?e.slice(0,18)+`...`:e,tokens:t.tokens,cost:t.costUsd,fullName:e})):[];return(0,B.jsxs)(L,{className:`border-primary/10`,children:[(0,B.jsx)(F,{className:`pb-2`,children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(P,{className:`text-base flex items-center gap-2`,children:[(0,B.jsx)(R,{className:`h-5 w-5 text-primary`}),`Uso y Costos de API`]}),(0,B.jsx)(he,{children:`Tokens consumidos y costos por provider/modelo`})]}),(0,B.jsx)(`div`,{className:`flex gap-1`,children:[6,24,168].map(n=>(0,B.jsx)(`button`,{onClick:()=>t(n),className:`px-2 py-1 text-xs rounded-md transition-colors ${e===n?`bg-primary text-primary-foreground`:`bg-muted hover:bg-muted/80`}`,children:n===6?`6h`:n===24?`24h`:`7d`},n))})]})}),(0,B.jsxs)(I,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`rounded-lg border p-3 ${r?.toonSavedTokens?`border-emerald-500/30 bg-emerald-500/5`:`bg-card/50`}`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,B.jsx)(E,{className:`h-3 w-3 ${r?.toonSavedTokens?`text-emerald-400`:``}`}),(0,B.jsx)(`span`,{className:`font-medium`,children:`TOON Optimización de Tokens`})]}),r?.toonSavingsPercent&&r.toonSavingsPercent>0?(0,B.jsxs)(`span`,{className:`text-xs font-bold text-emerald-400`,children:[K(r.toonSavingsPercent),` reducción`]}):null]}),(0,B.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 md:grid-cols-4 gap-3`,children:[(0,B.jsxs)(`div`,{className:`bg-emerald-500/5 rounded-md p-2`,children:[(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Tokens Ahorrados`}),(0,B.jsx)(`div`,{className:`text-lg font-bold ${r?.toonSavedTokens?`text-emerald-400`:`text-muted-foreground`}`,children:r?W(r.toonSavedTokens):`—`})]}),(0,B.jsxs)(`div`,{className:`bg-emerald-500/5 rounded-md p-2`,children:[(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Costo Ahorrado`}),(0,B.jsx)(`div`,{className:`text-lg font-bold text-emerald-400`,children:r?G(r.toonSavedCost):`—`})]}),(0,B.jsxs)(`div`,{className:`bg-emerald-500/5 rounded-md p-2`,children:[(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Bytes Ahorrados`}),(0,B.jsx)(`div`,{className:`text-lg font-bold text-emerald-400`,children:r&&r.toonSavedBytes>0?W(r.toonSavedBytes):`—`})]}),(0,B.jsxs)(`div`,{className:`bg-emerald-500/5 rounded-md p-2`,children:[(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Reducción Bytes`}),(0,B.jsx)(`div`,{className:`text-lg font-bold text-emerald-400`,children:r?.toonSavedBytesPercent&&r.toonSavedBytesPercent>0?K(r.toonSavedBytesPercent):`—`})]})]}),r&&(r.toonJsonTokens>0||r.toonToonTokens>0)&&(0,B.jsx)(`div`,{className:`mt-3 pt-3 border-t border-emerald-500/20`,children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsxs)(`span`,{className:`text-muted-foreground`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`JSON:`}),` `,(0,B.jsx)(`span`,{className:`font-medium`,children:r.toonJsonTokens>0?W(r.toonJsonTokens):`—`}),` `,(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`tokens`})]}),(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,B.jsxs)(`span`,{className:`text-muted-foreground`,children:[(0,B.jsx)(`span`,{className:`text-emerald-400`,children:`TOON:`}),` `,(0,B.jsx)(`span`,{className:`font-medium text-emerald-400`,children:r.toonToonTokens>0?W(r.toonToonTokens):`—`}),` `,(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`tokens`})]})]}),r?.toonSavingsPercent&&r.toonSavingsPercent>0?(0,B.jsxs)(`span`,{className:`text-xs font-bold text-emerald-400`,children:[K(r.toonSavingsPercent),` menos tokens`]}):null]})}),r&&!r.toonSavedTokens&&(0,B.jsx)(`div`,{className:`mt-2 text-xs text-muted-foreground italic`,children:`Sin optimizaciones TOON registradas aún`})]}),u?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,B.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,B.jsx)(R,{className:`h-3 w-3`}),`Costo Total`]}),(0,B.jsx)(`div`,{className:`text-2xl font-bold text-green-500`,children:G(r.totalCostUsd)})]}),(0,B.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,B.jsx)(ye,{className:`h-3 w-3`}),`Total Tokens`]}),(0,B.jsx)(`div`,{className:`text-2xl font-bold`,children:W(r.totalTokens)})]}),(0,B.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,B.jsx)(xe,{className:`h-3 w-3`}),`Input / Output`]}),(0,B.jsxs)(`div`,{className:`text-lg font-semibold`,children:[(0,B.jsx)(`span`,{className:`text-blue-500`,children:W(r.totalInputTokens)}),(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:` / `}),(0,B.jsx)(`span`,{className:`text-purple-500`,children:W(r.totalOutputTokens)})]})]}),(0,B.jsxs)(`div`,{className:`rounded-lg border bg-card/50 p-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground mb-1`,children:[(0,B.jsx)(k,{className:`h-3 w-3`}),`Providers`]}),(0,B.jsx)(`div`,{className:`text-2xl font-bold`,children:Object.keys(r.byProvider).length})]})]}),(0,B.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`h4`,{className:`text-sm font-medium mb-2 flex items-center gap-2`,children:[(0,B.jsx)(k,{className:`h-4 w-4 text-muted-foreground`}),`Por Provider`]}),(0,B.jsx)(`div`,{className:`h-[180px]`,children:(0,B.jsx)(a,{width:`100%`,height:`100%`,children:(0,B.jsxs)(o,{data:f,layout:`vertical`,children:[(0,B.jsx)(i,{type:`number`,hide:!0}),(0,B.jsx)(c,{type:`category`,dataKey:`name`,axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:11},width:70}),(0,B.jsx)(d,{contentStyle:{backgroundColor:`hsl(var(--card))`,border:`1px solid hsl(var(--border))`,borderRadius:`8px`},formatter:(e,t)=>[t===`cost`?G(e):W(e),t===`cost`?`Costo`:`Tokens`]}),(0,B.jsx)(l,{dataKey:`value`,radius:[0,4,4,0],barSize:16,children:f.map(e=>(0,B.jsx)(n,{fill:e.color},e.name))})]})})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`h4`,{className:`text-sm font-medium mb-2 flex items-center gap-2`,children:[(0,B.jsx)(A,{className:`h-4 w-4 text-muted-foreground`}),`Por Modelo (Top 8)`]}),(0,B.jsx)(`div`,{className:`h-[180px]`,children:(0,B.jsx)(a,{width:`100%`,height:`100%`,children:(0,B.jsxs)(o,{data:p,children:[(0,B.jsx)(i,{dataKey:`name`,axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:10},angle:-45,textAnchor:`end`,height:60}),(0,B.jsx)(c,{axisLine:!1,tickLine:!1,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:10}}),(0,B.jsx)(d,{contentStyle:{backgroundColor:`hsl(var(--card))`,border:`1px solid hsl(var(--border))`,borderRadius:`8px`},formatter:e=>G(e),labelFormatter:e=>p.find(t=>t.name===e)?.fullName||e}),(0,B.jsx)(l,{dataKey:`cost`,radius:[4,4,0,0],children:p.map(e=>(0,B.jsx)(n,{fill:U[e.fullName.split(`-`)[0]?.toLowerCase()]||`#6b7280`},e.fullName))})]})})})]})]}),f.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h4`,{className:`text-sm font-medium mb-2`,children:`Detalle por Provider`}),(0,B.jsx)(`div`,{className:`rounded-lg border overflow-hidden`,children:(0,B.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,B.jsx)(`thead`,{className:`bg-muted/50`,children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{className:`text-left p-2 font-medium`,children:`Provider`}),(0,B.jsx)(`th`,{className:`text-right p-2 font-medium`,children:`Input`}),(0,B.jsx)(`th`,{className:`text-right p-2 font-medium`,children:`Output`}),(0,B.jsx)(`th`,{className:`text-right p-2 font-medium`,children:`Total`}),(0,B.jsx)(`th`,{className:`text-right p-2 font-medium`,children:`Costo`})]})}),(0,B.jsx)(`tbody`,{children:Object.entries(r.byProvider).map(([e,t])=>(0,B.jsxs)(`tr`,{className:`border-t`,children:[(0,B.jsx)(`td`,{className:`p-2 font-medium`,children:e}),(0,B.jsx)(`td`,{className:`p-2 text-right text-blue-500`,children:W(t.inputTokens)}),(0,B.jsx)(`td`,{className:`p-2 text-right text-purple-500`,children:W(t.outputTokens)}),(0,B.jsx)(`td`,{className:`p-2 text-right`,children:W(t.tokens)}),(0,B.jsx)(`td`,{className:`p-2 text-right font-medium text-green-500`,children:G(t.costUsd)})]},e))})]})})]})]}):(0,B.jsx)(`div`,{className:`h-32 flex items-center justify-center text-muted-foreground`,children:(0,B.jsxs)(`div`,{className:`text-center`,children:[(0,B.jsx)(S,{className:`h-8 w-8 mx-auto mb-2 opacity-50`}),(0,B.jsx)(`p`,{children:`No hay datos de uso aún`}),(0,B.jsx)(`p`,{className:`text-xs`,children:`Los tokens se registrarán automáticamente`})]})})]})]})}var Te=h,Ee=g,De=z.forwardRef(({className:e,...t},n)=>(0,B.jsx)(_,{className:D(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t,ref:n}));De.displayName=_.displayName;var q=z.forwardRef(({className:e,...t},n)=>(0,B.jsxs)(Ee,{children:[(0,B.jsx)(De,{}),(0,B.jsx)(m,{ref:n,className:D(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...t})]}));q.displayName=m.displayName;var J=({className:e,...t})=>(0,B.jsx)(`div`,{className:D(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});J.displayName=`AlertDialogHeader`;var Y=({className:e,...t})=>(0,B.jsx)(`div`,{className:D(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Y.displayName=`AlertDialogFooter`;var X=z.forwardRef(({className:e,...t},n)=>(0,B.jsx)(f,{ref:n,className:D(`text-lg font-semibold`,e),...t}));X.displayName=f.displayName;var Z=z.forwardRef(({className:e,...t},n)=>(0,B.jsx)(v,{ref:n,className:D(`text-sm text-muted-foreground`,e),...t}));Z.displayName=v.displayName;var Q=z.forwardRef(({className:e,...t},n)=>(0,B.jsx)(y,{ref:n,className:D(se(),e),...t}));Q.displayName=y.displayName;var $=z.forwardRef(({className:e,...t},n)=>(0,B.jsx)(p,{ref:n,className:D(se({variant:`outline`}),`mt-2 sm:mt-0`,e),...t}));$.displayName=p.displayName;function Oe(){let[e,t]=(0,z.useState)(!1),[n,r]=(0,z.useState)(0),[i,a]=(0,z.useState)([]),o=b(),{data:s,isLoading:c}=x({queryKey:[`version-check`],queryFn:()=>j(`/api/version`),refetchInterval:3e5,retry:2}),l=te({mutationFn:()=>j(`/api/update`,{method:`POST`,showLoader:`Actualizando Hive...`}),onSuccess:e=>{r(100),e.success?(a(e.instructions||[]),M.fire({title:`¡Actualización Completada!`,text:e.message||`Hive ha sido actualizado exitosamente.`,icon:`success`,confirmButtonText:`Continuar`})):(e.instructions&&a(e.instructions),M.fire({title:`Información de Actualización`,html:`
|
|
2
2
|
<div class="text-left space-y-2">
|
|
3
3
|
${e.error?`<p class="mb-2">${e.error}</p>`:``}
|
|
4
4
|
${e.output?`<pre class="bg-muted p-2 rounded text-xs overflow-auto max-h-40">${e.output}</pre>`:``}
|