geneseed 5.3.0 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/README.md +23 -20
  3. package/SHIPPED.md +7 -7
  4. package/adapters/bob/README.md +31 -18
  5. package/adapters/claude-code/README.md +27 -22
  6. package/adapters/openclaude/README.md +18 -8
  7. package/adapters/opencode/HOW-OPENCODE-LOADS.md +8 -3
  8. package/adapters/opencode/README.md +3 -2
  9. package/adapters/opencode/plugins/geneseed-activity.js +20 -21
  10. package/adapters/opencode/plugins/geneseed-context.js +175 -62
  11. package/adapters/opencode/plugins/geneseed-guard.js +419 -205
  12. package/adapters/opencode/plugins/geneseed-workflow.js +3 -2
  13. package/adapters/opencode/workflows/_runtime.js +3 -2
  14. package/bin/geneseed-cli.mjs +7 -0
  15. package/bin/geneseed-hook.mjs +59 -11
  16. package/docs/PRD.md +1 -1
  17. package/docs/README.md +1 -0
  18. package/docs/concepts/agents.md +1 -1
  19. package/docs/concepts/collaboration.md +2 -2
  20. package/docs/concepts/enforcement-table.md +5 -2
  21. package/docs/concepts/exclusions.md +18 -4
  22. package/docs/concepts/footprint.md +11 -1
  23. package/docs/concepts/foreman-mode.md +1 -1
  24. package/docs/concepts/hook-gates.md +5 -5
  25. package/docs/concepts/hooks.md +4 -3
  26. package/docs/concepts/host-matrix.md +24 -6
  27. package/docs/concepts/kits.md +12 -2
  28. package/docs/concepts/loop-bricks.md +3 -3
  29. package/docs/concepts/loops.md +6 -4
  30. package/docs/concepts/ownership.md +1 -1
  31. package/docs/concepts/rules.md +2 -2
  32. package/docs/concepts/skills.md +1 -1
  33. package/docs/design-history.md +8 -0
  34. package/docs/extending.md +112 -35
  35. package/docs/guides/auto-merge.md +100 -0
  36. package/docs/guides/choose-your-setup.md +1 -1
  37. package/docs/guides/headless.md +1 -1
  38. package/docs/guides/install-bob.md +2 -2
  39. package/docs/guides/install-clone.md +1 -1
  40. package/docs/guides/install-openclaude.md +1 -1
  41. package/docs/guides/install.md +1 -1
  42. package/docs/guides/loop-finish.md +3 -3
  43. package/docs/guides/loop-running.md +4 -4
  44. package/docs/guides/project-context.md +1 -1
  45. package/docs/guides/run-a-factory.md +2 -2
  46. package/docs/guides/setup-doctrines.md +2 -2
  47. package/docs/guides/setup-footprint.md +1 -1
  48. package/docs/guides/uninstall.md +3 -3
  49. package/docs/guides/upgrade.md +1 -1
  50. package/docs/guides/verify.md +12 -0
  51. package/docs/guides/worktree.md +1 -1
  52. package/docs/reference/environment.md +5 -2
  53. package/docs/reference/plugin-activity.md +1 -1
  54. package/docs/reference/plugin-guard.md +1 -1
  55. package/docs/reference/plugin-learn.md +1 -1
  56. package/docs/reference/plugin-workflow.md +1 -1
  57. package/docs/reference/troubleshoot-doctor.md +2 -2
  58. package/docs/reference/troubleshoot-hooks.md +2 -2
  59. package/docs/reference/troubleshoot-install.md +3 -3
  60. package/docs/reference/troubleshoot-tools.md +1 -1
  61. package/docs/token-footprint.md +68 -4
  62. package/docs/understand/design-choices-hosts.md +1 -1
  63. package/docs/understand/design-choices-shape.md +1 -0
  64. package/docs/understand/enforced-vs-asked.md +2 -2
  65. package/docs/understand/machine-bob.md +1 -1
  66. package/docs/understand/machine-claude.md +2 -2
  67. package/docs/understand/on-your-machine.md +1 -1
  68. package/docs/web-ui.md +10 -5
  69. package/harness.config.json +1 -1
  70. package/js/README.md +5 -3
  71. package/js/build/args.mjs +13 -2
  72. package/js/build/driver.mjs +34 -7
  73. package/js/build/emit-claude.mjs +9 -5
  74. package/js/build/emit-opencode.mjs +13 -9
  75. package/js/build/generate.mjs +10 -165
  76. package/js/build/profile.mjs +318 -0
  77. package/js/build/render.mjs +81 -3
  78. package/js/build/retired-skills.mjs +60 -13
  79. package/js/build/source.mjs +15 -1
  80. package/js/build/stubs.mjs +4 -1
  81. package/js/cli-table.json +48 -3
  82. package/js/hosts/done-checks.mjs +6 -0
  83. package/js/hosts/geneseed-dir.mjs +3 -2
  84. package/js/hosts/gitref.mjs +5 -3
  85. package/js/hosts/hook-tap.mjs +104 -0
  86. package/js/hosts/hooks-context.mjs +4 -2
  87. package/js/hosts/hooks-done.mjs +345 -55
  88. package/js/hosts/hooks-learn.mjs +51 -19
  89. package/js/hosts/hooks-prims.mjs +5 -3
  90. package/js/hosts/hooks.mjs +172 -19
  91. package/js/hosts/hosts.mjs +80 -12
  92. package/js/hosts/installs.mjs +26 -1
  93. package/js/hosts/native.mjs +33 -7
  94. package/js/hosts/owned.mjs +7 -6
  95. package/js/hosts/ownership-gate.mjs +14 -1
  96. package/js/hosts/settings.mjs +273 -105
  97. package/js/hosts/shim.mjs +4 -4
  98. package/js/hosts/usage.mjs +9 -3
  99. package/js/inspect/checks-constitution.mjs +32 -0
  100. package/js/inspect/checks-probe.mjs +66 -5
  101. package/js/inspect/checks-repo.mjs +196 -2
  102. package/js/inspect/cost.mjs +34 -2
  103. package/js/inspect/diff.mjs +21 -3
  104. package/js/inspect/doctor.mjs +6 -1
  105. package/js/inspect/inventory.mjs +1 -1
  106. package/js/lib/machine-dir.mjs +1 -1
  107. package/js/lib/node-floor.mjs +46 -6
  108. package/js/maintain/setup.mjs +5 -1
  109. package/js/maintain/uninstall.mjs +42 -16
  110. package/js/maintain/update.mjs +4 -2
  111. package/js/web/actions.mjs +17 -12
  112. package/js/web/api.mjs +7 -2
  113. package/package.json +1 -1
  114. package/registry.json +14 -0
  115. package/src/AGENT.md.tmpl +15 -17
  116. package/src/bricks/pr-open.md +3 -2
  117. package/src/doctrines/ops.md +2 -2
  118. package/src/doctrines/process.md +40 -36
  119. package/src/factories/analysis-to-build.json +1 -1
  120. package/src/factories/bug-report-to-fix.json +1 -1
  121. package/src/factories/issue-to-pr.json +1 -1
  122. package/src/kits/terminal-tools/rules.md +10 -0
  123. package/src/kits/terminal-tools.json +13 -0
  124. package/src/licenses/herdr.txt +201 -0
  125. package/src/modes/foreman.md +6 -3
  126. package/src/skills/_self-improvement.md +9 -7
  127. package/src/skills/commit.md +17 -17
  128. package/src/skills/debug/ci.md +1 -1
  129. package/src/skills/dependencies.md +3 -3
  130. package/src/skills/document-project.md +3 -2
  131. package/src/skills/factory.md +13 -4
  132. package/src/skills/geneseed.md +4 -2
  133. package/src/skills/git-history.md +5 -7
  134. package/src/skills/herdr.md +135 -0
  135. package/src/skills/loop.md +3 -2
  136. package/src/skills/opencode-cli.md +84 -0
  137. package/src/skills/pipeline.md +1 -1
  138. package/src/skills/release.md +5 -8
  139. package/src/skills/review-response.md +4 -2
  140. package/src/skills/rule.md +27 -1
  141. package/src/skills/ship.md +54 -7
  142. package/src/skills/worktree.md +2 -2
  143. package/src/upstreams.json +7 -0
  144. package/themes/_TEMPLATE.json +2 -0
  145. package/themes/biker.json +2 -0
  146. package/themes/commentator.json +2 -0
  147. package/themes/cyberpunk.json +2 -0
  148. package/themes/gamer.json +2 -0
  149. package/themes/imperial.json +2 -0
  150. package/themes/joker.json +2 -0
  151. package/themes/marvin.json +2 -0
  152. package/themes/mean.json +2 -0
  153. package/themes/military.json +2 -0
  154. package/themes/neutral.json +2 -0
  155. package/themes/pirate.json +2 -0
  156. package/themes/sports.json +2 -0
  157. package/themes/verstappen.json +2 -0
  158. package/themes/wizard.json +2 -0
  159. package/web/dist/assets/Activity-D2kOc3yi.js +1 -0
  160. package/web/dist/assets/ActivityDetail-By3xOr21.js +1 -0
  161. package/web/dist/assets/{Bonsai-Bfpb6W-1.js → Bonsai-CBWDTBA4.js} +1 -1
  162. package/web/dist/assets/{CopyButton-ByIntFtB.js → CopyButton-BVbpriMB.js} +1 -1
  163. package/web/dist/assets/Dashboard-CIJLPHM9.js +2 -0
  164. package/web/dist/assets/{Docs-DvlMJhpu.js → Docs-CiRRIELs.js} +3 -3
  165. package/web/dist/assets/Factories-DhyK0O8d.js +1 -0
  166. package/web/dist/assets/GreenhouseView-DW3PgTPy.js +1 -0
  167. package/web/dist/assets/Installs-B6nlo-Ly.js +3 -0
  168. package/web/dist/assets/JournalView-O65qEWfp.js +1 -0
  169. package/web/dist/assets/Kits-C5U-yT6Z.js +1 -0
  170. package/web/dist/assets/Laws-CuTw_XNf.js +4 -0
  171. package/web/dist/assets/{LibRows-DEHjIoD-.js → LibRows-D6-CVa3K.js} +1 -1
  172. package/web/dist/assets/Library-CzPlerd6.js +3 -0
  173. package/web/dist/assets/Loops-CqNF_-nS.js +2 -0
  174. package/web/dist/assets/Markdown-CxkA7940.js +71 -0
  175. package/web/dist/assets/OperatorHudView-BNr8K5qj.js +1 -0
  176. package/web/dist/assets/Personal-DeDb9e8O.js +2 -0
  177. package/web/dist/assets/Settings-B8MPN_AD.js +1 -0
  178. package/web/dist/assets/{Tabs-CWeQTADL.js → Tabs-DJzAez4h.js} +1 -1
  179. package/web/dist/assets/index-BL3P-9Rg.js +6 -0
  180. package/web/dist/assets/{index-CsAZq0BQ.css → index-CRWqKxfY.css} +1 -1
  181. package/web/dist/index.html +2 -2
  182. package/adapters/claude-code/settings.json +0 -52
  183. package/web/dist/assets/Activity-CqJiquEq.js +0 -1
  184. package/web/dist/assets/ActivityDetail-BSzevynX.js +0 -1
  185. package/web/dist/assets/Dashboard-DBOEi9lQ.js +0 -2
  186. package/web/dist/assets/Factories-Bpvv7L2H.js +0 -1
  187. package/web/dist/assets/GreenhouseView-GpBsYn50.js +0 -1
  188. package/web/dist/assets/Installs-BlGmVrFK.js +0 -3
  189. package/web/dist/assets/JournalView-iLuLrOxE.js +0 -1
  190. package/web/dist/assets/Kits-DRwpxC-J.js +0 -1
  191. package/web/dist/assets/Laws-CZkiNOWQ.js +0 -4
  192. package/web/dist/assets/Library-B4K-1iNF.js +0 -3
  193. package/web/dist/assets/Loops-BWSzaW8E.js +0 -2
  194. package/web/dist/assets/Markdown-0ORz7tAc.js +0 -69
  195. package/web/dist/assets/OperatorHudView-BAXwCEvY.js +0 -1
  196. package/web/dist/assets/Personal-Bp9nV4GR.js +0 -2
  197. package/web/dist/assets/Settings-CWWuaIp-.js +0 -1
  198. package/web/dist/assets/index-How7SzDZ.js +0 -6
@@ -1,69 +0,0 @@
1
- import{n as e,r as t}from"./rolldown-runtime-XKyaHtl9.js";import{i as n,t as r}from"./react-C1iE8mnY.js";var i=t(n(),1);function a(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var o=a();function s(e){o=e}var c={exec:()=>null};function l(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function u(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(f.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var d=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),f={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)([ \t]+)/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:l(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:l(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:l(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:l(e=>RegExp(`^ {0,${e}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:l(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:l(e=>RegExp(`^ {0,${e}}(?:</?(?:${S})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,`i`)),blockquoteBeginRegex:l(e=>RegExp(`^ {0,${e}}>`))},p=/^(?:[ \t]*(?:\n|$))+/,m=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,h=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,g=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,_=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,v=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ee=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,y=u(ee).replace(/bull/g,v).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),te=u(ee).replace(/bull/g,v).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),b=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,ne=/^[^\n]+/,x=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,re=u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,x).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ie=u(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,v).getRegex(),S=`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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,C=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ae=u(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?:[ \\t]+|\\n|/?>|$)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,C).replace(`tag`,S).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),oe=e=>u(b).replace(`hr`,g).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,S).getRegex(),se=oe(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),ce=oe(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),w={blockquote:u(/^( {0,3}> ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace(`paragraph`,ce).getRegex(),code:m,def:re,fences:h,heading:_,hr:g,html:ae,lheading:y,list:ie,newline:p,paragraph:se,table:c,text:ne},le=u(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,g).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,S).getRegex(),ue={...w,lheading:te,table:le,paragraph:u(b).replace(`hr`,g).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,le).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,S).getRegex()},de={...w,html:u(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,C).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:c,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:u(b).replace(`hr`,g).replace(`heading`,` *#{1,6} *[^
2
- ]`).replace(`lheading`,y).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},fe=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,pe=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,me=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,he=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,T=/[\p{P}\p{S}]/u,E=/[\s\p{P}\p{S}]/u,D=/[^\s\p{P}\p{S}]/u,ge=u(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,E).getRegex(),_e=/[\p{Pi}\p{Ps}"']/u,ve=/(?!~)[\p{P}\p{S}]/u,ye=/(?!~)[\s\p{P}\p{S}]/u,be=/(?:[^\s\p{P}\p{S}]|~)/u,xe=u(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,d?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),O=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Se=u(O,`u`).replace(/punct/g,T).getRegex(),Ce=u(O,`u`).replace(/punct/g,ve).getRegex(),we=u(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,_e).replace(/punct/g,T).getRegex(),k=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Te=u(k,`gu`).replace(/notPunctSpace/g,D).replace(/punctSpace/g,E).replace(/punct/g,T).getRegex(),Ee=u(k,`gu`).replace(/notPunctSpace/g,be).replace(/punctSpace/g,ye).replace(/punct/g,ve).getRegex(),De=u(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,D).replace(/punctSpace/g,E).replace(/punct/g,T).getRegex(),Oe=u(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,D).replace(/punctSpace/g,E).replace(/punct/g,T).getRegex(),ke=u(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,D).replace(/punctSpace/g,E).replace(/punct/g,T).getRegex(),Ae=u(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,T).getRegex(),je=u(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,D).replace(/punctSpace/g,E).replace(/punct/g,T).getRegex(),Me=u(/\\(punct)/,`gu`).replace(/punct/g,T).getRegex(),Ne=u(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,`gu`).replace(/punct/g,T).getRegex(),Pe=u(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[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])?)+(?![-_])/).getRegex(),Fe=u(C).replace(`(?:-->|$)`,`-->`).getRegex(),Ie=u(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Fe).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),A=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,j=u(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,A).getRegex(),Le=u(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace(`label`,j).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Re=u(/^!?\[(label)\]\[(ref)\]/).replace(`label`,j).replace(`ref`,x).getRegex(),ze=u(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,x).getRegex(),M=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Be=u(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,A).getRegex(),Ve=u(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,u(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Be).replace(`ref`,M).getRegex()).replace(`nolink`,u(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,M).getRegex()).getRegex(),N=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,He=u(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),P={_backpedal:c,anyPunctuation:Me,anyPunctuationOutsideCode:Ne,autolink:Pe,blockSkip:xe,br:me,code:pe,del:c,delLDelim:c,delRDelim:c,emStrongLDelim:Se,emStrongRDelimAst:Te,emStrongRDelimUnd:Oe,escape:fe,link:Le,nolink:ze,punctuation:ge,reflink:Re,reflinkSearch:Ve,tag:Ie,text:he,url:c},Ue={...P,emStrongLDelim:we,emStrongRDelimAst:De,emStrongRDelimUnd:ke,link:u(/^!?\[(label)\]\((.*?)\)/).replace(`label`,j).getRegex(),reflink:u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,j).getRegex()},F={...P,emStrongRDelimAst:Ee,emStrongLDelim:Ce,delLDelim:Ae,delRDelim:je,url:u(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,He).replace(`protocol`,N).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:u(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,N).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},We={...F,br:u(me).replace(`{2,}`,`*`).getRegex(),text:u(F.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},I={normal:w,gfm:ue,pedantic:de},L={normal:P,gfm:F,breaks:We,pedantic:Ue},Ge={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},Ke=e=>Ge[e];function R(e,t){if(t){if(f.escapeTest.test(e))return e.replace(f.escapeReplace,Ke)}else if(f.escapeTestNoEncode.test(e))return e.replace(f.escapeReplaceNoEncode,Ke);return e}function qe(e){return f.numericCharacterReference.test(e)?e.replace(f.numericCharacterReferenceOrAmpersand,(e,t,n)=>{if(t===void 0&&n===void 0)return`&amp;`;let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:r===38?`&amp;`:String.fromCodePoint(r)}):e}function Je(e){try{e=encodeURI(e).replace(f.percentDecode,`%`)}catch{return null}return e}function Ye(e,t){let n=e.replace(f.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(f.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(f.slashPipe,`|`);return n}function z(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Xe(e){let t=e.split(`
3
- `),n=t.length-1;for(;n>=0&&f.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
4
- `)}function B(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function Ze(e,t){if(e.indexOf(t[0])===-1&&e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function V(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function Qe(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`,l=r.state.inLink,u=r.state.linkEmitted,d=r.state.inRawBlock;r.state.inLink=!0,r.state.linkEmitted=!1;let f=r.inlineTokens(s),p=r.state.linkEmitted;if(r.state.linkEmitted=u,r.state.inLink=l,!c){if(p){r.state.inRawBlock=d;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:f}}function $e(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
5
- `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return e.slice(Math.min(r.length,i.length))}).join(`
6
- `)}function et(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var H=class{options;rules;lexer;constructor(e){this.options=e||o}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:Xe(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=$e(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=z(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:z(t[0],`
7
- `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:z(t[0],`
8
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=z(t[0],`
9
- `).split(`
10
- `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
11
- `),c=s.replace(this.rules.other.blockquoteMarkerWhitespace,(e,t,n)=>t+V(n,t.length)).replace(this.rules.other.blockquoteSetextReplace,`
12
- $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
13
- ${s}`:s,r=r?`${r}
14
- ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`||u?.type===`heading`||u?.type===`hr`||u?.type===`html`)break;if(u?.type===`blockquote`){let t=u,a=e.join(`
15
- `),o=t.raw+`
16
- `+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s;let c=o.substring(s.raw.length).replace(/^\n/,``),l=c?c.split(`
17
- `).length:0,d=l?e.slice(0,-l):e;d.length>0&&(n=`${n}
18
- ${d.join(`
19
- `)}`),r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
20
- `+e.join(`
21
- `),o=this.list(a);i[i.length-1]=o;let s=o.raw.length>t.raw.length?a.slice(t.raw.length+1,o.raw.length).split(`
22
- `).length:0;if(s>0){let t=e.slice(0,s).join(`
23
- `);n=`${n}
24
- ${t}`,r=`${r}
25
- ${t}`}e=e.slice(s)}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=e,r=()=>n.length-e.length,i=t[1].trim(),a=i.length>1,o={type:`list`,raw:``,ordered:a,start:a?+i.slice(0,-1):``,loose:!1,items:[]};i=a?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=a?i:`[*+-]`);let s=this.rules.other.listItemRegex(i),c=!1;for(;e;){let i=!1,a=``;if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;let l=r();e=e.substring(t[0].length);let u=t[2].split(`
26
- `,1)[0],d=t[1].length,f=this.options.pedantic?V(u,d):u.replace(this.rules.other.leadingSpaceTab,e=>V(e,d)),p=e.split(`
27
- `,1)[0],m=!f.trim(),h=0;if(this.options.pedantic?(h=2,a=f.trimStart()):m?h=d+1:(h=f.search(this.rules.other.nonSpaceChar),h=h>4?1:h,a=f.slice(h),h+=d),m&&this.rules.other.blankLine.test(p)&&(e=e.substring(p.length+1),i=!0),!i){let t=this.rules.other.nextBulletRegex(h),n=this.rules.other.hrRegex(h),r=this.rules.other.fencesBeginRegex(h),i=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(h):this.rules.other.headingBeginRegex(h),o=this.rules.other.htmlBeginRegex(h),s=this.rules.other.blockquoteBeginRegex(h);for(;e;){let c=e.split(`
28
- `,1)[0],l;if(p=c,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting,` `),l=p):l=p.replace(this.rules.other.leadingSpaceTab,e=>V(e)),r.test(p)||i.test(p)||o.test(p)||s.test(p)||t.test(p)||n.test(p))break;if(l.search(this.rules.other.nonSpaceChar)>=h||!p.trim())a+=`
29
- `+l.slice(h);else{if(m||f.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||r.test(f)||i.test(f)||n.test(f))break;let e=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(p)&&this.rules.block.lheading.test(`${f}
30
- ${p}`)?` ${l.replace(/^ {0,3}/,``)}`:p;a+=`
31
- `+e}m=!p.trim(),e=e.substring(c.length+1),f=l.slice(h)}}let g=n.slice(l,r());o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(g)&&(c=!0)),o.items.push({type:`list_item`,raw:g,task:!!this.options.gfm&&this.rules.other.listIsTask.test(a),loose:!1,text:a,tokens:[]})}let l=o.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;o.raw=n.slice(0,r()).trimEnd();for(let e of o.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!o.loose){let t=e.tokens.filter(e=>e.type===`space`);o.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of o.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,o.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(o.loose)for(let e of o.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=Xe(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){if(!this.rules.other.startAngleBracket.test(t[2])&&Ze(t[2],`()`)!==-1)return;let e=B(t[1]).replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:z(t[0],`
32
- `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Ye(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
33
- `):[],a={type:`table`,raw:z(t[0],`
34
- `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Ye(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:z(t[0],`
35
- `),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
36
- `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){if(this.lexer.state.linkParenPossible===!1)return;let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&et(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=z(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=Ze(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let i=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),Qe(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&et(e,n[1],r,this.rules))return;let i=t[B((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return Qe(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||!r[1]&&!r[2]&&!r[3]&&!r[4])return;let i=r[0][0],a=n===i,o=t.length-e.length,s=o;for(;!this.options.pedantic&&s>0&&t[s-1]===i;)s--;let c=[...t.slice(Math.max(0,s-2),s)].at(-1)??``,l=c===`*`||c===`_`||!!this.rules.inline.punctuation.exec(c);s<o&&(n=c);let u=s<o?l:!!this.rules.inline.punctuation.exec(n);if(r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))return;let d=r[1]||r[3]||``;if(!d||!n||u){let n=[...r[0]].length-1,u,f,p=n,m=0,h=o-s+n,g=!this.options.pedantic&&!!c.trim()&&(!!d||i===`*`&&!l),_=i===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(_.lastIndex=0,t=t.slice(-1*e.length+n);(r=_.exec(t))!==null;){if(u=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!u)continue;if(f=[...u].length,r[3]||r[4]){p+=f;continue}if(r[5]||r[6]||g){if(a&&(r[5]||r[6]))break;if(h%3&&!((h+f)%3)){m+=f;continue}}if(p-=f,p>0)continue;f=Math.min(f,f+p+m);let t=[...r[0]][0].length,i=e.slice(0,n+r.index+t+f);if(Math.min(n,f)%2){let e=i.slice(1,-1);return{type:`em`,raw:i,text:e,tokens:this.lexer.inlineTokens(e)}}let o=i.slice(2,-2);return{type:`strong`,raw:i,text:o,tokens:this.lexer.inlineTokens(o)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:e?t[0]:qe(t[0]),escaped:e}}}},U=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||o,this.options.tokenizer=this.options.tokenizer||new H,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let t={other:f,block:I.normal,inline:L.normal};this.options.pedantic?(t.block=I.pedantic,t.inline=L.pedantic):this.options.gfm&&(t.block=I.gfm,t.inline=this.options.breaks?L.breaks:L.gfm),this.tokenizer.rules=t}static get rules(){return{block:I,inline:L}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(f.carriageReturn,`
37
- `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.state.inRawBlock=!1,this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(f.tabCharGlobal,` `).replace(f.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
38
- `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
39
- `)?``:`
40
- `)+i.raw,n.text+=`
41
- `+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if((i=this.tokenizer.fences(e))||(i=this.tokenizer.heading(e))||(i=this.tokenizer.hr(e))||(i=this.tokenizer.blockquote(e))||(i=this.tokenizer.list(e))||(i=this.tokenizer.html(e))){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
42
- `)?``:`
43
- `)+i.raw,n.text+=`
44
- `+i.raw,this.inlineQueue.at(-1).src=n.text):(this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title}),t.push(i));continue}if((i=this.tokenizer.table(e))||(i=this.tokenizer.lheading(e))){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
45
- `)?``:`
46
- `)+i.raw,r.text+=`
47
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length)}else if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
48
- `)?``:`
49
- `)+i.raw,n.text+=`
50
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(e.charAt(0)!==`!`&&Object.hasOwn(this.tokens.links,B(e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&e.includes(`)`);try{return this.#e(e,t)}finally{this.state.linkParenPossible=n}}#e(e,t){let n=e.includes(`*`)||e.includes(`_`)||e.includes(`~`)||this.options.hooks?.emStrongMask||this.tokenizer.emStrong!==H.prototype.emStrong||this.tokenizer.del!==H.prototype.del?this.#t(e):e,r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if((o=this.tokenizer.escape(e))||(o=this.tokenizer.tag(e))||(o=this.tokenizer.link(e))){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if((o=this.tokenizer.emStrong(e,n,i))||(o=this.tokenizer.codespan(e))||(o=this.tokenizer.br(e))||(o=this.tokenizer.del(e,n,i))||(o=this.tokenizer.autolink(e))||!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}#t(e){let t=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,n=t=>{let r=t.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,B(t.slice(r+1,-1))))return t;if(r>1&&t.charAt(0)!==`!`){let i=t.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,n)+`][`+`a`.repeat(t.length-r-2)+`]`}return`[`+`a`.repeat(t.length-2)+`]`};t=t.replace(e,n)}return t=t.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(e,t,n)=>n?`+`.repeat(e.length):t?t+e.slice(t.length,-t.length).replace(/`/g,`+`)+t:e),t=t.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),t=this.options.hooks?.emStrongMask?.call({lexer:this},t)??t,t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},W=class{options;parser;constructor(e){this.options=e||o}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(f.notSpaceStart)?.[0],i=e?e.replace(f.endingNewline,``)+`
51
- `:``;return r?`<pre><code class="language-`+R(r)+`">`+(n?i:R(i,!0))+`</code></pre>
52
- `:`<pre><code>`+(n?i:R(i,!0))+`</code></pre>
53
- `}blockquote({tokens:e}){return`<blockquote>
54
- ${this.parser.parse(e)}</blockquote>
55
- `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
56
- `}hr(e){return`<hr>
57
- `}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
58
- `+r+`</`+i+`>
59
- `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
60
- `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
61
- `}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
62
- <thead>
63
- `+t+`</thead>
64
- `+r+`</table>
65
- `}tablerow({text:e}){return`<tr>
66
- ${e}</tr>
67
- `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
68
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${R(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?R(n,!0):this.parser.parseInline(r),o=Je(e);if(o===null)return a;e=R(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+R(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Je(e);if(i===null)return R(n);e=i;let a=`<img src="${R(e)}" alt="${R(n)}"`;return t&&(a+=` title="${R(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:R(e.text)}},G=class{parser;strong({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}em({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}codespan({text:e}){return e}del({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}html({text:e}){return e}text({text:e}){return e}link({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}image({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}br(){return``}checkbox({raw:e}){return e}},K=class e{options;renderer;textRenderer;constructor(e){this.options=e||o,this.options.renderer=this.options.renderer||new W,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new G,this.textRenderer.parser=this}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},q=class{options;block;constructor(e){this.options=e||o}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?U.lex:U.lexInline}provideParser(e=this.block){return e?K.parse:K.parseInline}};function J(e,t){if(Array.isArray(t))for(let n=0;n<t.length;n++)e.push(t[n]);else e.push(t)}var Y=new class{defaults=a();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=K;Renderer=W;TextRenderer=G;Lexer=U;Tokenizer=H;Hooks=q;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(J(n,t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)J(n,this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)J(n,this.walkTokens(e.tokens,t));break}case`list`:{let e=r;J(n,this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);J(n,this.walkTokens(i,t))}):e.tokens&&J(n,this.walkTokens(e.tokens,t))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new W(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new H(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new q;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=q.passThroughHooks.has(n)?e=>{if(t.options.async&&q.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(t.options.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&J(n,t.call(this,e)),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return U.lex(e,t??this.defaults)}parser(e,t){return K.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?U.lex:U.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?K.parse:K.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?U.lex:U.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?K.parse:K.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
69
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+R(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function X(e,t){return Y.parse(e,t)}X.options=X.setOptions=function(e){return Y.setOptions(e),X.defaults=Y.defaults,s(X.defaults),X},X.getDefaults=a,X.defaults=o;function tt(...e){return Y.use(...e),X.defaults=Y.defaults,s(X.defaults),X}X.use=tt,X.walkTokens=function(e,t){return Y.walkTokens(e,t)},X.parseInline=Y.parseInline,X.Parser=K,X.parser=K.parse,X.Renderer=W,X.TextRenderer=G,X.Lexer=U,X.lexer=U.lex,X.Tokenizer=H,X.Hooks=q,X.parse=X,X.options,X.setOptions,X.walkTokens,X.parseInline,K.parse,U.lex;var nt=e({default:()=>$,renderMarkdown:()=>Q,sanitizeHtml:()=>Z}),rt=r(),it=new Set([`script`,`style`,`iframe`,`frame`,`frameset`,`object`,`embed`,`link`,`meta`,`base`,`form`,`template`,`animate`,`set`,`animatemotion`,`animatetransform`,`discard`,`animatecolor`,`xmp`,`noembed`,`noframes`,`noscript`,`plaintext`]),at=new Set([`href`,`src`,`xlink:href`,`action`,`formaction`,`poster`,`background`]),ot=new Set([`http`,`https`,`mailto`]);function st(e){let t=/^([a-z][a-z0-9+.-]*):/.exec(e.replace(/[\u0000- ]/g,``).toLowerCase());return!t||ot.has(t[1])}function Z(e){for(let t=0;t<4;t++){let t=ct(e);if(t===e)return t;e=t}return``}function ct(e){let t=document.createElement(`template`);return t.innerHTML=e,t.content.querySelectorAll(`*`).forEach(e=>{if(it.has(e.localName.toLowerCase()))return e.remove();for(let{name:t,value:n}of[...e.attributes]){let r=t.toLowerCase();(r.startsWith(`on`)||r===`srcdoc`||r===`style`||at.has(r)&&!st(n))&&e.removeAttribute(t)}}),t.innerHTML}function Q(e,t=[]){let n=new Map(t.map(e=>[e.label,e])),r=(e||``).replace(/\[\[([^\]]+)\]\]/g,(e,t)=>{let r=n.get(t.trim());return r?`[${r.label}](#/item/${r.type}/${encodeURIComponent(r.name)})`:e});return Z(X.parse(r,{breaks:!1}))}var lt=[];function $({body:e,links:t=lt}){let n=(0,i.useMemo)(()=>Q(e,t),[e,t]);return(0,rt.jsx)(`div`,{className:`markdown`,dangerouslySetInnerHTML:{__html:n}})}export{X as a,Z as i,nt as n,Q as r,$ as t};
@@ -1 +0,0 @@
1
- import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{n,r}from"./sections-CtFz7HFH.js";import{F as i,_t as a}from"./index-How7SzDZ.js";import{n as o,r as s}from"./Dashboard-DBOEi9lQ.js";e();var c=t(),l=14;function u({title:e,right:t,children:n,span:r}){return(0,c.jsxs)(`div`,{className:`c-mod`,style:r?{gridColumn:`span ${r}`}:null,children:[(0,c.jsxs)(`div`,{className:`c-mod-head`,children:[(0,c.jsx)(`span`,{className:`c-tab`}),(0,c.jsx)(`h3`,{children:e}),t&&(0,c.jsx)(`span`,{className:`c-mod-right`,children:t})]}),(0,c.jsx)(`div`,{className:`c-mod-body`,children:n})]})}function d({label:e,value:t}){return(0,c.jsxs)(`div`,{className:`c-kpi`,children:[(0,c.jsx)(`div`,{className:`c-kpi-label`,children:e}),(0,c.jsx)(`div`,{className:`c-kpi-val`+(t===0?` zero`:``),children:t})]})}function f({data:e,height:t=120,hi:n}){if(!e.length)return null;let r=Math.max(...e.map(e=>e.v),1);return(0,c.jsx)(`div`,{className:`c-cols`,style:{height:t},children:e.map((e,i)=>{let a=Math.max(e.v/r*(t-6),2);return(0,c.jsx)(`div`,{className:`c-col ${i===n?`hi`:``}`,style:{height:a},title:`${e.t}: ${e.v}`},i)})})}function p({checks:e}){return(0,c.jsx)(`div`,{className:`c-band`,children:e.map((e,t)=>(0,c.jsx)(`span`,{className:`c-band-cell ${e.problems.length===0?`ok`:`bad`}`,title:`${e.label}: ${e.problems.length===0?`pass`:`${e.problems.length} problem(s)`}`},t))})}function m(e){let t={};for(let n of e||[]){let e=n.action||`unknown`;t[e]=(t[e]||0)+1}return Object.entries(t).map(([e,t])=>({label:e,value:t})).sort((e,t)=>t.value-e.value)}function h({overview:e,jobs:t,lens:h}){let g=e.counts||{},_=r.reduce((e,t)=>e+(g[t]||0),0),v=Math.max(...r.map(e=>g[e]||0),1),y=h?.doctor?.state||`loading`,b=h?.doctor?.data?.groups||[],x=b.filter(e=>e.problems.length===0).length,S=i(t||[],10,`0d`),C=S.reduce((e,t)=>e+t.v,0),w=m(t),T=Math.max(...w.map(e=>e.value),1),E=a(e.diff),D=[[`status`,e.deployed?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`DEPLOYED`}):(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NOT DEPLOYED`})],[`voice`,(0,c.jsx)(`span`,{className:`t-cap`,children:e.theme})],[`mode`,e.emit],[`doctor`,y===`failed`?(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NO ANSWER`}):y===`ok`?b.length===0?(0,c.jsx)(`span`,{className:`c-pill`,children:`—`}):x===b.length?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`CLEAN`}):(0,c.jsxs)(`span`,{className:`c-pill warn`,children:[b.length-x,` ISSUES`]}):(0,c.jsx)(`span`,{className:`c-pill`,children:`…`})],[`edits`,String(E)],[`built`,e.build_time||`—`],[`target`,(0,c.jsx)(`span`,{className:`c-dim mono`,children:e.target})]];return(0,c.jsxs)(`div`,{className:`c-root`,children:[(0,c.jsx)(`div`,{className:`c-titlebar`,children:(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`h2`,{className:`c-h1`,children:`HARNESS // STATUS`}),(0,c.jsxs)(`div`,{className:`c-sub`,children:[e.target,` · rendered from src/ · inherited everywhere`]}),(0,c.jsx)(o,{verdict:h?.verdict})]})}),(0,c.jsx)(`div`,{className:`c-strip`,children:D.map(([e,t],n)=>(0,c.jsxs)(`div`,{className:`c-strip-cell`,children:[(0,c.jsx)(`div`,{className:`c-strip-k`,children:e}),(0,c.jsx)(`div`,{className:`c-strip-v`,children:t})]},n))}),(0,c.jsxs)(`div`,{className:`c-kpi-row`,children:[(0,c.jsx)(d,{label:`AGENTS`,value:g.agents??`—`}),(0,c.jsx)(d,{label:`SKILLS`,value:g.skills??`—`}),(0,c.jsx)(d,{label:`DICTATES`,value:g.laws??`—`}),(0,c.jsx)(d,{label:`PACKS`,value:g.doctrines?`${g.doctrines.active}/${g.doctrines.total}`:`—`}),(0,c.jsx)(d,{label:`MEMORY`,value:g.memory??`—`}),(0,c.jsx)(d,{label:`NOTEBOOK`,value:g.notebook??`—`}),(0,c.jsx)(d,{label:`EDITS`,value:E})]}),(0,c.jsxs)(`div`,{className:`c-grid`,children:[(0,c.jsx)(u,{title:`CAPABILITY DISTRIBUTION`,right:`${_} ENTRIES`,span:2,children:(0,c.jsxs)(`table`,{className:`c-tbl`,children:[(0,c.jsx)(`thead`,{children:(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`th`,{children:`SECTION`}),(0,c.jsx)(`th`,{children:`DETAIL`}),(0,c.jsx)(`th`,{style:{width:150},children:`SHARE`}),(0,c.jsx)(`th`,{className:`num`,children:`N`})]})}),(0,c.jsx)(`tbody`,{children:r.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,children:n[e].label}),(0,c.jsx)(`td`,{className:`c-dim`,children:n[e].desc}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${(g[e]||0)/v*100}%`,background:e===`agents`||e===`skills`?`var(--accent)`:`var(--line-3)`}})})}),(0,c.jsx)(`td`,{className:(g[e]||0)>0?`num`:`num c-dim`,children:g[e]??0})]},e))})]})}),(0,c.jsx)(u,{title:`DOCTOR // CHECKS`,right:b.length?`${x}/${b.length}`:`—`,children:b.length>0?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(p,{checks:b}),(0,c.jsx)(`div`,{className:`c-check-list`,children:b.map(e=>{let t=e.problems.length===0;return(0,c.jsxs)(`div`,{className:`c-check-row`,children:[(0,c.jsx)(`span`,{className:`c-dotmark ${t?`ok`:`bad`}`}),(0,c.jsx)(`span`,{className:`c-check-name`,children:e.label}),(0,c.jsx)(`span`,{className:`c-check-detail`,children:t?`clean`:`${e.problems.length} problem${e.problems.length===1?``:`s`}`})]},e.label)})})]}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:y===`failed`?`Doctor did not answer.`:y===`ok`?`Doctor reported no checks.`:`Checking…`})}),(0,c.jsxs)(u,{title:`RUN RATE // 10D`,right:`${C} RUNS`,span:2,children:[(0,c.jsx)(f,{data:S,height:120,hi:S.length-1}),(0,c.jsx)(`div`,{className:`c-axis`,children:S.map((e,t)=>(0,c.jsx)(`span`,{children:t%2==0?e.t:``},t))})]}),(0,c.jsx)(u,{title:`RUN LOG // BY TYPE`,right:`${(t||[]).length} LOGGED`,children:w.length>0?(0,c.jsx)(`table`,{className:`c-tbl`,children:(0,c.jsx)(`tbody`,{children:w.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,style:{textTransform:`uppercase`,fontWeight:400},children:e.label}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${e.value/T*100}%`,background:`var(--accent)`}})})}),(0,c.jsx)(`td`,{className:`num`,children:e.value})]},e.label))})}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})}),(0,c.jsx)(u,{title:`RECENT // RUN LOG`,span:3,children:(0,c.jsx)(s,{jobs:t,max:l,empty:(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})})})]})]})}export{h as default};
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{$ as i,Dt as a,Et as o,J as s,K as c,St as l,U as u,V as d,et as f,it as p,mt as m,nt as h,pt as g,tt as _}from"./index-How7SzDZ.js";import{t as v}from"./Markdown-0ORz7tAc.js";import{t as y}from"./EmptyState-CY5Pm2xy.js";import{t as b}from"./Tabs-CWeQTADL.js";import x,{installLabel as S}from"./Library-B4K-1iNF.js";var C=e(t(),1),w=e=>e(`Discard your unsaved edit?`,{title:`Unsaved edit`,confirmLabel:`Discard`,tone:`danger`}),T=`The file changed on disk — reloaded the fresh copy. Your draft is kept.`;function E({data:e,reload:t}){let n=p(),[r,i]=(0,C.useState)(null),[s,c]=(0,C.useState)(null),[l,u]=(0,C.useState)(!1),[d,f]=(0,C.useState)(``),m=e?.fingerprint||``,h=r!==null&&JSON.stringify(r)!==JSON.stringify(s),g=(0,C.useRef)(!1),_=e=>{i(e),c(e)},v=()=>i(null);return(0,C.useEffect)(()=>{if(!h)return;let e=e=>{e.preventDefault(),e.returnValue=``};window.addEventListener(`beforeunload`,e);let t=a(({to:e})=>(g.current||(g.current=!0,w(n).then(n=>{n&&(t(),i(null),o(e))}).finally(()=>{g.current=!1})),!1));return()=>{window.removeEventListener(`beforeunload`,e),t()}},[h,n]),{draft:r,setDraft:i,open:_,close:v,discard:async()=>h&&!await w(n)?!1:(v(),!0),dirty:h,busy:l,notice:d,setNotice:f,save:async(e,{conflict:n}={})=>{u(!0),f(``);try{return await e(m)||!0}catch(e){e.status===409?f(n??T):f(e.message);return}finally{u(!1),t()}}}}var D=n(),O=(e,t)=>`${e} ${t}${e===1?``:`s`}`,k=e=>`≈${e.toLocaleString(`en-US`)} tokens`,ee={title:``,body:``,scope:`project`,trial_until:``},A=[`project`,`global`],j=e=>e===`user`?`global`:e,M=/\r\n|[\n\r\v\f\x1c\x1d\x1e\x85\u2028\u2029]/,N=e=>e.startsWith(`## `)||/^##\s+R\d+\s*[—–-]+\s*\S/.test(e),te=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Your draft is kept — Save again.`,ne=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Try again.`;function P({value:e,onChange:t,onCancel:n,onSave:r,busy:i,writeTo:a=null}){let[o]=(0,C.useState)(e.scope),s=n=>r=>t({...e,[n]:r.target.value}),c=e.body.trim().split(M).some(N)?`A line cannot start with “## ” — user-rules.md reads it as a new rule heading. Use ### or plain text.`:``,l=!(e.title.trim()&&e.body.trim()),u=!l&&!c;return(0,D.jsxs)(`div`,{className:`rule-form`,children:[a,(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule title`}),(0,D.jsx)(`input`,{className:`lib-filter`,type:`text`,value:e.title,onChange:s(`title`),placeholder:`Title — short and imperative (e.g. No emoji in commit subjects)`,autoFocus:!0})]}),(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule body`}),(0,D.jsx)(`textarea`,{className:`rule-body-input`,value:e.body,onChange:s(`body`),rows:4,placeholder:`The rule, stated plainly and testably, in one short paragraph.`,"aria-invalid":c?!0:void 0,"aria-describedby":c?`rule-body-error`:void 0})]}),c?(0,D.jsx)(`p`,{id:`rule-body-error`,className:`sub sub-wide rule-notice`,role:`alert`,children:c}):null,(0,D.jsxs)(`div`,{className:`row wrap`,children:[(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule scope`}),(0,D.jsxs)(`select`,{className:`sel`,value:e.scope,onChange:s(`scope`),children:[(0,D.jsx)(`option`,{value:`project`,children:`scope: project (this repo, committable)`}),(0,D.jsx)(`option`,{value:`global`,children:`scope: global (every repository)`}),A.includes(o)?null:(0,D.jsxs)(`option`,{value:o,children:[`scope: `,o,` (as written in the file)`]})]})]}),(0,D.jsxs)(`label`,{className:`rule-trial-label`,children:[`trial until`,(0,D.jsx)(`input`,{className:`lib-filter rule-date`,type:`date`,value:e.trial_until,onChange:s(`trial_until`),"aria-label":`Trial until date (optional)`})]}),(0,D.jsxs)(`div`,{className:`row gap-8`,style:{marginLeft:`auto`},children:[(0,D.jsx)(`button`,{className:`btn sm`,disabled:!u||i,onClick:()=>r(e),"aria-describedby":l?`rule-form-hint`:void 0,children:i?`Saving…`:`Save rule`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:i,onClick:n,children:`Cancel`})]})]}),l?(0,D.jsx)(`p`,{id:`rule-form-hint`,className:`panel-note`,children:`A rule needs a title and a body.`}):null]})}function re({rule:e,tag:t,usual:n,isOpen:r,onToggle:i,onEdit:a,onDelete:o,onGraduate:s}){let c=t?` · ${t}`:``;return(0,D.jsxs)(`div`,{className:`rule-row ${r?`on`:``}`,children:[(0,D.jsxs)(`button`,{className:`rule-head`,onClick:i,"aria-expanded":r,"data-rule-head":e.key,children:[(0,D.jsxs)(`span`,{className:`rule-no`,children:[`R`,e.id]}),(0,D.jsx)(`span`,{className:`rule-title`,children:e.title}),j(e.scope)===n?null:(0,D.jsx)(`span`,{className:`rule-chip ${e.scope===`user`?`user`:``}`,children:e.scope}),e.status===`trial`&&(0,D.jsx)(`span`,{className:`rule-chip trial ${e.overdue?`overdue`:``}`,children:e.overdue?`review due`:`trial · ${e.trial_until}`}),(0,D.jsx)(`span`,{className:`rule-chip mono`,children:k(e.tokens)})]}),r&&(0,D.jsxs)(`div`,{className:`rule-expand`,children:[(0,D.jsx)(`p`,{children:e.body}),e.source?(0,D.jsxs)(`div`,{className:`rule-src`,children:[`source: `,e.source]}):null,(0,D.jsxs)(`div`,{className:`row gap-8`,style:{marginTop:10},children:[e.status===`trial`&&(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:s,title:`Adopt for good — drop the trial marker`,"aria-label":`Graduate R${e.id}${c}`,children:`Graduate`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:a,"aria-label":`Edit R${e.id}${c}`,children:`Edit`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:o,"aria-label":`Retire R${e.id}${c}`,children:`Retire`})]})]})]})}var F=(e,t)=>({approve:`Approve`,reject:`Reject`,host:`Use the ${e.choice?.host} file`,shared:`Use the shared file`,both:`Keep both`})[t];function I({choice:e}){let t=(e,t,n)=>(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`rule-src`,title:t,children:e}),(0,D.jsx)(`pre`,{className:`mono`,children:n??`(absent)`})]});return(0,D.jsxs)(`div`,{className:`rule-choice`,children:[t(`Shared file`,e.shared_path,e.shared_text),t(`${e.host} file`,e.host_path,e.host_text)]})}function ie({drafts:e,deciding:t,onDecide:n}){return e.length?(0,D.jsxs)(`section`,{className:`mb-16`,"aria-labelledby":`rules-pending`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`rules-pending`,children:`Pending`}),(0,D.jsx)(`span`,{className:`mono dim`,children:e.length})]}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Waiting in `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.draft.md`}),`. A pending rule still binds on its host, and only there. Decide each one here, or ask the agent to run its rule Rite.`]}),(0,D.jsx)(`div`,{className:`card rules-list`,children:e.map((e,r)=>(0,D.jsxs)(`div`,{className:`rule-row`,children:[(0,D.jsxs)(`div`,{className:`rule-head static`,children:[(0,D.jsx)(`span`,{className:`rule-title`,children:e.title}),e.host?(0,D.jsxs)(`span`,{className:`rule-chip mono`,children:[`binds on `,e.host]}):null]}),(0,D.jsxs)(`div`,{className:`rule-expand`,children:[e.body?(0,D.jsx)(`p`,{children:e.body}):null,e.choice?(0,D.jsx)(I,{choice:e.choice}):null,e.held?(0,D.jsx)(`p`,{className:`rule-src`,children:`The shared file already holds this rule. The next rebuild clears it.`}):null,e.decisions?.length?(0,D.jsx)(`div`,{className:`row gap-8`,style:{marginTop:10},children:e.decisions.map(r=>(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:t!==``,"aria-label":`${F(e,r)} · ${e.title}`,onClick:()=>n(e,r),children:F(e,r)},r))}):null]})]},e.key??r))})]}):null}function L({onChanged:e,dataRev:t,onAction:n}){let a=p(),{targets:o,sets:s,failed:l,reason:u,reload:d}=c(r.rules,t),[h,v]=(0,C.useState)(null),b=E({data:null,reload:d}),{draft:x,busy:S,notice:w}=b,[T,A]=(0,C.useState)(``),[M,N]=(0,C.useState)(null),F=(0,C.useRef)(null),[I,L]=(0,C.useState)(0),R=e=>{F.current=e,L(e=>e+1)},z=(0,C.useRef)(null),B=(0,C.useRef)(null);if((0,C.useEffect)(()=>{let e=F.current;if(F.current=null,e===null)return;let t=[...B.current?.querySelectorAll(`[data-rule-head]`)||[]];(e===`add`?z.current:t.find(t=>t.dataset.ruleHead===e))?.focus()},[I]),s&&!s.length&&u)return(0,D.jsx)(i,{error:u,onRetry:d});if(!s)return(0,D.jsx)(f,{});let V=o.length>1,H=e=>e?.id??``,U=e=>e?.shared?`shared`:g(e),W=s.flatMap(({inst:e,data:t})=>(t.rules||[]).map(t=>({...t,inst:e,key:`${H(e)}#${t.id}`}))),G=s.filter(e=>e.data.exists).map(e=>e.inst),K=G.length>0,q=x?.target,J=q!==void 0&&q!==`new`&&!W.some(e=>e.key===q&&e.title===x.title0),Y=q===`new`||J,X=x?.to!==void 0&&!G.some(e=>H(e)===x.to),Z=X?null:G.find(e=>H(e)===x?.to)??G[0]??null,ae=X?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`alert`,children:`The install this draft was for has no user-rules.md now, so it is not saved anywhere else. Cancel it, or copy the text into a new rule.`}):G.length>1?(0,D.jsx)(_,{installs:G,value:Z,onChange:e=>b.setDraft({...x,to:e.id}),tagOf:U}):V&&Z?(0,D.jsxs)(`p`,{className:`install-pick`,children:[(0,D.jsx)(`span`,{className:`dim`,children:`Install:`}),` `,(0,D.jsx)(`span`,{className:`mono`,children:U(Z)})]}):null,Q=async(t,n,i)=>{let a=s.find(e=>H(e.inst)===H(n))?.data.fingerprint||``,o=await b.save(()=>r.rulesMutate({...t,fingerprint:a},m(n)),{conflict:i?te:ne});return o&&i&&b.close(),e?.(),o},$=e=>b.setDraft({...x,form:e}),oe=async(e,t,n)=>{await Q(e,t,!0)&&R(n)},se=async e=>{await b.discard()&&R(e)},ce=async e=>{await a(`Retire rule R${e.id} — “${e.title}”${V?` from ${U(e.inst)}`:``}? It moves to user-rules-retired.md, which is never loaded.`,{title:`Retire this rule?`,confirmLabel:`Retire`,tone:`danger`})&&await Q({op:`delete`,id:e.id},e.inst)&&x===null&&R(`add`)},le=async e=>{await Q({op:`update`,id:e.id,title:e.title,body:e.body,scope:e.scope,source:e.source,trial_until:``},e.inst)&&R(e.key)},ue=(e,t)=>{let n=e.choice?.file;return t===`approve`?a(`Approve “${e.title}”? It moves to the shared file under a new number and binds every host on this machine. A rule may tighten a law, never repeal one: check that it does not.`,{title:`Approve this rule?`,confirmLabel:`Approve`}):t===`host`?a(`Make the ${e.choice.host} file the shared ${n}? The current shared file is replaced, and a copy goes to archived-${n}/ beside it.`,{title:`Replace the shared file?`,confirmLabel:`Replace`,tone:`danger`}):t!==`shared`||a(`Keep the shared ${n}? The ${e.choice.host} file moves to archived-${n}/ beside it, and that host returns to its seed at the next rebuild.`,{title:`Move the host file aside?`,confirmLabel:`Move aside`,tone:`danger`})},de=async(t,n)=>{if(await ue(t,n)){A(t.key),N(null),b.setNotice(``);try{let e=await r.rulesDecide({key:t.key,decision:n,fingerprint:t.fingerprint},m(t.inst));N({rebuild:e.rebuild,cleared:e.cleared??[]})}catch(e){let t=e.body?.cleared?.length?` Cleared: ${e.body.cleared.join(`, `)}.`:``;b.setNotice(e.status===409?`${e.body?.detail??e.message}${t} Reloaded the fresh copy.`:e.message)}finally{A(``),d(),e?.()}}},fe=async()=>{await a(`Rebuild every active install? Each is rebuilt in place from source with its own settings; files you edited are kept.`,{title:`Rebuild all active installs?`,confirmLabel:`Rebuild all`})&&n(`build-all`)},pe=s.flatMap(({inst:e,data:t})=>(t.warnings||[]).map(t=>V?`${U(e)}: ${t}`:t)),me=s.flatMap(({inst:e,data:t})=>(t.drafts||[]).map(n=>({...n,inst:e,fingerprint:t.draft_fingerprint}))),he=s.filter(e=>e.data.exists),ge=e=>e?.scope===`project`?`project`:`global`,_e=e=>!J&&q===e.key?(0,D.jsx)(`div`,{className:`rule-row on`,children:(0,D.jsx)(`div`,{className:`rule-expand`,style:{paddingTop:14},children:(0,D.jsx)(P,{value:x.form,onChange:$,busy:S,onCancel:()=>se(e.key),onSave:t=>oe({op:`update`,id:e.id,source:e.source,...t},e.inst,e.key)})})},e.key):(0,D.jsx)(re,{rule:e,tag:V?U(e.inst):null,usual:ge(e.inst),isOpen:h===e.key,onToggle:()=>v(h===e.key?null:e.key),onEdit:()=>{v(e.key),b.open({target:e.key,no:e.id,to:H(e.inst),title0:e.title,form:{title:e.title,body:e.body,scope:j(e.scope),trial_until:e.trial_until}})},onDelete:()=>ce(e),onGraduate:()=>le(e)},e.key);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsxs)(`div`,{className:`head-text`,children:[(0,D.jsx)(`h2`,{className:`h`,children:`Rules`}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Your standing rules, from `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),`. The agent obeys them in every session, so keep the set small. `,(0,D.jsx)(`a`,{href:`#/docs/rules`,children:`Docs`})]})]}),K&&x===null&&(0,D.jsx)(`button`,{className:`btn`,ref:z,onClick:()=>b.open({target:`new`,title0:``,form:ee}),children:`Add rule`})]}),w?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:w}):null,l.length?(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:[`Could not read user-rules.md of`,` `,l.map(e=>e?g(e):`the default install`).join(`, `),`.`]}):null,pe.map(e=>(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,children:[`format warning: `,e]},e)),M?(0,D.jsxs)(`p`,{className:`sub sub-wide`,role:`status`,children:[`Decided.`,` `,M.rebuild?`A rebuild removes the host copy.`:`The host file stays as it is.`,M.cleared.length?` Cleared: ${M.cleared.join(`, `)}.`:``,` `,M.rebuild&&n?(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:fe,children:`Rebuild all`}):null]}):null,(0,D.jsx)(ie,{drafts:me,deciding:T,onDecide:de}),Y&&(0,D.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,D.jsx)(`div`,{className:`eyebrow`,style:{marginBottom:10},children:`new rule`}),J?(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:[`Rule R`,x.no,` is no longer in user-rules.md (an agent session removed or renumbered it). Your draft is kept — Save adds it as a new rule.`]}):null,(0,D.jsx)(P,{value:x.form,onChange:$,busy:S,writeTo:ae,onCancel:()=>se(`add`),onSave:e=>!X&&G.length&&oe({op:`add`,...e},Z,`add`)})]}),K?W.length===0&&!Y?(0,D.jsx)(y,{title:`No rules yet`,children:`The file is seeded and loaded every session, and it is empty. Add your first standing rule here, ask the agent for one in a session (the rule skill), or promote a recurring fact from Memory.`}):(0,D.jsx)(`div`,{ref:B,children:he.map(({inst:e,data:t})=>(0,D.jsxs)(`section`,{className:`mb-16`,"aria-label":V?U(e):`Rules`,children:[(0,D.jsxs)(`div`,{className:`rules-file`,children:[V?(0,D.jsx)(`b`,{className:`mono`,children:U(e)}):null,(0,D.jsxs)(`span`,{className:`mono dim`,children:[O(t.rules.length,`rule`),` · `,k(t.stats.tokens),` every turn · scope `,ge(e),` unless marked`]})]}),t.rules.length?(0,D.jsx)(`div`,{className:`card rules-list`,children:W.filter(t=>t.inst===e).map(_e)}):null]},H(e)))}):(0,D.jsxs)(y,{title:`No user-rules.md here yet`,children:[`The build seeds it. Rebuild on the Overview, or run`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`geneseed update`}),`, and it appears, ready for your rules.`]})]})}var R=`PROFILE.md changed on disk since you opened it — reloaded the fresh copy. Your draft is kept — Save again.`,z=e=>e?.id??``;function B({onChanged:e,dataRev:t}){let{targets:n,sets:i,failed:a}=c(r.profile,t);if(!i)return(0,D.jsx)(f,{});let o=new Set(a.map(z)),s=new Set([...i.map(e=>z(e.inst)),...o]),l=n.filter(e=>s.has(z(e))).map(e=>({install:e,tag:n.length<2?null:e?.shared&&!o.has(z(e))?`shared`:g(e)}));return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`mb-16`,children:[(0,D.jsx)(`h2`,{className:`h`,children:`Profile`}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Who you are and how you like to work, from `,(0,D.jsx)(`code`,{className:`mono`,children:`PROFILE.md`}),`. It guides the agent and never binds it. `,(0,D.jsx)(`a`,{href:`#/docs/collaboration`,children:`Docs`})]})]}),l.map(({install:t,tag:n})=>(0,D.jsx)(V,{install:t,tag:n,onChanged:e},z(t)))]})}function V({install:e,tag:t,onChanged:n}){let{data:a,error:o,loading:s,reload:c,setData:u}=l(()=>r.profile(m(e)),[]),d=E({data:a,reload:c}),{draft:p,dirty:g,busy:_,notice:b}=d,[x,S]=(0,C.useState)(!1);if(a&&!x&&(S(!0),(a.text||``).trim()||d.open(a.text||``)),s&&!a)return(0,D.jsx)(f,{});if(o)return(0,D.jsxs)(`section`,{"aria-label":t?`Profile, ${t}`:void 0,children:[t?(0,D.jsx)(`span`,{className:`rule-chip mono`,children:t}):null,(0,D.jsx)(i,{error:o,onRetry:c})]});let w=p!==null,T=a?.text||``;return(0,D.jsxs)(`section`,{"aria-label":t?`Profile, ${t}`:void 0,children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsx)(`div`,{children:t?(0,D.jsx)(`span`,{className:`rule-chip mono`,children:t}):null}),(0,D.jsxs)(`div`,{className:`row`,children:[(0,D.jsxs)(h,{"aria-label":t?`Profile mode, ${t}`:`Profile mode`,children:[(0,D.jsx)(`button`,{className:w?``:`on`,"aria-pressed":!w,onClick:d.discard,children:`View`}),(0,D.jsx)(`button`,{className:w?`on`:``,"aria-pressed":w,onClick:()=>w||d.open(T),children:`Edit`})]}),w&&(0,D.jsx)(`button`,{className:`btn`,disabled:!g||_,onClick:async()=>{let t=await d.save(t=>r.profileSave({text:p,fingerprint:t},m(e)),{conflict:R});t&&(u(e=>({...e,text:p,seeded:!1,fingerprint:t.fingerprint||``})),d.setNotice(`Saved.`),d.close(),n?.())},children:_?`Saving…`:`Save`})]})]}),b?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:b}):null,w?(0,D.jsx)(`textarea`,{className:`rule-body-input`,style:{width:`100%`,minHeight:`60vh`,fontFamily:`var(--mono, monospace)`},value:p,onChange:e=>d.setDraft(e.target.value),spellCheck:!1,"aria-label":`Profile markdown`}):T.trim()?(0,D.jsxs)(D.Fragment,{children:[a?.seeded?(0,D.jsxs)(y,{title:`This is still the template`,children:[`Ask the agent to run the `,(0,D.jsx)(`code`,{className:`mono`,children:`profile`}),` skill — it interviews you and drafts this file with your consent.`]}):null,(0,D.jsx)(`div`,{className:`card pad-lg`,children:(0,D.jsx)(v,{body:T})})]}):(0,D.jsxs)(y,{title:`No profile yet`,children:[`Switch to Edit to write one, or ask the agent to run the`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`profile`}),` skill.`]})]})}var H=(e,t)=>`${e} ${t}${e===1?``:`s`}`,U=e=>e?(e.items||[]).length:null,W=/^- \[([^\]]*)\]\(topics\/[^)]+\.md\) — (\d+) facts?$/,G=e=>String(e||``).split(`
2
- `).map(e=>W.exec(e.trim())).filter(Boolean).map(e=>({topic:e[1],n:Number(e[2])}));function K({topics:e,install:t,shared:n}){return e.length?(0,D.jsxs)(`section`,{className:`panel pm-topics`,"aria-labelledby":`pm-topics`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`pm-topics`,children:`Topics`}),t&&!n?(0,D.jsx)(`span`,{className:`mono dim`,children:S(t)}):null,(0,D.jsx)(`span`,{className:`mono dim`,children:H(e.length,`topic`)})]}),(0,D.jsx)(`ul`,{className:`hbars`,children:e.map(e=>(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`span`,{className:`hb-label`,children:e.topic}),(0,D.jsx)(`span`,{className:`mono hb-n`,children:H(e.n,`fact`)})]},e.topic))})]}):null}var q={memory:{title:`No facts yet`,body:(0,D.jsxs)(`div`,{className:`pm-first`,children:[(0,D.jsx)(`p`,{children:`The agent writes a fact when a session teaches it something durable: a decision, a correction, a trap. Say “remember that…” in any session, and it asks whether that belongs here or in your standing rules.`}),(0,D.jsxs)(`ul`,{children:[(0,D.jsx)(`li`,{children:`One fact per file, filed under a topic.`}),(0,D.jsx)(`li`,{children:`Stale facts move to Archived; nothing is deleted without you.`}),(0,D.jsx)(`li`,{children:`The store stays on this machine and out of git.`})]})]}),action:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`a`,{className:`btn ghost`,href:`#/docs/memory`,children:`How memory works`}),(0,D.jsx)(`a`,{className:`btn ghost`,href:`#/item/skill/rule`,children:`The rule skill`})]})},notebook:{title:`No notes yet`,body:`The notebook is the agent’s own scratch space: plans and notes it keeps for itself.`}};function J({tab:e=`rules`,item:t,dataRev:n,onCountsChanged:i,onAction:a}){let o=e=>Promise.resolve(e).catch(()=>null),c=s(n),{reload:f}=u(n),{data:p,error:m,reload:h}=l(()=>r.profile(),[n]),{data:g,reload:_}=l(()=>r.catalog(`memory`),[`memory`,n],`catalog`),{data:v}=l(()=>r.catalog(`notebook`),[`notebook`,n],`catalog`),S=U(g),{data:C}=l(()=>e===`memory`?o(r.item(`memory`,`MEMORY`)):Promise.resolve(null),[`memory-map`,e,n,S]),w=U(v),T={memory:S,notebook:w},E={profile:m?`read failed`:p?.seeded?`template`:null,memory:S,notebook:w},O=e===`memory`||e===`notebook`;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(d,{title:`Personal`,sub:`The only files you write. They survive updates, reinstalls and voice changes.`+(c?.some(e=>e.shared)?` Global installs share one copy of the rules, profile and memory; a project install keeps its own.`:``)}),(0,D.jsx)(b,{page:`personal`,current:e,badges:E,label:`Personal files`}),e===`rules`&&(0,D.jsx)(L,{onChanged:f,dataRev:n,onAction:a}),e===`profile`&&(0,D.jsx)(B,{onChanged:h,dataRev:n}),O&&T[e]===0&&!t?(0,D.jsx)(y,{title:q[e].title,action:q[e].action,children:q[e].body}):O?(0,D.jsxs)(D.Fragment,{children:[e===`memory`&&(0,D.jsx)(K,{topics:G(C?.body),install:C?.install,shared:C?.shared}),(0,D.jsx)(x,{lock:e,base:`#/personal/${e}`,selected:t,dataRev:n,onCountsChanged:i,onRulesChanged:()=>{f(),_()}},e)]}):null]})}export{J as default};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{i}from"./motion-RlUl1osO.js";import{$ as a,Ct as o,V as s,bt as c,ft as l,gt as u,it as d}from"./index-How7SzDZ.js";var f=e(t(),1),p=n();function m(){let e=d(),[t,n]=(0,f.useState)(!1),[i,o]=(0,f.useState)(null);return t?(0,p.jsxs)(`p`,{className:`sub`,children:[`Server stopped. You can close this tab and reopen any time with `,(0,p.jsx)(`code`,{children:`geneseed web`}),`.`]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(a,{error:i}),(0,p.jsxs)(`button`,{className:`btn ghost danger-line`,onClick:async()=>{if(await e(`Stop the local Geneseed server? The console goes offline until you start it again.`,{title:`Stop the server?`,confirmLabel:`Stop server`,tone:`danger`})){o(null);try{await r.shutdown()}catch(e){if(e.status)return o(e.message)}n(!0)}},children:[(0,p.jsx)(u,{name:`x`}),`Stop server`]})]})}function h(){let e=d(),[t,n]=(0,f.useState)(!1),[r,i]=(0,f.useState)(null);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(a,{error:r}),(0,p.jsxs)(`button`,{className:`btn ghost`,onClick:async()=>{if(await e(`Restart the local Geneseed server? The console reconnects in a moment.`,{title:`Restart the server?`,confirmLabel:`Restart`})){n(!0),i(null);try{await o()}catch(e){i(e.message),n(!1)}}},disabled:t,children:[(0,p.jsx)(u,{name:`refresh`}),t?`Restarting…`:`Restart server`]})]})}var g=`https://github.com/Arylmera/Geneseed`,_=`https://github.com/Arylmera`,v=[[`machine`,`Machine`],[`server`,`Server`],[`about`,`About`],[`danger`,`Danger zone`]],y=[`Host check`,`token on writes`,`framing refused`,`cross-site GET refused`];function b({k:e,help:t,children:n,control:r}){return(0,p.jsxs)(`div`,{className:`sheet-row`,children:[(0,p.jsxs)(`span`,{className:`sheet-k`,children:[e,t?(0,p.jsx)(`span`,{className:`sheet-h sub`,children:t}):null]}),(0,p.jsx)(`div`,{className:`sheet-v`,children:n}),(0,p.jsx)(`div`,{className:`sheet-c`,children:r})]})}function x({id:e,title:t,head:n,className:r=``,children:i}){return(0,p.jsxs)(`section`,{id:`set-${e}`,className:`card pad-md sheet-sec ${r}`,"aria-labelledby":`${e}-h`,children:[(0,p.jsxs)(`div`,{className:`card-head`,children:[(0,p.jsx)(`h3`,{id:`${e}-h`,children:t}),n]}),i]})}function S({stale:e}){let t=e=>document.getElementById(`set-${e}`)?.scrollIntoView?.({behavior:i()?`smooth`:`auto`,block:`start`});return(0,p.jsx)(`nav`,{className:`sheet-index`,"aria-label":`On this page`,children:v.map(([n,r])=>(0,p.jsxs)(`button`,{type:`button`,className:n===`danger`?`t-bad`:``,onClick:()=>t(n),children:[r,n===`server`&&(0,p.jsx)(`span`,{className:`sheet-dot ${e?`warn`:`good`}`,"aria-hidden":`true`})]},n))})}function C({version:e}){let[t,n]=(0,f.useState)(g),[i,a]=(0,f.useState)(!0);(0,f.useEffect)(()=>{Promise.resolve(r.docsPage?.(`about`)).then(e=>{e?.repo&&(n(e.repo),a(!!e.repo_is_github))}).catch(()=>{})},[]);let o=(e,t)=>(0,p.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,children:[t,` `,(0,p.jsx)(u,{name:`external`})]});return(0,p.jsxs)(x,{id:`about`,title:`About`,children:[(0,p.jsx)(b,{k:`Version`,control:i?o(t+`/blob/main/CHANGELOG.md`,`Changelog`):null,children:(0,p.jsx)(`span`,{className:`mono`,children:e||`unknown`})}),i?(0,p.jsx)(b,{k:`Credits`,control:o(t+`#-credits`,`Credits`),children:(0,p.jsx)(`span`,{className:`sub`,children:`Skills and agents adapted from other projects, with their licences`})}):null,(0,p.jsx)(b,{k:`Geneseed`,help:`MIT-licensed`,control:(0,p.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,p.jsxs)(`a`,{className:`btn ghost`,href:t,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(u,{name:`github`}),i?`Source on GitHub`:`Source repo`]}),i&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`a`,{className:`btn ghost`,href:t+`/issues`,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(u,{name:`external`}),`Issues`]}),(0,p.jsxs)(`a`,{className:`btn ghost`,href:t+`/blob/main/LICENSE`,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(u,{name:`external`}),`MIT License`]})]})]}),children:(0,p.jsx)(`span`,{className:`sub`,children:`A portable, theme-able harness you implant once and use everywhere to grow a disciplined AI coding agent. One canonical source, many voices.`})}),(0,p.jsx)(b,{k:`Creator`,control:(0,p.jsxs)(`a`,{className:`btn ghost`,href:_,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(u,{name:`github`}),`@Arylmera on GitHub`]}),children:(0,p.jsxs)(`span`,{className:`sub`,children:[`Built by `,(0,p.jsx)(`strong`,{children:`Guillaume Lemer`}),`. It started as a personal, Obsidian-vault-grown agent operating system and was distilled into the repo you are running. If you find it useful, a star on the repo or an issue with feedback is the best way to help shape what comes next.`]})})]})}var w={absent:`Off`,ours:`On · written by Geneseed`,stale:`On · points at another copy or Node`,hand:`On · set up by hand`};function T({initial:e}){let t=d(),[n,i]=(0,f.useState)(void 0),[o,s]=(0,f.useState)(null),[c,l]=(0,f.useState)(!1),u=n===void 0?e:n,m=async e=>{let n=e===`install`;if(await t(n?`Write ${u.file}? It starts the web console from ${u.root} at each login (hidden, no browser).`+(u.file.endsWith(`.plist`)?` It loads at your next login.`:``)+(u.transient?` Warning: that copy is an agent worktree or an npx cache, which can be deleted; the login item then fails.`:``):`Delete ${u.file}? The console no longer starts at login.`,n?{title:`Start at login?`,confirmLabel:u.state===`stale`?`Update`:`Write file`}:{title:`Stop starting at login?`,confirmLabel:`Delete file`,tone:`danger`})){l(!0),s(null);try{i((await r.autostart(e)).autostart)}catch(e){s(e.message),e.body?.autostart&&i(e.body.autostart)}finally{l(!1)}}},h=u?.state,g=h===`absent`||h===`stale`?(0,p.jsx)(`button`,{className:`btn ghost`,disabled:c,onClick:()=>m(`install`),children:h===`stale`?`Update`:`Turn on`}):h===`ours`?(0,p.jsx)(`button`,{className:`btn ghost`,disabled:c,onClick:()=>m(`remove`),children:`Remove`}):h===`hand`?(0,p.jsx)(`a`,{href:`#/docs/autostart`,children:`Install guide →`}):null;return(0,p.jsx)(b,{k:`Start at login`,help:u?u.file:u===null?`No login launcher on this system`:`A login launcher`,control:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(a,{error:o}),g]}),children:(0,p.jsx)(`span`,{className:`sub`,children:u===null?`not available`:w[h]??`unknown`})})}function E({overview:e,onAction:t}){let n=d(),i=e?.server,a=e?.daemon_stale,[o,g]=(0,f.useState)(null);(0,f.useEffect)(()=>{Promise.resolve(r.update?.()).then(e=>g(e||null)).catch(()=>{})},[]);let _=o?o.install??(o.git?`git`:`npm-global`):null,v=_===`git`?`Update (git pull + rebuild)`:_===`npm-global`?`Update (npm install -g + rebuild)`:`Update`;return(0,p.jsxs)(`div`,{children:[(0,p.jsx)(s,{title:`Settings`,sub:`This copy of Geneseed and the local server.`}),(0,p.jsxs)(`div`,{className:`sheet`,children:[(0,p.jsx)(S,{stale:a}),(0,p.jsxs)(`div`,{className:`sheet-body`,children:[(0,p.jsxs)(x,{id:`machine`,title:`Machine`,children:[(0,p.jsx)(b,{k:`Geneseed`,help:`This copy of the source`,control:_===`other`?o.command?(0,p.jsxs)(`span`,{className:`dim`,children:[`update with `,(0,p.jsx)(`code`,{className:`mono`,children:o.command})]}):null:o?.behind===!1?(0,p.jsx)(`span`,{className:`dim`,children:`This checkout cannot pull: it has local changes, a detached HEAD, no upstream or a diverged branch.`}):(0,p.jsxs)(`button`,{className:`btn`,onClick:async()=>{let e=`the installs it finds`;try{let{installs:t=[]}=await r.installs();e=t.filter(e=>e.state===`active`).map(e=>`${l(e)} · ${e.scope}`).join(`, `)||`none`}catch{}await n(`Update Geneseed, then rebuild every active install: ${e}? Each is rebuilt in place with its own settings; files you edited are kept.`,{title:`Update and rebuild?`,confirmLabel:`Update`})&&t(`update`)},children:[(0,p.jsx)(u,{name:`download`}),v]}),children:(0,p.jsx)(`span`,{className:`mono`,children:e?.version||`unknown`})}),(0,p.jsx)(b,{k:`Command on PATH`,help:`Run geneseed from any folder`,control:(0,p.jsxs)(`button`,{className:`btn ghost`,onClick:()=>t(`link`),children:[(0,p.jsx)(u,{name:`external`}),`Add to PATH`]})})]}),(0,p.jsxs)(x,{id:`server`,title:`Server`,className:`sheet-live`,head:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`span`,{className:`pill good`,children:`running`}),(0,p.jsxs)(`span`,{className:`mono dim`,children:[`127.0.0.1:`,window.location.port||`80`,i?` · pid ${i.pid} · up ${c(i.started)}`:``]})]}),children:[(0,p.jsx)(b,{k:`Code`,help:`The page you see matches the build on disk`,control:(0,p.jsx)(h,{}),children:a?(0,p.jsx)(`span`,{className:`pill warn`,children:`disk has newer code → Restart`}):(0,p.jsx)(`span`,{className:`pill good`,children:`matches disk`})}),(0,p.jsx)(T,{initial:i?.autostart}),(0,p.jsx)(b,{k:`Guards`,help:`What stops another page from driving the console`,children:(0,p.jsx)(`span`,{className:`row wrap gap-8`,children:y.map(e=>(0,p.jsx)(`span`,{className:`pill good`,children:e},e))})})]}),(0,p.jsx)(C,{version:e?.version}),(0,p.jsxs)(x,{id:`danger`,title:`Danger zone`,className:`danger-zone`,children:[(0,p.jsx)(b,{k:`Stop the server`,help:`The console goes offline until you run geneseed web`,control:(0,p.jsx)(m,{})}),(0,p.jsx)(b,{k:`The geneseed command`,help:`Installs keep working; only the command goes`,control:(0,p.jsx)(`button`,{className:`btn ghost danger-line`,onClick:()=>t(`unlink`),children:`Remove from PATH`})}),(0,p.jsx)(b,{k:`Uninstall`,children:(0,p.jsxs)(`span`,{className:`sub`,children:[`Each install has its own Uninstall in `,(0,p.jsx)(`a`,{href:`#/installs/hosts`,children:`Hosts`}),`, bound to its host and path.`]})})]})]})]})]})}export{E as default};
@@ -1,6 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-DBOEi9lQ.js","assets/rolldown-runtime-XKyaHtl9.js","assets/react-C1iE8mnY.js","assets/api-DLDVY3K-.js","assets/motion-RlUl1osO.js","assets/sections-CtFz7HFH.js","assets/Activity-CqJiquEq.js","assets/EmptyState-CY5Pm2xy.js","assets/Bonsai-Bfpb6W-1.js","assets/usePoll-D5c_qIFZ.js","assets/ActivityDetail-BSzevynX.js","assets/Library-B4K-1iNF.js","assets/LibRows-DEHjIoD-.js","assets/FilterInput-qGKNSlxv.js","assets/Kits-DRwpxC-J.js","assets/Markdown-0ORz7tAc.js","assets/DataTable-b9zTShqJ.js","assets/controls-D4wmg_pl.js","assets/Loops-BWSzaW8E.js","assets/CopyButton-ByIntFtB.js","assets/ActiveLoops-BJJN3P-V.js","assets/Factories-Bpvv7L2H.js","assets/Laws-CZkiNOWQ.js","assets/Personal-Bp9nV4GR.js","assets/Tabs-CWeQTADL.js","assets/Installs-BlGmVrFK.js","assets/Settings-CWWuaIp-.js","assets/Docs-DvlMJhpu.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,n,r,t as i}from"./react-C1iE8mnY.js";import{t as a}from"./api-DLDVY3K-.js";import{A as o,D as s,G as c,I as l,L as u,M as d,N as f,O as p,R as m,S as h,T as g,V as _,W as v,a as y,b,c as x,d as S,f as C,i as w,k as ee,l as T,m as te,n as E,o as D,p as O,q as k,r as A,t as j,y as M,z as N}from"./motion-RlUl1osO.js";import{i as P,n as F,r as I,t as ne}from"./sections-CtFz7HFH.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var L=(e,t)=>{if(N(t,`<`)){let n=t[1]===`<`,r=e._tail,i=r?r._offset+r._delay:0;return n?i:i+r.duration}},R=(e,t)=>{let n=e.iterationDuration;if(n===1e-11&&(n=0),f(t))return n;if(o(+t))return+t;let r=t,i=e?e.labels:null,a=!ee(i),s=L(e,r),l=!f(s),u=c.exec(r);if(u){let e=u[0],t=r.split(e),o=a&&t[0]?i[t[0]]:n,c=l?s:a?o:n,d=+t[1];return b(c,d,e[0])}return l?s:a?f(i[r])?n:i[r]:n},re=(e=0,t=1,n=0)=>{let r=10**n;return Math.floor((Math.random()*(t-e+1/r)+e)*r)/r},ie=0,ae=(e,t=0,n=1,r=0)=>{let i=e===void 0?ie++:e;return(e=t,a=n,o=r)=>{i+=1831565813,i=Math.imul(i^i>>>15,i|1),i^=i+Math.imul(i^i>>>7,i|61);let s=10**o;return Math.floor((((i^i>>>14)>>>0)/4294967296*(a-e+1/s)+e)*s)/s}},oe=(e,t=re)=>{let n=e.length,r,i;for(;n;)i=t(0,--n),r=e[n],e[n]=e[i],e[i]=r;return e},z=(e,t={})=>{let n=[],r=0,i,a=null,c=t.from,_=t.reversed,v=t.ease,y=!f(v),b=y&&!f(v.ease)?v.ease:y?C(v):null,x=t.grid,S=x===!0,w=t.axis,ee=t.total,T=f(c)||c===0||c===`first`,E=c===`center`,D=c===`last`,O=c===`random`,A=s(c),j=s(e),N=t.use,P=l(j?e[0]:e),F=j?l(e[1]):0,I=k.exec((j?e[1]:e)+``),ne=t.start||0+(j?P:0),L=t.seed,ie=!f(L)&&L!==!1?ae(L===!0?0:L):re,z=t.jitter,se=!f(z),ce=s(z),le=ce?z[0]:z||0,ue=ce?z[1]:z||0,B=T?0:o(c)?c:0;return(e,s,l,v,y)=>{let[C]=te(e),T=f(ee)?l.length:ee,k=f(N)?!1:p(N)?N(C,s,T):M(C,N),L=o(k)||d(k)&&o(+k)?+k:s,re=L>=0&&L<T?L:s;if(E&&(B=(T-1)/2),D&&(B=T-1),!n.length){if(S){let e=!0,t=!1,r=1/0,i=1/0,a=1/0,s=-1/0,u=-1/0,d=-1/0,f=[],g=[],_=[];for(let n=0;n<T;n++){let c=l[n],m=0,h=0,v=0,y=!1;if(c&&p(c.getBoundingClientRect)){let e=c.getBoundingClientRect();m=e.left+e.width/2,h=e.top+e.height/2,y=!0}else{let e=c;e&&o(e.x)&&o(e.y)&&(m=e.x,h=e.y,o(e.z)&&(v=e.z,t=!0),y=!0)}if(!y){e=!1;break}f.push(m),g.push(h),_.push(v),m<r&&(r=m),h<i&&(i=h),v<a&&(a=v),m>s&&(s=m),h>u&&(u=h),v>d&&(d=v)}if(e){let e=f[0],l=g[0],p=_[0];A?(e=r+c[0]*(s-r),l=i+c[1]*(u-i),p=t?a+(c.length>=3?c[2]:.5)*(d-a):0):E?(e=(r+s)/2,l=(i+u)/2,p=(a+d)/2):D?(e=f[T-1],l=g[T-1],p=_[T-1]):o(c)&&(e=f[c],l=g[c],p=_[c]);for(let r=0;r<T;r++){let i=e-f[r],a=l-g[r],o=p-_[r],s=m(i*i+a*a+(t?o*o:0));w===`x`&&(s=-i),w===`y`&&(s=-a),w===`z`&&(s=-o),n.push(s)}let v=1/0;for(let e=0;e<T;e++){let t=h(n[e]);t>0&&t<v&&(v=t)}if(v>0&&v<1/0)for(let e=0;e<T;e++)n[e]=n[e]/v}else for(let e=0;e<T;e++)n.push(h(B-e))}else for(let e=0;e<T;e++)if(!x)n.push(h(B-e));else{let t=x.length,r=x[0]*x[1],i,a,o;A?(i=c[0]*(x[0]-1),a=c[1]*(x[1]-1),o=t===3?(c.length>=3?c[2]:.5)*(x[2]-1):0):E?(i=(x[0]-1)/2,a=(x[1]-1)/2,o=t===3?(x[2]-1)/2:0):(i=B%x[0],a=g(B/x[0])%x[1],o=t===3?g(B/r):0);let s=e%x[0],l=g(e/x[0])%x[1],u=t===3?g(e/r):0,d=i-s,f=a-l,p=o-u,h=m(d*d+f*f+(t===3?p*p:0));w===`x`&&(h=-d),w===`y`&&(h=-f),w===`z`&&(h=-p),n.push(h)}r=n[0];for(let e=1;e<T;e++)n[e]>r&&(r=n[e]);if(b||_)for(let e=0;e<T;e++){let t=n[e];b&&(t=b(t/r)*r),_&&(t=w?-t:h(r-t)),n[e]=t}if(se){a=Array(T);for(let e=0;e<T;e++)a[e]=ie(-1,1,4)}O&&(n=oe(n,ie))}let ae=j?(F-P)/r:P;f(i)&&(i=y?R(y,f(t.start)?y.iterationDuration:ne):ne);let z=i+(ae*u(n[re],2)||0);if(se){let e=r?n[re]/r:0,t=le+(ue-le)*e;z+=a[re]*t}return t.modifier&&(z=t.modifier(z)),I&&(z=`${z}${I[2]}`),z}},se=e=>{let t=1;if(e&&e.getCTM){let n=e.getCTM();n&&(t=(m(n.a*n.a+n.b*n.b)+m(n.c*n.c+n.d*n.d))/2)}return t},ce=(e,t,n)=>{let r=_,i=getComputedStyle(e),a=i.strokeLinecap,o=i.vectorEffect===`non-scaling-stroke`?e:null,s=a,c=new Proxy(e,{get(e,t){let n=e[t];return t===v?e:t===`setAttribute`?(...t)=>{if(t[0]===`draw`){let n=t[1].split(` `),i=+n[0],c=+n[1],l=se(o),u=i*-r*l,d=c*r*l+u,f=r*l+(i===0&&c===1||i===1&&c===0?0:10*l)-d;if(a!==`butt`){let t=i===c?`butt`:a;s!==t&&(e.style.strokeLinecap=`${t}`,s=t)}e.setAttribute(`stroke-dashoffset`,`${u}`),e.setAttribute(`stroke-dasharray`,`${d} ${f}`)}return Reflect.apply(n,e,t)}:p(n)?(...t)=>Reflect.apply(n,e,t):n}});return e.getAttribute(`pathLength`)!==`${r}`&&(e.setAttribute(`pathLength`,`${r}`),c.setAttribute(`draw`,`${t} ${n}`)),c},le=(e,t=0,n=0)=>O(e).map(e=>ce(e,t,n)),ue=r(),B=n(),V=e(t(),1),de={overview:`Overview`,laws:`Constitution`,library:`Library`,kits:`Kits`,loops:`Loops`,factories:`Factories`,personal:`Personal`,installs:`Installs`,docs:`Docs`,activity:`Activity`,settings:`Settings`},fe={loops:[`templates`,`bricks`,`active`],factories:[`templates`,`active`],personal:[`rules`,`profile`,`memory`,`notebook`],installs:[`hosts`,`edits`,`doctor`]},pe={templates:`Templates`,bricks:`Bricks`,active:`Active`,rules:`Rules`,profile:`Profile`,memory:`Memory`,notebook:`Notebook`,hosts:`Hosts`,edits:`Local edits`,doctor:`Doctor`},me={dashboard:[`overview`],constitution:[`laws`],rules:[`personal`,`rules`],profile:[`personal`,`profile`],harness:[`installs`,`hosts`],harnesses:[`installs`,`hosts`],themes:[`installs`,`hosts`],diff:[`installs`,`edits`],doctor:[`installs`,`doctor`],about:[`settings`]},he={kits:`kits`,server:`settings`},ge=(e,t)=>t!==void 0&&Object.hasOwn(e,t),_e=(e,t)=>fe[e].includes(t)?t:fe[e][0];function ve(e){let t=(e||`#/`).slice(2).split(`/`).filter(Boolean),[n,r,i]=t,a=e=>{try{return decodeURIComponent(e||``)}catch{return e||``}};if(n===`section`||n===`item`){let e=n===`item`&&ge(P,r)?P[r]:r,t=n===`item`?a(i):void 0;return e===`memory`||e===`notebook`?t?{page:`personal`,tab:e,item:t}:{page:`personal`,tab:e}:{page:e===`laws`?`laws`:`library`,section:e,item:t}}if(n===`docs`)return{page:`docs`,item:a(t.slice(1).join(`/`))};if(n===`kits`)return r?{page:`kits`,item:a(r)}:{page:`kits`};if(n===`activity`&&r)return{page:`activity`,item:a(r)};if(n===`skills`||n===`agents`)return{page:`library`,section:n};if(n===`installs`&&ge(he,r))return{page:he[r]};if(ge(fe,n)){let e=_e(n,r);return i&&e===r?{page:n,tab:e,item:a(i)}:{page:n,tab:e}}if(ge(me,n)){let[e,t]=me[n];return t?{page:e,tab:t}:{page:e}}return{page:ge(de,n)?n:`overview`}}var ye=new Set;function be(e){return ye.add(e),()=>ye.delete(e)}function xe(){let e=()=>ve(typeof window<`u`?window.location.hash:``),[t,n]=(0,V.useState)(e);(0,V.useEffect)(()=>{let t=window.location.hash,r=()=>{let r=window.location.hash;if(r!==t){for(let e of ye)if(e({from:t,to:r})===!1){window.history.replaceState(window.history.state,``,t||`#/`);return}t=r,n(e())}};return window.addEventListener(`hashchange`,r),()=>window.removeEventListener(`hashchange`,r)},[]);let r=(0,V.useRef)(!1);return(0,V.useEffect)(()=>{if(document.title=`${de[t.page]} · Geneseed`,!r.current){r.current=!0;return}let e=document.getElementById(`main`);e?.focus();for(let t of[e,document.scrollingElement||document.documentElement])t&&(t.scrollTop=0)},[t.page]),t}var Se=e=>{window.location.hash=e},Ce={red:`#FF5C57`,green:`#4ED888`,yellow:`#E8B53D`,blue:`#5B8CFF`,magenta:`#C77DFF`,cyan:`#3AD4C4`,white:`#E9EFEA`},we={red:`#C53A36`,green:`#2FA864`,yellow:`#B8862A`,blue:`#3C66D8`,magenta:`#9A52D6`,cyan:`#2BA89B`,white:`#AEB8B0`},Te=e=>Ce[e]||Ce.cyan,Ee={red:`#A92F2B`,green:`#1E7A47`,yellow:`#8A6414`,blue:`#2F55C0`,magenta:`#7E3FB8`,cyan:`#15766C`,white:`#465A51`};function De(e,t,n){if(!e)return;let r=n===`light`,i=r?we[t]||we.cyan:Te(t);r&&t===`white`&&(i=`#566B62`);let a=r?Ee[t]||Ee.cyan:i;Ge(e,Ve(i,we[t]||we.cyan,Me,a,r),r)}var Oe={cultivar:{dark:`#3AD4C4`,light:`#127E73`,ink:`#06100D`},operator:{dark:`#E8A23B`,light:`#8F5E10`,ink:`#1A1306`},matrix:{dark:`#19E37C`,light:`#0B7A47`,ink:`#04140C`},atlas:{dark:`#8FD694`,light:`#1C8450`,ink:`#14200F`}};function ke(e,t,n){let r=Oe[t];if(!e||!r)return!1;let i=n===`light`,a=i?r.light:r.dark;return Ge(e,Ve(a,r.light,r.ink,a,i),i),!0}var Ae={dark:{worst:`#232A31`,soft:[`#14181D`,`#1B2026`,`#11151A`,`#171C22`,`#0B1116`,`#121A21`,`#1C1A12`,`#211E15`]},light:{worst:`#EBE6D8`,soft:[`#FBFDFC`,`#F3F6F6`,`#F4F6F8`,`#E9F4ED`,`#FCFAF4`,`#F6F2E7`]}},je=.13,Me=`#06100D`,Ne=e=>{let t=e.replace(`#`,``);return[0,2,4].map(e=>parseInt(t.slice(e,e+2),16))},Pe=e=>`#`+e.map(e=>Math.round(e).toString(16).padStart(2,`0`)).join(``).toUpperCase(),Fe=e=>{let[t,n,r]=Ne(e).map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r},Ie=(e,t)=>{let[n,r]=[Fe(e),Fe(t)].sort((e,t)=>t-e);return(n+.05)/(r+.05)},Le=(e,t,n)=>{let r=Ne(e),i=Ne(t);return Pe(r.map((e,t)=>e+(i[t]-e)*n))},Re=(e,t,n,r)=>{let i=e=>Math.min(...[].concat(t).map(t=>Ie(e,t))),a=e;for(let t=.05;i(a)<n&&t<=1.0001;t+=.05)a=Le(e,r,t);return a},ze=e=>{let[t,n,r]=Ne(e).map(e=>e/255),i=Math.max(t,n,r),a=Math.min(t,n,r),o=i-a;if(o===0)return{h:0,s:0};let s=o/(1-Math.abs(i+a-1));return{h:((i===t?(n-r)/o%6:i===n?(r-t)/o+2:(t-n)/o+4)*60+360)%360,s}},Be=(e,t)=>{let n=Math.abs(e-t)%360;return n>180?360-n:n};function Ve(e,t,n,r,i){let a=i?`#000000`:`#FFFFFF`,o=e=>Ie(e,n)>=Ie(e,`#FFFFFF`)?n:`#FFFFFF`,s=Ie(e,o(e))>=4.5?e:Re(e,i?`#FFFFFF`:n,4.5,a),c=i?Ae.light:Ae.dark,l=[c.worst,...c.soft.map(e=>Le(e,s,je))];return{accent:s,accent2:t,ink:o(s),text:Re(r,l,4.5,a)}}var He=39,Ue={dark:[`#FF8A4C`,`#FF8A4C`],light:[`#B4441F`,`#9B3A1B`]};function We(e,t,n){let[r,i]=n?Ue.light:Ue.dark,{h:a,s:o}=ze(t),s=Be(a,He);o>=.15&&s<=29&&Be(a,ze(r).h)>s?(e.style.setProperty(`--warn`,r),e.style.setProperty(`--warn-text`,i)):(e.style.removeProperty(`--warn`),e.style.removeProperty(`--warn-text`))}function Ge(e,t,n){e.style.setProperty(`--accent`,t.accent),e.style.setProperty(`--accent-2`,t.accent2),e.style.setProperty(`--accent-ink`,t.ink),e.style.setProperty(`--accent-text`,t.text),We(e,t.accent,n)}var Ke=e=>typeof e==`string`&&/^#[0-9a-fA-F]{6}$/.test(e);function qe(e,t){let n=t===`light`,r=n?Ae.light:Ae.dark,i=n?`#000000`:`#FFFFFF`,a=Re(e,r.worst,3,i);return Ve(a,Re(a,r.worst,4.5,i),Me,a,n)}function Je(e,t,n){return!e||!Ke(t)?!1:(Ge(e,qe(t,n),n===`light`),!0)}function H(e,t){let[n,r]=(0,V.useState)(()=>{try{return t(localStorage.getItem(e))}catch{return t(null)}});return[n,(0,V.useCallback)(t=>r(n=>{let r=typeof t==`function`?t(n):t;try{localStorage.setItem(e,r)}catch{}return r}),[e])]}var Ye=`geneseed-mode`;function Xe(){let[e,t]=H(Ye,e=>e===`light`?`light`:`dark`);return[e,()=>t(e=>e===`light`?`dark`:`light`)]}var Ze=`geneseed-flavour`,Qe=[{id:`cultivar`,short:`Cultivar`,name:`Cultivar Evolved`,tagline:`The calm default — cool teal ink, geometric sans, soft flat cards lit by one quiet shadow.`},{id:`operator`,short:`Operator`,name:`Operator HUD`,tagline:`Amber phosphor on cool charcoal — all-mono, zero-radius instrument readout.`},{id:`matrix`,short:`Matrix`,name:`Matrix`,tagline:`Acid-green order-book terminal on pure black — all Space Mono, square 2px, a faint code-grid.`},{id:`atlas`,short:`Atlas`,name:`Atlas`,tagline:`The field journal — loam dark, sage ink, the codex as a living map.`}],$e=new Set(Qe.map(e=>e.id)),et={a:`cultivar`,b:`atlas`,c:`operator`,d:`cultivar`,e:`matrix`,f:`cultivar`,g:`cultivar`,z:`cultivar`,cb:`matrix`,cm:`cultivar`,greenhouse:`atlas`,heirloom:`cultivar`,aurora:`cultivar`,perspective:`cultivar`,sequencer:`cultivar`,cobalt:`matrix`,cosmic:`cultivar`,neon:`matrix`};function tt(){return H(Ze,nt)}function nt(e){return $e.has(e)?e:et[e]||`cultivar`}var rt=()=>window.location.reload(),it=1e3,at=e=>new Promise(t=>setTimeout(t,e));async function ot(){try{return(await a.ping()).pid??null}catch{return null}}async function st(e=0,t=null){await at(e);for(let e=0;e<30;e++){let e=await ot();if(e!==null&&e!==t)break;await at(it)}rt()}async function ct(){let e=await ot();try{await a.restart()}catch(e){if(e.status)throw e}await st(it,e)}var lt=`geneseed-accent`,ut=[{id:`curated`,short:`Curated`,tagline:`Each skin's own signature colour.`}],dt=[[`cyan`,`Cyan`],[`blue`,`Blue`],[`magenta`,`Violet`],[`yellow`,`Amber`],[`green`,`Green`]].map(([e,t])=>({id:`custom:${e}`,name:e,short:t,hex:Te(e),tagline:`${t}, whatever the voice, until the skin changes.`})),ft=[...ut,...dt],pt=new Set(ft.map(e=>e.id)),mt=e=>{let t=typeof e==`string`&&e.startsWith(`hex:`)?e.slice(4):null;return Ke(t)?t.toUpperCase():null},ht=e=>e&&(pt.has(e)||mt(e))?e:`curated`,gt=e=>dt.find(t=>t.id===e)?.name??null,_t=e=>{let t=mt(e);return t?`Your own colour, ${t}.`:ft.find(t=>t.id===e)?.tagline??``};function vt(){return H(lt,ht)}var yt=`geneseed-layout`,bt=[{id:`overview`,short:`Overview`,tagline:`Every install, what needs you, cost, usage and gates.`},{id:`genome`,short:`Genome`,tagline:`Hero, KPIs & genome grid.`},{id:`greenhouse`,short:`Greenhouse`,tagline:`Ring, tiles & mix donut.`},{id:`hud`,short:`HUD`,tagline:`Dense instrument panel & check matrix.`},{id:`journal`,short:`Journal`,tagline:`Growth rings & the constitution map.`}],xt=new Set(bt.map(e=>e.id)),St={cultivar:`genome`,operator:`hud`};function Ct(e){return Object.hasOwn(St,e??``)?St[e]:e&&xt.has(e)?e:`overview`}function wt(){return H(yt,Ct)}var Tt=1500;function Et(e,t){let[n,r]=(0,V.useState)(null),[i,o]=(0,V.useState)(null),[s,c]=(0,V.useState)([]),[l,u]=(0,V.useState)(0),d=()=>a.overview().then(e=>{r(e),o(null)}),f=()=>d().catch(t=>{o(t?.body?.message||t?.message||String(t)),e?.(t)}),p=(0,V.useRef)(!1);return(0,V.useEffect)(()=>{if(n?.doctor===null){p.current=!0;let e=setTimeout(()=>d().catch(()=>u(e=>e+1)),Tt);return()=>clearTimeout(e)}p.current&&(p.current=!1,t?.())},[n,l]),(0,V.useEffect)(()=>{f()},[]),(0,V.useEffect)(()=>{a.themes().then(e=>c(e.themes)).catch(()=>{})},[]),{overview:n,error:i,themes:s,reload:f}}var Dt=600;function Ot({onFinish:e,onError:t}={}){let[n,r]=(0,V.useState)([]),[i,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{a.jobs().then(({jobs:e})=>{if(!e.length)return;r(e.map(e=>({id:e.id,action:e.action,status:e.status,output:e.output||``,duration:e.duration,started:e.started})));let t=e.find(e=>e.status===`running`);t&&(o(t.id),c(!0))}).catch(()=>{})},[]),(0,V.useEffect)(()=>{if(!i)return;let t=n.find(e=>e.id===i),s=t?.action===`update`||!!t?.restarts,c=null;s&&ot().then(e=>c=e);let l=setInterval(async()=>{if(!document.hidden)try{let t=await a.job(i);if(r(e=>{let n=e.findIndex(e=>e.id===i);if(n===-1)return e;let r=e[n],a=t.output||``;if(r.output===a&&r.status===t.status&&r.duration===t.duration)return e;let o=e.slice();return o[n]={...r,output:a,status:t.status,duration:t.duration},o}),t.status!==`running`){if(clearInterval(l),o(null),s&&t.status===`done`){st(2e3,c);return}e?.(t.status)}}catch{if(!s)return;clearInterval(l),st(0,c)}},Dt);return()=>clearInterval(l)},[i]),{runs:n,activeId:i,consoleOpen:s,setConsoleOpen:c,runAction:async(e,n,i)=>{try{let{job_id:t,restarts:s}=await a.action(e,n,i),l=n?.emit||i?.host,u=e===`build`&&n?.theme?`build (${n.theme}${l?` · ${l}`:``})`:e;return r(e=>[...e,{id:t,action:u,status:`running`,output:``,started:Date.now()/1e3,restarts:!!s}]),o(t),c(!0),t}catch(e){t?.(e)}},cancelJob:e=>a.cancelJob(e).catch(e=>t?.(e)),clearRuns:()=>r([])}}var U=new Map,kt=new Map,At=new Map;function jt(e){for(let t of[U,At])for(let n of t.keys())n.startsWith(`${e}|`)&&t.delete(n)}function W(e,t=[],n=null,{revalidate:r=!1}={}){let i=n===null?null:`${n}|${t.join(``)}`,[a,o]=(0,V.useState)(()=>i!==null&&U.has(i)?U.get(i):null),[s,c]=(0,V.useState)(``),[l,u]=(0,V.useState)(()=>!(i!==null&&U.has(i))),d=(0,V.useRef)(e),f=(0,V.useRef)(i);(0,V.useLayoutEffect)(()=>{d.current=e,f.current=i});let p=(0,V.useRef)(0),m=(0,V.useCallback)(e=>{let t=++p.current,n=()=>t===p.current;u(!0),c(``);let r=f.current,i=e?At.get(r):void 0;if(!i&&(i=Promise.resolve(d.current()),r!==null)){let e=i,t=()=>{At.get(r)===e&&At.delete(r)};At.set(r,e),e.then(t,t)}return i.then(e=>{if(n()&&(o(e),r!==null)){U.set(r,e);for(let t of kt.get(r)||[])t(e)}}).catch(e=>{n()&&c(e.message)}).finally(()=>{n()&&u(!1)})},t),h=(0,V.useCallback)(()=>m(!1),[m]);return(0,V.useEffect)(()=>{let e=f.current;return e!==null&&(kt.has(e)||kt.set(e,new Set),kt.get(e).add(o)),e!==null&&U.has(e)&&(p.current++,o(U.get(e)),c(``),u(!1),!r)||m(!0),()=>kt.get(e)?.delete(o)},[m]),{data:a,error:s,loading:l,reload:h,setData:o}}var Mt=60,Nt=3600,Pt=86400,Ft={seconds:90,minutes:5400,hours:36*Nt};function It(e){let t=Math.max(0,Date.now()/1e3-e);return t<Ft.seconds?`${Math.round(t)}s`:t<Ft.minutes?`${Math.round(t/Mt)}m`:t<Ft.hours?`${Math.round(t/Nt)}h`:`${Math.round(t/Pt)}d`}var G={deployed:.4,doctorClean:.25,doctorMinor:.15,doctorMinorMax:2,doctorFail:.05,versionSynced:.2,diskClean:.15},Lt={warn:G.deployed+G.doctorClean,bad:G.deployed};function Rt(e,t,n){if(!e)return 0;let r=e.doctor?.problems?.length??(e.doctor===null?0:99),i=e.doctor?.ok?G.doctorClean:r<=G.doctorMinorMax?G.doctorMinor:G.doctorFail,a=t&&t.installed_fp&&t.installed_fp===t.source_fp,o=(e.deployed?G.deployed:0)+i+(a?G.versionSynced:0)+(e.diff&&e.diff.missing===0?G.diskClean:0);return Math.min(o,Lt[n]??1)}var zt=e=>Math.max(...I.map(t=>e?.[t]??0),1),Bt=e=>(e?.edited??0)+(e?.added??0),Vt=e=>Bt(e)+(e?.missing??0),Ht=e=>(e?.laws??0)+(e?.doctrines?.rules??0),Ut=e=>ne.reduce((t,n)=>t+(e?.[n]??0),0),K=i(),Wt={dashboard:`M3 13h7V3H3v10Zm0 8h7v-6H3v6Zm11 0h7V11h-7v10Zm0-18v6h7V3h-7Z`,library:`M4 5h10v14H4zM16 7h4v12h-4M7 9h4M7 12h4`,loop:`M19.5 9A8 8 0 1 1 15 4.6M15 1.5l.2 3.3-3.2.8`,graph:`M6 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM18 8a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM18 20a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM7.5 14.5l8-8M16.7 15.2L8.8 16.6`,changes:`M4 6h10M4 12h7M4 18h12M17 4l3 3-3 3M20 7h-6`,doctor:`M12 3v6m0 0a4 4 0 0 1-4 4H7a3 3 0 0 0-3 3v2m8-9a4 4 0 0 0 4 4h1a3 3 0 0 1 3 3v2M12 3a1.5 1.5 0 1 0 0-.01`,themes:`M12 3a9 9 0 1 0 0 18c1.1 0 2-.9 2-2 0-.5-.2-1-.5-1.3-.3-.4-.5-.8-.5-1.2 0-1 .8-1.5 1.7-1.5H17a4 4 0 0 0 4-4c0-4.4-4-8-9-8Z`,settings:`M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm8-3a8 8 0 0 0-.1-1.3l2-1.6-2-3.4-2.4 1a8 8 0 0 0-2.2-1.3L15 2H9l-.3 2.6a8 8 0 0 0-2.2 1.3l-2.4-1-2 3.4 2 1.6A8 8 0 0 0 4 12c0 .4 0 .9.1 1.3l-2 1.6 2 3.4 2.4-1a8 8 0 0 0 2.2 1.3L9 22h6l.3-2.6a8 8 0 0 0 2.2-1.3l2.4 1 2-3.4-2-1.6c.1-.4.1-.9.1-1.3Z`,search:`M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM21 21l-4.3-4.3`,chevron:`M9 6l6 6-6 6`,x:`M6 6l12 12M18 6L6 18`,menu:`M4 7h16M4 12h16M4 17h16`,play:`M7 5v14l11-7L7 5Z`,clear:`M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14`,download:`M12 3v12m0 0l-4-4m4 4l4-4M4 19h16`,refresh:`M21 12a9 9 0 1 1-3-6.7M21 4v5h-5`,folder:`M3 7a2 2 0 0 1 2-2h3.5l2 2H19a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z`,build:`M14 3l-1 4 4-1 3 3-4 1 1 4-3 3-1-4-4 1-3-3 4-1-1-4 3-3 5 0Z`,arrow:`M5 12h14M13 6l6 6-6 6`,external:`M14 5h5v5M19 5l-8 8M12 5H6a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-6`,copy:`M9 9h11v11H9zM5 15H4V4h11v1`,check:`M5 12.5l4.5 4.5L19 7`,flask:`M9 3h6M10 3v6l-5.4 9.2A1.9 1.9 0 0 0 6.2 21h11.6a1.9 1.9 0 0 0 1.6-2.8L14 9V3M7.5 15h9`,spark:`M12 3v3m0 12v3m9-9h-3M6 12H3m13.5-6.5-2 2m-7 7-2 2m11 0-2-2m-7-7-2-2`,activity:`M3 12h4l2.5-7 5 14 2.5-7H21`,agent:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8ZM22 21v-2a4 4 0 0 0-3-3.9M16 3.1a4 4 0 0 1 0 7.8`,kit:`M21 8l-9-5-9 5v8l9 5 9-5V8ZM3 8l9 5 9-5M12 13v8`,layers:`M12 3l9 5-9 5-9-5 9-5ZM3 13l9 5 9-5M3 17l9 5 9-5`,sun:`M12 4V2M12 22v-2M4 12H2M22 12h-2M5.6 5.6 4.2 4.2M19.8 19.8l-1.4-1.4M18.4 5.6l1.4-1.4M4.2 19.8l1.4-1.4M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z`,moon:`M21 12.8A8.5 8.5 0 1 1 11.2 3a6.5 6.5 0 0 0 9.8 9.8Z`,power:`M12 3v9M7.5 6.5a7 7 0 1 0 9 0`,docs:`M5 4h9l5 5v11a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1ZM14 4v5h5M8 12h7M8 16h7`,skill:`M21.7 6.6a5 5 0 0 1-6.6 6.6l-7.4 7.4a2 2 0 1 1-2.8-2.8l7.4-7.4a5 5 0 0 1 6.6-6.6l-2.6 2.6a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0Z`,law:`M12 3v18M5 6h14M8 21h8M6 6l-3 6h6zM3 12a3 3 0 0 1 6 0M18 6l-3 6h6zM15 12a3 3 0 0 1 6 0`,rule:`M7 3h10a1 1 0 0 1 1 1v17l-6-3.5L6 21V4a1 1 0 0 1 1-1ZM9.5 9.5l1.8 1.8 3.4-3.6`,profile:`M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8ZM5 20a7 7 0 0 1 14 0`,notebook:`M7 4h11v16H7zM4 8h3M4 12h3M4 16h3M11 9h5M11 13h5M11 17h3`,about:`M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18ZM12 11v6M12 7.6h.01`,github:`M12 2a10 10 0 0 0-3.2 19.5c.5.1.7-.2.7-.5v-1.8c-2.8.6-3.4-1.2-3.4-1.2-.5-1.2-1.1-1.5-1.1-1.5-.9-.6.1-.6.1-.6 1 .1 1.5 1 1.5 1 .9 1.5 2.3 1.1 2.9.8.1-.6.3-1.1.6-1.3-2.2-.3-4.6-1.1-4.6-5 0-1.1.4-2 1-2.7-.1-.3-.4-1.3.1-2.7 0 0 .8-.3 2.7 1a9.4 9.4 0 0 1 5 0c1.9-1.3 2.7-1 2.7-1 .5 1.4.2 2.4.1 2.7.6.7 1 1.6 1 2.7 0 3.9-2.4 4.7-4.6 5 .4.3.7.9.7 1.8v2.6c0 .3.2.6.7.5A10 10 0 0 0 12 2Z`};function q({name:e,className:t=`glyph`,style:n}){return(0,K.jsx)(`svg`,{className:t,style:n,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:Wt[e]||``})})}function Gt({className:e=`sprout`}){return(0,K.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,K.jsx)(`path`,{d:`M12 21.5v-9`,stroke:`var(--accent)`,strokeWidth:`2`,strokeLinecap:`round`,fill:`none`}),(0,K.jsx)(`path`,{d:`M12 13c0-4.5 3.2-7.5 7.5-7.5 0 4.5-3.2 7.5-7.5 7.5z`,fill:`var(--accent)`}),(0,K.jsx)(`path`,{d:`M12 14.5c0-3.6-2.6-6-6-6 0 3.6 2.6 6 6 6z`,fill:`var(--accent)`,opacity:`.42`}),(0,K.jsx)(`circle`,{cx:`12`,cy:`12.4`,r:`1.1`,fill:`var(--bg)`})]})}var Kt=[{group:`core`,hash:`#/`,page:`overview`,label:`Overview`,icon:`dashboard`},{group:`govern`,hash:`#/laws`,page:`laws`,label:`Constitution`,icon:`law`,count:e=>e?.counts?Ht(e.counts):null},{group:`build`,hash:`#/library`,page:`library`,label:`Library`,icon:`library`,count:e=>e?.counts?Ut(e.counts):null},{group:`build`,hash:`#/kits`,page:`kits`,label:`Kits`,icon:`kit`},{group:`build`,hash:`#/loops`,page:`loops`,label:`Loops`,icon:`loop`,countTitle:`Templates across every install`,count:e=>e?.counts?.loops??null},{group:`build`,hash:`#/factories`,page:`factories`,label:`Factories`,icon:`build`},{group:`govern`,hash:`#/personal`,page:`personal`,label:`Personal`,icon:`profile`},{group:`run`,hash:`#/installs`,page:`installs`,label:`Installs`,icon:`layers`,count:(e,t)=>t?t.filter(e=>e.state!==`absent`).length:null}],qt=[{group:`help`,hash:`#/docs`,page:`docs`,label:`Docs`,icon:`docs`},{group:`run`,hash:`#/activity`,page:`activity`,label:`Activity`,icon:`activity`},{group:`help`,hash:`#/settings`,page:`settings`,label:`Settings`,icon:`settings`}],Jt=[{id:`core`,title:null},{id:`govern`,title:`Govern`},{id:`build`,title:`Build`},{id:`run`,title:`Run`},{id:`help`,title:`Help`}],Yt=[...Kt,...qt],Xt=`geneseed-rail`;function Zt({n:e,lit:t,count:n,collapsed:r,onNavigate:i}){return(0,K.jsx)(`li`,{children:(0,K.jsxs)(`a`,{className:`sb-item${t?` on`:``}`,href:e.hash,"aria-current":t?`page`:void 0,title:r?e.label:void 0,"aria-label":r?n==null?e.label:`${e.label}, ${n}`:void 0,onClick:()=>i?.(),children:[(0,K.jsx)(`span`,{className:`sb-chip`,"aria-hidden":`true`,children:(0,K.jsx)(q,{name:e.icon})}),(0,K.jsx)(`span`,{className:`sb-label`,children:e.label}),n==null?null:(0,K.jsx)(`span`,{className:`sb-count`,title:e.countTitle,children:n})]})})}function Qt({route:e,overview:t,installs:n,onNavigate:r}){let[i,a]=H(Xt,e=>e===`collapsed`?`collapsed`:`open`),o=i===`collapsed`,s=()=>a(o?`open`:`collapsed`),c=o?`Expand the sidebar`:`Collapse the sidebar`;return(0,K.jsxs)(`nav`,{className:`sidebar${o?` collapsed`:``}`,id:`rail-nav`,"aria-label":`Console`,tabIndex:-1,children:[(0,K.jsxs)(`div`,{className:`sb-head`,children:[(0,K.jsx)(`button`,{type:`button`,className:`sb-collapse`,onClick:s,"aria-label":c,title:c,"aria-expanded":!o,children:(0,K.jsx)(q,{name:`chevron`})}),(0,K.jsxs)(`button`,{type:`button`,className:`sb-brand`,onClick:()=>{Se(`#/`),r?.()},"aria-label":`Geneseed, go to the overview`,children:[(0,K.jsx)(`span`,{className:`sb-mark`,children:(0,K.jsx)(Gt,{})}),(0,K.jsxs)(`span`,{className:`sb-brand-text`,children:[(0,K.jsx)(`span`,{className:`sb-name`,children:`Geneseed`}),(0,K.jsx)(`span`,{className:`sb-ver`,children:[t?.version&&`v${t.version}`,t?.theme].filter(Boolean).join(` · `)})]})]})]}),Jt.map(i=>(0,K.jsxs)(`div`,{className:`sb-group sb-${i.id}`,role:`group`,"aria-labelledby":i.title?`sb-g-${i.id}`:void 0,"aria-label":i.title?void 0:`Overview`,children:[i.title?(0,K.jsxs)(`div`,{className:`sb-group-title`,id:`sb-g-${i.id}`,children:[(0,K.jsx)(`i`,{"aria-hidden":`true`}),i.title]}):null,(0,K.jsx)(`ul`,{className:`sb-list`,children:Yt.filter(e=>e.group===i.id).map(i=>(0,K.jsx)(Zt,{n:i,lit:e.page===i.page,count:i.count?.(t,n),collapsed:o,onNavigate:r},i.page))})]},i.id))]})}var $t=[`overview`,`laws`,`library`,`installs`];function en({route:e,navOpen:t,onMore:n}){return(0,K.jsxs)(`nav`,{className:`tabbar`,"aria-label":`Console pages`,children:[Kt.filter(e=>$t.includes(e.page)).map(t=>(0,K.jsxs)(`a`,{href:t.hash,className:e.page===t.page?`on`:``,"aria-current":e.page===t.page?`page`:void 0,children:[(0,K.jsx)(q,{name:t.icon}),t.label]},t.page)),(0,K.jsxs)(`button`,{type:`button`,className:`tab-more${$t.includes(e.page)?``:` on`}`,"aria-controls":`rail-nav`,"aria-expanded":!!t,onClick:n,children:[(0,K.jsx)(q,{name:`menu`}),`More`]})]})}var tn=[{id:`opencode`,label:`OpenCode`,deployAdds:`.opencode/ + AGENT.md`,removeProject:`.opencode/ + AGENT.md + the bundle`,removeGlobal:`~/.config/opencode's AGENT.md, agents, skills, plugins + the opencode.json entry`},{id:`claude`,label:`Claude Code`,deployAdds:`.claude/ + CLAUDE.md`,removeProject:`.claude/ + the CLAUDE.md block`,removeGlobal:`~/.claude's agents/skills + the CLAUDE.md block + settings hooks`},{id:`bob`,label:`BOB (IBM)`,deployAdds:`.bob/ + AGENTS.md`,removeProject:`.bob/ + the AGENTS.md block`,removeGlobal:`~/.bob's agents/skills + the AGENTS.md block + settings hooks`},{id:`openclaude`,label:`OpenClaude`,deployAdds:`.openclaude/ + its CLAUDE.md`,removeProject:`.openclaude/ + its CLAUDE.md block`,removeGlobal:`~/.openclaude's agents/skills + the CLAUDE.md block + settings hooks`}],J=e=>tn.find(t=>t.id===e)||tn[0],nn=(e,t)=>t===`project`?J(e).removeProject:J(e).removeGlobal,rn=e=>String(e||``).replace(/[\\/]+$/,``).split(/[\\/]/).pop()||e,an=e=>e.scope===`global`?J(e.host).label:rn(e.path),on=e=>{let t=J(e.host).label;return e.scope===`global`?`${t} · global`:`${rn(e.path)} · ${t}`},sn=e=>({"--cc":`var(--cat-${e*2%7})`}),cn=(e,t=[])=>[...new Set(e)].filter(e=>!t.includes(e)),ln=e=>{let t=(e||[]).filter(e=>e.state===`active`);return[...t.filter(e=>e.default),...t.filter(e=>!e.default)]},un=e=>e?{host:e.host,path:e.path}:void 0,dn=`geneseed-harness`,fn=tn.map(({id:e,label:t})=>({id:e,label:t}));function pn(e=`opencode`){let[t,n]=H(dn,e=>fn.some(t=>t.id===e)?e:null);return[t??e,n]}function mn(e){let t=String(e||``);return tn.find(e=>t.startsWith(e.id))?.id||`opencode`}var hn=Object.entries(de).flatMap(([e,t])=>(fe[e]||[``]).map(n=>{let r=n?t+` / `+pe[n]:t;return{kind:`Pages`,sortKey:-1,title:r,desc:``,hay:r.toLowerCase(),route:e===`overview`?`#/`:`#/`+e+(n?`/`+n:``)}}));function gn(e=0){let[t,n]=(0,V.useState)(null),[r,i]=(0,V.useState)(``),o=(0,V.useRef)(null),[s]=pn(),c=`${e}|${s}`,[l,u]=(0,V.useState)(c);return l!==c&&(u(c),n(null)),(0,V.useEffect)(()=>{o.current=null},[c]),{index:t,error:r,prime:(0,V.useCallback)(()=>{if(t||o.current)return o.current;let e=(async()=>{let e=[],t=[`laws`,`skills`,...I],r=await Promise.all(t.map(async e=>{try{return{sec:e,items:(await a.catalog(e))?.items||[]}}catch{return{sec:e,items:[]}}}));for(let{sec:n,items:i}of r){let r=F[n];for(let a of i){let i=a.title||a.name;e.push({kind:r.label,sortKey:t.indexOf(n),title:i,desc:a.desc||``,hay:`${i} ${a.desc||``} ${a.name||``}`.toLowerCase(),route:`#/item/${r.type}/${encodeURIComponent(a.name)}`})}}try{let t=await a.mcp(),n=new Set;for(let r of t?.targets||[])for(let t of r.servers||[]){if(n.has(t.name))continue;n.add(t.name);let r=t.label||t.name;e.push({kind:`MCP servers`,sortKey:100,title:r,desc:t.desc||``,hay:`${r} ${t.desc||``} ${t.name||``} mcp`.toLowerCase(),route:`#/installs/hosts`})}}catch{}try{let t=await a.docs(s);for(let n of t?.groups||[])for(let t of n.pages||[])e.push({kind:`Docs`,sortKey:110,title:t.title,desc:n.label,hay:`${t.title||``} ${t.id||``} ${n.label||``} ${t.section||``} ${t.description||``}`.toLowerCase(),route:`#/docs/${encodeURIComponent(t.id)}`})}catch{}return n(e),o.current=null,e})().catch(e=>(o.current=null,i(e.message||String(e)),[]));return o.current=e,e},[t,s])}}function _n({open:e,title:t,children:n,confirmLabel:r,tone:i,onConfirm:a,onClose:o}){let s=(0,V.useRef)(null),c=(0,V.useRef)(null),l=(0,V.useRef)(null),u=(0,V.useId)(),d=i===`danger`;return(0,V.useEffect)(()=>{let t=s.current;t&&(e&&!t.open&&(typeof t.showModal==`function`?t.showModal():t.setAttribute(`open`,``)),e&&(d?c:l).current?.focus(),!e&&t.open&&(typeof t.close==`function`?t.close():t.removeAttribute(`open`)))},[e,d]),(0,K.jsxs)(`dialog`,{ref:s,className:`confirm`,"aria-labelledby":`${u}-title`,"aria-describedby":`${u}-body`,onCancel:o,onClose:o,children:[(0,K.jsx)(`h3`,{className:`confirm-title`,id:`${u}-title`,children:t}),(0,K.jsx)(`div`,{className:`confirm-body`,id:`${u}-body`,children:n}),(0,K.jsxs)(`div`,{className:`confirm-actions`,children:[(0,K.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:o,ref:c,children:`Cancel`}),(0,K.jsx)(`button`,{type:`button`,className:d?`btn danger`:`btn`,onClick:a,ref:l,children:r||`Confirm`})]})]})}var vn=(0,V.createContext)(null),yn=()=>{throw Error(`useConfirm() needs a <ConfirmProvider> above it`)};function bn(){return(0,V.useContext)(vn)||yn}function xn({children:e}){let[t,n]=(0,V.useState)(null),[r,i]=(0,V.useState)(!1),a=(0,V.useRef)(null),o=e=>{let t=a.current;a.current=null,n(null),t?.(e)},s=(0,V.useCallback)((e,t={})=>new Promise(r=>{a.current?.(!1),a.current=r,i(!!t.check?.checked),n({msg:e,...t})}),[]);return(0,K.jsxs)(vn.Provider,{value:s,children:[e,(0,K.jsxs)(_n,{open:!!t,title:t?.title||`Are you sure?`,confirmLabel:t?.confirmLabel,tone:t?.tone,onConfirm:()=>o(!t?.check||{checked:r}),onClose:()=>o(!1),children:[t?.msg,t?.check?(0,K.jsxs)(`label`,{className:`confirm-check`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:r,onChange:e=>i(e.target.checked)}),t.check.label]}):null]})]})}var Sn=24;function Cn(e,t){let n=e.title.toLowerCase();return n.startsWith(t)?0:n.includes(t)?1:e.hay.includes(t)?2:-1}function wn(e,t){let n=t.toLowerCase().trim();if(!e)return[];if(!n)return e.filter(e=>e.sortKey<0).sort((e,t)=>e.sortKey-t.sortKey);let r=[];for(let t of e){let e=Cn(t,n);e>=0&&r.push({e:t,s:e})}r.sort((e,t)=>e.e.sortKey-t.e.sortKey||e.s-t.s||e.e.title.localeCompare(t.e.title));let i=r.map(e=>e.e),a=i.filter(e=>e.sortKey>=0).slice(0,Sn);return i.filter(e=>e.sortKey<0).concat(a)}function Tn(e,t){let n=t.trim().toLowerCase(),r=n?e.toLowerCase().indexOf(n):-1;return r<0?e:(0,K.jsxs)(K.Fragment,{children:[e.slice(0,r),(0,K.jsx)(`mark`,{className:`spot-hit`,children:e.slice(r,r+n.length)}),e.slice(r+n.length)]})}function En({query:e,index:t,loading:n,error:r,active:i,onActive:a,onPick:o}){let s=(0,V.useMemo)(()=>wn(t,e),[t,e]),c=(0,V.useRef)(null),l=s.length>0;(0,V.useLayoutEffect)(()=>{let e=c.current?.querySelectorAll(`[data-spot-row]`);if(!l||!e?.length||!w())return;let t=S(e,{opacity:[0,1],translateY:[-4,0],duration:E[4],delay:z(E[0]),ease:A});return y(t,E[4]+E[0]*e.length)},[l]),(0,V.useEffect)(()=>{i>=s.length&&a(0)},[s,i,a]),(0,V.useEffect)(()=>{(c.current?.querySelector(`[data-spot-row="${i}"]`))?.scrollIntoView({block:`nearest`})},[i]);let u=[],d=null;s.forEach((e,t)=>{d&&d.kind===e.kind||(d={kind:e.kind,rows:[]},u.push(d)),d.rows.push({entry:e,index:t})});let f=!!e.trim();return(0,K.jsxs)(`div`,{className:`spotlight`,ref:c,id:`spotlight-list`,role:`listbox`,"aria-label":`Search results`,children:[u.map(t=>(0,K.jsxs)(`div`,{className:`spot-group`,role:`group`,"aria-label":t.kind,children:[(0,K.jsx)(`div`,{className:`spot-group-head`,"aria-hidden":`true`,children:t.kind}),t.rows.map(({entry:t,index:n})=>(0,K.jsxs)(`div`,{id:`spot-opt-${n}`,"data-spot-row":n,role:`option`,"aria-selected":n===i,className:`spot-row ${n===i?`on`:``}`,onMouseDown:e=>{e.preventDefault(),o(t)},onMouseEnter:()=>a(n),children:[(0,K.jsx)(`div`,{className:`spot-title`,children:Tn(t.title,e)}),t.desc?(0,K.jsx)(`div`,{className:`spot-desc`,children:t.desc}):null]},`${t.route||t.title}-${n}`))]},`${t.kind}-${t.rows[0].index}`)),f&&r&&(0,K.jsxs)(`div`,{className:`spot-empty`,role:`presentation`,children:[`Could not load the search index — `,r]}),f&&n&&!r&&(0,K.jsx)(`div`,{className:`spot-empty`,role:`presentation`,children:`Loading…`}),f&&!n&&!r&&s.length===0&&(0,K.jsxs)(`div`,{className:`spot-empty`,role:`presentation`,children:[`No matches for “`,e,`”.`]})]})}function Dn({actions:e=[],dataRev:t}){let n=(0,V.useRef)(null),r=(0,V.useRef)(null),i=(0,V.useRef)(null),[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)(``),[l,u]=(0,V.useState)(0),{index:d,error:f,prime:p}=gn(t),m=bn(),h=()=>{o(!0),p()},g=()=>{let e=n.current;e?.open&&(typeof e.close==`function`?e.close():e.removeAttribute(`open`)),o(!1),c(``),u(0),i.current?.focus()};(0,V.useEffect)(()=>{let e=n.current;a&&e&&!e.open&&(typeof e.showModal==`function`?e.showModal():e.setAttribute(`open`,``),r.current?.focus())},[a]),(0,V.useEffect)(()=>{let e=e=>{((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()===`k`||e.key===`/`&&!e.target.closest(`input, textarea, select`))&&(e.preventDefault(),o(!0),p())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[p]);let _=(0,V.useMemo)(()=>[...e.map(e=>({sortKey:-2,...e})),...hn,...d||[]],[e,d]),v=a?wn(_,s):[],y=l<v.length?`spot-opt-${l}`:void 0,b=async e=>{if(g(),!e.run)return Se(e.route);let t=e.confirm;(!t||await m(t.msg,{title:t.title,confirmLabel:t.confirmLabel,tone:t.tone}))&&e.run()};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{type:`button`,className:`tb-cmdk`,ref:i,"aria-haspopup":`dialog`,onClick:h,title:`Press / to open, or Ctrl-K / ⌘K from inside any field`,children:[(0,K.jsx)(q,{name:`search`,className:`mag glyph`}),(0,K.jsx)(`span`,{className:`tb-cmdk-label`,children:`Search or run…`}),(0,K.jsx)(`kbd`,{className:`tb-cmdk-key`,children:`Ctrl K`})]}),(0,K.jsx)(`dialog`,{ref:n,className:`palette`,"aria-label":`Search or run`,onCancel:e=>{e.preventDefault(),g()},onClose:()=>a&&g(),onClick:e=>e.target===n.current&&g(),children:a&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`palette-head`,children:[(0,K.jsx)(q,{name:`search`,className:`mag glyph`}),(0,K.jsx)(`input`,{ref:r,role:`combobox`,"aria-label":`Search or run`,"aria-autocomplete":`list`,"aria-expanded":`true`,"aria-controls":`spotlight-list`,"aria-activedescendant":y,value:s,onChange:e=>{c(e.target.value),u(0)},onKeyDown:e=>{if(e.key===`ArrowDown`)e.preventDefault(),u(e=>Math.min(e+1,Math.max(v.length-1,0)));else if(e.key===`ArrowUp`)e.preventDefault(),u(e=>Math.max(e-1,0));else if(e.key===`Enter`){let t=v[l];t&&(e.preventDefault(),b(t))}else e.key===`Escape`&&(e.preventDefault(),s?(c(``),u(0)):g())},placeholder:`Search or run…`}),(0,K.jsx)(`kbd`,{className:`palette-key`,children:`Esc`})]}),(0,K.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:v.length?`${v.length} results`:`no matches`}),(0,K.jsx)(En,{query:s,index:_,loading:!d,error:d?``:f,active:l,onActive:u,onPick:b}),(0,K.jsxs)(`div`,{className:`palette-foot`,children:[(0,K.jsx)(`span`,{children:`↑↓ move`}),(0,K.jsx)(`span`,{children:`↵ open`}),(0,K.jsx)(`span`,{children:`actions that write always ask first`})]})]})})]})}var On=`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function kn({open:e,onClose:t,anchorRef:n,label:r,className:i,children:a}){let o=(0,V.useRef)(null);return(0,V.useEffect)(()=>{if(!e)return;let r=o.current,i=n?.current;(r.querySelector(On)||r).focus();let a=e=>{e.key===`Escape`&&t()},s=e=>{r.contains(e.target)||i?.contains(e.target)||t()};return document.addEventListener(`keydown`,a),document.addEventListener(`mousedown`,s),()=>{document.removeEventListener(`keydown`,a),document.removeEventListener(`mousedown`,s);let e=document.activeElement;(!e||e===document.body||r.contains(e))&&i?.focus()}},[e]),e?(0,K.jsx)(`div`,{ref:o,className:i?`popover ${i}`:`popover`,role:`dialog`,"aria-label":r,tabIndex:-1,onBlur:e=>{let r=e.relatedTarget;!r||o.current?.contains(r)||n?.current?.contains(r)||t()},children:a}):null}function An({children:e,...t}){let n=x(`button.on`);return(0,K.jsxs)(`div`,{className:`seg`,role:`group`,ref:n,...t,children:[(0,K.jsx)(`span`,{className:`glide`,"aria-hidden":`true`}),e]})}function jn({value:e,onChange:t,labelledBy:n}){let r=mt(e);return(0,K.jsxs)(`div`,{className:`accent-picker`,role:`group`,"aria-labelledby":n,children:[ut.map(n=>(0,K.jsx)(`button`,{type:`button`,className:`accent-src${e===n.id?` on`:``}`,"aria-pressed":e===n.id,title:n.tagline,onClick:()=>t(n.id),children:n.short},n.id)),(0,K.jsxs)(`div`,{className:`accent-swatches`,children:[dt.map(n=>(0,K.jsx)(`button`,{type:`button`,className:`accent-swatch${e===n.id?` on`:``}`,style:{"--sw":n.hex},"aria-pressed":e===n.id,"aria-label":`${n.short} accent`,title:n.short,onClick:()=>t(n.id)},n.id)),(0,K.jsx)(`label`,{className:`accent-swatch accent-custom${r?` on picked`:``}`,style:r?{"--sw":r}:void 0,title:r?`Your colour, ${r}`:`Pick any colour`,children:(0,K.jsx)(`input`,{type:`color`,"aria-label":`Custom accent colour`,value:(r||`#3AD4C4`).toLowerCase(),onChange:e=>t(`hex:${e.target.value.toUpperCase()}`)})})]})]})}function Mn({flavour:e,onFlavour:t,accentMode:n,onAccentMode:r,onClose:i,anchorRef:a}){return(0,ue.createPortal)((0,K.jsxs)(kn,{open:!0,onClose:i,anchorRef:a,label:`Appearance`,className:`appearance-pop`,children:[(0,K.jsxs)(`div`,{className:`ap-group`,children:[(0,K.jsx)(`span`,{className:`ap-label`,id:`ap-skin`,children:`Skin`}),(0,K.jsx)(An,{"aria-labelledby":`ap-skin`,children:Qe.map(n=>(0,K.jsx)(`button`,{type:`button`,className:e===n.id?`on`:``,"aria-pressed":e===n.id,onClick:()=>t(n.id),children:n.short},n.id))}),(0,K.jsx)(`span`,{className:`ap-note`,role:`status`,"aria-live":`polite`,children:Qe.find(t=>t.id===e)?.tagline})]}),(0,K.jsxs)(`div`,{className:`ap-group`,children:[(0,K.jsx)(`span`,{className:`ap-label`,id:`ap-accent`,children:`Accent`}),(0,K.jsx)(jn,{value:n,onChange:r,labelledBy:`ap-accent`}),(0,K.jsx)(`span`,{className:`ap-note`,role:`status`,"aria-live":`polite`,children:_t(n)})]})]}),document.querySelector(`.app`)||document.body)}function Nn({route:e,navOpen:t,onToggleNav:n,actions:r,mode:i,onToggleMode:a,appearance:o,dataRev:s}){let[c,l]=(0,V.useState)(!1),u=(0,V.useRef)(null),d=e.tab&&pe[e.tab];return(0,K.jsxs)(`header`,{className:`topbar`,children:[(0,K.jsx)(`button`,{type:`button`,className:`tb-menu iconbtn`,onClick:n,"aria-label":t?`Close navigation`:`Open navigation`,"aria-expanded":!!t,"aria-controls":`rail-nav`,children:(0,K.jsx)(q,{name:t?`x`:`menu`})}),(0,K.jsx)(`nav`,{className:`crumbs`,"aria-label":`Breadcrumb`,children:(0,K.jsxs)(`ol`,{children:[(0,K.jsx)(`li`,{children:d?(0,K.jsx)(`a`,{href:e.page===`overview`?`#/`:`#/${e.page}`,children:de[e.page]}):(0,K.jsx)(`span`,{className:`crumb-here`,"aria-current":`page`,children:de[e.page]})}),d?(0,K.jsx)(`li`,{children:(0,K.jsx)(`span`,{className:`crumb-here`,"aria-current":`page`,children:d})}):null]})}),(0,K.jsx)(`div`,{className:`topbar-spacer`}),(0,K.jsx)(Dn,{actions:r,dataRev:s}),(0,K.jsx)(`button`,{type:`button`,className:`iconbtn`,ref:u,"aria-label":`Appearance`,title:`Appearance`,"aria-expanded":c,onClick:()=>l(e=>!e),children:(0,K.jsx)(q,{name:`themes`})}),c?(0,K.jsx)(Mn,{...o,anchorRef:u,onClose:()=>l(!1)}):null,(0,K.jsx)(`button`,{type:`button`,className:`iconbtn`,title:i===`light`?`Switch to dark`:`Switch to light`,"aria-label":i===`light`?`Switch to dark mode`:`Switch to light mode`,onClick:a,children:(0,K.jsx)(q,{name:i===`light`?`moon`:`sun`})})]})}function Pn({installs:e,value:t,onChange:n,className:r=``,tagOf:i=on,label:a=`Install`}){return!t||!e||e.length<2?null:(0,K.jsxs)(`label`,{className:`install-pick ${r}`.trim(),children:[(0,K.jsx)(`span`,{className:`dim`,children:`Install:`}),(0,K.jsx)(`select`,{className:`sel mono`,"aria-label":a,value:t.id,onChange:t=>n(e.find(e=>e.id===t.target.value)),children:e.map(e=>(0,K.jsx)(`option`,{value:e.id,children:i(e)},e.id))})]})}function Fn({unreadable:e}){return e?(0,K.jsx)(`p`,{className:`sub rule-notice`,role:`status`,children:`Install list unreadable — showing the default install.`}):null}var In=3500;function Ln({toast:e,onClose:t}){let[n,r]=(0,V.useState)(null),i=!!e&&e.kind!==`err`&&n!==e;(0,V.useEffect)(()=>{if(!i)return;let e=setTimeout(t,In);return()=>clearTimeout(e)},[e,i]);let a=()=>r(e),o=()=>r(null);return(0,K.jsx)(`div`,{className:`toast-region`,"aria-live":e?.kind===`err`?void 0:`polite`,children:e&&(0,K.jsxs)(`div`,{className:`toast ${e.kind}`,role:e.kind===`err`?`alert`:void 0,onMouseEnter:a,onMouseLeave:e=>{e.currentTarget.contains(document.activeElement)||o()},onFocus:a,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||o()},children:[(0,K.jsx)(`div`,{children:e.msg}),(0,K.jsx)(`div`,{style:{marginTop:8},children:(0,K.jsx)(`button`,{className:`btn ghost`,onClick:t,children:`Dismiss`})})]})})}var Rn=e=>tn.find(t=>t.id===e)?.label??e;function zn(e){let t=/^([a-z]+?)(?:-(global))?$/.exec(e);return t?`${Rn(t[1])} · ${t[2]||`project`}`:e}var Bn={upgrade:`Update the source`,"rebuild-all":`Rebuild every install`,doctor:`Run the doctor`,diff:`Export local edits`,link:`Link the CLI`,unlink:`Unlink the CLI`};function Vn(e){let t;return(t=/geneseed-cli\.mjs\s+(\S+)/.exec(e))?{title:Bn[t[1]]||`Run ${t[1]}`,container:t[1]===`rebuild-all`}:/build-driver\.mjs\b/.test(e)?(t=/--emit\s+(\S+)/.exec(e),{title:t?`Build ${zn(t[1])}`:`Build the bundle`}):/npm(\.cmd)?\s+install\b/i.test(e)?{title:`Install the npm package`}:{title:`Run a step`}}var Hn=/^\[(?:geneseed|rebuild-all|upgrade)\]\s*(?:WARN\b:?|⚠️)\s*/u,Un=/^(?:\[rebuild-all\] FAILED |\[rebuild-all\] \d+\/\d+ install\(s\) failed|\[rebuild-all\] not started:|\[web\] ✗ |\[web\] job crashed|\[web\] cancelled by user|\[geneseed\]\[E-[A-Z]+\] ✗|\[geneseed\] ✗)/,Wn=/^\[geneseed\] (refused \S+: it is a link)/,Gn=/^\[rebuild-all\] ([a-z]+):([a-z]+) \((.*)\): theme=/,Kn=/^\[geneseed\] ([a-z]+(?:-global)?) -> .+?: (\d+ subagents, \d+ skills)/,qn=/^\[geneseed\] (\d+) new commit\(s\) upstream/,Jn=/^\[geneseed\] already up to date\./,Yn=/^\[rebuild-all\] rebuilt (\d+) install\(s\)\./,Xn=/^\[rebuild-all\] WARN /,Zn=/restarts? itself after this job/,Qn=/^\[geneseed\] ✓ (?:upgrade|update) complete\./,$n=/skipping the (\d+) remaining step\(s\)/;function er(e){let t=e.replace(Hn,``),n=t.replace(/"[^"]*"(?:,\s*"[^"]*")+/g,e=>`${e.match(/"[^"]*"/g).length} entries`),r=n.indexOf(` — `),i=r===-1?n:n.slice(0,r),a=r===-1?``:n.slice(r+3),o=a.search(/\.(\s|$)/);return o!==-1&&(a=a.slice(0,o+1)),i.length>96&&(i=`${i.slice(0,95).replace(/\s+\S*$/,``)}…`),a&&=a[0].toUpperCase()+a.slice(1),{title:i,body:a,text:t}}function tr(e,t,n={}){return{title:e,detail:``,raw:t==null?[]:[t],lines:[],warnings:[],notices:[],errors:[],...n}}var nr=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`;function rr(e=``,t=`done`){let n=e?e.replace(/\n$/,``).split(`
3
- `):[],r=[],i=[],a=null,o=null,s=!1,c=null,l=null,u=!1,d=[],f=e=>{a&&a.container&&a.raw.length===1&&!a.lines.length&&(r.pop(),e.raw.unshift(...a.raw)),r.push(e),a=e};for(let e of n){let t;if(t=/^\$ (.+)$/.exec(e)){let{title:n,container:r}=Vn(t[1]);f(tr(n,e,{container:!!r}))}else(t=Gn.exec(e))?f(tr(`Rebuild ${Rn(t[1])} · ${t[2]}`,e)):a?(a.raw.push(e),Xn.test(e)?d.push(er(e)):Hn.test(e)?a.warnings.push(er(e)):Un.test(e)?(a.errors.push(e),(t=$n.exec(e))&&(a.skippedSteps=Number(t[1]))):(t=Wn.exec(e))?a.notices.push({title:t[1],text:e}):(t=Kn.exec(e))?(a.detail=a.detail||t[2],l||=t[1]):(t=qn.exec(e))?(o=Number(t[1]),a.detail=nr(o,`new commit`)):Jn.test(e)?(s=!0,a.detail=`already up to date`):(t=Yn.exec(e))?c=Number(t[1]):Zn.test(e)?u=!0:Qn.test(e)||e.trim()&&a.lines.push(e)):i.push(e)}if(t===`failed`&&!r.some(e=>e.errors.length)){r.length||r.push(tr(`Run`,null));let e=[...n].reverse().find(e=>e.trim())||`the job failed without output`;r[r.length-1].failLine=e}r.forEach((e,n)=>{e.state=e.errors.length||e.failLine?`failed`:t===`running`&&n===r.length-1?`running`:e.warnings.length?`warn`:e.notices.length?`skipped`:`done`,e.stateText={failed:`Failed`,running:`Running`,warn:nr(e.warnings.length,`warning`),skipped:`${e.notices.length} skipped`,done:`Done`}[e.state],delete e.container}),u&&r.length&&(r[r.length-1].title+=`, restart web`);let p=[];return o===null?s&&p.push(`up to date`):p.push(nr(o,`new commit`)),c===null?l&&p.push(l):p.push(nr(c,`install`)),{phases:r,other:i,runWarnings:d,failed:r.some(e=>e.state===`failed`),warnings:r.reduce((e,t)=>e+t.warnings.length,d.length),notices:r.reduce((e,t)=>e+t.notices.length,0),detail:p.join(` · `),restart:u}}function ir(e){if(e==null)return``;if(e<60)return`${e}s`;let t=Math.floor(e/60);return`${t}m ${Math.round(e-t*60)}s`}function ar(e,t){return e===`running`?`running`:e===`failed`||t.failed?`failed`:t.warnings?`warn`:`done`}var or={running:`Running`,failed:`Failed`,done:`Done`,warn:`Done`},sr={running:`running`,failed:`✗`,warn:`⚠`},cr=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function lr({runs:e,open:t,onToggle:n,onClear:r,onCancel:i,busy:a,finish:o}){let s=(0,V.useRef)(null),c=(0,V.useRef)(null),[l,u]=(0,V.useState)({id:null,at:0}),[d,f]=(0,V.useState)(null);(0,V.useEffect)(()=>{let e=c.current;o&&e&&(e.classList.remove(`flash-ok`,`flash-bad`),e.offsetWidth,e.classList.add(o.status===`done`?`flash-ok`:`flash-bad`))},[o]);let p=(0,V.useMemo)(()=>e.map(e=>rr(e.output,e.status)),[e]),m=l.at===e.length?l.id:null,h=m===null?-1:e.findIndex(e=>e.id===m),g=h===-1?e.length-1:h,_=e[g],v=p[g],y=_?_.output.length:0;return(0,V.useEffect)(()=>{s.current&&(s.current.scrollTop=0)},[_?.id]),(0,V.useEffect)(()=>{let e=s.current;e&&t&&_?.status===`running`&&(e.scrollTop=e.scrollHeight)},[y,t,_?.status]),(0,K.jsxs)(`div`,{className:`console`,style:{height:`42vh`,transform:t?`none`:`translateY(calc(42vh - 42px))`},children:[(0,K.jsxs)(`div`,{className:`console-head`,ref:c,onClick:n,onAnimationEnd:e=>{e.target===e.currentTarget&&e.currentTarget.classList.remove(`flash-ok`,`flash-bad`)},children:[a&&(0,K.jsx)(`span`,{className:`console-progress`,"aria-hidden":`true`}),(0,K.jsxs)(`span`,{className:`ttl`,children:[(0,K.jsx)(`span`,{className:`live ${a?`on`:``}`}),`terminal`]}),(0,K.jsx)(`span`,{className:`count`,children:e.length}),(0,K.jsxs)(`div`,{className:`right`,onClick:e=>e.stopPropagation(),children:[(0,K.jsx)(`button`,{className:`iconbtn`,title:`Clear`,"aria-label":`Clear run history`,onClick:r,disabled:!e.length,children:(0,K.jsx)(q,{name:`clear`})}),(0,K.jsx)(`button`,{className:`iconbtn`,title:t?`Collapse`:`Expand`,"aria-label":t?`Collapse console`:`Expand console`,"aria-expanded":t,onClick:n,children:(0,K.jsx)(q,{name:`chevron`,className:`glyph`,style:{transform:t?`rotate(90deg)`:`rotate(-90deg)`}})})]})]}),t&&(e.length===0?(0,K.jsx)(`div`,{className:`console-body`,children:(0,K.jsx)(`div`,{className:`console-empty`,children:`No commands run yet. Actions you trigger stream here.`})}):(0,K.jsxs)(`div`,{className:`console-body cx`,children:[(0,K.jsx)(`ul`,{className:`cx-runs`,"aria-label":`Runs`,children:e.map((t,n)=>{let r=ar(t.status,p[n]);return(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{className:`cx-run${n===g?` on`:``}`,"aria-current":n===g?`true`:void 0,onClick:()=>u({id:t.id,at:e.length}),children:[(0,K.jsx)(`span`,{className:`cx-dot ${r}`,"aria-hidden":`true`}),(0,K.jsxs)(`span`,{className:`cx-run-main`,children:[(0,K.jsx)(`span`,{className:`cx-run-act`,children:t.action}),p[n].detail&&(0,K.jsx)(`span`,{className:`cx-run-sub`,title:p[n].detail,children:p[n].detail})]}),(0,K.jsxs)(`span`,{className:`cx-run-dur`,children:[sr[r]&&(0,K.jsx)(`span`,{className:`cx-mark ${r}`,"aria-hidden":`true`,children:sr[r]}),t.status===`running`?``:ir(t.duration)]}),(0,K.jsxs)(`span`,{className:`sr-only`,children:[or[r],r===`warn`?` with warnings`:``]})]})},t.id)}).reverse()}),(0,K.jsx)(`section`,{className:`cx-detail`,ref:s,"aria-label":`Run ${_.action}`,children:(0,K.jsx)(ur,{run:_,view:v,showLog:d===_.id,onLog:()=>f(e=>e===_.id?null:_.id),onCancel:i})})]}))]})}function ur({run:e,view:t,showLog:n,onLog:r,onCancel:i}){let a=ar(e.status,t),o=[e.status===`running`?`running`:ir(e.duration),cr(t.warnings,`warning`),cr(t.notices,`notice`)].filter(Boolean);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`header`,{className:`cx-head`,children:[(0,K.jsx)(`h3`,{className:`cx-title`,children:e.action}),(0,K.jsx)(`span`,{className:`cx-pill ${a}`,children:or[a]}),e.status===`running`&&i&&(0,K.jsx)(`button`,{className:`iconbtn run-cancel`,title:`Cancel this run`,"aria-label":`Cancel the ${e.action} run`,onClick:()=>i(e.id),children:(0,K.jsx)(q,{name:`x`})}),(0,K.jsx)(`button`,{className:`cx-logbtn`,"aria-pressed":n,onClick:r,children:`Full log`})]}),(0,K.jsx)(`p`,{className:`cx-sum`,children:o.join(` · `)}),n?(0,K.jsx)(`pre`,{className:`run-out`,children:e.output}):(0,K.jsxs)(K.Fragment,{children:[t.phases.length===0&&!t.other.length&&(0,K.jsx)(`div`,{className:`console-empty`,children:e.status===`running`?`Waiting for output…`:`No output`}),(0,K.jsx)(`ol`,{className:`cx-phases`,children:t.phases.map((e,t)=>(0,K.jsx)(fr,{n:t+1,p:e},t))}),t.runWarnings.length>0&&(0,K.jsxs)(`div`,{className:`cx-other`,children:[(0,K.jsx)(`div`,{className:`cx-ph-title`,children:`Run warnings`}),t.runWarnings.map((e,t)=>(0,K.jsx)(dr,{w:e},t))]}),t.other.length>0&&(0,K.jsx)(pr,{lines:t.other})]})]})}function dr({w:e}){return(0,K.jsxs)(`div`,{className:`cx-warn`,children:[(0,K.jsx)(`b`,{children:e.title}),e.body&&(0,K.jsx)(`p`,{children:e.body}),e.text!==e.title&&(0,K.jsxs)(`details`,{children:[(0,K.jsx)(`summary`,{children:`Full text`}),(0,K.jsx)(`p`,{className:`cx-warn-full`,children:e.text})]})]})}function fr({n:e,p:t}){return(0,K.jsxs)(`li`,{className:`cx-phase ${t.state}`,children:[(0,K.jsx)(`span`,{className:`cx-num`,"aria-hidden":`true`,children:e}),(0,K.jsxs)(`div`,{className:`cx-ph`,children:[(0,K.jsxs)(`div`,{className:`cx-ph-head`,children:[(0,K.jsx)(`span`,{className:`cx-ph-title`,children:t.title}),(0,K.jsx)(`span`,{className:`cx-ph-state`,children:t.stateText})]}),t.detail&&(0,K.jsx)(`div`,{className:`cx-ph-detail`,children:t.detail}),t.errors.map((e,t)=>(0,K.jsx)(`div`,{className:`cx-err`,children:e},`e${t}`)),t.failLine&&(0,K.jsx)(`div`,{className:`cx-err`,children:t.failLine}),t.warnings.map((e,t)=>(0,K.jsx)(dr,{w:e},`w${t}`)),t.notices.map((e,t)=>(0,K.jsx)(`div`,{className:`cx-note`,title:e.text,children:e.title},`n${t}`)),t.lines.length>0&&(0,K.jsx)(`pre`,{className:`cx-lines`,children:t.lines.join(`
4
- `)})]})]})}function pr({lines:e}){return(0,K.jsxs)(`div`,{className:`cx-other`,children:[(0,K.jsx)(`div`,{className:`cx-ph-title`,children:`Other output`}),(0,K.jsx)(`pre`,{className:`cx-lines`,children:e.join(`
5
- `)})]})}var mr=550,hr=`gs-splash-seen`,gr=8e3;function _r(){try{if(window.localStorage.getItem(hr))return 0;window.localStorage.setItem(hr,`1`)}catch{}return mr}function vr({ready:e,onDone:t}){let[n,r]=(0,V.useState)(!1),[i,a]=(0,V.useState)(!1);(0,V.useEffect)(()=>{let e=setTimeout(()=>r(!0),_r());return()=>clearTimeout(e)},[]);let[o,s]=(0,V.useState)(!1);(0,V.useEffect)(()=>{if(e)return;let t=setTimeout(()=>s(!0),gr);return()=>clearTimeout(t)},[e]),e&&n&&!i&&a(!0),(0,V.useEffect)(()=>{if(!i)return;let e=setTimeout(()=>t?.(),E[9]);return()=>clearTimeout(e)},[i]);let c=o&&!i;return(0,K.jsxs)(`div`,{className:`boot-splash${i?` fading`:``}`,"aria-hidden":c?void 0:`true`,onAnimationEnd:e=>{e.animationName===`splashOut`&&t?.()},children:[(0,K.jsxs)(`div`,{className:`boot-dial`,"aria-hidden":`true`,children:[(0,K.jsxs)(`svg`,{className:`boot-ring`,viewBox:`0 0 172 172`,children:[(0,K.jsx)(`circle`,{cx:`86`,cy:`86`,r:`72`,fill:`none`,stroke:`var(--surface-3)`,strokeWidth:`9`}),(0,K.jsx)(`circle`,{cx:`86`,cy:`86`,r:`50`,fill:`none`,stroke:`var(--line-2)`,strokeWidth:`8`,strokeDasharray:`1.2 5.3`,opacity:`.7`}),(0,K.jsx)(`circle`,{className:`boot-progress`,cx:`86`,cy:`86`,r:`72`,fill:`none`,stroke:`var(--accent)`,strokeWidth:`9`,strokeLinecap:`round`})]}),(0,K.jsxs)(`svg`,{className:`boot-sprout`,viewBox:`0 0 24 24`,children:[(0,K.jsx)(`path`,{className:`bs-stem`,d:`M12 21.5v-9`,stroke:`var(--accent)`,strokeWidth:`2`,strokeLinecap:`round`,fill:`none`}),(0,K.jsx)(`path`,{className:`bs-leaf bs-leaf-main`,d:`M12 13c0-4.5 3.2-7.5 7.5-7.5 0 4.5-3.2 7.5-7.5 7.5z`,fill:`var(--accent)`}),(0,K.jsx)(`path`,{className:`bs-leaf bs-leaf-back`,d:`M12 14.5c0-3.6-2.6-6-6-6 0 3.6 2.6 6 6 6z`,fill:`var(--accent)`,opacity:`.42`}),(0,K.jsx)(`circle`,{cx:`12`,cy:`12.4`,r:`1.1`,fill:`var(--bg)`})]})]}),c?(0,K.jsxs)(`div`,{className:`boot-status`,role:`alert`,children:[(0,K.jsx)(`span`,{children:`The server is not answering.`}),` `,(0,K.jsx)(`button`,{type:`button`,className:`btn`,onClick:rt,children:`Retry`})]}):(0,K.jsxs)(`div`,{className:`boot-status`,children:[(0,K.jsx)(`span`,{children:`germinating harness`}),(0,K.jsx)(`span`,{className:`boot-caret`})]})]})}function Y({label:e=`Loading…`}){return(0,K.jsxs)(`div`,{className:`loading`,role:`status`,children:[e,(0,K.jsxs)(`div`,{className:`skel`,"aria-hidden":`true`,children:[(0,K.jsx)(`div`,{className:`skel-bar`}),(0,K.jsx)(`div`,{className:`skel-bar`}),(0,K.jsx)(`div`,{className:`skel-bar`})]})]})}function yr({error:e,style:t,onRetry:n,role:r=`alert`}){return e?n?(0,K.jsxs)(`div`,{className:`error-state`,role:r,style:t,children:[(0,K.jsx)(`p`,{className:`badge bad`,children:e}),(0,K.jsx)(`button`,{type:`button`,className:`btn sm`,onClick:n,children:`Retry`})]}):(0,K.jsx)(`p`,{className:`badge bad`,role:r,style:t,children:e}):null}function br(){let[e,t]=(0,V.useState)(!1),[n,r]=(0,V.useState)(null);return(0,K.jsxs)(`div`,{className:`stale-banner`,role:`alert`,children:[(0,K.jsx)(`span`,{children:n||`This console is running code from before your last upgrade.`}),(0,K.jsx)(`button`,{className:`btn sm`,onClick:async()=>{t(!0),r(null);try{await ct()}catch(e){r(e.message),t(!1)}},disabled:e,children:e?`Restarting…`:`Restart`})]})}var xr=/dynamically imported module|Importing a module script failed|Unable to preload CSS/i,Sr=e=>xr.test(e?.message||``),Cr=class extends V.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}render(){let{error:e}=this.state;if(!e)return this.props.children;let t=Sr(e);return(0,K.jsxs)(`div`,{role:t?void 0:`alert`,children:[(0,K.jsx)(yr,{error:e.message||String(e),role:null}),t?(0,K.jsx)(br,{}):(0,K.jsx)(`button`,{type:`button`,className:`btn sm`,onClick:()=>this.setState({error:null}),children:`Retry`})]})}},wr=(0,V.createContext)(null),Tr=e=>[...e].sort().join(`,`),Er=e=>[...e.values()].some(e=>!e.applied&&Tr(e.value)!==e.base);function Dr(e,t){let[n,r]=(0,V.useState)(()=>({kits:new Map,rules:new Map})),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(t);if(o!==t&&(s(t),i&&t)){let e=t.status===`done`?{applied:!0}:{failed:!0};r(t=>{let n=t[i.kind].get(i.key);return n?{...t,[i.kind]:new Map(t[i.kind]).set(i.key,{...n,...e})}:t}),a(null)}let c=Er(n.kits)||Er(n.rules);return(0,V.useEffect)(()=>{if(!c)return;let e=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[c]),{get:(e,t)=>n[e].get(t),put:(e,t,n,i)=>r(r=>{let a=new Map(r[e]);return Tr(n)===i?a.delete(t):a.set(t,{value:n,base:i}),{...r,[e]:a}}),drop:(e,t)=>r(n=>{let r=new Map(n[e]);return r.delete(t),{...n,[e]:r}}),prune:(0,V.useCallback)((e,t)=>r(n=>{let r=[...n[e]].filter(([e,n])=>t(e,n)).map(([e])=>e);if(!r.length)return n;let i=new Map(n[e]);return r.forEach(e=>i.delete(e)),{...n,[e]:i}}),[]),startApply:(e,t)=>{a({kind:e,key:t}),r(n=>{let r=n[e].get(t);return r?.failed?{...n,[e]:new Map(n[e]).set(t,{value:r.value,base:r.base})}:n})},running:(t,n)=>!!e&&i?.kind===t&&i?.key===n,busy:!!e}}function Or({activeId:e,finish:t,children:n}){let r=Dr(e,t);return(0,K.jsx)(wr.Provider,{value:r,children:n})}function kr(){let e=Dr(null,null);return(0,V.useContext)(wr)||e}var Ar=e=>!!e&&!e.endsWith(`-global`);function jr({onAction:e}){let{data:t,error:n}=W(()=>a.themes(),[]),[r,i]=(0,V.useState)(``),[o,s]=(0,V.useState)(``),[c,l]=(0,V.useState)(``),[u,d]=(0,V.useState)(``),[f,p]=(0,V.useState)(!1);if(n)return(0,K.jsx)(yr,{error:n});if(!t)return(0,K.jsx)(Y,{});let m=r||t.current?.theme||`neutral`,h=(t.emits||[]).filter(e=>e.name!==`files`),g=t.emits?.some(e=>e.name===`opencode-global`),_=o||(g?`opencode-global`:t.current?.emit||h[0]?.name||``),v=i,y=s,b=Ar(_);return(0,K.jsxs)(`div`,{className:`narrow-lg`,children:[(0,K.jsx)(`div`,{className:`head-row mb-18`,children:(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h1`,{className:`h`,children:`Deploy your harness`}),(0,K.jsx)(`p`,{className:`sub`,children:`Geneseed isn't implanted on this machine yet. Pick a voice and an install mode, then deploy. The graft runs in the console below, and this dashboard lights up when it lands.`})]})}),(0,K.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,K.jsx)(`div`,{className:`card-head`,children:(0,K.jsx)(`h3`,{children:`1 · Choose a voice`})}),(0,K.jsx)(`div`,{className:`row wrap gap-10`,children:t.themes.map(e=>(0,K.jsx)(`button`,{className:`btn ${e.name===m?`soft`:`ghost`}`,onClick:()=>v(e.name),title:e.blurb||e.tagline||e.name,children:(0,K.jsx)(`span`,{style:{textTransform:`capitalize`},children:e.name})},e.name))})]}),(0,K.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,K.jsx)(`div`,{className:`card-head`,children:(0,K.jsx)(`h3`,{children:`2 · Install mode`})}),(0,K.jsxs)(`p`,{className:`sub mb-16`,children:[`A `,(0,K.jsx)(`code`,{children:`-global`}),` mode deploys once to that tool's global config, so every repo on this machine inherits the harness (recommended). A project mode installs into the repository folder you choose.`]}),(0,K.jsxs)(`label`,{className:`stack`,style:{gap:6,maxWidth:360},children:[(0,K.jsx)(`span`,{className:`tick`,children:`Mode`}),(0,K.jsx)(`select`,{className:`sel`,value:_,onChange:e=>y(e.target.value),children:h.map(e=>(0,K.jsxs)(`option`,{value:e.name,children:[e.name,e.desc?` · ${e.desc}`:``]},e.name))})]}),b&&(0,K.jsxs)(`div`,{className:`row gap-10`,style:{maxWidth:560,marginTop:12},children:[(0,K.jsx)(`input`,{className:`inp`,style:{flex:1},type:`text`,placeholder:`/path/to/project, or click Browse…`,value:c,onChange:e=>l(e.target.value),"aria-label":`Project folder to install into`}),(0,K.jsx)(`button`,{className:`btn ghost sm`,disabled:f,onClick:async()=>{p(!0),d(``);try{let e=await a.pickFolder();e.path?l(e.path):e.error&&d(e.error)}catch(e){d(e.message)}finally{p(!1)}},children:f?`Choosing…`:`Browse…`})]}),u&&(0,K.jsx)(`p`,{className:`sub`,style:{marginTop:12},children:u})]}),(0,K.jsxs)(`button`,{className:`btn btn-grid`,disabled:!m||!_||b&&!c.trim(),onClick:()=>{if(!b)return e(`build`,{theme:m,emit:_});let t=c.trim();return t?(d(``),e(`deploy`,{host:_,path:t,theme:m})):d(`Choose or type the project folder to install into.`)},children:[(0,K.jsx)(q,{name:`build`}),`Deploy harness`]})]})}function Mr(e){return W(()=>Promise.resolve().then(()=>a.installs()).catch(()=>null),[e],`installs`)}function Nr(e){let{data:t,loading:n}=Mr(e);return n&&!t?null:ln(t?.installs)}var Pr=e=>`geneseed-install-${e}`;function Fr(e,t){try{localStorage.setItem(Pr(e),t)}catch{}}function Ir(e){try{let t=localStorage.getItem(Pr(e))||``;return localStorage.removeItem(Pr(e)),t}catch{return``}}function Lr(e,t){let[n,r]=H(Pr(e),e=>e||null);return[(t||[]).find(e=>e.id===n)||t?.[0]||null,e=>r(e.id)]}function Rr(e,t){let{data:n,loading:r}=Mr(t),[i,a]=(0,V.useState)(null);n&&n!==i&&a(n);let o=n??i,s=r&&!o?null:ln(o?.installs),c=s===null?null:s.length?s:[null],{data:l,reload:u}=W(()=>c?Promise.allSettled(c.map(t=>e(un(t)))).then(e=>{let t=e.flatMap((e,t)=>e.status===`fulfilled`?[{inst:c[t],data:e.value}]:[]),n=t.map(e=>e.data.path);return{sets:t.filter((e,t)=>n.indexOf(e.data.path)===t),failed:c.filter((t,n)=>e[n].status===`rejected`),reason:e.find(e=>e.status===`rejected`)?.reason??null}}):Promise.resolve(null),[t,c?c.map(e=>e?.id??``).join(`|`):null]);return{targets:c,sets:l?.sets??null,failed:l?.failed??[],reason:l?.reason,reload:u}}var zr=(e,t)=>W(()=>a.rules(t).catch(()=>null),t?[e,t.host,t.path]:[e],`rules`,{revalidate:!0}),Br=()=>jt(`rules`);function Vr({eyebrow:e,title:t,sub:n,primary:r,actions:i,crumbs:a}){return(0,K.jsxs)(`div`,{className:`page-head`,children:[(0,K.jsxs)(`div`,{children:[a?.length?(0,K.jsx)(`nav`,{"aria-label":`Breadcrumb`,className:`page-crumbs`,children:(0,K.jsx)(`ol`,{children:a.map((e,t)=>(0,K.jsx)(`li`,{children:t===a.length-1?(0,K.jsx)(`span`,{"aria-current":`page`,children:e.label}):e.href?(0,K.jsx)(`a`,{href:e.href,children:e.label}):e.label},t))})}):null,e?(0,K.jsx)(`div`,{className:`eyebrow`,children:e}):null,(0,K.jsx)(`h1`,{className:`h`,children:t}),n?(0,K.jsx)(`p`,{className:`sub`,children:n}):null]}),r||i?(0,K.jsxs)(`div`,{className:`page-actions`,children:[i,r]}):null]})}function Hr({segments:e,value:t,max:n,size:r=120,stroke:i=12,label:a,sweepMs:o=E[9]}){let s=n>0?n:0,c=e||[{key:`v`,label:a,n:Math.min(Math.max(t||0,0),s),tone:`accent`}],l=e?c.reduce((e,t)=>e+t.n,0):s,u=e?c.map(e=>`${e.label}: ${e.n} of ${l}`).join(`, `):`${c[0].n} of ${l}`,d=r/2-i/2,f=r/2,p=e=>[f+d*Math.cos(e),f+d*Math.sin(e)],m=[],h=0;for(let e of c)m.push(h),h+=e.n;let g=(0,V.useRef)(null),_=c.map(e=>e.n).join(`,`);return(0,V.useLayoutEffect)(()=>{let e=g.current?.querySelectorAll(`path.ring-arc`);if(!o||!e?.length||!w())return;let t=c.map(e=>e.n/l).filter(e=>e>0),n=t.map((e,n)=>t.slice(0,n).reduce((e,t)=>e+t,0)),r=le(e);T(r,{draw:`0 0`});let i=S(r,{draw:[`0 0`,`0 1`],duration:(e,n)=>Math.max(o*t[n],E[1]),delay:(e,t)=>o*n[t],ease:`linear`});return y(i,o)},[_,o]),(0,K.jsxs)(`svg`,{className:`ring`,width:r,height:r,viewBox:`0 0 ${r} ${r}`,role:`img`,"aria-label":a?`${a}: ${u}`:u,children:[(0,K.jsx)(`circle`,{className:`ring-track`,cx:f,cy:f,r:d,fill:`none`,strokeWidth:i}),(0,K.jsx)(`g`,{ref:g,children:l>0?c.map((e,t)=>{let n=e.n/l;if(!(n>0))return null;let r=m[t]/l*2*Math.PI-Math.PI/2,a=r+n*2*Math.PI,[o,s]=p(r),[c,u]=p(a),h=n>=.9999?`M ${o} ${s} A ${d} ${d} 0 1 1 ${2*f-o} ${2*f-s} A ${d} ${d} 0 1 1 ${o} ${s}`:`M ${o} ${s} A ${d} ${d} 0 ${+(n>.5)} 1 ${c} ${u}`;return(0,K.jsx)(`path`,{className:`ring-arc tone-${e.tone||`muted`}`,d:h,fill:`none`,strokeWidth:i,children:(0,K.jsxs)(`title`,{children:[e.label,`: `,e.n]})},e.key)}):null})]})}var Ur=E[8];function Wr({parts:e,total:t,label:n,legend:r=!0}){let i=e.reduce((e,t)=>e+t.n,0),a=t??i,o=e=>a>0?`${e/a*100}%`:`0%`,s=e.map(e=>`${e.label}: ${e.n} of ${a}`).join(`, `),c=(0,V.useRef)(null),l=e.map(e=>e.n).join(`,`)+`/${a}`;return(0,V.useLayoutEffect)(()=>{if(c.current&&w())return T(c.current,{scaleX:0}),y(S(c.current,{scaleX:[0,1],duration:Ur,ease:A}),Ur)},[l]),(0,K.jsxs)(`div`,{className:`stackbar-box`,children:[(0,K.jsx)(`div`,{className:`stackbar sweep`,role:`img`,"aria-label":n?`${n}: ${s}`:s,ref:c,children:e.map(e=>e.n>0?(0,K.jsx)(`span`,{className:`tone-${e.tone||`muted`}`,style:{width:o(e.n)},title:`${e.label}: ${e.n}`},e.key):null)}),r&&(0,K.jsx)(`ul`,{className:`stackbar-legend`,"aria-hidden":`true`,children:e.map(e=>(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`i`,{className:`tone-${e.tone||`muted`}`}),e.label,` `,(0,K.jsx)(`span`,{className:`mono`,children:e.n})]},e.key))})]})}function Gr({value:e,max:t,label:n=`value`,tone:r=`accent`}){let i=t>0?t:0;return(0,K.jsx)(Wr,{parts:[{key:`v`,label:n,n:Math.min(Math.max(e||0,0),i),tone:r}],total:i,legend:!1})}var Kr=864e5;function qr(e,t=10,n=`today`){let r=Array(t).fill(0).map((e,r)=>({t:r===t-1?n:`${t-1-r}d`,v:0})),i=e=>new Date(e).setHours(0,0,0,0),a=i(Date.now());for(let n of e){let e=n.started||n.finished||n.created||n.ts;if(!e)continue;let o=typeof e==`string`?Date.parse(e):e*1e3;if(!Number.isFinite(o))continue;let s=Math.round((a-i(o))/Kr);s<0||s>=t||(r[t-1-s].v+=1)}return r}var Jr=(e,t)=>[...e||[]].sort((e,t)=>(t.started||0)-(e.started||0)).slice(0,t),Yr=[`--emit`,`--theme`,`--scope`],Xr={done:`✓`,failed:`✗`};function Zr(e){let t=(e.output||``).split(`
6
- `).find(e=>e.startsWith(`$ `))||``,n=t.split(/\s+/),r=[];return n.forEach((e,t)=>{let[i,a]=e.split(`=`),o=a||n[t+1];Yr.includes(i)&&o&&!o.startsWith(`--`)&&r.push(o)}),{verb:(e.action||`run`).split(/[\s(]/)[0],scope:r.join(` · `),result:Xr[e.status]||`…`,duration:e.duration?`${e.duration}s`:`—`,command:t}}var Qr={busy:{cls:`acc`,label:`working`,accent:`var(--accent)`},"waiting-input":{cls:`warn`,label:`your move`,accent:`var(--warn)`},blocked:{cls:`bad`,label:`blocked`,accent:`var(--bad)`},idle:{cls:``,label:`idle`,accent:`var(--line)`}},$r={cls:``,label:`ended`};function ei(e){if(!e)return``;let t=e.replace(/\\/g,`/`).replace(/\/+$/,``).split(`/`);return t[t.length-1]||e}var ti=e=>e?e<1e3?String(e):e<1e5?(e/1e3).toFixed(1)+`k`:e<1e6?(e/1e3).toFixed(0)+`k`:(e/1e6).toFixed(1)+`M`:`0`;function ni(e){if(e=Math.max(0,Math.floor(e)),e<60)return`${e}s`;let t=Math.floor(e/60);return t<60?`${t}m ${e%60}s`:`${Math.floor(t/60)}h ${t%60}m`}function ri({startedAt:e}){let[t,n]=(0,V.useState)(()=>Date.now()/1e3);return(0,V.useEffect)(()=>{let e=setInterval(()=>n(Date.now()/1e3),1e3);return()=>clearInterval(e)},[]),ni(t-e)}function ii({done:e,total:t}){let n=Math.min(t,10),r=Math.min(n,Math.round(e/t*n));return(0,K.jsxs)(`span`,{className:`act-todo`,children:[(0,K.jsx)(`span`,{className:`on`,children:`●`.repeat(r)}),(0,K.jsx)(`span`,{className:`dim`,children:`○`.repeat(n-r)})]})}var ai=e=>e.ended?null:e.turn_started_at,oi=e=>!!(e.tokens>0||e.cost>0||ai(e)||e.files?.count>0);function si({s:e,heading:t,id:n,children:r}){let i=e.ended?$r:Qr[e.status]||Qr.idle,a=e.files,o=oi(e),s=e=>n?`${n}-${e}`:void 0;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`row between wrap gap-12`,children:[t?(0,K.jsxs)(`div`,{className:`row gap-10 act-min`,children:[(0,K.jsx)(`span`,{className:`feed-dot act-dot ${e.ended?``:i.cls||`acc`}`}),(0,K.jsxs)(`div`,{className:`act-min`,children:[(0,K.jsx)(`h2`,{className:`act-title`,id:s(`t`),children:t}),e.cwd&&(0,K.jsx)(`div`,{className:`dim mono act-cwd`,title:e.cwd,children:e.cwd})]})]}):null,(0,K.jsxs)(`div`,{className:`row gap-8 act-fixed`,children:[e.model&&(0,K.jsx)(`span`,{className:`badge mono`,title:`model`,children:e.model}),e.agent&&(0,K.jsx)(`span`,{className:`badge`,children:e.agent}),(0,K.jsxs)(`span`,{className:`badge ${i.cls}`,id:s(`st`),children:[(0,K.jsx)(`span`,{className:`dot`}),i.label]}),r]})]}),e.phase&&(0,K.jsxs)(`div`,{className:`row gap-8 act-phase`,children:[(0,K.jsx)(q,{name:`activity`}),(0,K.jsx)(`span`,{className:`act-ell`,title:e.phase,children:e.phase})]}),o&&(0,K.jsxs)(`div`,{className:`row wrap act-counters`,id:s(`c`),children:[e.tokens>0&&(0,K.jsxs)(`span`,{children:[ti(e.tokens),` tok`]}),e.cost>0&&(0,K.jsxs)(`span`,{children:[`$`,e.cost.toFixed(2)]}),ai(e)?(0,K.jsx)(`span`,{children:(0,K.jsx)(ri,{startedAt:e.turn_started_at})}):null,a&&a.count>0&&(0,K.jsxs)(`span`,{children:[a.count,` file`,a.count===1?``:`s`,` `,(0,K.jsxs)(`span`,{className:`t-good`,children:[`+`,a.additions]}),` `,(0,K.jsxs)(`span`,{className:`t-bad`,children:[`−`,a.deletions]})]})]}),(e.error||e.blocked_on)&&(0,K.jsx)(`div`,{className:`act-err-row`,children:(0,K.jsx)(`span`,{className:`badge bad act-ell`,title:e.error||e.blocked_on,children:e.error||e.blocked_on})})]})}var ci=e=>e?.status===`blocked`||e?.status===`waiting-input`,li=864e5,ui=e=>new Date(e).toISOString().slice(0,10),di=(e,t)=>new Date(`${e}T00:00:00Z`).toLocaleDateString(`en-GB`,{...t,timeZone:`UTC`}),fi=e=>di(e,{day:`numeric`,month:`short`});function pi(e,t=Date.now()){let n=di(e,{weekday:`long`,day:`numeric`,month:`long`}),r=e===ui(t)?`Today`:e===ui(t-li)?`Yesterday`:``;return r?`${r} · ${n}`:n}function mi(e,{now:t=Date.now(),days:n=14,cap:r}={}){let i=(e||[]).filter(e=>Number.isFinite(e.started)),a={};for(let e of i){let t=ui(e.started*1e3);a[t]=(a[t]||0)+1}let o=i.length?ui(Math.min(...i.map(e=>e.started))*1e3):null,s=i.filter(e=>e.status!==`running`).length,c=typeof r!=`number`||s>=r;return Array.from({length:n},(e,r)=>{let i=ui(t-(n-1-r)*li);return{key:i,n:a[i]||0,nodata:c&&(o===null||i<o)}})}var hi=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function gi(e,t,n,r=Date.now()){let i={},a=e=>i[e]||={key:e,runs:[],asks:[]};for(let t of Jr(e,(e||[]).length))Number.isFinite(t.started)&&a(ui(t.started*1e3)).runs.push(t);return(n||[]).forEach((e,n)=>{for(let r of t||[])r.per_day?.[n]>0&&a(e).asks.push([r.name,r.per_day[n]])}),Object.values(i).sort((e,t)=>e.key<t.key?1:-1).map(({key:e,runs:t,asks:n})=>{n.sort((e,t)=>t[1]-e[1]);let i=n.reduce((e,t)=>e+t[1],0),a=n.map(([e,t],n)=>`${e}${n?``:` asked`} ${t}×`).join(`, `),o=[t.length&&hi(t.length,`run`),i&&hi(i,`gate ask`)];return{key:e,title:pi(e,r),sum:o.filter(Boolean).join(` · `),runs:t,gate:i?{title:a,n:i}:null}})}var _i=E[8];function vi({vals:e,i:t,sweep:n=!1,fill:r=!1}){let i=(0,V.useRef)(null),a=e.join(`,`);(0,V.useLayoutEffect)(()=>{if(n&&i.current&&w())return T(i.current,{strokeDasharray:1,strokeDashoffset:1}),y(S(i.current,{strokeDashoffset:[1,0],duration:_i,ease:A}),_i)},[a,n]);let o=Math.max(1,...e),s=96/(e.length-1),c=e.map((e,t)=>`${(t*s).toFixed(1)},${(20-e/o*17).toFixed(1)}`),[l,u]=c[c.length-1].split(`,`),d=(0,K.jsxs)(`svg`,{className:`spark`,viewBox:`0 0 96 22`,preserveAspectRatio:r?`none`:void 0,"aria-hidden":`true`,style:{"--i":t},children:[(0,K.jsx)(`polyline`,{points:`0,21 96,21`,className:`spk-base`}),(0,K.jsx)(`polygon`,{className:`spk-area`,points:`0,21 ${c.join(` `)} 96,21`}),(0,K.jsx)(`polyline`,{className:`spk-line`,pathLength:`1`,points:c.join(` `),ref:i}),r?null:(0,K.jsx)(`circle`,{className:`spk-end`,cx:l,cy:u,r:`2.4`})]});return r?(0,K.jsxs)(`span`,{className:`spark-fill`,style:{"--i":t},children:[d,(0,K.jsx)(`i`,{className:`spk-end`,"aria-hidden":`true`,style:{top:`${u/22*100}%`}})]}):d}function yi(e,t){let n=(0,V.useRef)(null);return(0,V.useLayoutEffect)(()=>{let e=n.current?[...n.current.querySelectorAll(`[data-sweep]`)]:[];if(e.length&&w())return T(e,{[t]:0}),y(S(e,{[t]:[0,1],duration:_i,ease:A}),_i)},[e,t]),n}var X={security:`oklch(0.74 0.085 45)`,verify:`oklch(0.78 0.075 200)`,process:`oklch(0.76 0.075 150)`,craft:`oklch(0.78 0.085 95)`,context:`oklch(0.74 0.08 280)`,comms:`oklch(0.76 0.085 345)`},bi={security:{label:`Security`,c:X.security},verify:{label:`Verification`,c:X.verify},process:{label:`Process`,c:X.process},craft:{label:`Craft`,c:X.craft},context:{label:`Context`,c:X.context},comms:{label:`Communication`,c:X.comms}},xi={craft:X.craft,rigor:X.verify,ops:X.process,process:X.security,comms:X.comms},Si=e=>xi[e]||`var(--text-3)`,Ci={design:{label:`Design`,c:X.context},build:{label:`Build`,c:X.craft},review:{label:`Review`,c:X.security},ship:{label:`Ship`,c:X.process},understand:{label:`Understand`,c:X.verify},learn:{label:`Learn`,c:X.comms},harness:{label:`Harness`,c:`oklch(0.76 0.07 250)`},personal:{label:`Custom`,c:`oklch(0.72 0.025 250)`}},wi=Object.keys(Ci);function Ti(e){let t=String(e||``),n=/\(retired\)\s*$/i.test(t);t=t.replace(/\s*\(retired\)\s*$/i,``),t=t.replace(/^(?:Rule\s+[IVXLCDM\d]+|Doctrine\s+[a-z]+\s+\d+)\s*[—-]\s*/i,``);let r=t.indexOf(` · `);return r===-1?{latin:``,name:t.trim(),retired:n}:{latin:t.slice(0,r).trim(),name:t.slice(r+3).trim(),retired:n}}var Ei=[[10,`X`],[9,`IX`],[5,`V`],[4,`IV`],[1,`I`]],Di=e=>{let t=``;for(let[n,r]of Ei)for(;e>=n;)t+=r,e-=n;return t};function Oi(e){let t=/^([a-z]+)-(\d+)$/.exec(String(e));return t?t[1]===`law`?Di(Number(t[2])):`${t[1]}.${t[2]}`:String(e)}function ki(e){if(ji[e])return ji[e].label;let t=/^([a-z]+)\.(\d+)$/.exec(e);return t?`${t[1][0].toUpperCase()}${t[1].slice(1)} rule ${t[2]}`:/^[IVXLC]+$/.test(e)?`Rule ${e}`:e}var Ai=new Set([`I`,`III`,`IV`,`process.1`,`process.5`,`rigor.5`,`ops.2`]),ji={I:{key:`secretsGate`,label:`Secrets gate`},III:{key:`doneGate`,label:`Done gate`},IV:{key:`deletionGate`,label:`Deletion gate`},VIII:{key:`testNote`,label:`Test note`},ownership:{key:`ownershipGate`,label:`Ownership gate`},"rigor.5":{key:`externalGate`,label:`External gate`}},Mi=new Set([`process.1`,`process.5`,`ops.2`]),Ni=new Set([...Ai].filter(e=>e.includes(`.`)&&!Mi.has(e)&&!ji[e])),Pi={I:{arm:`Writes that would carry a credential-shaped string are refused again.`,off:`A write carrying a credential-shaped string (on OpenCode, also a write to a key file) stops being refused. Rule I’s text still binds the agent; protected checks, real data loss and commit/push consent stay gated.`},III:{arm:`A turn that edited files cannot end before the checks in a non-empty .geneseed/done-checks.txt pass. With no such file, inferred checks only warn.`,off:`A turn that edited files may end without its checks passing, listed or inferred, and the session’s done-gate line goes. Rule III’s text still binds the agent; every other gate stays.`},IV:{arm:`Commands that would lose data nothing else holds ask again.`,off:`Commands that would really lose data — discarding uncommitted work, deleting an unpushed branch, removing untracked files — stop asking. Rule IV’s text still binds the agent; secrets, root-wide scans and commit/push consent stay gated.`},VIII:{arm:`A write that weakens a test gets a note again, when it happens and when the turn ends.`,off:`A write that adds a skip marker or drops an assertion gets no note, when it happens or when the turn ends. Rule VIII’s text still binds the agent; the done checks and every other gate stay. Run geneseed rebuild-all first: an older hook shim refuses the new flag, and every gate on that hook goes silent.`},ownership:{desc:`Stops the first write in an undecided application, once per session.`,arm:`The first write in an undecided application stops once again.`,off:`The first write in an undecided application is no longer stopped, the setup proposal leaves the install’s AGENT.md, and no decline reminder prints. A repo with mode: on still runs its checkpoints, and the Credo section still binds.`},"rigor.5":{arm:`Writes to a protected check or a gate’s own configuration ask again.`,off:`Writes to a protected check or a gate’s own configuration stop asking. The agent can then edit hook settings and AGENT.md gate markers unasked, so every other gate holds only while it leaves its wiring alone. OpenCode’s own permission.edit keys still ask. The rule’s text is not touched: excluding it is the rule’s own switch. Run geneseed rebuild-all first: an older hook shim refuses the new flag, and every gate on that hook goes silent.`}},Fi={I:{on:`A file write (Write, Edit, NotebookEdit) whose new text holds a credential-shaped string: an AWS access key, a GitHub, Anthropic or Slack token, a private-key block. Files named .env* are exempt.`,hosts:`Claude Code and OpenClaude ask you. Bob refuses the write. OpenCode refuses it, and also refuses a write to a key file, such as *.pem, *.key, id_rsa, .ssh/ or .npmrc; on .env* it only warns.`,blind:`Text written by a shell command is not scanned, and other token formats pass.`,off:`The scan stops on every host, OpenCode’s key-file block too. Rule I’s text still binds.`},III:{on:`The end of a turn that edited files under the git root with a file-write tool. It reads the turn’s shell calls in the transcript and never runs a check itself.`,hosts:`Claude Code and OpenClaude: with checks listed in .geneseed/done-checks.txt, the turn cannot end until each one ran unpiped and passed after the last edit (one block per turn). With no list, checks are inferred from the manifests and only warn. OpenCode 1: a reminder on the next request. OpenCode 2 and Bob: not judged.`,blind:`A shell edit (sed -i, a redirect) is no edit here. A check that is piped, masked (|| true) or spelled another way (npx vitest) reads as not run.`,off:`No check at turn end, no done-gate line at start, and no weakened-test line at turn end; learning still runs. Rule III’s text still binds.`},IV:{on:`A shell command that would lose data nothing else holds, judged against the repo’s state: a protected branch deleted or force-pushed, an unpushed branch deleted, reset --hard over unpushed commits, uncommitted work discarded, a stash dropped, the reflog pruned, files git cannot restore removed. Also rm -rf of /, a drive or ~, mkfs, dd over a disk, format, a fork bomb.`,hosts:`Claude Code and OpenClaude ask you. Bob and OpenCode’s guard refuse. OpenCode’s own prompt also asks on git reflog expire, git gc --prune, and a force push or delete of main or master.`,blind:`It reads git, the rm family, find -delete, mkfs, dd and format: a script that deletes files itself passes. When it cannot tell (a glob, a $variable, sh -c, xargs), it asks rather than passes.`,off:`The real-loss check and OpenCode’s Rule IV prompt keys stop. The rm -rf / class still asks (refused on Bob and OpenCode). Rule IV’s text still binds.`},VIII:{on:`A file write to a test file that adds a skip marker (.skip(, xit(, xfail, @Disabled, @Ignore, pytest.mark.skip, t.Skip() or removes an assertion line and adds no other.`,hosts:`Advisory on every host: it asks nothing and blocks nothing. Claude Code and OpenClaude: a note to the agent at the edit, and a line to you at turn end. Bob: a hook-log line. OpenCode: one reminder on the next request, which the done gate’s switch also silences.`,blind:`Shell edits, and an assertion that is loosened in place rather than removed.`,off:`No note at the edit or at turn end. Rule VIII’s text still binds; the done checks stay.`},ownership:{on:`The first file write of a session in an application repo (a git root with a build manifest) whose root AGENTS.md has no ## Ownership section. Writes to AGENTS.md or .geneseed/ pass.`,hosts:`Every host refuses that write once and gives the reason to the agent, which asks you to set ownership up or skip; the next write passes. Bob uses exit 2. On Claude Code, OpenClaude and OpenCode a sub-agent never triggers it.`,blind:`Shell writes.`,off:`No first-write stop and no setup proposal. A repo with mode: on still runs its checkpoints, and the Credo section still binds.`},"process.1":{on:`A write to a rule store, user-rules.md or user-rules.draft.md, by a file tool or a parsed shell write. A hardlinked file always asks. Memory writes (MEMORY.md, memory/) pass.`,hosts:`Claude Code and OpenClaude ask you. Bob refuses a file-tool write and only warns on a shell write. OpenCode asks with its own prompt; the guard refuses what the host cannot prompt for, and OpenCode 1 refuses a parsed shell write.`,blind:`bash -c, interpreters, scripts and variables. The change report at turn end still lists store changes made outside an approved write, memory writes included.`,off:`Excluding this rule, or the process pack, is the switch: its hook goes with its text on every host, OpenCode’s permission.edit keys on the rule files too. The change report still lists rule-file changes.`},"process.5":{on:`A shell command whose text holds git, then commit or push (so git log --grep push asks too).`,hosts:`Claude Code and OpenClaude ask you; a loop’s own commits and pushes on its loop/* branch pass. OpenCode asks with its own prompt, and allows a push of HEAD to loop/*. Bob only logs a warning; the command runs.`,blind:`A commit or push made by another program, a script or an alias.`,off:`Excluding this rule, or the process pack, is the switch: commits and pushes stop asking (Bob still logs its warning). The data-loss checks stay.`},"rigor.5":{on:`A write to a path in the project’s .geneseed/protected-checks.txt, to .geneseed/done-checks.txt, or to a gate’s own configuration: hook settings, excludes.json, AGENT.md gate markers, the manifest, any opencode.json(c), the hook shim. Parsed shell writes too (>, tee, sed -i, cp, mv, rm, the PowerShell writers).`,hosts:`Claude Code and OpenClaude ask you. Bob refuses the write; a hook settings.json only when it changes Geneseed’s own entries. OpenCode asks through its permission.edit keys; its guard refuses a protected check, the other hosts’ Geneseed files, and a shell write to any of them.`,blind:`bash -c, pwsh -c, interpreters, scripts, variables and globs: run the same checks in CI.`,off:`Every ask and refusal above stops, except OpenCode’s own permission.edit keys. Excluding the text on this page switches this gate off too; --exclude-rules rigor.5 alone leaves the hook asking.`},"ops.2":{on:`A recursive scan rooted at a filesystem root: find /, du /, grep -r or rg at /, /c or C:\\, Get-ChildItem C:\\ -Recurse.`,hosts:`Claude Code and OpenClaude ask you. Bob and OpenCode refuse it.`,blind:`A deeper path, ls / without -R, a quoted argument, the remote half of ssh, and a scan made by any other program.`,off:`Excluding this rule, or the ops pack, is the switch: a root scan stops asking on every host. The data-loss checks stay.`}},Ii=[{key:`invariants`,source:`{{LAWS}}`,against:`—`},{key:`yours`,source:`user-rules.md`,against:`may tighten a {{LAW}}, never repeal one`},{key:`ethos`,source:`{{ONTOLOGY}}`,against:`never against a user rule`},{key:`doctrines`,source:`{{DOCTRINES}}`,against:`may tighten, never repeal`}],Li=[{source:`mode`,label:`Mode`,against:`binds how work runs`},{source:`PROFILE.md, posture, theme`,label:`Profile, posture, voice`,against:`inform only; never bind`}],Ri=(e,t={})=>ji[e]?t?.[ji[e].key]===!1?`Gate off`:`Hook gate`:Ai.has(e)?`Hook gate`:`Instruction`;function zi(e){let t={};for(let n of e||[]){let e=Ci[n.klass]?n.klass:`personal`,r=t[e]||(t[e]={key:e,label:Ci[e].label,ok:0,exp:0});n.status===`experimental`?r.exp+=1:r.ok+=1}let n=wi.filter(e=>t[e]).map(e=>({...t[e],n:t[e].ok+t[e].exp}));return{rows:n,total:n.reduce((e,t)=>e+t.n,0),experimental:n.reduce((e,t)=>e+t.exp,0),max:Math.max(1,...n.map(e=>e.n))}}var Z=(e,t,n=t+`s`)=>`${e} ${e===1?t:n}`;function Bi({overview:e,setup:t,rules:n,activity:r,profile:i,skills:a,laws:o}){let s=[],c=e?.doctor;c&&!c.ok&&s.push({id:`doctor`,tag:`Doctor`,tone:`bad`,title:`Doctor found ${Z(c.problems.length,`problem`)}`,detail:c.problems[0]||``,where:`installs/doctor`,verb:`Review`,href:`#/installs/doctor`});let l=e?.diff,u=Vt(l);u&&s.push({id:`drift`,tag:`Local edits`,tone:`warn`,title:Z(u,`local edit`),detail:`${l.edited} edited, ${l.added} added, ${l.missing} missing`,where:`installs/edits`,verb:`Review`,href:`#/installs/edits`}),i?.seeded&&s.push({id:`profile`,tag:`Profile`,tone:`warn`,title:`Profile is still the seeded template`,detail:`every section holds placeholder text`,where:`personal/profile`,verb:`Fill in`,href:`#/personal/profile`});let d=n?.exists?n.stats:null;d&&d.rules===0&&s.push({id:`rules`,tag:`Rules`,tone:``,title:`No standing rules yet`,detail:`≈${d.tokens.toLocaleString(`en-US`)} tokens, the file's header alone`,where:`personal/rules`,verb:`Write a rule`,href:`#/personal/rules`});let f=Object.entries(t?.gates?.asks||{}).sort((e,t)=>t[1]-e[1]);if(f.length){let[e,n]=f[0],r=Oi(e),i=(o?.items||[]).find(e=>e.name===r),a=i?Ti(i.title).name:ki(r);s.push({id:`gates`,tag:`Gates`,tone:``,title:`${a} asked ${Z(n,`time`)}`,detail:`${n} of ${t.gates.total} gate asks`,where:`constitution`,verb:`Review`,href:`#/item/law/${encodeURIComponent(r)}`})}if(a){let{rows:e,experimental:t}=zi(a.items);t&&s.push({id:`skills`,tag:`Skills`,tone:``,title:`${Z(t,`skill`)} still experimental`,detail:e.filter(e=>e.exp).sort((e,t)=>t.exp-e.exp).map(e=>`${e.label.toLowerCase()} ${e.exp}`).join(`, `),where:`library/skills`,verb:`Triage`,href:`#/skills`})}return t&&t.facts===0&&s.push({id:`memory`,tag:`Memory`,tone:``,title:`Memory holds no facts`,detail:`MEMORY.md is an empty index`,where:`personal/memory`,verb:`Open`,href:`#/personal/memory`}),r&&r.enabled===!1&&s.push({id:`activity`,tag:`Activity`,tone:``,title:`Session tracking is off`,detail:`no per-session trace is kept`,where:`activity`,verb:`Turn on`,href:`#/activity`}),s}var Vi=e=>Vt(e.drift),Hi=e=>e.drift?.stale??0;function Ui(e){let t=t=>new Set((e?.never||[]).filter(e=>e.kind===t).map(e=>e.name)).size;return{skills:t(`skill`),agents:t(`agent`)}}function Wi(e){let t=e?.installs||[],n=t.filter(e=>e.state===`active`),r=t.length-n.length,i=n.filter(e=>e.verdict===`behind`).length,a=n.reduce((e,t)=>e+Vi(t),0),o=n.reduce((e,t)=>e+Hi(t),0),s=e?.doctor,c=s&&!s.ok?`bad`:i||a||o?`warn`:s?`good`:`unknown`,l={good:`Installs healthy.`,unknown:`Checking the installs.`,warn:`Installs need a look.`,bad:`Installs have problems.`}[c],u=[Z(n.length,`active install`)+(r?`, ${r} disabled`:``),s?s.ok?`doctor clean`:`doctor found ${Z(s.problems.length,`problem`)}`:`doctor still running`,i?`${Z(i,`install`)} behind source`:`all in sync with source`,a?Z(a,`local edit`):`no local edits`];return o&&u.push(`${Z(o,`file`)} behind source`),{tone:c,head:l,facts:u}}var Gi=[[`carrier`,`Root file`],[`skills`,`Skill list`],[`agents`,`Agent list`],[`context`,`Session files`]],Ki=e=>e?e.carrier+e.skills+e.agents+e.context:0,qi=e=>e.state===`active`&&(e.verdict===`behind`||Vt(e.drift)>0||(e.drift?.stale??0)>0),Q=e=>`≈${(e/4/1e3).toFixed(1)}k`,Ji=on,Yi=.85;function Xi(e){let t=({chars:e,budget:t,cut:n})=>e+(n?t:0),n=(e||[]).filter(e=>e.session_start).reduce((e,n)=>!e||t(n.session_start)>t(e.session_start)?n:e,null);if(!n)return null;let{chars:r,budget:i,cut:a}=n.session_start;return{install:n,size:`${(r/1e3).toFixed(1)} / ${i/1e3} KB`,cut:a,near:a||r/i>=Yi}}var Zi=e=>({id:e.id,host:e.host,path:e.path,label:Ji(e)});function Qi({fleet:e,usage:t,defaultLabel:n=null,...r}){let i=[],a=e?.doctor;a&&!a.ok&&i.push({id:`doctor`,tag:`Doctor`,tone:`bad`,title:`Doctor found ${Z(a.problems.length,`problem`)}`,detail:a.problems[0]||``,where:`installs/doctor`,verb:`Review`,href:`#/installs/doctor`});for(let t of(e?.installs||[]).filter(e=>e.state===`active`)){if(t.verdict===`behind`){let e=t.built_epoch?`built ${It(t.built_epoch)} ago`:`never built`,n=Hi(t);i.push({id:`behind:${t.id}`,tag:`Behind`,tone:`warn`,title:`${Ji(t)} is behind its source`,detail:n?`${e} · ${Z(n,`file`)} behind`:e,where:J(t.host).label,verb:`Rebuild`,act:`rebuild`,installs:[Zi(t)]})}let e=Vi(t);e&&i.push({id:`drift:${t.id}`,tag:`Local edits`,tone:`warn`,title:`${Ji(t)}: ${Z(e,`local edit`)}`,detail:`${t.drift.edited} edited, ${t.drift.added} added, ${t.drift.missing} missing`,where:`installs/edits`,verb:`Review`,href:`#/installs/edits`})}if(t&&t.days_counted>=30&&t.never?.length){let{skills:e,agents:n}=Ui(t);i.push({id:`usage`,tag:`Usage`,tone:``,sugg:!0,title:`${Z(e,`skill`)} never fired in 30 days`,detail:`${Z(n,`agent`)} too`,where:`library/skills`,verb:`Triage`,href:`#/skills`})}let o=Xi(e?.installs);if(o?.near){let e=o.cut?`were cut to fit the session-start budget`:`are near the session-start budget`;i.push({id:`session-start`,tag:`Session`,tone:`warn`,sugg:!0,title:o.install.shared?`Session files ${e}`:`${Ji(o.install)}: session files ${e}`,detail:`${o.size} · without project context`,where:`personal`,verb:`Trim`,href:`#/personal`})}let s=(e?.installs||[]).filter(e=>e.state===`active`);s.some(e=>e.shared&&e.facts===0)&&i.push({id:`memory:shared`,tag:`Memory`,tone:``,sugg:!0,title:`Memory holds no facts`,detail:`no durable lesson recorded yet`,where:`personal/memory`,verb:`Open`,href:`#/personal/memory`});for(let e of s.filter(e=>!e.shared&&e.facts===0))i.push({id:`memory:${e.id}`,tag:`Memory`,tone:``,sugg:!0,title:`${Ji(e)}: memory holds no facts`,detail:`no durable lesson recorded yet`,where:`personal/memory`,verb:`Open`,href:`#/personal/memory`});let c=Bi({...r,overview:r.overview&&{...r.overview,doctor:null,diff:null},setup:s.some(e=>e.facts!=null)&&r.setup?{...r.setup,facts:null}:r.setup}),l=new Set([`profile`,`rules`]);for(let e of c){let t=n&&l.has(e.id)&&!r[e.id]?.shared?{title:`${n}: ${e.title}`}:{};i.push({...e,...t,sugg:!0})}return i}function $i(e,t){return(e?.rules||[]).map(e=>{let n=Oi(e.rule),r=(t?.items||[]).find(e=>e.name===n);return{...e,name:r?Ti(r.title).name:e.rule===`wiki`?`Wiki guard`:ki(n)}})}var ea=e=>(e||[]).filter(e=>e.state===`active`&&e.cost);function ta(e){let t=ea(e).filter(e=>e.cost.ceiling>0&&Number.isFinite(e.cost.carrier)),n=e=>e.cost.carrier/e.cost.ceiling,r=t.reduce((e,t)=>!e||n(t)>n(e)?t:e,null);if(!r)return null;let{carrier:i,ceiling:a}=r.cost;return{label:on(r),carrier:i,ceiling:a,pct:Math.round(n(r)*100)}}function na(e){let t=ea(e);if(!t.length)return null;let n=t.reduce((e,t)=>Ki(t.cost)>Ki(e.cost)?t:e),r=t.map(e=>Ki(e.cost));return{min:Math.min(...r),max:Math.max(...r),top:n}}var ra=e=>(e?.per_day||[]).reduce((e,t)=>e+t,0);function ia(e,t){let n=$i(e,t),r=n.reduce((e,t)=>e+t.n,0),i=n.reduce((e,t)=>!e||t.n>e.n?t:e,null),a=[];for(let e of n)(e.per_day||[]).forEach((e,t)=>{a[t]=(a[t]||0)+e});return{total:r,top:i?{name:i.name,n:i.n}:null,perDay:a}}var aa=e=>e.catch(()=>null),oa=e=>e.loading&&!e.data,sa=e=>!e.loading&&!e.data,ca=e=>{let t=e.currentTarget.closest(`section`);t&&(t.setAttribute(`tabindex`,`-1`),t.focus())};function la({what:e,read:t,retry:n=!0}){let r=t.error?`${e} could not be read: ${t.error}`:`${e} could not be read.`;return n?(0,K.jsxs)(`div`,{className:`error-state`,children:[(0,K.jsx)(yr,{error:r}),(0,K.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Retry: ${e.toLowerCase()}`,onClick:e=>{ca(e),t.reload()},children:`Retry`})]}):(0,K.jsx)(yr,{error:r,role:null})}var ua=e=>Promise.resolve().then(e),da=(e,t)=>`${t?Math.min(100,e/t*100):0}%`,fa=36e5,pa=5e3,ma=`This checkout cannot pull: it has local changes, a detached HEAD, no upstream or a diverged branch.`;function ha({update:e,onAction:t,canFill:n=!0}){if(!e)return null;let r=e.install??(e.git?`git`:`npm-global`),i=r===`git`&&typeof e.behind==`number`?e.behind:null,a=r===`git`&&e.behind===null&&e.checking,o=i===null?e.latest===null||a?(0,K.jsxs)(`span`,{className:`mono dim ver-chip`,children:[e.current??``,` · `,e.checking?`checking…`:`update check unavailable`]}):e.available?(0,K.jsxs)(`span`,{className:`mono ver-chip`,children:[e.current,` `,(0,K.jsxs)(`span`,{className:`ver-new`,children:[e.latest,` available`]})]}):(0,K.jsxs)(`span`,{className:`mono dim ver-chip`,children:[e.current,` · latest`]}):i>0?(0,K.jsxs)(`span`,{className:`mono ver-chip`,children:[e.current??``,` `,(0,K.jsxs)(`span`,{className:`ver-new`,children:[i,` commit`,i===1?``:`s`,` to pull`]})]}):(0,K.jsxs)(`span`,{className:`mono dim ver-chip`,children:[e.current??``,` · latest`]});if(r===`other`)return!e.available||!e.command?o:(0,K.jsxs)(K.Fragment,{children:[o,(0,K.jsxs)(`span`,{className:`dim`,children:[`update with `,(0,K.jsx)(`code`,{className:`mono`,children:e.command})]})]});if(e.behind===!1&&e.available)return(0,K.jsx)(`span`,{title:ma,children:o});if(a||e.behind===!1||r!==`git`&&!e.available)return o;let s=i===null?!!e.available:i>0;return(0,K.jsxs)(K.Fragment,{children:[o,(0,K.jsx)(`button`,{type:`button`,className:s&&n?`btn`:`btn ghost`,title:r===`git`?i===0?`Nothing to pull: this is the latest. Pulls and rebuilds every install anyway.`:`git pull, then rebuild every install`:`npm install -g geneseed@latest, then rebuild every install`,onClick:()=>t(`update`),children:`Update`})]})}var ga={good:`M8 12.5l2.7 2.7L16 9.5M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18z`,warn:`M12 3 22 20H2zM12 10v4M12 17v.5`,bad:`M9 9l6 6M15 9l-6 6M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18z`,unknown:`M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18z`};function _a({tone:e}){return(0,K.jsx)(`svg`,{className:`health-ico`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:ga[e]||ga.warn})})}function va({fleet:e,error:t,behind:n,onAction:r,onRebuild:i}){let a=(0,K.jsx)(`button`,{type:`button`,className:`btn ghost ldg-doctor`,onClick:()=>r(`doctor`),children:`Run doctor`});if(!e)return t?(0,K.jsxs)(`section`,{className:`health unknown`,"aria-labelledby":`ldg-health`,children:[(0,K.jsx)(_a,{tone:`warn`}),(0,K.jsx)(`div`,{className:`health-text`,role:`status`,children:(0,K.jsx)(`h2`,{id:`ldg-health`,children:`Status unknown`})}),(0,K.jsx)(`div`,{className:`health-acts`,children:a})]}):(0,K.jsx)(`div`,{className:`health unknown`,"aria-busy":`true`,children:(0,K.jsx)(Y,{label:`Reading the installs…`})});let o=Wi(e),s=[...o.facts,...e.version?[`Source is ${e.version}`]:[]];return(0,K.jsxs)(`section`,{className:`health ${o.tone}`,"aria-labelledby":`ldg-health`,children:[(0,K.jsx)(_a,{tone:o.tone}),(0,K.jsxs)(`div`,{className:`health-text`,role:`status`,children:[(0,K.jsx)(`h2`,{id:`ldg-health`,children:o.head}),(0,K.jsxs)(`p`,{className:`health-facts`,children:[s.join(` · `),`.`]})]}),(0,K.jsxs)(`div`,{className:`health-acts`,children:[a,n.length?(0,K.jsxs)(`button`,{type:`button`,className:`btn`,title:`Rebuilds ${n.map(e=>e.label).join(`, `)}`,onClick:()=>i(n),children:[`Rebuild all behind (`,n.length,`)`]}):null]})]})}function ya({chars:e}){let t=D(e);return(0,K.jsxs)(`span`,{className:`mono`,children:[Q(t??e),` tok`]})}var ba=e=>Math.round(e/4),xa={carrier:`accent`,skills:`skill`,agents:`agent`,context:`context`},Sa=e=>Gi.map(([t,n])=>({key:t,label:n,n:ba(e[t]),tone:xa[t]})),Ca=on;function wa({cost:e,i:t}){let n=2*Math.PI*14,r=e.ceiling?Math.min(1,e.carrier/e.ceiling):0;return(0,K.jsxs)(`svg`,{className:`ldg-ring`,viewBox:`0 0 36 36`,"aria-hidden":`true`,children:[(0,K.jsx)(`circle`,{className:`bg`,cx:`18`,cy:`18`,r:14}),(0,K.jsx)(`circle`,{className:`fg`+(e.ceiling&&e.carrier>e.ceiling?` over`:``),cx:`18`,cy:`18`,r:14,strokeDasharray:n.toFixed(2),strokeDashoffset:(n*(1-r)).toFixed(2),style:{"--circ":n.toFixed(2),"--i":t}})]})}function Ta({id:e,title:t,aside:n,className:r=``,children:i}){return(0,K.jsxs)(`section`,{className:`panel ldg-kpi ${r}`,"aria-labelledby":e,children:[(0,K.jsxs)(`div`,{className:`ldg-kpi-head`,children:[(0,K.jsx)(`h3`,{id:e,children:t}),n]}),i]})}var Ea=(0,K.jsx)(`p`,{className:`dim`,children:`The installs could not be read.`});function Da({installs:e,pending:t,failed:n}){let r=ta(e);return(0,K.jsx)(Ta,{id:`ldg-k-root`,title:`Root file vs ceiling`,className:`ldg-kpi-root`,children:t?(0,K.jsx)(Y,{}):n?Ea:r?(0,K.jsxs)(`div`,{className:`ldg-kpi-ring`,children:[(0,K.jsxs)(`span`,{className:`ldg-ringbox`,children:[(0,K.jsx)(Hr,{value:ba(r.carrier),max:ba(r.ceiling),segments:r.pct>100?[{key:`v`,label:`root file`,n:ba(r.carrier),tone:`bad`}]:void 0,size:104,stroke:10,label:`Worst root file: ${r.label}, ${r.pct} percent of its ceiling`}),(0,K.jsxs)(`span`,{className:`mono ldg-ring-pct`,"aria-hidden":`true`,children:[r.pct,`%`]})]}),(0,K.jsxs)(`span`,{className:`ldg-kpi-stack`,children:[(0,K.jsx)(`span`,{className:`mono ldg-kpi-fig`,children:`${Q(r.carrier)} tokens`}),(0,K.jsx)(`span`,{className:`dim`,children:`of ${Q(r.ceiling)} ceiling`}),(0,K.jsx)(`span`,{className:`dim`,title:r.label,children:`Highest install`})]})]}):(0,K.jsx)(`p`,{className:`dim`,children:`No root file to measure.`})})}function Oa({installs:e,pending:t,failed:n}){let r=na(e),i=Xi(e),a=r&&(Q(r.min)===Q(r.max)?Q(r.max):`${Q(r.min)} – ${Q(r.max)}`);return(0,K.jsx)(Ta,{id:`ldg-k-cost`,title:`Loaded every turn`,className:`ldg-kpi-cost`,children:t?(0,K.jsx)(Y,{}):n?Ea:r?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`ldg-kpi-stack`,children:[(0,K.jsx)(`span`,{className:`mono ldg-kpi-fig`,children:`${Q(Ki(r.top.cost))} tokens`}),(0,K.jsx)(`span`,{className:`dim`,title:Ca(r.top),children:`Highest install`})]}),(0,K.jsx)(Wr,{parts:Sa(r.top.cost),label:`Loaded every turn, ${Ca(r.top)}`}),(0,K.jsx)(`span`,{className:`dim ldg-kpi-cap`,children:`All installs: ${a} tokens`}),i?(0,K.jsx)(`span`,{className:`ldg-kpi-cap ${i.near?`t-warn`:`dim`}`,children:`Session start · ${i.size} · without project context`}):null]}):(0,K.jsx)(`p`,{className:`dim`,children:`No install has a root file to measure.`})})}function ka({usage:e,read:t,pending:n}){let r=e?.enabled?e.days_counted<30&&e.since?`since ${e.since}`:`30 days`:null;return(0,K.jsx)(Ta,{id:`ldg-k-calls`,title:`Skill and agent calls`,className:`ldg-kpi-calls`,aside:r?(0,K.jsx)(`span`,{className:`mono dim ldg-kpi-aside`,children:r}):null,children:n?(0,K.jsx)(Y,{}):e?e.enabled?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`mono ldg-kpi-fig`,children:(0,K.jsx)(j,{value:ra(e)})}),e.per_day?.length>1?(0,K.jsx)(vi,{vals:e.per_day,i:0,fill:!0}):null]}):(0,K.jsx)(`p`,{className:`dim`,children:`Usage counting is off on this machine.`}):(0,K.jsx)(la,{what:`Usage`,read:t})})}function Aa({gates:e,laws:t,read:n,pending:r}){let i=ia(e,t);return(0,K.jsx)(Ta,{id:`ldg-k-gates`,title:`Gate asks · 30 days`,className:`ldg-kpi-gates`,aside:(0,K.jsx)(`a`,{className:`ldg-kpi-aside`,href:`#/laws`,"aria-label":`Open the Constitution`,children:`Constitution →`}),children:r?(0,K.jsx)(Y,{}):e?i.total?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`ldg-kpi-line`,children:[(0,K.jsx)(`span`,{className:`mono ldg-kpi-fig`,children:i.total}),` `,(0,K.jsx)(`span`,{className:`dim`,children:`· ${i.top.name} ${i.top.n}`})]}),i.perDay.length>1?(0,K.jsx)(vi,{vals:i.perDay,i:1,fill:!0}):null]}):(0,K.jsx)(`p`,{className:`dim`,children:`No gate asked in 30 days.`}):(0,K.jsx)(la,{what:`Gate activity`,read:n})})}var ja=6;function Ma({i:e}){if(!e.diffable)return(0,K.jsx)(`span`,{className:`dim`,title:`Local edits are only checked for global installs`,children:`not checkable`});let t=Vt(e.drift),n=e.drift?.stale??0;return(0,K.jsxs)(K.Fragment,{children:[n||t?(0,K.jsx)(`span`,{className:`ldg-syncbar`,children:(0,K.jsx)(Wr,{parts:[{key:`stale`,label:`Behind source`,n,tone:`warn`},{key:`edited`,label:`Local edits`,n:t,tone:`bad`}],label:`Sync with source, ${Ca(e)}`,legend:!1})}):null,t?(0,K.jsxs)(`span`,{className:`mono t-bad`,children:[t,` edited`]}):e.drift?.linked?(0,K.jsxs)(`span`,{className:`mono dim`,title:`Yours: links Geneseed leaves alone`,children:[e.drift.linked,` linked by you`]}):n?null:(0,K.jsx)(`span`,{className:`mono dim`,children:`No edits`}),n?(0,K.jsxs)(`div`,{className:`mono dim ldg-sub`,children:[n,` file`,n===1?``:`s`,` behind`]}):null]})}function Na(e){if(!e.diffable)return`Not checkable: local edits are only checked for global installs.`;let t=e.drift||{},n=[t.stale?`${t.stale} behind`:null,t.edited?`${t.edited} edited`:null,t.added?`${t.added} added`:null,t.missing?`${t.missing} missing`:null,t.linked?`${t.linked} linked (yours)`:null].filter(Boolean);return n.length?n.join(` · `):`Nothing differs.`}function Pa({i:e,n:t,onRebuild:n,onOpen:r,busy:i}){let[a,o]=(0,V.useState)(!1),s=Ca(e),c=(0,K.jsxs)(`td`,{className:`ldg-where`,children:[i?(0,K.jsx)(`span`,{className:`console-progress`,role:`progressbar`,"aria-label":`Rebuilding ${s}`}):null,(0,K.jsxs)(`div`,{className:`ldg-who`,children:[qi(e)?(0,K.jsx)(`svg`,{className:`ldg-glyph ${Vt(e.drift)?`bad`:`warn`}`,viewBox:`0 0 10 10`,role:`img`,"aria-label":Vt(e.drift)?`local edits`:`needs a rebuild`,children:(0,K.jsx)(`path`,{d:`M5 1 9 9H1z`,fill:`currentColor`})}):null,e.state===`active`&&e.cost?(0,K.jsx)(`span`,{className:`ldg-phone-ring`,"aria-hidden":`true`,children:(0,K.jsx)(wa,{cost:e.cost,i:t})}):null,(0,K.jsxs)(`div`,{className:`ldg-name`,children:[(0,K.jsx)(`span`,{className:`ldg-host`,children:J(e.host).label}),` `,(0,K.jsx)(`span`,{className:`dim`,children:e.scope}),(0,K.jsx)(`div`,{className:`mono dim ldg-path`,title:e.path,children:e.path})]})]})]});if(e.state!==`active`)return(0,K.jsxs)(`tr`,{className:`ldg-off`,children:[c,(0,K.jsx)(`td`,{className:`ldg-build`,children:(0,K.jsx)(`span`,{className:`pill off`,children:`disabled`})}),(0,K.jsx)(`td`,{className:`ldg-sync`}),(0,K.jsx)(`td`,{className:`ldg-root`}),(0,K.jsx)(`td`,{className:`ldg-total`}),(0,K.jsx)(`td`,{className:`ldg-act`,children:(0,K.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Open ${s}`,onClick:()=>r(e),children:`Open`})})]});let l={synced:(0,K.jsx)(`span`,{className:`pill good`,children:`in sync`}),behind:(0,K.jsx)(`span`,{className:`pill warn`,children:`behind source`}),unknown:(0,K.jsx)(`span`,{className:`pill off`,children:`not checked`})}[e.verdict],u=Ki(e.cost),d=e.cost?.ceiling?Math.round(e.cost.carrier/e.cost.ceiling*100):null;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`tr`,{className:a?`ldg-open`:``,children:[c,(0,K.jsxs)(`td`,{className:`ldg-build`,children:[l,(0,K.jsx)(`div`,{className:`mono dim ldg-sub`,children:e.built_epoch?`built ${It(e.built_epoch)} ago`:`never built`})]}),(0,K.jsx)(`td`,{className:`ldg-sync`,children:(0,K.jsx)(Ma,{i:e})}),(0,K.jsx)(`td`,{className:`ldg-root`,children:e.cost?d===null?(0,K.jsx)(`span`,{className:`dim`,children:`no ceiling`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`ldg-rootbar`,children:(0,K.jsx)(Gr,{value:ba(e.cost.carrier),max:ba(e.cost.ceiling),label:`Root file, ${s}`,tone:d>100?`bad`:`accent`})}),(0,K.jsx)(`span`,{className:`mono dim ldg-sub`,children:`${Q(e.cost.carrier)} / ${Q(e.cost.ceiling)} · ${d}%`})]}):(0,K.jsx)(`span`,{className:`dim`,children:`not measured`})}),(0,K.jsx)(`td`,{className:`ldg-total`,children:e.cost?(0,K.jsx)(ya,{chars:u}):null}),(0,K.jsxs)(`td`,{className:`ldg-act`,children:[qi(e)?(0,K.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Rebuild ${s}`,title:`Rebuilds ${s} only`,onClick:()=>n([Zi(e)]),children:`Rebuild`}):(0,K.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Open ${s}`,onClick:()=>r(e),children:`Open`}),(0,K.jsx)(`button`,{type:`button`,className:`btn ghost sm ldg-toggle`,"aria-label":`Details for ${s}`,"aria-expanded":a,"aria-controls":a?`ldg-detail-${e.id}`:void 0,onClick:()=>o(e=>!e),children:(0,K.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:a?`M6 15l6-6 6 6`:`M6 9l6 6 6-6`})})})]})]}),a?(0,K.jsx)(`tr`,{className:`ldg-detail`,id:`ldg-detail-${e.id}`,children:(0,K.jsx)(`td`,{colSpan:ja,children:(0,K.jsxs)(`div`,{className:`ldg-detail-grid`,children:[(0,K.jsxs)(`div`,{className:`ldg-detail-col`,children:[e.cost?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`ldg-lbl`,children:`What rides every turn · ${Q(u)} tokens`}),(0,K.jsx)(Wr,{parts:Sa(e.cost),label:s})]}):(0,K.jsx)(`span`,{className:`dim`,children:`Always-on cost not measured.`}),(0,K.jsx)(`span`,{className:`dim`,children:[`Voice ${e.theme}`,`${e.footprint} footprint`,e.posture&&`${e.posture} posture`,e.mode&&`${e.mode} mode`].filter(Boolean).join(` · `)})]}),(0,K.jsxs)(`div`,{className:`ldg-detail-col`,children:[(0,K.jsx)(`span`,{className:`ldg-lbl`,children:`Differs from source`}),(0,K.jsx)(`span`,{className:`muted`,children:Na(e)}),e.diffable?(0,K.jsx)(`span`,{children:(0,K.jsx)(`a`,{className:`btn ghost sm`,href:`#/installs/edits`,"aria-label":`View diff for ${s}`,onClick:()=>Fr(`edits`,e.id),children:`View diff`})}):null]})]})})}):null]})}function Fa({rows:e,pending:t,partial:n,onRetry:r,onAction:i,onRebuild:a}){let o=e.filter(e=>!e.sugg).length;return t?(0,K.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-needs`,children:[(0,K.jsx)(`div`,{className:`panel-head panel-head-rule`,children:(0,K.jsx)(`h2`,{id:`ldg-needs`,children:`Needs you`})}),(0,K.jsx)(Y,{})]}):(0,K.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-needs`,children:[(0,K.jsxs)(`div`,{className:`panel-head panel-head-rule`,children:[(0,K.jsx)(`h2`,{id:`ldg-needs`,children:`Needs you`}),(0,K.jsxs)(`span`,{className:`mono dim`,children:[o,` problem`,o===1?``:`s`,`, `,e.length-o,` suggestion`,e.length-o===1?``:`s`]})]}),e.length?(0,K.jsx)(`ul`,{className:`needs`,children:e.map(e=>(0,K.jsxs)(`li`,{className:e.sugg?`sugg`:``,children:[(0,K.jsx)(`span`,{className:`tag ${e.tone}`,children:e.tag}),(0,K.jsxs)(`span`,{className:`needs-what`,children:[(0,K.jsx)(`b`,{children:e.title}),e.detail?(0,K.jsxs)(`span`,{className:`dim`,children:[` · `,e.detail]}):null]}),(0,K.jsx)(`span`,{className:`mono dim needs-where`,title:e.where,children:e.where}),e.act?(0,K.jsx)(`button`,{type:`button`,className:`needs-verb linkish`,"aria-label":`${e.verb}: ${e.title}`,onClick:()=>e.installs?a(e.installs):i(e.act),children:e.verb}):(0,K.jsx)(`a`,{className:`needs-verb`,href:e.href,"aria-label":`${e.verb}: ${e.title}`,children:e.verb})]},e.id))}):n?null:(0,K.jsx)(`p`,{className:`needs-empty`,children:`Nothing needs you.`}),n?(0,K.jsxs)(`p`,{className:`dim`,children:[`Some reads failed, so this list may be incomplete.`,` `,(0,K.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Retry: the failed reads`,onClick:e=>{ca(e),r()},children:`Retry`})]}):null]})}function Ia({usage:e,read:t,pending:n}){let r=(0,K.jsxs)(`div`,{className:`panel-head`,children:[(0,K.jsx)(`h2`,{id:`ldg-usage`,children:`What fires`}),(0,K.jsx)(`span`,{className:`mono dim`,children:`skills and agents, 30 d`})]});if(!e)return(0,K.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-usage`,children:[r,n?(0,K.jsx)(Y,{}):(0,K.jsx)(la,{what:`Usage`,read:t,retry:!1})]});if(!e.enabled)return(0,K.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-usage`,children:[r,(0,K.jsx)(`p`,{className:`dim`,children:`Usage counting is off on this machine.`})]});if(e.days_counted<30)return(0,K.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-usage`,children:[r,(0,K.jsx)(`p`,{className:`muted`,children:e.since?(0,K.jsxs)(K.Fragment,{children:[`Counting since `,(0,K.jsx)(`b`,{children:e.since}),`, `,e.days_counted,` of 30 days`]}):`No skill or agent call counted yet`}),(0,K.jsx)(`div`,{className:`daytrack`,"aria-hidden":`true`,children:Array.from({length:30},(t,n)=>(0,K.jsx)(`i`,{className:n<e.days_counted?`on`:``},n))}),(0,K.jsx)(`p`,{className:`dim chart-foot`,children:`Rankings and the never-fired count appear once 30 days are counted, so a new install is not told every skill is unused.`})]});let i=e.rows.slice(0,7),a=Math.max(1,...i.map(e=>e.n));return(0,K.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-usage`,children:[r,(0,K.jsx)(`ul`,{className:`ubars`,children:i.map((e,t)=>(0,K.jsxs)(`li`,{className:e.kind,children:[(0,K.jsxs)(`span`,{className:`ub-name`,title:`${e.name} ${e.kind}`,children:[e.name,` `,(0,K.jsx)(`span`,{className:`dim`,children:e.kind})]}),(0,K.jsx)(`span`,{className:`ub-trk`,children:(0,K.jsx)(`i`,{style:{width:da(e.n,a),"--i":t}})}),(0,K.jsx)(`span`,{className:`mono`,children:e.n})]},`${e.install}:${e.kind}:${e.name}`))}),e.never.length?(0,K.jsxs)(`div`,{className:`ub-never`,children:[(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`b`,{children:Ui(e).skills}),` skills never fired`]}),(0,K.jsx)(`a`,{className:`needs-verb`,href:`#/skills`,children:`Triage`})]}):null]})}function La({count:e,canFill:t,onAction:n,view:r,dataRev:i}){let o=(0,V.useRef)(null),{data:s,reload:c}=W(()=>aa(a.update()).then(e=>(e?o.current=e:o.current?.checking&&(o.current={...o.current,checking:!1}),o.current)),[i]);(0,V.useEffect)(()=>{let e=setInterval(c,fa),t=()=>{document.visibilityState===`visible`&&c()};return document.addEventListener(`visibilitychange`,t),()=>{clearInterval(e),document.removeEventListener(`visibilitychange`,t)}},[c]);let l=!!s?.checking;return(0,V.useEffect)(()=>{if(!l)return;let e=setTimeout(c,pa);return()=>clearTimeout(e)},[l,s,c]),(0,K.jsx)(Vr,{title:`Overview`,sub:e===null?null:`${e} install${e===1?``:`s`} on this machine`,actions:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ha,{update:s,onAction:n,canFill:t}),r]})})}function Ra({overview:e,setup:t,runs:n,onAction:r,dataRev:i,banner:o,view:s}){let c=bn(),[l,u]=(0,V.useState)({}),d=W(()=>a.fleet(),[i]),{data:f,error:p,reload:m}=d,h=W(()=>a.usage(),[i]),g=W(()=>a.gates(),[i]),{data:_}=h,{data:v}=g,y=zr(i),b=W(()=>a.activity(),[i]),x=W(()=>a.profile(),[i]),S=W(()=>ua(()=>a.catalog(`skills`)),[i],`catalog:skills`),C=W(()=>ua(()=>a.catalog(`laws`)),[i],`catalog:laws`),{data:w}=y,{data:ee}=b,{data:T}=x,{data:te}=S,{data:E}=C,D=oa(d),O=[d,h,y,b,x,S,C],k=O.some(oa),A=sa(d),j=f?.installs||[],M=e=>{Fr(`hosts`,e.id),window.location.hash=`#/installs/hosts`},N=Nr(i),P=Qi({defaultLabel:N?.length>1?Ca(N[0]):null,fleet:f,usage:_,overview:e,setup:t,rules:w,activity:ee,profile:T,skills:te,laws:E}),F=j.filter(qi).map(Zi),I=async e=>{let t=e.map(e=>e.label);if(!await c(`Rebuild ${t.join(`, `)}? Each is re-rendered from source with its own settings.`,{title:e.length===1?`Rebuild ${t[0]}?`:`Rebuild ${e.length} installs?`,confirmLabel:`Rebuild`}))return;let n=await r(`rebuild`,{installs:e.map(({host:e,path:t})=>({host:e,path:t}))});n&&u(t=>({...t,[n]:e.map(e=>e.id)}))},ne=new Set(Object.entries(l).filter(([e])=>n?.find(t=>t.id===e)?.status===`running`).flatMap(([,e])=>e));return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(La,{count:f?j.length:null,canFill:!F.length,onAction:r,view:s,dataRev:i}),o,(0,K.jsxs)(`div`,{className:`ov-stack ldg`,children:[(0,K.jsx)(va,{fleet:f,error:p,behind:F,onAction:r,onRebuild:I}),(0,K.jsxs)(`div`,{className:`ldg-kpis`,role:`group`,"aria-labelledby":`ldg-kpis-h`,children:[(0,K.jsx)(`h2`,{id:`ldg-kpis-h`,className:`sr-only`,children:`Key figures`}),(0,K.jsx)(Da,{installs:j,pending:D,failed:A}),(0,K.jsx)(Oa,{installs:j,pending:D,failed:A}),(0,K.jsx)(ka,{usage:_,read:h,pending:oa(h)}),(0,K.jsx)(Aa,{gates:v,laws:E,read:g,pending:oa(g)})]}),(0,K.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-fleet`,children:[(0,K.jsxs)(`div`,{className:`panel-head panel-head-rule`,children:[(0,K.jsx)(`h2`,{id:`ldg-fleet`,children:`Installs`}),f?.source_fp?(0,K.jsxs)(`span`,{className:`mono dim`,children:[`source `,f.source_fp]}):null]}),p&&f?(0,K.jsxs)(`p`,{className:`dim`,role:`status`,children:[`Could not refresh the installs — showing the last read.`,` `,(0,K.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:m,children:`Retry`})]}):null,(0,K.jsx)(`div`,{className:`ldg-scroll`,children:(0,K.jsxs)(`table`,{className:`ldg-fleet`,children:[(0,K.jsx)(`caption`,{className:`sr-only`,children:`Installs`}),(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{scope:`col`,children:`Install`}),(0,K.jsx)(`th`,{scope:`col`,className:`ldg-build`,children:`Build`}),(0,K.jsx)(`th`,{scope:`col`,className:`ldg-sync`,children:`Sync with source`}),(0,K.jsx)(`th`,{scope:`col`,className:`ldg-root`,children:`Root file · ceiling`}),(0,K.jsx)(`th`,{scope:`col`,className:`ldg-total`,children:`Always-on`}),(0,K.jsx)(`th`,{scope:`col`,children:(0,K.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,K.jsxs)(`tbody`,{children:[p&&!f?(0,K.jsx)(`tr`,{children:(0,K.jsxs)(`td`,{colSpan:ja,children:[(0,K.jsx)(`span`,{className:`dim`,role:`status`,children:`Could not read the installs`}),` `,(0,K.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:m,children:`Retry`})]})}):null,D?(0,K.jsx)(`tr`,{children:(0,K.jsx)(`td`,{colSpan:ja,children:(0,K.jsx)(Y,{})})}):null,j.map((e,t)=>(0,K.jsx)(Pa,{i:e,n:t,onRebuild:I,onOpen:M,busy:ne.has(e.id)},e.id))]})]})})]}),(0,K.jsxs)(`div`,{className:`ldg-bottom`,children:[(0,K.jsx)(Fa,{rows:P,pending:k,partial:O.some(sa),onRetry:()=>O.filter(sa).forEach(e=>e.reload()),onAction:r,onRebuild:I}),(0,K.jsx)(Ia,{usage:_,read:h,pending:oa(h)})]})]})]})}var za=`geneseed-understand-seen`,Ba=`understand`;function Va(){try{let e=JSON.parse(localStorage.getItem(za));return Array.isArray(e)?e:[]}catch{return[]}}var Ha=`modulepreload`,Ua=function(e){return`/`+e},Wa={},Ga=function(e){return e.pathname.endsWith(`.css`)},Ka=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},$=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Ua(t,n);let r=s(t),i=Ga(r);return Ka(Wa,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Ha,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},qa=`geneseed-newhere-dismissed`,Ja=(0,V.lazy)(()=>$(()=>import(`./Dashboard-DBOEi9lQ.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5])));function Ya({harness:e}){let[t,n]=(0,V.useState)(()=>!!localStorage.getItem(qa)),{data:r}=W(()=>t?Promise.resolve(null):a.docs(e).catch(()=>null),[t,e]),i=r?.groups?.find(e=>e.id===`understand`)?.pages||[],o=Va(),s=i.findIndex(e=>!o.includes(e.id));if(t||!i.length||s<0)return null;let c=i.filter(e=>o.includes(e.id)).length;return(0,K.jsxs)(`section`,{className:`newhere`,"aria-label":`New here?`,children:[(0,K.jsxs)(`div`,{className:`newhere-body`,children:[(0,K.jsx)(`b`,{children:`New here? Understand your harness.`}),(0,K.jsxs)(`p`,{children:[i.length,` short pages: what a harness is, what was installed, what changes in your day, and what is guaranteed.`]}),c?(0,K.jsx)(`div`,{className:`newhere-dots`,"aria-label":`${c} of ${i.length} read`,children:i.map(e=>(0,K.jsx)(`i`,{className:o.includes(e.id)?`f`:``},e.id))}):null]}),(0,K.jsx)(`a`,{className:`btn ghost`,href:`#/docs/${encodeURIComponent(i[s].id)}`,children:c?`Continue · step ${s+1}`:`Start`}),(0,K.jsx)(`button`,{type:`button`,className:`newhere-x`,onClick:()=>{localStorage.setItem(qa,`1`),n(!0)},title:`Dismiss for good`,"aria-label":`Dismiss`,children:`×`})]})}function Xa({layout:e,onLayout:t}){return(0,K.jsx)(An,{"aria-label":`View`,children:bt.map(n=>(0,K.jsx)(`button`,{type:`button`,className:e===n.id?`on`:``,"aria-pressed":e===n.id,title:n.tagline,onClick:()=>t(n.id),children:n.short},n.id))})}function Za({overview:e,overviewError:t,onRetry:n,themes:r,setup:i,runs:o,onAction:s,layout:c=`overview`,onLayout:l,dataRev:u}){let{data:d,loading:f}=W(()=>Promise.resolve().then(()=>a.installs()).catch(()=>null),[u],`installs`);if(!e)return t?(0,K.jsx)(yr,{error:`Could not load the harness overview: ${t}`,onRetry:n}):(0,K.jsx)(Y,{});if(!(d?d.installs?.some(e=>e.state===`active`):e.deployed))return f&&!d?(0,K.jsx)(Y,{}):(0,K.jsx)(jr,{onAction:s});let p=(0,K.jsx)(Ya,{harness:mn(e.emit)}),m=l?(0,K.jsx)(Xa,{layout:c,onLayout:l}):null;return c===`overview`?(0,K.jsx)(Ra,{overview:e,setup:i,runs:o,onAction:s,onRetry:n,dataRev:u,view:m,banner:(0,K.jsxs)(K.Fragment,{children:[e.daemon_stale?(0,K.jsx)(br,{}):null,p]})}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(La,{count:d?d.installs.filter(e=>e.state!==`absent`).length:null,canFill:!1,onAction:s,view:m,dataRev:u}),p,(0,K.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,K.jsx)(`p`,{className:`sub`,children:[e.install&&on(e.install),e.theme&&`${e.theme} voice`,e.footprint&&`${e.footprint} footprint`,e.target,`counts cover every install`].filter(Boolean).join(` · `)}),(0,K.jsxs)(`div`,{className:`row gap-10`,children:[(0,K.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>s(`doctor`),children:`Run doctor`}),(0,K.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>s(`build-all`),children:`Rebuild`})]})]}),(0,K.jsx)(V.Suspense,{fallback:(0,K.jsx)(Y,{}),children:(0,K.jsx)(Ja,{overview:e,overviewError:t,onRetry:n,themes:r,setup:i,runs:o,onAction:s,layout:c,dataRev:u})})]})}var Qa=(0,V.lazy)(()=>$(()=>import(`./Activity-CqJiquEq.js`),__vite__mapDeps([6,1,2,3,4,7,8,9]))),$a=(0,V.lazy)(()=>$(()=>import(`./ActivityDetail-BSzevynX.js`),__vite__mapDeps([10,1,2,3,7,8,9]))),eo=(0,V.lazy)(()=>$(()=>import(`./Library-B4K-1iNF.js`),__vite__mapDeps([11,1,2,3,4,5,7,12,13]))),to=(0,V.lazy)(()=>$(()=>import(`./Kits-DRwpxC-J.js`),__vite__mapDeps([14,1,2,3,15,7,16,17]))),no=(0,V.lazy)(()=>$(()=>import(`./Loops-BWSzaW8E.js`),__vite__mapDeps([18,1,2,3,4,15,7,12,13,19,20,9,16]))),ro=(0,V.lazy)(()=>$(()=>import(`./Factories-Bpvv7L2H.js`),__vite__mapDeps([21,1,2,3,7,9,12,13,19,16,20]))),io=(0,V.lazy)(()=>$(()=>import(`./Laws-CZkiNOWQ.js`),__vite__mapDeps([22,1,2,3,15,7,13]))),ao=(0,V.lazy)(()=>$(()=>import(`./Personal-Bp9nV4GR.js`),__vite__mapDeps([23,1,2,3,15,7,24,11,4,5,12,13]))),oo=(0,V.lazy)(()=>$(()=>import(`./Installs-BlGmVrFK.js`),__vite__mapDeps([25,1,2,3,7,24,17]))),so=(0,V.lazy)(()=>$(()=>import(`./Settings-CWWuaIp-.js`),__vite__mapDeps([26,1,2,3,4]))),co=(0,V.lazy)(()=>$(()=>import(`./Docs-DvlMJhpu.js`),__vite__mapDeps([27,1,2,3,4,15,7,12,13,19])));function lo(){let e=xe(),[t,n]=(0,V.useState)(null),[r,i]=Xe(),[o,s]=tt(),[c,l]=vt(),u=e=>{if(e===o)return;let t=()=>{s(e),l(`curated`)};if(!document.startViewTransition||!w())return t();document.startViewTransition(()=>(0,ue.flushSync)(t))},[d,f]=wt(),[p,m]=(0,V.useState)(()=>{try{return!window.sessionStorage.getItem(`gs-booted`)}catch{return!0}}),[h,g]=(0,V.useState)(!1),_=(0,V.useRef)(null),v=(0,V.useRef)(null);(0,V.useEffect)(()=>{if(!h)return;let e=e=>{e.key===`Escape`&&g(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h]),(0,V.useEffect)(()=>{if(!h)return;let e=v.current,t=document.activeElement;return e&&(e.inert=!0),document.getElementById(`rail-nav`)?.focus(),()=>{e&&(e.inert=!1),t instanceof HTMLElement&&t.focus()}},[h]);let y=e=>n({kind:e?.body?.kind||`err`,msg:e?.body?.message||e.message}),[b,x]=(0,V.useState)(0),{overview:S,error:C,themes:ee,reload:T}=Et(y,()=>x(e=>e+1)),te=()=>{T(),x(e=>e+1)},[E,D]=(0,V.useState)(null),{runs:O,activeId:k,consoleOpen:A,setConsoleOpen:j,runAction:M,cancelJob:N,clearRuns:P}=Ot({onFinish:e=>{te(),D({status:e,at:Date.now()})},onError:y}),{data:F}=W(()=>a.setup().catch(()=>null),[b],`setup`),{data:I,loading:ne}=W(()=>a.installs().catch(()=>null),[b],`installs`),L=I?.installs||null,R=O[O.length-1],re=R?R.status===`running`?`${R.action} running`:`${R.action} ${R.status}`:``;(0,V.useEffect)(()=>{let e=_.current;if(e){if(!Je(e,mt(c),r)){let t=gt(c);t?De(e,t,r):ke(e,o,r)}document.querySelector(`meta[name="theme-color"]`)?.setAttribute(`content`,getComputedStyle(e).getPropertyValue(`--bg`).trim())}},[r,c,o]);let ie=[{title:`Rebuild all`,desc:`Re-emit every install`,run:()=>M(`build-all`),confirm:{msg:`Rebuild every install from the current sources?`,title:`Rebuild all?`,confirmLabel:`Rebuild all`}},{title:`Update`,desc:`Pull the latest Geneseed; the server restarts after`,run:()=>M(`update`),confirm:{msg:`Update Geneseed? The server restarts when the update ends.`,title:`Update Geneseed?`,confirmLabel:`Update`}},{title:`Run doctor`,desc:`Read-only health check`,run:()=>M(`doctor`)},{title:`Restart server`,desc:`Restart the local Geneseed server`,run:()=>ct().catch(y),confirm:{msg:`Restart the local Geneseed server? The console reconnects in a moment.`,title:`Restart the server?`,confirmLabel:`Restart`}},{title:r===`light`?`Switch to dark mode`:`Switch to light mode`,desc:`Appearance`,run:i},...Qe.filter(e=>e.id!==o).map(e=>({title:`Skin: ${e.name}`,desc:e.tagline,run:()=>u(e.id)}))].map(e=>({kind:`Actions`,hay:`${e.title} ${e.desc}`.toLowerCase(),...e})),ae={flavour:o,onFlavour:u,accentMode:c,onAccentMode:l};return(0,K.jsx)(`div`,{className:`app fl-${o} ${r===`light`?`light`:``}${h?` nav-open`:``}`,ref:_,children:(0,K.jsxs)(xn,{children:[(0,K.jsx)(`div`,{className:`atmos`,"aria-hidden":`true`}),(0,K.jsx)(`a`,{className:`skip-link`,href:`#main`,onClick:e=>{e.preventDefault(),document.getElementById(`main`)?.focus()},children:`Skip to content`}),(0,K.jsx)(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:re}),h&&(0,K.jsx)(`button`,{type:`button`,className:`nav-scrim`,"aria-label":`Close navigation`,onClick:()=>g(!1)}),(0,K.jsx)(Qt,{route:e,overview:S,installs:L,onNavigate:()=>g(!1)}),(0,K.jsxs)(`div`,{className:`col`,ref:v,children:[(0,K.jsx)(Nn,{route:e,navOpen:h,onToggleNav:()=>g(e=>!e),actions:ie,mode:r,onToggleMode:i,appearance:ae,dataRev:b}),(0,K.jsx)(`main`,{className:`page`,id:`main`,tabIndex:-1,children:(0,K.jsxs)(`div`,{className:[`library`,`kits`,`loops`,`factories`,`docs`].includes(e.page)?`pad pad-wide`:`pad`,children:[(0,K.jsx)(Fn,{unreadable:!ne&&!I}),(0,K.jsx)(Or,{activeId:k,finish:E,children:(0,K.jsx)(Cr,{children:(0,K.jsx)(V.Suspense,{fallback:(0,K.jsx)(Y,{}),children:{overview:()=>(0,K.jsx)(Za,{overview:S,overviewError:C,onRetry:T,themes:ee,setup:F,runs:O,onAction:M,layout:d,onLayout:f,dataRev:b}),laws:()=>(0,K.jsx)(io,{selected:e.item,overview:S,setup:F,onAction:M,dataRev:b}),library:()=>(0,K.jsx)(eo,{overview:S,section:e.section,selected:e.item,dataRev:b,onCountsChanged:T}),kits:()=>(0,K.jsx)(to,{item:e.item,onAction:M,dataRev:b}),loops:()=>(0,K.jsx)(no,{tab:e.tab,item:e.item,dataRev:b}),factories:()=>(0,K.jsx)(ro,{tab:e.tab,item:e.item,dataRev:b}),personal:()=>(0,K.jsx)(ao,{tab:e.tab,item:e.item,setup:F,dataRev:b,onAction:M,onCountsChanged:T}),installs:()=>(0,K.jsx)(oo,{tab:e.tab,overview:S,setup:F,themes:ee,onAction:M,onMutated:te,dataRev:b}),settings:()=>(0,K.jsx)(so,{overview:S,onAction:M}),activity:()=>e.item?(0,K.jsx)($a,{sid:e.item},e.item):(0,K.jsx)(Qa,{}),docs:()=>(0,K.jsx)(co,{page:e.item,onAction:M,overview:S})}[e.page]?.()})},e.page)})]})}),(0,K.jsx)(en,{route:e,navOpen:h,onMore:()=>g(!0)}),(0,K.jsx)(lr,{runs:O,open:A,busy:!!k,finish:E,onToggle:()=>j(e=>!e),onClear:P,onCancel:N})]}),(0,K.jsx)(Ln,{toast:t,onClose:()=>n(null)}),p&&(0,K.jsx)(vr,{ready:!!S||!!C,onDone:()=>{try{window.sessionStorage.setItem(`gs-booted`,`1`)}catch{}m(!1)}})]})})}(0,B.createRoot)(document.getElementById(`root`)).render((0,K.jsx)(lo,{})),`serviceWorker`in navigator&&window.addEventListener(`load`,()=>{navigator.serviceWorker.register(`/sw.js`).catch(()=>{})});export{yr as $,oi as A,R as At,Hr as B,Qr as C,ct as Ct,ei as D,be as Dt,ii as E,Se as Et,qr as F,Ir as G,Br as H,Zr as I,Nr as J,Rr as K,Jr as L,mi as M,fi as N,ti as O,le as Ot,yi as P,br as Q,Gr as R,Si as S,W as St,vi as T,pe as Tt,zr as U,Vr as V,Fr as W,Tr as X,jr as Y,kr as Z,Ti as _,Bt as _t,Wi as a,fn as at,Ci as b,It as bt,Pi as c,tn as ct,Ii as d,J as dt,Y as et,Li as f,an as ft,ki as g,q as gt,Oi as h,nn as ht,Va as i,bn as it,ci as j,gi as k,z as kt,Fi as l,sn as lt,Ri as m,un as mt,za as n,An as nt,$i as o,mn as ot,Mi as p,on as pt,Lr as q,Ba as r,kn as rt,Ni as s,pn as st,$ as t,Pn as tt,ji as u,cn as ut,bi as v,zt as vt,si as w,fe as wt,wi as x,Ht as xt,xi as y,Rt as yt,Wr as z};