@dmrlzz/davecode 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/{ChatApp-BO7QMBWD.js → ChatApp-CJBICQGA.js} +6 -6
  2. package/dist/{account-UGNLJPQ4.js → account-QWDPJWAA.js} +3 -3
  3. package/dist/{accounts-NM7IWP53.js → accounts-IQMR72FC.js} +5 -5
  4. package/dist/{budget-INAW6FXD.js → budget-XANOUVWO.js} +4 -4
  5. package/dist/{chat-U4QJQ7M6.js → chat-KDDRNC5V.js} +8 -8
  6. package/dist/{chunk-CWBVNS3L.js → chunk-44AFJL2X.js} +4 -4
  7. package/dist/{chunk-MOK5D3XJ.js → chunk-AZKACMME.js} +2 -2
  8. package/dist/{chunk-DZ2FDABF.js → chunk-FYPMA55O.js} +2 -2
  9. package/dist/{chunk-3Q2KCXLN.js → chunk-HSBJDV3O.js} +2 -2
  10. package/dist/{chunk-3Q2KCXLN.js.map → chunk-HSBJDV3O.js.map} +1 -1
  11. package/dist/{chunk-ROIUTNQV.js → chunk-JLATEHS7.js} +2 -2
  12. package/dist/{chunk-GZJ6JSO7.js → chunk-PGAJIGUF.js} +3 -3
  13. package/dist/{chunk-GHDOUII5.js → chunk-W7GPBEBZ.js} +2 -2
  14. package/dist/{chunk-Z6NQDJEN.js → chunk-WQ7MEWDF.js} +3 -3
  15. package/dist/{config-YEAPBMBX.js → config-YTUPIYZT.js} +3 -3
  16. package/dist/dashboard/assets/Accounts-cq8RLMoI.js +1 -0
  17. package/dist/dashboard/assets/{Badge-CGY6DgGx.js → Badge-Z4RBdO9j.js} +2 -2
  18. package/dist/dashboard/assets/Callout-w8BTYh4k.js +1 -0
  19. package/dist/dashboard/assets/Field-Cmpgg_1z.js +1 -0
  20. package/dist/dashboard/assets/Goals-Bw02to72.js +1 -0
  21. package/dist/dashboard/assets/Library-DK7mlpRb.js +1 -0
  22. package/dist/dashboard/assets/{Markdown-Xhao3sgL.js → Markdown-DCZ4Awcc.js} +2 -2
  23. package/dist/dashboard/assets/Panes-_KTf8pbZ.js +8 -0
  24. package/dist/dashboard/assets/Panes-kHJ-D0s7.css +1 -0
  25. package/dist/dashboard/assets/RoutesPage-QV0oPRW9.js +4 -0
  26. package/dist/dashboard/assets/Runner-CkHBLQl0.js +1 -0
  27. package/dist/dashboard/assets/Settings-BLz2gTBR.js +1 -0
  28. package/dist/dashboard/assets/Switch-DPYlLseH.js +1 -0
  29. package/dist/dashboard/assets/Tasks-BiUQSTpt.js +2 -0
  30. package/dist/dashboard/assets/Traffic-BVfBuC70.js +1 -0
  31. package/dist/dashboard/assets/Workspace-CJTgiiU5.js +1 -0
  32. package/dist/dashboard/assets/arrow-up-DjhzZprp.js +1 -0
  33. package/dist/dashboard/assets/cn-BwE4cei0.js +1 -0
  34. package/dist/dashboard/assets/forms-DVIUAxAc.js +1 -0
  35. package/dist/dashboard/assets/index-BDBa5cb0.js +104 -0
  36. package/dist/dashboard/assets/index-BEmBgsbP.css +2 -0
  37. package/dist/dashboard/assets/task-errors-Daqwi0ue.js +1 -0
  38. package/dist/dashboard/assets/trash-BTuDcSaQ.js +1 -0
  39. package/dist/dashboard/index.html +4 -4
  40. package/dist/{dist-RRQGUBL3.js → dist-37VQSHHA.js} +2 -2
  41. package/dist/{doctor-MQYK44S2.js → doctor-PYUQRRCB.js} +3 -3
  42. package/dist/{goal-6NUX4AIT.js → goal-SXZUDUCL.js} +3 -3
  43. package/dist/index.js +31 -31
  44. package/dist/{init-AXYIWAB3.js → init-Z2AFQEEP.js} +3 -3
  45. package/dist/{run-QRTLHFB3.js → run-AOS7L3RT.js} +3 -3
  46. package/dist/runtime.js +2 -2
  47. package/dist/{start-O5I5TSO2.js → start-CEPXKZUE.js} +3 -3
  48. package/dist/{status-LEA3RVUX.js → status-WNJ3GGKU.js} +4 -4
  49. package/dist/{tasks-XOTVICVZ.js → tasks-TFUTUMWB.js} +4 -4
  50. package/package.json +4 -4
  51. package/dist/dashboard/assets/Accounts-CeVyX4a3.js +0 -1
  52. package/dist/dashboard/assets/Callout-DauCk_cW.js +0 -1
  53. package/dist/dashboard/assets/Field-OXMnT9Tb.js +0 -1
  54. package/dist/dashboard/assets/Goals-DH-KDh8M.js +0 -1
  55. package/dist/dashboard/assets/Library-C15szLjZ.js +0 -1
  56. package/dist/dashboard/assets/Panel-Du40pM7n.js +0 -1
  57. package/dist/dashboard/assets/RoutesPage-Cj1OelGO.js +0 -4
  58. package/dist/dashboard/assets/Runner-BK1-ZF7h.js +0 -1
  59. package/dist/dashboard/assets/Settings-C1nzQQhe.js +0 -1
  60. package/dist/dashboard/assets/Switch-bwtIJ00H.js +0 -1
  61. package/dist/dashboard/assets/Tasks-x4s8IiPG.js +0 -2
  62. package/dist/dashboard/assets/Traffic-CV7TaTid.js +0 -1
  63. package/dist/dashboard/assets/Workspace-DAL-MBc0.js +0 -1
  64. package/dist/dashboard/assets/arrow-up-goM9r-I9.js +0 -1
  65. package/dist/dashboard/assets/forms-DtpfI65-.js +0 -1
  66. package/dist/dashboard/assets/index-BCi-Vuvh.js +0 -104
  67. package/dist/dashboard/assets/index-CcJFhc98.css +0 -2
  68. package/dist/dashboard/assets/task-errors-B2pgjUGN.js +0 -1
  69. package/dist/dashboard/assets/trash-BVojETtF.js +0 -1
  70. /package/dist/{ChatApp-BO7QMBWD.js.map → ChatApp-CJBICQGA.js.map} +0 -0
  71. /package/dist/{account-UGNLJPQ4.js.map → account-QWDPJWAA.js.map} +0 -0
  72. /package/dist/{accounts-NM7IWP53.js.map → accounts-IQMR72FC.js.map} +0 -0
  73. /package/dist/{budget-INAW6FXD.js.map → budget-XANOUVWO.js.map} +0 -0
  74. /package/dist/{chat-U4QJQ7M6.js.map → chat-KDDRNC5V.js.map} +0 -0
  75. /package/dist/{chunk-CWBVNS3L.js.map → chunk-44AFJL2X.js.map} +0 -0
  76. /package/dist/{chunk-MOK5D3XJ.js.map → chunk-AZKACMME.js.map} +0 -0
  77. /package/dist/{chunk-DZ2FDABF.js.map → chunk-FYPMA55O.js.map} +0 -0
  78. /package/dist/{chunk-ROIUTNQV.js.map → chunk-JLATEHS7.js.map} +0 -0
  79. /package/dist/{chunk-GZJ6JSO7.js.map → chunk-PGAJIGUF.js.map} +0 -0
  80. /package/dist/{chunk-GHDOUII5.js.map → chunk-W7GPBEBZ.js.map} +0 -0
  81. /package/dist/{chunk-Z6NQDJEN.js.map → chunk-WQ7MEWDF.js.map} +0 -0
  82. /package/dist/{config-YEAPBMBX.js.map → config-YTUPIYZT.js.map} +0 -0
  83. /package/dist/{dist-RRQGUBL3.js.map → dist-37VQSHHA.js.map} +0 -0
  84. /package/dist/{doctor-MQYK44S2.js.map → doctor-PYUQRRCB.js.map} +0 -0
  85. /package/dist/{goal-6NUX4AIT.js.map → goal-SXZUDUCL.js.map} +0 -0
  86. /package/dist/{init-AXYIWAB3.js.map → init-Z2AFQEEP.js.map} +0 -0
  87. /package/dist/{run-QRTLHFB3.js.map → run-AOS7L3RT.js.map} +0 -0
  88. /package/dist/{start-O5I5TSO2.js.map → start-CEPXKZUE.js.map} +0 -0
  89. /package/dist/{status-LEA3RVUX.js.map → status-WNJ3GGKU.js.map} +0 -0
  90. /package/dist/{tasks-XOTVICVZ.js.map → tasks-TFUTUMWB.js.map} +0 -0
@@ -1 +0,0 @@
1
- import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s,u as c}from"./Panel-Du40pM7n.js";import{E as l,F as u,R as d,_ as f,d as p,ft as m,h,ot as g,p as _,pt as v,st as y,t as b,u as x,v as S,x as C,y as w}from"./Badge-CGY6DgGx.js";import{n as T,t as E}from"./Switch-bwtIJ00H.js";import{a as D,c as O,i as k,l as ee,n as te,o as ne,r as A,s as re,t as ie}from"./forms-DtpfI65-.js";import{t as j}from"./Callout-DauCk_cW.js";import{t as M}from"./trash-BVojETtF.js";import{A as N,C as P,H as F,M as I,N as L,S as R,T as z,c as B,f as V,i as H,l as U,n as W,o as G,p as K,r as q,s as ae,t as J,u as oe,y as Y}from"./index-BCi-Vuvh.js";import{n as X,t as Z}from"./Field-OXMnT9Tb.js";var se={name:`log-in`,size:24,node:[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]};se.node;var ce=i(se),le={name:`shield-alert`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]};le.node;var ue=i(le),Q=c(t(),1),$=o(),de=3e5,fe={connected:{tone:`ok`,label:`Connected`},not_connected:{tone:`warn`,label:`Not connected`},unknown:{tone:`neutral`,label:`Unknown`}};function pe({status:e}){let{tone:t,label:n}=fe[e];return(0,$.jsx)(b,{tone:t,dot:!0,children:n})}function me({account:e}){let[t,r]=(0,Q.useState)(null),i=S(e.id,t!==null),a=f(),o=i.data,s=o?.status===`connected`;return(0,Q.useEffect)(()=>{if(!t)return;if(s){r(null),Y({tone:`ok`,title:`Subscription connected`,description:e.label});return}let n=window.setTimeout(()=>r(null),de);return()=>window.clearTimeout(n)},[t,s,e.label]),(0,$.jsxs)(`section`,{"aria-label":`Connection`,className:`flex flex-col gap-2.5 rounded-md border border-line bg-raised p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`text-[12px] font-medium text-fg-2`,children:`Connection`}),o?(0,$.jsx)(pe,{status:o.status}):i.isError?(0,$.jsx)(b,{tone:`err`,children:`Check failed`}):(0,$.jsx)(b,{children:`Checking…`}),(0,$.jsx)(n,{variant:`ghost`,size:`sm`,icon:I,iconOnly:!0,"aria-label":`Check again`,className:`ml-auto`,loading:i.isFetching&&!t,onClick:()=>i.refetch()})]}),o?.detail&&(0,$.jsx)(`p`,{className:`text-2xs leading-5 text-muted`,children:o.detail}),i.isError&&(0,$.jsx)(`p`,{className:`text-2xs leading-5 text-err`,children:m(i.error)}),o?.method===`cli-login`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(n,{variant:s?`secondary`:`primary`,size:`sm`,icon:ce,loading:a.isPending,onClick:async()=>{try{r(await a.mutateAsync(e.id))}catch(e){Y({tone:`err`,title:`Could not start the sign-in`,description:m(e)})}},children:s?`Sign in again`:`Connect subscription`}),(0,$.jsx)(`span`,{className:`text-2xs text-muted`,children:`Opens the vendor’s official sign-in. DaveCode never sees your password.`})]}),t&&(0,$.jsxs)(j,{tone:`info`,title:t.launched?`Waiting for the sign-in…`:`Run the sign-in on the gateway machine`,children:[(0,$.jsx)(`p`,{children:t.message}),!t.launched&&(0,$.jsx)(U,{command:t.command,className:`mt-2`})]}),!t&&!s&&o.loginCommand&&(0,$.jsx)(U,{command:o.loginCommand})]})]})}function he({account:e,usage:t,onClose:n}){return(0,$.jsx)(B,{open:!!e,onClose:n,title:e?.label??`Account`,description:e&&(0,$.jsx)(`span`,{className:`font-mono`,children:e.id}),width:`w-[min(560px,100vw)]`,children:e&&(0,$.jsx)(ge,{account:e,usage:t,onDone:n},e.id)})}function ge({account:e,usage:t,onDone:r}){let i=u(),a=C(),o=y(e.provider),s=Array.isArray(e.config.models)?e.config.models.join(`, `):``,[c,l]=(0,Q.useState)(e.label),[d,f]=(0,Q.useState)(String(e.priority)),[h,g]=(0,Q.useState)(String(e.weight)),[_,v]=(0,Q.useState)(D(e.limits)),[b,x]=(0,Q.useState)(ee(e.subscription)),[S,w]=(0,Q.useState)({}),[T,E]=(0,Q.useState)(typeof e.config.baseUrl==`string`?e.config.baseUrl:``),[N,P]=(0,Q.useState)(s),[F,I]=(0,Q.useState)(``),[L,R]=(0,Q.useState)({}),[z,B]=(0,Q.useState)({}),[H,U]=(0,Q.useState)(null),[G,J]=(0,Q.useState)(!1);return(0,$.jsxs)(`form`,{onSubmit:async t=>{t.preventDefault(),U(null);let n={};c.trim()||(n.label=`Label cannot be empty.`);let a=Number(d);(!Number.isInteger(a)||a<0)&&(n.priority=`Whole number, 0 or more.`);let o=Number(h);(!Number.isFinite(o)||o<=0)&&(n.weight=`Number above 0.`),e.provider===`openai-compatible`&&!k(T.trim())&&(n.baseUrl=`Enter an http(s) URL.`);let s=ne(_),l=O(b);if(R(n),B(s.errors),w(l.errors),Object.values(n).some(Boolean)||Object.keys(s.errors).length||Object.keys(l.errors).length)return;let u={};if(c.trim()!==e.label&&(u.label=c.trim()),a!==e.priority&&(u.priority=a),o!==e.weight&&(u.weight=o),JSON.stringify(s.limits)!==JSON.stringify(e.limits)&&(u.limits=s.limits),JSON.stringify(l.subscription??null)!==JSON.stringify(e.subscription??null)&&(u.subscription=l.subscription??null),e.provider===`openai-compatible`){let t=re(N),n={...e.config,baseUrl:T.trim(),models:t.length?t:void 0};JSON.stringify(n)!==JSON.stringify(e.config)&&(u.config=n)}if(F.trim()&&(u.secret=F.trim()),Object.keys(u).length===0)r();else try{await i.mutateAsync({id:e.id,patch:u}),I(``),Y({tone:`ok`,title:`Account updated`,description:e.label}),r()}catch(e){I(``),U(m(e))}},noValidate:!0,className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`section`,{"aria-label":`Summary`,className:`flex flex-col gap-3 rounded-md border border-line bg-raised p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(K,{provider:e.provider,size:`lg`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-[13px] font-medium text-fg`,children:o.label}),(0,$.jsxs)(`p`,{className:`font-mono text-2xs text-muted`,children:[e.provider,` · updated `,p(Date.parse(e.updatedAt))]})]}),(0,$.jsx)(V,{account:e})]}),e.lastError&&e.status!==`active`&&(0,$.jsx)(`p`,{className:`rounded border border-line bg-panel px-2 py-1.5 font-mono text-2xs text-fg-2`,children:e.lastError}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(q,{label:`1m`,usage:t?.windows[`1m`]}),(0,$.jsx)(q,{label:`5h`,usage:t?.windows[`5h`]}),(0,$.jsx)(q,{label:`24h`,usage:t?.windows[`24h`]}),(0,$.jsx)(W,{className:`pl-9`})]})]}),(0,$.jsx)(me,{account:e}),(0,$.jsx)(Z,{label:`Label`,required:!0,error:L.label,children:({id:e,describedBy:t,invalid:n})=>(0,$.jsx)(X,{id:e,value:c,onChange:e=>l(e.target.value),"aria-describedby":t,"aria-invalid":n||void 0})}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsx)(Z,{label:`Priority`,error:L.priority,hint:`Lower is tried first.`,children:({id:e,describedBy:t,invalid:n})=>(0,$.jsx)(X,{id:e,inputMode:`numeric`,value:d,onChange:e=>f(e.target.value),"aria-describedby":t,"aria-invalid":n||void 0,className:`tnum font-mono`})}),(0,$.jsx)(Z,{label:`Weight`,error:L.weight,hint:`Share among equal priorities.`,children:({id:e,describedBy:t,invalid:n})=>(0,$.jsx)(X,{id:e,inputMode:`decimal`,value:h,onChange:e=>g(e.target.value),"aria-describedby":t,"aria-invalid":n||void 0,className:`tnum font-mono`})})]}),e.provider===`openai-compatible`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{label:`Base URL`,required:!0,error:L.baseUrl,children:({id:e,describedBy:t,invalid:n})=>(0,$.jsx)(X,{id:e,type:`url`,value:T,onChange:e=>E(e.target.value),"aria-describedby":t,"aria-invalid":n||void 0,className:`font-mono`})}),(0,$.jsx)(Z,{label:`Models`,hint:`Comma-separated allow-list.`,children:({id:e,describedBy:t})=>(0,$.jsx)(X,{id:e,value:N,onChange:e=>P(e.target.value),"aria-describedby":t,className:`font-mono`})})]}),(o.auth===`api-key`||o.auth===`optional-key`)&&(0,$.jsx)(Z,{label:`Replace ${(o.secretLabel??`secret`).replace(` (optional)`,``)}`,hint:e.hasSecret===!1?`No secret stored yet. Write-only: it is encrypted at rest and never displayed.`:`A secret is stored. Write-only: leave empty to keep it; it is never displayed.`,children:({id:e,describedBy:t})=>(0,$.jsx)(te,{id:e,value:F,onChange:I,placeholder:`••••••••••••`,describedBy:t})}),(0,$.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`legend`,{className:`mb-2 text-[12px] font-medium text-fg-2`,children:`Quota limits`}),(0,$.jsx)(ie,{value:_,onChange:v,errors:z})]}),(0,$.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`legend`,{className:`mb-1 text-[12px] font-medium text-fg-2`,children:`Subscription`}),(0,$.jsx)(`p`,{className:`mb-1 text-2xs text-muted`,children:`What you pay for this account. Entered by hand; DaveCode never reads billing pages. Agents see the plan, renewal and remaining budget, never secrets.`}),(0,$.jsx)(A,{value:b,onChange:x,errors:S})]}),Object.keys(e.config).length>0&&e.provider!==`openai-compatible`&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`p`,{className:`text-[12px] font-medium text-fg-2`,children:`Provider config`}),(0,$.jsx)(`pre`,{className:`overflow-x-auto rounded-md border border-line bg-raised p-2.5 font-mono text-2xs leading-5 text-fg-2`,children:JSON.stringify(e.config,null,2)})]}),H&&(0,$.jsx)(j,{tone:`err`,title:`Request failed`,children:H}),(0,$.jsxs)(`div`,{className:`sticky -bottom-4 -mx-5 -mb-4 flex items-center gap-2 border-t border-line bg-panel px-5 py-3`,children:[(0,$.jsx)(n,{variant:`danger`,icon:M,onClick:()=>J(!0),children:`Delete`}),(0,$.jsxs)(`div`,{className:`ml-auto flex gap-2`,children:[(0,$.jsx)(n,{variant:`ghost`,onClick:r,children:`Cancel`}),(0,$.jsx)(n,{type:`submit`,variant:`primary`,loading:i.isPending,children:`Save changes`})]})]}),(0,$.jsx)(ae,{open:G,onClose:()=>J(!1),title:`Delete ${e.label}?`,description:`The account and its encrypted secret are removed from the gateway. Requests already served stay in the usage history.`,footer:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(n,{variant:`ghost`,onClick:()=>J(!1),children:`Keep account`}),(0,$.jsx)(n,{variant:`danger`,icon:M,loading:a.isPending,onClick:async()=>{try{await a.mutateAsync(e.id),Y({tone:`ok`,title:`Account removed`,description:e.label}),J(!1),r()}catch(e){J(!1),U(m(e))}},children:`Delete account`})]}),children:(0,$.jsx)(`p`,{className:`font-mono text-[12px] text-muted`,children:e.id})})]})}var _e={"claude-cli":{binary:`claude`,env:`CLAUDE_CONFIG_DIR`},"codex-cli":{binary:`codex`,env:`CODEX_HOME`},"gemini-cli":{binary:`gemini`,env:`GEMINI_CLI_HOME`}};function ve({open:e,onClose:t}){return(0,$.jsx)(B,{open:e,onClose:t,title:`Add account`,description:`Secrets are encrypted at rest with AES-256-GCM and are never shown again after saving.`,width:`w-[min(560px,100vw)]`,children:e&&(0,$.jsx)(ye,{onDone:t})})}function ye({onDone:t}){let r=l(),i=_(),a=w(),o=r.data?.experimental.geminiWeb??!1,s=r.data?.experimental.multiAccountRotation??!1,[c,u]=(0,Q.useState)(`anthropic`),[d,f]=(0,Q.useState)(``),[p,h]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(``),[S,C]=(0,Q.useState)(``),[T,E]=(0,Q.useState)(``),[O,ee]=(0,Q.useState)(`100`),[A,M]=(0,Q.useState)(`1`),[N,P]=(0,Q.useState)(D()),[F,I]=(0,Q.useState)(!1),[L,R]=(0,Q.useState)({}),[z,B]=(0,Q.useState)(null),V=y(c),H=(i.data??[]).filter(e=>e.provider===c),W=V.subscription&&H.length>0&&!s,G=c===`gemini-web`&&!o;return(0,$.jsxs)(`form`,{onSubmit:async e=>{e.preventDefault(),B(null);let n={};d.trim()||(n.label=`Give the account a name you will recognise in logs.`),V.auth===`api-key`&&!p.trim()&&(n.secret=`${V.secretLabel??`Secret`} is required.`),c===`openai-compatible`&&!k(b.trim())&&(n.baseUrl=`Enter an http(s) URL ending in the /v1 base, e.g. http://127.0.0.1:11434/v1`);let r=Number(O);(!Number.isInteger(r)||r<0)&&(n.priority=`Whole number, 0 or more.`);let i=Number(A);(!Number.isFinite(i)||i<=0)&&(n.weight=`Number above 0.`),c===`gemini-web`&&!F&&(n.ack=`Confirm that you accept the risk.`);let o=ne(N);if(Object.keys(o.errors).length&&(n.limits=o.errors),R(n),Object.keys(n).length||G)return;let s={};if(c===`openai-compatible`){s.baseUrl=b.trim();let e=re(S);e.length&&(s.models=e)}V.auth===`cli`&&T.trim()&&(s.binaryPath=T.trim());let l={provider:c,label:d.trim(),priority:r,weight:i,...Object.keys(o.limits).length&&{limits:o.limits},...Object.keys(s).length&&{config:s},...p.trim()&&{secret:p.trim()}};try{let e=await a.mutateAsync(l);h(``),Y({tone:`ok`,title:`Account added`,description:`${e.label} (${e.id})`}),t()}catch(e){h(``),B(v(e)&&e.code===`experimental_disabled`?`The gateway refused this provider: experimental.geminiWeb is off in config.json.`:m(e))}},noValidate:!0,className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`fieldset`,{children:[(0,$.jsx)(`legend`,{className:`mb-2 text-[12px] font-medium text-fg-2`,children:`Provider`}),(0,$.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:g.map(t=>{let n=y(t),r=t===`gemini-web`&&!o,i=c===t;return(0,$.jsxs)(`label`,{className:e(`relative flex cursor-pointer items-start gap-2.5 rounded-md border p-2.5 transition-colors duration-150`,`has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-accent`,i?`border-accent/60 bg-accent-soft`:`border-line hover:border-line-strong hover:bg-hover`,r&&!i&&`opacity-60`),children:[(0,$.jsx)(`input`,{type:`radio`,name:`provider`,value:t,checked:i,onChange:()=>{u(t),R({}),B(null)},className:`sr-only`}),(0,$.jsx)(K,{provider:t}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[13px] font-medium text-fg`,children:[n.label,n.experimental&&(0,$.jsx)(`span`,{className:`rounded border border-warn/30 px-1 text-2xs font-medium text-warn`,children:r?`off`:`experimental`})]}),(0,$.jsx)(`span`,{className:`block font-mono text-2xs text-muted`,children:t})]})]},t)})}),(0,$.jsx)(`p`,{className:`mt-2 text-[12px] text-muted`,children:V.blurb})]}),c===`gemini-web`&&(0,$.jsxs)(j,{tone:`warn`,title:`Terms of Service risk`,children:[(0,$.jsx)(`p`,{children:`This provider automates a consumer Gemini web session through Chromium. That likely violates Google's Terms of Service and the account can be rate-limited or suspended.`}),o?(0,$.jsxs)(`label`,{className:`mt-2 flex items-start gap-2 text-fg`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:F,onChange:e=>I(e.target.checked),className:`mt-0.5 accent-accent`,"aria-describedby":L.ack?`ack-error`:void 0}),`I understand the risk and want to add this account anyway.`]}):(0,$.jsxs)(`p`,{className:`mt-1.5`,children:[`It is disabled on this gateway. To opt in, set`,` `,(0,$.jsxs)(`code`,{className:`font-mono text-fg`,children:[`"experimental": `,`{ "geminiWeb": true }`]}),` `,`in `,(0,$.jsx)(`code`,{className:`font-mono text-fg`,children:`~/.davecode/config.json`}),` and restart.`]}),L.ack&&(0,$.jsx)(`p`,{id:`ack-error`,role:`alert`,className:`mt-1 text-err`,children:L.ack})]}),W&&(0,$.jsxs)(j,{tone:`info`,title:`Multi-account rotation is off`,children:[`You already have a `,V.label,` account. Without`,` `,(0,$.jsx)(`code`,{className:`font-mono text-fg`,children:`experimental.multiAccountRotation`}),` the router uses only one subscription login per provider; the others act as manual fallbacks.`]}),!G&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{label:`Label`,required:!0,error:L.label,hint:`Shown in the dashboard, logs and events.`,children:({id:e,describedBy:t,invalid:n})=>(0,$.jsx)(X,{id:e,value:d,placeholder:c===`openai-compatible`?`OpenRouter`:`${V.label} — work`,onChange:e=>f(e.target.value),"aria-describedby":t,"aria-invalid":n||void 0,"aria-required":!0})}),c===`openai-compatible`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{label:`Base URL`,required:!0,error:L.baseUrl,hint:`The OpenAI-compatible root, including /v1.`,children:({id:e,describedBy:t,invalid:n})=>(0,$.jsx)(X,{id:e,type:`url`,value:b,placeholder:`http://127.0.0.1:11434/v1`,onChange:e=>x(e.target.value),"aria-describedby":t,"aria-invalid":n||void 0,className:`font-mono`})}),(0,$.jsx)(Z,{label:`Models`,hint:`Comma-separated allow-list. Leave empty to discover via /v1/models.`,children:({id:e,describedBy:t})=>(0,$.jsx)(X,{id:e,value:S,placeholder:`Provider model IDs`,onChange:e=>C(e.target.value),"aria-describedby":t,className:`font-mono`})})]}),V.auth===`cli`?(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(Z,{label:`CLI binary`,hint:`Optional path; defaults to the binary on your PATH.`,children:({id:e,describedBy:t})=>(0,$.jsx)(X,{id:e,value:T,placeholder:_e[c]?.binary??`claude`,onChange:e=>E(e.target.value),"aria-describedby":t,className:`font-mono`})}),(0,$.jsxs)(`p`,{className:`text-[12px] text-muted`,children:[`No secret is needed here. After adding, open the account and press`,` `,(0,$.jsx)(`span`,{className:`text-fg-2`,children:`Connect subscription`}),`: it runs the vendor’s official sign-in inside the account’s own sandbox (`,_e[c]?.env,`). DaveCode never sees your password. From a terminal:`]}),(0,$.jsx)(U,{command:`davecode add-account --provider ${c}`})]}):V.auth===`browser`?null:(0,$.jsx)(Z,{label:V.secretLabel??`Secret`,required:V.auth===`api-key`,error:L.secret,hint:`Write-only. Encrypted at rest; no endpoint ever returns it.`,children:({id:e,describedBy:t,invalid:n})=>(0,$.jsx)(te,{id:e,value:p,onChange:h,placeholder:V.secretPlaceholder,describedBy:t,invalid:n})}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsx)(Z,{label:`Priority`,error:L.priority,hint:`Lower is tried first.`,children:({id:e,describedBy:t,invalid:n})=>(0,$.jsx)(X,{id:e,inputMode:`numeric`,value:O,onChange:e=>ee(e.target.value),"aria-describedby":t,"aria-invalid":n||void 0,className:`tnum font-mono`})}),(0,$.jsx)(Z,{label:`Weight`,error:L.weight,hint:`Share among equal priorities.`,children:({id:e,describedBy:t,invalid:n})=>(0,$.jsx)(X,{id:e,inputMode:`decimal`,value:A,onChange:e=>M(e.target.value),"aria-describedby":t,"aria-invalid":n||void 0,className:`tnum font-mono`})})]}),(0,$.jsxs)(`details`,{className:`group rounded-md border border-line`,children:[(0,$.jsxs)(`summary`,{className:`flex items-center justify-between px-3 py-2 text-[12px] font-medium text-fg-2 select-none hover:text-fg`,children:[`Quota limits`,(0,$.jsx)(`span`,{className:`text-2xs font-normal text-muted group-open:hidden`,children:`optional · unlimited by default`})]}),(0,$.jsx)(`div`,{className:`border-t border-line p-3`,children:(0,$.jsx)(ie,{value:N,onChange:P,errors:L.limits??{}})})]})]}),z&&(0,$.jsx)(j,{tone:`err`,title:`Could not add the account`,children:z}),(0,$.jsxs)(`div`,{className:`sticky -bottom-4 -mx-5 -mb-4 flex items-center justify-end gap-2 border-t border-line bg-panel px-5 py-3`,children:[(0,$.jsx)(n,{variant:`ghost`,onClick:t,children:`Cancel`}),(0,$.jsx)(n,{type:`submit`,variant:`primary`,loading:a.isPending,disabled:G,icon:G?ue:void 0,children:G?`Disabled by config`:`Add account`})]})]})}function be(e){if(!e)return;let t=e.price?`${e.price.amount} ${e.price.currency}/${e.price.period===`month`?`mo`:`yr`}`:void 0;return[e.plan,t].filter(Boolean).join(` · `)||void 0}function xe({days:e}){return e===void 0?(0,$.jsx)(`span`,{className:`text-faint`,children:`—`}):e<0?(0,$.jsxs)(b,{tone:`err`,children:[`overdue `,-e,`d`]}):(0,$.jsx)(b,{tone:e<=3?`warn`:`neutral`,mono:!0,children:e===0?`today`:`in ${e}d`})}function Se({budget:t}){if(t.remaining===null)return(0,$.jsx)(`span`,{className:`text-2xs text-faint`,children:`no limit known`});let n=t.remaining,r=n<=.1?`bg-err`:n<=.15?`bg-warn`:`bg-meter`;return(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`div`,{role:`meter`,"aria-label":`${t.label} remaining budget`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(n*100),className:`relative h-1.5 min-w-16 flex-1 rounded-full bg-track`,children:(0,$.jsx)(`div`,{className:e(`absolute inset-y-0 left-0 rounded-full transition-[width] duration-500 ease-snappy`,r),style:{width:`${Math.min(100,n*100)}%`}})}),(0,$.jsx)(`span`,{className:`tnum w-9 shrink-0 text-right font-mono text-2xs text-fg-2`,children:x(n)}),(0,$.jsx)(`span`,{className:`w-14 shrink-0 font-mono text-2xs text-muted`,children:t.tightestWindow??`provider`})]})}function Ce(){let t=h(),[i,o]=(0,Q.useState)(!1),s=t.data?.accounts??[],c=s.filter(e=>e.enabled),l=c.filter(e=>e.available).length;return(0,$.jsxs)(r,{"aria-labelledby":`budget-title`,children:[(0,$.jsx)(a,{id:`budget-title`,title:`Budget`,meta:t.data?`${l} of ${c.length} enabled accounts available · plans are entered by hand`:void 0,actions:(0,$.jsx)(n,{size:`sm`,variant:`ghost`,icon:F,"aria-expanded":i,onClick:()=>o(e=>!e),children:`What agents see`})}),t.isPending?(0,$.jsx)(G,{rows:3}):t.isError?(0,$.jsx)(`p`,{className:`px-3.5 py-3 text-[12px] text-err`,children:m(t.error)}):(0,$.jsxs)($.Fragment,{children:[i&&(0,$.jsxs)(`div`,{className:`relative border-b border-line bg-raised px-3.5 py-3`,children:[(0,$.jsx)(oe,{value:t.data.context,label:`Copy agent budget context`,className:`absolute top-2 right-2`}),(0,$.jsx)(`pre`,{className:`overflow-x-auto pr-8 font-mono text-2xs leading-5 whitespace-pre-wrap text-fg-2`,children:t.data.context||`No enabled accounts: agents get no budget context.`})]}),(0,$.jsx)(`ul`,{className:`divide-y divide-line`,children:s.map(t=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>R(`account`,t.accountId),className:e(`grid w-full grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)_auto] items-center gap-x-4 gap-y-1.5 px-3.5 py-2.5 text-left transition-colors duration-150 hover:bg-hover/60 md:grid-cols-[minmax(0,1.3fr)_minmax(0,1fr)_5.5rem_minmax(0,1.2fr)_minmax(0,1fr)]`,!t.enabled&&`text-muted`),children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(K,{provider:t.provider}),(0,$.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:t.label})]}),(0,$.jsx)(`span`,{className:`truncate text-[12px] text-fg-2`,children:be(t.subscription)??(0,$.jsx)(`span`,{className:`text-faint`,children:`no plan`})}),(0,$.jsx)(`span`,{className:`justify-self-end md:justify-self-start`,children:(0,$.jsx)(xe,{days:t.renewsInDays})}),(0,$.jsx)(`span`,{className:`col-span-2 md:col-span-1`,children:(0,$.jsx)(Se,{budget:t})}),(0,$.jsx)(`span`,{className:`truncate text-[12px] md:text-right`,children:t.available?(0,$.jsx)(b,{tone:`ok`,dot:!0,children:`available`}):(0,$.jsx)(`span`,{className:`text-warn`,title:t.unavailableReason,children:t.unavailableReason??`unavailable`})})]})},t.accountId))})]})]})}function we(){let t=_(),i=d(),a=u(),{params:o}=P(),[c,l]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(`all`),h=o.get(`account`),g=o.get(`new`)===`1`,v=(0,Q.useMemo)(()=>new Map((i.data??[]).map(e=>[e.accountId,e])),[i.data]),b=(0,Q.useMemo)(()=>[...t.data??[]].sort((e,t)=>e.priority-t.priority||e.label.localeCompare(t.label)),[t.data]),x=(0,Q.useMemo)(()=>{let e={all:b.length,active:0,cooldown:0,disabled:0,error:0};for(let t of b)e[t.status]+=1;return e},[b]),S=c.trim().toLowerCase(),C=b.filter(e=>(f===`all`||e.status===f)&&(!S||e.label.toLowerCase().includes(S)||e.id.toLowerCase().includes(S)||e.provider.includes(S))),w=b.find(e=>e.id===h),D=(e,t)=>{a.mutate({id:e.id,patch:{enabled:t}},{onError:n=>Y({tone:`err`,title:`Could not ${t?`enable`:`disable`} ${e.label}`,description:m(n)})})};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsx)(s,{title:`Accounts`,description:`Provider accounts the router balances across. Lower priority numbers are tried first.`,actions:(0,$.jsx)(n,{variant:`primary`,icon:L,onClick:()=>R(`new`,`1`),children:`Add account`})}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`relative w-full sm:w-64`,children:[(0,$.jsx)(N,{"aria-hidden":!0,className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted`,strokeWidth:1.75}),(0,$.jsx)(X,{type:`search`,"aria-label":`Filter accounts`,placeholder:`Filter by label, id or provider`,value:c,onChange:e=>l(e.target.value),className:`pl-8`,"data-filter-input":!0})]}),(0,$.jsx)(J,{label:`Status`,value:f,onChange:p,options:[{value:`all`,label:`All`,count:x.all},{value:`active`,label:`Active`,count:x.active},{value:`cooldown`,label:`Cooldown`,count:x.cooldown},{value:`disabled`,label:`Disabled`,count:x.disabled},{value:`error`,label:`Error`,count:x.error}]}),(0,$.jsx)(W,{className:`ml-auto hidden lg:flex`})]}),t.isError&&(0,$.jsx)(j,{tone:`err`,title:`Could not load accounts`,children:m(t.error)}),(0,$.jsx)(r,{children:t.isPending?(0,$.jsx)(G,{rows:5}):b.length===0?(0,$.jsx)(H,{icon:z,title:`No accounts yet`,description:`Add an API key, a local OpenAI-compatible server or a CLI login. The router starts using it immediately.`,command:`davecode add-account`,action:(0,$.jsx)(n,{variant:`primary`,icon:L,onClick:()=>R(`new`,`1`),children:`Add account`})}):C.length===0?(0,$.jsx)(H,{icon:N,title:`No matching accounts`,description:`Try a different filter.`}):(0,$.jsx)(`div`,{className:`overflow-x-auto`,children:(0,$.jsxs)(`table`,{className:`w-full min-w-[880px] text-[13px]`,children:[(0,$.jsx)(`caption`,{className:`sr-only`,children:`Accounts`}),(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{className:`border-b border-line text-left text-[12px] text-muted`,children:[(0,$.jsx)(`th`,{scope:`col`,className:`w-[32%] px-3.5 py-2 font-medium`,children:`Account`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,$.jsx)(`th`,{scope:`col`,className:`w-20 px-3 py-2 text-right font-medium`,children:`Priority`}),(0,$.jsx)(`th`,{scope:`col`,className:`w-20 px-3 py-2 text-right font-medium`,children:`Weight`}),(0,$.jsx)(`th`,{scope:`col`,className:`w-[30%] px-3 py-2 font-medium`,children:`Quota`}),(0,$.jsx)(`th`,{scope:`col`,className:`w-20 px-3 py-2 font-medium`,children:`Enabled`}),(0,$.jsx)(`th`,{scope:`col`,className:`w-10 px-2 py-2`,children:(0,$.jsx)(`span`,{className:`sr-only`,children:`Details`})})]})}),(0,$.jsx)(`tbody`,{children:C.map(t=>{let n=v.get(t.id),r=y(t.provider);return(0,$.jsxs)(`tr`,{onClick:()=>R(`account`,t.id),className:e(`group cursor-pointer border-b border-line transition-colors duration-150 last:border-b-0 hover:bg-hover/60`,h===t.id&&`bg-hover/60`,!t.enabled&&`text-muted`),children:[(0,$.jsx)(`td`,{className:`max-w-0 px-3.5 py-2.5`,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,$.jsx)(K,{provider:t.provider}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),R(`account`,t.id)},className:`block max-w-full truncate text-left font-medium text-fg hover:underline focus-visible:underline`,children:t.label}),(0,$.jsxs)(`p`,{className:`truncate font-mono text-2xs text-muted`,children:[t.id,` · `,r.label,r.experimental&&(0,$.jsx)(`span`,{className:`text-warn`,children:` · experimental`})]})]})]})}),(0,$.jsx)(`td`,{className:`px-3 py-2.5`,children:(0,$.jsx)(V,{account:t})}),(0,$.jsx)(`td`,{className:`tnum px-3 py-2.5 text-right font-mono`,children:t.priority}),(0,$.jsx)(`td`,{className:`tnum px-3 py-2.5 text-right font-mono`,children:t.weight}),(0,$.jsx)(`td`,{className:`px-3 py-2`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(q,{label:`1m`,usage:n?.windows[`1m`]}),(0,$.jsx)(q,{label:`5h`,usage:n?.windows[`5h`]}),(0,$.jsx)(q,{label:`24h`,usage:n?.windows[`24h`]})]})}),(0,$.jsx)(`td`,{className:`px-3 py-2.5`,children:(0,$.jsx)(E,{checked:t.enabled,onChange:e=>D(t,e),label:`${t.enabled?`Disable`:`Enable`} ${t.label}`})}),(0,$.jsx)(`td`,{className:`px-2 py-2.5 text-muted`,children:(0,$.jsx)(T,{"aria-hidden":!0,className:`size-4 transition-transform duration-150 group-hover:translate-x-0.5`,strokeWidth:1.75})})]},t.id)})})]})})}),b.length>0&&(0,$.jsx)(Ce,{}),(0,$.jsx)(ve,{open:g,onClose:()=>R(`new`,null)}),(0,$.jsx)(he,{account:w,usage:w?v.get(w.id):void 0,onClose:()=>R(`account`,null)})]})}export{we as Accounts};
@@ -1 +0,0 @@
1
- import{a as e,o as t,s as n}from"./Panel-Du40pM7n.js";import{E as r,R as i}from"./index-BCi-Vuvh.js";var a={name:`octagon-alert`,size:24,node:[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]],aliases:[`alert-octagon`]};a.node;var o=t(a),s=n(),c={info:{box:`border-info/25 bg-info-soft [&_svg]:text-info`,icon:i},warn:{box:`border-warn/30 bg-warn-soft [&_svg]:text-warn`,icon:r},err:{box:`border-err/30 bg-err-soft [&_svg]:text-err`,icon:o}};function l({tone:t=`info`,title:n,children:r,action:i,className:a}){let{box:o,icon:l}=c[t];return(0,s.jsxs)(`div`,{role:t===`info`?`note`:`alert`,className:e(`flex gap-2.5 rounded-md border px-3 py-2.5 text-[12px] leading-5`,o,a),children:[(0,s.jsx)(l,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0`,strokeWidth:1.75}),(0,s.jsxs)(`div`,{className:`min-w-0 flex-1 text-fg-2`,children:[n&&(0,s.jsx)(`p`,{className:`font-medium text-fg`,children:n}),r]}),i&&(0,s.jsx)(`div`,{className:`shrink-0 self-center`,children:i})]})}export{l as t};
@@ -1 +0,0 @@
1
- import{a as e,c as t,s as n,u as r}from"./Panel-Du40pM7n.js";var i=r(t(),1),a=n(),o=`h-8 w-full min-w-0 rounded-md border border-line-strong bg-bg px-2.5 text-[13px] text-fg placeholder:text-faint transition-[border-color,box-shadow] duration-150 ease-snappy hover:border-faint/70 focus-visible:border-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/25 disabled:opacity-50 aria-invalid:border-err`,s=(0,i.forwardRef)(function({className:t,...n},r){return(0,a.jsx)(`input`,{ref:r,className:e(o,t),...n})}),c=(0,i.forwardRef)(function({className:t,rows:n=3,...r},i){return(0,a.jsx)(`textarea`,{ref:i,rows:n,className:e(o,`h-auto min-h-16 resize-y py-1.5 leading-5`,t),...r})}),l=(0,i.forwardRef)(function({className:t,children:n,...r},i){return(0,a.jsx)(`select`,{ref:i,className:e(o,`cursor-pointer pr-7`,t),...r,children:n})});function u({label:t,hint:n,error:r,required:o,className:s,children:c}){let l=(0,i.useId)(),u=`${l}-hint`,d=`${l}-error`,f=[n?u:null,r?d:null].filter(Boolean).join(` `);return(0,a.jsxs)(`div`,{className:e(`flex flex-col gap-1.5`,s),children:[(0,a.jsxs)(`label`,{htmlFor:l,className:`text-[12px] font-medium text-fg-2`,children:[t,o&&(0,a.jsx)(`span`,{"aria-hidden":!0,className:`ml-0.5 text-accent-text`,children:`*`})]}),c({id:l,describedBy:f||void 0,invalid:!!r}),n&&!r&&(0,a.jsx)(`p`,{id:u,className:`text-[12px] leading-4 text-muted`,children:n}),r&&(0,a.jsx)(`p`,{id:d,role:`alert`,className:`text-[12px] leading-4 text-err`,children:r})]})}export{c as i,s as n,l as r,u as t};
@@ -1 +0,0 @@
1
- import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s,u as c}from"./Panel-Du40pM7n.js";import{C as l,M as u,T as d,V as f,d as p,ft as m,g as h,i as g,pt as _,r as v,t as y,w as b}from"./Badge-CGY6DgGx.js";import{n as x,t as S}from"./Switch-bwtIJ00H.js";import{n as C,t as w}from"./Markdown-Xhao3sgL.js";import{t as T}from"./Callout-DauCk_cW.js";import{D as E,P as D,h as O,i as k,k as A,l as j,o as M,s as N,u as P,y as F}from"./index-BCi-Vuvh.js";import{i as I,n as L,t as R}from"./Field-OXMnT9Tb.js";var z={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};z.node;var B=i(z),V={name:`shield-check`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]};V.node;var H=i(V),U=c(t(),1),W=o(),G={planning:`info`,running:`info`,reviewing:`info`,planned:`accent`,succeeded:`ok`,failed:`err`,cancelled:`neutral`,budget_exhausted:`warn`},K={planning:`planning`,running:`running`,reviewing:`reviewing`,planned:`planned (dry run)`,succeeded:`succeeded`,failed:`failed`,cancelled:`cancelled`,budget_exhausted:`out of budget`},q=new Set([`planning`,`running`,`reviewing`]);function J(e){return q.has(e.status)}function Y(e){let t=Number(e);return e.trim()&&Number.isInteger(t)&&t>0?t:void 0}function X(){let t=d(),[n,i]=(0,U.useState)(),o=_(t.error)&&t.error.status===501,c=t.data??[],l=c.find(e=>e.id===n)??c[0],u=c.find(J);return(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsx)(s,{title:`Goals`,description:`Give the agent team an objective: a planner splits it into tasks, role agents execute them, a reviewer re-plans until it is done or the budget runs out.`}),o?(0,W.jsxs)(T,{tone:`warn`,title:`Goal mode unavailable`,children:[(0,W.jsxs)(`p`,{children:[`This gateway answered `,(0,W.jsx)(`code`,{className:`font-mono text-fg`,children:`501 goals_unavailable`}),`: it was started outside a project. Start it inside a repository with a project brain, or run a goal from the terminal:`]}),(0,W.jsx)(j,{command:`davecode goal "<objective>"`,className:`mt-2 max-w-sm`})]}):(0,W.jsx)(Z,{busy:u?.id,onStarted:e=>i(e.id)}),t.isError&&!o&&(0,W.jsx)(T,{tone:`err`,title:`Could not load goals`,children:m(t.error)}),!o&&(0,W.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 xl:grid-cols-[320px_minmax(0,1fr)]`,children:[(0,W.jsxs)(r,{"aria-labelledby":`goal-list-title`,className:`xl:self-start`,children:[(0,W.jsx)(a,{id:`goal-list-title`,title:`History`,meta:c.length?`${c.length} goal${c.length===1?``:`s`}`:void 0}),t.isPending?(0,W.jsx)(M,{rows:4,className:`p-3`}):c.length===0?(0,W.jsx)(k,{icon:E,title:`No goals yet`,description:`Describe an objective above, or try a dry run to see the plan first.`}):(0,W.jsx)(`ul`,{className:`flex flex-col p-1.5`,"aria-label":`Goals`,children:c.map(t=>{let n=t.tasks.filter(e=>e.status===`SUCCESS`).length,r=t.id===l?.id;return(0,W.jsx)(`li`,{children:(0,W.jsxs)(`button`,{type:`button`,"aria-current":r?`true`:void 0,onClick:()=>i(t.id),className:e(`flex w-full flex-col gap-1 rounded-md px-2.5 py-2 text-left transition-colors duration-150`,r?`bg-hover`:`hover:bg-hover/60`),children:[(0,W.jsx)(`span`,{className:`line-clamp-2 text-[13px] leading-5 text-fg`,children:t.objective}),(0,W.jsxs)(`span`,{className:`flex items-center gap-2 text-2xs text-muted`,children:[(0,W.jsx)(y,{tone:G[t.status],dot:!0,pulse:J(t),children:K[t.status]}),(0,W.jsxs)(`span`,{className:`tnum`,children:[n,`/`,t.tasks.length,` tasks`]}),(0,W.jsx)(`span`,{className:`ml-auto`,children:p(Date.parse(t.createdAt))})]})]})},t.id)})})]}),l?(0,W.jsx)($,{goal:l}):null]})]})}function Z({busy:e,onStarted:t}){let i=u(),[o,s]=(0,U.useState)(``),[c,l]=(0,U.useState)(``),[d,f]=(0,U.useState)(``),[p,h]=(0,U.useState)(``),[g,v]=(0,U.useState)(!1),[y,b]=(0,U.useState)(null);return(0,W.jsxs)(r,{"aria-labelledby":`new-goal-title`,children:[(0,W.jsx)(a,{id:`new-goal-title`,title:`New goal`,meta:(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,W.jsx)(H,{"aria-hidden":!0,className:`size-3.5 text-ok`,strokeWidth:1.75}),`Never emails, posts, pays or signs up: those become drafts`]})}),(0,W.jsxs)(`form`,{onSubmit:e=>{if(e.preventDefault(),!o.trim()){b(`Describe what the team should achieve.`);return}b(null);let n={objective:o.trim()},r=Y(c),a=Y(d),l=Y(p);r&&(n.maxRounds=r),a&&(n.maxTasks=a),l&&(n.maxTokens=l),g&&(n.dryRun=!0),i.mutate(n,{onSuccess:e=>{F({tone:`info`,title:g?`Planning (dry run)`:`Goal started`,description:e.objective}),s(``),t(e)},onError:e=>F({tone:`err`,title:`Could not start the goal`,description:_(e)&&e.code===`busy`?`${e.message}. Goals and the runner take turns on the working tree.`:m(e)})})},className:`flex flex-col gap-3 p-4`,children:[(0,W.jsx)(R,{label:`Objective`,required:!0,error:y,children:({id:e,describedBy:t,invalid:n})=>(0,W.jsx)(I,{id:e,"aria-describedby":t,"aria-invalid":n,rows:2,maxLength:4e3,placeholder:`e.g. Write positioning and landing-page copy for this project, then add a /pricing page`,value:o,onChange:e=>s(e.target.value)})}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,W.jsx)(R,{label:`Max rounds`,className:`w-28`,children:({id:e})=>(0,W.jsx)(L,{id:e,inputMode:`numeric`,placeholder:`4`,value:c,onChange:e=>l(e.target.value)})}),(0,W.jsx)(R,{label:`Max tasks`,className:`w-28`,children:({id:e})=>(0,W.jsx)(L,{id:e,inputMode:`numeric`,placeholder:`12`,value:d,onChange:e=>f(e.target.value)})}),(0,W.jsx)(R,{label:`Token budget`,className:`w-36`,children:({id:e})=>(0,W.jsx)(L,{id:e,inputMode:`numeric`,placeholder:`1000000`,value:p,onChange:e=>h(e.target.value)})}),(0,W.jsxs)(`span`,{className:`flex h-8 items-center gap-2 text-[12px] text-fg-2`,children:[(0,W.jsx)(S,{checked:g,onChange:v,label:`Dry run`}),`Dry run (plan only)`]}),(0,W.jsx)(n,{type:`submit`,variant:`primary`,icon:D,className:`ml-auto`,loading:i.isPending,disabled:i.isPending||!!e&&!g,title:e&&!g?`Goal ${e} is still running`:void 0,children:g?`Plan`:`Start goal`})]})]})]})}function Q({label:t,value:n,max:r,format:i=String}){let a=r>0?Math.min(100,n/r*100):0;return(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,W.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 text-[12px]`,children:[(0,W.jsx)(`span`,{className:`text-muted`,children:t}),(0,W.jsxs)(`span`,{className:`tnum font-mono text-fg`,children:[i(n),(0,W.jsxs)(`span`,{className:`text-muted`,children:[` / `,i(r)]})]})]}),(0,W.jsx)(`div`,{className:`h-1.5 overflow-hidden rounded-full bg-track`,"aria-hidden":!0,children:(0,W.jsx)(`div`,{className:e(`h-full rounded-full transition-[width] duration-500 ease-snappy`,a>=90?`bg-warn`:`bg-accent`),style:{width:`${a}%`}})})]})}function $({goal:t}){let i=h(),o=l(),s=f(),[c,u]=(0,U.useState)(!1),[d,p]=(0,U.useState)(),_=J(t),b=t.tasks.filter(e=>e.status===`SUCCESS`).length,S=s.events.filter(e=>e.type===`goal.log`&&e.goalId===t.id),T=()=>i.mutate(t.id,{onSuccess:e=>F({tone:`info`,title:`Goal ${e.status}`,description:e.objective}),onError:e=>F({tone:`err`,title:`Could not cancel`,description:m(e)})});return(0,W.jsxs)(r,{"aria-labelledby":`goal-detail-title`,className:`min-w-0`,children:[(0,W.jsx)(a,{id:`goal-detail-title`,title:(0,W.jsx)(`span`,{className:`font-mono text-2xs text-muted`,children:t.id}),meta:(0,W.jsx)(y,{tone:G[t.status],dot:!0,pulse:_,children:K[t.status]}),actions:(0,W.jsxs)(W.Fragment,{children:[t.status===`planned`&&(0,W.jsx)(n,{size:`sm`,variant:`primary`,icon:D,loading:o.isPending,onClick:()=>o.mutate(t.id,{onSuccess:e=>F({tone:`info`,title:`Executing planned goal`,description:e.objective}),onError:e=>F({tone:`err`,title:`Could not execute plan`,description:m(e)})}),children:`Execute plan`}),_&&(0,W.jsx)(n,{size:`sm`,variant:`danger`,icon:A,loading:i.isPending,onClick:()=>u(!0),children:`Cancel`})]})}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,W.jsx)(`p`,{className:`text-[15px] leading-6 font-medium text-fg`,children:t.objective}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-3`,children:[(0,W.jsx)(Q,{label:`Rounds`,value:t.round,max:t.limits.maxRounds}),(0,W.jsx)(Q,{label:`Tasks done`,value:b,max:Math.max(t.tasks.length,1)}),(0,W.jsx)(Q,{label:`Tokens`,value:t.limits.tokensUsed,max:t.limits.maxTokens,format:g})]}),t.lastError&&(0,W.jsx)(`p`,{className:`rounded-md border border-err/30 bg-err-soft p-2 font-mono text-2xs text-err`,children:t.lastError}),(0,W.jsx)(`section`,{"aria-label":`Tasks`,className:`flex flex-col`,children:t.tasks.length===0?(0,W.jsx)(`p`,{className:`text-[12px] text-muted`,children:_?`The planner is drafting the task graph…`:`No tasks were planned.`}):(0,W.jsx)(`ol`,{className:`flex flex-col divide-y divide-line rounded-md border border-line`,children:t.tasks.map(n=>(0,W.jsxs)(`li`,{className:e(`flex flex-col gap-1.5 px-3 py-2.5`,n.id===t.activeTaskId&&`bg-accent-soft/40`),children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(O,{status:n.status}),(0,W.jsx)(`span`,{className:`font-mono text-2xs text-muted`,children:n.id}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 text-[13px] text-fg`,children:n.title}),(0,W.jsx)(y,{mono:!0,children:n.role}),(0,W.jsx)(y,{tone:n.kind===`code`?`accent`:`neutral`,mono:!0,children:n.kind}),n.round>1&&(0,W.jsxs)(y,{mono:!0,children:[`round `,n.round]})]}),n.dependsOn.length>0&&(0,W.jsxs)(`p`,{className:`text-2xs text-muted`,children:[`after `,n.dependsOn.join(`, `)]}),n.artifact&&(0,W.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 font-mono text-2xs text-fg-2`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>p(e=>e===n.id?void 0:n.id),"aria-expanded":d===n.id,className:`inline-flex items-center gap-1 rounded px-1 py-0.5 text-fg-2 transition-colors hover:bg-hover hover:text-fg`,children:[d===n.id?(0,W.jsx)(B,{"aria-hidden":!0,className:`size-3.5 text-muted`}):(0,W.jsx)(x,{"aria-hidden":!0,className:`size-3.5 text-muted`}),(0,W.jsx)(C,{"aria-hidden":!0,className:`size-3.5 text-muted`,strokeWidth:1.75}),(0,W.jsx)(`span`,{className:`truncate`,children:n.artifact})]}),(0,W.jsx)(P,{value:n.artifact,label:`Copy path`})]}),d===n.id&&(0,W.jsx)(ee,{goalId:t.id,taskId:n.id})]}),n.status===`FAILED`&&n.notes&&(0,W.jsx)(`p`,{className:`line-clamp-3 font-mono text-2xs text-err`,children:n.notes})]},n.id))})}),t.summary&&(0,W.jsx)(`section`,{"aria-label":`Summary`,className:`rounded-md border border-line bg-raised/40 p-3`,children:(0,W.jsx)(w,{source:t.summary,className:`text-[13px]`})}),(0,W.jsx)(`section`,{"aria-label":`Goal log`,className:`term max-h-64 overflow-auto rounded-md border border-line bg-term py-2 font-mono text-[12px] leading-[1.6]`,children:S.length===0?(0,W.jsx)(`p`,{className:`px-3 text-muted`,children:_?`Waiting for agent output…`:`No live log for this goal in this session.`}):S.map(t=>(0,W.jsxs)(`div`,{className:`flex gap-3 px-3`,children:[(0,W.jsx)(`span`,{className:`tnum shrink-0 text-faint select-none`,children:v(t.ts)}),(0,W.jsx)(`span`,{className:`w-20 shrink-0 truncate text-info`,children:t.role??`goal`}),(0,W.jsx)(`span`,{className:e(`min-w-0 break-words`,t.level===`error`?`text-err`:t.level===`warn`?`text-warn`:`text-fg-2`),children:t.message})]},`${t.ts}-${t.message}`))})]}),(0,W.jsx)(N,{open:c,onClose:()=>u(!1),title:`Cancel this goal?`,description:`The agent in flight is stopped. Finished artifacts and merged code stay; an interrupted code task keeps its partial work on its branch.`,footer:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(n,{variant:`ghost`,onClick:()=>u(!1),children:`Keep going`}),(0,W.jsx)(n,{variant:`danger`,icon:A,onClick:()=>{u(!1),T()},children:`Cancel goal`})]}),children:(0,W.jsx)(`p`,{className:`text-[12px] text-muted`,children:t.objective})})]})}function ee({goalId:e,taskId:t}){let n=b(e,t);return n.isPending?(0,W.jsx)(M,{rows:3,className:`p-2`}):n.isError?(0,W.jsx)(`p`,{className:`rounded-md border border-err/30 bg-err-soft p-2 font-mono text-2xs text-err`,children:m(n.error)}):(0,W.jsxs)(`div`,{className:`rounded-md border border-line bg-raised/50 p-3`,children:[(0,W.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 border-b border-line pb-1.5`,children:[(0,W.jsx)(`span`,{className:`font-mono text-2xs text-muted`,children:n.data.path}),(0,W.jsx)(P,{value:n.data.content,label:`Copy markdown`})]}),(0,W.jsx)(w,{source:n.data.content,className:`text-[13px]`})]})}export{$ as GoalDetail,X as Goals,J as isActiveGoal,B as t};
@@ -1 +0,0 @@
1
- import{c as e,i as t,s as n,t as r,u as i}from"./Panel-Du40pM7n.js";import{A as a,U as o,W as s,x as c}from"./index-BCi-Vuvh.js";import{n as l}from"./Field-OXMnT9Tb.js";var u=i(e(),1),d=[{id:`ponytail`,name:`Ponytail`,kind:`Guidance`,url:`https://github.com/DietrichGebert/ponytail`,description:`Reuse what exists and keep implementations small. Useful for avoiding unnecessary code; it does not supply an art direction.`,access:`Repository; review license before reuse`},{id:`anti-slop`,name:`Anti Slop`,kind:`Guidance`,url:`https://github.com/miqdadbadjuber/anti-slop`,description:`Review recurring generic patterns in interface design, copy and generated code.`,access:`Repository; review license before reuse`},{id:`impeccable`,name:`Impeccable`,kind:`Guidance`,url:`https://github.com/pbakaus/impeccable`,description:`Design guidance for defining a product direction and refining the finished interface.`,access:`Repository; review license before reuse`},{id:`anti-ui-slop`,name:`Anti UI Slop`,kind:`Guidance`,url:`https://github.com/tuanphung2005/anti-ui-slop`,description:`A separate UI-focused ruleset. Compare its constraints with your brief rather than combining conflicting rules.`,access:`Repository; review license before reuse`},{id:`shadcn`,name:`shadcn/ui`,kind:`Components`,url:`https://github.com/shadcn-ui/ui`,description:`Own and adapt the component source. Start from accessible building blocks and make them fit your identity.`,access:`MIT component library`},{id:`radix`,name:`Radix Primitives`,kind:`Components`,url:`https://github.com/radix-ui/primitives`,description:`Accessible interaction primitives for dialogs, menus and other complex interface behaviors.`,access:`MIT component library`},{id:`motion`,name:`Motion`,kind:`Components`,url:`https://github.com/motiondivision/motion`,description:`Animation for React and JavaScript. Use motion to explain a change, with a reduced-motion alternative.`,access:`MIT library; optional paid products are separate`},{id:`r3f`,name:`React Three Fiber`,kind:`Components`,url:`https://github.com/pmndrs/react-three-fiber`,description:`A React renderer for Three.js. Consider it when a real 3D experience serves the idea.`,access:`MIT library; assets have their own licenses`},{id:`awwwards`,name:`Awwwards`,kind:`Inspiration`,url:`https://www.awwwards.com/`,description:`Explore expressive websites and the studios behind them. Study composition and interaction, then create your own interpretation.`,access:`Reference gallery; artwork is not licensed for copying`},{id:`siteinspire`,name:`Siteinspire`,kind:`Inspiration`,url:`https://www.siteinspire.com/`,description:`Find references by style, type and subject instead of starting from the same SaaS template.`,access:`Reference gallery; artwork is not licensed for copying`},{id:`freight`,name:`Studio Freight`,kind:`Inspiration`,url:`https://studiofreight.com/`,description:`A studio reference for thoughtful digital identity and web experiences.`,access:`Studio portfolio; reference only`},{id:`hf`,name:`Hugging Face Spaces`,kind:`AI tools`,url:`https://huggingface.co/spaces`,description:`Discover interactive AI demos. Check each Space, model license and compute requirements before using it in your project.`,access:`Availability, model licenses and costs vary`}];function f(e){return`Help me create a distinctive interface for this project. Use ${e.name} (${e.url}) as a reference if you can access it. Its purpose: ${e.description}\n\nFirst identify the audience, intended outcome and existing design system. Propose a specific visual direction and a short design brief: typography, palette, composition, imagery, interaction and mobile behavior. Preserve the project stack, cover loading/empty/error states, and verify the rendered result. Use references as inspiration and respect their licenses. Do not claim to have read, installed or connected a resource without checking. Explain any external dependency before adding it.`}var p=n(),m=[`All`,`Guidance`,`Components`,`Inspiration`,`AI tools`];function h(){let[e,n]=(0,u.useState)(`All`),[i,h]=(0,u.useState)(``),g=d.filter(t=>(e===`All`||t.kind===e)&&`${t.name} ${t.description}`.toLowerCase().includes(i.toLowerCase()));return(0,p.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,p.jsx)(r,{title:`Creative library`,description:`Find a direction before you build. A curated starting point for people with ideas, with guidance, components and real design references.`}),(0,p.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,p.jsx)(`fieldset`,{className:`flex flex-wrap gap-1`,"aria-label":`Resource category`,children:m.map(r=>(0,p.jsx)(t,{variant:r===e?`primary`:`ghost`,onClick:()=>n(r),"aria-pressed":r===e,children:r},r))}),(0,p.jsxs)(`label`,{htmlFor:`creative-search`,className:`relative ml-auto w-full max-w-xs`,children:[(0,p.jsx)(`span`,{className:`sr-only`,children:`Find a creative resource`}),(0,p.jsx)(a,{"aria-hidden":!0,className:`absolute top-2.5 left-2.5 size-3.5 text-muted`}),(0,p.jsx)(l,{id:`creative-search`,value:i,onChange:e=>h(e.target.value),placeholder:`Find a resource…`,className:`pl-8`})]})]}),(0,p.jsx)(`div`,{className:`grid gap-x-8 md:grid-cols-2 xl:grid-cols-3`,children:g.map(e=>(0,p.jsxs)(`article`,{className:`flex flex-col items-start border-t border-line py-6`,children:[(0,p.jsx)(`p`,{className:`text-[12px] text-accent-text`,children:e.kind}),(0,p.jsx)(`h2`,{className:`mt-3 text-[21px] font-medium tracking-tight text-fg`,children:e.name}),(0,p.jsx)(`p`,{className:`mt-3 max-w-sm flex-1 text-[13px] leading-6 text-muted`,children:e.description}),(0,p.jsx)(`p`,{className:`mt-4 text-[11px] leading-5 text-muted`,children:e.access}),(0,p.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-4`,children:[(0,p.jsx)(t,{size:`sm`,onClick:()=>c(`/?brief=${encodeURIComponent(f(e))}`),children:`Use in a goal`}),(0,p.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-[12px] text-fg-2 hover:text-fg`,children:[`Visit source`,(0,p.jsx)(s,{"aria-hidden":!0,className:`size-3`})]})]})]},e.id))}),g.length===0&&(0,p.jsx)(`p`,{role:`status`,className:`py-8 text-[13px] text-muted`,children:`No resources match. Try another name or category.`}),(0,p.jsxs)(`div`,{className:`flex gap-3 border-t border-line pt-5 text-[12px] leading-6 text-muted`,children:[(0,p.jsx)(o,{"aria-hidden":!0,className:`mt-1 size-4 shrink-0`}),(0,p.jsx)(`p`,{children:`These are curated references, not installed plugins. “Use in a goal” prepares a brief for your agent; it does not run code, fetch a site or connect an account. DaveCode includes its own design-quality guidance by default. Third-party resources keep their own licenses and access requirements.`})]})]})}export{h as Library};
@@ -1 +0,0 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)),l=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function D(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function O(e,t){return D(e.type,t,e.props)}function k(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ee(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?ee(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(w,w):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(k(o)&&(o=O(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function te(e){var t=T.T,n={};n.types=t===null?null:t.types,T.T=n;try{var r=e(),i=T.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(w,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),T.T=t}}function ne(e){var t=T.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else te(ne.bind(null,e))}var re={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!k(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=re,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=x,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return T.H.useMemoCache(e)}},e.addTransitionType=ne,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!E.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return D(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)E.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return D(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=k,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=te,e.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},e.use=function(e){return T.H.use(e)},e.useActionState=function(e,t,n){return T.H.useActionState(e,t,n)},e.useCallback=function(e,t){return T.H.useCallback(e,t)},e.useContext=function(e){return T.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return T.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return T.H.useEffect(e,t)},e.useEffectEvent=function(e){return T.H.useEffectEvent(e)},e.useId=function(){return T.H.useId()},e.useImperativeHandle=function(e,t,n){return T.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return T.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return T.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return T.H.useMemo(e,t)},e.useOptimistic=function(e,t){return T.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return T.H.useReducer(e,t,n)},e.useRef=function(e){return T.H.useRef(e)},e.useState=function(e){return T.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return T.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return T.H.useTransition()},e.version=`19.3.1`})),u=o(((e,t)=>{t.exports=l()})),d=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),f=o(((e,t)=>{t.exports=d()})),p=c(u(),1),m=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function h(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:m(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var g=e=>{let t=``,n=!1;for(let r of e)r===`-`||r===`_`||r<=` `?n=t.length>0:(t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1);return t},_=e=>{let t=g(e);return t.charAt(0).toUpperCase()+t.slice(1)},v=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),y={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function b(e){return e!=null}function x(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??y.width,a=e.size??e.height??y.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?v(...c):v(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??y[`stroke-width`])*Number(e.size??e.width??y.width)/Number(t.size??t.width??y.width):t.strokeWidth??y[`stroke-width`];return[`svg`,{...Object.entries(y).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&b(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&b(t.width)&&{[r(`width`)]:t.width},...`height`in t&&b(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function S(e,t={}){return x(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var C=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},w=(0,p.createContext)({}),T=()=>(0,p.useContext)(w),E=(0,p.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:m=24,strokeWidth:h=2,absoluteStrokeWidth:g=!1,nonScalingStroke:_=!1,color:y=`currentColor`,className:b=``}=T()??{},x=!!c||C(d),[w,E,D=[]]=S(u,{color:e??y,width:n??t??m,height:r??t??m,strokeWidth:i??h,absoluteStrokeWidth:a??g,nonScalingStroke:o??_,className:v(b,s),hasA11yProp:x,attributes:d});return(0,p.createElement)(w,{ref:f,...E},[...D.map(([e,t])=>(0,p.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function D(e,t=[],n=[]){let r=typeof e==`string`?h(e,t,n):e,i=(0,p.forwardRef)(({className:e,...t},n)=>(0,p.createElement)(E,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=_(r.name)),i}function O(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=O(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function k(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=O(e))&&(r&&(r+=` `),r+=t);return r}var ee=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},A=(e,t)=>({classGroupId:e,validator:t}),j=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),M=`-`,N=[],P=`arbitrary..`,F=e=>{let t=ne(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return te(e);let n=e.split(M);return I(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?ee(i,t):t:i||N}return n[e]||N}}},I=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=I(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(M):e.slice(t).join(M),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},te=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?P+r:void 0})(),ne=e=>{let{theme:t,classGroups:n}=e;return re(n,t)},re=(e,t)=>{let n=j();for(let r in e){let i=e[r];L(i,n,r,t)}return n},L=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];R(i,t,n,r)}},R=(e,t,n,r)=>{typeof e==`string`?ie(e,t,n):typeof e==`function`?ae(e,t,n,r):z(e,t,n,r)},ie=(e,t,n)=>{let r=e===``?t:oe(t,e);r.classGroupId=n},ae=(e,t,n,r)=>{se(e)?L(e(r),t,n,r):(t.validators===null&&(t.validators=[]),t.validators.push(A(n,e)))},z=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];L(o,oe(t,a),n,r)}},oe=(e,t)=>{let n=e,r=t.split(M),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=j(),n.nextPart.set(t,i)),n=i}return n},se=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,ce=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},B=`!`,V=`:`,le=[],ue=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),de=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===V){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(B)?(c=s.slice(0,-1),l=!0):s.startsWith(B)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return ue(t,l,c,u)};if(t){let e=t+V,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):ue(le,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},fe=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},pe=e=>({cache:ce(e.cacheSize),parseClassName:de(e),sortModifiers:fe(e),postfixLookupClassGroupIds:me(e),...F(e)}),me=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},he=/\s+/,ge=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(he),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h||(g=r(p),!g)){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+B:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},_e=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=ve(n))&&(i&&(i+=` `),i+=r);return i},ve=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=ve(e[r]))&&(n&&(n+=` `),n+=t);return n},ye=(e,...t)=>{let n,r,i,a,o=o=>(n=pe(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=ge(e,n);return i(e,a),a};return a=o,(...e)=>a(_e(...e))},be=[],H=e=>{let t=t=>t[e]||be;return t.isThemeGetter=!0,t.themeKey=e,t},xe=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Se=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ce=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,we=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Te=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Ee=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,De=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Oe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,U=e=>Ce.test(e),W=e=>!!e&&!Number.isNaN(Number(e)),G=e=>!!e&&Number.isInteger(Number(e)),ke=e=>e.endsWith(`%`)&&W(e.slice(0,-1)),K=e=>we.test(e),Ae=()=>!0,je=e=>Te.test(e)&&!Ee.test(e),Me=()=>!1,Ne=e=>De.test(e),Pe=e=>Oe.test(e),Fe=e=>!q(e)&&!Y(e),Ie=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Le=e=>X(e,$e,Me),q=e=>xe.test(e),J=e=>X(e,et,je),Re=e=>X(e,tt,W),ze=e=>X(e,rt,Ae),Be=e=>X(e,nt,Me),Ve=e=>X(e,Ze,Me),He=e=>X(e,Qe,Pe),Ue=e=>X(e,it,Ne),Y=e=>Se.test(e),We=e=>Z(e,et),Ge=e=>Z(e,nt),Ke=e=>Z(e,Ze),qe=e=>Z(e,$e),Je=e=>Z(e,Qe),Ye=e=>Z(e,it,!0),Xe=e=>Z(e,rt,!0),X=(e,t,n)=>{let r=xe.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Z=(e,t,n=!1)=>{let r=Se.exec(e);return r?r[1]?t(r[1]):n:!1},Ze=e=>e===`position`||e===`percentage`,Qe=e=>e===`image`||e===`url`,$e=e=>e===`length`||e===`size`||e===`bg-size`,et=e=>e===`length`,tt=e=>e===`number`,nt=e=>e===`family-name`,rt=e=>e===`number`||e===`weight`,it=e=>e===`shadow`,at=()=>{let e=H(`color`),t=H(`font`),n=H(`text`),r=H(`font-weight`),i=H(`tracking`),a=H(`leading`),o=H(`breakpoint`),s=H(`container`),c=H(`spacing`),l=H(`radius`),u=H(`shadow`),d=H(`inset-shadow`),f=H(`text-shadow`),p=H(`drop-shadow`),m=H(`blur`),h=H(`perspective`),g=H(`aspect`),_=H(`ease`),v=H(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),Y,q],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Y,q,c],T=()=>[U,`full`,`auto`,...w()],E=()=>[G,`none`,`subgrid`,Y,q],D=()=>[`auto`,{span:[`full`,G,Y,q]},G,Y,q],O=()=>[G,`auto`,Y,q],k=()=>[`auto`,`min`,`max`,`fr`,Y,q],ee=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],A=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],j=()=>[`auto`,...w()],M=()=>[U,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],N=()=>[s,U,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],P=()=>[U,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],F=()=>[e,Y,q],I=()=>[...b(),Ke,Ve,{position:[Y,q]}],te=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ne=()=>[`auto`,`cover`,`contain`,qe,Le,{size:[Y,q]}],re=()=>[ke,We,J],L=()=>[``,`none`,`full`,l,Y,q],R=()=>[``,W,We,J],ie=()=>[`solid`,`dashed`,`dotted`,`double`],ae=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],z=()=>[W,ke,Ke,Ve],oe=()=>[``,`none`,m,Y,q],se=()=>[`none`,W,Y,q],ce=()=>[`none`,W,Y,q],B=()=>[W,Y,q],V=()=>[U,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[K],breakpoint:[K],color:[Ae],container:[K],"drop-shadow":[K],ease:[`in`,`out`,`in-out`],font:[Fe],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[K],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[K],shadow:[K],spacing:[`px`,W],text:[K],"text-shadow":[K],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,U,q,Y,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,Y,q]}],"container-named":[Ie],columns:[{columns:[W,`auto`,q,Y,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[G,`auto`,Y,q]}],basis:[{basis:[U,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[W,U,`auto`,`initial`,`none`,q]}],grow:[{grow:[``,W,Y,q]}],shrink:[{shrink:[``,W,Y,q]}],order:[{order:[G,`first`,`last`,`none`,Y,q]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...ee(),`normal`]}],"justify-items":[{"justify-items":[...A(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...A()]}],"align-content":[{content:[`normal`,...ee()]}],"align-items":[{items:[...A(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...A(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...A(),`baseline`]}],"place-self":[{"place-self":[`auto`,...A()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mbs:[{mbs:j()}],mbe:[{mbe:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:M()}],"inline-size":[{inline:[`auto`,...N()]}],"min-inline-size":[{"min-inline":[`auto`,...N()]}],"max-inline-size":[{"max-inline":[`none`,...N()]}],"block-size":[{block:[`auto`,...P()]}],"min-block-size":[{"min-block":[`auto`,...P()]}],"max-block-size":[{"max-block":[`none`,...P()]}],w:[{w:[s,`screen`,...M()]}],"min-w":[{"min-w":[s,`screen`,`none`,...M()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...M()]}],h:[{h:[`screen`,`lh`,...M()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...M()]}],"max-h":[{"max-h":[`screen`,`lh`,`none`,...M()]}],"font-size":[{text:[`base`,n,We,J]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Xe,ze]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,ke,q]}],"font-family":[{font:[Ge,Be,t]}],"font-features":[{"font-features":[q]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,Y,q]}],"line-clamp":[{"line-clamp":[W,`none`,Y,Re]}],leading:[{leading:[`none`,a,...w()]}],"list-image":[{"list-image":[`none`,Y,q]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Y,q]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...ie(),`wavy`]}],"text-decoration-thickness":[{decoration:[W,`from-font`,`auto`,Y,J]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[W,`auto`,Y,q]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[G,Y,q]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Y,q]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Y,q]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:I()}],"bg-repeat":[{bg:te()}],"bg-size":[{bg:ne()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},G,Y,q],radial:[``,Y,q],conic:[``,G,Y,q]},Je,He]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:L()}],"rounded-s":[{"rounded-s":L()}],"rounded-e":[{"rounded-e":L()}],"rounded-t":[{"rounded-t":L()}],"rounded-r":[{"rounded-r":L()}],"rounded-b":[{"rounded-b":L()}],"rounded-l":[{"rounded-l":L()}],"rounded-ss":[{"rounded-ss":L()}],"rounded-se":[{"rounded-se":L()}],"rounded-ee":[{"rounded-ee":L()}],"rounded-es":[{"rounded-es":L()}],"rounded-tl":[{"rounded-tl":L()}],"rounded-tr":[{"rounded-tr":L()}],"rounded-br":[{"rounded-br":L()}],"rounded-bl":[{"rounded-bl":L()}],"border-w":[{border:R()}],"border-w-x":[{"border-x":R()}],"border-w-y":[{"border-y":R()}],"border-w-s":[{"border-s":R()}],"border-w-e":[{"border-e":R()}],"border-w-bs":[{"border-bs":R()}],"border-w-be":[{"border-be":R()}],"border-w-t":[{"border-t":R()}],"border-w-r":[{"border-r":R()}],"border-w-b":[{"border-b":R()}],"border-w-l":[{"border-l":R()}],"divide-x":[{"divide-x":R()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":R()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...ie(),`hidden`,`none`]}],"divide-style":[{divide:[...ie(),`hidden`,`none`]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-bs":[{"border-bs":F()}],"border-color-be":[{"border-be":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...ie(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[W,Y,q]}],"outline-w":[{outline:[``,W,We,J]}],"outline-color":[{outline:F()}],shadow:[{shadow:[``,`inner`,`none`,u,Ye,Ue]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":[`none`,d,Ye,Ue]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:R()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[W,J]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":R()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":[`none`,f,Ye,Ue]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[W,Y,q]}],"mix-blend":[{"mix-blend":[...ae(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ae()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[W]}],"mask-image-linear-from-pos":[{"mask-linear-from":z()}],"mask-image-linear-to-pos":[{"mask-linear-to":z()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":z()}],"mask-image-t-to-pos":[{"mask-t-to":z()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":z()}],"mask-image-r-to-pos":[{"mask-r-to":z()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":z()}],"mask-image-b-to-pos":[{"mask-b-to":z()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":z()}],"mask-image-l-to-pos":[{"mask-l-to":z()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":z()}],"mask-image-x-to-pos":[{"mask-x-to":z()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":z()}],"mask-image-y-to-pos":[{"mask-y-to":z()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[Y,q]}],"mask-image-radial-from-pos":[{"mask-radial-from":z()}],"mask-image-radial-to-pos":[{"mask-radial-to":z()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[W]}],"mask-image-conic-from-pos":[{"mask-conic-from":z()}],"mask-image-conic-to-pos":[{"mask-conic-to":z()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:I()}],"mask-repeat":[{mask:te()}],"mask-size":[{mask:ne()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Y,q]}],filter:[{filter:[``,`none`,Y,q]}],blur:[{blur:oe()}],brightness:[{brightness:[W,Y,q]}],contrast:[{contrast:[W,Y,q]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Ye,Ue]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:[``,W,Y,q]}],"hue-rotate":[{"hue-rotate":[W,Y,q]}],invert:[{invert:[``,W,Y,q]}],saturate:[{saturate:[W,Y,q]}],sepia:[{sepia:[``,W,Y,q]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Y,q]}],"backdrop-blur":[{"backdrop-blur":oe()}],"backdrop-brightness":[{"backdrop-brightness":[W,Y,q]}],"backdrop-contrast":[{"backdrop-contrast":[W,Y,q]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,W,Y,q]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[W,Y,q]}],"backdrop-invert":[{"backdrop-invert":[``,W,Y,q]}],"backdrop-opacity":[{"backdrop-opacity":[W,Y,q]}],"backdrop-saturate":[{"backdrop-saturate":[W,Y,q]}],"backdrop-sepia":[{"backdrop-sepia":[``,W,Y,q]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,Y,q]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[W,`initial`,Y,q]}],ease:[{ease:[`linear`,`initial`,_,Y,q]}],delay:[{delay:[W,Y,q]}],animate:[{animate:[`none`,v,Y,q]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Y,q]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:se()}],"rotate-x":[{"rotate-x":se()}],"rotate-y":[{"rotate-y":se()}],"rotate-z":[{"rotate-z":se()}],scale:[{scale:ce()}],"scale-x":[{"scale-x":ce()}],"scale-y":[{"scale-y":ce()}],"scale-z":[{"scale-z":ce()}],"scale-3d":[`scale-3d`],skew:[{skew:B()}],"skew-x":[{"skew-x":B()}],"skew-y":[{"skew-y":B()}],transform:[{transform:[Y,q,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:V()}],"translate-x":[{"translate-x":V()}],"translate-y":[{"translate-y":V()}],"translate-z":[{"translate-z":V()}],"translate-none":[`translate-none`],zoom:[{zoom:[G,Y,q]}],accent:[{accent:F()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Y,q]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":F()}],"scrollbar-track-color":[{"scrollbar-track":F()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Y,q]}],fill:[{fill:[`none`,...F()]}],"stroke-w":[{stroke:[W,We,J,Re]}],stroke:[{stroke:[`none`,...F()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`start`,`end`,`right`,`left`],"inset-y":[`inset-bs`,`inset-be`,`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`ps`,`pe`,`pr`,`pl`],py:[`pbs`,`pbe`,`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`ms`,`me`,`mr`,`ml`],my:[`mbs`,`mbe`,`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-s`,`border-w-e`,`border-w-r`,`border-w-l`],"border-w-y":[`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-s`,`border-color-e`,`border-color-r`,`border-color-l`],"border-color-y":[`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-ms`,`scroll-me`,`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-ps`,`scroll-pe`,`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}},ot=(e,{cacheSize:t,prefix:n,experimentalParseClassName:r,extend:i={},override:a={}})=>(Q(e,`cacheSize`,t),Q(e,`prefix`,n),Q(e,`experimentalParseClassName`,r),st(e.theme,a.theme),st(e.classGroups,a.classGroups),st(e.conflictingClassGroups,a.conflictingClassGroups),st(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),Q(e,`postfixLookupClassGroups`,a.postfixLookupClassGroups),Q(e,`orderSensitiveModifiers`,a.orderSensitiveModifiers),ct(e.theme,i.theme),ct(e.classGroups,i.classGroups),ct(e.conflictingClassGroups,i.conflictingClassGroups),ct(e.conflictingClassGroupModifiers,i.conflictingClassGroupModifiers),lt(e,i,`postfixLookupClassGroups`),lt(e,i,`orderSensitiveModifiers`),e),Q=(e,t,n)=>{n!==void 0&&(e[t]=n)},st=(e,t)=>{if(t)for(let n in t)Q(e,n,t[n])},ct=(e,t)=>{if(t)for(let n in t)lt(e,t,n)},lt=(e,t,n)=>{let r=t[n];r!==void 0&&(e[n]=e[n]?e[n].concat(r):r)},ut=((e,...t)=>typeof e==`function`?ye(at,e,...t):ye(()=>ot(at(),e),...t))({extend:{classGroups:{"font-size":[{text:[`2xs`]}]}}});function dt(...e){return ut(k(e))}var $=f(),ft={primary:`bg-accent text-accent-fg hover:brightness-110 active:brightness-95 border border-transparent font-medium`,secondary:`bg-raised text-fg border border-line-strong hover:bg-hover hover:border-faint/60`,ghost:`text-fg-2 border border-transparent hover:bg-hover hover:text-fg`,danger:`bg-err-soft text-err border border-err/30 hover:bg-err/20`},pt={sm:`h-7 gap-1.5 px-2.5 text-[12px]`,md:`h-8 gap-2 px-3 text-[13px]`},mt=(0,p.forwardRef)(function({variant:e=`secondary`,size:t=`md`,icon:n,iconOnly:r,loading:i,className:a,children:o,disabled:s,type:c=`button`,...l},u){return(0,$.jsxs)(`button`,{ref:u,type:c,disabled:s||i,"aria-busy":i||void 0,className:dt(`inline-flex shrink-0 items-center justify-center rounded-md whitespace-nowrap select-none`,`transition-[background-color,border-color,color,filter,transform] duration-150 ease-snappy`,`active:scale-[0.98] disabled:pointer-events-none disabled:opacity-45`,ft[e],pt[t],r&&(t===`sm`?`w-7 px-0`:`w-8 px-0`),a),...l,children:[i?(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-3.5 animate-spin rounded-full border-[1.5px] border-current border-r-transparent`}):n?(0,$.jsx)(n,{"aria-hidden":!0,className:`size-3.5 shrink-0`,strokeWidth:1.75}):null,!r&&o]})});function ht({className:e,...t}){return(0,$.jsx)(`section`,{className:dt(`flex min-w-0 flex-col rounded-lg border border-line bg-panel`,e),...t})}function gt({title:e,id:t,meta:n,actions:r,className:i}){return(0,$.jsxs)(`header`,{className:dt(`flex min-h-10 flex-wrap items-center gap-x-3 gap-y-1 border-b border-line px-3.5 py-2`,i),children:[(0,$.jsx)(`h2`,{id:t,className:`text-[13px] font-medium text-fg`,children:e}),n&&(0,$.jsx)(`div`,{className:`text-[12px] text-muted`,children:n}),r&&(0,$.jsx)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:r})]})}function _t({title:e,description:t,actions:n}){return(0,$.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-6 gap-y-3 pb-4`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h1`,{className:`text-[17px] font-semibold tracking-tight text-fg`,children:e}),t&&(0,$.jsx)(`p`,{className:`mt-0.5 text-[13px] text-muted`,children:t})]}),n&&(0,$.jsx)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:n})]})}export{dt as a,u as c,mt as i,o as l,ht as n,D as o,gt as r,f as s,_t as t,c as u};
@@ -1,4 +0,0 @@
1
- import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s,u as c}from"./Panel-Du40pM7n.js";import{$ as l,D as u,I as d,O as f,Q as p,at as m,et as h,ft as g,it as _,n as v,nt as y,ot as b,p as x,rt as S,st as C,t as w,tt as T,yt as E}from"./Badge-CGY6DgGx.js";import{t as D}from"./arrow-up-goM9r-I9.js";import{t as O}from"./Callout-DauCk_cW.js";import{n as k,t as A}from"./task-errors-B2pgjUGN.js";import{t as j}from"./trash-BVojETtF.js";import{C as M,N,S as P,b as F,c as I,d as L,i as R,j as z,o as B,p as V,u as H,w as U,y as W}from"./index-BCi-Vuvh.js";import{n as G,r as K,t as q}from"./Field-OXMnT9Tb.js";var J={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};J.node;var Y=i(J),X=c(t(),1),Z=o();function Q({open:e,onClose:t,routes:n,defaultRoute:r}){return(0,Z.jsx)(I,{open:e,onClose:t,title:`Edit routes`,description:(0,Z.jsxs)(Z.Fragment,{children:[`Saved to the global `,(0,Z.jsx)(`span`,{className:`font-mono`,children:`~/.davecode/config.json`}),` and applied to the router immediately.`]}),width:`w-[min(680px,100vw)]`,children:e&&(0,Z.jsx)($,{routes:n,defaultRoute:r,onDone:t})})}function $({routes:t,defaultRoute:r,onDone:i}){let a=x(),o=u(),s=d(),c=a.data??[],[f,g]=(0,X.useState)(()=>S(t,r)),[v,b]=(0,X.useState)(!1),[C,w]=(0,X.useState)(null),E=(0,X.useMemo)(()=>m(f,c),[f,c]),D=p(f,t,r),k=(0,X.useMemo)(()=>{let e=new Map;for(let t of o.data??[]){if(t.owned_by===`davecode`)continue;let n=t.owned_by,r=`${n}/`,i=e.get(n)??[];i.push(t.id.startsWith(r)?t.id.slice(r.length):t.id),e.set(n,i)}return e},[o.data]),M=(e,t)=>g(n=>({...n,routes:n.routes.map(n=>n.key===e?t(n):n)})),P=(e,t,n)=>M(e,e=>({...e,targets:e.targets.map(e=>e.key===t?{...e,...n}:e)})),F=()=>g(e=>{let t=h(y(e.routes));return{routes:[...e.routes,t],defaultKey:e.defaultKey??t.key}}),I=e=>g(t=>{let n=t.routes.filter(t=>t.key!==e);return{routes:n,defaultKey:t.defaultKey===e?n[0]?.key??null:t.defaultKey}});return(0,Z.jsxs)(`form`,{onSubmit:async e=>{if(e.preventDefault(),b(!0),w(null),E.valid)try{let e=await s.mutateAsync(_(f));W({tone:`ok`,title:`Routes saved`,description:`${e.routes.length} route${e.routes.length===1?``:`s`}, default davecode/${e.defaultRoute}`}),e.shadowedByProject&&W({tone:`info`,title:`This project overrides routes`,description:`The project .davecode/config.json also sets routing and wins after a restart.`}),i()}catch(e){w(A(e))}},noValidate:!0,className:`flex flex-col gap-4`,children:[f.routes.length===0&&(0,Z.jsxs)(`p`,{className:`rounded-md border border-dashed border-line-strong px-3 py-6 text-center text-[12px] text-muted`,children:[`No routes. Clients can still call `,(0,Z.jsx)(`span`,{className:`font-mono`,children:`provider/model`}),` ids directly. Add a route to expose `,(0,Z.jsx)(`span`,{className:`font-mono`,children:`davecode/<name>`}),`.`]}),f.routes.map(t=>{let r=E.byRoute[t.key],i=f.defaultKey===t.key,a=v;return(0,Z.jsxs)(`section`,{"aria-label":`Route ${t.name||`unnamed`}`,className:e(`flex flex-col gap-3 rounded-lg border bg-raised p-3`,i?`border-accent/50`:`border-line`),children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(q,{label:`Name`,error:a?r?.name:null,className:`min-w-0 flex-1`,children:({id:e,describedBy:n,invalid:r})=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-[12px] text-muted`,children:`davecode/`}),(0,Z.jsx)(G,{id:e,value:t.name,onChange:e=>M(t.key,t=>({...t,name:e.target.value})),"aria-describedby":n,"aria-invalid":r||void 0,spellCheck:!1,autoCapitalize:`off`,className:`font-mono`})]})}),(0,Z.jsxs)(`label`,{className:`mt-6 flex shrink-0 cursor-pointer items-center gap-1.5 text-[12px] text-fg-2`,children:[(0,Z.jsx)(`input`,{type:`radio`,name:`default-route`,checked:i,onChange:()=>g(e=>({...e,defaultKey:t.key})),className:`size-3.5 accent-accent`}),`Default`]}),(0,Z.jsx)(n,{variant:`ghost`,size:`sm`,iconOnly:!0,icon:j,"aria-label":`Remove route ${t.name||`unnamed`}`,onClick:()=>I(t.key),className:`mt-6 text-err hover:bg-err-soft hover:text-err`})]}),(0,Z.jsx)(q,{label:`Description`,children:({id:e,describedBy:n})=>(0,Z.jsx)(G,{id:e,value:t.description,onChange:e=>M(t.key,t=>({...t,description:e.target.value})),"aria-describedby":n,placeholder:`When to use this route`})}),(0,Z.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`legend`,{className:`mb-1 text-[12px] font-medium text-fg-2`,children:[`Targets`,` `,(0,Z.jsx)(`span`,{className:`font-normal text-muted`,children:`tried in order, then fail over`})]}),a&&r?.targets&&(0,Z.jsx)(`p`,{role:`alert`,className:`text-[12px] text-err`,children:r.targets}),(0,Z.jsx)(`ol`,{className:`flex flex-col gap-2`,children:t.targets.map((e,n)=>(0,Z.jsx)(ee,{index:n,count:t.targets.length,target:e,accounts:c,models:k.get(e.provider)??[],error:a?r?.target[e.key]:void 0,onChange:n=>P(t.key,e.key,n),onMove:e=>M(t.key,t=>({...t,targets:l(t.targets,n,e)})),onRemove:()=>M(t.key,t=>({...t,targets:t.targets.filter(t=>t.key!==e.key)}))},e.key))}),(0,Z.jsx)(n,{size:`sm`,variant:`secondary`,icon:N,className:`self-start`,onClick:()=>M(t.key,e=>({...e,targets:[...e.targets,T(e.targets.at(-1)?.provider)]})),children:`Add target`})]})]},t.key)}),v&&E.defaultRoute&&(0,Z.jsx)(`p`,{role:`alert`,className:`text-[12px] text-err`,children:E.defaultRoute}),(0,Z.jsx)(n,{variant:`secondary`,icon:N,className:`self-start`,onClick:F,children:`Add route`}),C&&(0,Z.jsx)(O,{tone:`err`,title:`Could not save the routes`,children:C}),(0,Z.jsxs)(`div`,{className:`sticky -bottom-4 -mx-5 -mb-4 flex items-center justify-end gap-2 border-t border-line bg-panel px-5 py-3`,children:[!D&&(0,Z.jsx)(`span`,{className:`mr-auto text-[12px] text-muted`,children:`No changes`}),(0,Z.jsx)(n,{variant:`ghost`,onClick:i,children:`Cancel`}),(0,Z.jsx)(n,{type:`submit`,variant:`primary`,loading:s.isPending,disabled:!D,children:`Save routes`})]})]})}function ee({index:e,count:t,target:r,accounts:i,models:a,error:o,onChange:s,onMove:c,onRemove:l}){let u=`models-${r.key}`,d=i.filter(e=>e.provider===r.provider),f=r.accountId&&!i.some(e=>e.id===r.accountId);return(0,Z.jsxs)(`li`,{className:`flex items-start gap-2 rounded-md border border-line bg-panel p-2`,children:[(0,Z.jsx)(`span`,{className:`mt-1.5 flex size-6 shrink-0 items-center justify-center rounded-full border border-line-strong bg-raised font-mono text-[11px] text-fg-2`,children:e+1}),(0,Z.jsxs)(`div`,{className:`grid min-w-0 flex-1 grid-cols-1 gap-2 sm:grid-cols-2`,children:[(0,Z.jsx)(q,{label:`Provider`,children:({id:e})=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(V,{provider:r.provider,size:`sm`}),(0,Z.jsx)(K,{id:e,value:r.provider,onChange:e=>{let t=e.target.value;s({provider:t,...i.find(e=>e.id===r.accountId)?.provider===t?{}:{accountId:``}})},children:b.map(e=>(0,Z.jsx)(`option`,{value:e,children:C(e).label},e))})]})}),(0,Z.jsx)(q,{label:`Model`,error:o?.model,children:({id:e,describedBy:t,invalid:n})=>(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(G,{id:e,list:u,value:r.model,onChange:e=>s({model:e.target.value}),"aria-describedby":t,"aria-invalid":n||void 0,spellCheck:!1,autoCapitalize:`off`,placeholder:`claude-sonnet-5-5`,className:`font-mono`}),(0,Z.jsx)(`datalist`,{id:u,children:a.map(e=>(0,Z.jsx)(`option`,{value:e},e))})]})}),(0,Z.jsx)(q,{label:`Account`,error:o?.accountId,className:`sm:col-span-2`,children:({id:e,describedBy:t,invalid:n})=>(0,Z.jsxs)(K,{id:e,value:r.accountId,onChange:e=>s({accountId:e.target.value}),"aria-describedby":t,"aria-invalid":n||void 0,children:[(0,Z.jsx)(`option`,{value:``,children:`Balanced across matching accounts`}),f&&(0,Z.jsxs)(`option`,{value:r.accountId,children:[r.accountId,` (missing)`]}),d.map(e=>(0,Z.jsxs)(`option`,{value:e.id,children:[`Pinned to `,e.label,` (`,e.id,`)`]},e.id))]})})]}),(0,Z.jsxs)(`div`,{className:`mt-1 flex shrink-0 flex-col gap-0.5`,children:[(0,Z.jsx)(n,{size:`sm`,variant:`ghost`,iconOnly:!0,icon:D,"aria-label":`Move target ${e+1} up`,disabled:e===0,onClick:()=>c(e-1)}),(0,Z.jsx)(n,{size:`sm`,variant:`ghost`,iconOnly:!0,icon:Y,"aria-label":`Move target ${e+1} down`,disabled:e===t-1,onClick:()=>c(e+1)}),(0,Z.jsx)(n,{size:`sm`,variant:`ghost`,iconOnly:!0,icon:U,"aria-label":`Remove target ${e+1}`,onClick:l})]})]})}function te(e,t){return t.filter(t=>{if(e.accountId)return t.id===e.accountId;if(t.provider!==e.provider)return!1;let n=t.config.models;return!Array.isArray(n)||n.length===0||n.includes(e.model)})}function ne(){let e=f(),{params:t}=M(),i=t.get(`edit`)===`1`,o=x(),c=u(),l=E(),d=o.data??[],p=`${l.gatewayUrl||`http://127.0.0.1:4040`}/v1`,m=e.data?.defaultRoute??`auto`,h=(0,X.useMemo)(()=>{let e=c.data??[];return{total:e.length,routes:e.filter(e=>e.owned_by===`davecode`).length}},[c.data]),_=`curl ${p}/chat/completions \\
2
- -H "Content-Type: application/json" \\
3
- -H "Authorization: Bearer $DAVECODE_TOKEN" \\
4
- -d '{"model": "davecode/${m}", "messages": [{"role": "user", "content": "Hello"}]}'`;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(s,{title:`Routes`,description:(0,Z.jsxs)(Z.Fragment,{children:[`Exposed to clients as`,` `,(0,Z.jsx)(`code`,{className:`font-mono text-fg-2`,children:`davecode/<route>`}),`. Targets are tried in order; the router fails over down the list before the first byte.`]}),actions:(0,Z.jsxs)(Z.Fragment,{children:[c.data&&(0,Z.jsxs)(w,{mono:!0,children:[h.total,` models · `,h.routes,` routes on /v1/models`]}),(0,Z.jsx)(n,{variant:`primary`,icon:k,disabled:!e.data,onClick:()=>P(`edit`,`1`),children:`Edit routes`})]})}),e.isError&&(0,Z.jsx)(O,{tone:`err`,title:`Could not load routes`,children:g(e.error)}),e.isPending?(0,Z.jsx)(r,{children:(0,Z.jsx)(B,{rows:6})}):(e.data?.routes.length??0)===0?(0,Z.jsx)(r,{children:(0,Z.jsx)(R,{icon:z,title:`No routes configured`,description:`Until you add one, clients can call provider/model ids directly. Routes are saved to ~/.davecode/config.json.`,action:(0,Z.jsx)(n,{variant:`primary`,icon:N,onClick:()=>P(`edit`,`1`),children:`Add a route`})})}):(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:e.data?.routes.map(e=>(0,Z.jsxs)(r,{"aria-labelledby":`route-${e.name}`,children:[(0,Z.jsx)(a,{id:`route-${e.name}`,title:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-mono`,children:[`davecode/`,e.name,(0,Z.jsx)(H,{value:`davecode/${e.name}`,label:`Copy davecode/${e.name}`})]}),actions:e.name===m?(0,Z.jsx)(w,{tone:`accent`,children:`default`}):void 0}),e.description&&(0,Z.jsx)(`p`,{className:`px-3.5 pt-3 text-[12px] text-muted`,children:e.description}),(0,Z.jsx)(`ol`,{className:`flex flex-col p-3.5`,children:e.targets.map((t,n)=>{let r=te(t,d),i=r.filter(e=>e.enabled&&e.status!==`disabled`);return(0,Z.jsxs)(`li`,{className:`relative flex gap-3 pb-3 last:pb-0`,children:[n<e.targets.length-1&&(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`absolute top-7 bottom-0 left-[11px] w-px bg-line-strong`}),(0,Z.jsx)(`span`,{className:`z-10 flex size-6 shrink-0 items-center justify-center rounded-full border border-line-strong bg-raised font-mono text-[11px] text-fg-2`,children:n+1}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 rounded-md border border-line bg-raised px-2.5 py-2`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(V,{provider:t.provider,size:`sm`}),(0,Z.jsxs)(`span`,{className:`truncate font-mono text-[12px] text-fg`,children:[t.provider,`/`,t.model]}),i.length===0&&(0,Z.jsx)(w,{tone:`err`,className:`ml-auto`,children:`no usable account`})]}),(0,Z.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-[12px] text-muted`,children:[(0,Z.jsx)(`span`,{children:t.accountId?`pinned to`:`balanced · ${C(t.provider).label}`}),r.length===0&&(0,Z.jsx)(`span`,{className:`text-faint`,children:`no matching account`}),r.map(e=>(0,Z.jsxs)(F,{to:`/accounts?account=${encodeURIComponent(e.id)}`,className:`inline-flex items-center gap-1.5 text-fg-2 hover:text-fg`,children:[(0,Z.jsx)(v,{tone:L[e.status]}),e.label,(0,Z.jsxs)(`span`,{className:`sr-only`,children:[`(`,e.status,`)`]})]},e.id))]})]})]},`${t.provider}/${t.model}/${t.accountId??``}`)})})]},e.name))}),(0,Z.jsx)(Q,{open:i&&!!e.data,onClose:()=>P(`edit`,null),routes:e.data?.routes??[],defaultRoute:m}),(0,Z.jsxs)(r,{"aria-labelledby":`usage-title`,children:[(0,Z.jsx)(a,{id:`usage-title`,title:`Use a route`,meta:`any OpenAI-compatible client`,actions:(0,Z.jsx)(H,{value:_,label:`Copy snippet`})}),(0,Z.jsx)(`pre`,{className:`overflow-x-auto p-3.5 font-mono text-[12px] leading-5 text-fg-2`,children:_})]})]})}export{ne as RoutesPage};
@@ -1 +0,0 @@
1
- import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s,u as c}from"./Panel-Du40pM7n.js";import{A as l,B as u,N as d,V as f,ft as p,j as m,o as h,pt as g,r as _,t as v}from"./Badge-CGY6DgGx.js";import{t as y}from"./Callout-DauCk_cW.js";import{A as b,F as x,H as S,P as C,V as w,_ as T,a as E,b as D,h as O,k,l as A,s as ee,y as j,z as M}from"./index-BCi-Vuvh.js";var N={name:`arrow-down-to-line`,size:24,node:[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]};N.node;var P=i(N),F={name:`eraser`,size:24,node:[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]};F.node;var I=i(F),L={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};L.node;var R=i(L),z={name:`text-wrap`,size:24,node:[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]],aliases:[`wrap-text`]};z.node;var B=i(z),V=c(t(),1),H=o(),U=[`debug`,`info`,`warn`,`error`],W={debug:`text-muted`,info:`text-info`,warn:`text-warn`,error:`text-err`};function G(e){return e.level===`error`?`text-err`:e.level===`warn`?`text-warn`:e.message.startsWith(`$ `)?`text-fg`:e.message.startsWith(`✓`)?`text-ok`:e.message.startsWith(`→`)?`text-info`:e.level===`debug`?`text-muted`:`text-fg-2`}function K({lines:t,onClear:n,className:r}){let[i,a]=(0,V.useState)(()=>new Set([`info`,`warn`,`error`])),[o,s]=(0,V.useState)(`runner`),[c,l]=(0,V.useState)(``),[u,d]=(0,V.useState)(!0),[f,p]=(0,V.useState)(!0),m=(0,V.useRef)(null),h=(0,V.useMemo)(()=>{let e={debug:0,info:0,warn:0,error:0};for(let n of t)(o===`all`||n.source===`runner`)&&(e[n.level]+=1);return e},[t,o]),g=c.trim().toLowerCase(),v=(0,V.useMemo)(()=>t.filter(e=>i.has(e.level)&&(o===`all`||e.source===`runner`)&&(!g||e.message.toLowerCase().includes(g)||(e.taskId??e.scope??``).includes(g))),[t,i,o,g]);(0,V.useLayoutEffect)(()=>{let e=m.current;e&&f&&(e.scrollTop=e.scrollHeight)},[v,f]),(0,V.useEffect)(()=>{let e=m.current;if(!e)return;let t=()=>{let t=e.scrollHeight-e.scrollTop-e.clientHeight<24;p(t)};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},[]);let y=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,H.jsxs)(`section`,{"aria-label":`Runner log`,className:e(`term flex min-h-0 flex-col overflow-hidden rounded-lg border border-line bg-term`,r),children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-line px-3 py-2`,children:[(0,H.jsxs)(`fieldset`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`legend`,{className:`sr-only`,children:`Log levels`}),U.map(t=>(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":i.has(t),onClick:()=>y(t),className:e(`inline-flex h-6 items-center gap-1.5 rounded border px-2 font-mono text-2xs uppercase transition-colors duration-150`,i.has(t)?`border-line-strong bg-hover text-fg`:`border-transparent text-faint hover:text-muted`),children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:e(`size-1.5 rounded-full bg-current`,i.has(t)&&W[t])}),t,(0,H.jsx)(`span`,{className:`tnum text-muted`,children:h[t]})]},t))]}),(0,H.jsx)(`span`,{"aria-hidden":!0,className:`h-4 w-px bg-line-strong`}),(0,H.jsxs)(`fieldset`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`legend`,{className:`sr-only`,children:`Log source`}),[`runner`,`all`].map(t=>(0,H.jsx)(`button`,{type:`button`,"aria-pressed":o===t,onClick:()=>s(t),className:e(`h-6 rounded px-2 text-[12px] transition-colors duration-150`,o===t?`bg-hover text-fg`:`text-muted hover:text-fg-2`),children:t===`runner`?`Runner`:`All logs`},t))]}),(0,H.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(b,{"aria-hidden":!0,className:`pointer-events-none absolute top-1/2 left-2 size-3 -translate-y-1/2 text-muted`,strokeWidth:1.75}),(0,H.jsx)(`input`,{type:`search`,"aria-label":`Filter log lines`,placeholder:`Filter`,value:c,onChange:e=>l(e.target.value),className:`h-6 w-32 rounded border border-line-strong bg-transparent pr-2 pl-6 font-mono text-[11px] text-fg placeholder:text-faint focus-visible:border-accent focus-visible:outline-none`,"data-filter-input":!0})]}),(0,H.jsx)(`button`,{type:`button`,"aria-pressed":u,onClick:()=>d(e=>!e),"aria-label":`Wrap long lines`,title:`Wrap long lines`,className:e(`inline-flex size-6 items-center justify-center rounded`,u?`bg-hover text-fg`:`text-muted hover:text-fg`),children:(0,H.jsx)(B,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:1.75})}),(0,H.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`Clear console`,title:`Clear console`,className:`inline-flex size-6 items-center justify-center rounded text-muted hover:bg-hover hover:text-fg`,children:(0,H.jsx)(I,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:1.75})})]})]}),(0,H.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[(0,H.jsx)(`div`,{ref:m,role:`log`,"aria-live":`off`,"aria-label":`Log lines`,tabIndex:0,className:`absolute inset-0 overflow-auto py-2 font-mono text-[12px] leading-[1.6]`,children:v.length===0?(0,H.jsx)(`p`,{className:`px-3 text-muted`,children:t.length===0?`Waiting for runner output…`:`No lines match the filters.`}):v.map(t=>(0,H.jsxs)(`div`,{className:e(`flex gap-3 px-3 hover:bg-hover/60`,u?`whitespace-pre-wrap break-words`:`whitespace-pre`,t.level===`error`&&`bg-err/[0.06]`),children:[(0,H.jsx)(`span`,{className:`tnum shrink-0 text-faint select-none`,children:_(t.ts,!0)}),(0,H.jsx)(`span`,{className:e(`w-10 shrink-0 uppercase select-none`,W[t.level]),children:t.level}),o===`all`&&(0,H.jsx)(`span`,{className:`w-16 shrink-0 truncate text-muted`,children:t.source===`runner`?`runner`:t.scope}),(0,H.jsx)(`span`,{className:e(`min-w-0`,G(t)),children:t.message})]},t.key))}),!f&&(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{let e=m.current;e&&(e.scrollTop=e.scrollHeight),p(!0)},className:`absolute right-4 bottom-3 inline-flex animate-pop-in items-center gap-1.5 rounded-md border border-line-strong bg-raised px-2.5 py-1 text-[12px] text-fg shadow-overlay`,children:[(0,H.jsx)(P,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:1.75}),`Jump to latest`]})]}),(0,H.jsx)(`p`,{className:`sr-only`,"aria-live":`polite`,children:f?``:`Autoscroll paused.`})]})}var q=[`idle`,`selecting`,`preparing`,`implementing`,`validating`,`repairing`,`merging`],J={idle:`Waiting for work`,selecting:`Picking the next unblocked task`,preparing:`Creating the task branch and loading the brain`,implementing:`Writing code through the gateway`,validating:`Running lint, typecheck and tests`,repairing:`Feeding failures back for another attempt`,merging:`Merging the task branch`,paused:`Paused; resumes at the same step`,stopped:`Stopped`,error:`Stopped on an error`},Y={idle:`neutral`,selecting:`info`,preparing:`info`,implementing:`info`,validating:`info`,repairing:`warn`,merging:`ok`,paused:`warn`,stopped:`neutral`,error:`err`},X=3;function Z(){let t=l(),i=d(),o=f(),{live:c}=u(),_=m(),b=T(1e3),[N,P]=(0,V.useState)(!1),F=g(t.error)&&t.error.status===501,I=F?void 0:t.data,L=I?.state,z=i.data?.graph.tasks.find(e=>e.id===I?.taskId),B=(0,V.useMemo)(()=>{if(!F){if(L&&q.includes(L))return L;for(let e=o.events.length-1;e>=0;e--){let t=o.events[e];if(t?.type===`runner.status`&&q.includes(t.status.state))return t.status.state}}},[F,L,o.events]),U=async e=>{try{let t=await _.mutateAsync(e);j({tone:`info`,title:`Runner ${t.state}`,description:J[t.state]})}catch(t){j({tone:`err`,title:`Could not ${e} the runner`,description:g(t)&&t.code===`runner_unavailable`?`This gateway was started without the autonomous runner.`:p(t)})}},W=L!==void 0&&![`idle`,`paused`,`stopped`,`error`].includes(L),G=!F&&(L===`idle`||L===`paused`||L===`stopped`||L===`error`),Z=I?.startedAt?(b-Date.parse(I.startedAt))/1e3:void 0,Q=I?.repairCycle??0,te=i.data?.graph.tasks.filter(e=>e.status===`SUCCESS`).length??0,$=i.data?.graph.tasks.length??0;return(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsx)(s,{title:`Runner`,description:`The autonomous engineer: one task at a time, on its own branch, merged only when checks pass.`,actions:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(n,{variant:`primary`,icon:C,disabled:!G||_.isPending,loading:_.isPending&&_.variables===`start`,onClick:()=>U(`start`),children:L===`paused`?`Resume`:`Start`}),(0,H.jsx)(n,{icon:x,disabled:F||!W||_.isPending,loading:_.isPending&&_.variables===`pause`,onClick:()=>U(`pause`),children:`Pause`}),(0,H.jsx)(n,{variant:`danger`,icon:k,disabled:F||L===`stopped`||L===`idle`||L===void 0||_.isPending,onClick:()=>P(!0),children:`Stop`})]})}),F&&(0,H.jsxs)(y,{tone:`warn`,title:`Runner unavailable`,children:[(0,H.jsxs)(`p`,{children:[`This gateway answered `,(0,H.jsx)(`code`,{className:`font-mono text-fg`,children:`501 runner_unavailable`}),`: it is running without the autonomous engine. Routing and the dashboard keep working; start the runner from a project directory to drive the task graph:`]}),(0,H.jsx)(A,{command:`davecode run`,className:`mt-2 max-w-sm`})]}),t.isError&&!F&&(0,H.jsx)(y,{tone:`err`,title:`Could not read the runner status`,children:p(t.error)}),(0,H.jsxs)(r,{"aria-labelledby":`machine-title`,children:[(0,H.jsx)(a,{id:`machine-title`,title:`State machine`,meta:L?J[L]:void 0,actions:L&&(0,H.jsx)(v,{tone:Y[L],dot:!0,pulse:W,children:L})}),(0,H.jsxs)(`div`,{className:`p-4`,children:[t.isPending?(0,H.jsx)(E,{className:`h-16 w-full`}):(0,H.jsx)(`ol`,{className:`flex flex-wrap items-center gap-y-3`,"aria-label":`Runner pipeline`,children:q.map((t,n)=>{let r=t===B,i=r&&W,a=B?q.indexOf(B):-1,o=a>0&&n>0&&n<a&&(t!==`repairing`||Q!==0);return(0,H.jsxs)(`li`,{className:`flex items-center`,"aria-current":r?`step`:void 0,children:[n>0&&(0,H.jsx)(`span`,{"aria-hidden":!0,className:e(`mx-1.5 h-px w-4 sm:w-6`,o||r?`bg-fg-2/50`:`bg-line-strong`)}),(0,H.jsxs)(`span`,{className:e(`inline-flex h-7 items-center gap-1.5 rounded-full border px-3 font-mono text-[12px] transition-colors duration-200`,r?L===`paused`||L===`stopped`||t===`repairing`?`border-warn/50 bg-warn-soft text-warn`:`border-accent/60 bg-accent-soft text-accent-text shadow-[0_0_0_3px_var(--dc-accent-soft)]`:o?`border-line-strong text-fg-2`:`border-line text-faint`),children:[o&&(0,H.jsx)(w,{"aria-hidden":!0,className:`size-3`,strokeWidth:2.25}),t===`repairing`&&!o&&(0,H.jsx)(R,{"aria-hidden":!0,className:`size-3`,strokeWidth:2}),i&&(0,H.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 animate-pulse-dot rounded-full bg-current`}),t,r&&(0,H.jsxs)(`span`,{className:`sr-only`,children:[` (current`,L===t?``:`, ${L}`,`)`]})]})]},t)})}),(0,H.jsxs)(`p`,{className:`mt-3 text-[12px] text-muted`,children:[(0,H.jsx)(R,{"aria-hidden":!0,className:`mr-1 inline size-3 align-[-2px]`,strokeWidth:2}),`Failed validation loops `,(0,H.jsx)(`span`,{className:`font-mono`,children:`repairing → implementing`}),` up to `,X,` times; then the task is marked FAILED and the runner moves on.`]})]})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 xl:grid-cols-[minmax(0,1fr)_340px]`,children:[(0,H.jsxs)(r,{"aria-labelledby":`current-title`,className:`xl:order-2 xl:self-start`,children:[(0,H.jsx)(a,{id:`current-title`,title:`Current task`,meta:$?`${te}/${$} tasks done`:void 0}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[t.isPending?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(E,{className:`h-4 w-40`}),(0,H.jsx)(E,{className:`h-4 w-56`})]}):z?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(D,{to:`/tasks?task=${encodeURIComponent(z.id)}`,className:`font-mono text-2xs text-muted hover:text-fg`,children:z.id}),(0,H.jsx)(`p`,{className:`text-[13px] leading-5 font-medium text-fg`,children:z.title})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,H.jsx)(O,{status:z.status}),z.attempts!==void 0&&(0,H.jsxs)(v,{mono:!0,children:[`attempt `,z.attempts]})]}),(0,H.jsxs)(`p`,{className:`flex items-center gap-1.5 font-mono text-[12px] text-fg-2`,children:[(0,H.jsx)(M,{"aria-hidden":!0,className:`size-3.5 text-muted`,strokeWidth:1.75}),z.branch??`davecode/task-${z.id}`]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[12px]`,children:[(0,H.jsx)(`span`,{className:`text-muted`,children:`Repair cycle`}),(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`flex gap-1`,"aria-hidden":!0,children:Array.from({length:X},(t,n)=>(0,H.jsx)(`span`,{className:e(`h-1.5 w-5 rounded-full`,n<Q?`bg-warn`:`bg-track`)},n))}),(0,H.jsxs)(`span`,{className:`tnum font-mono text-fg`,children:[Q,`/`,X]})]})]}),Z!==void 0&&(0,H.jsxs)(`div`,{className:`flex items-center justify-between text-[12px]`,children:[(0,H.jsx)(`span`,{className:`text-muted`,children:`Running for`}),(0,H.jsx)(`span`,{className:`tnum font-mono text-fg`,children:h(Z)})]})]}):(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5 text-[12px] text-muted`,children:[(0,H.jsx)(S,{"aria-hidden":!0,className:`size-4`,strokeWidth:1.5}),F?`No runner attached to this gateway.`:`No task in progress.`]}),I?.lastError&&(0,H.jsx)(`p`,{className:`rounded-md border border-err/30 bg-err-soft p-2 font-mono text-2xs text-err`,children:I.lastError})]})]}),(0,H.jsx)(K,{lines:o.logs,onClear:()=>c.clearLogs(),className:`h-[480px] xl:order-1`})]}),(0,H.jsx)(ee,{open:N,onClose:()=>P(!1),title:`Stop the runner?`,description:`The current step is abandoned. Work done so far stays on the task branch.`,footer:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(n,{variant:`ghost`,onClick:()=>P(!1),children:`Keep running`}),(0,H.jsx)(n,{variant:`danger`,icon:k,onClick:()=>{P(!1),U(`stop`)},children:`Stop runner`})]}),children:z&&(0,H.jsx)(`p`,{className:`font-mono text-[12px] text-muted`,children:z.id})})]})}export{Z as Runner};
@@ -1 +0,0 @@
1
- import{c as e,i as t,n,o as r,r as i,s as a,t as o,u as s}from"./Panel-Du40pM7n.js";import{B as c,E as l,dt as u,ft as d,gt as f,o as p,t as m,vt as h,yt as g}from"./Badge-CGY6DgGx.js";import{i as _,n as v}from"./forms-DtpfI65-.js";import{t as y}from"./Callout-DauCk_cW.js";import{I as b,L as x,O as S,U as C,t as w,v as T,y as E}from"./index-BCi-Vuvh.js";import{n as D,t as O}from"./Field-OXMnT9Tb.js";var k={name:`external-link`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]};k.node;var A=r(k),j={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};j.node;var M=r(j),N={name:`plug-zap`,size:24,node:[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]],aliases:[`plug-zap-2`]};N.node;var P=r(N),F=s(e(),1),I=a(),L=`https://github.com/DMRLZZ/DaveCode`;function R(){let e=g(),r=l(),{connection:a}=c(),[s,k]=(0,F.useState)(e.gatewayUrl),[j,N]=(0,F.useState)(e.token),[R,z]=(0,F.useState)(null),[B,V]=(0,F.useState)(!1),[H,U]=(0,F.useState)(null),W=()=>{let e=s.trim();return e&&!_(e)?`Enter an http(s) origin such as http://127.0.0.1:4040, or leave empty.`:null},G=e=>{e.preventDefault();let t=W();z(t),!t&&(h({gatewayUrl:s.trim().replace(/\/+$/,``),token:j.trim()}),E({tone:`ok`,title:`Connection settings saved`,description:`Stored in this browser only.`}))},K=async()=>{let e=W();if(z(e),!e){V(!0),U(null);try{let e=await u({baseUrl:s.trim(),token:j.trim()}).health();U({ok:!0,text:`Connected: DaveCode ${e.version}, ${e.status}, up ${p(e.uptimeSec)}.`})}catch(e){U({ok:!1,text:d(e)})}finally{V(!1)}}},q=f();return(0,I.jsxs)(`div`,{className:`flex max-w-3xl flex-col gap-4`,children:[(0,I.jsx)(o,{title:`Settings`,description:`Preferences are stored in this browser's localStorage.`}),(0,I.jsxs)(n,{"aria-labelledby":`conn-title`,children:[(0,I.jsx)(i,{id:`conn-title`,title:`Gateway connection`}),(0,I.jsxs)(`form`,{onSubmit:G,noValidate:!0,className:`flex flex-col gap-4 p-4`,children:[(0,I.jsx)(O,{label:`Gateway URL`,error:R,hint:`Leave empty when the dashboard is served by the gateway or the Vite dev proxy (same origin).`,children:({id:e,describedBy:t,invalid:n})=>(0,I.jsx)(D,{id:e,type:`url`,value:s,placeholder:`same origin`,onChange:e=>k(e.target.value),"aria-describedby":t,"aria-invalid":n||void 0,className:`font-mono`})}),(0,I.jsx)(O,{label:`Bearer token`,hint:`Needed when server.authToken is set. Sent as Authorization: Bearer, and as ?token= for the event stream.`,children:({id:e,describedBy:t})=>(0,I.jsx)(v,{id:e,value:j,onChange:N,placeholder:`not set`,describedBy:t})}),H&&(0,I.jsx)(y,{tone:H.ok?`info`:`err`,title:H.ok?`Gateway reachable`:`Connection failed`,children:H.text}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(t,{type:`submit`,variant:`primary`,children:`Save`}),(0,I.jsx)(t,{icon:P,onClick:K,loading:B,children:`Test connection`}),a.unauthorized&&(0,I.jsx)(m,{tone:`err`,children:`gateway returned 401`})]})]})]}),(0,I.jsxs)(n,{"aria-labelledby":`data-title`,children:[(0,I.jsx)(i,{id:`data-title`,title:`Data source`}),(0,I.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,I.jsx)(w,{label:`Data source`,value:e.dataMode,onChange:e=>h({dataMode:e}),options:[{value:`auto`,label:`Auto`},{value:`live`,label:`Live only`},{value:`mock`,label:`Mock data`}]}),(0,I.jsxs)(`p`,{className:`text-[12px] leading-5 text-muted`,children:[(0,I.jsx)(`strong`,{className:`font-medium text-fg-2`,children:`Auto`}),` uses the gateway and falls back to simulated data when it is unreachable, re-checking every 15 s.`,` `,(0,I.jsx)(`strong`,{className:`font-medium text-fg-2`,children:`Mock data`}),` always simulates a busy gateway, handy for demos and screenshots.`]}),q&&(0,I.jsxs)(y,{tone:`info`,children:[`Mock mode is currently forced by `,(0,I.jsx)(`code`,{className:`font-mono`,children:`?mock=1`}),` or`,` `,(0,I.jsx)(`code`,{className:`font-mono`,children:`VITE_DAVECODE_MOCK=1`}),`; this setting applies once that is removed.`]})]})]}),(0,I.jsxs)(n,{"aria-labelledby":`look-title`,children:[(0,I.jsx)(i,{id:`look-title`,title:`Appearance`}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 p-4`,children:[(0,I.jsx)(w,{label:`Theme`,value:e.theme,onChange:e=>h({theme:e}),options:[{value:`dark`,label:`Dark`,icon:b},{value:`light`,label:`Light`,icon:S},{value:`system`,label:`System`,icon:M}]}),(0,I.jsx)(t,{variant:`ghost`,icon:x,onClick:T.openHelp,children:`Keyboard shortcuts`})]})]}),(0,I.jsxs)(n,{"aria-labelledby":`about-title`,children:[(0,I.jsx)(i,{id:`about-title`,title:`About`}),(0,I.jsxs)(`div`,{className:`flex flex-col gap-3 p-4 text-[13px]`,children:[(0,I.jsxs)(`dl`,{className:`grid grid-cols-[120px_1fr] gap-y-1.5`,children:[(0,I.jsx)(`dt`,{className:`text-muted`,children:`Gateway`}),(0,I.jsx)(`dd`,{className:`font-mono text-fg-2`,children:r.data?`v${r.data.version} · ${r.data.status}`:a.mode===`probing`?`checking…`:`unreachable`}),(0,I.jsx)(`dt`,{className:`text-muted`,children:`Data`}),(0,I.jsx)(`dd`,{className:`text-fg-2`,children:a.mode===`mock`?`Simulated (mock mode)`:`Live gateway`}),(0,I.jsx)(`dt`,{className:`text-muted`,children:`Experimental`}),(0,I.jsxs)(`dd`,{className:`flex flex-wrap gap-1.5`,children:[(0,I.jsxs)(m,{tone:r.data?.experimental.geminiWeb?`warn`:`neutral`,mono:!0,children:[`geminiWeb `,r.data?.experimental.geminiWeb?`on`:`off`]}),(0,I.jsxs)(m,{tone:r.data?.experimental.multiAccountRotation?`warn`:`neutral`,mono:!0,children:[`multiAccountRotation `,r.data?.experimental.multiAccountRotation?`on`:`off`]})]})]}),(0,I.jsx)(`ul`,{className:`flex flex-wrap gap-2`,children:[[`README`,`${L}#readme`],[`Architecture`,`${L}/blob/main/docs/ARCHITECTURE.md`],[`HTTP API`,`${L}/blob/main/docs/API.md`]].map(([e,t])=>(0,I.jsx)(`li`,{children:(0,I.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-line px-2.5 text-[12px] text-fg-2 transition-colors duration-150 hover:border-line-strong hover:text-fg`,children:[(0,I.jsx)(C,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:1.75}),e,(0,I.jsx)(A,{"aria-hidden":!0,className:`size-3 text-muted`,strokeWidth:1.75}),(0,I.jsx)(`span`,{className:`sr-only`,children:`(opens in a new tab)`})]})},e))})]})]})]})}export{R as Settings};
@@ -1 +0,0 @@
1
- import{a as e,o as t,s as n}from"./Panel-Du40pM7n.js";var r={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};r.node;var i=t(r),a=n();function o({checked:t,onChange:n,label:r,disabled:i,className:o}){return(0,a.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"aria-label":r,disabled:i,onClick:e=>{e.stopPropagation(),n(!t)},className:e(`relative inline-flex h-[18px] w-8 shrink-0 items-center rounded-full border transition-colors duration-150 ease-snappy`,t?`border-accent bg-accent`:`border-line-strong bg-track`,`disabled:cursor-not-allowed disabled:opacity-45`,o),children:(0,a.jsx)(`span`,{"aria-hidden":!0,className:e(`inline-block size-3 rounded-full shadow-sm transition-transform duration-150 ease-snappy`,t?`translate-x-[15px] bg-accent-fg`:`translate-x-[2px] bg-fg-2`)})})}export{i as n,o as t};
@@ -1,2 +0,0 @@
1
- import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s,u as c}from"./Panel-Du40pM7n.js";import{G as l,H as u,J as d,K as f,L as p,N as m,S as h,U as g,W as _,X as v,Y as y,Z as b,b as x,d as S,ft as C,k as w,m as T,q as E,t as D}from"./Badge-CGY6DgGx.js";import{n as O,t as k}from"./Markdown-Xhao3sgL.js";import{t as A}from"./Callout-DauCk_cW.js";import{n as ee,t as j}from"./task-errors-B2pgjUGN.js";import{t as M}from"./trash-BVojETtF.js";import{A as te,B as ne,C as re,N,P as ie,S as P,a as ae,c as oe,g as F,h as I,i as se,m as L,o as ce,s as le,t as R,u as ue,w as de,y as z,z as B}from"./index-BCi-Vuvh.js";import{i as V,n as H,t as U}from"./Field-OXMnT9Tb.js";var W={name:`circle-dashed`,size:24,node:[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]};W.node;var fe=i(W),G={name:`kanban`,size:24,node:[[`path`,{d:`M5 3v14`,key:`9nsxs2`}],[`path`,{d:`M12 3v8`,key:`1h2ygw`}],[`path`,{d:`M19 3v18`,key:`1sk56x`}]]};G.node;var pe=i(G),K={name:`list`,size:24,node:[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]};K.node;var me=i(K),q={name:`network`,size:24,node:[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]};q.node;var he=i(q),J=c(t(),1),ge={nodeWidth:220,nodeHeight:60,gapX:64,gapY:16,padding:16,sweeps:4,direction:`LR`};function Y(e,t={}){let n={...ge,...t},r=new Map(e.map(e=>[e.id,e])),i=[],a=[],o=new Map;for(let t of e){let e=[];for(let n of t.dependsOn)r.has(n)?e.push(n):i.push({task:t.id,dependsOn:n});o.set(t.id,e)}let s=new Map,c=new Set,l=e=>{let t=s.get(e);if(t!==void 0)return t;c.add(e);let n=0,r=[];for(let t of o.get(e)??[])c.has(t)?a.push({from:t,to:e}):(r.push(t),n=Math.max(n,l(t)+1));return o.set(e,r),c.delete(e),s.set(e,n),n};for(let t of e)l(t.id);let u=e.length?Math.max(...s.values())+1:0,d=Array.from({length:u},()=>[]),f=[...e].sort((e,t)=>(t.priority??0)-(e.priority??0)||e.id.localeCompare(t.id));for(let e of f)d[s.get(e.id)??0]?.push(e.id);let p=new Map;for(let[e,t]of o)for(let n of t)p.set(n,[...p.get(n)??[],e]);let m=new Map,h=()=>{for(let e of d)e.forEach((e,t)=>{m.set(e,t)})};h();let g=(e,t)=>{let n=(t??[]).map(e=>m.get(e)).filter(e=>e!==void 0);return n.length?n.reduce((e,t)=>e+t,0)/n.length:m.get(e)??0};for(let e=0;e<n.sweeps;e++){for(let e=1;e<d.length;e++){let t=d[e];t&&(t.sort((e,t)=>g(e,o.get(e))-g(t,o.get(t))),h())}for(let e=d.length-2;e>=0;e--){let t=d[e];t&&(t.sort((e,t)=>g(e,p.get(e))-g(t,p.get(t))),h())}}let _=n.direction===`TB`,v=Math.max(0,...d.map(e=>e.length)),y=_?n.nodeWidth:n.nodeHeight,b=_?n.gapX:n.gapY,x=_?n.nodeHeight:n.nodeWidth,S=_?n.gapY:n.gapX,C=v*y+Math.max(0,v-1)*b,w=u*x+Math.max(0,u-1)*S,T=n.padding*2+(_?C:w),E=n.padding*2+(_?w:C),D=[],O=new Map;d.forEach((e,t)=>{let r=e.length*y+Math.max(0,e.length-1)*b,i=n.padding+(C-r)/2;e.forEach((e,r)=>{let a=n.padding+t*(x+S),o=i+r*(y+b),s=_?o:a,c=_?a:o;O.set(e,{x:s,y:c}),D.push({id:e,layer:t,order:r,x:s,y:c})})});let k=[];for(let t of e){let e=O.get(t.id);if(e)for(let r of o.get(t.id)??[]){let i=O.get(r);if(!i)continue;let a;if(_){let t=i.x+n.nodeWidth/2,r=i.y+n.nodeHeight,o=e.x+n.nodeWidth/2,s=e.y,c=Math.max(20,(s-r)/2);a=`M${t},${r} C${t},${r+c} ${o},${s-c} ${o},${s}`}else{let t=i.x+n.nodeWidth,r=i.y+n.nodeHeight/2,o=e.x,s=e.y+n.nodeHeight/2,c=Math.max(24,(o-t)/2);a=`M${t},${r} C${t+c},${r} ${o-c},${s} ${o},${s}`}k.push({from:r,to:t.id,path:a})}}return{nodes:D,edges:k,width:T,height:E,layers:u,missing:i,cycleEdges:a}}function _e(e){let t=new Map(e.map(e=>[e.id,e])),n=new Map,r=new Set,i=e=>{let a=n.get(e);if(a)return a;let o=t.get(e);if(!o)return`waiting`;let s={SUCCESS:`done`,IN_PROGRESS:`running`,FAILED:`failed`,PENDING:null}[o.status];if(!s){if(r.has(e))return`waiting`;r.add(e);let n=o.dependsOn.filter(e=>t.has(e)).map(i);r.delete(e),s=n.some(e=>e===`failed`||e===`blocked`)?`blocked`:n.every(e=>e===`done`)?`ready`:`waiting`}return n.set(e,s),s};for(let t of e)i(t.id);return n}function ve(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Map;for(let t of e)for(let e of t.dependsOn)r.set(e,[...r.get(e)??[],t.id]);let i=(e,t)=>{let n=new Set,r=[...t(e)];for(;r.length;){let e=r.pop();e===void 0||n.has(e)||(n.add(e),r.push(...t(e)))}return n};return{up:i(t,e=>n.get(e)?.dependsOn??[]),down:i(t,e=>r.get(e)??[])}}var X=o();function ye({task:e,tasks:t,readiness:r,onSelect:i,onClose:a,onEdit:o}){let s=p(),c=h(),l=w(),[u,d]=(0,J.useState)(!1),[f,m]=(0,J.useState)(null),g=(t,n)=>s.mutate({id:e.id,patch:{status:t}},{onSuccess:()=>z({tone:`ok`,title:n,description:e.id}),onError:e=>z({tone:`err`,title:`Could not ${n.toLowerCase()}`,description:j(e)})}),_=()=>l.mutate(e.id,{onSuccess:()=>z({tone:`info`,title:`Runner started`,description:e.id}),onError:e=>z({tone:`err`,title:`Could not start the runner`,description:j(e)})}),v=()=>c.mutate(e.id,{onSuccess:()=>{z({tone:`ok`,title:`Task deleted`,description:e.id}),d(!1),a()},onError:e=>m(j(e))}),b=new Map(t.map(e=>[e.id,e])),x=t.filter(t=>t.dependsOn.includes(e.id)),C=e.status===`SUCCESS`;return(0,X.jsxs)(`article`,{"aria-labelledby":`task-title`,className:`flex flex-col gap-4 p-4`,children:[(0,X.jsxs)(`header`,{className:`flex items-start gap-2`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`p`,{className:`flex items-center gap-1 font-mono text-2xs text-muted`,children:[e.id,(0,X.jsx)(ue,{value:e.id,label:`Copy task id`,className:`size-5`})]}),(0,X.jsx)(`h3`,{id:`task-title`,className:`mt-0.5 text-[15px] leading-5 font-semibold tracking-tight text-fg`,children:e.title})]}),(0,X.jsx)(`button`,{type:`button`,onClick:a,"aria-label":`Close task details`,className:`-mr-1 inline-flex size-7 items-center justify-center rounded-md text-muted hover:bg-hover hover:text-fg`,children:(0,X.jsx)(de,{"aria-hidden":!0,className:`size-4`,strokeWidth:1.75})})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(I,{status:e.status}),r===`ready`&&(0,X.jsx)(D,{tone:`ok`,children:`ready to run`}),r===`blocked`&&(0,X.jsx)(D,{tone:`err`,children:`blocked by a failed dependency`}),e.priority!==void 0&&(0,X.jsxs)(D,{mono:!0,children:[`priority `,e.priority]}),e.attempts!==void 0&&(0,X.jsxs)(D,{mono:!0,children:[`attempt `,e.attempts]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[r===`ready`&&(0,X.jsx)(n,{size:`sm`,variant:`primary`,icon:ie,loading:l.isPending,onClick:_,children:`Run now`}),y(e.status).map(e=>(0,X.jsx)(n,{size:`sm`,variant:e.variant,disabled:s.isPending,onClick:()=>g(e.to,e.label),children:e.label},e.to)),(0,X.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5`,children:[(0,X.jsx)(n,{size:`sm`,variant:`ghost`,icon:ee,onClick:o,children:`Edit`}),(0,X.jsx)(n,{size:`sm`,variant:`ghost`,iconOnly:!0,icon:M,"aria-label":`Delete task ${e.id}`,onClick:()=>{m(null),d(!0)},className:`text-err hover:bg-err-soft hover:text-err`})]})]}),e.branch&&(0,X.jsxs)(`p`,{className:`flex items-center gap-1.5 font-mono text-[12px] text-fg-2`,children:[(0,X.jsx)(B,{"aria-hidden":!0,className:`size-3.5 text-muted`,strokeWidth:1.75}),e.branch]}),e.description&&(0,X.jsx)(`p`,{className:`text-[13px] leading-5 text-fg-2`,children:e.description}),e.acceptance&&e.acceptance.length>0&&(0,X.jsxs)(`section`,{"aria-labelledby":`acc-title`,children:[(0,X.jsx)(`h4`,{id:`acc-title`,className:`eyebrow mb-1.5`,children:`Acceptance criteria`}),(0,X.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.acceptance.map(e=>(0,X.jsxs)(`li`,{className:`flex items-start gap-2 text-[13px] leading-5 text-fg-2`,children:[C?(0,X.jsx)(ne,{"aria-label":`met`,className:`mt-0.5 size-3.5 shrink-0 text-ok`,strokeWidth:1.75}):(0,X.jsx)(fe,{"aria-label":`not verified yet`,className:`mt-0.5 size-3.5 shrink-0 text-faint`,strokeWidth:1.75}),e]},e))})]}),e.notes&&(0,X.jsxs)(`section`,{"aria-labelledby":`notes-title`,children:[(0,X.jsx)(`h4`,{id:`notes-title`,className:`eyebrow mb-1.5`,children:`Notes`}),(0,X.jsx)(`p`,{className:`rounded-md border border-line bg-raised p-2.5 text-[12px] leading-5 text-fg-2`,children:e.notes})]}),(0,X.jsxs)(`section`,{"aria-labelledby":`deps-title`,className:`grid grid-cols-2 gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{id:`deps-title`,className:`eyebrow mb-1.5`,children:`Depends on`}),(0,X.jsx)(Z,{ids:e.dependsOn,byId:b,onSelect:i})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{className:`eyebrow mb-1.5`,children:`Unblocks`}),(0,X.jsx)(Z,{ids:x.map(e=>e.id),byId:b,onSelect:i})]})]}),e.updatedAt&&(0,X.jsxs)(`p`,{className:`text-2xs text-muted`,children:[`Updated `,S(Date.parse(e.updatedAt))]}),(0,X.jsxs)(le,{open:u,onClose:()=>d(!1),title:`Delete ${e.id}?`,description:x.length>0?`Other tasks depend on this one, so the gateway will refuse until those dependencies are removed.`:`The task is removed from TASK_GRAPH.json. Its branch and any merged work stay in git.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(n,{variant:`ghost`,onClick:()=>d(!1),children:`Keep task`}),(0,X.jsx)(n,{variant:`danger`,icon:M,loading:c.isPending,onClick:v,children:`Delete task`})]}),children:[(0,X.jsx)(`p`,{className:`truncate text-[13px] text-fg-2`,children:e.title}),x.length>0&&(0,X.jsxs)(`p`,{className:`mt-2 font-mono text-[12px] text-muted`,children:[`Needed by `,x.map(e=>e.id).join(`, `)]}),f&&(0,X.jsx)(A,{tone:`err`,title:`Could not delete the task`,className:`mt-3`,children:f})]})]})}function Z({ids:e,byId:t,onSelect:n}){return e.length===0?(0,X.jsx)(`p`,{className:`text-[12px] text-faint`,children:`None`}):(0,X.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:e.map(e=>{let r=t.get(e);return(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:`flex w-full min-w-0 items-center gap-1.5 rounded px-1 py-0.5 text-left font-mono text-[12px] text-fg-2 hover:bg-hover hover:text-fg`,children:[r?(0,X.jsx)(F,{status:r.status}):(0,X.jsx)(`span`,{className:`text-err`,children:`?`}),(0,X.jsx)(`span`,{className:`truncate`,children:e})]})},e)})})}var Q=204,$=56,be={SUCCESS:`stroke-ok/50`,IN_PROGRESS:`stroke-info/70`,FAILED:`stroke-err/70`,PENDING:`stroke-line-strong`},xe={SUCCESS:`border-line-strong`,IN_PROGRESS:`border-info/50 shadow-[0_0_0_3px_var(--dc-info-soft)]`,FAILED:`border-err/50`,PENDING:`border-line-strong border-dashed`};function Se({tasks:t,ready:n,selectedId:r,onSelect:i}){let a=(0,J.useMemo)(()=>Y(t,{nodeWidth:Q,nodeHeight:$,gapX:14,gapY:40,padding:20,direction:`TB`}),[t]),[o,s]=(0,J.useState)(null),c=o??r,l=(0,J.useMemo)(()=>c?ve(t,c):null,[t,c]),u=(0,J.useMemo)(()=>new Map(t.map(e=>[e.id,e])),[t]),d=e=>!l||e===c||l.up.has(e)||l.down.has(e),f=(e,t)=>!l||(e===c||l.up.has(e))&&(t===c||l.up.has(t))||(t===c||l.down.has(t))&&(e===c||l.down.has(e));return(0,X.jsx)(`div`,{className:`relative overflow-x-auto`,children:(0,X.jsxs)(`div`,{className:`relative mx-auto`,style:{width:a.width,height:a.height},children:[(0,X.jsxs)(`svg`,{width:a.width,height:a.height,className:`pointer-events-none absolute inset-0`,"aria-hidden":!0,children:[(0,X.jsx)(`defs`,{children:(0,X.jsx)(`marker`,{id:`dag-arrow`,viewBox:`0 0 8 8`,refX:`7`,refY:`4`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,X.jsx)(`path`,{d:`M0,0 L8,4 L0,8 z`,className:`fill-faint`})})}),a.edges.map(t=>{let n=u.get(t.from),r=f(t.from,t.to);return(0,X.jsx)(`path`,{d:t.path,fill:`none`,strokeWidth:r&&l?1.75:1.25,markerEnd:`url(#dag-arrow)`,className:e(`transition-opacity duration-200`,n?be[n.status]:`stroke-line-strong`,!r&&`opacity-20`)},`${t.from}->${t.to}`)})]}),a.nodes.map(t=>{let a=u.get(t.id);if(!a)return null;let o=n.get(a.id),c=a.id===r;return(0,X.jsxs)(`button`,{type:`button`,onClick:()=>i(a.id),onPointerEnter:()=>s(a.id),onPointerLeave:()=>s(null),onFocus:()=>s(a.id),onBlur:()=>s(null),"aria-pressed":c,"aria-label":`${a.id}: ${a.title}. ${a.status.toLowerCase().replace(`_`,` `)}${o===`ready`?`, ready to run`:o===`blocked`?`, blocked by a failed dependency`:``}`,className:e(`absolute flex flex-col justify-center gap-1 rounded-md border bg-panel px-2.5 text-left transition-[opacity,border-color,box-shadow,transform] duration-200 ease-snappy`,`hover:-translate-y-px hover:border-fg-2/40`,xe[a.status],c&&`border-accent shadow-[0_0_0_3px_var(--dc-accent-soft)]`,!d(a.id)&&`opacity-35`),style:{left:t.x,top:t.y,width:Q,height:$},children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,X.jsx)(F,{status:a.status}),(0,X.jsx)(`span`,{className:`truncate font-mono text-2xs text-muted`,children:a.id}),o===`ready`&&(0,X.jsx)(`span`,{className:`ml-auto shrink-0 rounded border border-ok/30 px-1 text-[10px] leading-4 text-ok`,children:`ready`}),o===`blocked`&&(0,X.jsx)(`span`,{className:`ml-auto shrink-0 rounded border border-err/30 px-1 text-[10px] leading-4 text-err`,children:`blocked`}),a.status===`IN_PROGRESS`&&(0,X.jsx)(`span`,{className:`ml-auto shrink-0 rounded border border-info/30 px-1 text-[10px] leading-4 text-info`,children:`running`})]}),(0,X.jsx)(`span`,{className:`truncate text-[12px] leading-4 text-fg`,children:a.title})]},t.id)})]})})}function Ce({open:e,task:t,tasks:n,onClose:r}){let i=t!==void 0;return(0,X.jsx)(oe,{open:e,onClose:r,title:i?`Edit task`:`New task`,description:i?(0,X.jsx)(`span`,{className:`font-mono`,children:t.id}):`The task starts as pending and is picked up in dependency order.`,width:`w-[min(560px,100vw)]`,children:e&&(0,X.jsx)(we,{task:t,tasks:n,onDone:r},t?.id??`new`)})}function we({task:e,tasks:t,onDone:r}){let i=x(),a=p(),[o,s]=(0,J.useState)(()=>e?_(e):l()),[c,m]=(0,J.useState)(!1),[h,g]=(0,J.useState)({}),[y,S]=(0,J.useState)(null),C=i.isPending||a.isPending,w=(e,t)=>s(n=>({...n,[e]:t})),T=n=>s(r=>({...r,title:n,...!e&&!c?{id:v(d(n),t)}:{}}));return(0,X.jsxs)(`form`,{onSubmit:async n=>{n.preventDefault(),S(null);let s=b(o,t,e?.id);if(g(s),!(Object.keys(s).length>0))try{if(e){let t=E(e,o);f(t)||await a.mutateAsync({id:e.id,patch:t}),z({tone:`ok`,title:`Task updated`,description:e.id})}else{let e=await i.mutateAsync(u(o));z({tone:`ok`,title:`Task created`,description:e.id})}r()}catch(e){S(j(e))}},noValidate:!0,className:`flex flex-col gap-5`,children:[(0,X.jsx)(U,{label:`Title`,required:!0,error:h.title,children:({id:e,describedBy:t,invalid:n})=>(0,X.jsx)(H,{id:e,autoFocus:!0,value:o.title,onChange:e=>T(e.target.value),"aria-describedby":t,"aria-invalid":n||void 0,placeholder:`Add the /health endpoint`})}),!e&&(0,X.jsx)(U,{label:`Id`,required:!0,error:h.id,hint:`Lowercase kebab-case. Used for the branch name and in dependencies; it cannot change later.`,children:({id:e,describedBy:t,invalid:n})=>(0,X.jsx)(H,{id:e,value:o.id,onChange:e=>{m(!0),w(`id`,e.target.value)},"aria-describedby":t,"aria-invalid":n||void 0,spellCheck:!1,autoCapitalize:`off`,className:`font-mono`})}),(0,X.jsx)(U,{label:`Description`,children:({id:e,describedBy:t})=>(0,X.jsx)(V,{id:e,value:o.description,onChange:e=>w(`description`,e.target.value),"aria-describedby":t,placeholder:`What needs to be done and why.`})}),(0,X.jsx)(U,{label:`Acceptance criteria`,hint:`One per line. The validator and judge check the result against these.`,children:({id:e,describedBy:t})=>(0,X.jsx)(V,{id:e,value:o.acceptance,onChange:e=>w(`acceptance`,e.target.value),"aria-describedby":t,placeholder:`GET /health returns 200
2
- The route has a test`})}),(0,X.jsx)(U,{label:`Priority`,error:h.priority,hint:`Higher runs first among unblocked tasks. Empty means 0.`,className:`max-w-40`,children:({id:e,describedBy:t,invalid:n})=>(0,X.jsx)(H,{id:e,inputMode:`decimal`,value:o.priority,onChange:e=>w(`priority`,e.target.value),"aria-describedby":t,"aria-invalid":n||void 0,className:`tnum font-mono`})}),(0,X.jsx)(Te,{tasks:t,selfId:e?.id,value:o.dependsOn,onChange:e=>w(`dependsOn`,e),error:h.dependsOn}),e&&(0,X.jsx)(U,{label:`Notes`,hint:`Written by the runner after each attempt; edit to leave a hint.`,children:({id:e,describedBy:t})=>(0,X.jsx)(V,{id:e,value:o.notes,onChange:e=>w(`notes`,e.target.value),"aria-describedby":t})}),y&&(0,X.jsx)(A,{tone:`err`,title:e?`Could not save the task`:`Could not create the task`,children:y}),(0,X.jsxs)(`div`,{className:`sticky -bottom-4 -mx-5 -mb-4 flex items-center justify-end gap-2 border-t border-line bg-panel px-5 py-3`,children:[(0,X.jsx)(n,{variant:`ghost`,onClick:r,children:`Cancel`}),(0,X.jsx)(n,{type:`submit`,variant:`primary`,loading:C,children:e?`Save changes`:`Create task`})]})]})}function Te({tasks:t,selfId:n,value:r,onChange:i,error:a}){let[o,s]=(0,J.useState)(``),c=(0,J.useMemo)(()=>g(t,n),[t,n]),l=new Set(t.map(e=>e.id)),u=t.length-c.length-+!!n,d=o.trim().toLowerCase(),f=c.filter(e=>!d||e.id.toLowerCase().includes(d)||e.title.toLowerCase().includes(d)),p=r.filter(e=>!l.has(e)),m=(e,t)=>i(t?[...r,e]:r.filter(t=>t!==e));return(0,X.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,"aria-describedby":a?`deps-error`:void 0,children:[(0,X.jsxs)(`legend`,{className:`mb-1.5 flex w-full items-baseline gap-2 text-[12px] font-medium text-fg-2`,children:[`Depends on`,(0,X.jsx)(`span`,{className:`tnum font-normal text-muted`,children:r.length===0?`none`:`${r.length} selected`})]}),(0,X.jsxs)(`div`,{className:`rounded-md border border-line-strong bg-bg`,children:[(0,X.jsxs)(`div`,{className:`relative border-b border-line`,children:[(0,X.jsx)(te,{"aria-hidden":!0,className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted`,strokeWidth:1.75}),(0,X.jsx)(`input`,{type:`search`,"aria-label":`Filter tasks`,placeholder:`Filter tasks`,value:o,onChange:e=>s(e.target.value),className:`h-8 w-full bg-transparent pr-2.5 pl-8 text-[13px] text-fg placeholder:text-faint focus-visible:outline-none`})]}),(0,X.jsxs)(`ul`,{className:`max-h-48 overflow-y-auto p-1`,children:[p.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-[12px] hover:bg-hover`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:!0,onChange:()=>m(e,!1),className:`size-3.5 accent-accent`}),(0,X.jsx)(`span`,{className:`font-mono text-err`,children:e}),(0,X.jsx)(`span`,{className:`text-muted`,children:`unknown task, uncheck to remove`})]})},e)),f.length===0&&p.length===0&&(0,X.jsx)(`li`,{className:`px-2 py-3 text-center text-[12px] text-faint`,children:t.length===0?`No other tasks yet.`:`No tasks match.`}),f.map(t=>{let n=r.includes(t.id);return(0,X.jsx)(`li`,{children:(0,X.jsxs)(`label`,{className:e(`flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-[12px] hover:bg-hover`,n&&`bg-hover/60`),children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>m(t.id,e.target.checked),className:`size-3.5 accent-accent`}),(0,X.jsx)(F,{status:t.status}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-fg`,children:t.title}),(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-2xs text-muted`,children:t.id})]})},t.id)})]})]}),a?(0,X.jsx)(`p`,{id:`deps-error`,role:`alert`,className:`text-[12px] leading-4 text-err`,children:a}):(0,X.jsxs)(`p`,{className:`text-[12px] leading-4 text-muted`,children:[`This task waits until every selected task is done.`,n&&u>0&&` ${u} dependent task${u===1?``:`s`} hidden: choosing them would create a cycle.`]})]})}var Ee=[`IN_PROGRESS`,`PENDING`,`FAILED`,`SUCCESS`];function De(){let e=m(),t=T(),{params:i}=re(),o=[`graph`,`board`,`list`].includes(i.get(`view`)??``)?i.get(`view`):`graph`,c=i.get(`task`),l=i.get(`panel`),u=i.get(`new`)===`1`,d=i.get(`edit`),f=e.data?.graph.tasks??[],p=(0,J.useMemo)(()=>_e(f),[f]),h=f.find(e=>e.id===c),g=f.find(e=>e.id===d),_=l??(h?`task`:`state`),v=(0,J.useMemo)(()=>Y(f),[f]),y=(0,J.useMemo)(()=>{let e={PENDING:0,IN_PROGRESS:0,SUCCESS:0,FAILED:0};for(let t of f)e[t.status]+=1;return e},[f]),b=f.length?y.SUCCESS/f.length:0,x=e=>{P(`panel`,null),P(`task`,e)},S=e.data?.project;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsx)(s,{title:`Tasks`,description:S?(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`text-fg-2`,children:S.name}),` `,(0,X.jsxs)(`span`,{className:`font-mono text-2xs text-faint`,children:[S.root,`/.davecode/TASK_GRAPH.json`]})]}):`The project task graph the autonomous runner works through.`,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(n,{variant:`primary`,icon:N,onClick:()=>P(`new`,`1`),children:`New task`}),(0,X.jsx)(R,{label:`Task view`,value:o,onChange:e=>P(`view`,e===`graph`?null:e),options:[{value:`graph`,label:`Graph`,icon:he},{value:`board`,label:`Board`,icon:pe},{value:`list`,label:`List`,icon:me}]})]})}),e.isError&&(0,X.jsx)(A,{tone:`err`,title:`Could not load the task graph`,children:C(e.error)}),f.length>0&&(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-5 gap-y-2 text-[12px]`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,X.jsx)(`div`,{className:`h-1.5 w-40 overflow-hidden rounded-full bg-track`,role:`progressbar`,"aria-label":`Tasks done`,"aria-valuemin":0,"aria-valuemax":f.length,"aria-valuenow":y.SUCCESS,children:(0,X.jsx)(`div`,{className:`h-full rounded-full bg-ok transition-[width] duration-500 ease-snappy`,style:{width:`${b*100}%`}})}),(0,X.jsxs)(`span`,{className:`tnum text-fg-2`,children:[y.SUCCESS,` of `,f.length,` done`]})]}),Ee.map(e=>(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-muted`,children:[(0,X.jsx)(F,{status:e}),L[e],` `,(0,X.jsx)(`span`,{className:`tnum text-fg-2`,children:y[e]})]},e)),v.missing.length>0&&(0,X.jsxs)(D,{tone:`warn`,children:[v.missing.length,` unknown dependencies`]})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 xl:grid-cols-[minmax(0,1fr)_380px]`,children:[(0,X.jsx)(r,{className:`min-h-[420px]`,children:e.isPending?(0,X.jsx)(`div`,{className:`p-4`,children:(0,X.jsx)(ae,{className:`h-[380px] w-full`})}):f.length===0?(0,X.jsx)(se,{icon:B,title:`No task graph yet`,description:`Describe the work as a DAG of tasks and the runner will pick them up in dependency order. You can also edit .davecode/TASK_GRAPH.json by hand.`,command:`davecode run`,action:(0,X.jsx)(n,{variant:`primary`,icon:N,onClick:()=>P(`new`,`1`),children:`New task`}),className:`py-20`}):o===`graph`?(0,X.jsx)(Se,{tasks:f,ready:p,selectedId:c,onSelect:x}):o===`board`?(0,X.jsx)(ke,{tasks:f,ready:p,selectedId:c,onSelect:x}):(0,X.jsx)(Ae,{tasks:f,ready:p,selectedId:c,onSelect:x})}),(0,X.jsxs)(r,{className:`xl:sticky xl:top-16 xl:max-h-[calc(100dvh-5rem)] xl:self-start`,children:[(0,X.jsx)(a,{title:(0,X.jsx)(R,{size:`sm`,label:`Side panel`,value:_,onChange:e=>P(`panel`,e),options:[...h?[{value:`task`,label:`Task`,icon:B}]:[],{value:`state`,label:`STATE.md`,icon:O},{value:`architecture`,label:`ARCHITECTURE.md`,icon:O}]})}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:_===`task`&&h?(0,X.jsx)(ye,{task:h,tasks:f,readiness:p.get(h.id),onSelect:x,onEdit:()=>P(`edit`,h.id),onClose:()=>{P(`task`,null),P(`panel`,null)}}):t.isPending?(0,X.jsx)(ce,{rows:6}):t.isError?(0,X.jsx)(`p`,{className:`p-4 text-[12px] text-err`,children:C(t.error)}):(0,X.jsx)(k,{className:`p-4`,source:(_===`architecture`?t.data?.architecture:t.data?.state)||`_This file is empty._`})})]})]}),(0,X.jsx)(Ce,{open:u,tasks:f,onClose:()=>P(`new`,null)}),(0,X.jsx)(Ce,{open:!!g,task:g,tasks:f,onClose:()=>P(`edit`,null)})]})}function Oe({r:e}){return e===`ready`?(0,X.jsx)(D,{tone:`ok`,children:`ready`}):e===`blocked`?(0,X.jsx)(D,{tone:`err`,children:`blocked`}):null}function ke({tasks:t,ready:n,selectedId:r,onSelect:i}){return(0,X.jsx)(`div`,{className:`grid grid-cols-1 gap-px overflow-x-auto bg-line sm:grid-cols-2 lg:grid-cols-4`,children:Ee.map(a=>{let o=t.filter(e=>e.status===a).sort((e,t)=>(t.priority??0)-(e.priority??0));return(0,X.jsxs)(`section`,{"aria-label":L[a],className:`flex min-w-0 flex-col bg-panel`,children:[(0,X.jsxs)(`h3`,{className:`flex items-center gap-2 border-b border-line px-3 py-2 text-[12px] font-medium text-fg-2`,children:[(0,X.jsx)(F,{status:a}),L[a],(0,X.jsx)(`span`,{className:`tnum ml-auto text-muted`,children:o.length})]}),(0,X.jsxs)(`ul`,{className:`flex flex-col gap-2 p-2`,children:[o.length===0&&(0,X.jsx)(`li`,{className:`px-1 py-3 text-center text-[12px] text-faint`,children:`Empty`}),o.map(t=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{type:`button`,onClick:()=>i(t.id),"aria-pressed":t.id===r,className:e(`flex w-full flex-col gap-1.5 rounded-md border bg-raised p-2.5 text-left transition-colors duration-150 hover:border-fg-2/30`,t.id===r?`border-accent`:`border-line`),children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`truncate font-mono text-2xs text-muted`,children:t.id}),(0,X.jsx)(`span`,{className:`ml-auto`,children:(0,X.jsx)(Oe,{r:n.get(t.id)})})]}),(0,X.jsx)(`span`,{className:`text-[12px] leading-4 text-fg`,children:t.title}),t.dependsOn.length>0&&(0,X.jsxs)(`span`,{className:`truncate font-mono text-[10px] text-faint`,children:[`after `,t.dependsOn.join(`, `)]})]})},t.id))]})]},a)})})}function Ae({tasks:t,ready:n,selectedId:r,onSelect:i}){let a=(0,J.useMemo)(()=>new Map(Y(t).nodes.map(e=>[e.id,e.layer])),[t]),o=[...t].sort((e,t)=>(a.get(e.id)??0)-(a.get(t.id)??0)||(t.priority??0)-(e.priority??0));return(0,X.jsx)(`div`,{className:`overflow-x-auto`,children:(0,X.jsxs)(`table`,{className:`w-full min-w-[640px] text-[12px]`,children:[(0,X.jsx)(`caption`,{className:`sr-only`,children:`Tasks in dependency order`}),(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{className:`border-b border-line text-left text-muted`,children:[(0,X.jsx)(`th`,{scope:`col`,className:`px-3.5 py-2 font-medium`,children:`Task`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-2 py-2 font-medium`,children:`Status`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-2 py-2 text-right font-medium`,children:`Priority`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-2 py-2 font-medium`,children:`Depends on`})]})}),(0,X.jsx)(`tbody`,{children:o.map(t=>(0,X.jsxs)(`tr`,{className:e(`border-b border-line last:border-b-0`,t.id===r&&`bg-hover/60`),children:[(0,X.jsx)(`td`,{className:`max-w-0 px-3.5 py-2`,children:(0,X.jsxs)(`button`,{type:`button`,onClick:()=>i(t.id),className:`block w-full min-w-0 text-left hover:underline`,children:[(0,X.jsx)(`span`,{className:`block truncate text-[13px] text-fg`,children:t.title}),(0,X.jsx)(`span`,{className:`block truncate font-mono text-2xs text-muted`,children:t.id})]})}),(0,X.jsx)(`td`,{className:`px-2 py-2`,children:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(I,{status:t.status}),(0,X.jsx)(Oe,{r:n.get(t.id)})]})}),(0,X.jsx)(`td`,{className:`tnum px-2 py-2 text-right font-mono text-fg-2`,children:t.priority??`—`}),(0,X.jsx)(`td`,{className:`max-w-0 truncate px-2 py-2 font-mono text-2xs text-muted`,children:t.dependsOn.join(`, `)||`—`})]},t.id))})]})})}export{De as Tasks};
@@ -1 +0,0 @@
1
- import{a as e,c as t,i as n,n as r,o as i,s as a,t as o,u as s}from"./Panel-Du40pM7n.js";import{B as c,V as l,c as u,ct as d,f,i as p,l as m,lt as h,p as g,r as _,t as v,ut as y}from"./Badge-CGY6DgGx.js";import{A as b,C as x,F as S,G as C,P as w,S as T,V as E,c as D,i as O,o as k,p as A,t as j,u as M,w as N}from"./index-BCi-Vuvh.js";import{n as P,r as F}from"./Field-OXMnT9Tb.js";var I={name:`loader`,size:24,node:[[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m16.2 7.8 2.9-2.9`,key:`r700ao`}],[`path`,{d:`M18 12h4`,key:`wj9ykh`}],[`path`,{d:`m16.2 16.2 2.9 2.9`,key:`1bxg5t`}],[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`m4.9 19.1 2.9-2.9`,key:`bwix9q`}],[`path`,{d:`M2 12h4`,key:`j09sii`}],[`path`,{d:`m4.9 4.9 2.9 2.9`,key:`giyufr`}]]};I.node;var L=i(I),R=s(t(),1),z=a();function B({chain:t,accounts:n,className:r}){let i=t.attempts.map(e=>{let t=n.get(e.accountId)?.label??e.accountId;return e.outcome===`failed`?`${t} failed (${y(e)})`:`${t} ${e.outcome}`}).join(`, then `);return(0,z.jsxs)(`div`,{className:e(`flex min-w-0 items-center gap-1`,r),title:i,children:[(0,z.jsx)(`span`,{className:`sr-only`,children:i}),t.attempts.map((e,r)=>(0,z.jsxs)(R.Fragment,{children:[r>0&&(0,z.jsx)(V,{attempt:t.attempts[r-1]}),(0,z.jsx)(H,{attempt:e,account:n.get(e.accountId),compact:t.attempts.length>2&&r<t.attempts.length-1})]},r))]})}function V({attempt:e}){return(0,z.jsxs)(`span`,{"aria-hidden":!0,className:`flex shrink-0 items-center gap-1 text-faint`,children:[(0,z.jsx)(`span`,{className:`h-px w-2 bg-line-strong`}),e?.outcome===`failed`&&(0,z.jsx)(`span`,{className:`rounded border border-err/30 bg-err-soft px-1 font-mono text-[10px] leading-4 text-err`,children:y(e)}),(0,z.jsx)(`span`,{className:`h-px w-2 bg-line-strong`}),(0,z.jsx)(`span`,{className:`-ml-1.5 text-[10px] leading-none`,children:`▸`})]})}function H({attempt:t,account:n,compact:r}){let i=n?.label??t.accountId;return(0,z.jsxs)(`span`,{"aria-hidden":!0,className:e(`inline-flex h-6 max-w-[180px] min-w-0 items-center gap-1.5 rounded border pr-1.5 pl-0.5 text-[12px]`,t.outcome===`failed`?`border-line text-muted`:`border-line-strong bg-raised text-fg`),children:[(0,z.jsx)(A,{provider:t.provider,size:`sm`,className:`size-[18px] border-0 bg-transparent`}),!r&&(0,z.jsx)(`span`,{className:e(`truncate`,t.outcome===`failed`&&`line-through decoration-faint`),children:i}),t.outcome===`success`&&(0,z.jsx)(E,{className:`size-3 shrink-0 text-ok`,strokeWidth:2.25}),t.outcome===`failed`&&(0,z.jsx)(N,{className:`size-3 shrink-0 text-err`,strokeWidth:2.25}),t.outcome===`pending`&&(0,z.jsx)(L,{className:`size-3 shrink-0 animate-spin text-info [animation-duration:1.6s]`,strokeWidth:2})]})}function U({chain:e}){return e.outcome===`pending`?(0,z.jsx)(v,{tone:`info`,dot:!0,pulse:!0,children:`in flight`}):e.outcome===`failed`?(0,z.jsx)(v,{tone:`err`,dot:!0,children:`failed`}):e.failovers>0?(0,z.jsxs)(v,{tone:`warn`,dot:!0,children:[`ok · `,e.failovers,` failover`,e.failovers>1?`s`:``]}):(0,z.jsx)(v,{tone:`ok`,dot:!0,children:`ok`})}function W({chain:e,accounts:t,onClose:n}){return(0,z.jsx)(D,{open:!!e,onClose:n,title:`Request`,description:e&&(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono`,children:[e.requestId,(0,z.jsx)(M,{value:e.requestId,label:`Copy request id`})]}),width:`w-[min(520px,100vw)]`,children:e&&(0,z.jsx)(G,{chain:e,accounts:t})})}function G({chain:t,accounts:n}){let r=h(t),i=d(t),a=[[`Outcome`,(0,z.jsx)(U,{chain:t},`o`)],[`Model`,(0,z.jsx)(`span`,{className:`font-mono`,children:t.model||`—`},`m`)],[`Started`,(0,z.jsx)(`span`,{className:`tnum font-mono`,children:_(t.startedTs,!0)},`s`)],[`End-to-end`,(0,z.jsx)(`span`,{className:`tnum font-mono`,children:i===void 0?`—`:m(i)},`l`)],[`Tokens`,(0,z.jsxs)(`span`,{className:`tnum font-mono`,children:[u(r.prompt),` in · `,u(r.completion),` out`]},`t`)],[`Failovers`,(0,z.jsx)(`span`,{className:`tnum font-mono`,children:t.failovers},`f`)]];return(0,z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,z.jsx)(`dl`,{className:`grid grid-cols-[110px_1fr] gap-x-4 gap-y-2 text-[13px]`,children:a.map(([e,t])=>(0,z.jsxs)(`div`,{className:`contents`,children:[(0,z.jsx)(`dt`,{className:`text-muted`,children:e}),(0,z.jsx)(`dd`,{className:`min-w-0 text-fg`,children:t})]},e))}),(0,z.jsxs)(`section`,{"aria-labelledby":`attempts-title`,children:[(0,z.jsx)(`h3`,{id:`attempts-title`,className:`mb-2 text-[12px] font-medium text-fg-2`,children:`Attempts`}),(0,z.jsx)(`ol`,{className:`relative flex flex-col gap-0`,children:t.attempts.map((r,i)=>{let a=n.get(r.accountId),o=r.startedTs-t.startedTs,s=i===t.attempts.length-1;return(0,z.jsxs)(`li`,{className:`relative flex gap-3 pb-4 last:pb-0`,children:[!s&&(0,z.jsx)(`span`,{"aria-hidden":!0,className:`absolute top-7 bottom-0 left-[11px] w-px bg-line-strong`}),(0,z.jsx)(`span`,{className:e(`z-10 mt-0.5 flex size-6 shrink-0 items-center justify-center rounded-full border text-[10px] font-semibold`,r.outcome===`success`?`border-ok/40 bg-ok-soft text-ok`:r.outcome===`failed`?`border-err/40 bg-err-soft text-err`:`border-info/40 bg-info-soft text-info`),children:i+1}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1 rounded-md border border-line bg-raised p-2.5`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(A,{provider:r.provider,size:`sm`}),(0,z.jsx)(`span`,{className:`truncate text-[13px] font-medium text-fg`,children:a?.label??r.accountId}),(0,z.jsx)(`span`,{className:`ml-auto`,children:r.outcome===`success`?(0,z.jsx)(v,{tone:`ok`,children:`served`}):r.outcome===`failed`?(0,z.jsxs)(v,{tone:`err`,mono:!0,children:[y(r),` `,r.errorKind]}):(0,z.jsx)(v,{tone:`info`,dot:!0,pulse:!0,children:`in flight`})})]}),(0,z.jsxs)(`p`,{className:`tnum mt-1.5 font-mono text-2xs text-muted`,children:[r.accountId,` · +`,m(o),r.latencyMs!==void 0&&` · took ${m(r.latencyMs)}`,r.outcome===`success`&&` · ${u(r.promptTokens??0)} → ${u(r.completionTokens??0)} tok`]}),r.errorMessage&&(0,z.jsx)(`p`,{className:`mt-1.5 text-[12px] text-fg-2`,children:r.errorMessage})]})]},i)})})]}),(0,z.jsxs)(`details`,{className:`rounded-md border border-line`,children:[(0,z.jsx)(`summary`,{className:`px-3 py-2 text-[12px] font-medium text-fg-2 select-none hover:text-fg`,children:`Raw chain`}),(0,z.jsx)(`pre`,{className:`max-h-80 overflow-auto border-t border-line p-3 font-mono text-2xs leading-5 text-fg-2`,children:JSON.stringify(t,null,2)})]})]})}function K(e,t){switch(t){case`ok`:return e.outcome===`success`&&e.failovers===0;case`failover`:return e.failovers>0;case`failed`:return e.outcome===`failed`;case`pending`:return e.outcome===`pending`;default:return!0}}var q=250;function J(){let t=l(),{connection:i}=c(),a=g(),{params:s}=x(),[u,y]=(0,R.useState)(``),[E,D]=(0,R.useState)(`all`),[A,M]=(0,R.useState)(``),[N,I]=(0,R.useState)(null),L=(0,R.useMemo)(()=>new Map((a.data??[]).map(e=>[e.id,e])),[a.data]),V=N??t.chains,H=N?Math.max(0,t.chains.length-N.length):0,G=(0,R.useMemo)(()=>{let e={all:0,ok:0,failover:0,failed:0,pending:0};for(let t of V)e.all+=1,K(t,`ok`)&&(e.ok+=1),K(t,`failover`)&&(e.failover+=1),K(t,`failed`)&&(e.failed+=1),K(t,`pending`)&&(e.pending+=1);return e},[V]),J=u.trim().toLowerCase(),Y=V.filter(e=>K(e,E)&&(!A||e.attempts.some(e=>e.accountId===A))&&(!J||e.requestId.toLowerCase().includes(J)||e.model.toLowerCase().includes(J)||e.attempts.some(e=>e.accountId.toLowerCase().includes(J)||(L.get(e.accountId)?.label.toLowerCase().includes(J)??!1)))).slice(0,q),X=s.get(`req`),Z=X?t.chains.find(e=>e.requestId===X):void 0,Q=t.chains.length===0&&i.mode!==`live`;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,z.jsx)(o,{title:`Traffic`,description:`Every request through /v1, with failover hops shown inline.`,actions:(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[N?(0,z.jsxs)(v,{tone:`warn`,children:[`paused`,H>0&&` · ${H} new`]}):(0,z.jsx)(v,{tone:`ok`,dot:!0,pulse:!0,children:`streaming`}),(0,z.jsx)(n,{icon:N?w:S,onClick:()=>I(N?null:t.chains),"aria-pressed":!!N,children:N?`Resume`:`Pause`})]})}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsxs)(`div`,{className:`relative w-full sm:w-64`,children:[(0,z.jsx)(b,{"aria-hidden":!0,className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted`,strokeWidth:1.75}),(0,z.jsx)(P,{type:`search`,"aria-label":`Filter requests`,placeholder:`Model, request id or account`,value:u,onChange:e=>y(e.target.value),className:`pl-8`,"data-filter-input":!0})]}),(0,z.jsx)(j,{label:`Outcome`,value:E,onChange:D,options:[{value:`all`,label:`All`,count:G.all},{value:`ok`,label:`OK`,count:G.ok},{value:`failover`,label:`Failover`,count:G.failover},{value:`failed`,label:`Failed`,count:G.failed},{value:`pending`,label:`In flight`,count:G.pending}]}),(0,z.jsxs)(F,{"aria-label":`Filter by account`,value:A,onChange:e=>M(e.target.value),className:`w-auto min-w-44`,children:[(0,z.jsx)(`option`,{value:``,children:`All accounts`}),(a.data??[]).map(e=>(0,z.jsx)(`option`,{value:e.id,children:e.label},e.id))]})]}),(0,z.jsx)(r,{children:Q?(0,z.jsx)(k,{rows:8}):Y.length===0?t.chains.length===0?(0,z.jsx)(O,{icon:C,title:`No requests yet`,description:`Point any OpenAI-compatible client at the gateway and use a davecode/<route> model.`,command:`curl http://127.0.0.1:4040/v1/chat/completions -H 'content-type: application/json' -d '{"model":"davecode/auto","messages":[{"role":"user","content":"hi"}]}'`}):(0,z.jsx)(O,{icon:b,title:`No matching requests`,description:`Try a different filter.`}):(0,z.jsx)(`div`,{className:`overflow-x-auto`,children:(0,z.jsxs)(`table`,{className:`w-full min-w-[920px] text-[12px]`,children:[(0,z.jsx)(`caption`,{className:`sr-only`,children:`Recent requests, newest first`}),(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{className:`border-b border-line text-left text-muted`,children:[(0,z.jsx)(`th`,{scope:`col`,className:`w-24 px-3.5 py-2 font-medium`,children:`Time`}),(0,z.jsx)(`th`,{scope:`col`,className:`w-24 px-2 py-2 font-medium`,children:`Request`}),(0,z.jsx)(`th`,{scope:`col`,className:`w-40 px-2 py-2 font-medium`,children:`Model`}),(0,z.jsx)(`th`,{scope:`col`,className:`px-2 py-2 font-medium`,children:`Accounts`}),(0,z.jsx)(`th`,{scope:`col`,className:`w-20 px-2 py-2 text-right font-medium`,children:`Latency`}),(0,z.jsx)(`th`,{scope:`col`,className:`w-28 px-2 py-2 text-right font-medium`,children:`Tokens in → out`}),(0,z.jsx)(`th`,{scope:`col`,className:`w-36 px-3.5 py-2 text-right font-medium`,children:`Status`})]})}),(0,z.jsx)(`tbody`,{children:Y.map(t=>{let n=h(t),r=d(t);return(0,z.jsxs)(`tr`,{onClick:()=>T(`req`,t.requestId),className:e(`animate-row-in cursor-pointer border-b border-line transition-colors duration-150 last:border-b-0 hover:bg-hover/60`,X===t.requestId&&`bg-hover/60`),children:[(0,z.jsx)(`td`,{className:`tnum px-3.5 py-2 font-mono text-muted`,children:_(t.startedTs)}),(0,z.jsx)(`td`,{className:`px-2 py-2`,children:(0,z.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),T(`req`,t.requestId)},className:`font-mono text-fg-2 hover:text-fg hover:underline focus-visible:underline`,"aria-label":`Open request ${t.requestId}`,children:f(t.requestId)})}),(0,z.jsx)(`td`,{className:`max-w-0 truncate px-2 py-2 font-mono text-fg`,children:t.model||`—`}),(0,z.jsx)(`td`,{className:`max-w-0 px-2 py-1.5`,children:(0,z.jsx)(B,{chain:t,accounts:L})}),(0,z.jsx)(`td`,{className:`tnum px-2 py-2 text-right font-mono text-fg-2`,children:r===void 0?`…`:m(r)}),(0,z.jsx)(`td`,{className:`tnum px-2 py-2 text-right font-mono text-fg-2`,children:n.prompt||n.completion?(0,z.jsxs)(z.Fragment,{children:[p(n.prompt),` `,(0,z.jsx)(`span`,{className:`text-faint`,children:`→`}),` `,p(n.completion)]}):(0,z.jsx)(`span`,{className:`text-faint`,children:`—`})}),(0,z.jsx)(`td`,{className:`px-3.5 py-2 text-right`,children:(0,z.jsx)(U,{chain:t})})]},t.requestId)})})]})})}),Y.length===q&&(0,z.jsxs)(`p`,{className:`text-center text-[12px] text-muted`,children:[`Showing the latest `,q,` requests.`]}),(0,z.jsx)(W,{chain:Z,accounts:L,onClose:()=>T(`req`,null)})]})}export{J as Traffic};
@@ -1 +0,0 @@
1
- import{c as e,i as t,s as n,u as r}from"./Panel-Du40pM7n.js";import{B as i,C as a,M as o,N as s,T as c,ft as l,g as u,p as d,pt as f}from"./Badge-CGY6DgGx.js";import{t as p}from"./arrow-up-goM9r-I9.js";import{t as m}from"./Markdown-Xhao3sgL.js";import{t as h}from"./Callout-DauCk_cW.js";import{C as g,P as _,V as v,b as y,k as b,x}from"./index-BCi-Vuvh.js";import{GoalDetail as S,isActiveGoal as C,t as w}from"./Goals-DH-KDh8M.js";var T=r(e(),1),E=n(),D={planning:`Putting a plan together`,running:`Working on it`,reviewing:`Checking the result`,planned:`Your plan is ready`,succeeded:`Done`,failed:`Something needs attention`,cancelled:`Stopped`,budget_exhausted:`Usage limit reached`},O=[{title:`Make something`,prompt:`Help me turn an idea into something useful. First help me define who it is for and what it should do.`},{title:`Understand a project`,prompt:`Explain this project in plain language and write a short getting-started guide for someone without a technical background.`},{title:`Improve a design`,prompt:`Review this project’s interface. Propose a distinctive visual direction, explain the most useful improvements and make a plan before changing code.`}];function k(){let{params:e}=g(),{connection:n}=i(),r=c(),k=d(),A=s(),j=o(),M=a(),N=u(),P=(0,T.useRef)(null),[F,I]=(0,T.useState)(()=>(e.get(`brief`)??``).slice(0,4e3)),[L,R]=(0,T.useState)(`plan`),[z,B]=(0,T.useState)(`50000`),[V,H]=(0,T.useState)(),U=r.data??[],W=U.find(C),G=e.has(`new`)||e.has(`brief`)?void 0:U.find(t=>t.id===e.get(`goal`))??W,K=n.mode===`mock`,q=f(r.error)&&r.error.status===501,J=(k.data??[]).some(e=>e.enabled),Y=r.isPending||r.isError||k.isPending||k.isError||!J||j.isPending||!!W&&L===`work`;function X(e){e.preventDefault(),!Y&&F.trim()&&(H(void 0),j.mutate({objective:F.trim(),dryRun:L===`plan`,maxTokens:Number(z)},{onSuccess:e=>{I(``),x(`/?goal=${encodeURIComponent(e.id)}`)},onError:e=>H(l(e))}))}return(0,E.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[780px] flex-1 flex-col`,children:[K&&(0,E.jsxs)(`p`,{className:`mb-4 text-center text-[12px] text-muted`,children:[`This is a demo.`,` `,(0,E.jsx)(y,{to:`/settings`,className:`underline`,children:`Connect your device`}),` `,`to work on your files.`]}),q&&(0,E.jsxs)(h,{tone:`warn`,title:`Open a project to start`,children:[`Start DaveCode in your project folder.`,` `,(0,E.jsx)(y,{to:`/goals`,className:`underline`,children:`Setup instructions`})]}),r.isError&&!q&&(0,E.jsx)(h,{tone:`err`,title:`Could not load your work`,children:l(r.error)}),k.isError&&(0,E.jsx)(h,{tone:`err`,title:`Could not load AI connections`,children:l(k.error)}),G?(0,E.jsxs)(`div`,{className:`flex flex-1 flex-col gap-7 pb-10 pt-6`,children:[(0,E.jsx)(`div`,{className:`ml-auto max-w-[90%] rounded-2xl bg-raised px-5 py-4 text-[15px] leading-7 text-fg`,children:G.objective}),(0,E.jsxs)(`section`,{"aria-labelledby":`work-status`,className:`px-1`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,E.jsx)(`h1`,{id:`work-status`,className:`text-[19px] font-medium tracking-tight text-fg`,children:D[G.status]}),C(G)&&(0,E.jsx)(t,{size:`sm`,variant:`ghost`,icon:b,loading:N.isPending,onClick:()=>N.mutate(G.id,{onError:e=>H(l(e))}),children:`Stop`})]}),G.tasks.length>0&&(0,E.jsx)(`ol`,{className:`mt-5 flex flex-col gap-4`,children:G.tasks.map(e=>(0,E.jsxs)(`li`,{className:`flex items-start gap-3 text-[14px] leading-6 text-fg-2`,children:[e.status===`SUCCESS`?(0,E.jsx)(v,{"aria-hidden":!0,className:`mt-1 size-4 shrink-0 text-fg-2`}):(0,E.jsx)(`span`,{className:`mt-0.5 w-4 shrink-0 text-center text-muted`,"aria-hidden":!0,children:e.id===G.activeTaskId?`→`:`−`}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`span`,{children:e.title}),e.status===`FAILED`&&(0,E.jsx)(`p`,{className:`mt-1 text-[12px] text-err`,children:`This step needs attention.`})]})]},e.id))}),G.summary&&(0,E.jsx)(m,{source:G.summary,className:`mt-6 text-[14px]`}),G.lastError&&(0,E.jsx)(`p`,{role:`alert`,className:`mt-4 text-[13px] text-err`,children:G.lastError}),G.status===`planned`&&(0,E.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-3`,children:[(0,E.jsx)(t,{size:`sm`,variant:`primary`,icon:_,loading:M.isPending,disabled:!!W,onClick:()=>{H(void 0),M.mutate(G.id,{onError:e=>H(l(e))})},children:`Execute this plan`}),(0,E.jsx)(`span`,{className:`text-[13px] leading-6 text-muted`,children:`Runs the planned steps above without re-planning.`})]})]}),(0,E.jsxs)(`details`,{className:`text-[12px] text-muted`,children:[(0,E.jsx)(`summary`,{className:`mb-3 cursor-pointer`,children:`Task details`}),(0,E.jsx)(S,{goal:G},G.id)]})]}):(0,E.jsxs)(`section`,{className:`flex flex-1 flex-col items-center justify-center pb-8 pt-16 text-center md:pt-20`,children:[(0,E.jsx)(`h1`,{className:`text-3xl font-medium tracking-tight text-fg md:text-[38px]`,children:`What are we making?`}),(0,E.jsx)(`p`,{className:`mt-3 text-[15px] text-muted`,children:`An idea is a good place to start.`}),(0,E.jsx)(`div`,{className:`mt-8 flex flex-wrap justify-center gap-2`,children:O.map(e=>(0,E.jsx)(`button`,{type:`button`,onClick:()=>{I(e.prompt),R(`plan`),P.current?.focus()},className:`rounded-xl border border-line px-4 py-3 text-[13px] text-fg-2 transition-colors hover:border-line-strong hover:bg-hover`,children:e.title},e.title))})]}),(0,E.jsxs)(`div`,{className:`sticky bottom-0 bg-bg pb-3 pt-3`,children:[(0,E.jsxs)(`form`,{onSubmit:X,className:`rounded-2xl border border-line-strong bg-panel p-4 focus-within:border-faint`,children:[(0,E.jsx)(`label`,{htmlFor:`workspace-composer`,className:`sr-only`,children:`What would you like to do?`}),(0,E.jsx)(`textarea`,{id:`workspace-composer`,ref:P,required:!0,rows:3,maxLength:4e3,value:F,onChange:e=>I(e.target.value),placeholder:`Describe what you have in mind…`,"aria-describedby":V?`workspace-error`:void 0,className:`block w-full resize-none border-0 bg-transparent px-1 py-2 text-[15px] leading-6 text-fg outline-none placeholder:text-muted`}),(0,E.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,E.jsx)(`label`,{className:`sr-only`,htmlFor:`workspace-mode`,children:`How to start`}),(0,E.jsxs)(`select`,{id:`workspace-mode`,value:L,onChange:e=>R(e.target.value),className:`max-w-44 rounded-lg border-0 bg-transparent py-2 pr-3 text-[12px] text-fg-2 outline-accent`,children:[(0,E.jsx)(`option`,{value:`plan`,children:`Plan first`}),(0,E.jsx)(`option`,{value:`work`,children:`Plan and work`})]}),(0,E.jsxs)(`details`,{className:`relative`,children:[(0,E.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-1 text-[12px] text-muted`,children:[`Options`,(0,E.jsx)(w,{"aria-hidden":!0,className:`size-3`})]}),(0,E.jsxs)(`div`,{className:`absolute bottom-9 left-0 z-10 w-56 rounded-xl border border-line-strong bg-panel p-4 shadow-overlay`,children:[(0,E.jsx)(`label`,{htmlFor:`workspace-limit`,className:`text-[12px] text-fg-2`,children:`AI usage limit`}),(0,E.jsxs)(`select`,{id:`workspace-limit`,value:z,onChange:e=>B(e.target.value),className:`mt-2 w-full rounded-md border border-line-strong bg-panel px-2 py-2 text-[12px] text-fg`,children:[(0,E.jsx)(`option`,{value:`50000`,children:`50k tokens`}),(0,E.jsx)(`option`,{value:`250000`,children:`250k tokens`}),(0,E.jsx)(`option`,{value:`1000000`,children:`1m tokens`})]}),(0,E.jsx)(`p`,{className:`mt-2 text-[11px] leading-5 text-muted`,children:`A usage limit, not a price cap.`})]})]})]}),(0,E.jsx)(t,{type:`submit`,icon:p,iconOnly:!0,"aria-label":K?`Try demo`:L===`plan`?`Make a plan`:`Start working`,variant:`primary`,disabled:Y||!F.trim(),loading:j.isPending,className:`size-9 rounded-xl`})]})]}),V&&(0,E.jsx)(`p`,{id:`workspace-error`,role:`alert`,className:`mt-2 text-[12px] text-err`,children:V}),!k.isPending&&!k.isError&&!J&&(0,E.jsxs)(`p`,{className:`mt-3 text-center text-[12px] text-muted`,children:[(0,E.jsx)(y,{to:`/accounts`,className:`underline`,children:`Connect an AI tool`}),` `,`to get started.`]}),W&&L===`work`&&(0,E.jsx)(`p`,{role:`status`,className:`mt-3 text-center text-[12px] text-muted`,children:`A task is running. You can still plan the next one.`}),(0,E.jsxs)(`p`,{className:`mt-3 text-center text-[11px] leading-5 text-muted`,children:[L===`plan`?`Planning does not execute tasks.`:`Execution can edit files and merge changes.`,A.data?.project?` Working in ${A.data.project.name}.`:``]})]})]})}export{k as Workspace};
@@ -1 +0,0 @@
1
- import{o as e}from"./Panel-Du40pM7n.js";var t={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};t.node;var n=e(t);export{n as t};
@@ -1 +0,0 @@
1
- import{c as e,o as t,s as n,u as r}from"./Panel-Du40pM7n.js";import{n as i,r as a,t as o}from"./Field-OXMnT9Tb.js";var s={name:`eye-off`,size:24,node:[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};s.node;var c=t(s),l={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};l.node;var u=t(l),d=r(e(),1),f=n(),p=[{key:`tpm`,label:`Tokens / min`},{key:`rpm`,label:`Requests / min`},{key:`tokens5h`,label:`Tokens / 5 h`},{key:`requests5h`,label:`Requests / 5 h`},{key:`tokensDaily`,label:`Tokens / 24 h`},{key:`requestsDaily`,label:`Requests / 24 h`}];function m(e={}){let t={};for(let{key:n}of p)t[n]=e[n]===void 0?``:String(e[n]);return t}function h(e){let t={},n={};for(let{key:r}of p){let i=e[r].replace(/[,_\s]/g,``);if(!i)continue;let a=Number(i);!Number.isInteger(a)||a<=0?n[r]=`Whole number above 0`:t[r]=a}return{limits:t,errors:n}}function g({value:e,onChange:t,errors:n}){return(0,f.jsx)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-3`,children:p.map(({key:r,label:a})=>(0,f.jsx)(o,{label:a,error:n[r],children:({id:n,describedBy:a,invalid:o})=>(0,f.jsx)(i,{id:n,inputMode:`numeric`,placeholder:`unlimited`,value:e[r],"aria-describedby":a,"aria-invalid":o||void 0,onChange:n=>t({...e,[r]:n.target.value}),className:`tnum font-mono`})},r))})}function _({id:e,value:t,onChange:n,placeholder:r,describedBy:a,invalid:o}){let[s,l]=(0,d.useState)(!1);return(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(i,{id:e,type:s?`text`:`password`,autoComplete:`new-password`,spellCheck:!1,autoCapitalize:`off`,value:t,placeholder:r,"aria-describedby":a,"aria-invalid":o||void 0,onChange:e=>n(e.target.value),className:`pr-9 font-mono`}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>l(e=>!e),"aria-label":s?`Hide secret`:`Show secret`,"aria-pressed":s,className:`absolute top-1/2 right-1 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded text-muted hover:bg-hover hover:text-fg`,children:s?(0,f.jsx)(c,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:1.75}):(0,f.jsx)(u,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:1.75})})]})}function v(e){return{plan:e?.plan??``,amount:e?.price?String(e.price.amount):``,currency:e?.price?.currency??`USD`,period:e?.price?.period??`month`,paidAt:e?.paidAt?.slice(0,10)??``,renewsAt:e?.renewsAt?.slice(0,10)??``,notes:e?.notes??``}}function y(e){let t={},n={};e.plan.trim()&&(n.plan=e.plan.trim()),e.notes.trim()&&(n.notes=e.notes.trim()),e.paidAt&&(n.paidAt=e.paidAt),e.renewsAt&&(n.renewsAt=e.renewsAt);let r=e.amount.replace(/[,\s]/g,``);if(r){let i=Number(r),a=e.currency.trim().toUpperCase();(!Number.isFinite(i)||i<0)&&(t.amount=`Number, 0 or more`),/^[A-Z]{3}$/.test(a)||(t.currency=`3-letter code`),!t.amount&&!t.currency&&(n.price={amount:i,currency:a,period:e.period})}return{subscription:Object.keys(n).length>0?n:void 0,errors:t}}function b({value:e,onChange:t,errors:n}){let r=(n,r)=>t({...e,[n]:r});return(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,f.jsx)(o,{label:`Plan`,hint:`As the vendor calls it, e.g. Claude Pro or API pay-as-you-go.`,children:({id:t,describedBy:n})=>(0,f.jsx)(i,{id:t,value:e.plan,placeholder:`Claude Pro`,"aria-describedby":n,onChange:e=>r(`plan`,e.target.value)})}),(0,f.jsxs)(`div`,{className:`grid grid-cols-[1fr_5.5rem_7rem] gap-3`,children:[(0,f.jsx)(o,{label:`Price`,error:n.amount,children:({id:t,describedBy:n,invalid:a})=>(0,f.jsx)(i,{id:t,inputMode:`decimal`,placeholder:`20`,value:e.amount,"aria-describedby":n,"aria-invalid":a||void 0,onChange:e=>r(`amount`,e.target.value),className:`tnum font-mono`})}),(0,f.jsx)(o,{label:`Currency`,error:n.currency,children:({id:t,describedBy:n,invalid:a})=>(0,f.jsx)(i,{id:t,maxLength:3,value:e.currency,"aria-describedby":n,"aria-invalid":a||void 0,onChange:e=>r(`currency`,e.target.value.toUpperCase()),className:`font-mono uppercase`})}),(0,f.jsx)(o,{label:`Per`,children:({id:t})=>(0,f.jsxs)(a,{id:t,value:e.period,onChange:e=>r(`period`,e.target.value),children:[(0,f.jsx)(`option`,{value:`month`,children:`month`}),(0,f.jsx)(`option`,{value:`year`,children:`year`})]})})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,f.jsx)(o,{label:`Last paid`,children:({id:t})=>(0,f.jsx)(i,{id:t,type:`date`,value:e.paidAt,onChange:e=>r(`paidAt`,e.target.value),className:`font-mono`})}),(0,f.jsx)(o,{label:`Renews on`,children:({id:t})=>(0,f.jsx)(i,{id:t,type:`date`,value:e.renewsAt,onChange:e=>r(`renewsAt`,e.target.value),className:`font-mono`})})]}),(0,f.jsx)(o,{label:`Notes`,children:({id:t})=>(0,f.jsx)(i,{id:t,value:e.notes,placeholder:`Shared with the team, prepaid credits…`,onChange:e=>r(`notes`,e.target.value)})})]})}function x(e){return e.split(/[\n,]/).map(e=>e.trim()).filter(Boolean)}function S(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}export{m as a,y as c,S as i,v as l,_ as n,h as o,b as r,x as s,g as t};