@zuzuucodes/cli 1.5.0 → 1.6.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/bin/zuzuu.mjs +12 -3
  2. package/package.json +1 -1
  3. package/web-app/dist/auth.js +91 -0
  4. package/web-app/dist/server.js +16 -79
  5. package/web-app/dist/zuzuu-cli.js +124 -0
  6. package/web-app/dist/{zuzuu-api.js → zuzuu-routes.js} +46 -116
  7. package/web-app/web-dist/assets/CommandPalette-DhBdR7X3.js +45 -0
  8. package/web-app/web-dist/assets/DiffTab-CqxwSjI2.js +1 -0
  9. package/web-app/web-dist/assets/EditorPane-94QPFR9R.js +41 -0
  10. package/web-app/web-dist/assets/MonacoFile-D76epTrG.js +1 -0
  11. package/web-app/web-dist/assets/angular-html-BVBpGdXr.js +1 -0
  12. package/web-app/web-dist/assets/{angular-ts-CD_OonCa.js → angular-ts-BfdufMKP.js} +1 -1
  13. package/web-app/web-dist/assets/{apl-uOGC3x4e.js → apl-DWBSSoBH.js} +1 -1
  14. package/web-app/web-dist/assets/{astro-B6ybQmWG.js → astro-3LtMP0Sq.js} +1 -1
  15. package/web-app/web-dist/assets/{blade-B1QGRlVx.js → blade-llJRbbtR.js} +1 -1
  16. package/web-app/web-dist/assets/c-Wt1voDr2.js +1 -0
  17. package/web-app/web-dist/assets/{cobol-BgqgtYWn.js → cobol-x_HIyl2P.js} +1 -1
  18. package/web-app/web-dist/assets/{coffee-0wIRKYlr.js → coffee-CThvmt4R.js} +1 -1
  19. package/web-app/web-dist/assets/cpp-NtAeskI3.js +1 -0
  20. package/web-app/web-dist/assets/{crystal-CyTK3qFN.js → crystal-DNu_sX0G.js} +1 -1
  21. package/web-app/web-dist/assets/css-DJp_X0uY.js +1 -0
  22. package/web-app/web-dist/assets/{cssMode-Dx3ub8Pk.js → cssMode-ByQBaInt.js} +1 -1
  23. package/web-app/web-dist/assets/dist-DQqjtuhV.js +153 -0
  24. package/web-app/web-dist/assets/{edge-CvML9pwC.js → edge-ozw5tpLl.js} +1 -1
  25. package/web-app/web-dist/assets/{editor.api2-BmGoRSl4.js → editor.api2-C7skgoRB.js} +1 -1
  26. package/web-app/web-dist/assets/{elixir-CrjqTiSc.js → elixir-VhA6FeZt.js} +1 -1
  27. package/web-app/web-dist/assets/{elm-C4JtJ0Au.js → elm-dREJmIFz.js} +1 -1
  28. package/web-app/web-dist/assets/{erb-Cmeb-29V.js → erb-CIg6G69l.js} +1 -1
  29. package/web-app/web-dist/assets/{freemarker2-B5LAi19B.js → freemarker2-CBBwP9JV.js} +1 -1
  30. package/web-app/web-dist/assets/{git-rebase-CXqdToiP.js → git-rebase-B44mJPta.js} +1 -1
  31. package/web-app/web-dist/assets/{glimmer-js-Kq-kdTyV.js → glimmer-js-vH_gHG0-.js} +1 -1
  32. package/web-app/web-dist/assets/{glimmer-ts-D0RKLJNf.js → glimmer-ts--abOzSAQ.js} +1 -1
  33. package/web-app/web-dist/assets/glsl-Dv5r7kPw.js +1 -0
  34. package/web-app/web-dist/assets/graphql-CB4jsw2E.js +1 -0
  35. package/web-app/web-dist/assets/{hack-trjVF3Po.js → hack-DvEYX148.js} +1 -1
  36. package/web-app/web-dist/assets/haml-zE6W3STP.js +1 -0
  37. package/web-app/web-dist/assets/{handlebars-B8_x7Zx7.js → handlebars-CzBR2SDs.js} +1 -1
  38. package/web-app/web-dist/assets/{handlebars-g7ZhGhI_.js → handlebars-tXdfxEd6.js} +1 -1
  39. package/web-app/web-dist/assets/html-C8UlPnhE.js +1 -0
  40. package/web-app/web-dist/assets/{html-CfvRMgoC.js → html-DgPn1QYH.js} +1 -1
  41. package/web-app/web-dist/assets/{html-derivative-BYX_F_XH.js → html-derivative-CY6NRz-J.js} +1 -1
  42. package/web-app/web-dist/assets/{htmlMode-DM6oHc7c.js → htmlMode-BtdIDgA2.js} +1 -1
  43. package/web-app/web-dist/assets/{http-BIVDpHT-.js → http-Cyd7bS_S.js} +1 -1
  44. package/web-app/web-dist/assets/{hurl-CFsshMju.js → hurl-CWPsiEpf.js} +1 -1
  45. package/web-app/web-dist/assets/index-B27_WOhS.css +2 -0
  46. package/web-app/web-dist/assets/index-De6DWTZM.js +7 -0
  47. package/web-app/web-dist/assets/java-CGc3VwQr.js +1 -0
  48. package/web-app/web-dist/assets/{javascript-Bxx2wV4w.js → javascript-5m05n-Be.js} +1 -1
  49. package/web-app/web-dist/assets/javascript-CUt1pgmJ.js +1 -0
  50. package/web-app/web-dist/assets/{jinja-_ZS5zWwe.js → jinja-CD-Z-FLd.js} +1 -1
  51. package/web-app/web-dist/assets/{jison-D8mMEpcs.js → jison-imPNup1l.js} +1 -1
  52. package/web-app/web-dist/assets/json-Bg9ijW3F.js +1 -0
  53. package/web-app/web-dist/assets/{jsonMode-DflaUwqW.js → jsonMode-BG32YnTY.js} +1 -1
  54. package/web-app/web-dist/assets/jsx-CY6oMTks.js +1 -0
  55. package/web-app/web-dist/assets/{julia-D4h2DZrs.js → julia-Dc3O-irA.js} +1 -1
  56. package/web-app/web-dist/assets/{just-bMqQi3xg.js → just-BhOq_Kbv.js} +1 -1
  57. package/web-app/web-dist/assets/{latex-DThYi3CX.js → latex-Cu4Y1d5w.js} +1 -1
  58. package/web-app/web-dist/assets/lib-KIOQTlcs.js +1 -0
  59. package/web-app/web-dist/assets/{liquid-CUjzzP4r.js → liquid-3ZnQzTbs.js} +1 -1
  60. package/web-app/web-dist/assets/{liquid-CesB-zzl.js → liquid-CvXMrjlQ.js} +1 -1
  61. package/web-app/web-dist/assets/{lspLanguageFeatures-gTnJsses.js → lspLanguageFeatures-6KXALSrl.js} +1 -1
  62. package/web-app/web-dist/assets/lua-BjLEUjKY.js +1 -0
  63. package/web-app/web-dist/assets/{marko-yoGoLK2m.js → marko-DvhNOisQ.js} +1 -1
  64. package/web-app/web-dist/assets/{mdc-BvtXU6eH.js → mdc-Bm9TpL1X.js} +1 -1
  65. package/web-app/web-dist/assets/{mdx-DrXGQbNB.js → mdx-DffTEkNE.js} +1 -1
  66. package/web-app/web-dist/assets/{monaco-setup-wbBeb0oN.js → monaco-setup-DM3A5_VI.js} +3 -3
  67. package/web-app/web-dist/assets/{nginx-DoUz032F.js → nginx-Bhc82uuv.js} +1 -1
  68. package/web-app/web-dist/assets/{nim-B0Pl8B4R.js → nim-DXTVBFnF.js} +1 -1
  69. package/web-app/web-dist/assets/{perl-D2tfAALb.js → perl-C7veXV9z.js} +1 -1
  70. package/web-app/web-dist/assets/{php-BImCcX5X.js → php-BRiuMnnr.js} +1 -1
  71. package/web-app/web-dist/assets/{pug-BcnpC8P_.js → pug-C5hz5LQ7.js} +1 -1
  72. package/web-app/web-dist/assets/{python-ypRCBnvu.js → python-DyLAD3Wt.js} +1 -1
  73. package/web-app/web-dist/assets/{qml-DFDAunHY.js → qml-BdUV3aTS.js} +1 -1
  74. package/web-app/web-dist/assets/r-8R7vtdQc.js +1 -0
  75. package/web-app/web-dist/assets/{razor-aqrhpwqZ.js → razor-C49xQTPQ.js} +1 -1
  76. package/web-app/web-dist/assets/{razor-1_376SZM.js → razor-DRL52XO2.js} +1 -1
  77. package/web-app/web-dist/assets/react-vendor-CCIEwYL0.js +9 -0
  78. package/web-app/web-dist/assets/regexp-Omp9DhTb.js +1 -0
  79. package/web-app/web-dist/assets/{rst-2vG6f11Y.js → rst-BHX71KW9.js} +1 -1
  80. package/web-app/web-dist/assets/{ruby-Dj6bCFXR.js → ruby-B--HzjGU.js} +1 -1
  81. package/web-app/web-dist/assets/{sas-BhVZ4qL2.js → sas-DrLaYOK_.js} +1 -1
  82. package/web-app/web-dist/assets/scss-DdSxiZKl.js +1 -0
  83. package/web-app/web-dist/assets/shellscript-DwcUjJBL.js +1 -0
  84. package/web-app/web-dist/assets/{shellsession-CyO2fnhB.js → shellsession-CPZkydE6.js} +1 -1
  85. package/web-app/web-dist/assets/{soy-DIkw6E88.js → soy-Br5FhD7c.js} +1 -1
  86. package/web-app/web-dist/assets/sql-DNssxck8.js +1 -0
  87. package/web-app/web-dist/assets/{stata-DvkM932O.js → stata-DXn1tqOr.js} +1 -1
  88. package/web-app/web-dist/assets/{surrealql-B4-Q8tqV.js → surrealql-IeLNQw0f.js} +1 -1
  89. package/web-app/web-dist/assets/{svelte-p6yBy-Ki.js → svelte-DOdLCIlh.js} +1 -1
  90. package/web-app/web-dist/assets/{templ-C7EkuiZr.js → templ-CIwIngms.js} +1 -1
  91. package/web-app/web-dist/assets/{tex-DkmD8uFC.js → tex-D8QMumu5.js} +1 -1
  92. package/web-app/web-dist/assets/{ts-tags-U-hncHg4.js → ts-tags-BMVY4q-l.js} +1 -1
  93. package/web-app/web-dist/assets/{tsMode-DRwkDcoK.js → tsMode-BndVBac5.js} +1 -1
  94. package/web-app/web-dist/assets/tsx-5Eka4NBX.js +1 -0
  95. package/web-app/web-dist/assets/{twig-CU0OP-IA.js → twig-C8o_5mgw.js} +1 -1
  96. package/web-app/web-dist/assets/{typescript-DnLjiKtn.js → typescript-B1w9vqKF.js} +1 -1
  97. package/web-app/web-dist/assets/typescript-DOu2WMV5.js +1 -0
  98. package/web-app/web-dist/assets/{vue-Db7nY3ba.js → vue-BU18DNDL.js} +1 -1
  99. package/web-app/web-dist/assets/{vue-html-BvAbiAw1.js → vue-html-BeluIYX0.js} +1 -1
  100. package/web-app/web-dist/assets/{vue-vine-BEaIQIlA.js → vue-vine-DGUAbOCX.js} +1 -1
  101. package/web-app/web-dist/assets/{xml-an4Nuuqq.js → xml-D8uAlVv5.js} +1 -1
  102. package/web-app/web-dist/assets/xml-DIqSwXR3.js +1 -0
  103. package/web-app/web-dist/assets/{xsl-D3NQgH22.js → xsl-Ct_-YIAy.js} +1 -1
  104. package/web-app/web-dist/assets/xterm-B1ffpRuj.js +36 -0
  105. package/web-app/web-dist/assets/xterm-addons-psDEiUMC.js +136 -0
  106. package/web-app/web-dist/assets/{yaml-Diiu6O9P.js → yaml-Bb7jXyQv.js} +1 -1
  107. package/web-app/web-dist/assets/yaml-DTtCYNlS.js +1 -0
  108. package/web-app/web-dist/index.html +6 -3
  109. package/zuzuu/actions/trail.mjs +1 -1
  110. package/zuzuu/commands/act.mjs +1 -1
  111. package/zuzuu/commands/capture.mjs +2 -2
  112. package/zuzuu/commands/code.mjs +2 -2
  113. package/zuzuu/commands/digest.mjs +2 -2
  114. package/zuzuu/commands/distill.mjs +15 -16
  115. package/zuzuu/commands/doctor.mjs +39 -4
  116. package/zuzuu/commands/enable.mjs +1 -1
  117. package/zuzuu/commands/eval.mjs +3 -36
  118. package/zuzuu/commands/faculty.mjs +102 -19
  119. package/zuzuu/commands/generation.mjs +3 -4
  120. package/zuzuu/commands/hook.mjs +7 -7
  121. package/zuzuu/commands/inbox.mjs +1 -6
  122. package/zuzuu/commands/init.mjs +5 -4
  123. package/zuzuu/commands/knowledge.mjs +1 -1
  124. package/zuzuu/commands/migrations/home.mjs +96 -0
  125. package/zuzuu/commands/migrations/index.mjs +48 -0
  126. package/zuzuu/commands/{migrate.mjs → migrations/items.mjs} +34 -246
  127. package/zuzuu/commands/migrations/proposals.mjs +100 -0
  128. package/zuzuu/commands/proposals.mjs +131 -0
  129. package/zuzuu/commands/review.mjs +13 -227
  130. package/zuzuu/commands/session.mjs +8 -2
  131. package/zuzuu/commands/sessions.mjs +159 -0
  132. package/zuzuu/commands/status.mjs +3 -3
  133. package/zuzuu/commands/trace.mjs +1 -1
  134. package/zuzuu/{capture-core.mjs → core/capture-core.mjs} +3 -3
  135. package/zuzuu/{store.mjs → core/store.mjs} +1 -1
  136. package/zuzuu/digest/compose.mjs +96 -0
  137. package/zuzuu/eval/score.mjs +14 -1
  138. package/zuzuu/faculties/actions/index.mjs +283 -0
  139. package/zuzuu/faculties/guardrails/index.mjs +320 -0
  140. package/zuzuu/faculties/instructions/index.mjs +288 -0
  141. package/zuzuu/faculties/knowledge/index.mjs +185 -0
  142. package/zuzuu/{memory/adapter.mjs → faculties/memory/index.mjs} +37 -9
  143. package/zuzuu/faculty/generation/read.mjs +206 -0
  144. package/zuzuu/faculty/generation/write.mjs +207 -0
  145. package/zuzuu/faculty/items.mjs +11 -5
  146. package/zuzuu/faculty/module.mjs +74 -0
  147. package/zuzuu/faculty/pending.mjs +63 -0
  148. package/zuzuu/faculty/registry.mjs +204 -18
  149. package/zuzuu/faculty/render.mjs +59 -0
  150. package/zuzuu/faculty/trail.mjs +1 -1
  151. package/zuzuu/{guardrails.mjs → guardrails/engine.mjs} +1 -1
  152. package/zuzuu/{scaffold.mjs → home/scaffold.mjs} +12 -2
  153. package/zuzuu/live/live-store.mjs +2 -2
  154. package/zuzuu/live/reconcile.mjs +2 -2
  155. package/zuzuu/sessions/git.mjs +47 -0
  156. package/zuzuu/{session-git.mjs → sessions/session-git.mjs} +5 -43
  157. package/web-app/web-dist/assets/DiffTab-BpGp1akx.js +0 -1
  158. package/web-app/web-dist/assets/MonacoFile-CqbVacUZ.js +0 -1
  159. package/web-app/web-dist/assets/angular-html-CmT26mqM.js +0 -1
  160. package/web-app/web-dist/assets/c-BvoqrSVH.js +0 -1
  161. package/web-app/web-dist/assets/cpp-BXsk94m0.js +0 -1
  162. package/web-app/web-dist/assets/css-Z8oOGxII.js +0 -1
  163. package/web-app/web-dist/assets/dist-C6R6xoyX.js +0 -153
  164. package/web-app/web-dist/assets/glsl-KwyfU2aa.js +0 -1
  165. package/web-app/web-dist/assets/graphql-DSeOUAa2.js +0 -1
  166. package/web-app/web-dist/assets/haml-azVoxQRV.js +0 -1
  167. package/web-app/web-dist/assets/html-D_7P5S4m.js +0 -1
  168. package/web-app/web-dist/assets/index-DHpC851f.js +0 -268
  169. package/web-app/web-dist/assets/index-O-t1gyMG.css +0 -2
  170. package/web-app/web-dist/assets/java-D4RbCvBe.js +0 -1
  171. package/web-app/web-dist/assets/javascript-Cb010CKM.js +0 -1
  172. package/web-app/web-dist/assets/json-DWgqV4D1.js +0 -1
  173. package/web-app/web-dist/assets/jsx-CZjSJa1f.js +0 -1
  174. package/web-app/web-dist/assets/lua-TGj_6NzO.js +0 -1
  175. package/web-app/web-dist/assets/r-fCpuAR7u.js +0 -1
  176. package/web-app/web-dist/assets/regexp-B4yxx-Ty.js +0 -1
  177. package/web-app/web-dist/assets/scss-QdjMO_xV.js +0 -1
  178. package/web-app/web-dist/assets/shellscript-BnlgeVVx.js +0 -1
  179. package/web-app/web-dist/assets/sql-DGnQv6iD.js +0 -1
  180. package/web-app/web-dist/assets/tsx-MJ0-9sYG.js +0 -1
  181. package/web-app/web-dist/assets/typescript-C17ZkDe8.js +0 -1
  182. package/web-app/web-dist/assets/xml-CA9lHFQV.js +0 -1
  183. package/web-app/web-dist/assets/yaml-CwRYMJka.js +0 -1
  184. package/zuzuu/actions/adapter.mjs +0 -122
  185. package/zuzuu/digest.mjs +0 -154
  186. package/zuzuu/faculty/generation.mjs +0 -398
  187. package/zuzuu/guardrails/adapter.mjs +0 -103
  188. package/zuzuu/instructions/adapter.mjs +0 -93
  189. package/zuzuu/knowledge/adapter.mjs +0 -99
  190. package/zuzuu/miners/actions.mjs +0 -112
  191. package/zuzuu/miners/guardrails.mjs +0 -176
  192. package/zuzuu/miners/instructions.mjs +0 -157
  193. package/zuzuu/miners/knowledge.mjs +0 -25
  194. package/zuzuu/miners/memory.mjs +0 -27
  195. package/zuzuu/miners/registry.mjs +0 -31
  196. /package/web-app/web-dist/assets/{chunk-QTnfLwEv.js → rolldown-runtime-QTnfLwEv.js} +0 -0
  197. /package/zuzuu/{session.mjs → core/session.mjs} +0 -0
  198. /package/zuzuu/{inject.mjs → home/inject.mjs} +0 -0
@@ -0,0 +1,7 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/EditorPane-94QPFR9R.js","assets/rolldown-runtime-QTnfLwEv.js","assets/lib-KIOQTlcs.js","assets/react-vendor-CCIEwYL0.js","assets/CommandPalette-DhBdR7X3.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,r,t as i}from"./react-vendor-CCIEwYL0.js";import{t as a}from"./xterm-B1ffpRuj.js";import{a as o,i as s,n as c,o as l,r as u,t as d}from"./xterm-addons-psDEiUMC.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),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var f=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},p=new class extends f{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},m={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},h=new class{#e=m;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function g(e){setTimeout(e,0)}var _=typeof window>`u`||`Deno`in globalThis;function v(){}function y(e,t){return typeof e==`function`?e(t):e}function b(e){return typeof e==`number`&&e>=0&&e!==1/0}function x(e,t){return Math.max(e+(t||0)-Date.now(),0)}function S(e,t){return typeof e==`function`?e(t):e}function C(e,t){return typeof e==`function`?e(t):e}function w(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==E(o,t.options))return!1}else if(!O(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function T(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(D(t.options.mutationKey)!==D(a))return!1}else if(!O(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function E(e,t){return(t?.queryKeyHashFn||D)(e)}function D(e){return JSON.stringify(e,(e,t)=>re(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function O(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>O(e[n],t[n])):!1}var ee=Object.prototype.hasOwnProperty;function k(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ne(e)&&ne(t);if(!r&&!(re(e)&&re(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:ee.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=k(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function te(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function ne(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function re(e){if(!ie(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ie(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ie(e){return Object.prototype.toString.call(e)===`[object Object]`}function ae(e){return new Promise(t=>{h.setTimeout(t,e)})}function oe(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:k(e,t)}function se(e){return e}function ce(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function le(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ue=Symbol();function de(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ue?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function fe(e,t){return typeof e==`function`?e(...t):!!e}function pe(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var me=(()=>{let e=()=>_;return{isServer(){return e()},setIsServer(t){e=t}}})();function he(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var ge=g;function _e(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=ge,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var A=_e(),ve=new class extends f{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function ye(e){return Math.min(1e3*2**e,3e4)}function be(e){return(e??`online`)===`online`?ve.isOnline():!0}var xe=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Se(e){let t=!1,n=0,r,i=he(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new xe(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>p.isFocused()&&(e.networkMode===`always`||ve.isOnline())&&e.canRun(),u=()=>be(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},m=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),h=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(me.isServer()?0:3),o=e.retryDelay??ye,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),ae(s).then(()=>l()?void 0:m()).then(()=>{t?f(r):h()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?h():m().then(h),i)}}var Ce=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),b(this.gcTime)&&(this.#e=h.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(me.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(h.clearTimeout(this.#e),this.#e=void 0)}};function we(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{pe(e,()=>t.signal,()=>n=!0)},u=de(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?le:ce;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Ee:Te,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Te(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Te(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ee(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var De=class extends Ce{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Ae(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Ae(this.options);e.data!==void 0&&(this.setState(ke(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=oe(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(v).catch(v):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>C(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ue||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>S(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!x(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=de(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?we(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=Se({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof xe&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof xe){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Oe(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...ke(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),A.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Oe(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:be(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function ke(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Ae(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var je=class extends f{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=he(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ne(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Pe(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Pe(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof C(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!te(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Fe(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||C(this.options.enabled,this.#t)!==C(t.enabled,this.#t)||S(this.options.staleTime,this.#t)!==S(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||C(this.options.enabled,this.#t)!==C(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Le(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(v)),t}#g(){this.#b();let e=S(this.options.staleTime,this.#t);if(me.isServer()||this.#r.isStale||!b(e))return;let t=x(this.#r.dataUpdatedAt,e)+1;this.#d=h.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(me.isServer()||C(this.options.enabled,this.#t)===!1||!b(this.#p)||this.#p===0)&&(this.#f=h.setInterval(()=>{(this.options.refetchIntervalInBackground||p.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(h.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(h.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Ne(e,t),o=i&&Fe(e,n,t,r);(a||o)&&(l={...l,...Oe(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=oe(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=oe(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Ie(e,t),refetch:this.refetch,promise:this.#o,isEnabled:C(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=he())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!te(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){A.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Me(e,t){return C(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&C(t.retryOnMount,e)===!1)}function Ne(e,t){return Me(e,t)||e.state.data!==void 0&&Pe(e,t,t.refetchOnMount)}function Pe(e,t,n){if(C(t.enabled,e)!==!1&&S(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Ie(e,t)}return!1}function Fe(e,t,n,r){return(e!==t||C(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ie(e,n)}function Ie(e,t){return C(t.enabled,e)!==!1&&e.isStaleByTime(S(t.staleTime,e))}function Le(e,t){return!te(e.getCurrentResult(),t)}var Re=class extends Ce{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||ze(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Se({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),A.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function ze(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Be=class extends f{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Re({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Ve(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Ve(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Ve(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Ve(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){A.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>T(t,e))}findAll(e={}){return this.getAll().filter(t=>T(e,t))}notify(e){A.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return A.batch(()=>Promise.all(e.map(e=>e.continue().catch(v))))}};function Ve(e){return e.options.scope?.id}function He(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Ue(e,t,n){let r=e.slice(0);return r[t]=n,r}var We=class extends f{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,A.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!te(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(He(e,n).forEach(e=>{e.destroy()}),He(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=k(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new je(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Ue(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&A.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},Ge=class extends f{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??E(r,t),a=this.get(i);return a||(a=new De({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){A.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>w(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>w(e,t)):t}notify(e){A.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){A.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){A.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ke=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ge,this.#t=e.mutationCache||new Be,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=p.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ve.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(S(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=y(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return A.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;A.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return A.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=A.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(v).catch(v)}invalidateQueries(e,t={}){return A.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=A.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(v)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(v)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(S(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(v).catch(v)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(v).catch(v)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return ve.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(D(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{O(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(D(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{O(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=E(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===ue&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},j=e(t(),1),M=i(),qe=j.createContext(void 0),N=e=>{let t=j.useContext(qe);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Je=({client:e,children:t})=>(j.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,M.jsx)(qe.Provider,{value:e,children:t})),Ye=j.createContext(!1),Xe=()=>j.useContext(Ye);Ye.Provider;function Ze(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Qe=j.createContext(Ze()),$e=()=>j.useContext(Qe),et=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?fe(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},tt=e=>{j.useEffect(()=>{e.clearReset()},[e])},nt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||fe(n,[e.error,r])),rt=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},it=(e,t)=>e.isLoading&&e.isFetching&&!t,at=(e,t)=>e?.suspense&&t.isPending,ot=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function st({queries:e,...t},n){let r=N(n),i=Xe(),a=$e(),o=j.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{rt(e),et(e,a,r.getQueryCache().get(e.queryHash))}),tt(a);let[s]=j.useState(()=>new We(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;j.useSyncExternalStore(j.useCallback(e=>d?s.subscribe(A.batchCalls(e)):v,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),j.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>at(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&at(n,e)?ot(n,new je(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&nt({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}function ct(e,t,n){let r=Xe(),i=$e(),a=N(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,rt(o),et(o,i,s),tt(i);let l=!a.getQueryCache().get(o.queryHash),[u]=j.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(j.useSyncExternalStore(j.useCallback(e=>{let t=f?u.subscribe(A.batchCalls(e)):v;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),j.useEffect(()=>{u.setOptions(o)},[o,u]),at(o,d))throw ot(o,u,i);if(nt({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!me.isServer()&&it(d,r)&&(l?ot(o,u,i):s?.promise)?.catch(v).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function P(e,t){return ct(e,je,t)}var lt=e(n(),1),ut={Input:0,Resize:1,Ack:2},dt={Output:0,Exit:1,Replay:2,Title:3,Cwd:4};function ft(e){return`'${e.replace(/'/g,`'\\''`)}'`}function pt(e,t){return e.replace(/\{\{\s*(\w+)\s*\}\}/g,(e,n)=>t[n]??``)}var mt=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},ht=(e=>e?mt(e):mt),gt=e=>e;function _t(e,t=gt){let n=j.useSyncExternalStore(e.subscribe,j.useCallback(()=>t(e.getState()),[e,t]),j.useCallback(()=>t(e.getInitialState()),[e,t]));return j.useDebugValue(n),n}var vt=e=>{let t=ht(e),n=e=>_t(t,e);return Object.assign(n,t),n},yt=(e=>e?vt(e):vt),bt=class extends Error{status;constructor(e,t){super(t),this.status=e}};async function F(e,t){let n=await fetch(e,t);if(!n.ok){if(n.status===401)throw new bt(401,`not authorized — open the URL printed by the zuzuu-web daemon`);let e=await n.json().catch(()=>null);throw new bt(n.status,e?.error??`request failed (${n.status})`)}return n.json()}var I=e=>({method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),L={workspace:()=>F(`/api/workspace`),listSessions:()=>F(`/api/sessions`),createSession:(e={})=>F(`/api/sessions`,I(e)),closeSession:e=>F(`/api/sessions/${e}`,{method:`DELETE`}),sessionDetail:e=>F(`/api/sessions/${e}`),listDir:e=>F(`/api/fs/list?path=${encodeURIComponent(e)}`),mkdir:e=>F(`/api/fs/mkdir`,I({path:e})),rename:(e,t)=>F(`/api/fs/rename`,I({from:e,to:t})),remove:e=>F(`/api/fs/delete`,I({paths:e})),downloadUrl:e=>`/api/fs/download?path=${encodeURIComponent(e)}`,openLocal:(e,t=!1)=>F(`/api/fs/open`,I({path:e,reveal:t})),saveRecording:(e,t)=>F(`/api/sessions/${e}/recording`,I({path:t})),search:(e,t={})=>{let n=new URLSearchParams({q:e});return t.path&&n.set(`path`,t.path),t.regex&&n.set(`regex`,`1`),t.caseSensitive&&n.set(`case`,`1`),F(`/api/search?${n}`)},listFiles:()=>F(`/api/files`),listWorkflows:()=>F(`/api/workflows`),saveWorkflow:e=>F(`/api/workflows`,I(e)),readFile:async e=>{let t=await fetch(`/api/fs/download?path=${encodeURIComponent(e)}&inline=1`);if(!t.ok)throw new bt(t.status,`failed to read (${t.status})`);return t.text()},writeFile:(e,t)=>F(`/api/fs/write`,I({path:e,content:t})),gitStatus:()=>F(`/api/git/status`),gitDiff:e=>F(`/api/git/diff?path=${encodeURIComponent(e)}`),gitStage:e=>F(`/api/git/stage`,I({paths:e})),gitUnstage:e=>F(`/api/git/unstage`,I({paths:e})),gitCommit:e=>F(`/api/git/commit`,I({message:e})),history:()=>F(`/api/history`),killPort:e=>F(`/api/fix/kill-port`,I({port:e})),health:()=>F(`/api/health`),workspaceConfig:()=>F(`/api/workspace/config`),setOnboarded:()=>F(`/api/workspace/onboarded`,{method:`POST`}),browse:e=>F(`/api/browse${e?`?path=${encodeURIComponent(e)}`:``}`),browseMkdir:(e,t)=>F(`/api/browse/mkdir`,I({parent:e,name:t})),switchWorkspace:e=>F(`/api/workspace/switch`,I({path:e}))};function xt(e){return`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${e}`}var R=yt((e,t)=>({tabs:[],activeId:null,loaded:!1,init:async()=>{if(t().loaded)return;let n=await L.listSessions();e({tabs:n,activeId:n[n.length-1]?.id??null,loaded:!0})},create:async(t={})=>{let n=await L.createSession(t);e(e=>({tabs:[...e.tabs,n],activeId:n.id}))},close:async t=>{await L.closeSession(t).catch(()=>{}),e(e=>{let n=e.tabs.filter(e=>e.id!==t);return{tabs:n,activeId:e.activeId===t?n[n.length-1]?.id??null:e.activeId}})},setActive:t=>e({activeId:t}),setTitle:(t,n)=>e(e=>({tabs:e.tabs.map(e=>e.id===t?{...e,title:n}:e)})),setCwd:(t,n)=>e(e=>({tabs:e.tabs.map(e=>e.id===t?{...e,cwdLive:n}:e)})),markExited:t=>e(e=>({tabs:e.tabs.map(e=>e.id===t?{...e,alive:!1}:e)})),reset:()=>e({tabs:[],activeId:null,loaded:!1})}));function St(){let e=P({queryKey:[`health`],queryFn:L.health,refetchInterval:5e3,retry:!1,staleTime:4e3}),t=`connected`;return e.isError?t=`disconnected`:e.isLoading&&!e.data&&(t=`reconnecting`),{state:t,uptimeMs:e.data?.uptimeMs??null,rss:e.data?.rss??null}}var Ct=new Map,wt={set:(e,t)=>Ct.set(e,t),delete:e=>Ct.delete(e),get:e=>e?Ct.get(e):void 0};function Tt({state:e}){if(e===`connected`)return null;let t=e===`disconnected`;return(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center justify-center gap-2 py-0.5 text-meta ${t?`bg-danger/90 text-ink-950`:`bg-warn/90 text-ink-950`}`,children:[(0,M.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-app/70`}),t?`Lost connection to the zuzuu-web daemon — retrying…`:`Reconnecting…`,t&&(0,M.jsx)(`button`,{onClick:()=>window.location.reload(),className:`rounded-[var(--radius-sm)] bg-ink-950/20 px-1.5 font-medium hover:bg-ink-950/35`,children:`Reconnect`})]})}function z(...e){return e.filter(Boolean).join(` `)}function Et({children:e,border:t,className:n,surface:r=`surface`}){return(0,M.jsx)(`div`,{className:z(`wc-bar`,r===`app`?`bg-app`:r===`elevated`?`bg-elevated`:r===`transparent`?``:`bg-surface`,t===`t`?`border-t border-border`:t===`none`?``:`border-b border-border`,n),children:e})}var Dt=`wc-focus inline-flex items-center justify-center gap-1.5 rounded-[var(--radius-sm)] font-medium transition-colors disabled:opacity-40 disabled:pointer-events-none whitespace-nowrap`,Ot={primary:`border border-accent-dim bg-[color-mix(in_oklab,var(--color-accent)_14%,transparent)] text-accent hover:bg-[color-mix(in_oklab,var(--color-accent)_22%,transparent)]`,ghost:`text-ink-300 hover:bg-hover hover:text-ink-100`,subtle:`border border-border text-ink-200 hover:border-border-strong hover:text-ink-100`,danger:`text-danger hover:bg-[color-mix(in_oklab,var(--color-danger)_16%,transparent)]`},kt={sm:`h-6 px-2 text-meta`,md:`h-7 px-3 text-ui`};function B({variant:e=`subtle`,size:t=`md`,className:n,...r}){return(0,M.jsx)(`button`,{className:z(Dt,Ot[e],kt[t],n),...r})}function At({iconPath:e,active:t,className:n,...r}){return(0,M.jsx)(`button`,{className:z(`wc-focus flex h-6 w-6 shrink-0 items-center justify-center rounded-[var(--radius-sm)] transition-colors`,t?`text-accent`:`text-ink-400 hover:bg-hover hover:text-ink-100`,n),...r,children:(0,M.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,children:(0,M.jsx)(`path`,{d:e,strokeLinecap:`round`,strokeLinejoin:`round`})})})}function jt({className:e,...t}){return(0,M.jsx)(`input`,{className:z(`wc-input w-full px-2 py-1.5`,e),...t})}function Mt({children:e}){return(0,M.jsx)(`kbd`,{className:`rounded-[var(--radius-sm)] border border-border bg-elevated px-1.5 py-0.5 font-mono text-meta text-ink-300`,children:e})}function Nt({tone:e,pulse:t,title:n}){return(0,M.jsx)(`span`,{title:n,className:z(`h-1.5 w-1.5 shrink-0 rounded-full`,e===`ok`?`bg-accent`:e===`warn`?`bg-warn`:e===`bad`?`bg-danger`:`bg-ink-500`,t&&`animate-pulse`)})}function Pt({className:e}){return(0,M.jsxs)(`svg`,{className:z(`h-3.5 w-3.5 animate-spin text-ink-500`,e),viewBox:`0 0 16 16`,fill:`none`,children:[(0,M.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6`,stroke:`currentColor`,strokeWidth:`2`,strokeOpacity:`0.25`}),(0,M.jsx)(`path`,{d:`M14 8a6 6 0 00-6-6`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`})]})}function Ft({children:e,className:t}){return(0,M.jsx)(`div`,{className:z(`flex h-full items-stretch`,t),children:e})}function It({active:e,onClick:t,onClose:n,dirty:r,leading:i,trailing:a,title:o,children:s,className:c}){return(0,M.jsxs)(`button`,{onClick:t,title:o,className:z(`group/tab relative flex max-w-52 items-center gap-1.5 px-3 text-ui transition-colors`,e?`bg-app text-ink-100`:`text-ink-400 hover:bg-hover hover:text-ink-200`,c),children:[e&&(0,M.jsx)(`span`,{className:`absolute inset-x-0 -bottom-px h-px bg-accent`}),i,(0,M.jsx)(`span`,{className:`truncate`,children:s}),a,n&&(0,M.jsx)(`span`,{role:`button`,tabIndex:-1,onClick:e=>{e.stopPropagation(),n()},className:`ml-0.5 flex h-4 w-4 items-center justify-center rounded-[var(--radius-sm)] text-ink-500 hover:bg-elevated hover:text-ink-100`,children:r?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-ink-300 group-hover/tab:hidden`}),(0,M.jsx)(`span`,{className:`hidden text-meta group-hover/tab:inline`,children:`×`})]}):(0,M.jsx)(`span`,{className:`text-meta`,children:`×`})})]})}function Lt({onClose:e,children:t,align:n=`center`,className:r,z:i=70}){return(0,j.useEffect)(()=>{let t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]),(0,M.jsx)(`div`,{onClick:e,style:{zIndex:i},className:z(`fixed inset-0 flex justify-center bg-black/65 backdrop-blur-[3px]`,n===`top`?`items-start pt-[12vh]`:`items-center`,r),children:t})}function Rt({children:e,className:t,width:n=`md`}){return(0,M.jsx)(`div`,{onClick:e=>e.stopPropagation(),style:{boxShadow:`var(--shadow-dialog)`},className:z(`w-full overflow-hidden rounded-[var(--radius-dialog)] border border-border bg-elevated`,n===`sm`?`max-w-md`:n===`lg`?`max-w-2xl`:`max-w-lg`,t),children:e})}function zt({title:e,onClose:t}){return(0,M.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-4 py-2.5`,children:[(0,M.jsx)(`span`,{className:`text-body font-semibold text-ink-100`,children:e}),t&&(0,M.jsx)(`button`,{onClick:t,className:`ml-auto rounded-[var(--radius-sm)] p-1 text-ink-500 hover:text-ink-100`,title:`Close`,children:(0,M.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,children:(0,M.jsx)(`path`,{d:`M4 4l8 8m0-8l-8 8`,strokeLinecap:`round`})})})]})}var Bt=yt(e=>({current:null,show:t=>e({current:t}),clear:()=>e({current:null})}));function Vt(e){return new Promise(t=>Bt.getState().show({kind:`prompt`,...e,resolve:t}))}function Ht(e){return new Promise(t=>Bt.getState().show({kind:`confirm`,...e,resolve:t}))}function Ut(){let e=Bt(e=>e.current),t=Bt(e=>e.clear),[n,r]=(0,j.useState)(``);if((0,j.useEffect)(()=>{e?.kind===`prompt`&&r(e.defaultValue??``)},[e]),!e)return null;let i=n=>{e.resolve(n),t()};return(0,M.jsx)(Lt,{z:90,onClose:()=>i(e.kind===`prompt`?null:!1),children:(0,M.jsxs)(Rt,{width:`sm`,className:`p-4`,children:[(0,M.jsx)(`div`,{className:`mb-3 text-body font-semibold text-ink-100`,children:e.title}),e.kind===`prompt`?(0,M.jsx)(jt,{autoFocus:!0,value:n,placeholder:e.placeholder,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&n.trim()&&i(n.trim())}}):e.message&&(0,M.jsx)(`p`,{className:`text-ui text-ink-300`,children:e.message}),(0,M.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,M.jsx)(B,{variant:`ghost`,onClick:()=>i(e.kind===`prompt`?null:!1),children:`Cancel`}),e.kind===`prompt`?(0,M.jsx)(B,{variant:`primary`,disabled:!n.trim(),onClick:()=>i(n.trim()),children:e.okLabel??`OK`}):(0,M.jsx)(B,{variant:e.danger?`danger`:`primary`,onClick:()=>i(!0),children:e.okLabel??`Confirm`})]})]})})}var Wt=e(r(),1);function Gt({items:e,className:t=``,title:n=`More actions`,align:r=`right`,iconPath:i}){let[a,o]=(0,j.useState)(!1),s=(0,j.useRef)(null);return(0,M.jsxs)(`div`,{className:`relative`,children:[(0,M.jsx)(`button`,{ref:s,title:n,"data-menu-open":a||void 0,onClick:e=>{e.stopPropagation(),o(e=>!e)},className:`flex h-6 w-6 items-center justify-center rounded-[var(--radius-sm)] text-ink-400 hover:bg-hover hover:text-ink-100 ${t}`,children:i?(0,M.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,children:(0,M.jsx)(`path`,{d:i,strokeLinecap:`round`,strokeLinejoin:`round`})}):(0,M.jsxs)(`svg`,{viewBox:`0 0 16 16`,className:`h-3.5 w-3.5`,fill:`currentColor`,children:[(0,M.jsx)(`circle`,{cx:`3`,cy:`8`,r:`1.3`}),(0,M.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.3`}),(0,M.jsx)(`circle`,{cx:`13`,cy:`8`,r:`1.3`})]})}),a&&(0,M.jsx)(Jt,{items:e,onClose:()=>o(!1),anchorEl:s.current,ignore:s,align:r})]})}var Kt=8,qt=4;function Jt({items:e,onClose:t,align:n=`right`,x:r,y:i,anchorEl:a,ignore:o}){let s=(0,j.useRef)(null),[c,l]=(0,j.useState)(null);return(0,j.useLayoutEffect)(()=>{let e=s.current;if(!e)return;let t=e.offsetWidth,o=e.offsetHeight,c,u;if(a){let e=a.getBoundingClientRect();c=n===`left`?e.left:e.right-t,u=e.bottom+qt,u+o>window.innerHeight-Kt&&(u=e.top-qt-o)}else c=r??0,u=i??0;c=Math.max(Kt,Math.min(c,window.innerWidth-Kt-t)),u=Math.max(Kt,Math.min(u,window.innerHeight-Kt-o)),l({left:c,top:u})},[a,n,r,i]),(0,j.useEffect)(()=>{let e=e=>{let n=e.target;s.current?.contains(n)||o?.current?.contains(n)||t()},n=e=>{e.key===`Escape`&&t()},r=e=>{e.target instanceof Node&&s.current?.contains(e.target)||t()};return window.addEventListener(`mousedown`,e,!0),window.addEventListener(`keydown`,n),window.addEventListener(`scroll`,r,!0),window.addEventListener(`resize`,t),()=>{window.removeEventListener(`mousedown`,e,!0),window.removeEventListener(`keydown`,n),window.removeEventListener(`scroll`,r,!0),window.removeEventListener(`resize`,t)}},[t,o]),(0,Wt.createPortal)((0,M.jsx)(`div`,{ref:s,role:`menu`,style:{position:`fixed`,left:c?.left??0,top:c?.top??0,visibility:c?void 0:`hidden`,boxShadow:`var(--shadow-menu)`},onClick:e=>e.stopPropagation(),className:`z-[80] min-w-44 overflow-hidden rounded-[var(--radius-ui)] border border-border bg-elevated py-1`,children:e.map((e,n)=>(0,M.jsxs)(`div`,{children:[e.separated&&n>0&&(0,M.jsx)(`div`,{className:`my-1 border-t border-border`}),(0,M.jsxs)(`button`,{disabled:e.disabled,onClick:n=>{n.stopPropagation(),!e.disabled&&(e.onClick(),t())},className:`flex w-full items-center gap-2 px-3 py-1 text-left text-ui ${e.disabled?`cursor-default text-ink-600`:`hover:bg-hover ${e.danger?`text-danger hover:text-danger`:`text-ink-200 hover:text-ink-100`}`}`,children:[e.iconPath?(0,M.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`h-3.5 w-3.5 shrink-0`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,children:(0,M.jsx)(`path`,{d:e.iconPath,strokeLinecap:`round`,strokeLinejoin:`round`})}):(0,M.jsx)(`span`,{className:`w-3.5 shrink-0`}),e.label,e.hint&&(0,M.jsx)(`span`,{className:`ml-auto pl-4 text-meta text-ink-600`,children:e.hint})]})]},e.label))}),document.body)}function Yt({workspaceName:e,onOpenVaultPicker:t,onDismiss:n}){return(0,M.jsx)(Lt,{onClose:n,children:(0,M.jsxs)(Rt,{className:`p-7`,children:[(0,M.jsx)(`div`,{className:`mb-1 text-3xl text-accent`,children:`❯_`}),(0,M.jsx)(`h1`,{className:`text-base font-semibold text-ink-100`,children:`Welcome to zuzuu-web`}),(0,M.jsxs)(`p`,{className:`mt-1.5 text-body leading-relaxed text-ink-300`,children:[`A native-feeling terminal, file explorer, and editor for your machine — in the browser. You're working in`,` `,(0,M.jsx)(`span`,{className:`text-accent`,children:e??`this folder`}),`. Everything stays local.`]}),(0,M.jsxs)(`div`,{className:`mt-5 grid grid-cols-3 gap-2 text-ui`,children:[(0,M.jsx)(Xt,{kbd:`⌘K`,label:`Jump to a file or command`}),(0,M.jsx)(Xt,{kbd:`⌘R`,label:`Re-run a recent command`}),(0,M.jsx)(Xt,{kbd:`⌘⇧O`,label:`Switch workspace`})]}),(0,M.jsxs)(`div`,{className:`mt-6 flex items-center gap-2`,children:[(0,M.jsx)(B,{variant:`subtle`,onClick:t,children:`Open a different folder…`}),(0,M.jsx)(B,{variant:`primary`,onClick:n,className:`ml-auto px-4`,children:`Start working`})]})]})})}function Xt({kbd:e,label:t}){return(0,M.jsxs)(`div`,{className:`rounded-[var(--radius-ui)] border border-border bg-surface p-2`,children:[(0,M.jsx)(`div`,{className:`font-mono text-accent`,children:e}),(0,M.jsx)(`div`,{className:`mt-0.5 text-ink-400`,children:t})]})}var Zt=e=>e.replace(/^\/Users\/[^/]+/,`~`).replace(/^\/home\/[^/]+/,`~`);function Qt(e){if(!e.startsWith(`/`))return[];let t=/^(\/Users\/[^/]+|\/home\/[^/]+)(?:\/|$)/.exec(e)?.[1],n=t?[{label:`~`,path:t}]:[{label:`/`,path:`/`}],r=t?e.slice(t.length):e;for(let e of r.split(`/`).filter(Boolean)){let t=n[n.length-1].path;n.push({label:e,path:t===`/`?`/${e}`:`${t}/${e}`})}return n}function $t(e,t,n=5){let r=[],i=new Set;for(let a of e)if(!(!a||a===t||i.has(a))&&(i.add(a),r.push(a),r.length>=n))break;return r}function en({recent:e,currentRoot:t,onClose:n,onPick:r}){let[i,a]=(0,j.useState)(t),o=P({queryKey:[`browse`,i??`~`],queryFn:()=>L.browse(i)}),s=o.data?.path,c=o.data?.parent??null,l=s?Qt(s):[],u=$t(e,t,5),d=async()=>{if(!s)return;let e=await Vt({title:`New folder`,placeholder:`created here, then opened`,okLabel:`Create`});if(e)try{r((await L.browseMkdir(s,e)).path)}catch(e){window.alert(e.message)}};return(0,M.jsx)(Lt,{onClose:n,children:(0,M.jsxs)(Rt,{width:`lg`,className:`flex h-[60vh] flex-col !max-w-xl`,children:[(0,M.jsx)(zt,{title:`Open a folder as workspace`,onClose:n}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-y-0.5 border-b border-border px-3 py-1.5 text-ui`,children:[l.length===0&&(0,M.jsx)(`span`,{className:`text-ink-500`,children:`…`}),l.map((e,t)=>(0,M.jsxs)(`span`,{className:`flex max-w-full items-center`,children:[t>0&&(0,M.jsx)(`span`,{className:`px-0.5 text-ink-600`,children:`/`}),e.path===s?(0,M.jsx)(`span`,{className:`truncate rounded px-0.5 text-ink-100`,title:e.path,children:e.label}):(0,M.jsx)(`button`,{onClick:()=>a(e.path),className:`truncate rounded px-0.5 text-ink-400 hover:bg-hover hover:text-ink-100`,title:e.path,children:e.label})]},e.path))]}),(0,M.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto py-1`,children:[o.isLoading&&(0,M.jsx)(`div`,{className:`px-3 py-2 text-ui text-ink-500`,children:`loading…`}),o.error&&(0,M.jsx)(`div`,{className:`px-3 py-2 text-ui text-danger`,children:o.error.message}),c&&(0,M.jsxs)(`div`,{className:`flex cursor-default items-center gap-2 px-3 py-1 text-ui text-ink-400 hover:bg-hover hover:text-ink-100`,onClick:()=>a(c),title:c,children:[(0,M.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`h-3.5 w-3.5 shrink-0`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,children:(0,M.jsx)(`path`,{d:`M8 12V4m0 0L4.5 7.5M8 4l3.5 3.5`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,M.jsx)(`span`,{children:`.. (parent)`})]}),o.data?.dirs.length===0&&(0,M.jsx)(`div`,{className:`px-3 py-2 text-ui text-ink-500`,children:`no subfolders`}),o.data?.dirs.map(e=>(0,M.jsxs)(`div`,{className:`group flex cursor-default items-center gap-2 px-3 py-1 text-ui hover:bg-hover`,onClick:()=>a(e.path),onDoubleClick:()=>r(e.path),title:`Click to browse into ${e.name}`,children:[(0,M.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`h-3.5 w-3.5 shrink-0 text-accent-dim`,fill:`currentColor`,children:(0,M.jsx)(`path`,{d:`M1.5 3.5A1.5 1.5 0 013 2h3l1.5 1.5H13A1.5 1.5 0 0114.5 5v7A1.5 1.5 0 0113 13.5H3A1.5 1.5 0 011.5 12v-8.5z`})}),(0,M.jsx)(`span`,{className:`truncate text-ink-100`,children:e.name}),(0,M.jsx)(`button`,{onClick:t=>{t.stopPropagation(),r(e.path)},title:`Open ${e.name} as workspace`,className:`ml-auto hidden shrink-0 rounded border border-border px-2 py-0.5 text-meta text-accent group-hover:block hover:bg-hover`,children:`Open`}),(0,M.jsx)(`span`,{className:`ml-auto shrink-0 text-ink-600 group-hover:hidden`,children:`›`})]},e.path))]}),u.length>0&&(0,M.jsxs)(`div`,{className:`border-t border-border px-2 py-1.5`,children:[(0,M.jsx)(`div`,{className:`px-1 py-0.5 text-meta uppercase tracking-wider text-ink-500`,children:`Recent`}),(0,M.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:u.map(e=>(0,M.jsx)(`button`,{onClick:()=>r(e),title:e,className:`max-w-full truncate rounded border border-border px-2 py-0.5 text-meta text-ink-300 hover:border-accent-dim hover:text-ink-100`,children:Zt(e)},e))})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border px-3 py-2`,children:[(0,M.jsx)(B,{variant:`ghost`,onClick:()=>void d(),children:`New folder…`}),(0,M.jsx)(B,{variant:`primary`,className:`ml-auto`,onClick:()=>s&&r(s),disabled:!s,children:`Open this folder`})]})]})})}var tn=yt(e=>({command:null,open:t=>e({command:t}),close:()=>e({command:null})}));function nn(e){let t=[];for(let n of e.matchAll(/\{\{\s*(\w+)\s*\}\}/g))t.includes(n[1])||t.push(n[1]);return t}function rn({title:e,children:t,onClose:n}){return(0,M.jsx)(Lt,{onClose:n,align:`top`,className:`pt-[15vh]`,children:(0,M.jsxs)(Rt,{width:`sm`,className:`p-4`,children:[(0,M.jsx)(`div`,{className:`mb-3 text-body font-semibold text-ink-100`,children:e}),t]})})}var an=`wc-input w-full px-2 py-1.5`;function on(){let e=tn(e=>e.command),t=tn(e=>e.close),n=N(),[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``);if((0,j.useEffect)(()=>{e!==null&&(c(e),i(``),o(``))},[e]),e===null)return null;let l=nn(s).map(e=>({name:e,placeholder:e})),u=async()=>{if(!r.trim()||!s.trim())return;let e={name:r.trim(),command:s.trim(),description:a.trim()||void 0,args:l.length?l:void 0};await L.saveWorkflow(e),n.invalidateQueries({queryKey:[`workflows`]}),t()};return(0,M.jsx)(rn,{title:`Save as workflow`,onClose:t,children:(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(`input`,{className:an,placeholder:`name`,autoFocus:!0,value:r,onChange:e=>i(e.target.value)}),(0,M.jsx)(`input`,{className:an,placeholder:`description (optional)`,value:a,onChange:e=>o(e.target.value)}),(0,M.jsx)(`textarea`,{className:`${an} h-20 font-mono`,value:s,onChange:e=>c(e.target.value)}),(0,M.jsxs)(`p`,{className:`text-meta text-ink-500`,children:[`Use `,(0,M.jsx)(`code`,{className:`text-accent`,children:`{{arg}}`}),` for prompts.`,l.length>0&&` Args: ${l.map(e=>e.name).join(`, `)}`]}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-2 pt-1`,children:[(0,M.jsx)(B,{variant:`ghost`,onClick:t,children:`cancel`}),(0,M.jsx)(B,{variant:`primary`,onClick:()=>void u(),children:`save`})]})]})})}function sn({workflow:e,onClose:t}){let n=R(e=>e.activeId),[r,i]=(0,j.useState)({});if((0,j.useEffect)(()=>{if(e){let t={};for(let n of e.args??[])t[n.name]=n.default??``;i(t)}},[e]),!e)return null;let a=e.args??nn(e.command).map(e=>({name:e})),o=()=>{let i=pt(e.command,r);wt.get(n)?.sendInput(`\x15${i}\r`),t()};return(0,M.jsx)(rn,{title:`Run: ${e.name}`,onClose:t,children:(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(`p`,{className:`truncate font-mono text-meta text-ink-500`,children:e.command}),a.map((e,t)=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`mb-0.5 block text-meta text-ink-400`,children:e.name}),(0,M.jsx)(`input`,{className:an,autoFocus:t===0,placeholder:e.placeholder??e.name,value:r[e.name]??``,onChange:t=>i(n=>({...n,[e.name]:t.target.value})),onKeyDown:e=>{e.key===`Enter`&&o()}})]},e.name)),(0,M.jsxs)(`div`,{className:`flex justify-end gap-2 pt-1`,children:[(0,M.jsx)(B,{variant:`ghost`,onClick:t,children:`cancel`}),(0,M.jsx)(B,{variant:`primary`,onClick:o,children:`run`})]})]})})}function cn(e){return e.diff?`diff:${e.path}`:e.path}var ln=yt((e,t)=>({openFiles:[],activePath:null,buffers:{},mdPreview:{},open:n=>{let r=cn(n),i=t().openFiles.some(e=>cn(e)===r);e(e=>({openFiles:i?e.openFiles:[...e.openFiles,n],activePath:r})),!i&&!n.diff&&!t().buffers[r]&&un(r,n.path,e)},close:n=>{t().buffers[n]?.dirty&&!window.confirm(`Discard unsaved changes?`)||e(e=>{let t=e.openFiles.filter(e=>cn(e)!==n),r=e.activePath===n?t[t.length-1]?cn(t[t.length-1]):null:e.activePath,i={...e.buffers};return delete i[n],{openFiles:t,activePath:r,buffers:i}})},setActive:t=>e({activePath:t}),setValue:(t,n)=>e(e=>{let r=e.buffers[t];return r?{buffers:{...e.buffers,[t]:{...r,value:n,dirty:n!==r.original}}}:e}),save:async n=>{let r=t().buffers[n];if(!(!r||!r.dirty||r.saving)){e(e=>({buffers:{...e.buffers,[n]:{...r,saving:!0}}}));try{await L.writeFile(n,r.value),e(e=>{let t=e.buffers[n];return t?{buffers:{...e.buffers,[n]:{...t,original:t.value,dirty:!1,saving:!1}}}:e})}catch(t){e(e=>{let r=e.buffers[n];return r?{buffers:{...e.buffers,[n]:{...r,saving:!1,error:t.message}}}:e})}}},saveActive:()=>{let e=t().activePath;e&&!e.startsWith(`diff:`)&&t().save(e)},toggleMdPreview:t=>e(e=>({mdPreview:{...e.mdPreview,[t]:!e.mdPreview[t]}})),reload:n=>{let r=t().buffers[n];r&&!r.dirty&&un(n,n,e)},resetAll:()=>e({openFiles:[],activePath:null,buffers:{},mdPreview:{}})}));async function un(e,t,n){n(t=>({buffers:{...t.buffers,[e]:{original:``,value:``,dirty:!1,saving:!1,loading:!0}}}));try{let r=await L.readFile(t);n(t=>({buffers:{...t.buffers,[e]:{original:r,value:r,dirty:!1,saving:!1,loading:!1}}}))}catch(t){n(n=>({buffers:{...n.buffers,[e]:{original:``,value:``,dirty:!1,saving:!1,loading:!1,error:t.message}}}))}}var dn=cn,V=yt(e=>({mode:`faculties`,drill:null,showFiles:()=>e(e=>ln.getState().openFiles.length>0?{mode:`files`}:e),showFaculties:()=>e({mode:`faculties`,drill:null}),openFaculty:t=>e({mode:`faculties`,drill:{kind:`faculty`,key:t}}),openSession:t=>e({mode:`faculties`,drill:{kind:`session`,id:t}}),closeDrill:()=>e({drill:null})}));ln.subscribe((e,t)=>{if(e.openFiles.length===0){t.openFiles.length>0&&V.setState({mode:`faculties`,drill:null});return}(e.openFiles.length>t.openFiles.length||e.activePath!==t.activePath)&&V.setState({mode:`files`})});var fn=class extends Error{status;stderr;data;constructor(e,t,n,r){super(t),this.status=e,this.stderr=n,this.data=r}},pn=e=>e instanceof fn&&e.status===503;function mn(e){return pn(e)?`zuzuu CLI required — npm i -g @zuzuucodes/cli`:e instanceof fn&&e.stderr?e.stderr:e instanceof Error?e.message:String(e)}async function H(e,t){let n=await fetch(`/api/zuzuu${e}`,t);if(!n.ok){let e=await n.json().catch(()=>null);throw new fn(n.status,e?.error??`request failed (${n.status})`,e?.stderr,e?.data)}return n.json()}var U=e=>({method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),W={health:()=>H(`/health`),status:()=>H(`/status`),faculties:()=>H(`/faculties`),overview:()=>H(`/overview`),faculty:e=>H(`/faculty/${encodeURIComponent(e)}`),facultySchema:e=>H(`/faculty/${encodeURIComponent(e)}/schema`),inbox:()=>H(`/inbox`),generations:()=>H(`/generations`),generation:e=>H(`/generation/${encodeURIComponent(e)}`),sessions:()=>H(`/sessions`),sessionInspect:e=>H(`/session-inspect/${encodeURIComponent(e)}`),digest:()=>H(`/digest`),evalRanked:()=>H(`/eval`),hosts:()=>H(`/hosts`),approveProposal:(e,t)=>H(`/proposals/${encodeURIComponent(e)}/approve`,U({faculty:t})),rejectProposal:(e,t,n)=>H(`/proposals/${encodeURIComponent(e)}/reject`,U(n?{faculty:t,reason:n}:{faculty:t})),approveAction:e=>H(`/actions/${encodeURIComponent(e)}/approve`,U({})),rejectAction:e=>H(`/actions/${encodeURIComponent(e)}/reject`,U({})),mintGeneration:e=>H(`/generation/mint`,U({from:e})),rollback:e=>H(`/generation/${encodeURIComponent(e)}/rollback`,U({})),sessionGit:()=>H(`/session`),sessionMerge:()=>H(`/session/merge`,U({})),sessionContinue:()=>H(`/session/continue`,U({})),sessionDiscard:()=>H(`/session/discard`,U({}))},hn={fact:`M8 2.5a5.5 5.5 0 110 11 5.5 5.5 0 010-11M8 5.5v.5M8 8v3`,entity:`M8 2l5 2.5v7L8 14l-5-2.5v-7L8 2M3 4.5L8 7l5-2.5M8 7v7`,command:`M3 4l3.5 4L3 12M8.5 12H13`,decision:`M4 13.5V8a4 4 0 014-4h4.5M10 1.5L13 4l-3 2.5`,episode:`M8 2.5a5.5 5.5 0 110 11 5.5 5.5 0 010-11M8 5v3.2l2.2 1.6`,runbook:`M4 2.5h8.5v11H5.5A1.5 1.5 0 014 12V2.5M4 10.5h8.5`,script:`M5.5 4L2.5 8l3 4M10.5 4l3 4-3 4`,steering:`M4 2.5v11M4 3.5h7.5L9.5 6l2 2.5H4`,amendment:`M3 13l.7-2.8 7.5-7.5a1.1 1.1 0 011.6 0l.5.5a1.1 1.1 0 010 1.6L5.8 12.3 3 13`,rule:`M8 2l4.5 1.8v3.5c0 3-1.9 5.1-4.5 6.2-2.6-1.1-4.5-3.2-4.5-6.2V3.8L8 2`},gn=e=>e&&hn[e]||`M4.5 2.5h5L12 5v8.5H4.5v-11M9 2.5V5.5H12`,_n=[`knowledge`,`memory`,`actions`,`instructions`,`guardrails`],vn={knowledge:{label:`Knowledge`,icon:`M6.3 13.5h3.4M6.8 11.5h2.4M8 2.5a3.9 3.9 0 012.2 7.1c-.5.4-.7 1.1-.7 1.9H6.5c0-.8-.2-1.5-.7-1.9A3.9 3.9 0 018 2.5`,emptyHeadline:`No knowledge yet`,teach:`Facts zuzuu learns from your sessions land here after your approval.`},memory:{label:`Memory`,icon:`M8 2.5a5.5 5.5 0 110 11 5.5 5.5 0 010-11M8 5v3.2l2.2 1.6`,emptyHeadline:`No memories yet`,teach:`Episodes — distilled records of past sessions — accumulate here as you work.`},actions:{label:`Actions`,icon:`M9 1.5L3.5 9H7l-.5 5.5L12 7H8.5L9 1.5`,emptyHeadline:`No actions yet`,teach:`Procedures zuzuu sees you repeat become reusable runbooks once you approve them.`},instructions:{label:`Instructions`,icon:`M4 2.5v11M4 3.5h7.5L9.5 6l2 2.5H4`,emptyHeadline:`No instructions yet`,teach:`Steering — the pinned guidance your agent reads at every session start — lives here.`},guardrails:{label:`Guardrails`,icon:`M8 2l4.5 1.8v3.5c0 3-1.9 5.1-4.5 6.2-2.6-1.1-4.5-3.2-4.5-6.2V3.8L8 2`,emptyHeadline:`No guardrails yet`,teach:`Hard rules enforced on tool calls — a refusal here is policy, not preference.`}},yn={book:vn.knowledge.icon,clock:vn.memory.icon,play:vn.actions.icon,compass:vn.instructions.icon,shield:vn.guardrails.icon},bn=e=>e in vn;function xn(e,t){let n=bn(e)?vn[e]:void 0,r=t?.title??n?.label??e.charAt(0).toUpperCase()+e.slice(1),i=t?.ui?.icon;return{label:r,icon:(i&&yn[i])??n?.icon??`M4.5 2.5h5L12 5v8.5H4.5v-11M9 2.5V5.5H12`,emptyHeadline:n?.emptyHeadline??`No ${r.toLowerCase()} yet`,teach:t?.ui?.teaching??n?.teach??`Items graduate here through your review.`}}function Sn(e,t=Date.now()){if(!e)return null;let n=Date.parse(e);if(Number.isNaN(n))return null;let r=Math.max(0,Math.floor((t-n)/1e3));if(r<60)return`just now`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);if(a<24)return`${a}h ago`;let o=Math.floor(a/24);if(o<30)return`${o}d ago`;let s=Math.floor(o/30);return s<12?`${s}mo ago`:`${Math.floor(o/365)}y ago`}function Cn({label:e,value:t,delta:n,tone:r=`default`,title:i}){return(0,M.jsxs)(`span`,{title:i,className:`inline-flex items-baseline gap-1 rounded-ui border border-border bg-surface px-2 py-0.5 text-meta`,children:[(0,M.jsx)(`span`,{className:`text-ink-500`,children:e}),(0,M.jsx)(`span`,{className:z(`font-medium`,r===`ok`?`text-status-ok`:r===`pending`?`text-status-pending`:`text-ink-100`),children:t}),n&&(0,M.jsx)(`span`,{className:`text-ink-500`,children:n})]})}function wn({kind:e,title:t,status:n,timestamp:r,onClick:i,compact:a=!1,titleAttr:o}){let s=Sn(r),c=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`h-3.5 w-3.5 shrink-0 text-ink-500`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,children:(0,M.jsx)(`path`,{d:gn(e),strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,M.jsx)(`span`,{className:`min-w-0 truncate text-ink-300`,children:t}),n===`pending`&&(0,M.jsx)(`span`,{className:`shrink-0 rounded-full bg-[color-mix(in_oklab,var(--color-status-pending)_16%,transparent)] px-1.5 text-meta leading-4 text-status-pending`,children:`pending`}),n===`archived`&&(0,M.jsx)(`span`,{className:`shrink-0 rounded-full bg-hover px-1.5 text-meta leading-4 text-ink-500`,children:`archived`}),s&&(0,M.jsx)(`span`,{className:`ml-auto shrink-0 text-meta text-ink-600`,children:s})]}),l=z(`flex w-full min-w-0 items-center gap-2 text-left text-ui`,a?`py-0.5`:`border-b border-border py-1 last:border-0`);return i?(0,M.jsx)(`button`,{onClick:i,className:z(l,`transition-colors hover:bg-hover`),title:o,children:c}):(0,M.jsx)(`div`,{className:l,title:o,children:c})}function Tn({display:e,count:t,pending:n,onOpen:r}){return(0,M.jsxs)(`button`,{onClick:r,className:`wc-focus group relative flex aspect-square w-full flex-col items-center justify-center gap-1.5 rounded-ui border border-border bg-surface p-card text-center transition-colors hover:border-border-strong hover:bg-hover`,title:n>0?`Open ${e.label} — ${n} pending review`:`Open ${e.label}`,children:[n>0&&(0,M.jsx)(`span`,{className:`absolute right-2 top-2 h-1.5 w-1.5 rounded-full bg-status-pending`,"aria-label":`${n} pending`}),(0,M.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`h-5 w-5 text-ink-300 transition-colors group-hover:text-ink-100`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,children:(0,M.jsx)(`path`,{d:e.icon,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,M.jsx)(`span`,{className:`text-ui font-medium text-ink-100`,children:e.label}),(0,M.jsx)(`span`,{className:z(`text-meta`,t>0?`text-ink-500`:`text-ink-600`),children:t===0?`empty`:t})]})}function En({display:e,cta:t}){return(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-6 text-center`,children:[(0,M.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`h-12 w-12 text-ink-600`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.1`,children:(0,M.jsx)(`path`,{d:e.icon,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,M.jsx)(`div`,{className:`text-ui font-medium text-ink-300`,children:e.emptyHeadline}),(0,M.jsx)(`p`,{className:`max-w-60 text-meta leading-relaxed text-ink-500`,children:e.teach}),t&&(0,M.jsx)(B,{size:`sm`,variant:`subtle`,onClick:t.onClick,children:t.label})]})}function G({label:e,trailing:t,children:n}){return(0,M.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,M.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,M.jsx)(`div`,{className:`text-meta uppercase tracking-wide text-ink-500`,children:e}),t&&(0,M.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:t})]}),n]})}var Dn=yt(e=>({open:!1,setOpen:t=>e({open:t})}));function On(e){return e.filter(e=>e.counts.pending>0).map(e=>({id:e.id,title:e.title,pending:e.counts.pending}))}var kn=e=>e.reduce((e,t)=>e+t.counts.pending,0);function An(e){let t=e.find(e=>e.state===`active`)??null;return{active:t,rest:e.filter(e=>e!==t)}}function jn(e){switch(e){case`active`:return{label:`active`,tone:`ok`,pulse:!0};case`opening`:return{label:`opening`,tone:`idle`,pulse:!0};case`completed`:return{label:`completed`,tone:`ok`,pulse:!1};case`abandoned`:return{label:`abandoned`,tone:`warn`,pulse:!1};case`crashed`:return{label:`crashed`,tone:`danger`,pulse:!1};case`captured`:return{label:`captured`,tone:`idle`,pulse:!1};default:return{label:e??`—`,tone:`idle`,pulse:!1}}}function Mn(e,t){return t?e.filter(e=>(e.provenance??[]).some(e=>e.session===t)):[]}function Nn(e){return e==null||!Number.isFinite(e)||e<0?null:e<6e4?`${Math.round(e/1e3)}s`:e<36e5?`${(e/6e4).toFixed(1)}m`:`${Math.floor(e/36e5)}h ${Math.round(e%36e5/6e4)}m`}var Pn=e=>e.slice(0,8);function Fn({faculties:e,status:t,zuzuuBin:n}){let r=V(e=>e.openFaculty),i=Dn(e=>e.setOpen),a=On(e),o=kn(e),s=t?.drift?.dirty??!1,c=a.length===0&&!s&&n;return(0,M.jsxs)(G,{label:`needs you`,trailing:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Cn,{label:`⟡`,value:t?.activeGeneration??`no gen`,title:`active generation`}),o>0&&(0,M.jsxs)(B,{size:`sm`,variant:`primary`,onClick:()=>i(!0),children:[`Review `,o]})]}),children:[!n&&(0,M.jsxs)(`div`,{className:`rounded-ui border border-warn/40 bg-[color-mix(in_oklab,var(--color-warn)_10%,transparent)] px-3 py-2 text-ui text-warn`,children:[`zuzuu CLI required — `,(0,M.jsx)(`code`,{children:`npm i -g @zuzuucodes/cli`})]}),s&&(0,M.jsxs)(`div`,{className:`rounded-ui border border-warn/40 bg-[color-mix(in_oklab,var(--color-warn)_10%,transparent)] px-3 py-2 text-ui text-warn`,children:[`drift detected — run `,(0,M.jsx)(`code`,{children:`zuzuu doctor`})]}),a.length>0&&(0,M.jsx)(`div`,{className:`flex flex-col`,children:a.map(t=>{let n=xn(t.id,e.find(e=>e.id===t.id));return(0,M.jsxs)(`button`,{onClick:()=>r(t.id),className:`flex w-full items-center gap-2 border-b border-border py-1.5 text-left text-ui transition-colors last:border-0 hover:bg-hover`,title:`Open ${t.title}`,children:[(0,M.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`h-3.5 w-3.5 shrink-0 text-ink-500`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,children:(0,M.jsx)(`path`,{d:n.icon,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,M.jsx)(`span`,{className:`text-ink-100`,children:t.title}),(0,M.jsxs)(`span`,{className:`text-status-pending`,children:[`· `,t.pending,` to review`]}),(0,M.jsx)(`span`,{className:`ml-auto text-ink-600`,children:`›`})]},t.id)})}),c&&(0,M.jsx)(`div`,{className:`py-1 text-meta text-ink-600`,children:`all caught up`})]})}var In=new class{ws=null;watched=new Set;listener=null;retries=0;started=!1;start(e){this.listener=e,!this.started&&(this.started=!0,this.watched.add(``),this.connect())}connect(){let e=new WebSocket(xt(`/ws/fs`));this.ws=e,e.onopen=()=>{this.retries=0;for(let t of this.watched)e.send(JSON.stringify({type:`watch`,path:t}))},e.onmessage=e=>{try{let t=JSON.parse(e.data);t.type===`changed`&&this.listener?.(t.path)}catch{}},e.onclose=()=>{if(this.ws=null,this.retries>=6)return;let e=Math.min(500*2**this.retries,8e3);this.retries+=1,setTimeout(()=>this.connect(),e)}}watch(e){this.watched.has(e)||(this.watched.add(e),this.send({type:`watch`,path:e}))}unwatch(e){e===``||!this.watched.delete(e)||this.send({type:`unwatch`,path:e})}send(e){this.ws?.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(e))}},K=yt(e=>({expanded:new Set,selected:null,renaming:null,setRenaming:t=>e({renaming:t}),searchOpen:!1,searchSeed:null,openSearch:t=>e({searchOpen:!0,searchSeed:t??null}),closeSearch:()=>e({searchOpen:!1,searchSeed:null}),toggle:t=>e(e=>{let n=new Set(e.expanded);return n.has(t)?(n.delete(t),In.unwatch(t)):(n.add(t),In.watch(t)),{expanded:n}}),collapseAll:()=>e(e=>{for(let t of e.expanded)In.unwatch(t);return{expanded:new Set}}),select:t=>e({selected:t}),openPreview:e=>ln.getState().open(e),openPreviewPath:e=>ln.getState().open({path:e,name:e.split(`/`).pop()??e}),revealPath:t=>e(e=>{let n=new Set(e.expanded),r=t.split(`/`).slice(0,-1),i=``;for(let e of r)i=i?`${i}/${e}`:e,n.has(i)||(n.add(i),In.watch(i));return{expanded:n,selected:t}}),resetAll:()=>e({expanded:new Set,selected:null,searchOpen:!1,searchSeed:null})})),Ln=`.zuzuu`,Rn=`${Ln}/.live/digest.md`,zn=e=>`${Ln}/${e}`,Bn=e=>`${zn(e)}/README.md`,Vn=e=>`${zn(e)}/schema.json`;function Hn(e){return e===`actions`?null:e===`memory`?`${Ln}/memory/entries`:`${zn(e)}/items`}function Un(e,t){return e===`actions`?`${Ln}/actions/${t}/ACTION.md`:`${Hn(e)}/${t}.md`}function Wn(){let e=P({queryKey:[`zuzuu`,`digest`],queryFn:W.digest,refetchInterval:6e3}),[t,n]=(0,j.useState)(!1),r=e.data?.text??``,i=r.trim()!==``;return(0,M.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-l-2 border-border pl-2.5`,children:[(0,M.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,M.jsxs)(`button`,{onClick:()=>n(e=>!e),className:`flex items-baseline gap-1 text-meta text-ink-500 transition-colors hover:text-ink-300`,title:t?`Collapse the session brief`:`Expand the session brief`,children:[(0,M.jsx)(`span`,{className:`inline-block w-2`,children:t?`▾`:`▸`}),`Session brief`]}),!t&&(0,M.jsx)(`span`,{className:`min-w-0 truncate text-meta text-ink-600`,children:i?r.trim().split(`
3
+ `)[0]??``:`none yet`}),i&&(0,M.jsx)(`button`,{onClick:()=>K.getState().openPreviewPath(Rn),className:`ml-auto shrink-0 text-meta text-ink-500 hover:text-accent`,title:`Open ${Rn} in the editor`,children:`open ›`})]}),t&&(i?(0,M.jsx)(`pre`,{className:`max-h-36 overflow-auto whitespace-pre-wrap rounded-ui border border-border bg-surface p-card text-meta text-ink-300`,children:r}):(0,M.jsx)(`div`,{className:`text-meta text-ink-600`,children:`no brief yet — generated each session`}))]})}var Gn={ok:`text-status-ok`,warn:`text-warn`,danger:`text-danger`,idle:`text-ink-500`};function Kn({session:e,pinned:t=!1}){let n=V(e=>e.openSession),r=jn(e.state),i=Nn(e.durationMs),a=Sn(e.startedAt??void 0);return(0,M.jsxs)(`button`,{onClick:()=>n(e.id),className:z(`flex w-full items-center gap-2 py-1.5 text-left text-ui transition-colors hover:bg-hover`,t?``:`border-b border-border last:border-0`),title:`Inspect session ${e.id}`,children:[(0,M.jsx)(Nt,{tone:r.tone===`danger`?`bad`:r.tone===`warn`?`warn`:r.tone===`ok`?`ok`:`idle`,pulse:r.pulse}),(0,M.jsx)(`span`,{className:`text-ink-100`,children:e.host??`?`}),(0,M.jsx)(`span`,{className:z(`text-meta`,Gn[r.tone]),children:r.label}),(0,M.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-baseline gap-2 text-meta text-ink-600`,children:[a&&(0,M.jsx)(`span`,{children:a}),i&&(0,M.jsx)(`span`,{children:i}),(0,M.jsx)(`span`,{className:`font-mono`,children:Pn(e.id)})]})]})}function qn(){let e=P({queryKey:[`zuzuu`,`sessions`],queryFn:W.sessions,refetchInterval:6e3}),{active:t,rest:n}=An(e.data?.sessions??[]),r=(e.data?.sessions??[]).length;return(0,M.jsx)(G,{label:`sessions${r>0?` (${r})`:``}`,children:r===0?(0,M.jsx)(`div`,{className:`py-1 text-meta text-ink-600`,children:`none yet — sessions are captured as you work with a host`}):(0,M.jsxs)(`div`,{className:`flex flex-col`,children:[t&&(0,M.jsxs)(`div`,{className:`mb-1.5 flex flex-col gap-1 rounded-ui border border-border bg-surface px-2 pb-2 pt-0.5`,children:[(0,M.jsx)(Kn,{session:t,pinned:!0}),(0,M.jsx)(Wn,{})]}),n.map(e=>(0,M.jsx)(Kn,{session:e},e.id))]})})}function Jn(e,t){let n=[];return Array.isArray(t.added)&&t.added.length&&n.push(`+${t.added.length} added`),Array.isArray(t.changed)&&t.changed.length?n.push(`~${t.changed.length} changed`):t.changed===!0&&n.push(`changed`),Array.isArray(t.removed)&&t.removed.length&&n.push(`-${t.removed.length} removed`),`${e}: ${n.length?n.join(` · `):`no change`}`}function Yn({id:e}){let t=P({queryKey:[`zuzuu`,`generation`,e],queryFn:()=>W.generation(e)});if(t.isLoading)return(0,M.jsx)(`div`,{className:`text-meta text-ink-500`,children:`loading diff…`});if(t.error)return(0,M.jsx)(`div`,{className:`text-meta text-ink-500`,children:`diff needs the zuzuu CLI on PATH`});let n=t.data;return n?(0,M.jsxs)(`div`,{className:`rounded-ui border border-border bg-surface p-3 text-ui`,children:[(0,M.jsx)(`div`,{className:`mb-1 font-medium text-ink-100`,children:n.id}),(0,M.jsxs)(`div`,{className:`mb-2 text-meta text-ink-500`,children:[`forkedFrom `,n.forkedFrom??`(none)`,` · from `,n.mintedFrom.length,` proposal(s)`]}),(0,M.jsx)(`div`,{className:`flex flex-col gap-0.5 text-meta text-ink-300`,children:Object.entries(n.faculties).map(([e,t])=>(0,M.jsx)(`div`,{children:Jn(e,t)},e))})]}):null}function Xn(){let[e,t]=(0,j.useState)(null),n=P({queryKey:[`zuzuu`,`generations`],queryFn:W.generations,refetchInterval:4e3}),r=n.data?.generations??[];return(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(`div`,{className:`text-meta uppercase tracking-wide text-ink-500`,children:`generations`}),r.length===0?(0,M.jsx)(`div`,{className:`text-meta text-ink-600`,children:`no generations yet — approving proposals mints one`}):(0,M.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:r.map(r=>{let i=r.id===n.data?.active,a=r.id===e;return(0,M.jsxs)(`button`,{onClick:()=>t(a?null:r.id),className:`flex items-center gap-1 rounded-ui border px-2 py-1 text-meta transition-colors ${a?`border-accent bg-elevated`:`border-border bg-surface hover:bg-hover`}`,title:r.mintedAt??``,children:[(0,M.jsx)(`span`,{className:i?`text-accent`:`text-ink-500`,children:`●`}),(0,M.jsx)(`span`,{className:`text-ink-300`,children:r.id})]},r.id)})}),e&&(0,M.jsx)(Yn,{id:e})]})}function Zn({zuzuuBin:e}){let t=V(e=>e.openFaculty),n=P({queryKey:[`zuzuu`,`overview`],queryFn:W.overview,refetchInterval:8e3}),r=P({queryKey:[`zuzuu`,`status`],queryFn:W.status,refetchInterval:8e3}),i=n.data?.faculties??[],a=[..._n.filter(e=>i.length===0||i.some(t=>t.id===e)),...i.map(e=>e.id).filter(e=>!_n.includes(e))];return(0,M.jsxs)(`div`,{className:`flex flex-col gap-5 p-3`,children:[(0,M.jsx)(Fn,{faculties:i,status:r.data,zuzuuBin:e}),(0,M.jsx)(qn,{}),(0,M.jsxs)(G,{label:`faculties`,children:[(0,M.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:a.map(e=>{let n=i.find(t=>t.id===e);return(0,M.jsx)(Tn,{display:xn(e,n),count:n?.counts.items??0,pending:n?.counts.pending??0,onOpen:()=>t(e)},e)})}),(0,M.jsx)(Xn,{})]})]})}function Qn({data:e,onApprove:t,onReject:n}){return(0,M.jsxs)(`div`,{className:`group flex items-center gap-2 border-b border-border py-1 text-ui last:border-0`,children:[(0,M.jsx)(`span`,{className:`shrink-0 text-meta text-ink-500`,children:e.faculty}),(0,M.jsx)(`span`,{className:`truncate text-ink-300`,children:e.title}),(t||n)&&(0,M.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100`,children:[t&&(0,M.jsx)(At,{title:`Approve`,iconPath:`M3 8.5l3.5 3.5L13 4.5`,className:`hover:!text-accent`,onClick:t}),n&&(0,M.jsx)(At,{title:`Reject`,iconPath:`M4 4l8 8m0-8l-8 8`,className:`hover:!text-danger`,onClick:n})]})]})}var $n=e=>K.getState().openPreviewPath(e),er=`zuzuu.hint.graduation`,tr=()=>{try{return localStorage.getItem(er)===`1`}catch{return!0}};function nr({facultyKey:e}){let t=N(),n=V(e=>e.closeDrill),[r,i]=(0,j.useState)(null),[a,o]=(0,j.useState)(tr),s=xn(e,P({queryKey:[`zuzuu`,`overview`],queryFn:W.overview,refetchInterval:8e3}).data?.faculties.find(t=>t.id===e)),c=P({queryKey:[`zuzuu`,`faculty`,e],queryFn:()=>W.faculty(e),refetchInterval:4e3}),l=async e=>{i(null);try{await e(),t.invalidateQueries({queryKey:[`zuzuu`]})}catch(e){i(mn(e))}},u=t=>void l(()=>e===`actions`?W.approveAction(t.id):W.approveProposal(t.id,t.faculty)),d=async t=>{await Ht({title:`Reject proposal?`,message:t.title,okLabel:`Reject`,danger:!0})&&l(()=>e===`actions`?W.rejectAction(t.id):W.rejectProposal(t.id,t.faculty))},f=()=>{o(!0);try{localStorage.setItem(er,`1`)}catch{}},p=c.data?.proposals??[],m=c.data?.items??[],h=c.data?.errors??[],g=p.length===0&&m.length===0&&h.length===0;return(0,M.jsxs)(`div`,{className:`wc-slide-in flex flex-col gap-4 p-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`button`,{onClick:n,className:`text-meta text-ink-500 transition-colors hover:text-accent`,title:`Back to all faculties`,children:`‹ All faculties`}),(0,M.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5 text-ui font-medium text-ink-100`,children:[(0,M.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`h-3.5 w-3.5 text-ink-300`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,children:(0,M.jsx)(`path`,{d:s.icon,strokeLinecap:`round`,strokeLinejoin:`round`})}),s.label]})]}),!a&&(0,M.jsxs)(`div`,{className:`flex items-start gap-2 rounded-ui border border-border bg-surface p-card-sm text-meta text-ink-400`,children:[(0,M.jsx)(`span`,{className:`min-w-0`,children:`items graduate through review — nothing changes without your approval`}),(0,M.jsx)(`button`,{onClick:f,className:`ml-auto shrink-0 text-ink-600 hover:text-ink-300`,title:`Dismiss`,children:`✕`})]}),g?(0,M.jsx)(En,{display:s}):(0,M.jsxs)(M.Fragment,{children:[p.length>0&&(0,M.jsx)(G,{label:`pending proposals (${p.length})`,children:(0,M.jsx)(`div`,{className:`flex flex-col`,children:p.map(e=>(0,M.jsx)(Qn,{data:e,onApprove:()=>u(e),onReject:()=>void d(e)},e.id))})}),(0,M.jsx)(G,{label:`items (${m.length})`,children:m.length===0?(0,M.jsx)(`div`,{className:`text-meta text-ink-600`,children:`none yet — approved proposals land here`}):(0,M.jsx)(`div`,{className:`flex flex-col`,children:m.map(t=>(0,M.jsx)(wn,{kind:t.kind,title:t.title,status:t.status===`archived`?`archived`:void 0,timestamp:t.updated_at??t.created_at,onClick:()=>$n(Un(e,t.id)),titleAttr:Un(e,t.id)},t.id))})}),h.length>0&&(0,M.jsx)(G,{label:`unparseable (${h.length})`,children:h.map(e=>(0,M.jsxs)(`div`,{className:`truncate text-meta text-danger`,title:e.error,children:[`✗ `,e.file,`: `,e.error]},e.file))})]}),r&&(0,M.jsx)(`div`,{className:`break-all font-mono text-meta text-danger`,children:r}),(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(`button`,{onClick:()=>$n(Vn(e)),className:`text-meta text-ink-500 hover:text-accent`,title:Vn(e),children:`schema.json ›`}),(0,M.jsx)(`button`,{onClick:()=>$n(Bn(e)),className:`text-meta text-ink-500 hover:text-accent`,title:Bn(e),children:`faculty README ›`})]})]})}function rr({sessionId:e}){let t=V(e=>e.closeDrill),n=P({queryKey:[`zuzuu`,`session-inspect`,e],queryFn:()=>W.sessionInspect(e),refetchInterval:8e3,retry:!1}),r=P({queryKey:[`zuzuu`,`sessions`],queryFn:W.sessions,refetchInterval:6e3}),i=n.data?.session??r.data?.sessions.find(t=>t.id===e),a=Mn(st({queries:_n.map(e=>({queryKey:[`zuzuu`,`faculty`,e],queryFn:()=>W.faculty(e),staleTime:8e3}))}).flatMap(e=>e.data?.items??[]),e),o=jn(i?.state),s=n.data?.trace,c=Object.entries(n.data?.signals??{}),l=n.data?.warnings??[];return(0,M.jsxs)(`div`,{className:`wc-slide-in flex flex-col gap-4 p-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`button`,{onClick:t,className:`text-meta text-ink-500 transition-colors hover:text-accent`,title:`Back to the panel`,children:`‹ Sessions`}),(0,M.jsxs)(`span`,{className:`ml-auto flex min-w-0 items-baseline gap-2 text-ui font-medium text-ink-100`,children:[(0,M.jsx)(`span`,{className:`truncate`,children:i?.host??`session`}),(0,M.jsx)(`span`,{className:`font-mono text-meta text-ink-500`,children:Pn(e)}),(0,M.jsx)(`span`,{className:`text-meta text-ink-500`,children:o.label})]})]}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,M.jsx)(Cn,{label:`spans`,value:s?.spans==null?`—`:String(s.spans),title:`OTLP spans in the stored trace`}),(0,M.jsx)(Cn,{label:`tools`,value:s?.tools==null?String(i?.counts?.tools??`—`):String(s.tools),title:`tool calls`}),(0,M.jsx)(Cn,{label:`duration`,value:Nn(s?.duration??i?.durationMs)??`—`,title:`session duration`}),i?.counts?.errors!==void 0&&i.counts.errors>0&&(0,M.jsx)(Cn,{label:`errors`,value:String(i.counts.errors),tone:`pending`,title:`errored tool calls`})]}),n.error!=null&&(0,M.jsx)(`div`,{className:`rounded-ui border border-warn/40 bg-[color-mix(in_oklab,var(--color-warn)_10%,transparent)] px-3 py-2 text-meta text-warn`,children:pn(n.error)?`trace inspection needs the zuzuu CLI — npm i -g @zuzuucodes/cli`:mn(n.error)}),n.data&&(0,M.jsx)(G,{label:`signals`,children:c.length===0?(0,M.jsx)(`div`,{className:`text-meta text-ink-600`,children:`no signals mined`}):(0,M.jsx)(`div`,{className:`flex flex-col`,children:c.map(([e,t])=>{let n=xn(e),r=Object.entries(t).filter(([,e])=>e>0);return(0,M.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border py-1 text-ui last:border-0`,children:[(0,M.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`h-3.5 w-3.5 shrink-0 text-ink-500`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,children:(0,M.jsx)(`path`,{d:n.icon,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,M.jsx)(`span`,{className:`text-ink-300`,children:n.label}),(0,M.jsx)(`span`,{className:`ml-auto text-meta text-ink-500`,children:r.length===0?`—`:r.map(([e,t])=>`${e} ${t}`).join(` · `)})]},e)})})}),(0,M.jsx)(G,{label:`graduated from this session (${a.length})`,children:a.length===0?(0,M.jsx)(`div`,{className:`text-meta text-ink-600`,children:`nothing graduated yet — approve proposals via review`}):(0,M.jsx)(`div`,{className:`flex flex-col`,children:a.map(e=>(0,M.jsx)(wn,{kind:e.kind,title:e.title,timestamp:e.updated_at??e.created_at,onClick:()=>K.getState().openPreviewPath(Un(e.faculty,e.id)),titleAttr:Un(e.faculty,e.id)},`${e.faculty}-${e.id}`))})}),l.length>0&&(0,M.jsx)(G,{label:`warnings`,children:l.map(e=>(0,M.jsxs)(`div`,{className:`text-meta text-warn`,children:[`⚠ `,e]},e))})]})}var ir=`modulepreload`,ar=function(e){return`/`+e},or={},sr=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),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}))))}r=o(t.map(t=>{if(t=ar(t,n),t in or)return;or[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:ir,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}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)})},cr=(0,j.lazy)(()=>sr(()=>import(`./EditorPane-94QPFR9R.js`).then(e=>({default:e.EditorPane})),__vite__mapDeps([0,1,2,3])));function lr({zuzuuHome:e,zuzuuBin:t,onCollapse:n}){let r=V(e=>e.mode),i=V(e=>e.drill),a=V(e=>e.showFiles),o=V(e=>e.showFaculties),s=ln(e=>e.openFiles.length>0);return r===`files`&&s?(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(`div`,{className:`flex h-full items-center justify-center text-ui text-ink-500`,children:`loading editor…`}),children:(0,M.jsx)(cr,{leading:(0,M.jsx)(`button`,{onClick:o,className:`shrink-0 self-stretch border-r border-border px-2 text-meta text-ink-500 transition-colors hover:text-accent`,title:`Show faculties (editor tabs stay open)`,children:`‹ faculties`})})}):(0,M.jsxs)(`div`,{className:`flex h-full min-w-0 flex-col bg-surface`,children:[(0,M.jsxs)(Et,{border:`b`,children:[(0,M.jsx)(`span`,{className:`min-w-0 truncate text-meta uppercase tracking-wide text-ink-500`,children:i===null?`zuzuu`:i.kind===`faculty`?`zuzuu · ${xn(i.key).label}`:`zuzuu · session ${Pn(i.id)}`}),s&&(0,M.jsx)(`button`,{onClick:a,className:`ml-auto shrink-0 px-1 text-meta text-ink-500 transition-colors hover:text-accent`,title:`Back to the open files`,children:`files ›`}),(0,M.jsx)(At,{title:`Collapse panel`,iconPath:`M6 4l4 4-4 4`,onClick:n,className:s?``:`ml-auto`})]}),(0,M.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:e?i?.kind===`faculty`?(0,M.jsx)(nr,{facultyKey:i.key}):i?.kind===`session`?(0,M.jsx)(rr,{sessionId:i.id}):(0,M.jsx)(Zn,{zuzuuBin:t}):(0,M.jsx)(ur,{zuzuuBin:t})})]})}function ur({zuzuuBin:e}){return(0,M.jsxs)(`div`,{className:`flex flex-col gap-2 p-4 text-ui leading-relaxed text-ink-500`,children:[(0,M.jsx)(`div`,{className:`text-ink-300`,children:`No zuzuu home in this project yet.`}),(0,M.jsx)(`p`,{children:`Once set up, your agent's faculties — knowledge, memory, actions, instructions, guardrails — live here and grow from real sessions.`}),!e&&(0,M.jsxs)(`p`,{className:`text-meta`,children:[`zuzuu CLI required — `,(0,M.jsx)(`code`,{className:`text-warn`,children:`npm i -g @zuzuucodes/cli`})]})]})}function dr(e,t){let n=e.map(e=>({kind:`proposal`,id:e.id,faculty:e.faculty,title:e.title,score:e.score,confidence:e.confidence,rationale:e.rationale})),r=new Set(n.map(e=>e.id));for(let e of t)r.has(e.id)||(r.add(e.id),n.push({kind:`action`,id:e.id,faculty:`actions`,title:e.title,score:null,confidence:null,rationale:null}));return n}function fr(e){return{queue:e,index:0,approvedIds:[],cliAbsent:!1,error:null}}function pr(e,t){switch(t.type){case`approved`:return{...e,approvedIds:[...e.approvedIds,t.id],index:e.index+1,error:null};case`rejected`:case`skipped`:return{...e,index:e.index+1,error:null};case`cli-absent`:return{...e,cliAbsent:!0};case`failed`:return{...e,error:t.message}}}var mr=e=>e.queue[e.index]??null,hr=e=>e.index>=e.queue.length;function gr(){let e=Dn(e=>e.open),t=Dn(e=>e.setOpen);return e?(0,M.jsx)(_r,{onClose:()=>t(!1)}):null}function _r({onClose:e}){let t=N(),n=P({queryKey:[`zuzuu`,`eval`],queryFn:W.evalRanked}),r=P({queryKey:[`zuzuu`,`faculty`,`actions`],queryFn:()=>W.faculty(`actions`)}),[i,a]=(0,j.useState)(null);(0,j.useEffect)(()=>{i===null&&n.data&&r.data&&a(fr(dr(n.data.ranked,r.data.proposals)))},[i,n.data,r.data]);let[o,s]=(0,j.useState)(!1),[c,l]=(0,j.useState)(!1),[u,d]=(0,j.useState)(``),[f,p]=(0,j.useState)({phase:`idle`}),m=e=>{a(t=>t&&pr(t,e)),l(!1),d(``)},h=()=>void t.invalidateQueries({queryKey:[`zuzuu`]}),g=e=>m(pn(e)?{type:`cli-absent`}:{type:`failed`,message:mn(e)}),_=async e=>{s(!0);try{e.kind===`action`?await W.approveAction(e.id):await W.approveProposal(e.id,e.faculty),m({type:`approved`,id:e.id}),h()}catch(e){g(e)}finally{s(!1)}},v=async e=>{s(!0);try{e.kind===`action`?await W.rejectAction(e.id):await W.rejectProposal(e.id,e.faculty,u.trim()||void 0),m({type:`rejected`}),h()}catch(e){g(e)}finally{s(!1)}},y=i?.approvedIds??[],b=(0,j.useCallback)(async e=>{p({phase:`minting`});try{p({phase:`done`,id:(await W.mintGeneration(e)).id}),t.invalidateQueries({queryKey:[`zuzuu`]})}catch(e){p({phase:`error`,message:mn(e)})}},[t]),x=i!==null&&hr(i),[S,C]=(0,j.useState)(!1),w=x||S,T=()=>{i&&!x&&y.length>0&&f.phase===`idle`?C(!0):e()},E=(0,j.useRef)(!1);(0,j.useEffect)(()=>{w&&y.length>0&&f.phase===`idle`&&!E.current&&(E.current=!0,b(y))},[w,y,f.phase,b]);let D=i?mr(i):null;return(0,M.jsx)(Lt,{onClose:T,children:(0,M.jsxs)(Rt,{width:`lg`,children:[(0,M.jsx)(zt,{title:i&&!w?(0,M.jsxs)(M.Fragment,{children:[`Review `,(0,M.jsxs)(`span`,{className:`font-normal text-ink-500`,children:[`· `,i.index+1,` of `,i.queue.length]})]}):`Review`,onClose:T}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[i?.cliAbsent&&(0,M.jsxs)(`div`,{className:`rounded-[var(--radius-sm)] border border-warn/40 bg-[color-mix(in_oklab,var(--color-warn)_10%,transparent)] px-3 py-2 text-ui text-warn`,children:[`zuzuu CLI required — `,(0,M.jsx)(`code`,{children:`npm i -g @zuzuucodes/cli`})]}),i===null&&(0,M.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-ui text-ink-500`,children:[(0,M.jsx)(Pt,{}),` loading queue…`]}),i!==null&&w&&(0,M.jsx)(yr,{approvedCount:y.length,mint:f,onRetry:()=>void b(y),onDone:e}),i!==null&&!w&&D&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(vr,{item:D}),i.error&&(0,M.jsx)(`div`,{className:`break-all font-mono text-meta text-danger`,children:i.error}),c?(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(jt,{autoFocus:!0,value:u,placeholder:`reason (optional)`,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!o&&v(D)}}),(0,M.jsx)(B,{variant:`danger`,disabled:o||i.cliAbsent,onClick:()=>void v(D),children:`Confirm reject`}),(0,M.jsx)(B,{variant:`ghost`,disabled:o,onClick:()=>{l(!1),d(``)},children:`Cancel`})]}):(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(B,{variant:`primary`,disabled:o||i.cliAbsent,onClick:()=>void _(D),children:`Approve`}),(0,M.jsx)(B,{variant:`danger`,disabled:o||i.cliAbsent,onClick:()=>l(!0),children:`Reject`}),(0,M.jsx)(B,{variant:`ghost`,disabled:o,onClick:()=>m({type:`skipped`}),children:`Skip`}),o&&(0,M.jsx)(Pt,{}),(0,M.jsxs)(`span`,{className:`ml-auto text-meta text-ink-500`,children:[y.length,` approved`]})]})]})]})]})})}function vr({item:e}){return(0,M.jsxs)(`div`,{className:`rounded-ui border border-border bg-surface p-3`,children:[(0,M.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`rounded-[var(--radius-sm)] bg-hover px-1.5 py-0.5 text-meta text-accent-dim`,children:e.faculty}),e.kind===`action`&&(0,M.jsx)(`span`,{className:`rounded-[var(--radius-sm)] border border-border px-1.5 py-0.5 text-meta text-ink-400`,children:`action inbox`}),e.score!==null&&(0,M.jsxs)(`span`,{className:`ml-auto text-meta text-ink-400`,children:[`score `,e.score,e.confidence?` · ${e.confidence}`:``]})]}),(0,M.jsx)(`div`,{className:`text-ui text-ink-100`,children:e.title}),(0,M.jsx)(`div`,{className:`mt-1 font-mono text-meta text-ink-600`,children:e.id}),e.rationale&&(0,M.jsx)(`div`,{className:`mt-2 text-meta text-ink-400`,children:e.rationale})]})}function yr({approvedCount:e,mint:t,onRetry:n,onDone:r}){return(0,M.jsxs)(`div`,{className:`flex flex-col items-start gap-3 py-2`,children:[e===0&&(0,M.jsx)(`div`,{className:`text-ui text-ink-300`,children:`All caught up — nothing pending review.`}),t.phase===`minting`&&(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-ui text-ink-300`,children:[(0,M.jsx)(Pt,{}),` minting generation…`]}),t.phase===`done`&&(0,M.jsxs)(`div`,{className:`text-ui text-ink-100`,children:[`generation `,(0,M.jsx)(`span`,{className:`text-accent`,children:t.id}),` minted from `,e,` approval`,e===1?``:`s`]}),t.phase===`error`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`break-all font-mono text-meta text-danger`,children:[`mint failed: `,t.message]}),(0,M.jsx)(B,{variant:`primary`,onClick:n,children:`Retry mint`})]}),t.phase!==`minting`&&t.phase!==`error`&&(0,M.jsx)(B,{variant:`subtle`,onClick:r,children:`Done`})]})}var br=[{name:`claude-code`,label:`Claude Code`,command:`claude`,spawn:{command:`claude`,args:[],host:`claude`}},{name:`gemini-cli`,label:`Gemini CLI`,command:`gemini`,spawn:{command:`gemini`,args:[],host:`gemini`}},{name:`codex`,label:`Codex`,command:`codex`,spawn:{command:`codex`,args:[],host:`codex`}},{name:`pi`,label:`pi`,command:`pi`,spawn:{command:`pi`,args:[],host:`pi`}}],xr={label:`OpenCode (bundled)`,command:`zuzuu code`,spawn:{command:`zuzuu`,args:[`code`],host:`opencode`}};function Sr(e){let t=new Set(e.map(e=>e.name));return[...br.map(e=>({label:e.label,command:e.command,detected:t.has(e.name)})),{label:xr.label,command:xr.command,detected:!0}]}function Cr(e){return e.find(e=>e.detected)??null}function wr(e){if(e===xr.command)return{...xr.spawn,args:[...xr.spawn.args]};let t=br.find(t=>t.command===e);return t?{...t.spawn,args:[...t.spawn.args]}:null}var Tr={claude:`Claude Code`,gemini:`Gemini CLI`,codex:`Codex`,pi:`pi`,opencode:`OpenCode`};function Er(e){return(e===void 0?void 0:Tr[e])??e??`agent`}function Dr(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Or(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function kr(e){return e/100*window.innerHeight}function Ar(e){return e/100*window.innerWidth}function jr(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function Mr({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=jr(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Or(t,i);break;case`em`:r=Dr(t,i);break;case`vh`:r=kr(i);break;case`vw`:r=Ar(i);break}return r}function q(e){return parseFloat(e.toFixed(3))}function Nr({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function Pr(e){let{panels:t}=e,n=Nr({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=q(Mr({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=q(Mr({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=q(Mr({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=q(Mr({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function J(e,t=`Assertion error`){if(!e)throw Error(t)}function Fr(e,t){return Array.from(t).sort(e===`horizontal`?Ir:Lr)}function Ir(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Lr(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function Rr(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function zr(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function Br({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=zr(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return J(i,`No rect found`),i}var Vr;function Hr(){return Vr===void 0&&(Vr=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),Vr}function Ur(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Fr(n,Array.from(t.children).filter(Rr).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,Br({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=Hr()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:Nr({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var Wr=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},Y=new Map,Gr=new Wr;function Kr(e){Y=new Map(Y),Y.delete(e)}function qr(e,t){for(let[t]of Y)if(t.id===e)return t}function Jr(e,t){for(let[t,n]of Y)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Yr(){return Y}function Xr(e,t){return Gr.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function X(e,t){let n=Y.get(e);Y=new Map(Y),Y.set(e,t),Gr.emit(`groupChange`,{group:e,prev:n,next:t})}function Zr(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=zr(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function Qr(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function $r(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:ai(e),b:ai(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();J(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:ii(ri(n.a)),b:ii(ri(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var ei=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function ti(e){let t=getComputedStyle(oi(e)??e).display;return t===`flex`||t===`inline-flex`}function ni(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||ti(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||ei.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function ri(e){let t=e.length;for(;t--;){let n=e[t];if(J(n,`Missing node`),ni(n))return n}return null}function ii(e){return e&&Number(getComputedStyle(e).zIndex)||0}function ai(e){let t=[];for(;e;)t.push(e),e=oi(e);return t}function oi(e){let{parentNode:t}=e;return Qr(t)?t.host:t}function si(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function ci({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Rr(n)||n.contains(e)||e.contains(n))return!0;if($r(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(si(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function li(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Ur(r),a=Zr(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&ci({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function ui(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Z(e,t,n=0){return Math.abs(q(e)-q(t))<=n}function Q(e,t){return Z(e,t)?0:e>t?1:-1}function di({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(Q(r,c)<0)if(a){let e=(i+c)/2;r=Q(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=q(r),r}function fi({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Z(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;J(u!=null,`Invalid first pivot index`),J(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];J(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(J(n!=null,`Previous layout not found for panel index ${t}`),Z(n,i)){let t=o-n;Q(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];J(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(J(n!=null,`Previous layout not found for panel index ${t}`),Z(n,o)){let t=n-i;Q(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];J(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&Q(i,c)<0)if(e>0){let t=c-o,n=t/2;Q(i+e,c)<0&&(e=Q(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;Q(i-e,c)<0&&(e=Q(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];J(e!=null,`Previous layout not found for panel index ${r}`);let a=di({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];J(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=di({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Z(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(ui(c,l))return i;{let t=e<0?d:u,r=s[t];J(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=di({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Z(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];J(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=di({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Z(i,s)||(t-=s-i,l[r]=s),Z(t,0))break;e>0?r--:r++}}}if(!Z(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function pi(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Q(e[n],t[n])!==0)return!1;return!0}function mi({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!Z(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];J(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];J(i!=null,`No layout data found for index ${e}`);let o=r[e];J(o!=null,`No layout data found for index ${e}`);let s=di({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Z(a,0))for(let e=0;e<t.length;e++){let n=r[e];J(n!=null,`No layout data found for index ${e}`);let i=n+a,o=di({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Z(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function hi({groupId:e,panelId:t}){let n=()=>{let t=Yr();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),s=n.findIndex(e=>e.id===t),c=s===0,l=s===n.length-1;if(l&&e<o&&(c||n.slice(0,s).every((e,t)=>{let n=i[t];return n?.collapsible&&Z(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:q(100-e)}}return fi({delta:l?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:l?[s-1,s]:[s,s+1],prevLayout:r,trigger:`imperative-api`})},s=e=>{if(e===a())return;let{defaultLayoutDeferred:t,derivedPanelConstraints:r,group:i,groupSize:s,layout:c,separatorToPanels:l}=n(),u=mi({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});pi(c,u)||X(i,{defaultLayoutDeferred:t,derivedPanelConstraints:r,groupSize:s,layout:u,separatorToPanels:l})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),o=a();e&&o!==t&&(n.expandToSize=o,s(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:o}=i(),c=a();if(e&&c===t){let e=o.expandToSize??n;e===0&&(e=1),s(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&Z(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Nr({group:t});s(q(Mr({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function gi(e){e.defaultPrevented||li(e,Yr()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=hi({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function _i(e){let t=Yr();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function vi({groupId:e}){let t=()=>{let t=Yr();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=mi({layout:e,panelConstraints:r});return n?o:(pi(o,c)||X(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function yi(e,t){let n=_i(e),r=Jr(n.id,!0),i=n.separators.find(t=>t.element===e);J(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);J(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=vi({groupId:n.id}).getLayout(),c=mi({layout:fi({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});pi(s,c)||X(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function bi(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=_i(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&yi(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&yi(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&yi(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&yi(t,-5);break;case`End`:e.preventDefault(),yi(t,100);break;case`Enter`:{e.preventDefault();let n=_i(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Jr(n.id,!0),o=n.separators.find(e=>e.element===t);J(o,`Matching separator not found`);let s=a.get(o);J(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(J(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];yi(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=_i(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);J(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),yi(t,-100);break}}var xi={cursorFlags:0,state:`inactive`},Si=new Wr;function Ci(){return xi}function wi(e){return Si.addListener(`change`,e)}function Ti(e){let t=xi,n={...xi};n.cursorFlags=e,xi=n,Si.emit(`change`,{prev:t,next:n})}function Ei(e){let t=xi;xi=e,Si.emit(`change`,{prev:t,next:e})}function Di(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Yr(),n=li(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),Ei({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var Oi=e=>e,ki=()=>{},Ai=1,ji=2,Mi=4,Ni=8,Pi=3,Fi=12,Ii;function Li(){return Ii===void 0&&(Ii=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Ii=!0)),Ii}function Ri({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&Li()){let t=(e&Ai)!==0,n=(e&ji)!==0,r=(e&Mi)!==0,i=(e&Ni)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return Li()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var zi=new WeakMap;function Bi(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=zi.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=Ci();switch(r.state){case`active`:case`hover`:{let e=Ri({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}zi.set(e,{prevStyle:t,styleSheet:n})}function Vi({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=fi({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(pi(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Ai:ji;break;case`vertical`:s|=d<0?Mi:Ni;break}}else X(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&Pi:c|=s&Pi,t.movementY===0?c|=o&Fi:c|=s&Fi,Ti(c),Bi(e)}function Hi(e){let t=Yr(),n=Ci();switch(n.state){case`active`:Vi({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Ui(e){if(e.defaultPrevented)return;let t=Ci(),n=Yr();switch(t.state){case`active`:if(e.buttons===0){Ei({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=Jr(e.group.id,!0);X(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}Vi({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=li(e,n);r.length===0?t.state!==`inactive`&&Ei({cursorFlags:0,state:`inactive`}):Ei({cursorFlags:0,hitRegions:r,state:`hover`}),Bi(e.currentTarget);break}}}function Wi(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Ci().state){case`hover`:Ei({cursorFlags:0,state:`inactive`})}}function Gi(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Ci();switch(t.state){case`active`:Ei({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Bi(e.currentTarget),t.hitRegions.forEach(e=>{let t=Jr(e.group.id,!0);X(e.group,t)}),e.preventDefault())}}function Ki(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=q(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=q((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function qi(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Nr({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:q(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Ji(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Yi({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=q(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=q((r[e]??0)/a*l);else{let e=q(l/c.length);for(let t of c)u[t]=e}return u}function Xi(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var Zi=new Map;function Qi(e){let t=!0;J(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=Nr({group:e});if(t===0)return;let n=Jr(e.id);if(!n)return;let r=Pr(e),i=n.defaultLayoutDeferred?Ki(r):n.layout,a=mi({layout:Yi({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&pi(n.layout,a)&&Ji(n.derivedPanelConstraints,r)&&n.groupSize===t)return;X(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else qi(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{J(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=Nr({group:e}),s=Pr(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Xi(e.panels,l)||(l=void 0));let u=mi({layout:e.mutableState.layouts[c]??l??Ki(s),panelConstraints:s}),d=e.element.ownerDocument;Zi.set(d,(Zi.get(d)??0)+1);let f=new Map;return Ur(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),X(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{J(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,bi)}),Zi.get(d)===1&&(d.addEventListener(`dblclick`,gi,!0),d.addEventListener(`pointerdown`,Di,!0),d.addEventListener(`pointerleave`,Hi),d.addEventListener(`pointermove`,Ui),d.addEventListener(`pointerout`,Wi),d.addEventListener(`pointerup`,Gi,!0)),function(){t=!1,Zi.set(d,Math.max(0,(Zi.get(d)??0)-1)),Kr(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,bi)}),Zi.get(d)||(d.removeEventListener(`dblclick`,gi,!0),d.removeEventListener(`pointerdown`,Di,!0),d.removeEventListener(`pointerleave`,Hi),d.removeEventListener(`pointermove`,Ui),d.removeEventListener(`pointerout`,Wi),d.removeEventListener(`pointerup`,Gi,!0)),a.disconnect()}}function $i(){let[e,t]=(0,j.useState)({});return[e,(0,j.useCallback)(()=>t({}),[])]}function ea(e){let t=(0,j.useId)();return`${e??t}`}var ta=typeof window<`u`?j.useLayoutEffect:j.useEffect;function na(e){let t=(0,j.useRef)(e);return ta(()=>{t.current=e},[e]),(0,j.useCallback)((...e)=>t.current?.(...e),[t])}function ra(...e){return na(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function ia(e){let t=(0,j.useRef)({...e});return ta(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var aa=(0,j.createContext)(null);function oa(e,t){let n=(0,j.useRef)({getLayout:()=>({}),setLayout:Oi});(0,j.useImperativeHandle)(t,()=>n.current,[]),ta(()=>{Object.assign(n.current,vi({groupId:e}))})}function sa({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,j.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=na(e=>{pi(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=na(e=>{pi(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=ea(s),v=(0,j.useRef)(null),[y,b]=$i(),x=(0,j.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=ra(v,a);oa(_,o);let C=na((e,t)=>{let r=Ci(),i=qr(e),a=Jr(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=ia({defaultLayout:n,disableCursor:r}),T=(0,j.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=Fr(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Fr(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=qr(_),i=Jr(_);r&&i&&X(r,{...i,derivedPanelConstraints:Pr(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[C,_,b,u,w]),E=(0,j.useRef)(null);return ta(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=w.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!w.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};E.current=r;let a=Qi(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Jr(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=Xr(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=Z(t.collapsedSize,i[t.panelId]),a=Z(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Ci().state!==`active`;h(i),o&&g(i)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,j.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,M.jsx)(aa.Provider,{value:T,children:(0,M.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}sa.displayName=`Group`;function ca(){let e=(0,j.useContext)(aa);return J(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function la(e,t){let{id:n}=ca(),r=(0,j.useRef)({collapse:ki,expand:ki,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:ki});(0,j.useImperativeHandle)(t,()=>r.current,[]),ta(()=>{Object.assign(r.current,hi({groupId:n,panelId:e}))})}function ua({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=ea(c),_=ia({disabled:a}),v=(0,j.useRef)(null),y=ra(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=ca(),T=d!==null,E=na((e,t,n)=>{d?.(e,c,n)});ta(()=>{let e=v.current;if(e!==null)return C({element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:T?E:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}})},[s,n,r,i,T,g,h,l,u,E,C,_]),(0,j.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),la(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,j.useSyncExternalStore)(e=>Xr(x,e),D,D),ee;return ee=O?JSON.parse(O):i===void 0?{flexGrow:1}:{flexGrow:void 0,flexShrink:void 0,flexBasis:i},(0,M.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...da,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...ee},children:(0,M.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}ua.displayName=`Panel`;var da={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function fa({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=mi({layout:fi({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=mi({layout:fi({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function pa({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=ea(a),l=ia({disabled:n,disableDoubleClick:r}),[u,d]=(0,j.useState)({}),[f,p]=(0,j.useState)(`inactive`),[m,h]=(0,j.useState)(!1),g=(0,j.useRef)(null),_=ra(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=ca(),C=b===`horizontal`?`vertical`:`horizontal`;ta(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=wi(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Xr(y,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(fa({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,j.useEffect)(()=>{S(c,{disabled:n,disableDoubleClick:r})},[n,r,c,S]);let w;n&&!v&&(w=`not-allowed`);let T;if(n)T=`disabled`;else switch(f){case`active`:T=`active`;break;default:T=m?`focus`:f}return(0,M.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":C,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":T,"data-testid":c,id:c,onBlur:()=>h(!1),onFocus:()=>h(!0),ref:_,role:`separator`,style:{flexBasis:`auto`,cursor:w,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}pa.displayName=`Separator`;function ma({sidebar:e,center:t,right:n,rightCollapsed:r,onExpandRight:i}){return(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,M.jsxs)(sa,{orientation:`horizontal`,className:`min-h-0 flex-1`,children:[(0,M.jsx)(ua,{defaultSize:`22%`,minSize:`160px`,maxSize:`45%`,className:`bg-surface`,children:e}),(0,M.jsx)(pa,{className:`w-px bg-border transition-colors hover:bg-accent-dim`}),(0,M.jsx)(ua,{className:`flex min-w-0 flex-col`,children:t}),!r&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(pa,{className:`w-px bg-border transition-colors hover:bg-accent-dim`}),(0,M.jsx)(ua,{id:`right`,defaultSize:`30%`,minSize:`280px`,className:`min-w-0`,children:n})]})]}),r&&(0,M.jsx)(`button`,{onClick:i,title:`Show panel`,className:`flex w-6 shrink-0 items-center justify-center border-l border-border bg-surface text-ink-500 transition-colors hover:text-accent`,children:`‹`})]})}function ha(e,t,n){let r=Array(e);return new Proxy(r,{get(r,i,a){if(typeof i==`string`){let a=i.charCodeAt(0);if(a>=48&&a<=57){let a=+i;if(Number.isInteger(a)&&a>=0&&a<e){let e=r[a];if(!e){let i=t[a*2];e=r[a]={index:a,key:n(a),start:i,size:t[a*2+1],end:i+t[a*2+1],lane:0}}return e}}if(i===`length`)return e}return Reflect.get(r,i,a)}})}function ga(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return o.length!==r.length||o.some((e,t)=>r[t]!==e)?(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i):i}return o.updateDeps=e=>{r=e},o}function _a(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var va=(e,t)=>Math.abs(e-t)<1.01,ya=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},ba,xa=()=>{if(ba!==void 0)return ba;if(typeof navigator>`u`)return ba=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return ba=!0;let e=navigator.maxTouchPoints;return ba=navigator.platform===`MacIntel`&&e!==void 0&&e>0},Sa=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Ca=e=>e,wa=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},Ta=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(Sa(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(Sa(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},Ea={passive:!0},Da=typeof window>`u`?!0:`onscrollend`in window,Oa=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&Da,o=0,s=a?null:ya(i,()=>t(o,!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,Ea),a&&r.addEventListener(`scrollend`,u,Ea),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u)}},ka=(e,t)=>Oa(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),Aa=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},ja=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},Ma=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Ca,rangeExtractor:wa,onChange:()=>{},measureElement:Aa,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=e>0?s[0]?.key??n.getItemKey(0):null,l=e>0?s[e-1]?.key??n.getItemKey(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==c||t.getItemKey(o-1)!==l)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>e&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==l)&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,s=0;if(r&&this.scrollOffset!==null){let[e,t]=r,n=this.getMeasurements(),{count:i,getItemKey:a}=this.options,c=0;for(;c<i&&a(c)!==e;)c++;if(c<i){let e=n[c];if(e){let n=e.start+t;n!==this.scrollOffset&&(s=n-this.scrollOffset,this.scrollOffset=n,o=!0)}}}(o||i)&&(this.pendingScrollAnchor=[o?r[0]:null,o?r[1]:0,i,s])},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=ga(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,!(!xa()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,Ea),e.addEventListener(`touchend`,n,Ea),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let t=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled){let[e,n,r,i]=t;e!==null&&!r&&(xa()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?i!==0&&(this._iosDeferredAdjustment+=i):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,t)=>{let n=new Map,r=new Map;for(let i=t-1;i>=0;i--){let t=e[i];if(n.has(t.lane))continue;let a=r.get(t.lane);if(a==null||t.end>a.end?r.set(t.lane,t):t.end<a.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurementOptions=ga(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(e,t,n,r,i,a,o)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o}),{key:!1}),this.getMeasurements=ga(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o},s)=>{let c=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let l=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=this.options.gap,a=e*2,o=this._flatMeasurements;if(!o||o.length<a){let e=new Float64Array(a);o&&l>0&&e.set(o.subarray(0,l*2)),o=e,this._flatMeasurements=o}let s;if(l===0)s=t+n;else{let e=l-1;s=o[e*2]+o[e*2+1]+i}for(let t=l;t<e;t++){let e=r(t),n=c.get(e),a=typeof n==`number`?n:this.options.estimateSize(t);o[t*2]=s,o[t*2+1]=a,s+=a+i}let u=ha(e,o,r);return this.measurementsCache=u,u}let u=this.measurementsCache.slice(0,l),d=Array(a).fill(void 0);for(let e=0;e<l;e++){let t=u[e];t&&(d[t.lane]=e)}for(let i=l;i<e;i++){let e=r(i),a=this.laneAssignments.get(i),s,l,f=o===`estimate`||c.has(e);if(a!==void 0&&this.options.lanes>1){s=a;let e=d[s],r=e===void 0?void 0:u[e];l=r?r.end+this.options.gap:t+n}else{let e=this.options.lanes===1?u[i-1]:this.getFurthestMeasurement(u,i);l=e?e.end+this.options.gap:t+n,s=e?e.lane:i%this.options.lanes,this.options.lanes>1&&f&&this.laneAssignments.set(i,s)}let p=c.get(e),m=typeof p==`number`?p:this.options.estimateSize(i),h=l+m;u[i]={index:i,start:l,size:m,end:h,key:e,lane:s},d[s]=i}return this.measurementsCache=u,u},{key:!1,debug:()=>this.options.debug}),this.calculateRange=ga(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>this.range=e.length>0&&t>0?Pa({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:r===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=ga(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(e<0||e>=this.options.count)return;let n,r,i,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=t-(this.itemSizeCache.get(i)??n);if(o!==0){let a=this.options.anchorTo===`end`&&this.scrollState?.behavior!==`smooth`&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,s=a?this.getTotalSize():0,c=this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?r<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!==`backward`:this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:r,size:n,end:r+n,lane:0},o,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++,a?this.applyScrollAdjustment(this.getTotalSize()-s):c&&this.applyScrollAdjustment(o),this.notify(!1)}},this.getVirtualItems=ga(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._flatMeasurements,r=this.options.lanes===1&&n!=null;return _a(t[Na(0,t.length-1,r?e=>n[e*2]:e=>_a(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`)if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t];if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:`start`,behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e=`auto`}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:`end`,behavior:e});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._flatMeasurements;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){e!==0&&(xa()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&va(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},Na=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function Pa({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:i}){let a=e.length-1,o=i?e=>i[e*2]:t=>e[t].start,s=i?e=>i[e*2]+i[e*2+1]:t=>e[t].end;if(e.length<=r)return{startIndex:0,endIndex:a};let c=Na(0,a,o,n),l=c;if(r===1)for(;l<a&&s(l)<n+t;)l++;else if(r>1){let i=Array(r).fill(0);for(;l<a&&i.some(e=>e<n+t);){let t=e[l];i[t.lane]=t.end,l++}let o=Array(r).fill(n+t);for(;c>=0&&o.some(e=>e>=n);){let t=e[c];o[t.lane]=t.start,c--}c=Math.max(0,c-c%r),l=Math.min(a,l+(r-1-l%r))}return{startIndex:c,endIndex:l}}var Fa=typeof document<`u`?j.useLayoutEffect:j.useEffect;function Ia({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=j.useReducer(e=>e+1,0)[1],a=j.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=e=>{let t=a.current;if(!t.enabled)return;let n=e.getTotalSize();if(t.container&&n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}let r=!!e.options.horizontal,i=t.mode===`transform`,o=r?`left`:`top`,s=e.options.scrollMargin,c=e.getVirtualItems();for(let n of c){let a=n.start-s,c=e.elementsCache.get(n.key);c&&t.lastPositions.get(c)!==a&&(t.lastPositions.set(c,a),i?c.style.transform=r?`translate3d(${a}px, 0, 0)`:`translate3d(0, ${a}px, 0)`:c.style[o]=`${a}px`)}},s={...r,onChange:(t,n)=>{var s;let c=a.current,l=!0;if(c.enabled){o(t);let e=t.range,n=c.prevRange;l=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,l&&(c.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}l&&(e&&n?(0,Wt.flushSync)(i):i()),(s=r.onChange)==null||s.call(r,t,n)}},[c]=j.useState(()=>{let e=new Ma(s);return Object.assign(e,{containerRef:t=>{let n=a.current;if(n.container=t,n.lastSize=null,t&&n.enabled){let r=e.getTotalSize();n.lastSize=r;let i=e.options.horizontal?`width`:`height`;t.style[i]=`${r}px`}}})});return c.setOptions(s),Fa(()=>c._didMount(),[]),Fa(()=>c._willUpdate()),Fa(()=>{o(c)}),c}function La(e){return Ia({observeElementRect:Ta,observeElementOffset:ka,scrollToFn:ja,...e})}function Ra(e,t){return[{label:`Copy path`,iconPath:`M6 6h7v7H6zM3 10V3h7`,onClick:()=>void navigator.clipboard.writeText(t??e)},{label:`Reveal in Finder`,iconPath:`M2 5h4l1.5 1.5H14V12a1 1 0 01-1 1H3a1 1 0 01-1-1V5z`,onClick:()=>void L.openLocal(e,!0)},{label:`Open with default app`,iconPath:`M6 3H3v10h10v-3M9 3h4v4M13 3L7 9`,onClick:()=>void L.openLocal(e)}]}var za=(e,t)=>e?`${e}/${t}`:t;function Ba(e,t){let n=[],r=(i,a)=>{let o=e.get(i);if(o)for(let e of o.entries){let o=za(i,e.name),s=e.kind===`dir`||e.targetKind===`dir`,c=s&&t.has(o);n.push({path:o,name:e.name,depth:a,isDir:s,isSymlink:e.kind===`symlink`,expanded:c,size:e.size}),c&&r(o,a+1)}};return r(``,0),n}function Va({open:e}){return(0,M.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`h-3 w-3 shrink-0 transition-transform ${e?`rotate-90`:``}`,fill:`currentColor`,children:(0,M.jsx)(`path`,{d:`M6 4l4 4-4 4V4z`})})}function Ha({row:e}){return e.isDir?(0,M.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`h-3.5 w-3.5 shrink-0 text-accent-dim`,fill:`currentColor`,children:(0,M.jsx)(`path`,{d:`M1.5 3.5A1.5 1.5 0 013 2h3l1.5 1.5H13A1.5 1.5 0 0114.5 5v7A1.5 1.5 0 0113 13.5H3A1.5 1.5 0 011.5 12v-8.5z`})}):(0,M.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`h-3.5 w-3.5 shrink-0 text-ink-500`,fill:`currentColor`,children:(0,M.jsx)(`path`,{d:`M4 1.5h5L13 5.5v9a1 1 0 01-1 1H4a1 1 0 01-1-1v-12a1 1 0 011-1zM9 2v4h4`,fillRule:`evenodd`})})}function Ua(){let e=N(),{expanded:t,selected:n,toggle:r,select:i,openPreview:a,renaming:o,setRenaming:s}=K(),c=R(e=>e.activeId),l=R(e=>{let t=e.tabs.find(t=>t.id===e.activeId);return t?.cwdLive&&!t.cwdLive.outside?t.cwdLive.cwd:void 0}),u=P({queryKey:[`workspace`],queryFn:L.workspace}),d=P({queryKey:[`git`,`status`],queryFn:L.gitStatus,refetchInterval:4e3,placeholderData:se}),f=(0,j.useRef)(null),p=(0,j.useMemo)(()=>{let e=new Map;for(let t of d.data?.entries??[]){let n=t.index===`?`?`U`:t.worktree===` `?t.index:t.worktree;n&&n!==` `&&e.set(t.path,n)}return e},[d.data]),m=(0,j.useMemo)(()=>[``,...t].sort(),[t]),h=st({queries:m.map(e=>({queryKey:[`dir`,e],queryFn:()=>L.listDir(e),placeholderData:se}))}),g=(0,j.useMemo)(()=>{let e=new Map;return m.forEach((t,n)=>e.set(t,h[n]?.data)),e},[m,h]),_=(0,j.useMemo)(()=>Ba(g,t),[g,t]),v=La({count:_.length,getScrollElement:()=>f.current,estimateSize:()=>24,overscan:20}),y=t=>e.invalidateQueries({queryKey:[`dir`,t]}),b=e=>e.split(`/`).slice(0,-1).join(`/`);(0,j.useMemo)(()=>n?_.find(e=>e.path===n)?.isDir?n:b(n):``,[n,_]);let x=e=>s(e.path),S=async(e,t)=>{s(null);let n=t.trim(),r=b(e);if(!n||n===e.split(`/`).pop())return;let a=za(r,n);await L.rename(e,a),y(r),i(a)},C=async e=>{await Ht({title:`Delete ${e.name}?`,message:e.isDir?`This folder and its contents will be deleted.`:`This file will be deleted.`,okLabel:`Delete`,danger:!0})&&(await L.remove([e.path]),i(null),y(b(e.path)))},w=e=>{let t=u.data?.root;return t?e?`${t}/${e}`:t:e},T=e=>{wt.get(c)?.sendInput(`\x15cd ${ft(w(e.path))}\r`)},E=e=>{let t=e.isDir?[{label:`cd here`,iconPath:`M2 8h9m0 0L8 5m3 3l-3 3M13 3v10`,onClick:()=>T(e)},{label:`New folder`,iconPath:`M8 4v8M4 8h8`,onClick:()=>void D(e.path)}]:[];return[...t,...Ra(e.path,w(e.path)).map((e,n)=>n===0?{...e,separated:t.length>0}:e),{label:`Rename`,iconPath:`M11 3l2 2-7 7H4v-2l7-7z`,onClick:()=>void x(e),separated:!0},{label:`Delete`,iconPath:`M4 5h8m-7 0v7m3-7v7m3-7v7M6 5V3h4v2`,onClick:()=>void C(e),danger:!0}]},D=async e=>{let t=g.get(e),n=new Set((t?.entries??[]).map(e=>e.name)),r=`untitled`;for(let e=1;n.has(r);e++)r=`untitled-${e}`;let a=za(e,r);await L.mkdir(a),await y(e),i(a),s(a)},[O,ee]=(0,j.useState)(null);return(0,j.useEffect)(()=>{if(!n)return;let e=_.findIndex(e=>e.path===n);e>=0&&v.scrollToIndex(e,{align:`auto`})},[n,_.length]),(0,M.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,M.jsxs)(`div`,{ref:f,className:`min-h-0 flex-1 overflow-auto py-1`,children:[(0,M.jsx)(`div`,{className:`relative`,style:{height:v.getTotalSize()},children:v.getVirtualItems().map(e=>{let t=_[e.index];return(0,M.jsxs)(`div`,{className:`group absolute left-0 top-0 flex w-full cursor-default items-center gap-1.5 px-2 ${n===t.path?`bg-ink-700/70`:`hover:bg-ink-800`}`,style:{height:e.size,transform:`translateY(${e.start}px)`,paddingLeft:8+t.depth*14},onClick:()=>{i(t.path),t.isDir?r(t.path):a({path:t.path,name:t.name,size:t.size})},onDoubleClick:()=>{t.isDir&&T(t)},onContextMenu:e=>{e.preventDefault(),ee({items:E(t),x:e.clientX,y:e.clientY})},children:[t.isDir?(0,M.jsx)(Va,{open:t.expanded}):(0,M.jsx)(`span`,{className:`w-3 shrink-0`}),(0,M.jsx)(Ha,{row:t}),o===t.path?(0,M.jsx)(Wa,{name:t.name,onCommit:e=>void S(t.path,e),onCancel:()=>s(null)}):(0,M.jsxs)(`span`,{className:`truncate text-ui ${p.has(t.path)?`text-warn`:`text-ink-100`}`,children:[t.name,t.isSymlink&&(0,M.jsx)(`span`,{className:`ml-1 text-ink-500`,children:`⤳`})]}),p.has(t.path)&&(0,M.jsx)(`span`,{className:`ml-1 shrink-0 text-meta ${p.get(t.path)===`D`?`text-danger`:p.get(t.path)===`U`?`text-accent-dim`:`text-warn`}`,title:`git: ${p.get(t.path)}`,children:p.get(t.path)}),l!==void 0&&l===t.path&&(0,M.jsx)(`span`,{title:`active terminal is here`,className:`ml-1 h-1.5 w-1.5 shrink-0 rounded-full bg-accent`}),(0,M.jsx)(`span`,{className:`ml-auto hidden shrink-0 group-hover:block has-[[data-menu-open]]:block`,children:(0,M.jsx)(Gt,{items:E(t)})})]},t.path)})}),_.length===0&&(0,M.jsx)(`div`,{className:`px-3 py-2 text-ui text-ink-500`,children:`empty workspace`})]}),O&&(0,M.jsx)(Jt,{items:O.items,x:O.x,y:O.y,onClose:()=>ee(null)})]})}function Wa({name:e,onCommit:t,onCancel:n}){let r=(0,j.useRef)(null);return(0,j.useEffect)(()=>{let t=r.current;if(!t)return;t.focus();let n=e.lastIndexOf(`.`);t.setSelectionRange(0,n>0?n:e.length)},[e]),(0,M.jsx)(`input`,{ref:r,defaultValue:e,onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),onBlur:e=>t(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`?t(e.target.value):e.key===`Escape`&&n()},className:`wc-input min-w-0 flex-1 px-1 py-0 text-ui`})}function Ga(e){let t=e.text.length-e.text.trimStart().length;return t===0?e.ranges:e.ranges.map(([e,n])=>[Math.max(0,e-t),Math.max(0,n-t)]).filter(([e,t])=>t>e)}var Ka=e=>e.trim().length>=2;function qa(e,t){let[n,r]=(0,j.useState)(e);return(0,j.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Ja({text:e,ranges:t}){if(t.length===0)return(0,M.jsx)(M.Fragment,{children:e});let n=[],r=0;for(let[i,a]of t)i>r&&n.push(e.slice(r,i)),n.push((0,M.jsx)(`mark`,{className:`rounded-sm bg-accent/25 text-accent`,children:e.slice(i,a)},i)),r=a;return r<e.length&&n.push(e.slice(r)),(0,M.jsx)(M.Fragment,{children:n})}function Ya(){let e=K(e=>e.searchSeed),t=K(e=>e.closeSearch),[n,r]=(0,j.useState)(e??``),[i,a]=(0,j.useState)(!1),[o,s]=(0,j.useState)(!1);(0,j.useEffect)(()=>{e!==null&&r(e)},[e]);let c=qa(n.trim(),300),l=K(e=>e.openPreviewPath),{data:u,isFetching:d,error:f}=P({queryKey:[`search`,c,i,o],enabled:Ka(c),staleTime:1e4,queryFn:()=>L.search(c,{regex:i,caseSensitive:o})});return(0,M.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,M.jsxs)(`div`,{className:`border-b border-border p-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(jt,{autoFocus:!0,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),t())},placeholder:`search workspace…`}),(0,M.jsx)(At,{title:`Close search (Esc)`,iconPath:`M4 4l8 8M12 4l-8 8`,onClick:t})]}),(0,M.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-2 text-meta text-ink-500`,children:[(0,M.jsx)(Xa,{label:`.*`,title:`Regular expression`,active:i,onClick:()=>a(e=>!e)}),(0,M.jsx)(Xa,{label:`Aa`,title:`Case sensitive`,active:o,onClick:()=>s(e=>!e)}),d&&(0,M.jsx)(`span`,{className:`ml-auto`,children:`searching…`})]})]}),(0,M.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto py-1`,children:[f&&(0,M.jsx)(`div`,{className:`px-3 py-2 text-ui text-danger`,children:f.message}),u?.results.map(e=>(0,M.jsxs)(`div`,{className:`mb-1`,children:[(0,M.jsx)(`div`,{className:`cursor-default truncate px-2 py-0.5 text-meta font-semibold text-ink-300 hover:bg-hover`,title:e.path,onClick:()=>l(e.path),children:e.path}),e.matches.map((t,n)=>(0,M.jsxs)(`div`,{className:`flex cursor-default gap-2 px-2 py-0.5 text-ui hover:bg-hover`,onClick:()=>l(e.path),children:[(0,M.jsx)(`span`,{className:`w-8 shrink-0 text-right text-ink-500`,children:t.line}),(0,M.jsx)(`span`,{className:`truncate text-ink-100`,children:(0,M.jsx)(Ja,{text:t.text.trimStart(),ranges:Ga(t)})})]},`${t.line}-${n}`))]},e.path)),u&&u.results.length===0&&(0,M.jsx)(`div`,{className:`px-3 py-2 text-ui text-ink-500`,children:`no matches`}),c.length>0&&c.length<2&&(0,M.jsx)(`div`,{className:`px-3 py-2 text-ui text-ink-500`,children:`type at least 2 characters`})]}),u&&(0,M.jsxs)(`div`,{className:`border-t border-border px-2 py-1 text-meta text-ink-500`,children:[u.total,u.truncated?`+`:``,` matches · `,u.results.length,` files · `,u.engine]})]})}function Xa({label:e,title:t,active:n,onClick:r}){return(0,M.jsx)(`button`,{title:t,onClick:r,className:`rounded border px-1.5 py-0.5 font-semibold ${n?`border-accent-dim bg-hover text-accent`:`border-border text-ink-500 hover:text-ink-300`}`,children:e})}function Za(){let e=N(),t=K(e=>e.searchOpen),n=K(e=>e.openSearch),r=K(e=>e.closeSearch),i=()=>{let e=K.getState().selected;return e?e.includes(`.`)?e.split(`/`).slice(0,-1).join(`/`):e:``},a=(t,n,r)=>{let i=e.getQueryData([`dir`,t]),a=new Set((i?.entries??[]).map(e=>e.name)),o=`${n}${r}`;for(let e=1;a.has(o);e++)o=`${n}-${e}${r}`;return o},o=async(t,n,r)=>{let i=t?`${t}/${n}`:n;await r(i),t&&K.getState().revealPath(`${t}/x`),await e.invalidateQueries({queryKey:[`dir`,t]}),K.getState().select(i),K.getState().setRenaming(i)},s=()=>{let e=i();return o(e,a(e,`untitled`,`.md`),e=>L.writeFile(e,``))},c=()=>{let e=i();return o(e,a(e,`untitled`,``),e=>L.mkdir(e))};return(0,M.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,M.jsxs)(Et,{border:`b`,className:`!gap-0`,children:[(0,M.jsx)(`span`,{className:`px-1 text-meta uppercase tracking-wider text-ink-500`,children:`Files`}),(0,M.jsxs)(`span`,{className:`ml-auto flex items-center gap-0.5`,children:[(0,M.jsx)(Gt,{items:[{label:`New file`,iconPath:`M4 1.5h5L13 5.5v9a1 1 0 01-1 1H4a1 1 0 01-1-1v-12a1 1 0 011-1zM9 2v4h4`,onClick:()=>void s()},{label:`New folder`,iconPath:`M1.5 3.5A1.5 1.5 0 013 2h3l1.5 1.5H13A1.5 1.5 0 0114.5 5v7A1.5 1.5 0 0113 13.5H3A1.5 1.5 0 011.5 12z`,onClick:()=>void c()}],title:`New file or folder`,iconPath:`M8 3v10M3 8h10`}),(0,M.jsx)(At,{title:`Search workspace (⌘F)`,iconPath:`M10.5 10.5L14 14M7 12A5 5 0 117 2a5 5 0 010 10z`,active:t,onClick:()=>t?r():n()})]})]}),(0,M.jsx)(`div`,{className:`min-h-0 flex-1`,children:t?(0,M.jsx)(Ya,{}):(0,M.jsx)(Ua,{})})]})}function Qa(e,t){return e>0?{kind:`none`}:t?.enabled&&!t.cliAbsent&&t.active&&!t.onSessionBranch?{kind:`recovery`,branch:t.active.branch,checkpoints:t.active.checkpoints}:{kind:`none`}}function $a(e,t,n){if(t===`zuzuu`)return{kind:`utility`};if(e!==`agent`||n===void 0)return{kind:`banner`};if(`cliAbsent`in n)return{kind:`cli-absent`};if(n.ok){let e=n.merge;return e.conflict?{kind:`conflict`}:e.reason===`empty-squash-with-checkpoints`?{kind:`no-net-changes`,checkpoints:e.commits??null}:e.ok===!1||e.mergedAs==null?{kind:`no-changes`}:{kind:`merged`,commits:e.commits??1}}let r=n.refusal??{},i=typeof r.reason==`string`?r.reason:null;if(i===`empty-squash-with-checkpoints`){let e=r.commits,t=r.checkpoints;return{kind:`no-net-changes`,checkpoints:typeof e==`number`?e:typeof t==`number`?t:null}}return i===`no-session-branch`?{kind:`no-changes`}:r.conflict===!0||i===`conflict`?{kind:`conflict`}:{kind:`failed`,message:n.stderr?.trim()||i||`session merge failed`}}function eo(e){if(!e?.enabled||e.cliAbsent||!e.active)return{kind:`none`};if(e.onSessionBranch){let t=e.active.checkpoints;return{kind:`active`,label:`● session · ${t} checkpoint${t===1?``:`s`}`}}return{kind:`leftover`,label:`◌ unfinished session`}}function to(e){if(!(e instanceof fn)||e.data===null||typeof e.data!=`object`)return null;let t=e.data.reason;return typeof t==`string`&&t.length>0?t:null}function no(e){e.invalidateQueries({queryKey:[`zuzuu`,`session`]}),e.invalidateQueries({queryKey:[`git`,`status`]}),e.invalidateQueries({queryKey:[`dir`]}),e.invalidateQueries({queryKey:[`files`]})}async function ro(){try{await W.sessionMerge()}catch(e){if(to(e)===`empty-squash-with-checkpoints`){await Ht({title:`Nothing to merge`,message:`This session only explored — its checkpoints left the tree identical to main. Discard the exploration checkpoints?`,okLabel:`Discard exploration checkpoints`,danger:!0})&&await W.sessionDiscard();return}throw e}}async function io(e){let t=R.getState(),n=t.tabs.find(e=>e.type===`agent`&&e.alive);if(n){t.setActive(n.id);return}await t.create({type:`agent`,command:e.command,args:e.args,host:e.host})}async function ao(e){await R.getState().create({type:`agent`,command:`zuzuu`,args:e,host:`zuzuu`})}function $({children:e,onDismiss:t}){return(0,M.jsxs)(`div`,{className:`relative w-full max-w-sm rounded-ui border border-border bg-elevated p-5`,style:{boxShadow:`var(--shadow-menu)`},children:[t&&(0,M.jsx)(`button`,{onClick:t,title:`Dismiss`,className:`absolute right-2.5 top-2.5 flex h-6 w-6 items-center justify-center rounded-[var(--radius-sm)] text-ink-500 hover:bg-hover hover:text-ink-100`,children:`✕`}),e]})}function oo({zuzuuBin:e,onDismiss:t}){return(0,M.jsxs)($,{...t?{onDismiss:t}:{},children:[(0,M.jsx)(`div`,{className:`text-base font-medium text-ink-100`,children:`Set up zuzuu`}),(0,M.jsxs)(`p`,{className:`mt-1 text-ui leading-relaxed text-ink-400`,children:[`zuzuu sets up a hidden `,(0,M.jsx)(`code`,{className:`text-accent-dim`,children:`.zuzuu/`}),` home in this project (like `,(0,M.jsx)(`code`,{className:`text-accent-dim`,children:`.git`}),`) where your agent's faculties — knowledge, memory, actions, instructions, guardrails — live and grow from real sessions.`]}),e?(0,M.jsxs)(`div`,{className:`mt-4 flex flex-col items-start gap-3`,children:[(0,M.jsx)(B,{variant:`primary`,onClick:()=>void ao([`init`]),children:`Set up zuzuu`}),(0,M.jsxs)(`div`,{className:`text-meta text-ink-500`,children:[`then`,` `,(0,M.jsx)(`button`,{className:`text-accent-dim underline decoration-dotted underline-offset-2 hover:text-accent`,onClick:()=>void ao([`enable`]),children:`Enable live capture`}),` `,`to observe sessions as they happen`]})]}):(0,M.jsxs)(`div`,{className:`mt-4 rounded-[var(--radius-sm)] border border-warn/40 bg-[color-mix(in_oklab,var(--color-warn)_10%,transparent)] px-3 py-2 text-ui text-warn`,children:[`zuzuu CLI required — `,(0,M.jsx)(`code`,{children:`npm i -g @zuzuucodes/cli`})]})]})}function so({branch:e,checkpoints:t}){let n=N(),[r,i]=(0,j.useState)(!1),a=e=>{i(!0),e().catch(e=>window.alert(mn(e))).finally(()=>{i(!1),no(n)})};return(0,M.jsxs)($,{children:[(0,M.jsx)(`div`,{className:`text-base font-medium text-ink-100`,children:`You left work here`}),(0,M.jsxs)(`p`,{className:`mt-1 text-ui leading-relaxed text-ink-400`,children:[(0,M.jsx)(`span`,{className:`text-accent-dim`,children:e}),` — `,t,` checkpoint`,t===1?``:`s`,` from an earlier session.`]}),(0,M.jsxs)(`div`,{className:`mt-4 flex items-center gap-2`,children:[(0,M.jsx)(B,{variant:`primary`,disabled:r,onClick:()=>a(W.sessionContinue),children:`Continue session`}),(0,M.jsx)(B,{disabled:r,onClick:()=>a(ro),children:`Merge & start fresh`}),r&&(0,M.jsx)(Pt,{})]})]})}function co({state:e,onStartNew:t,onCloseTab:n,onDismiss:r}){let i=N(),[a,o]=(0,j.useState)(!1),s=async()=>{if(await Ht({title:`Discard exploration checkpoints`,message:`Delete the session branch and its checkpoints? main is untouched either way.`,okLabel:`Discard checkpoints`,danger:!0})){o(!0);try{await W.sessionDiscard()}catch(e){window.alert(mn(e))}o(!1),no(i),r()}},c=(0,M.jsxs)(`div`,{className:`mt-4 flex items-center gap-2`,children:[(0,M.jsx)(B,{variant:`primary`,onClick:t,children:`Start new session`}),(0,M.jsx)(B,{onClick:n,children:`Close tab`})]});switch(e.kind){case`utility`:return(0,M.jsxs)($,{children:[(0,M.jsx)(`div`,{className:`text-base font-medium text-ink-100`,children:`Session finished`}),(0,M.jsx)(`div`,{className:`mt-4 flex items-center gap-2`,children:(0,M.jsx)(B,{onClick:n,children:`Close`})})]});case`merged`:return(0,M.jsxs)($,{children:[(0,M.jsx)(`div`,{className:`text-base font-medium text-ink-100`,children:`Session ended — merged to main ✓`}),(0,M.jsxs)(`p`,{className:`mt-1 text-ui text-ink-400`,children:[e.commits,` checkpoint`,e.commits===1?``:`s`,` → 1 commit`]}),c]});case`no-changes`:return(0,M.jsxs)($,{children:[(0,M.jsx)(`div`,{className:`text-base font-medium text-ink-100`,children:`Session ended`}),(0,M.jsx)(`p`,{className:`mt-1 text-ui text-ink-400`,children:`No changes to merge — main is untouched.`}),c]});case`cli-absent`:return(0,M.jsxs)($,{onDismiss:r,children:[(0,M.jsx)(`div`,{className:`text-base font-medium text-ink-100`,children:`Session ended`}),(0,M.jsxs)(`div`,{className:`mt-3 rounded-[var(--radius-sm)] border border-warn/40 bg-[color-mix(in_oklab,var(--color-warn)_10%,transparent)] px-3 py-2 text-ui text-warn`,children:[`zuzuu CLI required to merge session checkpoints —`,` `,(0,M.jsx)(`code`,{children:`npm i -g @zuzuucodes/cli`})]}),c]});case`no-net-changes`:return(0,M.jsxs)($,{children:[(0,M.jsx)(`div`,{className:`text-base font-medium text-ink-100`,children:`No net changes`}),(0,M.jsxs)(`p`,{className:`mt-1 text-ui leading-relaxed text-ink-400`,children:[e.checkpoints===null?`Exploration checkpoints retained`:`${e.checkpoints} exploration checkpoint${e.checkpoints===1?``:`s`} retained`,` `,`— the tree ended identical to main.`]}),(0,M.jsxs)(`div`,{className:`mt-4 flex items-center gap-2`,children:[(0,M.jsx)(B,{variant:`danger`,disabled:a,onClick:()=>void s(),children:`Discard checkpoints`}),(0,M.jsx)(B,{disabled:a,onClick:r,children:`Keep`}),a&&(0,M.jsx)(Pt,{})]})]});case`conflict`:return(0,M.jsxs)($,{onDismiss:r,children:[(0,M.jsx)(`div`,{className:`text-base font-medium text-ink-100`,children:`Merge hit a conflict`}),(0,M.jsxs)(`p`,{className:`mt-1 text-ui leading-relaxed text-ink-400`,children:[`Your checkpoints are safe on the session branch. Resolve in a terminal:`,` `,(0,M.jsx)(`code`,{className:`text-accent-dim`,children:`zuzuu session merge`}),`.`]}),c]});case`failed`:return(0,M.jsxs)($,{onDismiss:r,children:[(0,M.jsx)(`div`,{className:`text-base font-medium text-ink-100`,children:`Session merge failed`}),(0,M.jsx)(`p`,{className:`mt-1 break-words text-ui leading-relaxed text-ink-400`,children:e.message}),(0,M.jsx)(`p`,{className:`mt-2 text-meta text-ink-500`,children:`Checkpoints stay on the session branch — resolve in a terminal.`}),c]})}}var lo=new TextEncoder,uo=new TextDecoder;function fo(e,t){let n=typeof t==`string`?lo.encode(t):t,r=new Uint8Array(1+n.length);return r[0]=e,r.set(n,1),r}var po=class{sessionId;term;events;ws=null;unacked=0;retries=0;closedByUser=!1;firstReplayDone=!1;everOpened=!1;openWaiters=[];constructor(e,t,n){this.sessionId=e,this.term=t,this.events=n}connect(){this.events.onStatus(this.retries>0?`reconnecting`:`connecting`);let e=new WebSocket(xt(`/ws/term/${this.sessionId}`));e.binaryType=`arraybuffer`,this.ws=e,e.onopen=()=>{this.retries=0,this.everOpened=!0;for(let e of this.openWaiters.splice(0))e();this.events.onStatus(`open`),this.sendResize(this.term.cols,this.term.rows)},e.onmessage=e=>{if(!(e.data instanceof ArrayBuffer))return;let t=new Uint8Array(e.data);if(t.length===0)return;let n=t[0],r=t.subarray(1);switch(n){case dt.Replay:this.firstReplayDone&&this.term.reset(),this.firstReplayDone=!0,this.term.write(r);break;case dt.Output:this.term.write(r,()=>this.ack(r.length));break;case dt.Exit:{let{exitCode:e}=JSON.parse(uo.decode(r));this.events.onExit(e);break}case dt.Title:{let{title:e}=JSON.parse(uo.decode(r));this.events.onTitle(e);break}case dt.Cwd:this.events.onCwd(JSON.parse(uo.decode(r)));break}},e.onclose=e=>{if(this.ws=null,this.closedByUser||e.code===4e3){this.events.onStatus(`closed`);return}if(this.retries>=5){this.events.onStatus(`closed`);return}let t=Math.min(500*2**this.retries,5e3);this.retries+=1,this.events.onStatus(`reconnecting`),setTimeout(()=>{this.closedByUser||this.connect()},t)}}whenOpen(){return this.everOpened?Promise.resolve():new Promise(e=>this.openWaiters.push(e))}sendInput(e){this.send(fo(ut.Input,e))}sendResize(e,t){this.send(fo(ut.Resize,JSON.stringify({cols:e,rows:t})))}ack(e){this.unacked+=e,this.unacked>=32768?this.flushAck():this.scheduleAckFlush()}ackTimer=null;scheduleAckFlush(){this.ackTimer===null&&(this.ackTimer=setTimeout(()=>this.flushAck(),50))}flushAck(){this.ackTimer!==null&&(clearTimeout(this.ackTimer),this.ackTimer=null),this.unacked>0&&(this.send(fo(ut.Ack,JSON.stringify({bytes:this.unacked}))),this.unacked=0)}send(e){this.ws?.readyState===WebSocket.OPEN&&this.ws.send(e)}dispose(){this.closedByUser=!0,this.ackTimer!==null&&clearTimeout(this.ackTimer),this.ws?.close(1e3),this.ws=null}},mo=/(?:^|[\s"'`(\[<])((?:\.{1,2}\/|\/)?[\w.@+~-]+(?:\/[\w.@+~-]+)+|[\w@+-][\w.@+-]*\.(?:tsx?|jsx?|mjs|cjs|py|go|rs|rb|java|kt|swift|c|h|cpp|hpp|cs|php|sh|css|scss|html|json|jsonc|ya?ml|toml|md|sql|vue|svelte|lock|txt|log|cast))((?::\d+){0,2})(?=[\s"'`)\]>:,;]|$)/g;function ho(e){let t=[];for(let n of e)if(!(n===``||n===`.`))if(n===`..`){if(t.length===0)return null;t.pop()}else t.push(n);return t.join(`/`)}function go(e,t,n){return e.startsWith(`~`)?null:e.startsWith(`/`)?t?e===t?``:e.startsWith(t+`/`)?e.slice(t.length+1):null:null:n===void 0?null:ho([...n.split(`/`),...e.split(`/`)])}function _o(e,t){return e.registerLinkProvider({provideLinks(n,r){let i=e.buffer.active.getLine(n-1);if(!i)return r(void 0);let a=i.translateToString(!0),o=[];for(let e of a.matchAll(mo)){let r=e[1],i=e[2]??``,a=go(r,t.rootAbs(),t.cwdRel());if(a===null||a===``)continue;let s=e.index+e[0].indexOf(r);o.push({range:{start:{x:s+1,y:n},end:{x:s+r.length+i.length,y:n}},text:r+i,activate:()=>t.openPreview(a)})}r(o.length?o:void 0)}})}function vo(e,t,n){if(n===0||n===null)return null;let r=/git push --set-upstream (\S+) (\S+)/.exec(t);if(/\bgit push\b/.test(e)&&r){let e=`git push --set-upstream ${r[1]} ${r[2]}`;return{label:e,run:t=>t(e)}}let i=/EADDRINUSE.*?:(\d{2,5})/.exec(t)?.[1]??/address already in use.*?:(\d{2,5})/i.exec(t)?.[1]??/listen .*?:(\d{2,5})/i.exec(t)?.[1];if(i)return{label:`kill :${i} & rerun`,run:t=>{L.killPort(Number(i)).finally(()=>{e&&setTimeout(()=>t(e),250)})}};let a=/git: '(\S+)' is not a git command[\s\S]*?Did you mean[\s\S]*?\n\s+(\S+)/.exec(t);if(a){let t=e.replace(a[1],a[2]);return{label:t,run:e=>e(t)}}return null}var yo=class{term;events;blocks=[];nextId=1;bMarker=null;bCol=0;pending=null;constructor(e,t){this.term=e,this.events=t}handle(e){let t=e[0];if(t===`A`)this.bMarker=null;else if(t===`B`)this.bMarker=this.term.registerMarker(0),this.bCol=this.term.buffer.active.cursorX;else if(t===`C`){let e=this.readCommand(),t=this.term.registerMarker(0);this.pending={id:this.nextId++,outputStart:t?.line??this.absCursorRow(),outputEnd:null,command:e,exitCode:null,startedAt:performance.now(),durationMs:null},this.blocks.push(this.pending),e&&this.events.onCommand(e),this.emit()}else if(t===`D`&&this.pending){let t=Number(e.split(`;`)[1]??``);this.pending.exitCode=Number.isFinite(t)?t:null,this.pending.outputEnd=this.absCursorRow(),this.pending.durationMs=performance.now()-this.pending.startedAt,this.pending.fix=vo(this.pending.command,this.outputText(this.pending),this.pending.exitCode)??void 0,this.pending=null,this.emit()}}readCommand(){let e=this.term.buffer.active,t=this.bMarker?.line??this.absCursorRow(),n=this.absCursorRow(),r=``;for(let i=t;i<=n;i++){let n=e.getLine(i);if(!n)continue;let a=i===t?n.translateToString(!0).slice(this.bCol):n.translateToString(!0);r+=(i>t&&!n.isWrapped?`
4
+ `:``)+a}return r.trim()}absCursorRow(){let e=this.term.buffer.active;return e.baseY+e.cursorY}outputText(e){let t=this.term.buffer.active,n=e.outputEnd??t.baseY+t.cursorY,r=``;for(let i=e.outputStart;i<n;i++){let n=t.getLine(i);n&&(r+=(i>e.outputStart&&!n.isWrapped?`
5
+ `:``)+n.translateToString(!0))}return r.replace(/\n+$/,``)}list(){return this.blocks}emit(){this.events.onChange([...this.blocks])}dispose(){this.blocks=[]}};function bo(e,t){let n=t.querySelector(`.xterm-screen`);return!n||e.rows===0?null:{cellHeight:n.clientHeight/e.rows,padTop:n.getBoundingClientRect().top-t.getBoundingClientRect().top,viewportY:e.buffer.active.viewportY,rows:e.rows}}function xo({term:e,tracker:t,host:n,tick:r,onReRun:i,onSaveWorkflow:a,send:o}){let[s,c]=(0,j.useState)(null),[l,u]=(0,j.useState)(null),d=bo(e,n);if(!d)return null;let{cellHeight:f,padTop:p,viewportY:m,rows:h}=d,g=m+h,_=e=>p+(e-m)*f;return(0,M.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-10`,children:t.list().map(e=>{let n=e.outputEnd??g;if(n<m||e.outputStart>g)return null;let r=_(Math.max(e.outputStart,m)),d=_(Math.min(n,g)),f=Math.max(2,d-r),p=e.exitCode===null?`bg-ink-500`:e.exitCode===0?`bg-accent-dim`:`bg-danger`;return(0,M.jsxs)(`div`,{className:`pointer-events-auto absolute left-0 w-[3px] cursor-pointer transition-[width] hover:w-[5px]`,style:{top:r,height:f},onMouseEnter:()=>c(e.id),onMouseLeave:()=>c(t=>t===e.id?null:t),children:[(0,M.jsx)(`div`,{className:`h-full w-full rounded-r ${p}`}),(s===e.id||l===e.id)&&e.command&&(0,M.jsx)(So,{block:e,menuOpen:l===e.id,onMenuOpenChange:t=>u(t?e.id:null),onCopy:()=>void navigator.clipboard.writeText(t.outputText(e)),onReRun:()=>i(e.command),onSaveWorkflow:()=>a(e.command),onFix:()=>e.fix?.run(o)}),e.fix&&s!==e.id&&l!==e.id&&(0,M.jsxs)(`button`,{onClick:()=>e.fix.run(o),onMouseDown:e=>e.preventDefault(),className:`pointer-events-auto absolute left-2 top-0 flex items-center gap-1 whitespace-nowrap rounded border border-yellow-600/50 bg-elevated px-1.5 py-0.5 text-meta text-warn shadow-lg hover:border-yellow-500 hover:text-yellow-300`,title:`Quick fix`,children:[(0,M.jsx)(`span`,{children:`⚡`}),` `,e.fix.label]})]},e.id)})})}function So({block:e,menuOpen:t,onMenuOpenChange:n,onCopy:r,onReRun:i,onSaveWorkflow:a,onFix:o}){let s=(0,j.useRef)(null),c=[{label:`Copy output`,iconPath:`M6 6h7v7H6zM3 10V3h7`,onClick:r},{label:`Re-run`,iconPath:`M13 8a5 5 0 11-1.5-3.5M13 3v2.5h-2.5`,onClick:i},{label:`Save as workflow`,iconPath:`M8 3v10M3 8h10`,onClick:a}];return(0,M.jsxs)(`div`,{className:`pointer-events-auto absolute left-2 top-0 flex items-center gap-1 rounded border border-border bg-elevated px-1.5 py-0.5 shadow-lg`,onMouseDown:e=>e.preventDefault(),children:[(0,M.jsx)(`span`,{className:`max-w-40 truncate text-meta text-ink-300`,title:e.command,children:e.command.split(`
6
+ `)[0]}),e.durationMs!==null&&e.durationMs>200&&(0,M.jsx)(`span`,{className:`text-meta text-ink-500`,children:Co(e.durationMs)}),e.fix&&(0,M.jsx)(`button`,{onClick:o,title:`Quick fix: ${e.fix.label}`,className:`rounded px-1 text-meta text-warn hover:bg-hover hover:text-yellow-300`,children:`⚡ fix`}),(0,M.jsxs)(`div`,{className:`relative`,children:[(0,M.jsx)(`button`,{ref:s,onClick:()=>n(!t),title:`Block actions`,className:`rounded px-0.5 text-ink-400 hover:bg-hover hover:text-ink-100`,children:(0,M.jsxs)(`svg`,{viewBox:`0 0 16 16`,className:`h-3.5 w-3.5`,fill:`currentColor`,children:[(0,M.jsx)(`circle`,{cx:`3`,cy:`8`,r:`1.3`}),(0,M.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.3`}),(0,M.jsx)(`circle`,{cx:`13`,cy:`8`,r:`1.3`})]})}),t&&(0,M.jsx)(Jt,{items:c,onClose:()=>n(!1),anchorEl:s.current,ignore:s})]})]})}function Co(e){return e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(1)}s`}var wo=200,To=yt(e=>({bySession:{},history:[],setBlocks:(t,n)=>e(e=>({bySession:{...e.bySession,[t]:n}})),addCommand:t=>e(e=>{let n=t.trim();return n?{history:[n,...e.history.filter(e=>e!==n)].slice(0,wo)}:e}),clear:t=>e(e=>{let n={...e.bySession};return delete n[t],{bySession:n}}),resetAll:()=>e({bySession:{},history:[]})})),Eo=`"JetBrains Mono Variable", ui-monospace, Menlo, monospace`,Do={background:`#0a0d12`,foreground:`#d6dde8`,cursor:`#58e6c0`,cursorAccent:`#0a0d12`,selectionBackground:`#2c4f6e80`,black:`#11161f`,red:`#f47067`,green:`#57ab5a`,yellow:`#c69026`,blue:`#539bf5`,magenta:`#b083f0`,cyan:`#39c5cf`,white:`#909dab`,brightBlack:`#545d68`,brightRed:`#ff938a`,brightGreen:`#6bc46d`,brightYellow:`#daaa3f`,brightBlue:`#6cb6ff`,brightMagenta:`#dcbdfb`,brightCyan:`#56d4dd`,brightWhite:`#cdd9e5`};function Oo({sessionId:e,active:t,sessionType:n=`shell`,host:r,onStartNew:i,onCloseTab:f}){let p=(0,j.useRef)(null),m=(0,j.useRef)(null),h=(0,j.useRef)(null),[g,_]=(0,j.useState)(`connecting`),[v,y]=(0,j.useState)(null),[b,x]=(0,j.useState)(0),[S,C]=(0,j.useState)(null),w=R(e=>e.setTitle),T=R(e=>e.setCwd),E=R(e=>e.markExited),D=To(e=>e.setBlocks),O=To(e=>e.addCommand),ee=tn(e=>e.open),k=N();(0,j.useEffect)(()=>{let t=p.current;if(!t)return;let n=new a({allowProposedApi:!0,fontFamily:Eo,fontSize:13,lineHeight:1.25,letterSpacing:0,scrollback:1e4,cursorBlink:!0,macOptionIsMeta:!0,minimumContrastRatio:3,theme:Do});m.current=n;let r=new l;n.loadAddon(r),n.loadAddon(new s),n.loadAddon(new u((e,t)=>window.open(t,`_blank`))),n.loadAddon(new c),n.unicode.activeVersion=`11`,n.loadAddon(new d);let i=new po(e,n,{onTitle:t=>w(e,t),onExit:t=>{y(t),E(e)},onStatus:_,onCwd:t=>T(e,t)});wt.set(e,i);let f=_o(n,{rootAbs:()=>k.getQueryData([`workspace`])?.root,cwdRel:()=>{let t=R.getState().tabs.find(t=>t.id===e);if(!(!t?.cwdLive||t.cwdLive.outside))return t.cwdLive.cwd},openPreview:e=>K.getState().openPreviewPath(e)});To.getState().bySession[e];let g=new yo(n,{onChange:t=>{D(e,t),x(e=>e+1)},onCommand:e=>O(e)});h.current=g,n.parser.registerOscHandler(133,e=>(g.handle(e),!0)),n.onData(e=>i.sendInput(e)),n.onBinary(e=>i.sendInput(e)),n.onResize(({cols:e,rows:t})=>i.sendResize(e,t)),n.onTitleChange(t=>w(e,t)),n.onScroll(()=>{let e=n.buffer.active,t=e.viewportY,r=g.list(),i=e.viewportY>=e.baseY,a=r.find(e=>e.outputEnd!==null&&e.outputStart<=t&&(e.outputEnd??0)>t);C(!i&&a?{command:a.command,exitCode:a.exitCode}:null),x(e=>e+1)}),n.onRender(()=>x(e=>e+1));let v=e=>{let t=n.buffer.active.viewportY,r=g.list().map(e=>e.outputStart).sort((e,t)=>e-t),i=e===1?r.find(e=>e>t):[...r].reverse().find(e=>e<t);i!==void 0&&n.scrollToLine(i)};n.attachCustomKeyEventHandler(e=>e.type===`keydown`?e.metaKey&&e.key===`c`&&n.hasSelection()||e.metaKey&&e.key===`v`?!1:e.metaKey&&e.key===`ArrowUp`?(v(-1),!1):e.metaKey&&e.key===`ArrowDown`?(v(1),!1):!0:!0);let b=!1;document.fonts.load(`13px ${Eo}`).finally(()=>{if(!b){n.open(t);try{let e=new o;e.onContextLoss(()=>e.dispose()),n.loadAddon(e)}catch{}r.fit(),i.connect()}});let S=new ResizeObserver(()=>{t.clientWidth>0&&t.clientHeight>0&&r.fit()});return S.observe(t),()=>{b=!0,S.disconnect(),f.dispose(),g.dispose(),h.current=null,wt.delete(e),i.dispose(),n.dispose(),m.current=null}},[e,w,T,E,D,O,k]),(0,j.useEffect)(()=>{t&&m.current?.focus()},[t]);let te=t=>wt.get(e)?.sendInput(`\x15${t}\r`),ne=n===`agent`,[re,ie]=(0,j.useState)(!1),ae=P({queryKey:[`session-detail`,e,v],queryFn:()=>L.sessionDetail(e),enabled:ne&&v!==null,staleTime:1/0}),oe=ae.data?.closeResult;(0,j.useEffect)(()=>{oe!==void 0&&no(k)},[oe,k]);let se=$a(n,r,oe),ce=se.kind===`utility`;(0,j.useEffect)(()=>{ce&&v!==null&&k.invalidateQueries({queryKey:[`zuzuu`]})},[ce,v,k]);let le=ne&&v!==null&&!re;return(0,M.jsxs)(`div`,{className:`relative h-full w-full bg-ink-950`,children:[(0,M.jsx)(`div`,{ref:p,className:`term-host h-full w-full`}),m.current&&h.current&&p.current&&(0,M.jsx)(xo,{term:m.current,tracker:h.current,host:p.current,tick:b,onReRun:te,onSaveWorkflow:e=>ee(e),send:te}),S&&(0,M.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 z-20 flex items-center gap-2 border-b border-border bg-surface/95 px-3 py-1 text-ui backdrop-blur`,children:[(0,M.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${S.exitCode===null?`bg-ink-500`:S.exitCode===0?`bg-accent`:`bg-danger`}`}),(0,M.jsx)(`span`,{className:`truncate text-ink-300`,children:S.command.split(`
7
+ `)[0]})]}),g===`reconnecting`&&(0,M.jsx)(`div`,{className:`absolute right-3 top-2 rounded bg-hover px-2 py-0.5 text-meta text-warn`,children:`reconnecting…`}),v!==null&&(!le||se.kind===`banner`)&&(0,M.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0 flex items-center gap-2 border-t border-border bg-surface/95 px-3 py-1.5 text-ui text-ink-300`,children:[`process exited with code `,v]}),le&&ae.isPending&&!ce&&(0,M.jsx)(`div`,{className:`absolute inset-0 z-30 flex items-center justify-center bg-ink-950/70 p-6`,children:(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-ui text-ink-300`,children:[(0,M.jsx)(Pt,{}),` session ended — merging checkpoints…`]})}),le&&(ce||!ae.isPending)&&se.kind!==`banner`&&(0,M.jsx)(`div`,{className:`absolute inset-0 z-30 flex items-center justify-center bg-ink-950/70 p-6`,children:(0,M.jsx)(co,{state:se,onStartNew:i??(()=>{}),onCloseTab:f??(()=>{}),onDismiss:()=>ie(!0)})}),g===`closed`&&v===null&&(0,M.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 flex items-center gap-2 border-t border-border bg-surface/95 px-3 py-1.5 text-ui text-danger`,children:`disconnected — session may be attached in another window`})]})}function ko(e){let t=wr(e);t&&io(t).catch(e=>window.alert(e.message))}var Ao=(0,j.forwardRef)(function(e,t){let n=Sr(P({queryKey:[`zuzuu`,`hosts`],queryFn:W.hosts,refetchInterval:8e3}).data?.hosts??[]),r=Cr(n);return(0,M.jsx)(`div`,{ref:t,tabIndex:0,className:`wc-focus outline-none`,onKeyDown:e=>{e.key===`Enter`&&r&&(e.preventDefault(),ko(r.command))},children:(0,M.jsxs)(Et,{border:`t`,surface:`surface`,className:`!h-auto !min-h-[var(--height-bar)] flex-wrap !gap-1.5 py-1.5`,children:[(0,M.jsx)(`span`,{className:`shrink-0 text-meta text-ink-500`,children:`Start a session with`}),n.map(e=>(e.command,r?.command,(0,M.jsxs)(`button`,{disabled:!e.detected,onClick:()=>ko(e.command),className:z(`wc-focus flex shrink-0 items-center gap-1.5 rounded-[var(--radius-sm)] border px-2 py-0.5 text-meta transition-colors`,e.detected?`border-border text-ink-100 hover:border-accent-dim hover:bg-hover`:`cursor-default border-border/60 text-ink-600`),title:e.detected?`Start ${e.label}`:`${e.label} — not installed`,children:[e.label,!e.detected&&(0,M.jsx)(`span`,{className:`text-ink-600`,children:`not installed`})]},e.command))),r&&(0,M.jsxs)(`span`,{className:`ml-auto hidden shrink-0 items-center gap-1 text-meta text-ink-600 sm:flex`,children:[(0,M.jsx)(Mt,{children:`↵`}),` `,r.label]})]})})}),jo=()=>P({queryKey:[`workspace`],queryFn:L.workspace}),Mo=()=>P({queryKey:[`workspace`,`config`],queryFn:L.workspaceConfig}),No=()=>P({queryKey:[`files`],queryFn:L.listFiles,staleTime:3e4,placeholderData:se}),Po=()=>P({queryKey:[`zuzuu`,`health`],queryFn:W.health,refetchInterval:8e3}),Fo=e=>P({queryKey:[`zuzuu`,`session`],queryFn:W.sessionGit,refetchInterval:6e3,enabled:e}),Io=e=>e.split(`/`).slice(0,-1).join(`/`);function Lo(e){let t=N();(0,j.useEffect)(()=>{e&&(In.start(e=>{t.invalidateQueries({queryKey:[`dir`,e]}),t.invalidateQueries({queryKey:[`git`,`status`]}),(e===`.zuzuu`||e.startsWith(`.zuzuu/`))&&t.invalidateQueries({queryKey:[`zuzuu`]}),t.invalidateQueries({predicate:t=>t.queryKey[0]===`preview`&&typeof t.queryKey[1]==`string`&&Io(t.queryKey[1])===e})}),In.watch(`.zuzuu`),In.watch(`.zuzuu/.live`))},[e,t])}function Ro(){let{tabs:e,activeId:t,loaded:n,close:r,setActive:i}=R(),a=Po(),o=a.data?.home===!0,s=Fo(o),c=(0,j.useRef)(null),l=()=>c.current?.focus(),u=e.length===0&&(a.isPending||o&&s.isPending),d=n&&!u?Qa(e.length,s.data):{kind:`none`},f=n&&!u&&e.length===0&&a.data?.home===!1;return(0,M.jsxs)(`div`,{className:`flex h-full min-w-0 flex-col`,children:[(0,M.jsxs)(Et,{border:`b`,surface:`surface`,className:`!gap-0 overflow-x-auto !px-0`,children:[(0,M.jsx)(Ft,{children:e.map(e=>{let n=e.type===`agent`?Er(e.host):e.title;return(0,M.jsx)(It,{active:e.id===t,onClick:()=>i(e.id),onClose:()=>void r(e.id),title:e.cwdLive?`${n} · ${e.cwdLive.cwd}`:n,leading:(0,M.jsx)(Nt,{tone:e.alive?`ok`:`idle`}),children:n},e.id)})}),(0,M.jsx)(At,{title:`New agent session — pick a host below`,iconPath:`M8 3v10M3 8h10`,className:`mx-1`,onClick:l})]}),(0,M.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[e.map(e=>(0,M.jsx)(`div`,{className:`absolute inset-0`,style:{visibility:e.id===t?`visible`:`hidden`},children:(0,M.jsx)(Oo,{sessionId:e.id,active:e.id===t,sessionType:e.type,host:e.host,onStartNew:l,onCloseTab:()=>void r(e.id)})},e.id)),e.length===0&&d.kind===`none`&&!f&&(0,M.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,M.jsx)(`span`,{className:`select-none text-2xl text-ink-600`,children:`❯_`})}),(d.kind===`recovery`||f)&&(0,M.jsx)(`div`,{className:`absolute inset-0 z-30 flex items-center justify-center bg-app/90 p-6`,children:d.kind===`recovery`?(0,M.jsx)(so,{branch:d.branch,checkpoints:d.checkpoints}):(0,M.jsx)(oo,{zuzuuBin:a.data?.zuzuuBin??!1})})]}),o&&(0,M.jsx)(Ao,{ref:c})]})}function zo({enabled:e}){let t=N(),[n,r]=(0,j.useState)(!1),[i,a]=(0,j.useState)(!1),o=(0,j.useRef)(null),s=eo(P({queryKey:[`zuzuu`,`session`],queryFn:W.sessionGit,refetchInterval:6e3,enabled:e}).data);if(s.kind===`none`)return null;let c=e=>{a(!0),e().catch(e=>window.alert(mn(e))).finally(()=>{a(!1),no(t)})},l=[{label:`Merge to main`,onClick:()=>c(ro),disabled:i},...s.kind===`leftover`?[{label:`Continue session`,onClick:()=>c(W.sessionContinue),disabled:i}]:[]];return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{ref:o,onClick:()=>r(e=>!e),className:`shrink-0 ${s.kind===`leftover`?`text-warn hover:text-warn/80`:`text-ink-300 hover:text-accent`}`,title:s.kind===`leftover`?`A session branch was left unmerged — merge or continue it`:`zuzuu session branch — checkpoints land here, merge squashes to main`,children:s.label}),n&&(0,M.jsx)(Jt,{items:l,onClose:()=>r(!1),anchorEl:o.current,ignore:o})]})}async function Bo(e,t){try{await L.switchWorkspace(t),ln.getState().resetAll(),To.getState().resetAll(),K.getState().resetAll(),R.getState().reset(),e.clear(),await R.getState().init(),await e.invalidateQueries()}catch(e){window.alert(`Could not open vault: ${e.message}`)}}async function Vo(){let e=R.getState(),t=e.tabs.find(t=>t.id===e.activeId);if(!t)return;let n=new Date().toISOString().slice(11,19).replace(/:/g,``),r=await Vt({title:`Save session recording`,defaultValue:`recordings/${t.title}-${n}.cast`,okLabel:`Save`});if(r)try{(await L.saveRecording(t.id,r)).truncated&&window.alert(`Saved — note: the oldest output was dropped (buffer cap reached).`)}catch(e){window.alert(`Could not save recording: ${e.message}`)}}var Ho=`https://github.com/h1902y/zuzuu/wiki`;function Uo(e){let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}var Wo=e=>`${Math.round(e/1024/1024)} MB`;function Go({zuzuuHome:e,onOpenPalette:t,onOpenVaultPicker:n}){let r=N(),i=St(),{tabs:a}=R(),o=jo(),s=Mo(),c=No(),[l,u]=(0,j.useState)(!1),[d,f]=(0,j.useState)(!1),p=(0,j.useRef)(null),m=$t(s.data?.recent??[],o.data?.root,5),h=e=>{u(!1),Bo(r,e)};return(0,M.jsxs)(Et,{border:`t`,surface:`surface`,className:`relative !gap-2.5 text-meta text-ink-500`,children:[(0,M.jsx)(`span`,{className:`shrink-0 ${i.state===`connected`?`text-accent-dim`:i.state===`reconnecting`?`animate-pulse text-warn`:`text-danger`}`,title:[`daemon ${i.state}`,c.data?`${c.data.files.length}${c.data.truncated?`+`:``} files`:null,`${a.filter(e=>e.alive).length} session(s)`,i.uptimeMs===null?null:`up ${Uo(i.uptimeMs)}`,i.rss===null?null:Wo(i.rss)].filter(Boolean).join(` · `),children:`❯_`}),(0,M.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,M.jsxs)(`button`,{onClick:()=>u(e=>!e),className:`max-w-72 truncate rounded-[var(--radius-sm)] px-1 text-ink-300 hover:text-accent`,title:o.data?.root,children:[o.data?.name??`…`,` ▾`]}),l&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{className:`fixed inset-0 z-40`,onClick:()=>u(!1)}),(0,M.jsxs)(`div`,{style:{boxShadow:`var(--shadow-menu)`},className:`absolute bottom-full left-0 z-50 mb-1 max-h-[60vh] w-64 overflow-y-auto rounded-[var(--radius-ui)] border border-border bg-elevated py-1`,children:[(0,M.jsxs)(`button`,{onClick:()=>{u(!1),n()},className:`block w-full px-3 py-1.5 text-left text-ui text-ink-100 hover:bg-hover`,children:[`Browse… `,(0,M.jsx)(`span`,{className:`text-ink-500`,children:`⌘⇧O`})]}),m.length>0&&(0,M.jsxs)(`div`,{className:`mt-1 border-t border-border pt-1`,children:[(0,M.jsx)(`div`,{className:`px-3 py-0.5 text-meta uppercase tracking-wider text-ink-500`,children:`Recent`}),m.map(e=>(0,M.jsx)(`button`,{onClick:()=>h(e),className:`block w-full truncate px-3 py-1 text-left text-ui text-ink-300 hover:bg-hover hover:text-ink-100`,title:e,children:Zt(e)},e))]})]})]})]}),(0,M.jsx)(zo,{enabled:e}),(0,M.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,M.jsx)(`span`,{ref:p,children:(0,M.jsx)(At,{title:`Help — what is zuzuu?`,iconPath:`M8 2.5a5.5 5.5 0 110 11 5.5 5.5 0 010-11M6.3 6.2a1.8 1.8 0 113 1.3c-.6.5-1.3.8-1.3 1.7M8 11.2v.3`,onClick:()=>f(e=>!e)})}),d&&(0,M.jsx)(Jt,{items:[{label:`What is zuzuu? — run zuzuu explain`,onClick:()=>{f(!1),ao([`explain`])}},{label:`Workbench guide ↗`,onClick:()=>{f(!1),window.open(`${Ho}/Workbench`,`_blank`,`noopener`)}},{label:`Faculty Standard ↗`,onClick:()=>{f(!1),window.open(`${Ho}/Faculty-Standard`,`_blank`,`noopener`)}}],onClose:()=>f(!1),anchorEl:p.current,ignore:p}),(0,M.jsx)(`button`,{onClick:t,className:`shrink-0 rounded-[var(--radius-sm)] px-1.5 text-ink-500 hover:text-accent`,title:`Command palette`,children:`⌘K`})]})]})}function Ko(e){let{onPalette:t,onClosePalette:n,paletteAllOpen:r,onOpenVaultPicker:i,onSaveRecording:a}=e,o=ln(e=>e.saveActive);(0,j.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&e.key===`k`)e.preventDefault(),r?n():t(`all`);else if((e.metaKey||e.ctrlKey)&&e.key===`f`&&!e.shiftKey&&!e.altKey){if(e.target?.closest?.(`.monaco-editor`))return;e.preventDefault(),K.getState().openSearch()}else (e.metaKey||e.ctrlKey)&&e.key===`r`?(e.preventDefault(),t(`history`)):(e.metaKey||e.ctrlKey)&&e.key===`s`?(e.preventDefault(),o()):(e.metaKey||e.ctrlKey)&&e.shiftKey&&e.key.toLowerCase()===`o`?(e.preventDefault(),i()):e.key===`Escape`&&n()},s=()=>i(),c=()=>a();return window.addEventListener(`keydown`,e),window.addEventListener(`zuzuu-web:open-vault-picker`,s),window.addEventListener(`zuzuu-web:save-recording`,c),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`zuzuu-web:open-vault-picker`,s),window.removeEventListener(`zuzuu-web:save-recording`,c)}},[t,n,r,i,a,o])}var qo=(0,j.lazy)(()=>sr(()=>import(`./CommandPalette-DhBdR7X3.js`).then(e=>({default:e.CommandPalette})),__vite__mapDeps([4,1,3])));function Jo(){let e=N(),{tabs:t,activeId:n,init:r}=R(),[i,a]=(0,j.useState)(null),o=jo(),s=Mo(),c=St(),l=Po(),u=l.data?.home===!0;(0,j.useEffect)(()=>{r().catch(e=>a(e.message))},[r]),Lo(o.data!==void 0);let[d,f]=(0,j.useState)(!1),[p,m]=(0,j.useState)(!1),[h,g]=(0,j.useState)(!1),[_,v]=(0,j.useState)(`all`),[y,b]=(0,j.useState)(null);Ko({onPalette:(0,j.useCallback)(e=>{v(e),g(!0)},[]),onClosePalette:(0,j.useCallback)(()=>g(!1),[]),paletteAllOpen:h&&_===`all`,onOpenVaultPicker:(0,j.useCallback)(()=>f(!0),[]),onSaveRecording:(0,j.useCallback)(()=>void Vo(),[])});let x=e=>{(e.args?.length??0)>0||/\{\{\s*\w+\s*\}\}/.test(e.command)?b(e):wt.get(R.getState().activeId)?.sendInput(`\x15${pt(e.command,{})}\r`)},S=t.find(e=>e.id===n);return(0,j.useEffect)(()=>{let e=o.data?.name??`zuzuu-web`,t=S&&(S.type===`agent`?Er(S.host):S.title);document.title=t?`${t} — ${e}`:e},[S,o.data]),o.error||i?(0,M.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 text-ink-300`,children:[(0,M.jsx)(`div`,{className:`text-2xl text-accent`,children:`❯_`}),(0,M.jsx)(`div`,{className:`max-w-md text-center text-sm leading-relaxed`,children:o.error?.message??i})]}):(0,M.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,M.jsx)(Tt,{state:c.state}),(0,M.jsx)(ma,{sidebar:(0,M.jsx)(Za,{}),center:(0,M.jsx)(Ro,{}),right:(0,M.jsx)(lr,{zuzuuHome:u,zuzuuBin:l.data?.zuzuuBin??!0,onCollapse:()=>m(!0)}),rightCollapsed:p,onExpandRight:()=>m(!1)}),(0,M.jsx)(Go,{zuzuuHome:u,onOpenPalette:()=>{v(`all`),g(!0)},onOpenVaultPicker:()=>f(!0)}),h&&(0,M.jsx)(j.Suspense,{fallback:null,children:(0,M.jsx)(qo,{open:!0,mode:_,onClose:()=>g(!1),onRunWorkflow:x})}),(0,M.jsx)(on,{}),(0,M.jsx)(sn,{workflow:y,onClose:()=>b(null)}),(0,M.jsx)(gr,{}),(0,M.jsx)(Ut,{}),d&&(0,M.jsx)(en,{recent:s.data?.recent??[],currentRoot:o.data?.root,onClose:()=>f(!1),onPick:t=>{f(!1),Bo(e,t)}}),s.data&&!s.data.onboarded&&(0,M.jsx)(Yt,{workspaceName:o.data?.name,onOpenVaultPicker:()=>f(!0),onDismiss:()=>{L.setOnboarded(),e.invalidateQueries({queryKey:[`workspace`,`config`]})}})]})}var Yo=new Ke({defaultOptions:{queries:{staleTime:5e3,retry:1,refetchOnWindowFocus:!1}}});lt.createRoot(document.getElementById(`root`)).render((0,M.jsx)(j.StrictMode,{children:(0,M.jsx)(Je,{client:Yo,children:(0,M.jsx)(Jo,{})})}));export{dn as a,Lt as c,Et as d,wt as f,N as g,P as h,K as i,It as l,L as m,Ra as n,ln as o,R as p,sr as r,Gt as s,To as t,Ft as u};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-QTnfLwEv.js";var t=e({default:()=>n}),n=[Object.freeze(JSON.parse(`{"displayName":"Java","name":"java","patterns":[{"begin":"\\\\b(package)\\\\b\\\\s*","beginCaptures":{"1":{"name":"keyword.other.package.java"}},"contentName":"storage.modifier.package.java","end":"\\\\s*(;)","endCaptures":{"1":{"name":"punctuation.terminator.java"}},"name":"meta.package.java","patterns":[{"include":"#comments"},{"match":"(?<=\\\\.)\\\\s*\\\\.|\\\\.(?=\\\\s*;)","name":"invalid.illegal.character_not_allowed_here.java"},{"match":"(?<!_)_(?=\\\\s*([.;]))|\\\\b\\\\d+|-+","name":"invalid.illegal.character_not_allowed_here.java"},{"match":"[A-Z]+","name":"invalid.deprecated.package_name_not_lowercase.java"},{"match":"\\\\b(?<!\\\\$)(abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|non-sealed|package|permits|private|protected|public|return|sealed|short|static|strictfp|super|switch|syncronized|this|throws??|transient|try|void|volatile|while|yield|true|false|null)\\\\b","name":"invalid.illegal.character_not_allowed_here.java"},{"match":"\\\\.","name":"punctuation.separator.java"}]},{"begin":"\\\\b(import)\\\\b\\\\s*\\\\b(static)?\\\\b\\\\s","beginCaptures":{"1":{"name":"keyword.other.import.java"},"2":{"name":"storage.modifier.java"}},"contentName":"storage.modifier.import.java","end":"\\\\s*(;)","endCaptures":{"1":{"name":"punctuation.terminator.java"}},"name":"meta.import.java","patterns":[{"include":"#comments"},{"match":"(?<=\\\\.)\\\\s*\\\\.|\\\\.(?=\\\\s*;)","name":"invalid.illegal.character_not_allowed_here.java"},{"match":"(?<!\\\\.)\\\\s*\\\\*","name":"invalid.illegal.character_not_allowed_here.java"},{"match":"(?<!_)_(?=\\\\s*([.;]))|\\\\b\\\\d+|-+","name":"invalid.illegal.character_not_allowed_here.java"},{"match":"\\\\b(?<!\\\\$)(abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|non-sealed|package|permits|private|protected|public|return|sealed|short|static|strictfp|super|switch|syncronized|this|throws??|transient|try|void|volatile|while|yield|true|false|null)\\\\b","name":"invalid.illegal.character_not_allowed_here.java"},{"match":"\\\\.","name":"punctuation.separator.java"},{"match":"\\\\*","name":"variable.language.wildcard.java"}]},{"include":"#comments-javadoc"},{"include":"#code"},{"include":"#module"}],"repository":{"all-types":{"patterns":[{"include":"#primitive-arrays"},{"include":"#primitive-types"},{"include":"#object-types"}]},"annotations":{"patterns":[{"begin":"((@)\\\\s*([^(\\\\s]+))(\\\\()","beginCaptures":{"2":{"name":"punctuation.definition.annotation.java"},"3":{"name":"storage.type.annotation.java"},"4":{"name":"punctuation.definition.annotation-arguments.begin.bracket.round.java"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.annotation-arguments.end.bracket.round.java"}},"name":"meta.declaration.annotation.java","patterns":[{"captures":{"1":{"name":"constant.other.key.java"},"2":{"name":"keyword.operator.assignment.java"}},"match":"(\\\\w*)\\\\s*(=)"},{"include":"#code"}]},{"captures":{"1":{"name":"punctuation.definition.annotation.java"},"2":{"name":"storage.modifier.java"},"3":{"name":"storage.type.annotation.java"},"5":{"name":"punctuation.definition.annotation.java"},"6":{"name":"storage.type.annotation.java"}},"match":"(@)(interface)\\\\s+(\\\\w*)|((@)\\\\s*(\\\\w+))","name":"meta.declaration.annotation.java"}]},"anonymous-block-and-instance-initializer":{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.section.block.begin.bracket.curly.java"}},"end":"}","endCaptures":{"0":{"name":"punctuation.section.block.end.bracket.curly.java"}},"patterns":[{"include":"#code"}]},"anonymous-classes-and-new":{"begin":"\\\\bnew\\\\b","beginCaptures":{"0":{"name":"keyword.control.new.java"}},"end":"(?=[])-.:;?}]|/(?![*/])|[!%\\\\&=^|])","patterns":[{"include":"#comments"},{"include":"#function-call"},{"include":"#all-types"},{"begin":"(?<=\\\\))","end":"(?=[])-.:;?}]|/(?![*/])|[!%\\\\&=^|])","patterns":[{"include":"#comments"},{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.section.inner-class.begin.bracket.curly.java"}},"end":"}","endCaptures":{"0":{"name":"punctuation.section.inner-class.end.bracket.curly.java"}},"name":"meta.inner-class.java","patterns":[{"include":"#class-body"}]}]},{"begin":"(?<=])","end":"(?=[])-.:;?}]|/(?![*/])|[!%\\\\&=^|])","patterns":[{"include":"#comments"},{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.section.array-initializer.begin.bracket.curly.java"}},"end":"}","endCaptures":{"0":{"name":"punctuation.section.array-initializer.end.bracket.curly.java"}},"name":"meta.array-initializer.java","patterns":[{"include":"#code"}]}]},{"include":"#parens"}]},"assertions":{"patterns":[{"begin":"\\\\b(assert)\\\\s","beginCaptures":{"1":{"name":"keyword.control.assert.java"}},"end":"$","name":"meta.declaration.assertion.java","patterns":[{"match":":","name":"keyword.operator.assert.expression-separator.java"},{"include":"#code"}]}]},"class":{"begin":"(?=\\\\w?[-\\\\w\\\\s]*\\\\b(?:class|(?<!@)interface|enum)\\\\s+[$\\\\w]+)","end":"}","endCaptures":{"0":{"name":"punctuation.section.class.end.bracket.curly.java"}},"name":"meta.class.java","patterns":[{"include":"#storage-modifiers"},{"include":"#generics"},{"include":"#comments"},{"captures":{"1":{"name":"storage.modifier.java"},"2":{"name":"entity.name.type.class.java"}},"match":"(class|(?<!@)interface|enum)\\\\s+([$\\\\w]+)","name":"meta.class.identifier.java"},{"begin":"extends","beginCaptures":{"0":{"name":"storage.modifier.extends.java"}},"end":"(?=\\\\{|implements|permits)","name":"meta.definition.class.inherited.classes.java","patterns":[{"include":"#object-types-inherited"},{"include":"#comments"}]},{"begin":"(implements)\\\\s","beginCaptures":{"1":{"name":"storage.modifier.implements.java"}},"end":"(?=\\\\s*extends|permits|\\\\{)","name":"meta.definition.class.implemented.interfaces.java","patterns":[{"include":"#object-types-inherited"},{"include":"#comments"}]},{"begin":"(permits)\\\\s","beginCaptures":{"1":{"name":"storage.modifier.permits.java"}},"end":"(?=\\\\s*extends|implements|\\\\{)","name":"meta.definition.class.permits.classes.java","patterns":[{"include":"#object-types-inherited"},{"include":"#comments"}]},{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.section.class.begin.bracket.curly.java"}},"contentName":"meta.class.body.java","end":"(?=})","patterns":[{"include":"#class-body"}]}]},"class-body":{"patterns":[{"include":"#comments-javadoc"},{"include":"#comments"},{"include":"#enums"},{"include":"#class"},{"include":"#generics"},{"include":"#static-initializer"},{"include":"#class-fields-and-methods"},{"include":"#annotations"},{"include":"#storage-modifiers"},{"include":"#member-variables"},{"include":"#code"}]},"class-fields-and-methods":{"patterns":[{"begin":"(?==)","end":"(?=;)","patterns":[{"include":"#code"}]},{"include":"#methods"}]},"code":{"patterns":[{"include":"#annotations"},{"include":"#comments"},{"include":"#enums"},{"include":"#class"},{"include":"#record"},{"include":"#anonymous-block-and-instance-initializer"},{"include":"#try-catch-finally"},{"include":"#assertions"},{"include":"#parens"},{"include":"#constants-and-special-vars"},{"include":"#numbers"},{"include":"#anonymous-classes-and-new"},{"include":"#lambda-expression"},{"include":"#keywords"},{"include":"#storage-modifiers"},{"include":"#method-call"},{"include":"#function-call"},{"include":"#variables"},{"include":"#variables-local"},{"include":"#objects"},{"include":"#properties"},{"include":"#strings"},{"include":"#all-types"},{"match":",","name":"punctuation.separator.delimiter.java"},{"match":"\\\\.","name":"punctuation.separator.period.java"},{"match":";","name":"punctuation.terminator.java"}]},"comments":{"patterns":[{"captures":{"0":{"name":"punctuation.definition.comment.java"}},"match":"/\\\\*\\\\*/","name":"comment.block.empty.java"},{"include":"#comments-inline"}]},"comments-inline":{"patterns":[{"begin":"/\\\\*","captures":{"0":{"name":"punctuation.definition.comment.java"}},"end":"\\\\*/","name":"comment.block.java"},{"begin":"(^[\\\\t ]+)?(?=//)","beginCaptures":{"1":{"name":"punctuation.whitespace.comment.leading.java"}},"end":"(?!\\\\G)","patterns":[{"begin":"//","beginCaptures":{"0":{"name":"punctuation.definition.comment.java"}},"end":"\\\\n","name":"comment.line.double-slash.java"}]}]},"comments-javadoc":{"patterns":[{"begin":"^\\\\s*(/\\\\*\\\\*)(?!/)","beginCaptures":{"1":{"name":"punctuation.definition.comment.java"}},"end":"\\\\*/","endCaptures":{"0":{"name":"punctuation.definition.comment.java"}},"name":"comment.block.javadoc.java","patterns":[{"match":"@(author|deprecated|return|see|serial|since|version)\\\\b","name":"keyword.other.documentation.javadoc.java"},{"captures":{"1":{"name":"keyword.other.documentation.javadoc.java"},"2":{"name":"variable.parameter.java"}},"match":"(@param)\\\\s+(\\\\S+)"},{"captures":{"1":{"name":"keyword.other.documentation.javadoc.java"},"2":{"name":"entity.name.type.class.java"}},"match":"(@(?:exception|throws))\\\\s+(\\\\S+)"},{"captures":{"1":{"name":"keyword.other.documentation.javadoc.java"},"2":{"name":"entity.name.type.class.java"},"3":{"name":"variable.parameter.java"}},"match":"\\\\{(@link)\\\\s+(\\\\S+)?#([$\\\\w]+\\\\s*\\\\([^()]*\\\\)).*?}"}]}]},"constants-and-special-vars":{"patterns":[{"match":"\\\\b(true|false|null)\\\\b","name":"constant.language.java"},{"match":"\\\\bthis\\\\b","name":"variable.language.this.java"},{"match":"\\\\bsuper\\\\b","name":"variable.language.java"}]},"enums":{"begin":"^\\\\s*([\\\\w\\\\s]*)(enum)\\\\s+(\\\\w+)","beginCaptures":{"1":{"patterns":[{"include":"#storage-modifiers"}]},"2":{"name":"storage.modifier.java"},"3":{"name":"entity.name.type.enum.java"}},"end":"}","endCaptures":{"0":{"name":"punctuation.section.enum.end.bracket.curly.java"}},"name":"meta.enum.java","patterns":[{"begin":"\\\\b(extends)\\\\b","beginCaptures":{"1":{"name":"storage.modifier.extends.java"}},"end":"(?=\\\\{|\\\\bimplements\\\\b)","name":"meta.definition.class.inherited.classes.java","patterns":[{"include":"#object-types-inherited"},{"include":"#comments"}]},{"begin":"\\\\b(implements)\\\\b","beginCaptures":{"1":{"name":"storage.modifier.implements.java"}},"end":"(?=\\\\{|\\\\bextends\\\\b)","name":"meta.definition.class.implemented.interfaces.java","patterns":[{"include":"#object-types-inherited"},{"include":"#comments"}]},{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.section.enum.begin.bracket.curly.java"}},"end":"(?=})","patterns":[{"begin":"(?<=\\\\{)","end":"(?=[;}])","patterns":[{"include":"#comments-javadoc"},{"include":"#comments"},{"begin":"\\\\b(\\\\w+)\\\\b","beginCaptures":{"1":{"name":"constant.other.enum.java"}},"end":"(,)|(?=[;}])","endCaptures":{"1":{"name":"punctuation.separator.delimiter.java"}},"patterns":[{"include":"#comments-javadoc"},{"include":"#comments"},{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.bracket.round.java"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.bracket.round.java"}},"patterns":[{"include":"#code"}]},{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.bracket.curly.java"}},"end":"}","endCaptures":{"0":{"name":"punctuation.bracket.curly.java"}},"patterns":[{"include":"#class-body"}]}]}]},{"include":"#class-body"}]}]},"function-call":{"begin":"([$A-Z_a-z][$\\\\w]*)\\\\s*(\\\\()","beginCaptures":{"1":{"name":"entity.name.function.java"},"2":{"name":"punctuation.definition.parameters.begin.bracket.round.java"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.parameters.end.bracket.round.java"}},"name":"meta.function-call.java","patterns":[{"include":"#code"}]},"generics":{"begin":"<","beginCaptures":{"0":{"name":"punctuation.bracket.angle.java"}},"end":">","endCaptures":{"0":{"name":"punctuation.bracket.angle.java"}},"patterns":[{"match":"\\\\b(extends|super)\\\\b","name":"storage.modifier.$1.java"},{"captures":{"1":{"name":"storage.type.java"}},"match":"(?<!\\\\.)([$A-Z_a-z][$0-9A-Z_a-z]*)(?=\\\\s*<)"},{"include":"#primitive-arrays"},{"match":"[$A-Z_a-z][$0-9A-Z_a-z]*","name":"storage.type.generic.java"},{"match":"\\\\?","name":"storage.type.generic.wildcard.java"},{"match":"&","name":"punctuation.separator.types.java"},{"match":",","name":"punctuation.separator.delimiter.java"},{"match":"\\\\.","name":"punctuation.separator.period.java"},{"include":"#parens"},{"include":"#generics"},{"include":"#comments"}]},"keywords":{"patterns":[{"match":"\\\\bthrow\\\\b","name":"keyword.control.throw.java"},{"match":"[:?]","name":"keyword.control.ternary.java"},{"match":"\\\\b(return|yield|break|case|continue|default|do|while|for|switch|if|else)\\\\b","name":"keyword.control.java"},{"match":"\\\\b(instanceof)\\\\b","name":"keyword.operator.instanceof.java"},{"match":"(<<|>>>?|[\\\\^~])","name":"keyword.operator.bitwise.java"},{"match":"(([\\\\&^|]|<<|>>>?)=)","name":"keyword.operator.assignment.bitwise.java"},{"match":"(===?|!=|<=|>=|<>|[<>])","name":"keyword.operator.comparison.java"},{"match":"([-%*+/]=)","name":"keyword.operator.assignment.arithmetic.java"},{"match":"(=)","name":"keyword.operator.assignment.java"},{"match":"(--|\\\\+\\\\+)","name":"keyword.operator.increment-decrement.java"},{"match":"([-%*+/])","name":"keyword.operator.arithmetic.java"},{"match":"(!|&&|\\\\|\\\\|)","name":"keyword.operator.logical.java"},{"match":"([\\\\&|])","name":"keyword.operator.bitwise.java"},{"match":"\\\\b(const|goto)\\\\b","name":"keyword.reserved.java"}]},"lambda-expression":{"patterns":[{"match":"->","name":"storage.type.function.arrow.java"}]},"member-variables":{"begin":"(?=private|protected|public|native|synchronized|abstract|threadsafe|transient|static|final)","end":"(?=[;=])","patterns":[{"include":"#storage-modifiers"},{"include":"#variables"},{"include":"#primitive-arrays"},{"include":"#object-types"}]},"method-call":{"begin":"(\\\\.)\\\\s*([$A-Z_a-z][$\\\\w]*)\\\\s*(\\\\()","beginCaptures":{"1":{"name":"punctuation.separator.period.java"},"2":{"name":"entity.name.function.java"},"3":{"name":"punctuation.definition.parameters.begin.bracket.round.java"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.parameters.end.bracket.round.java"}},"name":"meta.method-call.java","patterns":[{"include":"#code"}]},"methods":{"begin":"(?!new)(?=[<\\\\w].*\\\\s+)(?=([^/=]|/(?!/))+\\\\()","end":"(})|(?=;)","endCaptures":{"1":{"name":"punctuation.section.method.end.bracket.curly.java"}},"name":"meta.method.java","patterns":[{"include":"#storage-modifiers"},{"begin":"(\\\\w+)\\\\s*(\\\\()","beginCaptures":{"1":{"name":"entity.name.function.java"},"2":{"name":"punctuation.definition.parameters.begin.bracket.round.java"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.parameters.end.bracket.round.java"}},"name":"meta.method.identifier.java","patterns":[{"include":"#parameters"},{"include":"#parens"},{"include":"#comments"}]},{"include":"#generics"},{"begin":"(?=\\\\w.*\\\\s+\\\\w+\\\\s*\\\\()","end":"(?=\\\\s+\\\\w+\\\\s*\\\\()","name":"meta.method.return-type.java","patterns":[{"include":"#all-types"},{"include":"#parens"},{"include":"#comments"}]},{"include":"#throws"},{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.section.method.begin.bracket.curly.java"}},"contentName":"meta.method.body.java","end":"(?=})","patterns":[{"include":"#code"}]},{"include":"#comments"}]},"module":{"begin":"((open)\\\\s)?(module)\\\\s+(\\\\w+)","beginCaptures":{"1":{"name":"storage.modifier.java"},"3":{"name":"storage.modifier.java"},"4":{"name":"entity.name.type.module.java"}},"end":"}","endCaptures":{"0":{"name":"punctuation.section.module.end.bracket.curly.java"}},"name":"meta.module.java","patterns":[{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.section.module.begin.bracket.curly.java"}},"contentName":"meta.module.body.java","end":"(?=})","patterns":[{"include":"#comments"},{"include":"#comments-javadoc"},{"match":"\\\\b(requires|transitive|exports|opens|to|uses|provides|with)\\\\b","name":"keyword.module.java"}]}]},"numbers":{"patterns":[{"match":"\\\\b(?<!\\\\$)0([Xx])((?<!\\\\.)\\\\h([_\\\\h]*\\\\h)?[Ll]?(?!\\\\.)|(\\\\h([_\\\\h]*\\\\h)?\\\\.?|(\\\\h([_\\\\h]*\\\\h)?)?\\\\.\\\\h([_\\\\h]*\\\\h)?)[Pp][-+]?[0-9]([0-9_]*[0-9])?[DFdf]?)\\\\b(?!\\\\$)","name":"constant.numeric.hex.java"},{"match":"\\\\b(?<!\\\\$)0([Bb])[01]([01_]*[01])?[Ll]?\\\\b(?!\\\\$)","name":"constant.numeric.binary.java"},{"match":"\\\\b(?<!\\\\$)0[0-7]([0-7_]*[0-7])?[Ll]?\\\\b(?!\\\\$)","name":"constant.numeric.octal.java"},{"match":"(?<!\\\\$)(\\\\b[0-9]([0-9_]*[0-9])?\\\\.\\\\B(?!\\\\.)|\\\\b[0-9]([0-9_]*[0-9])?\\\\.([Ee][-+]?[0-9]([0-9_]*[0-9])?)[DFdf]?\\\\b|\\\\b[0-9]([0-9_]*[0-9])?\\\\.([Ee][-+]?[0-9]([0-9_]*[0-9])?)?[DFdf]\\\\b|\\\\b[0-9]([0-9_]*[0-9])?\\\\.([0-9]([0-9_]*[0-9])?)([Ee][-+]?[0-9]([0-9_]*[0-9])?)?[DFdf]?\\\\b|(?<!\\\\.)\\\\B\\\\.[0-9]([0-9_]*[0-9])?([Ee][-+]?[0-9]([0-9_]*[0-9])?)?[DFdf]?\\\\b|\\\\b[0-9]([0-9_]*[0-9])?([Ee][-+]?[0-9]([0-9_]*[0-9])?)[DFdf]?\\\\b|\\\\b[0-9]([0-9_]*[0-9])?([Ee][-+]?[0-9]([0-9_]*[0-9])?)?[DFdf]\\\\b|\\\\b(0|[1-9]([0-9_]*[0-9])?)(?!\\\\.)[Ll]?\\\\b)(?!\\\\$)","name":"constant.numeric.decimal.java"}]},"object-types":{"patterns":[{"include":"#generics"},{"begin":"\\\\b((?:[A-Z_a-z]\\\\w*\\\\s*\\\\.\\\\s*)*)([A-Z_]\\\\w*)\\\\s*(?=\\\\[)","beginCaptures":{"1":{"patterns":[{"match":"[A-Z_a-z]\\\\w*","name":"storage.type.java"},{"match":"\\\\.","name":"punctuation.separator.period.java"}]},"2":{"name":"storage.type.object.array.java"}},"end":"(?!\\\\s*\\\\[)","patterns":[{"include":"#comments"},{"include":"#parens"}]},{"captures":{"1":{"patterns":[{"match":"[A-Z_a-z]\\\\w*","name":"storage.type.java"},{"match":"\\\\.","name":"punctuation.separator.period.java"}]}},"match":"\\\\b((?:[A-Z_a-z]\\\\w*\\\\s*\\\\.\\\\s*)*[A-Z_]\\\\w*)\\\\s*(?=<)"},{"captures":{"1":{"patterns":[{"match":"[A-Z_a-z]\\\\w*","name":"storage.type.java"},{"match":"\\\\.","name":"punctuation.separator.period.java"}]}},"match":"\\\\b((?:[A-Z_a-z]\\\\w*\\\\s*\\\\.\\\\s*)*[A-Z_]\\\\w*)\\\\b((?=\\\\s*[\\\\n$A-Z_a-z])|(?=\\\\s*\\\\.\\\\.\\\\.))"}]},"object-types-inherited":{"patterns":[{"include":"#generics"},{"captures":{"1":{"name":"punctuation.separator.period.java"}},"match":"\\\\b(?:[A-Z]\\\\w*\\\\s*(\\\\.)\\\\s*)*[A-Z]\\\\w*\\\\b","name":"entity.other.inherited-class.java"},{"match":",","name":"punctuation.separator.delimiter.java"}]},"objects":{"match":"(?<![$\\\\w])[$A-Z_a-z][$\\\\w]*(?=\\\\s*\\\\.\\\\s*[$\\\\w]+)","name":"variable.other.object.java"},"parameters":{"patterns":[{"match":"\\\\bfinal\\\\b","name":"storage.modifier.java"},{"include":"#annotations"},{"include":"#all-types"},{"include":"#strings"},{"match":"\\\\w+","name":"variable.parameter.java"},{"match":",","name":"punctuation.separator.delimiter.java"},{"match":"\\\\.\\\\.\\\\.","name":"punctuation.definition.parameters.varargs.java"}]},"parens":{"patterns":[{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.bracket.round.java"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.bracket.round.java"}},"patterns":[{"include":"#code"}]},{"begin":"\\\\[","beginCaptures":{"0":{"name":"punctuation.bracket.square.java"}},"end":"]","endCaptures":{"0":{"name":"punctuation.bracket.square.java"}},"patterns":[{"include":"#code"}]},{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.bracket.curly.java"}},"end":"}","endCaptures":{"0":{"name":"punctuation.bracket.curly.java"}},"patterns":[{"include":"#code"}]}]},"primitive-arrays":{"patterns":[{"begin":"\\\\b(void|boolean|byte|char|short|int|float|long|double)\\\\b\\\\s*(?=\\\\[)","beginCaptures":{"1":{"name":"storage.type.primitive.array.java"}},"end":"(?!\\\\s*\\\\[)","patterns":[{"include":"#comments"},{"include":"#parens"}]}]},"primitive-types":{"match":"\\\\b(void|boolean|byte|char|short|int|float|long|double)\\\\b","name":"storage.type.primitive.java"},"properties":{"patterns":[{"captures":{"1":{"name":"punctuation.separator.period.java"},"2":{"name":"keyword.control.new.java"}},"match":"(\\\\.)\\\\s*(new)"},{"captures":{"1":{"name":"punctuation.separator.period.java"},"2":{"name":"variable.other.object.property.java"}},"match":"(\\\\.)\\\\s*([$A-Z_a-z][$\\\\w]*)(?=\\\\s*\\\\.\\\\s*[$A-Z_a-z][$\\\\w]*)"},{"captures":{"1":{"name":"punctuation.separator.period.java"},"2":{"name":"variable.other.object.property.java"}},"match":"(\\\\.)\\\\s*([$A-Z_a-z][$\\\\w]*)"},{"captures":{"1":{"name":"punctuation.separator.period.java"},"2":{"name":"invalid.illegal.identifier.java"}},"match":"(\\\\.)\\\\s*([0-9][$\\\\w]*)"}]},"record":{"begin":"(?=\\\\w?[\\\\w\\\\s]*\\\\brecord\\\\s+[$\\\\w]+)","end":"}","endCaptures":{"0":{"name":"punctuation.section.class.end.bracket.curly.java"}},"name":"meta.record.java","patterns":[{"include":"#storage-modifiers"},{"include":"#generics"},{"include":"#comments"},{"begin":"(record)\\\\s+([$\\\\w]+)(<[$\\\\w]+>)?(\\\\()","beginCaptures":{"1":{"name":"storage.modifier.java"},"2":{"name":"entity.name.type.record.java"},"3":{"patterns":[{"include":"#generics"}]},"4":{"name":"punctuation.definition.parameters.begin.bracket.round.java"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.parameters.end.bracket.round.java"}},"name":"meta.record.identifier.java","patterns":[{"include":"#code"}]},{"begin":"(implements)\\\\s","beginCaptures":{"1":{"name":"storage.modifier.implements.java"}},"end":"(?=\\\\s*\\\\{)","name":"meta.definition.class.implemented.interfaces.java","patterns":[{"include":"#object-types-inherited"},{"include":"#comments"}]},{"include":"#record-body"}]},"record-body":{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.section.class.begin.bracket.curly.java"}},"end":"(?=})","name":"meta.record.body.java","patterns":[{"include":"#record-constructor"},{"include":"#class-body"}]},"record-constructor":{"begin":"(?!new)(?=[<\\\\w].*\\\\s+)(?=([^(/=]|/(?!/))+(?=\\\\{))","end":"(})|(?=;)","endCaptures":{"1":{"name":"punctuation.section.method.end.bracket.curly.java"}},"name":"meta.method.java","patterns":[{"include":"#storage-modifiers"},{"begin":"(\\\\w+)","beginCaptures":{"1":{"name":"entity.name.function.java"}},"end":"(?=\\\\s*\\\\{)","name":"meta.method.identifier.java","patterns":[{"include":"#comments"}]},{"include":"#comments"},{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.section.method.begin.bracket.curly.java"}},"contentName":"meta.method.body.java","end":"(?=})","patterns":[{"include":"#code"}]}]},"static-initializer":{"patterns":[{"include":"#anonymous-block-and-instance-initializer"},{"match":"static","name":"storage.modifier.java"}]},"storage-modifiers":{"match":"\\\\b(public|private|protected|static|final|native|synchronized|abstract|threadsafe|transient|volatile|default|strictfp|sealed|non-sealed)\\\\b","name":"storage.modifier.java"},"strings":{"patterns":[{"begin":"\\"\\"\\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.java"}},"end":"\\"\\"\\"","endCaptures":{"0":{"name":"punctuation.definition.string.end.java"}},"name":"string.quoted.triple.java","patterns":[{"match":"(\\\\\\\\\\"\\"\\")(?!\\")|(\\\\\\\\.)","name":"constant.character.escape.java"}]},{"begin":"\\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.java"}},"end":"\\"","endCaptures":{"0":{"name":"punctuation.definition.string.end.java"}},"name":"string.quoted.double.java","patterns":[{"match":"\\\\\\\\.","name":"constant.character.escape.java"}]},{"begin":"'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.java"}},"end":"'","endCaptures":{"0":{"name":"punctuation.definition.string.end.java"}},"name":"string.quoted.single.java","patterns":[{"match":"\\\\\\\\.","name":"constant.character.escape.java"}]}]},"throws":{"begin":"throws","beginCaptures":{"0":{"name":"storage.modifier.java"}},"end":"(?=[;{])","name":"meta.throwables.java","patterns":[{"match":",","name":"punctuation.separator.delimiter.java"},{"match":"[$A-Z_a-z][$.0-9A-Z_a-z]*","name":"storage.type.java"},{"include":"#comments"}]},"try-catch-finally":{"patterns":[{"begin":"\\\\btry\\\\b","beginCaptures":{"0":{"name":"keyword.control.try.java"}},"end":"}","endCaptures":{"0":{"name":"punctuation.section.try.end.bracket.curly.java"}},"name":"meta.try.java","patterns":[{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.section.try.resources.begin.bracket.round.java"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.section.try.resources.end.bracket.round.java"}},"name":"meta.try.resources.java","patterns":[{"include":"#code"}]},{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.section.try.begin.bracket.curly.java"}},"contentName":"meta.try.body.java","end":"(?=})","patterns":[{"include":"#code"}]}]},{"begin":"\\\\b(catch)\\\\b","beginCaptures":{"1":{"name":"keyword.control.catch.java"}},"end":"}","endCaptures":{"0":{"name":"punctuation.section.catch.end.bracket.curly.java"}},"name":"meta.catch.java","patterns":[{"include":"#comments"},{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.parameters.begin.bracket.round.java"}},"contentName":"meta.catch.parameters.java","end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.parameters.end.bracket.round.java"}},"patterns":[{"include":"#comments"},{"include":"#storage-modifiers"},{"begin":"[$A-Z_a-z][$.0-9A-Z_a-z]*","beginCaptures":{"0":{"name":"storage.type.java"}},"end":"(\\\\|)|(?=\\\\))","endCaptures":{"1":{"name":"punctuation.catch.separator.java"}},"patterns":[{"include":"#comments"},{"captures":{"0":{"name":"variable.parameter.java"}},"match":"\\\\w+"}]}]},{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.section.catch.begin.bracket.curly.java"}},"contentName":"meta.catch.body.java","end":"(?=})","patterns":[{"include":"#code"}]}]},{"begin":"\\\\bfinally\\\\b","beginCaptures":{"0":{"name":"keyword.control.finally.java"}},"end":"}","endCaptures":{"0":{"name":"punctuation.section.finally.end.bracket.curly.java"}},"name":"meta.finally.java","patterns":[{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.section.finally.begin.bracket.curly.java"}},"contentName":"meta.finally.body.java","end":"(?=})","patterns":[{"include":"#code"}]}]}]},"variables":{"begin":"(?=\\\\b((void|boolean|byte|char|short|int|float|long|double)|(?>(\\\\w+\\\\.)*[A-Z_]+\\\\w*))\\\\b\\\\s*(<[],.<>?\\\\[\\\\w\\\\s]*>)?\\\\s*((\\\\[])*)?\\\\s+[$A-Z_a-z][$\\\\w]*([]$,\\\\[\\\\w][],\\\\[\\\\w\\\\s]*)?\\\\s*([:;=]))","end":"(?=[:;=])","name":"meta.definition.variable.java","patterns":[{"captures":{"1":{"name":"variable.other.definition.java"}},"match":"([$A-Z_a-z][$\\\\w]*)(?=\\\\s*(\\\\[])*\\\\s*([,:;=]))"},{"include":"#all-types"},{"include":"#code"}]},"variables-local":{"begin":"(?=\\\\b(var)\\\\b\\\\s+[$A-Z_a-z][$\\\\w]*\\\\s*([:;=]))","end":"(?=[:;=])","name":"meta.definition.variable.local.java","patterns":[{"match":"\\\\bvar\\\\b","name":"storage.type.local.java"},{"captures":{"1":{"name":"variable.other.definition.java"}},"match":"([$A-Z_a-z][$\\\\w]*)(?=\\\\s*(\\\\[])*\\\\s*([:;=]))"},{"include":"#code"}]}},"scopeName":"source.java"}`))];export{t as n,n as t};