@davidbalzan/groundwork-console 0.1.4 → 0.1.5

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 (94) hide show
  1. package/package.json +1 -1
  2. package/public/assets/{abnfDiagram-N423BO3Z-DjcI5EtN.js → abnfDiagram-N423BO3Z-eACBdXEp.js} +1 -1
  3. package/public/assets/{arc-CLreMRTi.js → arc-C8zPWxct.js} +1 -1
  4. package/public/assets/architecture-TIHT7OUA-CtVIKkxG.js +1 -0
  5. package/public/assets/{architectureDiagram-T3A2C74G-GVsKASaE.js → architectureDiagram-T3A2C74G-BZqtGnsC.js} +1 -1
  6. package/public/assets/{blockDiagram-VBNYF7ZC-kUIhKmE4.js → blockDiagram-VBNYF7ZC-D265Ytun.js} +1 -1
  7. package/public/assets/{c4Diagram-5PPSVZJV-BQFI1po0.js → c4Diagram-5PPSVZJV-CodzUBEt.js} +1 -1
  8. package/public/assets/channel-CpTfWcC2.js +1 -0
  9. package/public/assets/{chunk-2GRJ4B5K-CAC9E6Lc.js → chunk-2GRJ4B5K-D59ECeXb.js} +1 -1
  10. package/public/assets/{chunk-4I5QYGJK-Do801ucH.js → chunk-4I5QYGJK-DlE6ad0r.js} +1 -1
  11. package/public/assets/{chunk-5RXB4S5H-DgGb8Ei0.js → chunk-5RXB4S5H-Bw4SBOdN.js} +1 -1
  12. package/public/assets/{chunk-6Q2QTUOP-N3v574-9.js → chunk-6Q2QTUOP-BD4S6iuB.js} +1 -1
  13. package/public/assets/{chunk-7Z6QIM7H-BGVpdvGU.js → chunk-7Z6QIM7H-DvwJZM4T.js} +1 -1
  14. package/public/assets/{chunk-GF5L2VYU-CyQ84gnX.js → chunk-GF5L2VYU-BlzSHpI6.js} +1 -1
  15. package/public/assets/{chunk-I66GZJ75-Bazokq-r.js → chunk-I66GZJ75-DJurmtZ9.js} +1 -1
  16. package/public/assets/{chunk-JQJVKLGR-BXG1sCkI.js → chunk-JQJVKLGR-t20LaGIq.js} +1 -1
  17. package/public/assets/{chunk-KBJHAD2P-Bi0agcVN.js → chunk-KBJHAD2P-Dgjyd4B5.js} +1 -1
  18. package/public/assets/{chunk-NSK5VX7P-CRNBZms6.js → chunk-NSK5VX7P-Chchkdi8.js} +1 -1
  19. package/public/assets/{chunk-QR6OTTB3-BVNnO0nC.js → chunk-QR6OTTB3-CJK67frw.js} +1 -1
  20. package/public/assets/{chunk-RYQCIY6F-BDA4j6A-.js → chunk-RYQCIY6F-sGSUyT6_.js} +1 -1
  21. package/public/assets/{chunk-UBXNYLIW-DGeBgwe-.js → chunk-UBXNYLIW-CEzUmAZt.js} +1 -1
  22. package/public/assets/{chunk-W5SLKNZC-xcy3l2eH.js → chunk-W5SLKNZC-Spmh0y1r.js} +1 -1
  23. package/public/assets/{chunk-WRU74C26-CIO3U59-.js → chunk-WRU74C26-DEsyhzZw.js} +1 -1
  24. package/public/assets/{chunk-XXDRQBXY-lsNR2odJ.js → chunk-XXDRQBXY-Bo1s3Uh5.js} +1 -1
  25. package/public/assets/classDiagram-JCYQIIEL-BSB0boKu.js +1 -0
  26. package/public/assets/classDiagram-v2-OCEON4UE-BSB0boKu.js +1 -0
  27. package/public/assets/{cose-bilkent-JH36ORCC-Dgq33rVP.js → cose-bilkent-JH36ORCC-15pcvj-n.js} +1 -1
  28. package/public/assets/{cynefin-VYW2F7L2-BHP3DZqn.js → cynefin-VYW2F7L2-BZxWqC-g.js} +1 -1
  29. package/public/assets/{cynefinDiagram-MW4NZA55-BmxpLFSH.js → cynefinDiagram-MW4NZA55-B_czkRTa.js} +1 -1
  30. package/public/assets/{dagre-VZM6K2ZE-3sD0lAzD.js → dagre-VZM6K2ZE-D8bvaK5F.js} +1 -1
  31. package/public/assets/{diagram-7IWD3JNH-CyaD0_jh.js → diagram-7IWD3JNH-_vpWqUu0.js} +1 -1
  32. package/public/assets/{diagram-B4RE2ZJO-td2N4qE1.js → diagram-B4RE2ZJO-DPfWeSE2.js} +1 -1
  33. package/public/assets/{diagram-LBJQPF4R-D_wWDJ4F.js → diagram-LBJQPF4R-Cb7ustRg.js} +1 -1
  34. package/public/assets/{diagram-Q27KOJAE-DKPs8Pt1.js → diagram-Q27KOJAE-CRIHo9aN.js} +1 -1
  35. package/public/assets/{diagram-UB23O5K3-DMH09z4H.js → diagram-UB23O5K3-CMyiQouk.js} +1 -1
  36. package/public/assets/{dist-BFMCu1a5.js → dist-DVdstvf6.js} +1 -1
  37. package/public/assets/{ebnfDiagram-BXEA7PRR-Cl2AEyY9.js → ebnfDiagram-BXEA7PRR-UURYMfYm.js} +1 -1
  38. package/public/assets/{erDiagram-JOGREHBK-CyAJ5sjB.js → erDiagram-JOGREHBK-Dio32huH.js} +1 -1
  39. package/public/assets/eventmodeling-45OFAUF4-DP5rNNNm.js +1 -0
  40. package/public/assets/flowDiagram-UKHOOZJN-DjrqEV81.js +1 -0
  41. package/public/assets/{ganttDiagram-PKOTCBZU-YM9FA8H8.js → ganttDiagram-PKOTCBZU-62etRb4w.js} +1 -1
  42. package/public/assets/{gitGraph-TEB2WS4Q-ws9TESN2.js → gitGraph-TEB2WS4Q-CfIUb3Fs.js} +1 -1
  43. package/public/assets/{gitGraphDiagram-DS77QQ5N-CZu8bXTF.js → gitGraphDiagram-DS77QQ5N-DuwZInBC.js} +1 -1
  44. package/public/assets/index-ZvSJKDLe.css +2 -0
  45. package/public/assets/{index-C84drWhX.js → index-iKIFRUDL.js} +4 -4
  46. package/public/assets/{info-DKCQHKI2-RSQw6txJ.js → info-DKCQHKI2-BfXJHEd1.js} +1 -1
  47. package/public/assets/{infoDiagram-6WML65LV-Bxmxzous.js → infoDiagram-6WML65LV-Bmh_7gih.js} +1 -1
  48. package/public/assets/{ishikawaDiagram-WSZJBQD7-C80fxFdg.js → ishikawaDiagram-WSZJBQD7-i8-L2rAe.js} +1 -1
  49. package/public/assets/{journeyDiagram-NVQOT4AX-DQTG0OdM.js → journeyDiagram-NVQOT4AX-BtfEqljI.js} +1 -1
  50. package/public/assets/{kanban-definition-27J2QSJJ-B5WxFLvF.js → kanban-definition-27J2QSJJ-pH6QumbR.js} +1 -1
  51. package/public/assets/{line-D-jeoEtL.js → line-DsGf4Aam.js} +1 -1
  52. package/public/assets/{linear-7oKWtFDc.js → linear-BNSu_43k.js} +1 -1
  53. package/public/assets/{mermaid-parser.core-DG-hDTtF.js → mermaid-parser.core-679COn57.js} +3 -3
  54. package/public/assets/{mermaid.core-CxtgV-Z8.js → mermaid.core-D_f4AlrR.js} +4 -4
  55. package/public/assets/{mindmap-definition-FAOFIHXS-DyT9O-XZ.js → mindmap-definition-FAOFIHXS-D1tM4SRn.js} +1 -1
  56. package/public/assets/{packet-7NZHBO7P-fYfZRQ_r.js → packet-7NZHBO7P-olELdMgx.js} +1 -1
  57. package/public/assets/{pegDiagram-VL7TDLO6-BIKwmoZk.js → pegDiagram-VL7TDLO6-DgAndH0A.js} +1 -1
  58. package/public/assets/{pie-RZYD4A2V-hHye9M3B.js → pie-RZYD4A2V-DWj8tY38.js} +1 -1
  59. package/public/assets/{pieDiagram-7S7Q4E2Y-B9IF9fZk.js → pieDiagram-7S7Q4E2Y-DK7c2EvE.js} +1 -1
  60. package/public/assets/{quadrantDiagram-CIZ2JOQS-CriT2z0D.js → quadrantDiagram-CIZ2JOQS-DI-ZbPxK.js} +1 -1
  61. package/public/assets/{radar-I7S5WNFK-UHbLAuY0.js → radar-I7S5WNFK-DLsdeAbl.js} +1 -1
  62. package/public/assets/{railroad-3IZDKUUU-3enNyn3l.js → railroad-3IZDKUUU-BFUnqJxV.js} +1 -1
  63. package/public/assets/railroad-abnf-AHOZXSZD-B00TU1b8.js +1 -0
  64. package/public/assets/railroad-ebnf-EBAXGLYW-RrXgWJqj.js +1 -0
  65. package/public/assets/railroad-peg-LSFZ7HO6-CsiNSgst.js +1 -0
  66. package/public/assets/{railroadDiagram-AXF67PYL-Bkr9TUm0.js → railroadDiagram-AXF67PYL-BcCf-qnq.js} +1 -1
  67. package/public/assets/{requirementDiagram-LRYGKXZP-CEp-ppYZ.js → requirementDiagram-LRYGKXZP-CSERzrsB.js} +1 -1
  68. package/public/assets/{sankeyDiagram-W5VNT64P-CU-4IBMj.js → sankeyDiagram-W5VNT64P-BTHdyTAB.js} +1 -1
  69. package/public/assets/{sequenceDiagram-SI44F4Z6-Asi631mZ.js → sequenceDiagram-SI44F4Z6-DCMbcZQ-.js} +1 -1
  70. package/public/assets/{src-CJc45UuW.js → src-CWXJqyrc.js} +1 -1
  71. package/public/assets/{stateDiagram-OKZ733FA-DkDphzLX.js → stateDiagram-OKZ733FA-BhzI_RZ_.js} +1 -1
  72. package/public/assets/stateDiagram-v2-UEYNNEHI-DKG0b0eo.js +1 -0
  73. package/public/assets/{swimlanes-SLNWSIFB-BVnRBmZ_.js → swimlanes-SLNWSIFB-DPKSeErn.js} +1 -1
  74. package/public/assets/swimlanesDiagram-ULZ7WXOC-D6CPDB9k.js +8 -0
  75. package/public/assets/{timeline-definition-Z64GVDOM-B3jYbkKD.js → timeline-definition-Z64GVDOM-BnLvIO3-.js} +1 -1
  76. package/public/assets/{treeView-QDETBFTQ-FZndVHM1.js → treeView-QDETBFTQ-BgFXBEUi.js} +1 -1
  77. package/public/assets/{treemap-6X3UGDF4-CKoOe0fa.js → treemap-6X3UGDF4-KzlTv1ih.js} +1 -1
  78. package/public/assets/{vennDiagram-T6HMQDX7-B7qlSH-y.js → vennDiagram-T6HMQDX7-gsHmzjh9.js} +1 -1
  79. package/public/assets/{wardley-OPB4EBWU-DlWXVdBE.js → wardley-OPB4EBWU-DyQkbq8g.js} +1 -1
  80. package/public/assets/{wardleyDiagram-T6FBY63Y-Dk0uBYWd.js → wardleyDiagram-T6FBY63Y-DqwaVwnv.js} +1 -1
  81. package/public/assets/{xychartDiagram-ELKLHX3M-BDrlWQ3J.js → xychartDiagram-ELKLHX3M-DGZxfApD.js} +1 -1
  82. package/public/index.html +2 -2
  83. package/public/assets/architecture-TIHT7OUA-BxHBbCM_.js +0 -1
  84. package/public/assets/channel-DiEdto8Z.js +0 -1
  85. package/public/assets/classDiagram-JCYQIIEL-DQfOF2lx.js +0 -1
  86. package/public/assets/classDiagram-v2-OCEON4UE-DQfOF2lx.js +0 -1
  87. package/public/assets/eventmodeling-45OFAUF4-CA3qsYNk.js +0 -1
  88. package/public/assets/flowDiagram-UKHOOZJN-BmCE-89P.js +0 -1
  89. package/public/assets/index-C3zhnM_H.css +0 -2
  90. package/public/assets/railroad-abnf-AHOZXSZD-CxQOPSx1.js +0 -1
  91. package/public/assets/railroad-ebnf-EBAXGLYW-CQ4P6ont.js +0 -1
  92. package/public/assets/railroad-peg-LSFZ7HO6-sSkmKuAv.js +0 -1
  93. package/public/assets/stateDiagram-v2-UEYNNEHI-DUHdaHkv.js +0 -1
  94. package/public/assets/swimlanesDiagram-ULZ7WXOC-RkUs-XHd.js +0 -8
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-CxtgV-Z8.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-CJc45UuW.js","assets/chunk-I66GZJ75-Bazokq-r.js","assets/chunk-NSK5VX7P-CRNBZms6.js","assets/dist-BFMCu1a5.js","assets/chunk-4I5QYGJK-Do801ucH.js","assets/chunk-WRU74C26-CIO3U59-.js","assets/chunk-7BUUIJ7U-Bb538aSH.js","assets/chunk-UBXNYLIW-DGeBgwe-.js","assets/chunk-W5SLKNZC-xcy3l2eH.js","assets/chunk-QR6OTTB3-BVNnO0nC.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-7Z6QIM7H-BGVpdvGU.js","assets/line-D-jeoEtL.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-D_f4AlrR.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-CWXJqyrc.js","assets/chunk-I66GZJ75-DJurmtZ9.js","assets/chunk-NSK5VX7P-Chchkdi8.js","assets/dist-DVdstvf6.js","assets/chunk-4I5QYGJK-DlE6ad0r.js","assets/chunk-WRU74C26-DEsyhzZw.js","assets/chunk-7BUUIJ7U-Bb538aSH.js","assets/chunk-UBXNYLIW-CEzUmAZt.js","assets/chunk-W5SLKNZC-Spmh0y1r.js","assets/chunk-QR6OTTB3-CJK67frw.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-7Z6QIM7H-DvwJZM4T.js","assets/line-DsGf4Aam.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js"])))=>i.map(i=>d[i]);
2
2
  var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(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 u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),d=o(((e,t)=>{t.exports=u()})),f=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function ee(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function P(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var F=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},I={map:ee,forEach:function(e,t,n){ee(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ee(e,function(){t++}),t},toArray:function(e){return ee(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=I,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:P}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,F)}catch(e){F(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),p=o(((e,t)=>{t.exports=f()})),m=o((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,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){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&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(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`):w=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(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),h=o(((e,t)=>{t.exports=m()})),g=o((e=>{var t=p();function n(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 r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(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=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.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,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,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=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.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=c(n,t.crossOrigin);i.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=c(t.as,t.crossOrigin);i.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})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.8`})),_=o(((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=g()})),v=o((e=>{var t=h(),n=p(),r=_();function i(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 a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(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 c(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 l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,m=Symbol.for(`react.element`),g=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function ee(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?ee(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return ee(e(t))}catch{}}return null}var P=Array.isArray,F=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te={pending:!1,data:null,method:null,action:null},ne=[],re=-1;function L(e){return{current:e}}function R(e){0>re||(e.current=ne[re],ne[re]=null,re--)}function z(e,t){re++,ne[re]=e.current,e.current=t}var ie=L(null),ae=L(null),oe=L(null),se=L(null);function ce(e,t){switch(z(oe,t),z(ae,e),z(ie,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}R(ie),z(ie,e)}function le(){R(ie),R(ae),R(oe)}function ue(e){e.memoizedState!==null&&z(se,e);var t=ie.current,n=Hd(t,e.type);t!==n&&(z(ae,e),z(ie,n))}function de(e){ae.current===e&&(R(ie),R(ae)),se.current===e&&(R(se),Qf._currentValue=te)}var fe,pe;function me(e){if(fe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);fe=t&&t[1]||``,pe=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+fe+e+pe}var he=!1;function ge(e,t){if(!e||he)return``;he=!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}e.call(n.prototype)}}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(`
@@ -21,11 +21,11 @@ Error generating stack: `+e.message+`
21
21
  `),t=t.replace(Dc,`�`),e.src=t}function kc(e){let t;e.inlineMode?(t=new e.Token(`inline`,``,0),t.content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function Ac(e){let t=e.tokens,n=0;for(let e=0;e<t.length;e++)t[e].type!==`reference_definition`&&(e!==n&&(t[n]=t[e]),n++);t.length!==n&&(t.length=n)}function jc(e){let t=e.tokens;for(let n=0,r=t.length;n<r;n++){let r=t[n];r.type===`inline`&&e.md.inline.parse(r.content,e.md,e.env,r.children)}}function Mc(e){return/^<a[>\s]/i.test(e)}function Nc(e){return/^<\/a\s*>/i.test(e)}function Pc(e){let t=e.tokens;if(e.md.options.linkify)for(let n=0,r=t.length;n<r;n++){if(t[n].type!==`inline`||!e.md.linkify.test(t[n].content))continue;let r=t[n].children,i=0;for(let a=r.length-1;a>=0;a--){let o=r[a];if(o.type===`link_close`){for(a--;r[a].level!==o.level&&r[a].type!==`link_open`;)a--;continue}if(o.type===`html_inline`&&(Mc(o.content)&&i>0&&i--,Nc(o.content)&&i++),!(i>0)&&o.type===`text`&&e.md.linkify.test(o.content)){let i=o.content,s=e.md.linkify.match(i),c=[],l=o.level,u=0;s.length>0&&s[0].index===0&&a>0&&r[a-1].type===`text_special`&&(s=s.slice(1));for(let t=0;t<s.length;t++){let n=s[t].url,r=e.md.normalizeLink(n);if(!e.md.validateLink(r))continue;let a=s[t].text;a=s[t].schema?s[t].schema===`mailto:`&&!/^mailto:/i.test(a)?e.md.normalizeLinkText(`mailto:${a}`).replace(/^mailto:/,``):e.md.normalizeLinkText(a):e.md.normalizeLinkText(`http://${a}`).replace(/^http:\/\//,``);let o=s[t].index;if(o>u){let t=new e.Token(`text`,``,0);t.content=i.slice(u,o),t.level=l,c.push(t)}let d=new e.Token(`link_open`,`a`,1);d.attrs=[[`href`,r]],d.level=l++,d.markup=`linkify`,d.info=`auto`,c.push(d);let f=new e.Token(`text`,``,0);f.content=a,f.level=l,c.push(f);let p=new e.Token(`link_close`,`a`,-1);p.level=--l,p.markup=`linkify`,p.info=`auto`,c.push(p),u=s[t].lastIndex}if(u<i.length){let t=new e.Token(`text`,``,0);t.content=i.slice(u),t.level=l,c.push(t)}t[n].children=r=Us(r,a,c)}}}}var Fc=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,Ic=/\((c|tm|r)\)/i,Lc=/\((c|tm|r)\)/gi,Rc={c:`©`,r:`®`,tm:`™`};function zc(e,t){return Rc[t.toLowerCase()]}function Bc(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&(r.content=r.content.replace(Lc,zc)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function Vc(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&Fc.test(r.content)&&(r.content=r.content.replace(/\+-/g,`±`).replace(/\.{2,}/g,`…`).replace(/([?!])…/g,`$1..`).replace(/([?!]){4,}/g,`$1$1$1`).replace(/,{2,}/g,`,`).replace(/(^|[^-])---(?=[^-]|$)/gm,`$1—`).replace(/(^|\s)--(?=\s|$)/gm,`$1–`).replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,`$1–`)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function Hc(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type===`inline`&&(Ic.test(e.tokens[t].content)&&Bc(e.tokens[t].children),Fc.test(e.tokens[t].content)&&Vc(e.tokens[t].children))}var Uc=/['"]/,Wc=/['"]/g,Gc=`’`;function Kc(e,t,n,r){e[t]||(e[t]=[]),e[t].push({pos:n,ch:r})}function qc(e,t){let n=``,r=0;t.sort((e,t)=>e.pos-t.pos);for(let i=0;i<t.length;i++){let a=t[i];n+=e.slice(r,a.pos)+a.ch,r=a.pos+1}return n+e.slice(r)}function Jc(e,t){let n,r=[],i={};for(let a=0;a<e.length;a++){let o=e[a],s=e[a].level;for(n=r.length-1;n>=0&&!(r[n].level<=s);n--);if(r.length=n+1,o.type!==`text`)continue;let c=o.content,l=0,u=c.length;OUTER:for(;l<u;){Wc.lastIndex=l;let o=Wc.exec(c);if(!o)break;let d=!0,f=!0;l=o.index+1;let p=o[0]===`'`,m=32;if(o.index-1>=0)m=c.charCodeAt(o.index-1);else for(n=a-1;n>=0&&e[n].type!==`softbreak`&&e[n].type!==`hardbreak`;n--)if(e[n].content){m=e[n].content.charCodeAt(e[n].content.length-1);break}let h=32;if(l<u)h=c.charCodeAt(l);else for(n=a+1;n<e.length&&e[n].type!==`softbreak`&&e[n].type!==`hardbreak`;n++)if(e[n].content){h=e[n].content.charCodeAt(0);break}let g=lc(m)||cc(m),_=lc(h)||cc(h),v=oc(m),y=oc(h);if(y?d=!1:_&&(v||g||(d=!1)),v?f=!1:g&&(y||_||(f=!1)),h===34&&o[0]===`"`&&m>=48&&m<=57&&(f=d=!1),d&&f&&(d=g,f=_),!d&&!f){p&&Kc(i,a,o.index,Gc);continue}if(f)for(n=r.length-1;n>=0;n--){let e=r[n];if(r[n].level<s)break;if(e.single===p&&r[n].level===s){e=r[n];let s,c;p?(s=t.md.options.quotes[2],c=t.md.options.quotes[3]):(s=t.md.options.quotes[0],c=t.md.options.quotes[1]),Kc(i,a,o.index,c),Kc(i,e.token,e.pos,s),r.length=n;continue OUTER}}d?r.push({token:a,pos:o.index,single:p,level:s}):f&&p&&Kc(i,a,o.index,Gc)}}Object.keys(i).forEach(function(t){let n=Number(t);e[n].content=qc(e[n].content,i[t])})}function Yc(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)e.tokens[t].type!==`inline`||!Uc.test(e.tokens[t].content)||Jc(e.tokens[t].children,e)}function Xc(e){let t,n,r=e.length;for(t=0;t<r;t++)e[t].type===`text_special`&&(e[t].type=`text`);for(t=n=0;t<r;t++)e[t].type===`text`&&t+1<r&&e[t+1].type===`text`?e[t+1].content=e[t].content+e[t+1].content:(t!==n&&(e[n]=e[t]),n++);t!==n&&(e.length=n)}function Zc(e){let t,n,r=e.tokens,i=r.length;for(let e=0;e<i;e++){if(r[e].type!==`inline`)continue;let i=r[e].children,a=i.length;for(t=0;t<a;t++)i[t].type===`text_special`&&(i[t].type=`text`),i[t].children&&Xc(i[t].children);for(t=n=0;t<a;t++)i[t].type===`text`&&t+1<a&&i[t+1].type===`text`?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}}var Qc=[[`normalize`,Oc],[`block`,kc],[`strip_references`,Ac],[`inline`,jc],[`linkify`,Pc],[`replacements`,Hc],[`smartquotes`,Yc],[`text_join`,Zc]],$c=class{constructor(){Y(this,`ruler`,new Sc),Y(this,`State`,Tc);for(let e=0;e<Qc.length;e++)this.ruler.push(Qc[e][0],Qc[e][1])}process(e){let t=this.ruler.getRules(``);for(let n=0,r=t.length;n<r;n++)t[n](e)}},el=class{constructor(e,t,n,r){Y(this,`bMarks`,[]),Y(this,`eMarks`,[]),Y(this,`tShift`,[]),Y(this,`sCount`,[]),Y(this,`bsCount`,[]),Y(this,`blkIndent`,0),Y(this,`line`,0),Y(this,`lineMax`,0),Y(this,`tight`,!1),Y(this,`listIndent`,-1),Y(this,`parentType`,`root`),Y(this,`level`,0),Y(this,`Token`,xc),this.src=e,this.md=t,this.env=n,this.tokens=r;let i=this.src;for(let e=0,t=0,n=0,r=0,a=i.length,o=!1;t<a;t++){let s=i.charCodeAt(t);if(!o){if(ac(s)){n++,s===9?r+=4-r%4:r++;continue}o=!0}(s===10||t===a-1)&&(s!==10&&t++,this.bMarks.push(e),this.eMarks.push(t),this.tShift.push(n),this.sCount.push(r),this.bsCount.push(0),o=!1,n=0,r=0,e=t+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}push(e,t,n){let r=new xc(e,t,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r}isEmpty(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]}skipEmptyLines(e){for(let t=this.lineMax;e<t&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e}skipSpaces(e){for(let t=this.src.length;e<t&&ac(this.src.charCodeAt(e));e++);return e}skipSpacesBack(e,t){if(e<=t)return e;for(;e>t;)if(!ac(this.src.charCodeAt(--e)))return e+1;return e}skipChars(e,t){for(let n=this.src.length;e<n&&this.src.charCodeAt(e)===t;e++);return e}skipCharsBack(e,t,n){if(e<=n)return e;for(;e>n;)if(t!==this.src.charCodeAt(--e))return e+1;return e}getLines(e,t,n,r){if(e>=t)return``;let i=Array(t-e);for(let a=0,o=e;o<t;o++,a++){let e=0,s=this.bMarks[o],c=s,l;for(l=o+1<t||r?this.eMarks[o]+1:this.eMarks[o];c<l&&e<n;){let t=this.src.charCodeAt(c);if(ac(t))t===9?e+=4-(e+this.bsCount[o])%4:e++;else if(c-s<this.tShift[o])e++;else break;c++}e>n?i[a]=Array(e-n+1).join(` `)+this.src.slice(c,l):i[a]=this.src.slice(c,l)}return i.join(``)}},tl=65536;function nl(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];return e.src.slice(n,r)}function rl(e){let t=[],n=e.length,r=0,i=e.charCodeAt(r),a=!1,o=0,s=``;for(;r<n;)i===124&&(a?(s+=e.substring(o,r-1),o=r):(t.push(s+e.substring(o,r)),s=``,o=r+1)),a=i===92,r++,i=e.charCodeAt(r);return t.push(s+e.substring(o)),t}function il(e,t,n,r){if(t+2>n)return!1;let i=t+1;if(e.sCount[i]<e.blkIndent||e.sCount[i]-e.blkIndent>=4)return!1;let a=e.bMarks[i]+e.tShift[i];if(a>=e.eMarks[i])return!1;let o=e.src.charCodeAt(a++);if(o!==124&&o!==45&&o!==58||a>=e.eMarks[i])return!1;let s=e.src.charCodeAt(a++);if(s!==124&&s!==45&&s!==58&&!ac(s)||o===45&&ac(s))return!1;for(;a<e.eMarks[i];){let t=e.src.charCodeAt(a);if(t!==124&&t!==45&&t!==58&&!ac(t))return!1;a++}let c=nl(e,t+1),l=c.split(`|`),u=[];for(let e=0;e<l.length;e++){let t=l[e].trim();if(!t){if(e===0||e===l.length-1)continue;return!1}if(!/^:?-+:?$/.test(t))return!1;t.charCodeAt(t.length-1)===58?u.push(t.charCodeAt(0)===58?`center`:`right`):t.charCodeAt(0)===58?u.push(`left`):u.push(``)}if(c=nl(e,t).trim(),c.indexOf(`|`)===-1||e.sCount[t]-e.blkIndent>=4)return!1;l=rl(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop();let d=l.length;if(d===0||d!==u.length)return!1;if(r)return!0;let f=e.parentType;e.parentType=`table`;let p=e.md.block.ruler.getRules(`blockquote`),m=e.push(`table_open`,`table`,1),h=[t,0];m.map=h;let g=e.push(`thead_open`,`thead`,1);g.map=[t,t+1];let _=e.push(`tr_open`,`tr`,1);_.map=[t,t+1];for(let t=0;t<l.length;t++){let n=e.push(`th_open`,`th`,1);u[t]&&(n.attrs=[[`style`,`text-align:${u[t]}`]]);let r=e.push(`inline`,``,0);r.content=l[t].trim(),r.children=[],e.push(`th_close`,`th`,-1)}e.push(`tr_close`,`tr`,-1),e.push(`thead_close`,`thead`,-1);let v,y=0;for(i=t+2;i<n&&!(e.sCount[i]<e.blkIndent);i++){let r=!1;for(let t=0,a=p.length;t<a;t++)if(p[t](e,i,n,!0)){r=!0;break}if(r||(c=nl(e,i).trim(),!c)||e.sCount[i]-e.blkIndent>=4||(l=rl(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop(),y+=d-l.length,y>tl))break;if(i===t+2){let n=e.push(`tbody_open`,`tbody`,1);n.map=v=[t+2,0]}let a=e.push(`tr_open`,`tr`,1);a.map=[i,i+1];for(let t=0;t<d;t++){let n=e.push(`td_open`,`td`,1);u[t]&&(n.attrs=[[`style`,`text-align:${u[t]}`]]);let r=e.push(`inline`,``,0);r.content=l[t]?l[t].trim():``,r.children=[],e.push(`td_close`,`td`,-1)}e.push(`tr_close`,`tr`,-1)}return v&&(e.push(`tbody_close`,`tbody`,-1),v[1]=i),e.push(`table_close`,`table`,-1),h[1]=i,e.parentType=f,e.line=i,!0}function al(e,t,n){if(e.sCount[t]-e.blkIndent<4)return!1;let r=t+1,i=r;for(;r<n;){if(e.isEmpty(r)){r++;continue}if(e.sCount[r]-e.blkIndent>=4){r++,i=r;continue}break}e.line=i;let a=e.push(`code_block`,`code`,0);return a.content=e.getLines(t,i,4+e.blkIndent,!1)+`
22
22
  `,a.map=[t,e.line],!0}function ol(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||i+3>a)return!1;let o=e.src.charCodeAt(i);if(o!==126&&o!==96)return!1;let s=i;i=e.skipChars(i,o);let c=i-s;if(c<3)return!1;let l=e.src.slice(s,i),u=e.src.slice(i,a);if(o===96&&u.indexOf(String.fromCharCode(o))>=0)return!1;if(r)return!0;let d=t,f=!1;for(;d++,!(d>=n||(i=s=e.bMarks[d]+e.tShift[d],a=e.eMarks[d],i<a&&e.sCount[d]<e.blkIndent));)if(e.src.charCodeAt(i)===o&&!(e.sCount[d]-e.blkIndent>=4)&&(i=e.skipChars(i,o),!(i-s<c)&&(i=e.skipSpaces(i),!(i<a)))){f=!0;break}c=e.sCount[t],e.line=d+ +!!f;let p=e.push(`fence`,`code`,0);return p.info=u,p.content=e.getLines(t+1,d,c,!0),p.markup=l,p.map=[t,e.line],!0}function sl(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=e.lineMax;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==62)return!1;if(r)return!0;let s=[],c=[],l=[],u=[],d=e.md.block.ruler.getRules(`blockquote`),f=e.parentType;e.parentType=`blockquote`;let p=!1,m;for(m=t;m<n;m++){let t=e.sCount[m]<e.blkIndent;if(i=e.bMarks[m]+e.tShift[m],a=e.eMarks[m],i>=a)break;if(e.src.charCodeAt(i++)===62&&!t){let t=e.sCount[m]+1,n,r;e.src.charCodeAt(i)===32?(i++,t++,r=!1,n=!0):e.src.charCodeAt(i)===9?(n=!0,(e.bsCount[m]+t)%4==3?(i++,t++,r=!1):r=!0):n=!1;let o=t;for(s.push(e.bMarks[m]),e.bMarks[m]=i;i<a;){let t=e.src.charCodeAt(i);if(ac(t))t===9?o+=4-(o+e.bsCount[m]+ +!!r)%4:o++;else break;i++}p=i>=a,c.push(e.bsCount[m]),e.bsCount[m]=e.sCount[m]+1+ +!!n,l.push(e.sCount[m]),e.sCount[m]=o-t,u.push(e.tShift[m]),e.tShift[m]=i-e.bMarks[m];continue}if(p)break;let r=!1;for(let t=0,i=d.length;t<i;t++)if(d[t](e,m,n,!0)){r=!0;break}if(r){e.lineMax=m,e.blkIndent!==0&&(s.push(e.bMarks[m]),c.push(e.bsCount[m]),u.push(e.tShift[m]),l.push(e.sCount[m]),e.sCount[m]-=e.blkIndent);break}s.push(e.bMarks[m]),c.push(e.bsCount[m]),u.push(e.tShift[m]),l.push(e.sCount[m]),e.sCount[m]=-1}let h=e.blkIndent;e.blkIndent=0;let g=e.push(`blockquote_open`,`blockquote`,1);g.markup=`>`;let _=[t,0];g.map=_,e.md.block.tokenize(e,t,m);let v=e.push(`blockquote_close`,`blockquote`,-1);v.markup=`>`,e.lineMax=o,e.parentType=f,_[1]=e.line;for(let n=0;n<u.length;n++)e.bMarks[n+t]=s[n],e.tShift[n+t]=u[n],e.sCount[n+t]=l[n],e.bsCount[n+t]=c[n];return e.blkIndent=h,!0}function cl(e,t,n,r){let i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let a=e.bMarks[t]+e.tShift[t],o=e.src.charCodeAt(a++);if(o!==42&&o!==45&&o!==95)return!1;let s=1;for(;a<i;){let t=e.src.charCodeAt(a++);if(t!==o&&!ac(t))return!1;t===o&&s++}if(s<3)return!1;if(r)return!0;e.line=t+1;let c=e.push(`hr`,`hr`,0);return c.map=[t,e.line],c.markup=Array(s+1).join(String.fromCharCode(o)),!0}function ll(e,t){let n=e.eMarks[t],r=e.bMarks[t]+e.tShift[t],i=e.src.charCodeAt(r++);return i!==42&&i!==45&&i!==43||r<n&&!ac(e.src.charCodeAt(r))?-1:r}function ul(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t],i=n;if(i+1>=r)return-1;let a=e.src.charCodeAt(i++);if(a<48||a>57)return-1;for(;;){if(i>=r)return-1;if(a=e.src.charCodeAt(i++),a>=48&&a<=57){if(i-n>=10)return-1;continue}if(a===41||a===46)break;return-1}return i<r&&(a=e.src.charCodeAt(i),!ac(a))?-1:i}function dl(e,t){let n=e.level+2;for(let r=t+2,i=e.tokens.length-2;r<i;r++)e.tokens[r].level===n&&e.tokens[r].type===`paragraph_open`&&(e.tokens[r+2].hidden=!0,e.tokens[r].hidden=!0,r+=2)}function fl(e,t,n,r){let i,a,o,s,c=t,l=!0;if(e.sCount[c]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[c]-e.listIndent>=4&&e.sCount[c]<e.blkIndent)return!1;let u=!1;r&&e.parentType===`paragraph`&&e.sCount[c]>=e.blkIndent&&(u=!0);let d,f,p;if((p=ul(e,c))>=0){if(d=!0,o=e.bMarks[c]+e.tShift[c],f=Number(e.src.slice(o,p-1)),u&&f!==1)return!1}else if((p=ll(e,c))>=0)d=!1;else return!1;if(u&&e.skipSpaces(p)>=e.eMarks[c])return!1;if(r)return!0;let m=e.src.charCodeAt(p-1),h=e.tokens.length;d?(s=e.push(`ordered_list_open`,`ol`,1),f!==1&&(s.attrs=[[`start`,f]])):s=e.push(`bullet_list_open`,`ul`,1);let g=[c,0];s.map=g,s.markup=String.fromCharCode(m);let _=!1,v=e.md.block.ruler.getRules(`list`),y=e.parentType;for(e.parentType=`list`;c<n;){a=p,i=e.eMarks[c];let t=e.sCount[c]+p-(e.bMarks[c]+e.tShift[c]),r=t;for(;a<i;){let t=e.src.charCodeAt(a);if(t===9)r+=4-(r+e.bsCount[c])%4;else if(t===32)r++;else break;a++}let u=a,f;f=u>=i?1:r-t,f>4&&(f=1);let h=t+f;s=e.push(`list_item_open`,`li`,1),s.markup=String.fromCharCode(m);let g=[c,0];s.map=g,d&&(s.info=e.src.slice(o,p-1));let y=e.tight,b=e.tShift[c],x=e.sCount[c],S=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=h,e.tight=!0,e.tShift[c]=u-e.bMarks[c],e.sCount[c]=r,u>=i&&e.isEmpty(c+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,c,n),(!e.tight||_)&&(l=!1),_=e.line-c>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=S,e.tShift[c]=b,e.sCount[c]=x,e.tight=y,s=e.push(`list_item_close`,`li`,-1),s.markup=String.fromCharCode(m),c=e.line,g[1]=c,c>=n||e.sCount[c]<e.blkIndent||e.sCount[c]-e.blkIndent>=4)break;let C=!1;for(let t=0,r=v.length;t<r;t++)if(v[t](e,c,n,!0)){C=!0;break}if(C)break;if(d){if(p=ul(e,c),p<0)break;o=e.bMarks[c]+e.tShift[c]}else if(p=ll(e,c),p<0)break;if(m!==e.src.charCodeAt(p-1))break}return s=d?e.push(`ordered_list_close`,`ol`,-1):e.push(`bullet_list_close`,`ul`,-1),s.markup=String.fromCharCode(m),g[1]=c,e.line=c,e.parentType=y,l&&dl(e,h),!0}function pl(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=t+1;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==91)return!1;function s(t){let n=e.lineMax;if(t>=n||e.isEmpty(t))return null;let r=!1;if(e.sCount[t]-e.blkIndent>3&&(r=!0),e.sCount[t]<0&&(r=!0),!r){let r=e.md.block.ruler.getRules(`reference`),i=e.parentType;e.parentType=`reference`;let a=!1;for(let i=0,o=r.length;i<o;i++)if(r[i](e,t,n,!0)){a=!0;break}if(e.parentType=i,a)return null}let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];return e.src.slice(i,a+1)}let c=e.src.slice(i,a+1);a=c.length;let l=-1;for(i=1;i<a;i++){let e=c.charCodeAt(i);if(e===91)return!1;if(e===93){l=i;break}if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(e===92&&(i++,i<a&&c.charCodeAt(i)===10)){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}}if(l<0||c.charCodeAt(l+1)!==58)return!1;for(i=l+2;i<a;i++){let e=c.charCodeAt(i);if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(!ac(e))break}let u=e.md.helpers.parseLinkDestination(c,i,a);if(!u.ok)return!1;let d=e.md.normalizeLink(u.str);if(!e.md.validateLink(d))return!1;i=u.pos;let f=i,p=o,m=i;for(;i<a;i++){let e=c.charCodeAt(i);if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(!ac(e))break}let h=e.md.helpers.parseLinkTitle(c,i,a);for(;h.can_continue;){let t=s(o);if(t===null)break;c+=t,i=a,a=c.length,o++,h=e.md.helpers.parseLinkTitle(c,i,a,h)}let g;for(i<a&&m!==i&&h.ok?(g=h.str,i=h.pos):(g=``,i=f,o=p);i<a&&ac(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10&&g)for(g=``,i=f,o=p;i<a&&ac(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10)return!1;let _=uc(c.slice(1,l));if(!_)return!1;if(r)return!0;e.env.references===void 0&&(e.env.references={}),e.env.references[_]===void 0&&(e.env.references[_]={title:g,href:d});let v=e.push(`reference_definition`,``,0);v.map=[t,o],v.hidden=!0;let y=Object.create(null);return y.label=_,v.meta=y,e.line=o,!0}var ml=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),hl=`<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`,gl=`<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>`,_l=RegExp(`^(?:${hl}|${gl}|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`),vl=RegExp(`^(?:${hl}|${gl})`),yl=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Za-z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[RegExp(`^</?(${ml.join(`|`)})(?=(\\s|/?>|$))`,`i`),/^$/,!0],[RegExp(`${vl.source}\\s*$`),/^$/,!1]];function bl(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(i)!==60)return!1;let o=e.src.slice(i,a),s=0;for(;s<yl.length&&!yl[s][0].test(o);s++);if(s===yl.length)return!1;if(r)return yl[s][2];let c=t+1,l=yl[s][1].test(``);if(!yl[s][1].test(o)){for(;c<n&&!(e.sCount[c]<e.blkIndent&&(l||!e.isEmpty(c)));c++)if(i=e.bMarks[c]+e.tShift[c],a=e.eMarks[c],o=e.src.slice(i,a),yl[s][1].test(o)){o.length!==0&&c++;break}}e.line=c;let u=e.push(`html_block`,``,0);return u.map=[t,c],u.content=e.getLines(t,c,e.blkIndent,!0),!0}function xl(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let o=e.src.charCodeAt(i);if(o!==35||i>=a)return!1;let s=1;for(o=e.src.charCodeAt(++i);o===35&&i<a&&s<=6;)s++,o=e.src.charCodeAt(++i);if(s>6||i<a&&!ac(o))return!1;if(r)return!0;a=e.skipSpacesBack(a,i);let c=e.skipCharsBack(a,35,i);c>i&&ac(e.src.charCodeAt(c-1))&&(a=c),e.line=t+1;let l=e.push(`heading_open`,`h${s}`,1);l.markup=`########`.slice(0,s),l.map=[t,e.line];let u=e.push(`inline`,``,0);u.content=fc(e.src.slice(i,a)),u.map=[t,e.line],u.children=[];let d=e.push(`heading_close`,`h${s}`,-1);return d.markup=`########`.slice(0,s),!0}function Sl(e,t,n){let r=e.md.block.ruler.getRules(`paragraph`);if(e.sCount[t]-e.blkIndent>=4)return!1;let i=e.parentType;e.parentType=`paragraph`;let a=0,o,s=t+1;for(;s<n&&!e.isEmpty(s);s++){if(e.sCount[s]-e.blkIndent>3)continue;if(e.sCount[s]>=e.blkIndent){let t=e.bMarks[s]+e.tShift[s],n=e.eMarks[s];if(t<n&&(o=e.src.charCodeAt(t),(o===45||o===61)&&(t=e.skipChars(t,o),t=e.skipSpaces(t),t>=n))){a=o===61?1:2;break}}if(e.sCount[s]<0)continue;let t=!1;for(let i=0,a=r.length;i<a;i++)if(r[i](e,s,n,!0)){t=!0;break}if(t)break}if(!a)return e.parentType=i,!1;let c=fc(e.getLines(t,s,e.blkIndent,!1));e.line=s+1;let l=e.push(`heading_open`,`h${a}`,1);l.markup=String.fromCharCode(o),l.map=[t,e.line];let u=e.push(`inline`,``,0);u.content=c,u.map=[t,e.line-1],u.children=[];let d=e.push(`heading_close`,`h${a}`,-1);return d.markup=String.fromCharCode(o),e.parentType=i,!0}function Cl(e,t,n){let r=e.md.block.ruler.getRules(`paragraph`),i=e.parentType,a=t+1;for(e.parentType=`paragraph`;a<n&&!e.isEmpty(a);a++){if(e.sCount[a]-e.blkIndent>3||e.sCount[a]<0)continue;let t=!1;for(let i=0,o=r.length;i<o;i++)if(r[i](e,a,n,!0)){t=!0;break}if(t)break}let o=fc(e.getLines(t,a,e.blkIndent,!1));e.line=a;let s=e.push(`paragraph_open`,`p`,1);s.map=[t,e.line];let c=e.push(`inline`,``,0);return c.content=o,c.map=[t,e.line],c.children=[],e.push(`paragraph_close`,`p`,-1),e.parentType=i,!0}var wl=[[`table`,il,[`paragraph`,`reference`]],[`code`,al],[`fence`,ol,[`paragraph`,`reference`,`blockquote`,`list`]],[`blockquote`,sl,[`paragraph`,`reference`,`blockquote`,`list`]],[`hr`,cl,[`paragraph`,`reference`,`blockquote`,`list`]],[`list`,fl,[`paragraph`,`reference`,`blockquote`]],[`reference`,pl],[`html_block`,bl,[`paragraph`,`reference`,`blockquote`]],[`heading`,xl,[`paragraph`,`reference`,`blockquote`]],[`lheading`,Sl],[`paragraph`,Cl]],Tl=class{constructor(){Y(this,`ruler`,new Sc),Y(this,`State`,el);for(let e=0;e<wl.length;e++)this.ruler.push(wl[e][0],wl[e][1],{alt:(wl[e][2]||[]).slice()})}tokenize(e,t,n){let r=this.ruler.getRules(``),i=r.length,a=e.md.options.maxNesting,o=t,s=!1;for(;o<n&&(e.line=o=e.skipEmptyLines(o),!(o>=n||e.sCount[o]<e.blkIndent));){if(e.level>=a){e.line=n;break}let t=e.line,c=!1;for(let a=0;a<i;a++)if(c=r[a](e,o,n,!1),c){if(t>=e.line)throw Error(`block rule didn't increment state.line`);break}if(!c)throw Error(`none of the block rules matched`);e.tight=!s,e.isEmpty(e.line-1)&&(s=!0),o=e.line,o<n&&e.isEmpty(o)&&(s=!0,o++,e.line=o)}}parse(e,t,n,r){if(!e)return;let i=new this.State(e,t,n,r);this.tokenize(i,i.line,i.lineMax)}},El=class{constructor(e,t,n,r){Y(this,`pos`,0),Y(this,`level`,0),Y(this,`pending`,``),Y(this,`pendingLevel`,0),Y(this,`cache`,{}),Y(this,`backticks`,{}),Y(this,`backticksScanned`,!1),Y(this,`linkLevel`,0),Y(this,`delimiters`,[]),Y(this,`_prev_delimiters`,[]),Y(this,`Token`,xc),this.src=e,this.env=n,this.md=t,this.tokens=r,this.tokens_meta=Array(r.length),this.posMax=this.src.length}pushPending(){let e=new xc(`text`,``,0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending=``,e}push(e,t,n){this.pending&&this.pushPending();let r=new xc(e,t,n),i;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r}scanDelims(e,t){let n=this.posMax,r=this.src.charCodeAt(e),i;if(e===0)i=32;else if(e===1)i=this.src.charCodeAt(0),(i&63488)==55296&&(i=65533);else if(i=this.src.charCodeAt(e-1),(i&64512)==56320){let t=this.src.charCodeAt(e-2);i=(t&64512)==55296?65536+(t-55296<<10)+(i-56320):65533}else(i&64512)==55296&&(i=65533);let a=e;for(;a<n&&this.src.charCodeAt(a)===r;)a++;let o=a-e,s=a<n?this.src.charCodeAt(a):32;if((s&64512)==55296){let e=this.src.charCodeAt(a+1);s=(e&64512)==56320?65536+(s-55296<<10)+(e-56320):65533}else(s&64512)==56320&&(s=65533);let c=lc(i)||cc(i),l=lc(s)||cc(s),u=oc(i),d=oc(s),f=!d&&(!l||u||c),p=!u&&(!c||d||l);return{can_open:f&&(t||!p||c),can_close:p&&(t||!f||l),length:o}}};function Dl(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function Ol(e,t){let n=e.pos;for(;n<e.posMax&&!Dl(e.src.charCodeAt(n));)n++;return n!==e.pos&&(t||(e.pending+=e.src.slice(e.pos,n)),e.pos=n,!0)}var kl=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function Al(e,t){if(!e.md.options.linkify||e.linkLevel>0)return!1;let n=e.pos,r=e.posMax;if(n+3>r||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;let i=e.pending.match(kl);if(!i)return!1;let a=i[1],o=e.md.linkify.matchAtStart(e.src.slice(n-a.length));if(!o)return!1;let s=o.url;if(s.length<=a.length)return!1;let c=s.length;for(;c>0&&s.charCodeAt(c-1)===42;)c--;c!==s.length&&(s=s.slice(0,c));let l=e.md.normalizeLink(s);if(!e.md.validateLink(l))return!1;if(!t){e.pending=e.pending.slice(0,-a.length);let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,l]],t.markup=`linkify`,t.info=`auto`;let n=e.push(`text`,``,0);n.content=e.md.normalizeLinkText(s);let r=e.push(`link_close`,`a`,-1);r.markup=`linkify`,r.info=`auto`}return e.pos+=s.length-a.length,!0}function jl(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;let r=e.pending.length-1,i=e.posMax;if(!t){if(r>=0&&e.pending.charCodeAt(r)===32){if(r>=1&&e.pending.charCodeAt(r-1)===32){let t=r-1;for(;t>=1&&e.pending.charCodeAt(t-1)===32;)t--;e.pending=e.pending.slice(0,t),e.push(`hardbreak`,`br`,0)}else e.pending=e.pending.slice(0,-1),e.push(`softbreak`,`br`,0)}else e.push(`softbreak`,`br`,0)}for(n++;n<i&&ac(e.src.charCodeAt(n));)n++;return e.pos=n,!0}var Ml=[];for(let e=0;e<256;e++)Ml.push(0);`\\!"#$%&'()*+,./:;<=>?@[]^_\`{|}~-`.split(``).forEach(function(e){Ml[e.charCodeAt(0)]=1});function Nl(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let i=e.src.charCodeAt(n);if(i===10){for(t||e.push(`hardbreak`,`br`,0),n++;n<r&&(i=e.src.charCodeAt(n),ac(i));)n++;return e.pos=n,!0}if(i===32){if(!t){let t=e.push(`text_special`,``,0);t.content=`\\`,t.markup=`\\`,t.info=`escape`}return e.pos=n,!0}let a=e.src[n];if(i>=55296&&i<=56319&&n+1<r){let t=e.src.charCodeAt(n+1);t>=56320&&t<=57343&&(a+=e.src[n+1],n++)}let o=`\\`+a;if(!t){let t=e.push(`text_special`,``,0);t.content=i<256&&Ml[i]!==0?a:o,t.markup=o,t.info=`escape`}return e.pos=n+1,!0}function Pl(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==96)return!1;let r=n;n++;let i=e.posMax;for(;n<i&&e.src.charCodeAt(n)===96;)n++;let a=e.src.slice(r,n),o=a.length;if(e.backticksScanned&&(e.backticks[o]||0)<=r)return t||(e.pending+=a),e.pos+=o,!0;let s=n,c;for(;(c=e.src.indexOf("`",s))!==-1;){for(s=c+1;s<i&&e.src.charCodeAt(s)===96;)s++;let r=s-c;if(r===o){if(!t){let t=e.push(`code_inline`,`code`,0);t.markup=a,t.content=e.src.slice(n,c).replace(/\n/g,` `).replace(/^ (.+) $/,`$1`)}return e.pos=s,!0}e.backticks[r]=c}return e.backticksScanned=!0,t||(e.pending+=a),e.pos+=o,!0}function X(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==126)return!1;let i=e.scanDelims(e.pos,!0),a=i.length,o=String.fromCharCode(r);if(a<2)return!1;let s;a%2&&(s=e.push(`text`,``,0),s.content=o,a--);for(let t=0;t<a;t+=2)s=e.push(`text`,``,0),s.content=o+o,e.delimiters.push({marker:r,length:0,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close});return e.pos+=i.length,!0}function Fl(e,t){let n,r=[],i=t.length;for(let a=0;a<i;a++){let i=t[a];if(i.marker!==126||i.end===-1)continue;let o=t[i.end];n=e.tokens[i.token],n.type=`s_open`,n.tag=`s`,n.nesting=1,n.markup=`~~`,n.content=``,n=e.tokens[o.token],n.type=`s_close`,n.tag=`s`,n.nesting=-1,n.markup=`~~`,n.content=``,e.tokens[o.token-1].type===`text`&&e.tokens[o.token-1].content===`~`&&r.push(o.token-1)}for(;r.length;){let t=r.pop(),i=t+1;for(;i<e.tokens.length&&e.tokens[i].type===`s_close`;)i++;i--,t!==i&&(n=e.tokens[i],e.tokens[i]=e.tokens[t],e.tokens[t]=n)}}function Z(e){let t=e.tokens_meta,n=e.tokens_meta.length;Fl(e,e.delimiters);for(let r=0;r<n;r++){let n=t[r]?.delimiters;n&&Fl(e,n)}}var Q={tokenize:X,postProcess:Z};function Il(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==95&&r!==42)return!1;let i=e.scanDelims(e.pos,r===42);for(let t=0;t<i.length;t++){let t=e.push(`text`,``,0);t.content=String.fromCharCode(r),e.delimiters.push({marker:r,length:i.length,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close})}return e.pos+=i.length,!0}function Ll(e,t){let n=t.length;for(let r=n-1;r>=0;r--){let n=t[r];if(n.marker!==95&&n.marker!==42||n.end===-1)continue;let i=t[n.end],a=r>0&&t[r-1].end===n.end+1&&t[r-1].marker===n.marker&&t[r-1].token===n.token-1&&t[n.end+1].token===i.token+1,o=String.fromCharCode(n.marker),s=e.tokens[n.token];s.type=a?`strong_open`:`em_open`,s.tag=a?`strong`:`em`,s.nesting=1,s.markup=a?o+o:o,s.content=``;let c=e.tokens[i.token];c.type=a?`strong_close`:`em_close`,c.tag=a?`strong`:`em`,c.nesting=-1,c.markup=a?o+o:o,c.content=``,a&&(e.tokens[t[r-1].token].content=``,e.tokens[t[n.end+1].token].content=``,r--)}}function Rl(e){let t=e.tokens_meta,n=e.tokens_meta.length;Ll(e,e.delimiters);for(let r=0;r<n;r++){let n=t[r]?.delimiters;n&&Ll(e,n)}}var zl={tokenize:Il,postProcess:Rl};function Bl(e,t){let n,r,i,a,o=``,s=``,c=e.pos,l=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;let u=e.pos,d=e.posMax,f=e.pos+1,p=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(p<0)return!1;let m=p+1;if(m<d&&e.src.charCodeAt(m)===40){for(l=!1,m++;m<d&&(n=e.src.charCodeAt(m),!(!ac(n)&&n!==10));m++);if(m>=d)return!1;if(c=m,i=e.md.helpers.parseLinkDestination(e.src,m,e.posMax),i.ok){for(o=e.md.normalizeLink(i.str),e.md.validateLink(o)?m=i.pos:o=``,c=m;m<d&&(n=e.src.charCodeAt(m),!(!ac(n)&&n!==10));m++);if(i=e.md.helpers.parseLinkTitle(e.src,m,e.posMax),m<d&&c!==m&&i.ok)for(s=i.str,m=i.pos;m<d&&(n=e.src.charCodeAt(m),!(!ac(n)&&n!==10));m++);}(m>=d||e.src.charCodeAt(m)!==41)&&(l=!0),m++}if(l){if(e.env.references===void 0)return!1;if(m<d&&e.src.charCodeAt(m)===91?(c=m+1,m=e.md.helpers.parseLinkLabel(e,m),m>=0?r=e.src.slice(c,m++):m=p+1):m=p+1,r||=e.src.slice(f,p),r=uc(r),a=e.env.references[r],!a)return e.pos=u,!1;o=a.href,s=a.title}if(!t){e.pos=f,e.posMax=p;let t=e.push(`link_open`,`a`,1),n=[[`href`,o]];if(t.attrs=n,s&&n.push([`title`,s]),r){let e=Object.create(null);e.label=r,t.meta=e}e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push(`link_close`,`a`,-1)}return e.pos=m,e.posMax=d,!0}function Vl(e,t){let n,r,i,a,o,s,c,l,u=``,d=e.pos,f=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;let p=e.pos+2,m=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(m<0)return!1;if(a=m+1,a<f&&e.src.charCodeAt(a)===40){for(a++;a<f&&(n=e.src.charCodeAt(a),!(!ac(n)&&n!==10));a++);if(a>=f)return!1;for(l=a,s=e.md.helpers.parseLinkDestination(e.src,a,e.posMax),s.ok&&(u=e.md.normalizeLink(s.str),e.md.validateLink(u)?a=s.pos:u=``),l=a;a<f&&(n=e.src.charCodeAt(a),!(!ac(n)&&n!==10));a++);if(s=e.md.helpers.parseLinkTitle(e.src,a,e.posMax),a<f&&l!==a&&s.ok)for(c=s.str,a=s.pos;a<f&&(n=e.src.charCodeAt(a),!(!ac(n)&&n!==10));a++);else c=``;if(a>=f||e.src.charCodeAt(a)!==41)return e.pos=d,!1;a++}else{if(e.env.references===void 0)return!1;if(a<f&&e.src.charCodeAt(a)===91?(l=a+1,a=e.md.helpers.parseLinkLabel(e,a),a>=0?i=e.src.slice(l,a++):a=m+1):a=m+1,i||=e.src.slice(p,m),i=uc(i),o=e.env.references[i],!o)return e.pos=d,!1;u=o.href,c=o.title}if(!t){r=e.src.slice(p,m);let t=[];e.md.inline.parse(r,e.md,e.env,t);let n=e.push(`image`,`img`,0),a=[[`src`,u],[`alt`,``]];if(n.attrs=a,n.children=t,n.content=r,c&&a.push([`title`,c]),i){let e=Object.create(null);e.label=i,n.meta=e}}return e.pos=a,e.posMax=f,!0}var Hl=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,Ul=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function Wl(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==60)return!1;let r=e.pos,i=e.posMax;for(;;){if(++n>=i)return!1;let t=e.src.charCodeAt(n);if(t===60)return!1;if(t===62)break}let a=e.src.slice(r+1,n);if(Ul.test(a)){let n=e.md.normalizeLink(a);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(a);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=a.length+2,!0}if(Hl.test(a)){let n=e.md.normalizeLink(`mailto:${a}`);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(a);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=a.length+2,!0}return!1}function Gl(e){return/^<a[>\s]/i.test(e)}function Kl(e){return/^<\/a\s*>/i.test(e)}function ql(e){let t=e|32;return t>=97&&t<=122}function Jl(e,t){if(!e.md.options.html)return!1;let n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==60||r+2>=n)return!1;let i=e.src.charCodeAt(r+1);if(i!==33&&i!==63&&i!==47&&!ql(i))return!1;let a=e.src.slice(r).match(_l);if(!a)return!1;if(!t){let t=e.push(`html_inline`,``,0);t.content=a[0],Gl(t.content)&&e.linkLevel++,Kl(t.content)&&e.linkLevel--}return e.pos+=a[0].length,!0}var Yl=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,Xl=/^&([a-z][a-z0-9]{1,31});/i;function Zl(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=r)return!1;if(e.src.charCodeAt(n+1)===35){let r=e.src.slice(n).match(Yl);if(r){if(!t){let t=r[1][0].toLowerCase()===`x`?parseInt(r[1].slice(1),16):parseInt(r[1],10),n=e.push(`text_special`,``,0);n.content=Ws(t)?Gs(t):Gs(65533),n.markup=r[0],n.info=`entity`}return e.pos+=r[0].length,!0}}else{let r=e.src.slice(n).match(Xl);if(r){let n=ns(r[0]);if(n!==r[0]){if(!t){let t=e.push(`text_special`,``,0);t.content=n,t.markup=r[0],t.info=`entity`}return e.pos+=r[0].length,!0}}}return!1}function Ql(e){let t={},n=e.length;if(!n)return;let r=0,i=-2,a=[];for(let o=0;o<n;o++){let n=e[o];if(a.push(0),(e[r].marker!==n.marker||i!==n.token-1)&&(r=o),i=n.token,n.length=n.length||0,!n.close)continue;t.hasOwnProperty(n.marker)||(t[n.marker]=[-1,-1,-1,-1,-1,-1]);let s=t[n.marker][(n.open?3:0)+n.length%3],c=r-a[r]-1,l=c;for(;c>s;c-=a[c]+1){let t=e[c];if(t.marker===n.marker&&t.open&&t.end<0){let r=!1;if((t.close||n.open)&&(t.length+n.length)%3==0&&(t.length%3!=0||n.length%3!=0)&&(r=!0),!r){let r=c>0&&!e[c-1].open?a[c-1]+1:0;a[o]=o-c+r,a[c]=r,n.open=!1,t.end=o,t.close=!1,l=-1,i=-2;break}}}l!==-1&&(t[n.marker][(n.open?3:0)+(n.length||0)%3]=l)}}function $l(e){let t=e.tokens_meta,n=e.tokens_meta.length;Ql(e.delimiters);for(let e=0;e<n;e++){let n=t[e]?.delimiters;n&&Ql(n)}}function eu(e){let t,n,r=0,i=e.tokens,a=e.tokens.length;for(t=n=0;t<a;t++)i[t].nesting<0&&r--,i[t].level=r,i[t].nesting>0&&r++,i[t].type===`text`&&t+1<a&&i[t+1].type===`text`?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}var tu=[[`text`,Ol],[`linkify`,Al],[`newline`,jl],[`escape`,Nl],[`backticks`,Pl],[`strikethrough`,Q.tokenize],[`emphasis`,zl.tokenize],[`link`,Bl],[`image`,Vl],[`autolink`,Wl],[`html_inline`,Jl],[`entity`,Zl]],nu=[[`balance_pairs`,$l],[`strikethrough`,Q.postProcess],[`emphasis`,zl.postProcess],[`fragments_join`,eu]],ru=class{constructor(){Y(this,`ruler`,new Sc),Y(this,`ruler2`,new Sc),Y(this,`State`,El);for(let e=0;e<tu.length;e++)this.ruler.push(tu[e][0],tu[e][1]);for(let e=0;e<nu.length;e++)this.ruler2.push(nu[e][0],nu[e][1])}skipToken(e){let t=e.pos,n=this.ruler.getRules(``),r=n.length,i=e.md.options.maxNesting,a=e.cache;if(a[t]!==void 0){e.pos=a[t];return}let o=!1;if(e.level<i){for(let i=0;i<r;i++)if(e.level++,o=n[i](e,!0),e.level--,o){if(t>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}else e.pos=e.posMax;o||e.pos++,a[t]=e.pos}tokenize(e){let t=this.ruler.getRules(``),n=t.length,r=e.posMax,i=e.md.options.maxNesting;for(;e.pos<r;){let a=e.pos,o=!1;if(e.level<i){for(let r=0;r<n;r++)if(o=t[r](e,!1),o){if(a>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}if(o){if(e.pos>=r)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()}parse(e,t,n,r){let i=new this.State(e,t,n,r);this.tokenize(i);let a=this.ruler2.getRules(``),o=a.length;for(let e=0;e<o;e++)a[e](i)}},iu={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`strip_references`,`inline`,`text_join`]},block:{rules:[`paragraph`]},inline:{rules:[`text`],rules2:[`balance_pairs`,`fragments_join`]}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`strip_references`,`inline`,`text_join`]},block:{rules:[`blockquote`,`code`,`fence`,`heading`,`hr`,`html_block`,`lheading`,`list`,`reference`,`paragraph`]},inline:{rules:[`autolink`,`backticks`,`emphasis`,`entity`,`escape`,`html_inline`,`image`,`link`,`newline`,`text`],rules2:[`balance_pairs`,`emphasis`,`fragments_join`]}}}},au=/^(vbscript|javascript|file|data):/,ou=/^data:image\/(gif|png|jpeg|webp);/,su=[`http:`,`https:`,`mailto:`],cu=class{validateLink(e){let t=e.trim().toLowerCase();return!au.test(t)||ou.test(t)}normalizeLink(e){let t=Ao(e,!0);if(t.hostname&&(!t.protocol||su.indexOf(t.protocol)>=0))try{t.hostname=Rs.toASCII(t.hostname)}catch{}return _o(vo(t))}normalizeLinkText(e){let t=Ao(e,!0);if(t.hostname&&(!t.protocol||su.indexOf(t.protocol)>=0))try{t.hostname=Rs.toUnicode(t.hostname)}catch{}return mo(vo(t),mo.defaultChars+`%`)}constructor(...e){Y(this,`inline`,new ru),Y(this,`block`,new Tl),Y(this,`core`,new $c),Y(this,`renderer`,new wc),Y(this,`linkify`,new ds),Y(this,`utils`,Vs),Y(this,`helpers`,Object.assign({},_c));let[t,n]=e;typeof t==`string`?(this.configure(t),n&&this.set(n)):(this.configure(`default`),this.set(t||{}))}set(e){return Object.assign(this.options,e),this}configure(e){let t;if(typeof e==`string`){let n=e;if(t=iu[n],!t)throw Error(`Wrong 'markdown-it' preset "${n}", check name`)}else t=e;if(!t)throw Error("Wrong `markdown-it` preset, can't be empty");t.options&&(this.options={...t.options});let n=t.components;if(n){[`core`,`block`,`inline`].forEach(e=>{let t=n[e]?.rules;t&&this[e].ruler.enableOnly(t)});let e=n.inline?.rules2;e&&this.inline.ruler2.enableOnly(e)}return this}enable(e,t=!1){let n=[];Array.isArray(e)||(e=[e]),[`core`,`block`,`inline`].forEach(t=>{n=n.concat(this[t].ruler.enable(e,!0))}),n=n.concat(this.inline.ruler2.enable(e,!0));let r=e.filter(e=>n.indexOf(e)<0);if(r.length&&!t)throw Error(`MarkdownIt. Failed to enable unknown rule(s): ${r}`);return this}disable(e,t=!1){let n=[];Array.isArray(e)||(e=[e]),[`core`,`block`,`inline`].forEach(t=>{n=n.concat(this[t].ruler.disable(e,!0))}),n=n.concat(this.inline.ruler2.disable(e,!0));let r=e.filter(e=>n.indexOf(e)<0);if(r.length&&!t)throw Error(`MarkdownIt. Failed to disable unknown rule(s): ${r}`);return this}use(e,...t){return e.apply(e,[this,...t]),this}parse(e,t){if(typeof e!=`string`)throw Error(`Input data should be a String`);let n=new this.core.State(e,this,t);return this.core.process(n),n.tokens}render(e,t={}){return this.renderer.render(this.parse(e,t),this.options,t)}parseInline(e,t){let n=new this.core.State(e,this,t);return n.inlineMode=!0,this.core.process(n),n.tokens}renderInline(e,t={}){return this.renderer.render(this.parseInline(e,t),this.options,t)}};Y(cu,`Token`,xc),Y(cu,`Ruler`,Sc),Y(cu,`Renderer`,wc),Y(cu,`ParserCore`,$c),Y(cu,`StateCore`,Tc),Y(cu,`ParserBlock`,Tl),Y(cu,`StateBlock`,el),Y(cu,`ParserInline`,ru),Y(cu,`StateInline`,El);var lu=new(Hs(cu))({html:!1,linkify:!0,typographer:!1}),uu=0;lu.core.ruler.push(`source_map`,e=>{for(let t of e.tokens)t.map&&t.block&&t.nesting>=0&&t.type!==`inline`&&(t.attrSet(`data-line`,String(t.map[0]+1+uu)),t.attrSet(`data-line-end`,String(t.map[1]+1+uu)))});var du=lu.renderer.rules.fence;lu.renderer.rules.fence=(e,t,n,r,i)=>{let a=e[t],o=a.map?` data-line="${a.map[0]+1+uu}" data-line-end="${a.map[1]+1+uu}"`:``;return a.info.trim()===`mermaid`?`<div class="mermaid"${o}>${lu.utils.escapeHtml(a.content)}</div>`:du(e,t,n,r,i).replace(/^<pre/,`<pre${o}`)};var fu=new Map;function pu(e){let t=e.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/);return t?{meta:t[1].split(`
23
23
  `).map(e=>{let t=e.indexOf(`:`);return t>0?[e.slice(0,t).trim(),e.slice(t+1).trim()]:null}).filter(e=>!!e&&!!e[0]),body:e.slice(t[0].length)}:{meta:null,body:e}}function mu(e){let t=fu.get(e);if(t)return t;let{meta:n,body:r}=pu(e),i=e.length-r.length?e.slice(0,e.length-r.length).split(`
24
- `).length-1:0,a=n?`<div class="frontmatter" data-line="1" data-line-end="${i+1}"><table>${n.map(([e,t])=>`<tr><th>${lu.utils.escapeHtml(e)}</th><td>${lu.utils.escapeHtml(t)}</td></tr>`).join(``)}</table></div>`:``;uu=i;let o=a+lu.render(r).replace(/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,(e,t,n)=>`<a class="wikilink" href="#/docs/${encodeURIComponent(t)}">${n??t}</a>`).replace(/<li([^>]*)>\[( |x|X)\] /g,(e,t,n)=>`<li${t} class="task"><input type="checkbox" disabled${n.trim()?` checked`:``}> `);return fu.size>200&&fu.clear(),fu.set(e,o),o}var hu={theme:`base`,themeVariables:{primaryColor:`#FFFFFF`,primaryBorderColor:`#2B1D14`,primaryTextColor:`#2B1D14`,lineColor:`#9A7A60`,secondaryColor:`#FBE3D0`,tertiaryColor:`#EFE5D8`,fontFamily:`"Source Sans 3", system-ui, sans-serif`,fontSize:`13px`}};function gu(e){let t=[],n=e.newStart,r=!1;for(let i of e.lines)if(i.startsWith(`+`)){let e=t[t.length-1];e&&e[1]===n?e[1]=n+1:t.push([n,n+1]),n++,r=!1}else i.startsWith(`-`)?r||=(t.push([n,n+1]),!0):(n++,r=!1);return t}function _u(e,t){e.querySelectorAll(`[data-chg]`).forEach(e=>{e.removeAttribute(`data-chg`),e.removeAttribute(`data-hunk`),e.classList.remove(`chg-uncommitted`,`chg-commit`)});let n=[...e.querySelectorAll(`[data-line]`)];t.forEach((e,t)=>e.hunks.forEach((r,i)=>{let a=gu(r),o=n.filter(e=>{let t=+e.dataset.line,n=+e.dataset.lineEnd;return a.some(([e,r])=>t<r&&n>e)});for(let n of o)o.some(e=>e!==n&&n.contains(e))||n.dataset.chg!==`uncommitted`&&(n.dataset.chg=e.kind,n.dataset.hunk=`${t}:${i}`,n.classList.add(e.kind===`uncommitted`?`chg-uncommitted`:`chg-commit`))}))}function vu(e,t){if(t.length===0)return e;let n=document.createElement(`div`);return n.innerHTML=e,_u(n,t),n.innerHTML}var yu=(0,P.memo)(function({html:e,className:t,onOver:n,onLeave:r}){let i=(0,P.useRef)(null);return(0,P.useEffect)(()=>{let e=i.current;if(!e)return;let t=e.querySelectorAll(`.mermaid:not([data-processed])`);if(t.length===0)return;let n=!1;return oi(async()=>{let{default:e}=await import(`./mermaid.core-CxtgV-Z8.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])).then(async({default:e})=>{n||(e.initialize({startOnLoad:!1,...hu}),await e.run({nodes:t}))}),()=>{n=!0}},[e]),(0,B.jsx)(`div`,{ref:i,className:`md ${t}`,dangerouslySetInnerHTML:{__html:e},onMouseOver:n,onMouseLeave:r})});function bu({source:e,changes:t=[],className:n=``}){let r=mu(e),[i,a]=(0,P.useState)(null),o=(0,P.useMemo)(()=>vu(r,t),[r,t]),s=(0,P.useRef)(t);s.current=t;let c=(0,P.useCallback)(e=>{let t=e.target.closest(`[data-hunk]`);if(!t){a(e=>e&&null);return}let[n,r]=t.dataset.hunk.split(`:`).map(Number),i=s.current[n],o=i?.hunks[r];if(!i||!o){a(null);return}let c=t.getBoundingClientRect();a({x:Math.min(c.left,window.innerWidth-560),y:c.bottom+6,change:i,hunk:o})},[]),l=(0,P.useCallback)(()=>a(null),[]);return(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(yu,{html:o,className:n,onOver:c,onLeave:l}),i&&(0,B.jsxs)(`div`,{className:`fixed z-50 max-w-[540px] max-h-[50vh] overflow-auto bg-paper border border-sand rounded-kit shadow-panel text-[12px]`,style:{left:i.x,top:i.y},children:[(0,B.jsxs)(`div`,{className:`px-3 py-1.5 border-b border-sand font-mono flex gap-2 items-baseline ${i.change.kind===`uncommitted`?`text-amber`:`text-leaf`}`,children:[(0,B.jsx)(`b`,{children:i.change.kind===`uncommitted`?`uncommitted`:`last commit`}),(0,B.jsx)(`span`,{className:`text-ink3 truncate`,children:i.change.label}),(0,B.jsxs)(`span`,{className:`ml-auto text-tan`,children:[`@@ +`,i.hunk.newStart,`,`,i.hunk.newLines]})]}),(0,B.jsx)(`pre`,{className:`m-0 px-3 py-2 font-mono leading-[1.5] whitespace-pre-wrap`,children:i.hunk.lines.map((e,t)=>(0,B.jsx)(`div`,{className:e.startsWith(`+`)?`bg-moss-wash text-moss`:e.startsWith(`-`)?`bg-brick-wash text-brick line-through decoration-brick/40`:`text-umber`,children:e},t))})]})]})}function xu(e,t){let n=e.trim().replace(/^['"`<(]+|[>'"`)]+$/g,``),r,i=n.match(/:(\d+)$/);i&&(r=Number(i[1]),n=n.slice(0,-i[0].length)),n.startsWith(`[[`)&&n.endsWith(`]]`)&&(n=n.slice(2,-2).split(`|`)[0].trim()),n=n.replace(/\\/g,`/`);let a=n.toLowerCase().lastIndexOf(`/docs/`);a>=0&&(n=n.slice(a+1)),n.startsWith(`./`)&&(n=n.slice(2));let o=n.toLowerCase().startsWith(`docs/`)?n.slice(5):n,s=o.replace(/\.md$/i,``);if(!t.length)return/^[\w./-]+\.md$/i.test(o)?{file:o,line:r}:s&&!s.includes(` `)?{file:`${s}.md`,line:r}:null;let c=t.filter(e=>{let t=e.replace(/\.md$/i,``),n=e.split(`/`).pop()?.replace(/\.md$/i,``);return e===o||e===`${o}.md`||t===s||t.endsWith(`/${s}`)||e.endsWith(`/${o}`)||n===s});return c.length===1?{file:c[0],line:r}:c.includes(o)?{file:o,line:r}:c.includes(`${o}.md`)?{file:`${o}.md`,line:r}:null}var Su=/\[\[([^\]|]+)(?:\|[^\]]+)?\]\](?::\d+)?|(?:(?:~\/|\.{1,2}\/)?(?:[\w.-]+\/)+)?[\w.-]+\.md(?::\d+)?/g;function Cu(e,t,n){return e==null||typeof e==`boolean`||typeof e==`number`?e:typeof e==`string`?wu(e,t,n):Array.isArray(e)?e.map((e,r)=>{let i=Cu(e,t,n);return(0,P.isValidElement)(i)&&i.key==null?(0,P.cloneElement)(i,{key:r}):i}):(0,P.isValidElement)(e)&&e.props.children!=null?(0,P.cloneElement)(e,void 0,Cu(e.props.children,t,n)):e}function wu(e,t,n){if(Su.lastIndex=0,!Su.test(e))return e;Su.lastIndex=0;let r=[],i=0,a,o=0;for(;a=Su.exec(e);){a.index>i&&r.push(e.slice(i,a.index));let s=a[0],c=xu(s,t);c?r.push((0,B.jsx)(`button`,{type:`button`,className:`md-ref`,title:`Open ${c.file}${c.line?`:${c.line}`:``}`,onClick:e=>{e.preventDefault(),e.stopPropagation(),n(c)},children:s},`md-${o++}`)):r.push(s),i=a.index+s.length}return i<e.length&&r.push(e.slice(i)),r.length===1?r[0]:r}var Tu=(0,P.createContext)({files:[],open:()=>{},linkify:e=>e}),Eu=()=>(0,P.useContext)(Tu);function Du({children:e}){let{current:t}=za(),n=ar(),[r,i]=(0,P.useState)(null),a=q(t?`/projects/${t}/docs`:null,3e4).data?.files??[],o=q(r?`/projects/${r.project}/docs/${encodeURIComponent(r.ref.file)}`:null),s=(e,n)=>{let r=n||t;r&&i({ref:e,project:r})};return(0,P.useEffect)(()=>{if(!r)return;let e=e=>{e.key===`Escape`&&(e.stopPropagation(),e.preventDefault(),i(null))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r]),(0,P.useEffect)(()=>{if(!r||!o.data||!r.ref.line)return;let e=setTimeout(()=>document.getElementById(`L${r.ref.line}`)?.scrollIntoView({block:`center`}),80);return()=>clearTimeout(e)},[r,o.data]),(0,B.jsxs)(Tu.Provider,{value:{files:a,open:s,linkify:(e,n)=>Cu(e,a,e=>s(e,n||t))},children:[e,r&&(0,B.jsx)(`div`,{className:`fixed inset-0 z-[70] bg-walnut/40 flex items-start justify-center pt-[8vh] px-4`,onMouseDown:e=>{e.target===e.currentTarget&&i(null)},children:(0,B.jsxs)(`div`,{className:`w-[min(820px,94vw)] max-h-[84vh] bg-paper border border-sand rounded-kit shadow-panel grid grid-rows-[auto_1fr] overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`px-4 py-2.5 border-b border-sand flex items-center gap-2 min-w-0`,children:[(0,B.jsxs)(`span`,{className:`font-mono text-[12px] text-ink3 truncate`,title:o.data?.path??r.ref.file,children:[o.data?.path??`docs/${r.ref.file}`,r.ref.line?`:${r.ref.line}`:``]}),(0,B.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5 shrink-0`,children:[(0,B.jsx)(K,{size:`sm`,onClick:()=>{n(`/docs/${encodeURIComponent(r.ref.file)}${r.ref.line?`?view=source&line=${r.ref.line}`:``}`),i(null)},children:`Open in Docs`}),(0,B.jsx)(K,{size:`sm`,onClick:()=>i(null),children:`Close (Esc)`})]})]}),(0,B.jsxs)(`div`,{className:`overflow-auto px-6 py-4`,children:[o.loading&&(0,B.jsx)(`div`,{className:`text-[13px] text-umber`,children:`loading…`}),o.error&&(0,B.jsxs)(`div`,{className:`text-[13px] text-brick`,children:[`Could not load — not in `,r.project,`’s docs/? `,o.error]}),o.data&&(0,B.jsx)(bu,{source:o.data.source})]})]})})]})}var Ou=[`circle`,`square`,`diamond`,`hexagon`,`triangle`,`shield`,`leaf`,`pentagon`];function ku(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}var Au=e=>Ou[ku(e)%Ou.length];function ju(e,t){let n=t/2,r=t/2-1,i=(e,t=-Math.PI/2)=>Array.from({length:e},(i,a)=>{let o=t+a*2*Math.PI/e;return`${(n+r*Math.cos(o)).toFixed(2)},${(n+r*Math.sin(o)).toFixed(2)}`}).join(` `);switch(e){case`circle`:return(0,B.jsx)(`circle`,{cx:n,cy:n,r});case`square`:return(0,B.jsx)(`rect`,{x:1.5,y:1.5,width:t-3,height:t-3,rx:2});case`diamond`:return(0,B.jsx)(`polygon`,{points:i(4)});case`hexagon`:return(0,B.jsx)(`polygon`,{points:i(6,0)});case`triangle`:return(0,B.jsx)(`polygon`,{points:i(3)});case`pentagon`:return(0,B.jsx)(`polygon`,{points:i(5)});case`shield`:return(0,B.jsx)(`path`,{d:`M${n} 1.5 L${t-1.5} ${t*.3} V${t*.55} Q${t-1.5} ${t-2} ${n} ${t-1.5} Q1.5 ${t-2} 1.5 ${t*.55} V${t*.3} Z`});case`leaf`:return(0,B.jsx)(`path`,{d:`M${n} 1.5 Q${t-1.5} ${t*.35} ${t-2.5} ${t-2} Q${t*.35} ${t-1.5} 1.5 ${n} Q${t*.35} 1.5 ${n} 1.5 Z`})}}function Mu({id:e,role:t,size:n=18,state:r,active:i,className:a=``}){let o=nd(t),s=Au(e),c=r===`dead`?.35:r===`idle`?.7:1,l=e.replace(/[^a-z0-9]/gi,``).slice(0,1).toUpperCase();return(0,B.jsxs)(`span`,{className:`relative inline-flex shrink-0 ${a}`,style:{width:n,height:n},title:`${e}${t?` · ${t}`:``}`,children:[(0,B.jsxs)(`svg`,{width:n,height:n,viewBox:`0 0 ${n} ${n}`,style:{opacity:c},"aria-hidden":!0,children:[(0,B.jsx)(`g`,{fill:o,stroke:o,strokeWidth:`1`,children:ju(s,n)}),(0,B.jsx)(`text`,{x:n/2,y:n/2+n*.22,textAnchor:`middle`,fontSize:n*.55,fontFamily:`JetBrains Mono, monospace`,fontWeight:`700`,fill:`#FCFAF6`,children:l})]}),i&&(0,B.jsx)(`span`,{className:`absolute -right-0.5 -bottom-0.5 w-2 h-2 rounded-full bg-moss ring-2 ring-paper`,children:(0,B.jsx)(`span`,{className:`absolute inset-0 rounded-full bg-moss animate-ping opacity-60`})})]})}var Nu=e=>/done|merged|deployed|complete|closed|✅/i.test(e);function Pu(e){return e?e.workstreams.rows.filter(e=>!(`malformed`in e)).map(e=>e.schema===`workstreams.v1`?{name:e.stream,owner:e.owner,status:e.status,note:e.lastNote??``}:{name:e.lane,owner:e.owner,status:e.state,note:e.currentSlice??``}).map(e=>({...e,done:Nu(e.status)})):[]}var Fu=e=>e.match(/^Task\s+(\d+)\b/i)?.[1]??null;function Iu(e,t,n){if(!n)return null;let r=t.replace(/\./g,`\\.`),i=RegExp(`(^|\\b)(P${r}[-.\\s]?T${n}\\b|Phase\\s*${r}\\b.*\\bT(?:ask)?\\s*${n}\\b)`,`i`);return e.find(e=>i.test(e.name))??null}function Lu(e,t){let n=e.trim().toLowerCase();return t.find(e=>e.toLowerCase()===n)??t.find(e=>n.includes(e.toLowerCase()))??null}function Ru({text:e}){let t=[],n=/(`[^`]+`)|(\*\*[^*]+\*\*)|(\[\[([^\]|]+)(?:\|([^\]]+))?\]\])/g,r=0,i,a=0;for(;i=n.exec(e);)i.index>r&&t.push(e.slice(r,i.index)),i[1]?t.push((0,B.jsx)(`code`,{className:`font-mono text-[.92em] px-1 rounded bg-linen text-walnut`,children:i[1].slice(1,-1)},a++)):i[2]?t.push((0,B.jsx)(`b`,{children:i[2].slice(2,-2)},a++)):t.push((0,B.jsx)(V,{to:`/docs/${encodeURIComponent(i[4])}`,onClick:e=>e.stopPropagation(),className:`text-ember-deep`,children:i[5]??i[4]},a++)),r=i.index+i[0].length;return r<e.length&&t.push(e.slice(r)),(0,B.jsx)(B.Fragment,{children:t})}function zu({stream:e,agents:t,size:n=`sm`}){if(!e)return null;let r=Lu(e.owner,t.map(e=>e.agentId));return(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 shrink-0`,title:`${e.name} · ${e.owner} · ${e.status}${e.note?` · ${e.note}`:``}`,children:[r?(0,B.jsx)(ed,{id:r,bare:!0,size:n}):(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono text-[11px] text-umber`,children:[(0,B.jsx)(Mu,{id:e.owner,size:14,state:`dead`}),e.owner]}),(0,B.jsx)(G,{tone:e.done?`ok`:/block/i.test(e.status)?`bad`:/queued|hold|wait/i.test(e.status)?`warn`:`neutral`,children:e.status.replace(/^[^\w]+/,``).slice(0,16)})]})}function Bu({project:e,phase:t,highlight:n,maxH:r=`46vh`,compact:i=!1}){let{data:a,error:o}=q(`/projects/${e}/phases/${t.id}/tasks`,15e3),s=q(`/projects/${e}/board`,15e3).data,c=q(`/bus/agents`,2e4).data??[],l=Pu(s),[u,d]=(0,P.useState)({});return o?(0,B.jsx)(`div`,{className:`px-3 py-2 text-[13px] text-brick`,children:o}):a?a.sections.length===0?(0,B.jsxs)(`div`,{className:`px-3 py-3 text-[13px] text-umber`,children:[`No tasks yet — run `,(0,B.jsx)(`code`,{children:`/plan-phase`}),` (roadmap → Plan).`]}):(0,B.jsx)(`div`,{className:`grid gap-0 overflow-auto min-w-0`,style:{maxHeight:r},children:a.sections.map(e=>{let r=e.tasks.filter(e=>e.done).length,o=r===e.tasks.length,s=Iu(l,t.n,Fu(e.title)),f=!!n&&!!s&&Lu(s.owner,c.map(e=>e.agentId))===n,p=i&&o&&!u[e.line];return(0,B.jsxs)(`div`,{className:`border-b border-sand last:border-b-0 min-w-0 ${f?`bg-ember/[.04]`:``}`,children:[(0,B.jsxs)(`div`,{className:`sticky top-0 z-[1] px-3 py-1.5 min-w-0 ${f?`bg-ember-wash`:`bg-cream`} ${i?`grid gap-0.5`:`flex items-center gap-2`}`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[i&&o&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>d(t=>({...t,[e.line]:!t[e.line]})),className:`border-0 bg-transparent p-0 cursor-pointer font-mono text-[11px] text-tan w-3 shrink-0`,title:p?`show done sub-steps`:`collapse`,children:p?`▸`:`▾`}),f&&(0,B.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-ember shrink-0`,title:`this agent's task`}),(0,B.jsx)(V,{to:`/docs/${encodeURIComponent(a.file)}?view=source&line=${e.line}`,className:`font-semibold text-[12px] hover:no-underline hover:text-ember-deep truncate ${o?`text-tan`:`text-umber`}`,children:e.title}),(0,B.jsxs)(`span`,{className:`font-mono text-[11px] shrink-0 ${o?`text-leaf`:`text-tan`}`,children:[r,`/`,e.tasks.length,o?` ✓`:``]}),!i&&(0,B.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[(0,B.jsx)(zu,{stream:s,agents:c}),(0,B.jsx)(`span`,{className:`h-1 w-24 rounded-full bg-linen overflow-hidden`,children:(0,B.jsx)(`span`,{className:`block h-full ${o?`bg-leaf`:`bg-ember`}`,style:{width:`${e.tasks.length?r/e.tasks.length*100:0}%`}})})]})]}),i&&s&&(0,B.jsx)(`div`,{className:`flex items-center gap-2 min-w-0 pl-5`,children:(0,B.jsx)(zu,{stream:s,agents:c})})]}),!p&&e.tasks.map(e=>(0,B.jsxs)(V,{to:`/docs/${encodeURIComponent(a.file)}?view=source&line=${e.line}`,className:`grid grid-cols-[var(--spacing-gutter)_minmax(0,1fr)] items-start hover:no-underline hover:bg-linen/60 text-inherit border-t border-sand/60 min-w-0`,style:{paddingLeft:e.depth*12},children:[(0,B.jsx)(`span`,{className:`self-stretch flex items-start justify-center pt-1.5 font-mono text-[11px] border-r border-sand ${e.done?`text-leaf`:`text-tan`}`,children:e.done?`- [x]`:`- [ ]`}),(0,B.jsx)(`span`,{className:`px-3 py-1.5 min-w-0 break-words ${i?`text-[12px] leading-snug`:`text-[13px]`} ${e.done?`text-tan line-through decoration-dust`:``}`,children:(0,B.jsx)(Ru,{text:e.text})})]},e.line))]},e.line)})}):(0,B.jsx)(`div`,{className:`px-3 py-2 font-mono text-[12px] text-tan`,children:`…`})}function Vu({project:e,phase:t,onClose:n}){let{data:r}=q(`/projects/${e}/phases/${t.id}/tasks`,15e3),i=r?.total?Math.round(r.done/r.total*100):0;return(0,B.jsxs)(`div`,{className:`mt-3 border border-sand rounded-kit bg-paper`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b border-sand`,children:[(0,B.jsx)(`b`,{className:`text-[13px]`,children:t.title}),(0,B.jsx)(G,{tone:r?.total&&r.done===r.total?`ok`:`neutral`,children:r?`${r.done}/${r.total} · ${i}%`:`…`}),(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-ink3`,children:r?.file??`no tasks file`}),(0,B.jsxs)(`span`,{className:`ml-auto flex gap-1.5`,children:[r?.file&&(0,B.jsx)(V,{to:`/docs/${encodeURIComponent(r.file)}`,className:`hover:no-underline`,children:(0,B.jsx)(K,{size:`sm`,tone:`ghost`,children:`Open doc`})}),(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:n,children:`✕`})]})]}),(0,B.jsx)(Bu,{project:e,phase:t})]})}var Hu=`/api`,Uu=/\[image: (\S+) · (\S+)\]/g,Wu=e=>`${Hu}/uploads/${encodeURIComponent(e.split(`/`).pop()??``)}`;function Gu(){let[e,t]=(0,P.useState)([]),[n,r]=(0,P.useState)(0),[i,a]=(0,P.useState)(null),o=(0,P.useCallback)(async e=>{let n=e.filter(e=>e.type.startsWith(`image/`));if(n.length){r(e=>e+n.length),a(null);for(let e of n)try{let n=new FormData;n.append(`file`,e,e.name||`paste.png`);let r=await fetch(`${Hu}/uploads`,{method:`POST`,body:n}),i=await r.json();if(!r.ok)throw Error(i.error??`${r.status}`);t(e=>e.some(e=>e.name===i.name)?e:[...e,i])}catch(e){a(e.message)}finally{r(e=>e-1)}}},[]),s=(0,P.useCallback)(e=>{let t=Array.from(e.clipboardData?.files??[]);t.length&&(e.preventDefault(),o(t))},[o]),c=(0,P.useCallback)(e=>{let t=Array.from(e.dataTransfer?.files??[]);t.length&&(e.preventDefault(),o(t))},[o]),l=(0,P.useCallback)(e=>{e.dataTransfer?.types.includes(`Files`)&&e.preventDefault()},[]);return{items:e,busy:n>0,err:i,onPaste:s,onDrop:c,onDragOver:l,remove:e=>t(t=>t.filter(t=>t.name!==e)),clear:()=>t([]),withRefs:t=>e.length?`${t.trim()}${t.trim()?`
24
+ `).length-1:0,a=n?`<div class="frontmatter" data-line="1" data-line-end="${i+1}"><table>${n.map(([e,t])=>`<tr><th>${lu.utils.escapeHtml(e)}</th><td>${lu.utils.escapeHtml(t)}</td></tr>`).join(``)}</table></div>`:``;uu=i;let o=a+lu.render(r).replace(/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,(e,t,n)=>`<a class="wikilink" href="#/docs/${encodeURIComponent(t)}">${n??t}</a>`).replace(/<li([^>]*)>\[( |x|X)\] /g,(e,t,n)=>`<li${t} class="task"><input type="checkbox" disabled${n.trim()?` checked`:``}> `);return fu.size>200&&fu.clear(),fu.set(e,o),o}var hu={theme:`base`,themeVariables:{primaryColor:`#FFFFFF`,primaryBorderColor:`#2B1D14`,primaryTextColor:`#2B1D14`,lineColor:`#9A7A60`,secondaryColor:`#FBE3D0`,tertiaryColor:`#EFE5D8`,fontFamily:`"Source Sans 3", system-ui, sans-serif`,fontSize:`13px`}};function gu(e){let t=[],n=e.newStart,r=!1;for(let i of e.lines)if(i.startsWith(`+`)){let e=t[t.length-1];e&&e[1]===n?e[1]=n+1:t.push([n,n+1]),n++,r=!1}else i.startsWith(`-`)?r||=(t.push([n,n+1]),!0):(n++,r=!1);return t}function _u(e,t){e.querySelectorAll(`[data-chg]`).forEach(e=>{e.removeAttribute(`data-chg`),e.removeAttribute(`data-hunk`),e.classList.remove(`chg-uncommitted`,`chg-commit`)});let n=[...e.querySelectorAll(`[data-line]`)];t.forEach((e,t)=>e.hunks.forEach((r,i)=>{let a=gu(r),o=n.filter(e=>{let t=+e.dataset.line,n=+e.dataset.lineEnd;return a.some(([e,r])=>t<r&&n>e)});for(let n of o)o.some(e=>e!==n&&n.contains(e))||n.dataset.chg!==`uncommitted`&&(n.dataset.chg=e.kind,n.dataset.hunk=`${t}:${i}`,n.classList.add(e.kind===`uncommitted`?`chg-uncommitted`:`chg-commit`))}))}function vu(e,t){if(t.length===0)return e;let n=document.createElement(`div`);return n.innerHTML=e,_u(n,t),n.innerHTML}var yu=(0,P.memo)(function({html:e,className:t,onOver:n,onLeave:r}){let i=(0,P.useRef)(null);return(0,P.useEffect)(()=>{let e=i.current;if(!e)return;let t=e.querySelectorAll(`.mermaid:not([data-processed])`);if(t.length===0)return;let n=!1;return oi(async()=>{let{default:e}=await import(`./mermaid.core-D_f4AlrR.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])).then(async({default:e})=>{n||(e.initialize({startOnLoad:!1,...hu}),await e.run({nodes:t}))}),()=>{n=!0}},[e]),(0,B.jsx)(`div`,{ref:i,className:`md ${t}`,dangerouslySetInnerHTML:{__html:e},onMouseOver:n,onMouseLeave:r})});function bu({source:e,changes:t=[],className:n=``}){let r=mu(e),[i,a]=(0,P.useState)(null),o=(0,P.useMemo)(()=>vu(r,t),[r,t]),s=(0,P.useRef)(t);s.current=t;let c=(0,P.useCallback)(e=>{let t=e.target.closest(`[data-hunk]`);if(!t){a(e=>e&&null);return}let[n,r]=t.dataset.hunk.split(`:`).map(Number),i=s.current[n],o=i?.hunks[r];if(!i||!o){a(null);return}let c=t.getBoundingClientRect();a({x:Math.min(c.left,window.innerWidth-560),y:c.bottom+6,change:i,hunk:o})},[]),l=(0,P.useCallback)(()=>a(null),[]);return(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(yu,{html:o,className:n,onOver:c,onLeave:l}),i&&(0,B.jsxs)(`div`,{className:`fixed z-50 max-w-[540px] max-h-[50vh] overflow-auto bg-paper border border-sand rounded-kit shadow-panel text-[12px]`,style:{left:i.x,top:i.y},children:[(0,B.jsxs)(`div`,{className:`px-3 py-1.5 border-b border-sand font-mono flex gap-2 items-baseline ${i.change.kind===`uncommitted`?`text-amber`:`text-leaf`}`,children:[(0,B.jsx)(`b`,{children:i.change.kind===`uncommitted`?`uncommitted`:`last commit`}),(0,B.jsx)(`span`,{className:`text-ink3 truncate`,children:i.change.label}),(0,B.jsxs)(`span`,{className:`ml-auto text-tan`,children:[`@@ +`,i.hunk.newStart,`,`,i.hunk.newLines]})]}),(0,B.jsx)(`pre`,{className:`m-0 px-3 py-2 font-mono leading-[1.5] whitespace-pre-wrap`,children:i.hunk.lines.map((e,t)=>(0,B.jsx)(`div`,{className:e.startsWith(`+`)?`bg-moss-wash text-moss`:e.startsWith(`-`)?`bg-brick-wash text-brick line-through decoration-brick/40`:`text-umber`,children:e},t))})]})]})}function xu(e,t){let n=e.trim().replace(/^['"`<(]+|[>'"`)]+$/g,``),r,i=n.match(/:(\d+)$/);i&&(r=Number(i[1]),n=n.slice(0,-i[0].length)),n.startsWith(`[[`)&&n.endsWith(`]]`)&&(n=n.slice(2,-2).split(`|`)[0].trim()),n=n.replace(/\\/g,`/`);let a=n.toLowerCase().lastIndexOf(`/docs/`);a>=0&&(n=n.slice(a+1)),n.startsWith(`./`)&&(n=n.slice(2));let o=n.toLowerCase().startsWith(`docs/`)?n.slice(5):n,s=o.replace(/\.md$/i,``);if(!t.length)return/^[\w./-]+\.md$/i.test(o)?{file:o,line:r}:s&&!s.includes(` `)?{file:`${s}.md`,line:r}:null;let c=t.filter(e=>{let t=e.replace(/\.md$/i,``),n=e.split(`/`).pop()?.replace(/\.md$/i,``);return e===o||e===`${o}.md`||t===s||t.endsWith(`/${s}`)||e.endsWith(`/${o}`)||n===s});return c.length===1?{file:c[0],line:r}:c.includes(o)?{file:o,line:r}:c.includes(`${o}.md`)?{file:`${o}.md`,line:r}:null}var Su=/\[\[([^\]|]+)(?:\|[^\]]+)?\]\](?::\d+)?|(?:(?:~\/|\.{1,2}\/)?(?:[\w.-]+\/)+)?[\w.-]+\.md(?::\d+)?/g;function Cu(e,t,n){return e==null||typeof e==`boolean`||typeof e==`number`?e:typeof e==`string`?wu(e,t,n):Array.isArray(e)?e.map((e,r)=>{let i=Cu(e,t,n);return(0,P.isValidElement)(i)&&i.key==null?(0,P.cloneElement)(i,{key:r}):i}):(0,P.isValidElement)(e)&&e.props.children!=null?(0,P.cloneElement)(e,void 0,Cu(e.props.children,t,n)):e}function wu(e,t,n){if(Su.lastIndex=0,!Su.test(e))return e;Su.lastIndex=0;let r=[],i=0,a,o=0;for(;a=Su.exec(e);){a.index>i&&r.push(e.slice(i,a.index));let s=a[0],c=xu(s,t);c?r.push((0,B.jsx)(`button`,{type:`button`,className:`md-ref`,title:`Open ${c.file}${c.line?`:${c.line}`:``}`,onClick:e=>{e.preventDefault(),e.stopPropagation(),n(c)},children:s},`md-${o++}`)):r.push(s),i=a.index+s.length}return i<e.length&&r.push(e.slice(i)),r.length===1?r[0]:r}var Tu=(0,P.createContext)({files:[],open:()=>{},linkify:e=>e}),Eu=()=>(0,P.useContext)(Tu);function Du({children:e}){let{current:t}=za(),n=ar(),[r,i]=(0,P.useState)(null),a=q(t?`/projects/${t}/docs`:null,3e4).data?.files??[],o=q(r?`/projects/${r.project}/docs/${encodeURIComponent(r.ref.file)}`:null),s=(e,n)=>{let r=n||t;r&&i({ref:e,project:r})};return(0,P.useEffect)(()=>{if(!r)return;let e=e=>{e.key===`Escape`&&(e.stopPropagation(),e.preventDefault(),i(null))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r]),(0,P.useEffect)(()=>{if(!r||!o.data||!r.ref.line)return;let e=setTimeout(()=>document.getElementById(`L${r.ref.line}`)?.scrollIntoView({block:`center`}),80);return()=>clearTimeout(e)},[r,o.data]),(0,B.jsxs)(Tu.Provider,{value:{files:a,open:s,linkify:(e,n)=>Cu(e,a,e=>s(e,n||t))},children:[e,r&&(0,B.jsx)(`div`,{className:`fixed inset-0 z-[70] bg-walnut/40 flex items-start justify-center pt-[8vh] px-4`,onMouseDown:e=>{e.target===e.currentTarget&&i(null)},children:(0,B.jsxs)(`div`,{className:`w-[min(820px,94vw)] max-h-[84vh] bg-paper border border-sand rounded-kit shadow-panel grid grid-rows-[auto_1fr] overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`px-4 py-2.5 border-b border-sand flex items-center gap-2 min-w-0`,children:[(0,B.jsxs)(`span`,{className:`font-mono text-[12px] text-ink3 truncate`,title:o.data?.path??r.ref.file,children:[o.data?.path??`docs/${r.ref.file}`,r.ref.line?`:${r.ref.line}`:``]}),(0,B.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5 shrink-0`,children:[(0,B.jsx)(K,{size:`sm`,onClick:()=>{n(`/docs/${encodeURIComponent(r.ref.file)}${r.ref.line?`?view=source&line=${r.ref.line}`:``}`),i(null)},children:`Open in Docs`}),(0,B.jsx)(K,{size:`sm`,onClick:()=>i(null),children:`Close (Esc)`})]})]}),(0,B.jsxs)(`div`,{className:`overflow-auto px-6 py-4`,children:[o.loading&&(0,B.jsx)(`div`,{className:`text-[13px] text-umber`,children:`loading…`}),o.error&&(0,B.jsxs)(`div`,{className:`text-[13px] text-brick`,children:[`Could not load — not in `,r.project,`’s docs/? `,o.error]}),o.data&&(0,B.jsx)(bu,{source:o.data.source})]})]})})]})}var Ou=[`circle`,`square`,`diamond`,`hexagon`,`triangle`,`shield`,`leaf`,`pentagon`];function ku(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}var Au=e=>Ou[ku(e)%Ou.length];function ju(e,t){let n=t/2,r=t/2-1,i=(e,t=-Math.PI/2)=>Array.from({length:e},(i,a)=>{let o=t+a*2*Math.PI/e;return`${(n+r*Math.cos(o)).toFixed(2)},${(n+r*Math.sin(o)).toFixed(2)}`}).join(` `);switch(e){case`circle`:return(0,B.jsx)(`circle`,{cx:n,cy:n,r});case`square`:return(0,B.jsx)(`rect`,{x:1.5,y:1.5,width:t-3,height:t-3,rx:2});case`diamond`:return(0,B.jsx)(`polygon`,{points:i(4)});case`hexagon`:return(0,B.jsx)(`polygon`,{points:i(6,0)});case`triangle`:return(0,B.jsx)(`polygon`,{points:i(3)});case`pentagon`:return(0,B.jsx)(`polygon`,{points:i(5)});case`shield`:return(0,B.jsx)(`path`,{d:`M${n} 1.5 L${t-1.5} ${t*.3} V${t*.55} Q${t-1.5} ${t-2} ${n} ${t-1.5} Q1.5 ${t-2} 1.5 ${t*.55} V${t*.3} Z`});case`leaf`:return(0,B.jsx)(`path`,{d:`M${n} 1.5 Q${t-1.5} ${t*.35} ${t-2.5} ${t-2} Q${t*.35} ${t-1.5} 1.5 ${n} Q${t*.35} 1.5 ${n} 1.5 Z`})}}function Mu({id:e,role:t,size:n=18,state:r,active:i,className:a=``}){let o=nd(t),s=Au(e),c=r===`dead`?.35:r===`idle`?.7:1,l=e.replace(/[^a-z0-9]/gi,``).slice(0,1).toUpperCase();return(0,B.jsxs)(`span`,{className:`relative inline-flex shrink-0 ${a}`,style:{width:n,height:n},title:`${e}${t?` · ${t}`:``}`,children:[(0,B.jsxs)(`svg`,{width:n,height:n,viewBox:`0 0 ${n} ${n}`,style:{opacity:c},"aria-hidden":!0,children:[(0,B.jsx)(`g`,{fill:o,stroke:o,strokeWidth:`1`,children:ju(s,n)}),(0,B.jsx)(`text`,{x:n/2,y:n/2+n*.22,textAnchor:`middle`,fontSize:n*.55,fontFamily:`JetBrains Mono, monospace`,fontWeight:`700`,fill:`#FCFAF6`,children:l})]}),i&&(0,B.jsx)(`span`,{className:`absolute -right-0.5 -bottom-0.5 w-2 h-2 rounded-full bg-moss ring-2 ring-paper`,children:(0,B.jsx)(`span`,{className:`absolute inset-0 rounded-full bg-moss animate-ping opacity-60`})})]})}var Nu=e=>/done|merged|deployed|complete|closed|✅/i.test(e);function Pu(e){return e?e.workstreams.rows.filter(e=>!(`malformed`in e)).map(e=>e.schema===`workstreams.v1`?{name:e.stream,owner:e.owner,status:e.status,note:e.lastNote??``}:{name:e.lane,owner:e.owner,status:e.state,note:e.currentSlice??``}).map(e=>({...e,done:Nu(e.status)})):[]}var Fu=e=>e.match(/^Task\s+(\d+)\b/i)?.[1]??null;function Iu(e,t,n){if(!n)return null;let r=t.replace(/\./g,`\\.`),i=RegExp(`(^|\\b)(P${r}[-.\\s]?T${n}\\b|Phase\\s*${r}\\b.*\\bT(?:ask)?\\s*${n}\\b)`,`i`);return e.find(e=>i.test(e.name))??null}function Lu(e,t){let n=e.trim().toLowerCase();return t.find(e=>e.toLowerCase()===n)??t.find(e=>n.includes(e.toLowerCase()))??null}function Ru({text:e}){let t=[],n=/(`[^`]+`)|(\*\*[^*]+\*\*)|(\[\[([^\]|]+)(?:\|([^\]]+))?\]\])/g,r=0,i,a=0;for(;i=n.exec(e);)i.index>r&&t.push(e.slice(r,i.index)),i[1]?t.push((0,B.jsx)(`code`,{className:`font-mono text-[.92em] px-1 rounded bg-linen text-walnut`,children:i[1].slice(1,-1)},a++)):i[2]?t.push((0,B.jsx)(`b`,{children:i[2].slice(2,-2)},a++)):t.push((0,B.jsx)(V,{to:`/docs/${encodeURIComponent(i[4])}`,onClick:e=>e.stopPropagation(),className:`text-ember-deep`,children:i[5]??i[4]},a++)),r=i.index+i[0].length;return r<e.length&&t.push(e.slice(r)),(0,B.jsx)(B.Fragment,{children:t})}function zu({stream:e,agents:t,size:n=`sm`}){if(!e)return null;let r=Lu(e.owner,t.map(e=>e.agentId));return(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 shrink-0`,title:`${e.name} · ${e.owner} · ${e.status}${e.note?` · ${e.note}`:``}`,children:[r?(0,B.jsx)(ed,{id:r,bare:!0,size:n}):(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono text-[11px] text-umber`,children:[(0,B.jsx)(Mu,{id:e.owner,size:14,state:`dead`}),e.owner]}),(0,B.jsx)(G,{tone:e.done?`ok`:/block/i.test(e.status)?`bad`:/queued|hold|wait/i.test(e.status)?`warn`:`neutral`,children:e.status.replace(/^[^\w]+/,``).slice(0,16)})]})}function Bu({project:e,phase:t,highlight:n,maxH:r=`46vh`,compact:i=!1}){let{data:a,error:o}=q(`/projects/${e}/phases/${t.id}/tasks`,15e3),s=q(`/projects/${e}/board`,15e3).data,c=q(`/bus/agents`,2e4).data??[],l=Pu(s),[u,d]=(0,P.useState)({});return o?(0,B.jsx)(`div`,{className:`px-3 py-2 text-[13px] text-brick`,children:o}):a?a.sections.length===0?(0,B.jsxs)(`div`,{className:`px-3 py-3 text-[13px] text-umber`,children:[`No tasks yet — run `,(0,B.jsx)(`code`,{children:`/plan-phase`}),` (roadmap → Plan).`]}):(0,B.jsx)(`div`,{className:`grid gap-0 overflow-auto overscroll-contain min-w-0`,style:{maxHeight:r},children:a.sections.map(e=>{let r=e.tasks.filter(e=>e.done).length,o=r===e.tasks.length,s=Iu(l,t.n,Fu(e.title)),f=!!n&&!!s&&Lu(s.owner,c.map(e=>e.agentId))===n,p=i&&o&&!u[e.line];return(0,B.jsxs)(`div`,{className:`border-b border-sand last:border-b-0 min-w-0 ${f?`bg-ember/[.04]`:``}`,children:[(0,B.jsxs)(`div`,{className:`sticky top-0 z-[1] px-3 py-1.5 min-w-0 ${f?`bg-ember-wash`:`bg-cream`} ${i?`grid gap-0.5`:`flex items-center gap-2`}`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[i&&o&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>d(t=>({...t,[e.line]:!t[e.line]})),className:`border-0 bg-transparent p-0 cursor-pointer font-mono text-[11px] text-tan w-3 shrink-0`,title:p?`show done sub-steps`:`collapse`,children:p?`▸`:`▾`}),f&&(0,B.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-ember shrink-0`,title:`this agent's task`}),(0,B.jsx)(V,{to:`/docs/${encodeURIComponent(a.file)}?view=source&line=${e.line}`,className:`font-semibold text-[12px] hover:no-underline hover:text-ember-deep truncate ${o?`text-tan`:`text-umber`}`,children:e.title}),(0,B.jsxs)(`span`,{className:`font-mono text-[11px] shrink-0 ${o?`text-leaf`:`text-tan`}`,children:[r,`/`,e.tasks.length,o?` ✓`:``]}),!i&&(0,B.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[(0,B.jsx)(zu,{stream:s,agents:c}),(0,B.jsx)(`span`,{className:`h-1 w-24 rounded-full bg-linen overflow-hidden`,children:(0,B.jsx)(`span`,{className:`block h-full ${o?`bg-leaf`:`bg-ember`}`,style:{width:`${e.tasks.length?r/e.tasks.length*100:0}%`}})})]})]}),i&&s&&(0,B.jsx)(`div`,{className:`flex items-center gap-2 min-w-0 pl-5`,children:(0,B.jsx)(zu,{stream:s,agents:c})})]}),!p&&e.tasks.map(e=>(0,B.jsxs)(V,{to:`/docs/${encodeURIComponent(a.file)}?view=source&line=${e.line}`,className:`grid grid-cols-[var(--spacing-gutter)_minmax(0,1fr)] items-start hover:no-underline hover:bg-linen/60 text-inherit border-t border-sand/60 min-w-0`,style:{paddingLeft:e.depth*12},children:[(0,B.jsx)(`span`,{className:`self-stretch flex items-start justify-center pt-1.5 font-mono text-[11px] border-r border-sand ${e.done?`text-leaf`:`text-tan`}`,children:e.done?`- [x]`:`- [ ]`}),(0,B.jsx)(`span`,{className:`px-3 py-1.5 min-w-0 break-words ${i?`text-[12px] leading-snug`:`text-[13px]`} ${e.done?`text-tan line-through decoration-dust`:``}`,children:(0,B.jsx)(Ru,{text:e.text})})]},e.line))]},e.line)})}):(0,B.jsx)(`div`,{className:`px-3 py-2 font-mono text-[12px] text-tan`,children:`…`})}function Vu({project:e,phase:t,onClose:n}){let{data:r}=q(`/projects/${e}/phases/${t.id}/tasks`,15e3),i=r?.total?Math.round(r.done/r.total*100):0;return(0,B.jsxs)(`div`,{className:`mt-3 border border-sand rounded-kit bg-paper`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b border-sand`,children:[(0,B.jsx)(`b`,{className:`text-[13px]`,children:t.title}),(0,B.jsx)(G,{tone:r?.total&&r.done===r.total?`ok`:`neutral`,children:r?`${r.done}/${r.total} · ${i}%`:`…`}),(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-ink3`,children:r?.file??`no tasks file`}),(0,B.jsxs)(`span`,{className:`ml-auto flex gap-1.5`,children:[r?.file&&(0,B.jsx)(V,{to:`/docs/${encodeURIComponent(r.file)}`,className:`hover:no-underline`,children:(0,B.jsx)(K,{size:`sm`,tone:`ghost`,children:`Open doc`})}),(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:n,children:`✕`})]})]}),(0,B.jsx)(Bu,{project:e,phase:t})]})}var Hu=`/api`,Uu=/\[image: (\S+) · (\S+)\]/g,Wu=e=>`${Hu}/uploads/${encodeURIComponent(e.split(`/`).pop()??``)}`;function Gu(){let[e,t]=(0,P.useState)([]),[n,r]=(0,P.useState)(0),[i,a]=(0,P.useState)(null),o=(0,P.useCallback)(async e=>{let n=e.filter(e=>e.type.startsWith(`image/`));if(n.length){r(e=>e+n.length),a(null);for(let e of n)try{let n=new FormData;n.append(`file`,e,e.name||`paste.png`);let r=await fetch(`${Hu}/uploads`,{method:`POST`,body:n}),i=await r.json();if(!r.ok)throw Error(i.error??`${r.status}`);t(e=>e.some(e=>e.name===i.name)?e:[...e,i])}catch(e){a(e.message)}finally{r(e=>e-1)}}},[]),s=(0,P.useCallback)(e=>{let t=Array.from(e.clipboardData?.files??[]);t.length&&(e.preventDefault(),o(t))},[o]),c=(0,P.useCallback)(e=>{let t=Array.from(e.dataTransfer?.files??[]);t.length&&(e.preventDefault(),o(t))},[o]),l=(0,P.useCallback)(e=>{e.dataTransfer?.types.includes(`Files`)&&e.preventDefault()},[]);return{items:e,busy:n>0,err:i,onPaste:s,onDrop:c,onDragOver:l,remove:e=>t(t=>t.filter(t=>t.name!==e)),clear:()=>t([]),withRefs:t=>e.length?`${t.trim()}${t.trim()?`
25
25
  `:``}${e.map(e=>e.ref).join(`
26
- `)}`:t,hasContent:t=>!!t.trim()||e.length>0}}function Ku({a:e}){return!e.items.length&&!e.busy&&!e.err?null:(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[e.items.map(t=>(0,B.jsxs)(`span`,{className:`relative inline-flex items-center gap-1 border border-sand rounded-kit bg-cream/60 p-0.5`,title:`${t.path}\n${t.url}`,children:[(0,B.jsx)(`img`,{src:Wu(t.name),alt:t.name,className:`h-10 w-auto max-w-[120px] rounded object-cover`}),(0,B.jsxs)(`span`,{className:`font-mono text-[10px] text-ink3 pr-1`,children:[Math.round(t.bytes/1024),` KB`]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>e.remove(t.name),className:`absolute -top-1.5 -right-1.5 w-4 h-4 rounded-full bg-walnut text-paper text-[10px] leading-none border-0 cursor-pointer`,title:`remove`,children:`×`})]},t.name)),e.busy&&(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-ink3`,children:`uploading…`}),e.err&&(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-brick`,children:e.err})]})}function qu({text:e}){let t=[],n=0,r,i=0;for(Uu.lastIndex=0;r=Uu.exec(e);){r.index>n&&t.push(e.slice(n,r.index));let[,a,o]=r;t.push((0,B.jsx)(`a`,{href:Wu(o),target:`_blank`,rel:`noreferrer`,className:`inline-block align-top my-1 mr-1 border border-sand rounded-kit p-0.5 bg-cream/60 hover:no-underline`,title:a,children:(0,B.jsx)(`img`,{src:Wu(o),alt:a.split(`/`).pop(),className:`max-h-40 max-w-[280px] rounded object-contain`,loading:`lazy`})},i++)),n=r.index+r[0].length}return n<e.length&&t.push(e.slice(n)),(0,B.jsx)(B.Fragment,{children:t})}var Ju=`/api`;function Yu({agentId:e,onClose:t}){let{linkify:n}=Eu(),[r,i]=(0,P.useState)(null),[a,o]=(0,P.useState)(null),[s,c]=(0,P.useState)(200),[l,u]=(0,P.useState)(!0),[d,f]=(0,P.useState)(!0),[p,m]=(0,P.useState)(()=>localStorage.getItem(`groundwork-console.pane.tasks`)!==`0`),h=e=>{m(e),localStorage.setItem(`groundwork-console.pane.tasks`,e?`1`:`0`)},{current:g,projects:_}=za(),v=q(`/admin/bus-writes`,1e4).data?.enabled??!1,y=(q(`/bus/agents`,3e4).data??[]).find(t=>t.agentId===e),b=y?.project&&_.some(e=>e.name===y.project||e.room===y.project)?_.find(e=>e.name===y.project||e.room===y.project).name:g,[x,S]=(0,P.useState)(``),[C,w]=(0,P.useState)(null),T=Gu(),E=async()=>{if(T.hasContent(x)){w(`sending`);try{let t=await Fa(`/actions/send`,{as:`david`,to:e,text:T.withRefs(x)});w(t.status===`ok`?`sent — lands in the pane via tmux-push`:t.error??t.log?.slice(-1)[0]??`failed`),t.status===`ok`&&(S(``),T.clear())}catch(e){w(e.message)}}},D=(0,P.useRef)(null);return(0,P.useEffect)(()=>{let t=!0,n=async()=>{try{let n=await fetch(`${Ju}/bus/agents/${encodeURIComponent(e)}/pane?lines=${s}${d?`&colors=1`:``}`),r=await n.json();if(!t)return;if(!n.ok){o(r.error??`${n.status}`);return}o(null),i(r)}catch(e){t&&o(e.message)}};n();let r=setInterval(n,3e3);return()=>{t=!1,clearInterval(r)}},[e,s,d]),(0,P.useEffect)(()=>{l&&D.current&&(D.current.scrollTop=D.current.scrollHeight)},[r,l]),(0,P.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]),(0,B.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-walnut/30 flex justify-end`,onMouseDown:e=>{e.target===e.currentTarget&&t()},children:(0,B.jsxs)(`div`,{className:`${p?`w-[min(1340px,calc(100vw-16px))]`:`w-[min(920px,92vw)]`} h-full max-h-screen bg-paper border-l border-sand shadow-panel grid grid-rows-[auto_minmax(0,1fr)] whitespace-normal text-left transition-[width] duration-200`,style:{borderTop:`4px solid ${nd(y?.role)}`},children:[(0,B.jsxs)(`div`,{className:`px-4 py-2.5 border-b border-sand flex items-center gap-2`,children:[(0,B.jsx)(Mu,{id:e,role:y?.role,size:22,state:y?.liveness,active:y?.active}),(0,B.jsx)(`span`,{className:`font-display font-bold text-[16px] text-umber`,children:e}),y?.role&&(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.06em]`,style:{color:nd(y.role)},children:y.role}),r&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{className:`font-mono text-[12px] text-ink3`,children:[r.pane,` · `,r.command]}),r.active?(0,B.jsx)(G,{tone:`ok`,children:`active`}):(0,B.jsx)(G,{tone:`outline`,children:`quiet`}),(0,B.jsxs)(`span`,{className:`font-mono text-[11px] text-tan`,children:[r.lines,` lines · `,new Date(r.capturedAt).toLocaleTimeString()]})]}),(0,B.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5`,children:[(0,B.jsx)(`span`,{className:`inline-flex border border-dust rounded-kit overflow-hidden`,children:[[`colors`,d,()=>f(e=>!e)],[`tasks`,p,()=>h(!p)],[`follow`,l,()=>u(e=>!e)]].map(([e,t,n])=>(0,B.jsx)(`button`,{type:`button`,onClick:n,"aria-pressed":t,className:`px-2 py-[3px] text-[11px] font-mono border-0 cursor-pointer ${t?`bg-walnut text-paper`:`bg-paper text-umber`}`,children:e},e))}),(0,B.jsx)(`select`,{value:s,onChange:e=>c(Number(e.target.value)),className:`font-mono text-[11px] px-1.5 py-1 border border-dust rounded bg-paper text-umber`,children:[100,200,500,1e3,2e3].map(e=>(0,B.jsxs)(`option`,{value:e,children:[e,` lines`]},e))}),(0,B.jsx)(K,{size:`sm`,onClick:t,children:`Close (Esc)`})]})]}),(0,B.jsxs)(`div`,{className:`min-h-0 grid ${p?`grid-cols-[minmax(0,1fr)_minmax(300px,380px)]`:`grid-cols-1`}`,children:[(0,B.jsxs)(`div`,{className:`min-h-0 grid grid-rows-[minmax(0,1fr)_auto]`,children:[(0,B.jsx)(`pre`,{ref:D,className:`m-0 px-4 py-3 min-h-0 overflow-auto font-mono text-[12px] leading-[1.45] whitespace-pre-wrap break-words pane-dark`,children:a?(0,B.jsx)(`span`,{className:`text-brick`,children:a}):r?n(d&&r.ansi?uo(r.ansi):r.text):`capturing…`}),(0,B.jsxs)(`div`,{className:`px-4 py-2 border-t border-sand grid gap-1.5`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] gap-2 items-center`,children:[(0,B.jsx)(`input`,{value:x,onChange:e=>S(e.target.value),onKeyDown:e=>{e.key===`Enter`&&v&&E()},onPaste:T.onPaste,onDrop:T.onDrop,onDragOver:T.onDragOver,disabled:!v,placeholder:v?`DM ${e} as david — paste or drop an image, delivered by its tmux-push into this pane`:`DM needs bus writes on (header badge)`,className:`text-[13px] px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut`}),(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:E,disabled:!v||!T.hasContent(x)||T.busy||C===`sending`,children:`Send DM`})]}),(0,B.jsx)(Ku,{a:T}),(0,B.jsxs)(`div`,{className:`font-mono text-[11px] text-tan`,children:[`read-only `,(0,B.jsx)(`code`,{children:`tmux capture-pane`}),` · 3 s refresh · the console never types into panes — the DM goes through the bus (a Run) and the agent's own pusher types it`,C&&C!==`sending`?(0,B.jsxs)(`span`,{className:/^sent/.test(C)?` text-leaf`:` text-brick`,children:[` · `,C]}):null]})]})]}),p&&(0,B.jsx)(Xu,{project:b,agentId:e})]})]})})}function Xu({project:e,agentId:t}){let n=q(e?`/projects/${e}/board`:null,15e3).data,r=q(`/bus/agents`,2e4).data??[],i=n?.phases.find(e=>e.state===`ongoing`)??n?.phases.find(e=>e.state===`planned`),a=Pu(n).filter(e=>!e.done&&Lu(e.owner,r.map(e=>e.agentId))===t);return(0,B.jsxs)(`aside`,{className:`min-h-0 min-w-0 overflow-hidden border-l border-sand bg-cream/40 grid grid-rows-[auto_auto_minmax(0,1fr)]`,children:[(0,B.jsxs)(`div`,{className:`px-3 py-2 border-b border-sand flex items-center gap-2 flex-wrap`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[.1em] text-tan`,children:`now`}),i?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(V,{to:`/board`,className:`font-semibold text-[13px] text-walnut hover:text-ember-deep hover:no-underline`,children:i.title}),(0,B.jsx)(G,{tone:i.state===`ongoing`?`david`:`neutral`,children:i.state}),(0,B.jsxs)(`span`,{className:`font-mono text-[11px] text-ink3`,children:[i.done,`/`,i.total]})]}):(0,B.jsx)(`span`,{className:`text-[13px] text-umber`,children:e?`no phase in flight`:`no project selected`})]}),(0,B.jsxs)(`div`,{className:`px-3 py-2 border-b border-sand grid gap-1`,children:[(0,B.jsxs)(`span`,{className:`font-mono text-[10px] uppercase tracking-[.1em] text-tan`,children:[t,` is on`]}),a.length===0&&(0,B.jsx)(`span`,{className:`text-[12px] text-umber`,children:`no active stream owned by this agent`}),a.map(e=>(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px]`,children:[(0,B.jsx)(`span`,{className:`font-mono text-umber truncate`,title:e.note,children:e.name}),(0,B.jsx)(`span`,{className:`ml-auto`,children:(0,B.jsx)(zu,{stream:e,agents:r})})]},e.name))]}),i&&e?(0,B.jsx)(Bu,{project:e,phase:i,highlight:t,maxH:`100%`,compact:!0}):(0,B.jsx)(`div`,{className:`px-3 py-3 text-[12px] text-umber`,children:`Pick a project (header) to see its phase tasks.`})]})}var Zu=`/api`,Qu=e=>{if(!e)return`—`;let t=Math.floor((Date.now()-e)/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:`${Math.floor(t/3600)}h`};function $u({agentId:e,lines:t=4,className:n=``,label:r}){let[i,a]=(0,P.useState)(null),[o,s]=(0,P.useState)(null),[c,l]=(0,P.useState)(!1);(0,P.useEffect)(()=>{let n=!0,r=async()=>{try{let r=await fetch(`${Zu}/bus/agents/${encodeURIComponent(e)}/pane?lines=${t+6}&colors=1`),i=await r.json();if(!n)return;if(!r.ok){s(i.error??String(r.status));return}s(null),a(i)}catch(e){n&&s(e.message)}};r();let i=setInterval(r,3e3);return()=>{n=!1,clearInterval(i)}},[e,t]);let u=e=>e.split(`
26
+ `)}`:t,hasContent:t=>!!t.trim()||e.length>0}}function Ku({a:e}){return!e.items.length&&!e.busy&&!e.err?null:(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[e.items.map(t=>(0,B.jsxs)(`span`,{className:`relative inline-flex items-center gap-1 border border-sand rounded-kit bg-cream/60 p-0.5`,title:`${t.path}\n${t.url}`,children:[(0,B.jsx)(`img`,{src:Wu(t.name),alt:t.name,className:`h-10 w-auto max-w-[120px] rounded object-cover`}),(0,B.jsxs)(`span`,{className:`font-mono text-[10px] text-ink3 pr-1`,children:[Math.round(t.bytes/1024),` KB`]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>e.remove(t.name),className:`absolute -top-1.5 -right-1.5 w-4 h-4 rounded-full bg-walnut text-paper text-[10px] leading-none border-0 cursor-pointer`,title:`remove`,children:`×`})]},t.name)),e.busy&&(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-ink3`,children:`uploading…`}),e.err&&(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-brick`,children:e.err})]})}function qu({text:e}){let t=[],n=0,r,i=0;for(Uu.lastIndex=0;r=Uu.exec(e);){r.index>n&&t.push(e.slice(n,r.index));let[,a,o]=r;t.push((0,B.jsx)(`a`,{href:Wu(o),target:`_blank`,rel:`noreferrer`,className:`inline-block align-top my-1 mr-1 border border-sand rounded-kit p-0.5 bg-cream/60 hover:no-underline`,title:a,children:(0,B.jsx)(`img`,{src:Wu(o),alt:a.split(`/`).pop(),className:`max-h-40 max-w-[280px] rounded object-contain`,loading:`lazy`})},i++)),n=r.index+r[0].length}return n<e.length&&t.push(e.slice(n)),(0,B.jsx)(B.Fragment,{children:t})}var Ju=`/api`;function Yu({agentId:e,onClose:t}){let{linkify:n}=Eu(),[r,i]=(0,P.useState)(null),[a,o]=(0,P.useState)(null),[s,c]=(0,P.useState)(200),[l,u]=(0,P.useState)(!0),[d,f]=(0,P.useState)(!0),[p,m]=(0,P.useState)(()=>localStorage.getItem(`groundwork-console.pane.tasks`)!==`0`),h=e=>{m(e),localStorage.setItem(`groundwork-console.pane.tasks`,e?`1`:`0`)},{current:g,projects:_}=za(),v=q(`/admin/bus-writes`,1e4).data?.enabled??!1,y=(q(`/bus/agents`,3e4).data??[]).find(t=>t.agentId===e),b=y?.project&&_.some(e=>e.name===y.project||e.room===y.project)?_.find(e=>e.name===y.project||e.room===y.project).name:g,[x,S]=(0,P.useState)(``),[C,w]=(0,P.useState)(null),T=Gu(),E=async()=>{if(T.hasContent(x)){w(`sending`);try{let t=await Fa(`/actions/send`,{as:`david`,to:e,text:T.withRefs(x)});w(t.status===`ok`?`sent — lands in the pane via tmux-push`:t.error??t.log?.slice(-1)[0]??`failed`),t.status===`ok`&&(S(``),T.clear())}catch(e){w(e.message)}}},D=(0,P.useRef)(null);return(0,P.useEffect)(()=>{let t=!0,n=async()=>{try{let n=await fetch(`${Ju}/bus/agents/${encodeURIComponent(e)}/pane?lines=${s}${d?`&colors=1`:``}`),r=await n.json();if(!t)return;if(!n.ok){o(r.error??`${n.status}`);return}o(null),i(r)}catch(e){t&&o(e.message)}};n();let r=setInterval(n,3e3);return()=>{t=!1,clearInterval(r)}},[e,s,d]),(0,P.useEffect)(()=>{l&&D.current&&(D.current.scrollTop=D.current.scrollHeight)},[r,l]),(0,P.useEffect)(()=>{let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}},[]),(0,P.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]),(0,B.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-walnut/30 flex justify-end`,onMouseDown:e=>{e.target===e.currentTarget&&t()},children:(0,B.jsxs)(`div`,{className:`${p?`w-[min(1340px,calc(100vw-16px))]`:`w-[min(920px,92vw)]`} h-full max-h-screen bg-paper border-l border-sand shadow-panel grid grid-rows-[auto_minmax(0,1fr)] whitespace-normal text-left transition-[width] duration-200`,style:{borderTop:`4px solid ${nd(y?.role)}`},children:[(0,B.jsxs)(`div`,{className:`px-4 py-2.5 border-b border-sand flex items-center gap-2`,children:[(0,B.jsx)(Mu,{id:e,role:y?.role,size:22,state:y?.liveness,active:y?.active}),(0,B.jsx)(`span`,{className:`font-display font-bold text-[16px] text-umber`,children:e}),y?.role&&(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.06em]`,style:{color:nd(y.role)},children:y.role}),r&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{className:`font-mono text-[12px] text-ink3`,children:[r.pane,` · `,r.command]}),r.active?(0,B.jsx)(G,{tone:`ok`,children:`active`}):(0,B.jsx)(G,{tone:`outline`,children:`quiet`}),(0,B.jsxs)(`span`,{className:`font-mono text-[11px] text-tan`,children:[r.lines,` lines · `,new Date(r.capturedAt).toLocaleTimeString()]})]}),(0,B.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5`,children:[(0,B.jsx)(`span`,{className:`inline-flex border border-dust rounded-kit overflow-hidden`,children:[[`colors`,d,()=>f(e=>!e)],[`tasks`,p,()=>h(!p)],[`follow`,l,()=>u(e=>!e)]].map(([e,t,n])=>(0,B.jsx)(`button`,{type:`button`,onClick:n,"aria-pressed":t,className:`px-2 py-[3px] text-[11px] font-mono border-0 cursor-pointer ${t?`bg-walnut text-paper`:`bg-paper text-umber`}`,children:e},e))}),(0,B.jsx)(`select`,{value:s,onChange:e=>c(Number(e.target.value)),className:`font-mono text-[11px] px-1.5 py-1 border border-dust rounded bg-paper text-umber`,children:[100,200,500,1e3,2e3].map(e=>(0,B.jsxs)(`option`,{value:e,children:[e,` lines`]},e))}),(0,B.jsx)(K,{size:`sm`,onClick:t,children:`Close (Esc)`})]})]}),(0,B.jsxs)(`div`,{className:`min-h-0 grid ${p?`grid-cols-[minmax(0,1fr)_minmax(300px,380px)]`:`grid-cols-1`}`,children:[(0,B.jsxs)(`div`,{className:`min-h-0 grid grid-rows-[minmax(0,1fr)_auto]`,children:[(0,B.jsx)(`pre`,{ref:D,onScroll:()=>{let e=D.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<24;t!==l&&u(t)},className:`m-0 px-4 py-3 min-h-0 overflow-auto overscroll-contain font-mono text-[12px] leading-[1.45] whitespace-pre-wrap break-words pane-dark`,children:a?(0,B.jsx)(`span`,{className:`text-brick`,children:a}):r?n(d&&r.ansi?uo(r.ansi):r.text):`capturing…`}),(0,B.jsxs)(`div`,{className:`px-4 py-2 border-t border-sand grid gap-1.5`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] gap-2 items-center`,children:[(0,B.jsx)(`input`,{value:x,onChange:e=>S(e.target.value),onKeyDown:e=>{e.key===`Enter`&&v&&E()},onPaste:T.onPaste,onDrop:T.onDrop,onDragOver:T.onDragOver,disabled:!v,placeholder:v?`DM ${e} as david — paste or drop an image, delivered by its tmux-push into this pane`:`DM needs bus writes on (header badge)`,className:`text-[13px] px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut`}),(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:E,disabled:!v||!T.hasContent(x)||T.busy||C===`sending`,children:`Send DM`})]}),(0,B.jsx)(Ku,{a:T}),(0,B.jsxs)(`div`,{className:`font-mono text-[11px] text-tan`,children:[`read-only `,(0,B.jsx)(`code`,{children:`tmux capture-pane`}),` · 3 s refresh · the console never types into panes — the DM goes through the bus (a Run) and the agent's own pusher types it`,C&&C!==`sending`?(0,B.jsxs)(`span`,{className:/^sent/.test(C)?` text-leaf`:` text-brick`,children:[` · `,C]}):null]})]})]}),p&&(0,B.jsx)(Xu,{project:b,agentId:e})]})]})})}function Xu({project:e,agentId:t}){let n=q(e?`/projects/${e}/board`:null,15e3).data,r=q(`/bus/agents`,2e4).data??[],i=n?.phases.find(e=>e.state===`ongoing`)??n?.phases.find(e=>e.state===`planned`),a=Pu(n).filter(e=>!e.done&&Lu(e.owner,r.map(e=>e.agentId))===t);return(0,B.jsxs)(`aside`,{className:`min-h-0 min-w-0 overflow-hidden overscroll-contain border-l border-sand bg-cream/40 grid grid-rows-[auto_auto_minmax(0,1fr)]`,children:[(0,B.jsxs)(`div`,{className:`px-3 py-2 border-b border-sand flex items-center gap-2 flex-wrap`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[.1em] text-tan`,children:`now`}),i?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(V,{to:`/board`,className:`font-semibold text-[13px] text-walnut hover:text-ember-deep hover:no-underline`,children:i.title}),(0,B.jsx)(G,{tone:i.state===`ongoing`?`david`:`neutral`,children:i.state}),(0,B.jsxs)(`span`,{className:`font-mono text-[11px] text-ink3`,children:[i.done,`/`,i.total]})]}):(0,B.jsx)(`span`,{className:`text-[13px] text-umber`,children:e?`no phase in flight`:`no project selected`})]}),(0,B.jsxs)(`div`,{className:`px-3 py-2 border-b border-sand grid gap-1`,children:[(0,B.jsxs)(`span`,{className:`font-mono text-[10px] uppercase tracking-[.1em] text-tan`,children:[t,` is on`]}),a.length===0&&(0,B.jsx)(`span`,{className:`text-[12px] text-umber`,children:`no active stream owned by this agent`}),a.map(e=>(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px]`,children:[(0,B.jsx)(`span`,{className:`font-mono text-umber truncate`,title:e.note,children:e.name}),(0,B.jsx)(`span`,{className:`ml-auto`,children:(0,B.jsx)(zu,{stream:e,agents:r})})]},e.name))]}),i&&e?(0,B.jsx)(Bu,{project:e,phase:i,highlight:t,maxH:`100%`,compact:!0}):(0,B.jsx)(`div`,{className:`px-3 py-3 text-[12px] text-umber`,children:`Pick a project (header) to see its phase tasks.`})]})}var Zu=`/api`,Qu=e=>{if(!e)return`—`;let t=Math.floor((Date.now()-e)/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:`${Math.floor(t/3600)}h`};function $u({agentId:e,lines:t=4,className:n=``,label:r}){let[i,a]=(0,P.useState)(null),[o,s]=(0,P.useState)(null),[c,l]=(0,P.useState)(!1);(0,P.useEffect)(()=>{let n=!0,r=async()=>{try{let r=await fetch(`${Zu}/bus/agents/${encodeURIComponent(e)}/pane?lines=${t+6}&colors=1`),i=await r.json();if(!n)return;if(!r.ok){s(i.error??String(r.status));return}s(null),a(i)}catch(e){n&&s(e.message)}};r();let i=setInterval(r,3e3);return()=>{n=!1,clearInterval(i)}},[e,t]);let u=e=>e.split(`
27
27
  `).filter(e=>e.trim().length>0).slice(-t).join(`
28
- `);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{onClick:()=>l(!0),className:`w-full text-left rounded-[4px] overflow-hidden border border-sand bg-transparent p-0 cursor-pointer group ${n}`,title:`${e} · pane ${i?.pane??``} · click for the full view`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-[3px] bg-linen border-b border-sand`,children:[(0,B.jsx)(`span`,{className:`relative inline-block w-1.5 h-1.5 rounded-full ${i?.active?`bg-moss`:`bg-dust`}`,children:i?.active&&(0,B.jsx)(`span`,{className:`absolute inset-0 rounded-full bg-moss animate-ping opacity-60`})}),(0,B.jsx)(`span`,{className:`font-mono text-[10px] text-ink3 truncate`,children:r??e}),(0,B.jsx)(`span`,{className:`ml-auto font-mono text-[10px] text-tan`,children:i?i.active?`active`:`quiet ${Qu(i.paneActivity)}`:`…`})]}),(0,B.jsx)(`pre`,{className:`m-0 px-2 py-1 pane-dark font-mono text-[10.5px] leading-[1.35] whitespace-pre-wrap break-words max-h-[calc(1.35em*4+8px)] overflow-hidden group-hover:opacity-90`,style:{maxHeight:`calc(1.35em * ${t} + 8px)`},children:o?(0,B.jsx)(`span`,{className:`text-brick`,children:o}):i?i.ansi?uo(u(i.ansi)):u(i.text):`capturing…`})]}),c&&(0,B.jsx)(Yu,{agentId:e,onClose:()=>l(!1)})]})}function ed({id:e,prefix:t,size:n=`sm`,className:r=``,bare:i=!1,noDot:a=!1}){let o=(q(`/bus/agents`,2e4).data??[]).find(t=>t.agentId===e),[s,c]=(0,P.useState)(!1),[l,u]=(0,P.useState)(!1),d=(0,P.useRef)(null),f=()=>{d.current&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>c(!0),250)},p=()=>{d.current&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>c(!1),200)};(0,P.useEffect)(()=>()=>{d.current&&window.clearTimeout(d.current)},[]);let m=!!o?.pane;return(0,B.jsxs)(`span`,{className:`relative inline-flex ${r}`,onMouseEnter:f,onMouseLeave:p,children:[(0,B.jsxs)(`button`,{onClick:()=>m&&u(!0),className:i?`inline-flex items-center gap-1.5 font-mono font-semibold ${n===`sm`?`text-[12px]`:`text-[13px]`} border-0 bg-transparent p-0 text-walnut ${m?`cursor-pointer hover:text-ember-deep`:`cursor-default`}`:`inline-flex items-center gap-1.5 rounded-full border font-mono ${n===`sm`?`text-[11px] px-2 py-0.5`:`text-[12px] px-2.5 py-1`} ${m?`cursor-pointer border-dust bg-paper hover:border-ember`:`cursor-default border-sand bg-linen/60`} text-walnut`,title:m?`${e} · pane ${o.pane} · click to pop out`:`${e}${o?` · ${o.liveness}`:` · not on the bus`}`,children:[t&&(0,B.jsx)(`span`,{className:`text-tan`,children:t}),!a&&(0,B.jsx)(Mu,{id:e,role:o?.role,size:n===`sm`?14:18,state:o?.liveness??`dead`,active:o?.active}),(0,B.jsx)(`span`,{className:`truncate max-w-[220px]`,children:e}),o&&!o.transport&&o.liveness!==`dead`&&(0,B.jsx)(`span`,{className:`text-amber`,title:`not attached — DMs won't reach its pane`,children:`⚠`})]}),s&&m&&(0,B.jsx)(`span`,{className:`absolute left-0 top-[calc(100%+6px)] z-50 w-[420px] whitespace-normal text-left`,onMouseEnter:f,onMouseLeave:p,children:(0,B.jsx)($u,{agentId:e,lines:6,label:`${e} · ${o.role??``}`,className:`shadow-panel bg-paper`})}),l&&(0,B.jsx)(Yu,{agentId:e,onClose:()=>u(!1)})]})}var td=[{re:/coordinator/i,label:`coordinator`,dot:`#4A6A2C`,ring:`#B9CFA0`},{re:/aide|liaison|curator/i,label:`aide`,dot:`#C4587A`,ring:`#F0C2D2`},{re:/\bqa\b|quality/i,label:`qa`,dot:`#C88A1E`,ring:`#F0DFA6`},{re:/\bci\b/i,label:`ci`,dot:`#E8702A`,ring:`#F6C9A6`},{re:/audit/i,label:`audit`,dot:`#7A4A6A`,ring:`#DDBFD3`},{re:/automation/i,label:`automation`,dot:`#8A7660`,ring:`#D9CDBB`},{re:/human|david/i,label:`human`,dot:`#B7521A`,ring:`#F6C9A6`}],nd=e=>td.find(t=>t.re.test(e??``))?.dot??`#5C7A96`,rd=e=>td.find(t=>t.re.test(e??``))?.label??`worker`;function id(){let{projects:e,current:t}=za(),n=q(`/bus/agents`,15e3).data??[],r=e.find(e=>e.name===t)?.room,i=n.filter(e=>e.liveness!==`dead`&&![`groundwork-console`,`david`].includes(e.agentId)&&(e.project===t||r&&e.project===r)),a=n.filter(e=>e.liveness!==`dead`&&![`groundwork-console`,`david`].includes(e.agentId)&&!i.includes(e)),o=e=>[`aide`,`coordinator`,`qa`,`ci`,`worker`,`audit`].indexOf(rd(e.role))+1||9,s=[...i].sort((e,t)=>o(e)-o(t)||e.agentId.localeCompare(t.agentId)),[c,l]=(0,P.useState)(!1);return(0,B.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-1.5 border-b border-sand bg-paper/70 min-h-[34px] whitespace-nowrap overflow-x-auto [scrollbar-width:none]`,children:[(0,B.jsxs)(`span`,{className:`font-mono text-[10px] uppercase tracking-[.1em] text-tan shrink-0`,children:[`online · `,t||`—`]}),s.length===0&&(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-tan`,children:`no agents for this project`}),s.map(e=>(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full border border-sand bg-paper`,style:{borderColor:nd(e.role)+`66`},title:`${e.agentId} · ${rd(e.role)}${e.pane?` · ${e.pane}`:``}`,children:[(0,B.jsx)(Mu,{id:e.agentId,role:e.role,size:16,state:e.liveness,active:e.active}),(0,B.jsx)(ed,{id:e.agentId,bare:!0,noDot:!0,size:`sm`}),(0,B.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[.06em]`,style:{color:nd(e.role)},children:rd(e.role)})]},e.agentId)),c&&a.map(e=>(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full border border-dashed border-sand bg-cream/60`,title:`${e.agentId} · ${rd(e.role)} · ${e.project??`?`}`,children:[(0,B.jsx)(Mu,{id:e.agentId,role:e.role,size:16,state:e.liveness,active:e.active}),(0,B.jsx)(ed,{id:e.agentId,bare:!0,noDot:!0,size:`sm`}),(0,B.jsx)(`span`,{className:`font-mono text-[10px] text-tan`,children:e.project})]},e.agentId)),a.length>0&&(0,B.jsx)(`button`,{onClick:()=>l(e=>!e),"aria-pressed":c,className:`ml-auto font-mono text-[11px] text-ink3 shrink-0 border-0 bg-transparent cursor-pointer hover:text-umber`,title:c?`show only this project`:a.map(e=>e.agentId).join(`, `),children:c?`only this project`:`+${a.length} elsewhere`}),(0,B.jsx)(`span`,{className:`ml-3 font-mono text-[10px] text-tan shrink-0 hidden xl:inline-flex items-center gap-2`,children:[[`coordinator`,`#4A6A2C`],[`aide`,`#C4587A`],[`qa`,`#C88A1E`],[`ci`,`#E8702A`],[`worker`,`#5C7A96`]].map(([e,t])=>(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,B.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full`,style:{background:t}}),e]},e))})]})}var ad=(e,t)=>window.dispatchEvent(new CustomEvent(`groundwork-console:summon`,{detail:{agentId:e,answers:t?.answers}})),od=e=>`groundwork-console.summon.${e}`,sd=e=>`groundwork-console.summon.seen.${e}`;function cd(e){let t=rr(),n=t.pathname.match(/^\/docs\/(.+)$/),r=new URLSearchParams(t.search);if(n){let t=decodeURIComponent(n[1]),i=r.get(`line`);return t.startsWith(`kb:`)?{label:`knowledge/${t.slice(3)}${i?`:${i}`:``}`,cite:`groundwork-knowledge/${t.slice(3)}${i?`:${i}`:``}`}:{label:`${t}${i?`:${i}`:``}`,cite:`${e}/docs/${t}${i?`:${i}`:``}`}}let i=t.pathname===`/`?`home`:t.pathname.slice(1).split(`/`)[0];return{label:i,cite:`groundwork-console /${i}${e?` · ${e}`:``}`}}function ld(){let{current:e}=za(),t=q(`/bus/agents`,2e4).data??[],n=q(e?`/projects/${e}/agents`:null,3e4).data,r=t.filter(e=>e.liveness!==`dead`&&e.agentId!==`david`&&e.agentId!==`groundwork-console`),[i,a]=(0,P.useState)(()=>e?localStorage.getItem(od(e)):null);(0,P.useEffect)(()=>{a(e?localStorage.getItem(od(e)):null)},[e]);let o=(i&&t.some(e=>e.agentId===i)?i:null)??n?.aide??n?.coordinator??r[0]?.agentId??null,s=t.find(e=>e.agentId===o),[c,l]=(0,P.useState)(!1),[u,d]=(0,P.useState)(!1),f=t=>{a(t),e&&localStorage.setItem(od(e),t),d(!1),l(!0)},p=q(o?`/bus/dm/${encodeURIComponent(o)}?limit=80`:null,c?4e3:2e4).data,m=q(`/bus/inbox?limit=100`,2e4).data?.decisions??{},[h,g]=(0,P.useState)(0);(0,P.useEffect)(()=>{o&&g(Number(localStorage.getItem(sd(o))??0))},[o]),(0,P.useEffect)(()=>{c&&o&&p&&(localStorage.setItem(sd(o),String(p.lastFromAgent)),g(p.lastFromAgent))},[c,o,p]);let _=!!p&&p.lastFromAgent>h;(0,P.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(d(!1),l(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let[v,y]=(0,P.useState)([]);if((0,P.useEffect)(()=>{let e=e=>{let t=e.detail;y(t?.answers??[]),t?.agentId?f(t.agentId):(l(!1),d(!0))};return window.addEventListener(`groundwork-console:summon`,e),()=>window.removeEventListener(`groundwork-console:summon`,e)}),!o)return null;let b=r.length,x=r,S=e=>{let t=(b===1?.5:e/(b-1))*(Math.PI/2);return{x:-Math.sin(t)*96,y:-Math.cos(t)*96}};return(0,B.jsxs)(B.Fragment,{children:[c&&(0,B.jsx)(fd,{agentId:o,me:s,project:e,thread:p??void 0,answers:v,onAnswered:()=>y([]),onClose:()=>l(!1),onSwitch:()=>{d(!0)}}),(0,B.jsxs)(`div`,{className:`fixed right-5 bottom-5 z-[55]`,style:{width:52,height:52},children:[u&&(0,B.jsxs)(`div`,{className:`absolute inset-0`,"aria-label":`pick an agent`,children:[x.map((e,t)=>{let n=S(t);return(0,B.jsxs)(`button`,{onClick:()=>f(e.agentId),title:`${e.agentId} · ${rd(e.role)}`,className:`absolute rounded-full border-2 bg-paper shadow-panel cursor-pointer p-[3px] transition-transform hover:scale-110`,style:{left:26+n.x-17,top:26+n.y-17,borderColor:nd(e.role),width:34,height:34,animation:`summon-pop .18s ease-out ${t*30}ms both`},children:[(0,B.jsx)(Mu,{id:e.agentId,role:e.role,size:26,state:e.liveness,active:e.active}),m[e.agentId]?(0,B.jsx)(ud,{n:m[e.agentId],small:!0}):null]},e.agentId)}),x.length===0&&(0,B.jsx)(`span`,{className:`absolute right-0 bottom-14 whitespace-nowrap font-mono text-[11px] text-tan bg-paper border border-sand rounded-kit px-2 py-1`,children:`no live agents`})]}),(0,B.jsxs)(`button`,{onClick:()=>u?d(!1):l(e=>!e),title:`${o} · ${rd(s?.role)} — click to chat`,className:`absolute inset-0 rounded-full border-2 bg-paper shadow-panel cursor-pointer p-1 hover:scale-105 transition-transform`,style:{borderColor:nd(s?.role)},children:[(0,B.jsx)(Mu,{id:o,role:s?.role,size:40,state:s?.liveness??`dead`,active:s?.active}),m[o]?(0,B.jsx)(ud,{n:m[o]}):_&&(0,B.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 w-3 h-3 rounded-full bg-ember border-2 border-paper`,title:`new message`})]}),(0,B.jsx)(`button`,{onClick:()=>d(e=>!e),"aria-pressed":u,title:`pick another agent`,className:`absolute -left-2 -top-2 w-6 h-6 rounded-full border border-dust shadow-panel cursor-pointer text-[13px] leading-none flex items-center justify-center ${u?`bg-walnut text-paper`:`bg-paper text-umber`}`,children:u?`×`:`+`})]}),(0,B.jsx)(`style`,{children:`.summon-dots{display:inline-flex;gap:3px}.summon-dots i{width:5px;height:5px;border-radius:50%;background:currentColor;opacity:.25;animation:summon-dot 1.2s infinite}.summon-dots i:nth-child(2){animation-delay:.2s}.summon-dots i:nth-child(3){animation-delay:.4s}@keyframes summon-dot{0%,80%,100%{opacity:.25}40%{opacity:1}}@keyframes summon-pop{from{transform:scale(.4);opacity:0}to{transform:scale(1);opacity:1}}@keyframes summon-pulse{0%,100%{box-shadow:0 0 0 0 rgba(200,120,42,.55)}50%{box-shadow:0 0 0 6px rgba(200,120,42,0)}}`})]})}function ud({n:e,small:t=!1}){return(0,B.jsx)(`span`,{className:`absolute -top-1 -right-1 rounded-full bg-ember text-paper border-2 border-paper font-mono font-bold flex items-center justify-center leading-none ${t?`w-4 h-4 text-[9px]`:`w-5 h-5 text-[10px]`}`,title:`${e} decision${e===1?``:`s`} waiting on you`,style:{animation:`summon-pulse 1.6s ease-in-out infinite`},children:`★`})}var dd=e=>{let t=Math.round(e/1e3);return t<60?`${t} s`:t<3600?`${Math.floor(t/60)} min`:`${Math.floor(t/3600)} h`};function fd({agentId:e,me:t,project:n,thread:r,answers:i=[],onAnswered:a,onClose:o,onSwitch:s}){let c=q(`/admin/bus-writes`,1e4).data?.enabled??!1,l=cd(n),[u,d]=(0,P.useState)(!0),[f,p]=(0,P.useState)(``),[m,h]=(0,P.useState)(null),[g,_]=(0,P.useState)(!1),[v,y]=(0,P.useState)(()=>localStorage.getItem(`groundwork-console.summon.max`)===`1`),b=()=>y(e=>(localStorage.setItem(`groundwork-console.summon.max`,e?`0`:`1`),!e)),x=Gu(),S=(0,P.useRef)(null),[C,w]=(0,P.useState)([]),T=r?.messages??[],E=C.filter(e=>!T.some(t=>t.from===`david`&&Number(t.ts??0)>=Number(e.ts??0)-2e3&&(t.text??``)===(e.text??``))),D=[...T,...E],[O,k]=(0,P.useState)(0);(0,P.useEffect)(()=>{let e=setInterval(()=>k(e=>e+1),1e3);return()=>clearInterval(e)},[]);let A=(q(`/bus/agents`,4e3).data??[]).find(t=>t.agentId===e)??t,j=A?.paneActivity?Date.now()-A.paneActivity:1/0,M=j<2e4,N=([...D].reverse().find(e=>e.from===`david`)?.ts??0)>([...D].reverse().find(e=>e.from!==`david`)?.ts??0);(0,P.useEffect)(()=>{S.current&&(S.current.scrollTop=S.current.scrollHeight)},[D.length,M,N]);let ee=async()=>{if(!x.hasContent(f))return;h(`sending`);let t=x.withRefs(f.trim()),n=u?`${t}\n(context: ${l.cite})`:t,r={id:`local-${Date.now()}`,ts:Date.now(),from:`david`,to:e,text:n,prefix:null,pending:!0};w(e=>[...e,r]),p(``),x.clear();try{let t=await Fa(`/actions/send`,{as:`david`,to:e,text:n,answers:i.length?i:void 0});if(t.status===`ok`)h(null),a?.();else{let e=t.error??t.log?.slice(-1)[0]??`failed`;h(e),w(t=>t.map(t=>t.id===r.id?{...t,failed:e}:t))}}catch(e){let t=e.message;h(t),w(e=>e.map(e=>e.id===r.id?{...e,failed:t}:e))}},F=e=>e?new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):``,I=(0,P.useMemo)(()=>D,[D]);return(0,B.jsxs)(B.Fragment,{children:[g&&(0,B.jsx)(Yu,{agentId:e,onClose:()=>_(!1)}),(0,B.jsxs)(`div`,{className:`fixed z-[54] bg-paper border border-sand rounded-kit shadow-panel grid grid-rows-[auto_minmax(0,1fr)_auto] whitespace-normal text-left transition-[width,height] duration-150 ${v?`right-5 bottom-[84px] w-[min(1100px,calc(100vw-40px))] h-[calc(100vh-110px)]`:`right-5 bottom-[84px] w-[min(400px,calc(100vw-40px))] h-[min(560px,calc(100vh-140px))]`}`,style:{borderTop:`3px solid ${nd(t?.role)}`},children:[(0,B.jsxs)(`div`,{className:`px-3 py-2 border-b border-sand flex items-center gap-2 min-w-0`,children:[(0,B.jsx)(Mu,{id:e,role:t?.role,size:22,state:t?.liveness??`dead`,active:t?.active}),(0,B.jsx)(`span`,{className:`font-display font-bold text-[14px] text-umber truncate`,children:e}),(0,B.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[.06em]`,style:{color:nd(t?.role)},children:rd(t?.role)}),t?(0,B.jsx)(G,{tone:t.liveness===`live`?`ok`:t.liveness===`idle`?`warn`:`bad`,children:t.active?`active`:t.liveness}):(0,B.jsx)(G,{tone:`bad`,children:`offline`}),(0,B.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[t?.pane&&(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:()=>_(!0),title:`open its pane`,children:`pane`}),(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:s,title:`summon another agent`,children:`switch`}),(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:b,title:v?`restore`:`maximize`,children:v?`⇲`:`⇱`}),(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:o,children:`✕`})]})]}),(0,B.jsxs)(`div`,{ref:S,className:`min-h-0 overflow-auto px-3 py-2 grid gap-1.5 content-start bg-cream/40`,children:[!r&&(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-tan`,children:`loading thread…`}),r&&I.length===0&&(0,B.jsxs)(`span`,{className:`text-[12px] text-umber`,children:[`No DMs with `,e,` yet. Say what you need — it lands in its pane via tmux-push.`]}),I.map((e,t)=>{let n=e.from===`david`,r=String(e.text??``),i=e.prefix?r.replace(RegExp(`^${e.prefix}:?\\s*`),``):r;return(0,B.jsxs)(`div`,{className:`${e.pending?`opacity-70`:``} ${v?`max-w-[70%]`:`max-w-[88%]`} rounded-kit px-2.5 py-1.5 text-[12.5px] leading-snug whitespace-pre-wrap break-words border ${n?`justify-self-end bg-paper border-sand`:`justify-self-start bg-linen/70 border-sand/70`}`,children:[e.prefix&&(0,B.jsx)(Da,{prefix:e.prefix}),(0,B.jsx)(qu,{text:i}),(0,B.jsx)(`div`,{className:`font-mono text-[10px] mt-0.5 ${n?`text-right`:``} ${e.failed?`text-brick`:`text-tan`}`,children:e.failed?`not sent · ${e.failed}`:e.pending?`sending…`:F(e.ts)})]},e.id??t)}),(M||N)&&(0,B.jsx)(`div`,{className:`justify-self-start inline-flex items-center gap-2 px-2.5 py-1.5 rounded-kit border border-sand/70 bg-linen/50 font-mono text-[11px] text-ink3`,title:A?.paneActivity?`last pane output ${Math.round(j/1e3)} s ago`:`no pane activity`,children:M?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{className:`summon-dots`,"aria-hidden":!0,children:[(0,B.jsx)(`i`,{}),(0,B.jsx)(`i`,{}),(0,B.jsx)(`i`,{})]}),(0,B.jsxs)(`span`,{children:[e.split(`-`)[0],` is working`]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-tan`}),(0,B.jsxs)(`span`,{children:[`delivered · quiet for `,j===1/0?`a while`:dd(j)]})]})})]}),(0,B.jsxs)(`div`,{className:`px-3 py-2 border-t border-sand grid gap-1.5`,children:[(0,B.jsxs)(`label`,{className:`flex items-center gap-1.5 font-mono text-[11px] text-ink3 min-w-0`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>d(e.target.checked)}),(0,B.jsx)(`span`,{className:`shrink-0`,children:`context:`}),(0,B.jsx)(`span`,{className:`truncate text-umber`,title:l.cite,children:l.label})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] gap-1.5 items-center`,children:[(0,B.jsx)(`textarea`,{value:f,onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&c&&(e.preventDefault(),ee())},onPaste:x.onPaste,onDrop:x.onDrop,onDragOver:x.onDragOver,disabled:!c,rows:v?4:2,placeholder:c?`DM ${e} as david — Enter to send, ⇧Enter newline, paste images`:`bus writes are off (header badge)`,className:`text-[13px] px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut resize-none min-w-0`}),(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:ee,disabled:!c||!x.hasContent(f)||x.busy||m===`sending`,children:m===`sending`?`…`:`Send`})]}),(0,B.jsx)(Ku,{a:x}),m&&m!==`sending`&&(0,B.jsx)(`div`,{className:`font-mono text-[11px] text-brick`,children:m})]})]})]})}var pd={h:`/`,b:`/board`,m:`/monitor`,u:`/bus`,d:`/docs`,o:`/ops`},md=e=>{let t=e;return!!t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable)};function hd(){let e=ar(),[t,n]=(0,P.useState)(!1);return(0,P.useEffect)(()=>{let t=0,r=r=>{if(!(r.metaKey||r.ctrlKey||r.altKey||md(r.target))){if(r.key===`Escape`){n(!1);return}if(r.key===`?`){n(e=>!e);return}if(r.key===`/`){r.preventDefault(),ad(``);return}if(r.key===`g`){t=Date.now();return}Date.now()-t<900&&pd[r.key]&&(r.preventDefault(),e(pd[r.key]),t=0)}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e]),t?(0,B.jsx)(`div`,{className:`fixed inset-0 z-[70] bg-walnut/30 flex items-center justify-center`,onMouseDown:()=>n(!1),children:(0,B.jsxs)(`div`,{className:`bg-paper border border-sand rounded-kit shadow-panel p-4 grid gap-2 min-w-[320px]`,onMouseDown:e=>e.stopPropagation(),children:[(0,B.jsx)(`div`,{className:`font-display font-bold text-[15px] text-umber`,children:`Keyboard`}),[[`/`,`summon an agent (picker)`],[`g h`,`Home`],[`g b`,`Board`],[`g m`,`Monitor`],[`g u`,`Bus`],[`g d`,`Docs`],[`g o`,`Ops`],[`Esc`,`close drawer / picker / this`],[`?`,`toggle this list`]].map(([e,t])=>(0,B.jsxs)(`div`,{className:`grid grid-cols-[64px_1fr] gap-3 items-baseline text-[13px]`,children:[(0,B.jsx)(`kbd`,{className:`font-mono text-[12px] px-1.5 py-0.5 border border-dust rounded bg-cream text-walnut justify-self-start`,children:e}),(0,B.jsx)(`span`,{className:`text-umber`,children:t})]},e)),(0,B.jsx)(`div`,{className:`font-mono text-[11px] text-tan mt-1`,children:`In the Summon drawer: Enter sends · ⇧Enter newline · paste images.`})]})}):null}var gd=`/api`;function _d({children:e}){let[t,n]=(0,P.useState)(`checking`),[r,i]=(0,P.useState)(``),[a,o]=(0,P.useState)(null),[s,c]=(0,P.useState)(!1),l=async()=>{try{let e=await(await fetch(`${gd}/auth/status`)).json();n(e.authed?`in`:`out`)}catch{n(`offline`)}};(0,P.useEffect)(()=>{l()},[]),(0,P.useEffect)(()=>{t!==`in`&&fetch(`${gd}/health`).then(e=>e.json()).then(e=>{document.title=e.hostname?`Sign in · ${e.hostname}`:`Sign in · Groundwork Console`}).catch(()=>{document.title=`Sign in · Groundwork Console`})},[t]),(0,P.useEffect)(()=>{let e=()=>n(`out`);return window.addEventListener(`groundwork-console:unauthorized`,e),()=>window.removeEventListener(`groundwork-console:unauthorized`,e)},[]);let u=async()=>{c(!0),o(null);try{let e=await fetch(`${gd}/auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:r})}),t=await e.json();if(!e.ok)throw Error(t.error??`${e.status}`);i(``),n(`in`)}catch(e){o(e.message)}finally{c(!1)}};return t===`in`?(0,B.jsx)(B.Fragment,{children:e}):t===`checking`?(0,B.jsx)(`div`,{className:`min-h-screen grid place-items-center font-mono text-[12px] text-tan`,children:`checking session…`}):(0,B.jsx)(`div`,{className:`min-h-screen grid place-items-center bg-cream p-6`,children:(0,B.jsxs)(`div`,{className:`w-[380px] bg-paper border border-sand rounded-kit shadow-panel`,children:[(0,B.jsxs)(`div`,{className:`px-5 py-4 border-b border-sand flex items-center gap-2 font-display font-bold text-[18px] text-ember`,children:[(0,B.jsx)(Na,{}),` Groundwork Console`]}),(0,B.jsx)(`div`,{className:`p-5 grid gap-3 text-[13px]`,children:t===`offline`?(0,B.jsxs)(`div`,{className:`text-brick`,children:[`API unreachable — start it with `,(0,B.jsx)(`code`,{children:`pnpm dev:api`}),`, then `,(0,B.jsx)(`button`,{className:`underline border-0 bg-transparent p-0 cursor-pointer text-ember-deep`,onClick:l,children:`retry`}),`.`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`text-umber`,children:[`This console can write to your bus and docs. Enter the console token — it's in `,(0,B.jsx)(`code`,{className:`font-mono text-[12px]`,children:`~/.groundwork-console/token`}),` on the machine running the API (or `,(0,B.jsx)(`code`,{className:`font-mono text-[12px]`,children:`GROUNDWORK_CONSOLE_TOKEN`}),`).`]}),(0,B.jsx)(`input`,{type:`password`,autoFocus:!0,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&r&&u()},placeholder:`token`,className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`}),a&&(0,B.jsx)(`div`,{className:`text-brick`,children:a}),(0,B.jsx)(K,{tone:`primary`,onClick:u,disabled:!r||s,children:s?`Signing in…`:`Sign in`}),(0,B.jsx)(`div`,{className:`font-mono text-[11px] text-tan`,children:`Cookie lasts 30 days on this browser. Single shared token — no accounts.`})]})})]})})}var vd=[{to:`/`,label:`Home`,icon:`home`},{to:`/board`,label:`Board`,icon:`board`},{to:`/bus`,label:`Bus`,icon:`bus`},{to:`/monitor`,label:`Monitor`,icon:`monitor`},{to:`/docs`,label:`Docs`,icon:`docs`},{to:`/ops`,label:`Ops`,icon:`fleet`}];function $(){let{error:e}=za(),{running:t}=Ha(),n=q(`/bus/unread`,3e4).data?.inbox??0,r=q(`/kit`).data,i=q(`/health`,6e4).data?.hostname,a=rr();(0,P.useEffect)(()=>{let e=a.pathname===`/`?``:a.pathname.split(`/`)[1],t=vd.find(t=>t.to===`/`?e===``:t.to===`/${e}`)?.label??(e?e[0].toUpperCase()+e.slice(1):`Home`);document.title=i?`${t} · ${i}`:t},[a.pathname,i]);let o=r?.packages?`${r.name} ${r.kitVersion} · seam ${r.packages.seam?.version} · mcp ${r.packages.mcp?.version}`:`kit · offline`;return(0,B.jsx)(_d,{children:(0,B.jsx)(Du,{children:(0,B.jsxs)(`div`,{className:`grid grid-rows-[48px_auto_1fr] min-h-screen`,children:[(0,B.jsxs)(`header`,{className:`grid grid-cols-[auto_auto_1fr] items-center gap-4 px-4 border-b border-sand bg-cream min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 font-display font-bold text-[16px] text-ember whitespace-nowrap`,title:o,children:[(0,B.jsx)(Na,{}),` Groundwork Console`]}),(0,B.jsx)(`nav`,{className:`flex gap-0.5 whitespace-nowrap`,children:vd.map(e=>(0,B.jsxs)(ji,{to:e.to===`/bus`&&n>0?`/bus?view=inbox`:e.to,end:e.to===`/`,className:({isActive:e})=>`inline-flex items-center gap-1.5 px-3 py-2 rounded-kit font-medium ${e?`bg-paper text-walnut shadow-[inset_0_0_0_1px_var(--color-sand)]`:`text-umber hover:no-underline hover:bg-linen`}`,children:[(0,B.jsx)(`span`,{className:`text-tan`,children:Ca[e.icon]({size:16})}),(0,B.jsx)(`span`,{className:`hidden xl:inline`,children:e.label}),e.to===`/ops`&&t>0?(0,B.jsxs)(`span`,{className:`ml-1.5 inline-flex items-center gap-1 text-amber`,children:[(0,B.jsx)(Ma,{size:12}),(0,B.jsx)(G,{tone:`warn`,children:t})]}):null,e.to===`/bus`&&n>0?(0,B.jsx)(`span`,{className:`ml-1.5 inline-flex`,title:`${n} unread DM(s) to david`,children:(0,B.jsx)(G,{tone:`david`,children:n})}):null,e.badge?(0,B.jsx)(`span`,{className:`ml-1.5 inline-flex`,children:(0,B.jsx)(G,{tone:`david`,children:e.badge})}):null]},e.to))}),(0,B.jsxs)(`div`,{className:`flex gap-0.5 items-center justify-end min-w-0 whitespace-nowrap`,children:[e&&(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-brick mr-2`,title:e,children:`api offline`}),(0,B.jsx)(Ga,{}),(0,B.jsx)(Ya,{}),(0,B.jsx)(Ja,{}),(0,B.jsx)(J,{}),(0,B.jsx)(`button`,{onClick:async()=>{await fetch(`/api/auth/logout`,{method:`POST`}),window.dispatchEvent(new Event(`groundwork-console:unauthorized`))},className:`ml-1 font-mono text-[11px] text-tan border-0 bg-transparent cursor-pointer hover:text-umber`,title:`sign out (clears the session cookie)`,children:`⎋`})]})]}),(0,B.jsx)(id,{}),(0,B.jsx)(Rr,{}),(0,B.jsx)(ao,{}),(0,B.jsx)(ld,{}),(0,B.jsx)(hd,{})]})})})}function yd(e,t=Date.now()){let n=Math.max(0,(t-e)/1e3)/60,r=n/60,i=r/24;if(n<1)return`just now`;if(r<1)return`${Math.floor(n)} min ago`;if(i<1)return`${Math.floor(r)} h ago`;if(i<2)return`yesterday`;if(i<7)return`${Math.floor(i)} days ago`;let a=i/7;if(a<2)return`last week`;if(i<30)return`${Math.floor(a)} weeks ago`;let o=i/30;return o<2?`last month`:i<365?`${Math.floor(o)} months ago`:i<730?`last year`:`${Math.floor(i/365)} years ago`}function bd(e,t=Date.now()){let n=(t-e)/864e5;return n<1?`text-tan`:n<7?`text-amber`:`text-brick font-semibold`}var xd=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),Sd=e=>!!e&&Ta.includes(e),Cd={"state.fact.stale":`warn`,"state.board.malformed":`bad`,"state.decision.open":`david`,"state.phase.active":`neutral`,"phase.completed":`ok`,"phase.started":`ok`,"phase.progress":`neutral`,"done.appended":`ok`,"queue.item.added":`neutral`,"queue.item.closed":`ok`,"fact.stale":`warn`,"board.malformed":`bad`,"decision.posted":`david`};function wd(){let{data:e,refresh:t}=q(`/events?limit=40`,15e3),[n,r]=(0,P.useState)(!1),[i,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(!1),c=async(e,n)=>{s(!0);try{await Fa(`/events/config`,{rule:e,enabled:n}),t()}finally{s(!1)}},l=async e=>{s(!0);try{await Fa(`/events/config`,{dryRun:e,confirm:e?void 0:i}),t(),r(!1),a(``)}finally{s(!1)}},[u,d]=(0,P.useState)([]);(0,P.useEffect)(()=>{let e=new EventSource(`/api/events/stream`);return e.onmessage=e=>{let t=JSON.parse(e.data);t.type!==`hello`&&d(e=>{let n=e.findIndex(e=>e.id===t.id);if(n>=0){let r=e.slice();return r[n]=t,r}return[t,...e].slice(0,40)})},()=>e.close()},[]);let f=[...u,...(e?.recent??[]).filter(e=>!u.some(t=>t.id===e.id)).slice().reverse()].slice(0,40),p=e?.config;return(0,B.jsxs)(U,{children:[(0,B.jsxs)(W,{title:`Events`,icon:`health`,path:p?`${p.identity.displayName??p.identity.agentId} · ${p.rules.filter(e=>e.enabled).length}/${p.rules.length} rules enabled · dedupe ${p.limits?.dedupeTtlHours??72} h · max ${p.limits?.maxPerRulePerProjectPerHour??3}/h`:`detector`,children:[p&&(p.live?(0,B.jsx)(G,{tone:`bad`,children:`LIVE — sending`}):p.dryRun?(0,B.jsx)(G,{tone:`outline`,children:`dry-run`}):(0,B.jsx)(G,{tone:`warn`,children:`armed · bus writes off`})),p&&(p.dryRun?(0,B.jsx)(K,{size:`sm`,onClick:()=>r(!0),disabled:o,children:`Go live…`}):(0,B.jsx)(K,{size:`sm`,onClick:()=>l(!0),disabled:o,children:`Back to dry-run`}))]}),p&&(0,B.jsxs)(`div`,{className:`px-3 py-2 border-b border-sand grid gap-1`,children:[p.rules.map(e=>(0,B.jsxs)(`label`,{className:`grid grid-cols-[auto_1fr] gap-2 items-baseline font-mono text-[12px] text-ink3 cursor-pointer`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:!!e.enabled,disabled:o||e.action.type===`none`,onChange:t=>c(e.id,t.target.checked),title:e.action.type===`none`?`informational rule — nothing to send`:`enable this rule`}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`text-walnut`,children:e.on}),` → `,e.action.type===`none`?(0,B.jsx)(`span`,{className:`text-tan`,children:e.action.note}):(0,B.jsxs)(B.Fragment,{children:[e.action.to?e.action.to:`#${e.action.room}`,` · `,Sd(e.action.prefix)&&(0,B.jsx)(Da,{prefix:e.action.prefix}),(0,B.jsx)(`span`,{className:`text-umber`,children:e.action.text})]})]})]},e.id)),(0,B.jsxs)(`div`,{className:`text-[11px] font-mono text-tan`,children:[`a rule sends only when: bus writes ON (header) · dry-run OFF · rule enabled · not a duplicate (key, `,p.limits?.dedupeTtlHours??72,` h) · under the rate limit · a live coordinator exists for the project. Baseline state.* events never trigger rules.`]})]}),n&&(0,B.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-walnut/30 flex items-start justify-center pt-[12vh]`,onMouseDown:e=>{e.target===e.currentTarget&&r(!1)},children:(0,B.jsxs)(`div`,{className:`w-[520px] bg-paper border border-brick rounded-kit shadow-panel`,children:[(0,B.jsx)(`div`,{className:`px-4 py-3 border-b border-sand font-display font-bold text-[18px] text-brick`,children:`Turn dry-run off`}),(0,B.jsxs)(`div`,{className:`p-4 grid gap-3 text-[13px] text-umber`,children:[(0,B.jsxs)(`div`,{children:[`Enabled rules will really `,(0,B.jsx)(`code`,{children:`send_message`}),` as `,(0,B.jsx)(`b`,{className:`text-walnut`,children:`groundwork-console`}),` (automation) whenever bus writes are on. Dedupe + rate limit apply; every send is a Run. Persisted in `,(0,B.jsx)(`code`,{children:`groundwork-console.rules.json`}),`.`]}),(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Type LIVE to confirm`}),(0,B.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]})]}),(0,B.jsxs)(`div`,{className:`px-4 py-3 border-t border-sand flex justify-end gap-2`,children:[(0,B.jsx)(K,{size:`sm`,onClick:()=>r(!1),children:`Cancel`}),(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:()=>l(!1),disabled:i!==`LIVE`||o,children:`Go live`})]})]})}),f.length===0&&(0,B.jsx)(`div`,{className:`px-3 py-3 text-[13px] text-umber`,children:`Watching seam files + rooms every 15 s. Nothing dirty at baseline and nothing changed since.`}),f.map(e=>(0,B.jsxs)(`div`,{className:`grid grid-cols-[var(--spacing-gutter)_1fr] border-b border-sand last:border-b-0`,children:[(0,B.jsx)(`div`,{className:`py-2.5 flex justify-center font-mono text-[12px] text-tan border-r border-sand`,children:`⚡`}),(0,B.jsxs)(`div`,{className:`px-3 pt-2 pb-2.5 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex gap-2 items-baseline mb-0.5 flex-wrap`,children:[(0,B.jsx)(G,{tone:Cd[e.type]??`neutral`,children:e.type}),e.data.baseline?(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-tan`,children:`baseline · no action`}):null,(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-umber`,children:e.project}),(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-ink3`,children:xd(e.ts)})]}),(0,B.jsx)(`div`,{className:`font-mono text-[12px] text-umber break-all`,children:Object.entries(e.data).filter(([e])=>![`project`,`room`].includes(e)).map(([e,t])=>`${e}=${String(t)}`).join(` · `)}),e.actions.filter(e=>e.type!==`none`).map(e=>(0,B.jsxs)(`div`,{className:`mt-1 text-[13px] pl-2 border-l-2 ${e.sent?`border-leaf`:e.skipped?`border-amber`:`border-dust`}`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.06em] mr-1.5 ${e.sent?`text-leaf`:e.skipped?`text-amber`:`text-tan`}`,children:e.sent?`sent`:e.skipped?`skipped · ${e.skipped}`:e.dryRun?`would send`:`sending`}),Sd(e.prefix)&&(0,B.jsx)(Da,{prefix:e.prefix}),(0,B.jsx)(`span`,{className:`text-walnut`,children:e.text}),` `,(0,B.jsxs)(`span`,{className:`font-mono text-[12px] text-ink3`,children:[`→ `,e.to??`#${e.room}`]}),e.runId&&(0,B.jsx)(`span`,{className:`ml-2 font-mono text-[11px] text-tan`,children:e.runId})]},e.ruleId))]})]},e.id))]})}function Td(){let{data:e}=q(`/events?limit=40`,3e4),t=e?.config;if(!t)return null;let n=t.rules.filter(e=>e.enabled).length,r=Date.now()-864e5,i=(e?.recent??[]).filter(e=>e.ts>r).flatMap(e=>e.actions).filter(e=>e.sent).length;return(0,B.jsxs)(`div`,{className:`flex items-center gap-2 font-mono text-[11px] text-ink3 px-1`,children:[(0,B.jsx)(`span`,{className:`uppercase tracking-[.1em] text-tan`,children:`events`}),t.live?(0,B.jsx)(G,{tone:`bad`,children:`live`}):t.dryRun?(0,B.jsx)(G,{tone:`outline`,children:`dry-run`}):(0,B.jsx)(G,{tone:`warn`,children:`armed · bus writes off`}),(0,B.jsxs)(`span`,{children:[n,`/`,t.rules.length,` rules on · `,i,` sent in 24 h`]}),(0,B.jsx)(V,{to:`/ops/events`,className:`ml-auto text-ember-deep`,children:`Ops → Events`})]})}var Ed={complete:{label:`complete`,tone:`ok`,dot:`bg-leaf border-leaf`,ring:`text-leaf`,hint:`all tasks ticked`},ongoing:{label:`ongoing`,tone:`david`,dot:`bg-ember border-ember`,ring:`text-ember`,hint:`streams in flight or tasks ticked`},planned:{label:`planned`,tone:`neutral`,dot:`bg-paper border-umber`,ring:`text-umber`,hint:`tasks written, none started`},pending:{label:`pending`,tone:`outline`,dot:`bg-paper border-dust border-dashed`,ring:`text-tan`,hint:`no PHASE*_TASKS.md yet — run /plan-phase`}};function Dd({pct:e,cls:t,size:n=44}){let r=(n-6)/2,i=2*Math.PI*r;return(0,B.jsxs)(`svg`,{width:n,height:n,viewBox:`0 0 ${n} ${n}`,className:t,"aria-hidden":!0,children:[(0,B.jsx)(`circle`,{cx:n/2,cy:n/2,r,fill:`none`,stroke:`currentColor`,strokeOpacity:`.18`,strokeWidth:`4`}),(0,B.jsx)(`circle`,{cx:n/2,cy:n/2,r,fill:`none`,stroke:`currentColor`,strokeWidth:`4`,strokeLinecap:`round`,strokeDasharray:`${e/100*i} ${i}`,transform:`rotate(-90 ${n/2} ${n/2})`})]})}function Od({project:e,phases:t,canWrite:n,prd:r}){let i=q(`/projects/${e}/agents`,3e4).data,[a,o]=(0,P.useState)(null),[s,c]=(0,P.useState)(null),[l,u]=(0,P.useState)(null),d=`groundwork-console.roadmap.last.${e}`,[f,p]=(0,P.useState)(()=>{try{return JSON.parse(localStorage.getItem(d)??`{}`)}catch{return{}}}),m=(e,t,n)=>p(r=>{let i={...r,[e]:{verb:t,to:n,ts:Date.now()}};return localStorage.setItem(d,JSON.stringify(i)),i}),h=e=>{let t=Math.floor((Date.now()-e)/6e4);return t<1?`just now`:t<60?`${t} min ago`:`${Math.floor(t/60)} h ago`},g=async(t,r)=>{if(!n){c(`bus writes are off — click the header badge (read-only · v0.1) and type ENABLE, then retry`);return}if(r===`plan`&&!i?.aide){c(`no live aide for ${e} — start one (coord-aide) in #room, or DM the coordinator from Bus`);return}if(r!==`plan`&&!i?.coordinator){c(`no live coordinator for ${e}`);return}o(`${t.id}:${r}`),c(null);try{let n=await Fa(`/actions/phase/${e}/${t.id}/${r}`),i=n.args?.to??``;n.status===`ok`&&m(t.id,r,i),c(n.status===`ok`?`sent → ${i}`:n.error??n.log?.slice(-1)[0]??`failed`)}catch(e){c(e.message)}finally{o(null)}},_=async t=>{if(!n){c(`bus writes are off — switch them on in the header, then retry`);return}o(t),c(null);try{let n=await Fa(`/actions/project/${e}/${t}`),r=n.args?.to??``;c(n.status===`ok`?`sent → ${r} — continue in its thread`:n.error??n.log?.slice(-1)[0]??`failed`),n.status===`ok`&&r&&ad(r)}catch(e){c(e.message)}finally{o(null)}},v=t.filter(e=>e.state===`complete`).length,y=t.find(e=>e.state===`ongoing`)??t.find(e=>e.state===`planned`)??t.find(e=>e.state===`pending`);return(0,B.jsxs)(U,{children:[(0,B.jsx)(W,{title:`Roadmap`,icon:`phases`,eyebrow:`PRODUCTION_ROADMAP · phases/`,path:`${v}/${t.length} complete${y?` · next: ${y.title}`:``}`,children:(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 flex-wrap`,children:[i?.aide?(0,B.jsx)(ed,{id:i.aide,prefix:`aide`}):(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-tan`,children:`no live aide`}),i?.coordinator?(0,B.jsx)(ed,{id:i.coordinator,prefix:`coord`}):(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-tan`,children:`no live coordinator`})]})}),t.length===0&&(0,B.jsxs)(`div`,{className:`px-3 py-3 grid gap-2 text-[13px]`,children:[r==null?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`text-walnut`,children:[`No PRD yet. The roadmap starts from `,(0,B.jsx)(`code`,{children:`docs/PRD.md`}),` — write it with your aide (it runs `,(0,B.jsx)(`code`,{children:`/create-prd`}),` and asks you what it needs).`]}),(0,B.jsxs)(`div`,{className:`flex gap-2 items-center flex-wrap`,children:[(0,B.jsx)(K,{size:`sm`,tone:`primary`,disabled:!!a||!i?.aide,title:i?.aide?`DM ${i.aide}: run /create-prd with me`:`no live aide — spawn one under Ops → Fleets`,onClick:()=>_(`create-prd`),children:a===`create-prd`?(0,B.jsx)(Ma,{size:12}):`Write the PRD with the aide`}),i?.aide&&(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:()=>ad(i.aide),children:`Open the aide's thread`}),!i?.aide&&(0,B.jsx)(V,{to:`/ops/fleets`,className:`hover:no-underline`,children:(0,B.jsx)(K,{size:`sm`,children:`Spawn aide`})})]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`text-walnut`,children:[`PRD is `,(0,B.jsx)(`b`,{children:r.status??`present`}),r.roadmap?` and a roadmap exists`:``,` — no `,(0,B.jsx)(`code`,{children:`docs/phases/`}),` yet. Kickstart builds the roadmap + doc scaffold (roadmap, tech stack, architecture, decisions, workstreams, queue, done, facts); phases follow with `,(0,B.jsx)(`code`,{children:`/plan-phase 1`}),`.`]}),(0,B.jsxs)(`div`,{className:`flex gap-2 items-center flex-wrap`,children:[(0,B.jsx)(K,{size:`sm`,tone:`primary`,disabled:!!a||!i?.aide,title:i?.aide?`DM ${i.aide}: run /kickstart in ${e}`:`no live aide — spawn one under Ops → Fleets`,onClick:()=>_(`kickstart`),children:a===`kickstart`?(0,B.jsx)(Ma,{size:12}):`Kickstart with the aide`}),i?.aide&&(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:()=>ad(i.aide),children:`Open the aide's thread`}),!i?.aide&&(0,B.jsx)(V,{to:`/ops/fleets`,className:`hover:no-underline`,children:(0,B.jsx)(K,{size:`sm`,children:`Spawn aide`})})]})]}),s&&(0,B.jsx)(`div`,{className:`font-mono text-[12px] ${/^sent/.test(s)?`text-leaf`:`text-brick`}`,children:s})]}),t.length>0&&(0,B.jsxs)(`div`,{className:`px-3 pt-3 pb-2 overflow-x-auto`,children:[(0,B.jsx)(`ol`,{className:`flex items-start gap-0 min-w-max`,children:t.map((e,n)=>{let r=Ed[e.state],i=e.total?Math.round(e.done/e.total*100):0,o=n===t.length-1;return(0,B.jsxs)(`li`,{className:`flex items-start`,children:[(0,B.jsxs)(`div`,{className:`w-[190px] grid gap-1.5 justify-items-center text-center`,children:[(0,B.jsxs)(`button`,{onClick:()=>u(t=>t===e.id?null:e.id),className:`relative border-0 bg-transparent p-0 cursor-pointer rounded-full ${l===e.id?`ring-2 ring-ember ring-offset-2 ring-offset-paper`:``}`,title:`show tasks`,children:[(0,B.jsx)(Dd,{pct:e.state===`complete`?100:i,cls:r.ring}),(0,B.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center font-mono font-bold text-[12px] ${r.ring}`,children:e.state===`complete`?`✓`:e.n})]}),(0,B.jsx)(`button`,{onClick:()=>u(t=>t===e.id?null:e.id),className:`font-semibold text-[13px] leading-tight line-clamp-2 px-1 border-0 bg-transparent cursor-pointer text-walnut hover:text-ember-deep`,title:e.title,children:e.title}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(G,{tone:r.tone,children:r.label}),(0,B.jsxs)(`span`,{className:`font-mono text-[11px] text-ink3`,children:[e.total?`${e.done}/${e.total}`:`—`,e.streams?` · ${e.streams} stream${e.streams===1?``:`s`}`:``]})]}),f[e.id]&&(0,B.jsxs)(`div`,{className:`font-mono text-[10px] text-ink3 flex items-center gap-1 justify-center flex-wrap`,title:new Date(f[e.id].ts).toLocaleString(),children:[(0,B.jsx)(`span`,{className:`uppercase tracking-[.06em]`,children:f[e.id].verb===`kickoff`?`kicked off`:f[e.id].verb===`plan`?`plan requested`:`audit requested`}),(0,B.jsx)(`span`,{children:`→`}),(0,B.jsx)(ed,{id:f[e.id].to,bare:!0}),(0,B.jsx)(`span`,{className:`text-tan`,children:h(f[e.id].ts)})]}),(0,B.jsxs)(`div`,{className:`flex gap-1 flex-wrap justify-center`,children:[(e.tasks||e.readme)&&(0,B.jsx)(V,{to:`/docs/${encodeURIComponent(e.tasks??e.readme)}`,className:`hover:no-underline`,children:(0,B.jsx)(K,{size:`sm`,tone:`ghost`,children:`Open`})}),e.state===`pending`&&(0,B.jsx)(K,{size:`sm`,tone:`primary`,disabled:!!a,title:`DM the aide: run /plan-phase`,onClick:()=>g(e,`plan`),children:a===`${e.id}:plan`?(0,B.jsx)(Ma,{size:12}):`Plan`}),e.state===`planned`&&(0,B.jsx)(K,{size:`sm`,tone:`primary`,disabled:!!a,title:`GO to the coordinator`,onClick:()=>g(e,`kickoff`),children:a===`${e.id}:kickoff`?(0,B.jsx)(Ma,{size:12}):`Kick off`}),e.state===`ongoing`&&(0,B.jsx)(K,{size:`sm`,disabled:!!a,title:`ask the coordinator to run /coord-audit`,onClick:()=>g(e,`audit`),children:a===`${e.id}:audit`?(0,B.jsx)(Ma,{size:12}):`Audit`})]})]}),!o&&(0,B.jsx)(`div`,{className:`mt-[21px] h-[3px] w-6 rounded ${e.state===`complete`?`bg-leaf`:`bg-sand`}`})]},e.id)})}),l&&(0,B.jsx)(Vu,{project:e,phase:t.find(e=>e.id===l),onClose:()=>u(null)}),s&&(0,B.jsx)(`div`,{className:`mt-2 font-mono text-[12px] flex items-center gap-2 ${/^sent/.test(s)?`text-leaf`:`text-brick`}`,children:/^sent → /.test(s)?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:`sent →`}),(0,B.jsx)(ed,{id:s.replace(/^sent → /,``),bare:!0})]}):s}),(0,B.jsx)(`div`,{className:`mt-2 font-mono text-[11px] text-tan flex gap-3 flex-wrap`,children:Object.keys(Ed).map(e=>(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full border mr-1 align-middle ${Ed[e].dot}`}),Ed[e].label,` — `,Ed[e].hint]},e))})]})]})}function kd({phases:e}){return e?.length?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:e.map(e=>`${e.n}: ${e.state}${e.total?` ${e.done}/${e.total}`:``}`).join(` · `),children:[e.map((e,t)=>(0,B.jsx)(`span`,{className:`inline-block w-2.5 h-2.5 rounded-full border ${Ed[e.state].dot}`},t)),(0,B.jsxs)(`span`,{className:`ml-1 font-mono text-[11px] text-ink3`,children:[e.filter(e=>e.state===`complete`).length,`/`,e.length]})]}):(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-tan`,children:`no phases`})}function Ad({project:e,canWrite:t,onClose:n,initialRole:r}){let{data:i}=q(`/actions/spawn/options?project=${encodeURIComponent(e)}`),[a,o]=(0,P.useState)(r??`worker`),[s,c]=(0,P.useState)(`claude`),[l,u]=(0,P.useState)(``),[d,f]=(0,P.useState)(``),[p,m]=(0,P.useState)(``),[h,g]=(0,P.useState)(``),[_,v]=(0,P.useState)(8),[y,b]=(0,P.useState)(!1),[x,S]=(0,P.useState)(null),[C,w]=(0,P.useState)(null),T=ar(),{runs:E}=Ha(),D=x?E.find(e=>e.id===x.id)??x:null;(0,P.useEffect)(()=>{i&&!l&&u(i.suggest[a]??``)},[i,a,l]),(0,P.useEffect)(()=>{i&&u(i.suggest[a]??``)},[a]);let O=async()=>{b(!0),w(null);try{let t=await Fa(`/actions/spawn`,{project:e,role:a,harness:s,agentId:l,lane:d||void 0,model:p||void 0,note:h||void 0,waitSeconds:_});if(!t.status)throw Error(t.error??`failed`);S(t)}catch(e){w(e.message)}finally{b(!1)}},k=i?.roles.find(e=>e.id===a)?.skill??``;return(0,B.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-walnut/30 flex items-start justify-center pt-[8vh] whitespace-normal text-left`,onMouseDown:e=>{e.target===e.currentTarget&&!y&&n()},children:(0,B.jsxs)(`div`,{className:`w-[640px] bg-paper border border-sand rounded-kit shadow-panel`,children:[(0,B.jsxs)(`div`,{className:`px-4 py-3 border-b border-sand font-display font-bold text-[18px] text-umber`,children:[`Spawn agent · `,e]}),(0,B.jsxs)(`div`,{className:`p-4 grid gap-3 text-[13px]`,children:[(0,B.jsxs)(`div`,{className:`flex gap-1.5 flex-wrap items-center text-umber`,children:[(0,B.jsx)(G,{tone:t?`warn`:`outline`,children:t?`bus writes on`:`bus writes OFF`}),(0,B.jsxs)(`span`,{children:[`tmux window `,(0,B.jsxs)(`code`,{children:[`fleet-`,e]}),` · cwd `,(0,B.jsx)(`code`,{children:i?.repoPath?.replace(/^\/Users\/[^/]+/,`~`)}),i?.room?(0,B.jsxs)(B.Fragment,{children:[` · room `,(0,B.jsxs)(`code`,{children:[`#`,i.room]})]}):` · no room linked`]})]}),!t&&(0,B.jsx)(`div`,{className:`text-brick`,children:`Turn on bus writes (header toggle) first — spawning launches a process and types the role invocation into the new pane.`}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Role · playbook card`}),(0,B.jsx)(`select`,{value:a,onChange:e=>o(e.target.value),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`,children:(i?.roles??[]).map(e=>(0,B.jsxs)(`option`,{value:e.id,children:[e.id,` · `,e.skill]},e.id))})]}),(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Harness`}),(0,B.jsx)(`select`,{value:s,onChange:e=>c(e.target.value),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`,children:(i?.harnesses??[]).map(e=>(0,B.jsxs)(`option`,{value:e.id,children:[e.id,` · `,e.cmd]},e.id))})]}),(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Agent id`}),(0,B.jsx)(`input`,{value:l,onChange:e=>u(e.target.value.trim()),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]}),a===`worker`?(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Lane`}),(0,B.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),placeholder:`repo-owner · rendering · api`,className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]}):(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Model (Claude only, optional)`}),(0,B.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),placeholder:`claude-sonnet-4-6`,className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]})]}),(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Extra instruction (optional, injected after the skill)`}),(0,B.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),placeholder:`e.g. mission: re-verify the design doc after PR4`,className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3 text-umber`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Start wait`}),(0,B.jsx)(`input`,{type:`range`,min:3,max:30,value:_,onChange:e=>v(Number(e.target.value))}),(0,B.jsxs)(`span`,{className:`font-mono text-[12px]`,children:[_,` s`]}),(0,B.jsx)(`span`,{className:`text-[12px]`,children:`before injecting the skill`})]}),(0,B.jsxs)(`div`,{className:`font-mono text-[12px] text-ink3 bg-linen rounded px-2 py-1.5`,children:[`will type: `,(0,B.jsx)(`b`,{className:`text-walnut`,children:i?.harnesses.find(e=>e.id===s)?.cmd}),` → wait `,_,` s → `,s===`claude`?`/color · `:``,(0,B.jsxs)(`b`,{className:`text-walnut`,children:[k,` --id=`,l||`…`,d?` --lane=${d}`:``,i?.room?` --room=${i.room}`:``]}),` → wait for register (≤ 90 s)`]}),C&&(0,B.jsx)(`div`,{className:`text-brick`,children:C}),D&&(0,B.jsxs)(`div`,{className:`p-2 rounded-kit border ${D.status===`ok`?`border-moss-line bg-moss-wash/50`:D.status===`failed`?`border-brick-line bg-brick-wash/50`:`border-amber-line bg-amber-wash/40`}`,children:[(0,B.jsxs)(`div`,{className:`font-mono text-[12px]`,children:[D.status===`running`?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-amber`,children:[(0,B.jsx)(Ma,{}),` `,(0,B.jsx)(G,{tone:`warn`,children:`running`})]}):(0,B.jsx)(G,{tone:D.status===`ok`?`ok`:`bad`,children:D.status}),` `,(0,B.jsx)(`b`,{children:D.label}),D.status===`running`&&(0,B.jsx)(`span`,{className:`ml-2 text-tan`,children:`live — you can close this; it keeps running (see Runs)`})]}),(0,B.jsxs)(`pre`,{className:`m-0 mt-1 font-mono text-[12px] whitespace-pre-wrap max-h-[30vh] overflow-auto`,children:[D.log.join(`
28
+ `);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{onClick:()=>l(!0),className:`w-full text-left rounded-[4px] overflow-hidden border border-sand bg-transparent p-0 cursor-pointer group ${n}`,title:`${e} · pane ${i?.pane??``} · click for the full view`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-[3px] bg-linen border-b border-sand`,children:[(0,B.jsx)(`span`,{className:`relative inline-block w-1.5 h-1.5 rounded-full ${i?.active?`bg-moss`:`bg-dust`}`,children:i?.active&&(0,B.jsx)(`span`,{className:`absolute inset-0 rounded-full bg-moss animate-ping opacity-60`})}),(0,B.jsx)(`span`,{className:`font-mono text-[10px] text-ink3 truncate`,children:r??e}),(0,B.jsx)(`span`,{className:`ml-auto font-mono text-[10px] text-tan`,children:i?i.active?`active`:`quiet ${Qu(i.paneActivity)}`:`…`})]}),(0,B.jsx)(`pre`,{className:`m-0 px-2 py-1 pane-dark font-mono text-[10.5px] leading-[1.35] whitespace-pre-wrap break-words max-h-[calc(1.35em*4+8px)] overflow-hidden group-hover:opacity-90`,style:{maxHeight:`calc(1.35em * ${t} + 8px)`},children:o?(0,B.jsx)(`span`,{className:`text-brick`,children:o}):i?i.ansi?uo(u(i.ansi)):u(i.text):`capturing…`})]}),c&&(0,B.jsx)(Yu,{agentId:e,onClose:()=>l(!1)})]})}function ed({id:e,prefix:t,size:n=`sm`,className:r=``,bare:i=!1,noDot:a=!1}){let o=(q(`/bus/agents`,2e4).data??[]).find(t=>t.agentId===e),[s,c]=(0,P.useState)(!1),[l,u]=(0,P.useState)(!1),d=(0,P.useRef)(null),f=()=>{d.current&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>c(!0),250)},p=()=>{d.current&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>c(!1),200)};(0,P.useEffect)(()=>()=>{d.current&&window.clearTimeout(d.current)},[]);let m=!!o?.pane;return(0,B.jsxs)(`span`,{className:`relative inline-flex ${r}`,onMouseEnter:f,onMouseLeave:p,children:[(0,B.jsxs)(`button`,{onClick:()=>m&&u(!0),className:i?`inline-flex items-center gap-1.5 font-mono font-semibold ${n===`sm`?`text-[12px]`:`text-[13px]`} border-0 bg-transparent p-0 text-walnut ${m?`cursor-pointer hover:text-ember-deep`:`cursor-default`}`:`inline-flex items-center gap-1.5 rounded-full border font-mono ${n===`sm`?`text-[11px] px-2 py-0.5`:`text-[12px] px-2.5 py-1`} ${m?`cursor-pointer border-dust bg-paper hover:border-ember`:`cursor-default border-sand bg-linen/60`} text-walnut`,title:m?`${e} · pane ${o.pane} · click to pop out`:`${e}${o?` · ${o.liveness}`:` · not on the bus`}`,children:[t&&(0,B.jsx)(`span`,{className:`text-tan`,children:t}),!a&&(0,B.jsx)(Mu,{id:e,role:o?.role,size:n===`sm`?14:18,state:o?.liveness??`dead`,active:o?.active}),(0,B.jsx)(`span`,{className:`truncate max-w-[220px]`,children:e}),o&&!o.transport&&o.liveness!==`dead`&&(0,B.jsx)(`span`,{className:`text-amber`,title:`not attached — DMs won't reach its pane`,children:`⚠`})]}),s&&m&&(0,B.jsx)(`span`,{className:`absolute left-0 top-[calc(100%+6px)] z-50 w-[420px] whitespace-normal text-left`,onMouseEnter:f,onMouseLeave:p,children:(0,B.jsx)($u,{agentId:e,lines:6,label:`${e} · ${o.role??``}`,className:`shadow-panel bg-paper`})}),l&&(0,B.jsx)(Yu,{agentId:e,onClose:()=>u(!1)})]})}var td=[{re:/coordinator/i,label:`coordinator`,dot:`#4A6A2C`,ring:`#B9CFA0`},{re:/aide|liaison|curator/i,label:`aide`,dot:`#C4587A`,ring:`#F0C2D2`},{re:/\bqa\b|quality/i,label:`qa`,dot:`#C88A1E`,ring:`#F0DFA6`},{re:/\bci\b/i,label:`ci`,dot:`#E8702A`,ring:`#F6C9A6`},{re:/audit/i,label:`audit`,dot:`#7A4A6A`,ring:`#DDBFD3`},{re:/automation/i,label:`automation`,dot:`#8A7660`,ring:`#D9CDBB`},{re:/human|david/i,label:`human`,dot:`#B7521A`,ring:`#F6C9A6`}],nd=e=>td.find(t=>t.re.test(e??``))?.dot??`#5C7A96`,rd=e=>td.find(t=>t.re.test(e??``))?.label??`worker`;function id(){let{projects:e,current:t}=za(),n=q(`/bus/agents`,15e3).data??[],r=e.find(e=>e.name===t)?.room,i=n.filter(e=>e.liveness!==`dead`&&![`groundwork-console`,`david`].includes(e.agentId)&&(e.project===t||r&&e.project===r)),a=n.filter(e=>e.liveness!==`dead`&&![`groundwork-console`,`david`].includes(e.agentId)&&!i.includes(e)),o=e=>[`aide`,`coordinator`,`qa`,`ci`,`worker`,`audit`].indexOf(rd(e.role))+1||9,s=[...i].sort((e,t)=>o(e)-o(t)||e.agentId.localeCompare(t.agentId)),[c,l]=(0,P.useState)(!1);return(0,B.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-1.5 border-b border-sand bg-paper/70 min-h-[34px] whitespace-nowrap overflow-x-auto [scrollbar-width:none]`,children:[(0,B.jsxs)(`span`,{className:`font-mono text-[10px] uppercase tracking-[.1em] text-tan shrink-0`,children:[`online · `,t||`—`]}),s.length===0&&(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-tan`,children:`no agents for this project`}),s.map(e=>(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full border border-sand bg-paper`,style:{borderColor:nd(e.role)+`66`},title:`${e.agentId} · ${rd(e.role)}${e.pane?` · ${e.pane}`:``}`,children:[(0,B.jsx)(Mu,{id:e.agentId,role:e.role,size:16,state:e.liveness,active:e.active}),(0,B.jsx)(ed,{id:e.agentId,bare:!0,noDot:!0,size:`sm`}),(0,B.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[.06em]`,style:{color:nd(e.role)},children:rd(e.role)})]},e.agentId)),c&&a.map(e=>(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full border border-dashed border-sand bg-cream/60`,title:`${e.agentId} · ${rd(e.role)} · ${e.project??`?`}`,children:[(0,B.jsx)(Mu,{id:e.agentId,role:e.role,size:16,state:e.liveness,active:e.active}),(0,B.jsx)(ed,{id:e.agentId,bare:!0,noDot:!0,size:`sm`}),(0,B.jsx)(`span`,{className:`font-mono text-[10px] text-tan`,children:e.project})]},e.agentId)),a.length>0&&(0,B.jsx)(`button`,{onClick:()=>l(e=>!e),"aria-pressed":c,className:`ml-auto font-mono text-[11px] text-ink3 shrink-0 border-0 bg-transparent cursor-pointer hover:text-umber`,title:c?`show only this project`:a.map(e=>e.agentId).join(`, `),children:c?`only this project`:`+${a.length} elsewhere`}),(0,B.jsx)(`span`,{className:`ml-3 font-mono text-[10px] text-tan shrink-0 hidden xl:inline-flex items-center gap-2`,children:[[`coordinator`,`#4A6A2C`],[`aide`,`#C4587A`],[`qa`,`#C88A1E`],[`ci`,`#E8702A`],[`worker`,`#5C7A96`]].map(([e,t])=>(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,B.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full`,style:{background:t}}),e]},e))})]})}var ad=(e,t)=>window.dispatchEvent(new CustomEvent(`groundwork-console:summon`,{detail:{agentId:e,answers:t?.answers}})),od=e=>`groundwork-console.summon.${e}`,sd=e=>`groundwork-console.summon.seen.${e}`;function cd(e){let t=rr(),n=t.pathname.match(/^\/docs\/(.+)$/),r=new URLSearchParams(t.search);if(n){let t=decodeURIComponent(n[1]),i=r.get(`line`);return t.startsWith(`kb:`)?{label:`knowledge/${t.slice(3)}${i?`:${i}`:``}`,cite:`groundwork-knowledge/${t.slice(3)}${i?`:${i}`:``}`}:{label:`${t}${i?`:${i}`:``}`,cite:`${e}/docs/${t}${i?`:${i}`:``}`}}let i=t.pathname===`/`?`home`:t.pathname.slice(1).split(`/`)[0];return{label:i,cite:`groundwork-console /${i}${e?` · ${e}`:``}`}}function ld(){let{current:e}=za(),t=q(`/bus/agents`,2e4).data??[],n=q(e?`/projects/${e}/agents`:null,3e4).data,r=t.filter(e=>e.liveness!==`dead`&&e.agentId!==`david`&&e.agentId!==`groundwork-console`),[i,a]=(0,P.useState)(()=>e?localStorage.getItem(od(e)):null);(0,P.useEffect)(()=>{a(e?localStorage.getItem(od(e)):null)},[e]);let o=(i&&t.some(e=>e.agentId===i)?i:null)??n?.aide??n?.coordinator??r[0]?.agentId??null,s=t.find(e=>e.agentId===o),[c,l]=(0,P.useState)(!1),[u,d]=(0,P.useState)(!1),f=t=>{a(t),e&&localStorage.setItem(od(e),t),d(!1),l(!0)},p=q(o?`/bus/dm/${encodeURIComponent(o)}?limit=80`:null,c?4e3:2e4).data,m=q(`/bus/inbox?limit=100`,2e4).data?.decisions??{},[h,g]=(0,P.useState)(0);(0,P.useEffect)(()=>{o&&g(Number(localStorage.getItem(sd(o))??0))},[o]),(0,P.useEffect)(()=>{c&&o&&p&&(localStorage.setItem(sd(o),String(p.lastFromAgent)),g(p.lastFromAgent))},[c,o,p]);let _=!!p&&p.lastFromAgent>h;(0,P.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(d(!1),l(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let[v,y]=(0,P.useState)([]);if((0,P.useEffect)(()=>{let e=e=>{let t=e.detail;y(t?.answers??[]),t?.agentId?f(t.agentId):(l(!1),d(!0))};return window.addEventListener(`groundwork-console:summon`,e),()=>window.removeEventListener(`groundwork-console:summon`,e)}),!o)return null;let b=r.length,x=r,S=e=>{let t=(b===1?.5:e/(b-1))*(Math.PI/2);return{x:-Math.sin(t)*96,y:-Math.cos(t)*96}};return(0,B.jsxs)(B.Fragment,{children:[c&&(0,B.jsx)(fd,{agentId:o,me:s,project:e,thread:p??void 0,answers:v,onAnswered:()=>y([]),onClose:()=>l(!1),onSwitch:()=>{d(!0)}}),(0,B.jsxs)(`div`,{className:`fixed right-5 bottom-5 z-[55]`,style:{width:52,height:52},children:[u&&(0,B.jsxs)(`div`,{className:`absolute inset-0`,"aria-label":`pick an agent`,children:[x.map((e,t)=>{let n=S(t);return(0,B.jsxs)(`button`,{onClick:()=>f(e.agentId),title:`${e.agentId} · ${rd(e.role)}`,className:`absolute rounded-full border-2 bg-paper shadow-panel cursor-pointer p-[3px] transition-transform hover:scale-110`,style:{left:26+n.x-17,top:26+n.y-17,borderColor:nd(e.role),width:34,height:34,animation:`summon-pop .18s ease-out ${t*30}ms both`},children:[(0,B.jsx)(Mu,{id:e.agentId,role:e.role,size:26,state:e.liveness,active:e.active}),m[e.agentId]?(0,B.jsx)(ud,{n:m[e.agentId],small:!0}):null]},e.agentId)}),x.length===0&&(0,B.jsx)(`span`,{className:`absolute right-0 bottom-14 whitespace-nowrap font-mono text-[11px] text-tan bg-paper border border-sand rounded-kit px-2 py-1`,children:`no live agents`})]}),(0,B.jsxs)(`button`,{onClick:()=>u?d(!1):l(e=>!e),title:`${o} · ${rd(s?.role)} — click to chat`,className:`absolute inset-0 rounded-full border-2 bg-paper shadow-panel cursor-pointer p-1 hover:scale-105 transition-transform`,style:{borderColor:nd(s?.role)},children:[(0,B.jsx)(Mu,{id:o,role:s?.role,size:40,state:s?.liveness??`dead`,active:s?.active}),m[o]?(0,B.jsx)(ud,{n:m[o]}):_&&(0,B.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 w-3 h-3 rounded-full bg-ember border-2 border-paper`,title:`new message`})]}),(0,B.jsx)(`button`,{onClick:()=>d(e=>!e),"aria-pressed":u,title:`pick another agent`,className:`absolute -left-2 -top-2 w-6 h-6 rounded-full border border-dust shadow-panel cursor-pointer text-[13px] leading-none flex items-center justify-center ${u?`bg-walnut text-paper`:`bg-paper text-umber`}`,children:u?`×`:`+`})]}),(0,B.jsx)(`style`,{children:`.summon-dots{display:inline-flex;gap:3px}.summon-dots i{width:5px;height:5px;border-radius:50%;background:currentColor;opacity:.25;animation:summon-dot 1.2s infinite}.summon-dots i:nth-child(2){animation-delay:.2s}.summon-dots i:nth-child(3){animation-delay:.4s}@keyframes summon-dot{0%,80%,100%{opacity:.25}40%{opacity:1}}@keyframes summon-pop{from{transform:scale(.4);opacity:0}to{transform:scale(1);opacity:1}}@keyframes summon-pulse{0%,100%{box-shadow:0 0 0 0 rgba(200,120,42,.55)}50%{box-shadow:0 0 0 6px rgba(200,120,42,0)}}`})]})}function ud({n:e,small:t=!1}){return(0,B.jsx)(`span`,{className:`absolute -top-1 -right-1 rounded-full bg-ember text-paper border-2 border-paper font-mono font-bold flex items-center justify-center leading-none ${t?`w-4 h-4 text-[9px]`:`w-5 h-5 text-[10px]`}`,title:`${e} decision${e===1?``:`s`} waiting on you`,style:{animation:`summon-pulse 1.6s ease-in-out infinite`},children:`★`})}var dd=e=>{let t=Math.round(e/1e3);return t<60?`${t} s`:t<3600?`${Math.floor(t/60)} min`:`${Math.floor(t/3600)} h`};function fd({agentId:e,me:t,project:n,thread:r,answers:i=[],onAnswered:a,onClose:o,onSwitch:s}){let c=q(`/admin/bus-writes`,1e4).data?.enabled??!1,l=cd(n),[u,d]=(0,P.useState)(!0),[f,p]=(0,P.useState)(``),[m,h]=(0,P.useState)(null),[g,_]=(0,P.useState)(!1),[v,y]=(0,P.useState)(()=>localStorage.getItem(`groundwork-console.summon.max`)===`1`),b=()=>y(e=>(localStorage.setItem(`groundwork-console.summon.max`,e?`0`:`1`),!e)),x=Gu(),S=(0,P.useRef)(null),[C,w]=(0,P.useState)([]),T=r?.messages??[],E=C.filter(e=>!T.some(t=>t.from===`david`&&Number(t.ts??0)>=Number(e.ts??0)-2e3&&(t.text??``)===(e.text??``))),D=[...T,...E],[O,k]=(0,P.useState)(0);(0,P.useEffect)(()=>{let e=setInterval(()=>k(e=>e+1),1e3);return()=>clearInterval(e)},[]);let A=(q(`/bus/agents`,4e3).data??[]).find(t=>t.agentId===e)??t,j=A?.paneActivity?Date.now()-A.paneActivity:1/0,M=j<2e4,N=([...D].reverse().find(e=>e.from===`david`)?.ts??0)>([...D].reverse().find(e=>e.from!==`david`)?.ts??0);(0,P.useEffect)(()=>{S.current&&(S.current.scrollTop=S.current.scrollHeight)},[D.length,M,N]);let ee=async()=>{if(!x.hasContent(f))return;h(`sending`);let t=x.withRefs(f.trim()),n=u?`${t}\n(context: ${l.cite})`:t,r={id:`local-${Date.now()}`,ts:Date.now(),from:`david`,to:e,text:n,prefix:null,pending:!0};w(e=>[...e,r]),p(``),x.clear();try{let t=await Fa(`/actions/send`,{as:`david`,to:e,text:n,answers:i.length?i:void 0});if(t.status===`ok`)h(null),a?.();else{let e=t.error??t.log?.slice(-1)[0]??`failed`;h(e),w(t=>t.map(t=>t.id===r.id?{...t,failed:e}:t))}}catch(e){let t=e.message;h(t),w(e=>e.map(e=>e.id===r.id?{...e,failed:t}:e))}},F=e=>e?new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):``,I=(0,P.useMemo)(()=>D,[D]);return(0,B.jsxs)(B.Fragment,{children:[g&&(0,B.jsx)(Yu,{agentId:e,onClose:()=>_(!1)}),(0,B.jsxs)(`div`,{className:`fixed z-[54] bg-paper border border-sand rounded-kit shadow-panel grid grid-rows-[auto_minmax(0,1fr)_auto] whitespace-normal text-left transition-[width,height] duration-150 ${v?`right-5 bottom-[84px] w-[min(1100px,calc(100vw-40px))] h-[calc(100vh-110px)]`:`right-5 bottom-[84px] w-[min(400px,calc(100vw-40px))] h-[min(560px,calc(100vh-140px))]`}`,style:{borderTop:`3px solid ${nd(t?.role)}`},children:[(0,B.jsxs)(`div`,{className:`px-3 py-2 border-b border-sand flex items-center gap-2 min-w-0`,children:[(0,B.jsx)(Mu,{id:e,role:t?.role,size:22,state:t?.liveness??`dead`,active:t?.active}),(0,B.jsx)(`span`,{className:`font-display font-bold text-[14px] text-umber truncate`,children:e}),(0,B.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[.06em]`,style:{color:nd(t?.role)},children:rd(t?.role)}),t?(0,B.jsx)(G,{tone:t.liveness===`live`?`ok`:t.liveness===`idle`?`warn`:`bad`,children:t.active?`active`:t.liveness}):(0,B.jsx)(G,{tone:`bad`,children:`offline`}),(0,B.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[t?.pane&&(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:()=>_(!0),title:`open its pane`,children:`pane`}),(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:s,title:`summon another agent`,children:`switch`}),(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:b,title:v?`restore`:`maximize`,children:v?`⇲`:`⇱`}),(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:o,children:`✕`})]})]}),(0,B.jsxs)(`div`,{ref:S,className:`min-h-0 overflow-auto overscroll-contain px-3 py-2 grid gap-1.5 content-start bg-cream/40`,children:[!r&&(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-tan`,children:`loading thread…`}),r&&I.length===0&&(0,B.jsxs)(`span`,{className:`text-[12px] text-umber`,children:[`No DMs with `,e,` yet. Say what you need — it lands in its pane via tmux-push.`]}),I.map((e,t)=>{let n=e.from===`david`,r=String(e.text??``),i=e.prefix?r.replace(RegExp(`^${e.prefix}:?\\s*`),``):r;return(0,B.jsxs)(`div`,{className:`${e.pending?`opacity-70`:``} ${v?`max-w-[70%]`:`max-w-[88%]`} rounded-kit px-2.5 py-1.5 text-[12.5px] leading-snug whitespace-pre-wrap break-words border ${n?`justify-self-end bg-paper border-sand`:`justify-self-start bg-linen/70 border-sand/70`}`,children:[e.prefix&&(0,B.jsx)(Da,{prefix:e.prefix}),(0,B.jsx)(qu,{text:i}),(0,B.jsx)(`div`,{className:`font-mono text-[10px] mt-0.5 ${n?`text-right`:``} ${e.failed?`text-brick`:`text-tan`}`,children:e.failed?`not sent · ${e.failed}`:e.pending?`sending…`:F(e.ts)})]},e.id??t)}),(M||N)&&(0,B.jsx)(`div`,{className:`justify-self-start inline-flex items-center gap-2 px-2.5 py-1.5 rounded-kit border border-sand/70 bg-linen/50 font-mono text-[11px] text-ink3`,title:A?.paneActivity?`last pane output ${Math.round(j/1e3)} s ago`:`no pane activity`,children:M?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{className:`summon-dots`,"aria-hidden":!0,children:[(0,B.jsx)(`i`,{}),(0,B.jsx)(`i`,{}),(0,B.jsx)(`i`,{})]}),(0,B.jsxs)(`span`,{children:[e.split(`-`)[0],` is working`]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-tan`}),(0,B.jsxs)(`span`,{children:[`delivered · quiet for `,j===1/0?`a while`:dd(j)]})]})})]}),(0,B.jsxs)(`div`,{className:`px-3 py-2 border-t border-sand grid gap-1.5`,children:[(0,B.jsxs)(`label`,{className:`flex items-center gap-1.5 font-mono text-[11px] text-ink3 min-w-0`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>d(e.target.checked)}),(0,B.jsx)(`span`,{className:`shrink-0`,children:`context:`}),(0,B.jsx)(`span`,{className:`truncate text-umber`,title:l.cite,children:l.label})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] gap-1.5 items-center`,children:[(0,B.jsx)(`textarea`,{value:f,onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&c&&(e.preventDefault(),ee())},onPaste:x.onPaste,onDrop:x.onDrop,onDragOver:x.onDragOver,disabled:!c,rows:v?4:2,placeholder:c?`DM ${e} as david — Enter to send, ⇧Enter newline, paste images`:`bus writes are off (header badge)`,className:`text-[13px] px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut resize-none min-w-0`}),(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:ee,disabled:!c||!x.hasContent(f)||x.busy||m===`sending`,children:m===`sending`?`…`:`Send`})]}),(0,B.jsx)(Ku,{a:x}),m&&m!==`sending`&&(0,B.jsx)(`div`,{className:`font-mono text-[11px] text-brick`,children:m})]})]})]})}var pd={h:`/`,b:`/board`,m:`/monitor`,u:`/bus`,d:`/docs`,o:`/ops`},md=e=>{let t=e;return!!t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable)};function hd(){let e=ar(),[t,n]=(0,P.useState)(!1);return(0,P.useEffect)(()=>{let t=0,r=r=>{if(!(r.metaKey||r.ctrlKey||r.altKey||md(r.target))){if(r.key===`Escape`){n(!1);return}if(r.key===`?`){n(e=>!e);return}if(r.key===`/`){r.preventDefault(),ad(``);return}if(r.key===`g`){t=Date.now();return}Date.now()-t<900&&pd[r.key]&&(r.preventDefault(),e(pd[r.key]),t=0)}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e]),t?(0,B.jsx)(`div`,{className:`fixed inset-0 z-[70] bg-walnut/30 flex items-center justify-center`,onMouseDown:()=>n(!1),children:(0,B.jsxs)(`div`,{className:`bg-paper border border-sand rounded-kit shadow-panel p-4 grid gap-2 min-w-[320px]`,onMouseDown:e=>e.stopPropagation(),children:[(0,B.jsx)(`div`,{className:`font-display font-bold text-[15px] text-umber`,children:`Keyboard`}),[[`/`,`summon an agent (picker)`],[`g h`,`Home`],[`g b`,`Board`],[`g m`,`Monitor`],[`g u`,`Bus`],[`g d`,`Docs`],[`g o`,`Ops`],[`Esc`,`close drawer / picker / this`],[`?`,`toggle this list`]].map(([e,t])=>(0,B.jsxs)(`div`,{className:`grid grid-cols-[64px_1fr] gap-3 items-baseline text-[13px]`,children:[(0,B.jsx)(`kbd`,{className:`font-mono text-[12px] px-1.5 py-0.5 border border-dust rounded bg-cream text-walnut justify-self-start`,children:e}),(0,B.jsx)(`span`,{className:`text-umber`,children:t})]},e)),(0,B.jsx)(`div`,{className:`font-mono text-[11px] text-tan mt-1`,children:`In the Summon drawer: Enter sends · ⇧Enter newline · paste images.`})]})}):null}var gd=`/api`;function _d({children:e}){let[t,n]=(0,P.useState)(`checking`),[r,i]=(0,P.useState)(``),[a,o]=(0,P.useState)(null),[s,c]=(0,P.useState)(!1),l=async()=>{try{let e=await(await fetch(`${gd}/auth/status`)).json();n(e.authed?`in`:`out`)}catch{n(`offline`)}};(0,P.useEffect)(()=>{l()},[]),(0,P.useEffect)(()=>{t!==`in`&&fetch(`${gd}/health`).then(e=>e.json()).then(e=>{document.title=e.hostname?`Sign in · ${e.hostname}`:`Sign in · Groundwork Console`}).catch(()=>{document.title=`Sign in · Groundwork Console`})},[t]),(0,P.useEffect)(()=>{let e=()=>n(`out`);return window.addEventListener(`groundwork-console:unauthorized`,e),()=>window.removeEventListener(`groundwork-console:unauthorized`,e)},[]);let u=async()=>{c(!0),o(null);try{let e=await fetch(`${gd}/auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:r})}),t=await e.json();if(!e.ok)throw Error(t.error??`${e.status}`);i(``),n(`in`)}catch(e){o(e.message)}finally{c(!1)}};return t===`in`?(0,B.jsx)(B.Fragment,{children:e}):t===`checking`?(0,B.jsx)(`div`,{className:`min-h-screen grid place-items-center font-mono text-[12px] text-tan`,children:`checking session…`}):(0,B.jsx)(`div`,{className:`min-h-screen grid place-items-center bg-cream p-6`,children:(0,B.jsxs)(`div`,{className:`w-[380px] bg-paper border border-sand rounded-kit shadow-panel`,children:[(0,B.jsxs)(`div`,{className:`px-5 py-4 border-b border-sand flex items-center gap-2 font-display font-bold text-[18px] text-ember`,children:[(0,B.jsx)(Na,{}),` Groundwork Console`]}),(0,B.jsx)(`div`,{className:`p-5 grid gap-3 text-[13px]`,children:t===`offline`?(0,B.jsxs)(`div`,{className:`text-brick`,children:[`API unreachable — start it with `,(0,B.jsx)(`code`,{children:`pnpm dev:api`}),`, then `,(0,B.jsx)(`button`,{className:`underline border-0 bg-transparent p-0 cursor-pointer text-ember-deep`,onClick:l,children:`retry`}),`.`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`text-umber`,children:[`This console can write to your bus and docs. Enter the console token — it's in `,(0,B.jsx)(`code`,{className:`font-mono text-[12px]`,children:`~/.groundwork-console/token`}),` on the machine running the API (or `,(0,B.jsx)(`code`,{className:`font-mono text-[12px]`,children:`GROUNDWORK_CONSOLE_TOKEN`}),`).`]}),(0,B.jsx)(`input`,{type:`password`,autoFocus:!0,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&r&&u()},placeholder:`token`,className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`}),a&&(0,B.jsx)(`div`,{className:`text-brick`,children:a}),(0,B.jsx)(K,{tone:`primary`,onClick:u,disabled:!r||s,children:s?`Signing in…`:`Sign in`}),(0,B.jsx)(`div`,{className:`font-mono text-[11px] text-tan`,children:`Cookie lasts 30 days on this browser. Single shared token — no accounts.`})]})})]})})}var vd=[{to:`/`,label:`Home`,icon:`home`},{to:`/board`,label:`Board`,icon:`board`},{to:`/bus`,label:`Bus`,icon:`bus`},{to:`/monitor`,label:`Monitor`,icon:`monitor`},{to:`/docs`,label:`Docs`,icon:`docs`},{to:`/ops`,label:`Ops`,icon:`fleet`}];function $(){let{error:e}=za(),{running:t}=Ha(),n=q(`/bus/unread`,3e4).data?.inbox??0,r=q(`/kit`).data,i=q(`/health`,6e4).data?.hostname,a=rr();(0,P.useEffect)(()=>{let e=a.pathname===`/`?``:a.pathname.split(`/`)[1],t=vd.find(t=>t.to===`/`?e===``:t.to===`/${e}`)?.label??(e?e[0].toUpperCase()+e.slice(1):`Home`);document.title=i?`${t} · ${i}`:t},[a.pathname,i]);let o=r?.packages?`${r.name} ${r.kitVersion} · seam ${r.packages.seam?.version} · mcp ${r.packages.mcp?.version}`:`kit · offline`;return(0,B.jsx)(_d,{children:(0,B.jsx)(Du,{children:(0,B.jsxs)(`div`,{className:`grid grid-rows-[48px_auto_1fr] min-h-screen`,children:[(0,B.jsxs)(`header`,{className:`grid grid-cols-[auto_auto_1fr] items-center gap-4 px-4 border-b border-sand bg-cream min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 font-display font-bold text-[16px] text-ember whitespace-nowrap`,title:o,children:[(0,B.jsx)(Na,{}),` Groundwork Console`]}),(0,B.jsx)(`nav`,{className:`flex gap-0.5 whitespace-nowrap`,children:vd.map(e=>(0,B.jsxs)(ji,{to:e.to===`/bus`&&n>0?`/bus?view=inbox`:e.to,end:e.to===`/`,className:({isActive:e})=>`inline-flex items-center gap-1.5 px-3 py-2 rounded-kit font-medium ${e?`bg-paper text-walnut shadow-[inset_0_0_0_1px_var(--color-sand)]`:`text-umber hover:no-underline hover:bg-linen`}`,children:[(0,B.jsx)(`span`,{className:`text-tan`,children:Ca[e.icon]({size:16})}),(0,B.jsx)(`span`,{className:`hidden xl:inline`,children:e.label}),e.to===`/ops`&&t>0?(0,B.jsxs)(`span`,{className:`ml-1.5 inline-flex items-center gap-1 text-amber`,children:[(0,B.jsx)(Ma,{size:12}),(0,B.jsx)(G,{tone:`warn`,children:t})]}):null,e.to===`/bus`&&n>0?(0,B.jsx)(`span`,{className:`ml-1.5 inline-flex`,title:`${n} unread DM(s) to david`,children:(0,B.jsx)(G,{tone:`david`,children:n})}):null,e.badge?(0,B.jsx)(`span`,{className:`ml-1.5 inline-flex`,children:(0,B.jsx)(G,{tone:`david`,children:e.badge})}):null]},e.to))}),(0,B.jsxs)(`div`,{className:`flex gap-0.5 items-center justify-end min-w-0 whitespace-nowrap`,children:[e&&(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-brick mr-2`,title:e,children:`api offline`}),(0,B.jsx)(Ga,{}),(0,B.jsx)(Ya,{}),(0,B.jsx)(Ja,{}),(0,B.jsx)(J,{}),(0,B.jsx)(`button`,{onClick:async()=>{await fetch(`/api/auth/logout`,{method:`POST`}),window.dispatchEvent(new Event(`groundwork-console:unauthorized`))},className:`ml-1 font-mono text-[11px] text-tan border-0 bg-transparent cursor-pointer hover:text-umber`,title:`sign out (clears the session cookie)`,children:`⎋`})]})]}),(0,B.jsx)(id,{}),(0,B.jsx)(Rr,{}),(0,B.jsx)(ao,{}),(0,B.jsx)(ld,{}),(0,B.jsx)(hd,{})]})})})}function yd(e,t=Date.now()){let n=Math.max(0,(t-e)/1e3)/60,r=n/60,i=r/24;if(n<1)return`just now`;if(r<1)return`${Math.floor(n)} min ago`;if(i<1)return`${Math.floor(r)} h ago`;if(i<2)return`yesterday`;if(i<7)return`${Math.floor(i)} days ago`;let a=i/7;if(a<2)return`last week`;if(i<30)return`${Math.floor(a)} weeks ago`;let o=i/30;return o<2?`last month`:i<365?`${Math.floor(o)} months ago`:i<730?`last year`:`${Math.floor(i/365)} years ago`}function bd(e,t=Date.now()){let n=(t-e)/864e5;return n<1?`text-tan`:n<7?`text-amber`:`text-brick font-semibold`}var xd=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),Sd=e=>!!e&&Ta.includes(e),Cd={"state.fact.stale":`warn`,"state.board.malformed":`bad`,"state.decision.open":`david`,"state.phase.active":`neutral`,"phase.completed":`ok`,"phase.started":`ok`,"phase.progress":`neutral`,"done.appended":`ok`,"queue.item.added":`neutral`,"queue.item.closed":`ok`,"fact.stale":`warn`,"board.malformed":`bad`,"decision.posted":`david`};function wd(){let{data:e,refresh:t}=q(`/events?limit=40`,15e3),[n,r]=(0,P.useState)(!1),[i,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(!1),c=async(e,n)=>{s(!0);try{await Fa(`/events/config`,{rule:e,enabled:n}),t()}finally{s(!1)}},l=async e=>{s(!0);try{await Fa(`/events/config`,{dryRun:e,confirm:e?void 0:i}),t(),r(!1),a(``)}finally{s(!1)}},[u,d]=(0,P.useState)([]);(0,P.useEffect)(()=>{let e=new EventSource(`/api/events/stream`);return e.onmessage=e=>{let t=JSON.parse(e.data);t.type!==`hello`&&d(e=>{let n=e.findIndex(e=>e.id===t.id);if(n>=0){let r=e.slice();return r[n]=t,r}return[t,...e].slice(0,40)})},()=>e.close()},[]);let f=[...u,...(e?.recent??[]).filter(e=>!u.some(t=>t.id===e.id)).slice().reverse()].slice(0,40),p=e?.config;return(0,B.jsxs)(U,{children:[(0,B.jsxs)(W,{title:`Events`,icon:`health`,path:p?`${p.identity.displayName??p.identity.agentId} · ${p.rules.filter(e=>e.enabled).length}/${p.rules.length} rules enabled · dedupe ${p.limits?.dedupeTtlHours??72} h · max ${p.limits?.maxPerRulePerProjectPerHour??3}/h`:`detector`,children:[p&&(p.live?(0,B.jsx)(G,{tone:`bad`,children:`LIVE — sending`}):p.dryRun?(0,B.jsx)(G,{tone:`outline`,children:`dry-run`}):(0,B.jsx)(G,{tone:`warn`,children:`armed · bus writes off`})),p&&(p.dryRun?(0,B.jsx)(K,{size:`sm`,onClick:()=>r(!0),disabled:o,children:`Go live…`}):(0,B.jsx)(K,{size:`sm`,onClick:()=>l(!0),disabled:o,children:`Back to dry-run`}))]}),p&&(0,B.jsxs)(`div`,{className:`px-3 py-2 border-b border-sand grid gap-1`,children:[p.rules.map(e=>(0,B.jsxs)(`label`,{className:`grid grid-cols-[auto_1fr] gap-2 items-baseline font-mono text-[12px] text-ink3 cursor-pointer`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:!!e.enabled,disabled:o||e.action.type===`none`,onChange:t=>c(e.id,t.target.checked),title:e.action.type===`none`?`informational rule — nothing to send`:`enable this rule`}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`text-walnut`,children:e.on}),` → `,e.action.type===`none`?(0,B.jsx)(`span`,{className:`text-tan`,children:e.action.note}):(0,B.jsxs)(B.Fragment,{children:[e.action.to?e.action.to:`#${e.action.room}`,` · `,Sd(e.action.prefix)&&(0,B.jsx)(Da,{prefix:e.action.prefix}),(0,B.jsx)(`span`,{className:`text-umber`,children:e.action.text})]})]})]},e.id)),(0,B.jsxs)(`div`,{className:`text-[11px] font-mono text-tan`,children:[`a rule sends only when: bus writes ON (header) · dry-run OFF · rule enabled · not a duplicate (key, `,p.limits?.dedupeTtlHours??72,` h) · under the rate limit · a live coordinator exists for the project. Baseline state.* events never trigger rules.`]})]}),n&&(0,B.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-walnut/30 flex items-start justify-center pt-[12vh]`,onMouseDown:e=>{e.target===e.currentTarget&&r(!1)},children:(0,B.jsxs)(`div`,{className:`w-[520px] bg-paper border border-brick rounded-kit shadow-panel`,children:[(0,B.jsx)(`div`,{className:`px-4 py-3 border-b border-sand font-display font-bold text-[18px] text-brick`,children:`Turn dry-run off`}),(0,B.jsxs)(`div`,{className:`p-4 grid gap-3 text-[13px] text-umber`,children:[(0,B.jsxs)(`div`,{children:[`Enabled rules will really `,(0,B.jsx)(`code`,{children:`send_message`}),` as `,(0,B.jsx)(`b`,{className:`text-walnut`,children:`groundwork-console`}),` (automation) whenever bus writes are on. Dedupe + rate limit apply; every send is a Run. Persisted in `,(0,B.jsx)(`code`,{children:`groundwork-console.rules.json`}),`.`]}),(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Type LIVE to confirm`}),(0,B.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]})]}),(0,B.jsxs)(`div`,{className:`px-4 py-3 border-t border-sand flex justify-end gap-2`,children:[(0,B.jsx)(K,{size:`sm`,onClick:()=>r(!1),children:`Cancel`}),(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:()=>l(!1),disabled:i!==`LIVE`||o,children:`Go live`})]})]})}),f.length===0&&(0,B.jsx)(`div`,{className:`px-3 py-3 text-[13px] text-umber`,children:`Watching seam files + rooms every 15 s. Nothing dirty at baseline and nothing changed since.`}),f.map(e=>(0,B.jsxs)(`div`,{className:`grid grid-cols-[var(--spacing-gutter)_1fr] border-b border-sand last:border-b-0`,children:[(0,B.jsx)(`div`,{className:`py-2.5 flex justify-center font-mono text-[12px] text-tan border-r border-sand`,children:`⚡`}),(0,B.jsxs)(`div`,{className:`px-3 pt-2 pb-2.5 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex gap-2 items-baseline mb-0.5 flex-wrap`,children:[(0,B.jsx)(G,{tone:Cd[e.type]??`neutral`,children:e.type}),e.data.baseline?(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-tan`,children:`baseline · no action`}):null,(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-umber`,children:e.project}),(0,B.jsx)(`span`,{className:`font-mono text-[12px] text-ink3`,children:xd(e.ts)})]}),(0,B.jsx)(`div`,{className:`font-mono text-[12px] text-umber break-all`,children:Object.entries(e.data).filter(([e])=>![`project`,`room`].includes(e)).map(([e,t])=>`${e}=${String(t)}`).join(` · `)}),e.actions.filter(e=>e.type!==`none`).map(e=>(0,B.jsxs)(`div`,{className:`mt-1 text-[13px] pl-2 border-l-2 ${e.sent?`border-leaf`:e.skipped?`border-amber`:`border-dust`}`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.06em] mr-1.5 ${e.sent?`text-leaf`:e.skipped?`text-amber`:`text-tan`}`,children:e.sent?`sent`:e.skipped?`skipped · ${e.skipped}`:e.dryRun?`would send`:`sending`}),Sd(e.prefix)&&(0,B.jsx)(Da,{prefix:e.prefix}),(0,B.jsx)(`span`,{className:`text-walnut`,children:e.text}),` `,(0,B.jsxs)(`span`,{className:`font-mono text-[12px] text-ink3`,children:[`→ `,e.to??`#${e.room}`]}),e.runId&&(0,B.jsx)(`span`,{className:`ml-2 font-mono text-[11px] text-tan`,children:e.runId})]},e.ruleId))]})]},e.id))]})}function Td(){let{data:e}=q(`/events?limit=40`,3e4),t=e?.config;if(!t)return null;let n=t.rules.filter(e=>e.enabled).length,r=Date.now()-864e5,i=(e?.recent??[]).filter(e=>e.ts>r).flatMap(e=>e.actions).filter(e=>e.sent).length;return(0,B.jsxs)(`div`,{className:`flex items-center gap-2 font-mono text-[11px] text-ink3 px-1`,children:[(0,B.jsx)(`span`,{className:`uppercase tracking-[.1em] text-tan`,children:`events`}),t.live?(0,B.jsx)(G,{tone:`bad`,children:`live`}):t.dryRun?(0,B.jsx)(G,{tone:`outline`,children:`dry-run`}):(0,B.jsx)(G,{tone:`warn`,children:`armed · bus writes off`}),(0,B.jsxs)(`span`,{children:[n,`/`,t.rules.length,` rules on · `,i,` sent in 24 h`]}),(0,B.jsx)(V,{to:`/ops/events`,className:`ml-auto text-ember-deep`,children:`Ops → Events`})]})}var Ed={complete:{label:`complete`,tone:`ok`,dot:`bg-leaf border-leaf`,ring:`text-leaf`,hint:`all tasks ticked`},ongoing:{label:`ongoing`,tone:`david`,dot:`bg-ember border-ember`,ring:`text-ember`,hint:`streams in flight or tasks ticked`},planned:{label:`planned`,tone:`neutral`,dot:`bg-paper border-umber`,ring:`text-umber`,hint:`tasks written, none started`},pending:{label:`pending`,tone:`outline`,dot:`bg-paper border-dust border-dashed`,ring:`text-tan`,hint:`no PHASE*_TASKS.md yet — run /plan-phase`}};function Dd({pct:e,cls:t,size:n=44}){let r=(n-6)/2,i=2*Math.PI*r;return(0,B.jsxs)(`svg`,{width:n,height:n,viewBox:`0 0 ${n} ${n}`,className:t,"aria-hidden":!0,children:[(0,B.jsx)(`circle`,{cx:n/2,cy:n/2,r,fill:`none`,stroke:`currentColor`,strokeOpacity:`.18`,strokeWidth:`4`}),(0,B.jsx)(`circle`,{cx:n/2,cy:n/2,r,fill:`none`,stroke:`currentColor`,strokeWidth:`4`,strokeLinecap:`round`,strokeDasharray:`${e/100*i} ${i}`,transform:`rotate(-90 ${n/2} ${n/2})`})]})}function Od({project:e,phases:t,canWrite:n,prd:r}){let i=q(`/projects/${e}/agents`,3e4).data,[a,o]=(0,P.useState)(null),[s,c]=(0,P.useState)(null),[l,u]=(0,P.useState)(null),d=`groundwork-console.roadmap.last.${e}`,[f,p]=(0,P.useState)(()=>{try{return JSON.parse(localStorage.getItem(d)??`{}`)}catch{return{}}}),m=(e,t,n)=>p(r=>{let i={...r,[e]:{verb:t,to:n,ts:Date.now()}};return localStorage.setItem(d,JSON.stringify(i)),i}),h=e=>{let t=Math.floor((Date.now()-e)/6e4);return t<1?`just now`:t<60?`${t} min ago`:`${Math.floor(t/60)} h ago`},g=async(t,r)=>{if(!n){c(`bus writes are off — click the header badge (read-only · v0.1) and type ENABLE, then retry`);return}if(r===`plan`&&!i?.aide){c(`no live aide for ${e} — start one (coord-aide) in #room, or DM the coordinator from Bus`);return}if(r!==`plan`&&!i?.coordinator){c(`no live coordinator for ${e}`);return}o(`${t.id}:${r}`),c(null);try{let n=await Fa(`/actions/phase/${e}/${t.id}/${r}`),i=n.args?.to??``;n.status===`ok`&&m(t.id,r,i),c(n.status===`ok`?`sent → ${i}`:n.error??n.log?.slice(-1)[0]??`failed`)}catch(e){c(e.message)}finally{o(null)}},_=async t=>{if(!n){c(`bus writes are off — switch them on in the header, then retry`);return}o(t),c(null);try{let n=await Fa(`/actions/project/${e}/${t}`),r=n.args?.to??``;c(n.status===`ok`?`sent → ${r} — continue in its thread`:n.error??n.log?.slice(-1)[0]??`failed`),n.status===`ok`&&r&&ad(r)}catch(e){c(e.message)}finally{o(null)}},v=t.filter(e=>e.state===`complete`).length,y=t.find(e=>e.state===`ongoing`)??t.find(e=>e.state===`planned`)??t.find(e=>e.state===`pending`);return(0,B.jsxs)(U,{children:[(0,B.jsx)(W,{title:`Roadmap`,icon:`phases`,eyebrow:`PRODUCTION_ROADMAP · phases/`,path:`${v}/${t.length} complete${y?` · next: ${y.title}`:``}`,children:(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 flex-wrap`,children:[i?.aide?(0,B.jsx)(ed,{id:i.aide,prefix:`aide`}):(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-tan`,children:`no live aide`}),i?.coordinator?(0,B.jsx)(ed,{id:i.coordinator,prefix:`coord`}):(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-tan`,children:`no live coordinator`})]})}),t.length===0&&(0,B.jsxs)(`div`,{className:`px-3 py-3 grid gap-2 text-[13px]`,children:[r==null?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`text-walnut`,children:[`No PRD yet. The roadmap starts from `,(0,B.jsx)(`code`,{children:`docs/PRD.md`}),` — write it with your aide (it runs `,(0,B.jsx)(`code`,{children:`/create-prd`}),` and asks you what it needs).`]}),(0,B.jsxs)(`div`,{className:`flex gap-2 items-center flex-wrap`,children:[(0,B.jsx)(K,{size:`sm`,tone:`primary`,disabled:!!a||!i?.aide,title:i?.aide?`DM ${i.aide}: run /create-prd with me`:`no live aide — spawn one under Ops → Fleets`,onClick:()=>_(`create-prd`),children:a===`create-prd`?(0,B.jsx)(Ma,{size:12}):`Write the PRD with the aide`}),i?.aide&&(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:()=>ad(i.aide),children:`Open the aide's thread`}),!i?.aide&&(0,B.jsx)(V,{to:`/ops/fleets`,className:`hover:no-underline`,children:(0,B.jsx)(K,{size:`sm`,children:`Spawn aide`})})]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`text-walnut`,children:[`PRD is `,(0,B.jsx)(`b`,{children:r.status??`present`}),r.roadmap?` and a roadmap exists`:``,` — no `,(0,B.jsx)(`code`,{children:`docs/phases/`}),` yet. Kickstart builds the roadmap + doc scaffold (roadmap, tech stack, architecture, decisions, workstreams, queue, done, facts); phases follow with `,(0,B.jsx)(`code`,{children:`/plan-phase 1`}),`.`]}),(0,B.jsxs)(`div`,{className:`flex gap-2 items-center flex-wrap`,children:[(0,B.jsx)(K,{size:`sm`,tone:`primary`,disabled:!!a||!i?.aide,title:i?.aide?`DM ${i.aide}: run /kickstart in ${e}`:`no live aide — spawn one under Ops → Fleets`,onClick:()=>_(`kickstart`),children:a===`kickstart`?(0,B.jsx)(Ma,{size:12}):`Kickstart with the aide`}),i?.aide&&(0,B.jsx)(K,{size:`sm`,tone:`ghost`,onClick:()=>ad(i.aide),children:`Open the aide's thread`}),!i?.aide&&(0,B.jsx)(V,{to:`/ops/fleets`,className:`hover:no-underline`,children:(0,B.jsx)(K,{size:`sm`,children:`Spawn aide`})})]})]}),s&&(0,B.jsx)(`div`,{className:`font-mono text-[12px] ${/^sent/.test(s)?`text-leaf`:`text-brick`}`,children:s})]}),t.length>0&&(0,B.jsxs)(`div`,{className:`px-3 pt-3 pb-2 overflow-x-auto`,children:[(0,B.jsx)(`ol`,{className:`flex items-start gap-0 min-w-max`,children:t.map((e,n)=>{let r=Ed[e.state],i=e.total?Math.round(e.done/e.total*100):0,o=n===t.length-1;return(0,B.jsxs)(`li`,{className:`flex items-start`,children:[(0,B.jsxs)(`div`,{className:`w-[190px] grid gap-1.5 justify-items-center text-center`,children:[(0,B.jsxs)(`button`,{onClick:()=>u(t=>t===e.id?null:e.id),className:`relative border-0 bg-transparent p-0 cursor-pointer rounded-full ${l===e.id?`ring-2 ring-ember ring-offset-2 ring-offset-paper`:``}`,title:`show tasks`,children:[(0,B.jsx)(Dd,{pct:e.state===`complete`?100:i,cls:r.ring}),(0,B.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center font-mono font-bold text-[12px] ${r.ring}`,children:e.state===`complete`?`✓`:e.n})]}),(0,B.jsx)(`button`,{onClick:()=>u(t=>t===e.id?null:e.id),className:`font-semibold text-[13px] leading-tight line-clamp-2 px-1 border-0 bg-transparent cursor-pointer text-walnut hover:text-ember-deep`,title:e.title,children:e.title}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(G,{tone:r.tone,children:r.label}),(0,B.jsxs)(`span`,{className:`font-mono text-[11px] text-ink3`,children:[e.total?`${e.done}/${e.total}`:`—`,e.streams?` · ${e.streams} stream${e.streams===1?``:`s`}`:``]})]}),f[e.id]&&(0,B.jsxs)(`div`,{className:`font-mono text-[10px] text-ink3 flex items-center gap-1 justify-center flex-wrap`,title:new Date(f[e.id].ts).toLocaleString(),children:[(0,B.jsx)(`span`,{className:`uppercase tracking-[.06em]`,children:f[e.id].verb===`kickoff`?`kicked off`:f[e.id].verb===`plan`?`plan requested`:`audit requested`}),(0,B.jsx)(`span`,{children:`→`}),(0,B.jsx)(ed,{id:f[e.id].to,bare:!0}),(0,B.jsx)(`span`,{className:`text-tan`,children:h(f[e.id].ts)})]}),(0,B.jsxs)(`div`,{className:`flex gap-1 flex-wrap justify-center`,children:[(e.tasks||e.readme)&&(0,B.jsx)(V,{to:`/docs/${encodeURIComponent(e.tasks??e.readme)}`,className:`hover:no-underline`,children:(0,B.jsx)(K,{size:`sm`,tone:`ghost`,children:`Open`})}),e.state===`pending`&&(0,B.jsx)(K,{size:`sm`,tone:`primary`,disabled:!!a,title:`DM the aide: run /plan-phase`,onClick:()=>g(e,`plan`),children:a===`${e.id}:plan`?(0,B.jsx)(Ma,{size:12}):`Plan`}),e.state===`planned`&&(0,B.jsx)(K,{size:`sm`,tone:`primary`,disabled:!!a,title:`GO to the coordinator`,onClick:()=>g(e,`kickoff`),children:a===`${e.id}:kickoff`?(0,B.jsx)(Ma,{size:12}):`Kick off`}),e.state===`ongoing`&&(0,B.jsx)(K,{size:`sm`,disabled:!!a,title:`ask the coordinator to run /coord-audit`,onClick:()=>g(e,`audit`),children:a===`${e.id}:audit`?(0,B.jsx)(Ma,{size:12}):`Audit`})]})]}),!o&&(0,B.jsx)(`div`,{className:`mt-[21px] h-[3px] w-6 rounded ${e.state===`complete`?`bg-leaf`:`bg-sand`}`})]},e.id)})}),l&&(0,B.jsx)(Vu,{project:e,phase:t.find(e=>e.id===l),onClose:()=>u(null)}),s&&(0,B.jsx)(`div`,{className:`mt-2 font-mono text-[12px] flex items-center gap-2 ${/^sent/.test(s)?`text-leaf`:`text-brick`}`,children:/^sent → /.test(s)?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:`sent →`}),(0,B.jsx)(ed,{id:s.replace(/^sent → /,``),bare:!0})]}):s}),(0,B.jsx)(`div`,{className:`mt-2 font-mono text-[11px] text-tan flex gap-3 flex-wrap`,children:Object.keys(Ed).map(e=>(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full border mr-1 align-middle ${Ed[e].dot}`}),Ed[e].label,` — `,Ed[e].hint]},e))})]})]})}function kd({phases:e}){return e?.length?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:e.map(e=>`${e.n}: ${e.state}${e.total?` ${e.done}/${e.total}`:``}`).join(` · `),children:[e.map((e,t)=>(0,B.jsx)(`span`,{className:`inline-block w-2.5 h-2.5 rounded-full border ${Ed[e.state].dot}`},t)),(0,B.jsxs)(`span`,{className:`ml-1 font-mono text-[11px] text-ink3`,children:[e.filter(e=>e.state===`complete`).length,`/`,e.length]})]}):(0,B.jsx)(`span`,{className:`font-mono text-[11px] text-tan`,children:`no phases`})}function Ad({project:e,canWrite:t,onClose:n,initialRole:r}){let{data:i}=q(`/actions/spawn/options?project=${encodeURIComponent(e)}`),[a,o]=(0,P.useState)(r??`worker`),[s,c]=(0,P.useState)(`claude`),[l,u]=(0,P.useState)(``),[d,f]=(0,P.useState)(``),[p,m]=(0,P.useState)(``),[h,g]=(0,P.useState)(``),[_,v]=(0,P.useState)(8),[y,b]=(0,P.useState)(!1),[x,S]=(0,P.useState)(null),[C,w]=(0,P.useState)(null),T=ar(),{runs:E}=Ha(),D=x?E.find(e=>e.id===x.id)??x:null;(0,P.useEffect)(()=>{i&&!l&&u(i.suggest[a]??``)},[i,a,l]),(0,P.useEffect)(()=>{i&&u(i.suggest[a]??``)},[a]);let O=async()=>{b(!0),w(null);try{let t=await Fa(`/actions/spawn`,{project:e,role:a,harness:s,agentId:l,lane:d||void 0,model:p||void 0,note:h||void 0,waitSeconds:_});if(!t.status)throw Error(t.error??`failed`);S(t)}catch(e){w(e.message)}finally{b(!1)}},k=i?.roles.find(e=>e.id===a)?.skill??``;return(0,B.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-walnut/30 flex items-start justify-center pt-[8vh] whitespace-normal text-left`,onMouseDown:e=>{e.target===e.currentTarget&&!y&&n()},children:(0,B.jsxs)(`div`,{className:`w-[640px] bg-paper border border-sand rounded-kit shadow-panel`,children:[(0,B.jsxs)(`div`,{className:`px-4 py-3 border-b border-sand font-display font-bold text-[18px] text-umber`,children:[`Spawn agent · `,e]}),(0,B.jsxs)(`div`,{className:`p-4 grid gap-3 text-[13px]`,children:[(0,B.jsxs)(`div`,{className:`flex gap-1.5 flex-wrap items-center text-umber`,children:[(0,B.jsx)(G,{tone:t?`warn`:`outline`,children:t?`bus writes on`:`bus writes OFF`}),(0,B.jsxs)(`span`,{children:[`tmux window `,(0,B.jsxs)(`code`,{children:[`fleet-`,e]}),` · cwd `,(0,B.jsx)(`code`,{children:i?.repoPath?.replace(/^\/Users\/[^/]+/,`~`)}),i?.room?(0,B.jsxs)(B.Fragment,{children:[` · room `,(0,B.jsxs)(`code`,{children:[`#`,i.room]})]}):` · no room linked`]})]}),!t&&(0,B.jsx)(`div`,{className:`text-brick`,children:`Turn on bus writes (header toggle) first — spawning launches a process and types the role invocation into the new pane.`}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Role · playbook card`}),(0,B.jsx)(`select`,{value:a,onChange:e=>o(e.target.value),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`,children:(i?.roles??[]).map(e=>(0,B.jsxs)(`option`,{value:e.id,children:[e.id,` · `,e.skill]},e.id))})]}),(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Harness`}),(0,B.jsx)(`select`,{value:s,onChange:e=>c(e.target.value),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`,children:(i?.harnesses??[]).map(e=>(0,B.jsxs)(`option`,{value:e.id,children:[e.id,` · `,e.cmd]},e.id))})]}),(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Agent id`}),(0,B.jsx)(`input`,{value:l,onChange:e=>u(e.target.value.trim()),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]}),a===`worker`?(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Lane`}),(0,B.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),placeholder:`repo-owner · rendering · api`,className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]}):(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Model (Claude only, optional)`}),(0,B.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),placeholder:`claude-sonnet-4-6`,className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]})]}),(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Extra instruction (optional, injected after the skill)`}),(0,B.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),placeholder:`e.g. mission: re-verify the design doc after PR4`,className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3 text-umber`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Start wait`}),(0,B.jsx)(`input`,{type:`range`,min:3,max:30,value:_,onChange:e=>v(Number(e.target.value))}),(0,B.jsxs)(`span`,{className:`font-mono text-[12px]`,children:[_,` s`]}),(0,B.jsx)(`span`,{className:`text-[12px]`,children:`before injecting the skill`})]}),(0,B.jsxs)(`div`,{className:`font-mono text-[12px] text-ink3 bg-linen rounded px-2 py-1.5`,children:[`will type: `,(0,B.jsx)(`b`,{className:`text-walnut`,children:i?.harnesses.find(e=>e.id===s)?.cmd}),` → wait `,_,` s → `,s===`claude`?`/color · `:``,(0,B.jsxs)(`b`,{className:`text-walnut`,children:[k,` --id=`,l||`…`,d?` --lane=${d}`:``,i?.room?` --room=${i.room}`:``]}),` → wait for register (≤ 90 s)`]}),C&&(0,B.jsx)(`div`,{className:`text-brick`,children:C}),D&&(0,B.jsxs)(`div`,{className:`p-2 rounded-kit border ${D.status===`ok`?`border-moss-line bg-moss-wash/50`:D.status===`failed`?`border-brick-line bg-brick-wash/50`:`border-amber-line bg-amber-wash/40`}`,children:[(0,B.jsxs)(`div`,{className:`font-mono text-[12px]`,children:[D.status===`running`?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-amber`,children:[(0,B.jsx)(Ma,{}),` `,(0,B.jsx)(G,{tone:`warn`,children:`running`})]}):(0,B.jsx)(G,{tone:D.status===`ok`?`ok`:`bad`,children:D.status}),` `,(0,B.jsx)(`b`,{children:D.label}),D.status===`running`&&(0,B.jsx)(`span`,{className:`ml-2 text-tan`,children:`live — you can close this; it keeps running (see Runs)`})]}),(0,B.jsxs)(`pre`,{className:`m-0 mt-1 font-mono text-[12px] whitespace-pre-wrap max-h-[30vh] overflow-auto`,children:[D.log.join(`
29
29
  `),D.error?`
30
30
  `+D.error:``]})]})]}),(0,B.jsxs)(`div`,{className:`px-4 py-3 border-t border-sand flex justify-end gap-2`,children:[(0,B.jsx)(K,{size:`sm`,onClick:n,disabled:y,children:D?D.status===`running`?`Close (keeps running)`:`Close`:`Cancel`}),D&&(0,B.jsx)(K,{size:`sm`,onClick:()=>{n(),T(`/monitor`)},children:`Open Monitor`}),!D&&(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:O,disabled:!t||y||!l,children:y?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(Ma,{}),` Starting…`]}):`Spawn`})]})]})})}function jd({project:e,fleet:t,canWrite:n,compact:r=!1}){let i=q(`/bus/agents`,2e4).data??[],[a,o]=(0,P.useState)(null),s=e=>e?i.find(t=>t.agentId===e):void 0,c=({role:e,id:t,wide:n})=>{let r=s(t);return t?(0,B.jsxs)(`div`,{className:`px-2.5 py-1.5 rounded-kit border border-sand bg-paper ${n?``:`min-w-[170px]`}`,children:[(0,B.jsx)(ed,{id:t,size:`md`,bare:!0}),(0,B.jsxs)(`span`,{className:`block font-mono text-[10px] uppercase tracking-[.08em] text-tan mt-0.5`,children:[e,r?.pane?` · ${r.pane}`:``]})]}):(0,B.jsxs)(`button`,{onClick:()=>o(e),className:`grid grid-cols-[auto_1fr] gap-2 items-center px-2.5 py-1.5 rounded-kit border border-dashed border-dust bg-transparent text-left cursor-pointer hover:border-ember ${n?``:`min-w-[150px]`}`,title:`spawn a ${e}`,children:[(0,B.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full border border-dashed border-dust`}),(0,B.jsxs)(`span`,{className:`min-w-0`,children:[(0,B.jsx)(`span`,{className:`block font-mono text-[12px] text-tan`,children:`missing`}),(0,B.jsxs)(`span`,{className:`block font-mono text-[10px] uppercase tracking-[.08em] text-tan`,children:[e,` · spawn`]})]})]})},l=({v:e=!1})=>(0,B.jsx)(`span`,{className:e?`w-px h-4 bg-dust mx-auto`:`h-px w-5 bg-dust self-center`}),u=t.roles.workers;return(0,B.jsxs)(`div`,{className:`grid gap-1 ${r?`text-[12px]`:``}`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,B.jsx)(`div`,{className:`px-2.5 py-1.5 rounded-kit border border-ember bg-ember-wash/40 font-mono font-semibold text-[12px] text-ember-deep`,children:`David`}),(0,B.jsx)(l,{}),(0,B.jsx)(c,{role:`aide`,id:t.roles.aide}),(0,B.jsx)(l,{}),(0,B.jsx)(c,{role:`coordinator`,id:t.roles.coordinator}),(0,B.jsx)(l,{}),(0,B.jsxs)(`div`,{className:`grid gap-1`,children:[(0,B.jsxs)(`div`,{className:`flex gap-1 flex-wrap`,children:[(0,B.jsx)(c,{role:`qa`,id:t.roles.qa}),(0,B.jsx)(c,{role:`ci`,id:t.roles.ci})]}),(0,B.jsxs)(`div`,{className:`flex gap-1 flex-wrap`,children:[u.map(e=>(0,B.jsx)(c,{role:`worker`,id:e},e)),(0,B.jsx)(c,{role:`worker`,id:null})]})]})]}),!r&&(0,B.jsx)(`div`,{className:`font-mono text-[11px] text-tan`,children:`you talk to the aide · the coordinator faces the fleet · qa gates · ci ships · workers own lanes. Click a filled slot to watch its pane, a dashed one to spawn that role.`}),a&&(0,B.jsx)(Ad,{project:e,canWrite:n,initialRole:a,onClose:()=>o(null)})]})}var Md={absent:`bad`,partial:`warn`,present:`ok`};function Nd({fleet:e}){if(!e)return null;let t=e.state===`absent`?`no fleet`:e.state===`partial`?`fleet partial · missing ${e.missing.join(`, `)}`:`fleet · ${e.live.length} live`;return(0,B.jsx)(G,{tone:Md[e.state],children:t})}function Pd({project:e,canWrite:t}){let{data:n,refresh:r}=q(`/projects/${e}/fleet`,2e4),[i,a]=(0,P.useState)(!1);return!n||n.state===`present`?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`rounded-kit border px-4 py-3 grid gap-2 ${n.state===`absent`?`border-brick-line bg-brick-wash/40`:`border-amber-line bg-amber-wash/50`}`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,B.jsx)(Nd,{fleet:n}),(0,B.jsx)(`span`,{className:`text-[13px] text-umber`,children:n.state===`absent`?(0,B.jsxs)(B.Fragment,{children:[`No agents are live for `,(0,B.jsx)(`b`,{className:`text-walnut`,children:e}),`. Boards and docs still read fine; Plan / Fix / Kick off need someone to talk to.`]}):(0,B.jsxs)(B.Fragment,{children:[`Missing `,(0,B.jsx)(`b`,{className:`text-walnut`,children:n.missing.join(`, `)}),`.`]})}),(0,B.jsxs)(`span`,{className:`ml-auto flex gap-1.5`,children:[(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:()=>a(!0),children:`Spawn fleet…`}),(0,B.jsx)(V,{to:`/ops/fleets`,className:`hover:no-underline`,children:(0,B.jsx)(K,{size:`sm`,children:`Fleets`})})]})]}),(0,B.jsx)(jd,{project:e,fleet:n,canWrite:t,compact:!0})]}),i&&(0,B.jsx)(Fd,{project:e,templates:n.templates,missing:n.missing,canWrite:t,onClose:()=>{a(!1),r()}})]})}function Fd({project:e,templates:t,missing:n,canWrite:r,onClose:i}){let[a,o]=(0,P.useState)(t.find(e=>e.id===`standard`)?.id??t[0]?.id??`standard`),[s,c]=(0,P.useState)(`claude`),[l,u]=(0,P.useState)(`claude`),[d,f]=(0,P.useState)(null),[p,m]=(0,P.useState)(``),[h,g]=(0,P.useState)(8),[_,v]=(0,P.useState)(!1),[y,b]=(0,P.useState)(null),[x,S]=(0,P.useState)(null),{runs:C}=Ha(),w=y?C.find(e=>e.id===y.id)??y:null,T=t.find(e=>e.id===a),E=d??T?.workers??0;return(0,B.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-walnut/30 flex items-start justify-center pt-[8vh] whitespace-normal text-left`,onMouseDown:e=>{e.target===e.currentTarget&&!_&&i()},children:(0,B.jsxs)(`div`,{className:`w-[680px] bg-paper border border-sand rounded-kit shadow-panel`,children:[(0,B.jsxs)(`div`,{className:`px-4 py-3 border-b border-sand font-display font-bold text-[18px] text-umber`,children:[`Spawn a fleet · `,e]}),(0,B.jsxs)(`div`,{className:`p-4 grid gap-3 text-[13px]`,children:[(0,B.jsxs)(`div`,{className:`text-umber`,children:[`Shapes from the playbook layout. Agents are launched one after another in tmux window `,(0,B.jsxs)(`code`,{children:[`fleet-`,e]}),`, each injected with its role card and `,(0,B.jsx)(`code`,{children:`--id`}),`, and the console waits for each to register.`,n.length>0&&(0,B.jsxs)(B.Fragment,{children:[` Currently missing: `,(0,B.jsx)(`b`,{className:`text-walnut`,children:n.join(`, `)}),`.`]})]}),!r&&(0,B.jsx)(`div`,{className:`text-brick`,children:`Turn on bus writes (header toggle) first.`}),(0,B.jsx)(`div`,{className:`grid gap-1.5`,children:t.map(e=>(0,B.jsxs)(`label`,{className:`grid grid-cols-[auto_1fr] gap-2 items-start px-3 py-2 rounded-kit border cursor-pointer ${a===e.id?`border-ember bg-ember-wash/40`:`border-sand`}`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`tpl`,checked:a===e.id,onChange:()=>{o(e.id),f(null)}}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{children:e.label}),(0,B.jsx)(`span`,{className:`block text-[12px] text-umber`,children:e.hint}),(0,B.jsx)(`span`,{className:`block font-mono text-[11px] text-tan`,children:[...e.roles,...Array.from({length:e.workers},(e,t)=>`worker-${t+1}`)].join(` · `)})]})]},e.id))}),(0,B.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Harness`}),(0,B.jsx)(`select`,{value:s,onChange:e=>c(e.target.value),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`,children:[`claude`,`grok`,`codex`,`opencode`].map(e=>(0,B.jsx)(`option`,{children:e},e))})]}),T?.roles.includes(`ci`)&&(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`CI harness (cheap)`}),(0,B.jsx)(`select`,{value:l,onChange:e=>u(e.target.value),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`,children:[`claude`,`grok`,`codex`,`opencode`].map(e=>(0,B.jsx)(`option`,{children:e},e))})]}),(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Workers`}),(0,B.jsx)(`input`,{type:`number`,min:0,max:8,value:E,onChange:e=>f(Number(e.target.value)),className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]})]}),E>0&&(0,B.jsxs)(`label`,{className:`grid gap-1`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Lanes (comma-separated, optional)`}),(0,B.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),placeholder:`rendering, gameplay, infra`,className:`px-2.5 py-2 border border-dust rounded-kit bg-paper text-walnut font-mono`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3 text-umber`,children:[(0,B.jsx)(`span`,{className:`font-mono text-[11px] uppercase tracking-[.08em] text-ink3`,children:`Start wait`}),(0,B.jsx)(`input`,{type:`range`,min:3,max:30,value:h,onChange:e=>g(Number(e.target.value))}),(0,B.jsxs)(`span`,{className:`font-mono text-[12px]`,children:[h,` s per agent`]}),(0,B.jsxs)(`span`,{className:`text-[12px]`,children:[`· total ≈ `,(T?.roles.length??0)+E,` × (`,h,` s + register)`]})]}),x&&(0,B.jsx)(`div`,{className:`text-brick`,children:x}),w&&(0,B.jsxs)(`div`,{className:`p-2 rounded-kit border ${w.status===`ok`?`border-moss-line bg-moss-wash/50`:w.status===`failed`?`border-brick-line bg-brick-wash/50`:`border-amber-line bg-amber-wash/40`}`,children:[(0,B.jsxs)(`div`,{className:`font-mono text-[12px]`,children:[w.status===`running`?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-amber`,children:[(0,B.jsx)(Ma,{}),` `,(0,B.jsx)(G,{tone:`warn`,children:`running`})]}):(0,B.jsx)(G,{tone:w.status===`ok`?`ok`:`bad`,children:w.status}),` `,(0,B.jsx)(`b`,{children:w.label})]}),(0,B.jsx)(`pre`,{className:`m-0 mt-1 font-mono text-[12px] whitespace-pre-wrap max-h-[30vh] overflow-auto`,children:w.log.join(`
31
31
  `)})]})]}),(0,B.jsxs)(`div`,{className:`px-4 py-3 border-t border-sand flex justify-end gap-2`,children:[(0,B.jsx)(K,{size:`sm`,onClick:i,disabled:_,children:w?`Close (keeps running)`:`Cancel`}),!w&&(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:async()=>{v(!0),S(null);try{let t=await Fa(`/actions/spawn-fleet`,{project:e,template:a,harness:s,ciHarness:l,workers:E,lanes:p.split(`,`).map(e=>e.trim()).filter(Boolean),waitSeconds:h});if(!t.status)throw Error(t.error??`failed`);b(t)}catch(e){S(e.message)}finally{v(!1)}},disabled:!r||_||!T,children:_?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(Ma,{}),` Starting…`]}):`Spawn ${(T?.roles.length??0)+E} agents`})]})]})})}var Id=e=>{let t=Date.now()-e,n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n} min ago`;let r=Math.floor(n/60);return r<24?`${r} h ago`:`${Math.floor(r/24)} d ago`},Ld=e=>e===`workstreams.v1`?[e,`ok`]:e===`workstreams.lanes-v0`?[`lanes-v0 · legacy`,`warn`]:e===`unknown`?[`unknown workstreams grammar`,`bad`]:[`no WORKSTREAMS.md`,`outline`];function Rd(){let{projects:e,setCurrent:t,error:n,refresh:r}=za(),i=q(`/kit`).data,a=q(`/bus/agents`,3e4).data??[],o=a.filter(e=>e.liveness===`live`).length,s=a.filter(e=>e.liveness===`dead`),c=q(`/needs-david`,3e4).data??[],[l,u]=(0,P.useState)(!1);return(0,B.jsxs)(`div`,{className:`p-4 pb-10 grid gap-[18px] content-start`,children:[l&&(0,B.jsx)(qa,{onClose:()=>{u(!1),r()}}),(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-baseline gap-3 flex-wrap`,children:[(0,B.jsx)(`span`,{className:`font-display font-bold text-[34px] leading-[1.1] tracking-[-.015em] text-ember`,children:`Projects`}),(0,B.jsx)(K,{size:`sm`,tone:`primary`,onClick:()=>u(!0),title:`register a repo path with the console`,children:`Add project`}),(0,B.jsxs)(`span`,{className:`ml-3 text-[13px] text-umber`,children:[`Groundwork-managed repos with a seam in `,(0,B.jsx)(`code`,{children:`docs/`}),` · from `,(0,B.jsx)(`code`,{children:`groundwork-console.config.json`})]})]}),(0,B.jsxs)(`div`,{className:`flex gap-2.5 items-center flex-wrap`,children:[i?.requires&&!i.requires.ok&&(0,B.jsx)(`span`,{className:`font-mono text-[11px] px-2 py-1 rounded-full bg-ember-wash text-ember-deep border border-ember/40`,title:Object.entries(i.requires).filter(([e])=>[`seam`,`mcp`,`groundwork`,`playbook`].includes(e)).map(([e,t])=>`${e}: has ${t.installed??`none`}, needs ${t.required}`).join(`
@@ -1 +1 @@
1
- import"./chunk-KEIR6QF5-BICK3FdT.js";import{w as e}from"./mermaid-parser.core-DG-hDTtF.js";export{e as createInfoServices};
1
+ import"./chunk-KEIR6QF5-BICK3FdT.js";import{w as e}from"./mermaid-parser.core-679COn57.js";export{e as createInfoServices};
@@ -1,2 +1,2 @@
1
- import{n as e}from"./mermaid-parser.core-DG-hDTtF.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as n}from"./src-CJc45UuW.js";import{c as r}from"./chunk-I66GZJ75-Bazokq-r.js";import{a as i}from"./mermaid.core-CxtgV-Z8.js";var a={parse:t(async t=>{let r=await e(`info`,t);n.debug(r)},`parse`)},o={version:`11.16.1`},s={parser:a,db:{getVersion:t(()=>o.version,`getVersion`)},renderer:{draw:t((e,t,a)=>{n.debug(`rendering info diagram
1
+ import{n as e}from"./mermaid-parser.core-679COn57.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as n}from"./src-CWXJqyrc.js";import{c as r}from"./chunk-I66GZJ75-DJurmtZ9.js";import{a as i}from"./mermaid.core-D_f4AlrR.js";var a={parse:t(async t=>{let r=await e(`info`,t);n.debug(r)},`parse`)},o={version:`11.16.1`},s={parser:a,db:{getVersion:t(()=>o.version,`getVersion`)},renderer:{draw:t((e,t,a)=>{n.debug(`rendering info diagram
2
2
  `+e);let o=i(t);r(o,100,400,!0),o.append(`g`).append(`text`).attr(`x`,100).attr(`y`,40).attr(`class`,`version`).attr(`font-size`,32).style(`text-anchor`,`middle`).text(`v${a}`)},`draw`)}};export{s as diagram};