@ashlr/hub 3.5.0 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/dist/build-identity.json +2 -2
  3. package/dist/core/fleet/external-skill-audit.js +1 -1
  4. package/dist/core/fleet/external-skill-audit.js.map +1 -1
  5. package/dist/core/local-runtime/llama/config.d.ts +28 -6
  6. package/dist/core/local-runtime/llama/config.js +28 -6
  7. package/dist/core/local-runtime/llama/config.js.map +1 -1
  8. package/dist/core/web/public/next/assets/App-BbVoUCIi.js +7 -0
  9. package/dist/core/web/public/next/assets/App-BbVoUCIi.js.map +1 -0
  10. package/dist/core/web/public/next/assets/App-Cgi6j1Gk.css +1 -0
  11. package/dist/core/web/public/next/assets/ApprovalsSection-BW9iVjUa.js +2 -0
  12. package/dist/core/web/public/next/assets/ApprovalsSection-BW9iVjUa.js.map +1 -0
  13. package/dist/core/web/public/next/assets/ApprovalsSection-Su-NUTis.css +1 -0
  14. package/dist/core/web/public/next/assets/AutonomySection-CRqHUhED.js +2 -0
  15. package/dist/core/web/public/next/assets/AutonomySection-CRqHUhED.js.map +1 -0
  16. package/dist/core/web/public/next/assets/AutonomySection-Cpk_oEhc.css +1 -0
  17. package/dist/core/web/public/next/assets/ChatSection-5irrh6Jw.js +80 -0
  18. package/dist/core/web/public/next/assets/ChatSection-5irrh6Jw.js.map +1 -0
  19. package/dist/core/web/public/next/assets/ChatSection-LQiAn6Eu.css +1 -0
  20. package/dist/core/web/public/next/assets/ConfirmDialog-CXevY3Au.js +2 -0
  21. package/dist/core/web/public/next/assets/ConfirmDialog-CXevY3Au.js.map +1 -0
  22. package/dist/core/web/public/next/assets/{ConfirmDialog-cYuivhCX.css → ConfirmDialog-Dx15x0Ho.css} +1 -1
  23. package/dist/core/web/public/next/assets/Dialog-Bn0CgEGz.js +2 -0
  24. package/dist/core/web/public/next/assets/Dialog-Bn0CgEGz.js.map +1 -0
  25. package/dist/core/web/public/next/assets/Dialog-tQ8kFulD.css +1 -0
  26. package/dist/core/web/public/next/assets/DiffViewer-C8HHTnVE.css +1 -0
  27. package/dist/core/web/public/next/assets/DiffViewer-QKyisN2L.js +7 -0
  28. package/dist/core/web/public/next/assets/DiffViewer-QKyisN2L.js.map +1 -0
  29. package/dist/core/web/public/next/assets/{MutationTokenDialog-jWLLCxWn.css → MutationTokenDialog-CrfJ0PdD.css} +1 -1
  30. package/dist/core/web/public/next/assets/MutationTokenDialog-DbSHPy3w.js +2 -0
  31. package/dist/core/web/public/next/assets/MutationTokenDialog-DbSHPy3w.js.map +1 -0
  32. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-C-PCgCzo.js +7 -0
  33. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-C-PCgCzo.js.map +1 -0
  34. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-CM_8pJs6.css +1 -0
  35. package/dist/core/web/public/next/assets/RouteErrorBoundary-Dw8ZjmkS.js +2 -0
  36. package/dist/core/web/public/next/assets/RouteErrorBoundary-Dw8ZjmkS.js.map +1 -0
  37. package/dist/core/web/public/next/assets/RouteErrorBoundary-ekyMXAK8.css +1 -0
  38. package/dist/core/web/public/next/assets/SettingsSection-BII7TTSD.css +1 -0
  39. package/dist/core/web/public/next/assets/SettingsSection-CWxtTNlD.js +2 -0
  40. package/dist/core/web/public/next/assets/SettingsSection-CWxtTNlD.js.map +1 -0
  41. package/dist/core/web/public/next/assets/UniverseConsoleApp-Bk5HipM0.js +2 -0
  42. package/dist/core/web/public/next/assets/UniverseConsoleApp-Bk5HipM0.js.map +1 -0
  43. package/dist/core/web/public/next/assets/UniverseConsoleApp-Dh7A-hLD.css +1 -0
  44. package/dist/core/web/public/next/assets/UniverseView-Bqa8DH57.css +1 -0
  45. package/dist/core/web/public/next/assets/UniverseView-D8k9q0ce.js +9 -0
  46. package/dist/core/web/public/next/assets/UniverseView-D8k9q0ce.js.map +1 -0
  47. package/dist/core/web/public/next/assets/UsageSection-B2E06ZH1.js +2 -0
  48. package/dist/core/web/public/next/assets/UsageSection-B2E06ZH1.js.map +1 -0
  49. package/dist/core/web/public/next/assets/UsageSection-DwgNOYvi.css +1 -0
  50. package/dist/core/web/public/next/assets/VerseConsoleApp-CRfZUV-T.js +3 -0
  51. package/dist/core/web/public/next/assets/VerseConsoleApp-CRfZUV-T.js.map +1 -0
  52. package/dist/core/web/public/next/assets/VerseConsoleApp-D2E3mU9a.css +1 -0
  53. package/dist/core/web/public/next/assets/charts-CsrtT4rk.css +1 -0
  54. package/dist/core/web/public/next/assets/charts-DSUpczxG.js +2 -0
  55. package/dist/core/web/public/next/assets/charts-DSUpczxG.js.map +1 -0
  56. package/dist/core/web/public/next/assets/fleet-model-ClBbQ0Uj.js +2 -0
  57. package/dist/core/web/public/next/assets/fleet-model-ClBbQ0Uj.js.map +1 -0
  58. package/dist/core/web/public/next/assets/format-BNYWGJat.js +2 -0
  59. package/dist/core/web/public/next/assets/format-BNYWGJat.js.map +1 -0
  60. package/dist/core/web/public/next/assets/global-C4jfYHrj.js +2 -0
  61. package/dist/core/web/public/next/assets/global-C4jfYHrj.js.map +1 -0
  62. package/dist/core/web/public/next/assets/global-D463gG1X.css +1 -0
  63. package/dist/core/web/public/next/assets/icons-BxOX8-XB.js +2 -0
  64. package/dist/core/web/public/next/assets/icons-BxOX8-XB.js.map +1 -0
  65. package/dist/core/web/public/next/assets/index-BMRIET7F.js +11 -0
  66. package/dist/core/web/public/next/assets/index-BMRIET7F.js.map +1 -0
  67. package/dist/core/web/public/next/assets/queries-AxnVa02h.js +2 -0
  68. package/dist/core/web/public/next/assets/queries-AxnVa02h.js.map +1 -0
  69. package/dist/core/web/public/next/assets/use-guarded-action-BO6c94Wp.js +2 -0
  70. package/dist/core/web/public/next/assets/use-guarded-action-BO6c94Wp.js.map +1 -0
  71. package/dist/core/web/public/next/assets/verse-model-CvtK6vP6.js +2 -0
  72. package/dist/core/web/public/next/assets/verse-model-CvtK6vP6.js.map +1 -0
  73. package/dist/core/web/public/next/assets/workspace-model-cE4LkKpE.js +2 -0
  74. package/dist/core/web/public/next/assets/workspace-model-cE4LkKpE.js.map +1 -0
  75. package/dist/core/web/public/next/index.html +1 -1
  76. package/dist/release-dependency-inventory.json +1 -1
  77. package/node_modules/marked/README.md +8 -0
  78. package/node_modules/marked/bin/main.js +12 -11
  79. package/node_modules/marked/lib/marked.d.ts +88 -25
  80. package/node_modules/marked/lib/marked.esm.js +50 -44
  81. package/node_modules/marked/lib/marked.esm.js.map +3 -3
  82. package/node_modules/marked/lib/marked.umd.js +50 -44
  83. package/node_modules/marked/lib/marked.umd.js.map +3 -3
  84. package/node_modules/marked/man/marked.1 +1 -1
  85. package/node_modules/marked/package.json +21 -21
  86. package/package.json +13 -8
  87. package/dist/core/web/public/next/assets/App-BCKqSppK.css +0 -1
  88. package/dist/core/web/public/next/assets/App-CsbPYQqy.js +0 -16
  89. package/dist/core/web/public/next/assets/App-CsbPYQqy.js.map +0 -1
  90. package/dist/core/web/public/next/assets/ApprovalsSection-CBZquyLK.js +0 -2
  91. package/dist/core/web/public/next/assets/ApprovalsSection-CBZquyLK.js.map +0 -1
  92. package/dist/core/web/public/next/assets/ApprovalsSection-CRP59wSb.css +0 -1
  93. package/dist/core/web/public/next/assets/AutonomySection-CQVpEdCE.js +0 -2
  94. package/dist/core/web/public/next/assets/AutonomySection-CQVpEdCE.js.map +0 -1
  95. package/dist/core/web/public/next/assets/AutonomySection-DTN6m6QE.css +0 -1
  96. package/dist/core/web/public/next/assets/ChatSection-DiRvNX3Q.css +0 -1
  97. package/dist/core/web/public/next/assets/ChatSection-DmE9K0Tg.js +0 -77
  98. package/dist/core/web/public/next/assets/ChatSection-DmE9K0Tg.js.map +0 -1
  99. package/dist/core/web/public/next/assets/ConfirmDialog-deO0C0iY.js +0 -2
  100. package/dist/core/web/public/next/assets/ConfirmDialog-deO0C0iY.js.map +0 -1
  101. package/dist/core/web/public/next/assets/Dialog-CNd7q89m.js +0 -2
  102. package/dist/core/web/public/next/assets/Dialog-CNd7q89m.js.map +0 -1
  103. package/dist/core/web/public/next/assets/Dialog-DxN7RgB5.css +0 -1
  104. package/dist/core/web/public/next/assets/DiffViewer-DTO0KRuG.js +0 -7
  105. package/dist/core/web/public/next/assets/DiffViewer-DTO0KRuG.js.map +0 -1
  106. package/dist/core/web/public/next/assets/DiffViewer-hN7X6wGT.css +0 -1
  107. package/dist/core/web/public/next/assets/Epistemic-53PikaUI.js +0 -2
  108. package/dist/core/web/public/next/assets/Epistemic-53PikaUI.js.map +0 -1
  109. package/dist/core/web/public/next/assets/Epistemic-DiyMyeaN.css +0 -1
  110. package/dist/core/web/public/next/assets/Meter-CGBsbXUX.css +0 -1
  111. package/dist/core/web/public/next/assets/Meter-DRWZQgr1.js +0 -2
  112. package/dist/core/web/public/next/assets/Meter-DRWZQgr1.js.map +0 -1
  113. package/dist/core/web/public/next/assets/MutationTokenDialog-DYF8n_RD.js +0 -2
  114. package/dist/core/web/public/next/assets/MutationTokenDialog-DYF8n_RD.js.map +0 -1
  115. package/dist/core/web/public/next/assets/RefreshIndicator-DXJQXKyA.js +0 -2
  116. package/dist/core/web/public/next/assets/RefreshIndicator-DXJQXKyA.js.map +0 -1
  117. package/dist/core/web/public/next/assets/RefreshIndicator-O7jUBOmX.css +0 -1
  118. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-DLl4DbGG.css +0 -1
  119. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-hDSEFdLU.js +0 -7
  120. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-hDSEFdLU.js.map +0 -1
  121. package/dist/core/web/public/next/assets/RouteErrorBoundary-BIpdnxp-.css +0 -1
  122. package/dist/core/web/public/next/assets/RouteErrorBoundary-CZd7ln8v.js +0 -2
  123. package/dist/core/web/public/next/assets/RouteErrorBoundary-CZd7ln8v.js.map +0 -1
  124. package/dist/core/web/public/next/assets/SettingsSection-C9Qs9JWW.js +0 -2
  125. package/dist/core/web/public/next/assets/SettingsSection-C9Qs9JWW.js.map +0 -1
  126. package/dist/core/web/public/next/assets/SettingsSection-DGJMdUh2.css +0 -1
  127. package/dist/core/web/public/next/assets/Skeleton-D2JaTXyv.css +0 -1
  128. package/dist/core/web/public/next/assets/Skeleton-YkcOpgFb.js +0 -2
  129. package/dist/core/web/public/next/assets/Skeleton-YkcOpgFb.js.map +0 -1
  130. package/dist/core/web/public/next/assets/StatusBadge-DJw0LSPg.js +0 -2
  131. package/dist/core/web/public/next/assets/StatusBadge-DJw0LSPg.js.map +0 -1
  132. package/dist/core/web/public/next/assets/StatusBadge-TpDqZf6K.css +0 -1
  133. package/dist/core/web/public/next/assets/TableView-Bj-w1O6o.js +0 -2
  134. package/dist/core/web/public/next/assets/TableView-Bj-w1O6o.js.map +0 -1
  135. package/dist/core/web/public/next/assets/TableView-R6Yeztp1.css +0 -1
  136. package/dist/core/web/public/next/assets/UniverseConsoleApp-Bs2fxaen.js +0 -2
  137. package/dist/core/web/public/next/assets/UniverseConsoleApp-Bs2fxaen.js.map +0 -1
  138. package/dist/core/web/public/next/assets/UniverseConsoleApp-CiZZxRPV.css +0 -1
  139. package/dist/core/web/public/next/assets/UniverseView-B6b2hw-8.js +0 -9
  140. package/dist/core/web/public/next/assets/UniverseView-B6b2hw-8.js.map +0 -1
  141. package/dist/core/web/public/next/assets/UniverseView-gBxl6yum.css +0 -1
  142. package/dist/core/web/public/next/assets/UsageSection-C__ziNkV.js +0 -2
  143. package/dist/core/web/public/next/assets/UsageSection-C__ziNkV.js.map +0 -1
  144. package/dist/core/web/public/next/assets/UsageSection-UUYDidOg.css +0 -1
  145. package/dist/core/web/public/next/assets/VerseConsoleApp-Cu5aG6J6.js +0 -3
  146. package/dist/core/web/public/next/assets/VerseConsoleApp-Cu5aG6J6.js.map +0 -1
  147. package/dist/core/web/public/next/assets/VerseConsoleApp-mOAXvWa6.css +0 -1
  148. package/dist/core/web/public/next/assets/fleet-model-DXCfVtNW.js +0 -2
  149. package/dist/core/web/public/next/assets/fleet-model-DXCfVtNW.js.map +0 -1
  150. package/dist/core/web/public/next/assets/format-fggwu_Rs.js +0 -2
  151. package/dist/core/web/public/next/assets/format-fggwu_Rs.js.map +0 -1
  152. package/dist/core/web/public/next/assets/global-BHjd6fVZ.js +0 -2
  153. package/dist/core/web/public/next/assets/global-BHjd6fVZ.js.map +0 -1
  154. package/dist/core/web/public/next/assets/global-BeRYd1Bu.css +0 -1
  155. package/dist/core/web/public/next/assets/index-CJ-e8YA9.js +0 -2
  156. package/dist/core/web/public/next/assets/index-CJ-e8YA9.js.map +0 -1
  157. package/dist/core/web/public/next/assets/index-CpgkRaTi.js +0 -51
  158. package/dist/core/web/public/next/assets/index-CpgkRaTi.js.map +0 -1
  159. package/dist/core/web/public/next/assets/queries-856qUN3Y.js +0 -2
  160. package/dist/core/web/public/next/assets/queries-856qUN3Y.js.map +0 -1
  161. package/dist/core/web/public/next/assets/use-guarded-action-Bqa2v0a-.css +0 -1
  162. package/dist/core/web/public/next/assets/use-guarded-action-DwaESKVy.js +0 -2
  163. package/dist/core/web/public/next/assets/use-guarded-action-DwaESKVy.js.map +0 -1
  164. package/dist/core/web/public/next/assets/verse-model-Dllo8rRt.js +0 -2
  165. package/dist/core/web/public/next/assets/verse-model-Dllo8rRt.js.map +0 -1
  166. package/dist/core/web/public/next/assets/workspace-model-JgmWDKt4.js +0 -2
  167. package/dist/core/web/public/next/assets/workspace-model-JgmWDKt4.js.map +0 -1
  168. /package/node_modules/marked/{LICENSE.md → LICENSE} +0 -0
@@ -0,0 +1,80 @@
1
+ import{a as e,n as t,o as n}from"./index-BMRIET7F.js";import{A as r,B as i,H as a,L as o,M as s,R as c,V as l,_ as u,b as d,c as f,d as p,i as m,k as h,o as g,p as _,s as v,v as y,y as b,z as x}from"./global-C4jfYHrj.js";import{t as S}from"./Dialog-Bn0CgEGz.js";import{r as C}from"./RouteErrorBoundary-Dw8ZjmkS.js";import{t as ee}from"./MutationTokenDialog-DbSHPy3w.js";import{i as w,n as T,r as te,t as E}from"./DiffViewer-QKyisN2L.js";import{A as D,B as O,D as k,E as ne,G as A,J as j,K as M,M as N,N as re,O as ie,P as ae,U as P,W as oe,X as se,Y as ce,a as F,c as le,d as ue,f as de,h as fe,i as pe,j as I,k as me,l as L,m as he,n as ge,o as _e,p as ve,q as R,r as ye,s as be,t as xe}from"./VerseConsoleApp-CRfZUV-T.js";import{_ as Se,a as Ce,b as we,c as Te,d as Ee,f as De,g as Oe,h as ke,i as Ae,l as je,m as Me,n as Ne,o as Pe,p as Fe,r as Ie,s as Le,t as Re,v as ze,y as Be}from"./verse-model-CvtK6vP6.js";import{a as Ve,i as He,o as Ue,r as We,s as Ge}from"./workspace-model-cE4LkKpE.js";var z=n(e(),1),Ke={ready:`ready`,tight:`tight`,exhausted:`blocked`,"signed-out":`blocked`,unknown:`unread`};function qe(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return null;let n=t.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`});return new Date().toDateString()===t.toDateString()?`resets ${n}`:`resets ${t.toLocaleDateString([],{month:`short`,day:`numeric`})} at ${n}`}function Je(e,t){let n=`${e}_`,r=t;for(;r.startsWith(n)&&r.length>n.length;)r=r.slice(n.length);return Be(r)}function Ye(e,t){let n=t.resetDescription??(t.resetsAt===null?null:qe(t.resetsAt));return{id:t.id,label:Je(e,t.id),usedPercent:t.limitReached||!t.measured?null:t.usedPercent,limitReached:t.limitReached,resetText:n,resetsAt:t.resetsAt}}function Xe(e){let t=typeof e.usedPercent==`number`&&Number.isFinite(e.usedPercent)?Math.max(0,Math.min(100,e.usedPercent)):null,n=t!==null&&t>=100;return{id:e.id,label:Be(e.id),usedPercent:n?null:t,limitReached:n,resetText:e.resetsAt===null?null:qe(e.resetsAt),resetsAt:e.resetsAt}}function Ze(e){if(e===null)return{phrase:null,title:null};if(e.unlimited)return{phrase:`credits unlimited`,title:null};if(!e.hasCredits)return{phrase:null,title:null};if(e.balance===null)return{phrase:`credits available`,title:null};let t=Number.parseFloat(e.balance);return Number.isFinite(t)?{phrase:`${t.toFixed(2)} credits left`,title:e.balance}:{phrase:`credits available`,title:e.balance}}function Qe(e){let t=ze(e),n=e.health.state===`ready`,r=t===null?n?`ready`:`unread`:`blocked`;return{kind:`local`,plan:null,cls:r,word:Ne[r],summary:t??(n?`runs on this machine`:`readiness not reported`),binding:null,others:[],credits:null,creditsTitle:null,notes:e.health.summary===null?[]:[e.health.summary],evidenceSource:null,observedAt:e.health.observedAt,extended:!1}}function $e(e){let t=ke(e),n=e.health.windows.map(Xe),r=n.find(e=>e.limitReached)??null,i=n.filter(e=>e.usedPercent!==null),a=i.length===0?null:i.reduce((e,t)=>(t.usedPercent??0)>(e.usedPercent??0)?t:e),o=r??a,s=ze(e),c=s===null?t.cls:`blocked`;return{kind:`subscription`,plan:null,cls:c,word:Ne[c],summary:s??t.text,binding:o,others:o===null?n:n.filter(e=>e.id!==o.id),credits:null,creditsTitle:null,notes:[],evidenceSource:null,observedAt:e.health.observedAt,extended:!1}}function et(e){if(e.engine===`local`)return Qe(e);let t=e.capacity;if(t===void 0)return $e(e);let n=t.windows.map(t=>Ye(e.engine,t)),r=t.binding,i=r===null?null:n.find(e=>e.id===r.id)??Ye(e.engine,r),a=i===null?n:n.filter(e=>e.id!==i.id),o=Ze(t.credits),s=ze(e),c=s===null?Ke[t.usability]:`blocked`,l;return l=t.usability===`signed-out`?`signed out — reconnect this account`:s===null?i===null?`no capacity reading`:i.limitReached?t.usability===`tight`&&o.phrase!==null?`${i.label} limit reached · credits still spendable`:`${i.label} limit reached`:i.usedPercent===null?`no capacity reading`:`${Math.round(i.usedPercent)}% of ${i.label} used`:s,{kind:`subscription`,plan:t.planType,cls:c,word:Ne[c],summary:l,binding:i,others:a,credits:o.phrase,creditsTitle:o.title,notes:[...t.notes],evidenceSource:t.evidenceSource,observedAt:t.observedAt??e.health.observedAt,extended:!0}}function tt(e){switch(e){case`collector`:return null;case`shared-evidence`:return`read from another collector’s shared evidence, not probed here`;case`baseline`:return`operator-seeded baseline, not a live reading`;case`none`:return`no evidence source — nothing here was measured`;default:return null}}function nt(e,t){let n=[e.label];return t.plan!==null&&n.push(t.plan),n.push(t.word),n.push(t.summary),t.credits!==null&&n.push(t.credits),t.binding?.resetText!=null&&n.push(t.binding.resetText),n.join(` · `)}function rt(e){return e===`tight`||e===`blocked`}var B={chip:`_chip_rrd6q_8`,chipGlyph:`_chipGlyph_rrd6q_22`,window:`_window_rrd6q_35`,windowLead:`_windowLead_rrd6q_36`,windowLabel:`_windowLabel_rrd6q_43`,pct:`_pct_rrd6q_44`,flag:`_flag_rrd6q_60`,unknownHead:`_unknownHead_rrd6q_69`,unknownValue:`_unknownValue_rrd6q_76`,unknownRule:`_unknownRule_rrd6q_85`,reset:`_reset_rrd6q_93`,note:`_note_rrd6q_104`,noteHead:`_noteHead_rrd6q_110`,plan:`_plan_rrd6q_117`,noteSummary:`_noteSummary_rrd6q_130`,credits:`_credits_rrd6q_137`},V=t(),it={ready:`✓`,tight:`◑`,blocked:`▮`,unread:`?`};function at({view:e,title:t}){return(0,V.jsxs)(`span`,{className:B.chip,"data-capacity":e.cls,title:t??e.summary,children:[(0,V.jsx)(`span`,{className:B.chipGlyph,"aria-hidden":`true`,children:it[e.cls]}),e.word]})}function ot({windowView:e,ariaPrefix:t,prominent:n=!1}){let r=`${t} ${e.label}`;if(e.limitReached)return(0,V.jsxs)(`div`,{className:n?B.windowLead:B.window,children:[(0,V.jsx)(O,{value:100,max:100,tone:`danger`,label:(0,V.jsx)(`span`,{className:B.windowLabel,children:e.label}),valueText:(0,V.jsx)(`span`,{className:B.flag,children:`limit reached`}),"aria-label":`${r}: the provider flagged this window as rate-limited, so no percentage was measured`}),e.resetText===null?null:(0,V.jsx)(`p`,{className:B.reset,children:e.resetText})]});if(e.usedPercent===null)return(0,V.jsxs)(`div`,{className:n?B.windowLead:B.window,children:[(0,V.jsxs)(`div`,{className:B.unknownHead,children:[(0,V.jsx)(`span`,{className:B.windowLabel,children:e.label}),(0,V.jsx)(`span`,{className:B.unknownValue,children:`no reading`})]}),(0,V.jsx)(`hr`,{className:B.unknownRule,"aria-hidden":`true`}),e.resetText===null?null:(0,V.jsx)(`p`,{className:B.reset,children:e.resetText})]});let i=Math.round(e.usedPercent);return(0,V.jsxs)(`div`,{className:n?B.windowLead:B.window,children:[(0,V.jsx)(O,{value:i,max:100,label:(0,V.jsx)(`span`,{className:B.windowLabel,children:e.label}),valueText:(0,V.jsxs)(`span`,{className:B.pct,children:[i,`%`]}),"aria-label":`${r} used`}),e.resetText===null?null:(0,V.jsx)(`p`,{className:B.reset,children:e.resetText})]})}function st({seat:e,className:t}){let n=et(e);return(0,V.jsxs)(`div`,{className:`${B.note} ${t??``}`,"data-capacity":n.cls,children:[(0,V.jsxs)(`div`,{className:B.noteHead,children:[(0,V.jsx)(at,{view:n}),n.plan===null?null:(0,V.jsx)(`span`,{className:B.plan,children:n.plan}),(0,V.jsx)(`span`,{className:B.noteSummary,children:n.summary})]}),n.binding===null?null:(0,V.jsx)(ot,{windowView:n.binding,ariaPrefix:e.label,prominent:!0}),n.credits===null?null:(0,V.jsxs)(`p`,{className:B.credits,title:n.creditsTitle??void 0,children:[n.credits,` — credits are independent of the window`]})]})}var H={composer:`_composer_1q5ss_5`,box:`_box_1q5ss_10`,textarea:`_textarea_1q5ss_21`,boxListening:`_boxListening_1q5ss_28`,row:`_row_1q5ss_47`,spacer:`_spacer_1q5ss_53`,"engine-claude":`_engine-claude_1q5ss_56`,"engine-codex":`_engine-codex_1q5ss_57`,"engine-grok":`_engine-grok_1q5ss_58`,"engine-local":`_engine-local_1q5ss_59`,engineDot:`_engineDot_1q5ss_60`,seatField:`_seatField_1q5ss_69`,seatFieldCompact:`_seatFieldCompact_1q5ss_70`,fieldLabel:`_fieldLabel_1q5ss_71`,seatSelect:`_seatSelect_1q5ss_72`,seatPillWrap:`_seatPillWrap_1q5ss_89`,seatPill:`_seatPill_1q5ss_89`,seatPillText:`_seatPillText_1q5ss_107`,seatMenu:`_seatMenu_1q5ss_109`,seatMenuHeading:`_seatMenuHeading_1q5ss_126`,seatMenuEmpty:`_seatMenuEmpty_1q5ss_134`,seatMenuItem:`_seatMenuItem_1q5ss_135`,seatMenuText:`_seatMenuText_1q5ss_148`,seatMenuPrimary:`_seatMenuPrimary_1q5ss_149`,seatMenuSecondary:`_seatMenuSecondary_1q5ss_150`,seatMenuCapacity:`_seatMenuCapacity_1q5ss_156`,dictationWrap:`_dictationWrap_1q5ss_167`,dictation:`_dictation_1q5ss_167`,dictationLive:`_dictationLive_1q5ss_182`,dictationPulse:`_dictationPulse_1q5ss_183`,"verse-ring":`_verse-ring_1q5ss_1`,dictationHint:`_dictationHint_1q5ss_191`,dictationError:`_dictationError_1q5ss_212`,send:`_send_1q5ss_215`,stop:`_stop_1q5ss_216`,stopIcon:`_stopIcon_1q5ss_235`,help:`_help_1q5ss_238`,helpQuiet:`_helpQuiet_1q5ss_246`,helpError:`_helpError_1q5ss_255`,cost:`_cost_1q5ss_283`,costFigure:`_costFigure_1q5ss_295`};function ct(e){return JSON.stringify([e.seatId,e.model])}function lt(e){try{let t=JSON.parse(e);if(!Array.isArray(t)||t.length!==2)return null;let[n,r]=t;return typeof n!=`string`||typeof r!=`string`?null:{seatId:n,model:r}}catch{return null}}function ut(e){for(let t of Te(e))for(let e of t.seats)if(e.health.state!==`unavailable`&&e.models.length!==0)return{seatId:e.id,model:e.models[0].id};return null}function dt({seats:e,value:t,onChange:n,disabled:r=!1,label:i=`Seat and model`,id:a,compact:o=!1}){let s=(0,z.useId)(),c=a??s,l=Te(e),u=t?ct(t):``,d=t&&e.some(e=>e.id===t.seatId&&e.models.some(e=>e.id===t.model));return(0,V.jsxs)(`label`,{className:`${H.seatField} ${o?H.seatFieldCompact:``}`,htmlFor:c,children:[(0,V.jsx)(`span`,{className:o?`visually-hidden`:H.fieldLabel,children:i}),(0,V.jsxs)(`select`,{id:c,className:H.seatSelect,value:d?u:``,disabled:r||l.length===0,"aria-label":o?i:void 0,onChange:e=>{let t=lt(e.target.value);t&&n(t)},children:[d?null:(0,V.jsx)(`option`,{value:``,disabled:!0,children:l.length===0?`No seats discovered`:`Choose a seat…`}),l.map(e=>(0,V.jsx)(`optgroup`,{label:Re[e.engine],children:e.seats.flatMap(e=>{let t=ze(e),n=et(e),r=t===null?n.cls===`unread`||n.kind===`local`?null:`${n.plan===null?``:`${n.plan} · `}${n.word} · ${n.summary}`:`unavailable: ${t}`,i=r===null?void 0:r.charAt(0).toUpperCase()+r.slice(1);return e.models.map(n=>(0,V.jsxs)(`option`,{value:ct({seatId:e.id,model:n.id}),disabled:t!==null,title:i,children:[e.label,` — `,n.label,r?` (${r})`:``]},ct({seatId:e.id,model:n.id})))})},e.engine))]})]})}var U={width:`_width_1185y_1`,form:`_form_1185y_3`,field:`_field_1185y_4`,label:`_label_1185y_5`,optional:`_optional_1185y_13`,select:`_select_1185y_15`,input:`_input_1185y_16`,hint:`_hint_1185y_40`,error:`_error_1185y_41`,actions:`_actions_1185y_49`,cancel:`_cancel_1185y_50`,create:`_create_1185y_51`,capacity:`_capacity_1185y_72`,rootRow:`_rootRow_1185y_78`,removeRoot:`_removeRoot_1185y_87`,addRoot:`_addRoot_1185y_88`},ft=`\0workspace:`,pt=`\0other`;function mt({open:e,onClose:t,projects:n,seats:r,workspaces:i=[],initialProjectPath:a,initialSeat:o,busy:s=!1,error:c,onCreate:l}){let u=(0,z.useId)(),d=(0,z.useId)(),f=(0,z.useId)(),p=(0,z.useId)(),m=(0,z.useId)(),h=(0,z.useRef)(null),[g,_]=(0,z.useState)(``),[v,y]=(0,z.useState)(``),[x,C]=(0,z.useState)(null),[ee,w]=(0,z.useState)(``),[T,te]=(0,z.useState)(null),[E,D]=(0,z.useState)([]),O=(0,z.useMemo)(()=>[...n].sort((e,t)=>Number(t.enrolled)-Number(e.enrolled)||e.name.localeCompare(t.name)),[n]),k=(0,z.useRef)({initialProjectPath:a,initialSeat:o,projects:n,seats:r,sortedProjects:O});k.current={initialProjectPath:a,initialSeat:o,projects:n,seats:r,sortedProjects:O},(0,z.useEffect)(()=>{if(!e)return;let{initialProjectPath:t,initialSeat:n,projects:r,seats:i,sortedProjects:a}=k.current,o=t&&r.some(e=>e.path===t)?t:null;_(o??(t?pt:a[0]?.path??pt)),y(o?``:t??``),C(n??ut(i)),w(``),te(null),D([])},[e]),(0,z.useEffect)(()=>{e&&x===null&&r.length!==0&&C(o??ut(r))},[e,x,r,o]);let ne=b(ue);(0,z.useEffect)(()=>{e&&ne()},[e,ne]);let A=g.startsWith(ft),j=A?g.slice(11):null,M=A?``:g===pt?v.trim():g,N=x===null?null:r.find(e=>e.id===x.seatId)??null,re=N?.health.state===`unavailable`,ie=!s&&(A||M.length>0)&&x!==null&&!re,ae=N===null||N.engine!==`grok`;function P(e){if(e.preventDefault(),!x){te(`Pick a seat first.`);return}if(j!==null){te(null);let e={workspaceId:j,seatId:x.seatId,model:x.model};delete e.projectPath;let t=ee.trim();t&&(e.title=t),l(e);return}let t=Ue(M,E);if(!t.ok){te(t.error);return}te(null);let[n,...r]=t.roots,i={projectPath:n,seatId:x.seatId,model:x.model};r.length>0&&(i.extraRoots=r);let a=ee.trim();a&&(i.title=a),l(i)}let oe=T??c??null;return(0,V.jsx)(S,{open:e,onClose:t,titleId:u,title:`New chat`,initialFocusRef:h,widthClassName:U.width,children:(0,V.jsxs)(`form`,{className:U.form,onSubmit:P,noValidate:!0,children:[(0,V.jsxs)(`label`,{className:U.field,htmlFor:d,children:[(0,V.jsx)(`span`,{className:U.label,children:`Project`}),(0,V.jsxs)(`select`,{id:d,ref:h,value:g,onChange:e=>_(e.target.value),className:U.select,children:[i.length>0?(0,V.jsx)(`optgroup`,{label:`Workspaces`,children:i.map(e=>(0,V.jsxs)(`option`,{value:`${ft}${e.id}`,children:[e.name,` — `,Ge(e)]},e.id))}):null,O.map(e=>(0,V.jsxs)(`option`,{value:e.path,children:[e.name,e.enrolled?``:` (recent)`,` — `,e.path]},e.path)),(0,V.jsx)(`option`,{value:pt,children:`Other folder…`})]})]}),g===pt&&!A?(0,V.jsxs)(`label`,{className:U.field,htmlFor:f,children:[(0,V.jsx)(`span`,{className:U.label,children:`Folder path`}),(0,V.jsx)(`input`,{id:f,className:U.input,value:v,onChange:e=>y(e.target.value),placeholder:`/absolute/path/to/project`,autoComplete:`off`,spellCheck:!1})]}):null,A?null:(0,V.jsxs)(`div`,{className:U.field,children:[(0,V.jsxs)(`span`,{className:U.label,children:[`Also include `,(0,V.jsx)(`span`,{className:U.optional,children:`optional`})]}),E.map((e,t)=>(0,V.jsxs)(`div`,{className:U.rootRow,children:[(0,V.jsx)(`input`,{className:U.input,value:e,onChange:e=>D(E.map((n,r)=>r===t?e.target.value:n)),placeholder:`/absolute/path/to/another/folder`,"aria-label":`Additional folder ${t+1}`,autoComplete:`off`,spellCheck:!1}),(0,V.jsx)(`button`,{type:`button`,className:U.removeRoot,onClick:()=>D(E.filter((e,n)=>n!==t)),"aria-label":`Remove additional folder ${t+1}`,children:`Remove`})]},t)),E.length+1<8?(0,V.jsx)(`button`,{type:`button`,className:U.addRoot,onClick:()=>D([...E,``]),children:`Add a folder`}):null,E.length>0?(0,V.jsx)(`p`,{className:U.hint,children:ae?`The agent can read and write these folders for the life of this chat. Enrolment is separate — an unenrolled folder stays out of reach of the autonomous lane.`:`This seat’s CLI takes no additional-directory flag, so it will reach only the primary folder. Pick a Claude or Codex seat to use more than one.`}):null]}),(0,V.jsx)(dt,{id:m,seats:r,value:x,onChange:C}),N===null?null:(0,V.jsx)(st,{seat:N,className:U.capacity}),r.length===0?(0,V.jsx)(`p`,{className:U.hint,children:`No seats yet — connect an account or start Ollama, then reload.`}):null,(0,V.jsxs)(`label`,{className:U.field,htmlFor:p,children:[(0,V.jsxs)(`span`,{className:U.label,children:[`Title `,(0,V.jsx)(`span`,{className:U.optional,children:`optional`})]}),(0,V.jsx)(`input`,{id:p,className:U.input,value:ee,onChange:e=>w(e.target.value),placeholder:`Defaults to your first message`,maxLength:120})]}),oe?(0,V.jsx)(`p`,{role:`alert`,className:U.error,children:oe}):null,(0,V.jsxs)(`div`,{className:U.actions,children:[(0,V.jsx)(`button`,{type:`button`,className:U.cancel,onClick:t,children:`Cancel`}),(0,V.jsx)(`button`,{type:`submit`,className:U.create,disabled:!ie,children:s?`Creating…`:`Start chat`})]})]})})}var ht={width:`_width_k2wwr_1`,input:`_input_k2wwr_3`,list:`_list_k2wwr_19`,row:`_row_k2wwr_27`,rowActive:`_rowActive_k2wwr_41`,marker:`_marker_k2wwr_44`,"engine-claude":`_engine-claude_k2wwr_45`,"engine-codex":`_engine-codex_k2wwr_46`,"engine-grok":`_engine-grok_k2wwr_47`,"engine-local":`_engine-local_k2wwr_48`,rowText:`_rowText_k2wwr_50`,rowPrimary:`_rowPrimary_k2wwr_51`,rowSecondary:`_rowSecondary_k2wwr_58`,rowTrailing:`_rowTrailing_k2wwr_67`,emptyRow:`_emptyRow_k2wwr_76`};function gt({open:e,onClose:t,sessions:n,seats:r,projects:i,onSelectSession:a,onNewChat:o}){let s=(0,z.useId)(),c=(0,z.useId)(),l=(0,z.useRef)(null),[u,d]=(0,z.useState)(``),[f,p]=(0,z.useState)(0);(0,z.useEffect)(()=>{e&&(d(``),p(0))},[e]);let m=(0,z.useMemo)(()=>{let e=u.trim().toLowerCase(),s=[...n].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)).map(e=>({id:`session:${e.id}`,kind:`session`,engine:e.engine,primary:e.title||`Untitled chat`,secondary:`${Fe(e.projectPath,i)} · ${Oe(r,e)} · ${e.model}`,trailing:Le(e.updatedAt),run:()=>{a(e.id),t()}})),c=r.filter(e=>e.health.state!==`unavailable`&&e.models.length>0).map(e=>({id:`seat:${e.id}`,kind:`seat`,engine:e.engine,primary:`New chat on ${e.label}`,secondary:e.models[0].label,trailing:`⌘N`,run:()=>{o({seatId:e.id,model:e.models[0].id}),t()}})),l=[...s,...c];return e?l.filter(t=>t.primary.toLowerCase().includes(e)||t.secondary.toLowerCase().includes(e)):l},[u,n,r,i,a,o,t]);(0,z.useEffect)(()=>{f>=m.length&&p(0)},[m.length,f]);function h(e){e.key===`ArrowDown`?(e.preventDefault(),p(e=>m.length?(e+1)%m.length:0)):e.key===`ArrowUp`?(e.preventDefault(),p(e=>m.length?(e-1+m.length)%m.length:0)):e.key===`Enter`&&(e.preventDefault(),m[f]?.run())}return(0,V.jsxs)(S,{open:e,onClose:t,titleId:s,title:`Switch chat`,initialFocusRef:l,widthClassName:ht.width,children:[(0,V.jsx)(`input`,{ref:l,className:ht.input,value:u,placeholder:`Search chats or start one on a seat…`,role:`combobox`,"aria-expanded":`true`,"aria-controls":c,"aria-activedescendant":m[f]?`${c}-${f}`:void 0,"aria-autocomplete":`list`,autoComplete:`off`,onChange:e=>{d(e.target.value),p(0)},onKeyDown:h}),(0,V.jsx)(`ul`,{id:c,role:`listbox`,className:ht.list,"aria-label":`Chats and seats`,children:m.length===0?(0,V.jsx)(`li`,{className:ht.emptyRow,children:`Nothing matches.`}):m.map((e,t)=>(0,V.jsxs)(`li`,{id:`${c}-${t}`,role:`option`,"aria-selected":t===f,className:`${ht.row} ${ht[`engine-${e.engine}`]??``} ${t===f?ht.rowActive:``}`,"data-kind":e.kind,onMouseEnter:()=>p(t),onMouseDown:e=>e.preventDefault(),onClick:e.run,children:[(0,V.jsx)(`span`,{className:ht.marker,"aria-hidden":`true`}),(0,V.jsxs)(`span`,{className:ht.rowText,children:[(0,V.jsx)(`span`,{className:ht.rowPrimary,children:e.primary}),(0,V.jsx)(`span`,{className:ht.rowSecondary,children:e.secondary})]}),(0,V.jsx)(`span`,{className:ht.rowTrailing,"aria-hidden":`true`,children:e.trailing})]},e.id))})]})}var _t={roots:`_roots_1h85g_8`,title:`_title_1h85g_10`,count:`_count_1h85g_22`,workspace:`_workspace_1h85g_30`,list:`_list_1h85g_36`,root:`_root_1h85g_8`,rootHead:`_rootHead_1h85g_57`,name:`_name_1h85g_64`,badge:`_badge_1h85g_72`,git:`_git_1h85g_80`,remote:`_remote_1h85g_81`,caveat:`_caveat_1h85g_82`,note:`_note_1h85g_99`,error:`_error_1h85g_100`};function vt({session:e,refreshKey:t=0}){let[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(null),o=e?.id??null;return(0,z.useEffect)(()=>{if(!o){r(null);return}let e=new AbortController;return a(null),_e(o,e.signal).then(e=>r(e)).catch(t=>{e.signal.aborted||(r(null),a(t instanceof Error?t.message:`could not read this chat’s folders`))}),()=>e.abort()},[o,t]),!e||n!==null&&n.roots.length<=1&&n.workspaceId===null?null:(0,V.jsxs)(`section`,{className:_t.roots,"aria-labelledby":`verse-res-roots`,children:[(0,V.jsxs)(`h3`,{id:`verse-res-roots`,className:_t.title,children:[`Folders`,n?(0,V.jsx)(`span`,{className:_t.count,children:n.roots.length}):null]}),n?.workspaceName?(0,V.jsxs)(`p`,{className:_t.workspace,children:[`Workspace `,(0,V.jsx)(`strong`,{children:n.workspaceName})]}):null,i?(0,V.jsx)(`p`,{role:`alert`,className:_t.error,children:i}):null,(0,V.jsx)(`ul`,{className:_t.list,children:(n?.roots??[]).map(e=>{let t=He(e),n=We(e);return(0,V.jsxs)(`li`,{className:_t.root,"data-tone":Ve(e),children:[(0,V.jsxs)(`div`,{className:_t.rootHead,children:[(0,V.jsx)(`span`,{className:_t.name,title:e.path,children:e.name}),(0,V.jsx)(`span`,{className:_t.badge,children:e.primary?`primary`:`added`})]}),(0,V.jsx)(`p`,{className:_t.git,children:t??`not a git repo`}),e.git?.remote?(0,V.jsx)(`p`,{className:_t.remote,children:e.git.remote}):null,n?(0,V.jsx)(`p`,{className:_t.caveat,children:n}):null]},e.path)})}),(n?.notes??[]).map(e=>(0,V.jsx)(`p`,{className:_t.note,children:e},e))]})}var yt=`ashlr.verse.resources.v1`,bt=80,xt=200;function St(){return{collapsedGroups:[],seats:{}}}function Ct(e){return e!==`blocked`}function wt(e,t){return!e.collapsedGroups.includes(t)}function Tt(e,t,n){let r=e.seats[t];return typeof r==`boolean`?r:Ct(n)}function Et(e,t){let n=e.collapsedGroups.includes(t)?e.collapsedGroups.filter(e=>e!==t):[...e.collapsedGroups,t];return{...e,collapsedGroups:n}}function Dt(e,t,n){if(!kt(t))return e;let r={...e.seats,[t]:!Tt(e,t,n)};return{...e,seats:At(r)}}function Ot(e){return e.kind===`local`?[]:e.binding===null?[...e.others]:[e.binding,...e.others.filter(t=>t.id!==e.binding.id)]}function kt(e){return e.length>0&&e.length<=xt&&e!==`__proto__`&&e!==`constructor`&&e!==`prototype`}function At(e){let t=Object.entries(e);return t.length<=bt?{...e}:Object.fromEntries(t.slice(t.length-bt))}function jt(e){if(e===null||e===``)return St();let t;try{t=JSON.parse(e)}catch{return St()}if(!t||typeof t!=`object`||Array.isArray(t))return St();let n=t,r=[];if(Array.isArray(n.collapsedGroups))for(let e of n.collapsedGroups)typeof e==`string`&&Ee(e)&&!r.includes(e)&&r.push(e);let i={},a=n.seats;if(a&&typeof a==`object`&&!Array.isArray(a)){for(let[e,t]of Object.entries(a))if(kt(e)&&typeof t==`boolean`){if(Object.keys(i).length>=bt)break;Object.defineProperty(i,e,{value:t,enumerable:!0,writable:!0,configurable:!0})}}return{collapsedGroups:r,seats:i}}function Mt(){try{return jt(localStorage.getItem(yt))}catch{return St()}}function Nt(e){try{localStorage.setItem(yt,JSON.stringify({collapsedGroups:e.collapsedGroups,seats:e.seats}))}catch{}}var Pt={session:null,events:[],lastSeq:0,loaded:!1,loadError:null,stream:`idle`},Ft=new Map,It=new Set;function Lt(){for(let e of It)e()}function Rt(e){return It.add(e),()=>It.delete(e)}function zt(e){let t=Ft.get(e);return t||(t={sessionId:e,...Pt},Ft.set(e,t)),t}function Bt(e,t){let n=zt(e);Ft.set(e,{...n,...t}),Lt()}var Vt={sessionId:``,...Pt};function Ht(e){return e?zt(e):Vt}function Ut(e,t,n){let r=Zt(zt(e).events,n);Bt(e,{session:qt(t,r),events:r,lastSeq:r.length?r[r.length-1].seq:0,loaded:!0,loadError:null})}function Wt(e,t){Bt(e,{loadError:t,loaded:!0})}function Gt(e,t){zt(e).stream!==t&&Bt(e,{stream:t})}function Kt(e,t,n){Bt(e,{session:qt(t,zt(e).events,n)})}function qt(e,t,n){if(e.status!==`running`)return e;let r=-1,i=n??null;if(!n){for(let e of t)(e.type===`user-message`||e.type===`turn-started`)&&(r=e.seq,i=e.turnId);if(i===null)return e}let a=null,o=null;for(let e of t)e.seq<=r||(e.type===`error`&&e.turnId===i&&(o=e.message),(e.type===`turn-done`||e.type===`cancelled`)&&e.turnId===i&&(a=e));if(!a)return e;let s=a.type===`turn-done`&&!a.ok&&o!==null;return{...e,status:s?`error`:`idle`,lastError:s?o:null,updatedAt:a.at>e.updatedAt?a.at:e.updatedAt}}function Jt(e,t){let n=zt(e);n.session&&n.session.status!==t&&Bt(e,{session:{...n.session,status:t}})}function Yt(e,t){let n=zt(e);if(!Number.isFinite(t.seq)||n.events.some(e=>e.seq===t.seq))return!1;let r=Zt(n.events,[t]),i=n.session;if(i)switch(t.type){case`turn-started`:i={...i,status:`running`,lastError:null,updatedAt:t.at};break;case`usage`:i={...i,usage:{inputTokens:i.usage.inputTokens+t.usage.inputTokens,outputTokens:i.usage.outputTokens+t.usage.outputTokens,cacheReadTokens:i.usage.cacheReadTokens+t.usage.cacheReadTokens,cacheCreationTokens:i.usage.cacheCreationTokens+t.usage.cacheCreationTokens,contextTokens:t.usage.contextTokens,contextWindow:t.usage.contextWindow??i.usage.contextWindow},updatedAt:t.at};break;case`turn-done`:i={...i,status:t.ok?`idle`:i.lastError?`error`:`idle`,turnCount:i.turnCount+1,nativeSessionId:t.nativeSessionId??i.nativeSessionId,updatedAt:t.at};break;case`error`:i={...i,status:`error`,lastError:t.message,updatedAt:t.at};break;case`cancelled`:i={...i,status:`idle`,updatedAt:t.at}}return Bt(e,{events:r,lastSeq:Math.max(n.lastSeq,t.seq),session:i}),!0}function Xt(e){Ft.delete(e)&&Lt()}function Zt(e,t){if(t.length===0)return e;let n=new Map;for(let t of e)n.set(t.seq,t);for(let e of t)n.has(e.seq)||n.set(e.seq,e);return[...n.values()].sort((e,t)=>e.seq-t.seq)}function Qt(e,t){let n=Date.parse(e),r=Date.parse(t);return Number.isFinite(n)&&Number.isFinite(r)?Math.max(0,r-n):null}function $t(e){let t=[],n=new Map,r=null,i=!1,a=null,o=e=>{r&&=(t.push({kind:`assistant`,key:r.key,turnId:r.turnId,at:r.at,text:r.text,streaming:e}),null)};for(let s of e)switch(s.type){case`user-message`:o(!1),t.push({kind:`user`,key:`u-${s.seq}`,turnId:s.turnId,at:s.at,text:s.text});break;case`turn-started`:i=!0;break;case`text-delta`:r&&r.turnId!==s.turnId&&o(!1),r||={turnId:s.turnId,at:s.at,text:``,key:`d-${s.seq}`},r.text+=s.text;break;case`assistant-message`:r=null,t.push({kind:`assistant`,key:`a-${s.seq}`,turnId:s.turnId,at:s.at,text:s.text,streaming:!1});break;case`thinking`:o(!1),t.push({kind:`thinking`,key:`t-${s.seq}`,turnId:s.turnId,at:s.at,text:s.text});break;case`tool-use`:o(!1),n.set(s.toolUseId,t.length),t.push({kind:`tool`,key:`tu-${s.seq}`,turnId:s.turnId,at:s.at,toolUseId:s.toolUseId,name:s.name,input:s.input,result:null,durationMs:null});break;case`tool-result`:{let e=n.get(s.toolUseId),r=e===void 0?void 0:t[e];r&&r.kind===`tool`?t[e]={...r,result:{output:s.output,isError:s.isError},durationMs:Qt(r.at,s.at)}:t.push({kind:`tool`,key:`tr-${s.seq}`,turnId:s.turnId,at:s.at,toolUseId:s.toolUseId,name:`tool`,input:null,result:{output:s.output,isError:s.isError},durationMs:null});break}case`usage`:a=s.usage;break;case`error`:o(!1),t.push({kind:`error`,key:`e-${s.seq}`,turnId:s.turnId,at:s.at,message:s.message});break;case`cancelled`:o(!1),i=!1,t.push({kind:`cancelled`,key:`c-${s.seq}`,turnId:s.turnId,at:s.at});break;case`turn-done`:o(!1),i=!1,t.push({kind:`turn-done`,key:`td-${s.seq}`,turnId:s.turnId,at:s.at,ok:s.ok,durationMs:s.durationMs})}return o(i),{items:t,live:i,usage:a}}function en(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push(n[0]):t.push(tn(n)),n=[])};for(let i of e){if((i.kind===`tool`||i.kind===`thinking`)&&(n.length===0||n[0].turnId===i.turnId)){n.push(i);continue}r(),i.kind===`tool`||i.kind===`thinking`?n.push(i):t.push(i)}return r(),t}function tn(e){let t=new Map,n=0,r=!1;for(let i of e)i.kind===`tool`&&(t.set(i.name,(t.get(i.name)??0)+1),i.result===null?r=!0:i.result.isError&&(n+=1));let i=[...t.values()].reduce((e,t)=>e+t,0),a=[...t.entries()].map(([e,t])=>t>1?`${e} ×${t}`:e).join(`, `),o=Qt(e[0].at,e[e.length-1].at);return{kind:`toolGroup`,key:`g-${e[0].key}`,turnId:e[0].turnId,at:e[0].at,items:e,toolCount:i,summary:a,errorCount:n,pending:r,spanMs:o}}function nn(e){return e==null||!Number.isFinite(e)?`—`:e<1e3?String(Math.round(e)):e<1e6?`${Math.round(e/1e3)}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,``)}M`}var W={panel:`_panel_b2xdj_3`,head:`_head_b2xdj_10`,title:`_title_b2xdj_22`,close:`_close_b2xdj_30`,scroll:`_scroll_b2xdj_45`,section:`_section_b2xdj_46`,sectionTitle:`_sectionTitle_b2xdj_48`,asOf:`_asOf_b2xdj_64`,refresh:`_refresh_b2xdj_73`,count:`_count_b2xdj_89`,skeleton:`_skeleton_b2xdj_90`,muted:`_muted_b2xdj_91`,engineGroup:`_engineGroup_b2xdj_95`,engineTitle:`_engineTitle_b2xdj_96`,groupToggle:`_groupToggle_b2xdj_105`,seatToggle:`_seatToggle_b2xdj_106`,twist:`_twist_b2xdj_126`,seatList:`_seatList_b2xdj_137`,models:`_models_b2xdj_137`,runningList:`_runningList_b2xdj_137`,seat:`_seat_b2xdj_106`,"engine-claude":`_engine-claude_b2xdj_143`,"engine-codex":`_engine-codex_b2xdj_144`,"engine-grok":`_engine-grok_b2xdj_145`,"engine-local":`_engine-local_b2xdj_146`,seatHead:`_seatHead_b2xdj_148`,seatLabel:`_seatLabel_b2xdj_149`,seatMeta:`_seatMeta_b2xdj_158`,seatSummary:`_seatSummary_b2xdj_166`,plan:`_plan_b2xdj_169`,num:`_num_b2xdj_170`,notes:`_notes_b2xdj_174`,seatWindows:`_seatWindows_b2xdj_191`,credits:`_credits_b2xdj_192`,local:`_local_b2xdj_195`,mono:`_mono_b2xdj_196`,runningRow:`_runningRow_b2xdj_209`,runningOpen:`_runningOpen_b2xdj_210`,runningMeta:`_runningMeta_b2xdj_230`,runningDot:`_runningDot_b2xdj_232`,"verse-pulse-res":`_verse-pulse-res_b2xdj_1`,runningTitle:`_runningTitle_b2xdj_239`,stop:`_stop_b2xdj_255`,usage:`_usage_b2xdj_270`};function rn(e){let[t,n]=(0,z.useState)(()=>Date.now());return(0,z.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}function an(e){let t=null;for(let n of e){let e=et(n).observedAt;e!==null&&(t===null||e>t)&&(t=e)}return t}function on(){let[e,t]=(0,z.useState)(Mt),n=e=>{t(t=>{let n=e(t);return Nt(n),n})};return{state:e,toggleGroup:e=>n(t=>Et(t,e)),toggleSeat:(e,t)=>n(n=>Dt(n,e.id,t.cls))}}function sn({seat:e,view:t}){let n=Ot(t),r=nt(e,t),i=e.contextWindow===null?`ctx n/a`:`${nn(e.contextWindow)} ctx`,a=`${e.models.length} model${e.models.length===1?``:`s`}`,o=tt(t.evidenceSource),s=o===null?t.notes:[...t.notes,o];return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:W.seatMeta,children:[(0,V.jsx)(`span`,{children:Re[e.engine]}),t.plan===null?null:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,V.jsx)(`span`,{className:W.plan,children:t.plan})]}),(0,V.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,V.jsx)(`span`,{children:a}),(0,V.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,V.jsx)(`span`,{className:W.num,children:i})]}),t.kind===`local`||n.length===0?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:W.seatSummary,children:t.summary}),t.kind===`local`||e.health.summary===null||e.health.summary===t.summary?null:(0,V.jsx)(`p`,{className:W.seatSummary,children:e.health.summary})]}):(0,V.jsx)(`div`,{className:W.seatWindows,children:n.map(n=>(0,V.jsx)(ot,{windowView:n,ariaPrefix:e.label,prominent:t.binding?.id===n.id},n.id))}),t.credits===null?null:(0,V.jsx)(`p`,{className:W.credits,title:t.creditsTitle??r,children:t.credits}),s.length===0?null:(0,V.jsx)(`ul`,{className:W.notes,children:s.map(e=>(0,V.jsx)(`li`,{children:e},e))})]})}function cn({seat:e,open:t,onToggle:n}){let r=et(e),i=nt(e,r),a=`verse-seat-${e.id.replace(/[^A-Za-z0-9_-]/g,`-`)}`;return(0,V.jsxs)(`li`,{className:`${W.seat} ${W[`engine-${e.engine}`]??``}`,"data-engine":e.engine,"data-capacity":r.cls,"data-open":t?`true`:`false`,children:[(0,V.jsxs)(`button`,{type:`button`,className:W.seatToggle,"aria-expanded":t,"aria-controls":a,"aria-label":e.label,onClick:n,children:[(0,V.jsx)(`span`,{className:W.twist,"data-open":t?``:void 0,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:W.seatLabel,title:i,children:e.label}),r.kind===`local`?(0,V.jsx)(_,{status:e.health.state,tone:e.health.state===`ready`?`success`:e.health.state===`unavailable`?`danger`:`unknown`}):(0,V.jsx)(at,{view:r,title:i})]}),t?(0,V.jsx)(`div`,{id:a,children:(0,V.jsx)(sn,{seat:e,view:r})}):(0,V.jsx)(`p`,{id:a,className:W.seatSummary,children:r.summary})]})}function ln({bootstrap:e,sessions:t,current:n,onStop:r,onOpen:i,onClose:a}){let o=t.filter(e=>e.status===`running`),s=rn(o.length>0),c=e?Te(e.seats):[],l=e?.localRuntime.ollama,u=y(ue),f=d(ue),p=e?an(e.seats):null,h=p===null?null:Ae(p),v=on();return(0,V.jsxs)(`aside`,{className:W.panel,"aria-label":`Resources`,children:[(0,V.jsxs)(`header`,{className:W.head,children:[(0,V.jsx)(`h2`,{className:W.title,children:`Resources`}),(0,V.jsx)(`button`,{type:`button`,className:W.close,onClick:a,"aria-label":`Hide resources`,children:`×`})]}),(0,V.jsxs)(`div`,{className:W.scroll,children:[(0,V.jsxs)(`section`,{className:W.section,"aria-labelledby":`verse-res-seats`,children:[(0,V.jsxs)(`h3`,{id:`verse-res-seats`,className:W.sectionTitle,children:[(0,V.jsx)(`span`,{children:`Seats`}),(0,V.jsx)(`span`,{className:W.asOf,children:h===null?`no reading yet`:`as of ${h}`}),u.status===`refreshing`?(0,V.jsx)(g,{label:`Refreshing seats`}):null,(0,V.jsx)(`button`,{type:`button`,className:W.refresh,onClick:f,children:`Refresh`})]}),e?c.length===0?(0,V.jsxs)(`p`,{className:W.muted,children:[`No seats discovered. Connect an account with `,(0,V.jsx)(`code`,{children:`ashlr accounts`}),` or start Ollama.`]}):c.map(e=>{let t=wt(v.state,e.engine),n=`verse-res-group-${e.engine}`;return(0,V.jsxs)(`div`,{className:W.engineGroup,children:[(0,V.jsx)(`h4`,{className:W.engineTitle,children:(0,V.jsxs)(`button`,{type:`button`,className:W.groupToggle,"aria-expanded":t,"aria-controls":n,"aria-label":`${Re[e.engine]} seats`,onClick:()=>v.toggleGroup(e.engine),children:[(0,V.jsx)(`span`,{className:W.twist,"data-open":t?``:void 0,"aria-hidden":`true`}),(0,V.jsx)(`span`,{children:Re[e.engine]}),(0,V.jsx)(`span`,{className:W.count,children:e.seats.length})]})}),t?(0,V.jsx)(`ul`,{id:n,className:W.seatList,children:e.seats.map(e=>{let t=et(e);return(0,V.jsx)(cn,{seat:e,open:Tt(v.state,e.id,t.cls),onToggle:()=>v.toggleSeat(e,t)},e.id)})}):(0,V.jsx)(`ul`,{id:n,className:W.seatList,hidden:!0})]},e.engine)}):(0,V.jsxs)(`div`,{className:W.skeleton,children:[(0,V.jsx)(m,{width:`70%`}),(0,V.jsx)(m,{width:`50%`}),(0,V.jsx)(m,{width:`64%`})]})]}),(0,V.jsxs)(`section`,{className:W.section,"aria-labelledby":`verse-res-local`,children:[(0,V.jsx)(`h3`,{id:`verse-res-local`,className:W.sectionTitle,children:`Local runtime`}),l?(0,V.jsxs)(`div`,{className:W.local,children:[(0,V.jsxs)(`div`,{className:W.seatHead,children:[(0,V.jsx)(`span`,{className:W.seatLabel,children:`Ollama`}),(0,V.jsx)(_,{status:l.reachable?`ready`:`unavailable`,tone:l.reachable?`success`:`danger`,children:l.reachable?`reachable`:`unreachable`})]}),(0,V.jsx)(`p`,{className:W.mono,title:l.baseUrl,children:l.baseUrl}),l.reachable?l.models.length>0?(0,V.jsx)(`ul`,{className:W.models,children:l.models.map(e=>(0,V.jsx)(`li`,{children:(0,V.jsx)(`code`,{children:e})},e))}):(0,V.jsx)(`p`,{className:W.muted,children:`No models pulled yet.`}):(0,V.jsx)(`p`,{className:W.muted,children:`Start Ollama to enable local seats.`})]}):(0,V.jsx)(m,{width:`60%`})]}),(0,V.jsxs)(`section`,{className:W.section,"aria-labelledby":`verse-res-running`,children:[(0,V.jsxs)(`h3`,{id:`verse-res-running`,className:W.sectionTitle,children:[`Running `,(0,V.jsx)(`span`,{className:W.count,children:o.length})]}),o.length===0?(0,V.jsx)(`p`,{className:W.muted,children:`Nothing running.`}):(0,V.jsx)(`ul`,{className:W.runningList,children:o.map(t=>(0,V.jsxs)(`li`,{className:W.runningRow,children:[(0,V.jsxs)(`button`,{type:`button`,className:W.runningOpen,onClick:()=>i(t.id),title:t.title,children:[(0,V.jsx)(`span`,{className:W.runningDot,role:`img`,"aria-label":`Running`}),(0,V.jsx)(`span`,{className:W.runningTitle,children:t.title||`Untitled chat`}),(0,V.jsxs)(`span`,{className:W.runningMeta,children:[Fe(t.projectPath,e?.projects??[]),` · `,Pe(s-new Date(t.updatedAt).getTime())]})]}),(0,V.jsx)(`button`,{type:`button`,className:W.stop,onClick:()=>r(t.id),"aria-label":`Stop ${t.title||`chat`}`,children:`Stop`})]},t.id))})]}),(0,V.jsx)(vt,{session:n,refreshKey:n?.turnCount??0}),(0,V.jsxs)(`section`,{className:W.section,"aria-labelledby":`verse-res-usage`,children:[(0,V.jsx)(`h3`,{id:`verse-res-usage`,className:W.sectionTitle,children:`This chat`}),n?(0,V.jsxs)(`dl`,{className:W.usage,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Input`}),(0,V.jsx)(`dd`,{children:nn(n.usage.inputTokens)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Output`}),(0,V.jsx)(`dd`,{children:nn(n.usage.outputTokens)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Cache read`}),(0,V.jsx)(`dd`,{children:nn(n.usage.cacheReadTokens)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Cache write`}),(0,V.jsx)(`dd`,{children:nn(n.usage.cacheCreationTokens)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Turns`}),(0,V.jsx)(`dd`,{children:n.turnCount})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Context`}),(0,V.jsxs)(`dd`,{children:[nn(n.usage.contextTokens),n.usage.contextWindow?` / ${nn(n.usage.contextWindow)}`:``]})]})]}):(0,V.jsx)(`p`,{className:W.muted,children:`Select a chat to see its usage.`})]})]})]})}var G={sidebar:`_sidebar_bu0vt_1`,head:`_head_bu0vt_9`,headDragStrip:`_headDragStrip_bu0vt_40`,search:`_search_bu0vt_51`,searchIcon:`_searchIcon_bu0vt_58`,iconButton:`_iconButton_bu0vt_80`,scroll:`_scroll_bu0vt_98`,skeleton:`_skeleton_bu0vt_105`,error:`_error_bu0vt_106`,empty:`_empty_bu0vt_125`,emptyTitle:`_emptyTitle_bu0vt_131`,group:`_group_bu0vt_133`,groupTitle:`_groupTitle_bu0vt_134`,groupName:`_groupName_bu0vt_147`,enrolled:`_enrolled_bu0vt_148`,list:`_list_bu0vt_150`,session:`_session_bu0vt_153`,marker:`_marker_bu0vt_170`,"engine-claude":`_engine-claude_bu0vt_176`,"engine-codex":`_engine-codex_bu0vt_177`,"engine-grok":`_engine-grok_bu0vt_178`,"engine-local":`_engine-local_bu0vt_179`,sessionText:`_sessionText_bu0vt_181`,running:`_running_bu0vt_190`,"verse-pulse":`_verse-pulse_bu0vt_1`,errored:`_errored_bu0vt_197`,seatSpent:`_seatSpent_bu0vt_212`,time:`_time_bu0vt_224`,footer:`_footer_bu0vt_243`,footerButton:`_footerButton_bu0vt_251`};function un(e){let{sessions:t,sessionsStatus:n,sessionsError:r,projects:i,seats:a,selectedId:o,query:s,onQuery:c,onSelect:l,onNew:u,onRetry:d,onCollapse:f,onDisconnect:p}=e,h=(0,z.useId)(),_=je(t,i,s),v=n===`loading`||n===`idle`&&t.length===0;return(0,V.jsxs)(`nav`,{className:G.sidebar,"aria-label":`Chats`,children:[(0,V.jsxs)(`div`,{className:G.head,children:[(0,V.jsx)(`div`,{className:G.headDragStrip,"aria-hidden":`true`}),(0,V.jsxs)(`label`,{className:G.search,htmlFor:h,children:[(0,V.jsx)(`span`,{className:G.searchIcon,"aria-hidden":`true`,children:(0,V.jsx)(R,{})}),(0,V.jsx)(`span`,{className:`visually-hidden`,children:`Search chats`}),(0,V.jsx)(`input`,{id:h,type:`search`,value:s,placeholder:`Search chats`,autoComplete:`off`,onChange:e=>c(e.target.value)})]}),(0,V.jsx)(`button`,{type:`button`,className:G.iconButton,onClick:u,title:`New chat (⌘N)`,"aria-label":`New chat`,children:(0,V.jsx)(M,{})}),(0,V.jsx)(`button`,{type:`button`,className:G.iconButton,onClick:f,title:`Hide chat list`,"aria-label":`Hide chat list`,children:(0,V.jsx)(j,{})}),n===`refreshing`?(0,V.jsx)(g,{label:`Refreshing chats`}):null]}),(0,V.jsx)(`div`,{className:G.scroll,children:v?(0,V.jsxs)(`div`,{className:G.skeleton,"aria-busy":`true`,children:[(0,V.jsx)(m,{width:`48%`}),(0,V.jsx)(m,{width:`86%`}),(0,V.jsx)(m,{width:`74%`}),(0,V.jsx)(m,{width:`40%`}),(0,V.jsx)(m,{width:`80%`})]}):n===`error`&&t.length===0?(0,V.jsxs)(`div`,{role:`alert`,className:G.error,children:[(0,V.jsx)(`p`,{children:r??`Could not load chats.`}),(0,V.jsx)(`button`,{type:`button`,onClick:d,children:`Retry`})]}):_.length===0?(0,V.jsx)(`div`,{className:G.empty,children:s?(0,V.jsxs)(`p`,{children:[`No chats match “`,s,`”.`]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:G.emptyTitle,children:`No chats yet — ⌘N`}),(0,V.jsx)(`p`,{children:`Start one on any project with any seat.`})]})}):_.map(e=>(0,V.jsxs)(`section`,{className:G.group,"aria-label":e.name,children:[(0,V.jsxs)(`h2`,{className:G.groupTitle,title:e.projectPath,children:[(0,V.jsx)(`span`,{className:G.groupName,children:e.name}),e.enrolled?(0,V.jsx)(`span`,{className:G.enrolled,title:`Enrolled repo`,children:`enrolled`}):null]}),(0,V.jsx)(`ul`,{className:G.list,children:e.sessions.map(e=>{let t=Me(a,e.seatId),n=t===void 0?null:et(t),r=e.status===`running`&&n?.cls===`blocked`,i=n===null||n.cls===`ready`||n.cls===`unread`?`${e.title} · ${Se(a,e)}`:`${e.title} · ${Se(a,e)} · ${n.summary}`;return(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{type:`button`,className:`${G.session} ${G[`engine-${e.engine}`]??``}`,"aria-current":e.id===o?`true`:void 0,"data-focus-key":`verse-session:${e.id}`,"data-engine":e.engine,onClick:()=>l(e.id),title:i,children:[(0,V.jsx)(`span`,{className:G.marker,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:G.sessionText,children:e.title||`Untitled chat`}),r&&n!==null?(0,V.jsx)(`span`,{className:G.seatSpent,role:`img`,"aria-label":`Seat limit reached: ${n.summary}`,children:`▮`}):null,e.status===`running`?(0,V.jsx)(`span`,{className:G.running,role:`img`,"aria-label":`Running`}):e.status===`error`?(0,V.jsx)(`span`,{className:G.errored,role:`img`,"aria-label":`Last turn failed`,children:`!`}):null,(0,V.jsx)(`time`,{className:G.time,dateTime:e.updatedAt,children:Le(e.updatedAt)})]})},e.id)})})]},e.projectPath))}),(0,V.jsx)(`footer`,{className:G.footer,children:(0,V.jsx)(`button`,{type:`button`,onClick:p,className:G.footerButton,children:`Disconnect`})})]})}var dn=[`user-message`,`turn-started`,`text-delta`,`assistant-message`,`thinking`,`tool-use`,`tool-result`,`usage`,`turn-done`,`error`,`cancelled`];function fn(e){return`${de(e,`/events`)}?client=${encodeURIComponent(s())}`}function pn(e){return Math.min(1e3*2**e,15e3)}function mn(e){try{let t=JSON.parse(e);if(!t||typeof t!=`object`)return null;let n=t;return typeof n.seq!=`number`||typeof n.type!=`string`?null:t}catch{return null}}function hn(e){let t=null,n=null,i=0,a=!1,o=()=>{if(a||typeof EventSource>`u`||r().phase!==`authenticated`)return;Gt(e,i===0?`connecting`:`reconnecting`);let s=new EventSource(fn(e),{withCredentials:!0});t=s,s.onopen=()=>{i=0,Gt(e,`open`)};for(let t of dn)s.addEventListener(t,t=>{let n=mn(t.data);n&&(Yt(e,n),(n.type===`turn-done`||n.type===`cancelled`||n.type===`error`)&&be())});s.onerror=c=>{typeof MessageEvent<`u`&&c instanceof MessageEvent||(s.close(),t===s&&(t=null),!a&&(Gt(e,`reconnecting`),r().phase===`authenticated`&&(n=setTimeout(()=>{n=null,i+=1,o()},pn(i)))))}};return o(),()=>{a=!0,n&&clearTimeout(n),n=null,t?.close(),t=null,Gt(e,`closed`)}}function gn(){let e=null,t=null,n=0,i=!1,a=()=>{if(i||typeof EventSource>`u`||r().phase!==`authenticated`)return;let o=new EventSource(p(),{withCredentials:!0});e=o,o.onopen=()=>{n=0},o.addEventListener(`verse-sessions`,()=>be()),o.onerror=()=>{o.close(),e===o&&(e=null),!(i||r().phase!==`authenticated`)&&(t=setTimeout(()=>{t=null,n+=1,a()},pn(n)))}};return a(),()=>{i=!0,t&&clearTimeout(t),t=null,e?.close(),e=null}}function _n(e,t=0){let n=(0,z.useSyncExternalStore)(Rt,()=>Ht(e),()=>Ht(e));(0,z.useEffect)(()=>{if(!e)return;let t=new AbortController;F(e,t.signal).then(n=>{t.signal.aborted||Ut(e,n.session,n.events)}).catch(n=>{t.signal.aborted||Wt(e,n instanceof Error?n.message:`Could not load this chat.`)});let n=hn(e);return()=>{t.abort(),n()}},[e,t]);let r=(0,z.useMemo)(()=>$t(n.events),[n.events]);return(0,z.useMemo)(()=>({...n,transcript:r}),[n,r])}var K={workspace:`_workspace_yz289_1`,header:`_header_yz289_11`,headerSpacer:`_headerSpacer_yz289_23`,title:`_title_yz289_25`,titleButton:`_titleButton_yz289_29`,titleInput:`_titleInput_yz289_59`,titleSkeleton:`_titleSkeleton_yz289_72`,seatPill:`_seatPill_yz289_81`,engineDot:`_engineDot_yz289_100`,seatText:`_seatText_yz289_107`,projectName:`_projectName_yz289_114`,"engine-claude":`_engine-claude_yz289_123`,"engine-codex":`_engine-codex_yz289_124`,"engine-grok":`_engine-grok_yz289_125`,"engine-local":`_engine-local_yz289_126`,streamState:`_streamState_yz289_128`,ghost:`_ghost_yz289_130`,ghostIcon:`_ghostIcon_yz289_131`,danger:`_danger_yz289_132`,confirm:`_confirm_yz289_158`,confirmText:`_confirmText_yz289_159`,meter:`_meter_yz289_170`,"meter-warn":`_meter-warn_yz289_178`,"meter-danger":`_meter-danger_yz289_179`,"meter-unknown":`_meter-unknown_yz289_180`,meterTrack:`_meterTrack_yz289_183`,meterFill:`_meterFill_yz289_191`,meterInline:`_meterInline_yz289_196`,meterText:`_meterText_yz289_204`,meterTokens:`_meterTokens_yz289_213`,meterPercent:`_meterPercent_yz289_217`,emptyState:`_emptyState_yz289_221`,emptyMark:`_emptyMark_yz289_232`,emptyTitle:`_emptyTitle_yz289_233`,emptyBody:`_emptyBody_yz289_240`,emptyButton:`_emptyButton_yz289_241`,emptyWarn:`_emptyWarn_yz289_257`};function vn(e){return e===null?`unknown`:e>=90?`danger`:e>=70?`warn`:`ok`}function yn({contextTokens:e,contextWindow:t,variant:n=`header`}){let r=typeof e==`number`&&Number.isFinite(e)?Math.max(0,e):0,i=typeof t==`number`&&t>0?t:null,a=i?Math.min(100,Math.round(r/i*100)):null,o=vn(a),s=i?`${nn(r)} / ${nn(i)}`:`${nn(r)} / n/a`,c=a===null?`n/a`:`${a}%`;return(0,V.jsxs)(`div`,{className:`${K.meter} ${K[`meter-${o}`]??``} ${n===`inline`?K.meterInline:``}`,role:`meter`,"aria-label":`Context window`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":a??void 0,"aria-valuetext":`${s} (${c})`,title:`Context window — ${s} (${c})`,"data-tone":o,children:[(0,V.jsx)(`div`,{className:K.meterTrack,"aria-hidden":`true`,children:(0,V.jsx)(`div`,{className:K.meterFill,style:{width:`${a??0}%`}})}),(0,V.jsxs)(`span`,{className:K.meterText,children:[(0,V.jsx)(`span`,{className:K.meterTokens,children:s}),(0,V.jsx)(`span`,{className:K.meterPercent,children:c})]})]})}var bn=`Use Wispr Flow / Superwhisper — system dictation works in this box`;function xn(){let e=globalThis;return e.SpeechRecognition??e.webkitSpeechRecognition??null}function Sn({disabled:e=!1,onInterim:t,onFinal:n,onListeningChange:r}){let i=xn(),[a,o]=(0,z.useState)(!1),[s,c]=(0,z.useState)(null),l=(0,z.useRef)(null),u=(0,z.useId)(),d=(0,z.useRef)({onInterim:t,onFinal:n,onListeningChange:r});d.current={onInterim:t,onFinal:n,onListeningChange:r};let f=(0,z.useCallback)(()=>{let e=l.current;if(l.current=null,e){e.onresult=null,e.onend=null,e.onerror=null;try{e.stop()}catch{}}o(!1),d.current.onInterim(``),d.current.onListeningChange?.(!1)},[]),p=(0,z.useCallback)(()=>{if(!i||l.current)return;let e;try{e=new i}catch{c(`Dictation could not start in this browser.`);return}e.lang=navigator.language||`en-US`,e.continuous=!0,e.interimResults=!0,e.onresult=e=>{let t=``,n=``;for(let r=e.resultIndex;r<e.results.length;r+=1){let i=e.results[r];if(!i)continue;let a=i[0]?.transcript??``;i.isFinal?n+=a:t+=a}n&&d.current.onFinal(n.trim()),d.current.onInterim(t)},e.onerror=e=>{let t=e.error??`unknown`;t===`not-allowed`||t===`service-not-allowed`?c(`Microphone access was denied.`):t!==`aborted`&&t!==`no-speech`&&c(`Dictation stopped (${t}).`),f()},e.onend=()=>{l.current===e&&f()},l.current=e,c(null);try{e.start()}catch{l.current=null,c(`Dictation could not start in this browser.`);return}o(!0),d.current.onListeningChange?.(!0)},[i,f]);return(0,z.useEffect)(()=>{if(!a)return;function e(e){e.key===`Escape`&&(e.preventDefault(),f())}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a,f]),(0,z.useEffect)(()=>()=>{let e=l.current;l.current=null;try{e?.abort()}catch{}},[]),i?(0,V.jsxs)(`span`,{className:H.dictationWrap,children:[(0,V.jsxs)(`button`,{type:`button`,className:`${H.dictation} ${a?H.dictationLive:``}`,disabled:e&&!a,"aria-pressed":a,"aria-label":a?`Stop dictation (Esc)`:`Start dictation`,title:a?`Stop dictation (Esc)`:`Dictate`,onClick:()=>a?f():p(),children:[(0,V.jsx)(Cn,{}),a?(0,V.jsx)(`span`,{className:H.dictationPulse,"aria-hidden":`true`}):null]}),s?(0,V.jsx)(`span`,{role:`alert`,className:H.dictationError,children:s}):null]}):(0,V.jsxs)(`span`,{className:H.dictationWrap,children:[(0,V.jsxs)(`button`,{type:`button`,className:H.dictation,disabled:!0,"aria-disabled":`true`,"aria-describedby":u,title:bn,children:[(0,V.jsx)(Cn,{}),(0,V.jsx)(`span`,{className:`visually-hidden`,children:`Dictation unavailable`})]}),(0,V.jsx)(`span`,{role:`tooltip`,id:u,className:H.dictationHint,children:bn})]})}function Cn(){return(0,V.jsxs)(`svg`,{viewBox:`0 0 20 20`,width:`16`,height:`16`,"aria-hidden":`true`,focusable:`false`,children:[(0,V.jsx)(`rect`,{x:`7`,y:`2`,width:`6`,height:`10`,rx:`3`,fill:`currentColor`}),(0,V.jsx)(`path`,{d:`M4.5 9.5a5.5 5.5 0 0 0 11 0M10 15v3M7 18h6`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`})]})}var wn=65536,Tn=400,En=.4,Dn=320;function On({sessionId:e=null,seats:t,seat:n,engine:r,running:s,disabled:c,disabledReason:u,locked:d,hintSeen:f=!1,contextTokens:p=null,contextWindow:m=null,onSend:h,onStop:g,onSeatChange:_,autoFocus:v=!1}){let[y,b]=(0,z.useState)(()=>x(e)),[S,C]=(0,z.useState)(``),[ee,w]=(0,z.useState)(!1),[T,te]=(0,z.useState)(!1),[E,D]=(0,z.useState)(!1),[O,k]=(0,z.useState)(-1),[ne]=(0,z.useState)(()=>i(e)),A=(0,z.useRef)(ne),j=(0,z.useRef)(``),M=(0,z.useRef)(null),N=(0,z.useRef)(null),re=(0,z.useId)(),ie=S?`${y}${y&&!y.endsWith(` `)?` `:``}${S}`:y,ae=(0,z.useMemo)(()=>new TextEncoder().encode(ie).length>wn,[ie]),P=!c&&!s&&!ee&&ie.trim().length>0&&!ae,oe=!f&&!E,se=(0,z.useMemo)(()=>o(ie,p,m,70,90),[ie,p,m]),ce=(0,z.useRef)(y),F=(0,z.useRef)(y);F.current=y;let le=(0,z.useCallback)(()=>{ce.current!==F.current&&(ce.current=F.current,a(e,F.current))},[e]);(0,z.useEffect)(()=>{if(ce.current===y)return;let e=setTimeout(le,Tn);return()=>clearTimeout(e)},[y,le]),(0,z.useEffect)(()=>(window.addEventListener(`beforeunload`,le),()=>{window.removeEventListener(`beforeunload`,le),le()}),[le]),(0,z.useEffect)(()=>{v&&M.current?.focus()},[v]),(0,z.useEffect)(()=>{if(!s)return;let e=e=>{e.key!==`.`||!e.metaKey&&!e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),g())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[s,g]),(0,z.useEffect)(()=>{if(s||!v)return;let e=document.activeElement,t=e!==null&&e!==M.current&&N.current?.contains(e)===!0;(e===null||e===document.body||!e.isConnected||t)&&M.current?.focus()},[s,v]),(0,z.useEffect)(()=>{let e=M.current;if(!e)return;let t=typeof window>`u`?0:window.innerHeight,n=t>0?Math.round(t*En):Dn;e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,n)}px`},[ie]);let ue=(0,z.useCallback)(async()=>{if(!P)return;let t=ie.trim();w(!0);try{await h(t)&&(A.current[A.current.length-1]!==t&&(A.current=[...A.current,t]),l(e,t),k(-1),j.current=``,b(``),ce.current=``,F.current=``,a(e,``),C(``),D(!0))}finally{w(!1),M.current?.focus()}},[P,ie,h,e]);function de(e){let t=A.current;if(t.length===0)return!1;if(O===-1){if(e>0)return!1;j.current=y;let n=t.length-1;return k(n),b(t[n]),C(``),!0}let n=O+e;return n<0?!0:n>=t.length?(k(-1),b(j.current),!0):(k(n),b(t[n]),!0)}function fe(e){let t=e.currentTarget,n=t.selectionStart===t.selectionEnd;if(e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing){e.preventDefault(),ue();return}if(e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!e.nativeEvent.isComposing){e.preventDefault(),ue();return}if(e.key===`ArrowUp`&&n&&(O!==-1||t.selectionStart===0&&!S)){de(-1)&&e.preventDefault();return}e.key===`ArrowDown`&&n&&O!==-1&&de(1)&&e.preventDefault()}let pe=c?u??`Sending is disabled`:s?`Draft your next message…`:`Message the agent…`;return(0,V.jsxs)(`form`,{ref:N,className:H.composer,onSubmit:e=>{e.preventDefault(),ue()},"aria-describedby":re,children:[(0,V.jsxs)(`div`,{className:`${H.box} ${T?H.boxListening:``}`,children:[(0,V.jsx)(`textarea`,{ref:M,className:H.textarea,value:ie,rows:1,placeholder:pe,"aria-label":`Message`,disabled:c,onChange:e=>{C(``),k(-1),b(e.target.value)},onKeyDown:fe}),(0,V.jsxs)(`div`,{className:H.row,children:[(0,V.jsx)(kn,{seats:t,seat:n,engine:r,disabled:c,onNewChat:_}),(0,V.jsx)(`div`,{className:H.spacer}),(0,V.jsx)(Sn,{disabled:c,onInterim:C,onFinal:e=>b(t=>t&&!t.endsWith(` `)?`${t} ${e}`:`${t}${e}`),onListeningChange:te}),s?(0,V.jsxs)(`button`,{type:`button`,className:H.stop,onClick:g,title:`Stop the running turn (⌘.)`,"aria-label":`Stop the running turn`,children:[(0,V.jsx)(`span`,{className:H.stopIcon,"aria-hidden":`true`}),`Stop`]},`stop`):(0,V.jsx)(`button`,{type:`submit`,className:H.send,disabled:!P,"aria-label":d?`Send (unlocks first)`:`Send message`,children:ee?`Sending…`:d?`Unlock & send`:`Send`},`send`)]})]}),se?(0,V.jsxs)(`p`,{className:H.cost,"data-tone":se.tone,role:`status`,children:[(0,V.jsxs)(`span`,{className:H.costFigure,children:[`≈`,nn(se.draftTokens)]}),` tokens for this message — sending would reach `,(0,V.jsxs)(`span`,{className:H.costFigure,children:[se.projectedPercent,`%`]}),` of the context window.`,se.tone===`danger`?` Start a new chat to keep the agent sharp.`:``,(0,V.jsx)(`span`,{className:`visually-hidden`,children:` This is an estimate; the provider counts the real total.`})]}):null,(0,V.jsx)(`p`,{id:re,className:`${H.help} ${oe||ae||T||s||c||O!==-1?``:H.helpQuiet}`,children:ae?(0,V.jsx)(`span`,{role:`alert`,className:H.helpError,children:`Message is over 64 KB — trim it before sending.`}):T?`Listening… Esc stops dictation.`:c&&u?u:s?(0,V.jsxs)(V.Fragment,{children:[`Reply in progress — your draft stays here · `,(0,V.jsx)(`kbd`,{children:`⌘.`}),` or Stop interrupts the turn`]}):O===-1?oe?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`kbd`,{children:`Enter`}),` sends · `,(0,V.jsx)(`kbd`,{children:`Shift`}),`+`,(0,V.jsx)(`kbd`,{children:`Enter`}),` new line · `,(0,V.jsx)(`kbd`,{children:`↑`}),` recalls · `,(0,V.jsx)(`kbd`,{children:`⌘N`}),` new chat · `,(0,V.jsx)(`kbd`,{children:`⌘K`}),` switch`]}):null:(0,V.jsxs)(V.Fragment,{children:[`Recalled message `,O+1,` of `,A.current.length,` · `,(0,V.jsx)(`kbd`,{children:`↓`}),` returns to your draft`]})})]})}function kn({seats:e,seat:t,engine:n,disabled:r,onNewChat:i}){let[a,o]=(0,z.useState)(!1),s=(0,z.useRef)(null),c=(0,z.useRef)(null),l=(0,z.useId)(),u=An(e,t.seatId),d=n??u?.engine,f=Se(e,{seatId:t.seatId,engine:d??`claude`,model:t.model}),p=e.filter(e=>e.health.state!==`unavailable`&&e.models.length>0);(0,z.useEffect)(()=>{if(!a)return;let e=e=>{s.current&&!s.current.contains(e.target)&&o(!1)},t=e=>{e.key===`Escape`&&(e.preventDefault(),o(!1),c.current?.focus())};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[a]),(0,z.useEffect)(()=>{a&&s.current?.querySelector(`[role="menuitem"]`)?.focus()},[a]);function m(e){if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let t=Array.from(s.current?.querySelectorAll(`[role="menuitem"]`)??[]);if(t.length===0)return;e.preventDefault();let n=t.indexOf(document.activeElement);t[e.key===`ArrowDown`?(n+1)%t.length:(n-1+t.length)%t.length]?.focus()}return(0,V.jsxs)(`div`,{ref:s,className:`${H.seatPillWrap} ${d?H[`engine-${d}`]??``:``}`,children:[(0,V.jsxs)(`button`,{ref:c,type:`button`,className:H.seatPill,"data-engine":d,"aria-haspopup":`menu`,"aria-expanded":a,"aria-controls":a?l:void 0,disabled:r,title:`This chat is bound to one seat — open to start a new chat on another`,onClick:()=>o(e=>!e),children:[(0,V.jsx)(`span`,{className:H.engineDot,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:H.seatPillText,children:f})]}),a?(0,V.jsxs)(`div`,{id:l,role:`menu`,"aria-label":`Seat`,className:H.seatMenu,onKeyDown:m,children:[(0,V.jsxs)(`p`,{className:H.seatMenuHeading,children:[`This chat runs on `,(0,V.jsx)(`strong`,{children:f})]}),p.length===0?(0,V.jsx)(`p`,{className:H.seatMenuEmpty,children:`No other seats are available right now.`}):null,p.map(e=>{let n=ke(e);return(0,V.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`${H.seatMenuItem} ${H[`engine-${e.engine}`]??``}`,"data-capacity":n.cls,onClick:()=>{o(!1),i({seatId:e.id,model:e.models[0].id})},children:[(0,V.jsx)(`span`,{className:H.engineDot,"aria-hidden":`true`}),(0,V.jsxs)(`span`,{className:H.seatMenuText,children:[(0,V.jsxs)(`span`,{className:H.seatMenuPrimary,children:[`New chat on `,e.label]}),(0,V.jsxs)(`span`,{className:H.seatMenuSecondary,children:[e.models[0].label,e.id===t.seatId?` · same seat`:``]}),n.cls===`unread`?null:(0,V.jsxs)(`span`,{className:H.seatMenuCapacity,children:[Ne[n.cls],` · `,n.text]})]})]},e.id)})]}):null]})}function An(e,t){return e.find(e=>e.id===t)}var jn=1200;function Mn(e,t){let n=e.length,r=t.length;if(n===0&&r===0)return[];if(n===0)return t.map(e=>({kind:`add`,text:e}));if(r===0)return e.map(e=>({kind:`del`,text:e}));if(n>jn||r>jn)return[...e.map(e=>({kind:`del`,text:e})),...t.map(e=>({kind:`add`,text:e}))];let i=0;for(;i<n&&i<r&&e[i]===t[i];)i++;let a=n-1,o=r-1;for(;a>=i&&o>=i&&e[a]===t[o];)a--,o--;let s=e.slice(i,a+1),c=t.slice(i,o+1),l=s.length,u=c.length,d=u+1,f=new Int32Array((l+1)*d);for(let e=l-1;e>=0;e--)for(let t=u-1;t>=0;t--)f[e*d+t]=s[e]===c[t]?f[(e+1)*d+(t+1)]+1:Math.max(f[(e+1)*d+t],f[e*d+(t+1)]);let p=[];for(let t=0;t<i;t++)p.push({kind:`same`,text:e[t]});let m=0,h=0;for(;m<l&&h<u;)s[m]===c[h]?(p.push({kind:`same`,text:s[m]}),m++,h++):f[(m+1)*d+h]>=f[m*d+(h+1)]?(p.push({kind:`del`,text:s[m]}),m++):(p.push({kind:`add`,text:c[h]}),h++);for(;m<l;)p.push({kind:`del`,text:s[m++]});for(;h<u;)p.push({kind:`add`,text:c[h++]});for(let t=a+1;t<n;t++)p.push({kind:`same`,text:e[t]});return p}function Nn(e,t){let n=Math.max(0,t.context??3),r=t.oldStart??1,i=t.newStart??1;if(e.length===0||!e.some(e=>e.kind!==`same`))return``;let a=[],o=r,s=i;for(let t of e)a.push({...t,oldNo:o,newNo:s}),t.kind!==`add`&&o++,t.kind!==`del`&&s++;let c=[];for(let e=0;e<a.length;e++){if(a[e].kind===`same`)continue;let t=Math.max(0,e-n),r=Math.min(a.length-1,e+n),i=c[c.length-1];i&&t<=i.to+1?i.to=Math.max(i.to,r):c.push({from:t,to:r})}let l=[`--- a/${t.path}`,`+++ b/${t.path}`];for(let e of c){let n=a.slice(e.from,e.to+1),o=n.filter(e=>e.kind!==`add`).length,s=n.filter(e=>e.kind!==`del`).length,c=n.find(e=>e.kind!==`add`)?.oldNo??r,u=n.find(e=>e.kind!==`del`)?.newNo??i,d=t.section?` ${t.section}`:``;l.push(`@@ -${o===0?c-1:c},${o} +${s===0?u-1:u},${s} @@${d}`);for(let e of n)l.push(`${e.kind===`add`?`+`:e.kind===`del`?`-`:` `}${e.text}`)}return l.join(`
2
+ `)}function Pn(e,t,n){return e===t?``:Nn(Mn(Fn(e),Fn(t)),n)}function Fn(e){if(e===``)return[];let t=e.split(`
3
+ `);return t[t.length-1]===``&&t.pop(),t}var In=new Map([[`read`,`read`],[`readfile`,`read`],[`read_file`,`read`],[`view`,`read`],[`notebookread`,`read`],[`notebook_read`,`read`],[`cat`,`read`],[`open`,`read`],[`edit`,`edit`],[`multiedit`,`edit`],[`multi_edit`,`edit`],[`notebookedit`,`edit`],[`notebook_edit`,`edit`],[`str_replace`,`edit`],[`str_replace_editor`,`edit`],[`str_replace_based_edit_tool`,`edit`],[`apply_patch`,`edit`],[`patch`,`edit`],[`edit_structural`,`edit`],[`search_replace_regex`,`edit`],[`rename_file`,`edit`],[`update`,`edit`],[`applydiff`,`edit`],[`apply_diff`,`edit`],[`write`,`create`],[`create`,`create`],[`create_file`,`create`],[`writefile`,`create`],[`write_file`,`create`],[`new_file`,`create`],[`delete`,`delete`],[`delete_file`,`delete`],[`remove_file`,`delete`],[`rm`,`delete`],[`bash`,`command`],[`shell`,`command`],[`exec`,`command`],[`run`,`command`],[`run_command`,`command`],[`runcommand`,`command`],[`run_terminal_cmd`,`command`],[`bash_start`,`command`],[`bash_tail`,`command`],[`terminal`,`command`],[`test`,`command`],[`grep`,`search`],[`glob`,`search`],[`search`,`search`],[`find`,`search`],[`codebase_search`,`search`],[`ls`,`search`],[`tree`,`search`],[`list_dir`,`search`],[`task`,`task`],[`agent`,`task`],[`dispatch_agent`,`task`],[`subagent`,`task`],[`webfetch`,`web`],[`websearch`,`web`],[`fetch`,`web`],[`http`,`web`],[`browser`,`web`]]);function Ln(e){let t=e.split(`__`).filter(Boolean);return(t[t.length-1]??e).trim().toLowerCase()}function Rn(e){return In.get(Ln(e))??`other`}function zn(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function Bn(e){return typeof e==`string`&&e.length>0?e:null}var Vn=[`file_path`,`filePath`,`notebook_path`,`notebookPath`,`target_file`,`path`,`file`,`filename`,`fileName`,`relative_workspace_path`];function Hn(e){let t=zn(e);if(!t)return[];let n=[],r=e=>{let t=Bn(e);t&&!n.includes(t)&&n.push(t)};for(let e of Vn)r(t[e]);let i=t.paths??t.file_paths??t.files;if(Array.isArray(i))for(let e of i)r(typeof e==`string`?e:zn(e)?.path);return n}function Un(e){let t=e.split(/[\\/]/).filter(Boolean);return t[t.length-1]??e}function Wn(e){let t=e.split(/[\\/]/);return t.pop(),t.join(`/`)}var Gn=[`command`,`cmd`,`script`,`shell_command`,`commandLine`],Kn=/^[ \t]*(?:exit(?:ed)?[ \t]+(?:with[ \t]+)?(?:code|status)|exit[ \t]*code|exit[ \t]*status|command[ \t]+exited[ \t]+with[ \t]+code)[ \t]*[:=]?[ \t]*(\d{1,3})[ \t]*\.?$/im;function qn(e){let t=Kn.exec(e);if(!t)return null;let n=Number(t[1]);return Number.isInteger(n)&&n>=0&&n<=255?n:null}var Jn=/^diff --git /m,Yn=/^--- (?:a\/|\/dev\/null|[^\n]*\t)/m,Xn=/^\+\+\+ (?:b\/|\/dev\/null|[^\n]*\t)/m,Zn=/^@@ -\d+(?:,\d+)? \+\d+(?:,\d+)? @@/m;function Qn(e){return e?Jn.test(e)?!0:Zn.test(e)&&Yn.test(e)&&Xn.test(e):!1}function $n(e){let t=e.match(/^diff --git /gm);return t?t.length:(e.match(/^--- /gm)??[]).length}function er(e){let t=zn(e);if(!t)return null;let n=t.old_string??t.oldString??t.old_str??t.old??t.search??t.find,r=t.new_string??t.newString??t.new_str??t.new??t.replace??t.replacement;return typeof n!=`string`||typeof r!=`string`?null:{old:n,next:r}}function tr(e,t){let n=[],r=1;return t.forEach((i,a)=>{let o=Pn(i.old,i.next,{path:e,oldStart:r,newStart:r,section:t.length>1?`edit ${a+1} of ${t.length}`:void 0});r+=Math.max(Fn(i.old).length,Fn(i.next).length)+8,o&&n.push(o.split(`
4
+ `).slice(2).join(`
5
+ `))}),n.length===0?``:[`--- a/${e}`,`+++ b/${e}`,...n].join(`
6
+ `)}function nr(e,t){let n=Fn(t);return n.length===0?``:[`--- /dev/null`,`+++ b/${e}`,`@@ -0,0 +1,${n.length} @@`,...n.map(e=>`+${e}`)].join(`
7
+ `)}var rr=2e5;function ir(e){return e.length<=2e5?e:`${e.slice(0,rr)}\n… (${e.length-rr} more characters not shown)`}var ar=/\bhas been updated\b|\bsuccessfully (?:over)?written\b|\bupdated successfully\b/i,or=/\b(?:file )?created successfully\b|\bnew file created\b/i;function sr({name:e,input:t,result:n}){let r=Ln(e),i=Rn(e),a=zn(t),o=n?.output??``,s=n===null;i===`create`&&n&&ar.test(o)&&!or.test(o)&&(i=`edit`);let c=Hn(t),l=c[0]??null,u=null;if(a)for(let e of Gn){let t=Bn(a[e]);if(t){u={command:t,exitCode:n?qn(o):null},i===`other`&&(i=`command`);break}}let d=null,f=null;if(n&&Qn(o)&&(d={text:ir(o),anchored:!0,multiFile:$n(o)>1,origin:`output`}),!d&&a){let e=Bn(a.patch)??Bn(a.diff);e&&Qn(e)&&(d={text:ir(e),anchored:!0,multiFile:$n(e)>1,origin:`payload`})}if(!d&&a&&l){let e=er(a),t=a.edits??a.replacements??a.changes,n=Array.isArray(t)?t.map(er).filter(e=>e!==null):[],r=n.length>0?n:e?[e]:[];if(r.length>0){let e=tr(l,r);e&&(d={text:ir(e),anchored:!1,multiFile:!1,origin:`payload`}),i===`other`&&(i=`edit`)}}if(!d&&a&&l){let e=typeof a.content==`string`?a.content:typeof a.contents==`string`?a.contents:typeof a.text==`string`&&(i===`create`||i===`edit`)?a.text:null;if(e!==null){if(i===`create`){let t=nr(l,e);t&&(d={text:ir(t),anchored:!0,multiFile:!1,origin:`payload`})}else f={path:l,text:ir(e)}}}let p=n!==null&&(n.isError||(u?.exitCode??0)>0);return{base:r,action:i,paths:c,command:u,diff:d,written:f,failed:p,pending:s}}function cr(e){return`verse-tool-${e.replace(/[^A-Za-z0-9_-]/g,``)}`}function lr(){return{facts:new Map,counts:new Map,toolText:new Map}}function ur(e,t){let n=t?.facts.get(e.toolUseId);if(n&&!(n.pending&&e.result!==null))return n;let r=sr({name:e.name,input:e.input,result:e.result});return t&&(t.facts.set(e.toolUseId,r),t.counts.delete(e.toolUseId),t.toolText.delete(e.toolUseId)),r}function dr(e){return`verse-note-${e.replace(/[^A-Za-z0-9_-]/g,``)}`}function fr(e){return`verse-turn-${e.replace(/[^A-Za-z0-9_-]/g,``)}`}var pr={read:0,edit:1,create:2,delete:3};function mr(e){let t=0,n=0;for(let r of w(e).files)t+=r.additions,n+=r.deletions;return{additions:t,deletions:n}}function hr(e,t,n){let r=n?.counts.get(e);if(r)return r;let i=mr(t);return n?.counts.set(e,i),i}function gr(e){return e.kind===`tool`?[e]:e.kind===`toolGroup`?e.items.filter(e=>e.kind===`tool`):[]}function _r(e,t=null){let n=new Map,r=[],i=[],a=[],o=()=>{a.length!==0&&(i.push(vr(a,n,r,t)),a=[])},s;for(let t of e){let e=`turnId`in t?t.turnId:null;(t.kind===`user`||s!==void 0&&e!==null&&e!==s)&&o(),(t.kind===`user`||s===void 0||e!==null)&&(s=e),a.push(t)}return o(),{turns:i,facts:n,errorAnchors:r}}function vr(e,t,n,r){let i=e[0],a=new Map,o=0,s=0,c=0,l=null,u=`running`,d=null,f=null,p=e=>{c++,l||=e,n.push(e)};for(let n of e){n.kind===`user`&&f===null&&(f=n.text);for(let e of gr(n)){o++;let n=ur(e,r);t.set(e.toolUseId,n),n.action===`command`&&s++,n.failed&&p(`verse-tool-${e.toolUseId.replace(/[^A-Za-z0-9_-]/g,``)}`);let i=n.action;if(i!==`read`&&i!==`edit`&&i!==`create`&&i!==`delete`)continue;let c=n.diff?hr(e.toolUseId,n.diff.text,r):{additions:0,deletions:0};for(let t of n.paths){let r=a.get(t)??{path:t,reads:0,edits:0,creates:0,deletes:0,action:i,anchorToolUseId:e.toolUseId,additions:0,deletions:0,failed:!1};i===`read`?r.reads++:i===`edit`?r.edits++:i===`create`?r.creates++:r.deletes++,pr[i]>pr[r.action]&&(r.action=i,r.anchorToolUseId=e.toolUseId),i!==`read`&&(r.additions+=c.additions,r.deletions+=c.deletions),n.failed&&(r.failed=!0),a.set(t,r)}}switch(n.kind){case`error`:p(dr(n.key)),u=`error`;break;case`cancelled`:u=`stopped`;break;case`turn-done`:d=n.durationMs>0?n.durationMs:d,n.ok?u=u===`running`?`ok`:u:u===`running`&&(u=`error`,p(dr(n.key)))}}return{key:i.key,turnId:`turnId`in i?i.turnId:null,items:e,prompt:f,at:i.at,files:[...a.values()].sort((e,t)=>pr[t.action]-pr[e.action]||t.additions+t.deletions-(e.additions+e.deletions)||e.path.localeCompare(t.path)),toolCount:o,commandCount:s,errorCount:c,firstErrorAnchor:l,status:u,durationMs:d}}function yr(e){if(e.length===0)return``;let t={edited:0,created:0,deleted:0,read:0};for(let n of e)n.action===`edit`?t.edited++:n.action===`create`?t.created++:n.action===`delete`?t.deleted++:t.read++;let n=[];return t.created&&n.push(`${t.created} created`),t.edited&&n.push(`${t.edited} edited`),t.deleted&&n.push(`${t.deleted} deleted`),t.read&&n.push(`${t.read} read`),n.join(`, `)}var br=new WeakMap,xr=4e3;function Sr(e,t){let n=t?.toolText.get(e.toolUseId);if(n!==void 0)return n;let r=[e.name];if(typeof e.input==`string`)r.push(e.input.slice(0,xr));else if(e.input)try{r.push(JSON.stringify(e.input).slice(0,xr))}catch{}e.result&&r.push(e.result.output.slice(0,xr));let i=r.join(`
8
+ `);return t&&e.result&&t.toolText.set(e.toolUseId,i),i}function Cr(e,t=null){let n=br.get(e);if(n!==void 0)return n;let r=[],i=e=>{switch(e.kind){case`user`:case`assistant`:case`thinking`:r.push(e.text);break;case`error`:r.push(e.message);break;case`tool`:r.push(Sr(e,t));break;case`toolGroup`:for(let t of e.items)i(t)}};for(let t of e.items)i(t);let a=r.join(`
9
+ `);return br.set(e,a),a}var wr=48;function Tr(e,t,n=null){let r=t.trim().toLowerCase();if(r.length===0)return[];let i=[];for(let t of e){let e=Cr(t,n),a=e.toLowerCase().indexOf(r);if(a===-1)continue;let o=Math.max(0,a-wr),s=Math.min(e.length,a+r.length+wr),c=`${o>0?`…`:``}${e.slice(o,s).replace(/\s+/g,` `).trim()}${s<e.length?`…`:``}`;i.push({turnKey:t.key,snippet:c})}return i}function Er(e,t=72){let n=e.prompt?.replace(/\s+/g,` `).trim();return n?n.length>t?`${n.slice(0,t-1)}…`:n:e.toolCount>0?`${e.toolCount} tool call${e.toolCount===1?``:`s`}`:`Session note`}var q={diff:`_diff_6z1ga_30`,visuallyHidden:`_visuallyHidden_6z1ga_46`,diffMulti:`_diffMulti_6z1ga_58`,diffHead:`_diffHead_6z1ga_60`,diffPath:`_diffPath_6z1ga_68`,diffOldPath:`_diffOldPath_6z1ga_83`,diffStatus:`_diffStatus_6z1ga_101`,diffStats:`_diffStats_6z1ga_110`,diffAdd:`_diffAdd_6z1ga_118`,diffDel:`_diffDel_6z1ga_119`,diffNotice:`_diffNotice_6z1ga_121`,diffEmpty:`_diffEmpty_6z1ga_130`,diffTable:`_diffTable_6z1ga_136`,diffNo:`_diffNo_6z1ga_121`,diffMarker:`_diffMarker_6z1ga_30`,diffText:`_diffText_6z1ga_159`,diffCode:`_diffCode_6z1ga_179`,diffRow_add:`_diffRow_add_6z1ga_181`,diffRow_del:`_diffRow_del_6z1ga_182`,diffRow_context:`_diffRow_context_6z1ga_183`,diffHunkRow:`_diffHunkRow_6z1ga_185`,diffHunkHead:`_diffHunkHead_6z1ga_192`,diffMore:`_diffMore_6z1ga_200`,commandMore:`_commandMore_6z1ga_201`,activityMore:`_activityMore_6z1ga_202`,diffUnanchored:`_diffUnanchored_6z1ga_221`,tok_plain:`_tok_plain_6z1ga_232`,tok_comment:`_tok_comment_6z1ga_233`,tok_string:`_tok_string_6z1ga_234`,tok_number:`_tok_number_6z1ga_235`,tok_keyword:`_tok_keyword_6z1ga_236`,command:`_command_6z1ga_201`,commandLine:`_commandLine_6z1ga_250`,commandPrompt:`_commandPrompt_6z1ga_257`,commandText:`_commandText_6z1ga_264`,commandStatus:`_commandStatus_6z1ga_274`,commandStatusText:`_commandStatusText_6z1ga_282`,commandMeta:`_commandMeta_6z1ga_292`,commandPre:`_commandPre_6z1ga_297`,commandPending:`_commandPending_6z1ga_309`,activity:`_activity_6z1ga_202`,activityHead:`_activityHead_6z1ga_327`,activityCount:`_activityCount_6z1ga_336`,activityLabel:`_activityLabel_6z1ga_343`,activityBreakdown:`_activityBreakdown_6z1ga_350`,activityList:`_activityList_6z1ga_356`,activityRow:`_activityRow_6z1ga_358`,activityRule:`_activityRule_6z1ga_380`,activityVerb:`_activityVerb_6z1ga_375`,activityFailed:`_activityFailed_6z1ga_379`,activityPath:`_activityPath_6z1ga_411`,activityName:`_activityName_6z1ga_419`,activityDir:`_activityDir_6z1ga_420`,activityTimes:`_activityTimes_6z1ga_430`,activityDelta:`_activityDelta_6z1ga_431`,activityAdd:`_activityAdd_6z1ga_439`,activityDel:`_activityDel_6z1ga_431`,nav:`_nav_6z1ga_446`,navSpacer:`_navSpacer_6z1ga_457`,navOutlineButton:`_navOutlineButton_6z1ga_459`,navChevron:`_navChevron_6z1ga_473`,navCount:`_navCount_6z1ga_475`,navWord:`_navWord_6z1ga_481`,navSearch:`_navSearch_6z1ga_488`,navSearchIcon:`_navSearchIcon_6z1ga_512`,navMatches:`_navMatches_6z1ga_525`,navStep:`_navStep_6z1ga_532`,navError:`_navError_6z1ga_545`,navErrorGlyph:`_navErrorGlyph_6z1ga_563`,outline:`_outline_6z1ga_568`,outlineEmpty:`_outlineEmpty_6z1ga_582`,outlineList:`_outlineList_6z1ga_587`,outlineRow:`_outlineRow_6z1ga_588`,outlineIndex:`_outlineIndex_6z1ga_602`,outlineBody:`_outlineBody_6z1ga_609`,outlineTitle:`_outlineTitle_6z1ga_610`,outlineSnippet:`_outlineSnippet_6z1ga_617`,outlineMeta:`_outlineMeta_6z1ga_627`,outlineStatus:`_outlineStatus_6z1ga_631`},Dr=8,Or={read:`read`,edit:`edited`,create:`created`,delete:`deleted`};function kr({files:e,onJump:t}){let[n,r]=(0,z.useState)(!1);if(e.length===0)return null;let i=n||e.length<=Dr?e:e.slice(0,Dr),a=e.length-i.length;return(0,V.jsxs)(`section`,{className:q.activity,"aria-label":`Files this turn touched`,children:[(0,V.jsxs)(`h3`,{className:q.activityHead,children:[(0,V.jsx)(`span`,{className:q.activityCount,children:e.length}),(0,V.jsxs)(`span`,{className:q.activityLabel,children:[`file`,e.length===1?``:`s`]}),(0,V.jsx)(`span`,{className:q.activityBreakdown,children:yr(e)})]}),(0,V.jsx)(`ul`,{className:q.activityList,children:i.map(e=>{let n=e.reads+e.edits+e.creates+e.deletes,r=`${Or[e.action]} ${e.path}${n>1?`, ${n} calls`:``}${e.additions||e.deletions?`, +${e.additions} −${e.deletions}`:``}${e.failed?`, a call on this file failed`:``}`;return(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{type:`button`,className:q.activityRow,"data-action":e.action,"data-failed":e.failed?`true`:void 0,onClick:()=>t(e.anchorToolUseId),"aria-label":r,title:e.path,children:[(0,V.jsx)(`span`,{className:q.activityRule,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:q.activityVerb,children:Or[e.action]}),(0,V.jsxs)(`span`,{className:q.activityPath,children:[(0,V.jsx)(`span`,{className:q.activityName,children:Un(e.path)}),(0,V.jsx)(`span`,{className:q.activityDir,children:Wn(e.path)})]}),e.failed?(0,V.jsx)(`span`,{className:q.activityFailed,"aria-hidden":`true`,children:`! failed`}):null,n>1?(0,V.jsxs)(`span`,{className:q.activityTimes,children:[`×`,n]}):null,(0,V.jsxs)(`span`,{className:q.activityDelta,children:[e.additions>0?(0,V.jsxs)(`span`,{className:q.activityAdd,children:[`+`,e.additions]}):null,e.deletions>0?(0,V.jsxs)(`span`,{className:q.activityDel,children:[`−`,e.deletions]}):null]})]})},e.path)})}),a>0||n?(0,V.jsx)(`button`,{type:`button`,className:q.activityMore,"aria-expanded":n,onClick:()=>r(e=>!e),children:n?`Show fewer files`:`Show ${a} more file${a===1?``:`s`}`}):null]})}var Ar={running:`•`,ok:``,error:`!`,stopped:`×`},jr={running:`running`,ok:`completed`,error:`failed`,stopped:`stopped`};function Mr(e){let{turns:t,query:n,onQuery:r,matches:i,matchIndex:a,onStepMatch:o,errorCount:s,onJumpError:c,onJumpTurn:l,focusToken:u}=e,[d,f]=(0,z.useState)(!1),p=(0,z.useRef)(null),m=(0,z.useId)(),h=(0,z.useId)(),g=n.trim().length>0;(0,z.useEffect)(()=>{u>0&&(p.current?.focus(),p.current?.select())},[u]),(0,z.useEffect)(()=>{if(!d)return;let e=e=>{e.key===`Escape`&&f(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[d]);let _=g?t.filter(e=>i.some(t=>t.turnKey===e.key)):t,v=e=>i.find(t=>t.turnKey===e)?.snippet??null;return(0,V.jsxs)(`div`,{className:q.nav,children:[(0,V.jsxs)(`button`,{type:`button`,className:q.navOutlineButton,"aria-expanded":d,"aria-controls":d?m:void 0,onClick:()=>f(e=>!e),children:[(0,V.jsx)(`span`,{className:q.navChevron,"data-open":d?`true`:void 0,"aria-hidden":`true`,children:(0,V.jsx)(oe,{size:12})}),(0,V.jsx)(`span`,{className:q.navCount,children:t.length}),(0,V.jsxs)(`span`,{className:q.navWord,children:[`turn`,t.length===1?``:`s`]})]}),(0,V.jsxs)(`label`,{className:q.navSearch,htmlFor:h,children:[(0,V.jsx)(`span`,{className:q.navSearchIcon,"aria-hidden":`true`,children:(0,V.jsx)(R,{size:12})}),(0,V.jsx)(`span`,{className:`visually-hidden`,children:`Search this chat`}),(0,V.jsx)(`input`,{ref:p,id:h,type:`search`,value:n,placeholder:`Find in chat`,autoComplete:`off`,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),o(e.shiftKey?-1:1)):e.key===`Escape`&&(e.preventDefault(),r(``))}})]}),g?(0,V.jsx)(`span`,{className:q.navMatches,role:`status`,children:i.length===0?`no matches`:`${a<0?1:a+1} of ${i.length}`}):null,g&&i.length>0?(0,V.jsxs)(`span`,{className:q.navStep,children:[(0,V.jsx)(`button`,{type:`button`,onClick:()=>o(-1),"aria-label":`Previous match`,title:`Previous match (Shift+Enter)`,children:`↑`}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>o(1),"aria-label":`Next match`,title:`Next match (Enter)`,children:`↓`})]}):null,(0,V.jsx)(`span`,{className:q.navSpacer}),s>0?(0,V.jsxs)(`button`,{type:`button`,className:q.navError,onClick:c,children:[(0,V.jsx)(`span`,{className:q.navErrorGlyph,"aria-hidden":`true`,children:`!`}),s,` error`,s===1?``:`s`,(0,V.jsx)(`span`,{className:`visually-hidden`,children:` — jump to the first one`})]}):null,d?(0,V.jsx)(`div`,{id:m,className:q.outline,role:`group`,"aria-label":`Turns in this chat`,children:_.length===0?(0,V.jsxs)(`p`,{className:q.outlineEmpty,children:[`No turn matches “`,n.trim(),`”.`]}):(0,V.jsx)(`ol`,{className:q.outlineList,children:_.map(e=>{let n=t.indexOf(e)+1,r=v(e.key);return(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{type:`button`,className:q.outlineRow,"data-status":e.status,onClick:()=>{f(!1),l(e.key)},children:[(0,V.jsx)(`span`,{className:q.outlineIndex,children:n}),(0,V.jsxs)(`span`,{className:q.outlineBody,children:[(0,V.jsx)(`span`,{className:q.outlineTitle,children:Er(e)}),r?(0,V.jsx)(`span`,{className:q.outlineSnippet,children:r}):null,(0,V.jsxs)(`span`,{className:q.outlineMeta,children:[e.toolCount>0?`${e.toolCount} tool${e.toolCount===1?``:`s`}`:`no tools`,e.files.length>0?` · ${e.files.length} file${e.files.length===1?``:`s`}`:``,e.status===`ok`?``:` · ${jr[e.status]}`]})]}),Ar[e.status]?(0,V.jsx)(`span`,{className:q.outlineStatus,"aria-hidden":`true`,children:Ar[e.status]}):null]})},e.key)})})}):null]})}function Nr(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Pr(e){if(Array.isArray(e))return e}function Fr(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Ir(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
10
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Lr(e,t){return Pr(e)||Fr(e,t)||Rr(e,t)||Ir()}function Rr(e,t){if(e){if(typeof e==`string`)return Nr(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Nr(e,t):void 0}}var zr=Object.entries,Br=Object.setPrototypeOf,Vr=Object.isFrozen,Hr=Object.getPrototypeOf,Ur=Object.getOwnPropertyDescriptor,J=Object.freeze,Wr=Object.seal,Gr=Object.create,Kr=typeof Reflect<`u`&&Reflect,qr=Kr.apply,Jr=Kr.construct;J||=function(e){return e},Wr||=function(e){return e},qr||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},Jr||=function(e){return new e(...[...arguments].slice(1))};var Yr=Y(Array.prototype.forEach),Xr=Y(Array.prototype.lastIndexOf),Zr=Y(Array.prototype.pop),Qr=Y(Array.prototype.push),$r=Y(Array.prototype.splice),ei=Array.isArray,ti=Y(String.prototype.toLowerCase),ni=Y(String.prototype.toString),ri=Y(String.prototype.match),ii=Y(String.prototype.replace),ai=Y(String.prototype.indexOf),oi=Y(String.prototype.trim),si=Y(Number.prototype.toString),ci=Y(Boolean.prototype.toString),li=typeof BigInt>`u`?null:Y(BigInt.prototype.toString),ui=typeof Symbol>`u`?null:Y(Symbol.prototype.toString),di=Y(Object.prototype.hasOwnProperty),fi=Y(Object.prototype.toString),pi=Y(RegExp.prototype.test),mi=hi(TypeError);function Y(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return qr(e,t,n)}}function hi(e){return function(){return Jr(e,[...arguments])}}function X(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ti;if(Br&&Br(e,null),!ei(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Vr(t)||(t[r]=e),i=e)}e[i]=!0}return e}function gi(e){for(let t=0;t<e.length;t++)di(e,t)||(e[t]=null);return e}function _i(e){let t=Gr(null);for(let r of zr(e)){var n=Lr(r,2);let i=n[0],a=n[1];di(e,i)&&(t[i]=ei(a)?gi(a):a&&typeof a==`object`&&a.constructor===Object?_i(a):a)}return t}function vi(e){switch(typeof e){case`string`:return e;case`number`:return si(e);case`boolean`:return ci(e);case`bigint`:return li?li(e):`0`;case`symbol`:return ui?ui(e):`Symbol()`;case`undefined`:return fi(e);case`function`:case`object`:{if(e===null)return fi(e);let t=e,n=yi(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:fi(e)}return fi(e)}default:return fi(e)}}function yi(e,t){for(;e!==null;){let n=Ur(e,t);if(n){if(n.get)return Y(n.get);if(typeof n.value==`function`)return Y(n.value)}e=Hr(e)}function n(){return null}return n}function bi(e){try{return pi(e,``),!0}catch{return!1}}var xi=J(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Si=J(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Ci=J([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),wi=J([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Ti=J(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Ei=J([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Di=J([`#text`]),Oi=J(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),ki=J(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),Ai=J(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),ji=J([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Mi=Wr(/{{[\w\W]*|^[\w\W]*}}/g),Ni=Wr(/<%[\w\W]*|^[\w\W]*%>/g),Pi=Wr(/\${[\w\W]*/g),Fi=Wr(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ii=Wr(/^aria-[\-\w]+$/),Li=Wr(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ri=Wr(/^(?:\w+script|data):/i),zi=Wr(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Bi=Wr(/^html$/i),Vi=Wr(/^[a-z][.\w]*(-[.\w]+)+$/i),Hi=Wr(/<[/\w!]/g),Ui=Wr(/<[/\w]/g),Wi=Wr(/<\/no(script|embed|frames)/i),Gi=Wr(/\/>/i),Ki={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},qi=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],Ji=J(X({},qi)),Yi=function(){let e={};return Yr(qi,t=>{e[t]=Wr(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),J(e)}(),Xi=function(){return typeof window>`u`?null:window},Zi=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Qi=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},$i=function(e,t,n,r){return di(e,t)&&ei(e[t])?X(r.base?_i(r.base):{},e[t],r.transform):n},ea=function(e,t,n){let r=di(e,t)?e[t]:void 0;return r&&typeof r==`object`?_i(r):n()};function ta(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Xi(),t=e=>ta(e);if(t.version=`3.4.15`,t.removed=[],!e||!e.document||e.document.nodeType!==Ki.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=yi(d,`cloneNode`),p=yi(d,`remove`),m=yi(d,`removeAttributeNode`),h=yi(d,`nextSibling`),g=yi(d,`childNodes`),_=yi(d,`parentNode`),v=yi(d,`shadowRoot`),y=yi(d,`attributes`),b=o&&o.prototype?yi(o.prototype,`nodeType`):null,x=o&&o.prototype?yi(o.prototype,`nodeName`):null,S=o&&o.prototype?yi(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},ee=function(e){return x?x(e):e.nodeName};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let w,T=``,te,E=!1,D=0,O=function(){if(D>0)throw mi(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},k=function(e){O(),D++;try{return w.createHTML(e)}finally{D--}},ne=function(e){O(),D++;try{return w.createScriptURL(e)}finally{D--}},A=function(){return E||=(te=Zi(u,i),!0),te},j=n,M=j.implementation,N=j.createNodeIterator,re=j.createDocumentFragment,ie=j.getElementsByTagName,ae=r.importNode,P=Qi();t.isSupported=typeof zr==`function`&&typeof _==`function`&&M&&M.createHTMLDocument!==void 0;let oe=Mi,se=Ni,ce=Pi,F=Fi,le=Ii,ue=Ri,de=zi,fe=Vi,pe=Li,I=null,me=X({},[...xi,...Si,...Ci,...Ti,...Di]),L=null,he=X({},[...Oi,...ki,...Ai,...ji]),ge=Object.seal(Gr(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),_e=null,ve=null,R=Object.seal(Gr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ye=!0,be=!0,xe=!1,Se=!0,Ce=!1,we=!0,Te=!1,Ee=!1,De=null,Oe=null,ke=!1,Ae=!1,je=!1,Me=!1,Ne=!0,Pe=!1,Fe=`user-content-`,Ie=!0,Le=!1,Re={},ze=null,Be=X({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Ve=null,He=X({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ue=null,We=X({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Ge=`http://www.w3.org/1998/Math/MathML`,z=`http://www.w3.org/2000/svg`,Ke=`http://www.w3.org/1999/xhtml`,qe=Ke,Je=!1,Ye=null,Xe=X({},[Ge,z,Ke],ni),Ze=J([`mi`,`mo`,`mn`,`ms`,`mtext`]),Qe=X({},Ze),$e=J([`annotation-xml`]),et=X({},$e),tt=X({},[`title`,`style`,`font`,`a`,`script`]),nt=null,rt=[`application/xhtml+xml`,`text/html`],B=null,V=null,it=n.createElement(`form`),at=function(e){return e instanceof RegExp||e instanceof Function},ot=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(V&&V===e)return;(!e||typeof e!=`object`)&&(e={}),e=_i(e),nt=rt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,B=nt===`application/xhtml+xml`?ni:ti,I=$i(e,`ALLOWED_TAGS`,me,{transform:B}),L=$i(e,`ALLOWED_ATTR`,he,{transform:B}),Ye=$i(e,`ALLOWED_NAMESPACES`,Xe,{transform:ni}),Ue=$i(e,`ADD_URI_SAFE_ATTR`,We,{transform:B,base:We}),Ve=$i(e,`ADD_DATA_URI_TAGS`,He,{transform:B,base:He}),ze=$i(e,`FORBID_CONTENTS`,Be,{transform:B}),_e=$i(e,`FORBID_TAGS`,_i({}),{transform:B}),ve=$i(e,`FORBID_ATTR`,_i({}),{transform:B}),Re=di(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?_i(e.USE_PROFILES):e.USE_PROFILES:!1,ye=e.ALLOW_ARIA_ATTR!==!1,be=e.ALLOW_DATA_ATTR!==!1,xe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Se=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ce=e.SAFE_FOR_TEMPLATES||!1,we=e.SAFE_FOR_XML!==!1,Te=e.WHOLE_DOCUMENT||!1,Ae=e.RETURN_DOM||!1,je=e.RETURN_DOM_FRAGMENT||!1,Me=e.RETURN_TRUSTED_TYPE||!1,ke=e.FORCE_BODY||!1,Ne=e.SANITIZE_DOM!==!1,Pe=e.SANITIZE_NAMED_PROPS||!1,Ie=e.KEEP_CONTENT!==!1,Le=e.IN_PLACE||!1,pe=bi(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Li,qe=typeof e.NAMESPACE==`string`?e.NAMESPACE:Ke,Qe=ea(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>X({},Ze)),et=ea(e,`HTML_INTEGRATION_POINTS`,()=>X({},$e));let t=ea(e,`CUSTOM_ELEMENT_HANDLING`,()=>Gr(null));if(ge=Gr(null),di(t,`tagNameCheck`)&&at(t.tagNameCheck)&&(ge.tagNameCheck=t.tagNameCheck),di(t,`attributeNameCheck`)&&at(t.attributeNameCheck)&&(ge.attributeNameCheck=t.attributeNameCheck),di(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(ge.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),Wr(ge),Ce&&(be=!1),je&&(Ae=!0),Re&&(I=X({},Di),L=Gr(null),Re.html===!0&&(X(I,xi),X(L,Oi)),Re.svg===!0&&(X(I,Si),X(L,ki),X(L,ji)),Re.svgFilters===!0&&(X(I,Ci),X(L,ki),X(L,ji)),Re.mathMl===!0&&(X(I,Ti),X(L,Ai),X(L,ji))),R.tagCheck=null,R.attributeCheck=null,di(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?R.tagCheck=e.ADD_TAGS:ei(e.ADD_TAGS)&&(I===me&&(I=_i(I)),X(I,e.ADD_TAGS,B))),di(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?R.attributeCheck=e.ADD_ATTR:ei(e.ADD_ATTR)&&(L===he&&(L=_i(L)),X(L,e.ADD_ATTR,B))),di(e,`ADD_FORBID_CONTENTS`)&&ei(e.ADD_FORBID_CONTENTS)&&(ze===Be&&(ze=_i(ze)),X(ze,e.ADD_FORBID_CONTENTS,B)),Ie&&(I[`#text`]=!0),Te&&X(I,[`html`,`head`,`body`]),I.table&&(X(I,[`tbody`]),delete _e.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw mi(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw mi(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=w;w=e.TRUSTED_TYPES_POLICY;try{T=k(``)}catch(e){throw w=t,e}}else e.TRUSTED_TYPES_POLICY===null?(w=void 0,T=``):(w===void 0&&(w=A()),w&&typeof T==`string`&&(T=k(``)));J&&J(e),V=e},st=X({},[...Si,...Ci,...wi]),H=X({},[...Ti,...Ei]),ct=function(e,t,n){return t.namespaceURI===Ke?e===`svg`:t.namespaceURI===Ge?e===`svg`&&(n===`annotation-xml`||Qe[n]):!!st[e]},lt=function(e,t,n){return t.namespaceURI===Ke?e===`math`:t.namespaceURI===z?e===`math`&&et[n]:!!H[e]},ut=function(e,t,n){return t.namespaceURI===z&&!et[n]||t.namespaceURI===Ge&&!Qe[n]?!1:!H[e]&&(tt[e]||!st[e])},dt=function(e){let t=_(e);(!t||!t.tagName)&&(t={namespaceURI:qe,tagName:`template`});let n=ti(e.tagName),r=ti(t.tagName);return Ye[e.namespaceURI]?e.namespaceURI===z?ct(n,t,r):e.namespaceURI===Ge?lt(n,t,r):e.namespaceURI===Ke?ut(n,t,r):!!(nt===`application/xhtml+xml`&&Ye[e.namespaceURI]):!1},U=function(e){Qr(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw mi(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},ft=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},pt=function(e){gt(e);let t=g(e);if(t){let e=[];Yr(t,t=>{Qr(e,t)}),Yr(e,e=>{try{p(e)}catch{}})}let n=y(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&ft(e,r,i)}},mt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}Qr(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(Ae||je)try{U(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},ht=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||L[B(i)]||ft(e,r,i)}},gt=function(e){let t=[e];for(;t.length>0;){let e=t.pop();C(e)===Ki.element&&ht(e);let n=g(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},_t=function(e,t){return we?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},vt=function(e){if(!we)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=C(e);if(n===Ki.processingInstruction||n===Ki.comment&&pi(Ui,e.data)){try{p(e)}catch{}continue}if(n===Ki.element){let t=e,n=B(ee(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&_t(`for`,n)&&t.removeAttribute(`for`)}catch{}}let r=g(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},yt=function(e){let t=null,r=null;if(ke)e=`<remove></remove>`+e;else{let t=ri(e,/^[\r\n\t ]+/);r=t&&t[0]}nt===`application/xhtml+xml`&&qe===Ke&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=w?k(e):e;if(qe===Ke)try{t=new l().parseFromString(i,nt)}catch{}if(!t||!t.documentElement){t=M.createDocument(qe,`template`,null);try{t.documentElement.innerHTML=Je?T:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),qe===Ke?ie.call(t,Te?`html`:`body`)[0]:Te?t.documentElement:a},bt=function(e){let t=S?S(e):e.ownerDocument;return N.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},xt=function(e){return e=ii(e,oe,` `),e=ii(e,se,` `),e=ii(e,ce,` `),e},St=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=N.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=xt(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&Yr(i,e=>{wt(e.content)&&St(e.content)})},Ct=function(e){let t=x?x(e):null;return typeof t!=`string`||B(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},wt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===Ki.documentFragment}catch{return!1}},Tt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function Et(e,n,r){e.length!==0&&Yr(e,e=>{e.call(t,n,r,V)})}let Dt=function(e,t){return!!(we&&e.hasChildNodes()&&!Tt(e.firstElementChild)&&pi(Hi,e.textContent)&&pi(Hi,e.innerHTML)||we&&e.namespaceURI===Ke&&Ji[t]&&(Tt(e.firstElementChild)||typeof e.textContent==`string`&&pi(Yi[t],e.textContent))||e.nodeType===Ki.processingInstruction||we&&e.nodeType===Ki.comment&&pi(Ui,e.data))},Ot=function(e,t){return e instanceof RegExp?pi(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},kt=function(e,t,n){if(!_e[t]&&Ft(t)&&Ot(ge.tagNameCheck,t))return!1;if(Ie&&!ze[t]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return U(e),!0},At=function(e,t,n,r){return e.length===0?t:t===n||t===r?_i(t):t},jt=function(e,t){return e===t||_(e)!==null?!1:(Le&&gt(e),!0)},Mt=function(e,n){if(Et(P.beforeSanitizeElements,e,null),jt(e,n))return!0;if(Ct(e))return U(e),!0;let r=B(ee(e));if(I=At(P.uponSanitizeElement,I,me,De),Et(P.uponSanitizeElement,e,{tagName:r,allowedTags:I}),jt(e,n))return!0;if(Dt(e,r))return U(e),!0;if(_e[r]||!(R.tagCheck instanceof Function&&R.tagCheck(r))&&!I[r]){let t=kt(e,r,n);return t===!1&&Et(P.afterSanitizeElements,e,null),t}if(C(e)===Ki.element&&!dt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&pi(Wi,e.innerHTML))return U(e),!0;if(Ce&&e.nodeType===Ki.text){let n=xt(e.textContent);e.textContent!==n&&(Qr(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Et(P.afterSanitizeElements,e,null),!1},Nt=function(e,t,r){if(ve[t]||_t(t,e)||Ne&&(t===`id`||t===`name`)&&(r in n||r in it))return!1;let i=L[t]||R.attributeCheck instanceof Function&&R.attributeCheck(t,e);return be&&pi(F,t)||ye&&pi(le,t)?!0:i?Ue[t]||pi(pe,ii(r,de,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&ai(r,`data:`)===0&&Ve[e]||xe&&!pi(ue,ii(r,de,``))?!0:!r:Ft(e)&&Ot(ge.tagNameCheck,e)&&Ot(ge.attributeNameCheck,t,e)||t===`is`&&ge.allowCustomizedBuiltInElements&&Ot(ge.tagNameCheck,r)},Pt=X({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Ft=function(e){return!Pt[ti(e)]&&pi(fe,e)},It=function(e,t,n,r){if(w&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return k(r);case`TrustedScriptURL`:return ne(r)}return r},Lt=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!Ct(e)||(U(e),!1)}catch{return mt(t,e),!1}},Rt=function(e){Et(P.beforeSanitizeAttributes,e,null);let n=e.attributes;if(!n||Ct(e))return;L=At(P.uponSanitizeAttribute,L,he,Oe);let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:L,forceKeepAttr:void 0},i=n.length,a=B(e.nodeName);for(;i--;){let o=n[i],s=o.name,c=o.namespaceURI,l=o.value,u=B(s),d=l,f=s===`value`?d:oi(d),p=!1;if(r.attrName=u,r.attrValue=f,r.keepAttr=!0,r.forceKeepAttr=void 0,Et(P.uponSanitizeAttribute,e,r),f=r.attrValue,Pe&&(u===`id`||u===`name`)&&ai(f,Fe)!==0&&(mt(s,e,o),f=Fe+f,p=!0),we&&pi(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){mt(s,e,o);continue}if(u===`attributename`&&ri(f,`href`)){mt(s,e,o);continue}if(!r.forceKeepAttr){if(!r.keepAttr){mt(s,e,o);continue}if(!Se&&pi(Gi,f)){mt(s,e,o);continue}if(Ce&&(f=xt(f)),!Nt(a,u,f)){mt(s,e,o);continue}f=It(a,u,c,f),f!==d&&Lt(e,s,c,f)&&p&&Zr(t.removed)}}Et(P.afterSanitizeAttributes,e,null)},zt=function(e){let t=null,n=bt(e);for(Et(P.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Et(P.uponSanitizeShadowNode,t,null),Mt(t,e),Rt(t),wt(t.content)&&zt(t.content),C(t)===Ki.element){let e=v(t);wt(e)&&(Bt(e),zt(e))}Et(P.afterSanitizeShadowDOM,e,null)},Bt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){zt(e.shadow);continue}let n=e.node,r=C(n)===Ki.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&B(e)===`template`){let e=n.content;wt(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);wt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Je=!e,Je&&(e=`<!-->`),typeof e!=`string`&&!Tt(e)&&(e=vi(e),typeof e!=`string`))throw mi(`dirty is not a string, aborting`);if(!t.isSupported)return e;Ee?(I=De,L=Oe):ot(n),(P.uponSanitizeElement.length>0||P.uponSanitizeAttribute.length>0)&&(I=_i(I)),P.uponSanitizeAttribute.length>0&&(L=_i(L)),t.removed=[];let c=Le&&typeof e!=`string`&&Tt(e);if(c){vt(e);let t=ee(e);if(typeof t==`string`){let n=B(t);if(!I[n]||_e[n])throw pt(e),mi(`root node is forbidden and cannot be sanitized in-place`)}if(Ct(e))throw pt(e),mi(`root node is clobbered and cannot be sanitized in-place`);try{Bt(e)}catch(t){throw pt(e),t}}else if(Tt(e))i=yt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===Ki.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Bt(i);else{if(!Ae&&!Ce&&!Te&&e.indexOf(`<`)===-1)return w&&Me?k(e):e;if(i=yt(e),!i)return Ae?null:Me?T:``}i&&ke&&U(i.firstChild);let l=c?e:i;try{let e=bt(l);for(;o=e.nextNode();)Mt(o,l),Rt(o),wt(o.content)&&zt(o.content)}catch(n){throw c&&(pt(e),Yr(t.removed,e=>{e.element&&gt(e.element)})),n}if(c)return Yr(t.removed,e=>{e.element&&gt(e.element)}),Ce&&St(e),e;if(Ae){if(Ce&&St(i),je)for(s=re.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(L.shadowroot||L.shadowrootmode)&&(s=ae.call(r,s,!0)),s}let u=Te?i.outerHTML:i.innerHTML;return Te&&I[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&pi(Bi,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
11
+ `+u),Ce&&(u=xt(u)),w&&Me?k(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ot(e),Ee=!0,De=I,Oe=L},t.clearConfig=function(){V=null,Ee=!1,De=null,Oe=null,w=te,T=``},t.isValidAttribute=function(e,t,n){V||ot({});let r=B(e),i=B(t);return Nt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&di(P,e)&&Qr(P[e],t)},t.removeHook=function(e,t){if(di(P,e)){if(t!==void 0){let n=Xr(P[e],t);return n===-1?void 0:$r(P[e],n,1)[0]}return Zr(P[e])}},t.removeHooks=function(e){di(P,e)&&(P[e]=[])},t.removeAllHooks=function(){P=Qi()},t}var na=ta();function ra(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ia=ra();function aa(e){ia=e}var oa={exec:()=>null};function sa(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function Z(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(la.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var ca=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),la={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:sa(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:sa(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:sa(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:sa(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:sa(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:sa(e=>RegExp(`^ {0,${e}}>`))},ua=/^(?:[ \t]*(?:\n|$))+/,da=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,fa=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,pa=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ma=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ha=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ga=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_a=Z(ga).replace(/bull/g,ha).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),va=Z(ga).replace(/bull/g,ha).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ya=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,ba=/^[^\n]+/,xa=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Sa=Z(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,xa).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ca=Z(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,ha).getRegex(),wa=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,Ta=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ea=Z(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Ta).replace(`tag`,wa).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Da=e=>Z(ya).replace(`hr`,pa).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,wa).getRegex(),Oa=Da(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),ka=Da(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Aa={blockquote:Z(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,ka).getRegex(),code:da,def:Sa,fences:fa,heading:ma,hr:pa,html:Ea,lheading:_a,list:Ca,newline:ua,paragraph:Oa,table:oa,text:ba},ja=Z(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,pa).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,wa).getRegex(),Ma={...Aa,lheading:va,table:ja,paragraph:Z(ya).replace(`hr`,pa).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,ja).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,wa).getRegex()},Na={...Aa,html:Z(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Ta).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:oa,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Z(ya).replace(`hr`,pa).replace(`heading`,` *#{1,6} *[^
12
+ ]`).replace(`lheading`,_a).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Pa=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Fa=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ia=/^( {2,}|\\)\n(?!\s*$)/,La=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ra=/[\p{P}\p{S}]/u,za=/[\s\p{P}\p{S}]/u,Ba=/[^\s\p{P}\p{S}]/u,Va=Z(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,za).getRegex(),Ha=/[\p{Pi}\p{Ps}"']/u,Ua=/(?!~)[\p{P}\p{S}]/u,Wa=/(?!~)[\s\p{P}\p{S}]/u,Ga=/(?:[^\s\p{P}\p{S}]|~)/u,Ka=Z(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,ca?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),qa=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ja=Z(qa,`u`).replace(/punct/g,Ra).getRegex(),Ya=Z(qa,`u`).replace(/punct/g,Ua).getRegex(),Xa=Z(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,Ha).replace(/punct/g,Ra).getRegex(),Za=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Qa=Z(Za,`gu`).replace(/notPunctSpace/g,Ba).replace(/punctSpace/g,za).replace(/punct/g,Ra).getRegex(),$a=Z(Za,`gu`).replace(/notPunctSpace/g,Ga).replace(/punctSpace/g,Wa).replace(/punct/g,Ua).getRegex(),eo=Z(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Ba).replace(/punctSpace/g,za).replace(/punct/g,Ra).getRegex(),to=Z(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Ba).replace(/punctSpace/g,za).replace(/punct/g,Ra).getRegex(),no=Z(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Ba).replace(/punctSpace/g,za).replace(/punct/g,Ra).getRegex(),ro=Z(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,Ra).getRegex(),io=Z(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Ba).replace(/punctSpace/g,za).replace(/punct/g,Ra).getRegex(),ao=Z(/\\(punct)/,`gu`).replace(/punct/g,Ra).getRegex(),oo=Z(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),so=Z(Ta).replace(`(?:-->|$)`,`-->`).getRegex(),co=Z(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,so).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),lo=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,uo=Z(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,lo).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),fo=Z(/^!?\[(label)\]\[(ref)\]/).replace(`label`,lo).replace(`ref`,xa).getRegex(),po=Z(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,xa).getRegex(),mo=Z(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,fo).replace(`nolink`,po).getRegex(),ho=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,go={_backpedal:oa,anyPunctuation:ao,autolink:oo,blockSkip:Ka,br:Ia,code:Fa,del:oa,delLDelim:oa,delRDelim:oa,emStrongLDelim:Ja,emStrongRDelimAst:Qa,emStrongRDelimUnd:to,escape:Pa,link:uo,nolink:po,punctuation:Va,reflink:fo,reflinkSearch:mo,tag:co,text:La,url:oa},_o={...go,emStrongLDelim:Xa,emStrongRDelimAst:eo,emStrongRDelimUnd:no,link:Z(/^!?\[(label)\]\((.*?)\)/).replace(`label`,lo).getRegex(),reflink:Z(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,lo).getRegex()},vo={...go,emStrongRDelimAst:$a,emStrongLDelim:Ya,delLDelim:ro,delRDelim:io,url:Z(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,ho).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Z(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,ho).getRegex()},yo={...vo,br:Z(Ia).replace(`{2,}`,`*`).getRegex(),text:Z(vo.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},bo={normal:Aa,gfm:Ma,pedantic:Na},xo={normal:go,gfm:vo,breaks:yo,pedantic:_o},So={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},Co=e=>So[e];function wo(e,t){if(t){if(la.escapeTest.test(e))return e.replace(la.escapeReplace,Co)}else if(la.escapeTestNoEncode.test(e))return e.replace(la.escapeReplaceNoEncode,Co);return e}function To(e){try{e=encodeURI(e).replace(la.percentDecode,`%`)}catch{return null}return e}function Eo(e,t){let n=e.replace(la.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(la.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(la.slashPipe,`|`);return n}function Do(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Oo(e){let t=e.split(`
13
+ `),n=t.length-1;for(;n>=0&&la.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
14
+ `)}function ko(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Ao(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function jo(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function Mo(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
15
+ `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
16
+ `)}var No=class{options;rules;lexer;constructor(e){this.options=e||ia}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:Oo(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Mo(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=Do(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:Do(t[0],`
17
+ `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:Do(t[0],`
18
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Do(t[0],`
19
+ `).split(`
20
+ `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
21
+ `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
22
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
23
+ ${s}`:s,r=r?`${r}
24
+ ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=e.join(`
25
+ `),o=t.raw+`
26
+ `+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s,n=`${n}
27
+ ${a}`,r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
28
+ `+e.join(`
29
+ `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
30
+ `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=Ao(t[2].split(`
31
+ `,1)[0],t[1].length),l=e.split(`
32
+ `,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
33
+ `,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
34
+ `,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
35
+ `+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
36
+ `+l}u=!l.trim(),r+=p+`
37
+ `,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of i.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=Oo(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:Do(t[0],`
38
+ `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Eo(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
39
+ `):[],a={type:`table`,raw:Do(t[0],`
40
+ `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Eo(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:Do(t[0],`
41
+ `),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
42
+ `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=Do(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=ko(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),jo(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return jo(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},Po=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||ia,this.options.tokenizer=this.options.tokenizer||new No,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:la,block:bo.normal,inline:xo.normal};this.options.pedantic?(t.block=bo.pedantic,t.inline=xo.pedantic):this.options.gfm&&(t.block=bo.gfm,t.inline=this.options.breaks?xo.breaks:xo.gfm),this.tokenizer.rules=t}static get rules(){return{block:bo,inline:xo}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(la.carriageReturn,`
43
+ `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(la.tabCharGlobal,` `).replace(la.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
44
+ `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
45
+ `)?``:`
46
+ `)+i.raw,n.text+=`
47
+ `+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
48
+ `)?``:`
49
+ `)+i.raw,n.text+=`
50
+ `+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
51
+ `)?``:`
52
+ `)+i.raw,r.text+=`
53
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
54
+ `)?``:`
55
+ `)+i.raw,n.text+=`
56
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e;if(this.tokens.links){let e=Object.keys(this.tokens.links);e.length>0&&(n=n.replace(this.tokenizer.rules.inline.reflinkSearch,t=>e.includes(t.slice(t.lastIndexOf(`[`)+1,-1))?`[`+`a`.repeat(t.length-2)+`]`:t))}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,e=>`+`.repeat(e.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},Fo=class{options;parser;constructor(e){this.options=e||ia}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(la.notSpaceStart)?.[0],i=e.replace(la.endingNewline,``)+`
57
+ `;return r?`<pre><code class="language-`+wo(r)+`">`+(n?i:wo(i,!0))+`</code></pre>
58
+ `:`<pre><code>`+(n?i:wo(i,!0))+`</code></pre>
59
+ `}blockquote({tokens:e}){return`<blockquote>
60
+ ${this.parser.parse(e)}</blockquote>
61
+ `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
62
+ `}hr(e){return`<hr>
63
+ `}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
64
+ `+r+`</`+i+`>
65
+ `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
66
+ `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
67
+ `}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
68
+ <thead>
69
+ `+t+`</thead>
70
+ `+r+`</table>
71
+ `}tablerow({text:e}){return`<tr>
72
+ ${e}</tr>
73
+ `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
74
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${wo(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=To(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+wo(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=To(e);if(i===null)return wo(n);e=i;let a=`<img src="${e}" alt="${wo(n)}"`;return t&&(a+=` title="${wo(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:wo(e.text)}},Io=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},Lo=class e{options;renderer;textRenderer;constructor(e){this.options=e||ia,this.options.renderer=this.options.renderer||new Fo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Io}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Ro=class{options;block;constructor(e){this.options=e||ia}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?Po.lex:Po.lexInline}provideParser(e=this.block){return e?Lo.parse:Lo.parseInline}},zo=new class{defaults=ra();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Lo;Renderer=Fo;TextRenderer=Io;Lexer=Po;Tokenizer=No;Hooks=Ro;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Fo(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new No(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Ro;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=Ro.passThroughHooks.has(n)?e=>{if(this.defaults.async&&Ro.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Po.lex(e,t??this.defaults)}parser(e,t){return Lo.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?Po.lex:Po.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?Lo.parse:Lo.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?Po.lex:Po.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?Lo.parse:Lo.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
75
+ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+wo(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Q(e,t){return zo.parse(e,t)}Q.options=Q.setOptions=function(e){return zo.setOptions(e),Q.defaults=zo.defaults,aa(Q.defaults),Q},Q.getDefaults=ra,Q.defaults=ia;function Bo(...e){return zo.use(...e),Q.defaults=zo.defaults,aa(Q.defaults),Q}Q.use=Bo,Q.walkTokens=function(e,t){return zo.walkTokens(e,t)},Q.parseInline=zo.parseInline,Q.Parser=Lo,Q.parser=Lo.parse,Q.Renderer=Fo,Q.TextRenderer=Io,Q.Lexer=Po,Q.lexer=Po.lex,Q.Tokenizer=No,Q.Hooks=Ro,Q.parse=Q,Q.options,Q.setOptions,Q.walkTokens,Q.parseInline,Lo.parse,Po.lex;var $={transcriptWrap:`_transcriptWrap_yy5uu_5`,transcript:`_transcript_yy5uu_5`,list:`_list_yy5uu_14`,item:`_item_yy5uu_24`,skeleton:`_skeleton_yy5uu_26`,skeletonUser:`_skeletonUser_yy5uu_38`,loadError:`_loadError_yy5uu_39`,empty:`_empty_yy5uu_62`,emptyTitle:`_emptyTitle_yy5uu_63`,emptyBody:`_emptyBody_yy5uu_72`,user:`_user_yy5uu_75`,userText:`_userText_yy5uu_76`,assistant:`_assistant_yy5uu_87`,markdown:`_markdown_yy5uu_31`,codeHead:`_codeHead_yy5uu_182`,codeLang:`_codeLang_yy5uu_199`,copy:`_copy_yy5uu_198`,caret:`_caret_yy5uu_224`,streaming:`_streaming_yy5uu_225`,"verse-caret":`_verse-caret_yy5uu_1`,thinking:`_thinking_yy5uu_238`,thinkingSummary:`_thinkingSummary_yy5uu_239`,thinkingBody:`_thinkingBody_yy5uu_251`,tool:`_tool_yy5uu_262`,toolRun:`_toolRun_yy5uu_263`,toolLine:`_toolLine_yy5uu_265`,toolArg:`_toolArg_yy5uu_283`,toolState:`_toolState_yy5uu_283`,toolGlyph:`_toolGlyph_yy5uu_294`,toolName:`_toolName_yy5uu_304`,toolFailed:`_toolFailed_yy5uu_328`,toolBody:`_toolBody_yy5uu_331`,toolRunBody:`_toolRunBody_yy5uu_332`,toolRunList:`_toolRunList_yy5uu_339`,toolLabel:`_toolLabel_yy5uu_341`,toolPre:`_toolPre_yy5uu_350`,toolPending:`_toolPending_yy5uu_365`,note:`_note_yy5uu_368`,noteError:`_noteError_yy5uu_374`,meta:`_meta_yy5uu_375`,noteDuration:`_noteDuration_yy5uu_376`,metaText:`_metaText_yy5uu_380`,jump:`_jump_yy5uu_387`,jumpUnseen:`_jumpUnseen_yy5uu_410`,turn:`_turn_yy5uu_435`,turnItems:`_turnItems_yy5uu_457`,"verse-flash":`_verse-flash_yy5uu_1`,turnErrorJump:`_turnErrorJump_yy5uu_493`,toolDelta:`_toolDelta_yy5uu_511`,toolAdd:`_toolAdd_yy5uu_519`,toolDel:`_toolDel_yy5uu_511`,toolNote:`_toolNote_yy5uu_522`},Vo=!1;function Ho(){Vo||(Vo=!0,na.addHook(`afterSanitizeAttributes`,e=>{e.tagName===`A`&&(e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`))}))}var Uo={USE_PROFILES:{html:!0},ADD_ATTR:[`target`],FORBID_TAGS:[`style`,`form`,`input`,`button`,`iframe`,`object`,`embed`]};function Wo(e){Ho();let t=Q.parse(e,{async:!1,gfm:!0,breaks:!1});return na.sanitize(t,Uo)}var Go=`Copy`,Ko=`Copied`;function qo(e){return/(?:^|\s)(?:language|lang)-([\w+#.-]+)/.exec(e?.className??``)?.[1]??``}function Jo({text:e,streaming:t=!1}){let n=(0,z.useMemo)(()=>Wo(e),[e]),r=(0,z.useRef)(null);(0,z.useEffect)(()=>{let e=r.current;if(e)for(let t of e.querySelectorAll(`pre`)){if(t.querySelector(`[data-code-head]`))continue;let e=document.createElement(`div`);e.className=$.codeHead??``,e.setAttribute(`data-code-head`,``);let n=qo(t.querySelector(`code`)),r=document.createElement(`span`);r.className=$.codeLang??``,r.textContent=n,e.append(r);let i=document.createElement(`button`);i.type=`button`,i.className=$.copy??``,i.setAttribute(`data-copy`,``),i.setAttribute(`aria-label`,`Copy code`),i.textContent=Go,e.append(i),t.prepend(e)}},[n]);function i(e){let t=e.target?.closest(`[data-copy]`);if(!t)return;e.preventDefault();let n=t.closest(`pre`),r=n?.querySelector(`code`),i=n?.querySelector(`[data-code-head]`);Yo(r?r.textContent??``:Array.from(n?.childNodes??[]).filter(e=>e!==i).map(e=>e.textContent??``).join(``)).then(e=>{t.textContent=e?Ko:`Copy failed`,setTimeout(()=>{t.textContent=Go},1500)})}return(0,V.jsx)(`div`,{ref:r,className:`${$.markdown} ${t?$.streaming:``}`,onClick:i,dangerouslySetInnerHTML:{__html:n}})}async function Yo(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.append(t),t.select();let n=document.execCommand(`copy`);return t.remove(),n}catch{return!1}}var Xo=/\u001B\[[0-9;:?]*[ -/]*[@-~]/g,Zo=/\u001B\][\s\S]*?(?:\u0007|\u001B\\)/g,Qo=/\u001B[@-Z\\-_]/g,$o=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g;function es(e){return e.includes(`\x1B`)}function ts(e){return e.replace(Zo,``).replace(Xo,``).replace(Qo,``).replace($o,``)}function ns(e){return e.includes(`\r`)?e.split(`
76
+ `).map(e=>{if(!e.includes(`\r`))return e;let t=``;for(let n of e.split(`\r`))t=n.length>=t.length?n:n+t.slice(n.length);return t}).join(`
77
+ `):e}function rs(e){return ns(ts(e)).replace(/[ \t]+$/gm,``).replace(/\n+$/,``)}function is(e){if(e.length===0)return 0;let t=1;for(let n=0;n<e.length;n++)e.charCodeAt(n)===10&&t++;return t}function as(e,t){let n=e.split(`
78
+ `);return n.length<=t?{head:e,hidden:0}:{head:n.slice(0,t).join(`
79
+ `),hidden:n.length-t}}var os=20,ss=2e5;function cs({command:e,output:t,isError:n,pending:r,body:i}){let[a,o]=(0,z.useState)(!1),s=(0,z.useMemo)(()=>{let e=rs(t);return e.length>ss?`${e.slice(0,ss)}\n… (${e.length-ss} more characters not shown)`:e},[t]),{head:c,hidden:l}=(0,z.useMemo)(()=>as(s,os),[s]),u=a?s:c,d=e?.exitCode??null;return(0,V.jsxs)(`div`,{className:q.command,"data-failed":n?`true`:void 0,children:[e?(0,V.jsxs)(`div`,{className:q.commandLine,children:[(0,V.jsx)(`span`,{className:q.commandPrompt,"aria-hidden":`true`,children:`$`}),(0,V.jsx)(`code`,{className:q.commandText,children:e.command})]}):null,(0,V.jsxs)(`div`,{className:q.commandStatus,children:[(0,V.jsx)(`span`,{className:q.commandStatusText,"data-tone":r?`pending`:n?`bad`:`ok`,children:r?`running…`:d===null?n?`failed — no exit code reported`:`completed — no exit code reported`:`exit ${d}`}),!r&&!i&&s.length===0?(0,V.jsx)(`span`,{className:q.commandMeta,children:`no output`}):null,!r&&!i&&s.length>0?(0,V.jsxs)(`span`,{className:q.commandMeta,children:[is(s),` line`,is(s)===1?``:`s`,es(t)?` · colour codes stripped`:``]}):null]}),r?(0,V.jsx)(`p`,{className:q.commandPending,children:`Waiting for the command to finish…`}):i||(s.length>0?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`pre`,{className:q.commandPre,children:u}),l>0?(0,V.jsx)(`button`,{type:`button`,className:q.commandMore,"aria-expanded":a,onClick:()=>o(e=>!e),children:a?`Collapse output`:`Show ${l} more line${l===1?``:`s`}`}):null]}):null)]})}var ls=28,us=18,ds=4e3;function fs({diff:e,path:t=null}){let n=(0,z.useMemo)(()=>w(e.text),[e.text]);if(n.files.length===0)return null;if(e.multiFile||n.files.length>1)return(0,V.jsx)(`div`,{className:q.diffMulti,children:(0,V.jsx)(E,{diff:e.text,proposalKind:`tool call`})});let r=n.files[0];return(0,V.jsx)(ms,{file:r,anchored:e.anchored,path:t??r.displayPath})}function ps(e){switch(e.status){case`renamed`:return`Renamed. The contents did not change, so there are no lines to show.`;case`added`:return`New file. It was added with no contents to diff against.`;case`deleted`:return`Deleted. The file is gone, so there are no lines to show.`;default:return null}}function ms({file:e,anchored:t,path:n}){let[r,i]=(0,z.useState)(!1),a=T(n),o=(0,z.useMemo)(()=>hs(e.hunks),[e.hunks]),s=o.length>ls,c=s&&!r?o.slice(0,us):o,l=o.length-c.length,u=e.status===`renamed`?e.oldPath:null,d=ps(e);return(0,V.jsxs)(`div`,{className:q.diff,"data-anchored":t?`true`:`false`,"data-status":e.status,children:[(0,V.jsxs)(`div`,{className:q.diffHead,children:[u?(0,V.jsxs)(`span`,{className:q.diffOldPath,title:u,children:[u,(0,V.jsx)(`span`,{className:q.visuallyHidden,children:` renamed to`})]}):null,(0,V.jsx)(`span`,{className:q.diffPath,title:n,children:n}),e.status===`modified`?null:(0,V.jsx)(`span`,{className:q.diffStatus,children:e.status}),(0,V.jsxs)(`span`,{className:q.diffStats,children:[e.additions>0?(0,V.jsxs)(`span`,{className:q.diffAdd,children:[`+`,e.additions]}):null,e.deletions>0?(0,V.jsxs)(`span`,{className:q.diffDel,children:[`−`,e.deletions]}):null]})]}),e.unparsedNotice?(0,V.jsx)(`pre`,{className:q.diffNotice,children:e.unparsedNotice}):null,o.length===0?(0,V.jsx)(`p`,{className:q.diffEmpty,children:d??`No line-level changes in this call.`}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`table`,{className:q.diffTable,children:(0,V.jsx)(`tbody`,{children:c.map(e=>e.kind===`hunk`?(0,V.jsxs)(`tr`,{className:q.diffHunkRow,children:[t?(0,V.jsx)(`td`,{className:q.diffNo,"aria-hidden":`true`}):null,(0,V.jsx)(`td`,{className:q.diffMarker,"aria-hidden":`true`}),(0,V.jsx)(`td`,{className:q.diffHunkHead,children:e.label})]},e.key):(0,V.jsxs)(`tr`,{className:q[`diffRow_${e.line.kind}`],children:[t?(0,V.jsx)(`td`,{className:q.diffNo,children:e.line.newLineNo??e.line.oldLineNo??``}):null,(0,V.jsx)(`td`,{className:q.diffMarker,"aria-hidden":`true`,children:e.line.kind===`add`?`+`:e.line.kind===`del`?`−`:``}),(0,V.jsx)(`td`,{className:q.diffText,children:(0,V.jsx)(gs,{text:e.line.text,lang:a})})]},e.key))})}),s?(0,V.jsx)(`button`,{type:`button`,className:q.diffMore,onClick:()=>i(e=>!e),"aria-expanded":r,children:r?`Collapse diff`:`Show ${l} more line${l===1?``:`s`}`}):null]}),t?null:(0,V.jsx)(`p`,{className:q.diffUnanchored,children:`Line numbers are not shown — this tool call reported what it replaced, not where in the file.`})]})}function hs(e){let t=[],n=!1;return e.forEach((r,i)=>{if(n)return;let a=r.header.replace(/^@@[^@]*@@/,``).trim();(a||e.length>1)&&t.push({kind:`hunk`,key:`h${i}`,label:a||`hunk ${i+1}`});for(let e=0;e<r.lines.length;e++){if(t.length>=ds){n=!0,t.push({kind:`hunk`,key:`truncated`,label:`diff truncated at ${ds} lines`});return}t.push({kind:`line`,key:`h${i}l${e}`,line:r.lines[e]})}}),t}function gs({text:e,lang:t}){let n=te(e,t);return(0,V.jsx)(`code`,{className:q.diffCode,children:n.map((e,t)=>(0,V.jsx)(`span`,{className:q[`tok_${e.kind}`],children:e.text},t))})}var _s=2e4;function vs({name:e,input:t,result:n,toolUseId:r,durationMs:i=null,facts:a}){let o=(0,z.useMemo)(()=>a??sr({name:e,input:t,result:n}),[a,e,t,n]),s=we(t),c=o.failed||n?.isError===!0,l=n===null,u=l?`running`:c?`error`:i!==null&&i>0?Ce(i):`done`,d=(0,z.useMemo)(()=>o.diff?mr(o.diff.text):null,[o.diff]),f=n?n.output.length>_s?`${n.output.slice(0,_s)}\n… (${n.output.length-_s} more characters)`:n.output:``;return(0,V.jsxs)(`details`,{id:cr(r),className:`${$.tool} ${c?$.toolFailed:``}`,"data-state-key":`tool:${r}`,"data-action":o.action,children:[(0,V.jsxs)(`summary`,{className:$.toolLine,"aria-label":`${e}${s?`: ${s}`:``} (${u})`,children:[(0,V.jsx)(`span`,{className:$.toolGlyph,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:$.toolName,children:e}),s?(0,V.jsx)(`span`,{className:$.toolArg,title:s,children:s}):null,d&&(d.additions>0||d.deletions>0)?(0,V.jsxs)(`span`,{className:$.toolDelta,"aria-hidden":`true`,children:[d.additions>0?(0,V.jsxs)(`span`,{className:$.toolAdd,children:[`+`,d.additions]}):null,d.deletions>0?(0,V.jsxs)(`span`,{className:$.toolDel,children:[`−`,d.deletions]}):null]}):null,(0,V.jsx)(`span`,{className:$.toolState,children:u})]}),(0,V.jsx)(`div`,{className:$.toolBody,children:(0,V.jsx)(ys,{input:t,output:f,facts:o,pending:l,isError:c})})]})}function ys({input:e,output:t,facts:n,pending:r,isError:i}){return n.command?(0,V.jsx)(cs,{command:n.command,output:t,isError:i,pending:r,body:n.diff?(0,V.jsx)(fs,{diff:n.diff,path:n.paths[0]??null}):void 0}):n.diff?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(fs,{diff:n.diff,path:n.paths[0]??null}),r?(0,V.jsx)(`p`,{className:$.toolPending,children:`Waiting for the tool to finish…`}):null,i&&t?(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h4`,{className:$.toolLabel,children:`Error`}),(0,V.jsx)(`pre`,{className:$.toolPre,children:t})]}):null]}):n.written?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`section`,{children:[(0,V.jsxs)(`h4`,{className:$.toolLabel,children:[`Contents written to `,n.written.path]}),(0,V.jsx)(`pre`,{className:$.toolPre,children:n.written.text}),(0,V.jsx)(`p`,{className:$.toolNote,children:`The previous contents were not in this tool call, so there is nothing to diff against.`})]}),(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h4`,{className:$.toolLabel,children:i?`Error`:`Result`}),r?(0,V.jsx)(`p`,{className:$.toolPending,children:`Waiting for the tool to finish…`}):(0,V.jsx)(`pre`,{className:$.toolPre,children:t||`(empty)`})]})]}):(0,V.jsxs)(V.Fragment,{children:[e==null?null:(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h4`,{className:$.toolLabel,children:`Input`}),(0,V.jsx)(`pre`,{className:$.toolPre,children:De(e)})]}),(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h4`,{className:$.toolLabel,children:i?`Error`:`Result`}),r?(0,V.jsx)(`p`,{className:$.toolPending,children:`Waiting for the tool to finish…`}):(0,V.jsx)(`pre`,{className:$.toolPre,children:t||`(empty)`})]})]})}var bs=48,xs=3,Ss=1400;function Cs({transcript:e,loaded:t,loadError:n,onRetry:r,emptyHint:i}){let a=(0,z.useRef)(null),o=(0,z.useRef)(new Map),s=(0,z.useRef)(null),[c,l]=(0,z.useState)(!0),[u,d]=(0,z.useState)(!1),[f,p]=(0,z.useState)(``),[h,g]=(0,z.useState)(-1),[_,v]=(0,z.useState)(0),y=(0,z.useRef)(0),b=(0,z.useRef)(lr()),x=(0,z.useMemo)(()=>en(e.items),[e.items]),S=(0,z.useMemo)(()=>_r(x,b.current),[x]),C=(0,z.useMemo)(()=>Tr(S.turns,f,b.current),[S.turns,f]),ee=(0,z.useMemo)(()=>new Set(C.map(e=>e.turnKey)),[C]),w=(0,z.useMemo)(()=>{let t=new Set,n=null;for(let r of e.items)r.kind===`turn-done`&&!r.ok&&n&&n.turnId===r.turnId&&(n.kind===`cancelled`||n.kind===`error`)&&t.add(r.key),n={turnId:r.turnId,kind:r.kind};return t},[e.items]),T=(0,z.useCallback)((e=`auto`)=>{let t=a.current;t&&(typeof t.scrollTo==`function`?t.scrollTo({top:t.scrollHeight,behavior:e}):t.scrollTop=t.scrollHeight)},[]);function te(){let e=a.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<=bs;l(t),t&&d(!1)}let E=(0,z.useCallback)(e=>{e&&(l(!1),typeof e.scrollIntoView==`function`&&e.scrollIntoView({block:`center`,behavior:`smooth`}),typeof e.focus==`function`&&e.focus({preventScroll:!0}),e.setAttribute(`data-flash`,`true`),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>e.removeAttribute(`data-flash`),Ss))},[]);(0,z.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]);let D=(0,z.useCallback)(e=>{E(o.current.get(e)??null)},[E]),O=(0,z.useCallback)(e=>{let t=a.current?.ownerDocument?.getElementById(e)??null;if(t){for(let e=t;e&&(e instanceof HTMLDetailsElement&&(e.open=!0),e!==a.current);e=e.parentElement);E(t)}},[E]),k=(0,z.useCallback)(e=>O(cr(e)),[O]),ne=(0,z.useCallback)(()=>{let e=S.errorAnchors[0];e&&O(e)},[S.errorAnchors,O]),A=(0,z.useCallback)(e=>{if(C.length===0)return;let t=h<0?e>0?0:C.length-1:(h+e+C.length)%C.length;g(t),D(C[t].turnKey)},[C,h,D]);(0,z.useEffect)(()=>{g(-1)},[f]);let j=(0,z.useCallback)(e=>{let t=S.turns;if(t.length===0)return;let n=a.current?.ownerDocument?.activeElement,r=n instanceof HTMLElement?n.getAttribute(`data-turn-key`):null,i=r?t.findIndex(e=>e.key===r):-1,o=i<0?e>0?0:t.length-1:Math.max(0,Math.min(t.length-1,i+e));D(t[o].key)},[S.turns,D]);(0,z.useEffect)(()=>{if(S.turns.length===0)return;let e=e=>{let t=e.target,n=t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement||t?.isContentEditable===!0;if((e.metaKey||e.ctrlKey)&&!e.shiftKey&&!e.altKey&&e.key.toLowerCase()===`f`){if(S.turns.length<xs)return;e.preventDefault(),v(e=>e+1);return}e.altKey&&!e.metaKey&&!e.ctrlKey&&!n&&(e.key===`ArrowDown`?(e.preventDefault(),j(1)):e.key===`ArrowUp`&&(e.preventDefault(),j(-1)))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[S.turns.length,j]);function M(e){e.target?.hasAttribute(`data-turn-key`)&&(e.key===`ArrowDown`?(e.preventDefault(),j(1)):e.key===`ArrowUp`?(e.preventDefault(),j(-1)):e.key===`Home`?(e.preventDefault(),D(S.turns[0].key)):e.key===`End`&&(e.preventDefault(),D(S.turns[S.turns.length-1].key)))}if((0,z.useLayoutEffect)(()=>{let t=e.items.length,n=e.items[t-1],r=t!==y.current||n?.kind===`assistant`&&n.streaming;y.current=t,r&&(c?T():d(!0))},[e,c,T]),(0,z.useEffect)(()=>{t&&T()},[t,T]),!t&&!n)return(0,V.jsx)(`div`,{className:$.transcript,"aria-busy":`true`,children:(0,V.jsxs)(`div`,{className:$.skeleton,children:[(0,V.jsx)(`div`,{className:$.skeletonUser,children:(0,V.jsx)(m,{width:`42%`})}),(0,V.jsx)(m,{width:`88%`}),(0,V.jsx)(m,{width:`72%`}),(0,V.jsx)(m,{width:`80%`}),(0,V.jsx)(`div`,{className:$.skeletonUser,children:(0,V.jsx)(m,{width:`30%`})}),(0,V.jsx)(m,{width:`64%`})]})});if(n)return(0,V.jsx)(`div`,{className:$.transcript,children:(0,V.jsxs)(`div`,{role:`alert`,className:$.loadError,children:[(0,V.jsx)(`p`,{children:n}),r?(0,V.jsx)(`button`,{type:`button`,onClick:r,children:`Retry`}):null]})});let N=h>=0?C[h]?.turnKey??null:null;return(0,V.jsxs)(`div`,{className:$.transcriptWrap,children:[S.turns.length>=xs?(0,V.jsx)(Mr,{turns:S.turns,query:f,onQuery:p,matches:C,matchIndex:h,onStepMatch:A,errorCount:S.errorAnchors.length,onJumpError:ne,onJumpTurn:D,focusToken:_}):null,(0,V.jsxs)(`div`,{ref:a,className:$.transcript,onScroll:te,role:`log`,"aria-live":`polite`,"aria-relevant":`additions text`,children:[e.items.length===0?(0,V.jsxs)(`div`,{className:$.empty,children:[(0,V.jsx)(`p`,{className:$.emptyTitle,children:`Say something to begin.`}),(0,V.jsx)(`p`,{className:$.emptyBody,children:i??`The agent can read and edit this project. Ask for a change, a review, or an explanation.`})]}):null,(0,V.jsxs)(`ol`,{className:$.list,onKeyDown:M,children:[S.turns.map((e,t)=>(0,V.jsxs)(`li`,{id:fr(e.key),ref:t=>{t?o.current.set(e.key,t):o.current.delete(e.key)},className:$.turn,"data-turn-key":e.key,"data-status":e.status,"data-match":ee.has(e.key)?e.key===N?`active`:`true`:void 0,tabIndex:-1,"aria-label":`Turn ${t+1} of ${S.turns.length}`,children:[(0,V.jsx)(`ol`,{className:$.turnItems,children:e.items.map(e=>ws(e,S.facts,w))}),e.files.length>0?(0,V.jsx)(kr,{files:e.files,onJump:k}):null,e.errorCount>0&&e.firstErrorAnchor?(0,V.jsxs)(`button`,{type:`button`,className:$.turnErrorJump,onClick:()=>O(e.firstErrorAnchor),children:[e.errorCount,` failure`,e.errorCount===1?``:`s`,` in this turn — jump to the first`]}):null]},e.key)),e.live&&!e.items.some(e=>e.kind===`assistant`&&e.streaming)?(0,V.jsx)(`li`,{className:`${$.item} ${$.assistant}`,"data-kind":`pending`,"aria-label":`Waiting for the agent`,children:(0,V.jsx)(`span`,{className:$.caret,"aria-hidden":`true`})}):null]})]}),c?null:(0,V.jsxs)(`button`,{type:`button`,className:`${$.jump} ${u?$.jumpUnseen:``}`,onClick:()=>{l(!0),d(!1),T(`smooth`)},children:[(0,V.jsx)(P,{size:12}),` Jump to latest`]})]})}function ws(e,t,n){switch(e.kind){case`user`:return(0,V.jsx)(`li`,{className:`${$.item} ${$.user}`,"data-kind":`user`,children:(0,V.jsx)(`div`,{className:$.userText,children:e.text})},e.key);case`assistant`:return(0,V.jsx)(`li`,{className:`${$.item} ${$.assistant}`,"data-kind":`assistant`,"data-streaming":e.streaming||void 0,children:(0,V.jsx)(Jo,{text:e.text,streaming:e.streaming})},e.key);case`thinking`:return(0,V.jsx)(`li`,{className:$.item,"data-kind":`thinking`,children:(0,V.jsx)(Ts,{item:e})},e.key);case`tool`:return(0,V.jsx)(`li`,{className:$.item,"data-kind":`tool`,children:(0,V.jsx)(vs,{name:e.name,input:e.input,result:e.result,toolUseId:e.toolUseId,durationMs:e.durationMs,facts:t.get(e.toolUseId)})},e.key);case`toolGroup`:return(0,V.jsx)(`li`,{className:$.item,"data-kind":`tool-group`,children:(0,V.jsx)(Es,{item:e,facts:t})},e.key);case`error`:return(0,V.jsx)(`li`,{className:$.item,"data-kind":`error`,children:(0,V.jsx)(`div`,{id:dr(e.key),role:`alert`,className:`${$.note} ${$.noteError}`,children:e.message})},e.key);case`cancelled`:return(0,V.jsx)(`li`,{className:$.item,"data-kind":`cancelled`,children:(0,V.jsx)(`div`,{className:$.note,children:`Stopped.`})},e.key);case`turn-done`:return e.ok||n.has(e.key)?e.durationMs>0?(0,V.jsx)(`li`,{className:`${$.item} ${$.meta}`,"data-kind":`turn-done`,children:(0,V.jsx)(`span`,{className:$.metaText,children:Ce(e.durationMs)})},e.key):null:(0,V.jsx)(`li`,{className:$.item,"data-kind":`turn-done`,children:(0,V.jsxs)(`div`,{id:dr(e.key),className:`${$.note} ${$.noteError}`,children:[`Turn ended without a result (`,(0,V.jsx)(`span`,{className:$.noteDuration,children:Ce(e.durationMs)}),`).`]})},e.key);default:return null}}function Ts({item:e}){return(0,V.jsxs)(`details`,{className:$.thinking,"data-state-key":`thinking:${e.key}`,children:[(0,V.jsx)(`summary`,{className:$.thinkingSummary,children:`Thinking`}),(0,V.jsx)(`div`,{className:$.thinkingBody,children:e.text})]})}function Es({item:e,facts:t}){let n=e.pending?`running`:e.errorCount>0?`${e.errorCount} failed`:e.spanMs!==null&&e.spanMs>0?Ce(e.spanMs):`done`,r=`${e.toolCount} tool${e.toolCount===1?``:`s`}`;return(0,V.jsxs)(`details`,{className:`${$.toolRun} ${e.errorCount>0?$.toolFailed:``}`,"data-state-key":`toolgroup:${e.key}`,children:[(0,V.jsxs)(`summary`,{className:$.toolLine,"aria-label":`${r}: ${e.summary} (${n})`,children:[(0,V.jsx)(`span`,{className:$.toolGlyph,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:$.toolName,children:r}),e.summary?(0,V.jsx)(`span`,{className:$.toolArg,title:e.summary,children:e.summary}):null,(0,V.jsx)(`span`,{className:$.toolState,children:n})]}),(0,V.jsx)(`div`,{className:$.toolRunBody,children:(0,V.jsx)(`ol`,{className:$.toolRunList,children:e.items.map(e=>(0,V.jsx)(`li`,{"data-member":e.kind,children:e.kind===`tool`?(0,V.jsx)(vs,{name:e.name,input:e.input,result:e.result,toolUseId:e.toolUseId,durationMs:e.durationMs,facts:t.get(e.toolUseId)}):(0,V.jsx)(Ts,{item:e})},e.key))})})]})}var Ds=3e4;function Os(e=!0){let t=b(ue);(0,z.useEffect)(()=>{if(!e)return;let n=()=>{(typeof document>`u`||document.visibilityState!==`hidden`)&&t()},r=window.setInterval(n,Ds);return document.addEventListener(`visibilitychange`,n),()=>{window.clearInterval(r),document.removeEventListener(`visibilitychange`,n)}},[e,t])}function ks(e){let{view:t,seats:n,projects:r,dispatchEnabled:i,locked:a,hasAnySessions:o,onSend:s,onStop:c,onRename:l,onDelete:u,onSeatChange:d,onNew:f,onRetry:p,sidebarCollapsed:m,onToggleSidebar:h,resourcesOpen:g,onToggleResources:_}=e,v=t.session,[y,b]=(0,z.useState)(!1),[x,S]=(0,z.useState)(``),[C,ee]=(0,z.useState)(!1),[w,T]=(0,z.useState)(!1),te=(0,z.useRef)(null),E=(0,z.useId)();Os(),(0,z.useEffect)(()=>{b(!1),ee(!1)},[t.sessionId]),(0,z.useEffect)(()=>{y&&te.current?.select()},[y]);let D=(0,V.jsx)(V.Fragment,{children:m?(0,V.jsx)(`button`,{type:`button`,className:K.ghostIcon,onClick:h,title:`Show chat list`,"aria-label":`Show chat list`,children:(0,V.jsx)(j,{})}):null});if(!t.sessionId)return(0,V.jsxs)(`section`,{className:K.workspace,"aria-label":`Chat`,children:[(0,V.jsxs)(`header`,{className:K.header,"data-app-region":`drag`,children:[D,(0,V.jsx)(`div`,{className:K.headerSpacer}),(0,V.jsx)(As,{open:g,onToggle:_})]}),(0,V.jsxs)(`div`,{className:K.emptyState,children:[(0,V.jsx)(`span`,{className:K.emptyMark,"aria-hidden":`true`,children:(0,V.jsx)(se,{size:36})}),(0,V.jsx)(`h1`,{className:K.emptyTitle,children:o?`Pick a chat, or start a new one`:`No chats yet — ⌘N`}),(0,V.jsx)(`p`,{className:K.emptyBody,children:`Open a project, choose a seat — a Claude or Codex account, Grok, or a local Ollama model — and talk to an agent that can edit that project.`}),(0,V.jsxs)(`button`,{type:`button`,className:K.emptyButton,onClick:f,children:[`New chat `,(0,V.jsx)(`kbd`,{children:`⌘N`})]}),i?null:(0,V.jsxs)(`p`,{className:K.emptyWarn,role:`status`,children:[`This server was started without dispatch, so chats are read-only here. Run `,(0,V.jsx)(`code`,{children:`ashlr verse`}),` to enable sending.`]})]})]});async function O(){let e=x.trim();if(b(!1),v&&e&&e!==v.title){T(!0);try{await l(e)}finally{T(!1)}}}function k(e){e.key===`Enter`?(e.preventDefault(),O()):e.key===`Escape`&&(e.preventDefault(),b(!1))}let ne=v?.status===`running`,A=v?Ie(n,v):null,M=v?Me(n,v.seatId)??null:null,N=M===null?null:et(M),re=v===null?``:`${M===null||N===null?Se(n,v):nt(M,N)} · ${v.projectPath}`,ie=i?null:`Sending is disabled: this server was started without dispatch.`;return(0,V.jsxs)(`section`,{className:K.workspace,"aria-labelledby":E,children:[(0,V.jsxs)(`header`,{className:K.header,"data-app-region":`drag`,children:[D,v?y?(0,V.jsx)(`input`,{ref:te,className:K.titleInput,value:x,"aria-label":`Chat title`,onChange:e=>S(e.target.value),onBlur:()=>{O()},onKeyDown:k,maxLength:120}):(0,V.jsx)(`h1`,{id:E,className:K.title,children:(0,V.jsx)(`button`,{type:`button`,className:K.titleButton,title:`Rename chat`,disabled:w||!i,onClick:()=>{S(v.title),b(!0)},children:v.title||`Untitled chat`})}):(0,V.jsx)(`h1`,{id:E,className:`${K.title} skeleton ${K.titleSkeleton}`,"aria-label":`Loading chat`}),v?(0,V.jsxs)(`span`,{className:`${K.seatPill} ${K[`engine-${v.engine}`]??``}`,"data-engine":v.engine,"data-seat-capacity":N!==null&&rt(N.cls)?N.cls:void 0,title:re,children:[(0,V.jsx)(`span`,{className:K.engineDot,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:K.seatText,children:Se(n,v)}),(0,V.jsx)(`span`,{className:K.projectName,children:Fe(v.projectPath,r)}),N!==null&&rt(N.cls)?(0,V.jsx)(at,{view:N}):null]}):null,(0,V.jsx)(`div`,{className:K.headerSpacer}),t.stream===`reconnecting`?(0,V.jsx)(`span`,{className:K.streamState,role:`status`,children:`reconnecting…`}):null,v?(0,V.jsx)(yn,{contextTokens:v.usage.contextTokens,contextWindow:A}):null,v?C?(0,V.jsxs)(`span`,{className:K.confirm,role:`group`,"aria-label":`Confirm delete`,children:[(0,V.jsx)(`span`,{className:K.confirmText,children:`Delete this chat?`}),(0,V.jsx)(`button`,{type:`button`,className:K.danger,disabled:w,onClick:async()=>{T(!0);try{await u()||ee(!1)}finally{T(!1)}},children:`Delete`}),(0,V.jsx)(`button`,{type:`button`,className:K.ghost,onClick:()=>ee(!1),children:`Keep`})]}):(0,V.jsx)(`button`,{type:`button`,className:K.ghostIcon,onClick:()=>ee(!0),disabled:!i||ne,"aria-label":`Delete chat`,title:ne?`Stop the turn before deleting`:`Delete chat`,children:(0,V.jsx)(ce,{})}):null,(0,V.jsx)(As,{open:g,onToggle:_})]}),(0,V.jsx)(Cs,{transcript:t.transcript,loaded:t.loaded,loadError:t.loadError,onRetry:p}),v?(0,V.jsx)(On,{sessionId:v.id,seats:n,seat:{seatId:v.seatId,model:v.model},engine:v.engine,running:ne,disabled:!i,disabledReason:ie,locked:a,hintSeen:v.turnCount>0,contextTokens:v.usage.contextTokens,contextWindow:A,onSend:s,onStop:c,onSeatChange:d,autoFocus:!0},v.id):null]})}function As({open:e,onToggle:t}){return(0,V.jsx)(`button`,{type:`button`,className:K.ghostIcon,onClick:t,"aria-pressed":e,title:e?`Hide resources`:`Show resources`,"aria-label":`Resources`,children:(0,V.jsx)(A,{})})}var js={chat:`_chat_fzgvr_6`,main:`_main_fzgvr_30`,banner:`_banner_fzgvr_40`,bannerWarn:`_bannerWarn_fzgvr_41`,resize:`_resize_fzgvr_75`,scrim:`_scrim_fzgvr_94`},Ms=`ashlr.verse.selected.v1`;function Ns(){try{return localStorage.getItem(Ms)}catch{return null}}function Ps(e){return e instanceof f?"This server was started without dispatch — run `ashlr verse` to chat.":e instanceof v?e.status===409?`A turn is already running in this chat. Stop it first.`:e.status===413?`That message is too large (64 KB max).`:e.status===401?`Mutation token was rejected. Unlock again with the token ashlr verse printed.`:e.message:e instanceof Error?e.message:`Something went wrong.`}function Fs(){let e=y(ue),t=y(ve),n=d(ve),r=d(ue),i=u(),a=C(),o=fe(),[s,l]=(0,z.useState)(Ns),[f,p]=(0,z.useState)(``),[m,g]=(0,z.useState)({open:!1}),[_,v]=(0,z.useState)(!1),[b,x]=(0,z.useState)(null),[S,w]=(0,z.useState)(!1),[T,te]=(0,z.useState)(0),[E,O]=(0,z.useState)({open:!1,reason:``}),A=(0,z.useRef)(null),j=(0,z.useRef)(null),M=(0,z.useMemo)(()=>e.data?.seats??[],[e.data]),P=(0,z.useMemo)(()=>e.data?.projects??[],[e.data]),oe=y(he),se=(0,z.useMemo)(()=>oe.data?.workspaces??[],[oe.data]),ce=e.data?.dispatchEnabled??!0,F=_n(s,T),de=(0,z.useMemo)(()=>{let n=t.data??e.data?.sessions??[];if(!F.session)return n;let r=F.session;return n.some(e=>e.id===r.id)?n.map(e=>e.id===r.id?r:e):[r,...n]},[t.data,e.data,F.session]),_e=(0,z.useCallback)(e=>{l(e);try{e?localStorage.setItem(Ms,e):localStorage.removeItem(Ms)}catch{}},[]);(0,z.useEffect)(()=>{s&&t.data&&!t.data.some(e=>e.id===s)&&!F.session&&_e(null)},[s,t.data,F.session,_e]),(0,z.useEffect)(()=>gn(),[]);let R=(0,z.useCallback)((e,t)=>i.hasHold?t():new Promise(n=>{A.current={run:()=>{t().then(n)},cancel:()=>n(null)},O({open:!0,reason:e})}),[i.hasHold]),be=(0,z.useCallback)(e=>{e instanceof xe||a.show(Ps(e),`danger`)},[a]),Se=(0,z.useCallback)((e={})=>{x(null);let t=F.session,n=e.projectPath===void 0?t?.projectPath??null:e.projectPath,r=t&&n===t.projectPath?{seatId:t.seatId,model:t.model}:null,i=e.seat??r??me(n);g({open:!0,projectPath:n,seat:i})},[F.session]),Ce=(0,z.useCallback)(async e=>{await R(`Starting a chat spawns an agent process for this project.`,async()=>{v(!0),x(null);try{let t=await ye(e);D(t.projectPath,{seatId:t.seatId,model:t.model}),Kt(t.id,t),g({open:!1}),_e(t.id),a.show(`Started “${t.title}”`,`success`)}catch(e){x(Ps(e))}finally{v(!1)}})},[R,_e,a]),we=(0,z.useCallback)(async e=>{let t=s;return t?await R(`Sending a message runs the agent against this project.`,async()=>{Jt(t,`running`);try{let n=await L(t,e);return Kt(t,n.session,n.turnId),!0}catch(e){return Jt(t,`idle`),be(e),!1}})===!0:!1},[s,R,be]),Te=(0,z.useCallback)((e=s)=>{e&&R(`Stopping the running turn.`,async()=>{try{await ge(e)}catch(e){be(e)}})},[s,R,be]),Ee=(0,z.useCallback)(async e=>{let t=s;return t?await R(`Renaming a chat.`,async()=>{try{let n=await le(t,e);return Kt(t,n),!0}catch(e){return be(e),!1}})===!0:!1},[s,R,be]),De=(0,z.useCallback)(async()=>{let e=s;return e?await R(`Deleting a chat removes its transcript from disk.`,async()=>{try{return await pe(e),Xt(e),c(e),_e(null),a.show(`Chat deleted.`,`neutral`),!0}catch(e){return be(e),!1}})===!0:!1},[s,R,be,_e,a]),Oe=(0,z.useCallback)(e=>{let t=F.session;t&&(Se({projectPath:t.projectPath,seat:e}),a.show(`Chats are bound to one seat — starting a new chat on the same project.`,`neutral`))},[F.session,Se,a]),ke=(0,z.useRef)(0);(0,z.useEffect)(()=>{let e=o.command;e&&e.nonce!==ke.current&&(ke.current=e.nonce,e.name===`quick-switcher`?w(!0):Se(),ie())},[o.command,F.session,Se]);let Ae=(0,z.useCallback)((e,t)=>{e===`sidebar`?ae(t):N(t)},[]);function je(e){return t=>{let n=e===`sidebar`?k:ne,r=e===`sidebar`?o.sidebarWidth:o.resourcesWidth,i=e===`sidebar`?t.key===`ArrowRight`:t.key===`ArrowLeft`,a=e===`sidebar`?t.key===`ArrowLeft`:t.key===`ArrowRight`,s=i?r+20:a?r-20:t.key===`Home`?n.min:t.key===`End`?n.max:null;s!==null&&(t.preventDefault(),Ae(e,s))}}function Me(e){let t=e===`sidebar`?k:ne,n=e===`sidebar`?o.sidebarWidth:o.resourcesWidth;return(0,V.jsx)(`div`,{className:js.resize,role:`separator`,tabIndex:0,"aria-orientation":`vertical`,"aria-label":e===`sidebar`?`Resize chat list`:`Resize resources panel`,"aria-valuemin":t.min,"aria-valuemax":t.max,"aria-valuenow":n,onKeyDown:je(e),onPointerDown:t=>{j.current={id:t.pointerId,x:t.clientX,start:n,side:e},t.currentTarget.setPointerCapture?.(t.pointerId)},onPointerMove:e=>{let t=j.current;if(!t||t.id!==e.pointerId)return;let n=e.clientX-t.x;Ae(t.side,t.side===`sidebar`?t.start+n:t.start-n)},onPointerUp:()=>{j.current=null},onPointerCancel:()=>{j.current=null}})}let Ne={"--verse-sidebar-width":`${o.sidebarWidth}px`,"--verse-resources-width":`${o.resourcesWidth}px`},Pe=e.data?!e.data.dispatchEnabled:!1,Fe=o.resourcesOpen,Ie=o.sidebarCollapsed;return(0,V.jsxs)(`div`,{className:js.chat,style:Ne,"data-sidebar":Ie?`collapsed`:`open`,"data-resources":Fe?`open`:`closed`,children:[(0,V.jsx)(un,{sessions:de,sessionsStatus:t.status,sessionsError:t.error?.message??null,projects:P,seats:M,selectedId:s,query:f,onQuery:p,onSelect:e=>{_e(e),window.matchMedia?.(`(max-width: 760px)`)?.matches===!0&&re(!0)},onNew:()=>Se(),onRetry:()=>{n(),r()},onCollapse:()=>re(!0),onDisconnect:()=>{h()}}),Me(`sidebar`),(0,V.jsx)(`button`,{type:`button`,className:js.scrim,"aria-label":`Close chat list`,tabIndex:-1,onClick:()=>re(!0)}),(0,V.jsxs)(`div`,{className:js.main,children:[e.status===`error`&&!e.data?(0,V.jsxs)(`div`,{role:`alert`,className:js.banner,children:[(0,V.jsx)(`span`,{children:e.error?.message??`Could not load Verse.`}),(0,V.jsx)(`button`,{type:`button`,onClick:r,children:`Retry`})]}):Pe?(0,V.jsxs)(`div`,{role:`status`,className:js.bannerWarn,children:[`Read-only: this server was started without dispatch. Run `,(0,V.jsx)(`code`,{children:`ashlr verse`}),` to send messages.`]}):null,(0,V.jsx)(ks,{view:F,seats:M,projects:P,dispatchEnabled:ce,locked:!i.hasHold,hasAnySessions:de.length>0,onSend:we,onStop:()=>Te(),onRename:Ee,onDelete:De,onSeatChange:Oe,onNew:()=>Se(),onRetry:()=>te(e=>e+1),sidebarCollapsed:Ie,onToggleSidebar:()=>re(!Ie),resourcesOpen:Fe,onToggleResources:()=>I(!Fe)})]}),Fe?(0,V.jsxs)(V.Fragment,{children:[Me(`resources`),(0,V.jsx)(ln,{bootstrap:e.data,sessions:de,current:F.session,onStop:e=>Te(e),onOpen:_e,onClose:()=>I(!1)})]}):null,(0,V.jsx)(mt,{open:m.open,onClose:()=>g({open:!1}),projects:P,seats:M,workspaces:se,initialProjectPath:m.projectPath??null,initialSeat:m.seat??null,busy:_,error:b,onCreate:Ce}),(0,V.jsx)(gt,{open:S,onClose:()=>w(!1),sessions:de,seats:M,projects:P,onSelectSession:_e,onNewChat:e=>Se({projectPath:F.session?.projectPath??null,seat:e})}),(0,V.jsx)(ee,{open:E.open,reason:E.reason,tokenLabel:`Mutation token`,tokenHelp:`the mutation token ashlr verse printed`,onClose:()=>{O({open:!1,reason:``});let e=A.current;e&&setTimeout(()=>{A.current===e&&(A.current=null,e.cancel())},0)},onUnlocked:()=>{let e=A.current;A.current=null,e?.run()}})]})}export{Fs as ChatSection};
80
+ //# sourceMappingURL=ChatSection-5irrh6Jw.js.map