@dmrlzz/davecode 0.5.0 → 0.5.1

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 (69) hide show
  1. package/dist/{ChatApp-CJBICQGA.js → ChatApp-YMHKIAAH.js} +6 -6
  2. package/dist/{account-QWDPJWAA.js → account-5QFYCVYM.js} +3 -3
  3. package/dist/{accounts-IQMR72FC.js → accounts-756BMMAL.js} +5 -5
  4. package/dist/{budget-XANOUVWO.js → budget-PGSNCVVK.js} +4 -4
  5. package/dist/{chat-KDDRNC5V.js → chat-D3T4YG5D.js} +8 -8
  6. package/dist/{chunk-AZKACMME.js → chunk-6SHOBL2X.js} +2 -2
  7. package/dist/{chunk-WQ7MEWDF.js → chunk-6WUVR3R2.js} +10 -4
  8. package/dist/chunk-6WUVR3R2.js.map +1 -0
  9. package/dist/{chunk-HSBJDV3O.js → chunk-HENE4DA6.js} +240 -22
  10. package/dist/chunk-HENE4DA6.js.map +1 -0
  11. package/dist/{chunk-W7GPBEBZ.js → chunk-IOATP7KH.js} +2 -2
  12. package/dist/{chunk-FYPMA55O.js → chunk-JFWMLYV7.js} +111 -19
  13. package/dist/chunk-JFWMLYV7.js.map +1 -0
  14. package/dist/{chunk-44AFJL2X.js → chunk-JSRPO2AR.js} +6 -5
  15. package/dist/chunk-JSRPO2AR.js.map +1 -0
  16. package/dist/{chunk-JLATEHS7.js → chunk-K5AA65RS.js} +2 -2
  17. package/dist/{chunk-PGAJIGUF.js → chunk-ZNUNYYN6.js} +3 -3
  18. package/dist/{config-YTUPIYZT.js → config-TKGGYEN7.js} +3 -3
  19. package/dist/dashboard/assets/Accounts-DciFUg4y.js +1 -0
  20. package/dist/dashboard/assets/{Badge-Z4RBdO9j.js → Badge-DUGKlx3Z.js} +1 -1
  21. package/dist/dashboard/assets/{Callout-w8BTYh4k.js → Callout-WgXHDPg0.js} +1 -1
  22. package/dist/dashboard/assets/{Goals-Bw02to72.js → Goals-C6HL1PNE.js} +1 -1
  23. package/dist/dashboard/assets/{Library-DK7mlpRb.js → Library-DwpBYTbK.js} +1 -1
  24. package/dist/dashboard/assets/Markdown-CGgIydUh.js +71 -0
  25. package/dist/dashboard/assets/{Panes-_KTf8pbZ.js → Panes-DxFSwhb7.js} +1 -1
  26. package/dist/dashboard/assets/{RoutesPage-QV0oPRW9.js → RoutesPage-Cyo0MNd7.js} +1 -1
  27. package/dist/dashboard/assets/{Runner-CkHBLQl0.js → Runner-CIL7RxpN.js} +1 -1
  28. package/dist/dashboard/assets/{Settings-BLz2gTBR.js → Settings-B_PEB585.js} +1 -1
  29. package/dist/dashboard/assets/{Tasks-BiUQSTpt.js → Tasks-DEfPSaE6.js} +1 -1
  30. package/dist/dashboard/assets/{Traffic-BVfBuC70.js → Traffic-Dcz-WhsP.js} +1 -1
  31. package/dist/dashboard/assets/{Workspace-CJTgiiU5.js → Workspace-9UCw9q7C.js} +1 -1
  32. package/dist/dashboard/assets/{index-BDBa5cb0.js → index-CpztPbom.js} +3 -3
  33. package/dist/dashboard/assets/{task-errors-Daqwi0ue.js → task-errors-r-WYZ_S3.js} +1 -1
  34. package/dist/dashboard/index.html +2 -2
  35. package/dist/{dist-37VQSHHA.js → dist-F3NRJ5FK.js} +18 -2
  36. package/dist/{doctor-PYUQRRCB.js → doctor-V4XXVVGK.js} +3 -3
  37. package/dist/{goal-SXZUDUCL.js → goal-RUHYPVPA.js} +3 -3
  38. package/dist/index.js +31 -31
  39. package/dist/{init-Z2AFQEEP.js → init-54FKQZ2Z.js} +3 -3
  40. package/dist/{run-AOS7L3RT.js → run-4R25J2VN.js} +3 -3
  41. package/dist/runtime.js +2 -2
  42. package/dist/{start-CEPXKZUE.js → start-GRHW3TGE.js} +3 -3
  43. package/dist/{status-WNJ3GGKU.js → status-QR2HNPBK.js} +4 -4
  44. package/dist/{tasks-TFUTUMWB.js → tasks-BHWDV4JS.js} +4 -4
  45. package/package.json +6 -6
  46. package/dist/chunk-44AFJL2X.js.map +0 -1
  47. package/dist/chunk-FYPMA55O.js.map +0 -1
  48. package/dist/chunk-HSBJDV3O.js.map +0 -1
  49. package/dist/chunk-WQ7MEWDF.js.map +0 -1
  50. package/dist/dashboard/assets/Accounts-cq8RLMoI.js +0 -1
  51. package/dist/dashboard/assets/Markdown-DCZ4Awcc.js +0 -69
  52. /package/dist/{ChatApp-CJBICQGA.js.map → ChatApp-YMHKIAAH.js.map} +0 -0
  53. /package/dist/{account-QWDPJWAA.js.map → account-5QFYCVYM.js.map} +0 -0
  54. /package/dist/{accounts-IQMR72FC.js.map → accounts-756BMMAL.js.map} +0 -0
  55. /package/dist/{budget-XANOUVWO.js.map → budget-PGSNCVVK.js.map} +0 -0
  56. /package/dist/{chat-KDDRNC5V.js.map → chat-D3T4YG5D.js.map} +0 -0
  57. /package/dist/{chunk-AZKACMME.js.map → chunk-6SHOBL2X.js.map} +0 -0
  58. /package/dist/{chunk-W7GPBEBZ.js.map → chunk-IOATP7KH.js.map} +0 -0
  59. /package/dist/{chunk-JLATEHS7.js.map → chunk-K5AA65RS.js.map} +0 -0
  60. /package/dist/{chunk-PGAJIGUF.js.map → chunk-ZNUNYYN6.js.map} +0 -0
  61. /package/dist/{config-YTUPIYZT.js.map → config-TKGGYEN7.js.map} +0 -0
  62. /package/dist/{dist-37VQSHHA.js.map → dist-F3NRJ5FK.js.map} +0 -0
  63. /package/dist/{doctor-PYUQRRCB.js.map → doctor-V4XXVVGK.js.map} +0 -0
  64. /package/dist/{goal-SXZUDUCL.js.map → goal-RUHYPVPA.js.map} +0 -0
  65. /package/dist/{init-Z2AFQEEP.js.map → init-54FKQZ2Z.js.map} +0 -0
  66. /package/dist/{run-AOS7L3RT.js.map → run-4R25J2VN.js.map} +0 -0
  67. /package/dist/{start-CEPXKZUE.js.map → start-GRHW3TGE.js.map} +0 -0
  68. /package/dist/{status-WNJ3GGKU.js.map → status-QR2HNPBK.js.map} +0 -0
  69. /package/dist/{tasks-TFUTUMWB.js.map → tasks-BHWDV4JS.js.map} +0 -0
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Panes-_KTf8pbZ.js","./cn-BwE4cei0.js","./Panes-kHJ-D0s7.css","./Library-DK7mlpRb.js","./Field-Cmpgg_1z.js","./Workspace-CJTgiiU5.js","./Badge-Z4RBdO9j.js","./arrow-up-DjhzZprp.js","./Markdown-DCZ4Awcc.js","./Callout-w8BTYh4k.js","./Goals-Bw02to72.js","./Switch-DPYlLseH.js","./Accounts-cq8RLMoI.js","./forms-DVIUAxAc.js","./trash-BTuDcSaQ.js","./Traffic-BVfBuC70.js","./RoutesPage-QV0oPRW9.js","./task-errors-Daqwi0ue.js","./Tasks-BiUQSTpt.js","./Runner-CkHBLQl0.js","./Settings-BLz2gTBR.js"])))=>i.map(i=>d[i]);
2
- import{a as e,i as t,n,o as r,r as i,t as a}from"./cn-BwE4cei0.js";import{At as o,B as s,Ct as c,Dt as l,E as u,Et as d,Ft as f,It as p,Lt as m,Mt as h,N as g,Nt as _,O as v,Ot as y,P as b,Pt as x,R as ee,St as te,T as ne,Tt as S,V as re,_t as ie,a as ae,bt as oe,c as se,d as ce,ft as le,ht as ue,i as de,j as fe,jt as pe,kt as me,mt as he,n as ge,o as _e,p as ve,pt as ye,r as be,s as xe,st as Se,t as Ce,u as we,vt as Te,wt as C,xt as w,yt as Ee,z as De}from"./Badge-Z4RBdO9j.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Oe=class extends d{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new w({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ke(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=ke(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=ke(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=ke(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){C.batch(()=>{let e=this.getAll();this.#e.clear(),this.#t.clear(),e.forEach(e=>{this.notify({type:`removed`,mutation:e})})})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>o(t,e))}findAll(e={}){return this.getAll().filter(t=>o(e,t))}notify(e){C.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return C.batch(()=>Promise.all(e.map(e=>e.continue().catch(h))))}};function ke(e){return e.options.scope?.id}var Ae=class extends d{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??me(r,t),a=this.get(i);return a||(a=new te({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){C.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>pe(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>pe(e,t)):t}notify(e){C.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){C.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){C.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},T=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ae,this.#t=e.mutationCache||new Oe,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=S.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=c.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(x(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=l(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return C.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;C.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return C.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=C.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(h).catch(h)}invalidateQueries(e,t={}){return C.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=C.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(h)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(h)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(x(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(x(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(h).catch(h)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(h).catch(h)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return c.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(y(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{_(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(y(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{_(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=me(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===f&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},je=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,ee||(ee=!0,ae());else{var t=n(l);t!==null&&ce(x,t.startTime-e)}}}var ee=!1,te=-1,ne=5,S=-1;function re(){return g?!0:!(e.unstable_now()-S<ne)}function ie(){if(g=!1,ee){var t=e.unstable_now();S=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(te),te=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&re());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ce(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ae():ee=!1}}}var ae;if(typeof y==`function`)ae=function(){y(ie)};else if(typeof MessageChannel<`u`){var oe=new MessageChannel,se=oe.port2;oe.port1.onmessage=ie,ae=function(){se.postMessage(null)}}else ae=function(){_(ie,0)};function ce(t,n){te=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ne=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(te),te=-1):h=!0,ce(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,ae()))),r},e.unstable_shouldYield=re,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Me=e(((e,t)=>{t.exports=je()})),Ne=e((e=>{var n=t();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`),s=Symbol.for(`react.recoverable`),c=Symbol.for(`react.optimistic_key`);function l(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:r===c?c:``+r,children:e,containerInfo:t,implementation:n}}var u=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.browser=function(e){return{$$typeof:s,_reason:e}},e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return l(e,t,null,n)},e.flushSync=function(e){var t=u.T,n=a.p;try{if(u.T=null,a.p=2,e)return e()}finally{u.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=d(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??a.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=d(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else a.d.m(e)}},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return u.H.useFormState(e,t,n)},e.useFormStatus=function(){return u.H.useHostTransitionStatus()},e.version=`19.3.1`})),Pe=e(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Ne()})),Fe=e((e=>{var n=Me(),r=t(),i=Pe();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}function p(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&p(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function m(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function h(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function g(e){var t=[null,null],n=m(e);return n===null||_(t,e,n.child,{foundSelf:!1}),t}function _(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&_(e,t,n.child,r))return!0;n=n.sibling}return!1}function v(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(a(559))}}var y=null,b=null;function x(e,t,n){return e===n||e===t&&(y=e,!0)}function ee(e,t,n){return e===n?(b=e,!1):e===t&&(b!==null&&(y=e),!0)}function te(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function ne(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var S=Object.assign,re=Symbol.for(`react.element`),ie=Symbol.for(`react.transitional.element`),ae=Symbol.for(`react.portal`),oe=Symbol.for(`react.fragment`),se=Symbol.for(`react.strict_mode`),ce=Symbol.for(`react.profiler`),le=Symbol.for(`react.consumer`),ue=Symbol.for(`react.context`),de=Symbol.for(`react.forward_ref`),fe=Symbol.for(`react.suspense`),pe=Symbol.for(`react.suspense_list`),me=Symbol.for(`react.memo`),he=Symbol.for(`react.lazy`),ge=Symbol.for(`react.activity`),_e=Symbol.for(`react.legacy_hidden`),ve=Symbol.for(`react.memo_cache_sentinel`),ye=Symbol.for(`react.view_transition`),be=Symbol.for(`react.recoverable`),xe=Symbol.iterator;function Se(e){return typeof e!=`object`||!e?null:(e=xe&&e[xe]||e[`@@iterator`],typeof e==`function`?e:null)}var Ce=Symbol.for(`react.client.reference`);function we(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===Ce?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case oe:return`Fragment`;case ce:return`Profiler`;case se:return`StrictMode`;case fe:return`Suspense`;case pe:return`SuspenseList`;case ge:return`Activity`;case ye:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case ae:return`Portal`;case ue:return e.displayName||`Context`;case le:return(e._context.displayName||`Context`)+`.Consumer`;case de:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case me:return t=e.displayName||null,t===null?we(e.type)||`Memo`:t;case he:t=e._payload,e=e._init;try{return we(e(t))}catch{}}return null}var Te=Array.isArray,C=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,w=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ee={pending:!1,data:null,method:null,action:null},De=[],Oe=-1;function ke(e){return{current:e}}function Ae(e){0>Oe||(e.current=De[Oe],De[Oe]=null,Oe--)}function T(e,t){Oe++,De[Oe]=e.current,e.current=t}var je=ke(null),Ne=ke(null),Fe=ke(null),Ie=ke(null);function Le(e,t){switch(T(Fe,t),T(Ne,e),T(je,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}Ae(je),T(je,e)}function Re(){Ae(je),Ae(Ne),Ae(Fe)}function ze(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,T(Ie,e)),t=je.current;var n=dp(t,e.type);t!==n&&(T(Ne,e),T(je,n))}function Be(e){Ne.current===e&&(Ae(je),Ae(Ne)),Ie.current===e&&(Ae(Ie),sh._currentValue=Ee)}var Ve,He;function Ue(e){if(Ve===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ve=t&&t[1]||``,He=-1<e.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Panes-DxFSwhb7.js","./cn-BwE4cei0.js","./Panes-kHJ-D0s7.css","./Library-DwpBYTbK.js","./Field-Cmpgg_1z.js","./Workspace-9UCw9q7C.js","./Badge-DUGKlx3Z.js","./arrow-up-DjhzZprp.js","./Markdown-CGgIydUh.js","./Callout-WgXHDPg0.js","./Goals-C6HL1PNE.js","./Switch-DPYlLseH.js","./Accounts-DciFUg4y.js","./forms-DVIUAxAc.js","./trash-BTuDcSaQ.js","./Traffic-Dcz-WhsP.js","./RoutesPage-Cyo0MNd7.js","./task-errors-r-WYZ_S3.js","./Tasks-DEfPSaE6.js","./Runner-CIL7RxpN.js","./Settings-B_PEB585.js"])))=>i.map(i=>d[i]);
2
+ import{a as e,i as t,n,o as r,r as i,t as a}from"./cn-BwE4cei0.js";import{At as o,B as s,Ct as c,Dt as l,E as u,Et as d,Ft as f,It as p,Lt as m,Mt as h,N as g,Nt as _,O as v,Ot as y,P as b,Pt as x,R as ee,St as te,T as ne,Tt as S,V as re,_t as ie,a as ae,bt as oe,c as se,d as ce,ft as le,ht as ue,i as de,j as fe,jt as pe,kt as me,mt as he,n as ge,o as _e,p as ve,pt as ye,r as be,s as xe,st as Se,t as Ce,u as we,vt as Te,wt as C,xt as w,yt as Ee,z as De}from"./Badge-DUGKlx3Z.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Oe=class extends d{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new w({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ke(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=ke(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=ke(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=ke(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){C.batch(()=>{let e=this.getAll();this.#e.clear(),this.#t.clear(),e.forEach(e=>{this.notify({type:`removed`,mutation:e})})})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>o(t,e))}findAll(e={}){return this.getAll().filter(t=>o(e,t))}notify(e){C.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return C.batch(()=>Promise.all(e.map(e=>e.continue().catch(h))))}};function ke(e){return e.options.scope?.id}var Ae=class extends d{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??me(r,t),a=this.get(i);return a||(a=new te({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){C.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>pe(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>pe(e,t)):t}notify(e){C.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){C.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){C.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},T=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ae,this.#t=e.mutationCache||new Oe,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=S.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=c.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(x(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=l(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return C.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;C.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return C.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=C.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(h).catch(h)}invalidateQueries(e,t={}){return C.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=C.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(h)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(h)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(x(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(x(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(h).catch(h)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(h).catch(h)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return c.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(y(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{_(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(y(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{_(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=me(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===f&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},je=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,ee||(ee=!0,ae());else{var t=n(l);t!==null&&ce(x,t.startTime-e)}}}var ee=!1,te=-1,ne=5,S=-1;function re(){return g?!0:!(e.unstable_now()-S<ne)}function ie(){if(g=!1,ee){var t=e.unstable_now();S=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(te),te=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&re());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ce(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ae():ee=!1}}}var ae;if(typeof y==`function`)ae=function(){y(ie)};else if(typeof MessageChannel<`u`){var oe=new MessageChannel,se=oe.port2;oe.port1.onmessage=ie,ae=function(){se.postMessage(null)}}else ae=function(){_(ie,0)};function ce(t,n){te=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ne=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(te),te=-1):h=!0,ce(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,ae()))),r},e.unstable_shouldYield=re,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Me=e(((e,t)=>{t.exports=je()})),Ne=e((e=>{var n=t();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`),s=Symbol.for(`react.recoverable`),c=Symbol.for(`react.optimistic_key`);function l(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:r===c?c:``+r,children:e,containerInfo:t,implementation:n}}var u=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.browser=function(e){return{$$typeof:s,_reason:e}},e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return l(e,t,null,n)},e.flushSync=function(e){var t=u.T,n=a.p;try{if(u.T=null,a.p=2,e)return e()}finally{u.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=d(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??a.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=d(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else a.d.m(e)}},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return u.H.useFormState(e,t,n)},e.useFormStatus=function(){return u.H.useHostTransitionStatus()},e.version=`19.3.1`})),Pe=e(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Ne()})),Fe=e((e=>{var n=Me(),r=t(),i=Pe();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}function p(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&p(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function m(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function h(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function g(e){var t=[null,null],n=m(e);return n===null||_(t,e,n.child,{foundSelf:!1}),t}function _(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&_(e,t,n.child,r))return!0;n=n.sibling}return!1}function v(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(a(559))}}var y=null,b=null;function x(e,t,n){return e===n||e===t&&(y=e,!0)}function ee(e,t,n){return e===n?(b=e,!1):e===t&&(b!==null&&(y=e),!0)}function te(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function ne(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var S=Object.assign,re=Symbol.for(`react.element`),ie=Symbol.for(`react.transitional.element`),ae=Symbol.for(`react.portal`),oe=Symbol.for(`react.fragment`),se=Symbol.for(`react.strict_mode`),ce=Symbol.for(`react.profiler`),le=Symbol.for(`react.consumer`),ue=Symbol.for(`react.context`),de=Symbol.for(`react.forward_ref`),fe=Symbol.for(`react.suspense`),pe=Symbol.for(`react.suspense_list`),me=Symbol.for(`react.memo`),he=Symbol.for(`react.lazy`),ge=Symbol.for(`react.activity`),_e=Symbol.for(`react.legacy_hidden`),ve=Symbol.for(`react.memo_cache_sentinel`),ye=Symbol.for(`react.view_transition`),be=Symbol.for(`react.recoverable`),xe=Symbol.iterator;function Se(e){return typeof e!=`object`||!e?null:(e=xe&&e[xe]||e[`@@iterator`],typeof e==`function`?e:null)}var Ce=Symbol.for(`react.client.reference`);function we(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===Ce?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case oe:return`Fragment`;case ce:return`Profiler`;case se:return`StrictMode`;case fe:return`Suspense`;case pe:return`SuspenseList`;case ge:return`Activity`;case ye:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case ae:return`Portal`;case ue:return e.displayName||`Context`;case le:return(e._context.displayName||`Context`)+`.Consumer`;case de:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case me:return t=e.displayName||null,t===null?we(e.type)||`Memo`:t;case he:t=e._payload,e=e._init;try{return we(e(t))}catch{}}return null}var Te=Array.isArray,C=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,w=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ee={pending:!1,data:null,method:null,action:null},De=[],Oe=-1;function ke(e){return{current:e}}function Ae(e){0>Oe||(e.current=De[Oe],De[Oe]=null,Oe--)}function T(e,t){Oe++,De[Oe]=e.current,e.current=t}var je=ke(null),Ne=ke(null),Fe=ke(null),Ie=ke(null);function Le(e,t){switch(T(Fe,t),T(Ne,e),T(je,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}Ae(je),T(je,e)}function Re(){Ae(je),Ae(Ne),Ae(Fe)}function ze(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,T(Ie,e)),t=je.current;var n=dp(t,e.type);t!==n&&(T(Ne,e),T(je,n))}function Be(e){Ne.current===e&&(Ae(je),Ae(Ne)),Ie.current===e&&(Ae(Ie),sh._currentValue=Ee)}var Ve,He;function Ue(e){if(Ve===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ve=t&&t[1]||``,He=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+Ve+e+He}var We=!1;function Ge(e,t){if(!e||We)return``;We=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
5
5
  `),l=s.split(`
@@ -101,4 +101,4 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
101
101
  `},Tp=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Ep=function(){V.useEffect(function(){return document.body.setAttribute(Cp,(Tp()+1).toString()),function(){var e=Tp()-1;e<=0?document.body.removeAttribute(Cp):document.body.setAttribute(Cp,e.toString())}},[])},Dp=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Ep();var a=V.useMemo(function(){return xp(i)},[i]);return V.createElement(Sp,{styles:wp(a,!t,i,n?``:`!important`)})},Op=!1;if(typeof window<`u`)try{var kp=Object.defineProperty({},"passive",{get:function(){return Op=!0,!0}});window.addEventListener(`test`,kp,kp),window.removeEventListener(`test`,kp,kp)}catch{Op=!1}var Ap=Op?{passive:!1}:!1,jp=function(e){return e.tagName===`TEXTAREA`},Mp=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!jp(e)&&n[t]===`visible`)},Np=function(e){return Mp(e,`overflowY`)},Pp=function(e){return Mp(e,`overflowX`)},Fp=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Rp(e,r)){var i=zp(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ip=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Lp=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Rp=function(e,t){return e===`v`?Np(t):Pp(t)},zp=function(e,t){return e===`v`?Ip(t):Lp(t)},Bp=function(e,t){return e===`h`&&t===`rtl`?-1:1},Vp=function(e,t,n,r,i){var a=Bp(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=zp(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Rp(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Hp=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Up=function(e){return[e.deltaX,e.deltaY]},Wp=function(e){return e&&`current`in e?e.current:e},Gp=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Kp=function(e){return`
102
102
  .block-interactivity-${e} {pointer-events: none;}
103
103
  .allow-interactivity-${e} {pointer-events: all;}
104
- `},qp=0,Jp=[];function Yp(e){var t=V.useRef([]),n=V.useRef([0,0]),r=V.useRef(),i=V.useState(qp++)[0],a=V.useState(_p)[0],o=V.useRef(e);V.useEffect(function(){o.current=e},[e]),V.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Jf([e.lockRef.current],(e.shards||[]).map(Wp),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=V.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Hp(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Fp(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Fp(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Vp(h,t,e,h===`h`?s:c,!0)},[]),c=V.useCallback(function(e){var n=e;if(Jp.length&&Jp[Jp.length-1]===a){var r=`deltaY`in n?Up(n):Hp(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Gp(e.delta,r)})[0];if(i&&i.should)n.cancelable&&n.preventDefault();else if(!i){var c=(o.current.shards||[]).map(Wp).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=V.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Xp(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=V.useCallback(function(e){n.current=Hp(e),r.current=void 0},[]),d=V.useCallback(function(t){l(t.type,Up(t),t.target,s(t,e.lockRef.current))},[]),f=V.useCallback(function(t){l(t.type,Hp(t),t.target,s(t,e.lockRef.current))},[]);V.useEffect(function(){return Jp.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Ap),document.addEventListener(`touchmove`,c,Ap),document.addEventListener(`touchstart`,u,Ap),function(){Jp=Jp.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Ap),document.removeEventListener(`touchmove`,c,Ap),document.removeEventListener(`touchstart`,u,Ap)}},[]);var p=e.removeScrollBar,m=e.inert;return V.createElement(V.Fragment,null,m?V.createElement(a,{styles:Kp(i)}):null,p?V.createElement(Dp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Xp(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Zp=sp(cp,Yp),Qp=V.forwardRef(function(e,t){return V.createElement(up,Kf({},e,{ref:t,sideCar:Zp}))});Qp.classNames=up.classNames;var $p=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},em=new WeakMap,tm=new WeakMap,nm={},rm=0,im=function(e){return e&&(e.host||im(e.parentNode))},am=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=im(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},om=function(e,t,n,r){var i=am(t,Array.isArray(e)?e:[e]);nm[n]||(nm[n]=new WeakMap);var a=nm[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(em.get(e)||0)+1,l=(a.get(e)||0)+1;em.set(e,c),a.set(e,l),o.push(e),c===1&&i&&tm.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),rm++,function(){o.forEach(function(e){var t=em.get(e)-1,i=a.get(e)-1;em.set(e,t),a.set(e,i),t||(tm.has(e)||e.removeAttribute(r),tm.delete(e)),i||e.removeAttribute(n)}),rm--,rm||(em=new WeakMap,em=new WeakMap,tm=new WeakMap,nm={})}},sm=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||$p(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),om(r,i,n,`aria-hidden`)):function(){return null}},cm=Object.defineProperty,lm=(e,t)=>cm(e,`name`,{value:t,configurable:!0}),um=`Dialog`,[dm,fm]=ld(um),[pm,mm]=dm(um),hm=lm(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=V.useRef(null),c=V.useRef(null),[l,u]=wd({prop:r,defaultProp:i??!1,onChange:a,caller:um}),[d,f]=V.useState(0),[p,m]=V.useState(0);return(0,H.jsx)(pm,{scope:t,triggerRef:s,contentRef:c,contentId:gd(),titleId:gd(),descriptionId:gd(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:V.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),gm=`DialogPortal`,[_m,vm]=dm(gm,{forceMount:void 0}),ym=lm(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=mm(gm,t);return(0,H.jsx)(_m,{scope:t,forceMount:n,children:V.Children.map(r,e=>(0,H.jsx)(Pf,{present:n||a.open,children:(0,H.jsx)(Af,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),bm=`DialogOverlay`,xm=V.forwardRef(lm(function(e,t){let n=vm(bm,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=mm(bm,e.__scopeDialog);return a.modal?(0,H.jsx)(Pf,{present:r||a.open,children:(0,H.jsx)(Cm,{...i,ref:t})}):null},`DialogOverlay`)),Sm=Md(`DialogOverlay.RemoveScroll`),Cm=V.forwardRef(lm(function(e,t){let{__scopeDialog:n,...r}=e,i=mm(bm,n),a=ad(t,sf());return(0,H.jsx)(Qp,{as:Sm,allowPinchZoom:!0,shards:[i.contentRef],children:(0,H.jsx)(qd.div,{"data-state":km(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),wm=`DialogContent`,Tm=V.forwardRef(lm(function(e,t){let n=vm(wm,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=mm(wm,e.__scopeDialog);return(0,H.jsx)(Pf,{present:r||a.open,children:a.modal?(0,H.jsx)(Em,{...i,ref:t}):(0,H.jsx)(Dm,{...i,ref:t})})},`DialogContent`)),Em=V.forwardRef(lm(function(e,t){let n=mm(wm,e.__scopeDialog),r=V.useRef(null),i=ad(t,n.contentRef,r);return V.useEffect(()=>{let e=r.current;if(e)return sm(e)},[]),(0,H.jsx)(Om,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:G(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:G(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:G(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Dm=V.forwardRef(lm(function(e,t){let n=mm(wm,e.__scopeDialog),r=V.useRef(!1),i=V.useRef(!1);return(0,H.jsx)(Om,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),Om=V.forwardRef(lm(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=mm(wm,n);return Wf(),(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(_f,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,H.jsx)(of,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":km(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`));function km(e){return e?`open`:`closed`}lm(km,`getState`);var Am=`[cmdk-group=""]`,jm=`[cmdk-group-items=""]`,Mm=`[cmdk-group-heading=""]`,Nm=`[cmdk-item=""]`,Pm=`${Nm}:not([aria-disabled="true"])`,Fm=`cmdk-item-select`,Im=`data-value`,Lm=(e,t,n)=>Zu(e,t,n),Rm=V.createContext(void 0),zm=()=>V.useContext(Rm),Bm=V.createContext(void 0),Vm=()=>V.useContext(Bm),Hm=V.createContext(void 0),Um=V.forwardRef((e,t)=>{let n=rh(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=rh(()=>new Set),i=rh(()=>new Map),a=rh(()=>new Map),o=rh(()=>new Set),s=th(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=gd(),y=gd(),b=gd(),x=V.useRef(null),ee=oh();nh(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,te.emit()}},[u]),nh(()=>{ee(6,oe)},[]);let te=V.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)ae(),re(),ee(1,ie);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(ee(7,()=>{n.current.selectedItemId=se()?.id,te.emit()}),r||ee(5,oe),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}te.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),ne=V.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,S(t,r)),ee(2,()=>{re(),te.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),ee(3,()=>{ae(),re(),n.current.value||ie(),te.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=se();ee(4,()=>{ae(),t?.getAttribute(`id`)===e&&ie(),te.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function S(e,t){let r=s.current?.filter??Lm;return e?r(e,n.current.search,t):0}function re(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;ce().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(jm);t?t.appendChild(e.parentElement===t?e:e.closest(`${jm} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${jm} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${Am}[${Im}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function ie(){let e=ce().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Im);te.setState(`value`,e||void 0)}function ae(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=S(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function oe(){var e;let t=se();t&&(t.parentElement?.firstChild===t&&((e=t.closest(Am)?.querySelector(Mm))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function se(){return x.current?.querySelector(`${Nm}[aria-selected="true"]`)}function ce(){return Array.from(x.current?.querySelectorAll(Pm)||[])}function le(e){let t=ce()[e];t&&te.setState(`value`,t.getAttribute(Im))}function ue(e){var t;let n=se(),r=ce(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&te.setState(`value`,a.getAttribute(Im))}function de(e){let t=se()?.closest(Am),n;for(;t&&!n;)t=e>0?$m(t,Am):eh(t,Am),n=t?.querySelector(Pm);n?te.setState(`value`,n.getAttribute(Im)):ue(e)}let fe=()=>le(ce().length-1),pe=e=>{e.preventDefault(),e.metaKey?fe():e.altKey?de(1):ue(1)},me=e=>{e.preventDefault(),e.metaKey?le(0):e.altKey?de(-1):ue(-1)};return V.createElement(qd.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&pe(e);break;case`ArrowDown`:pe(e);break;case`p`:case`k`:g&&e.ctrlKey&&me(e);break;case`ArrowUp`:me(e);break;case`Home`:e.preventDefault(),le(0);break;case`End`:e.preventDefault(),fe();break;case`Enter`:{e.preventDefault();let t=se();if(t){let e=new Event(Fm);t.dispatchEvent(e)}}}}},V.createElement(`label`,{"cmdk-label":``,htmlFor:ne.inputId,id:ne.labelId,style:lh},c),ch(e,e=>V.createElement(Bm.Provider,{value:te},V.createElement(Rm.Provider,{value:ne},e))))}),Wm=V.forwardRef((e,t)=>{let n=gd(),r=V.useRef(null),i=V.useContext(Hm),a=zm(),o=th(e),s=o.current?.forceMount??i?.forceMount;nh(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=ah(n,r,[e.value,e.children,r],e.keywords),l=Vm(),u=ih(e=>e.value&&e.value===c.current),d=ih(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);V.useEffect(()=>{let t=r.current;if(t&&!e.disabled)return t.addEventListener(Fm,f),()=>t.removeEventListener(Fm,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return V.createElement(qd.div,{ref:id(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),Gm=V.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=gd(),s=V.useRef(null),c=V.useRef(null),l=gd(),u=zm(),d=ih(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));nh(()=>u.group(o),[]),ah(o,s,[e.value,e.heading,c]);let f=V.useMemo(()=>({id:o,forceMount:i}),[i]);return V.createElement(qd.div,{ref:id(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&V.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),ch(e,e=>V.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},V.createElement(Hm.Provider,{value:f},e))))}),Km=V.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=V.useRef(null),a=ih(e=>!e.search);return!n&&!a?null:V.createElement(qd.div,{ref:id(i,t),...r,"cmdk-separator":``,role:`separator`})}),qm=V.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Vm(),o=ih(e=>e.search),s=ih(e=>e.selectedItemId),c=zm();return V.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),V.createElement(qd.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Jm=V.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=V.useRef(null),o=V.useRef(null),s=ih(e=>e.selectedItemId),c=zm();return V.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),V.createElement(qd.div,{ref:id(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},ch(e,e=>V.createElement(`div`,{ref:id(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),Ym=V.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return V.createElement(hm,{open:n,onOpenChange:r},V.createElement(ym,{container:o},V.createElement(xm,{"cmdk-overlay":``,className:i}),V.createElement(Tm,{"aria-label":e.label,"cmdk-dialog":``,className:a},V.createElement(Um,{ref:t,...s}))))}),Xm=V.forwardRef((e,t)=>ih(e=>e.filtered.count===0)?V.createElement(qd.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),Zm=V.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return V.createElement(qd.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},ch(e,e=>V.createElement(`div`,{"aria-hidden":!0},e)))}),Qm=Object.assign(Um,{List:Jm,Item:Wm,Input:qm,Group:Gm,Separator:Km,Dialog:Ym,Empty:Xm,Loading:Zm});function $m(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function eh(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function th(e){let t=V.useRef(e);return nh(()=>{t.current=e}),t}var nh=typeof window>`u`?V.useEffect:V.useLayoutEffect;function rh(e){let t=V.useRef();return t.current===void 0&&(t.current=e()),t}function ih(e){let t=Vm(),n=()=>e(t.snapshot());return V.useSyncExternalStore(t.subscribe,n,n)}function ah(e,t,n,r=[]){let i=V.useRef(),a=zm();return nh(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(Im,s),i.current=s}),i}var oh=()=>{let[e,t]=V.useState(),n=rh(()=>new Map);return nh(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function sh(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function ch({asChild:e,children:t},n){return e&&V.isValidElement(t)?V.cloneElement(sh(t),{ref:t.ref},n(t.props.children)):n(t)}var lh={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},uh=[],dh=0,fh=new Set;function ph(){for(let e of fh)e()}function mh(e){uh=uh.filter(t=>t.id!==e),ph()}function hh(e){dh+=1;let t=dh;uh=[...uh.slice(-3),{...e,id:t}],ph(),setTimeout(()=>mh(t),4e3)}function gh(){return(0,V.useSyncExternalStore)(e=>(fh.add(e),()=>fh.delete(e)),()=>uh,()=>uh)}var _h={palette:!1,help:!1,sidebarOverlay:!1},vh=new Set;function yh(e){_h={..._h,...e};for(let e of vh)e()}var bh={openPalette:()=>yh({palette:!0,help:!1}),closePalette:()=>yh({palette:!1}),togglePalette:()=>yh({palette:!_h.palette,help:!1}),openHelp:()=>yh({help:!0,palette:!1}),closeHelp:()=>yh({help:!1}),setSidebarOverlay:e=>yh({sidebarOverlay:e})},xh=`(max-width: 1023px)`;function Sh(e){window.matchMedia(`(max-width: 1023px)`).matches?yh({sidebarOverlay:!_h.sidebarOverlay}):e()}function Ch(){return(0,V.useSyncExternalStore)(e=>(vh.add(e),()=>vh.delete(e)),()=>_h,()=>_h)}function wh(e){return(0,V.useSyncExternalStore)(t=>{let n=window.matchMedia(e);return n.addEventListener(`change`,t),()=>n.removeEventListener(`change`,t)},()=>window.matchMedia(e).matches,()=>!1)}function Th(e=1e3){let[t,n]=(0,V.useState)(()=>Date.now());return(0,V.useEffect)(()=>{let t=window.setInterval(()=>n(Date.now()),e);return()=>window.clearInterval(t)},[e]),t}function Eh(){let e=(0,V.useRef)(null),[t,n]=(0,V.useState)(0);return(0,V.useEffect)(()=>{let t=e.current;if(!t)return;n(t.clientWidth);let r=new ResizeObserver(e=>{let t=e[0]?.contentRect.width;t!==void 0&&n(Math.floor(t))});return r.observe(t),()=>r.disconnect()},[]),[e,t]}function Dh({provider:e,size:t=`md`,className:n}){let r=Se(e),i=r.icon,o=t===`sm`?`size-5 rounded`:t===`lg`?`size-8 rounded-md`:`size-6 rounded-md`,s=t===`sm`?`size-3`:t===`lg`?`size-4`:`size-3.5`;return(0,H.jsxs)(`span`,{title:r.label,className:a(`inline-flex shrink-0 items-center justify-center border border-line-strong bg-raised text-fg-2`,o,n),children:[(0,H.jsx)(i,{"aria-hidden":!0,className:s,strokeWidth:1.75}),(0,H.jsx)(`span`,{className:`sr-only`,children:r.label})]})}var Oh={active:`ok`,cooldown:`warn`,disabled:`neutral`,error:`err`};function kh({account:e}){let t=Th(1e3),n=Oh[e.status];if(e.status===`cooldown`&&e.cooldownUntil){let r=(Date.parse(e.cooldownUntil)-t)/1e3;return(0,H.jsxs)(Ce,{tone:n,dot:!0,children:[(0,H.jsx)(`span`,{children:`cooldown`}),(0,H.jsx)(`span`,{className:`tnum font-mono`,children:r>0?ae(r):`0:00`})]})}return(0,H.jsx)(`span`,{title:e.status===`error`?e.lastError:void 0,children:(0,H.jsx)(Ce,{tone:n,dot:!0,children:e.status})})}var Ah={PENDING:`neutral`,IN_PROGRESS:`info`,SUCCESS:`ok`,FAILED:`err`},jh={PENDING:`Pending`,IN_PROGRESS:`In progress`,SUCCESS:`Done`,FAILED:`Failed`};function Mh({status:e}){return(0,H.jsx)(Ce,{tone:Ah[e],dot:!0,pulse:e===`IN_PROGRESS`,children:jh[e]})}function Nh({status:e,className:t}){return(0,H.jsx)(ge,{tone:Ah[e],pulse:e===`IN_PROGRESS`,className:t})}function Ph({account:e,fallbackId:t,provider:n,showId:r,className:i}){let o=e?.provider??n??`openai-compatible`;return(0,H.jsxs)(`span`,{className:a(`inline-flex min-w-0 items-center gap-2`,i),children:[(0,H.jsx)(Dh,{provider:o,size:`sm`}),(0,H.jsxs)(`span`,{className:`min-w-0`,children:[(0,H.jsx)(`span`,{className:`block truncate text-fg`,children:e?.label??t??`unknown`}),r&&(0,H.jsx)(`span`,{className:`block truncate font-mono text-2xs text-muted`,children:e?.id??t})]})]})}var Fh=`https://github.com/DMRLZZ/DaveCode`;function Ih(){let{palette:e}=Ch(),t=(0,V.useRef)(null),n=(0,V.useRef)(null);return(0,V.useEffect)(()=>{let r=t.current;r&&(e&&!r.open&&(r.showModal(),n.current?.focus()),!e&&r.open&&r.close())},[e]),(0,V.useEffect)(()=>{let e=t.current;if(!e)return;let n=e=>{e.preventDefault(),bh.closePalette()};return e.addEventListener(`cancel`,n),()=>e.removeEventListener(`cancel`,n)},[]),(0,H.jsx)(`dialog`,{ref:t,"aria-label":`Command palette`,onClick:e=>{e.target===e.currentTarget&&bh.closePalette()},className:`mx-auto mt-[12vh] w-[min(640px,calc(100vw-2rem))] overflow-hidden rounded-xl border border-line-strong bg-panel p-0 text-fg shadow-overlay outline-none backdrop:bg-scrim open:animate-pop-in`,children:e&&(0,H.jsx)(Lh,{inputRef:n})})}function Lh({inputRef:e}){let t=ve(),n=g(),r=v(),i=fe(),{retry:a,connection:o}=s(),c=bh.closePalette,l=e=>()=>{c(),e()},u=e=>l(()=>{i.mutate(e,{onSuccess:e=>hh({tone:`info`,title:`Runner ${e.state}`}),onError:t=>hh({tone:`err`,title:`Could not ${e} the runner`,description:le(t)})})}),d=(e,t)=>l(()=>{navigator.clipboard.writeText(e).then(()=>hh({tone:`ok`,title:`Copied ${t}`,description:e})).catch(()=>hh({tone:`err`,title:`Clipboard unavailable`}))}),f=ie(ue().theme),p=`${ue().gatewayUrl||`http://127.0.0.1:4040`}/v1`;return(0,H.jsxs)(Qm,{label:`Command palette`,loop:!0,className:`flex max-h-[min(520px,70vh)] flex-col`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5 border-b border-line px-4`,children:[(0,H.jsx)(Kt,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted`,strokeWidth:1.75}),(0,H.jsx)(Qm.Input,{ref:e,placeholder:`Search pages, actions, accounts, tasks…`,className:`h-12 flex-1 bg-transparent text-[14px] text-fg outline-none placeholder:text-faint`}),(0,H.jsx)(W,{children:`Esc`})]}),(0,H.jsxs)(Qm.List,{className:`min-h-0 flex-1 overflow-y-auto p-1.5 [&_[cmdk-group-heading]]:px-2.5 [&_[cmdk-group-heading]]:pt-2.5 [&_[cmdk-group-heading]]:pb-1 [&_[cmdk-group-heading]]:text-2xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:tracking-[0.08em] [&_[cmdk-group-heading]]:text-muted [&_[cmdk-group-heading]]:uppercase`,children:[(0,H.jsx)(Qm.Empty,{className:`px-3 py-8 text-center text-[13px] text-muted`,children:`No results.`}),(0,H.jsx)(Qm.Group,{heading:`Go to`,children:xu.map(e=>(0,H.jsxs)(Rh,{value:`go ${e.label}`,keywords:[e.description],icon:e.icon,onSelect:l(()=>gu(e.path)),hint:(0,H.jsx)(Cu,{keys:[`g`,e.key]}),children:[e.label,(0,H.jsx)(`span`,{className:`ml-2 text-muted`,children:e.description})]},e.id))}),(0,H.jsxs)(Qm.Group,{heading:`Actions`,children:[(0,H.jsx)(Rh,{value:`add account`,icon:Bt,onSelect:l(()=>gu(`/accounts?new=1`)),children:`Add account`}),(0,H.jsx)(Rh,{value:`start resume runner`,icon:Rt,onSelect:u(`start`),children:`Start or resume the runner`}),(0,H.jsx)(Rh,{value:`pause runner`,icon:It,onSelect:u(`pause`),children:`Pause the runner`}),(0,H.jsx)(Rh,{value:`stop runner`,icon:Qt,onSelect:u(`stop`),children:`Stop the runner`}),(0,H.jsxs)(Rh,{value:`toggle theme dark light`,icon:f===`dark`?en:At,onSelect:l(()=>Te({theme:f===`dark`?`light`:`dark`})),children:[`Switch to `,f===`dark`?`light`:`dark`,` theme`]}),(0,H.jsx)(Rh,{value:`toggle mock data demo`,icon:gt,onSelect:l(()=>Te({dataMode:o.mode===`mock`?`auto`:`mock`})),children:o.mode===`mock`?`Use the live gateway (auto)`:`Show mock data`}),(0,H.jsxs)(Rh,{value:`copy openai base url`,icon:ft,onSelect:d(p,`base URL`),children:[`Copy OpenAI base URL`,(0,H.jsx)(`span`,{className:`ml-2 font-mono text-muted`,children:p})]}),(0,H.jsx)(Rh,{value:`retry reconnect gateway`,icon:Ht,onSelect:l(a),children:`Retry gateway connection`}),(0,H.jsx)(Rh,{value:`keyboard shortcuts help`,icon:St,onSelect:l(bh.openHelp),hint:(0,H.jsx)(W,{children:`?`}),children:`Keyboard shortcuts`})]}),(t.data?.length??0)>0&&(0,H.jsx)(Qm.Group,{heading:`Accounts`,children:t.data?.map(e=>(0,H.jsxs)(Rh,{value:`account ${e.label} ${e.id}`,keywords:[e.provider,e.status],iconNode:(0,H.jsx)(Dh,{provider:e.provider,size:`sm`}),onSelect:l(()=>gu(`/accounts?account=${encodeURIComponent(e.id)}`)),children:[e.label,(0,H.jsx)(`span`,{className:`ml-2 font-mono text-2xs text-muted`,children:e.id})]},e.id))}),(n.data?.graph.tasks.length??0)>0&&(0,H.jsx)(Qm.Group,{heading:`Tasks`,children:n.data?.graph.tasks.map(e=>(0,H.jsxs)(Rh,{value:`task ${e.id} ${e.title}`,keywords:[e.status],iconNode:(0,H.jsx)(`span`,{className:`flex size-5 items-center justify-center`,children:(0,H.jsx)(Nh,{status:e.status})}),onSelect:l(()=>gu(`/tasks?task=${encodeURIComponent(e.id)}`)),children:[(0,H.jsx)(`span`,{className:`font-mono text-[12px] text-muted`,children:e.id}),(0,H.jsx)(`span`,{className:`ml-2 truncate`,children:e.title})]},e.id))}),(r.data?.routes.length??0)>0&&(0,H.jsx)(Qm.Group,{heading:`Routes`,children:r.data?.routes.map(e=>(0,H.jsx)(Rh,{value:`route davecode/${e.name}`,keywords:[e.description??``],icon:Wt,onSelect:d(`davecode/${e.name}`,`model name`),hint:(0,H.jsx)(`span`,{className:`text-2xs text-muted`,children:`copy`}),children:(0,H.jsxs)(`span`,{className:`font-mono`,children:[`davecode/`,e.name]})},e.name))}),(0,H.jsx)(Qm.Group,{heading:`Docs`,children:[[`README`,`${Fh}#readme`],[`Architecture`,`${Fh}/blob/main/docs/ARCHITECTURE.md`],[`HTTP API reference`,`${Fh}/blob/main/docs/API.md`]].map(([e,t])=>(0,H.jsx)(Rh,{value:`docs ${e}`,icon:e===`Architecture`?vt:Je,onSelect:l(()=>window.open(t,`_blank`,`noopener,noreferrer`)),children:e},e))})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-line px-4 py-2 text-2xs text-muted`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,H.jsx)(W,{children:`↑`}),(0,H.jsx)(W,{children:`↓`}),` navigate`]}),(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,H.jsx)(W,{children:`↵`}),` select`]}),(0,H.jsxs)(`span`,{className:`ml-auto inline-flex items-center gap-1`,children:[(0,H.jsx)(mt,{"aria-hidden":!0,className:`size-3`,strokeWidth:1.75}),`DaveCode`]})]})]})}function Rh({value:e,keywords:t,icon:n,iconNode:r,hint:i,onSelect:o,children:s}){return(0,H.jsxs)(Qm.Item,{value:e,keywords:t,onSelect:o,className:a(`flex h-9 cursor-pointer items-center gap-2.5 rounded-md px-2.5 text-[13px] text-fg-2 select-none`,`data-[selected=true]:bg-hover data-[selected=true]:text-fg`),children:[r??(n&&(0,H.jsx)(n,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted`,strokeWidth:1.75})),(0,H.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center truncate`,children:s}),i]})}function zh({value:e,label:t=`Copy`,className:n}){let[r,i]=(0,V.useState)(!1);(0,V.useEffect)(()=>{if(!r)return;let e=window.setTimeout(()=>i(!1),1400);return()=>window.clearTimeout(e)},[r]);let o=async()=>{try{await navigator.clipboard.writeText(e),i(!0)}catch{}},s=r?et:ft;return(0,H.jsx)(`button`,{type:`button`,onClick:o,"aria-label":r?`Copied`:t,title:r?`Copied`:t,className:a(`inline-flex size-6 shrink-0 items-center justify-center rounded text-muted transition-colors duration-150 hover:bg-hover hover:text-fg`,r&&`text-ok hover:text-ok`,n),children:(0,H.jsx)(s,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:1.75})})}function Bh({command:e,className:t}){return(0,H.jsxs)(`div`,{className:a(`flex min-w-0 items-center gap-2 rounded-md border border-line bg-raised py-1 pr-1 pl-2.5 font-mono text-[12px] text-fg-2`,t),children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:`text-faint select-none`,children:`$`}),(0,H.jsx)(`code`,{className:`min-w-0 flex-1 truncate`,children:e}),(0,H.jsx)(zh,{value:e,label:`Copy command`})]})}function Vh(){let{connection:e,retry:t}=s(),n=Ee(),r=Th(1e3),[i,o]=(0,V.useState)(!1),c=(0,V.useRef)(null);(0,V.useEffect)(()=>{if(!i)return;let e=e=>{c.current?.contains(e.target)||o(!1)},t=e=>{e.key===`Escape`&&o(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[i]);let{mode:l,stream:u,reason:d,unauthorized:f}=e,p=`neutral`,m=`Connecting…`,h=!1;if(l===`mock`)p=`accent`,m=`Mock data`;else if(f)p=`err`,m=`Unauthorized`;else if(l===`live`&&u.state===`open`)p=`ok`,m=`Live`,h=!0;else if(u.state===`reconnecting`){p=`warn`;let e=u.retryAt?Math.max(0,Math.ceil((u.retryAt-r)/1e3)):0;m=e>0?`Reconnecting in ${e}s`:`Reconnecting…`}let g=n.gatewayUrl||window.location.origin;return(0,H.jsxs)(`div`,{ref:c,className:`relative`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),"aria-expanded":i,"aria-haspopup":`dialog`,"aria-label":`Connection: ${m}. Show details`,className:a(`flex h-7 items-center gap-2 rounded-md border px-2.5 text-[12px] font-medium transition-colors duration-150`,l===`mock`?`border-accent/30 bg-accent-soft text-accent-text hover:border-accent/50`:`border-line bg-panel text-fg-2 hover:border-line-strong hover:text-fg`),children:[l===`mock`?(0,H.jsx)(gt,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:1.75}):(0,H.jsx)(ge,{tone:p,pulse:h,className:`size-[7px]`}),(0,H.jsx)(`span`,{className:`whitespace-nowrap`,children:m})]}),i&&(0,H.jsxs)(`div`,{role:`dialog`,"aria-label":`Connection details`,className:`absolute top-9 right-0 z-30 w-[320px] animate-pop-in rounded-lg border border-line-strong bg-panel p-3.5 text-[12px] shadow-overlay`,children:[(0,H.jsxs)(`dl`,{className:`grid grid-cols-[88px_1fr] gap-x-3 gap-y-1.5`,children:[(0,H.jsx)(`dt`,{className:`text-muted`,children:`Source`}),(0,H.jsx)(`dd`,{className:`text-fg`,children:l===`mock`?`Simulated in this browser`:l===`probing`?`Probing…`:`Gateway`}),(0,H.jsx)(`dt`,{className:`text-muted`,children:`Gateway`}),(0,H.jsx)(`dd`,{className:`truncate font-mono text-fg-2`,children:g}),(0,H.jsx)(`dt`,{className:`text-muted`,children:`Event stream`}),(0,H.jsxs)(`dd`,{className:`text-fg-2`,children:[u.state,u.attempt>0&&` · attempt ${u.attempt}`]}),u.lastEventAt&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:`text-muted`,children:`Last event`}),(0,H.jsx)(`dd`,{className:`text-fg-2`,children:ce(u.lastEventAt,r)})]})]}),l===`mock`&&(0,H.jsxs)(`div`,{className:`mt-3 border-t border-line pt-3 text-fg-2`,children:[d===`unreachable`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{children:`The gateway did not answer, so the dashboard is showing simulated data. Start it with:`}),(0,H.jsx)(Bh,{command:`davecode start`,className:`mt-2`}),(0,H.jsx)(`p`,{className:`mt-2 text-muted`,children:`Retrying automatically every 15 s.`})]}),d===`forced`&&(0,H.jsxs)(`p`,{children:[`Mock mode is forced by `,(0,H.jsx)(`code`,{className:`font-mono`,children:`?mock=1`}),` or`,` `,(0,H.jsx)(`code`,{className:`font-mono`,children:`VITE_DAVECODE_MOCK=1`}),`.`]}),d===`setting`&&(0,H.jsx)(`p`,{children:`Mock mode is selected in Settings.`})]}),f&&(0,H.jsx)(`p`,{className:`mt-3 border-t border-line pt-3 text-err`,children:`The gateway requires a bearer token. Add it in Settings.`}),(0,H.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,H.jsx)(ju,{size:`sm`,variant:`ghost`,onClick:()=>{o(!1),gu(`/settings`)},children:`Settings`}),d!==`forced`&&(0,H.jsx)(ju,{size:`sm`,icon:Ht,onClick:t,children:`Retry now`})]})]})]})}var Hh=[{title:`General`,items:[{keys:[`mod`,`K`],description:`Open the command palette`},{keys:[`?`],description:`Show keyboard shortcuts`},{keys:[`/`],description:`Focus the filter on this page`},{keys:[`[`],description:`Collapse or expand the sidebar`},{keys:[`Esc`],description:`Close the open dialog or sheet`}]},{title:`Go to`,items:xu.map(e=>({keys:[`g`,e.key],description:e.label}))},{title:`Charts and lists`,items:[{keys:[`←`,`→`],description:`Step through chart values (when the chart is focused)`},{keys:[`Home`,`End`],description:`First or last chart value`},{keys:[`Tab`],description:`Move between task graph nodes`}]}];function Uh(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable}function Wh(){return document.querySelector(`dialog[open]`)!==null}function Gh(){(0,V.useEffect)(()=>{let e=0,t=t=>{if(!(t.target instanceof HTMLElement&&t.target.closest(`.xterm`))){if((t.metaKey||t.ctrlKey)&&!t.altKey&&t.key.toLowerCase()===`k`)t.preventDefault(),bh.togglePalette();else if(t.key===`Escape`&&bh.setSidebarOverlay(!1),!(t.defaultPrevented||t.metaKey||t.ctrlKey||t.altKey)&&!(Uh(t.target)||Wh())){if(e&&Date.now()-e<1200){e=0;let n=xu.find(e=>e.key===t.key.toLowerCase());n&&(t.preventDefault(),gu(n.path))}else switch(t.key){case`g`:e=Date.now();break;case`?`:t.preventDefault(),bh.openHelp();break;case`[`:t.preventDefault(),Sh(()=>Te({sidebarCollapsed:!ue().sidebarCollapsed}));break;case`/`:{let e=document.querySelector(`[data-filter-input]`);e&&(t.preventDefault(),e.focus(),e.select());break}}}}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[])}function Kh(e,t){let n=(0,V.useRef)(null);return(0,V.useEffect)(()=>{let t=n.current;t&&(e&&!t.open&&(t.showModal(),t.focus()),!e&&t.open&&t.close())},[e]),(0,V.useEffect)(()=>{let e=n.current;if(!e)return;let r=e=>{e.preventDefault(),t()};return e.addEventListener(`cancel`,r),()=>e.removeEventListener(`cancel`,r)},[t]),{ref:n,onBackdropClick:e=>{e.target===e.currentTarget&&t()}}}function qh({open:e,onClose:t,title:n,description:r,children:i,footer:o,className:s,width:c=`w-[min(480px,100vw)]`}){let{ref:l,onBackdropClick:u}=Kh(e,t),d=(0,V.useId)();return(0,H.jsx)(`dialog`,{ref:l,tabIndex:-1,"aria-labelledby":d,onClick:u,className:a(`fixed inset-y-0 right-0 left-auto m-0 h-dvh max-h-none max-w-none border-l border-line bg-panel p-0 text-fg shadow-overlay outline-none`,`backdrop:bg-scrim open:animate-sheet-in`,c,s),children:e&&(0,H.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,H.jsxs)(`header`,{className:`flex items-start gap-3 border-b border-line px-5 py-4`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`h2`,{id:d,className:`text-[15px] font-semibold tracking-tight`,children:n}),r&&(0,H.jsx)(`div`,{className:`mt-0.5 text-[12px] text-muted`,children:r})]}),(0,H.jsx)(Yh,{onClose:t})]}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:i}),o&&(0,H.jsx)(`footer`,{className:`flex items-center justify-end gap-2 border-t border-line px-5 py-3`,children:o})]})})}function Jh({open:e,onClose:t,title:n,description:r,children:i,footer:o,className:s}){let{ref:c,onBackdropClick:l}=Kh(e,t),u=(0,V.useId)();return(0,H.jsx)(`dialog`,{ref:c,tabIndex:-1,"aria-labelledby":u,onClick:l,className:a(`m-auto w-[min(520px,calc(100vw-2rem))] rounded-xl border border-line-strong bg-panel p-0 text-fg shadow-overlay outline-none`,`backdrop:bg-scrim open:animate-pop-in`,s),children:e&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`header`,{className:`flex items-start gap-3 px-5 pt-4 pb-2`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`h2`,{id:u,className:`text-[15px] font-semibold tracking-tight`,children:n}),r&&(0,H.jsx)(`div`,{className:`mt-1 text-[13px] text-muted`,children:r})]}),(0,H.jsx)(Yh,{onClose:t})]}),(0,H.jsx)(`div`,{className:`px-5 pb-4`,children:i}),o&&(0,H.jsx)(`footer`,{className:`flex items-center justify-end gap-2 border-t border-line px-5 py-3`,children:o})]})})}function Yh({onClose:e}){return(0,H.jsx)(`button`,{type:`button`,onClick:e,"aria-label":`Close`,className:`-mr-1.5 inline-flex size-7 items-center justify-center rounded-md text-muted transition-colors duration-150 hover:bg-hover hover:text-fg`,children:(0,H.jsx)(vn,{"aria-hidden":!0,className:`size-4`,strokeWidth:1.75})})}function Xh(){let{help:e}=Ch();return(0,H.jsx)(Jh,{open:e,onClose:bh.closeHelp,title:`Keyboard shortcuts`,description:`DaveCode is keyboard-first. Shortcuts are paused while you type in a field.`,className:`w-[min(560px,calc(100vw-2rem))]`,children:(0,H.jsx)(`div`,{className:`grid grid-cols-1 gap-x-8 gap-y-5 sm:grid-cols-2`,children:Hh.map(e=>(0,H.jsxs)(`section`,{"aria-labelledby":`sc-${e.title}`,children:[(0,H.jsx)(`h3`,{id:`sc-${e.title}`,className:`eyebrow mb-2`,children:e.title}),(0,H.jsx)(`dl`,{className:`flex flex-col gap-1.5`,children:e.items.map(e=>(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[13px]`,children:[(0,H.jsx)(`dt`,{className:`text-fg-2`,children:e.description}),(0,H.jsx)(`dd`,{children:(0,H.jsx)(Cu,{keys:e.keys.map(e=>e===`mod`?U:e)})})]},e.description))})]},e.title))})})}var Zh={ok:nt,err:ct,info:bt},Qh={ok:`text-ok`,err:`text-err`,info:`text-info`};function $h(){let e=gh();return(0,H.jsx)(`section`,{"aria-live":`polite`,"aria-label":`Notifications`,className:`pointer-events-none fixed right-4 bottom-4 z-50 flex w-[min(360px,calc(100vw-2rem))] flex-col gap-2`,children:e.map(e=>{let t=Zh[e.tone];return(0,H.jsxs)(`div`,{className:`pointer-events-auto flex animate-pop-in gap-2.5 rounded-lg border border-line-strong bg-panel px-3 py-2.5 shadow-overlay`,children:[(0,H.jsx)(t,{"aria-hidden":!0,className:a(`mt-0.5 size-4 shrink-0`,Qh[e.tone]),strokeWidth:1.75}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`p`,{className:`text-[13px] font-medium text-fg`,children:e.title}),e.description&&(0,H.jsx)(`p`,{className:`mt-0.5 text-[12px] text-muted`,children:e.description})]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>mh(e.id),"aria-label":`Dismiss notification`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded text-muted hover:bg-hover hover:text-fg`,children:(0,H.jsx)(vn,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:1.75})})]},e.id)})})}function eg({title:e,status:t,onOpenPalette:n,onOpenHelp:r}){let{theme:i}=Ee(),a=ie(i),o=a===`dark`?`light`:`dark`;return(0,H.jsxs)(`header`,{className:`sticky top-0 z-20 flex h-12 shrink-0 items-center gap-3 border-b border-line bg-bg px-4 md:px-5`,children:[(0,H.jsxs)(`p`,{className:`flex min-w-0 items-center gap-1.5 text-[13px]`,children:[(0,H.jsx)(`span`,{className:`hidden text-muted sm:inline`,children:`DaveCode`}),(0,H.jsx)(`span`,{"aria-hidden":!0,className:`hidden text-faint sm:inline`,children:`/`}),(0,H.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e})]}),(0,H.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[t,(0,H.jsxs)(`button`,{type:`button`,onClick:n,"aria-label":`Open command palette`,"aria-keyshortcuts":`Control+K Meta+K`,className:`hidden h-8 w-56 items-center gap-2 rounded-md border border-line bg-panel px-2.5 text-[12px] text-muted transition-colors duration-150 hover:border-line-strong hover:text-fg-2 md:flex`,children:[(0,H.jsx)(Kt,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:1.75}),(0,H.jsx)(`span`,{children:`Search or jump to…`}),(0,H.jsxs)(`span`,{className:`ml-auto flex items-center gap-0.5`,children:[(0,H.jsx)(W,{children:U}),(0,H.jsx)(W,{children:`K`})]})]}),(0,H.jsx)(ju,{variant:`ghost`,iconOnly:!0,icon:Kt,"aria-label":`Open command palette`,onClick:n,className:`md:hidden`}),(0,H.jsx)(ju,{variant:`ghost`,iconOnly:!0,icon:a===`dark`?en:At,"aria-label":`Switch to ${o} theme`,title:`Switch to ${o} theme`,onClick:()=>Te({theme:o})}),(0,H.jsx)(ju,{variant:`ghost`,iconOnly:!0,icon:ot,"aria-label":`Keyboard shortcuts`,"aria-keyshortcuts":`Shift+Slash`,title:`Keyboard shortcuts ?`,onClick:r})]})]})}function tg({children:e,mainRef:t}){let[n,r]=(0,V.useState)(!1),{params:i,path:a}=hu(),o=ne(),{connection:c}=s();return(0,H.jsxs)(`div`,{className:`flex min-h-dvh bg-bg`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>t.current?.focus(),className:`sr-only z-50 bg-accent px-3 py-2 text-accent-fg focus:not-sr-only focus:fixed focus:top-2 focus:left-2`,children:`Skip to content`}),(0,H.jsxs)(`aside`,{className:`${n?`fixed inset-y-0 left-0 z-40 flex shadow-overlay`:`hidden`} w-60 shrink-0 flex-col border-r border-line bg-panel p-3 md:sticky md:top-0 md:flex md:h-dvh`,"aria-label":`Workspace navigation`,children:[(0,H.jsxs)(vu,{to:`/`,className:`mb-8 flex items-center gap-2.5 px-2 py-3 text-[15px] font-semibold tracking-tight`,children:[(0,H.jsx)(Tu,{className:`size-7`}),`DaveCode`]}),(0,H.jsxs)(vu,{to:`/?new=1`,onClick:()=>r(!1),className:`mb-2 flex h-10 items-center gap-2 rounded-lg border border-line-strong px-3 text-[13px] text-fg transition-colors hover:bg-hover`,children:[(0,H.jsx)(Bt,{"aria-hidden":!0,className:`size-4`}),`New task`]}),(0,H.jsxs)(vu,{to:`/library`,onClick:()=>r(!1),"aria-current":a===`/library`?`page`:void 0,className:`mb-7 flex h-10 items-center gap-2 rounded-lg px-3 text-[13px] text-fg-2 hover:bg-hover`,children:[(0,H.jsx)(Je,{"aria-hidden":!0,className:`size-4`}),`Creative library`]}),(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[(0,H.jsx)(`p`,{className:`mb-2 px-3 text-[12px] text-muted`,children:`Recent work`}),(0,H.jsxs)(`nav`,{"aria-label":`Recent work`,className:`flex flex-col gap-1`,children:[(o.data??[]).slice(0,20).map(e=>(0,H.jsx)(vu,{to:`/?goal=${encodeURIComponent(e.id)}`,onClick:()=>r(!1),"aria-current":i.get(`goal`)===e.id?`page`:void 0,className:`truncate rounded-lg px-3 py-2.5 text-[13px] text-fg-2 transition-colors hover:bg-hover aria-[current=page]:bg-active aria-[current=page]:text-fg`,children:e.objective},e.id)),o.data?.length===0&&(0,H.jsx)(`p`,{className:`px-3 py-2 text-[12px] leading-5 text-muted`,children:`Your first task starts here.`})]})]}),(0,H.jsxs)(`div`,{className:`mt-4 flex flex-col gap-1 border-t border-line pt-3`,children:[(0,H.jsxs)(vu,{to:`/accounts`,className:`flex items-center gap-2 rounded-lg px-3 py-2.5 text-[13px] text-fg-2 hover:bg-hover`,children:[(0,H.jsx)(Xt,{"aria-hidden":!0,className:`size-4`}),`AI connections`]}),(0,H.jsxs)(vu,{to:`/settings`,className:`flex items-center gap-2 rounded-lg px-3 py-2.5 text-[13px] text-fg-2 hover:bg-hover`,children:[(0,H.jsx)(Jt,{"aria-hidden":!0,className:`size-4`}),`Settings`]})]})]}),n&&(0,H.jsx)(`button`,{type:`button`,"aria-label":`Close navigation`,onClick:()=>r(!1),className:`fixed inset-0 z-30 bg-scrim md:hidden`}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,H.jsxs)(`header`,{className:`flex h-16 items-center justify-between gap-3 px-5 md:px-8`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(ju,{icon:Ot,iconOnly:!0,"aria-label":`Open navigation`,variant:`ghost`,className:`md:hidden`,onClick:()=>r(!0)}),(0,H.jsx)(`span`,{className:`text-[14px] text-fg-2`,children:a===`/library`?`Creative library`:`Workspace`})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,H.jsx)(`span`,{className:`text-[12px] text-muted`,children:c.mode===`mock`?`Demo`:c.mode===`probing`?`Connecting`:`On your device`}),(0,H.jsx)(Iu,{})]})]}),(0,H.jsx)(`main`,{ref:t,tabIndex:-1,id:`main`,className:`mx-auto flex w-full max-w-6xl flex-1 flex-col px-5 pb-6 md:px-10`,children:e})]})]})}function ng({className:e}){return(0,H.jsx)(`div`,{"aria-hidden":!0,className:a(`skeleton h-3`,e)})}function rg({rows:e=5,className:t}){return(0,H.jsx)(`div`,{className:a(`flex flex-col`,t),role:`status`,"aria-label":`Loading`,children:Array.from({length:e},(e,t)=>(0,H.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-line px-3.5 py-3 last:border-b-0`,children:[(0,H.jsx)(ng,{className:`size-5 rounded`}),(0,H.jsx)(ng,{className:`h-3 w-40`}),(0,H.jsx)(ng,{className:`ml-auto h-3 w-24`}),(0,H.jsx)(ng,{className:`h-3 w-16`})]},t))})}function ig(){return window.davecodeDesktop?.terminal}function ag(e){return e<=1?1:e<=4?2:3}function og({icon:e,title:t,description:n,command:r,action:i,className:o}){return(0,H.jsxs)(`div`,{className:a(`flex flex-col items-center justify-center gap-3 px-6 py-10 text-center`,o),children:[(0,H.jsx)(`div`,{className:`flex size-9 items-center justify-center rounded-lg border border-line-strong bg-raised text-muted`,children:(0,H.jsx)(e,{"aria-hidden":!0,className:`size-4`,strokeWidth:1.5})}),(0,H.jsxs)(`div`,{className:`max-w-sm`,children:[(0,H.jsx)(`p`,{className:`text-[13px] font-medium text-fg`,children:t}),n&&(0,H.jsx)(`p`,{className:`mt-1 text-[12px] leading-5 text-muted`,children:n})]}),r&&(0,H.jsx)(Bh,{command:r,className:`w-full max-w-sm text-left`}),i]})}function sg(){return(0,H.jsx)(og,{icon:ut,title:`Nothing here`,description:`This route does not exist in the dashboard. Press ? to see every shortcut.`,action:(0,H.jsx)(ju,{variant:`secondary`,onClick:()=>gu(`/`),children:`Back to overview`}),className:`py-24`})}var cg={neutral:`text-muted`,accent:`text-accent-text`,ok:`text-ok`,warn:`text-warn`,err:`text-err`,info:`text-info`};function lg(e,t){let n=e=>e?t.get(e)?.label??e:`nobody`,r=`${e.ts}:${e.type}:${JSON.stringify(e).length}`;switch(e.type){case`router.failover`:return{key:r,ts:e.ts,icon:He,tone:e.toAccountId?`warn`:`err`,text:e.toAccountId?`Failover ${n(e.fromAccountId)} → ${n(e.toAccountId)}`:`No failover target left after ${n(e.fromAccountId)}`,detail:`${e.reason} · ${e.requestId}`};case`account.updated`:{let t=e.account.status;return{key:r,ts:e.ts,icon:un,tone:t===`cooldown`?`warn`:t===`error`?`err`:t===`active`?`ok`:`neutral`,text:`${e.account.label} is ${t}`,detail:t===`cooldown`?e.account.lastError:e.account.id}}case`account.removed`:return{key:r,ts:e.ts,icon:fn,tone:`neutral`,text:`Account ${e.accountId} removed`};case`task.updated`:return{key:r,ts:e.ts,icon:e.task.status===`SUCCESS`?nt:e.task.status===`FAILED`?ct:it,tone:e.task.status===`SUCCESS`?`ok`:e.task.status===`FAILED`?`err`:e.task.status===`IN_PROGRESS`?`info`:`neutral`,text:`${e.task.id} → ${e.task.status.toLowerCase().replace(`_`,` `)}`,detail:e.task.title};case`task.removed`:return{key:r,ts:e.ts,icon:ct,tone:`neutral`,text:`${e.taskId} removed`};case`runner.status`:return{key:r,ts:e.ts,icon:Xe,tone:e.status.state===`error`?`err`:e.status.state===`repairing`?`warn`:`info`,text:`Runner ${e.status.state}${e.status.taskId?` · ${e.status.taskId}`:``}`,detail:e.status.repairCycle?`repair cycle ${e.status.repairCycle}/3`:void 0};case`log`:case`runner.log`:return e.level!==`warn`&&e.level!==`error`?null:{key:r,ts:e.ts,icon:e.level===`error`?ct:cn,tone:e.level===`error`?`err`:`warn`,text:e.message,detail:e.type===`log`?e.scope:`runner`};default:return null}}function ug({items:e,className:t}){return e.length===0?(0,H.jsxs)(`div`,{className:a(`flex flex-1 items-center justify-center gap-2 p-6 text-[12px] text-muted`,t),children:[(0,H.jsx)(bt,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:1.75}),`Waiting for activity…`]}):(0,H.jsx)(`ol`,{"aria-label":`Recent activity`,className:a(`flex flex-col`,t),children:e.map(e=>{let t=e.icon;return(0,H.jsxs)(`li`,{className:`flex animate-row-in gap-2.5 border-b border-line px-3.5 py-2 last:border-b-0`,children:[(0,H.jsx)(t,{"aria-hidden":!0,className:a(`mt-0.5 size-3.5 shrink-0`,cg[e.tone]),strokeWidth:1.75}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`p`,{className:`truncate text-[12px] text-fg`,children:e.text}),e.detail&&(0,H.jsx)(`p`,{className:`truncate font-mono text-2xs text-muted`,children:e.detail})]}),(0,H.jsx)(`time`,{dateTime:new Date(e.ts).toISOString(),className:`tnum shrink-0 font-mono text-2xs text-faint`,children:be(e.ts)})]},e.key)})})}function dg(e){if(e<=0||!Number.isFinite(e))return 1;let t=10**Math.floor(Math.log10(e)),n=e/t;return(n<=1?1:n<=2?2:n<=2.5?2.5:n<=5?5:10)*t}function fg(e,t=4){let n=dg(Math.max(e,1)/t),r=Math.max(n,Math.ceil(e/n)*n),i=[];for(let e=0;e<=r+n/2;e+=n)i.push(Math.round(e*1e3)/1e3);return i}function pg(e,t){let[n,r]=e,[i,a]=t,o=r-n||1;return e=>i+(e-n)/o*(a-i)}function mg(e,t){if(e.length===0)return-1;let n=0,r=e.length-1;for(;r-n>1;){let i=n+r>>1;(e[i]??0)<t?n=i:r=i}return Math.abs((e[n]??0)-t)<=Math.abs((e[r]??0)-t)?n:r}function hg(e,t){if(e.length===0)return``;let n=e.map(([e,t],n)=>`${n===0?`M`:`L`}${e.toFixed(1)},${t.toFixed(1)}`).join(``);if(t===void 0)return n;let r=e[0],i=e[e.length-1];return!r||!i?n:`${n}L${i[0].toFixed(1)},${t.toFixed(1)}L${r[0].toFixed(1)},${t.toFixed(1)}Z`}var gg={top:14,right:64,bottom:24,left:44};function _g({points:e,height:t=220,label:n,unit:r,secondaryLabel:i,liveTail:o,className:s}){let[c,l]=Eh(),[u,d]=(0,V.useState)(null),f=(0,V.useId)(),p=(0,V.useMemo)(()=>{if(l<=0||e.length<2)return null;let n=Math.max(10,l-gg.left-gg.right),r=t-gg.top-gg.bottom,i=Math.max(...e.map(e=>e.value),1),a=fg(i,4),o=a[a.length-1]??i,s=e[0]?.ts??0,c=e[e.length-1]?.ts??1,u=pg([s,c],[gg.left,gg.left+n]),d=pg([0,o],[gg.top+r,gg.top]),f=e.map(e=>[u(e.ts),d(e.value)]),p=9e5,m=[];for(let e=Math.ceil(s/p)*p;e<=c;e+=p)m.push(e);return{innerW:n,innerH:r,ticks:a,x:u,y:d,xy:f,xTicks:m,baseline:gg.top+r}},[e,l,t]),m=p?o?p.xy.slice(0,-1):p.xy:[],h=p&&o?p.xy.slice(-2):[],g=p?.xy[p.xy.length-1],_=e[e.length-1],v=e=>{if(!p)return;let t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left+gg.left;d(mg(p.xy.map(e=>e[0]),n))},y=t=>{if(e.length===0)return;let n=e.length-1,r=u??n,i=r;if(t.key===`ArrowLeft`)i=Math.max(0,r-1);else if(t.key===`ArrowRight`)i=Math.min(n,r+1);else if(t.key===`Home`)i=0;else if(t.key===`End`)i=n;else if(t.key===`Escape`)i=null;else return;t.preventDefault(),d(i)},b=u===null?void 0:e[u],x=u===null?void 0:p?.xy[u],ee=e.reduce((e,t)=>Math.max(e,t.value),0);return(0,H.jsxs)(`figure`,{ref:c,tabIndex:0,"aria-label":`${n}. Peak ${se(ee)} ${r}. Use the left and right arrow keys to read values.`,onKeyDown:y,onBlur:()=>d(null),className:a(`relative m-0 w-full select-none rounded-md`,s),style:{height:t},children:[p&&(0,H.jsxs)(`svg`,{width:l,height:t,className:`block overflow-visible`,"aria-hidden":!0,children:[(0,H.jsx)(`defs`,{children:(0,H.jsx)(`clipPath`,{id:f,children:(0,H.jsx)(`rect`,{x:gg.left,y:0,width:p.innerW,height:t})})}),p.ticks.map(e=>(0,H.jsxs)(`g`,{children:[(0,H.jsx)(`line`,{x1:gg.left,x2:gg.left+p.innerW,y1:p.y(e),y2:p.y(e),className:e===0?`stroke-line-strong`:`stroke-line`,strokeWidth:1,shapeRendering:`crispEdges`}),(0,H.jsx)(`text`,{x:gg.left-8,y:p.y(e),dy:`0.32em`,textAnchor:`end`,className:`tnum fill-muted font-mono text-[10px]`,children:de(e)})]},e)),p.xTicks.map(e=>(0,H.jsx)(`text`,{x:p.x(e),y:t-6,textAnchor:`middle`,className:`tnum fill-muted font-mono text-[10px]`,children:xe(e)},e)),(0,H.jsxs)(`g`,{clipPath:`url(#${f})`,children:[(0,H.jsx)(`path`,{d:hg(p.xy,p.baseline),className:`fill-accent`,opacity:.1}),(0,H.jsx)(`path`,{d:hg(m),fill:`none`,className:`stroke-accent`,strokeWidth:2,strokeLinejoin:`round`,strokeLinecap:`round`}),h.length===2&&(0,H.jsx)(`path`,{d:hg(h),fill:`none`,className:`stroke-accent`,strokeWidth:2,strokeDasharray:`3 3`,strokeLinecap:`round`,opacity:.7})]}),g&&_&&(0,H.jsxs)(`g`,{children:[(0,H.jsx)(`circle`,{cx:g[0],cy:g[1],r:4,className:`fill-accent stroke-panel`,strokeWidth:2}),(0,H.jsx)(`text`,{x:g[0]+9,y:g[1],dy:`-0.1em`,className:`tnum fill-fg font-mono text-[11px] font-medium`,children:de(_.value)}),(0,H.jsx)(`text`,{x:g[0]+9,y:g[1],dy:`1.15em`,className:`fill-muted text-[10px]`,children:o?`now`:r})]}),x&&(0,H.jsxs)(`g`,{children:[(0,H.jsx)(`line`,{x1:x[0],x2:x[0],y1:gg.top,y2:p.baseline,className:`stroke-fg-2`,strokeWidth:1,opacity:.5,shapeRendering:`crispEdges`}),(0,H.jsx)(`circle`,{cx:x[0],cy:x[1],r:4,className:`fill-accent stroke-panel`,strokeWidth:2})]}),(0,H.jsx)(`rect`,{x:gg.left,y:gg.top,width:p.innerW,height:p.innerH,fill:`transparent`,onPointerMove:v,onPointerLeave:()=>d(null)})]}),b&&x&&p&&(0,H.jsxs)(`div`,{className:`pointer-events-none absolute top-1 z-10 min-w-32 rounded-md border border-line-strong bg-panel px-2.5 py-2 shadow-overlay`,style:{left:Math.min(Math.max(x[0]+10,0),l-150)},children:[(0,H.jsxs)(`p`,{className:`tnum font-mono text-[11px] text-muted`,children:[xe(b.ts),o&&u===e.length-1&&` · in progress`]}),(0,H.jsxs)(`p`,{className:`mt-1 flex items-center gap-2`,children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:`h-0.5 w-3 rounded-full bg-accent`}),(0,H.jsx)(`span`,{className:`tnum text-[13px] font-semibold text-fg`,children:se(b.value)}),(0,H.jsx)(`span`,{className:`text-[11px] text-muted`,children:r})]}),b.secondary!==void 0&&i&&(0,H.jsxs)(`p`,{className:`mt-0.5 pl-5 text-[11px] text-fg-2`,children:[(0,H.jsx)(`span`,{className:`tnum font-mono`,children:se(b.secondary)}),` `,i]})]})]})}function vg({values:e,width:t=96,height:n=28,className:r}){if(e.length<2)return(0,H.jsx)(`div`,{style:{width:t,height:n},className:r});let i=Math.max(...e,1),o=pg([0,e.length-1],[2,t-4]),s=pg([0,i],[n-3,3]),c=e.map((e,t)=>[o(t),s(e)]),l=c[c.length-1];return(0,H.jsxs)(`svg`,{width:t,height:n,"aria-hidden":!0,className:a(`overflow-visible`,r),children:[(0,H.jsx)(`path`,{d:hg(c,n-1),className:`fill-fg-2`,opacity:.06}),(0,H.jsx)(`path`,{d:hg(c),fill:`none`,className:`stroke-fg-2`,strokeWidth:1.5,strokeLinejoin:`round`,opacity:.7}),l&&(0,H.jsx)(`circle`,{cx:l[0],cy:l[1],r:2.5,className:`fill-accent`})]})}function yg(e){return e>=.9?`critical`:e>=.85?`warn`:`normal`}function bg(e){let t=[`${de(e.tokens)} tokens`];return e.tokenLimit&&(t[0]+=` of ${de(e.tokenLimit)}`),t.push(`${de(e.requests)} requests${e.requestLimit?` of ${de(e.requestLimit)}`:``}`),t.join(` · `)}function xg({usage:e,label:t,compact:n,className:r}){let i=!!(e&&(e.tokenLimit||e.requestLimit)),o=e?.utilization??0,s=yg(o),c=s===`critical`?`bg-err`:s===`warn`?`bg-warn`:`bg-meter`,l=i?`${we(o)} of the ${t} window`:`No ${t} limit`;return(0,H.jsxs)(`div`,{className:a(`flex min-w-0 items-center gap-2`,r),title:e?bg(e):void 0,children:[!n&&(0,H.jsx)(`span`,{className:`w-7 shrink-0 font-mono text-2xs text-muted`,children:t}),(0,H.jsxs)(`div`,{role:`meter`,"aria-label":`${t} quota`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":i?Math.round(Math.min(o,1)*100):0,"aria-valuetext":l,className:`relative h-1.5 min-w-10 flex-1 rounded-full bg-track`,children:[i&&(0,H.jsx)(`div`,{className:a(`absolute inset-y-0 left-0 rounded-full transition-[width] duration-500 ease-snappy`,c),style:{width:`${Math.min(100,o*100)}%`}}),i&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:`absolute -top-0.5 -bottom-0.5 w-px bg-warn/70`,style:{left:`85%`}}),(0,H.jsx)(`span`,{"aria-hidden":!0,className:`absolute -top-0.5 -bottom-0.5 w-px bg-err/80`,style:{left:`90%`}})]})]}),(0,H.jsx)(`span`,{className:a(`tnum w-9 shrink-0 text-right font-mono text-2xs`,i?s===`critical`?`text-err`:s===`warn`?`text-warn`:`text-fg-2`:`text-faint`),children:i?we(o):`—`})]})}function Sg({className:e}){return(0,H.jsxs)(`div`,{className:a(`flex flex-wrap items-center gap-x-4 gap-y-1 text-2xs text-muted`,e),children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:`h-2.5 w-px bg-warn`}),`85% backpressure`]}),(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:`h-2.5 w-px bg-err`}),`90% traffic shift`]})]})}var Cg=[`bg-s1`,`bg-s2`,`bg-s3`,`bg-s4`,`bg-s5`],wg=`bg-faint`;function Tg({items:e,unit:t,className:n}){let r=e.filter(e=>e.slot<Cg.length),i=e.filter(e=>e.slot>=Cg.length),o=[...r.map(e=>({...e,color:Cg[e.slot]??wg})),...i.length?[{id:`other`,label:`Other`,value:i.reduce((e,t)=>e+t.value,0),slot:99,color:wg}]:[]],s=o.reduce((e,t)=>e+t.value,0);return(0,H.jsxs)(`div`,{className:a(`flex flex-col gap-3`,n),children:[(0,H.jsx)(`div`,{className:`flex h-2.5 w-full gap-[2px] overflow-hidden rounded-[3px]`,"aria-hidden":!0,children:s===0?(0,H.jsx)(`div`,{className:`h-full flex-1 bg-track`}):o.filter(e=>e.value>0).map(e=>(0,H.jsx)(`div`,{title:`${e.label}: ${de(e.value)} ${t} (${we(e.value/s)})`,className:a(`h-full transition-[flex-grow] duration-500 ease-snappy first:rounded-l-[3px] last:rounded-r-[3px]`,e.color),style:{flexGrow:e.value,flexBasis:0}},e.id))}),(0,H.jsxs)(`table`,{className:`w-full text-[12px]`,children:[(0,H.jsxs)(`caption`,{className:`sr-only`,children:[`Share of `,t,` by account`]}),(0,H.jsx)(`thead`,{className:`sr-only`,children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{scope:`col`,children:`Account`}),(0,H.jsx)(`th`,{scope:`col`,children:t}),(0,H.jsx)(`th`,{scope:`col`,children:`Share`})]})}),(0,H.jsx)(`tbody`,{children:o.map(e=>(0,H.jsxs)(`tr`,{className:`border-b border-line last:border-b-0`,children:[(0,H.jsx)(`td`,{className:`py-1.5`,children:(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:a(`size-2 shrink-0 rounded-[2px]`,e.color)}),(0,H.jsx)(`span`,{className:`truncate text-fg-2`,children:e.label})]})}),(0,H.jsx)(`td`,{className:`tnum py-1.5 text-right font-mono text-fg`,children:de(e.value)}),(0,H.jsx)(`td`,{className:`tnum w-14 py-1.5 text-right font-mono text-muted`,children:s?we(e.value/s):`—`})]},e.id))})]})]})}function Eg({className:e,...t}){return(0,H.jsx)(`section`,{className:a(`flex min-w-0 flex-col rounded-lg border border-line bg-panel`,e),...t})}function Dg({title:e,id:t,meta:n,actions:r,className:i}){return(0,H.jsxs)(`header`,{className:a(`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,H.jsx)(`h2`,{id:t,className:`text-[13px] font-medium text-fg`,children:e}),n&&(0,H.jsx)(`div`,{className:`text-[12px] text-muted`,children:n}),r&&(0,H.jsx)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:r})]})}function Og({title:e,description:t,actions:n}){return(0,H.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-6 gap-y-3 pb-4`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h1`,{className:`text-[17px] font-semibold tracking-tight text-fg`,children:e}),t&&(0,H.jsx)(`p`,{className:`mt-0.5 text-[13px] text-muted`,children:t})]}),n&&(0,H.jsx)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:n})]})}function kg({value:e,onChange:t,options:n,label:r,size:i=`md`,className:o}){let s=(0,V.useId)();return(0,H.jsxs)(`fieldset`,{className:a(`inline-flex w-fit items-center gap-0.5 rounded-md border border-line bg-bg p-0.5`,o),children:[(0,H.jsx)(`legend`,{className:`sr-only`,children:r}),n.map(n=>{let r=n.value===e,o=n.icon;return(0,H.jsxs)(`label`,{className:a(`relative inline-flex cursor-pointer items-center gap-1.5 rounded-[5px] font-medium whitespace-nowrap transition-colors duration-150 ease-snappy`,`has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-1 has-[:focus-visible]:outline-accent`,i===`sm`?`h-6 px-2 text-[12px]`:`h-7 px-2.5 text-[12px]`,r?`bg-active text-fg shadow-[inset_0_0_0_1px_var(--dc-line-strong)]`:`text-muted hover:text-fg`),children:[(0,H.jsx)(`input`,{type:`radio`,name:s,value:n.value,checked:r,onChange:()=>t(n.value),className:`sr-only`}),o&&(0,H.jsx)(o,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:1.75}),n.label,n.count!==void 0&&(0,H.jsx)(`span`,{className:a(`tnum font-mono text-2xs`,r?`text-fg-2`:`text-faint`),children:n.count})]},n.value)})]})}function Ag(e,t,n,r=60){let i=Math.floor(n/6e4)*6e4,a=i-(r-1)*6e4,o=new Map;for(let e=a;e<=i;e+=6e4)o.set(e,{ts:e,tokens:0,requests:0});for(let t of e??[]){let e=Math.floor(t.ts/6e4)*6e4,n=o.get(e);n&&(n.tokens=Math.max(n.tokens,t.tokens),n.requests=Math.max(n.requests,t.requests))}for(let e of t){let t=o.get(e.ts);t&&(t.tokens=Math.max(t.tokens,e.tokens),t.requests=Math.max(t.requests,e.requests))}return[...o.values()]}function jg(e,t){let n=e.slice(0,-1).slice(-t);return n.length===0?0:n.reduce((e,t)=>e+t,0)/n.length}function Mg(e){return new Map((e??[]).map((e,t)=>[e.id,t]))}function Ng(){let e=u(),t=ve(),n=ee(),r=b(60,60),i=re(),a=Th(5e3),[o,s]=(0,V.useState)(`chart`),c=(0,V.useMemo)(()=>Ag(r.data,i.minutes,a),[r.data,i.minutes,a]),l=c.map(e=>e.tokens),d=c.map(e=>e.requests),f=jg(l,5),p=jg(l.slice(0,-5),15),m=jg(d,5),h=d.reduce((e,t)=>e+t,0),g=i.failoverTs.filter(e=>e>=a-36e5).length,_=(0,V.useMemo)(()=>new Map((t.data??[]).map(e=>[e.id,e])),[t.data]),v=(0,V.useMemo)(()=>new Map((n.data??[]).map(e=>[e.accountId,e])),[n.data]),y=(0,V.useMemo)(()=>{let e=[],t=new Set;for(let n=i.events.length-1;n>=0&&e.length<40;n--){let r=i.events[n];if(!r)continue;let a=lg(r,_);a&&!t.has(a.key)&&(t.add(a.key),e.push(a))}return e},[i.events,_]),x=(0,V.useMemo)(()=>{let e=Mg(t.data),n=new Map;for(let e of r.data??[])for(let[t,r]of Object.entries(e.byAccount))n.set(t,(n.get(t)??0)+r.tokens);return(t.data??[]).filter(e=>e.enabled||(n.get(e.id)??0)>0).map(t=>({id:t.id,label:t.label,value:n.get(t.id)??0,slot:e.get(t.id)??99}))},[t.data,r.data]),te=t.data?.filter(e=>e.status===`active`).length??0,ne=t.data?.filter(e=>e.status===`cooldown`).length??0,S=(t.data??[]).filter(e=>e.enabled),ie=r.isPending&&i.minutes.length===0,ae=p>0?f/p-1:0;return(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsx)(Og,{title:`Overview`,description:`Gateway health, token burn and quota pressure across every account.`}),(0,H.jsxs)(Eg,{"aria-label":`Key metrics`,className:`grid grid-cols-2 lg:grid-cols-4`,children:[(0,H.jsx)(Pg,{label:`Token burn`,hint:`tokens / min · 5 min avg`,loading:ie,value:de(f),trend:(0,H.jsx)(vg,{values:l.slice(-30)}),delta:p>0?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-muted`,children:[ae>=0?(0,H.jsx)(Ke,{"aria-hidden":!0,className:`size-3`,strokeWidth:2}):(0,H.jsx)(Be,{"aria-hidden":!0,className:`size-3`,strokeWidth:2}),(0,H.jsx)(`span`,{className:`tnum`,children:we(Math.abs(ae))}),(0,H.jsx)(`span`,{className:`sr-only`,children:ae>=0?`up`:`down`}),` vs prior 15 min`]}):null}),(0,H.jsx)(Pg,{label:`Requests`,hint:`per min · 5 min avg`,loading:ie,value:m.toFixed(1),trend:(0,H.jsx)(vg,{values:d.slice(-30)}),delta:(0,H.jsxs)(`span`,{className:`text-muted`,children:[(0,H.jsx)(`span`,{className:`tnum text-fg-2`,children:se(h)}),` in the last hour`]}),className:`border-l border-line`}),(0,H.jsx)(Pg,{label:`Failovers`,hint:`last hour`,loading:ie,value:se(g),delta:(0,H.jsxs)(`span`,{className:`text-muted`,children:[(0,H.jsx)(`span`,{className:`tnum text-fg-2`,children:h?we(g/h,1):`0%`}),` `,`of requests rerouted`]}),className:`border-t border-line lg:border-t-0 lg:border-l`}),(0,H.jsx)(Pg,{label:`System`,hint:e.data?`v${e.data.version}`:`gateway`,loading:e.isPending,value:e.isError?(0,H.jsx)(`span`,{className:`text-err`,children:`Down`}):(0,H.jsx)(`span`,{className:`inline-flex items-center gap-2`,children:e.data?.status===`ok`?`Healthy`:e.data?.status??`—`}),delta:(0,H.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-muted`,children:[e.data&&(0,H.jsxs)(`span`,{children:[`up `,_e(e.data.uptimeSec)]}),(0,H.jsx)(`span`,{"aria-hidden":!0,className:`text-faint`,children:`·`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`span`,{className:`tnum text-fg-2`,children:te}),` active`,ne>0&&(0,H.jsxs)(H.Fragment,{children:[`, `,(0,H.jsx)(`span`,{className:`tnum text-warn`,children:ne}),` cooling`]})]})]}),className:`border-t border-l border-line lg:border-t-0`})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-12 gap-4`,children:[(0,H.jsxs)(Eg,{className:`col-span-12 xl:col-span-8`,"aria-labelledby":`burn-title`,children:[(0,H.jsx)(Dg,{id:`burn-title`,title:`Token burn`,meta:`tokens per minute · last 60 min · live tail`,actions:(0,H.jsx)(kg,{size:`sm`,label:`Token burn view`,value:o,onChange:s,options:[{value:`chart`,label:`Chart`,icon:Qe},{value:`table`,label:`Table`,icon:nn}]})}),(0,H.jsx)(`div`,{className:`px-3.5 pt-3 pb-2`,children:ie?(0,H.jsx)(ng,{className:`h-[240px] w-full`}):o===`chart`?(0,H.jsx)(_g,{height:240,label:`Token burn, tokens per minute over the last 60 minutes`,unit:`tokens/min`,secondaryLabel:`requests`,liveTail:!0,points:c.map(e=>({ts:e.ts,value:e.tokens,secondary:e.requests}))}):(0,H.jsx)(`div`,{className:`h-[240px] overflow-y-auto rounded-md border border-line`,children:(0,H.jsxs)(`table`,{className:`w-full text-[12px]`,children:[(0,H.jsx)(`caption`,{className:`sr-only`,children:`Tokens and requests per minute`}),(0,H.jsx)(`thead`,{className:`sticky top-0 bg-raised text-left text-muted`,children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 font-medium`,children:`Minute`}),(0,H.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-right font-medium`,children:`Tokens`}),(0,H.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-right font-medium`,children:`Requests`})]})}),(0,H.jsx)(`tbody`,{children:[...c].reverse().map((e,t)=>(0,H.jsxs)(`tr`,{className:`border-t border-line`,children:[(0,H.jsxs)(`td`,{className:`tnum px-3 py-1 font-mono text-fg-2`,children:[xe(e.ts),t===0&&(0,H.jsx)(`span`,{className:`ml-2 text-muted`,children:`in progress`})]}),(0,H.jsx)(`td`,{className:`tnum px-3 py-1 text-right font-mono text-fg`,children:se(e.tokens)}),(0,H.jsx)(`td`,{className:`tnum px-3 py-1 text-right font-mono text-fg-2`,children:e.requests})]},e.ts))})]})})})]}),(0,H.jsxs)(Eg,{className:`col-span-12 h-[320px] xl:col-span-4 xl:h-auto`,"aria-labelledby":`activity-title`,children:[(0,H.jsx)(Dg,{id:`activity-title`,title:`Recent activity`,meta:`failovers · cooldowns · runner`,actions:(0,H.jsx)(vu,{to:`/traffic`,className:`text-[12px] text-muted hover:text-fg`,children:`Traffic →`})}),(0,H.jsx)(`div`,{className:`relative min-h-0 flex-1`,children:(0,H.jsx)(`div`,{className:`absolute inset-0 overflow-y-auto`,children:(0,H.jsx)(ug,{items:y})})})]}),(0,H.jsxs)(Eg,{className:`col-span-12 xl:col-span-8`,"aria-labelledby":`quota-title`,children:[(0,H.jsx)(Dg,{id:`quota-title`,title:`Quota utilization`,meta:`sliding windows per account`,actions:(0,H.jsx)(Sg,{})}),t.isPending||n.isPending?(0,H.jsx)(rg,{rows:4}):S.length===0?(0,H.jsx)(og,{icon:mn,title:`No accounts yet`,description:`Add a provider account to start routing traffic through the gateway.`,command:`davecode add-account`}):(0,H.jsx)(`div`,{className:`overflow-x-auto`,children:(0,H.jsxs)(`table`,{className:`w-full min-w-[640px] text-[12px]`,children:[(0,H.jsx)(`caption`,{className:`sr-only`,children:`Quota utilization per account and window`}),(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{className:`border-b border-line text-left text-muted`,children:[(0,H.jsx)(`th`,{scope:`col`,className:`w-[30%] px-3.5 py-2 font-medium`,children:`Account`}),(0,H.jsx)(`th`,{scope:`col`,className:`w-[19%] px-2 py-2 font-medium`,children:`1 min`}),(0,H.jsx)(`th`,{scope:`col`,className:`w-[19%] px-2 py-2 font-medium`,children:`5 h`}),(0,H.jsx)(`th`,{scope:`col`,className:`w-[19%] px-2 py-2 font-medium`,children:`24 h`}),(0,H.jsx)(`th`,{scope:`col`,className:`px-3.5 py-2 text-right font-medium`,children:`Status`})]})}),(0,H.jsx)(`tbody`,{children:S.map(e=>{let t=v.get(e.id);return(0,H.jsxs)(`tr`,{className:`border-b border-line last:border-b-0 hover:bg-hover/50`,children:[(0,H.jsx)(`td`,{className:`max-w-0 px-3.5 py-2.5`,children:(0,H.jsx)(Ph,{account:e})}),(0,H.jsx)(`td`,{className:`px-2 py-2.5`,children:(0,H.jsx)(xg,{compact:!0,label:`1m`,usage:t?.windows[`1m`]})}),(0,H.jsx)(`td`,{className:`px-2 py-2.5`,children:(0,H.jsx)(xg,{compact:!0,label:`5h`,usage:t?.windows[`5h`]})}),(0,H.jsx)(`td`,{className:`px-2 py-2.5`,children:(0,H.jsx)(xg,{compact:!0,label:`24h`,usage:t?.windows[`24h`]})}),(0,H.jsx)(`td`,{className:`px-3.5 py-2.5 text-right`,children:(0,H.jsx)(kh,{account:e})})]},e.id)})})]})})]}),(0,H.jsxs)(Eg,{className:`col-span-12 xl:col-span-4`,"aria-labelledby":`share-title`,children:[(0,H.jsx)(Dg,{id:`share-title`,title:`Traffic share`,meta:`tokens by account · 60 min`}),(0,H.jsx)(`div`,{className:`p-3.5`,children:r.isPending||t.isPending?(0,H.jsx)(rg,{rows:3}):(0,H.jsx)(Tg,{items:x,unit:`tokens`})})]})]})]})}function Pg({label:e,hint:t,value:n,delta:r,trend:i,loading:o,className:s}){return(0,H.jsxs)(`div`,{className:a(`flex min-w-0 flex-col gap-1.5 px-4 py-3.5`,s),children:[(0,H.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,H.jsx)(`h2`,{className:`text-[12px] font-medium text-fg-2`,children:e}),(0,H.jsx)(`span`,{className:`truncate text-2xs text-muted`,children:t})]}),o?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ng,{className:`h-7 w-24`}),(0,H.jsx)(ng,{className:`h-3 w-32`})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex items-end justify-between gap-3`,children:[(0,H.jsx)(`p`,{className:`text-[26px] leading-8 font-semibold tracking-tight text-fg`,children:n}),i&&(0,H.jsx)(`div`,{className:`hidden pb-1 sm:block`,children:i})]}),r&&(0,H.jsx)(`div`,{className:`truncate text-[12px]`,children:r})]})]})}var Fg=`modulepreload`,Ig=function(e,t){return new URL(e,t).href},Lg={},Rg=function(e){return e.pathname.endsWith(`.css`)},zg=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},Bg=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Ig(t,n);let r=s(t),i=Rg(r);return zg(Lg,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Fg,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Vg=(0,V.lazy)(()=>Bg(()=>import(`./Panes-_KTf8pbZ.js`).then(e=>({default:e.Panes})),__vite__mapDeps([0,1,2]),import.meta.url));function Hg({active:e}){let[t,n]=(0,V.useState)(e);if((0,V.useEffect)(()=>{e&&n(!0)},[e]),!t)return null;let r=ig();return(0,H.jsx)(`div`,{className:a(`fixed inset-0 z-20 bg-black text-zinc-100`,!e&&`hidden`),children:r?(0,H.jsx)(V.Suspense,{fallback:null,children:(0,H.jsx)(Vg,{bridge:r,active:e})}):(0,H.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 px-4 text-center`,children:[(0,H.jsx)(Tu,{className:`size-10`}),(0,H.jsx)(`p`,{className:`font-mono text-sm`,children:`Terminal panes run in the DaveCode desktop app.`}),(0,H.jsx)(vu,{to:`/`,className:`font-mono text-xs text-zinc-400 underline`,children:`Back to the workspace`})]})})}var Ug={library:(0,V.lazy)(()=>Bg(()=>import(`./Library-DK7mlpRb.js`).then(e=>({default:e.Library})),__vite__mapDeps([3,1,4]),import.meta.url)),workspace:(0,V.lazy)(()=>Bg(()=>import(`./Workspace-CJTgiiU5.js`).then(e=>({default:e.Workspace})),__vite__mapDeps([5,1,6,7,8,9,10,11,4]),import.meta.url)),overview:Ng,accounts:(0,V.lazy)(()=>Bg(()=>import(`./Accounts-cq8RLMoI.js`).then(e=>({default:e.Accounts})),__vite__mapDeps([12,1,6,11,13,4,9,14]),import.meta.url)),traffic:(0,V.lazy)(()=>Bg(()=>import(`./Traffic-BVfBuC70.js`).then(e=>({default:e.Traffic})),__vite__mapDeps([15,1,6,4]),import.meta.url)),routes:(0,V.lazy)(()=>Bg(()=>import(`./RoutesPage-QV0oPRW9.js`).then(e=>({default:e.RoutesPage})),__vite__mapDeps([16,1,6,7,9,17,14,4]),import.meta.url)),tasks:(0,V.lazy)(()=>Bg(()=>import(`./Tasks-BiUQSTpt.js`).then(e=>({default:e.Tasks})),__vite__mapDeps([18,1,6,8,9,17,14,4]),import.meta.url)),runner:(0,V.lazy)(()=>Bg(()=>import(`./Runner-CkHBLQl0.js`).then(e=>({default:e.Runner})),__vite__mapDeps([19,1,6,9]),import.meta.url)),goals:(0,V.lazy)(()=>Bg(()=>import(`./Goals-Bw02to72.js`).then(e=>({default:e.Goals})),__vite__mapDeps([10,1,6,11,8,9,4]),import.meta.url)),settings:(0,V.lazy)(()=>Bg(()=>import(`./Settings-BLz2gTBR.js`).then(e=>({default:e.Settings})),__vite__mapDeps([20,1,6,13,4,9]),import.meta.url))};function Wg(){return(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,role:`status`,"aria-label":`Loading page`,children:[(0,H.jsx)(ng,{className:`h-6 w-40`}),(0,H.jsx)(ng,{className:`h-4 w-80`}),(0,H.jsx)(ng,{className:`mt-4 h-64 w-full rounded-lg`})]})}function Gg(){let e=Ee(),{path:t}=hu(),n=Su(t),r=wh(xh),{sidebarOverlay:i}=Ch(),a=r&&i,o=r?!i:e.sidebarCollapsed,s=(0,V.useRef)(null),c=u();Gh(),(0,V.useEffect)(()=>he(e.theme),[e.theme]),(0,V.useEffect)(()=>{ig()&&t===`/`&&gu(`/terminal`,{replace:!0})},[]),(0,V.useEffect)(()=>{bh.setSidebarOverlay(!1),s.current?.focus({preventScroll:!0}),window.scrollTo({top:0}),document.title=n?`${n.label} · DaveCode`:`DaveCode`},[t]);let l=(0,H.jsx)(Hg,{active:n?.id===`terminal`});return n?.id===`terminal`?(0,H.jsxs)(H.Fragment,{children:[l,(0,H.jsx)(Ih,{}),(0,H.jsx)(Xh,{}),(0,H.jsx)($h,{})]}):n?.id===`workspace`||n?.id===`library`?(0,H.jsxs)(H.Fragment,{children:[l,(0,H.jsx)(tg,{mainRef:s,children:(0,H.jsx)(Kg,{id:n.id})}),(0,H.jsx)(Ih,{}),(0,H.jsx)(Xh,{}),(0,H.jsx)($h,{})]}):(0,H.jsxs)(`div`,{className:`flex min-h-dvh`,children:[l,(0,H.jsx)(`button`,{type:`button`,onClick:()=>s.current?.focus(),className:`sr-only z-50 rounded-md bg-accent px-3 py-2 text-accent-fg focus:not-sr-only focus:fixed focus:top-2 focus:left-2`,children:`Skip to content`}),(0,H.jsx)(Eu,{activeId:n?.id,collapsed:o,overlay:a,version:c.data?.version,onToggle:()=>Sh(()=>Te({sidebarCollapsed:!e.sidebarCollapsed}))}),a&&(0,H.jsx)(`button`,{type:`button`,"aria-label":`Close sidebar`,onClick:()=>bh.setSidebarOverlay(!1),className:`fixed inset-0 z-30 bg-scrim animate-fade-in`}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,H.jsx)(eg,{title:n?.label??`Not found`,status:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Vh,{}),(0,H.jsx)(Iu,{})]}),onOpenPalette:bh.openPalette,onOpenHelp:bh.openHelp}),(0,H.jsx)(`main`,{id:`main`,ref:s,tabIndex:-1,className:`mx-auto w-full max-w-[1600px] flex-1 px-4 py-5 outline-none md:px-6`,children:n?(0,H.jsx)(Kg,{id:n.id}):(0,H.jsx)(sg,{})})]}),(0,H.jsx)(Ih,{}),(0,H.jsx)(Xh,{}),(0,H.jsx)($h,{})]})}function Kg({id:e}){let t=Ug[e];return(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(Wg,{}),children:(0,H.jsx)(t,{})})}var qg=new T({defaultOptions:{queries:{staleTime:1e4,refetchOnWindowFocus:!1,retry:(e,t)=>ye(t)&&t.status>=400&&t.status<500?!1:e<2}}}),Jg=document.getElementById(`root`);if(!Jg)throw Error(`#root element missing from index.html`);(0,du.createRoot)(Jg).render((0,H.jsx)(V.StrictMode,{children:(0,H.jsx)(p,{client:qg,children:(0,H.jsx)(Fu,{children:(0,H.jsx)(De,{children:(0,H.jsx)(Gg,{})})})})}));export{vn as A,Rt as B,hh as C,gu as D,vu as E,Qt as F,vt as G,At as H,Kt as I,Xe as J,nt as K,Wt as L,cn as M,an as N,_u as O,en as P,Ht as R,bh as S,Tu as T,St as U,It as V,bt as W,Ke as X,Je as Y,Re as Z,Dh as _,Sg as a,Nh as b,ag as c,Jh as d,qh as f,kh as g,Oh as h,Dg as i,mn as j,hu as k,ng as l,zh as m,Og as n,xg as o,Bh as p,et as q,Eg as r,og as s,kg as t,rg as u,jh as v,ju as w,Th as x,Mh as y,Bt as z};
104
+ `},qp=0,Jp=[];function Yp(e){var t=V.useRef([]),n=V.useRef([0,0]),r=V.useRef(),i=V.useState(qp++)[0],a=V.useState(_p)[0],o=V.useRef(e);V.useEffect(function(){o.current=e},[e]),V.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Jf([e.lockRef.current],(e.shards||[]).map(Wp),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=V.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Hp(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Fp(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Fp(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Vp(h,t,e,h===`h`?s:c,!0)},[]),c=V.useCallback(function(e){var n=e;if(Jp.length&&Jp[Jp.length-1]===a){var r=`deltaY`in n?Up(n):Hp(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Gp(e.delta,r)})[0];if(i&&i.should)n.cancelable&&n.preventDefault();else if(!i){var c=(o.current.shards||[]).map(Wp).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=V.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Xp(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=V.useCallback(function(e){n.current=Hp(e),r.current=void 0},[]),d=V.useCallback(function(t){l(t.type,Up(t),t.target,s(t,e.lockRef.current))},[]),f=V.useCallback(function(t){l(t.type,Hp(t),t.target,s(t,e.lockRef.current))},[]);V.useEffect(function(){return Jp.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Ap),document.addEventListener(`touchmove`,c,Ap),document.addEventListener(`touchstart`,u,Ap),function(){Jp=Jp.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Ap),document.removeEventListener(`touchmove`,c,Ap),document.removeEventListener(`touchstart`,u,Ap)}},[]);var p=e.removeScrollBar,m=e.inert;return V.createElement(V.Fragment,null,m?V.createElement(a,{styles:Kp(i)}):null,p?V.createElement(Dp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Xp(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Zp=sp(cp,Yp),Qp=V.forwardRef(function(e,t){return V.createElement(up,Kf({},e,{ref:t,sideCar:Zp}))});Qp.classNames=up.classNames;var $p=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},em=new WeakMap,tm=new WeakMap,nm={},rm=0,im=function(e){return e&&(e.host||im(e.parentNode))},am=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=im(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},om=function(e,t,n,r){var i=am(t,Array.isArray(e)?e:[e]);nm[n]||(nm[n]=new WeakMap);var a=nm[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(em.get(e)||0)+1,l=(a.get(e)||0)+1;em.set(e,c),a.set(e,l),o.push(e),c===1&&i&&tm.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),rm++,function(){o.forEach(function(e){var t=em.get(e)-1,i=a.get(e)-1;em.set(e,t),a.set(e,i),t||(tm.has(e)||e.removeAttribute(r),tm.delete(e)),i||e.removeAttribute(n)}),rm--,rm||(em=new WeakMap,em=new WeakMap,tm=new WeakMap,nm={})}},sm=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||$p(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),om(r,i,n,`aria-hidden`)):function(){return null}},cm=Object.defineProperty,lm=(e,t)=>cm(e,`name`,{value:t,configurable:!0}),um=`Dialog`,[dm,fm]=ld(um),[pm,mm]=dm(um),hm=lm(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=V.useRef(null),c=V.useRef(null),[l,u]=wd({prop:r,defaultProp:i??!1,onChange:a,caller:um}),[d,f]=V.useState(0),[p,m]=V.useState(0);return(0,H.jsx)(pm,{scope:t,triggerRef:s,contentRef:c,contentId:gd(),titleId:gd(),descriptionId:gd(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:V.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),gm=`DialogPortal`,[_m,vm]=dm(gm,{forceMount:void 0}),ym=lm(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=mm(gm,t);return(0,H.jsx)(_m,{scope:t,forceMount:n,children:V.Children.map(r,e=>(0,H.jsx)(Pf,{present:n||a.open,children:(0,H.jsx)(Af,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),bm=`DialogOverlay`,xm=V.forwardRef(lm(function(e,t){let n=vm(bm,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=mm(bm,e.__scopeDialog);return a.modal?(0,H.jsx)(Pf,{present:r||a.open,children:(0,H.jsx)(Cm,{...i,ref:t})}):null},`DialogOverlay`)),Sm=Md(`DialogOverlay.RemoveScroll`),Cm=V.forwardRef(lm(function(e,t){let{__scopeDialog:n,...r}=e,i=mm(bm,n),a=ad(t,sf());return(0,H.jsx)(Qp,{as:Sm,allowPinchZoom:!0,shards:[i.contentRef],children:(0,H.jsx)(qd.div,{"data-state":km(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),wm=`DialogContent`,Tm=V.forwardRef(lm(function(e,t){let n=vm(wm,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=mm(wm,e.__scopeDialog);return(0,H.jsx)(Pf,{present:r||a.open,children:a.modal?(0,H.jsx)(Em,{...i,ref:t}):(0,H.jsx)(Dm,{...i,ref:t})})},`DialogContent`)),Em=V.forwardRef(lm(function(e,t){let n=mm(wm,e.__scopeDialog),r=V.useRef(null),i=ad(t,n.contentRef,r);return V.useEffect(()=>{let e=r.current;if(e)return sm(e)},[]),(0,H.jsx)(Om,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:G(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:G(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:G(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Dm=V.forwardRef(lm(function(e,t){let n=mm(wm,e.__scopeDialog),r=V.useRef(!1),i=V.useRef(!1);return(0,H.jsx)(Om,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),Om=V.forwardRef(lm(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=mm(wm,n);return Wf(),(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(_f,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,H.jsx)(of,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":km(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`));function km(e){return e?`open`:`closed`}lm(km,`getState`);var Am=`[cmdk-group=""]`,jm=`[cmdk-group-items=""]`,Mm=`[cmdk-group-heading=""]`,Nm=`[cmdk-item=""]`,Pm=`${Nm}:not([aria-disabled="true"])`,Fm=`cmdk-item-select`,Im=`data-value`,Lm=(e,t,n)=>Zu(e,t,n),Rm=V.createContext(void 0),zm=()=>V.useContext(Rm),Bm=V.createContext(void 0),Vm=()=>V.useContext(Bm),Hm=V.createContext(void 0),Um=V.forwardRef((e,t)=>{let n=rh(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=rh(()=>new Set),i=rh(()=>new Map),a=rh(()=>new Map),o=rh(()=>new Set),s=th(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=gd(),y=gd(),b=gd(),x=V.useRef(null),ee=oh();nh(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,te.emit()}},[u]),nh(()=>{ee(6,oe)},[]);let te=V.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)ae(),re(),ee(1,ie);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(ee(7,()=>{n.current.selectedItemId=se()?.id,te.emit()}),r||ee(5,oe),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}te.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),ne=V.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,S(t,r)),ee(2,()=>{re(),te.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),ee(3,()=>{ae(),re(),n.current.value||ie(),te.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=se();ee(4,()=>{ae(),t?.getAttribute(`id`)===e&&ie(),te.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function S(e,t){let r=s.current?.filter??Lm;return e?r(e,n.current.search,t):0}function re(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;ce().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(jm);t?t.appendChild(e.parentElement===t?e:e.closest(`${jm} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${jm} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${Am}[${Im}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function ie(){let e=ce().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Im);te.setState(`value`,e||void 0)}function ae(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=S(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function oe(){var e;let t=se();t&&(t.parentElement?.firstChild===t&&((e=t.closest(Am)?.querySelector(Mm))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function se(){return x.current?.querySelector(`${Nm}[aria-selected="true"]`)}function ce(){return Array.from(x.current?.querySelectorAll(Pm)||[])}function le(e){let t=ce()[e];t&&te.setState(`value`,t.getAttribute(Im))}function ue(e){var t;let n=se(),r=ce(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&te.setState(`value`,a.getAttribute(Im))}function de(e){let t=se()?.closest(Am),n;for(;t&&!n;)t=e>0?$m(t,Am):eh(t,Am),n=t?.querySelector(Pm);n?te.setState(`value`,n.getAttribute(Im)):ue(e)}let fe=()=>le(ce().length-1),pe=e=>{e.preventDefault(),e.metaKey?fe():e.altKey?de(1):ue(1)},me=e=>{e.preventDefault(),e.metaKey?le(0):e.altKey?de(-1):ue(-1)};return V.createElement(qd.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&pe(e);break;case`ArrowDown`:pe(e);break;case`p`:case`k`:g&&e.ctrlKey&&me(e);break;case`ArrowUp`:me(e);break;case`Home`:e.preventDefault(),le(0);break;case`End`:e.preventDefault(),fe();break;case`Enter`:{e.preventDefault();let t=se();if(t){let e=new Event(Fm);t.dispatchEvent(e)}}}}},V.createElement(`label`,{"cmdk-label":``,htmlFor:ne.inputId,id:ne.labelId,style:lh},c),ch(e,e=>V.createElement(Bm.Provider,{value:te},V.createElement(Rm.Provider,{value:ne},e))))}),Wm=V.forwardRef((e,t)=>{let n=gd(),r=V.useRef(null),i=V.useContext(Hm),a=zm(),o=th(e),s=o.current?.forceMount??i?.forceMount;nh(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=ah(n,r,[e.value,e.children,r],e.keywords),l=Vm(),u=ih(e=>e.value&&e.value===c.current),d=ih(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);V.useEffect(()=>{let t=r.current;if(t&&!e.disabled)return t.addEventListener(Fm,f),()=>t.removeEventListener(Fm,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return V.createElement(qd.div,{ref:id(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),Gm=V.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=gd(),s=V.useRef(null),c=V.useRef(null),l=gd(),u=zm(),d=ih(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));nh(()=>u.group(o),[]),ah(o,s,[e.value,e.heading,c]);let f=V.useMemo(()=>({id:o,forceMount:i}),[i]);return V.createElement(qd.div,{ref:id(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&V.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),ch(e,e=>V.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},V.createElement(Hm.Provider,{value:f},e))))}),Km=V.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=V.useRef(null),a=ih(e=>!e.search);return!n&&!a?null:V.createElement(qd.div,{ref:id(i,t),...r,"cmdk-separator":``,role:`separator`})}),qm=V.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Vm(),o=ih(e=>e.search),s=ih(e=>e.selectedItemId),c=zm();return V.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),V.createElement(qd.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Jm=V.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=V.useRef(null),o=V.useRef(null),s=ih(e=>e.selectedItemId),c=zm();return V.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),V.createElement(qd.div,{ref:id(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},ch(e,e=>V.createElement(`div`,{ref:id(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),Ym=V.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return V.createElement(hm,{open:n,onOpenChange:r},V.createElement(ym,{container:o},V.createElement(xm,{"cmdk-overlay":``,className:i}),V.createElement(Tm,{"aria-label":e.label,"cmdk-dialog":``,className:a},V.createElement(Um,{ref:t,...s}))))}),Xm=V.forwardRef((e,t)=>ih(e=>e.filtered.count===0)?V.createElement(qd.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),Zm=V.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return V.createElement(qd.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},ch(e,e=>V.createElement(`div`,{"aria-hidden":!0},e)))}),Qm=Object.assign(Um,{List:Jm,Item:Wm,Input:qm,Group:Gm,Separator:Km,Dialog:Ym,Empty:Xm,Loading:Zm});function $m(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function eh(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function th(e){let t=V.useRef(e);return nh(()=>{t.current=e}),t}var nh=typeof window>`u`?V.useEffect:V.useLayoutEffect;function rh(e){let t=V.useRef();return t.current===void 0&&(t.current=e()),t}function ih(e){let t=Vm(),n=()=>e(t.snapshot());return V.useSyncExternalStore(t.subscribe,n,n)}function ah(e,t,n,r=[]){let i=V.useRef(),a=zm();return nh(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(Im,s),i.current=s}),i}var oh=()=>{let[e,t]=V.useState(),n=rh(()=>new Map);return nh(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function sh(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function ch({asChild:e,children:t},n){return e&&V.isValidElement(t)?V.cloneElement(sh(t),{ref:t.ref},n(t.props.children)):n(t)}var lh={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},uh=[],dh=0,fh=new Set;function ph(){for(let e of fh)e()}function mh(e){uh=uh.filter(t=>t.id!==e),ph()}function hh(e){dh+=1;let t=dh;uh=[...uh.slice(-3),{...e,id:t}],ph(),setTimeout(()=>mh(t),4e3)}function gh(){return(0,V.useSyncExternalStore)(e=>(fh.add(e),()=>fh.delete(e)),()=>uh,()=>uh)}var _h={palette:!1,help:!1,sidebarOverlay:!1},vh=new Set;function yh(e){_h={..._h,...e};for(let e of vh)e()}var bh={openPalette:()=>yh({palette:!0,help:!1}),closePalette:()=>yh({palette:!1}),togglePalette:()=>yh({palette:!_h.palette,help:!1}),openHelp:()=>yh({help:!0,palette:!1}),closeHelp:()=>yh({help:!1}),setSidebarOverlay:e=>yh({sidebarOverlay:e})},xh=`(max-width: 1023px)`;function Sh(e){window.matchMedia(`(max-width: 1023px)`).matches?yh({sidebarOverlay:!_h.sidebarOverlay}):e()}function Ch(){return(0,V.useSyncExternalStore)(e=>(vh.add(e),()=>vh.delete(e)),()=>_h,()=>_h)}function wh(e){return(0,V.useSyncExternalStore)(t=>{let n=window.matchMedia(e);return n.addEventListener(`change`,t),()=>n.removeEventListener(`change`,t)},()=>window.matchMedia(e).matches,()=>!1)}function Th(e=1e3){let[t,n]=(0,V.useState)(()=>Date.now());return(0,V.useEffect)(()=>{let t=window.setInterval(()=>n(Date.now()),e);return()=>window.clearInterval(t)},[e]),t}function Eh(){let e=(0,V.useRef)(null),[t,n]=(0,V.useState)(0);return(0,V.useEffect)(()=>{let t=e.current;if(!t)return;n(t.clientWidth);let r=new ResizeObserver(e=>{let t=e[0]?.contentRect.width;t!==void 0&&n(Math.floor(t))});return r.observe(t),()=>r.disconnect()},[]),[e,t]}function Dh({provider:e,size:t=`md`,className:n}){let r=Se(e),i=r.icon,o=t===`sm`?`size-5 rounded`:t===`lg`?`size-8 rounded-md`:`size-6 rounded-md`,s=t===`sm`?`size-3`:t===`lg`?`size-4`:`size-3.5`;return(0,H.jsxs)(`span`,{title:r.label,className:a(`inline-flex shrink-0 items-center justify-center border border-line-strong bg-raised text-fg-2`,o,n),children:[(0,H.jsx)(i,{"aria-hidden":!0,className:s,strokeWidth:1.75}),(0,H.jsx)(`span`,{className:`sr-only`,children:r.label})]})}var Oh={active:`ok`,cooldown:`warn`,disabled:`neutral`,error:`err`};function kh({account:e}){let t=Th(1e3),n=Oh[e.status];if(e.status===`cooldown`&&e.cooldownUntil){let r=(Date.parse(e.cooldownUntil)-t)/1e3;return(0,H.jsxs)(Ce,{tone:n,dot:!0,children:[(0,H.jsx)(`span`,{children:`cooldown`}),(0,H.jsx)(`span`,{className:`tnum font-mono`,children:r>0?ae(r):`0:00`})]})}return(0,H.jsx)(`span`,{title:e.status===`error`?e.lastError:void 0,children:(0,H.jsx)(Ce,{tone:n,dot:!0,children:e.status})})}var Ah={PENDING:`neutral`,IN_PROGRESS:`info`,SUCCESS:`ok`,FAILED:`err`},jh={PENDING:`Pending`,IN_PROGRESS:`In progress`,SUCCESS:`Done`,FAILED:`Failed`};function Mh({status:e}){return(0,H.jsx)(Ce,{tone:Ah[e],dot:!0,pulse:e===`IN_PROGRESS`,children:jh[e]})}function Nh({status:e,className:t}){return(0,H.jsx)(ge,{tone:Ah[e],pulse:e===`IN_PROGRESS`,className:t})}function Ph({account:e,fallbackId:t,provider:n,showId:r,className:i}){let o=e?.provider??n??`openai-compatible`;return(0,H.jsxs)(`span`,{className:a(`inline-flex min-w-0 items-center gap-2`,i),children:[(0,H.jsx)(Dh,{provider:o,size:`sm`}),(0,H.jsxs)(`span`,{className:`min-w-0`,children:[(0,H.jsx)(`span`,{className:`block truncate text-fg`,children:e?.label??t??`unknown`}),r&&(0,H.jsx)(`span`,{className:`block truncate font-mono text-2xs text-muted`,children:e?.id??t})]})]})}var Fh=`https://github.com/DMRLZZ/DaveCode`;function Ih(){let{palette:e}=Ch(),t=(0,V.useRef)(null),n=(0,V.useRef)(null);return(0,V.useEffect)(()=>{let r=t.current;r&&(e&&!r.open&&(r.showModal(),n.current?.focus()),!e&&r.open&&r.close())},[e]),(0,V.useEffect)(()=>{let e=t.current;if(!e)return;let n=e=>{e.preventDefault(),bh.closePalette()};return e.addEventListener(`cancel`,n),()=>e.removeEventListener(`cancel`,n)},[]),(0,H.jsx)(`dialog`,{ref:t,"aria-label":`Command palette`,onClick:e=>{e.target===e.currentTarget&&bh.closePalette()},className:`mx-auto mt-[12vh] w-[min(640px,calc(100vw-2rem))] overflow-hidden rounded-xl border border-line-strong bg-panel p-0 text-fg shadow-overlay outline-none backdrop:bg-scrim open:animate-pop-in`,children:e&&(0,H.jsx)(Lh,{inputRef:n})})}function Lh({inputRef:e}){let t=ve(),n=g(),r=v(),i=fe(),{retry:a,connection:o}=s(),c=bh.closePalette,l=e=>()=>{c(),e()},u=e=>l(()=>{i.mutate(e,{onSuccess:e=>hh({tone:`info`,title:`Runner ${e.state}`}),onError:t=>hh({tone:`err`,title:`Could not ${e} the runner`,description:le(t)})})}),d=(e,t)=>l(()=>{navigator.clipboard.writeText(e).then(()=>hh({tone:`ok`,title:`Copied ${t}`,description:e})).catch(()=>hh({tone:`err`,title:`Clipboard unavailable`}))}),f=ie(ue().theme),p=`${ue().gatewayUrl||`http://127.0.0.1:4040`}/v1`;return(0,H.jsxs)(Qm,{label:`Command palette`,loop:!0,className:`flex max-h-[min(520px,70vh)] flex-col`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5 border-b border-line px-4`,children:[(0,H.jsx)(Kt,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted`,strokeWidth:1.75}),(0,H.jsx)(Qm.Input,{ref:e,placeholder:`Search pages, actions, accounts, tasks…`,className:`h-12 flex-1 bg-transparent text-[14px] text-fg outline-none placeholder:text-faint`}),(0,H.jsx)(W,{children:`Esc`})]}),(0,H.jsxs)(Qm.List,{className:`min-h-0 flex-1 overflow-y-auto p-1.5 [&_[cmdk-group-heading]]:px-2.5 [&_[cmdk-group-heading]]:pt-2.5 [&_[cmdk-group-heading]]:pb-1 [&_[cmdk-group-heading]]:text-2xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:tracking-[0.08em] [&_[cmdk-group-heading]]:text-muted [&_[cmdk-group-heading]]:uppercase`,children:[(0,H.jsx)(Qm.Empty,{className:`px-3 py-8 text-center text-[13px] text-muted`,children:`No results.`}),(0,H.jsx)(Qm.Group,{heading:`Go to`,children:xu.map(e=>(0,H.jsxs)(Rh,{value:`go ${e.label}`,keywords:[e.description],icon:e.icon,onSelect:l(()=>gu(e.path)),hint:(0,H.jsx)(Cu,{keys:[`g`,e.key]}),children:[e.label,(0,H.jsx)(`span`,{className:`ml-2 text-muted`,children:e.description})]},e.id))}),(0,H.jsxs)(Qm.Group,{heading:`Actions`,children:[(0,H.jsx)(Rh,{value:`add account`,icon:Bt,onSelect:l(()=>gu(`/accounts?new=1`)),children:`Add account`}),(0,H.jsx)(Rh,{value:`start resume runner`,icon:Rt,onSelect:u(`start`),children:`Start or resume the runner`}),(0,H.jsx)(Rh,{value:`pause runner`,icon:It,onSelect:u(`pause`),children:`Pause the runner`}),(0,H.jsx)(Rh,{value:`stop runner`,icon:Qt,onSelect:u(`stop`),children:`Stop the runner`}),(0,H.jsxs)(Rh,{value:`toggle theme dark light`,icon:f===`dark`?en:At,onSelect:l(()=>Te({theme:f===`dark`?`light`:`dark`})),children:[`Switch to `,f===`dark`?`light`:`dark`,` theme`]}),(0,H.jsx)(Rh,{value:`toggle mock data demo`,icon:gt,onSelect:l(()=>Te({dataMode:o.mode===`mock`?`auto`:`mock`})),children:o.mode===`mock`?`Use the live gateway (auto)`:`Show mock data`}),(0,H.jsxs)(Rh,{value:`copy openai base url`,icon:ft,onSelect:d(p,`base URL`),children:[`Copy OpenAI base URL`,(0,H.jsx)(`span`,{className:`ml-2 font-mono text-muted`,children:p})]}),(0,H.jsx)(Rh,{value:`retry reconnect gateway`,icon:Ht,onSelect:l(a),children:`Retry gateway connection`}),(0,H.jsx)(Rh,{value:`keyboard shortcuts help`,icon:St,onSelect:l(bh.openHelp),hint:(0,H.jsx)(W,{children:`?`}),children:`Keyboard shortcuts`})]}),(t.data?.length??0)>0&&(0,H.jsx)(Qm.Group,{heading:`Accounts`,children:t.data?.map(e=>(0,H.jsxs)(Rh,{value:`account ${e.label} ${e.id}`,keywords:[e.provider,e.status],iconNode:(0,H.jsx)(Dh,{provider:e.provider,size:`sm`}),onSelect:l(()=>gu(`/accounts?account=${encodeURIComponent(e.id)}`)),children:[e.label,(0,H.jsx)(`span`,{className:`ml-2 font-mono text-2xs text-muted`,children:e.id})]},e.id))}),(n.data?.graph.tasks.length??0)>0&&(0,H.jsx)(Qm.Group,{heading:`Tasks`,children:n.data?.graph.tasks.map(e=>(0,H.jsxs)(Rh,{value:`task ${e.id} ${e.title}`,keywords:[e.status],iconNode:(0,H.jsx)(`span`,{className:`flex size-5 items-center justify-center`,children:(0,H.jsx)(Nh,{status:e.status})}),onSelect:l(()=>gu(`/tasks?task=${encodeURIComponent(e.id)}`)),children:[(0,H.jsx)(`span`,{className:`font-mono text-[12px] text-muted`,children:e.id}),(0,H.jsx)(`span`,{className:`ml-2 truncate`,children:e.title})]},e.id))}),(r.data?.routes.length??0)>0&&(0,H.jsx)(Qm.Group,{heading:`Routes`,children:r.data?.routes.map(e=>(0,H.jsx)(Rh,{value:`route davecode/${e.name}`,keywords:[e.description??``],icon:Wt,onSelect:d(`davecode/${e.name}`,`model name`),hint:(0,H.jsx)(`span`,{className:`text-2xs text-muted`,children:`copy`}),children:(0,H.jsxs)(`span`,{className:`font-mono`,children:[`davecode/`,e.name]})},e.name))}),(0,H.jsx)(Qm.Group,{heading:`Docs`,children:[[`README`,`${Fh}#readme`],[`Architecture`,`${Fh}/blob/main/docs/ARCHITECTURE.md`],[`HTTP API reference`,`${Fh}/blob/main/docs/API.md`]].map(([e,t])=>(0,H.jsx)(Rh,{value:`docs ${e}`,icon:e===`Architecture`?vt:Je,onSelect:l(()=>window.open(t,`_blank`,`noopener,noreferrer`)),children:e},e))})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-line px-4 py-2 text-2xs text-muted`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,H.jsx)(W,{children:`↑`}),(0,H.jsx)(W,{children:`↓`}),` navigate`]}),(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,H.jsx)(W,{children:`↵`}),` select`]}),(0,H.jsxs)(`span`,{className:`ml-auto inline-flex items-center gap-1`,children:[(0,H.jsx)(mt,{"aria-hidden":!0,className:`size-3`,strokeWidth:1.75}),`DaveCode`]})]})]})}function Rh({value:e,keywords:t,icon:n,iconNode:r,hint:i,onSelect:o,children:s}){return(0,H.jsxs)(Qm.Item,{value:e,keywords:t,onSelect:o,className:a(`flex h-9 cursor-pointer items-center gap-2.5 rounded-md px-2.5 text-[13px] text-fg-2 select-none`,`data-[selected=true]:bg-hover data-[selected=true]:text-fg`),children:[r??(n&&(0,H.jsx)(n,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted`,strokeWidth:1.75})),(0,H.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center truncate`,children:s}),i]})}function zh({value:e,label:t=`Copy`,className:n}){let[r,i]=(0,V.useState)(!1);(0,V.useEffect)(()=>{if(!r)return;let e=window.setTimeout(()=>i(!1),1400);return()=>window.clearTimeout(e)},[r]);let o=async()=>{try{await navigator.clipboard.writeText(e),i(!0)}catch{}},s=r?et:ft;return(0,H.jsx)(`button`,{type:`button`,onClick:o,"aria-label":r?`Copied`:t,title:r?`Copied`:t,className:a(`inline-flex size-6 shrink-0 items-center justify-center rounded text-muted transition-colors duration-150 hover:bg-hover hover:text-fg`,r&&`text-ok hover:text-ok`,n),children:(0,H.jsx)(s,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:1.75})})}function Bh({command:e,className:t}){return(0,H.jsxs)(`div`,{className:a(`flex min-w-0 items-center gap-2 rounded-md border border-line bg-raised py-1 pr-1 pl-2.5 font-mono text-[12px] text-fg-2`,t),children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:`text-faint select-none`,children:`$`}),(0,H.jsx)(`code`,{className:`min-w-0 flex-1 truncate`,children:e}),(0,H.jsx)(zh,{value:e,label:`Copy command`})]})}function Vh(){let{connection:e,retry:t}=s(),n=Ee(),r=Th(1e3),[i,o]=(0,V.useState)(!1),c=(0,V.useRef)(null);(0,V.useEffect)(()=>{if(!i)return;let e=e=>{c.current?.contains(e.target)||o(!1)},t=e=>{e.key===`Escape`&&o(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[i]);let{mode:l,stream:u,reason:d,unauthorized:f}=e,p=`neutral`,m=`Connecting…`,h=!1;if(l===`mock`)p=`accent`,m=`Mock data`;else if(f)p=`err`,m=`Unauthorized`;else if(l===`live`&&u.state===`open`)p=`ok`,m=`Live`,h=!0;else if(u.state===`reconnecting`){p=`warn`;let e=u.retryAt?Math.max(0,Math.ceil((u.retryAt-r)/1e3)):0;m=e>0?`Reconnecting in ${e}s`:`Reconnecting…`}let g=n.gatewayUrl||window.location.origin;return(0,H.jsxs)(`div`,{ref:c,className:`relative`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),"aria-expanded":i,"aria-haspopup":`dialog`,"aria-label":`Connection: ${m}. Show details`,className:a(`flex h-7 items-center gap-2 rounded-md border px-2.5 text-[12px] font-medium transition-colors duration-150`,l===`mock`?`border-accent/30 bg-accent-soft text-accent-text hover:border-accent/50`:`border-line bg-panel text-fg-2 hover:border-line-strong hover:text-fg`),children:[l===`mock`?(0,H.jsx)(gt,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:1.75}):(0,H.jsx)(ge,{tone:p,pulse:h,className:`size-[7px]`}),(0,H.jsx)(`span`,{className:`whitespace-nowrap`,children:m})]}),i&&(0,H.jsxs)(`div`,{role:`dialog`,"aria-label":`Connection details`,className:`absolute top-9 right-0 z-30 w-[320px] animate-pop-in rounded-lg border border-line-strong bg-panel p-3.5 text-[12px] shadow-overlay`,children:[(0,H.jsxs)(`dl`,{className:`grid grid-cols-[88px_1fr] gap-x-3 gap-y-1.5`,children:[(0,H.jsx)(`dt`,{className:`text-muted`,children:`Source`}),(0,H.jsx)(`dd`,{className:`text-fg`,children:l===`mock`?`Simulated in this browser`:l===`probing`?`Probing…`:`Gateway`}),(0,H.jsx)(`dt`,{className:`text-muted`,children:`Gateway`}),(0,H.jsx)(`dd`,{className:`truncate font-mono text-fg-2`,children:g}),(0,H.jsx)(`dt`,{className:`text-muted`,children:`Event stream`}),(0,H.jsxs)(`dd`,{className:`text-fg-2`,children:[u.state,u.attempt>0&&` · attempt ${u.attempt}`]}),u.lastEventAt&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:`text-muted`,children:`Last event`}),(0,H.jsx)(`dd`,{className:`text-fg-2`,children:ce(u.lastEventAt,r)})]})]}),l===`mock`&&(0,H.jsxs)(`div`,{className:`mt-3 border-t border-line pt-3 text-fg-2`,children:[d===`unreachable`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{children:`The gateway did not answer, so the dashboard is showing simulated data. Start it with:`}),(0,H.jsx)(Bh,{command:`davecode start`,className:`mt-2`}),(0,H.jsx)(`p`,{className:`mt-2 text-muted`,children:`Retrying automatically every 15 s.`})]}),d===`forced`&&(0,H.jsxs)(`p`,{children:[`Mock mode is forced by `,(0,H.jsx)(`code`,{className:`font-mono`,children:`?mock=1`}),` or`,` `,(0,H.jsx)(`code`,{className:`font-mono`,children:`VITE_DAVECODE_MOCK=1`}),`.`]}),d===`setting`&&(0,H.jsx)(`p`,{children:`Mock mode is selected in Settings.`})]}),f&&(0,H.jsx)(`p`,{className:`mt-3 border-t border-line pt-3 text-err`,children:`The gateway requires a bearer token. Add it in Settings.`}),(0,H.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,H.jsx)(ju,{size:`sm`,variant:`ghost`,onClick:()=>{o(!1),gu(`/settings`)},children:`Settings`}),d!==`forced`&&(0,H.jsx)(ju,{size:`sm`,icon:Ht,onClick:t,children:`Retry now`})]})]})]})}var Hh=[{title:`General`,items:[{keys:[`mod`,`K`],description:`Open the command palette`},{keys:[`?`],description:`Show keyboard shortcuts`},{keys:[`/`],description:`Focus the filter on this page`},{keys:[`[`],description:`Collapse or expand the sidebar`},{keys:[`Esc`],description:`Close the open dialog or sheet`}]},{title:`Go to`,items:xu.map(e=>({keys:[`g`,e.key],description:e.label}))},{title:`Charts and lists`,items:[{keys:[`←`,`→`],description:`Step through chart values (when the chart is focused)`},{keys:[`Home`,`End`],description:`First or last chart value`},{keys:[`Tab`],description:`Move between task graph nodes`}]}];function Uh(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable}function Wh(){return document.querySelector(`dialog[open]`)!==null}function Gh(){(0,V.useEffect)(()=>{let e=0,t=t=>{if(!(t.target instanceof HTMLElement&&t.target.closest(`.xterm`))){if((t.metaKey||t.ctrlKey)&&!t.altKey&&t.key.toLowerCase()===`k`)t.preventDefault(),bh.togglePalette();else if(t.key===`Escape`&&bh.setSidebarOverlay(!1),!(t.defaultPrevented||t.metaKey||t.ctrlKey||t.altKey)&&!(Uh(t.target)||Wh())){if(e&&Date.now()-e<1200){e=0;let n=xu.find(e=>e.key===t.key.toLowerCase());n&&(t.preventDefault(),gu(n.path))}else switch(t.key){case`g`:e=Date.now();break;case`?`:t.preventDefault(),bh.openHelp();break;case`[`:t.preventDefault(),Sh(()=>Te({sidebarCollapsed:!ue().sidebarCollapsed}));break;case`/`:{let e=document.querySelector(`[data-filter-input]`);e&&(t.preventDefault(),e.focus(),e.select());break}}}}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[])}function Kh(e,t){let n=(0,V.useRef)(null);return(0,V.useEffect)(()=>{let t=n.current;t&&(e&&!t.open&&(t.showModal(),t.focus()),!e&&t.open&&t.close())},[e]),(0,V.useEffect)(()=>{let e=n.current;if(!e)return;let r=e=>{e.preventDefault(),t()};return e.addEventListener(`cancel`,r),()=>e.removeEventListener(`cancel`,r)},[t]),{ref:n,onBackdropClick:e=>{e.target===e.currentTarget&&t()}}}function qh({open:e,onClose:t,title:n,description:r,children:i,footer:o,className:s,width:c=`w-[min(480px,100vw)]`}){let{ref:l,onBackdropClick:u}=Kh(e,t),d=(0,V.useId)();return(0,H.jsx)(`dialog`,{ref:l,tabIndex:-1,"aria-labelledby":d,onClick:u,className:a(`fixed inset-y-0 right-0 left-auto m-0 h-dvh max-h-none max-w-none border-l border-line bg-panel p-0 text-fg shadow-overlay outline-none`,`backdrop:bg-scrim open:animate-sheet-in`,c,s),children:e&&(0,H.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,H.jsxs)(`header`,{className:`flex items-start gap-3 border-b border-line px-5 py-4`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`h2`,{id:d,className:`text-[15px] font-semibold tracking-tight`,children:n}),r&&(0,H.jsx)(`div`,{className:`mt-0.5 text-[12px] text-muted`,children:r})]}),(0,H.jsx)(Yh,{onClose:t})]}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:i}),o&&(0,H.jsx)(`footer`,{className:`flex items-center justify-end gap-2 border-t border-line px-5 py-3`,children:o})]})})}function Jh({open:e,onClose:t,title:n,description:r,children:i,footer:o,className:s}){let{ref:c,onBackdropClick:l}=Kh(e,t),u=(0,V.useId)();return(0,H.jsx)(`dialog`,{ref:c,tabIndex:-1,"aria-labelledby":u,onClick:l,className:a(`m-auto w-[min(520px,calc(100vw-2rem))] rounded-xl border border-line-strong bg-panel p-0 text-fg shadow-overlay outline-none`,`backdrop:bg-scrim open:animate-pop-in`,s),children:e&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`header`,{className:`flex items-start gap-3 px-5 pt-4 pb-2`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`h2`,{id:u,className:`text-[15px] font-semibold tracking-tight`,children:n}),r&&(0,H.jsx)(`div`,{className:`mt-1 text-[13px] text-muted`,children:r})]}),(0,H.jsx)(Yh,{onClose:t})]}),(0,H.jsx)(`div`,{className:`px-5 pb-4`,children:i}),o&&(0,H.jsx)(`footer`,{className:`flex items-center justify-end gap-2 border-t border-line px-5 py-3`,children:o})]})})}function Yh({onClose:e}){return(0,H.jsx)(`button`,{type:`button`,onClick:e,"aria-label":`Close`,className:`-mr-1.5 inline-flex size-7 items-center justify-center rounded-md text-muted transition-colors duration-150 hover:bg-hover hover:text-fg`,children:(0,H.jsx)(vn,{"aria-hidden":!0,className:`size-4`,strokeWidth:1.75})})}function Xh(){let{help:e}=Ch();return(0,H.jsx)(Jh,{open:e,onClose:bh.closeHelp,title:`Keyboard shortcuts`,description:`DaveCode is keyboard-first. Shortcuts are paused while you type in a field.`,className:`w-[min(560px,calc(100vw-2rem))]`,children:(0,H.jsx)(`div`,{className:`grid grid-cols-1 gap-x-8 gap-y-5 sm:grid-cols-2`,children:Hh.map(e=>(0,H.jsxs)(`section`,{"aria-labelledby":`sc-${e.title}`,children:[(0,H.jsx)(`h3`,{id:`sc-${e.title}`,className:`eyebrow mb-2`,children:e.title}),(0,H.jsx)(`dl`,{className:`flex flex-col gap-1.5`,children:e.items.map(e=>(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[13px]`,children:[(0,H.jsx)(`dt`,{className:`text-fg-2`,children:e.description}),(0,H.jsx)(`dd`,{children:(0,H.jsx)(Cu,{keys:e.keys.map(e=>e===`mod`?U:e)})})]},e.description))})]},e.title))})})}var Zh={ok:nt,err:ct,info:bt},Qh={ok:`text-ok`,err:`text-err`,info:`text-info`};function $h(){let e=gh();return(0,H.jsx)(`section`,{"aria-live":`polite`,"aria-label":`Notifications`,className:`pointer-events-none fixed right-4 bottom-4 z-50 flex w-[min(360px,calc(100vw-2rem))] flex-col gap-2`,children:e.map(e=>{let t=Zh[e.tone];return(0,H.jsxs)(`div`,{className:`pointer-events-auto flex animate-pop-in gap-2.5 rounded-lg border border-line-strong bg-panel px-3 py-2.5 shadow-overlay`,children:[(0,H.jsx)(t,{"aria-hidden":!0,className:a(`mt-0.5 size-4 shrink-0`,Qh[e.tone]),strokeWidth:1.75}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`p`,{className:`text-[13px] font-medium text-fg`,children:e.title}),e.description&&(0,H.jsx)(`p`,{className:`mt-0.5 text-[12px] text-muted`,children:e.description})]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>mh(e.id),"aria-label":`Dismiss notification`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded text-muted hover:bg-hover hover:text-fg`,children:(0,H.jsx)(vn,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:1.75})})]},e.id)})})}function eg({title:e,status:t,onOpenPalette:n,onOpenHelp:r}){let{theme:i}=Ee(),a=ie(i),o=a===`dark`?`light`:`dark`;return(0,H.jsxs)(`header`,{className:`sticky top-0 z-20 flex h-12 shrink-0 items-center gap-3 border-b border-line bg-bg px-4 md:px-5`,children:[(0,H.jsxs)(`p`,{className:`flex min-w-0 items-center gap-1.5 text-[13px]`,children:[(0,H.jsx)(`span`,{className:`hidden text-muted sm:inline`,children:`DaveCode`}),(0,H.jsx)(`span`,{"aria-hidden":!0,className:`hidden text-faint sm:inline`,children:`/`}),(0,H.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e})]}),(0,H.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[t,(0,H.jsxs)(`button`,{type:`button`,onClick:n,"aria-label":`Open command palette`,"aria-keyshortcuts":`Control+K Meta+K`,className:`hidden h-8 w-56 items-center gap-2 rounded-md border border-line bg-panel px-2.5 text-[12px] text-muted transition-colors duration-150 hover:border-line-strong hover:text-fg-2 md:flex`,children:[(0,H.jsx)(Kt,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:1.75}),(0,H.jsx)(`span`,{children:`Search or jump to…`}),(0,H.jsxs)(`span`,{className:`ml-auto flex items-center gap-0.5`,children:[(0,H.jsx)(W,{children:U}),(0,H.jsx)(W,{children:`K`})]})]}),(0,H.jsx)(ju,{variant:`ghost`,iconOnly:!0,icon:Kt,"aria-label":`Open command palette`,onClick:n,className:`md:hidden`}),(0,H.jsx)(ju,{variant:`ghost`,iconOnly:!0,icon:a===`dark`?en:At,"aria-label":`Switch to ${o} theme`,title:`Switch to ${o} theme`,onClick:()=>Te({theme:o})}),(0,H.jsx)(ju,{variant:`ghost`,iconOnly:!0,icon:ot,"aria-label":`Keyboard shortcuts`,"aria-keyshortcuts":`Shift+Slash`,title:`Keyboard shortcuts ?`,onClick:r})]})]})}function tg({children:e,mainRef:t}){let[n,r]=(0,V.useState)(!1),{params:i,path:a}=hu(),o=ne(),{connection:c}=s();return(0,H.jsxs)(`div`,{className:`flex min-h-dvh bg-bg`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>t.current?.focus(),className:`sr-only z-50 bg-accent px-3 py-2 text-accent-fg focus:not-sr-only focus:fixed focus:top-2 focus:left-2`,children:`Skip to content`}),(0,H.jsxs)(`aside`,{className:`${n?`fixed inset-y-0 left-0 z-40 flex shadow-overlay`:`hidden`} w-60 shrink-0 flex-col border-r border-line bg-panel p-3 md:sticky md:top-0 md:flex md:h-dvh`,"aria-label":`Workspace navigation`,children:[(0,H.jsxs)(vu,{to:`/`,className:`mb-8 flex items-center gap-2.5 px-2 py-3 text-[15px] font-semibold tracking-tight`,children:[(0,H.jsx)(Tu,{className:`size-7`}),`DaveCode`]}),(0,H.jsxs)(vu,{to:`/?new=1`,onClick:()=>r(!1),className:`mb-2 flex h-10 items-center gap-2 rounded-lg border border-line-strong px-3 text-[13px] text-fg transition-colors hover:bg-hover`,children:[(0,H.jsx)(Bt,{"aria-hidden":!0,className:`size-4`}),`New task`]}),(0,H.jsxs)(vu,{to:`/library`,onClick:()=>r(!1),"aria-current":a===`/library`?`page`:void 0,className:`mb-7 flex h-10 items-center gap-2 rounded-lg px-3 text-[13px] text-fg-2 hover:bg-hover`,children:[(0,H.jsx)(Je,{"aria-hidden":!0,className:`size-4`}),`Creative library`]}),(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[(0,H.jsx)(`p`,{className:`mb-2 px-3 text-[12px] text-muted`,children:`Recent work`}),(0,H.jsxs)(`nav`,{"aria-label":`Recent work`,className:`flex flex-col gap-1`,children:[(o.data??[]).slice(0,20).map(e=>(0,H.jsx)(vu,{to:`/?goal=${encodeURIComponent(e.id)}`,onClick:()=>r(!1),"aria-current":i.get(`goal`)===e.id?`page`:void 0,className:`truncate rounded-lg px-3 py-2.5 text-[13px] text-fg-2 transition-colors hover:bg-hover aria-[current=page]:bg-active aria-[current=page]:text-fg`,children:e.objective},e.id)),o.data?.length===0&&(0,H.jsx)(`p`,{className:`px-3 py-2 text-[12px] leading-5 text-muted`,children:`Your first task starts here.`})]})]}),(0,H.jsxs)(`div`,{className:`mt-4 flex flex-col gap-1 border-t border-line pt-3`,children:[(0,H.jsxs)(vu,{to:`/accounts`,className:`flex items-center gap-2 rounded-lg px-3 py-2.5 text-[13px] text-fg-2 hover:bg-hover`,children:[(0,H.jsx)(Xt,{"aria-hidden":!0,className:`size-4`}),`AI connections`]}),(0,H.jsxs)(vu,{to:`/settings`,className:`flex items-center gap-2 rounded-lg px-3 py-2.5 text-[13px] text-fg-2 hover:bg-hover`,children:[(0,H.jsx)(Jt,{"aria-hidden":!0,className:`size-4`}),`Settings`]})]})]}),n&&(0,H.jsx)(`button`,{type:`button`,"aria-label":`Close navigation`,onClick:()=>r(!1),className:`fixed inset-0 z-30 bg-scrim md:hidden`}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,H.jsxs)(`header`,{className:`flex h-16 items-center justify-between gap-3 px-5 md:px-8`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(ju,{icon:Ot,iconOnly:!0,"aria-label":`Open navigation`,variant:`ghost`,className:`md:hidden`,onClick:()=>r(!0)}),(0,H.jsx)(`span`,{className:`text-[14px] text-fg-2`,children:a===`/library`?`Creative library`:`Workspace`})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,H.jsx)(`span`,{className:`text-[12px] text-muted`,children:c.mode===`mock`?`Demo`:c.mode===`probing`?`Connecting`:`On your device`}),(0,H.jsx)(Iu,{})]})]}),(0,H.jsx)(`main`,{ref:t,tabIndex:-1,id:`main`,className:`mx-auto flex w-full max-w-6xl flex-1 flex-col px-5 pb-6 md:px-10`,children:e})]})]})}function ng({className:e}){return(0,H.jsx)(`div`,{"aria-hidden":!0,className:a(`skeleton h-3`,e)})}function rg({rows:e=5,className:t}){return(0,H.jsx)(`div`,{className:a(`flex flex-col`,t),role:`status`,"aria-label":`Loading`,children:Array.from({length:e},(e,t)=>(0,H.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-line px-3.5 py-3 last:border-b-0`,children:[(0,H.jsx)(ng,{className:`size-5 rounded`}),(0,H.jsx)(ng,{className:`h-3 w-40`}),(0,H.jsx)(ng,{className:`ml-auto h-3 w-24`}),(0,H.jsx)(ng,{className:`h-3 w-16`})]},t))})}function ig(){return window.davecodeDesktop?.terminal}function ag(e){return e<=1?1:e<=4?2:3}function og({icon:e,title:t,description:n,command:r,action:i,className:o}){return(0,H.jsxs)(`div`,{className:a(`flex flex-col items-center justify-center gap-3 px-6 py-10 text-center`,o),children:[(0,H.jsx)(`div`,{className:`flex size-9 items-center justify-center rounded-lg border border-line-strong bg-raised text-muted`,children:(0,H.jsx)(e,{"aria-hidden":!0,className:`size-4`,strokeWidth:1.5})}),(0,H.jsxs)(`div`,{className:`max-w-sm`,children:[(0,H.jsx)(`p`,{className:`text-[13px] font-medium text-fg`,children:t}),n&&(0,H.jsx)(`p`,{className:`mt-1 text-[12px] leading-5 text-muted`,children:n})]}),r&&(0,H.jsx)(Bh,{command:r,className:`w-full max-w-sm text-left`}),i]})}function sg(){return(0,H.jsx)(og,{icon:ut,title:`Nothing here`,description:`This route does not exist in the dashboard. Press ? to see every shortcut.`,action:(0,H.jsx)(ju,{variant:`secondary`,onClick:()=>gu(`/`),children:`Back to overview`}),className:`py-24`})}var cg={neutral:`text-muted`,accent:`text-accent-text`,ok:`text-ok`,warn:`text-warn`,err:`text-err`,info:`text-info`};function lg(e,t){let n=e=>e?t.get(e)?.label??e:`nobody`,r=`${e.ts}:${e.type}:${JSON.stringify(e).length}`;switch(e.type){case`router.failover`:return{key:r,ts:e.ts,icon:He,tone:e.toAccountId?`warn`:`err`,text:e.toAccountId?`Failover ${n(e.fromAccountId)} → ${n(e.toAccountId)}`:`No failover target left after ${n(e.fromAccountId)}`,detail:`${e.reason} · ${e.requestId}`};case`account.updated`:{let t=e.account.status;return{key:r,ts:e.ts,icon:un,tone:t===`cooldown`?`warn`:t===`error`?`err`:t===`active`?`ok`:`neutral`,text:`${e.account.label} is ${t}`,detail:t===`cooldown`?e.account.lastError:e.account.id}}case`account.removed`:return{key:r,ts:e.ts,icon:fn,tone:`neutral`,text:`Account ${e.accountId} removed`};case`task.updated`:return{key:r,ts:e.ts,icon:e.task.status===`SUCCESS`?nt:e.task.status===`FAILED`?ct:it,tone:e.task.status===`SUCCESS`?`ok`:e.task.status===`FAILED`?`err`:e.task.status===`IN_PROGRESS`?`info`:`neutral`,text:`${e.task.id} → ${e.task.status.toLowerCase().replace(`_`,` `)}`,detail:e.task.title};case`task.removed`:return{key:r,ts:e.ts,icon:ct,tone:`neutral`,text:`${e.taskId} removed`};case`runner.status`:return{key:r,ts:e.ts,icon:Xe,tone:e.status.state===`error`?`err`:e.status.state===`repairing`?`warn`:`info`,text:`Runner ${e.status.state}${e.status.taskId?` · ${e.status.taskId}`:``}`,detail:e.status.repairCycle?`repair cycle ${e.status.repairCycle}/3`:void 0};case`log`:case`runner.log`:return e.level!==`warn`&&e.level!==`error`?null:{key:r,ts:e.ts,icon:e.level===`error`?ct:cn,tone:e.level===`error`?`err`:`warn`,text:e.message,detail:e.type===`log`?e.scope:`runner`};default:return null}}function ug({items:e,className:t}){return e.length===0?(0,H.jsxs)(`div`,{className:a(`flex flex-1 items-center justify-center gap-2 p-6 text-[12px] text-muted`,t),children:[(0,H.jsx)(bt,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:1.75}),`Waiting for activity…`]}):(0,H.jsx)(`ol`,{"aria-label":`Recent activity`,className:a(`flex flex-col`,t),children:e.map(e=>{let t=e.icon;return(0,H.jsxs)(`li`,{className:`flex animate-row-in gap-2.5 border-b border-line px-3.5 py-2 last:border-b-0`,children:[(0,H.jsx)(t,{"aria-hidden":!0,className:a(`mt-0.5 size-3.5 shrink-0`,cg[e.tone]),strokeWidth:1.75}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`p`,{className:`truncate text-[12px] text-fg`,children:e.text}),e.detail&&(0,H.jsx)(`p`,{className:`truncate font-mono text-2xs text-muted`,children:e.detail})]}),(0,H.jsx)(`time`,{dateTime:new Date(e.ts).toISOString(),className:`tnum shrink-0 font-mono text-2xs text-faint`,children:be(e.ts)})]},e.key)})})}function dg(e){if(e<=0||!Number.isFinite(e))return 1;let t=10**Math.floor(Math.log10(e)),n=e/t;return(n<=1?1:n<=2?2:n<=2.5?2.5:n<=5?5:10)*t}function fg(e,t=4){let n=dg(Math.max(e,1)/t),r=Math.max(n,Math.ceil(e/n)*n),i=[];for(let e=0;e<=r+n/2;e+=n)i.push(Math.round(e*1e3)/1e3);return i}function pg(e,t){let[n,r]=e,[i,a]=t,o=r-n||1;return e=>i+(e-n)/o*(a-i)}function mg(e,t){if(e.length===0)return-1;let n=0,r=e.length-1;for(;r-n>1;){let i=n+r>>1;(e[i]??0)<t?n=i:r=i}return Math.abs((e[n]??0)-t)<=Math.abs((e[r]??0)-t)?n:r}function hg(e,t){if(e.length===0)return``;let n=e.map(([e,t],n)=>`${n===0?`M`:`L`}${e.toFixed(1)},${t.toFixed(1)}`).join(``);if(t===void 0)return n;let r=e[0],i=e[e.length-1];return!r||!i?n:`${n}L${i[0].toFixed(1)},${t.toFixed(1)}L${r[0].toFixed(1)},${t.toFixed(1)}Z`}var gg={top:14,right:64,bottom:24,left:44};function _g({points:e,height:t=220,label:n,unit:r,secondaryLabel:i,liveTail:o,className:s}){let[c,l]=Eh(),[u,d]=(0,V.useState)(null),f=(0,V.useId)(),p=(0,V.useMemo)(()=>{if(l<=0||e.length<2)return null;let n=Math.max(10,l-gg.left-gg.right),r=t-gg.top-gg.bottom,i=Math.max(...e.map(e=>e.value),1),a=fg(i,4),o=a[a.length-1]??i,s=e[0]?.ts??0,c=e[e.length-1]?.ts??1,u=pg([s,c],[gg.left,gg.left+n]),d=pg([0,o],[gg.top+r,gg.top]),f=e.map(e=>[u(e.ts),d(e.value)]),p=9e5,m=[];for(let e=Math.ceil(s/p)*p;e<=c;e+=p)m.push(e);return{innerW:n,innerH:r,ticks:a,x:u,y:d,xy:f,xTicks:m,baseline:gg.top+r}},[e,l,t]),m=p?o?p.xy.slice(0,-1):p.xy:[],h=p&&o?p.xy.slice(-2):[],g=p?.xy[p.xy.length-1],_=e[e.length-1],v=e=>{if(!p)return;let t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left+gg.left;d(mg(p.xy.map(e=>e[0]),n))},y=t=>{if(e.length===0)return;let n=e.length-1,r=u??n,i=r;if(t.key===`ArrowLeft`)i=Math.max(0,r-1);else if(t.key===`ArrowRight`)i=Math.min(n,r+1);else if(t.key===`Home`)i=0;else if(t.key===`End`)i=n;else if(t.key===`Escape`)i=null;else return;t.preventDefault(),d(i)},b=u===null?void 0:e[u],x=u===null?void 0:p?.xy[u],ee=e.reduce((e,t)=>Math.max(e,t.value),0);return(0,H.jsxs)(`figure`,{ref:c,tabIndex:0,"aria-label":`${n}. Peak ${se(ee)} ${r}. Use the left and right arrow keys to read values.`,onKeyDown:y,onBlur:()=>d(null),className:a(`relative m-0 w-full select-none rounded-md`,s),style:{height:t},children:[p&&(0,H.jsxs)(`svg`,{width:l,height:t,className:`block overflow-visible`,"aria-hidden":!0,children:[(0,H.jsx)(`defs`,{children:(0,H.jsx)(`clipPath`,{id:f,children:(0,H.jsx)(`rect`,{x:gg.left,y:0,width:p.innerW,height:t})})}),p.ticks.map(e=>(0,H.jsxs)(`g`,{children:[(0,H.jsx)(`line`,{x1:gg.left,x2:gg.left+p.innerW,y1:p.y(e),y2:p.y(e),className:e===0?`stroke-line-strong`:`stroke-line`,strokeWidth:1,shapeRendering:`crispEdges`}),(0,H.jsx)(`text`,{x:gg.left-8,y:p.y(e),dy:`0.32em`,textAnchor:`end`,className:`tnum fill-muted font-mono text-[10px]`,children:de(e)})]},e)),p.xTicks.map(e=>(0,H.jsx)(`text`,{x:p.x(e),y:t-6,textAnchor:`middle`,className:`tnum fill-muted font-mono text-[10px]`,children:xe(e)},e)),(0,H.jsxs)(`g`,{clipPath:`url(#${f})`,children:[(0,H.jsx)(`path`,{d:hg(p.xy,p.baseline),className:`fill-accent`,opacity:.1}),(0,H.jsx)(`path`,{d:hg(m),fill:`none`,className:`stroke-accent`,strokeWidth:2,strokeLinejoin:`round`,strokeLinecap:`round`}),h.length===2&&(0,H.jsx)(`path`,{d:hg(h),fill:`none`,className:`stroke-accent`,strokeWidth:2,strokeDasharray:`3 3`,strokeLinecap:`round`,opacity:.7})]}),g&&_&&(0,H.jsxs)(`g`,{children:[(0,H.jsx)(`circle`,{cx:g[0],cy:g[1],r:4,className:`fill-accent stroke-panel`,strokeWidth:2}),(0,H.jsx)(`text`,{x:g[0]+9,y:g[1],dy:`-0.1em`,className:`tnum fill-fg font-mono text-[11px] font-medium`,children:de(_.value)}),(0,H.jsx)(`text`,{x:g[0]+9,y:g[1],dy:`1.15em`,className:`fill-muted text-[10px]`,children:o?`now`:r})]}),x&&(0,H.jsxs)(`g`,{children:[(0,H.jsx)(`line`,{x1:x[0],x2:x[0],y1:gg.top,y2:p.baseline,className:`stroke-fg-2`,strokeWidth:1,opacity:.5,shapeRendering:`crispEdges`}),(0,H.jsx)(`circle`,{cx:x[0],cy:x[1],r:4,className:`fill-accent stroke-panel`,strokeWidth:2})]}),(0,H.jsx)(`rect`,{x:gg.left,y:gg.top,width:p.innerW,height:p.innerH,fill:`transparent`,onPointerMove:v,onPointerLeave:()=>d(null)})]}),b&&x&&p&&(0,H.jsxs)(`div`,{className:`pointer-events-none absolute top-1 z-10 min-w-32 rounded-md border border-line-strong bg-panel px-2.5 py-2 shadow-overlay`,style:{left:Math.min(Math.max(x[0]+10,0),l-150)},children:[(0,H.jsxs)(`p`,{className:`tnum font-mono text-[11px] text-muted`,children:[xe(b.ts),o&&u===e.length-1&&` · in progress`]}),(0,H.jsxs)(`p`,{className:`mt-1 flex items-center gap-2`,children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:`h-0.5 w-3 rounded-full bg-accent`}),(0,H.jsx)(`span`,{className:`tnum text-[13px] font-semibold text-fg`,children:se(b.value)}),(0,H.jsx)(`span`,{className:`text-[11px] text-muted`,children:r})]}),b.secondary!==void 0&&i&&(0,H.jsxs)(`p`,{className:`mt-0.5 pl-5 text-[11px] text-fg-2`,children:[(0,H.jsx)(`span`,{className:`tnum font-mono`,children:se(b.secondary)}),` `,i]})]})]})}function vg({values:e,width:t=96,height:n=28,className:r}){if(e.length<2)return(0,H.jsx)(`div`,{style:{width:t,height:n},className:r});let i=Math.max(...e,1),o=pg([0,e.length-1],[2,t-4]),s=pg([0,i],[n-3,3]),c=e.map((e,t)=>[o(t),s(e)]),l=c[c.length-1];return(0,H.jsxs)(`svg`,{width:t,height:n,"aria-hidden":!0,className:a(`overflow-visible`,r),children:[(0,H.jsx)(`path`,{d:hg(c,n-1),className:`fill-fg-2`,opacity:.06}),(0,H.jsx)(`path`,{d:hg(c),fill:`none`,className:`stroke-fg-2`,strokeWidth:1.5,strokeLinejoin:`round`,opacity:.7}),l&&(0,H.jsx)(`circle`,{cx:l[0],cy:l[1],r:2.5,className:`fill-accent`})]})}function yg(e){return e>=.9?`critical`:e>=.85?`warn`:`normal`}function bg(e){let t=[`${de(e.tokens)} tokens`];return e.tokenLimit&&(t[0]+=` of ${de(e.tokenLimit)}`),t.push(`${de(e.requests)} requests${e.requestLimit?` of ${de(e.requestLimit)}`:``}`),t.join(` · `)}function xg({usage:e,label:t,compact:n,className:r}){let i=!!(e&&(e.tokenLimit||e.requestLimit)),o=e?.utilization??0,s=yg(o),c=s===`critical`?`bg-err`:s===`warn`?`bg-warn`:`bg-meter`,l=i?`${we(o)} of the ${t} window`:`No ${t} limit`;return(0,H.jsxs)(`div`,{className:a(`flex min-w-0 items-center gap-2`,r),title:e?bg(e):void 0,children:[!n&&(0,H.jsx)(`span`,{className:`w-7 shrink-0 font-mono text-2xs text-muted`,children:t}),(0,H.jsxs)(`div`,{role:`meter`,"aria-label":`${t} quota`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":i?Math.round(Math.min(o,1)*100):0,"aria-valuetext":l,className:`relative h-1.5 min-w-10 flex-1 rounded-full bg-track`,children:[i&&(0,H.jsx)(`div`,{className:a(`absolute inset-y-0 left-0 rounded-full transition-[width] duration-500 ease-snappy`,c),style:{width:`${Math.min(100,o*100)}%`}}),i&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:`absolute -top-0.5 -bottom-0.5 w-px bg-warn/70`,style:{left:`85%`}}),(0,H.jsx)(`span`,{"aria-hidden":!0,className:`absolute -top-0.5 -bottom-0.5 w-px bg-err/80`,style:{left:`90%`}})]})]}),(0,H.jsx)(`span`,{className:a(`tnum w-9 shrink-0 text-right font-mono text-2xs`,i?s===`critical`?`text-err`:s===`warn`?`text-warn`:`text-fg-2`:`text-faint`),children:i?we(o):`—`})]})}function Sg({className:e}){return(0,H.jsxs)(`div`,{className:a(`flex flex-wrap items-center gap-x-4 gap-y-1 text-2xs text-muted`,e),children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:`h-2.5 w-px bg-warn`}),`85% backpressure`]}),(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:`h-2.5 w-px bg-err`}),`90% traffic shift`]})]})}var Cg=[`bg-s1`,`bg-s2`,`bg-s3`,`bg-s4`,`bg-s5`],wg=`bg-faint`;function Tg({items:e,unit:t,className:n}){let r=e.filter(e=>e.slot<Cg.length),i=e.filter(e=>e.slot>=Cg.length),o=[...r.map(e=>({...e,color:Cg[e.slot]??wg})),...i.length?[{id:`other`,label:`Other`,value:i.reduce((e,t)=>e+t.value,0),slot:99,color:wg}]:[]],s=o.reduce((e,t)=>e+t.value,0);return(0,H.jsxs)(`div`,{className:a(`flex flex-col gap-3`,n),children:[(0,H.jsx)(`div`,{className:`flex h-2.5 w-full gap-[2px] overflow-hidden rounded-[3px]`,"aria-hidden":!0,children:s===0?(0,H.jsx)(`div`,{className:`h-full flex-1 bg-track`}):o.filter(e=>e.value>0).map(e=>(0,H.jsx)(`div`,{title:`${e.label}: ${de(e.value)} ${t} (${we(e.value/s)})`,className:a(`h-full transition-[flex-grow] duration-500 ease-snappy first:rounded-l-[3px] last:rounded-r-[3px]`,e.color),style:{flexGrow:e.value,flexBasis:0}},e.id))}),(0,H.jsxs)(`table`,{className:`w-full text-[12px]`,children:[(0,H.jsxs)(`caption`,{className:`sr-only`,children:[`Share of `,t,` by account`]}),(0,H.jsx)(`thead`,{className:`sr-only`,children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{scope:`col`,children:`Account`}),(0,H.jsx)(`th`,{scope:`col`,children:t}),(0,H.jsx)(`th`,{scope:`col`,children:`Share`})]})}),(0,H.jsx)(`tbody`,{children:o.map(e=>(0,H.jsxs)(`tr`,{className:`border-b border-line last:border-b-0`,children:[(0,H.jsx)(`td`,{className:`py-1.5`,children:(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:a(`size-2 shrink-0 rounded-[2px]`,e.color)}),(0,H.jsx)(`span`,{className:`truncate text-fg-2`,children:e.label})]})}),(0,H.jsx)(`td`,{className:`tnum py-1.5 text-right font-mono text-fg`,children:de(e.value)}),(0,H.jsx)(`td`,{className:`tnum w-14 py-1.5 text-right font-mono text-muted`,children:s?we(e.value/s):`—`})]},e.id))})]})]})}function Eg({className:e,...t}){return(0,H.jsx)(`section`,{className:a(`flex min-w-0 flex-col rounded-lg border border-line bg-panel`,e),...t})}function Dg({title:e,id:t,meta:n,actions:r,className:i}){return(0,H.jsxs)(`header`,{className:a(`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,H.jsx)(`h2`,{id:t,className:`text-[13px] font-medium text-fg`,children:e}),n&&(0,H.jsx)(`div`,{className:`text-[12px] text-muted`,children:n}),r&&(0,H.jsx)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:r})]})}function Og({title:e,description:t,actions:n}){return(0,H.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-6 gap-y-3 pb-4`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h1`,{className:`text-[17px] font-semibold tracking-tight text-fg`,children:e}),t&&(0,H.jsx)(`p`,{className:`mt-0.5 text-[13px] text-muted`,children:t})]}),n&&(0,H.jsx)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:n})]})}function kg({value:e,onChange:t,options:n,label:r,size:i=`md`,className:o}){let s=(0,V.useId)();return(0,H.jsxs)(`fieldset`,{className:a(`inline-flex w-fit items-center gap-0.5 rounded-md border border-line bg-bg p-0.5`,o),children:[(0,H.jsx)(`legend`,{className:`sr-only`,children:r}),n.map(n=>{let r=n.value===e,o=n.icon;return(0,H.jsxs)(`label`,{className:a(`relative inline-flex cursor-pointer items-center gap-1.5 rounded-[5px] font-medium whitespace-nowrap transition-colors duration-150 ease-snappy`,`has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-1 has-[:focus-visible]:outline-accent`,i===`sm`?`h-6 px-2 text-[12px]`:`h-7 px-2.5 text-[12px]`,r?`bg-active text-fg shadow-[inset_0_0_0_1px_var(--dc-line-strong)]`:`text-muted hover:text-fg`),children:[(0,H.jsx)(`input`,{type:`radio`,name:s,value:n.value,checked:r,onChange:()=>t(n.value),className:`sr-only`}),o&&(0,H.jsx)(o,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:1.75}),n.label,n.count!==void 0&&(0,H.jsx)(`span`,{className:a(`tnum font-mono text-2xs`,r?`text-fg-2`:`text-faint`),children:n.count})]},n.value)})]})}function Ag(e,t,n,r=60){let i=Math.floor(n/6e4)*6e4,a=i-(r-1)*6e4,o=new Map;for(let e=a;e<=i;e+=6e4)o.set(e,{ts:e,tokens:0,requests:0});for(let t of e??[]){let e=Math.floor(t.ts/6e4)*6e4,n=o.get(e);n&&(n.tokens=Math.max(n.tokens,t.tokens),n.requests=Math.max(n.requests,t.requests))}for(let e of t){let t=o.get(e.ts);t&&(t.tokens=Math.max(t.tokens,e.tokens),t.requests=Math.max(t.requests,e.requests))}return[...o.values()]}function jg(e,t){let n=e.slice(0,-1).slice(-t);return n.length===0?0:n.reduce((e,t)=>e+t,0)/n.length}function Mg(e){return new Map((e??[]).map((e,t)=>[e.id,t]))}function Ng(){let e=u(),t=ve(),n=ee(),r=b(60,60),i=re(),a=Th(5e3),[o,s]=(0,V.useState)(`chart`),c=(0,V.useMemo)(()=>Ag(r.data,i.minutes,a),[r.data,i.minutes,a]),l=c.map(e=>e.tokens),d=c.map(e=>e.requests),f=jg(l,5),p=jg(l.slice(0,-5),15),m=jg(d,5),h=d.reduce((e,t)=>e+t,0),g=i.failoverTs.filter(e=>e>=a-36e5).length,_=(0,V.useMemo)(()=>new Map((t.data??[]).map(e=>[e.id,e])),[t.data]),v=(0,V.useMemo)(()=>new Map((n.data??[]).map(e=>[e.accountId,e])),[n.data]),y=(0,V.useMemo)(()=>{let e=[],t=new Set;for(let n=i.events.length-1;n>=0&&e.length<40;n--){let r=i.events[n];if(!r)continue;let a=lg(r,_);a&&!t.has(a.key)&&(t.add(a.key),e.push(a))}return e},[i.events,_]),x=(0,V.useMemo)(()=>{let e=Mg(t.data),n=new Map;for(let e of r.data??[])for(let[t,r]of Object.entries(e.byAccount))n.set(t,(n.get(t)??0)+r.tokens);return(t.data??[]).filter(e=>e.enabled||(n.get(e.id)??0)>0).map(t=>({id:t.id,label:t.label,value:n.get(t.id)??0,slot:e.get(t.id)??99}))},[t.data,r.data]),te=t.data?.filter(e=>e.status===`active`).length??0,ne=t.data?.filter(e=>e.status===`cooldown`).length??0,S=(t.data??[]).filter(e=>e.enabled),ie=r.isPending&&i.minutes.length===0,ae=p>0?f/p-1:0;return(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsx)(Og,{title:`Overview`,description:`Gateway health, token burn and quota pressure across every account.`}),(0,H.jsxs)(Eg,{"aria-label":`Key metrics`,className:`grid grid-cols-2 lg:grid-cols-4`,children:[(0,H.jsx)(Pg,{label:`Token burn`,hint:`tokens / min · 5 min avg`,loading:ie,value:de(f),trend:(0,H.jsx)(vg,{values:l.slice(-30)}),delta:p>0?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-muted`,children:[ae>=0?(0,H.jsx)(Ke,{"aria-hidden":!0,className:`size-3`,strokeWidth:2}):(0,H.jsx)(Be,{"aria-hidden":!0,className:`size-3`,strokeWidth:2}),(0,H.jsx)(`span`,{className:`tnum`,children:we(Math.abs(ae))}),(0,H.jsx)(`span`,{className:`sr-only`,children:ae>=0?`up`:`down`}),` vs prior 15 min`]}):null}),(0,H.jsx)(Pg,{label:`Requests`,hint:`per min · 5 min avg`,loading:ie,value:m.toFixed(1),trend:(0,H.jsx)(vg,{values:d.slice(-30)}),delta:(0,H.jsxs)(`span`,{className:`text-muted`,children:[(0,H.jsx)(`span`,{className:`tnum text-fg-2`,children:se(h)}),` in the last hour`]}),className:`border-l border-line`}),(0,H.jsx)(Pg,{label:`Failovers`,hint:`last hour`,loading:ie,value:se(g),delta:(0,H.jsxs)(`span`,{className:`text-muted`,children:[(0,H.jsx)(`span`,{className:`tnum text-fg-2`,children:h?we(g/h,1):`0%`}),` `,`of requests rerouted`]}),className:`border-t border-line lg:border-t-0 lg:border-l`}),(0,H.jsx)(Pg,{label:`System`,hint:e.data?`v${e.data.version}`:`gateway`,loading:e.isPending,value:e.isError?(0,H.jsx)(`span`,{className:`text-err`,children:`Down`}):(0,H.jsx)(`span`,{className:`inline-flex items-center gap-2`,children:e.data?.status===`ok`?`Healthy`:e.data?.status??`—`}),delta:(0,H.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-muted`,children:[e.data&&(0,H.jsxs)(`span`,{children:[`up `,_e(e.data.uptimeSec)]}),(0,H.jsx)(`span`,{"aria-hidden":!0,className:`text-faint`,children:`·`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`span`,{className:`tnum text-fg-2`,children:te}),` active`,ne>0&&(0,H.jsxs)(H.Fragment,{children:[`, `,(0,H.jsx)(`span`,{className:`tnum text-warn`,children:ne}),` cooling`]})]})]}),className:`border-t border-l border-line lg:border-t-0`})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-12 gap-4`,children:[(0,H.jsxs)(Eg,{className:`col-span-12 xl:col-span-8`,"aria-labelledby":`burn-title`,children:[(0,H.jsx)(Dg,{id:`burn-title`,title:`Token burn`,meta:`tokens per minute · last 60 min · live tail`,actions:(0,H.jsx)(kg,{size:`sm`,label:`Token burn view`,value:o,onChange:s,options:[{value:`chart`,label:`Chart`,icon:Qe},{value:`table`,label:`Table`,icon:nn}]})}),(0,H.jsx)(`div`,{className:`px-3.5 pt-3 pb-2`,children:ie?(0,H.jsx)(ng,{className:`h-[240px] w-full`}):o===`chart`?(0,H.jsx)(_g,{height:240,label:`Token burn, tokens per minute over the last 60 minutes`,unit:`tokens/min`,secondaryLabel:`requests`,liveTail:!0,points:c.map(e=>({ts:e.ts,value:e.tokens,secondary:e.requests}))}):(0,H.jsx)(`div`,{className:`h-[240px] overflow-y-auto rounded-md border border-line`,children:(0,H.jsxs)(`table`,{className:`w-full text-[12px]`,children:[(0,H.jsx)(`caption`,{className:`sr-only`,children:`Tokens and requests per minute`}),(0,H.jsx)(`thead`,{className:`sticky top-0 bg-raised text-left text-muted`,children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 font-medium`,children:`Minute`}),(0,H.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-right font-medium`,children:`Tokens`}),(0,H.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-right font-medium`,children:`Requests`})]})}),(0,H.jsx)(`tbody`,{children:[...c].reverse().map((e,t)=>(0,H.jsxs)(`tr`,{className:`border-t border-line`,children:[(0,H.jsxs)(`td`,{className:`tnum px-3 py-1 font-mono text-fg-2`,children:[xe(e.ts),t===0&&(0,H.jsx)(`span`,{className:`ml-2 text-muted`,children:`in progress`})]}),(0,H.jsx)(`td`,{className:`tnum px-3 py-1 text-right font-mono text-fg`,children:se(e.tokens)}),(0,H.jsx)(`td`,{className:`tnum px-3 py-1 text-right font-mono text-fg-2`,children:e.requests})]},e.ts))})]})})})]}),(0,H.jsxs)(Eg,{className:`col-span-12 h-[320px] xl:col-span-4 xl:h-auto`,"aria-labelledby":`activity-title`,children:[(0,H.jsx)(Dg,{id:`activity-title`,title:`Recent activity`,meta:`failovers · cooldowns · runner`,actions:(0,H.jsx)(vu,{to:`/traffic`,className:`text-[12px] text-muted hover:text-fg`,children:`Traffic →`})}),(0,H.jsx)(`div`,{className:`relative min-h-0 flex-1`,children:(0,H.jsx)(`div`,{className:`absolute inset-0 overflow-y-auto`,children:(0,H.jsx)(ug,{items:y})})})]}),(0,H.jsxs)(Eg,{className:`col-span-12 xl:col-span-8`,"aria-labelledby":`quota-title`,children:[(0,H.jsx)(Dg,{id:`quota-title`,title:`Quota utilization`,meta:`sliding windows per account`,actions:(0,H.jsx)(Sg,{})}),t.isPending||n.isPending?(0,H.jsx)(rg,{rows:4}):S.length===0?(0,H.jsx)(og,{icon:mn,title:`No accounts yet`,description:`Add a provider account to start routing traffic through the gateway.`,command:`davecode add-account`}):(0,H.jsx)(`div`,{className:`overflow-x-auto`,children:(0,H.jsxs)(`table`,{className:`w-full min-w-[640px] text-[12px]`,children:[(0,H.jsx)(`caption`,{className:`sr-only`,children:`Quota utilization per account and window`}),(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{className:`border-b border-line text-left text-muted`,children:[(0,H.jsx)(`th`,{scope:`col`,className:`w-[30%] px-3.5 py-2 font-medium`,children:`Account`}),(0,H.jsx)(`th`,{scope:`col`,className:`w-[19%] px-2 py-2 font-medium`,children:`1 min`}),(0,H.jsx)(`th`,{scope:`col`,className:`w-[19%] px-2 py-2 font-medium`,children:`5 h`}),(0,H.jsx)(`th`,{scope:`col`,className:`w-[19%] px-2 py-2 font-medium`,children:`24 h`}),(0,H.jsx)(`th`,{scope:`col`,className:`px-3.5 py-2 text-right font-medium`,children:`Status`})]})}),(0,H.jsx)(`tbody`,{children:S.map(e=>{let t=v.get(e.id);return(0,H.jsxs)(`tr`,{className:`border-b border-line last:border-b-0 hover:bg-hover/50`,children:[(0,H.jsx)(`td`,{className:`max-w-0 px-3.5 py-2.5`,children:(0,H.jsx)(Ph,{account:e})}),(0,H.jsx)(`td`,{className:`px-2 py-2.5`,children:(0,H.jsx)(xg,{compact:!0,label:`1m`,usage:t?.windows[`1m`]})}),(0,H.jsx)(`td`,{className:`px-2 py-2.5`,children:(0,H.jsx)(xg,{compact:!0,label:`5h`,usage:t?.windows[`5h`]})}),(0,H.jsx)(`td`,{className:`px-2 py-2.5`,children:(0,H.jsx)(xg,{compact:!0,label:`24h`,usage:t?.windows[`24h`]})}),(0,H.jsx)(`td`,{className:`px-3.5 py-2.5 text-right`,children:(0,H.jsx)(kh,{account:e})})]},e.id)})})]})})]}),(0,H.jsxs)(Eg,{className:`col-span-12 xl:col-span-4`,"aria-labelledby":`share-title`,children:[(0,H.jsx)(Dg,{id:`share-title`,title:`Traffic share`,meta:`tokens by account · 60 min`}),(0,H.jsx)(`div`,{className:`p-3.5`,children:r.isPending||t.isPending?(0,H.jsx)(rg,{rows:3}):(0,H.jsx)(Tg,{items:x,unit:`tokens`})})]})]})]})}function Pg({label:e,hint:t,value:n,delta:r,trend:i,loading:o,className:s}){return(0,H.jsxs)(`div`,{className:a(`flex min-w-0 flex-col gap-1.5 px-4 py-3.5`,s),children:[(0,H.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,H.jsx)(`h2`,{className:`text-[12px] font-medium text-fg-2`,children:e}),(0,H.jsx)(`span`,{className:`truncate text-2xs text-muted`,children:t})]}),o?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ng,{className:`h-7 w-24`}),(0,H.jsx)(ng,{className:`h-3 w-32`})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex items-end justify-between gap-3`,children:[(0,H.jsx)(`p`,{className:`text-[26px] leading-8 font-semibold tracking-tight text-fg`,children:n}),i&&(0,H.jsx)(`div`,{className:`hidden pb-1 sm:block`,children:i})]}),r&&(0,H.jsx)(`div`,{className:`truncate text-[12px]`,children:r})]})]})}var Fg=`modulepreload`,Ig=function(e,t){return new URL(e,t).href},Lg={},Rg=function(e){return e.pathname.endsWith(`.css`)},zg=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},Bg=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Ig(t,n);let r=s(t),i=Rg(r);return zg(Lg,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Fg,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Vg=(0,V.lazy)(()=>Bg(()=>import(`./Panes-DxFSwhb7.js`).then(e=>({default:e.Panes})),__vite__mapDeps([0,1,2]),import.meta.url));function Hg({active:e}){let[t,n]=(0,V.useState)(e);if((0,V.useEffect)(()=>{e&&n(!0)},[e]),!t)return null;let r=ig();return(0,H.jsx)(`div`,{className:a(`fixed inset-0 z-20 bg-black text-zinc-100`,!e&&`hidden`),children:r?(0,H.jsx)(V.Suspense,{fallback:null,children:(0,H.jsx)(Vg,{bridge:r,active:e})}):(0,H.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 px-4 text-center`,children:[(0,H.jsx)(Tu,{className:`size-10`}),(0,H.jsx)(`p`,{className:`font-mono text-sm`,children:`Terminal panes run in the DaveCode desktop app.`}),(0,H.jsx)(vu,{to:`/`,className:`font-mono text-xs text-zinc-400 underline`,children:`Back to the workspace`})]})})}var Ug={library:(0,V.lazy)(()=>Bg(()=>import(`./Library-DwpBYTbK.js`).then(e=>({default:e.Library})),__vite__mapDeps([3,1,4]),import.meta.url)),workspace:(0,V.lazy)(()=>Bg(()=>import(`./Workspace-9UCw9q7C.js`).then(e=>({default:e.Workspace})),__vite__mapDeps([5,1,6,7,8,9,10,11,4]),import.meta.url)),overview:Ng,accounts:(0,V.lazy)(()=>Bg(()=>import(`./Accounts-DciFUg4y.js`).then(e=>({default:e.Accounts})),__vite__mapDeps([12,1,6,11,13,4,9,14]),import.meta.url)),traffic:(0,V.lazy)(()=>Bg(()=>import(`./Traffic-Dcz-WhsP.js`).then(e=>({default:e.Traffic})),__vite__mapDeps([15,1,6,4]),import.meta.url)),routes:(0,V.lazy)(()=>Bg(()=>import(`./RoutesPage-Cyo0MNd7.js`).then(e=>({default:e.RoutesPage})),__vite__mapDeps([16,1,6,7,9,17,14,4]),import.meta.url)),tasks:(0,V.lazy)(()=>Bg(()=>import(`./Tasks-DEfPSaE6.js`).then(e=>({default:e.Tasks})),__vite__mapDeps([18,1,6,8,9,17,14,4]),import.meta.url)),runner:(0,V.lazy)(()=>Bg(()=>import(`./Runner-CIL7RxpN.js`).then(e=>({default:e.Runner})),__vite__mapDeps([19,1,6,9]),import.meta.url)),goals:(0,V.lazy)(()=>Bg(()=>import(`./Goals-C6HL1PNE.js`).then(e=>({default:e.Goals})),__vite__mapDeps([10,1,6,11,8,9,4]),import.meta.url)),settings:(0,V.lazy)(()=>Bg(()=>import(`./Settings-B_PEB585.js`).then(e=>({default:e.Settings})),__vite__mapDeps([20,1,6,13,4,9]),import.meta.url))};function Wg(){return(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,role:`status`,"aria-label":`Loading page`,children:[(0,H.jsx)(ng,{className:`h-6 w-40`}),(0,H.jsx)(ng,{className:`h-4 w-80`}),(0,H.jsx)(ng,{className:`mt-4 h-64 w-full rounded-lg`})]})}function Gg(){let e=Ee(),{path:t}=hu(),n=Su(t),r=wh(xh),{sidebarOverlay:i}=Ch(),a=r&&i,o=r?!i:e.sidebarCollapsed,s=(0,V.useRef)(null),c=u();Gh(),(0,V.useEffect)(()=>he(e.theme),[e.theme]),(0,V.useEffect)(()=>{ig()&&t===`/`&&gu(`/terminal`,{replace:!0})},[]),(0,V.useEffect)(()=>{bh.setSidebarOverlay(!1),s.current?.focus({preventScroll:!0}),window.scrollTo({top:0}),document.title=n?`${n.label} · DaveCode`:`DaveCode`},[t]);let l=(0,H.jsx)(Hg,{active:n?.id===`terminal`});return n?.id===`terminal`?(0,H.jsxs)(H.Fragment,{children:[l,(0,H.jsx)(Ih,{}),(0,H.jsx)(Xh,{}),(0,H.jsx)($h,{})]}):n?.id===`workspace`||n?.id===`library`?(0,H.jsxs)(H.Fragment,{children:[l,(0,H.jsx)(tg,{mainRef:s,children:(0,H.jsx)(Kg,{id:n.id})}),(0,H.jsx)(Ih,{}),(0,H.jsx)(Xh,{}),(0,H.jsx)($h,{})]}):(0,H.jsxs)(`div`,{className:`flex min-h-dvh`,children:[l,(0,H.jsx)(`button`,{type:`button`,onClick:()=>s.current?.focus(),className:`sr-only z-50 rounded-md bg-accent px-3 py-2 text-accent-fg focus:not-sr-only focus:fixed focus:top-2 focus:left-2`,children:`Skip to content`}),(0,H.jsx)(Eu,{activeId:n?.id,collapsed:o,overlay:a,version:c.data?.version,onToggle:()=>Sh(()=>Te({sidebarCollapsed:!e.sidebarCollapsed}))}),a&&(0,H.jsx)(`button`,{type:`button`,"aria-label":`Close sidebar`,onClick:()=>bh.setSidebarOverlay(!1),className:`fixed inset-0 z-30 bg-scrim animate-fade-in`}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,H.jsx)(eg,{title:n?.label??`Not found`,status:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Vh,{}),(0,H.jsx)(Iu,{})]}),onOpenPalette:bh.openPalette,onOpenHelp:bh.openHelp}),(0,H.jsx)(`main`,{id:`main`,ref:s,tabIndex:-1,className:`mx-auto w-full max-w-[1600px] flex-1 px-4 py-5 outline-none md:px-6`,children:n?(0,H.jsx)(Kg,{id:n.id}):(0,H.jsx)(sg,{})})]}),(0,H.jsx)(Ih,{}),(0,H.jsx)(Xh,{}),(0,H.jsx)($h,{})]})}function Kg({id:e}){let t=Ug[e];return(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(Wg,{}),children:(0,H.jsx)(t,{})})}var qg=new T({defaultOptions:{queries:{staleTime:1e4,refetchOnWindowFocus:!1,retry:(e,t)=>ye(t)&&t.status>=400&&t.status<500?!1:e<2}}}),Jg=document.getElementById(`root`);if(!Jg)throw Error(`#root element missing from index.html`);(0,du.createRoot)(Jg).render((0,H.jsx)(V.StrictMode,{children:(0,H.jsx)(p,{client:qg,children:(0,H.jsx)(Fu,{children:(0,H.jsx)(De,{children:(0,H.jsx)(Gg,{})})})})}));export{vn as A,Rt as B,hh as C,gu as D,vu as E,Qt as F,vt as G,At as H,Kt as I,Xe as J,nt as K,Wt as L,cn as M,an as N,_u as O,en as P,Ht as R,bh as S,Tu as T,St as U,It as V,bt as W,Ke as X,Je as Y,Re as Z,Dh as _,Sg as a,Nh as b,ag as c,Jh as d,qh as f,kh as g,Oh as h,Dg as i,mn as j,hu as k,ng as l,zh as m,Og as n,xg as o,Bh as p,et as q,Eg as r,og as s,kg as t,rg as u,jh as v,ju as w,Th as x,Mh as y,Bt as z};
@@ -1 +1 @@
1
- import{n as e}from"./cn-BwE4cei0.js";import{ft as t,pt as n}from"./Badge-Z4RBdO9j.js";var r={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};r.node;var i=e(r);function a(e){if(!n(e))return t(e);switch(e.code){case`brain_read_only`:return`This gateway exposes the project brain read-only, so the task graph cannot be edited here.`;case`no_brain`:return`No project is loaded. Start the gateway inside an initialised project (davecode init).`;case`cycle`:return e.cycle?`That would create a dependency cycle: ${e.cycle.join(` → `)}.`:e.message;case`has_dependents`:return e.dependents?.length?`Other tasks still depend on it: ${e.dependents.join(`, `)}. Remove those dependencies first.`:e.message;case`task_in_progress`:return`The task is in progress. Reopen it before deleting it.`;case`duplicate_id`:return`A task with this id already exists.`;case`invalid_transition`:return`The task cannot move to that status from its current one. ${e.message}`;case`config_invalid`:return`The global config file is not valid, so it was left untouched. ${e.message}`;default:return t(e)}}export{i as n,a as t};
1
+ import{n as e}from"./cn-BwE4cei0.js";import{ft as t,pt as n}from"./Badge-DUGKlx3Z.js";var r={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};r.node;var i=e(r);function a(e){if(!n(e))return t(e);switch(e.code){case`brain_read_only`:return`This gateway exposes the project brain read-only, so the task graph cannot be edited here.`;case`no_brain`:return`No project is loaded. Start the gateway inside an initialised project (davecode init).`;case`cycle`:return e.cycle?`That would create a dependency cycle: ${e.cycle.join(` → `)}.`:e.message;case`has_dependents`:return e.dependents?.length?`Other tasks still depend on it: ${e.dependents.join(`, `)}. Remove those dependencies first.`:e.message;case`task_in_progress`:return`The task is in progress. Reopen it before deleting it.`;case`duplicate_id`:return`A task with this id already exists.`;case`invalid_transition`:return`The task cannot move to that status from its current one. ${e.message}`;case`config_invalid`:return`The global config file is not valid, so it was left untouched. ${e.message}`;default:return t(e)}}export{i as n,a as t};
@@ -20,9 +20,9 @@
20
20
  document.documentElement.dataset.theme = storedTheme;
21
21
  }
22
22
  </script>
23
- <script type="module" crossorigin src="./assets/index-BDBa5cb0.js"></script>
23
+ <script type="module" crossorigin src="./assets/index-CpztPbom.js"></script>
24
24
  <link rel="modulepreload" crossorigin href="./assets/cn-BwE4cei0.js">
25
- <link rel="modulepreload" crossorigin href="./assets/Badge-Z4RBdO9j.js">
25
+ <link rel="modulepreload" crossorigin href="./assets/Badge-DUGKlx3Z.js">
26
26
  <link rel="stylesheet" crossorigin href="./assets/index-BEmBgsbP.css">
27
27
  </head>
28
28
  <body>