@smartmemory/compose 0.2.51 → 0.2.52-beta

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 (64) hide show
  1. package/dist/assets/App-Ddhfx18X.js +889 -0
  2. package/dist/assets/{_baseUniq-CsOHc_iS.js → _baseUniq-CoEVVYyC.js} +1 -1
  3. package/dist/assets/{arc-BXht3LyE.js → arc-DFnGxuCB.js} +1 -1
  4. package/dist/assets/{architectureDiagram-Q4EWVU46-BV1r86-w.js → architectureDiagram-Q4EWVU46-66rx01Tn.js} +1 -1
  5. package/dist/assets/{blockDiagram-DXYQGD6D-BgcMJjAR.js → blockDiagram-DXYQGD6D-AE5PKSak.js} +1 -1
  6. package/dist/assets/{c4Diagram-AHTNJAMY-nBIRLJTv.js → c4Diagram-AHTNJAMY-DtDSNlOX.js} +1 -1
  7. package/dist/assets/channel-CScyWprq.js +1 -0
  8. package/dist/assets/{chunk-4BX2VUAB-CNmGyhrp.js → chunk-4BX2VUAB-oXU2npoL.js} +1 -1
  9. package/dist/assets/{chunk-4TB4RGXK-MLT7I7w4.js → chunk-4TB4RGXK-5w2lZAjW.js} +1 -1
  10. package/dist/assets/{chunk-55IACEB6-D8KuKVLa.js → chunk-55IACEB6-BEEk2FdH.js} +1 -1
  11. package/dist/assets/{chunk-EDXVE4YY-TPlt1bS2.js → chunk-EDXVE4YY-Bse2kdRh.js} +1 -1
  12. package/dist/assets/{chunk-FMBD7UC4-tYY8xcjr.js → chunk-FMBD7UC4-BAa7Edp6.js} +1 -1
  13. package/dist/assets/{chunk-OYMX7WX6-yBPwT1AT.js → chunk-OYMX7WX6-CGr_YiAc.js} +1 -1
  14. package/dist/assets/{chunk-QZHKN3VN-B4Wfybww.js → chunk-QZHKN3VN-BMWFLZ8t.js} +1 -1
  15. package/dist/assets/{chunk-YZCP3GAM-DE6_5aqh.js → chunk-YZCP3GAM-CqjNXooj.js} +1 -1
  16. package/dist/assets/classDiagram-6PBFFD2Q-DibVYYdr.js +1 -0
  17. package/dist/assets/classDiagram-v2-HSJHXN6E-DibVYYdr.js +1 -0
  18. package/dist/assets/clone-ZMALIFmw.js +1 -0
  19. package/dist/assets/{cose-bilkent-S5V4N54A-DzzRyJtB.js → cose-bilkent-S5V4N54A-NYnH3mVW.js} +1 -1
  20. package/dist/assets/{dagre-KV5264BT-CTcTVGdU.js → dagre-KV5264BT--mrfaTHR.js} +1 -1
  21. package/dist/assets/{diagram-5BDNPKRD-qR6mc8kJ.js → diagram-5BDNPKRD-DjXvyFzh.js} +1 -1
  22. package/dist/assets/{diagram-G4DWMVQ6-CUcGXyNb.js → diagram-G4DWMVQ6-BrrexEvm.js} +1 -1
  23. package/dist/assets/{diagram-MMDJMWI5-B68cPonH.js → diagram-MMDJMWI5-D3Q0OT2M.js} +1 -1
  24. package/dist/assets/{diagram-TYMM5635-q8Id8eFG.js → diagram-TYMM5635-DKTntmxE.js} +1 -1
  25. package/dist/assets/{erDiagram-SMLLAGMA-CtxJi57K.js → erDiagram-SMLLAGMA-BWbR0dPj.js} +1 -1
  26. package/dist/assets/{flowDiagram-DWJPFMVM-BzzO4JYU.js → flowDiagram-DWJPFMVM-Dj5M5XaY.js} +1 -1
  27. package/dist/assets/{ganttDiagram-T4ZO3ILL-Dn0wIyhR.js → ganttDiagram-T4ZO3ILL-DKppFh_5.js} +1 -1
  28. package/dist/assets/{gitGraphDiagram-UUTBAWPF-tnNFXfMM.js → gitGraphDiagram-UUTBAWPF-9xQ9O25V.js} +1 -1
  29. package/dist/assets/{graph-Tq_bs_r0.js → graph-Cgmhvu1T.js} +1 -1
  30. package/dist/assets/index-BxRamj_i.css +1 -0
  31. package/dist/assets/{index-8UhRLbGq.js → index-D8uDfn8y.js} +2 -2
  32. package/dist/assets/{infoDiagram-42DDH7IO-BXLvLeS0.js → infoDiagram-42DDH7IO-DQYWVzVN.js} +1 -1
  33. package/dist/assets/{ishikawaDiagram-UXIWVN3A-DWx-7BBy.js → ishikawaDiagram-UXIWVN3A-CK2IFFAP.js} +1 -1
  34. package/dist/assets/{journeyDiagram-VCZTEJTY-C42hXNha.js → journeyDiagram-VCZTEJTY-DAH5Stkf.js} +1 -1
  35. package/dist/assets/{kanban-definition-6JOO6SKY-CEq930ew.js → kanban-definition-6JOO6SKY-Bi0aCqkv.js} +1 -1
  36. package/dist/assets/{layout-qtUgN9BC.js → layout-DN13RkA1.js} +1 -1
  37. package/dist/assets/{linear-D158F7OT.js → linear-ClGEGlS2.js} +1 -1
  38. package/dist/assets/{min-hESxN-c0.js → min-CXr-fUFS.js} +1 -1
  39. package/dist/assets/{mindmap-definition-QFDTVHPH-d9SSh2nG.js → mindmap-definition-QFDTVHPH-Wjr-PgC6.js} +1 -1
  40. package/dist/assets/{pieDiagram-DEJITSTG-gglmeMav.js → pieDiagram-DEJITSTG-CVipbIlr.js} +1 -1
  41. package/dist/assets/{quadrantDiagram-34T5L4WZ-CqFC_htU.js → quadrantDiagram-34T5L4WZ-CHJFyhm-.js} +1 -1
  42. package/dist/assets/{requirementDiagram-MS252O5E-B1ZFIotK.js → requirementDiagram-MS252O5E-CU9Rlyq5.js} +1 -1
  43. package/dist/assets/{sankeyDiagram-XADWPNL6-BvItvZt5.js → sankeyDiagram-XADWPNL6-BSULeqST.js} +1 -1
  44. package/dist/assets/{sequenceDiagram-FGHM5R23-CAIn5Z3U.js → sequenceDiagram-FGHM5R23-CCOKXvjj.js} +1 -1
  45. package/dist/assets/{stateDiagram-FHFEXIEX-CyJrGzib.js → stateDiagram-FHFEXIEX-B91gKA7Q.js} +1 -1
  46. package/dist/assets/stateDiagram-v2-QKLJ7IA2-Dc8ur9ta.js +1 -0
  47. package/dist/assets/{timeline-definition-GMOUNBTQ-k_0vJQAK.js → timeline-definition-GMOUNBTQ-C8SZmaLp.js} +1 -1
  48. package/dist/assets/{vennDiagram-DHZGUBPP-TZAW60b0.js → vennDiagram-DHZGUBPP-YvEPDlsM.js} +1 -1
  49. package/dist/assets/{wardley-RL74JXVD-DzQEoG6X.js → wardley-RL74JXVD-TMBUq_w1.js} +1 -1
  50. package/dist/assets/{wardleyDiagram-NUSXRM2D-BAoVVIjZ.js → wardleyDiagram-NUSXRM2D-DzEkPrri.js} +1 -1
  51. package/dist/assets/{xychartDiagram-5P7HB3ND-CynkZcUb.js → xychartDiagram-5P7HB3ND-BIiCeiYk.js} +1 -1
  52. package/dist/index.html +2 -2
  53. package/package.json +1 -1
  54. package/scripts/release-manual.sh +98 -0
  55. package/server/file-watcher.js +33 -0
  56. package/server/index.js +7 -0
  57. package/server/pipeline-routes.js +773 -3
  58. package/dist/assets/App-CT0vXPgd.js +0 -724
  59. package/dist/assets/channel-Dd4XaiYv.js +0 -1
  60. package/dist/assets/classDiagram-6PBFFD2Q-DshSQDF9.js +0 -1
  61. package/dist/assets/classDiagram-v2-HSJHXN6E-DshSQDF9.js +0 -1
  62. package/dist/assets/clone-CBsbNGAa.js +0 -1
  63. package/dist/assets/index-CRqB9els.css +0 -1
  64. package/dist/assets/stateDiagram-v2-QKLJ7IA2-DprhF_Ho.js +0 -1
@@ -1,724 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-KV5264BT-CTcTVGdU.js","assets/graph-Tq_bs_r0.js","assets/_baseUniq-CsOHc_iS.js","assets/layout-qtUgN9BC.js","assets/min-hESxN-c0.js","assets/clone-CBsbNGAa.js","assets/mobile-Chw8RWyH.js","assets/mobile-1gVCT0OK.css","assets/index-8UhRLbGq.js","assets/index-CRqB9els.css","assets/graph-DZe55uk8.js","assets/cose-bilkent-S5V4N54A-DzzRyJtB.js","assets/c4Diagram-AHTNJAMY-nBIRLJTv.js","assets/chunk-YZCP3GAM-DE6_5aqh.js","assets/flowDiagram-DWJPFMVM-BzzO4JYU.js","assets/chunk-FMBD7UC4-tYY8xcjr.js","assets/chunk-55IACEB6-D8KuKVLa.js","assets/chunk-EDXVE4YY-TPlt1bS2.js","assets/channel-Dd4XaiYv.js","assets/erDiagram-SMLLAGMA-CtxJi57K.js","assets/gitGraphDiagram-UUTBAWPF-tnNFXfMM.js","assets/chunk-4BX2VUAB-CNmGyhrp.js","assets/chunk-QZHKN3VN-B4Wfybww.js","assets/wardley-RL74JXVD-DzQEoG6X.js","assets/ganttDiagram-T4ZO3ILL-Dn0wIyhR.js","assets/linear-D158F7OT.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-DX6XiGOO.js","assets/infoDiagram-42DDH7IO-BXLvLeS0.js","assets/pieDiagram-DEJITSTG-gglmeMav.js","assets/arc-BXht3LyE.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-34T5L4WZ-CqFC_htU.js","assets/xychartDiagram-5P7HB3ND-CynkZcUb.js","assets/requirementDiagram-MS252O5E-B1ZFIotK.js","assets/sequenceDiagram-FGHM5R23-CAIn5Z3U.js","assets/classDiagram-6PBFFD2Q-DshSQDF9.js","assets/chunk-4TB4RGXK-MLT7I7w4.js","assets/classDiagram-v2-HSJHXN6E-DshSQDF9.js","assets/stateDiagram-FHFEXIEX-CyJrGzib.js","assets/chunk-OYMX7WX6-yBPwT1AT.js","assets/stateDiagram-v2-QKLJ7IA2-DprhF_Ho.js","assets/journeyDiagram-VCZTEJTY-C42hXNha.js","assets/timeline-definition-GMOUNBTQ-k_0vJQAK.js","assets/mindmap-definition-QFDTVHPH-d9SSh2nG.js","assets/kanban-definition-6JOO6SKY-CEq930ew.js","assets/sankeyDiagram-XADWPNL6-BvItvZt5.js","assets/diagram-TYMM5635-q8Id8eFG.js","assets/diagram-MMDJMWI5-B68cPonH.js","assets/blockDiagram-DXYQGD6D-BgcMJjAR.js","assets/diagram-5BDNPKRD-qR6mc8kJ.js","assets/architectureDiagram-Q4EWVU46-BV1r86-w.js","assets/ishikawaDiagram-UXIWVN3A-DWx-7BBy.js","assets/vennDiagram-DHZGUBPP-TZAW60b0.js","assets/diagram-G4DWMVQ6-CUcGXyNb.js","assets/wardleyDiagram-NUSXRM2D-BAoVVIjZ.js","assets/browser-CnKiSnlr.js"])))=>i.map(i=>d[i]);
2
- var bT=Object.defineProperty;var CT=(t,e,r)=>e in t?bT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var ee=(t,e,r)=>CT(t,typeof e!="symbol"?e+"":e,r);import{a as C,j as l,d as Dt,i as O0,e as R0,f as kT,g as zd,w as vt,h as vT,v as z0,k as Mr,n as se,l as wT,m as ST,P as Pf,o as TT,N as _T}from"./mobile-Chw8RWyH.js";import{c as bt,a as nt,b as jT,u as bs,P as ea,d as gc,e as NT,f as ei,g as Kn,h as ET,i as LT,I as qd,B as At,X as Kr,_ as Ht,j as Wd,D as xc,k as yc,l as bc,m as Cc,n as Hd,o as q0,r as BT,p as AT,q as W0}from"./index-8UhRLbGq.js";import{c as ra,b as H0,f as MT}from"./graph-DZe55uk8.js";/**
3
- * @license lucide-react v0.563.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */const IT=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Ud=bt("activity",IT);/**
8
- * @license lucide-react v0.563.0 - ISC
9
- *
10
- * This source code is licensed under the ISC license.
11
- * See the LICENSE file in the root directory of this source tree.
12
- */const FT=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],PT=bt("arrow-down-to-line",FT);/**
13
- * @license lucide-react v0.563.0 - ISC
14
- *
15
- * This source code is licensed under the ISC license.
16
- * See the LICENSE file in the root directory of this source tree.
17
- */const $T=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],DT=bt("arrow-left",$T);/**
18
- * @license lucide-react v0.563.0 - ISC
19
- *
20
- * This source code is licensed under the ISC license.
21
- * See the LICENSE file in the root directory of this source tree.
22
- */const OT=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],U0=bt("arrow-right",OT);/**
23
- * @license lucide-react v0.563.0 - ISC
24
- *
25
- * This source code is licensed under the ISC license.
26
- * See the LICENSE file in the root directory of this source tree.
27
- */const RT=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],zT=bt("bell",RT);/**
28
- * @license lucide-react v0.563.0 - ISC
29
- *
30
- * This source code is licensed under the ISC license.
31
- * See the LICENSE file in the root directory of this source tree.
32
- */const qT=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],V0=bt("book-open",qT);/**
33
- * @license lucide-react v0.563.0 - ISC
34
- *
35
- * This source code is licensed under the ISC license.
36
- * See the LICENSE file in the root directory of this source tree.
37
- */const WT=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],qi=bt("bot",WT);/**
38
- * @license lucide-react v0.563.0 - ISC
39
- *
40
- * This source code is licensed under the ISC license.
41
- * See the LICENSE file in the root directory of this source tree.
42
- */const HT=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]],UT=bt("chart-no-axes-column",HT);/**
43
- * @license lucide-react v0.563.0 - ISC
44
- *
45
- * This source code is licensed under the ISC license.
46
- * See the LICENSE file in the root directory of this source tree.
47
- */const VT=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Cs=bt("check",VT);/**
48
- * @license lucide-react v0.563.0 - ISC
49
- *
50
- * This source code is licensed under the ISC license.
51
- * See the LICENSE file in the root directory of this source tree.
52
- */const YT=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ks=bt("chevron-down",YT);/**
53
- * @license lucide-react v0.563.0 - ISC
54
- *
55
- * This source code is licensed under the ISC license.
56
- * See the LICENSE file in the root directory of this source tree.
57
- */const GT=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Y0=bt("chevron-left",GT);/**
58
- * @license lucide-react v0.563.0 - ISC
59
- *
60
- * This source code is licensed under the ISC license.
61
- * See the LICENSE file in the root directory of this source tree.
62
- */const XT=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ii=bt("chevron-right",XT);/**
63
- * @license lucide-react v0.563.0 - ISC
64
- *
65
- * This source code is licensed under the ISC license.
66
- * See the LICENSE file in the root directory of this source tree.
67
- */const KT=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],G0=bt("chevron-up",KT);/**
68
- * @license lucide-react v0.563.0 - ISC
69
- *
70
- * This source code is licensed under the ISC license.
71
- * See the LICENSE file in the root directory of this source tree.
72
- */const QT=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],ZT=bt("circle-check-big",QT);/**
73
- * @license lucide-react v0.563.0 - ISC
74
- *
75
- * This source code is licensed under the ISC license.
76
- * See the LICENSE file in the root directory of this source tree.
77
- */const JT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Vd=bt("circle-check",JT);/**
78
- * @license lucide-react v0.563.0 - ISC
79
- *
80
- * This source code is licensed under the ISC license.
81
- * See the LICENSE file in the root directory of this source tree.
82
- */const t_=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],e_=bt("circle-x",t_);/**
83
- * @license lucide-react v0.563.0 - ISC
84
- *
85
- * This source code is licensed under the ISC license.
86
- * See the LICENSE file in the root directory of this source tree.
87
- */const r_=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],n_=bt("circle",r_);/**
88
- * @license lucide-react v0.563.0 - ISC
89
- *
90
- * This source code is licensed under the ISC license.
91
- * See the LICENSE file in the root directory of this source tree.
92
- */const i_=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],X0=bt("clock",i_);/**
93
- * @license lucide-react v0.563.0 - ISC
94
- *
95
- * This source code is licensed under the ISC license.
96
- * See the LICENSE file in the root directory of this source tree.
97
- */const s_=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],Yd=bt("cpu",s_);/**
98
- * @license lucide-react v0.563.0 - ISC
99
- *
100
- * This source code is licensed under the ISC license.
101
- * See the LICENSE file in the root directory of this source tree.
102
- */const o_=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],K0=bt("eye",o_);/**
103
- * @license lucide-react v0.563.0 - ISC
104
- *
105
- * This source code is licensed under the ISC license.
106
- * See the LICENSE file in the root directory of this source tree.
107
- */const a_=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]],l_=bt("file-plus",a_);/**
108
- * @license lucide-react v0.563.0 - ISC
109
- *
110
- * This source code is licensed under the ISC license.
111
- * See the LICENSE file in the root directory of this source tree.
112
- */const c_=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],h_=bt("file-search",c_);/**
113
- * @license lucide-react v0.563.0 - ISC
114
- *
115
- * This source code is licensed under the ISC license.
116
- * See the LICENSE file in the root directory of this source tree.
117
- */const u_=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],mi=bt("file-text",u_);/**
118
- * @license lucide-react v0.563.0 - ISC
119
- *
120
- * This source code is licensed under the ISC license.
121
- * See the LICENSE file in the root directory of this source tree.
122
- */const d_=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],p_=bt("folder-open",d_);/**
123
- * @license lucide-react v0.563.0 - ISC
124
- *
125
- * This source code is licensed under the ISC license.
126
- * See the LICENSE file in the root directory of this source tree.
127
- */const f_=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Gd=bt("folder",f_);/**
128
- * @license lucide-react v0.563.0 - ISC
129
- *
130
- * This source code is licensed under the ISC license.
131
- * See the LICENSE file in the root directory of this source tree.
132
- */const m_=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],g_=bt("funnel",m_);/**
133
- * @license lucide-react v0.563.0 - ISC
134
- *
135
- * This source code is licensed under the ISC license.
136
- * See the LICENSE file in the root directory of this source tree.
137
- */const x_=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],Q0=bt("git-branch",x_);/**
138
- * @license lucide-react v0.563.0 - ISC
139
- *
140
- * This source code is licensed under the ISC license.
141
- * See the LICENSE file in the root directory of this source tree.
142
- */const y_=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],xu=bt("history",y_);/**
143
- * @license lucide-react v0.563.0 - ISC
144
- *
145
- * This source code is licensed under the ISC license.
146
- * See the LICENSE file in the root directory of this source tree.
147
- */const b_=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],C_=bt("inbox",b_);/**
148
- * @license lucide-react v0.563.0 - ISC
149
- *
150
- * This source code is licensed under the ISC license.
151
- * See the LICENSE file in the root directory of this source tree.
152
- */const k_=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],v_=bt("layers",k_);/**
153
- * @license lucide-react v0.563.0 - ISC
154
- *
155
- * This source code is licensed under the ISC license.
156
- * See the LICENSE file in the root directory of this source tree.
157
- */const w_=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],S_=bt("layout-dashboard",w_);/**
158
- * @license lucide-react v0.563.0 - ISC
159
- *
160
- * This source code is licensed under the ISC license.
161
- * See the LICENSE file in the root directory of this source tree.
162
- */const T_=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],si=bt("lightbulb",T_);/**
163
- * @license lucide-react v0.563.0 - ISC
164
- *
165
- * This source code is licensed under the ISC license.
166
- * See the LICENSE file in the root directory of this source tree.
167
- */const __=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],j_=bt("link-2",__);/**
168
- * @license lucide-react v0.563.0 - ISC
169
- *
170
- * This source code is licensed under the ISC license.
171
- * See the LICENSE file in the root directory of this source tree.
172
- */const N_=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],E_=bt("list-checks",N_);/**
173
- * @license lucide-react v0.563.0 - ISC
174
- *
175
- * This source code is licensed under the ISC license.
176
- * See the LICENSE file in the root directory of this source tree.
177
- */const L_=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],B_=bt("list",L_);/**
178
- * @license lucide-react v0.563.0 - ISC
179
- *
180
- * This source code is licensed under the ISC license.
181
- * See the LICENSE file in the root directory of this source tree.
182
- */const A_=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],xl=bt("loader-circle",A_);/**
183
- * @license lucide-react v0.563.0 - ISC
184
- *
185
- * This source code is licensed under the ISC license.
186
- * See the LICENSE file in the root directory of this source tree.
187
- */const M_=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],kc=bt("message-square",M_);/**
188
- * @license lucide-react v0.563.0 - ISC
189
- *
190
- * This source code is licensed under the ISC license.
191
- * See the LICENSE file in the root directory of this source tree.
192
- */const I_=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],F_=bt("moon",I_);/**
193
- * @license lucide-react v0.563.0 - ISC
194
- *
195
- * This source code is licensed under the ISC license.
196
- * See the LICENSE file in the root directory of this source tree.
197
- */const P_=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],$_=bt("network",P_);/**
198
- * @license lucide-react v0.563.0 - ISC
199
- *
200
- * This source code is licensed under the ISC license.
201
- * See the LICENSE file in the root directory of this source tree.
202
- */const D_=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Z0=bt("pencil",D_);/**
203
- * @license lucide-react v0.563.0 - ISC
204
- *
205
- * This source code is licensed under the ISC license.
206
- * See the LICENSE file in the root directory of this source tree.
207
- */const O_=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],R_=bt("play",O_);/**
208
- * @license lucide-react v0.563.0 - ISC
209
- *
210
- * This source code is licensed under the ISC license.
211
- * See the LICENSE file in the root directory of this source tree.
212
- */const z_=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],yl=bt("plus",z_);/**
213
- * @license lucide-react v0.563.0 - ISC
214
- *
215
- * This source code is licensed under the ISC license.
216
- * See the LICENSE file in the root directory of this source tree.
217
- */const q_=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Po=bt("refresh-cw",q_);/**
218
- * @license lucide-react v0.563.0 - ISC
219
- *
220
- * This source code is licensed under the ISC license.
221
- * See the LICENSE file in the root directory of this source tree.
222
- */const W_=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],H_=bt("rotate-ccw",W_);/**
223
- * @license lucide-react v0.563.0 - ISC
224
- *
225
- * This source code is licensed under the ISC license.
226
- * See the LICENSE file in the root directory of this source tree.
227
- */const U_=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],V_=bt("save",U_);/**
228
- * @license lucide-react v0.563.0 - ISC
229
- *
230
- * This source code is licensed under the ISC license.
231
- * See the LICENSE file in the root directory of this source tree.
232
- */const Y_=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],fn=bt("search",Y_);/**
233
- * @license lucide-react v0.563.0 - ISC
234
- *
235
- * This source code is licensed under the ISC license.
236
- * See the LICENSE file in the root directory of this source tree.
237
- */const G_=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Xd=bt("send",G_);/**
238
- * @license lucide-react v0.563.0 - ISC
239
- *
240
- * This source code is licensed under the ISC license.
241
- * See the LICENSE file in the root directory of this source tree.
242
- */const X_=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],gi=bt("shield-check",X_);/**
243
- * @license lucide-react v0.563.0 - ISC
244
- *
245
- * This source code is licensed under the ISC license.
246
- * See the LICENSE file in the root directory of this source tree.
247
- */const K_=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Q_=bt("shield",K_);/**
248
- * @license lucide-react v0.563.0 - ISC
249
- *
250
- * This source code is licensed under the ISC license.
251
- * See the LICENSE file in the root directory of this source tree.
252
- */const Z_=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],J0=bt("skip-forward",Z_);/**
253
- * @license lucide-react v0.563.0 - ISC
254
- *
255
- * This source code is licensed under the ISC license.
256
- * See the LICENSE file in the root directory of this source tree.
257
- */const J_=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],ty=bt("smartphone",J_);/**
258
- * @license lucide-react v0.563.0 - ISC
259
- *
260
- * This source code is licensed under the ISC license.
261
- * See the LICENSE file in the root directory of this source tree.
262
- */const tj=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],$f=bt("sparkles",tj);/**
263
- * @license lucide-react v0.563.0 - ISC
264
- *
265
- * This source code is licensed under the ISC license.
266
- * See the LICENSE file in the root directory of this source tree.
267
- */const ej=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],rj=bt("star",ej);/**
268
- * @license lucide-react v0.563.0 - ISC
269
- *
270
- * This source code is licensed under the ISC license.
271
- * See the LICENSE file in the root directory of this source tree.
272
- */const nj=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],ij=bt("sun",nj);/**
273
- * @license lucide-react v0.563.0 - ISC
274
- *
275
- * This source code is licensed under the ISC license.
276
- * See the LICENSE file in the root directory of this source tree.
277
- */const sj=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],oj=bt("terminal",sj);/**
278
- * @license lucide-react v0.563.0 - ISC
279
- *
280
- * This source code is licensed under the ISC license.
281
- * See the LICENSE file in the root directory of this source tree.
282
- */const aj=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],bl=bt("trash-2",aj);/**
283
- * @license lucide-react v0.563.0 - ISC
284
- *
285
- * This source code is licensed under the ISC license.
286
- * See the LICENSE file in the root directory of this source tree.
287
- */const lj=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],vc=bt("triangle-alert",lj);/**
288
- * @license lucide-react v0.563.0 - ISC
289
- *
290
- * This source code is licensed under the ISC license.
291
- * See the LICENSE file in the root directory of this source tree.
292
- */const cj=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Kd=bt("user",cj);/**
293
- * @license lucide-react v0.563.0 - ISC
294
- *
295
- * This source code is licensed under the ISC license.
296
- * See the LICENSE file in the root directory of this source tree.
297
- */const hj=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],uj=bt("wifi-off",hj);/**
298
- * @license lucide-react v0.563.0 - ISC
299
- *
300
- * This source code is licensed under the ISC license.
301
- * See the LICENSE file in the root directory of this source tree.
302
- */const dj=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],pj=bt("workflow",dj);/**
303
- * @license lucide-react v0.563.0 - ISC
304
- *
305
- * This source code is licensed under the ISC license.
306
- * See the LICENSE file in the root directory of this source tree.
307
- */const fj=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Cl=bt("zap",fj),hr={feature:"#3b82f6",bug:"#ef4444",track:"#06b6d4",decision:"#22c55e",task:"#94a3b8",spec:"#8b5cf6",idea:"#f59e0b",question:"#ec4899",evaluation:"#f97316",thread:"#64748b",artifact:"#a855f7"},Bn={planned:"#64748b",ready:"#0ea5e9",in_progress:"#3b82f6",review:"#f59e0b",complete:"#22c55e",blocked:"#ef4444",parked:"#475569",killed:"#1e293b",superseded:"#6b5b8a"},mj=["planned","ready","in_progress","review","complete","blocked","parked","killed","superseded"],ey=["vision","specification","planning","implementation","verification","release"],kl={vision:"Vision",specification:"Specification",planning:"Planning",implementation:"Implementation",verification:"Verification",release:"Release"},Qd=["Untested","Low","Moderate","High","Crystallized"],Ce={explore_design:"Design",prd:"PRD",architecture:"Architecture",blueprint:"Blueprint",verification:"Verification",plan:"Plan",execute:"Execute",report:"Report",docs:"Docs",ship:"Ship",complete:"Complete",killed:"Killed"},ry={explore_design:"design.md",prd:"prd.md",architecture:"architecture.md",blueprint:"blueprint.md",plan:"plan.md",report:"report.md"},ny=["claude","codex","gemini","human","unassigned"],Df={building:"bg-blue-500/10 text-blue-400",debugging:"bg-rose-500/10 text-rose-400",testing:"bg-amber-500/10 text-amber-400",exploring:"bg-purple-500/10 text-purple-400",thinking:"bg-cyan-500/10 text-cyan-400",reviewing:"bg-emerald-500/10 text-emerald-400"},un={design_gate:"Review Design",prd_gate:"Review PRD",architecture_gate:"Review Architecture",plan_gate:"Review Plan",report_gate:"Review Report",ship_gate:"Approve for Ship"};function $o(t,e){const r=un[t.stepId]??(t.fromPhase&&t.toPhase?`${Ce[t.fromPhase]??t.fromPhase} → ${Ce[t.toPhase]??t.toPhase}`:"Gate"),n=(e==null?void 0:e.title)||t.featureCode||null;return n?`${r} — ${n}`:r}const Of={design:{label:"Phase 1: Design",color:"border-blue-500/30 bg-blue-500/5"},blueprint:{label:"Phase 2: Blueprint",color:"border-violet-500/30 bg-violet-500/5"},implementation:{label:"Phase 3: Implement",color:"border-amber-500/30 bg-amber-500/5"},ship:{label:"Phase 4: Ship",color:"border-emerald-500/30 bg-emerald-500/5"}},gj={reading:"hsl(210 70% 60%)",writing:"hsl(142 60% 50%)",executing:"hsl(38 90% 60%)",searching:"hsl(270 60% 65%)",fetching:"hsl(190 70% 55%)",delegating:"hsl(330 60% 65%)",thinking:"hsl(240 30% 70%)"},Rf={complete:"hsl(var(--success, 160 60% 45%))",active:"hsl(var(--accent))",failed:"hsl(var(--destructive))",pending:"hsl(var(--muted-foreground) / 0.3)"},xj={development:"border-blue-500/30 bg-blue-500/5 text-blue-400",quality:"border-emerald-500/30 bg-emerald-500/5 text-emerald-400",maintenance:"border-amber-500/30 bg-amber-500/5 text-amber-400",documentation:"border-violet-500/30 bg-violet-500/5 text-violet-400",exploration:"border-cyan-500/30 bg-cyan-500/5 text-cyan-400"},yj={explore_design:{bg:"bg-blue-500/5",border:"border-blue-500/40",text:"text-blue-300"},prd:{bg:"bg-purple-500/5",border:"border-purple-500/40",text:"text-purple-300"},architecture:{bg:"bg-cyan-500/5",border:"border-cyan-500/40",text:"text-cyan-300"},blueprint:{bg:"bg-violet-500/5",border:"border-violet-500/40",text:"text-violet-300"},plan:{bg:"bg-amber-500/5",border:"border-amber-500/40",text:"text-amber-300"},report:{bg:"bg-emerald-500/5",border:"border-emerald-500/40",text:"text-emerald-300"},ship:{bg:"bg-green-500/5",border:"border-green-500/40",text:"text-green-300"}},bj={bg:"bg-muted/30",border:"border-border",text:"text-muted-foreground"},zf=["bg-slate-600","bg-rose-500","bg-amber-500","bg-emerald-500","bg-emerald-500"],Cj={info:"text-zinc-400",success:"text-emerald-400",warning:"text-amber-400",error:"text-red-400"},kj={phase:"text-blue-400",gate:"text-purple-400",session:"text-zinc-400",iteration:"text-blue-300",error:"text-red-400"},vj={"compose-explorer":"#06b6d4","compose-architect":"#a855f7",codex:"#10b981",claude:"#3b82f6"},qf={reading:"var(--color-category-reading)",writing:"var(--color-category-writing)",executing:"var(--color-category-executing)",searching:"var(--color-category-searching)",fetching:"var(--color-category-fetching)",delegating:"var(--color-category-delegating)",thinking:"hsl(var(--muted-foreground))"},iy={branch:{label:"Branch",icon:"⑂",color:"text-purple-400"},phase_transition:{label:"Phase",icon:"→",color:"text-blue-400"},iteration:{label:"Iteration",icon:"↻",color:"text-cyan-400"},gate:{label:"Gate",icon:"◈",color:"text-amber-400"},drift_threshold:{label:"Drift",icon:"⚠",color:"text-rose-400"}};function wj(t,e){return!Array.isArray(t)||t.length===0?"hidden":e?"expanded":"collapsed"}function Sj(t){return`violations (${Array.isArray(t)?t.length:0})`}function Tj(t){return t?"▾":"▸"}function _j({violations:t=[],expanded:e,onToggle:r}){const[n,i]=C.useState(!1),s=e!==void 0,o=s?e:n,a=wj(t,o);if(a==="hidden")return null;function c(){s?r==null||r():i(d=>!d)}const h=Tj(o),u=Sj(t);return l.jsxs("div",{style:{background:"hsl(38 90% 50% / 0.06)",borderLeft:"2px solid hsl(38 90% 50% / 0.3)",borderRadius:"3px",marginTop:"4px"},children:[l.jsxs("div",{onClick:c,style:{display:"flex",alignItems:"center",gap:"4px",padding:"3px 8px",cursor:"pointer",color:"hsl(38 90% 70%)",fontSize:"10px",fontFamily:"monospace",userSelect:"none"},children:[l.jsx("span",{style:{opacity:.7},children:h}),l.jsx("span",{children:u})]}),a==="expanded"&&l.jsx("ul",{style:{listStyle:"none",margin:0,padding:"0 8px 6px 16px"},children:t.map((d,f)=>l.jsx("li",{style:{color:"hsl(38 50% 60%)",fontSize:"10px",fontFamily:"monospace",lineHeight:"1.5"},children:d},f))})]})}function jj({msg:t,mode:e="stream"}){const[r,n]=C.useState(!1),i=t.retries??0,s=t.violations??[],o=s.length>0;return e==="strip"?i===0?null:l.jsx("span",{style:{background:"hsl(38 90% 50% / 0.2)",color:"hsl(38 90% 60%)",padding:"0 5px",borderRadius:"9999px",fontSize:"9px"},children:i}):l.jsxs("div",{className:"text-[10px] py-0.5",children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[l.jsxs("span",{style:{color:"hsl(var(--success, 142 60% 50%))",opacity:.7},children:["step complete -- ",t.stepId]}),i>0&&l.jsxs("span",{onClick:()=>n(a=>!a),style:{background:"hsl(38 90% 50% / 0.15)",color:"hsl(38 90% 60%)",padding:"1px 6px",borderRadius:"9999px",fontSize:"10px",cursor:"pointer"},children:[i," ",i===1?"retry":"retries"]}),o?l.jsxs("span",{onClick:()=>n(a=>!a),style:{color:"hsl(38 90% 60%)",fontSize:"10px",cursor:"pointer"},children:[s.length," ",s.length===1?"violation":"violations"]}):l.jsx("span",{style:{color:"hsl(var(--success, 142 60% 50%))",opacity:.4,fontSize:"10px"},children:"✓ checks passed"})]}),r&&o&&l.jsx(_j,{violations:s,expanded:!0,onToggle:()=>n(!1)})]})}const Nj=/\b(Error|error:|Traceback|FAILED|ENOENT|Cannot find)\b/,Wf=20;function Ej({summary:t,output:e}){const[r,n]=C.useState(!1),[i,s]=C.useState(!1),o=e?Nj.test(e):!1,a=e!=null&&e.length>0,c=a?e.split(`
308
- `):[],h=c.length>Wf,u=r&&!i&&h?c.slice(0,Wf):c,d=o?"hsl(var(--destructive, 0 84% 60%))":"hsl(215 20% 20%)";return a?l.jsxs("div",{style:{marginLeft:8,borderLeft:`1px solid ${d}`,paddingLeft:8,marginTop:2},children:[l.jsxs("div",{onClick:()=>n(f=>!f),style:{opacity:.6,fontSize:"10px",cursor:"pointer",color:"hsl(var(--muted-foreground))",fontFamily:"ui-monospace, monospace",userSelect:"none",display:"flex",alignItems:"center",gap:4},children:[l.jsx("span",{style:{fontSize:9},children:r?"▾":"▸"}),t]}),r&&l.jsxs("pre",{style:{margin:"4px 0 0 0",padding:0,fontSize:"10px",fontFamily:"ui-monospace, monospace",color:o?"hsl(var(--destructive, 0 84% 60%))":"hsl(var(--muted-foreground))",opacity:o?.9:.7,whiteSpace:"pre-wrap",wordBreak:"break-word",lineHeight:1.5},children:[u.join(`
309
- `),!i&&h&&l.jsxs(l.Fragment,{children:[`
310
- `,l.jsxs("span",{onClick:f=>{f.stopPropagation(),s(!0)},style:{color:"hsl(var(--accent))",cursor:"pointer",textDecoration:"underline",fontSize:"10px"},children:["Show all (",c.length," lines)"]})]})]})]}):l.jsx("div",{style:{marginLeft:8,opacity:.6,fontSize:"10px",padding:"2px 0",color:"hsl(var(--muted-foreground))",fontFamily:"ui-monospace, monospace"},children:t})}const Lj={Read:"reading",Glob:"searching",Grep:"searching",Write:"writing",Edit:"writing",NotebookEdit:"writing",Bash:"executing",Task:"delegating",Skill:"delegating",WebFetch:"fetching",WebSearch:"searching",TodoRead:"reading",TodoWrite:"writing"};function Bj(t){return gj[Lj[t]||"thinking"]}function Aj(t){return t?t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`:""}function Mj(t){return t==null?"":t<.001?"<$0.001":`$${t.toFixed(3)}`}function Ij({input:t}){const[e,r]=C.useState(!1);if(!t||Object.keys(t).length===0)return null;const n=Object.keys(t)[0],i=String(t[n]??""),s=i.length>60?i.slice(0,57)+"…":i;return l.jsxs("div",{className:"mt-1",children:[l.jsxs("button",{onClick:()=>r(o=>!o),className:"text-[10px] font-mono flex items-center gap-1",style:{color:"hsl(var(--muted-foreground))",background:"none",border:"none",cursor:"pointer",padding:0},children:[l.jsx("span",{style:{opacity:.6},children:e?"▾":"▸"}),!e&&l.jsxs("span",{style:{opacity:.6},children:[n,": ",s]}),e&&l.jsx("span",{style:{opacity:.6},children:"collapse"})]}),e&&l.jsx("pre",{className:"mt-1 text-[10px] font-mono rounded p-2 overflow-x-auto",style:{background:"hsl(var(--muted) / 0.4)",color:"hsl(var(--muted-foreground))",maxHeight:"200px",overflowY:"auto"},children:JSON.stringify(t,null,2)})]})}function Fj({block:t}){const e=Bj(t.name);return l.jsxs("div",{className:"rounded px-2 py-1.5 my-1",style:{background:"hsl(var(--muted) / 0.3)",borderLeft:`2px solid ${e}`},children:[l.jsx("div",{className:"flex items-center gap-1.5",children:l.jsx("span",{className:"text-[11px] font-semibold font-mono",style:{color:e},children:t.name})}),l.jsx(Ij,{input:t.input})]})}function Pj({msg:t}){var r;const e=((r=t.message)==null?void 0:r.content)??[];return l.jsx("div",{className:"flex flex-col gap-1 py-1",children:e.map((n,i)=>{if(n.type==="text")return l.jsx("p",{className:"text-sm leading-relaxed whitespace-pre-wrap",style:{color:"hsl(var(--foreground))"},children:n.text},i);if(n.type==="tool_use"){const s=!e.slice(i+1).some(o=>o.type==="tool_use");return l.jsxs(Dt.Fragment,{children:[l.jsx(Fj,{block:n}),s&&t._toolResult&&l.jsx(Ej,{summary:t._toolResult.summary,output:t._toolResult.output})]},i)}return null})})}function $j({msg:t}){const e=t.subtype!=="success",r=e?"hsl(var(--destructive))":"hsl(var(--success, 142 60% 50%))";return l.jsxs("div",{className:"rounded px-3 py-2 text-xs font-mono flex items-center gap-3 flex-wrap",style:{background:"hsl(var(--muted) / 0.4)",borderLeft:`2px solid ${r}`,color:r},children:[l.jsx("span",{children:e?"✗ error":"✓ done"}),!e&&t.num_turns!=null&&l.jsxs("span",{style:{color:"hsl(var(--muted-foreground))"},children:[t.num_turns," turn",t.num_turns!==1?"s":""]}),t.duration_ms!=null&&l.jsx("span",{style:{color:"hsl(var(--muted-foreground))"},children:Aj(t.duration_ms)}),t.total_cost_usd!=null&&l.jsx("span",{style:{color:"hsl(var(--muted-foreground))"},children:Mj(t.total_cost_usd)}),e&&t.errors&&l.jsx("span",{style:{color:"hsl(var(--destructive))"},children:t.errors.join("; ")})]})}function Dj({msg:t}){var r,n,i,s;const e=typeof((r=t.message)==null?void 0:r.content)=="string"?t.message.content:((s=(i=(n=t.message)==null?void 0:n.content)==null?void 0:i[0])==null?void 0:s.text)??"";return!e||t.isSynthetic?null:l.jsx("div",{className:"flex justify-end py-1",children:l.jsx("div",{className:"rounded-lg px-3 py-2 text-sm max-w-[80%] whitespace-pre-wrap",style:{background:"hsl(var(--accent) / 0.15)",color:"hsl(var(--foreground))",border:"1px solid hsl(var(--accent) / 0.3)"},children:e})})}function Oj({msg:t}){var e,r;if(t.type==="stream_event"||!t.verbose&&t.type==="tool_progress"||!t.verbose&&t.type==="tool_use_summary")return null;if(t.verbose){const n=t.type==="tool_progress"?`${t.tool||"tool"} · ${t.elapsed!=null?t.elapsed+"s":""}`:t.summary||"summary",i=t.type==="tool_progress"?"progress":"summary";return l.jsxs("div",{style:{opacity:.6,fontSize:"10px",padding:"2px 0",paddingLeft:4,borderLeft:"1px solid hsl(215 20% 20%)",color:"hsl(var(--muted-foreground))",fontFamily:"ui-monospace, monospace"},children:[l.jsx("span",{style:{color:"hsl(210 40% 45%)",background:"hsl(210 40% 45% / 0.1)",padding:"0 4px",borderRadius:2,fontSize:"10px"},children:i})," ",n]})}if(t.type==="system"&&t.subtype==="init")return l.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1 flex gap-3 flex-wrap",style:{color:"hsl(var(--muted-foreground))",opacity:.6},children:[l.jsxs("span",{children:["session ",(e=t.session_id)==null?void 0:e.slice(0,8)]}),l.jsx("span",{children:t.model}),l.jsx("span",{children:t.permissionMode})]});if(t.type==="system"&&t.subtype==="connected")return l.jsxs("div",{className:"text-[10px] py-0.5",style:{color:"hsl(var(--muted-foreground))",opacity:.5},children:["reconnected · session ",(r=t.sessionId)==null?void 0:r.slice(0,8)]});if(t.type==="system"&&(t.subtype==="build_start"||t.subtype==="build_resume")){const n=t.subtype==="build_resume"?"build resumed":"build started";return l.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1",style:{color:"hsl(var(--accent))",opacity:.8},children:[n," -- ",t.featureCode]})}if(t.type==="system"&&t.subtype==="build_step")return l.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1 flex gap-2",style:{color:"hsl(var(--muted-foreground))"},children:[l.jsxs("span",{children:["step ",t.stepNum,"/",t.totalSteps]}),l.jsx("span",{className:"font-mono",children:t.stepId}),l.jsx("span",{style:{opacity:.5},children:t.agent})]});if(t.type==="system"&&t.subtype==="build_step_done")return l.jsx(jj,{msg:t,mode:"stream"});if(t.type==="system"&&t.subtype==="build_gate")return l.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1",style:{color:"hsl(38 90% 60%)"},children:["gate -- ",t.stepId]});if(t.type==="system"&&t.subtype==="build_gate_resolved"){const n=t.outcome==="approved"||t.outcome==="approve"?"hsl(var(--success, 142 60% 50%))":t.outcome==="revise"?"hsl(38 90% 60%)":"hsl(var(--destructive))";return l.jsxs("div",{className:"text-[10px] py-0.5",style:{color:n,opacity:.8},children:["gate ",t.outcome," -- ",t.stepId]})}if(t.type==="system"&&t.subtype==="build_end"){const n=t.status==="complete"?"hsl(var(--success, 142 60% 50%))":"hsl(var(--destructive))";return l.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1",style:{color:n},children:["build ",t.status," -- ",t.featureCode]})}return t.type==="assistant"?l.jsx(Pj,{msg:t}):t.type==="user"?l.jsx(Dj,{msg:t}):t.type==="result"?l.jsx($j,{msg:t}):t.type==="error"?l.jsx("div",{className:"text-xs rounded px-2 py-1.5 font-mono",style:{background:"hsl(var(--destructive) / 0.1)",color:"hsl(var(--destructive))",borderLeft:"2px solid hsl(var(--destructive))"},children:t.message}):null}function Rj({onSend:t,disabled:e=!1,placeholder:r="Message Claude…"}){const n=C.useRef(null);C.useEffect(()=>{!e&&n.current&&n.current.focus()},[e]);function i(){const a=n.current;a&&(a.style.height="auto",a.style.height=`${Math.min(a.scrollHeight,160)}px`)}function s(a){a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),o())}function o(){const a=n.current;if(!a)return;const c=a.value.trim();c&&(t(c),a.value="",i())}return l.jsxs("div",{className:"flex items-end gap-2 px-3 py-2",style:{borderTop:"1px solid hsl(var(--border))"},children:[l.jsx("textarea",{ref:n,rows:1,disabled:e,placeholder:r,onKeyDown:s,onInput:i,className:"flex-1 resize-none bg-transparent text-sm outline-none font-mono leading-relaxed",style:{color:"hsl(var(--foreground))",caretColor:"hsl(var(--accent))",maxHeight:"160px",overflowY:"auto",opacity:e?.4:1,transition:"opacity 0.15s"}}),l.jsx("button",{onClick:o,disabled:e,title:"Send (Enter)",className:"shrink-0 rounded px-2 py-1 text-xs font-mono",style:{background:"hsl(var(--accent) / 0.15)",color:"hsl(var(--accent))",border:"1px solid hsl(var(--accent) / 0.3)",cursor:e?"not-allowed":"pointer",opacity:e?.4:1,transition:"opacity 0.15s"},children:"↵"})]})}const sy="compose:verboseStream",vl={verboseStream:!1};function oy(){return vl.verboseStream}function zj(t,e){vl.verboseStream=!!t;const r=typeof localStorage<"u"?localStorage:null;if(r)try{r.setItem(sy,String(vl.verboseStream))}catch{}}function qj(t){const e=typeof localStorage<"u"?localStorage:null;if(e)try{const r=e.getItem(sy);r!==null&&(vl.verboseStream=r==="true")}catch{}}function Wj(t,e){return t.type==="stream_event"?{include:!1,msg:t}:t.type==="tool_progress"||t.type==="tool_use_summary"?e?{include:!0,msg:{...t,verbose:!0}}:{include:!1,msg:t}:{include:!0,msg:t}}function Hj(t){var r,n;const e=[];for(let i=0;i<t.length;i++){const s=t[i],o=t[i+1],a=s.type==="assistant"&&((n=(r=s.message)==null?void 0:r.content)==null?void 0:n.some(h=>h.type==="tool_use")),c=o&&(o.type==="tool_use_summary"||o.type==="assistant"&&o.subtype==="tool_use_summary");a&&c?(e.push({...s,_toolResult:o}),i++):e.push(s)}return e}const ay=parseInt("4002",10),Uj="compose-agent-session",Hf=500,Vj=8,Yj=2e3,ly=3e4,Uf={Read:"reading",Glob:"searching",Grep:"searching",Write:"writing",Edit:"writing",NotebookEdit:"writing",Bash:"executing",Task:"delegating",Skill:"delegating",WebFetch:"fetching",WebSearch:"searching",TodoRead:"reading",TodoWrite:"writing"},Gj={reading:"Reading",writing:"Writing",executing:"Running",searching:"Searching",fetching:"Fetching",delegating:"Delegating",thinking:"Thinking",waiting:"Waiting for gate approval"};qj();const tt={es:null,connected:!1,connecting:!1,reconnectTimer:null,reconnectAttempts:0,sessionId:null,messages:[],agentStatus:"idle",agentTool:null,agentCategory:null,currentActivity:null,activityLog:[],_idleTimer:null,sourceStatus:{build:null,interactive:null},parallelTasks:null,streamError:null,retryInfo:null,stalled:!1,onConnectedChange:null,onMessagesChange:null,onAgentStatusChange:null,onStreamErrorChange:null};function Xj(t){var e,r;if(t._source==="build"){if(t.type==="system"){if(t.subtype==="build_step"||t.subtype==="build_step_done"||t.subtype==="build_gate_resolved")return{status:"working",tool:null,category:"thinking",_source:"build"};if(t.subtype==="build_gate")return{status:"working",tool:null,category:"waiting",_source:"build"};if(t.subtype==="build_end")return{status:"idle",tool:null,category:null,_source:"build"}}if(t.type==="error"&&t.source==="build")return{status:"working",tool:null,category:"thinking",_source:"build"};if(t.type==="assistant"){const n=((e=t.message)==null?void 0:e.content)??[];for(const i of n)if(i.type==="tool_use"){const s=Uf[i.name]||"thinking";return{status:"working",tool:i.name,category:s,_source:"build"}}if(n.some(i=>i.type==="text"))return{status:"working",tool:null,category:"thinking",_source:"build"}}return null}if(t.type==="assistant"){const n=((r=t.message)==null?void 0:r.content)??[];for(const i of n)if(i.type==="tool_use"){const s=Uf[i.name]||"thinking";return{status:"working",tool:i.name,category:s}}if(n.some(i=>i.type==="text"))return{status:"working",tool:null,category:"thinking"}}return t.type==="result"?{status:"idle",tool:null,category:null}:null}function lh(t,e,r){const n=Date.now(),i=tt.agentStatus,s=tt.agentTool;if(tt._idleTimer&&(clearTimeout(tt._idleTimer),tt._idleTimer=null),i==="working"&&(t==="idle"||e!==s)){const a=tt.currentActivity;a&&(a.endTime=n,a.duration=n-a.startTime,tt.activityLog.push(a),tt.activityLog.length>Vj&&tt.activityLog.shift())}t==="working"&&e!==s?tt.currentActivity={tool:e,category:r,startTime:n,endTime:null,duration:null}:t==="idle"&&(tt.currentActivity=null),tt.agentStatus=t,tt.agentTool=e,tt.agentCategory=r;const o={status:t,tool:e,category:r,activityLog:tt.activityLog,currentActivity:tt.currentActivity,parallelTasks:tt.parallelTasks};tt.onAgentStatusChange&&tt.onAgentStatusChange({...o}),window.dispatchEvent(new CustomEvent("compose:agent-status",{detail:o}))}function Vf(){const t=tt.sourceStatus.build,e=tt.sourceStatus.interactive;(e==null?void 0:e.status)==="working"?lh(e.status,e.tool,e.category):(t==null?void 0:t.status)==="working"?lh(t.status,t.tool,t.category):tt._idleTimer=setTimeout(()=>{tt._idleTimer=null,lh("idle",null,null)},Yj)}function yu(t){var i,s,o,a,c,h;t._source==="build"&&t.type==="system"&&t.parallel&&(t.subtype==="build_step"&&((i=t.stepNum)!=null&&i.toString().startsWith("∥"))?(tt.parallelTasks||(tt.parallelTasks={total:0,completed:0,failed:0,active:0,tasks:{}}),tt.parallelTasks.total++,tt.parallelTasks.active++,tt.parallelTasks.tasks[t.stepId]="working"):t.subtype==="build_step_done"&&((o=(s=tt.parallelTasks)==null?void 0:s.tasks)!=null&&o[t.stepId])?(tt.parallelTasks.active=Math.max(0,tt.parallelTasks.active-1),tt.parallelTasks.completed++,tt.parallelTasks.tasks[t.stepId]="complete"):t.subtype==="build_step_done"&&tt.parallelTasks&&!((a=t.stepNum)!=null&&a.toString().startsWith("∥"))&&(tt.parallelTasks=null)),t._source==="build"&&t.type==="error"&&((h=(c=tt.parallelTasks)==null?void 0:c.tasks)!=null&&h[t.stepId])&&(tt.parallelTasks.active=Math.max(0,tt.parallelTasks.active-1),tt.parallelTasks.failed++,tt.parallelTasks.tasks[t.stepId]="failed");const e=Xj(t);if(e){const u=e._source==="build"?"build":"interactive";tt.sourceStatus[u]=e,e.status==="idle"?(tt.parallelTasks=null,Vf()):(tt._idleTimer&&(clearTimeout(tt._idleTimer),tt._idleTimer=null),Vf())}t.type==="system"&&t.subtype==="init"&&t.session_id&&(tt.sessionId=t.session_id,sessionStorage.setItem(Uj,t.session_id));const{include:r,msg:n}=Wj(t,oy());r&&(tt.messages=[...tt.messages,n],tt.messages.length>Hf&&(tt.messages=tt.messages.slice(-Hf)),tt.onMessagesChange&&tt.onMessagesChange(tt.messages))}function ch(){if(tt.es)return;const t=O0()?R0("/api/agent/proxy/stream"):`${window.location.protocol}//${window.location.hostname}:${ay}/api/agent/stream`,e=kT({url:t,namedEvents:["hydrate"],onOpen:()=>{tt.connected=!0,tt.streamError=null,tt.retryInfo=null,tt.stalled=!1,tt.sourceStatus.build=null,tt.onConnectedChange&&tt.onConnectedChange(!0),tt.onStreamErrorChange&&tt.onStreamErrorChange({error:null,retryInfo:null,stalled:!1})},onClose:()=>{tt.connected=!1,tt.onConnectedChange&&tt.onConnectedChange(!1)},onError:r=>{tt.streamError=(r==null?void 0:r.message)||"Connection error",tt.onStreamErrorChange&&tt.onStreamErrorChange({error:tt.streamError,retryInfo:tt.retryInfo,stalled:tt.stalled})},onRetry:r=>{tt.retryInfo=r,tt.onStreamErrorChange&&tt.onStreamErrorChange({error:tt.streamError,retryInfo:r,stalled:tt.stalled})},onStall:()=>{tt.stalled=!0,tt.onStreamErrorChange&&tt.onStreamErrorChange({error:tt.streamError,retryInfo:tt.retryInfo,stalled:!0})},onExhausted:()=>{tt.es=null,tt.retryInfo=null,tt.onStreamErrorChange&&tt.onStreamErrorChange({error:tt.streamError,retryInfo:null,stalled:tt.stalled})},onEvent:(r,n)=>{if((tt.stalled||tt.streamError)&&(tt.stalled=!1,tt.streamError=null,tt.retryInfo=null,tt.onStreamErrorChange&&tt.onStreamErrorChange({error:null,retryInfo:null,stalled:!1})),n==="hydrate"){if(Array.isArray(r))for(const i of r)yu(i);return}yu(r)},maxBackoffMs:8e3,maxRetries:5,stallTimeoutMs:ly});tt.es=e}async function hh(t,e){const r=O0()?t.replace(/^\/api\/agent\//,"/api/agent/proxy/"):`${window.location.protocol}//${window.location.hostname}:${ay}${t}`,n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json","x-compose-token":""},body:JSON.stringify(e)});if(!n.ok){const i=await n.json().catch(()=>({error:n.statusText}));throw new Error(i.error||n.statusText)}return n.json()}function Yf(t){if(!t)return"";if(t<1e3)return"<1s";const e=Math.floor(t/1e3);return e<60?`${e}s`:`${Math.floor(e/60)}m ${e%60}s`}function cy(){var L;const[t,e]=C.useState(tt.connected),[r,n]=C.useState(tt.messages),[i,s]=C.useState({status:tt.agentStatus,tool:tt.agentTool,category:tt.agentCategory,activityLog:tt.activityLog,currentActivity:tt.currentActivity}),[o,a]=C.useState(!1),[c,h]=C.useState(null),[u,d]=C.useState({error:tt.streamError,retryInfo:tt.retryInfo,stalled:tt.stalled}),f=C.useRef(null),p=C.useRef(null),m=C.useRef(!1),x=r.length===0||r.every(B=>B.type==="system"&&(B.subtype==="init"||B.subtype==="connected"));C.useEffect(()=>(tt.onConnectedChange=e,tt.onMessagesChange=n,tt.onAgentStatusChange=s,tt.onStreamErrorChange=d,()=>{tt.onConnectedChange=null,tt.onMessagesChange=null,tt.onAgentStatusChange=null,tt.onStreamErrorChange=null}),[]),C.useEffect(()=>{ch()},[]);const g=C.useCallback(()=>{const B=p.current;if(!B)return;const N=B.scrollHeight-B.scrollTop-B.clientHeight<48;m.current=!N},[]);C.useEffect(()=>{var B;m.current||(B=f.current)==null||B.scrollIntoView({behavior:"smooth"})},[r.length]),C.useEffect(()=>{if(i.status!=="working"||!i.currentActivity){h(null);return}const B=i.currentActivity.startTime,N=()=>h(Date.now()-B);N();const A=setInterval(N,1e3);return()=>clearInterval(A)},[i.status,(L=i.currentActivity)==null?void 0:L.startTime]);const y=C.useCallback(async B=>{a(!0);const N=B.match(/[A-Z]+-\d+/);N&&window.dispatchEvent(new CustomEvent("compose:select-feature",{detail:{featureCode:N[0]}}));try{x||!tt.sessionId?await hh("/api/agent/session",{prompt:B}):await hh("/api/agent/message",{prompt:B})}catch(A){yu({type:"error",message:`Failed to send: ${A.message}`})}finally{a(!1)}},[x]),k=C.useCallback(async()=>{try{await hh("/api/agent/interrupt",{})}catch{}},[]),b=t&&(i.status==="working"||o),w=t?b?"#fbbf24":"hsl(var(--success, 142 60% 50%))":"hsl(var(--destructive))",_=i.category?Gj[i.category]:null,T=t?b?_||"working":"ready":"offline",S=i.activityLog||[];return l.jsxs("div",{className:"relative w-full h-full flex flex-col",style:{background:"hsl(var(--background))"},children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-3 py-1.5",style:{borderBottom:"1px solid hsl(var(--border) / 0.5)"},children:[l.jsx("div",{className:"flex items-center gap-0.5",children:t&&S.length>0&&S.slice(-5).map((B,N)=>l.jsx("div",{className:"h-1 rounded-full",title:`${B.tool||"thinking"} — ${Yf(B.duration)}`,style:{width:Math.max(6,Math.min(20,(B.duration||0)/1e3*2)),background:"hsl(var(--muted-foreground))",opacity:.25+N/5*.5}},N))}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[b&&l.jsx("button",{onClick:k,title:"Interrupt",className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"hsl(var(--destructive) / 0.15)",color:"hsl(var(--destructive))",border:"1px solid hsl(var(--destructive) / 0.3)",cursor:"pointer"},children:"stop"}),l.jsx("div",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:w,animation:b?"pulse 1.5s ease-in-out infinite":"none"}}),l.jsx("span",{className:"text-[10px] uppercase tracking-wider",style:{color:b?"#fbbf24":"hsl(var(--muted-foreground))"},children:T}),b&&i.tool&&l.jsx("span",{className:"text-[10px] font-mono",style:{color:"hsl(var(--muted-foreground))"},children:i.tool}),b&&c!=null&&l.jsx("span",{className:"text-[10px] tabular-nums",style:{color:"hsl(var(--muted-foreground))",opacity:.6},children:Yf(c)})]})]}),l.jsxs("div",{ref:p,onScroll:g,className:"flex-1 min-h-0 overflow-y-auto px-3 py-2",style:{scrollBehavior:"smooth"},children:[r.length===0&&l.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 opacity-40",children:[l.jsx("span",{className:"text-2xl",children:"⬡"}),l.jsx("span",{className:"text-xs uppercase tracking-widest",style:{color:"hsl(var(--muted-foreground))"},children:t?"ready":"connecting…"})]}),Hj(r).map((B,N)=>l.jsx(Oj,{msg:B},B.uuid||N)),l.jsx("div",{ref:f})]}),!t&&l.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center pointer-events-none",style:{background:"hsl(var(--background) / 0.7)",backdropFilter:"blur(2px)"},children:l.jsxs("div",{className:"flex flex-col items-center gap-3",role:"status","aria-live":"polite",children:[l.jsx("div",{className:"w-5 h-5 rounded-full animate-spin",style:{border:"2px solid hsl(var(--accent) / 0.2)",borderTopColor:"hsl(var(--accent))"}}),l.jsx("span",{className:"text-xs",style:{color:"hsl(var(--muted-foreground))"},children:u.retryInfo?`Retrying… ${u.retryInfo.attempt}/${u.retryInfo.maxRetries}`:"connecting to agent server…"}),u.error&&l.jsx("span",{className:"text-[10px]",style:{color:"hsl(var(--destructive))"},children:u.error}),!tt.es&&u.error&&l.jsx("button",{onClick:()=>{tt.streamError=null,tt.retryInfo=null,tt.stalled=!1,d({error:null,retryInfo:null,stalled:!1}),ch()},className:"pointer-events-auto px-3 py-1 rounded text-[11px] font-medium",style:{background:"hsl(var(--accent) / 0.15)",border:"1px solid hsl(var(--accent) / 0.3)",color:"hsl(var(--accent-foreground))",cursor:"pointer"},children:"Reconnect"})]})}),t&&(u.error||u.stalled)&&l.jsx("div",{role:"status","aria-live":"polite",className:"shrink-0 flex items-center gap-2 px-3 py-1.5 text-[11px]",style:{background:u.stalled?"hsl(45 93% 47% / 0.1)":"hsl(var(--destructive) / 0.1)",borderBottom:`1px solid ${u.stalled?"hsl(45 93% 47% / 0.2)":"hsl(var(--destructive) / 0.2)"}`,color:u.stalled?"hsl(45 93% 47%)":"hsl(var(--destructive))"},children:u.stalled?l.jsxs(l.Fragment,{children:[l.jsxs("span",{children:["No data received for ",ly/1e3,"s — connection may be stalled."]}),l.jsx("button",{onClick:()=>{tt.es&&(tt.es.close(),tt.es=null),tt.connected=!1,tt.onConnectedChange&&tt.onConnectedChange(!1),tt.streamError=null,tt.retryInfo=null,tt.stalled=!1,d({error:null,retryInfo:null,stalled:!1}),ch()},className:"ml-auto px-2 py-0.5 rounded text-[10px] font-medium",style:{background:"hsl(45 93% 47% / 0.15)",border:"1px solid hsl(45 93% 47% / 0.3)",cursor:"pointer"},children:"Reconnect"})]}):l.jsx("span",{children:u.error})}),l.jsx(Rj,{onSend:y,disabled:b||!t,placeholder:b?"Working…":"Message Claude…"})]})}function Kj(t,e){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const Qj=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Zj=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Jj={};function Gf(t,e){return(Jj.jsx?Zj:Qj).test(t)}const tN=/[ \t\n\f\r]/g;function eN(t){return typeof t=="object"?t.type==="text"?Xf(t.value):!1:Xf(t)}function Xf(t){return t.replace(tN,"")===""}class na{constructor(e,r,n){this.normal=r,this.property=e,n&&(this.space=n)}}na.prototype.normal={};na.prototype.property={};na.prototype.space=void 0;function hy(t,e){const r={},n={};for(const i of t)Object.assign(r,i.property),Object.assign(n,i.normal);return new na(r,n,e)}function bu(t){return t.toLowerCase()}class ur{constructor(e,r){this.attribute=r,this.property=e}}ur.prototype.attribute="";ur.prototype.booleanish=!1;ur.prototype.boolean=!1;ur.prototype.commaOrSpaceSeparated=!1;ur.prototype.commaSeparated=!1;ur.prototype.defined=!1;ur.prototype.mustUseProperty=!1;ur.prototype.number=!1;ur.prototype.overloadedBoolean=!1;ur.prototype.property="";ur.prototype.spaceSeparated=!1;ur.prototype.space=void 0;let rN=0;const $t=xi(),ve=xi(),Cu=xi(),ot=xi(),ce=xi(),Wi=xi(),gr=xi();function xi(){return 2**++rN}const ku=Object.freeze(Object.defineProperty({__proto__:null,boolean:$t,booleanish:ve,commaOrSpaceSeparated:gr,commaSeparated:Wi,number:ot,overloadedBoolean:Cu,spaceSeparated:ce},Symbol.toStringTag,{value:"Module"})),uh=Object.keys(ku);class Zd extends ur{constructor(e,r,n,i){let s=-1;if(super(e,r),Kf(this,"space",i),typeof n=="number")for(;++s<uh.length;){const o=uh[s];Kf(this,uh[s],(n&ku[o])===ku[o])}}}Zd.prototype.defined=!0;function Kf(t,e,r){r&&(t[e]=r)}function vs(t){const e={},r={};for(const[n,i]of Object.entries(t.properties)){const s=new Zd(n,t.transform(t.attributes||{},n),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(n)&&(s.mustUseProperty=!0),e[n]=s,r[bu(n)]=n,r[bu(s.attribute)]=n}return new na(e,r,t.space)}const uy=vs({properties:{ariaActiveDescendant:null,ariaAtomic:ve,ariaAutoComplete:null,ariaBusy:ve,ariaChecked:ve,ariaColCount:ot,ariaColIndex:ot,ariaColSpan:ot,ariaControls:ce,ariaCurrent:null,ariaDescribedBy:ce,ariaDetails:null,ariaDisabled:ve,ariaDropEffect:ce,ariaErrorMessage:null,ariaExpanded:ve,ariaFlowTo:ce,ariaGrabbed:ve,ariaHasPopup:null,ariaHidden:ve,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ce,ariaLevel:ot,ariaLive:null,ariaModal:ve,ariaMultiLine:ve,ariaMultiSelectable:ve,ariaOrientation:null,ariaOwns:ce,ariaPlaceholder:null,ariaPosInSet:ot,ariaPressed:ve,ariaReadOnly:ve,ariaRelevant:null,ariaRequired:ve,ariaRoleDescription:ce,ariaRowCount:ot,ariaRowIndex:ot,ariaRowSpan:ot,ariaSelected:ve,ariaSetSize:ot,ariaSort:null,ariaValueMax:ot,ariaValueMin:ot,ariaValueNow:ot,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function dy(t,e){return e in t?t[e]:e}function py(t,e){return dy(t,e.toLowerCase())}const nN=vs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Wi,acceptCharset:ce,accessKey:ce,action:null,allow:null,allowFullScreen:$t,allowPaymentRequest:$t,allowUserMedia:$t,alt:null,as:null,async:$t,autoCapitalize:null,autoComplete:ce,autoFocus:$t,autoPlay:$t,blocking:ce,capture:null,charSet:null,checked:$t,cite:null,className:ce,cols:ot,colSpan:null,content:null,contentEditable:ve,controls:$t,controlsList:ce,coords:ot|Wi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:$t,defer:$t,dir:null,dirName:null,disabled:$t,download:Cu,draggable:ve,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:$t,formTarget:null,headers:ce,height:ot,hidden:Cu,high:ot,href:null,hrefLang:null,htmlFor:ce,httpEquiv:ce,id:null,imageSizes:null,imageSrcSet:null,inert:$t,inputMode:null,integrity:null,is:null,isMap:$t,itemId:null,itemProp:ce,itemRef:ce,itemScope:$t,itemType:ce,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:$t,low:ot,manifest:null,max:null,maxLength:ot,media:null,method:null,min:null,minLength:ot,multiple:$t,muted:$t,name:null,nonce:null,noModule:$t,noValidate:$t,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:$t,optimum:ot,pattern:null,ping:ce,placeholder:null,playsInline:$t,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:$t,referrerPolicy:null,rel:ce,required:$t,reversed:$t,rows:ot,rowSpan:ot,sandbox:ce,scope:null,scoped:$t,seamless:$t,selected:$t,shadowRootClonable:$t,shadowRootDelegatesFocus:$t,shadowRootMode:null,shape:null,size:ot,sizes:null,slot:null,span:ot,spellCheck:ve,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ot,step:null,style:null,tabIndex:ot,target:null,title:null,translate:null,type:null,typeMustMatch:$t,useMap:null,value:ve,width:ot,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ce,axis:null,background:null,bgColor:null,border:ot,borderColor:null,bottomMargin:ot,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:$t,declare:$t,event:null,face:null,frame:null,frameBorder:null,hSpace:ot,leftMargin:ot,link:null,longDesc:null,lowSrc:null,marginHeight:ot,marginWidth:ot,noResize:$t,noHref:$t,noShade:$t,noWrap:$t,object:null,profile:null,prompt:null,rev:null,rightMargin:ot,rules:null,scheme:null,scrolling:ve,standby:null,summary:null,text:null,topMargin:ot,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ot,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:$t,disableRemotePlayback:$t,prefix:null,property:null,results:ot,security:null,unselectable:null},space:"html",transform:py}),iN=vs({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:gr,accentHeight:ot,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ot,amplitude:ot,arabicForm:null,ascent:ot,attributeName:null,attributeType:null,azimuth:ot,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ot,by:null,calcMode:null,capHeight:ot,className:ce,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ot,diffuseConstant:ot,direction:null,display:null,dur:null,divisor:ot,dominantBaseline:null,download:$t,dx:null,dy:null,edgeMode:null,editable:null,elevation:ot,enableBackground:null,end:null,event:null,exponent:ot,externalResourcesRequired:null,fill:null,fillOpacity:ot,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Wi,g2:Wi,glyphName:Wi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ot,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ot,horizOriginX:ot,horizOriginY:ot,id:null,ideographic:ot,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ot,k:ot,k1:ot,k2:ot,k3:ot,k4:ot,kernelMatrix:gr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ot,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ot,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ot,overlineThickness:ot,paintOrder:null,panose1:null,path:null,pathLength:ot,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ce,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ot,pointsAtY:ot,pointsAtZ:ot,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:gr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:gr,rev:gr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:gr,requiredFeatures:gr,requiredFonts:gr,requiredFormats:gr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ot,specularExponent:ot,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ot,strikethroughThickness:ot,string:null,stroke:null,strokeDashArray:gr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ot,strokeOpacity:ot,strokeWidth:null,style:null,surfaceScale:ot,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:gr,tabIndex:ot,tableValues:null,target:null,targetX:ot,targetY:ot,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:gr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ot,underlineThickness:ot,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ot,values:null,vAlphabetic:ot,vMathematical:ot,vectorEffect:null,vHanging:ot,vIdeographic:ot,version:null,vertAdvY:ot,vertOriginX:ot,vertOriginY:ot,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ot,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:dy}),fy=vs({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),my=vs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:py}),gy=vs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),sN={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},oN=/[A-Z]/g,Qf=/-[a-z]/g,aN=/^data[-\w.:]+$/i;function lN(t,e){const r=bu(e);let n=e,i=ur;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&aN.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(Qf,hN);n="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!Qf.test(s)){let o=s.replace(oN,cN);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=Zd}return new i(n,e)}function cN(t){return"-"+t.toLowerCase()}function hN(t){return t.charAt(1).toUpperCase()}const uN=hy([uy,nN,fy,my,gy],"html"),Jd=hy([uy,iN,fy,my,gy],"svg");function dN(t){return t.join(" ").trim()}var _i={},dh,Zf;function pN(){if(Zf)return dh;Zf=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,a=/^\s+|\s+$/g,c=`
311
- `,h="/",u="*",d="",f="comment",p="declaration";function m(g,y){if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)return[];y=y||{};var k=1,b=1;function w(P){var I=P.match(e);I&&(k+=I.length);var F=P.lastIndexOf(c);b=~F?P.length-F:b+P.length}function _(){var P={line:k,column:b};return function(I){return I.position=new T(P),B(),I}}function T(P){this.start=P,this.end={line:k,column:b},this.source=y.source}T.prototype.content=g;function S(P){var I=new Error(y.source+":"+k+":"+b+": "+P);if(I.reason=P,I.filename=y.source,I.line=k,I.column=b,I.source=g,!y.silent)throw I}function L(P){var I=P.exec(g);if(I){var F=I[0];return w(F),g=g.slice(F.length),I}}function B(){L(r)}function N(P){var I;for(P=P||[];I=A();)I!==!1&&P.push(I);return P}function A(){var P=_();if(!(h!=g.charAt(0)||u!=g.charAt(1))){for(var I=2;d!=g.charAt(I)&&(u!=g.charAt(I)||h!=g.charAt(I+1));)++I;if(I+=2,d===g.charAt(I-1))return S("End of comment missing");var F=g.slice(2,I-2);return b+=2,w(F),g=g.slice(I),b+=2,P({type:f,comment:F})}}function R(){var P=_(),I=L(n);if(I){if(A(),!L(i))return S("property missing ':'");var F=L(s),$=P({type:p,property:x(I[0].replace(t,d)),value:F?x(F[0].replace(t,d)):d});return L(o),$}}function z(){var P=[];N(P);for(var I;I=R();)I!==!1&&(P.push(I),N(P));return P}return B(),z()}function x(g){return g?g.replace(a,d):d}return dh=m,dh}var Jf;function fN(){if(Jf)return _i;Jf=1;var t=_i&&_i.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(_i,"__esModule",{value:!0}),_i.default=r;const e=t(pN());function r(n,i){let s=null;if(!n||typeof n!="string")return s;const o=(0,e.default)(n),a=typeof i=="function";return o.forEach(c=>{if(c.type!=="declaration")return;const{property:h,value:u}=c;a?i(h,u,c):u&&(s=s||{},s[h]=u)}),s}return _i}var qs={},tm;function mN(){if(tm)return qs;tm=1,Object.defineProperty(qs,"__esModule",{value:!0}),qs.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,r=/^[^-]+$/,n=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(h){return!h||r.test(h)||t.test(h)},o=function(h,u){return u.toUpperCase()},a=function(h,u){return"".concat(u,"-")},c=function(h,u){return u===void 0&&(u={}),s(h)?h:(h=h.toLowerCase(),u.reactCompat?h=h.replace(i,a):h=h.replace(n,a),h.replace(e,o))};return qs.camelCase=c,qs}var Ws,em;function gN(){if(em)return Ws;em=1;var t=Ws&&Ws.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(fN()),r=mN();function n(i,s){var o={};return!i||typeof i!="string"||(0,e.default)(i,function(a,c){a&&c&&(o[(0,r.camelCase)(a,s)]=c)}),o}return n.default=n,Ws=n,Ws}var xN=gN();const yN=zd(xN),xy=yy("end"),tp=yy("start");function yy(t){return e;function e(r){const n=r&&r.position&&r.position[t]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function bN(t){const e=tp(t),r=xy(t);if(e&&r)return{start:e,end:r}}function So(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?rm(t.position):"start"in t||"end"in t?rm(t):"line"in t||"column"in t?vu(t):""}function vu(t){return nm(t&&t.line)+":"+nm(t&&t.column)}function rm(t){return vu(t&&t.start)+"-"+vu(t&&t.end)}function nm(t){return t&&typeof t=="number"?t:1}class Ue extends Error{constructor(e,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",s={},o=!1;if(r&&("line"in r&&"column"in r?s={place:r}:"start"in r&&"end"in r?s={place:r}:"type"in r?s={ancestors:[r],place:r.position}:s={...r}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof n=="string"){const c=n.indexOf(":");c===-1?s.ruleId=n:(s.source=n.slice(0,c),s.ruleId=n.slice(c+1))}if(!s.place&&s.ancestors&&s.ancestors){const c=s.ancestors[s.ancestors.length-1];c&&(s.place=c.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=So(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ue.prototype.file="";Ue.prototype.name="";Ue.prototype.reason="";Ue.prototype.message="";Ue.prototype.stack="";Ue.prototype.column=void 0;Ue.prototype.line=void 0;Ue.prototype.ancestors=void 0;Ue.prototype.cause=void 0;Ue.prototype.fatal=void 0;Ue.prototype.place=void 0;Ue.prototype.ruleId=void 0;Ue.prototype.source=void 0;const ep={}.hasOwnProperty,CN=new Map,kN=/[A-Z]/g,vN=new Set(["table","tbody","thead","tfoot","tr"]),wN=new Set(["td","th"]),by="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function SN(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=e.filePath||void 0;let n;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=AN(r,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=BN(r,e.jsx,e.jsxs)}const i={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:n,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?Jd:uN,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=Cy(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function Cy(t,e,r){if(e.type==="element")return TN(t,e,r);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return _N(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return NN(t,e,r);if(e.type==="mdxjsEsm")return jN(t,e);if(e.type==="root")return EN(t,e,r);if(e.type==="text")return LN(t,e)}function TN(t,e,r){const n=t.schema;let i=n;e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=Jd,t.schema=i),t.ancestors.push(e);const s=vy(t,e.tagName,!1),o=MN(t,e);let a=np(t,e);return vN.has(e.tagName)&&(a=a.filter(function(c){return typeof c=="string"?!eN(c):!0})),ky(t,o,s,e),rp(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function _N(t,e){if(e.data&&e.data.estree&&t.evaluater){const n=e.data.estree.body[0];return n.type,t.evaluater.evaluateExpression(n.expression)}Do(t,e.position)}function jN(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Do(t,e.position)}function NN(t,e,r){const n=t.schema;let i=n;e.name==="svg"&&n.space==="html"&&(i=Jd,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:vy(t,e.name,!0),o=IN(t,e),a=np(t,e);return ky(t,o,s,e),rp(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function EN(t,e,r){const n={};return rp(n,np(t,e)),t.create(e,t.Fragment,n,r)}function LN(t,e){return e.value}function ky(t,e,r,n){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(e.node=n)}function rp(t,e){if(e.length>0){const r=e.length>1?e:e[0];r&&(t.children=r)}}function BN(t,e,r){return n;function n(i,s,o,a){const h=Array.isArray(o.children)?r:e;return a?h(s,o,a):h(s,o)}}function AN(t,e){return r;function r(n,i,s,o){const a=Array.isArray(s.children),c=tp(n);return e(i,s,o,a,{columnNumber:c?c.column-1:void 0,fileName:t,lineNumber:c?c.line:void 0},void 0)}}function MN(t,e){const r={};let n,i;for(i in e.properties)if(i!=="children"&&ep.call(e.properties,i)){const s=FN(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&wN.has(e.tagName)?n=a:r[o]=a}}if(n){const s=r.style||(r.style={});s[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function IN(t,e){const r={};for(const n of e.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&t.evaluater){const s=n.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(r,t.evaluater.evaluateExpression(a.argument))}else Do(t,e.position);else{const i=n.name;let s;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&t.evaluater){const a=n.value.data.estree.body[0];a.type,s=t.evaluater.evaluateExpression(a.expression)}else Do(t,e.position);else s=n.value===null?!0:n.value;r[i]=s}return r}function np(t,e){const r=[];let n=-1;const i=t.passKeys?new Map:CN;for(;++n<e.children.length;){const s=e.children[n];let o;if(t.passKeys){const c=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(c){const h=i.get(c)||0;o=c+"-"+h,i.set(c,h+1)}}const a=Cy(t,s,o);a!==void 0&&r.push(a)}return r}function FN(t,e,r){const n=lN(t.schema,e);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?Kj(r):dN(r)),n.property==="style"){let i=typeof r=="object"?r:PN(t,String(r));return t.stylePropertyNameCase==="css"&&(i=$N(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&n.space?sN[n.property]||n.property:n.attribute,r]}}function PN(t,e){try{return yN(e,{reactCompat:!0})}catch(r){if(t.ignoreInvalidStyle)return{};const n=r,i=new Ue("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=t.filePath||void 0,i.url=by+"#cannot-parse-style-attribute",i}}function vy(t,e,r){let n;if(!r)n={type:"Literal",value:e};else if(e.includes(".")){const i=e.split(".");let s=-1,o;for(;++s<i.length;){const a=Gf(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}n=o}else n=Gf(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(n.type==="Literal"){const i=n.value;return ep.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(n);Do(t)}function Do(t,e){const r=new Ue("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=t.filePath||void 0,r.url=by+"#cannot-handle-mdx-estrees-without-createevaluater",r}function $N(t){const e={};let r;for(r in t)ep.call(t,r)&&(e[DN(r)]=t[r]);return e}function DN(t){let e=t.replace(kN,ON);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function ON(t){return"-"+t.toLowerCase()}const ph={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},RN={};function ip(t,e){const r=RN,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return wy(t,n,i)}function wy(t,e,r){if(zN(t)){if("value"in t)return t.type==="html"&&!r?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return im(t.children,e,r)}return Array.isArray(t)?im(t,e,r):""}function im(t,e,r){const n=[];let i=-1;for(;++i<t.length;)n[i]=wy(t[i],e,r);return n.join("")}function zN(t){return!!(t&&typeof t=="object")}const sm=document.createElement("i");function sp(t){const e="&"+t+";";sm.innerHTML=e;const r=sm.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===e?!1:r}function xr(t,e,r,n){const i=t.length;let s=0,o;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,r=r>0?r:0,n.length<1e4)o=Array.from(n),o.unshift(e,r),t.splice(...o);else for(r&&t.splice(e,r);s<n.length;)o=n.slice(s,s+1e4),o.unshift(e,0),t.splice(...o),s+=1e4,e+=1e4}function vr(t,e){return t.length>0?(xr(t,t.length,0,e),t):e}const om={}.hasOwnProperty;function Sy(t){const e={};let r=-1;for(;++r<t.length;)qN(e,t[r]);return e}function qN(t,e){let r;for(r in e){const i=(om.call(t,r)?t[r]:void 0)||(t[r]={}),s=e[r];let o;if(s)for(o in s){om.call(i,o)||(i[o]=[]);const a=s[o];WN(i[o],Array.isArray(a)?a:a?[a]:[])}}}function WN(t,e){let r=-1;const n=[];for(;++r<e.length;)(e[r].add==="after"?t:n).push(e[r]);xr(t,0,0,n)}function Ty(t,e){const r=Number.parseInt(t,e);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Ir(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ke=Dn(/[A-Za-z]/),We=Dn(/[\dA-Za-z]/),HN=Dn(/[#-'*+\--9=?A-Z^-~]/);function wl(t){return t!==null&&(t<32||t===127)}const wu=Dn(/\d/),UN=Dn(/[\dA-Fa-f]/),VN=Dn(/[!-/:-@[-`{-~]/);function jt(t){return t!==null&&t<-2}function ae(t){return t!==null&&(t<0||t===32)}function zt(t){return t===-2||t===-1||t===32}const wc=Dn(new RegExp("\\p{P}|\\p{S}","u")),oi=Dn(/\s/);function Dn(t){return e;function e(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function ws(t){const e=[];let r=-1,n=0,i=0;for(;++r<t.length;){const s=t.charCodeAt(r);let o="";if(s===37&&We(t.charCodeAt(r+1))&&We(t.charCodeAt(r+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=t.charCodeAt(r+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(e.push(t.slice(n,r),encodeURIComponent(o)),n=r+i+1,o=""),i&&(r+=i,i=0)}return e.join("")+t.slice(n)}function Ut(t,e,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(c){return zt(c)?(t.enter(r),a(c)):e(c)}function a(c){return zt(c)&&s++<i?(t.consume(c),a):(t.exit(r),e(c))}}const YN={tokenize:GN};function GN(t){const e=t.attempt(this.parser.constructs.contentInitial,n,i);let r;return e;function n(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),Ut(t,e,"linePrefix")}function i(a){return t.enter("paragraph"),s(a)}function s(a){const c=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=c),r=c,o(a)}function o(a){if(a===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(a);return}return jt(a)?(t.consume(a),t.exit("chunkText"),s):(t.consume(a),o)}}const XN={tokenize:KN},am={tokenize:QN};function KN(t){const e=this,r=[];let n=0,i,s,o;return a;function a(b){if(n<r.length){const w=r[n];return e.containerState=w[1],t.attempt(w[0].continuation,c,h)(b)}return h(b)}function c(b){if(n++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&k();const w=e.events.length;let _=w,T;for(;_--;)if(e.events[_][0]==="exit"&&e.events[_][1].type==="chunkFlow"){T=e.events[_][1].end;break}y(n);let S=w;for(;S<e.events.length;)e.events[S][1].end={...T},S++;return xr(e.events,_+1,0,e.events.slice(w)),e.events.length=S,h(b)}return a(b)}function h(b){if(n===r.length){if(!i)return f(b);if(i.currentConstruct&&i.currentConstruct.concrete)return m(b);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(am,u,d)(b)}function u(b){return i&&k(),y(n),f(b)}function d(b){return e.parser.lazy[e.now().line]=n!==r.length,o=e.now().offset,m(b)}function f(b){return e.containerState={},t.attempt(am,p,m)(b)}function p(b){return n++,r.push([e.currentConstruct,e.containerState]),f(b)}function m(b){if(b===null){i&&k(),y(0),t.consume(b);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),x(b)}function x(b){if(b===null){g(t.exit("chunkFlow"),!0),y(0),t.consume(b);return}return jt(b)?(t.consume(b),g(t.exit("chunkFlow")),n=0,e.interrupt=void 0,a):(t.consume(b),x)}function g(b,w){const _=e.sliceStream(b);if(w&&_.push(null),b.previous=s,s&&(s.next=b),s=b,i.defineSkip(b.start),i.write(_),e.parser.lazy[b.start.line]){let T=i.events.length;for(;T--;)if(i.events[T][1].start.offset<o&&(!i.events[T][1].end||i.events[T][1].end.offset>o))return;const S=e.events.length;let L=S,B,N;for(;L--;)if(e.events[L][0]==="exit"&&e.events[L][1].type==="chunkFlow"){if(B){N=e.events[L][1].end;break}B=!0}for(y(n),T=S;T<e.events.length;)e.events[T][1].end={...N},T++;xr(e.events,L+1,0,e.events.slice(S)),e.events.length=T}}function y(b){let w=r.length;for(;w-- >b;){const _=r[w];e.containerState=_[1],_[0].exit.call(e,t)}r.length=b}function k(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function QN(t,e,r){return Ut(t,t.attempt(this.parser.constructs.document,e,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ls(t){if(t===null||ae(t)||oi(t))return 1;if(wc(t))return 2}function Sc(t,e,r){const n=[];let i=-1;for(;++i<t.length;){const s=t[i].resolveAll;s&&!n.includes(s)&&(e=s(e,r),n.push(s))}return e}const Su={name:"attention",resolveAll:ZN,tokenize:JN};function ZN(t,e){let r=-1,n,i,s,o,a,c,h,u;for(;++r<t.length;)if(t[r][0]==="enter"&&t[r][1].type==="attentionSequence"&&t[r][1]._close){for(n=r;n--;)if(t[n][0]==="exit"&&t[n][1].type==="attentionSequence"&&t[n][1]._open&&e.sliceSerialize(t[n][1]).charCodeAt(0)===e.sliceSerialize(t[r][1]).charCodeAt(0)){if((t[n][1]._close||t[r][1]._open)&&(t[r][1].end.offset-t[r][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[r][1].end.offset-t[r][1].start.offset)%3))continue;c=t[n][1].end.offset-t[n][1].start.offset>1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;const d={...t[n][1].end},f={...t[r][1].start};lm(d,-c),lm(f,c),o={type:c>1?"strongSequence":"emphasisSequence",start:d,end:{...t[n][1].end}},a={type:c>1?"strongSequence":"emphasisSequence",start:{...t[r][1].start},end:f},s={type:c>1?"strongText":"emphasisText",start:{...t[n][1].end},end:{...t[r][1].start}},i={type:c>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},t[n][1].end={...o.start},t[r][1].start={...a.end},h=[],t[n][1].end.offset-t[n][1].start.offset&&(h=vr(h,[["enter",t[n][1],e],["exit",t[n][1],e]])),h=vr(h,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),h=vr(h,Sc(e.parser.constructs.insideSpan.null,t.slice(n+1,r),e)),h=vr(h,[["exit",s,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[r][1].end.offset-t[r][1].start.offset?(u=2,h=vr(h,[["enter",t[r][1],e],["exit",t[r][1],e]])):u=0,xr(t,n-1,r-n+3,h),r=n+h.length-u-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function JN(t,e){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=ls(n);let s;return o;function o(c){return s=c,t.enter("attentionSequence"),a(c)}function a(c){if(c===s)return t.consume(c),a;const h=t.exit("attentionSequence"),u=ls(c),d=!u||u===2&&i||r.includes(c),f=!i||i===2&&u||r.includes(n);return h._open=!!(s===42?d:d&&(i||!f)),h._close=!!(s===42?f:f&&(u||!d)),e(c)}}function lm(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const t5={name:"autolink",tokenize:e5};function e5(t,e,r){let n=0;return i;function i(p){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(p){return Ke(p)?(t.consume(p),o):p===64?r(p):h(p)}function o(p){return p===43||p===45||p===46||We(p)?(n=1,a(p)):h(p)}function a(p){return p===58?(t.consume(p),n=0,c):(p===43||p===45||p===46||We(p))&&n++<32?(t.consume(p),a):(n=0,h(p))}function c(p){return p===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.exit("autolink"),e):p===null||p===32||p===60||wl(p)?r(p):(t.consume(p),c)}function h(p){return p===64?(t.consume(p),u):HN(p)?(t.consume(p),h):r(p)}function u(p){return We(p)?d(p):r(p)}function d(p){return p===46?(t.consume(p),n=0,u):p===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.exit("autolink"),e):f(p)}function f(p){if((p===45||We(p))&&n++<63){const m=p===45?f:d;return t.consume(p),m}return r(p)}}const ia={partial:!0,tokenize:r5};function r5(t,e,r){return n;function n(s){return zt(s)?Ut(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||jt(s)?e(s):r(s)}}const _y={continuation:{tokenize:i5},exit:s5,name:"blockQuote",tokenize:n5};function n5(t,e,r){const n=this;return i;function i(o){if(o===62){const a=n.containerState;return a.open||(t.enter("blockQuote",{_container:!0}),a.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),s}return r(o)}function s(o){return zt(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function i5(t,e,r){const n=this;return i;function i(o){return zt(o)?Ut(t,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(_y,e,r)(o)}}function s5(t){t.exit("blockQuote")}const jy={name:"characterEscape",tokenize:o5};function o5(t,e,r){return n;function n(s){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(s),t.exit("escapeMarker"),i}function i(s){return VN(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):r(s)}}const Ny={name:"characterReference",tokenize:a5};function a5(t,e,r){const n=this;let i=0,s,o;return a;function a(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),c}function c(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),h):(t.enter("characterReferenceValue"),s=31,o=We,u(d))}function h(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=UN,u):(t.enter("characterReferenceValue"),s=7,o=wu,u(d))}function u(d){if(d===59&&i){const f=t.exit("characterReferenceValue");return o===We&&!sp(n.sliceSerialize(f))?r(d):(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(d)&&i++<s?(t.consume(d),u):r(d)}}const cm={partial:!0,tokenize:c5},hm={concrete:!0,name:"codeFenced",tokenize:l5};function l5(t,e,r){const n=this,i={partial:!0,tokenize:_};let s=0,o=0,a;return c;function c(T){return h(T)}function h(T){const S=n.events[n.events.length-1];return s=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,a=T,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(T)}function u(T){return T===a?(o++,t.consume(T),u):o<3?r(T):(t.exit("codeFencedFenceSequence"),zt(T)?Ut(t,d,"whitespace")(T):d(T))}function d(T){return T===null||jt(T)?(t.exit("codeFencedFence"),n.interrupt?e(T):t.check(cm,x,w)(T)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),f(T))}function f(T){return T===null||jt(T)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(T)):zt(T)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Ut(t,p,"whitespace")(T)):T===96&&T===a?r(T):(t.consume(T),f)}function p(T){return T===null||jt(T)?d(T):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),m(T))}function m(T){return T===null||jt(T)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(T)):T===96&&T===a?r(T):(t.consume(T),m)}function x(T){return t.attempt(i,w,g)(T)}function g(T){return t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),y}function y(T){return s>0&&zt(T)?Ut(t,k,"linePrefix",s+1)(T):k(T)}function k(T){return T===null||jt(T)?t.check(cm,x,w)(T):(t.enter("codeFlowValue"),b(T))}function b(T){return T===null||jt(T)?(t.exit("codeFlowValue"),k(T)):(t.consume(T),b)}function w(T){return t.exit("codeFenced"),e(T)}function _(T,S,L){let B=0;return N;function N(I){return T.enter("lineEnding"),T.consume(I),T.exit("lineEnding"),A}function A(I){return T.enter("codeFencedFence"),zt(I)?Ut(T,R,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):R(I)}function R(I){return I===a?(T.enter("codeFencedFenceSequence"),z(I)):L(I)}function z(I){return I===a?(B++,T.consume(I),z):B>=o?(T.exit("codeFencedFenceSequence"),zt(I)?Ut(T,P,"whitespace")(I):P(I)):L(I)}function P(I){return I===null||jt(I)?(T.exit("codeFencedFence"),S(I)):L(I)}}}function c5(t,e,r){const n=this;return i;function i(o){return o===null?r(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return n.parser.lazy[n.now().line]?r(o):e(o)}}const fh={name:"codeIndented",tokenize:u5},h5={partial:!0,tokenize:d5};function u5(t,e,r){const n=this;return i;function i(h){return t.enter("codeIndented"),Ut(t,s,"linePrefix",5)(h)}function s(h){const u=n.events[n.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(h):r(h)}function o(h){return h===null?c(h):jt(h)?t.attempt(h5,o,c)(h):(t.enter("codeFlowValue"),a(h))}function a(h){return h===null||jt(h)?(t.exit("codeFlowValue"),o(h)):(t.consume(h),a)}function c(h){return t.exit("codeIndented"),e(h)}}function d5(t,e,r){const n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):jt(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):Ut(t,s,"linePrefix",5)(o)}function s(o){const a=n.events[n.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):jt(o)?i(o):r(o)}}const p5={name:"codeText",previous:m5,resolve:f5,tokenize:g5};function f5(t){let e=t.length-4,r=3,n,i;if((t[r][1].type==="lineEnding"||t[r][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(n=r;++n<e;)if(t[n][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[e][1].type="codeTextPadding",r+=2,e-=2;break}}for(n=r-1,e++;++n<=e;)i===void 0?n!==e&&t[n][1].type!=="lineEnding"&&(i=n):(n===e||t[n][1].type==="lineEnding")&&(t[i][1].type="codeTextData",n!==i+2&&(t[i][1].end=t[n-1][1].end,t.splice(i+2,n-i-2),e-=n-i-2,n=i+2),i=void 0);return t}function m5(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function g5(t,e,r){let n=0,i,s;return o;function o(d){return t.enter("codeText"),t.enter("codeTextSequence"),a(d)}function a(d){return d===96?(t.consume(d),n++,a):(t.exit("codeTextSequence"),c(d))}function c(d){return d===null?r(d):d===32?(t.enter("space"),t.consume(d),t.exit("space"),c):d===96?(s=t.enter("codeTextSequence"),i=0,u(d)):jt(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),c):(t.enter("codeTextData"),h(d))}function h(d){return d===null||d===32||d===96||jt(d)?(t.exit("codeTextData"),c(d)):(t.consume(d),h)}function u(d){return d===96?(t.consume(d),i++,u):i===n?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(s.type="codeTextData",h(d))}}class x5{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,r){const n=r??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,r,n){const i=r||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&Hs(this.left,n),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Hs(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Hs(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const r=this.left.splice(e,Number.POSITIVE_INFINITY);Hs(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Hs(this.left,r.reverse())}}}function Hs(t,e){let r=0;if(e.length<1e4)t.push(...e);else for(;r<e.length;)t.push(...e.slice(r,r+1e4)),r+=1e4}function Ey(t){const e={};let r=-1,n,i,s,o,a,c,h;const u=new x5(t);for(;++r<u.length;){for(;r in e;)r=e[r];if(n=u.get(r),r&&n[1].type==="chunkFlow"&&u.get(r-1)[1].type==="listItemPrefix"&&(c=n[1]._tokenizer.events,s=0,s<c.length&&c[s][1].type==="lineEndingBlank"&&(s+=2),s<c.length&&c[s][1].type==="content"))for(;++s<c.length&&c[s][1].type!=="content";)c[s][1].type==="chunkText"&&(c[s][1]._isInFirstContentOfListItem=!0,s++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,y5(u,r)),r=e[r],h=!0);else if(n[1]._container){for(s=r,i=void 0;s--;)if(o=u.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(n[1].end={...u.get(i)[1].start},a=u.slice(i,r),a.unshift(n),u.splice(i,r-i+1,a))}}return xr(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!h}function y5(t,e){const r=t.get(e)[1],n=t.get(e)[2];let i=e-1;const s=[];let o=r._tokenizer;o||(o=n.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,c=[],h={};let u,d,f=-1,p=r,m=0,x=0;const g=[x];for(;p;){for(;t.get(++i)[1]!==p;);s.push(i),p._tokenizer||(u=n.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=r;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(x=f+1,g.push(x),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){const y=a.slice(g[f],g[f+1]),k=s.pop();c.push([k,k+y.length-1]),t.splice(k,2,y)}for(c.reverse(),f=-1;++f<c.length;)h[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return h}const b5={resolve:k5,tokenize:v5},C5={partial:!0,tokenize:w5};function k5(t){return Ey(t),t}function v5(t,e){let r;return n;function n(a){return t.enter("content"),r=t.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):jt(a)?t.check(C5,o,s)(a):(t.consume(a),i)}function s(a){return t.exit("chunkContent"),t.exit("content"),e(a)}function o(a){return t.consume(a),t.exit("chunkContent"),r.next=t.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,i}}function w5(t,e,r){const n=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Ut(t,s,"linePrefix")}function s(o){if(o===null||jt(o))return r(o);const a=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):t.interrupt(n.parser.constructs.flow,r,e)(o)}}function Ly(t,e,r,n,i,s,o,a,c){const h=c||Number.POSITIVE_INFINITY;let u=0;return d;function d(y){return y===60?(t.enter(n),t.enter(i),t.enter(s),t.consume(y),t.exit(s),f):y===null||y===32||y===41||wl(y)?r(y):(t.enter(n),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),x(y))}function f(y){return y===62?(t.enter(s),t.consume(y),t.exit(s),t.exit(i),t.exit(n),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(t.exit("chunkString"),t.exit(a),f(y)):y===null||y===60||jt(y)?r(y):(t.consume(y),y===92?m:p)}function m(y){return y===60||y===62||y===92?(t.consume(y),p):p(y)}function x(y){return!u&&(y===null||y===41||ae(y))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(n),e(y)):u<h&&y===40?(t.consume(y),u++,x):y===41?(t.consume(y),u--,x):y===null||y===32||y===40||wl(y)?r(y):(t.consume(y),y===92?g:x)}function g(y){return y===40||y===41||y===92?(t.consume(y),x):x(y)}}function By(t,e,r,n,i,s){const o=this;let a=0,c;return h;function h(p){return t.enter(n),t.enter(i),t.consume(p),t.exit(i),t.enter(s),u}function u(p){return a>999||p===null||p===91||p===93&&!c||p===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?r(p):p===93?(t.exit(s),t.enter(i),t.consume(p),t.exit(i),t.exit(n),e):jt(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||jt(p)||a++>999?(t.exit("chunkString"),u(p)):(t.consume(p),c||(c=!zt(p)),p===92?f:d)}function f(p){return p===91||p===92||p===93?(t.consume(p),a++,d):d(p)}}function Ay(t,e,r,n,i,s){let o;return a;function a(f){return f===34||f===39||f===40?(t.enter(n),t.enter(i),t.consume(f),t.exit(i),o=f===40?41:f,c):r(f)}function c(f){return f===o?(t.enter(i),t.consume(f),t.exit(i),t.exit(n),e):(t.enter(s),h(f))}function h(f){return f===o?(t.exit(s),c(o)):f===null?r(f):jt(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),Ut(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===o||f===null||jt(f)?(t.exit("chunkString"),h(f)):(t.consume(f),f===92?d:u)}function d(f){return f===o||f===92?(t.consume(f),u):u(f)}}function To(t,e){let r;return n;function n(i){return jt(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r=!0,n):zt(i)?Ut(t,n,r?"linePrefix":"lineSuffix")(i):e(i)}}const S5={name:"definition",tokenize:_5},T5={partial:!0,tokenize:j5};function _5(t,e,r){const n=this;let i;return s;function s(p){return t.enter("definition"),o(p)}function o(p){return By.call(n,t,a,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return i=Ir(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),c):r(p)}function c(p){return ae(p)?To(t,h)(p):h(p)}function h(p){return Ly(t,u,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return t.attempt(T5,d,d)(p)}function d(p){return zt(p)?Ut(t,f,"whitespace")(p):f(p)}function f(p){return p===null||jt(p)?(t.exit("definition"),n.parser.defined.push(i),e(p)):r(p)}}function j5(t,e,r){return n;function n(a){return ae(a)?To(t,i)(a):r(a)}function i(a){return Ay(t,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return zt(a)?Ut(t,o,"whitespace")(a):o(a)}function o(a){return a===null||jt(a)?e(a):r(a)}}const N5={name:"hardBreakEscape",tokenize:E5};function E5(t,e,r){return n;function n(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return jt(s)?(t.exit("hardBreakEscape"),e(s)):r(s)}}const L5={name:"headingAtx",resolve:B5,tokenize:A5};function B5(t,e){let r=t.length-2,n=3,i,s;return t[n][1].type==="whitespace"&&(n+=2),r-2>n&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&t[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:t[n][1].start,end:t[r][1].end},s={type:"chunkText",start:t[n][1].start,end:t[r][1].end,contentType:"text"},xr(t,n,r-n+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function A5(t,e,r){let n=0;return i;function i(u){return t.enter("atxHeading"),s(u)}function s(u){return t.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&n++<6?(t.consume(u),o):u===null||ae(u)?(t.exit("atxHeadingSequence"),a(u)):r(u)}function a(u){return u===35?(t.enter("atxHeadingSequence"),c(u)):u===null||jt(u)?(t.exit("atxHeading"),e(u)):zt(u)?Ut(t,a,"whitespace")(u):(t.enter("atxHeadingText"),h(u))}function c(u){return u===35?(t.consume(u),c):(t.exit("atxHeadingSequence"),a(u))}function h(u){return u===null||u===35||ae(u)?(t.exit("atxHeadingText"),a(u)):(t.consume(u),h)}}const M5=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],um=["pre","script","style","textarea"],I5={concrete:!0,name:"htmlFlow",resolveTo:$5,tokenize:D5},F5={partial:!0,tokenize:R5},P5={partial:!0,tokenize:O5};function $5(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function D5(t,e,r){const n=this;let i,s,o,a,c;return h;function h(M){return u(M)}function u(M){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(M),d}function d(M){return M===33?(t.consume(M),f):M===47?(t.consume(M),s=!0,x):M===63?(t.consume(M),i=3,n.interrupt?e:j):Ke(M)?(t.consume(M),o=String.fromCharCode(M),g):r(M)}function f(M){return M===45?(t.consume(M),i=2,p):M===91?(t.consume(M),i=5,a=0,m):Ke(M)?(t.consume(M),i=4,n.interrupt?e:j):r(M)}function p(M){return M===45?(t.consume(M),n.interrupt?e:j):r(M)}function m(M){const ct="CDATA[";return M===ct.charCodeAt(a++)?(t.consume(M),a===ct.length?n.interrupt?e:R:m):r(M)}function x(M){return Ke(M)?(t.consume(M),o=String.fromCharCode(M),g):r(M)}function g(M){if(M===null||M===47||M===62||ae(M)){const ct=M===47,X=o.toLowerCase();return!ct&&!s&&um.includes(X)?(i=1,n.interrupt?e(M):R(M)):M5.includes(o.toLowerCase())?(i=6,ct?(t.consume(M),y):n.interrupt?e(M):R(M)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(M):s?k(M):b(M))}return M===45||We(M)?(t.consume(M),o+=String.fromCharCode(M),g):r(M)}function y(M){return M===62?(t.consume(M),n.interrupt?e:R):r(M)}function k(M){return zt(M)?(t.consume(M),k):N(M)}function b(M){return M===47?(t.consume(M),N):M===58||M===95||Ke(M)?(t.consume(M),w):zt(M)?(t.consume(M),b):N(M)}function w(M){return M===45||M===46||M===58||M===95||We(M)?(t.consume(M),w):_(M)}function _(M){return M===61?(t.consume(M),T):zt(M)?(t.consume(M),_):b(M)}function T(M){return M===null||M===60||M===61||M===62||M===96?r(M):M===34||M===39?(t.consume(M),c=M,S):zt(M)?(t.consume(M),T):L(M)}function S(M){return M===c?(t.consume(M),c=null,B):M===null||jt(M)?r(M):(t.consume(M),S)}function L(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||ae(M)?_(M):(t.consume(M),L)}function B(M){return M===47||M===62||zt(M)?b(M):r(M)}function N(M){return M===62?(t.consume(M),A):r(M)}function A(M){return M===null||jt(M)?R(M):zt(M)?(t.consume(M),A):r(M)}function R(M){return M===45&&i===2?(t.consume(M),F):M===60&&i===1?(t.consume(M),$):M===62&&i===4?(t.consume(M),Y):M===63&&i===3?(t.consume(M),j):M===93&&i===5?(t.consume(M),D):jt(M)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(F5,et,z)(M)):M===null||jt(M)?(t.exit("htmlFlowData"),z(M)):(t.consume(M),R)}function z(M){return t.check(P5,P,et)(M)}function P(M){return t.enter("lineEnding"),t.consume(M),t.exit("lineEnding"),I}function I(M){return M===null||jt(M)?z(M):(t.enter("htmlFlowData"),R(M))}function F(M){return M===45?(t.consume(M),j):R(M)}function $(M){return M===47?(t.consume(M),o="",O):R(M)}function O(M){if(M===62){const ct=o.toLowerCase();return um.includes(ct)?(t.consume(M),Y):R(M)}return Ke(M)&&o.length<8?(t.consume(M),o+=String.fromCharCode(M),O):R(M)}function D(M){return M===93?(t.consume(M),j):R(M)}function j(M){return M===62?(t.consume(M),Y):M===45&&i===2?(t.consume(M),j):R(M)}function Y(M){return M===null||jt(M)?(t.exit("htmlFlowData"),et(M)):(t.consume(M),Y)}function et(M){return t.exit("htmlFlow"),e(M)}}function O5(t,e,r){const n=this;return i;function i(o){return jt(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):r(o)}function s(o){return n.parser.lazy[n.now().line]?r(o):e(o)}}function R5(t,e,r){return n;function n(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(ia,e,r)}}const z5={name:"htmlText",tokenize:q5};function q5(t,e,r){const n=this;let i,s,o;return a;function a(j){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(j),c}function c(j){return j===33?(t.consume(j),h):j===47?(t.consume(j),_):j===63?(t.consume(j),b):Ke(j)?(t.consume(j),L):r(j)}function h(j){return j===45?(t.consume(j),u):j===91?(t.consume(j),s=0,m):Ke(j)?(t.consume(j),k):r(j)}function u(j){return j===45?(t.consume(j),p):r(j)}function d(j){return j===null?r(j):j===45?(t.consume(j),f):jt(j)?(o=d,$(j)):(t.consume(j),d)}function f(j){return j===45?(t.consume(j),p):d(j)}function p(j){return j===62?F(j):j===45?f(j):d(j)}function m(j){const Y="CDATA[";return j===Y.charCodeAt(s++)?(t.consume(j),s===Y.length?x:m):r(j)}function x(j){return j===null?r(j):j===93?(t.consume(j),g):jt(j)?(o=x,$(j)):(t.consume(j),x)}function g(j){return j===93?(t.consume(j),y):x(j)}function y(j){return j===62?F(j):j===93?(t.consume(j),y):x(j)}function k(j){return j===null||j===62?F(j):jt(j)?(o=k,$(j)):(t.consume(j),k)}function b(j){return j===null?r(j):j===63?(t.consume(j),w):jt(j)?(o=b,$(j)):(t.consume(j),b)}function w(j){return j===62?F(j):b(j)}function _(j){return Ke(j)?(t.consume(j),T):r(j)}function T(j){return j===45||We(j)?(t.consume(j),T):S(j)}function S(j){return jt(j)?(o=S,$(j)):zt(j)?(t.consume(j),S):F(j)}function L(j){return j===45||We(j)?(t.consume(j),L):j===47||j===62||ae(j)?B(j):r(j)}function B(j){return j===47?(t.consume(j),F):j===58||j===95||Ke(j)?(t.consume(j),N):jt(j)?(o=B,$(j)):zt(j)?(t.consume(j),B):F(j)}function N(j){return j===45||j===46||j===58||j===95||We(j)?(t.consume(j),N):A(j)}function A(j){return j===61?(t.consume(j),R):jt(j)?(o=A,$(j)):zt(j)?(t.consume(j),A):B(j)}function R(j){return j===null||j===60||j===61||j===62||j===96?r(j):j===34||j===39?(t.consume(j),i=j,z):jt(j)?(o=R,$(j)):zt(j)?(t.consume(j),R):(t.consume(j),P)}function z(j){return j===i?(t.consume(j),i=void 0,I):j===null?r(j):jt(j)?(o=z,$(j)):(t.consume(j),z)}function P(j){return j===null||j===34||j===39||j===60||j===61||j===96?r(j):j===47||j===62||ae(j)?B(j):(t.consume(j),P)}function I(j){return j===47||j===62||ae(j)?B(j):r(j)}function F(j){return j===62?(t.consume(j),t.exit("htmlTextData"),t.exit("htmlText"),e):r(j)}function $(j){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(j),t.exit("lineEnding"),O}function O(j){return zt(j)?Ut(t,D,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):D(j)}function D(j){return t.enter("htmlTextData"),o(j)}}const op={name:"labelEnd",resolveAll:V5,resolveTo:Y5,tokenize:G5},W5={tokenize:X5},H5={tokenize:K5},U5={tokenize:Q5};function V5(t){let e=-1;const r=[];for(;++e<t.length;){const n=t[e][1];if(r.push(t[e]),n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd"){const i=n.type==="labelImage"?4:2;n.type="data",e+=i}}return t.length!==r.length&&xr(t,0,t.length,r),t}function Y5(t,e){let r=t.length,n=0,i,s,o,a;for(;r--;)if(i=t[r][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[r][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(t[r][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=r,i.type!=="labelLink")){n=2;break}}else i.type==="labelEnd"&&(o=r);const c={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},h={type:"label",start:{...t[s][1].start},end:{...t[o][1].end}},u={type:"labelText",start:{...t[s+n+2][1].end},end:{...t[o-2][1].start}};return a=[["enter",c,e],["enter",h,e]],a=vr(a,t.slice(s+1,s+n+3)),a=vr(a,[["enter",u,e]]),a=vr(a,Sc(e.parser.constructs.insideSpan.null,t.slice(s+n+4,o-3),e)),a=vr(a,[["exit",u,e],t[o-2],t[o-1],["exit",h,e]]),a=vr(a,t.slice(o+1)),a=vr(a,[["exit",c,e]]),xr(t,s,t.length,a),t}function G5(t,e,r){const n=this;let i=n.events.length,s,o;for(;i--;)if((n.events[i][1].type==="labelImage"||n.events[i][1].type==="labelLink")&&!n.events[i][1]._balanced){s=n.events[i][1];break}return a;function a(f){return s?s._inactive?d(f):(o=n.parser.defined.includes(Ir(n.sliceSerialize({start:s.end,end:n.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(f),t.exit("labelMarker"),t.exit("labelEnd"),c):r(f)}function c(f){return f===40?t.attempt(W5,u,o?u:d)(f):f===91?t.attempt(H5,u,o?h:d)(f):o?u(f):d(f)}function h(f){return t.attempt(U5,u,d)(f)}function u(f){return e(f)}function d(f){return s._balanced=!0,r(f)}}function X5(t,e,r){return n;function n(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),i}function i(d){return ae(d)?To(t,s)(d):s(d)}function s(d){return d===41?u(d):Ly(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return ae(d)?To(t,c)(d):u(d)}function a(d){return r(d)}function c(d){return d===34||d===39||d===40?Ay(t,h,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function h(d){return ae(d)?To(t,u)(d):u(d)}function u(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):r(d)}}function K5(t,e,r){const n=this;return i;function i(a){return By.call(n,t,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return n.parser.defined.includes(Ir(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?e(a):r(a)}function o(a){return r(a)}}function Q5(t,e,r){return n;function n(s){return t.enter("reference"),t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),i}function i(s){return s===93?(t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),t.exit("reference"),e):r(s)}}const Z5={name:"labelStartImage",resolveAll:op.resolveAll,tokenize:J5};function J5(t,e,r){const n=this;return i;function i(a){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(a),t.exit("labelImageMarker"),s}function s(a){return a===91?(t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelImage"),o):r(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(a):e(a)}}const tE={name:"labelStartLink",resolveAll:op.resolveAll,tokenize:eE};function eE(t,e,r){const n=this;return i;function i(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(o):e(o)}}const mh={name:"lineEnding",tokenize:rE};function rE(t,e){return r;function r(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),Ut(t,e,"linePrefix")}}const el={name:"thematicBreak",tokenize:nE};function nE(t,e,r){let n=0,i;return s;function s(h){return t.enter("thematicBreak"),o(h)}function o(h){return i=h,a(h)}function a(h){return h===i?(t.enter("thematicBreakSequence"),c(h)):n>=3&&(h===null||jt(h))?(t.exit("thematicBreak"),e(h)):r(h)}function c(h){return h===i?(t.consume(h),n++,c):(t.exit("thematicBreakSequence"),zt(h)?Ut(t,a,"whitespace")(h):a(h))}}const ir={continuation:{tokenize:aE},exit:cE,name:"list",tokenize:oE},iE={partial:!0,tokenize:hE},sE={partial:!0,tokenize:lE};function oE(t,e,r){const n=this,i=n.events[n.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(p){const m=n.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!n.containerState.marker||p===n.containerState.marker:wu(p)){if(n.containerState.type||(n.containerState.type=m,t.enter(m,{_container:!0})),m==="listUnordered")return t.enter("listItemPrefix"),p===42||p===45?t.check(el,r,h)(p):h(p);if(!n.interrupt||p===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),c(p)}return r(p)}function c(p){return wu(p)&&++o<10?(t.consume(p),c):(!n.interrupt||o<2)&&(n.containerState.marker?p===n.containerState.marker:p===41||p===46)?(t.exit("listItemValue"),h(p)):r(p)}function h(p){return t.enter("listItemMarker"),t.consume(p),t.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||p,t.check(ia,n.interrupt?r:u,t.attempt(iE,f,d))}function u(p){return n.containerState.initialBlankLine=!0,s++,f(p)}function d(p){return zt(p)?(t.enter("listItemPrefixWhitespace"),t.consume(p),t.exit("listItemPrefixWhitespace"),f):r(p)}function f(p){return n.containerState.size=s+n.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(p)}}function aE(t,e,r){const n=this;return n.containerState._closeFlow=void 0,t.check(ia,i,s);function i(a){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Ut(t,e,"listItemIndent",n.containerState.size+1)(a)}function s(a){return n.containerState.furtherBlankLines||!zt(a)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,o(a)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,t.attempt(sE,e,o)(a))}function o(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,Ut(t,t.attempt(ir,e,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function lE(t,e,r){const n=this;return Ut(t,i,"listItemIndent",n.containerState.size+1);function i(s){const o=n.events[n.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===n.containerState.size?e(s):r(s)}}function cE(t){t.exit(this.containerState.type)}function hE(t,e,r){const n=this;return Ut(t,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=n.events[n.events.length-1];return!zt(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):r(s)}}const dm={name:"setextUnderline",resolveTo:uE,tokenize:dE};function uE(t,e){let r=t.length,n,i,s;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){n=r;break}t[r][1].type==="paragraph"&&(i=r)}else t[r][1].type==="content"&&t.splice(r,1),!s&&t[r][1].type==="definition"&&(s=r);const o={type:"setextHeading",start:{...t[n][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",o,e]),t.splice(s+1,0,["exit",t[n][1],e]),t[n][1].end={...t[s][1].end}):t[n][1]=o,t.push(["exit",o,e]),t}function dE(t,e,r){const n=this;let i;return s;function s(h){let u=n.events.length,d;for(;u--;)if(n.events[u][1].type!=="lineEnding"&&n.events[u][1].type!=="linePrefix"&&n.events[u][1].type!=="content"){d=n.events[u][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||d)?(t.enter("setextHeadingLine"),i=h,o(h)):r(h)}function o(h){return t.enter("setextHeadingLineSequence"),a(h)}function a(h){return h===i?(t.consume(h),a):(t.exit("setextHeadingLineSequence"),zt(h)?Ut(t,c,"lineSuffix")(h):c(h))}function c(h){return h===null||jt(h)?(t.exit("setextHeadingLine"),e(h)):r(h)}}const pE={tokenize:fE};function fE(t){const e=this,r=t.attempt(ia,n,t.attempt(this.parser.constructs.flowInitial,i,Ut(t,t.attempt(this.parser.constructs.flow,i,t.attempt(b5,i)),"linePrefix")));return r;function n(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,r}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,r}}const mE={resolveAll:Iy()},gE=My("string"),xE=My("text");function My(t){return{resolveAll:Iy(t==="text"?yE:void 0),tokenize:e};function e(r){const n=this,i=this.parser.constructs[t],s=r.attempt(i,o,a);return o;function o(u){return h(u)?s(u):a(u)}function a(u){if(u===null){r.consume(u);return}return r.enter("data"),r.consume(u),c}function c(u){return h(u)?(r.exit("data"),s(u)):(r.consume(u),c)}function h(u){if(u===null)return!0;const d=i[u];let f=-1;if(d)for(;++f<d.length;){const p=d[f];if(!p.previous||p.previous.call(n,n.previous))return!0}return!1}}}function Iy(t){return e;function e(r,n){let i=-1,s;for(;++i<=r.length;)s===void 0?r[i]&&r[i][1].type==="data"&&(s=i,i++):(!r[i]||r[i][1].type!=="data")&&(i!==s+2&&(r[s][1].end=r[i-1][1].end,r.splice(s+2,i-s-2),i=s+2),s=void 0);return t?t(r,n):r}}function yE(t,e){let r=0;for(;++r<=t.length;)if((r===t.length||t[r][1].type==="lineEnding")&&t[r-1][1].type==="data"){const n=t[r-1][1],i=e.sliceStream(n);let s=i.length,o=-1,a=0,c;for(;s--;){const h=i[s];if(typeof h=="string"){for(o=h.length;h.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(h===-2)c=!0,a++;else if(h!==-1){s++;break}}if(e._contentTypeTextTrailing&&r===t.length&&(a=0),a){const h={type:r===t.length||c||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:n.start._bufferIndex+o,_index:n.start._index+s,line:n.end.line,column:n.end.column-a,offset:n.end.offset-a},end:{...n.end}};n.end={...h.start},n.start.offset===n.end.offset?Object.assign(n,h):(t.splice(r,0,["enter",h,e],["exit",h,e]),r+=2)}r++}return t}const bE={42:ir,43:ir,45:ir,48:ir,49:ir,50:ir,51:ir,52:ir,53:ir,54:ir,55:ir,56:ir,57:ir,62:_y},CE={91:S5},kE={[-2]:fh,[-1]:fh,32:fh},vE={35:L5,42:el,45:[dm,el],60:I5,61:dm,95:el,96:hm,126:hm},wE={38:Ny,92:jy},SE={[-5]:mh,[-4]:mh,[-3]:mh,33:Z5,38:Ny,42:Su,60:[t5,z5],91:tE,92:[N5,jy],93:op,95:Su,96:p5},TE={null:[Su,mE]},_E={null:[42,95]},jE={null:[]},NE=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:_E,contentInitial:CE,disable:jE,document:bE,flow:vE,flowInitial:kE,insideSpan:TE,string:wE,text:SE},Symbol.toStringTag,{value:"Module"}));function EE(t,e,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const i={},s=[];let o=[],a=[];const c={attempt:S(_),check:S(T),consume:k,enter:b,exit:w,interrupt:S(T,{interrupt:!0})},h={code:null,containerState:{},defineSkip:x,events:[],now:m,parser:t,previous:null,sliceSerialize:f,sliceStream:p,write:d};let u=e.tokenize.call(h,c);return e.resolveAll&&s.push(e),h;function d(A){return o=vr(o,A),g(),o[o.length-1]!==null?[]:(L(e,0),h.events=Sc(s,h.events,h),h.events)}function f(A,R){return BE(p(A),R)}function p(A){return LE(o,A)}function m(){const{_bufferIndex:A,_index:R,line:z,column:P,offset:I}=n;return{_bufferIndex:A,_index:R,line:z,column:P,offset:I}}function x(A){i[A.line]=A.column,N()}function g(){let A;for(;n._index<o.length;){const R=o[n._index];if(typeof R=="string")for(A=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===A&&n._bufferIndex<R.length;)y(R.charCodeAt(n._bufferIndex));else y(R)}}function y(A){u=u(A)}function k(A){jt(A)?(n.line++,n.column=1,n.offset+=A===-3?2:1,N()):A!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),h.previous=A}function b(A,R){const z=R||{};return z.type=A,z.start=m(),h.events.push(["enter",z,h]),a.push(z),z}function w(A){const R=a.pop();return R.end=m(),h.events.push(["exit",R,h]),R}function _(A,R){L(A,R.from)}function T(A,R){R.restore()}function S(A,R){return z;function z(P,I,F){let $,O,D,j;return Array.isArray(P)?et(P):"tokenize"in P?et([P]):Y(P);function Y(lt){return It;function It(Pt){const Ct=Pt!==null&&lt[Pt],G=Pt!==null&&lt.null,it=[...Array.isArray(Ct)?Ct:Ct?[Ct]:[],...Array.isArray(G)?G:G?[G]:[]];return et(it)(Pt)}}function et(lt){return $=lt,O=0,lt.length===0?F:M(lt[O])}function M(lt){return It;function It(Pt){return j=B(),D=lt,lt.partial||(h.currentConstruct=lt),lt.name&&h.parser.constructs.disable.null.includes(lt.name)?X():lt.tokenize.call(R?Object.assign(Object.create(h),R):h,c,ct,X)(Pt)}}function ct(lt){return A(D,j),I}function X(lt){return j.restore(),++O<$.length?M($[O]):F}}}function L(A,R){A.resolveAll&&!s.includes(A)&&s.push(A),A.resolve&&xr(h.events,R,h.events.length-R,A.resolve(h.events.slice(R),h)),A.resolveTo&&(h.events=A.resolveTo(h.events,h))}function B(){const A=m(),R=h.previous,z=h.currentConstruct,P=h.events.length,I=Array.from(a);return{from:P,restore:F};function F(){n=A,h.previous=R,h.currentConstruct=z,h.events.length=P,a=I,N()}}function N(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function LE(t,e){const r=e.start._index,n=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let o;if(r===i)o=[t[r].slice(n,s)];else{if(o=t.slice(r,i),n>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(n):o.shift()}s>0&&o.push(t[i].slice(0,s))}return o}function BE(t,e){let r=-1;const n=[];let i;for(;++r<t.length;){const s=t[r];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
312
- `;break}case-3:{o=`\r
313
- `;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,n.push(o)}return n.join("")}function AE(t){const n={constructs:Sy([NE,...(t||{}).extensions||[]]),content:i(YN),defined:[],document:i(XN),flow:i(pE),lazy:{},string:i(gE),text:i(xE)};return n;function i(s){return o;function o(a){return EE(n,s,a)}}}function ME(t){for(;!Ey(t););return t}const pm=/[\0\t\n\r]/g;function IE(){let t=1,e="",r=!0,n;return i;function i(s,o,a){const c=[];let h,u,d,f,p;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),d=0,e="",r&&(s.charCodeAt(0)===65279&&d++,r=void 0);d<s.length;){if(pm.lastIndex=d,h=pm.exec(s),f=h&&h.index!==void 0?h.index:s.length,p=s.charCodeAt(f),!h){e=s.slice(d);break}if(p===10&&d===f&&n)c.push(-3),n=void 0;else switch(n&&(c.push(-5),n=void 0),d<f&&(c.push(s.slice(d,f)),t+=f-d),p){case 0:{c.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,c.push(-2);t++<u;)c.push(-1);break}case 10:{c.push(-4),t=1;break}default:n=!0,t=1}d=f+1}return a&&(n&&c.push(-5),e&&c.push(e),c.push(null)),c}}const FE=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function PE(t){return t.replace(FE,$E)}function $E(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return Ty(r.slice(s?2:1),s?16:10)}return sp(r)||t}const Fy={}.hasOwnProperty;function DE(t,e,r){return e&&typeof e=="object"&&(r=e,e=void 0),OE(r)(ME(AE(r).document().write(IE()(t,e,!0))))}function OE(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Ye),autolinkProtocol:B,autolinkEmail:B,atxHeading:s(Qt),blockQuote:s(G),characterEscape:B,characterReference:B,codeFenced:s(it),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(it,o),codeText:s(kt,o),codeTextData:B,data:B,codeFlowValue:B,definition:s(Tt),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(qt),hardBreakEscape:s(Gt),hardBreakTrailing:s(Gt),htmlFlow:s(Se,o),htmlFlowData:B,htmlText:s(Se,o),htmlTextData:B,image:s(Xt),label:o,link:s(Ye),listItem:s(Ae),listItemValue:f,listOrdered:s(le,d),listUnordered:s(le),paragraph:s(De),reference:M,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Qt),strong:s(Le),thematicBreak:s(Z)},exit:{atxHeading:c(),atxHeadingSequence:_,autolink:c(),autolinkEmail:Ct,autolinkProtocol:Pt,blockQuote:c(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:X,characterReferenceMarkerNumeric:X,characterReferenceValue:lt,characterReference:It,codeFenced:c(g),codeFencedFence:x,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:N,codeIndented:c(y),codeText:c(I),codeTextData:N,data:N,definition:c(),definitionDestinationString:w,definitionLabelString:k,definitionTitleString:b,emphasis:c(),hardBreakEscape:c(R),hardBreakTrailing:c(R),htmlFlow:c(z),htmlFlowData:N,htmlText:c(P),htmlTextData:N,image:c($),label:D,labelText:O,lineEnding:A,link:c(F),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ct,resourceDestinationString:j,resourceTitleString:Y,resource:et,setextHeading:c(L),setextHeadingLineSequence:S,setextHeadingText:T,strong:c(),thematicBreak:c()}};Py(e,(t||{}).mdastExtensions||[]);const r={};return n;function n(H){let J={type:"root",children:[]};const at={stack:[J],tokenStack:[],config:e,enter:a,exit:h,buffer:o,resume:u,data:r},pt=[];let _t=-1;for(;++_t<H.length;)if(H[_t][1].type==="listOrdered"||H[_t][1].type==="listUnordered")if(H[_t][0]==="enter")pt.push(_t);else{const Kt=pt.pop();_t=i(H,Kt,_t)}for(_t=-1;++_t<H.length;){const Kt=e[H[_t][0]];Fy.call(Kt,H[_t][1].type)&&Kt[H[_t][1].type].call(Object.assign({sliceSerialize:H[_t][2].sliceSerialize},at),H[_t][1])}if(at.tokenStack.length>0){const Kt=at.tokenStack[at.tokenStack.length-1];(Kt[1]||fm).call(at,void 0,Kt[0])}for(J.position={start:Cn(H.length>0?H[0][1].start:{line:1,column:1,offset:0}),end:Cn(H.length>0?H[H.length-2][1].end:{line:1,column:1,offset:0})},_t=-1;++_t<e.transforms.length;)J=e.transforms[_t](J)||J;return J}function i(H,J,at){let pt=J-1,_t=-1,Kt=!1,de,ge,Me,Zt;for(;++pt<=at;){const pe=H[pt];switch(pe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{pe[0]==="enter"?_t++:_t--,Zt=void 0;break}case"lineEndingBlank":{pe[0]==="enter"&&(de&&!Zt&&!_t&&!Me&&(Me=pt),Zt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Zt=void 0}if(!_t&&pe[0]==="enter"&&pe[1].type==="listItemPrefix"||_t===-1&&pe[0]==="exit"&&(pe[1].type==="listUnordered"||pe[1].type==="listOrdered")){if(de){let Te=pt;for(ge=void 0;Te--;){const Ie=H[Te];if(Ie[1].type==="lineEnding"||Ie[1].type==="lineEndingBlank"){if(Ie[0]==="exit")continue;ge&&(H[ge][1].type="lineEndingBlank",Kt=!0),Ie[1].type="lineEnding",ge=Te}else if(!(Ie[1].type==="linePrefix"||Ie[1].type==="blockQuotePrefix"||Ie[1].type==="blockQuotePrefixWhitespace"||Ie[1].type==="blockQuoteMarker"||Ie[1].type==="listItemIndent"))break}Me&&(!ge||Me<ge)&&(de._spread=!0),de.end=Object.assign({},ge?H[ge][1].start:pe[1].end),H.splice(ge||pt,0,["exit",de,pe[2]]),pt++,at++}if(pe[1].type==="listItemPrefix"){const Te={type:"listItem",_spread:!1,start:Object.assign({},pe[1].start),end:void 0};de=Te,H.splice(pt,0,["enter",Te,pe[2]]),pt++,at++,Me=void 0,Zt=!0}}}return H[J][1]._spread=Kt,at}function s(H,J){return at;function at(pt){a.call(this,H(pt),pt),J&&J.call(this,pt)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(H,J,at){this.stack[this.stack.length-1].children.push(H),this.stack.push(H),this.tokenStack.push([J,at||void 0]),H.position={start:Cn(J.start),end:void 0}}function c(H){return J;function J(at){H&&H.call(this,at),h.call(this,at)}}function h(H,J){const at=this.stack.pop(),pt=this.tokenStack.pop();if(pt)pt[0].type!==H.type&&(J?J.call(this,H,pt[0]):(pt[1]||fm).call(this,H,pt[0]));else throw new Error("Cannot close `"+H.type+"` ("+So({start:H.start,end:H.end})+"): it’s not open");at.position.end=Cn(H.end)}function u(){return ip(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(H){if(this.data.expectingFirstListItemValue){const J=this.stack[this.stack.length-2];J.start=Number.parseInt(this.sliceSerialize(H),10),this.data.expectingFirstListItemValue=void 0}}function p(){const H=this.resume(),J=this.stack[this.stack.length-1];J.lang=H}function m(){const H=this.resume(),J=this.stack[this.stack.length-1];J.meta=H}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const H=this.resume(),J=this.stack[this.stack.length-1];J.value=H.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const H=this.resume(),J=this.stack[this.stack.length-1];J.value=H.replace(/(\r?\n|\r)$/g,"")}function k(H){const J=this.resume(),at=this.stack[this.stack.length-1];at.label=J,at.identifier=Ir(this.sliceSerialize(H)).toLowerCase()}function b(){const H=this.resume(),J=this.stack[this.stack.length-1];J.title=H}function w(){const H=this.resume(),J=this.stack[this.stack.length-1];J.url=H}function _(H){const J=this.stack[this.stack.length-1];if(!J.depth){const at=this.sliceSerialize(H).length;J.depth=at}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function S(H){const J=this.stack[this.stack.length-1];J.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function B(H){const at=this.stack[this.stack.length-1].children;let pt=at[at.length-1];(!pt||pt.type!=="text")&&(pt=W(),pt.position={start:Cn(H.start),end:void 0},at.push(pt)),this.stack.push(pt)}function N(H){const J=this.stack.pop();J.value+=this.sliceSerialize(H),J.position.end=Cn(H.end)}function A(H){const J=this.stack[this.stack.length-1];if(this.data.atHardBreak){const at=J.children[J.children.length-1];at.position.end=Cn(H.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(J.type)&&(B.call(this,H),N.call(this,H))}function R(){this.data.atHardBreak=!0}function z(){const H=this.resume(),J=this.stack[this.stack.length-1];J.value=H}function P(){const H=this.resume(),J=this.stack[this.stack.length-1];J.value=H}function I(){const H=this.resume(),J=this.stack[this.stack.length-1];J.value=H}function F(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const J=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=J,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function $(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const J=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=J,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function O(H){const J=this.sliceSerialize(H),at=this.stack[this.stack.length-2];at.label=PE(J),at.identifier=Ir(J).toLowerCase()}function D(){const H=this.stack[this.stack.length-1],J=this.resume(),at=this.stack[this.stack.length-1];if(this.data.inReference=!0,at.type==="link"){const pt=H.children;at.children=pt}else at.alt=J}function j(){const H=this.resume(),J=this.stack[this.stack.length-1];J.url=H}function Y(){const H=this.resume(),J=this.stack[this.stack.length-1];J.title=H}function et(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function ct(H){const J=this.resume(),at=this.stack[this.stack.length-1];at.label=J,at.identifier=Ir(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function X(H){this.data.characterReferenceType=H.type}function lt(H){const J=this.sliceSerialize(H),at=this.data.characterReferenceType;let pt;at?(pt=Ty(J,at==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):pt=sp(J);const _t=this.stack[this.stack.length-1];_t.value+=pt}function It(H){const J=this.stack.pop();J.position.end=Cn(H.end)}function Pt(H){N.call(this,H);const J=this.stack[this.stack.length-1];J.url=this.sliceSerialize(H)}function Ct(H){N.call(this,H);const J=this.stack[this.stack.length-1];J.url="mailto:"+this.sliceSerialize(H)}function G(){return{type:"blockquote",children:[]}}function it(){return{type:"code",lang:null,meta:null,value:""}}function kt(){return{type:"inlineCode",value:""}}function Tt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function qt(){return{type:"emphasis",children:[]}}function Qt(){return{type:"heading",depth:0,children:[]}}function Gt(){return{type:"break"}}function Se(){return{type:"html",value:""}}function Xt(){return{type:"image",title:null,url:"",alt:null}}function Ye(){return{type:"link",title:null,url:"",children:[]}}function le(H){return{type:"list",ordered:H.type==="listOrdered",start:null,spread:H._spread,children:[]}}function Ae(H){return{type:"listItem",spread:H._spread,checked:null,children:[]}}function De(){return{type:"paragraph",children:[]}}function Le(){return{type:"strong",children:[]}}function W(){return{type:"text",value:""}}function Z(){return{type:"thematicBreak"}}}function Cn(t){return{line:t.line,column:t.column,offset:t.offset}}function Py(t,e){let r=-1;for(;++r<e.length;){const n=e[r];Array.isArray(n)?Py(t,n):RE(t,n)}}function RE(t,e){let r;for(r in e)if(Fy.call(e,r))switch(r){case"canContainEols":{const n=e[r];n&&t[r].push(...n);break}case"transforms":{const n=e[r];n&&t[r].push(...n);break}case"enter":case"exit":{const n=e[r];n&&Object.assign(t[r],n);break}}}function fm(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+So({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+So({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+So({start:e.start,end:e.end})+") is still open")}function zE(t){const e=this;e.parser=r;function r(n){return DE(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function qE(t,e){const r={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,r),t.applyData(e,r)}function WE(t,e){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,r),[t.applyData(e,r),{type:"text",value:`
314
- `}]}function HE(t,e){const r=e.value?e.value+`
315
- `:"",n={},i=e.lang?e.lang.split(/\s+/):[];i.length>0&&(n.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function UE(t,e){const r={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function VE(t,e){const r={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function YE(t,e){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=String(e.identifier).toUpperCase(),i=ws(n.toLowerCase()),s=t.footnoteOrder.indexOf(n);let o,a=t.footnoteCounts.get(n);a===void 0?(a=0,t.footnoteOrder.push(n),o=t.footnoteOrder.length):o=s+1,a+=1,t.footnoteCounts.set(n,a);const c={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+i,id:r+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(e,c);const h={type:"element",tagName:"sup",properties:{},children:[c]};return t.patch(e,h),t.applyData(e,h)}function GE(t,e){const r={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function XE(t,e){if(t.options.allowDangerousHtml){const r={type:"raw",value:e.value};return t.patch(e,r),t.applyData(e,r)}}function $y(t,e){const r=e.referenceType;let n="]";if(r==="collapsed"?n+="[]":r==="full"&&(n+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+n}];const i=t.all(e),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=n:i.push({type:"text",value:n}),i}function KE(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return $y(t,e);const i={src:ws(n.url||""),alt:e.alt};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,s),t.applyData(e,s)}function QE(t,e){const r={src:ws(e.url)};e.alt!==null&&e.alt!==void 0&&(r.alt=e.alt),e.title!==null&&e.title!==void 0&&(r.title=e.title);const n={type:"element",tagName:"img",properties:r,children:[]};return t.patch(e,n),t.applyData(e,n)}function ZE(t,e){const r={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,r);const n={type:"element",tagName:"code",properties:{},children:[r]};return t.patch(e,n),t.applyData(e,n)}function JE(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return $y(t,e);const i={href:ws(n.url||"")};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function tL(t,e){const r={href:ws(e.url)};e.title!==null&&e.title!==void 0&&(r.title=e.title);const n={type:"element",tagName:"a",properties:r,children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function eL(t,e,r){const n=t.all(e),i=r?rL(r):Dy(e),s={},o=[];if(typeof e.checked=="boolean"){const u=n[0];let d;u&&u.type==="element"&&u.tagName==="p"?d=u:(d={type:"element",tagName:"p",properties:{},children:[]},n.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<n.length;){const u=n[a];(i||a!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
316
- `}),u.type==="element"&&u.tagName==="p"&&!i?o.push(...u.children):o.push(u)}const c=n[n.length-1];c&&(i||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
317
- `});const h={type:"element",tagName:"li",properties:s,children:o};return t.patch(e,h),t.applyData(e,h)}function rL(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const r=t.children;let n=-1;for(;!e&&++n<r.length;)e=Dy(r[n])}return e}function Dy(t){const e=t.spread;return e??t.children.length>1}function nL(t,e){const r={},n=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(r.start=e.start);++i<n.length;){const o=n[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const s={type:"element",tagName:e.ordered?"ol":"ul",properties:r,children:t.wrap(n,!0)};return t.patch(e,s),t.applyData(e,s)}function iL(t,e){const r={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function sL(t,e){const r={type:"root",children:t.wrap(t.all(e))};return t.patch(e,r),t.applyData(e,r)}function oL(t,e){const r={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function aL(t,e){const r=t.all(e),n=r.shift(),i=[];if(n){const o={type:"element",tagName:"thead",properties:{},children:t.wrap([n],!0)};t.patch(e.children[0],o),i.push(o)}if(r.length>0){const o={type:"element",tagName:"tbody",properties:{},children:t.wrap(r,!0)},a=tp(e.children[1]),c=xy(e.children[e.children.length-1]);a&&c&&(o.position={start:a,end:c}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,s),t.applyData(e,s)}function lL(t,e,r){const n=r?r.children:void 0,s=(n?n.indexOf(e):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,a=o?o.length:e.children.length;let c=-1;const h=[];for(;++c<a;){const d=e.children[c],f={},p=o?o[c]:void 0;p&&(f.align=p);let m={type:"element",tagName:s,properties:f,children:[]};d&&(m.children=t.all(d),t.patch(d,m),m=t.applyData(d,m)),h.push(m)}const u={type:"element",tagName:"tr",properties:{},children:t.wrap(h,!0)};return t.patch(e,u),t.applyData(e,u)}function cL(t,e){const r={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}const mm=9,gm=32;function hL(t){const e=String(t),r=/\r?\n|\r/g;let n=r.exec(e),i=0;const s=[];for(;n;)s.push(xm(e.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(e);return s.push(xm(e.slice(i),i>0,!1)),s.join("")}function xm(t,e,r){let n=0,i=t.length;if(e){let s=t.codePointAt(n);for(;s===mm||s===gm;)n++,s=t.codePointAt(n)}if(r){let s=t.codePointAt(i-1);for(;s===mm||s===gm;)i--,s=t.codePointAt(i-1)}return i>n?t.slice(n,i):""}function uL(t,e){const r={type:"text",value:hL(String(e.value))};return t.patch(e,r),t.applyData(e,r)}function dL(t,e){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,r),t.applyData(e,r)}const pL={blockquote:qE,break:WE,code:HE,delete:UE,emphasis:VE,footnoteReference:YE,heading:GE,html:XE,imageReference:KE,image:QE,inlineCode:ZE,linkReference:JE,link:tL,listItem:eL,list:nL,paragraph:iL,root:sL,strong:oL,table:aL,tableCell:cL,tableRow:lL,text:uL,thematicBreak:dL,toml:Na,yaml:Na,definition:Na,footnoteDefinition:Na};function Na(){}const Oy=-1,Tc=0,_o=1,Sl=2,ap=3,lp=4,cp=5,hp=6,Ry=7,zy=8,ym=typeof self=="object"?self:globalThis,fL=(t,e)=>{const r=(i,s)=>(t.set(s,i),i),n=i=>{if(t.has(i))return t.get(i);const[s,o]=e[i];switch(s){case Tc:case Oy:return r(o,i);case _o:{const a=r([],i);for(const c of o)a.push(n(c));return a}case Sl:{const a=r({},i);for(const[c,h]of o)a[n(c)]=n(h);return a}case ap:return r(new Date(o),i);case lp:{const{source:a,flags:c}=o;return r(new RegExp(a,c),i)}case cp:{const a=r(new Map,i);for(const[c,h]of o)a.set(n(c),n(h));return a}case hp:{const a=r(new Set,i);for(const c of o)a.add(n(c));return a}case Ry:{const{name:a,message:c}=o;return r(new ym[a](c),i)}case zy:return r(BigInt(o),i);case"BigInt":return r(Object(BigInt(o)),i);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return r(new DataView(a),o)}}return r(new ym[s](o),i)};return n},bm=t=>fL(new Map,t)(0),ji="",{toString:mL}={},{keys:gL}=Object,Us=t=>{const e=typeof t;if(e!=="object"||!t)return[Tc,e];const r=mL.call(t).slice(8,-1);switch(r){case"Array":return[_o,ji];case"Object":return[Sl,ji];case"Date":return[ap,ji];case"RegExp":return[lp,ji];case"Map":return[cp,ji];case"Set":return[hp,ji];case"DataView":return[_o,r]}return r.includes("Array")?[_o,r]:r.includes("Error")?[Ry,r]:[Sl,r]},Ea=([t,e])=>t===Tc&&(e==="function"||e==="symbol"),xL=(t,e,r,n)=>{const i=(o,a)=>{const c=n.push(o)-1;return r.set(a,c),c},s=o=>{if(r.has(o))return r.get(o);let[a,c]=Us(o);switch(a){case Tc:{let u=o;switch(c){case"bigint":a=zy,u=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+c);u=null;break;case"undefined":return i([Oy],o)}return i([a,u],o)}case _o:{if(c){let f=o;return c==="DataView"?f=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(f=new Uint8Array(o)),i([c,[...f]],o)}const u=[],d=i([a,u],o);for(const f of o)u.push(s(f));return d}case Sl:{if(c)switch(c){case"BigInt":return i([c,o.toString()],o);case"Boolean":case"Number":case"String":return i([c,o.valueOf()],o)}if(e&&"toJSON"in o)return s(o.toJSON());const u=[],d=i([a,u],o);for(const f of gL(o))(t||!Ea(Us(o[f])))&&u.push([s(f),s(o[f])]);return d}case ap:return i([a,o.toISOString()],o);case lp:{const{source:u,flags:d}=o;return i([a,{source:u,flags:d}],o)}case cp:{const u=[],d=i([a,u],o);for(const[f,p]of o)(t||!(Ea(Us(f))||Ea(Us(p))))&&u.push([s(f),s(p)]);return d}case hp:{const u=[],d=i([a,u],o);for(const f of o)(t||!Ea(Us(f)))&&u.push(s(f));return d}}const{message:h}=o;return i([a,{name:c,message:h}],o)};return s},Cm=(t,{json:e,lossy:r}={})=>{const n=[];return xL(!(e||r),!!e,new Map,n)(t),n},Tl=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?bm(Cm(t,e)):structuredClone(t):(t,e)=>bm(Cm(t,e));function yL(t,e){const r=[{type:"text",value:"↩"}];return e>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),r}function bL(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function CL(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||yL,n=t.options.footnoteBackLabel||bL,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let c=-1;for(;++c<t.footnoteOrder.length;){const h=t.footnoteById.get(t.footnoteOrder[c]);if(!h)continue;const u=t.all(h),d=String(h.identifier).toUpperCase(),f=ws(d.toLowerCase());let p=0;const m=[],x=t.footnoteCounts.get(d);for(;x!==void 0&&++p<=x;){m.length>0&&m.push({type:"text",value:" "});let k=typeof r=="string"?r:r(c,p);typeof k=="string"&&(k={type:"text",value:k}),m.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+f+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(c,p),className:["data-footnote-backref"]},children:Array.isArray(k)?k:[k]})}const g=u[u.length-1];if(g&&g.type==="element"&&g.tagName==="p"){const k=g.children[g.children.length-1];k&&k.type==="text"?k.value+=" ":g.children.push({type:"text",value:" "}),g.children.push(...m)}else u.push(...m);const y={type:"element",tagName:"li",properties:{id:e+"fn-"+f},children:t.wrap(u,!0)};t.patch(h,y),a.push(y)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Tl(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
318
- `},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:`
319
- `}]}}const _c=(function(t){if(t==null)return SL;if(typeof t=="function")return jc(t);if(typeof t=="object")return Array.isArray(t)?kL(t):vL(t);if(typeof t=="string")return wL(t);throw new Error("Expected function, string, or object as test")});function kL(t){const e=[];let r=-1;for(;++r<t.length;)e[r]=_c(t[r]);return jc(n);function n(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function vL(t){const e=t;return jc(r);function r(n){const i=n;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function wL(t){return jc(e);function e(r){return r&&r.type===t}}function jc(t){return e;function e(r,n,i){return!!(TL(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function SL(){return!0}function TL(t){return t!==null&&typeof t=="object"&&"type"in t}const qy=[],_L=!0,Tu=!1,jL="skip";function Wy(t,e,r,n){let i;typeof e=="function"&&typeof r!="function"?(n=r,r=e):i=e;const s=_c(i),o=n?-1:1;a(t,void 0,[])();function a(c,h,u){const d=c&&typeof c=="object"?c:{};if(typeof d.type=="string"){const p=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(c.type+(p?"<"+p+">":""))+")"})}return f;function f(){let p=qy,m,x,g;if((!e||s(c,h,u[u.length-1]||void 0))&&(p=NL(r(c,u)),p[0]===Tu))return p;if("children"in c&&c.children){const y=c;if(y.children&&p[0]!==jL)for(x=(n?y.children.length:-1)+o,g=u.concat(y);x>-1&&x<y.children.length;){const k=y.children[x];if(m=a(k,x,g)(),m[0]===Tu)return m;x=typeof m[1]=="number"?m[1]:x+o}}return p}}}function NL(t){return Array.isArray(t)?t:typeof t=="number"?[_L,t]:t==null?qy:[t]}function up(t,e,r,n){let i,s,o;typeof e=="function"&&typeof r!="function"?(s=void 0,o=e,i=r):(s=e,o=r,i=n),Wy(t,s,a,i);function a(c,h){const u=h[h.length-1],d=u?u.children.indexOf(c):void 0;return o(c,d,u)}}const _u={}.hasOwnProperty,EL={};function LL(t,e){const r=e||EL,n=new Map,i=new Map,s=new Map,o={...pL,...r.handlers},a={all:h,applyData:AL,definitionById:n,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:c,options:r,patch:BL,wrap:IL};return up(t,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const d=u.type==="definition"?n:i,f=String(u.identifier).toUpperCase();d.has(f)||d.set(f,u)}}),a;function c(u,d){const f=u.type,p=a.handlers[f];if(_u.call(a.handlers,f)&&p)return p(a,u,d);if(a.options.passThrough&&a.options.passThrough.includes(f)){if("children"in u){const{children:x,...g}=u,y=Tl(g);return y.children=a.all(u),y}return Tl(u)}return(a.options.unknownHandler||ML)(a,u,d)}function h(u){const d=[];if("children"in u){const f=u.children;let p=-1;for(;++p<f.length;){const m=a.one(f[p],u);if(m){if(p&&f[p-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=km(m.value)),!Array.isArray(m)&&m.type==="element")){const x=m.children[0];x&&x.type==="text"&&(x.value=km(x.value))}Array.isArray(m)?d.push(...m):d.push(m)}}}return d}}function BL(t,e){t.position&&(e.position=bN(t))}function AL(t,e){let r=e;if(t&&t.data){const n=t.data.hName,i=t.data.hChildren,s=t.data.hProperties;if(typeof n=="string")if(r.type==="element")r.tagName=n;else{const o="children"in r?r.children:[r];r={type:"element",tagName:n,properties:{},children:o}}r.type==="element"&&s&&Object.assign(r.properties,Tl(s)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function ML(t,e){const r=e.data||{},n="value"in e&&!(_u.call(r,"hProperties")||_u.call(r,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function IL(t,e){const r=[];let n=-1;for(e&&r.push({type:"text",value:`
320
- `});++n<t.length;)n&&r.push({type:"text",value:`
321
- `}),r.push(t[n]);return e&&t.length>0&&r.push({type:"text",value:`
322
- `}),r}function km(t){let e=0,r=t.charCodeAt(e);for(;r===9||r===32;)e++,r=t.charCodeAt(e);return t.slice(e)}function vm(t,e){const r=LL(t,e),n=r.one(t,void 0),i=CL(r),s=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
323
- `},i),s}function FL(t,e){return t&&"run"in t?async function(r,n){const i=vm(r,{file:n,...e});await t.run(i,n)}:function(r,n){return vm(r,{file:n,...t||e})}}function wm(t){if(t)throw t}var gh,Sm;function PL(){if(Sm)return gh;Sm=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=function(h){return typeof Array.isArray=="function"?Array.isArray(h):e.call(h)==="[object Array]"},s=function(h){if(!h||e.call(h)!=="[object Object]")return!1;var u=t.call(h,"constructor"),d=h.constructor&&h.constructor.prototype&&t.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!u&&!d)return!1;var f;for(f in h);return typeof f>"u"||t.call(h,f)},o=function(h,u){r&&u.name==="__proto__"?r(h,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):h[u.name]=u.newValue},a=function(h,u){if(u==="__proto__")if(t.call(h,u)){if(n)return n(h,u).value}else return;return h[u]};return gh=function c(){var h,u,d,f,p,m,x=arguments[0],g=1,y=arguments.length,k=!1;for(typeof x=="boolean"&&(k=x,x=arguments[1]||{},g=2),(x==null||typeof x!="object"&&typeof x!="function")&&(x={});g<y;++g)if(h=arguments[g],h!=null)for(u in h)d=a(x,u),f=a(h,u),x!==f&&(k&&f&&(s(f)||(p=i(f)))?(p?(p=!1,m=d&&i(d)?d:[]):m=d&&s(d)?d:{},o(x,{name:u,newValue:c(k,m,f)})):typeof f<"u"&&o(x,{name:u,newValue:f}));return x},gh}var $L=PL();const xh=zd($L);function ju(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function DL(){const t=[],e={run:r,use:n};return e;function r(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...i);function a(c,...h){const u=t[++s];let d=-1;if(c){o(c);return}for(;++d<i.length;)(h[d]===null||h[d]===void 0)&&(h[d]=i[d]);i=h,u?OL(u,a)(...h):o(null,...h)}}function n(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function OL(t,e){let r;return n;function n(...o){const a=t.length>o.length;let c;a&&o.push(i);try{c=t.apply(this,o)}catch(h){const u=h;if(a&&r)throw u;return i(u)}a||(c&&c.then&&typeof c.then=="function"?c.then(s,i):c instanceof Error?i(c):s(c))}function i(o,...a){r||(r=!0,e(o,...a))}function s(o){i(null,o)}}const Ur={basename:RL,dirname:zL,extname:qL,join:WL,sep:"/"};function RL(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');sa(t);let r=0,n=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){r=i+1;break}}else n<0&&(s=!0,n=i+1);return n<0?"":t.slice(r,n)}if(e===t)return"";let o=-1,a=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){r=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(t.codePointAt(i)===e.codePointAt(a--)?a<0&&(n=i):(a=-1,n=o));return r===n?n=o:n<0&&(n=t.length),t.slice(r,n)}function zL(t){if(sa(t),t.length===0)return".";let e=-1,r=t.length,n;for(;--r;)if(t.codePointAt(r)===47){if(n){e=r;break}}else n||(n=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function qL(t){sa(t);let e=t.length,r=-1,n=0,i=-1,s=0,o;for(;e--;){const a=t.codePointAt(e);if(a===47){if(o){n=e+1;break}continue}r<0&&(o=!0,r=e+1),a===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||r<0||s===0||s===1&&i===r-1&&i===n+1?"":t.slice(i,r)}function WL(...t){let e=-1,r;for(;++e<t.length;)sa(t[e]),t[e]&&(r=r===void 0?t[e]:r+"/"+t[e]);return r===void 0?".":HL(r)}function HL(t){sa(t);const e=t.codePointAt(0)===47;let r=UL(t,!e);return r.length===0&&!e&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),e?"/"+r:r}function UL(t,e){let r="",n=0,i=-1,s=0,o=-1,a,c;for(;++o<=t.length;){if(o<t.length)a=t.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(c=r.lastIndexOf("/"),c!==r.length-1){c<0?(r="",n=0):(r=r.slice(0,c),n=r.length-1-r.lastIndexOf("/")),i=o,s=0;continue}}else if(r.length>0){r="",n=0,i=o,s=0;continue}}e&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+t.slice(i+1,o):r=t.slice(i+1,o),n=o-i-1;i=o,s=0}else a===46&&s>-1?s++:s=-1}return r}function sa(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const VL={cwd:YL};function YL(){return"/"}function Nu(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function GL(t){if(typeof t=="string")t=new URL(t);else if(!Nu(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return XL(t)}function XL(t){if(t.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const e=t.pathname;let r=-1;for(;++r<e.length;)if(e.codePointAt(r)===37&&e.codePointAt(r+1)===50){const n=e.codePointAt(r+2);if(n===70||n===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}const yh=["history","path","basename","stem","extname","dirname"];class Hy{constructor(e){let r;e?Nu(e)?r={path:e}:typeof e=="string"||KL(e)?r={value:e}:r=e:r={},this.cwd="cwd"in r?"":VL.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<yh.length;){const s=yh[n];s in r&&r[s]!==void 0&&r[s]!==null&&(this[s]=s==="history"?[...r[s]]:r[s])}let i;for(i in r)yh.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?Ur.basename(this.path):void 0}set basename(e){Ch(e,"basename"),bh(e,"basename"),this.path=Ur.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Ur.dirname(this.path):void 0}set dirname(e){Tm(this.basename,"dirname"),this.path=Ur.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Ur.extname(this.path):void 0}set extname(e){if(bh(e,"extname"),Tm(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ur.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Nu(e)&&(e=GL(e)),Ch(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Ur.basename(this.path,this.extname):void 0}set stem(e){Ch(e,"stem"),bh(e,"stem"),this.path=Ur.join(this.dirname||"",e+(this.extname||""))}fail(e,r,n){const i=this.message(e,r,n);throw i.fatal=!0,i}info(e,r,n){const i=this.message(e,r,n);return i.fatal=void 0,i}message(e,r,n){const i=new Ue(e,r,n);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function bh(t,e){if(t&&t.includes(Ur.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Ur.sep+"`")}function Ch(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function Tm(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function KL(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const QL=(function(t){const n=this.constructor.prototype,i=n[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,n),s}),ZL={}.hasOwnProperty;class dp extends QL{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=DL()}copy(){const e=new dp;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];e.use(...n)}return e.data(xh(!0,{},this.namespace)),e}data(e,r){return typeof e=="string"?arguments.length===2?(wh("data",this.frozen),this.namespace[e]=r,this):ZL.call(this.namespace,e)&&this.namespace[e]||void 0:e?(wh("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);const i=r.call(e,...n);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const r=La(e),n=this.parser||this.Parser;return kh("parse",n),n(String(r),r)}process(e,r){const n=this;return this.freeze(),kh("process",this.parser||this.Parser),vh("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(s,o){const a=La(e),c=n.parse(a);n.run(c,a,function(u,d,f){if(u||!d||!f)return h(u);const p=d,m=n.stringify(p,f);eB(m)?f.value=m:f.result=m,h(u,f)});function h(u,d){u||!d?o(u):s?s(d):r(void 0,d)}}}processSync(e){let r=!1,n;return this.freeze(),kh("processSync",this.parser||this.Parser),vh("processSync",this.compiler||this.Compiler),this.process(e,i),jm("processSync","process",r),n;function i(s,o){r=!0,wm(s),n=o}}run(e,r,n){_m(e),this.freeze();const i=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?s(void 0,n):new Promise(s);function s(o,a){const c=La(r);i.run(e,c,h);function h(u,d,f){const p=d||e;u?a(u):o?o(p):n(void 0,p,f)}}}runSync(e,r){let n=!1,i;return this.run(e,r,s),jm("runSync","run",n),i;function s(o,a){wm(o),i=a,n=!0}}stringify(e,r){this.freeze();const n=La(r),i=this.compiler||this.Compiler;return vh("stringify",i),_m(e),i(e,n)}use(e,...r){const n=this.attachers,i=this.namespace;if(wh("use",this.frozen),e!=null)if(typeof e=="function")c(e,r);else if(typeof e=="object")Array.isArray(e)?a(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(h){if(typeof h=="function")c(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[u,...d]=h;c(u,d)}else o(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function o(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(h.plugins),h.settings&&(i.settings=xh(!0,i.settings,h.settings))}function a(h){let u=-1;if(h!=null)if(Array.isArray(h))for(;++u<h.length;){const d=h[u];s(d)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function c(h,u){let d=-1,f=-1;for(;++d<n.length;)if(n[d][0]===h){f=d;break}if(f===-1)n.push([h,...u]);else if(u.length>0){let[p,...m]=u;const x=n[f][1];ju(x)&&ju(p)&&(p=xh(!0,x,p)),n[f]=[h,p,...m]}}}}const JL=new dp().freeze();function kh(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function vh(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function wh(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function _m(t){if(!ju(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function jm(t,e,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function La(t){return tB(t)?t:new Hy(t)}function tB(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function eB(t){return typeof t=="string"||rB(t)}function rB(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const nB="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Nm=[],Em={allowDangerousHtml:!0},iB=/^(https?|ircs?|mailto|xmpp)$/i,sB=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function pp(t){const e=oB(t),r=aB(t);return lB(e.runSync(e.parse(r),r),t)}function oB(t){const e=t.rehypePlugins||Nm,r=t.remarkPlugins||Nm,n=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Em}:Em;return JL().use(zE).use(r).use(FL,n).use(e)}function aB(t){const e=t.children||"",r=new Hy;return typeof e=="string"&&(r.value=e),r}function lB(t,e){const r=e.allowedElements,n=e.allowElement,i=e.components,s=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,c=e.urlTransform||cB;for(const u of sB)Object.hasOwn(e,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+nB+u.id,void 0);return up(t,h),SN(t,{Fragment:l.Fragment,components:i,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function h(u,d,f){if(u.type==="raw"&&f&&typeof d=="number")return o?f.children.splice(d,1):f.children[d]={type:"text",value:u.value},d;if(u.type==="element"){let p;for(p in ph)if(Object.hasOwn(ph,p)&&Object.hasOwn(u.properties,p)){const m=u.properties[p],x=ph[p];(x===null||x.includes(u.tagName))&&(u.properties[p]=c(String(m||""),p,u))}}if(u.type==="element"){let p=r?!r.includes(u.tagName):s?s.includes(u.tagName):!1;if(!p&&n&&typeof d=="number"&&(p=!n(u,d,f)),p&&f&&typeof d=="number")return a&&u.children?f.children.splice(d,1,...u.children):f.children.splice(d,1),d}}}function cB(t){const e=t.indexOf(":"),r=t.indexOf("?"),n=t.indexOf("#"),i=t.indexOf("/");return e===-1||i!==-1&&e>i||r!==-1&&e>r||n!==-1&&e>n||iB.test(t.slice(0,e))?t:""}function Lm(t,e){const r=String(t);if(typeof e!="string")throw new TypeError("Expected character");let n=0,i=r.indexOf(e);for(;i!==-1;)n++,i=r.indexOf(e,i+e.length);return n}function hB(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function uB(t,e,r){const i=_c((r||{}).ignore||[]),s=dB(e);let o=-1;for(;++o<s.length;)Wy(t,"text",a);function a(h,u){let d=-1,f;for(;++d<u.length;){const p=u[d],m=f?f.children:void 0;if(i(p,m?m.indexOf(p):void 0,f))return;f=p}if(f)return c(h,u)}function c(h,u){const d=u[u.length-1],f=s[o][0],p=s[o][1];let m=0;const g=d.children.indexOf(h);let y=!1,k=[];f.lastIndex=0;let b=f.exec(h.value);for(;b;){const w=b.index,_={index:b.index,input:b.input,stack:[...u,h]};let T=p(...b,_);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?f.lastIndex=w+1:(m!==w&&k.push({type:"text",value:h.value.slice(m,w)}),Array.isArray(T)?k.push(...T):T&&k.push(T),m=w+b[0].length,y=!0),!f.global)break;b=f.exec(h.value)}return y?(m<h.value.length&&k.push({type:"text",value:h.value.slice(m)}),d.children.splice(g,1,...k)):k=[h],g+k.length}}function dB(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!t[0]||Array.isArray(t[0])?t:[t];let n=-1;for(;++n<r.length;){const i=r[n];e.push([pB(i[0]),fB(i[1])])}return e}function pB(t){return typeof t=="string"?new RegExp(hB(t),"g"):t}function fB(t){return typeof t=="function"?t:function(){return t}}const Sh="phrasing",Th=["autolink","link","image","label"];function mB(){return{transforms:[vB],enter:{literalAutolink:xB,literalAutolinkEmail:_h,literalAutolinkHttp:_h,literalAutolinkWww:_h},exit:{literalAutolink:kB,literalAutolinkEmail:CB,literalAutolinkHttp:yB,literalAutolinkWww:bB}}}function gB(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Sh,notInConstruct:Th},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Sh,notInConstruct:Th},{character:":",before:"[ps]",after:"\\/",inConstruct:Sh,notInConstruct:Th}]}}function xB(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function _h(t){this.config.enter.autolinkProtocol.call(this,t)}function yB(t){this.config.exit.autolinkProtocol.call(this,t)}function bB(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function CB(t){this.config.exit.autolinkEmail.call(this,t)}function kB(t){this.exit(t)}function vB(t){uB(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,wB],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),SB]],{ignore:["link","linkReference"]})}function wB(t,e,r,n,i){let s="";if(!Uy(i)||(/^w/i.test(e)&&(r=e+r,e="",s="http://"),!TB(r)))return!1;const o=_B(r+n);if(!o[0])return!1;const a={type:"link",title:null,url:s+e+o[0],children:[{type:"text",value:e+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function SB(t,e,r,n){return!Uy(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+r,children:[{type:"text",value:e+"@"+r}]}}function TB(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function _B(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let r=e[0],n=r.indexOf(")");const i=Lm(t,"(");let s=Lm(t,")");for(;n!==-1&&i>s;)t+=r.slice(0,n+1),r=r.slice(n+1),n=r.indexOf(")"),s++;return[t,r]}function Uy(t,e){const r=t.input.charCodeAt(t.index-1);return(t.index===0||oi(r)||wc(r))&&(!e||r!==47)}Vy.peek=FB;function jB(){this.buffer()}function NB(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function EB(){this.buffer()}function LB(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function BB(t){const e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Ir(this.sliceSerialize(t)).toLowerCase(),r.label=e}function AB(t){this.exit(t)}function MB(t){const e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Ir(this.sliceSerialize(t)).toLowerCase(),r.label=e}function IB(t){this.exit(t)}function FB(){return"["}function Vy(t,e,r,n){const i=r.createTracker(n);let s=i.move("[^");const o=r.enter("footnoteReference"),a=r.enter("reference");return s+=i.move(r.safe(r.associationId(t),{after:"]",before:s})),a(),o(),s+=i.move("]"),s}function PB(){return{enter:{gfmFootnoteCallString:jB,gfmFootnoteCall:NB,gfmFootnoteDefinitionLabelString:EB,gfmFootnoteDefinition:LB},exit:{gfmFootnoteCallString:BB,gfmFootnoteCall:AB,gfmFootnoteDefinitionLabelString:MB,gfmFootnoteDefinition:IB}}}function $B(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:r,footnoteReference:Vy},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(n,i,s,o){const a=s.createTracker(o);let c=a.move("[^");const h=s.enter("footnoteDefinition"),u=s.enter("label");return c+=a.move(s.safe(s.associationId(n),{before:c,after:"]"})),u(),c+=a.move("]:"),n.children&&n.children.length>0&&(a.shift(4),c+=a.move((e?`
324
- `:" ")+s.indentLines(s.containerFlow(n,a.current()),e?Yy:DB))),h(),c}}function DB(t,e,r){return e===0?t:Yy(t,e,r)}function Yy(t,e,r){return(r?"":" ")+t}const OB=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Gy.peek=HB;function RB(){return{canContainEols:["delete"],enter:{strikethrough:qB},exit:{strikethrough:WB}}}function zB(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:OB}],handlers:{delete:Gy}}}function qB(t){this.enter({type:"delete",children:[]},t)}function WB(t){this.exit(t)}function Gy(t,e,r,n){const i=r.createTracker(n),s=r.enter("strikethrough");let o=i.move("~~");return o+=r.containerPhrasing(t,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function HB(){return"~"}function UB(t){return t.length}function VB(t,e){const r=e||{},n=(r.align||[]).concat(),i=r.stringLength||UB,s=[],o=[],a=[],c=[];let h=0,u=-1;for(;++u<t.length;){const x=[],g=[];let y=-1;for(t[u].length>h&&(h=t[u].length);++y<t[u].length;){const k=YB(t[u][y]);if(r.alignDelimiters!==!1){const b=i(k);g[y]=b,(c[y]===void 0||b>c[y])&&(c[y]=b)}x.push(k)}o[u]=x,a[u]=g}let d=-1;if(typeof n=="object"&&"length"in n)for(;++d<h;)s[d]=Bm(n[d]);else{const x=Bm(n);for(;++d<h;)s[d]=x}d=-1;const f=[],p=[];for(;++d<h;){const x=s[d];let g="",y="";x===99?(g=":",y=":"):x===108?g=":":x===114&&(y=":");let k=r.alignDelimiters===!1?1:Math.max(1,c[d]-g.length-y.length);const b=g+"-".repeat(k)+y;r.alignDelimiters!==!1&&(k=g.length+k+y.length,k>c[d]&&(c[d]=k),p[d]=k),f[d]=b}o.splice(1,0,f),a.splice(1,0,p),u=-1;const m=[];for(;++u<o.length;){const x=o[u],g=a[u];d=-1;const y=[];for(;++d<h;){const k=x[d]||"";let b="",w="";if(r.alignDelimiters!==!1){const _=c[d]-(g[d]||0),T=s[d];T===114?b=" ".repeat(_):T===99?_%2?(b=" ".repeat(_/2+.5),w=" ".repeat(_/2-.5)):(b=" ".repeat(_/2),w=b):w=" ".repeat(_)}r.delimiterStart!==!1&&!d&&y.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&k==="")&&(r.delimiterStart!==!1||d)&&y.push(" "),r.alignDelimiters!==!1&&y.push(b),y.push(k),r.alignDelimiters!==!1&&y.push(w),r.padding!==!1&&y.push(" "),(r.delimiterEnd!==!1||d!==h-1)&&y.push("|")}m.push(r.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return m.join(`
325
- `)}function YB(t){return t==null?"":String(t)}function Bm(t){const e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}function GB(t,e,r,n){const i=r.enter("blockquote"),s=r.createTracker(n);s.move("> "),s.shift(2);const o=r.indentLines(r.containerFlow(t,s.current()),XB);return i(),o}function XB(t,e,r){return">"+(r?"":" ")+t}function KB(t,e){return Am(t,e.inConstruct,!0)&&!Am(t,e.notInConstruct,!1)}function Am(t,e,r){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return r;let n=-1;for(;++n<e.length;)if(t.includes(e[n]))return!0;return!1}function Mm(t,e,r,n){let i=-1;for(;++i<r.unsafe.length;)if(r.unsafe[i].character===`
326
- `&&KB(r.stack,r.unsafe[i]))return/[ \t]/.test(n.before)?"":" ";return`\\
327
- `}function QB(t,e){const r=String(t);let n=r.indexOf(e),i=n,s=0,o=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;n!==-1;)n===i?++s>o&&(o=s):s=1,i=n+e.length,n=r.indexOf(e,i);return o}function ZB(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function JB(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function tA(t,e,r,n){const i=JB(r),s=t.value||"",o=i==="`"?"GraveAccent":"Tilde";if(ZB(t,r)){const d=r.enter("codeIndented"),f=r.indentLines(s,eA);return d(),f}const a=r.createTracker(n),c=i.repeat(Math.max(QB(s,i)+1,3)),h=r.enter("codeFenced");let u=a.move(c);if(t.lang){const d=r.enter(`codeFencedLang${o}`);u+=a.move(r.safe(t.lang,{before:u,after:" ",encode:["`"],...a.current()})),d()}if(t.lang&&t.meta){const d=r.enter(`codeFencedMeta${o}`);u+=a.move(" "),u+=a.move(r.safe(t.meta,{before:u,after:`
328
- `,encode:["`"],...a.current()})),d()}return u+=a.move(`
329
- `),s&&(u+=a.move(s+`
330
- `)),u+=a.move(c),h(),u}function eA(t,e,r){return(r?"":" ")+t}function fp(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function rA(t,e,r,n){const i=fp(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("definition");let a=r.enter("label");const c=r.createTracker(n);let h=c.move("[");return h+=c.move(r.safe(r.associationId(t),{before:h,after:"]",...c.current()})),h+=c.move("]: "),a(),!t.url||/[\0- \u007F]/.test(t.url)?(a=r.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(r.safe(t.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(a=r.enter("destinationRaw"),h+=c.move(r.safe(t.url,{before:h,after:t.title?" ":`
331
- `,...c.current()}))),a(),t.title&&(a=r.enter(`title${s}`),h+=c.move(" "+i),h+=c.move(r.safe(t.title,{before:h,after:i,...c.current()})),h+=c.move(i),a()),o(),h}function nA(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function Oo(t){return"&#x"+t.toString(16).toUpperCase()+";"}function _l(t,e,r){const n=ls(t),i=ls(e);return n===void 0?i===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:n===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Xy.peek=iA;function Xy(t,e,r,n){const i=nA(r),s=r.enter("emphasis"),o=r.createTracker(n),a=o.move(i);let c=o.move(r.containerPhrasing(t,{after:i,before:a,...o.current()}));const h=c.charCodeAt(0),u=_l(n.before.charCodeAt(n.before.length-1),h,i);u.inside&&(c=Oo(h)+c.slice(1));const d=c.charCodeAt(c.length-1),f=_l(n.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+Oo(d));const p=o.move(i);return s(),r.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+c+p}function iA(t,e,r){return r.options.emphasis||"*"}function sA(t,e){let r=!1;return up(t,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return r=!0,Tu}),!!((!t.depth||t.depth<3)&&ip(t)&&(e.options.setext||r))}function oA(t,e,r,n){const i=Math.max(Math.min(6,t.depth||1),1),s=r.createTracker(n);if(sA(t,r)){const u=r.enter("headingSetext"),d=r.enter("phrasing"),f=r.containerPhrasing(t,{...s.current(),before:`
332
- `,after:`
333
- `});return d(),u(),f+`
334
- `+(i===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
335
- `))+1))}const o="#".repeat(i),a=r.enter("headingAtx"),c=r.enter("phrasing");s.move(o+" ");let h=r.containerPhrasing(t,{before:"# ",after:`
336
- `,...s.current()});return/^[\t ]/.test(h)&&(h=Oo(h.charCodeAt(0))+h.slice(1)),h=h?o+" "+h:o,r.options.closeAtx&&(h+=" "+o),c(),a(),h}Ky.peek=aA;function Ky(t){return t.value||""}function aA(){return"<"}Qy.peek=lA;function Qy(t,e,r,n){const i=fp(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("image");let a=r.enter("label");const c=r.createTracker(n);let h=c.move("![");return h+=c.move(r.safe(t.alt,{before:h,after:"]",...c.current()})),h+=c.move("]("),a(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(a=r.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(r.safe(t.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(a=r.enter("destinationRaw"),h+=c.move(r.safe(t.url,{before:h,after:t.title?" ":")",...c.current()}))),a(),t.title&&(a=r.enter(`title${s}`),h+=c.move(" "+i),h+=c.move(r.safe(t.title,{before:h,after:i,...c.current()})),h+=c.move(i),a()),h+=c.move(")"),o(),h}function lA(){return"!"}Zy.peek=cA;function Zy(t,e,r,n){const i=t.referenceType,s=r.enter("imageReference");let o=r.enter("label");const a=r.createTracker(n);let c=a.move("![");const h=r.safe(t.alt,{before:c,after:"]",...a.current()});c+=a.move(h+"]["),o();const u=r.stack;r.stack=[],o=r.enter("reference");const d=r.safe(r.associationId(t),{before:c,after:"]",...a.current()});return o(),r.stack=u,s(),i==="full"||!h||h!==d?c+=a.move(d+"]"):i==="shortcut"?c=c.slice(0,-1):c+=a.move("]"),c}function cA(){return"!"}Jy.peek=hA;function Jy(t,e,r){let n=t.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(n);)i+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++s<r.unsafe.length;){const o=r.unsafe[s],a=r.compilePattern(o);let c;if(o.atBreak)for(;c=a.exec(n);){let h=c.index;n.charCodeAt(h)===10&&n.charCodeAt(h-1)===13&&h--,n=n.slice(0,h)+" "+n.slice(c.index+1)}}return i+n+i}function hA(){return"`"}function tb(t,e){const r=ip(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(r===t.url||"mailto:"+r===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}eb.peek=uA;function eb(t,e,r,n){const i=fp(r),s=i==='"'?"Quote":"Apostrophe",o=r.createTracker(n);let a,c;if(tb(t,r)){const u=r.stack;r.stack=[],a=r.enter("autolink");let d=o.move("<");return d+=o.move(r.containerPhrasing(t,{before:d,after:">",...o.current()})),d+=o.move(">"),a(),r.stack=u,d}a=r.enter("link"),c=r.enter("label");let h=o.move("[");return h+=o.move(r.containerPhrasing(t,{before:h,after:"](",...o.current()})),h+=o.move("]("),c(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(c=r.enter("destinationLiteral"),h+=o.move("<"),h+=o.move(r.safe(t.url,{before:h,after:">",...o.current()})),h+=o.move(">")):(c=r.enter("destinationRaw"),h+=o.move(r.safe(t.url,{before:h,after:t.title?" ":")",...o.current()}))),c(),t.title&&(c=r.enter(`title${s}`),h+=o.move(" "+i),h+=o.move(r.safe(t.title,{before:h,after:i,...o.current()})),h+=o.move(i),c()),h+=o.move(")"),a(),h}function uA(t,e,r){return tb(t,r)?"<":"["}rb.peek=dA;function rb(t,e,r,n){const i=t.referenceType,s=r.enter("linkReference");let o=r.enter("label");const a=r.createTracker(n);let c=a.move("[");const h=r.containerPhrasing(t,{before:c,after:"]",...a.current()});c+=a.move(h+"]["),o();const u=r.stack;r.stack=[],o=r.enter("reference");const d=r.safe(r.associationId(t),{before:c,after:"]",...a.current()});return o(),r.stack=u,s(),i==="full"||!h||h!==d?c+=a.move(d+"]"):i==="shortcut"?c=c.slice(0,-1):c+=a.move("]"),c}function dA(){return"["}function mp(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function pA(t){const e=mp(t),r=t.options.bulletOther;if(!r)return e==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+r+"`) to be different");return r}function fA(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function nb(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function mA(t,e,r,n){const i=r.enter("list"),s=r.bulletCurrent;let o=t.ordered?fA(r):mp(r);const a=t.ordered?o==="."?")":".":pA(r);let c=e&&r.bulletLastUsed?o===r.bulletLastUsed:!1;if(!t.ordered){const u=t.children?t.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(c=!0),nb(r)===o&&u){let d=-1;for(;++d<t.children.length;){const f=t.children[d];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(o=a),r.bulletCurrent=o;const h=r.containerFlow(t,n);return r.bulletLastUsed=o,r.bulletCurrent=s,i(),h}function gA(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function xA(t,e,r,n){const i=gA(r);let s=r.bulletCurrent||mp(r);e&&e.type==="list"&&e.ordered&&(s=(typeof e.start=="number"&&e.start>-1?e.start:1)+(r.options.incrementListMarker===!1?0:e.children.indexOf(t))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(o=Math.ceil(o/4)*4);const a=r.createTracker(n);a.move(s+" ".repeat(o-s.length)),a.shift(o);const c=r.enter("listItem"),h=r.indentLines(r.containerFlow(t,a.current()),u);return c(),h;function u(d,f,p){return f?(p?"":" ".repeat(o))+d:(p?s:s+" ".repeat(o-s.length))+d}}function yA(t,e,r,n){const i=r.enter("paragraph"),s=r.enter("phrasing"),o=r.containerPhrasing(t,n);return s(),i(),o}const bA=_c(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function CA(t,e,r,n){return(t.children.some(function(o){return bA(o)})?r.containerPhrasing:r.containerFlow).call(r,t,n)}function kA(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}ib.peek=vA;function ib(t,e,r,n){const i=kA(r),s=r.enter("strong"),o=r.createTracker(n),a=o.move(i+i);let c=o.move(r.containerPhrasing(t,{after:i,before:a,...o.current()}));const h=c.charCodeAt(0),u=_l(n.before.charCodeAt(n.before.length-1),h,i);u.inside&&(c=Oo(h)+c.slice(1));const d=c.charCodeAt(c.length-1),f=_l(n.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+Oo(d));const p=o.move(i+i);return s(),r.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+c+p}function vA(t,e,r){return r.options.strong||"*"}function wA(t,e,r,n){return r.safe(t.value,n)}function SA(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function TA(t,e,r){const n=(nb(r)+(r.options.ruleSpaces?" ":"")).repeat(SA(r));return r.options.ruleSpaces?n.slice(0,-1):n}const sb={blockquote:GB,break:Mm,code:tA,definition:rA,emphasis:Xy,hardBreak:Mm,heading:oA,html:Ky,image:Qy,imageReference:Zy,inlineCode:Jy,link:eb,linkReference:rb,list:mA,listItem:xA,paragraph:yA,root:CA,strong:ib,text:wA,thematicBreak:TA};function _A(){return{enter:{table:jA,tableData:Im,tableHeader:Im,tableRow:EA},exit:{codeText:LA,table:NA,tableData:jh,tableHeader:jh,tableRow:jh}}}function jA(t){const e=t._align;this.enter({type:"table",align:e.map(function(r){return r==="none"?null:r}),children:[]},t),this.data.inTable=!0}function NA(t){this.exit(t),this.data.inTable=void 0}function EA(t){this.enter({type:"tableRow",children:[]},t)}function jh(t){this.exit(t)}function Im(t){this.enter({type:"tableCell",children:[]},t)}function LA(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,BA));const r=this.stack[this.stack.length-1];r.type,r.value=e,this.exit(t)}function BA(t,e){return e==="|"?e:t}function AA(t){const e=t||{},r=e.tableCellPadding,n=e.tablePipeAlign,i=e.stringLength,s=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
337
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:a}};function o(p,m,x,g){return h(u(p,x,g),p.align)}function a(p,m,x,g){const y=d(p,x,g),k=h([y]);return k.slice(0,k.indexOf(`
338
- `))}function c(p,m,x,g){const y=x.enter("tableCell"),k=x.enter("phrasing"),b=x.containerPhrasing(p,{...g,before:s,after:s});return k(),y(),b}function h(p,m){return VB(p,{align:m,alignDelimiters:n,padding:r,stringLength:i})}function u(p,m,x){const g=p.children;let y=-1;const k=[],b=m.enter("table");for(;++y<g.length;)k[y]=d(g[y],m,x);return b(),k}function d(p,m,x){const g=p.children;let y=-1;const k=[],b=m.enter("tableRow");for(;++y<g.length;)k[y]=c(g[y],p,m,x);return b(),k}function f(p,m,x){let g=sb.inlineCode(p,m,x);return x.stack.includes("tableCell")&&(g=g.replace(/\|/g,"\\$&")),g}}function MA(){return{exit:{taskListCheckValueChecked:Fm,taskListCheckValueUnchecked:Fm,paragraph:FA}}}function IA(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:PA}}}function Fm(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function FA(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const n=r.children[0];if(n&&n.type==="text"){const i=e.children;let s=-1,o;for(;++s<i.length;){const a=i[s];if(a.type==="paragraph"){o=a;break}}o===r&&(n.value=n.value.slice(1),n.value.length===0?r.children.shift():r.position&&n.position&&typeof n.position.start.offset=="number"&&(n.position.start.column++,n.position.start.offset++,r.position.start=Object.assign({},n.position.start)))}}this.exit(t)}function PA(t,e,r,n){const i=t.children[0],s=typeof t.checked=="boolean"&&i&&i.type==="paragraph",o="["+(t.checked?"x":" ")+"] ",a=r.createTracker(n);s&&a.move(o);let c=sb.listItem(t,e,r,{...n,...a.current()});return s&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),c;function h(u){return u+o}}function $A(){return[mB(),PB(),RB(),_A(),MA()]}function DA(t){return{extensions:[gB(),$B(t),zB(),AA(t),IA()]}}const OA={tokenize:UA,partial:!0},ob={tokenize:VA,partial:!0},ab={tokenize:YA,partial:!0},lb={tokenize:GA,partial:!0},RA={tokenize:XA,partial:!0},cb={name:"wwwAutolink",tokenize:WA,previous:ub},hb={name:"protocolAutolink",tokenize:HA,previous:db},mn={name:"emailAutolink",tokenize:qA,previous:pb},Qr={};function zA(){return{text:Qr}}let Wn=48;for(;Wn<123;)Qr[Wn]=mn,Wn++,Wn===58?Wn=65:Wn===91&&(Wn=97);Qr[43]=mn;Qr[45]=mn;Qr[46]=mn;Qr[95]=mn;Qr[72]=[mn,hb];Qr[104]=[mn,hb];Qr[87]=[mn,cb];Qr[119]=[mn,cb];function qA(t,e,r){const n=this;let i,s;return o;function o(d){return!Eu(d)||!pb.call(n,n.previous)||gp(n.events)?r(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(d))}function a(d){return Eu(d)?(t.consume(d),a):d===64?(t.consume(d),c):r(d)}function c(d){return d===46?t.check(RA,u,h)(d):d===45||d===95||We(d)?(s=!0,t.consume(d),c):u(d)}function h(d){return t.consume(d),i=!0,c}function u(d){return s&&i&&Ke(n.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):r(d)}}function WA(t,e,r){const n=this;return i;function i(o){return o!==87&&o!==119||!ub.call(n,n.previous)||gp(n.events)?r(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(OA,t.attempt(ob,t.attempt(ab,s),r),r)(o))}function s(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function HA(t,e,r){const n=this;let i="",s=!1;return o;function o(d){return(d===72||d===104)&&db.call(n,n.previous)&&!gp(n.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),a):r(d)}function a(d){if(Ke(d)&&i.length<5)return i+=String.fromCodePoint(d),t.consume(d),a;if(d===58){const f=i.toLowerCase();if(f==="http"||f==="https")return t.consume(d),c}return r(d)}function c(d){return d===47?(t.consume(d),s?h:(s=!0,c)):r(d)}function h(d){return d===null||wl(d)||ae(d)||oi(d)||wc(d)?r(d):t.attempt(ob,t.attempt(ab,u),r)(d)}function u(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function UA(t,e,r){let n=0;return i;function i(o){return(o===87||o===119)&&n<3?(n++,t.consume(o),i):o===46&&n===3?(t.consume(o),s):r(o)}function s(o){return o===null?r(o):e(o)}}function VA(t,e,r){let n,i,s;return o;function o(h){return h===46||h===95?t.check(lb,c,a)(h):h===null||ae(h)||oi(h)||h!==45&&wc(h)?c(h):(s=!0,t.consume(h),o)}function a(h){return h===95?n=!0:(i=n,n=void 0),t.consume(h),o}function c(h){return i||n||!s?r(h):e(h)}}function YA(t,e){let r=0,n=0;return i;function i(o){return o===40?(r++,t.consume(o),i):o===41&&n<r?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?t.check(lb,e,s)(o):o===null||ae(o)||oi(o)?e(o):(t.consume(o),i)}function s(o){return o===41&&n++,t.consume(o),i}}function GA(t,e,r){return n;function n(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(t.consume(a),n):a===38?(t.consume(a),s):a===93?(t.consume(a),i):a===60||a===null||ae(a)||oi(a)?e(a):r(a)}function i(a){return a===null||a===40||a===91||ae(a)||oi(a)?e(a):n(a)}function s(a){return Ke(a)?o(a):r(a)}function o(a){return a===59?(t.consume(a),n):Ke(a)?(t.consume(a),o):r(a)}}function XA(t,e,r){return n;function n(s){return t.consume(s),i}function i(s){return We(s)?r(s):e(s)}}function ub(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||ae(t)}function db(t){return!Ke(t)}function pb(t){return!(t===47||Eu(t))}function Eu(t){return t===43||t===45||t===46||t===95||We(t)}function gp(t){let e=t.length,r=!1;for(;e--;){const n=t[e][1];if((n.type==="labelLink"||n.type==="labelImage")&&!n._balanced){r=!0;break}if(n._gfmAutolinkLiteralWalkedInto){r=!1;break}}return t.length>0&&!r&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const KA={tokenize:i3,partial:!0};function QA(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:e3,continuation:{tokenize:r3},exit:n3}},text:{91:{name:"gfmFootnoteCall",tokenize:t3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:ZA,resolveTo:JA}}}}function ZA(t,e,r){const n=this;let i=n.events.length;const s=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let o;for(;i--;){const c=n.events[i][1];if(c.type==="labelImage"){o=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return a;function a(c){if(!o||!o._balanced)return r(c);const h=Ir(n.sliceSerialize({start:o.end,end:n.now()}));return h.codePointAt(0)!==94||!s.includes(h.slice(1))?r(c):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(c),t.exit("gfmFootnoteCallLabelMarker"),e(c))}}function JA(t,e){let r=t.length;for(;r--;)if(t[r][1].type==="labelImage"&&t[r][0]==="enter"){t[r][1];break}t[r+1][1].type="data",t[r+3][1].type="gfmFootnoteCallLabelMarker";const n={type:"gfmFootnoteCall",start:Object.assign({},t[r+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[r+3][1].end),end:Object.assign({},t[r+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[t[r+1],t[r+2],["enter",n,e],t[r+3],t[r+4],["enter",i,e],["exit",i,e],["enter",s,e],["enter",o,e],["exit",o,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",n,e]];return t.splice(r,t.length-r+1,...a),t}function t3(t,e,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s=0,o;return a;function a(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),c}function c(d){return d!==94?r(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",h)}function h(d){if(s>999||d===93&&!o||d===null||d===91||ae(d))return r(d);if(d===93){t.exit("chunkString");const f=t.exit("gfmFootnoteCallString");return i.includes(Ir(n.sliceSerialize(f)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):r(d)}return ae(d)||(o=!0),s++,t.consume(d),d===92?u:h}function u(d){return d===91||d===92||d===93?(t.consume(d),s++,h):h(d)}}function e3(t,e,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s,o=0,a;return c;function c(m){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(m){return m===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",u):r(m)}function u(m){if(o>999||m===93&&!a||m===null||m===91||ae(m))return r(m);if(m===93){t.exit("chunkString");const x=t.exit("gfmFootnoteDefinitionLabelString");return s=Ir(n.sliceSerialize(x)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),f}return ae(m)||(a=!0),o++,t.consume(m),m===92?d:u}function d(m){return m===91||m===92||m===93?(t.consume(m),o++,u):u(m)}function f(m){return m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),i.includes(s)||i.push(s),Ut(t,p,"gfmFootnoteDefinitionWhitespace")):r(m)}function p(m){return e(m)}}function r3(t,e,r){return t.check(ia,e,t.attempt(KA,e,r))}function n3(t){t.exit("gfmFootnoteDefinition")}function i3(t,e,r){const n=this;return Ut(t,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=n.events[n.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?e(s):r(s)}}function s3(t){let r=(t||{}).singleTilde;const n={name:"strikethrough",tokenize:s,resolveAll:i};return r==null&&(r=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function i(o,a){let c=-1;for(;++c<o.length;)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let h=c;for(;h--;)if(o[h][0]==="exit"&&o[h][1].type==="strikethroughSequenceTemporary"&&o[h][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[h][1].end.offset-o[h][1].start.offset){o[c][1].type="strikethroughSequence",o[h][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},o[h][1].start),end:Object.assign({},o[c][1].end)},d={type:"strikethroughText",start:Object.assign({},o[h][1].end),end:Object.assign({},o[c][1].start)},f=[["enter",u,a],["enter",o[h][1],a],["exit",o[h][1],a],["enter",d,a]],p=a.parser.constructs.insideSpan.null;p&&xr(f,f.length,0,Sc(p,o.slice(h+1,c),a)),xr(f,f.length,0,[["exit",d,a],["enter",o[c][1],a],["exit",o[c][1],a],["exit",u,a]]),xr(o,h-1,c-h+3,f),c=h+f.length-2;break}}for(c=-1;++c<o.length;)o[c][1].type==="strikethroughSequenceTemporary"&&(o[c][1].type="data");return o}function s(o,a,c){const h=this.previous,u=this.events;let d=0;return f;function f(m){return h===126&&u[u.length-1][1].type!=="characterEscape"?c(m):(o.enter("strikethroughSequenceTemporary"),p(m))}function p(m){const x=ls(h);if(m===126)return d>1?c(m):(o.consume(m),d++,p);if(d<2&&!r)return c(m);const g=o.exit("strikethroughSequenceTemporary"),y=ls(m);return g._open=!y||y===2&&!!x,g._close=!x||x===2&&!!y,a(m)}}}class o3{constructor(){this.map=[]}add(e,r,n){a3(this,e,r,n)}consume(e){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let r=this.map.length;const n=[];for(;r>0;)r-=1,n.push(e.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),e.length=this.map[r][0];n.push(e.slice()),e.length=0;let i=n.pop();for(;i;){for(const s of i)e.push(s);i=n.pop()}this.map.length=0}}function a3(t,e,r,n){let i=0;if(!(r===0&&n.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=r,t.map[i][2].push(...n);return}i+=1}t.map.push([e,r,n])}}function l3(t,e){let r=!1;const n=[];for(;e<t.length;){const i=t[e];if(r){if(i[0]==="enter")i[1].type==="tableContent"&&n.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const s=n.length-1;n[s]=n[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(r=!0);e+=1}return n}function c3(){return{flow:{null:{name:"table",tokenize:h3,resolveAll:u3}}}}function h3(t,e,r){const n=this;let i=0,s=0,o;return a;function a(N){let A=n.events.length-1;for(;A>-1;){const P=n.events[A][1].type;if(P==="lineEnding"||P==="linePrefix")A--;else break}const R=A>-1?n.events[A][1].type:null,z=R==="tableHead"||R==="tableRow"?T:c;return z===T&&n.parser.lazy[n.now().line]?r(N):z(N)}function c(N){return t.enter("tableHead"),t.enter("tableRow"),h(N)}function h(N){return N===124||(o=!0,s+=1),u(N)}function u(N){return N===null?r(N):jt(N)?s>1?(s=0,n.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(N),t.exit("lineEnding"),p):r(N):zt(N)?Ut(t,u,"whitespace")(N):(s+=1,o&&(o=!1,i+=1),N===124?(t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),o=!0,u):(t.enter("data"),d(N)))}function d(N){return N===null||N===124||ae(N)?(t.exit("data"),u(N)):(t.consume(N),N===92?f:d)}function f(N){return N===92||N===124?(t.consume(N),d):d(N)}function p(N){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(N):(t.enter("tableDelimiterRow"),o=!1,zt(N)?Ut(t,m,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):m(N))}function m(N){return N===45||N===58?g(N):N===124?(o=!0,t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),x):_(N)}function x(N){return zt(N)?Ut(t,g,"whitespace")(N):g(N)}function g(N){return N===58?(s+=1,o=!0,t.enter("tableDelimiterMarker"),t.consume(N),t.exit("tableDelimiterMarker"),y):N===45?(s+=1,y(N)):N===null||jt(N)?w(N):_(N)}function y(N){return N===45?(t.enter("tableDelimiterFiller"),k(N)):_(N)}function k(N){return N===45?(t.consume(N),k):N===58?(o=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(N),t.exit("tableDelimiterMarker"),b):(t.exit("tableDelimiterFiller"),b(N))}function b(N){return zt(N)?Ut(t,w,"whitespace")(N):w(N)}function w(N){return N===124?m(N):N===null||jt(N)?!o||i!==s?_(N):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(N)):_(N)}function _(N){return r(N)}function T(N){return t.enter("tableRow"),S(N)}function S(N){return N===124?(t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),S):N===null||jt(N)?(t.exit("tableRow"),e(N)):zt(N)?Ut(t,S,"whitespace")(N):(t.enter("data"),L(N))}function L(N){return N===null||N===124||ae(N)?(t.exit("data"),S(N)):(t.consume(N),N===92?B:L)}function B(N){return N===92||N===124?(t.consume(N),L):L(N)}}function u3(t,e){let r=-1,n=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,c=0,h,u,d;const f=new o3;for(;++r<t.length;){const p=t[r],m=p[1];p[0]==="enter"?m.type==="tableHead"?(a=!1,c!==0&&(Pm(f,e,c,h,u),u=void 0,c=0),h={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(r,0,[["enter",h,e]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(n=!0,d=void 0,s=[0,0,0,0],o=[0,r+1,0,0],a&&(a=!1,u={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(r,0,[["enter",u,e]])),i=m.type==="tableDelimiterRow"?2:u?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(n=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],d=Ba(f,e,s,i,void 0,d),s=[0,0,0,0]),o[2]=r)):m.type==="tableCellDivider"&&(n?n=!1:(s[1]!==0&&(o[0]=o[1],d=Ba(f,e,s,i,void 0,d)),s=o,o=[s[1],r,0,0])):m.type==="tableHead"?(a=!0,c=r):m.type==="tableRow"||m.type==="tableDelimiterRow"?(c=r,s[1]!==0?(o[0]=o[1],d=Ba(f,e,s,i,r,d)):o[1]!==0&&(d=Ba(f,e,o,i,r,d)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=r)}for(c!==0&&Pm(f,e,c,h,u),f.consume(e.events),r=-1;++r<e.events.length;){const p=e.events[r];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=l3(e.events,r))}return t}function Ba(t,e,r,n,i,s){const o=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",a="tableContent";r[0]!==0&&(s.end=Object.assign({},Pi(e.events,r[0])),t.add(r[0],0,[["exit",s,e]]));const c=Pi(e.events,r[1]);if(s={type:o,start:Object.assign({},c),end:Object.assign({},c)},t.add(r[1],0,[["enter",s,e]]),r[2]!==0){const h=Pi(e.events,r[2]),u=Pi(e.events,r[3]),d={type:a,start:Object.assign({},h),end:Object.assign({},u)};if(t.add(r[2],0,[["enter",d,e]]),n!==2){const f=e.events[r[2]],p=e.events[r[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[1].contentType="text",r[3]>r[2]+1){const m=r[2]+1,x=r[3]-r[2]-1;t.add(m,x,[])}}t.add(r[3]+1,0,[["exit",d,e]])}return i!==void 0&&(s.end=Object.assign({},Pi(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function Pm(t,e,r,n,i){const s=[],o=Pi(e.events,r);i&&(i.end=Object.assign({},o),s.push(["exit",i,e])),n.end=Object.assign({},o),s.push(["exit",n,e]),t.add(r+1,0,s)}function Pi(t,e){const r=t[e],n=r[0]==="enter"?"start":"end";return r[1][n]}const d3={name:"tasklistCheck",tokenize:f3};function p3(){return{text:{91:d3}}}function f3(t,e,r){const n=this;return i;function i(c){return n.previous!==null||!n._gfmTasklistFirstContentOfListItem?r(c):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),s)}function s(c){return ae(c)?(t.enter("taskListCheckValueUnchecked"),t.consume(c),t.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(t.enter("taskListCheckValueChecked"),t.consume(c),t.exit("taskListCheckValueChecked"),o):r(c)}function o(c){return c===93?(t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),a):r(c)}function a(c){return jt(c)?e(c):zt(c)?t.check({tokenize:m3},e,r)(c):r(c)}}function m3(t,e,r){return Ut(t,n,"whitespace");function n(i){return i===null?r(i):e(i)}}function g3(t){return Sy([zA(),QA(),s3(t),c3(),p3()])}const x3={};function xp(t){const e=this,r=t||x3,n=e.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(g3(r)),s.push($A()),o.push(DA(r))}const Nc=C.createContext({newIds:new Set,changedIds:new Set}),$m=t=>{let e;const r=new Set,n=(h,u)=>{const d=typeof h=="function"?h(e):h;if(!Object.is(d,e)){const f=e;e=u??(typeof d!="object"||d===null)?d:Object.assign({},e,d),r.forEach(p=>p(e,f))}},i=()=>e,a={setState:n,getState:i,getInitialState:()=>c,subscribe:h=>(r.add(h),()=>r.delete(h))},c=e=t(n,i,a);return a},y3=(t=>t?$m(t):$m),b3=t=>t;function C3(t,e=b3){const r=Dt.useSyncExternalStore(t.subscribe,Dt.useCallback(()=>e(t.getState()),[t,e]),Dt.useCallback(()=>e(t.getInitialState()),[t,e]));return Dt.useDebugValue(r),r}const Dm=t=>{const e=y3(t),r=n=>C3(e,n);return Object.assign(r,e),r},yp=(t=>t?Dm(t):Dm),Vs=new Map;function k3(t,e,r){var $,O;const{prevItemMapRef:n,snapshotProviderRef:i,gatesRef:s,pendingResolveIdsRef:o,changeTimerRef:a,sessionEndTimerRef:c,wsRef:h}=e,{setItems:u,setConnections:d,setGates:f,setGateEvent:p,setRecentChanges:m,setUICommand:x,setAgentActivity:g,setAgentErrors:y,setSessionState:k,setSpawnedAgents:b,setAgentRelays:w,setSettings:_,setPipelineDraft:T,setActiveBuild:S,setSessions:L,setIterationStates:B,setFeatureTimeline:N,EMPTY_CHANGES:A,appendDecisionEvent:R,setDecisionEventsSnapshot:z,setStatusSnapshot:P,clearStatusSnapshots:I}=r,F=N?D=>{N(j=>j.some(Y=>Y.id===D.id)?j:[...j,D])}:null;if(t.type==="visionState"||t.type==="hydrate"){const D=t.items||[];if(n.current){const j=n.current,Y=new Set,et=new Set;for(const M of D){const ct=j.get(M.id);ct?(ct.status!==M.status||ct.confidence!==M.confidence||ct.title!==M.title)&&et.add(M.id):Y.add(M.id)}(Y.size>0||et.size>0)&&(m({newIds:Y,changedIds:et}),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>m(A),800))}n.current=new Map(D.map(j=>[j.id,j])),u(D),d(t.connections||[]),f(t.gates||[]),L&&L(t.sessions||[]),z&&Array.isArray(t.decisionEventsSnapshot)&&z(t.decisionEventsSnapshot),I&&I()}else if(t.type==="decisionEvent")R&&t.event&&R(t.event);else if(t.type==="decisionEventsSnapshot")z&&Array.isArray(t.events)&&z(t.events);else if(t.type==="statusSnapshot")P&&t.featureCode&&t.snapshot&&P(t.featureCode,t.snapshot);else if(t.type==="visionUI")x(t);else if(t.type==="agentActivity")g(D=>{const j=[...D,{tool:t.tool,category:t.category||null,detail:t.detail,items:t.items||[],error:t.error||null,timestamp:t.timestamp}];return j.length>20?j.slice(-20):j}),k(D=>D!=null&&D.active?{...D,toolCount:(D.toolCount||0)+1}:D);else if(t.type==="agentSpawned")b(D=>[...D,{agentId:t.agentId,parentSessionId:t.parentSessionId,agentType:t.agentType,status:"running",startedAt:t.startedAt,prompt:t.prompt}]);else if(t.type==="agentSilent")b(D=>D.map(j=>j.agentId===t.agentId?{...j,silent:!0,silentSinceMs:t.silentSinceMs}:j));else if(t.type==="agentKilled")b(D=>D.map(j=>j.agentId===t.agentId?{...j,status:"killed",terminalReason:t.reason,completedAt:new Date().toISOString()}:j));else if(t.type==="agentGC")(($=t.removed)==null?void 0:$.length)>0&&g(D=>{const j=[...D,{tool:"gc",category:"executing",detail:`Cleaned ${t.removed.length} orphan worktree(s)`,items:[],timestamp:t.timestamp}];return j.length>20?j.slice(-20):j});else if(t.type==="agentComplete")b(D=>D.map(j=>j.agentId===t.agentId?j.status==="killed"?j:{...j,status:t.status,completedAt:new Date().toISOString()}:j));else if(t.type==="agentRelay")w(D=>[...D,t].slice(-50));else if(t.type==="sessionStart")c.current&&(clearTimeout(c.current),c.current=null),b(()=>[]),w(()=>[]),k(D=>D&&D.id===t.sessionId?{...D,active:!0}:{id:t.sessionId,active:!0,startedAt:t.timestamp,source:t.source,toolCount:0,errorCount:0,summaries:[],featureCode:null,featureItemId:null,phaseAtBind:null,boundAt:null}),F&&F({id:`session-start-${t.sessionId}`,timestamp:t.timestamp,category:"session",title:"Session started",detail:t.source?`Source: ${t.source}`:null,severity:"info",sessionId:t.sessionId,meta:{source:t.source}});else if(t.type==="sessionEnd")c.current&&(clearTimeout(c.current),c.current=null),k(D=>D?{...D,active:!1,endedAt:t.timestamp,toolCount:t.toolCount,duration:t.duration,journalSpawned:t.journalSpawned,featureCode:t.featureCode||(D==null?void 0:D.featureCode)||null,phaseAtEnd:t.phaseAtEnd||null}:null),c.current=setTimeout(()=>{k(null),c.current=null},3e3),F&&F({id:`session-end-${t.sessionId||Date.now()}`,timestamp:t.timestamp,category:"session",title:`Session ended (${t.toolCount??0} tools)`,detail:null,severity:"info",sessionId:t.sessionId||null,meta:{toolCount:t.toolCount,duration:t.duration}});else if(t.type==="sessionSummary")k(D=>D&&{...D,summaries:[...D.summaries||[],{summary:t.summary,intent:t.intent,component:t.component,timestamp:t.timestamp}].slice(-5)});else if(t.type==="sessionBound")k(D=>D&&{...D,featureCode:t.featureCode,featureItemId:t.itemId,phaseAtBind:t.phase,boundAt:t.timestamp});else if(t.type==="agentError")y(D=>{const j=[...D,{errorType:t.errorType,severity:t.severity,message:t.message,tool:t.tool,detail:t.detail,items:t.items||[],timestamp:t.timestamp||new Date().toISOString()}];return j.length>10?j.slice(-10):j}),k(D=>D!=null&&D.active?{...D,errorCount:(D.errorCount||0)+1}:D),F&&F({id:`error-${t.timestamp}-${Math.random().toString(36).slice(2,6)}`,timestamp:t.timestamp||new Date().toISOString(),category:"error",title:t.message||`${t.errorType} error`,detail:t.tool?`Tool: ${t.tool}`:null,severity:t.severity==="error"?"error":"warning",sessionId:null,meta:{type:t.errorType,tool:t.tool}});else if(t.type==="gateCreated"||t.type==="gatePending")p({type:"pending",gateId:t.gateId,itemId:t.itemId,fromPhase:t.fromPhase,toPhase:t.toPhase}),F&&F({id:`gate-created-${t.gateId}`,timestamp:t.timestamp||new Date().toISOString(),category:"gate",title:t.fromPhase&&t.toPhase?`Gate: ${t.fromPhase} → ${t.toPhase}`:"Gate created",detail:null,severity:"info",sessionId:null,meta:{gateId:t.gateId,itemId:t.itemId,fromPhase:t.fromPhase,toPhase:t.toPhase}});else if(t.type==="gateResolved"){if(f(Y=>Y.map(et=>et.id===t.gateId?{...et,status:"resolved",outcome:t.outcome,resolvedAt:t.timestamp}:et)),o.current.has(t.gateId))o.current.delete(t.gateId);else{const Y=t.itemId??((O=s.current.find(et=>et.id===t.gateId))==null?void 0:O.itemId)??t.gateId;p({type:"resolved",gateId:t.gateId,outcome:t.outcome,itemId:Y})}const D=t.outcome==="approve"?"approved":t.outcome==="revise"?"revised":t.outcome==="kill"?"killed":t.outcome,j={approve:"success",revise:"warning",kill:"error"};F&&F({id:`gate-resolved-${t.gateId}`,timestamp:t.timestamp||new Date().toISOString(),category:"gate",title:`Gate ${D}`,detail:null,severity:j[t.outcome]||"info",sessionId:null,meta:{gateId:t.gateId,itemId:t.itemId,outcome:t.outcome}})}else if(t.type==="iterationStarted"||t.type==="iterationUpdate"||t.type==="iterationComplete"){if(g(D=>{let j;t.type==="iterationStarted"?j=`${t.loopType} loop started (0/${t.maxIterations})`:t.type==="iterationComplete"?j=`${t.loopType??"loop"} loop complete (${t.outcome} after ${t.finalCount} iterations)`:j=`${t.loopType??"loop"} iteration ${t.count}/${t.maxIterations}`;const Y=[...D,{tool:"iteration",category:t.loopType||"iteration",detail:j,items:[],timestamp:t.timestamp}];return Y.length>20?Y.slice(-20):Y}),t.type==="iterationStarted")Vs.has(t.loopId)&&(clearTimeout(Vs.get(t.loopId)),Vs.delete(t.loopId)),B(D=>{const j=new Map(D);return j.set(t.loopId,{loopId:t.loopId,itemId:t.itemId,loopType:t.loopType,count:0,maxIterations:t.maxIterations,status:"running",outcome:null,startedAt:t.startedAt??t.timestamp,wallClockTimeout:t.wallClockTimeout??null,maxActions:t.maxActions??null}),j});else if(t.type==="iterationUpdate")B(D=>{const j=D.get(t.loopId);if(!j)return D;const Y=new Map(D);return Y.set(t.loopId,{...j,count:t.count,maxIterations:t.maxIterations}),Y});else if(t.type==="iterationComplete"){B(j=>{const Y=j.get(t.loopId);if(!Y)return j;const et=new Map(j);return et.set(t.loopId,{...Y,status:"complete",outcome:t.outcome,count:t.finalCount??Y.count}),et});const D=setTimeout(()=>{B(j=>{const Y=new Map(j);return Y.delete(t.loopId),Y}),Vs.delete(t.loopId)},5e3);Vs.set(t.loopId,D)}if(t.type==="iterationComplete"&&(t.outcome==="max_reached"||t.outcome==="timeout"||t.outcome==="action_limit")){const D={max_reached:`${t.loopType??"Loop"} hit max iterations (${t.finalCount}) — problem may be in the spec`,timeout:`${t.loopType??"Loop"} timed out after ${t.elapsedMinutes??"?"} minutes (${t.finalCount} iterations)`,action_limit:`${t.loopType??"Loop"} hit action count ceiling (${t.finalCount} iterations)`};y(j=>{const Y=[...j,{errorType:"iteration_limit",severity:"warning",message:D[t.outcome]??`${t.loopType??"Loop"} stopped: ${t.outcome}`,timestamp:t.timestamp}];return Y.length>10?Y.slice(-10):Y}),k(j=>j!=null&&j.active?{...j,errorCount:(j.errorCount||0)+1}:j)}if(F&&(t.type==="iterationStarted"||t.type==="iterationComplete")){const D=t.type==="iterationStarted"?`${t.loopType} loop started (0/${t.maxIterations})`:`${t.loopType??"loop"} loop ${t.outcome} (${t.finalCount} iterations)`;F({id:`iteration-${t.loopId}-${t.type}`,timestamp:t.timestamp,category:"iteration",title:D,detail:null,severity:t.outcome==="max_reached"||t.outcome==="timeout"||t.outcome==="action_limit"?"warning":t.type==="iterationComplete"?"success":"info",sessionId:null,meta:{loopId:t.loopId,loopType:t.loopType}})}}else if(t.type==="lifecycleStarted")F&&F({id:`lifecycle-started-${t.itemId}`,timestamp:t.timestamp,category:"phase",title:`Lifecycle started: ${t.phase}`,detail:t.featureCode?`Feature: ${t.featureCode}`:null,severity:"success",sessionId:null,meta:{itemId:t.itemId,phase:t.phase,featureCode:t.featureCode}});else if(t.type==="lifecycleTransition"){const D=t.outcome==="skipped"?" (skipped)":t.outcome==="killed"?" (killed)":"",j=t.outcome==="killed"?"error":t.outcome==="skipped"?"info":"success";F&&F({id:`lifecycle-${t.itemId}-${t.from}-${t.to}`,timestamp:t.timestamp,category:"phase",title:`Phase: ${t.from} → ${t.to}${D}`,detail:null,severity:j,sessionId:null,meta:{itemId:t.itemId,from:t.from,to:t.to,outcome:t.outcome}})}else if(t.type==="openLoopsUpdate")u&&t.itemId&&Array.isArray(t.loops)&&u(D=>D.map(j=>{if(j.id!==t.itemId)return j;const Y=j.lifecycle?{...j.lifecycle}:{};return Y.lifecycle_ext={...Y.lifecycle_ext||{},open_loops:t.loops},{...j,lifecycle:Y}}));else if(t.type==="driftAxesUpdate")u&&t.itemId&&Array.isArray(t.drift_axes)&&u(D=>D.map(j=>{if(j.id!==t.itemId)return j;const Y=j.lifecycle?{...j.lifecycle}:{};return Y.lifecycle_ext={...Y.lifecycle_ext||{},drift_axes:t.drift_axes},{...j,lifecycle:Y}}));else if(t.type==="branchLineageUpdate"){if(u&&t.itemId){const{type:D,itemId:j,...Y}=t;u(et=>et.map(M=>{if(M.id!==j)return M;const ct=M.lifecycle?{...M.lifecycle}:{};return ct.lifecycle_ext={...ct.lifecycle_ext||{},branch_lineage:Y},{...M,lifecycle:ct}}))}}else if(t.type==="settingsState"||t.type==="settingsUpdated")_&&_(t.settings||null);else if(t.type==="buildState")S&&S(D=>{const j=(D==null?void 0:D.flowId)&&t.flowId&&D.flowId===t.flowId;return{...t,tierEvents:j?D.tierEvents??[]:[],capabilityEvents:j?D.capabilityEvents??[]:[],...j&&(D==null?void 0:D.health_score)!=null?{health_score:D.health_score,health_breakdown:D.health_breakdown,health_missing:D.health_missing}:{}}});else if(t.type==="pipelineDraft")T&&T(t);else if(t.type==="pipelineDraftResolved")T&&T(null);else if(t.type==="system"&&t.subtype==="health_score")S&&S(D=>D&&{...D,health_score:t.score,health_breakdown:t.breakdown,health_missing:t.missing});else if(t.type==="system"&&(t.subtype==="gate_tier_result"||t.subtype==="gate_tier_failed"||t.subtype==="gate_tier_summary"))S&&S(D=>D&&{...D,tierEvents:[...D.tierEvents||[],t].slice(-50)});else if(t.type==="system"&&t.subtype==="capability_violation")S&&S(D=>D&&{...D,capabilityEvents:[...D.capabilityEvents||[],t].slice(-200)});else if(t.type==="devicePaired")try{window.dispatchEvent(new CustomEvent("compose:devicePaired",{detail:{device_id:t.device_id,name:t.name,timestamp:t.timestamp}}))}catch{}else if(t.type==="snapshotRequest"&&t.requestId){const{collectDOMSnapshot:D}=e,j=i.current?i.current():{},Y=D?D():{},et=h.current;et&&et.send(JSON.stringify({type:"snapshotResponse",requestId:t.requestId,snapshot:{...j,dom:Y,timestamp:new Date().toISOString()}}))}}function v3(){const t=new Set(["SCRIPT","STYLE","LINK","META","NOSCRIPT"]),e=12,r=120;function n(s,o){if(!s||o>e)return null;if(s.nodeType===Node.TEXT_NODE){const f=s.textContent.trim();return f?f.slice(0,r):null}if(s.nodeType!==Node.ELEMENT_NODE||t.has(s.tagName))return null;const a=window.getComputedStyle(s);if(a.display==="none"||a.visibility==="hidden")return null;const c={},h=s.getAttribute("role")||s.getAttribute("aria-label"),u=s.tagName.toLowerCase();if(h?c.role=h:c.tag=u,s.className&&typeof s.className=="string"){const f=s.className.trim();f.length<80&&(c.class=f)}const d=[];for(const f of s.childNodes){const p=n(f,o+1);p&&d.push(p)}return d.length===1&&typeof d[0]=="string"?c.text=d[0]:d.length>0&&(c.children=d),!h&&(u==="div"||u==="span")&&!c.text&&d.length===1&&typeof d[0]=="object"?d[0]:c}const i=document.querySelector("[data-snapshot-root]")||document.body;return n(i,0)}const fe={ws:null,snapshotProvider:null,prevItemMap:null,changeTimer:null,sessionEndTimer:null,gates:[],pendingResolveIds:new Set,buildPollInterval:null,recentErrorsInterval:null,connected:!1},Om={newIds:new Set,changedIds:new Set},lr=yp((t,e)=>{async function r(o,a){const c=await vt(o,a),h=await c.json();return c.ok?h:(console.error(`[vision] API error ${c.status}:`,h.error||h),{error:h.error||`HTTP ${c.status}`})}function n(){t({connected:!0}),vt("/api/build/state").then(o=>o.json()).then(o=>t({activeBuild:o.state??null})).catch(()=>{}),vt("/api/pipeline/draft").then(o=>o.json()).then(o=>t({pipelineDraft:o.draft??null})).catch(()=>{}),vt("/api/agents/tree").then(o=>o.json()).then(o=>{e().spawnedAgents.length===0&&t({spawnedAgents:(o.agents||[]).map(c=>({agentId:c.agentId,parentSessionId:c.parentSessionId,agentType:c.agentType,status:c.status||"running",startedAt:c.startedAt,prompt:c.prompt}))})}).catch(()=>{})}function i(o){try{const a=JSON.parse(o.data);k3(a,{prevItemMapRef:{get current(){return fe.prevItemMap},set current(c){fe.prevItemMap=c}},snapshotProviderRef:{get current(){return fe.snapshotProvider},set current(c){fe.snapshotProvider=c}},gatesRef:{get current(){return fe.gates},set current(c){fe.gates=c}},pendingResolveIdsRef:{get current(){return fe.pendingResolveIds},set current(c){fe.pendingResolveIds=c}},changeTimerRef:{get current(){return fe.changeTimer},set current(c){fe.changeTimer=c}},sessionEndTimerRef:{get current(){return fe.sessionEndTimer},set current(c){fe.sessionEndTimer=c}},wsRef:{get current(){var c;return((c=fe.ws)==null?void 0:c.socket)||null},set current(c){}},collectDOMSnapshot:v3},{setItems:c=>t(h=>({items:typeof c=="function"?c(h.items):c})),setConnections:c=>t(h=>({connections:typeof c=="function"?c(h.connections):c})),setGates:c=>{t(h=>{const u=typeof c=="function"?c(h.gates):c;return fe.gates=u,{gates:u}})},setGateEvent:c=>t({gateEvent:c}),setRecentChanges:c=>t(h=>({recentChanges:typeof c=="function"?c(h.recentChanges):c})),setUICommand:c=>t({uiCommand:c}),setAgentActivity:c=>t(h=>({agentActivity:typeof c=="function"?c(h.agentActivity):c})),setAgentErrors:c=>{t(h=>{const u=typeof c=="function"?c(h.agentErrors):c,d=Date.now()-6e4,f=u.filter(p=>new Date(p.timestamp).getTime()>d).slice(-5);return{agentErrors:u,recentErrors:f}})},setSessionState:c=>t(h=>({sessionState:typeof c=="function"?c(h.sessionState):c})),setSpawnedAgents:c=>t(h=>({spawnedAgents:typeof c=="function"?c(h.spawnedAgents):c})),setAgentRelays:c=>t(h=>({agentRelays:typeof c=="function"?c(h.agentRelays):c})),setSettings:c=>t({settings:c}),setPipelineDraft:c=>t({pipelineDraft:c}),setActiveBuild:c=>t(h=>({activeBuild:typeof c=="function"?c(h.activeBuild):c})),setSessions:c=>t(h=>({sessions:typeof c=="function"?c(h.sessions):c})),setFeatureTimeline:c=>t(h=>({featureTimeline:typeof c=="function"?c(h.featureTimeline):c})),setIterationStates:c=>t(h=>({iterationStates:typeof c=="function"?c(h.iterationStates):c})),appendDecisionEvent:c=>t(h=>!(c!=null&&c.id)||h.decisionEvents.some(u=>u.id===c.id)?h:{decisionEvents:[...h.decisionEvents,c]}),setDecisionEventsSnapshot:c=>t({decisionEvents:Array.isArray(c)?c:[]}),setStatusSnapshot:(c,h)=>t(u=>({statusSnapshots:{...u.statusSnapshots,[c]:h}})),clearStatusSnapshots:()=>t({statusSnapshots:{}}),EMPTY_CHANGES:Om})}catch{}}function s(){fe.disposed||fe.ws||(fe.ws=vT({url:()=>z0(),onOpen:n,onMessage:i,onClose:()=>t({connected:!1})}))}return vt("/api/session/current").then(o=>o.json()).then(o=>{o.session&&t(a=>a.sessionState?{}:{sessionState:{id:o.session.id,active:!0,startedAt:o.session.startedAt,source:o.session.source||"hydrated",toolCount:o.session.toolCount||0,errorCount:o.session.errorCount||0,summaries:o.session.summaries||[],featureCode:o.session.featureCode||null,featureItemId:o.session.featureItemId||null,phaseAtBind:o.session.phaseAtBind||null,boundAt:o.session.boundAt||null}})}).catch(()=>console.warn("[vision] Failed to hydrate session state")),fe.buildPollInterval=setInterval(()=>{vt("/api/build/state").then(o=>o.json()).then(o=>t({activeBuild:o.state??null})).catch(()=>{})},5e3),fe.recentErrorsInterval=setInterval(()=>{const{agentErrors:o}=e(),a=Date.now()-6e4,c=o.filter(h=>new Date(h.timestamp).getTime()>a).slice(-5);t({recentErrors:c})},1e4),s(),{items:[],connections:[],connected:!1,uiCommand:null,recentChanges:Om,agentActivity:[],agentErrors:[],recentErrors:[],spawnedAgents:[],agentRelays:[],sessionState:null,gates:[],gateEvent:null,settings:null,pipelineDraft:null,activeBuild:null,iterationStates:new Map,sessions:[],buildHistory:[],featureTimeline:[],selectedPhase:(()=>{try{return localStorage.getItem("compose:selectedPhase")||null}catch{return null}})(),selectedBranches:{},decisionEvents:[],statusSnapshots:{},clearUICommand:()=>t({uiCommand:null}),setSelectedBranches:(o,a)=>t(c=>({selectedBranches:{...c.selectedBranches,[o]:a}})),setStatusSnapshot:(o,a)=>t(c=>({statusSnapshots:{...c.statusSnapshots,[o]:a}})),clearStatusSnapshots:()=>t({statusSnapshots:{}}),setDecisionEventsSnapshot:o=>t({decisionEvents:Array.isArray(o)?o:[]}),appendDecisionEvent:o=>t(a=>!(o!=null&&o.id)||a.decisionEvents.some(c=>c.id===o.id)?a:{decisionEvents:[...a.decisionEvents,o]}),registerSnapshotProvider:o=>{fe.snapshotProvider=o},setActiveBuild:o=>t({activeBuild:o}),setBuildHistory:o=>t({buildHistory:Array.isArray(o)?o:[]}),fetchBuildHistory:async()=>{try{const a=await(await vt("/api/builds")).json();t({buildHistory:Array.isArray(a.builds)?a.builds:[]})}catch{t({buildHistory:[]})}},setPipelineDraft:o=>t({pipelineDraft:o}),setFeatureTimeline:o=>t(a=>({featureTimeline:typeof o=="function"?o(a.featureTimeline):o})),setSelectedPhase:o=>{t({selectedPhase:o});try{o?localStorage.setItem("compose:selectedPhase",o):localStorage.removeItem("compose:selectedPhase")}catch{}},updateItemPosition:(o,a)=>{t(c=>({items:c.items.map(h=>h.id===o?{...h,position:a}:h)}))},createItem:o=>r("/api/vision/items",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}),updateItem:(o,a)=>r(`/api/vision/items/${o}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),deleteItem:o=>r(`/api/vision/items/${o}`,{method:"DELETE"}),createConnection:o=>r("/api/vision/connections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}),deleteConnection:o=>r(`/api/vision/connections/${o}`,{method:"DELETE"}),resolveGate:async(o,a,c)=>{fe.pendingResolveIds.add(o);try{const h=await r(`/api/vision/gates/${o}/resolve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({outcome:a,comment:c})});return h.error&&fe.pendingResolveIds.delete(o),h}catch{return fe.pendingResolveIds.delete(o),{error:"Network error"}}},updateSettings:o=>r("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}),resetSettings:o=>r("/api/settings/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o?{section:o}:{})})}}),w3=jT("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function cr({className:t,variant:e,...r}){return l.jsx("div",{className:nt(w3({variant:e}),t),...r})}var S3=C.createContext(void 0);function T3(t){const e=C.useContext(S3);return t||e||"ltr"}function _3(t,[e,r]){return Math.min(r,Math.max(e,t))}function j3(t,e){return C.useReducer((r,n)=>e[r][n]??r,t)}var bp="ScrollArea",[fb]=NT(bp),[N3,Tr]=fb(bp),mb=C.forwardRef((t,e)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:s=600,...o}=t,[a,c]=C.useState(null),[h,u]=C.useState(null),[d,f]=C.useState(null),[p,m]=C.useState(null),[x,g]=C.useState(null),[y,k]=C.useState(0),[b,w]=C.useState(0),[_,T]=C.useState(!1),[S,L]=C.useState(!1),B=bs(e,A=>c(A)),N=T3(i);return l.jsx(N3,{scope:r,type:n,dir:N,scrollHideDelay:s,scrollArea:a,viewport:h,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:_,onScrollbarXEnabledChange:T,scrollbarY:x,onScrollbarYChange:g,scrollbarYEnabled:S,onScrollbarYEnabledChange:L,onCornerWidthChange:k,onCornerHeightChange:w,children:l.jsx(ea.div,{dir:N,...o,ref:B,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":b+"px",...t.style}})})});mb.displayName=bp;var gb="ScrollAreaViewport",xb=C.forwardRef((t,e)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=t,o=Tr(gb,r),a=C.useRef(null),c=bs(e,a,o.onViewportChange);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),l.jsx(ea.div,{"data-radix-scroll-area-viewport":"",...s,ref:c,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t.style},children:l.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});xb.displayName=gb;var Zr="ScrollAreaScrollbar",Cp=C.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Tr(Zr,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=t.orientation==="horizontal";return C.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?l.jsx(E3,{...n,ref:e,forceMount:r}):i.type==="scroll"?l.jsx(L3,{...n,ref:e,forceMount:r}):i.type==="auto"?l.jsx(yb,{...n,ref:e,forceMount:r}):i.type==="always"?l.jsx(kp,{...n,ref:e}):null});Cp.displayName=Zr;var E3=C.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Tr(Zr,t.__scopeScrollArea),[s,o]=C.useState(!1);return C.useEffect(()=>{const a=i.scrollArea;let c=0;if(a){const h=()=>{window.clearTimeout(c),o(!0)},u=()=>{c=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",h),a.addEventListener("pointerleave",u),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",h),a.removeEventListener("pointerleave",u)}}},[i.scrollArea,i.scrollHideDelay]),l.jsx(gc,{present:r||s,children:l.jsx(yb,{"data-state":s?"visible":"hidden",...n,ref:e})})}),L3=C.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Tr(Zr,t.__scopeScrollArea),s=t.orientation==="horizontal",o=Lc(()=>c("SCROLL_END"),100),[a,c]=j3("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return C.useEffect(()=>{if(a==="idle"){const h=window.setTimeout(()=>c("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(h)}},[a,i.scrollHideDelay,c]),C.useEffect(()=>{const h=i.viewport,u=s?"scrollLeft":"scrollTop";if(h){let d=h[u];const f=()=>{const p=h[u];d!==p&&(c("SCROLL"),o()),d=p};return h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[i.viewport,s,c,o]),l.jsx(gc,{present:r||a!=="hidden",children:l.jsx(kp,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:ei(t.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:ei(t.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),yb=C.forwardRef((t,e)=>{const r=Tr(Zr,t.__scopeScrollArea),{forceMount:n,...i}=t,[s,o]=C.useState(!1),a=t.orientation==="horizontal",c=Lc(()=>{if(r.viewport){const h=r.viewport.offsetWidth<r.viewport.scrollWidth,u=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?h:u)}},10);return cs(r.viewport,c),cs(r.content,c),l.jsx(gc,{present:n||s,children:l.jsx(kp,{"data-state":s?"visible":"hidden",...i,ref:e})})}),kp=C.forwardRef((t,e)=>{const{orientation:r="vertical",...n}=t,i=Tr(Zr,t.__scopeScrollArea),s=C.useRef(null),o=C.useRef(0),[a,c]=C.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=wb(a.viewport,a.content),u={...n,sizes:a,onSizesChange:c,hasThumb:h>0&&h<1,onThumbChange:f=>s.current=f,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:f=>o.current=f};function d(f,p){return P3(f,o.current,a,p)}return r==="horizontal"?l.jsx(B3,{...u,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const f=i.viewport.scrollLeft,p=Rm(f,a,i.dir);s.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:f=>{i.viewport&&(i.viewport.scrollLeft=f)},onDragScroll:f=>{i.viewport&&(i.viewport.scrollLeft=d(f,i.dir))}}):r==="vertical"?l.jsx(A3,{...u,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const f=i.viewport.scrollTop,p=Rm(f,a);s.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:f=>{i.viewport&&(i.viewport.scrollTop=f)},onDragScroll:f=>{i.viewport&&(i.viewport.scrollTop=d(f))}}):null}),B3=C.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,s=Tr(Zr,t.__scopeScrollArea),[o,a]=C.useState(),c=C.useRef(null),h=bs(e,c,s.onScrollbarXChange);return C.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(Cb,{"data-orientation":"horizontal",...i,ref:h,sizes:r,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Ec(r)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.x),onDragScroll:u=>t.onDragScroll(u.x),onWheelScroll:(u,d)=>{if(s.viewport){const f=s.viewport.scrollLeft+u.deltaX;t.onWheelScroll(f),Tb(f,d)&&u.preventDefault()}},onResize:()=>{c.current&&s.viewport&&o&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Nl(o.paddingLeft),paddingEnd:Nl(o.paddingRight)}})}})}),A3=C.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,s=Tr(Zr,t.__scopeScrollArea),[o,a]=C.useState(),c=C.useRef(null),h=bs(e,c,s.onScrollbarYChange);return C.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(Cb,{"data-orientation":"vertical",...i,ref:h,sizes:r,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Ec(r)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.y),onDragScroll:u=>t.onDragScroll(u.y),onWheelScroll:(u,d)=>{if(s.viewport){const f=s.viewport.scrollTop+u.deltaY;t.onWheelScroll(f),Tb(f,d)&&u.preventDefault()}},onResize:()=>{c.current&&s.viewport&&o&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Nl(o.paddingTop),paddingEnd:Nl(o.paddingBottom)}})}})}),[M3,bb]=fb(Zr),Cb=C.forwardRef((t,e)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:h,onWheelScroll:u,onResize:d,...f}=t,p=Tr(Zr,r),[m,x]=C.useState(null),g=bs(e,B=>x(B)),y=C.useRef(null),k=C.useRef(""),b=p.viewport,w=n.content-n.viewport,_=Kn(u),T=Kn(c),S=Lc(d,10);function L(B){if(y.current){const N=B.clientX-y.current.left,A=B.clientY-y.current.top;h({x:N,y:A})}}return C.useEffect(()=>{const B=N=>{const A=N.target;(m==null?void 0:m.contains(A))&&_(N,w)};return document.addEventListener("wheel",B,{passive:!1}),()=>document.removeEventListener("wheel",B,{passive:!1})},[b,m,w,_]),C.useEffect(T,[n,T]),cs(m,S),cs(p.content,S),l.jsx(M3,{scope:r,scrollbar:m,hasThumb:i,onThumbChange:Kn(s),onThumbPointerUp:Kn(o),onThumbPositionChange:T,onThumbPointerDown:Kn(a),children:l.jsx(ea.div,{...f,ref:g,style:{position:"absolute",...f.style},onPointerDown:ei(t.onPointerDown,B=>{B.button===0&&(B.target.setPointerCapture(B.pointerId),y.current=m.getBoundingClientRect(),k.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),L(B))}),onPointerMove:ei(t.onPointerMove,L),onPointerUp:ei(t.onPointerUp,B=>{const N=B.target;N.hasPointerCapture(B.pointerId)&&N.releasePointerCapture(B.pointerId),document.body.style.webkitUserSelect=k.current,p.viewport&&(p.viewport.style.scrollBehavior=""),y.current=null})})})}),jl="ScrollAreaThumb",kb=C.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=bb(jl,t.__scopeScrollArea);return l.jsx(gc,{present:r||i.hasThumb,children:l.jsx(I3,{ref:e,...n})})}),I3=C.forwardRef((t,e)=>{const{__scopeScrollArea:r,style:n,...i}=t,s=Tr(jl,r),o=bb(jl,r),{onThumbPositionChange:a}=o,c=bs(e,d=>o.onThumbChange(d)),h=C.useRef(void 0),u=Lc(()=>{h.current&&(h.current(),h.current=void 0)},100);return C.useEffect(()=>{const d=s.viewport;if(d){const f=()=>{if(u(),!h.current){const p=$3(d,a);h.current=p,a()}};return a(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[s.viewport,u,a]),l.jsx(ea.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:ei(t.onPointerDownCapture,d=>{const p=d.target.getBoundingClientRect(),m=d.clientX-p.left,x=d.clientY-p.top;o.onThumbPointerDown({x:m,y:x})}),onPointerUp:ei(t.onPointerUp,o.onThumbPointerUp)})});kb.displayName=jl;var vp="ScrollAreaCorner",vb=C.forwardRef((t,e)=>{const r=Tr(vp,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?l.jsx(F3,{...t,ref:e}):null});vb.displayName=vp;var F3=C.forwardRef((t,e)=>{const{__scopeScrollArea:r,...n}=t,i=Tr(vp,r),[s,o]=C.useState(0),[a,c]=C.useState(0),h=!!(s&&a);return cs(i.scrollbarX,()=>{var d;const u=((d=i.scrollbarX)==null?void 0:d.offsetHeight)||0;i.onCornerHeightChange(u),c(u)}),cs(i.scrollbarY,()=>{var d;const u=((d=i.scrollbarY)==null?void 0:d.offsetWidth)||0;i.onCornerWidthChange(u),o(u)}),h?l.jsx(ea.div,{...n,ref:e,style:{width:s,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Nl(t){return t?parseInt(t,10):0}function wb(t,e){const r=t/e;return isNaN(r)?0:r}function Ec(t){const e=wb(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function P3(t,e,r,n="ltr"){const i=Ec(r),s=i/2,o=e||s,a=i-o,c=r.scrollbar.paddingStart+o,h=r.scrollbar.size-r.scrollbar.paddingEnd-a,u=r.content-r.viewport,d=n==="ltr"?[0,u]:[u*-1,0];return Sb([c,h],d)(t)}function Rm(t,e,r="ltr"){const n=Ec(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-i,o=e.content-e.viewport,a=s-n,c=r==="ltr"?[0,o]:[o*-1,0],h=_3(t,c);return Sb([0,o],[0,a])(h)}function Sb(t,e){return r=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const n=(e[1]-e[0])/(t[1]-t[0]);return e[0]+n*(r-t[0])}}function Tb(t,e){return t>0&&t<e}var $3=(t,e=()=>{})=>{let r={left:t.scrollLeft,top:t.scrollTop},n=0;return(function i(){const s={left:t.scrollLeft,top:t.scrollTop},o=r.left!==s.left,a=r.top!==s.top;(o||a)&&e(),r=s,n=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(n)};function Lc(t,e){const r=Kn(t),n=C.useRef(0);return C.useEffect(()=>()=>window.clearTimeout(n.current),[]),C.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function cs(t,e){const r=Kn(e);ET(()=>{let n=0;if(t){const i=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return i.observe(t),()=>{window.cancelAnimationFrame(n),i.unobserve(t)}}},[t,r])}var _b=mb,D3=xb,O3=vb;const An=C.forwardRef(({className:t,children:e,...r},n)=>l.jsxs(_b,{ref:n,className:nt("relative overflow-hidden",t),...r,children:[l.jsx(D3,{className:"h-full w-full rounded-[inherit]",children:e}),l.jsx(jb,{}),l.jsx(O3,{})]}));An.displayName=_b.displayName;const jb=C.forwardRef(({className:t,orientation:e="vertical",...r},n)=>l.jsx(Cp,{ref:n,orientation:e,className:nt("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...r,children:l.jsx(kb,{className:"relative flex-1 rounded-full bg-border"})}));jb.displayName=Cp.displayName;var R3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],z3=R3.reduce((t,e)=>{const r=LT(`Primitive.${e}`),n=C.forwardRef((i,s)=>{const{asChild:o,...a}=i,c=o?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:s})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{}),q3="Separator",zm="horizontal",W3=["horizontal","vertical"],Nb=C.forwardRef((t,e)=>{const{decorative:r,orientation:n=zm,...i}=t,s=H3(n)?n:zm,a=r?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return l.jsx(z3.div,{"data-orientation":s,...a,...i,ref:e})});Nb.displayName=q3;function H3(t){return W3.includes(t)}var Eb=Nb;const El=C.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},i)=>l.jsx(Eb,{ref:i,decorative:r,orientation:e,className:nt("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...n}));El.displayName=Eb.displayName;function U3({agentId:t,status:e}){const[r,n]=C.useState(""),[i,s]=C.useState(""),o=C.useRef(null),a=C.useRef(!1),c=C.useCallback(()=>{const d=o.current;d&&(a.current=d.scrollTop+d.clientHeight<d.scrollHeight-20)},[]);C.useEffect(()=>{const d=o.current;d&&!a.current&&(d.scrollTop=d.scrollHeight)},[r,i]),C.useEffect(()=>{if(!t)return;const d=async()=>{try{const f=await vt(`/api/agent/${t}`);if(!f.ok)return;const p=await f.json();p.output!=null&&n(p.output),p.stderr!=null&&s(p.stderr)}catch{}};if(d(),e==="running"){const f=setInterval(d,2e3);return()=>clearInterval(f)}},[t,e]);const h=!r&&!i,u=e==="running";return l.jsx("div",{children:l.jsx("div",{ref:o,onScroll:c,className:"overflow-auto max-h-[300px] rounded bg-muted/30 p-2",children:h?l.jsx("p",{className:"text-[10px] font-mono text-muted-foreground italic",children:u?"Waiting for output...":"No output"}):l.jsxs(l.Fragment,{children:[r&&l.jsx("pre",{className:"text-[10px] font-mono text-muted-foreground whitespace-pre-wrap break-all m-0",children:r}),i&&l.jsxs("div",{className:"mt-2",children:[l.jsx("span",{className:"text-[10px] font-mono font-medium text-destructive",children:"stderr"}),l.jsx("pre",{className:"text-[10px] font-mono text-destructive whitespace-pre-wrap break-all m-0 mt-0.5",children:i})]})]})})})}const V3=Dt.memo(U3);function Y3(t){if(!t)return"";const e=Math.floor((Date.now()-new Date(t).getTime())/1e3);return e<5?"now":e<60?`${e}s ago`:e<3600?`${Math.floor(e/60)}m ago`:`${Math.floor(e/3600)}h ago`}function G3({agentId:t,relays:e}){const r=C.useMemo(()=>!e||!t?[]:e.filter(n=>n.fromAgentId===t||n.toAgentId===t),[e,t]);return r.length===0?null:l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider mb-0.5",style:{color:"hsl(var(--muted-foreground))"},children:"Relays"}),l.jsx("div",{className:"space-y-0.5",children:r.map((n,i)=>{const s=n.direction==="result";return l.jsxs("div",{className:"flex items-start gap-1 text-[10px] font-mono",children:[l.jsx("span",{className:s?"text-foreground shrink-0":"text-muted-foreground shrink-0",children:s?"→":"←"}),l.jsx("span",{className:s?"text-foreground truncate":"text-muted-foreground truncate",title:n.messagePreview,children:n.messagePreview}),l.jsx("span",{className:"text-muted-foreground opacity-50 ml-auto shrink-0 tabular-nums",children:Y3(n.timestamp)})]},n.id||i)})})]})}const X3=Dt.memo(G3),K3={reading:"Reading",writing:"Writing",executing:"Running",searching:"Searching",fetching:"Fetching",delegating:"Delegating",thinking:"Thinking"},qm={build_error:"Build",test_failure:"Test",lint_error:"Lint",git_conflict:"Conflict",permission_error:"Permission",not_found:"Not Found",runtime_error:"Error"};function Nh(t){if(!t||t<1e3)return"<1s";const e=Math.floor(t/1e3);return e<60?`${e}s`:`${Math.floor(e/60)}m ${e%60}s`}const Q3=Dt.memo(function({startedAt:e,active:r,duration:n}){const[,i]=Dt.useState(0);Dt.useEffect(()=>{if(!r)return;const c=setInterval(()=>i(h=>h+1),1e3);return()=>clearInterval(c)},[r]);const s=r?Math.floor((Date.now()-new Date(e).getTime())/1e3):n||0,o=Math.floor(s/60),a=s%60;return l.jsxs("span",{className:"tabular-nums",children:[o,"m ",String(a).padStart(2,"0"),"s"]})});function Z3({agentActivity:t,agentErrors:e,sessionState:r,onSelectItem:n,spawnedAgents:i,agentRelays:s,onStopAgent:o}){var x,g,y,k;const[a,c]=Dt.useState(null),[h,u]=Dt.useState({status:"idle",tool:null,category:null,activityLog:[],currentActivity:null}),[,d]=Dt.useState(0),[f,p]=Dt.useState([]),m=Dt.useRef(null);return Dt.useEffect(()=>{const b=w=>u(w.detail);return window.addEventListener("compose:agent-status",b),()=>window.removeEventListener("compose:agent-status",b)},[]),Dt.useEffect(()=>{if(h.status!=="working")return;const b=setInterval(()=>d(w=>w+1),1e3);return()=>clearInterval(b)},[h.status]),Dt.useEffect(()=>{if(!t||t.length===0)return;const b=t[t.length-1];Array.isArray(b.items)&&b.items.length>0&&(p(b.items),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>p([]),3e4))},[t]),Dt.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),l.jsxs(l.Fragment,{children:[i&&i.length>0&&l.jsxs("div",{className:"flex items-center gap-0.5 mb-1.5 overflow-x-auto px-3",children:[l.jsx("button",{onClick:()=>c(null),className:nt("text-[10px] px-2 py-0.5 rounded cursor-pointer transition-colors border shrink-0",a?"bg-transparent text-muted-foreground border-border hover:text-foreground":"bg-primary text-primary-foreground border-primary"),children:"Session"}),i.map(b=>l.jsxs("span",{className:"flex items-center gap-0 shrink-0",children:[l.jsxs("button",{onClick:()=>c(b.agentId),className:nt("text-[10px] px-2 py-0.5 rounded-l cursor-pointer transition-colors border flex items-center gap-1 shrink-0",a===b.agentId?"bg-primary text-primary-foreground border-primary":"bg-transparent text-muted-foreground border-border hover:text-foreground"),children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:b.status==="killed"?"hsl(var(--destructive))":b.silent?"hsl(45 93% 47%)":b.status==="running"?"hsl(var(--success))":b.status==="complete"?"hsl(142 71% 45%)":"hsl(var(--destructive))",animation:b.status==="running"&&!b.silent?"phase-active-pulse 2s ease-in-out infinite":"none"}}),b.agentType,b.silent&&l.jsx("span",{className:"text-[8px] text-yellow-500 ml-0.5",title:"Agent silent",children:"!"})]}),b.status==="running"&&o&&l.jsx("button",{onClick:w=>{w.stopPropagation(),o(b.agentId)},className:"text-[10px] px-1 py-0.5 rounded-r border border-l-0 border-border hover:bg-destructive/20 hover:text-destructive cursor-pointer transition-colors",title:"Stop agent",children:"x"})]},b.agentId))]}),a?l.jsxs("div",{className:"px-3 pb-2 space-y-2",children:[l.jsx(V3,{agentId:a,status:(x=i.find(b=>b.agentId===a))==null?void 0:x.status}),l.jsx(X3,{agentId:a,relays:s})]}):l.jsxs(l.Fragment,{children:[(r==null?void 0:r.featureCode)&&l.jsxs("div",{className:"px-3 py-1.5 mb-1 rounded bg-muted/50",children:[l.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[l.jsx("span",{className:"text-muted-foreground",children:"Working on"}),l.jsx("button",{className:"font-medium text-foreground hover:underline",onClick:()=>r.featureItemId&&(n==null?void 0:n(r.featureItemId)),children:r.featureCode})]}),r.phaseAtBind&&l.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:["Phase: ",r.phaseAtBind.replace(/_/g," ")]})]}),r&&l.jsxs("div",{className:"px-3 pb-1",children:[l.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:r.active?"hsl(var(--primary))":"hsl(var(--success))"}}),l.jsx(Q3,{startedAt:r.startedAt,active:r.active,duration:r.duration}),l.jsxs("span",{className:"tabular-nums",children:[r.toolCount||0," tools"]}),r.errorCount>0&&l.jsxs("span",{style:{color:"hsl(var(--destructive))"},children:[r.errorCount," err"]}),!r.active&&r.journalSpawned&&l.jsx("span",{style:{color:"hsl(var(--primary))"},children:"journal"})]}),((g=r.summaries)==null?void 0:g.length)>0&&l.jsx("p",{className:"text-[10px] mt-0.5 truncate",style:{color:"hsl(var(--muted-foreground))",opacity:.7},title:(y=r.summaries[r.summaries.length-1])==null?void 0:y.summary,children:(k=r.summaries[r.summaries.length-1])==null?void 0:k.summary})]}),l.jsx("div",{className:"px-3 pb-2",children:l.jsxs("div",{className:"rounded-md p-2",style:{background:"hsl(var(--accent))"},children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[l.jsx("div",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:h.status==="working"?"var(--color-category-writing)":"hsl(var(--success))",animation:h.status==="working"?"pulse 1.5s ease-in-out infinite":"none"}}),l.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider",style:{color:h.status==="working"?"var(--color-category-writing)":"hsl(var(--muted-foreground))"},children:h.status==="working"?K3[h.category]||"Working":"Idle"}),h.status==="working"&&h.tool&&l.jsx("span",{className:"text-[10px] tracking-wider",style:{color:"hsl(var(--muted-foreground))"},children:h.tool}),h.status==="working"&&h.currentActivity&&l.jsx("span",{className:"text-[10px] tabular-nums ml-auto",style:{color:"hsl(var(--muted-foreground))",opacity:.6},children:Nh(Date.now()-h.currentActivity.startTime)})]}),h.activityLog&&h.activityLog.length>0&&l.jsx("div",{className:"flex items-center gap-0.5 mt-1",children:h.activityLog.slice(-6).map((b,w,_)=>l.jsx("div",{className:"h-1 rounded-full",title:`${b.tool||"thinking"} — ${Nh(b.duration)}`,style:{width:Math.max(4,Math.min(16,(b.duration||0)/1e3*2)),background:qf[b.category]||(h.status==="working"?"var(--color-category-writing)":"hsl(var(--success))"),opacity:.2+w/_.length*.6}},w))}),t&&t.length>0&&l.jsx("div",{className:"mt-1.5 space-y-0.5",children:t.slice(-4).map((b,w)=>l.jsxs("div",{className:"flex items-center gap-1 text-[10px]",style:{color:b.error?"hsl(var(--destructive))":"hsl(var(--muted-foreground))"},children:[b.error&&l.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:"hsl(var(--destructive))"}}),l.jsx("span",{className:"font-medium shrink-0",children:b.tool}),b.category&&!b.error&&l.jsx("span",{className:"shrink-0 opacity-50",style:{color:qf[b.category]},children:b.category}),b.error?l.jsx("span",{className:"truncate",title:b.error.type,children:qm[b.error.type]||b.error.type}):b.detail?l.jsx("span",{className:"truncate opacity-60",title:b.detail,children:b.detail.split("/").pop()}):null]},w))}),f.length>0&&l.jsxs("div",{className:"mt-1.5",children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider mb-0.5",style:{color:"hsl(var(--muted-foreground))"},children:"Working on"}),f.slice(0,3).map(b=>l.jsxs("div",{className:"flex items-center gap-1 text-[10px] py-0.5",style:{color:"hsl(var(--muted-foreground))"},children:[l.jsx("span",{children:b.status==="in_progress"?"◆":"◇"}),l.jsx("span",{className:"truncate",children:b.title})]},b.id))]}),e&&e.length>0&&l.jsxs("div",{className:"mt-1.5",children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider mb-0.5",style:{color:"hsl(var(--destructive))"},children:"Errors"}),e.slice(-3).map((b,w)=>l.jsxs("div",{className:"flex items-center gap-1 text-[10px] py-0.5",style:{color:"hsl(var(--destructive))"},children:[l.jsx("span",{className:"font-medium shrink-0",children:qm[b.errorType]||b.errorType}),l.jsx("span",{className:"truncate opacity-70",title:b.message,children:b.message})]},w))]}),i&&i.length>0&&l.jsxs("div",{className:"mt-1.5",children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider mb-0.5",style:{color:"hsl(var(--muted-foreground))"},children:"Subagents"}),i.map(b=>l.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] py-0.5",style:{color:"hsl(var(--muted-foreground))"},children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:b.status==="running"?"var(--color-category-executing)":b.status==="complete"?"hsl(var(--success))":"hsl(var(--destructive))",animation:b.status==="running"?"pulse 1.5s ease-in-out infinite":"none"}}),l.jsx("span",{className:"font-medium shrink-0",children:b.agentType}),l.jsx("span",{className:"truncate opacity-60",children:b.status}),l.jsx("span",{className:"tabular-nums ml-auto opacity-50",children:Nh(Date.now()-new Date(b.startedAt).getTime())})]},b.agentId))]})]})})]})]})}const J3=Dt.memo(Z3),jo={DECISION:1,PENDING_GATE:2,BLOCKED:3};function Lb(t,e){const r=new Set((e||[]).filter(s=>s.status==="pending").map(s=>s.itemId)),n=new Map,i=(s,o,a)=>{const c=n.get(s.id);(!c||o>c.priority)&&n.set(s.id,{item:s,priority:o,reason:a})};for(const s of t||[])s.status==="blocked"&&i(s,jo.BLOCKED,"Blocked"),r.has(s.id)&&i(s,jo.PENDING_GATE,"Pending gate"),s.type==="decision"&&s.status!=="complete"&&s.status!=="killed"&&s.status!=="parked"&&i(s,jo.DECISION,"Open decision");return Array.from(n.values()).sort((s,o)=>o.priority-s.priority)}function tM(t){if(!t)return{isRunning:!1,pct:0,stepLabel:"",featureCode:"",stepNum:0,totalSteps:0,status:""};const{currentStepId:e,stepNum:r,totalSteps:n,status:i,featureCode:s}=t,o=i==="running",a=n>0?r/n*100:0,c=Math.min(100,Math.max(0,Math.round(a))),h=e?e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g," "):"";return{isRunning:o,pct:c,stepLabel:h,featureCode:s||"",stepNum:r??0,totalSteps:n??0,status:i||""}}function Bb(t,e){const r=t||[],n=e||[];let i=0,s=0,o=0;for(const c of r)c.status==="in_progress"&&i++,c.status==="blocked"&&s++;const a=n.filter(c=>c.status==="pending"||c.status==="awaiting").length;return o=Lb(r,n).length,{total:r.length,inProgress:i,blocked:s,pendingGates:a,attentionCount:o}}function eM(t,e){return t&&t===e?null:e}const rM={planned:{bg:"bg-slate-500/15",text:"text-slate-400",dot:"bg-slate-400"},ready:{bg:"bg-sky-500/15",text:"text-sky-400",dot:"bg-sky-400"},in_progress:{bg:"bg-blue-500/15",text:"text-blue-400",dot:"bg-blue-400"},review:{bg:"bg-amber-500/15",text:"text-amber-400",dot:"bg-amber-400"},complete:{bg:"bg-emerald-500/15",text:"text-emerald-400",dot:"bg-emerald-400"},blocked:{bg:"bg-rose-500/15",text:"text-rose-400",dot:"bg-rose-400"},parked:{bg:"bg-slate-500/15",text:"text-slate-500",dot:"bg-slate-500"},killed:{bg:"bg-slate-500/15",text:"text-slate-600",dot:"bg-slate-600"},pending:{bg:"bg-amber-500/15",text:"text-amber-400",dot:"bg-amber-400"},resolved:{bg:"bg-emerald-500/15",text:"text-emerald-400",dot:"bg-emerald-400"},active:{bg:"bg-blue-500/15",text:"text-blue-400",dot:"bg-blue-400"},completed:{bg:"bg-emerald-500/15",text:"text-emerald-400",dot:"bg-emerald-400"},failed:{bg:"bg-rose-500/15",text:"text-rose-400",dot:"bg-rose-400"},paused:{bg:"bg-amber-500/15",text:"text-amber-400",dot:"bg-amber-400"}},nM={bg:"bg-slate-500/10",text:"text-slate-400",dot:"bg-slate-400"};function wp({status:t,className:e}){const r=rM[t]||nM,n=t?t.replace(/_/g," "):"—";return l.jsxs("span",{className:nt("inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[10px] font-medium",r.bg,r.text,e),children:[l.jsx("span",{className:nt("w-1 h-1 rounded-full shrink-0",r.dot)}),n]})}const iM={vision:"text-violet-400 bg-violet-500/10 border-violet-500/20",specification:"text-purple-400 bg-purple-500/10 border-purple-500/20",planning:"text-cyan-400 bg-cyan-500/10 border-cyan-500/20",implementation:"text-amber-400 bg-amber-500/10 border-amber-500/20",verification:"text-emerald-400 bg-emerald-500/10 border-emerald-500/20",release:"text-green-400 bg-green-500/10 border-green-500/20"},sM="text-slate-400 bg-slate-500/10 border-slate-500/20";function oM({phase:t,className:e}){const r=iM[t]||sM;return l.jsx("span",{className:nt("inline-flex items-center px-2 py-0.5 rounded-full border text-xs font-mono",r,e),children:t||"—"})}async function kn(t,e={}){const r=await vt(t,e),n=await r.json();if(!r.ok)throw new Error(n.error||`HTTP ${r.status}`);return n}let Eh=null;function Ab(t){if(Eh)return;const e=new WebSocket(z0());Eh=e,e.onmessage=r=>{try{const n=JSON.parse(r.data);n.type==="ideaboxUpdated"&&t(n)}catch{}},e.onclose=()=>{Eh=null,setTimeout(()=>{Ab(t)},3e3)},e.onerror=()=>{}}const hs=yp((t,e)=>(setTimeout(()=>e().hydrate(),0),setTimeout(()=>{Ab(()=>{e().hydrate()})},500),{ideas:[],killed:[],loading:!1,error:null,selectedIdeaId:null,filters:{tag:"",status:"",priority:"",search:""},hydrate:async()=>{t({loading:!0,error:null});try{const r=await kn("/api/ideabox");t({ideas:r.ideas||[],killed:r.killed||[],loading:!1})}catch(r){t({error:r.message,loading:!1})}},addIdea:async r=>{const n=await kn("/api/ideabox/ideas",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});return await e().hydrate(),n},promoteIdea:async(r,n="")=>{const i=await kn(`/api/ideabox/ideas/${r}/promote`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({featureCode:n})});return await e().hydrate(),i},killIdea:async(r,n="")=>{const i=await kn(`/api/ideabox/ideas/${r}/kill`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:n})});return await e().hydrate(),i},setPriority:async(r,n)=>{const i=await kn(`/api/ideabox/ideas/${r}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:n})});return t(s=>({ideas:s.ideas.map(o=>o.id===r?{...o,priority:n}:o)})),i},resurrectIdea:async r=>{const n=await kn(`/api/ideabox/ideas/${encodeURIComponent(r)}/resurrect`,{method:"POST"});return await e().hydrate(),n},addDiscussion:async(r,n,i)=>{const s=await kn(`/api/ideabox/ideas/${encodeURIComponent(r)}/discuss`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({author:n,text:i})});return await e().hydrate(),s},updateIdea:async(r,n)=>{const i=await kn(`/api/ideabox/ideas/${encodeURIComponent(r)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return await e().hydrate(),i},setSelectedIdea:r=>t({selectedIdeaId:r}),updateFilters:r=>t(n=>({filters:{...n.filters,...r}})),clearFilters:()=>t({filters:{tag:"",status:"",priority:"",search:""}})}));function aM({activeBuild:t}){const e=tM(t);if(!t)return null;const r=e.isRunning?"hsl(var(--primary))":e.status==="complete"?"hsl(var(--success))":e.status==="failed"||e.status==="killed"?"hsl(var(--destructive))":"hsl(var(--muted-foreground))";return l.jsxs("div",{className:"mx-3 mb-2 rounded-md p-2",style:{background:"hsl(var(--accent))"},children:[l.jsxs("div",{className:"flex items-center justify-between mb-1",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(Cl,{className:"h-3 w-3 shrink-0",style:{color:r}}),l.jsx("span",{className:"text-[10px] font-medium truncate max-w-[100px]",style:{color:"hsl(var(--foreground))"},children:e.featureCode||"Build"})]}),l.jsxs("span",{className:"text-[10px] tabular-nums",style:{color:"hsl(var(--muted-foreground))"},children:[e.stepNum,"/",e.totalSteps]})]}),l.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:l.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${e.pct}%`,background:r}})}),l.jsxs("div",{className:"flex items-center justify-between mt-1",children:[l.jsx("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:e.stepLabel}),e.isRunning&&l.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:"hsl(var(--primary))",animation:"pulse 1.5s ease-in-out infinite"}})]})]})}function lM({items:t,gates:e,onSelectItem:r}){const n=Dt.useMemo(()=>Lb(t,e),[t,e]),[i,s]=Dt.useState(!1);if(n.length===0)return null;const o=i?n:n.slice(0,5),a=n.length-5,c=h=>h===jo.BLOCKED?l.jsx(vc,{className:"h-3 w-3 shrink-0",style:{color:"hsl(var(--destructive))"}}):h===jo.PENDING_GATE?l.jsx(Q_,{className:"h-3 w-3 shrink-0",style:{color:"hsl(var(--warning))"}}):l.jsx(zT,{className:"h-3 w-3 shrink-0",style:{color:"hsl(var(--muted-foreground))"}});return l.jsxs("div",{className:"px-2 mb-2",children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider px-2 mb-1",style:{color:"hsl(var(--muted-foreground))"},children:"Needs Attention"}),o.map(({item:h,priority:u,reason:d})=>l.jsxs("button",{onClick:()=>r==null?void 0:r(h.id),className:"flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-xs transition-colors hover:bg-sidebar-accent/50",style:{color:"hsl(var(--muted-foreground))"},title:d,children:[c(u),l.jsx("span",{className:"truncate flex-1 text-left",children:h.title}),h.phase&&l.jsx(oM,{phase:h.phase,className:"shrink-0 text-[9px] px-1.5 py-0 h-4"}),l.jsx(wp,{status:h.status,className:"shrink-0"})]},h.id)),a>0&&l.jsx("button",{onClick:()=>s(h=>!h),className:"flex w-full items-center px-2 py-0.5 text-[10px] rounded-md hover:bg-sidebar-accent/50 transition-colors",style:{color:"hsl(var(--muted-foreground))"},children:i?"Show less":`+${a} more`})]})}function cM({items:t,gates:e}){const r=Dt.useMemo(()=>Bb(t,e),[t,e]);return r.total===0?null:l.jsxs("div",{className:"flex items-center gap-2 flex-wrap px-3 pb-1",children:[l.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.total," items"]}),r.inProgress>0&&l.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--primary))"},children:[r.inProgress," active"]}),r.blocked>0&&l.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--destructive))"},children:[r.blocked," blocked"]}),r.pendingGates>0&&l.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--warning))"},children:[r.pendingGates," ",r.pendingGates===1?"gate":"gates"]})]})}const hM=new Set(["planned","ready","in_progress","review","blocked","parked"]);function uM({items:t,hiddenGroups:e,onToggleGroup:r}){const n=Dt.useMemo(()=>{const i={},s={};for(const o of t){const a=o.title||"";if(a.startsWith("`docs/")||a.startsWith("docs/")||!hM.has(o.status))continue;const c=o.group||"other";i[c]=(i[c]||0)+1,["in_progress","review","ready"].includes(o.status)&&(s[c]=(s[c]||0)+1)}return Object.entries(i).sort((o,a)=>(s[a[0]]||0)-(s[o[0]]||0)||a[1]-o[1]||o[0].localeCompare(a[0])).map(([o,a])=>({group:o,count:a,active:s[o]||0}))},[t]);return n.length<=1?null:l.jsx(l.Fragment,{children:n.map(({group:i,count:s,active:o})=>{const a=e==null?void 0:e.has(i);return l.jsxs("button",{onClick:()=>r==null?void 0:r(i),className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm transition-colors hover:bg-sidebar-accent/50",style:{color:"hsl(var(--muted-foreground))",opacity:a?.4:1,fontWeight:o>0?500:400},children:[l.jsx("span",{className:"truncate flex-1 text-left",children:i}),o>0&&l.jsx("span",{className:"text-[10px] tabular-nums",style:{color:"hsl(var(--primary))"},children:o}),l.jsx("span",{className:"text-[10px] tabular-nums shrink-0",style:{color:"hsl(var(--muted-foreground))"},children:s})]},i)})})}function dM({onViewChange:t}){const e=hs(n=>n.ideas),r=Dt.useMemo(()=>e.filter(n=>!n.priority||n.priority==="—").length,[e]);return r===0?null:l.jsxs("div",{className:"px-2 mb-2",children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider px-2 mb-1",style:{color:"hsl(var(--muted-foreground))"},children:"Ideas"}),l.jsxs("button",{onClick:()=>t==null?void 0:t("ideabox"),className:"flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-xs transition-colors hover:bg-sidebar-accent/50",style:{color:"hsl(var(--muted-foreground))"},title:"View untriaged ideas",children:[l.jsx(si,{className:"h-3 w-3 shrink-0 text-amber-400"}),l.jsxs("span",{className:"flex-1 text-left",children:[r," untriaged"]})]})]})}function Mb({items:t,gates:e,activeBuild:r,onViewChange:n,selectedPhase:i,onPhaseSelect:s,selectedTrack:o,onTrackSelect:a,visibleTracks:c,onToggleVisibleTrack:h,onShowAllTracks:u,hiddenGroups:d,onToggleGroup:f,searchQuery:p,onSearchChange:m,connected:x,agentActivity:g,agentErrors:y,spawnedAgents:k,agentRelays:b,sessionState:w,onSelectItem:_,onStopAgent:T,onThemeChange:S,onNewItem:L,widthPx:B}){const N=t||[],A=e||[],R=Dt.useMemo(()=>Bb(N,A),[N,A]),[z,P]=Dt.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark"));Dt.useEffect(()=>{if(typeof document>"u")return;const F=new MutationObserver(()=>{P(document.documentElement.classList.contains("dark"))});return F.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>F.disconnect()},[]);const I=Dt.useCallback(()=>{const F=!z,$=F?"dark":"light";typeof document<"u"&&document.documentElement.classList.toggle("dark",F);try{localStorage.setItem("compose:theme",$)}catch{}S&&S({ui:{theme:$}})},[z,S]);return Dt.useCallback(F=>{s&&s(eM(i,F))},[s,i]),l.jsxs("aside",{className:"shrink-0 flex flex-col bg-sidebar border-r border-sidebar-border",style:{width:B??208},children:[l.jsxs("div",{className:"p-3 pb-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h2",{className:"text-sm font-semibold text-sidebar-foreground",children:"Compose"}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[!x&&l.jsx("span",{className:"text-[10px] text-destructive",children:"disconnected"}),L&&l.jsxs("button",{onClick:L,className:"flex items-center gap-1 px-1.5 py-0.5 rounded-md text-xs text-muted-foreground hover:text-foreground bg-sidebar-accent/50 hover:bg-sidebar-accent transition-colors",title:"New item (⌘N)",children:[l.jsx(yl,{className:"h-3.5 w-3.5"}),l.jsx("span",{children:"New"})]}),l.jsx("button",{onClick:I,className:"p-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-sidebar-accent transition-colors",title:z?"Switch to light mode":"Switch to dark mode",children:z?l.jsx(ij,{className:"h-3.5 w-3.5"}):l.jsx(F_,{className:"h-3.5 w-3.5"})})]})]}),l.jsx(cM,{items:N,gates:A})]}),l.jsx(aM,{activeBuild:r}),l.jsx(J3,{agentActivity:g,agentErrors:y,sessionState:w,onSelectItem:_,onStopAgent:T,spawnedAgents:k,agentRelays:b}),R.attentionCount>0&&l.jsxs(l.Fragment,{children:[l.jsx(El,{className:"bg-sidebar-border"}),l.jsx(lM,{items:N,gates:A,onSelectItem:_,onViewChange:n})]}),l.jsx(dM,{onViewChange:n}),l.jsx("div",{className:"px-3 pb-2",children:l.jsxs("div",{className:"relative",children:[l.jsx(fn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),l.jsx(qd,{placeholder:"Search...",value:p,onChange:F=>m(F.target.value),className:"h-7 pl-7 text-xs bg-sidebar"})]})}),l.jsx(El,{className:"bg-sidebar-border"}),l.jsx(An,{className:"flex-1",children:l.jsxs("div",{className:"p-2",children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider px-2 mb-1",style:{color:"hsl(var(--muted-foreground))"},children:"Groups"}),l.jsx(uM,{items:N,hiddenGroups:d,onToggleGroup:f})]})})]})}function pM({level:t,size:e=4}){return l.jsx("div",{className:"flex items-center gap-px",children:[0,1,2,3].map(r=>l.jsx("div",{className:"rounded-full",style:{width:e,height:e,background:r<t?t>=3?"hsl(var(--success))":t>=2?"hsl(var(--accent))":"hsl(var(--destructive))":"transparent",border:`1px solid ${r<t?t>=3?"hsl(var(--success))":t>=2?"hsl(var(--accent))":"hsl(var(--destructive))":"hsl(var(--border))"}`}},r))})}function oa({featureCode:t,active:e,onToggle:r}){return t?l.jsxs("button",{onClick:r,style:{fontSize:11,padding:"3px 9px",borderRadius:4,cursor:"pointer",transition:"all 0.15s",border:`1px solid ${e?"#f59e0b":"#334155"}`,background:e?"#f59e0b20":"#1e293b",color:e?"#f59e0b":"#94a3b8"},children:["Focus: ",t]}):null}function aa({icon:t=C_,title:e,description:r,action:n,onAction:i,className:s}){return l.jsxs("div",{className:nt("flex flex-col items-center justify-center gap-3 p-8 text-center",s),children:[l.jsx("div",{className:"flex items-center justify-center w-12 h-12 rounded-full bg-muted/50",children:l.jsx(t,{className:"w-6 h-6 text-muted-foreground/60"})}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("h3",{className:"text-sm font-medium text-foreground",children:e}),r&&l.jsx("p",{className:"text-xs text-muted-foreground",children:r})]}),n&&l.jsx(At,{variant:"outline",size:"sm",onClick:i,children:n})]})}const Wm=[{key:"all",label:"All",statuses:null},{key:"active",label:"Active",statuses:["planned","ready","in_progress","review"]},{key:"done",label:"Done",statuses:["complete"]},{key:"blocked",label:"Blocked",statuses:["blocked","parked"]}],fM=[{key:"all",label:"All"},{key:"feature",label:"Feature"},{key:"task",label:"Task"},{key:"track",label:"Track"}];function Hm({active:t,onClick:e,children:r}){return l.jsx("button",{onClick:e,style:{fontSize:11,padding:"2px 7px",borderRadius:4,cursor:"pointer",transition:"all 0.15s",border:`1px solid ${t?"#3b82f6":"#334155"}`,background:t?"#3b82f6":"#1e293b",color:t?"#fff":"#94a3b8"},children:r})}function Ib({item:t,children:e,depth:r,selectedItemId:n,onSelect:i,onToggle:s,expandedIds:o}){const a=e.length>0,c=o.has(t.id),h=n===t.id,u=hr[t.type]||hr.task,d=Bn[t.status]||Bn.planned,{newIds:f,changedIds:p}=C.useContext(Nc),m=f.has(t.id),x=p.has(t.id);return l.jsxs("div",{children:[l.jsxs("div",{"data-item-id":t.id,onClick:()=>i(t.id),className:nt("flex items-center gap-1.5 py-1 px-2 cursor-pointer transition-colors rounded-md","hover:bg-accent/5",h&&"bg-accent/10",m&&"bg-green-500/5 border-l-2 border-l-green-500",x&&!m&&"bg-amber-500/5 border-l-2 border-l-amber-500"),style:{paddingLeft:`${r*20+8}px`},children:[l.jsx("button",{onClick:g=>{g.stopPropagation(),a&&s(t.id)},className:nt("shrink-0 w-4 h-4 flex items-center justify-center rounded",a?"text-muted-foreground hover:text-foreground":"invisible"),children:a&&(c?l.jsx(ks,{className:"h-3.5 w-3.5"}):l.jsx(ii,{className:"h-3.5 w-3.5"}))}),l.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:d}}),l.jsx("span",{className:"text-[9px] uppercase tracking-wider shrink-0 w-12",style:{color:u},children:t.type}),l.jsx("span",{className:nt("text-sm text-foreground truncate flex-1",t.status==="killed"&&"line-through opacity-50"),children:t.title}),l.jsx(pM,{level:t.confidence||0}),t.phase&&l.jsx(cr,{variant:"outline",className:"text-[9px] px-1 py-0 h-3.5 shrink-0",children:t.phase})]}),a&&c&&l.jsx("div",{children:e.map(g=>l.jsx(Ib,{item:g,children:g._children||[],depth:r+1,selectedItemId:n,onSelect:i,onToggle:s,expandedIds:o},g.id))})]})}function Fb({items:t,connections:e,selectedItemId:r,onSelect:n,onCreate:i,onCreateFeature:s,isEmptyProject:o,featureCode:a,focusActive:c,onToggleFocus:h}){const[u,d]=C.useState(()=>new Set),[f,p]=C.useState(""),[m,x]=C.useState("all"),[g,y]=C.useState("all"),k=C.useCallback(S=>{d(L=>{const B=new Set(L);return B.has(S)?B.delete(S):B.add(S),B})},[]),b=C.useMemo(()=>{let S=t;const L=Wm.find(B=>B.key===m);if(L!=null&&L.statuses&&(S=S.filter(B=>L.statuses.includes(B.status||"planned"))),g!=="all"&&(S=S.filter(B=>B.type===g)),f){const B=f.toLowerCase();S=S.filter(N=>(N.title||"").toLowerCase().includes(B)||(N.description||"").toLowerCase().includes(B)||(N.type||"").toLowerCase().includes(B)||(N.phase||"").toLowerCase().includes(B))}return c&&a&&(S=S.filter(B=>{var N;return B.featureCode===a||((N=B.lifecycle)==null?void 0:N.featureCode)===a||(B.title||"").includes(a)})),S},[t,f,m,g,c,a]),w=C.useMemo(()=>{const S=new Set(b.map(R=>R.id)),L=new Map;for(const R of b)L.set(R.id,{...R,_children:[]});const B=new Map;for(const R of e)!S.has(R.fromId)||!S.has(R.toId)||(R.type==="informs"?B.has(R.toId)||B.set(R.toId,R.fromId):(R.type==="supports"||R.type==="blocks")&&(B.has(R.fromId)||B.set(R.fromId,R.toId)));for(const R of t)R.parentId&&L.has(R.parentId)&&B.set(R.id,R.parentId);for(const[R]of B){const z=new Set;let P=R;for(;P&&B.has(P);){if(z.has(P)){B.delete(P);break}z.add(P),P=B.get(P)}}const N=[];for(const R of L.values()){const z=B.get(R.id);z&&L.has(z)?L.get(z)._children.push(R):N.push(R)}const A=R=>{R.sort((z,P)=>(z.confidence||0)-(P.confidence||0));for(const z of R)z._children.length>0&&A(z._children)};return A(N),N},[b,e]);Dt.useEffect(()=>{if(f){const S=new Set,L=B=>{for(const N of B)N._children.length>0&&(S.add(N.id),L(N._children))};L(w),d(S)}else u.size===0&&w.length>0&&d(new Set(w.map(S=>S.id)))},[w,f]),Dt.useEffect(()=>{if(!r||w.length===0)return;const S=[],L=(B,N)=>{for(const A of B){if(A.id===N)return!0;if(A._children.length>0&&L(A._children,N))return S.push(A.id),!0}return!1};L(w,r),S.length>0&&d(B=>{const N=new Set(B);for(const A of S)N.add(A);return N}),requestAnimationFrame(()=>{const B=document.querySelector(`[data-item-id="${r}"]`);B&&B.scrollIntoView({block:"center",behavior:"smooth"})})},[r,w]);const _=C.useCallback(()=>{const S=new Set,L=B=>{for(const N of B)N._children.length>0&&(S.add(N.id),L(N._children))};L(w),d(S)},[w]),T=C.useCallback(()=>{d(new Set)},[]);return w.filter(S=>S._children.length>0).length,l.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border",children:[l.jsx(oa,{featureCode:a,active:c,onToggle:h}),l.jsxs("div",{className:"relative flex-1 max-w-[180px]",children:[l.jsx(fn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),l.jsx(qd,{placeholder:"Search items...",value:f,onChange:S=>p(S.target.value),className:"h-7 pl-7 pr-7 text-xs"}),f&&l.jsx("button",{onClick:()=>p(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:l.jsx(Kr,{className:"h-3 w-3"})})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-[10px] text-muted-foreground mr-0.5",children:"Status:"}),Wm.map(S=>l.jsx(Hm,{active:m===S.key,onClick:()=>x(S.key),children:S.label},S.key))]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-[10px] text-muted-foreground mr-0.5",children:"Type:"}),fM.map(S=>l.jsx(Hm,{active:g===S.key,onClick:()=>y(S.key),children:S.label},S.key))]}),l.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[b.length,f||m!=="all"||g!=="all"?`/${t.length}`:""]}),l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:_,className:"text-[10px] px-1.5 py-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent/10 transition-colors",children:"Expand"}),l.jsx("button",{onClick:T,className:"text-[10px] px-1.5 py-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent/10 transition-colors",children:"Collapse"}),i&&l.jsx("button",{onClick:i,title:"Create item",style:{width:24,height:24,borderRadius:4,border:"1px solid #334155",background:"#1e293b",color:"#94a3b8",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.15s"},className:"hover:border-blue-500 hover:text-white",children:l.jsx(yl,{className:"h-3.5 w-3.5"})})]}),l.jsx(An,{className:"flex-1",children:l.jsx("div",{className:"py-1",children:w.length===0?o?l.jsx(aa,{icon:yl,title:"No items yet",description:"Create your first feature to start building in the cockpit.",action:s?"Create your first feature":void 0,onAction:s,className:"py-8"}):l.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No items match the current filters"}):w.map(S=>l.jsx(Ib,{item:S,children:S._children,depth:0,selectedItemId:r,onSelect:n,onToggle:k,expandedIds:u},S.id))})})]})}try{ra.use(H0)}catch{}try{ra.use(MT)}catch{}const Ll={planned:"#64748b",ready:"#3b82f6",in_progress:"#fbbf24",review:"#f59e0b",complete:"#22c55e",blocked:"#ef4444",parked:"#6b7280",killed:"#475569"},mM=Object.fromEntries(Object.entries(hr).map(([t,e])=>{const r=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),i=parseInt(e.slice(5,7),16),s=[15,23,42],o=.15,a=[Math.round(s[0]*(1-o)+r*o),Math.round(s[1]*(1-o)+n*o),Math.round(s[2]*(1-o)+i*o)];return[t,`#${a.map(c=>c.toString(16).padStart(2,"0")).join("")}`]})),gM=[1,1.5,2,2.5,3],Lu={informs:{color:"#64748b",style:"solid"},supports:{color:"#22c55e",style:"solid"},blocks:{color:"#ef4444",style:"solid"},contradicts:{color:"#f472b6",style:"dashed"},implements:{color:"#a78bfa",style:"solid"}},Um=[{key:"all",label:"All",statuses:null},{key:"active",label:"Active",statuses:["planned","ready","in_progress","review"]},{key:"complete",label:"Done",statuses:["complete"]},{key:"blocked",label:"Blocked",statuses:["blocked","parked"]}];function fo(t){return t.group||"other"}const Vm=/^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)*[a-z]?$/,Lh=24;function xM(t){if(!t||t.length<=Lh)return t;const e=t.split("-");let r="";for(const n of e){const i=r?r+"-"+n:n;if(i.length>Lh-1)break;r=i}return(r||t.slice(0,Lh-1))+"…"}function yM(t){var i;const e=((i=t.lifecycle)==null?void 0:i.featureCode)||t.featureCode;if(e&&Vm.test(e))return e;if(t.id&&Vm.test(t.id)&&t.id.length<=32)return t.id;const n=(t.title||"").replace(/`/g,"").trim().match(/^([A-Z][A-Z0-9]*(?:-[A-Z0-9]+)*[a-z]?)\b/);return n&&n[1].length>=3?n[1]:t.slug?xM(t.slug):t.id?t.id.slice(0,12):"item"}function Ym(t,e=18){const r=t.split("-"),n=[];let i="";for(const s of r){const o=i?i+"-"+s:s;o.length>e&&i?(n.push(i),i=s):i=o}return i&&n.push(i),n.join(`
339
- `)}function bM(t,e,r,n,i){var h;const s=[],o=new Set(t.map(u=>u.id));let a=null;if(n&&i){a=new Set(t.filter(u=>{var d;return u.featureCode===i||((d=u.lifecycle)==null?void 0:d.featureCode)===i||(u.title||"").startsWith(i)}).map(u=>u.id));for(const u of e)a.has(u.fromId)&&o.has(u.toId)&&a.add(u.toId),a.has(u.toId)&&o.has(u.fromId)&&a.add(u.fromId)}const c=new Set;if(r){const d=[...new Set(t.map(f=>fo(f)).filter(Boolean))].map(f=>{const p=t.filter(y=>fo(y)===f),m=p.filter(y=>["blocked","parked"].includes(y.status)).length,x=p.filter(y=>["in_progress","review","ready"].includes(y.status)).length,g=p.filter(y=>y.status==="planned").length;return{group:f,blocked:m,active:x,planned:g,total:p.length}});d.sort((f,p)=>p.active-f.active||p.blocked-f.blocked||p.planned-f.planned||f.group.localeCompare(p.group));for(const{group:f,active:p,total:m}of d){if(m<2)continue;c.add(f);const x=a&&t.some(g=>fo(g)===f&&a.has(g.id));s.push({data:{id:`group-${f}`,label:`${Ym(f)}
340
- (${p} active, ${m} total)`,isGroup:!0,groupType:f},...a&&!x?{classes:"focus-dimmed"}:{}})}}for(const u of t){const d=u.slug||u.id.slice(0,8),f=Ym(yM(u),14),p=fo(u),m=a&&!a.has(u.id);s.push({data:{id:u.id,label:f,itemType:u.type||"task",status:u.status||"planned",phase:u.phase||"vision",confidence:u.confidence??0,title:u.title,description:u.description,slug:d,featureCode:((h=u.lifecycle)==null?void 0:h.featureCode)||u.featureCode||null,group:p||null,...r&&p&&c.has(p)?{parent:`group-${p}`}:{}},...m?{classes:"focus-dimmed"}:{}})}for(const u of e){if(!o.has(u.fromId)||!o.has(u.toId))continue;let d,f;u.type==="supports"||u.type==="blocks"?(d=u.toId,f=u.fromId):(d=u.fromId,f=u.toId);const p=Lu[u.type]||Lu.informs;s.push({data:{id:u.id||`${u.fromId}-${u.toId}`,source:d,target:f,edgeType:u.type,edgeColor:p.color,edgeStyle:p.style}})}return s}function CM(){return[{selector:"[?isGroup]",style:{label:"data(label)","text-valign":"top","text-halign":"center","font-size":"10px","font-weight":600,color:"#64748b","text-transform":"uppercase","letter-spacing":"0.08em","text-wrap":"wrap","text-max-width":"160px","background-color":"#1a2537","border-width":1,"border-color":"#283548","border-style":"solid",padding:"24px","text-margin-y":-4}},{selector:"node[status]",style:{label:"data(label)","text-valign":"center","text-halign":"center","font-size":"9px","font-family":'-apple-system, BlinkMacSystemFont, "Segoe UI", monospace',"font-weight":500,color:"#e2e8f0","text-wrap":"wrap","text-max-width":"130px",width:"150px",height:"60px",shape:"round-rectangle","background-color":"#1e293b","border-style":"solid","border-width":2,"border-color":"#3b82f6"}},...Object.entries(Ll).map(([t,e])=>({selector:`node[status="${t}"]`,style:{"border-color":e,...t==="parked"||t==="killed"?{opacity:.7}:{}}})),...Object.entries(mM).map(([t,e])=>({selector:`node[itemType="${t}"]`,style:{"background-color":e}})),...gM.map((t,e)=>({selector:`node[confidence=${e}]`,style:{"border-width":t}})),{selector:"node:selected",style:{"background-color":"#1e3a5f","border-width":3,"border-color":"#60a5fa"}},{selector:"edge",style:{width:1.5,"line-color":"data(edgeColor)","target-arrow-color":"data(edgeColor)","target-arrow-shape":"triangle","arrow-scale":.8,"curve-style":"bezier",opacity:.6}},{selector:'edge[edgeStyle="dashed"]',style:{"line-style":"dashed","line-dash-pattern":[6,3],"target-arrow-shape":"diamond"}},{selector:'edge[edgeType="blocks"]',style:{"target-arrow-shape":"tee"}},{selector:".dimmed",style:{opacity:.35}},{selector:".focus-dimmed",style:{opacity:.15,events:"no"}},{selector:".highlighted",style:{"border-width":3,"border-color":"#60a5fa"}},{selector:".build-building",style:{"border-color":"#3b82f6","border-width":3,"shadow-color":"#3b82f6","shadow-opacity":.6,"shadow-blur":12}},{selector:".build-gate-pending",style:{"border-color":"#f59e0b","border-width":3,"shadow-color":"#f59e0b","shadow-opacity":.5,"shadow-blur":8}},{selector:".build-blocked-downstream",style:{opacity:.35,"border-color":"#94a3b8"}},{selector:".build-error",style:{"border-color":"#ef4444","border-width":3,"shadow-color":"#ef4444","shadow-opacity":.5,"shadow-blur":8}},{selector:"[?isAgentGroup]",style:{label:"data(label)","text-valign":"top","text-halign":"center","font-size":"9px",color:"#64748b","text-transform":"uppercase","background-color":"#0f1a2b","border-width":1,"border-color":"#1e3050","border-style":"dashed",padding:"14px"}},{selector:"[?isAgentNode]",style:{label:"data(label)","text-valign":"center","text-halign":"center","font-size":"8px","font-family":"monospace",color:"#e2e8f0","text-wrap":"wrap","text-max-width":"70px",width:"80px",height:"40px",shape:"diamond","background-color":"#1e293b","border-style":"solid","border-width":2,"border-color":"data(agentColor)"}},{selector:'[agentStatus="complete"]',style:{"border-style":"dashed",opacity:.6}},{selector:'[agentStatus="failed"]',style:{"border-color":"#ef4444","border-style":"dashed",opacity:.6}},{selector:"[?isRelayEdge]",style:{width:1,"line-color":"#475569","line-style":"dashed","line-dash-pattern":[8,4],"target-arrow-color":"#475569","target-arrow-shape":"triangle","arrow-scale":.6,"curve-style":"bezier",opacity:.4}},{selector:".relay-active",style:{width:2,"line-color":"#3b82f6",opacity:.8,"target-arrow-color":"#3b82f6"}},{selector:".relay-result",style:{width:2,"line-color":"#10b981",opacity:.8,"target-arrow-color":"#10b981"}},{selector:".idea-node",style:{label:"data(label)","text-valign":"center","text-halign":"center","font-size":"8px","font-family":"monospace",color:"#fbbf24","text-wrap":"wrap","text-max-width":"70px",width:"70px",height:"70px",shape:"ellipse","background-color":"#451a0310","border-style":"dashed","border-width":1.5,"border-color":"#f59e0b",opacity:.85}},{selector:'edge[edgeType="idea"]',style:{width:1,"line-color":"#f59e0b","line-style":"dashed","line-dash-pattern":[6,3],"target-arrow-color":"#f59e0b","target-arrow-shape":"triangle","arrow-scale":.7,"curve-style":"bezier",opacity:.5}}]}function kM({data:t}){if(!t)return null;const{x:e,y:r,item:n}=t,i=Ll[n.status]||Ll.planned,s=hr[n.itemType]||"#94a3b8",o=e+300>window.innerWidth?e-294:e+14,a=Math.min(r-10,window.innerHeight-200);return l.jsxs("div",{style:{position:"fixed",left:o,top:a,zIndex:9999,pointerEvents:"none",maxWidth:280,background:"#1e293b",border:"1px solid #475569",borderRadius:8,padding:"10px 13px",fontSize:12,boxShadow:"0 8px 24px rgba(0,0,0,0.5)"},children:[l.jsx("div",{style:{fontWeight:700,fontSize:13,color:"#f8fafc",marginBottom:3},children:n.slug}),l.jsx("div",{style:{color:"#94a3b8",marginBottom:6,lineHeight:1.4},children:n.title}),l.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap"},children:[l.jsx(Bh,{color:i,children:(n.status||"planned").replace("_"," ")}),l.jsx(Bh,{color:s,children:n.itemType}),n.phase&&l.jsx(Bh,{color:"#94a3b8",children:kl[n.phase]||n.phase})]}),n.description&&l.jsx("div",{style:{marginTop:8,color:"#94a3b8",fontSize:11,lineHeight:1.4},children:n.description.length>140?n.description.slice(0,140)+"…":n.description}),l.jsxs("div",{style:{marginTop:6,color:"#64748b",fontSize:10},children:[Qd[n.confidence||0]," confidence"]})]})}function vM({data:t,onApply:e,onClose:r}){const{x:n,y:i,currentGroup:s}=t,[o,a]=C.useState(s||""),c=C.useRef(null);C.useEffect(()=>{var f,p;(f=c.current)==null||f.focus(),(p=c.current)==null||p.select()},[]),C.useEffect(()=>{const f=p=>{p.key==="Escape"&&r()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[r]),C.useEffect(()=>{const f=m=>{const x=document.getElementById("group-change-popover-root");x&&!x.contains(m.target)&&r()},p=setTimeout(()=>window.addEventListener("mousedown",f),0);return()=>{clearTimeout(p),window.removeEventListener("mousedown",f)}},[r]);const h=n+240>window.innerWidth?n-234:n+14,u=Math.min(i-10,window.innerHeight-120),d=()=>e(o.trim());return l.jsxs("div",{id:"group-change-popover-root","data-testid":"group-change-popover",style:{position:"fixed",left:h,top:u,zIndex:1e4,width:220,background:"#1e293b",border:"1px solid #475569",borderRadius:8,padding:"10px 12px",boxShadow:"0 8px 24px rgba(0,0,0,0.5)"},children:[l.jsx("div",{style:{fontSize:11,color:"#94a3b8",marginBottom:6,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em"},children:"Change group"}),l.jsx("input",{ref:c,type:"text",value:o,onChange:f=>a(f.target.value),onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),d())},placeholder:"(no group)",style:{width:"100%",boxSizing:"border-box",fontSize:12,padding:"5px 7px",background:"#0f172a",color:"#f8fafc",border:"1px solid #334155",borderRadius:4,outline:"none"}}),l.jsxs("div",{style:{display:"flex",gap:6,marginTop:8,justifyContent:"flex-end"},children:[l.jsx("button",{onClick:r,style:{fontSize:11,padding:"3px 9px",borderRadius:4,cursor:"pointer",background:"transparent",color:"#94a3b8",border:"1px solid #334155"},children:"Cancel"}),l.jsx("button",{onClick:d,"data-testid":"group-change-apply",style:{fontSize:11,padding:"3px 9px",borderRadius:4,cursor:"pointer",background:"#2563eb",color:"#f8fafc",border:"1px solid #2563eb"},children:"Apply"})]})]})}function Bh({color:t,children:e}){return l.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:3,fontWeight:600,background:`${t}20`,color:t,border:`1px solid ${t}40`,textTransform:"uppercase",letterSpacing:"0.03em"},children:e})}const Pb={fontSize:11,padding:"3px 9px",borderRadius:4,cursor:"pointer",transition:"all 0.15s"};function Ys({active:t,onClick:e,children:r}){return l.jsx("button",{onClick:e,style:{...Pb,border:`1px solid ${t?"#3b82f6":"#334155"}`,background:t?"#3b82f6":"#1e293b",color:t?"#fff":"#94a3b8"},children:r})}function Gs({onClick:t,children:e,title:r}){return l.jsx("button",{onClick:t,title:r,style:{...Pb,border:"1px solid #334155",background:"#1e293b",color:"#94a3b8"},children:e})}function Xs(){return l.jsx("div",{style:{width:1,height:20,background:"#334155",margin:"0 2px"}})}const wM=["build-building","build-gate-pending","build-blocked-downstream","build-error"],SM={building:{bg:"#3b82f620",border:"#3b82f6",color:"#3b82f6",label:"⚙"},gate_pending:{bg:"#f59e0b20",border:"#f59e0b",color:"#f59e0b",label:"⚠"},error:{bg:"#ef444420",border:"#ef4444",color:"#ef4444",label:"✖"}};function TM({badge:t,onClick:e}){const r=SM[t.state];return r?l.jsx("div",{onClick:e,style:{position:"absolute",left:t.x,top:t.y,width:16,height:16,borderRadius:"50%",background:r.bg,border:`1.5px solid ${r.border}`,color:r.color,fontSize:9,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",cursor:e?"pointer":"default",zIndex:100,pointerEvents:e?"auto":"none"},title:t.state.replace(/_/g," "),children:r.label}):null}function _M({featureCode:t,gates:e,items:r,badgePositions:n,onResolve:i,onClose:s}){const o=n.find(u=>u.featureCode===t);if(!o)return null;const a=r.find(u=>{var d;return((d=u.lifecycle)==null?void 0:d.featureCode)===t||u.featureCode===t||u.title===t}),c=a&&(e==null?void 0:e.find(u=>u.itemId===a.id&&!u.resolvedAt));if(!c)return null;const h=c.stepId?c.stepId.replace(/_/g," ").replace(/\b\w/g,u=>u.toUpperCase()):"Gate";return l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{position:"fixed",inset:0,zIndex:199},onClick:s}),l.jsxs("div",{style:{position:"absolute",left:o.x-80,top:o.y+22,zIndex:200,width:200,background:"#1e293b",border:"1px solid #475569",borderRadius:8,padding:"10px 12px",boxShadow:"0 8px 24px rgba(0,0,0,0.5)"},children:[l.jsx("div",{style:{fontSize:10,color:"#94a3b8",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:4},children:h}),l.jsx("div",{style:{fontSize:12,color:"#f8fafc",fontWeight:600,marginBottom:8},children:t}),l.jsxs("div",{style:{display:"flex",gap:4},children:[l.jsx("button",{onClick:()=>i(c.id,"approve"),style:{flex:1,padding:"4px 0",fontSize:10,fontWeight:600,borderRadius:4,background:"#22c55e20",color:"#22c55e",border:"1px solid #22c55e40",cursor:"pointer"},children:"Approve"}),l.jsx("button",{onClick:()=>i(c.id,"revise"),style:{flex:1,padding:"4px 0",fontSize:10,fontWeight:600,borderRadius:4,background:"#f59e0b20",color:"#f59e0b",border:"1px solid #f59e0b40",cursor:"pointer"},children:"Revise"}),l.jsx("button",{onClick:()=>i(c.id,"kill"),style:{flex:1,padding:"4px 0",fontSize:10,fontWeight:600,borderRadius:4,background:"#ef444420",color:"#ef4444",border:"1px solid #ef444440",cursor:"pointer"},children:"Kill"})]})]})]})}function $b({items:t,connections:e,selectedItemId:r,onSelect:n,onCreateFeature:i,isEmptyProject:s,visibleTracks:o,hiddenGroups:a,buildStateMap:c,resolveGate:h,gates:u,spawnedAgents:d,agentRelays:f,agentOverlay:p,featureCode:m,focusActive:x,onToggleFocus:g}){const y=C.useRef(null),k=C.useRef(null),b=C.useRef({}),w=C.useRef(!1),_=C.useRef({}),T=C.useRef(null),[S,L]=C.useState(null),[B,N]=C.useState("active"),[A,R]=C.useState(!0),[z,P]=C.useState(!1),[I,F]=C.useState(null),[$,O]=C.useState(null),[D,j]=C.useState([]),[Y,et]=C.useState(!1),[M,ct]=C.useState(!1),X=hs(W=>W.ideas);C.useEffect(()=>{let W=!1;return vt("/api/graph/layout").then(Z=>Z.ok?Z.json():{positions:{}}).then(Z=>{if(W)return;b.current=Z.positions||{},w.current=!0;const H=k.current;H&&Pt(H)}).catch(()=>{w.current=!0}),()=>{W=!0}},[]);const lt=C.useCallback(()=>{const W=_.current;_.current={},T.current=null,Object.keys(W).length&&vt("/api/graph/layout",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({positions:W})}).catch(Z=>console.warn("[graph-layout] save failed:",Z))},[]),It=C.useCallback(W=>{Object.assign(_.current,W),Object.assign(b.current,W),T.current&&clearTimeout(T.current),T.current=setTimeout(lt,500)},[lt]),Pt=C.useCallback(W=>{const Z=b.current,H={};W.nodes("node[status]").forEach(J=>{const at=J.data();if(at.isAgentNode||at.isIdeaNode)return;const pt=J.id(),_t=Z[pt];if(_t&&Number.isFinite(_t.x)&&Number.isFinite(_t.y))J.position({x:_t.x,y:_t.y});else{const Kt=J.position();Number.isFinite(Kt.x)&&Number.isFinite(Kt.y)&&(H[pt]={x:Kt.x,y:Kt.y})}}),Object.keys(H).length&&It(H)},[It]),Ct=C.useRef(!1);C.useEffect(()=>{const W=d==null?void 0:d.some(Z=>Z.status==="running");W&&!Ct.current?et(!0):!W&&Ct.current&&(d==null?void 0:d.length)>0&&et(!1),Ct.current=!!W},[d]);const G=C.useMemo(()=>t.filter(W=>{const Z=W.title||"";return!Z.startsWith("`docs/")&&!Z.startsWith("docs/")}),[t]),it=C.useMemo(()=>{let W=G;const Z=Um.find(H=>H.key===B);if(Z!=null&&Z.statuses&&(W=W.filter(H=>Z.statuses.includes(H.status||"planned"))),o){const H=J=>{const at=(J.description||"").match(/Track:\s*(\w+)/i);return at?at[1].toLowerCase():J.type||"other"};W=W.filter(J=>o.has(H(J)))}return(a==null?void 0:a.size)>0&&(W=W.filter(H=>!a.has(fo(H)))),W},[G,B,o,a]),kt=C.useMemo(()=>{const W=new Set(it.map(Z=>Z.id));return e.filter(Z=>W.has(Z.fromId)&&W.has(Z.toId))},[e,it]),Tt=C.useMemo(()=>!p||!p.nodes.length?[]:[...p.nodes,...p.edges],[d]),qt=C.useMemo(()=>{if(!M)return[];new Set(it.map(Z=>Z.id));const W=[];for(const Z of X){if(!Z.mapsTo)continue;const H=`idea-${Z.id}`;W.push({data:{id:H,label:`${Z.id}
341
- ${Z.title.slice(0,20)}${Z.title.length>20?"…":""}`,isIdeaNode:!0,status:"idea",ideaId:Z.id},classes:"idea-node"});const J=Z.mapsTo.split(",").map(at=>at.trim()).filter(Boolean);for(const at of J){const pt=it.find(_t=>{var Kt;return((Kt=_t.lifecycle)==null?void 0:Kt.featureCode)===at||_t.featureCode===at||(_t.title||"").startsWith(at)});pt&&W.push({data:{id:`idea-edge-${Z.id}-${pt.id}`,source:H,target:pt.id,edgeType:"idea",edgeColor:"#f59e0b",edgeStyle:"dashed"}})}}return W},[M,X,it]),Qt=C.useMemo(()=>{let Z=bM(it,kt,A,x,m);return Y&&Tt.length>0&&(Z=[...Z,...Tt]),M&&qt.length>0&&(Z=[...Z,...qt]),Z},[it,kt,A,Y,Tt,M,qt,x,m]),Gt=C.useMemo(()=>CM(),[]);C.useEffect(()=>{if(!y.current)return;k.current&&(k.current.destroy(),k.current=null);const W=ra({container:y.current,elements:Qt,style:Gt,layout:{name:"fcose",quality:"proof",animate:!1,fit:!1,padding:20,nodeSeparation:80,idealEdgeLength:120,nodeRepulsion:6e3,gravity:.3,gravityRange:1.5,tilingPaddingVertical:12,tilingPaddingHorizontal:12},minZoom:.1,maxZoom:4,wheelSensitivity:.3,boxSelectionEnabled:!1});if(k.current=W,W.one("layoutstop",()=>{w.current&&Pt(W),W.fit(void 0,30)}),W.fit(void 0,30),W.on("dragfree","node[status]",Z=>{const H=Z.target,J=H.data();if(J.isAgentNode||J.isIdeaNode)return;const at=H.position();!Number.isFinite(at.x)||!Number.isFinite(at.y)||It({[H.id()]:{x:at.x,y:at.y}})}),r){const Z=W.$id(r);Z.length&&Ah(W,Z)}return W.on("mouseover","node[status]",Z=>{const H=Z.renderedPosition||Z.position,J=W.container().getBoundingClientRect();L({x:J.left+H.x,y:J.top+H.y,item:Z.target.data()})}),W.on("mousemove","node[status]",Z=>{const H=Z.renderedPosition||Z.position,J=W.container().getBoundingClientRect();L(at=>at?{x:J.left+H.x,y:J.top+H.y,item:at.item}:null)}),W.on("mouseout","node[status]",()=>L(null)),W.on("tap","node[status]",Z=>{Se.current=!0,Ah(W,Z.target),n(Z.target.id())}),W.on("tap",Z=>{Z.target===W&&W.elements().removeClass("dimmed highlighted")}),W.on("cxttap","node[status]",Z=>{var pt;const H=Z.target.data();if(H.isAgentNode||H.isIdeaNode||H.isGroup)return;try{(pt=Z.originalEvent)==null||pt.preventDefault()}catch{}const J=Z.renderedPosition||Z.position,at=W.container().getBoundingClientRect();O({x:at.left+J.x,y:at.top+J.y,itemId:Z.target.id(),currentGroup:H.group||""}),L(null)}),W.container().addEventListener("contextmenu",Z=>Z.preventDefault()),()=>{T.current&&(clearTimeout(T.current),lt()),W.destroy(),k.current=null}},[Qt,Gt]);const Se=C.useRef(!1);C.useEffect(()=>{const W=k.current;if(!W||!r)return;const Z=W.$id(r);Z.length&&(W.elements().removeClass("dimmed highlighted"),Ah(W,Z),Se.current||W.animate({center:{eles:Z},duration:200}),Se.current=!1)},[r]),C.useEffect(()=>{const W=k.current;if(W&&(W.nodes().removeClass(wM.join(" ")),!(!c||Object.keys(c).length===0)))for(const[Z,H]of Object.entries(c)){const J=`build-${H.replace(/_/g,"-")}`,at=W.nodes().filter(pt=>{const _t=pt.data();return _t.slug===Z||_t.title===Z||_t.featureCode===Z});at.length&&at.addClass(J)}},[c]),C.useEffect(()=>{const W=k.current;if(!W||!c||!Object.values(c).includes("building"))return;let H=!0;const J=setInterval(()=>{const at=W.nodes(".build-building");at.length&&(H=!H,at.style("shadow-blur",H?12:4),at.style("shadow-opacity",H?.6:.2))},800);return()=>clearInterval(J)},[c]),C.useEffect(()=>{var at;const W=k.current;if(!W||(W.edges("[?isRelayEdge]").removeClass("relay-active relay-result"),!Y||!((at=p==null?void 0:p.activeEdgeIds)!=null&&at.size)))return;const Z=new Set((d||[]).map(pt=>pt.agentId)),H=pt=>pt==="session"?"agent-session":Z.has(pt)?`agent-${pt}`:"agent-session";for(const pt of p.activeEdgeIds){const _t=W.getElementById(pt);if(_t.length){const Kt=f==null?void 0:f.findLast(de=>{const ge=H(de.fromAgentId),Me=H(de.toAgentId);return(de.direction==="dispatch"?`relay-${ge}-${Me}`:`relay-${Me}-${ge}`)===pt});_t.addClass((Kt==null?void 0:Kt.direction)==="result"?"relay-result":"relay-active")}}const J=setInterval(()=>{const pt=W.edges(".relay-active, .relay-result");if(!pt.length)return;const _t=Date.now()/20%100;pt.style("line-dash-offset",-_t)},50);return()=>clearInterval(J)},[Y,p==null?void 0:p.activeEdgeIds,f]);const Xt=C.useCallback(()=>{const W=k.current;if(!W||!c||Object.keys(c).length===0){j([]);return}const Z=[];for(const[H,J]of Object.entries(c)){if(J!=="gate_pending"&&J!=="error"&&J!=="building")continue;const at=W.nodes().filter(Kt=>{const de=Kt.data();return de.slug===H||de.title===H||de.featureCode===H});if(!at.length)continue;const pt=at.renderedPosition(),_t=at.renderedOuterWidth();Z.push({featureCode:H,state:J,x:pt.x+_t/2-6,y:pt.y-at.renderedOuterHeight()/2-6,nodeId:at.id()})}j(Z)},[c]);C.useEffect(()=>{const W=k.current;if(W)return W.on("render pan zoom",Xt),Xt(),()=>{W.removeListener("render pan zoom",Xt)}},[Xt]);const Ye=C.useCallback(()=>{var W;return(W=k.current)==null?void 0:W.fit(void 0,40)},[]),le=C.useCallback(()=>{const W=k.current;W&&W.zoom({level:W.zoom()*1.3,renderedPosition:{x:W.width()/2,y:W.height()/2}})},[]),Ae=C.useCallback(()=>{const W=k.current;W&&W.zoom({level:W.zoom()/1.3,renderedPosition:{x:W.width()/2,y:W.height()/2}})},[]),De=C.useCallback(()=>{window.open("/api/export/roadmap-graph","_blank","noopener")},[]),Le=C.useCallback(async()=>{try{const W=await vt("/api/export/roadmap-graph/save",{method:"POST",headers:Mr({"Content-Type":"application/json"})}),Z=await W.json().catch(()=>({}));W.ok&&Z.ok?se(`Saved ${Z.path}`,"info"):se(Z.error||`Export save failed (HTTP ${W.status})`,"error")}catch(W){se(`Export save failed: ${W.message}`,"error")}},[]);return l.jsxs("div",{className:"flex-1 flex flex-col min-h-0",style:{background:"#0f172a"},children:[l.jsx("div",{className:"shrink-0",style:{background:"#1e293b",borderBottom:"1px solid #334155"},children:l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(oa,{featureCode:m,active:x,onToggle:g}),m&&l.jsx(Xs,{}),l.jsx("span",{style:{fontSize:11,color:"#64748b"},children:"Status:"}),Um.map(W=>l.jsx(Ys,{active:B===W.key,onClick:()=>N(W.key),children:W.label},W.key)),l.jsx(Xs,{}),l.jsxs("span",{style:{fontSize:10,color:"#475569"},children:[it.length," items · ",kt.length," edges"]})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(Ys,{active:A,onClick:()=>R(!A),children:"Group"}),l.jsx(Ys,{active:Y,onClick:()=>et(W=>!W),title:"Show/hide agent topology",children:"Agents"}),l.jsx(Ys,{active:M,onClick:()=>ct(W=>!W),title:"Show/hide idea nodes (connected to features via mapsTo)",children:"Ideas"}),l.jsx(Xs,{}),l.jsx(Gs,{onClick:Ae,title:"Zoom out",children:"−"}),l.jsx(Gs,{onClick:Ye,title:"Fit to view",children:"Fit"}),l.jsx(Gs,{onClick:le,title:"Zoom in",children:"+"}),l.jsx(Xs,{}),l.jsx(Gs,{onClick:De,title:"Open roadmap graph HTML export in a new tab",children:"Export"}),l.jsx(Gs,{onClick:Le,title:"Save roadmap graph export to docs/roadmap-graph.html",children:"Save HTML"}),l.jsx(Xs,{}),l.jsx(Ys,{active:z,onClick:()=>P(!z),children:"Legend"})]})]})}),it.length===0&&!Y?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx("div",{style:{textAlign:"center"},children:s?l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{fontSize:12,color:"#64748b",marginBottom:6},children:"No items yet"}),l.jsx("div",{style:{fontSize:11,color:"#475569",marginBottom:10},children:"Create your first feature to start building in the cockpit."}),i&&l.jsx("button",{onClick:i,style:{fontSize:11,color:"#e2e8f0",background:"#1e293b",border:"1px solid #334155",borderRadius:6,padding:"5px 12px",cursor:"pointer"},children:"Create your first feature"})]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{fontSize:12,color:"#64748b",marginBottom:6},children:"No items match the current filters"}),l.jsx("div",{style:{fontSize:11,color:"#475569"},children:"Try adjusting the status or group filters"})]})})}):l.jsxs("div",{className:"flex-1 relative min-h-0",children:[l.jsx("div",{ref:y,className:"w-full h-full"}),z&&l.jsxs("div",{style:{position:"absolute",bottom:16,left:16,zIndex:10,background:"#1e293b",border:"1px solid #334155",borderRadius:8,padding:"10px 13px",fontSize:11,maxHeight:"calc(100% - 32px)",overflowY:"auto"},children:[l.jsx(Mh,{title:"Types",children:Object.entries(hr).map(([W,Z])=>l.jsxs(Fh,{children:[l.jsx(Gm,{color:Z}),W]},W))}),l.jsx(Ih,{}),l.jsx(Mh,{title:"Status",children:Object.entries(Ll).map(([W,Z])=>l.jsxs(Fh,{children:[l.jsx(Gm,{color:Z}),W.replace("_"," ")]},W))}),l.jsx(Ih,{}),l.jsx(Mh,{title:"Edges",children:Object.entries(Lu).map(([W,Z])=>l.jsxs(Fh,{children:[l.jsx("svg",{width:"22",height:"6",style:{flexShrink:0},children:l.jsx("line",{x1:"0",y1:"3",x2:"22",y2:"3",stroke:Z.color,strokeWidth:"1.5",strokeDasharray:Z.style==="dashed"?"6,3":"none"})}),W]},W))}),l.jsx(Ih,{}),l.jsxs("div",{style:{fontSize:10,color:"#475569"},children:["Border weight = confidence",l.jsx("br",{}),"Click node to trace deps"]})]}),l.jsx(kM,{data:S}),$&&l.jsx(vM,{data:$,onClose:()=>O(null),onApply:W=>{const Z=$.itemId;O(null),vt(`/api/vision/items/${Z}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({group:W||null})}).catch(H=>console.warn("[graph] group update failed:",H))}}),D.map(W=>l.jsx(TM,{badge:W,onClick:W.state==="gate_pending"?()=>F(I===W.featureCode?null:W.featureCode):W.state==="error"?()=>n(W.nodeId):void 0},W.featureCode)),I&&l.jsx(_M,{featureCode:I,gates:u,items:t,badgePositions:D,onResolve:(W,Z)=>{h&&h(W,Z),F(null)},onClose:()=>F(null)})]})]})}function Ah(t,e){t.elements().removeClass("dimmed highlighted");const r=e.union(e.predecessors("node[status]")).union(e.successors("node[status]")),n=r.edgesWith(r);t.nodes("[status]").not(r).addClass("dimmed"),t.edges().not(n).addClass("dimmed"),e.addClass("highlighted")}function Mh({title:t,children:e}){return l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{fontSize:10,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:5,fontWeight:700},children:t}),e]})}function Ih(){return l.jsx("div",{style:{height:1,background:"#334155",margin:"6px 0"}})}function Fh({children:t}){return l.jsx("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:3,color:"#94a3b8"},children:t})}function Gm({color:t}){return l.jsx("div",{style:{width:10,height:10,borderRadius:2,background:t,flexShrink:0}})}var rl={exports:{}},jM=rl.exports,Xm;function NM(){return Xm||(Xm=1,(function(t,e){(function(r,n){t.exports=n()})(jM,(function(){var r=1e3,n=6e4,i=36e5,s="millisecond",o="second",a="minute",c="hour",h="day",u="week",d="month",f="quarter",p="year",m="date",x="Invalid Date",g=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,k={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(P){var I=["th","st","nd","rd"],F=P%100;return"["+P+(I[(F-20)%10]||I[F]||I[0])+"]"}},b=function(P,I,F){var $=String(P);return!$||$.length>=I?P:""+Array(I+1-$.length).join(F)+P},w={s:b,z:function(P){var I=-P.utcOffset(),F=Math.abs(I),$=Math.floor(F/60),O=F%60;return(I<=0?"+":"-")+b($,2,"0")+":"+b(O,2,"0")},m:function P(I,F){if(I.date()<F.date())return-P(F,I);var $=12*(F.year()-I.year())+(F.month()-I.month()),O=I.clone().add($,d),D=F-O<0,j=I.clone().add($+(D?-1:1),d);return+(-($+(F-O)/(D?O-j:j-O))||0)},a:function(P){return P<0?Math.ceil(P)||0:Math.floor(P)},p:function(P){return{M:d,y:p,w:u,d:h,D:m,h:c,m:a,s:o,ms:s,Q:f}[P]||String(P||"").toLowerCase().replace(/s$/,"")},u:function(P){return P===void 0}},_="en",T={};T[_]=k;var S="$isDayjsObject",L=function(P){return P instanceof R||!(!P||!P[S])},B=function P(I,F,$){var O;if(!I)return _;if(typeof I=="string"){var D=I.toLowerCase();T[D]&&(O=D),F&&(T[D]=F,O=D);var j=I.split("-");if(!O&&j.length>1)return P(j[0])}else{var Y=I.name;T[Y]=I,O=Y}return!$&&O&&(_=O),O||!$&&_},N=function(P,I){if(L(P))return P.clone();var F=typeof I=="object"?I:{};return F.date=P,F.args=arguments,new R(F)},A=w;A.l=B,A.i=L,A.w=function(P,I){return N(P,{locale:I.$L,utc:I.$u,x:I.$x,$offset:I.$offset})};var R=(function(){function P(F){this.$L=B(F.locale,null,!0),this.parse(F),this.$x=this.$x||F.x||{},this[S]=!0}var I=P.prototype;return I.parse=function(F){this.$d=(function($){var O=$.date,D=$.utc;if(O===null)return new Date(NaN);if(A.u(O))return new Date;if(O instanceof Date)return new Date(O);if(typeof O=="string"&&!/Z$/i.test(O)){var j=O.match(g);if(j){var Y=j[2]-1||0,et=(j[7]||"0").substring(0,3);return D?new Date(Date.UTC(j[1],Y,j[3]||1,j[4]||0,j[5]||0,j[6]||0,et)):new Date(j[1],Y,j[3]||1,j[4]||0,j[5]||0,j[6]||0,et)}}return new Date(O)})(F),this.init()},I.init=function(){var F=this.$d;this.$y=F.getFullYear(),this.$M=F.getMonth(),this.$D=F.getDate(),this.$W=F.getDay(),this.$H=F.getHours(),this.$m=F.getMinutes(),this.$s=F.getSeconds(),this.$ms=F.getMilliseconds()},I.$utils=function(){return A},I.isValid=function(){return this.$d.toString()!==x},I.isSame=function(F,$){var O=N(F);return this.startOf($)<=O&&O<=this.endOf($)},I.isAfter=function(F,$){return N(F)<this.startOf($)},I.isBefore=function(F,$){return this.endOf($)<N(F)},I.$g=function(F,$,O){return A.u(F)?this[$]:this.set(O,F)},I.unix=function(){return Math.floor(this.valueOf()/1e3)},I.valueOf=function(){return this.$d.getTime()},I.startOf=function(F,$){var O=this,D=!!A.u($)||$,j=A.p(F),Y=function(Ct,G){var it=A.w(O.$u?Date.UTC(O.$y,G,Ct):new Date(O.$y,G,Ct),O);return D?it:it.endOf(h)},et=function(Ct,G){return A.w(O.toDate()[Ct].apply(O.toDate("s"),(D?[0,0,0,0]:[23,59,59,999]).slice(G)),O)},M=this.$W,ct=this.$M,X=this.$D,lt="set"+(this.$u?"UTC":"");switch(j){case p:return D?Y(1,0):Y(31,11);case d:return D?Y(1,ct):Y(0,ct+1);case u:var It=this.$locale().weekStart||0,Pt=(M<It?M+7:M)-It;return Y(D?X-Pt:X+(6-Pt),ct);case h:case m:return et(lt+"Hours",0);case c:return et(lt+"Minutes",1);case a:return et(lt+"Seconds",2);case o:return et(lt+"Milliseconds",3);default:return this.clone()}},I.endOf=function(F){return this.startOf(F,!1)},I.$set=function(F,$){var O,D=A.p(F),j="set"+(this.$u?"UTC":""),Y=(O={},O[h]=j+"Date",O[m]=j+"Date",O[d]=j+"Month",O[p]=j+"FullYear",O[c]=j+"Hours",O[a]=j+"Minutes",O[o]=j+"Seconds",O[s]=j+"Milliseconds",O)[D],et=D===h?this.$D+($-this.$W):$;if(D===d||D===p){var M=this.clone().set(m,1);M.$d[Y](et),M.init(),this.$d=M.set(m,Math.min(this.$D,M.daysInMonth())).$d}else Y&&this.$d[Y](et);return this.init(),this},I.set=function(F,$){return this.clone().$set(F,$)},I.get=function(F){return this[A.p(F)]()},I.add=function(F,$){var O,D=this;F=Number(F);var j=A.p($),Y=function(ct){var X=N(D);return A.w(X.date(X.date()+Math.round(ct*F)),D)};if(j===d)return this.set(d,this.$M+F);if(j===p)return this.set(p,this.$y+F);if(j===h)return Y(1);if(j===u)return Y(7);var et=(O={},O[a]=n,O[c]=i,O[o]=r,O)[j]||1,M=this.$d.getTime()+F*et;return A.w(M,this)},I.subtract=function(F,$){return this.add(-1*F,$)},I.format=function(F){var $=this,O=this.$locale();if(!this.isValid())return O.invalidDate||x;var D=F||"YYYY-MM-DDTHH:mm:ssZ",j=A.z(this),Y=this.$H,et=this.$m,M=this.$M,ct=O.weekdays,X=O.months,lt=O.meridiem,It=function(G,it,kt,Tt){return G&&(G[it]||G($,D))||kt[it].slice(0,Tt)},Pt=function(G){return A.s(Y%12||12,G,"0")},Ct=lt||function(G,it,kt){var Tt=G<12?"AM":"PM";return kt?Tt.toLowerCase():Tt};return D.replace(y,(function(G,it){return it||(function(kt){switch(kt){case"YY":return String($.$y).slice(-2);case"YYYY":return A.s($.$y,4,"0");case"M":return M+1;case"MM":return A.s(M+1,2,"0");case"MMM":return It(O.monthsShort,M,X,3);case"MMMM":return It(X,M);case"D":return $.$D;case"DD":return A.s($.$D,2,"0");case"d":return String($.$W);case"dd":return It(O.weekdaysMin,$.$W,ct,2);case"ddd":return It(O.weekdaysShort,$.$W,ct,3);case"dddd":return ct[$.$W];case"H":return String(Y);case"HH":return A.s(Y,2,"0");case"h":return Pt(1);case"hh":return Pt(2);case"a":return Ct(Y,et,!0);case"A":return Ct(Y,et,!1);case"m":return String(et);case"mm":return A.s(et,2,"0");case"s":return String($.$s);case"ss":return A.s($.$s,2,"0");case"SSS":return A.s($.$ms,3,"0");case"Z":return j}return null})(G)||j.replace(":","")}))},I.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},I.diff=function(F,$,O){var D,j=this,Y=A.p($),et=N(F),M=(et.utcOffset()-this.utcOffset())*n,ct=this-et,X=function(){return A.m(j,et)};switch(Y){case p:D=X()/12;break;case d:D=X();break;case f:D=X()/3;break;case u:D=(ct-M)/6048e5;break;case h:D=(ct-M)/864e5;break;case c:D=ct/i;break;case a:D=ct/n;break;case o:D=ct/r;break;default:D=ct}return O?D:A.a(D)},I.daysInMonth=function(){return this.endOf(d).$D},I.$locale=function(){return T[this.$L]},I.locale=function(F,$){if(!F)return this.$L;var O=this.clone(),D=B(F,$,!0);return D&&(O.$L=D),O},I.clone=function(){return A.w(this.$d,this)},I.toDate=function(){return new Date(this.valueOf())},I.toJSON=function(){return this.isValid()?this.toISOString():null},I.toISOString=function(){return this.$d.toISOString()},I.toString=function(){return this.$d.toUTCString()},P})(),z=R.prototype;return N.prototype=z,[["$ms",s],["$s",o],["$m",a],["$H",c],["$W",h],["$M",d],["$y",p],["$D",m]].forEach((function(P){z[P[1]]=function(I){return this.$g(I,P[0],P[1])}})),N.extend=function(P,I){return P.$i||(P(I,R,N),P.$i=!0),N},N.locale=B,N.isDayjs=L,N.unix=function(P){return N(1e3*P)},N.en=T[_],N.Ls=T,N.p={},N}))})(rl)),rl.exports}var EM=NM();const LM=zd(EM);var Db=Object.defineProperty,v=(t,e)=>Db(t,"name",{value:e,configurable:!0}),BM=(t,e)=>{for(var r in e)Db(t,r,{get:e[r],enumerable:!0})},nn={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},rt={trace:v((...t)=>{},"trace"),debug:v((...t)=>{},"debug"),info:v((...t)=>{},"info"),warn:v((...t)=>{},"warn"),error:v((...t)=>{},"error"),fatal:v((...t)=>{},"fatal")},Sp=v(function(t="fatal"){let e=nn.fatal;typeof t=="string"?t.toLowerCase()in nn&&(e=nn[t]):typeof t=="number"&&(e=t),rt.trace=()=>{},rt.debug=()=>{},rt.info=()=>{},rt.warn=()=>{},rt.error=()=>{},rt.fatal=()=>{},e<=nn.fatal&&(rt.fatal=console.error?console.error.bind(console,kr("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",kr("FATAL"))),e<=nn.error&&(rt.error=console.error?console.error.bind(console,kr("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",kr("ERROR"))),e<=nn.warn&&(rt.warn=console.warn?console.warn.bind(console,kr("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",kr("WARN"))),e<=nn.info&&(rt.info=console.info?console.info.bind(console,kr("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",kr("INFO"))),e<=nn.debug&&(rt.debug=console.debug?console.debug.bind(console,kr("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",kr("DEBUG"))),e<=nn.trace&&(rt.trace=console.debug?console.debug.bind(console,kr("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",kr("TRACE")))},"setLogLevel"),kr=v(t=>`%c${LM().format("ss.SSS")} : ${t} : `,"format");const nl={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:t=>t>=255?255:t<0?0:t,g:t=>t>=255?255:t<0?0:t,b:t=>t>=255?255:t<0?0:t,h:t=>t%360,s:t=>t>=100?100:t<0?0:t,l:t=>t>=100?100:t<0?0:t,a:t=>t>=1?1:t<0?0:t},toLinear:t=>{const e=t/255;return t>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92},hue2rgb:(t,e,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t),hsl2rgb:({h:t,s:e,l:r},n)=>{if(!e)return r*2.55;t/=360,e/=100,r/=100;const i=r<.5?r*(1+e):r+e-r*e,s=2*r-i;switch(n){case"r":return nl.hue2rgb(s,i,t+1/3)*255;case"g":return nl.hue2rgb(s,i,t)*255;case"b":return nl.hue2rgb(s,i,t-1/3)*255}},rgb2hsl:({r:t,g:e,b:r},n)=>{t/=255,e/=255,r/=255;const i=Math.max(t,e,r),s=Math.min(t,e,r),o=(i+s)/2;if(n==="l")return o*100;if(i===s)return 0;const a=i-s,c=o>.5?a/(2-i-s):a/(i+s);if(n==="s")return c*100;switch(i){case t:return((e-r)/a+(e<r?6:0))*60;case e:return((r-t)/a+2)*60;case r:return((t-e)/a+4)*60;default:return-1}}},AM={clamp:(t,e,r)=>e>r?Math.min(e,Math.max(r,t)):Math.min(r,Math.max(e,t)),round:t=>Math.round(t*1e10)/1e10},MM={dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}},Mt={channel:nl,lang:AM,unit:MM},Sn={};for(let t=0;t<=255;t++)Sn[t]=Mt.unit.dec2hex(t);const Re={ALL:0,RGB:1,HSL:2};class IM{constructor(){this.type=Re.ALL}get(){return this.type}set(e){if(this.type&&this.type!==e)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=e}reset(){this.type=Re.ALL}is(e){return this.type===e}}class FM{constructor(e,r){this.color=r,this.changed=!1,this.data=e,this.type=new IM}set(e,r){return this.color=r,this.changed=!1,this.data=e,this.type.type=Re.ALL,this}_ensureHSL(){const e=this.data,{h:r,s:n,l:i}=e;r===void 0&&(e.h=Mt.channel.rgb2hsl(e,"h")),n===void 0&&(e.s=Mt.channel.rgb2hsl(e,"s")),i===void 0&&(e.l=Mt.channel.rgb2hsl(e,"l"))}_ensureRGB(){const e=this.data,{r,g:n,b:i}=e;r===void 0&&(e.r=Mt.channel.hsl2rgb(e,"r")),n===void 0&&(e.g=Mt.channel.hsl2rgb(e,"g")),i===void 0&&(e.b=Mt.channel.hsl2rgb(e,"b"))}get r(){const e=this.data,r=e.r;return!this.type.is(Re.HSL)&&r!==void 0?r:(this._ensureHSL(),Mt.channel.hsl2rgb(e,"r"))}get g(){const e=this.data,r=e.g;return!this.type.is(Re.HSL)&&r!==void 0?r:(this._ensureHSL(),Mt.channel.hsl2rgb(e,"g"))}get b(){const e=this.data,r=e.b;return!this.type.is(Re.HSL)&&r!==void 0?r:(this._ensureHSL(),Mt.channel.hsl2rgb(e,"b"))}get h(){const e=this.data,r=e.h;return!this.type.is(Re.RGB)&&r!==void 0?r:(this._ensureRGB(),Mt.channel.rgb2hsl(e,"h"))}get s(){const e=this.data,r=e.s;return!this.type.is(Re.RGB)&&r!==void 0?r:(this._ensureRGB(),Mt.channel.rgb2hsl(e,"s"))}get l(){const e=this.data,r=e.l;return!this.type.is(Re.RGB)&&r!==void 0?r:(this._ensureRGB(),Mt.channel.rgb2hsl(e,"l"))}get a(){return this.data.a}set r(e){this.type.set(Re.RGB),this.changed=!0,this.data.r=e}set g(e){this.type.set(Re.RGB),this.changed=!0,this.data.g=e}set b(e){this.type.set(Re.RGB),this.changed=!0,this.data.b=e}set h(e){this.type.set(Re.HSL),this.changed=!0,this.data.h=e}set s(e){this.type.set(Re.HSL),this.changed=!0,this.data.s=e}set l(e){this.type.set(Re.HSL),this.changed=!0,this.data.l=e}set a(e){this.changed=!0,this.data.a=e}}const Bc=new FM({r:0,g:0,b:0,a:0},"transparent"),Hi={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:t=>{if(t.charCodeAt(0)!==35)return;const e=t.match(Hi.re);if(!e)return;const r=e[1],n=parseInt(r,16),i=r.length,s=i%4===0,o=i>4,a=o?1:17,c=o?8:4,h=s?0:-1,u=o?255:15;return Bc.set({r:(n>>c*(h+3)&u)*a,g:(n>>c*(h+2)&u)*a,b:(n>>c*(h+1)&u)*a,a:s?(n&u)*a/255:1},t)},stringify:t=>{const{r:e,g:r,b:n,a:i}=t;return i<1?`#${Sn[Math.round(e)]}${Sn[Math.round(r)]}${Sn[Math.round(n)]}${Sn[Math.round(i*255)]}`:`#${Sn[Math.round(e)]}${Sn[Math.round(r)]}${Sn[Math.round(n)]}`}},Qn={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:t=>{const e=t.match(Qn.hueRe);if(e){const[,r,n]=e;switch(n){case"grad":return Mt.channel.clamp.h(parseFloat(r)*.9);case"rad":return Mt.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return Mt.channel.clamp.h(parseFloat(r)*360)}}return Mt.channel.clamp.h(parseFloat(t))},parse:t=>{const e=t.charCodeAt(0);if(e!==104&&e!==72)return;const r=t.match(Qn.re);if(!r)return;const[,n,i,s,o,a]=r;return Bc.set({h:Qn._hue2deg(n),s:Mt.channel.clamp.s(parseFloat(i)),l:Mt.channel.clamp.l(parseFloat(s)),a:o?Mt.channel.clamp.a(a?parseFloat(o)/100:parseFloat(o)):1},t)},stringify:t=>{const{h:e,s:r,l:n,a:i}=t;return i<1?`hsla(${Mt.lang.round(e)}, ${Mt.lang.round(r)}%, ${Mt.lang.round(n)}%, ${i})`:`hsl(${Mt.lang.round(e)}, ${Mt.lang.round(r)}%, ${Mt.lang.round(n)}%)`}},No={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:t=>{t=t.toLowerCase();const e=No.colors[t];if(e)return Hi.parse(e)},stringify:t=>{const e=Hi.stringify(t);for(const r in No.colors)if(No.colors[r]===e)return r}},mo={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:t=>{const e=t.charCodeAt(0);if(e!==114&&e!==82)return;const r=t.match(mo.re);if(!r)return;const[,n,i,s,o,a,c,h,u]=r;return Bc.set({r:Mt.channel.clamp.r(i?parseFloat(n)*2.55:parseFloat(n)),g:Mt.channel.clamp.g(o?parseFloat(s)*2.55:parseFloat(s)),b:Mt.channel.clamp.b(c?parseFloat(a)*2.55:parseFloat(a)),a:h?Mt.channel.clamp.a(u?parseFloat(h)/100:parseFloat(h)):1},t)},stringify:t=>{const{r:e,g:r,b:n,a:i}=t;return i<1?`rgba(${Mt.lang.round(e)}, ${Mt.lang.round(r)}, ${Mt.lang.round(n)}, ${Mt.lang.round(i)})`:`rgb(${Mt.lang.round(e)}, ${Mt.lang.round(r)}, ${Mt.lang.round(n)})`}},Gr={format:{keyword:No,hex:Hi,rgb:mo,rgba:mo,hsl:Qn,hsla:Qn},parse:t=>{if(typeof t!="string")return t;const e=Hi.parse(t)||mo.parse(t)||Qn.parse(t)||No.parse(t);if(e)return e;throw new Error(`Unsupported color format: "${t}"`)},stringify:t=>!t.changed&&t.color?t.color:t.type.is(Re.HSL)||t.data.r===void 0?Qn.stringify(t):t.a<1||!Number.isInteger(t.r)||!Number.isInteger(t.g)||!Number.isInteger(t.b)?mo.stringify(t):Hi.stringify(t)},Ob=(t,e)=>{const r=Gr.parse(t);for(const n in e)r[n]=Mt.channel.clamp[n](e[n]);return Gr.stringify(r)},Nn=(t,e,r=0,n=1)=>{if(typeof t!="number")return Ob(t,{a:e});const i=Bc.set({r:Mt.channel.clamp.r(t),g:Mt.channel.clamp.g(e),b:Mt.channel.clamp.b(r),a:Mt.channel.clamp.a(n)});return Gr.stringify(i)},PM=t=>{const{r:e,g:r,b:n}=Gr.parse(t),i=.2126*Mt.channel.toLinear(e)+.7152*Mt.channel.toLinear(r)+.0722*Mt.channel.toLinear(n);return Mt.lang.round(i)},$M=t=>PM(t)>=.5,Dr=t=>!$M(t),Rb=(t,e,r)=>{const n=Gr.parse(t),i=n[e],s=Mt.channel.clamp[e](i+r);return i!==s&&(n[e]=s),Gr.stringify(n)},Q=(t,e)=>Rb(t,"l",e),K=(t,e)=>Rb(t,"l",-e),E=(t,e)=>{const r=Gr.parse(t),n={};for(const i in e)e[i]&&(n[i]=r[i]+e[i]);return Ob(t,n)},DM=(t,e,r=50)=>{const{r:n,g:i,b:s,a:o}=Gr.parse(t),{r:a,g:c,b:h,a:u}=Gr.parse(e),d=r/100,f=d*2-1,p=o-u,x=((f*p===-1?f:(f+p)/(1+f*p))+1)/2,g=1-x,y=n*x+a*g,k=i*x+c*g,b=s*x+h*g,w=o*d+u*(1-d);return Nn(y,k,b,w)},V=(t,e=100)=>{const r=Gr.parse(t);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,DM(r,t,e)};/*! @license DOMPurify 3.4.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.0/LICENSE */const{entries:zb,setPrototypeOf:Km,isFrozen:OM,getPrototypeOf:RM,getOwnPropertyDescriptor:zM}=Object;let{freeze:Je,seal:wr,create:go}=Object,{apply:Bu,construct:Au}=typeof Reflect<"u"&&Reflect;Je||(Je=function(e){return e});wr||(wr=function(e){return e});Bu||(Bu=function(e,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),s=2;s<n;s++)i[s-2]=arguments[s];return e.apply(r,i)});Au||(Au=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return new e(...n)});const Ks=tr(Array.prototype.forEach),qM=tr(Array.prototype.lastIndexOf),Qm=tr(Array.prototype.pop),Qs=tr(Array.prototype.push),WM=tr(Array.prototype.splice),il=tr(String.prototype.toLowerCase),Ph=tr(String.prototype.toString),$h=tr(String.prototype.match),Ni=tr(String.prototype.replace),HM=tr(String.prototype.indexOf),UM=tr(String.prototype.trim),Nr=tr(Object.prototype.hasOwnProperty),Xe=tr(RegExp.prototype.test),Zs=VM(TypeError);function tr(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return Bu(t,e,n)}}function VM(t){return function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return Au(t,r)}}function Rt(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:il;Km&&Km(t,null);let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){const s=r(i);s!==i&&(OM(e)||(e[n]=s),i=s)}t[i]=!0}return t}function YM(t){for(let e=0;e<t.length;e++)Nr(t,e)||(t[e]=null);return t}function qr(t){const e=go(null);for(const[r,n]of zb(t))Nr(t,r)&&(Array.isArray(n)?e[r]=YM(n):n&&typeof n=="object"&&n.constructor===Object?e[r]=qr(n):e[r]=n);return e}function Js(t,e){for(;t!==null;){const n=zM(t,e);if(n){if(n.get)return tr(n.get);if(typeof n.value=="function")return tr(n.value)}t=RM(t)}function r(){return null}return r}const Zm=Je(["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"]),Dh=Je(["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"]),Oh=Je(["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"]),GM=Je(["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"]),Rh=Je(["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"]),XM=Je(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Jm=Je(["#text"]),tg=Je(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","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","slot"]),zh=Je(["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","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","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-rendering","textlength","type","u1","u2","unicode","values","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"]),eg=Je(["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"]),Aa=Je(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),KM=wr(/\{\{[\w\W]*|[\w\W]*\}\}/gm),QM=wr(/<%[\w\W]*|[\w\W]*%>/gm),ZM=wr(/\$\{[\w\W]*/gm),JM=wr(/^data-[\-\w.\u00B7-\uFFFF]+$/),tI=wr(/^aria-[\-\w]+$/),qb=wr(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),eI=wr(/^(?:\w+script|data):/i),rI=wr(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Wb=wr(/^html$/i),nI=wr(/^[a-z][.\w]*(-[.\w]+)+$/i);var rg=Object.freeze({__proto__:null,ARIA_ATTR:tI,ATTR_WHITESPACE:rI,CUSTOM_ELEMENT:nI,DATA_ATTR:JM,DOCTYPE_NAME:Wb,ERB_EXPR:QM,IS_ALLOWED_URI:qb,IS_SCRIPT_OR_DATA:eI,MUSTACHE_EXPR:KM,TMPLIT_EXPR:ZM});const to={element:1,text:3,progressingInstruction:7,comment:8,document:9},iI=function(){return typeof window>"u"?null:window},sI=function(e,r){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const i="data-tt-policy-suffix";r&&r.hasAttribute(i)&&(n=r.getAttribute(i));const s="dompurify"+(n?"#"+n:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},ng=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Hb(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:iI();const e=St=>Hb(St);if(e.version="3.4.0",e.removed=[],!t||!t.document||t.document.nodeType!==to.document||!t.Element)return e.isSupported=!1,e;let{document:r}=t;const n=r,i=n.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:a,Element:c,NodeFilter:h,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:d,DOMParser:f,trustedTypes:p}=t,m=c.prototype,x=Js(m,"cloneNode"),g=Js(m,"remove"),y=Js(m,"nextSibling"),k=Js(m,"childNodes"),b=Js(m,"parentNode");if(typeof o=="function"){const St=r.createElement("template");St.content&&St.content.ownerDocument&&(r=St.content.ownerDocument)}let w,_="";const{implementation:T,createNodeIterator:S,createDocumentFragment:L,getElementsByTagName:B}=r,{importNode:N}=n;let A=ng();e.isSupported=typeof zb=="function"&&typeof b=="function"&&T&&T.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:R,ERB_EXPR:z,TMPLIT_EXPR:P,DATA_ATTR:I,ARIA_ATTR:F,IS_SCRIPT_OR_DATA:$,ATTR_WHITESPACE:O,CUSTOM_ELEMENT:D}=rg;let{IS_ALLOWED_URI:j}=rg,Y=null;const et=Rt({},[...Zm,...Dh,...Oh,...Rh,...Jm]);let M=null;const ct=Rt({},[...tg,...zh,...eg,...Aa]);let X=Object.seal(go(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}})),lt=null,It=null;const Pt=Object.seal(go(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ct=!0,G=!0,it=!1,kt=!0,Tt=!1,qt=!0,Qt=!1,Gt=!1,Se=!1,Xt=!1,Ye=!1,le=!1,Ae=!0,De=!1;const Le="user-content-";let W=!0,Z=!1,H={},J=null;const at=Rt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let pt=null;const _t=Rt({},["audio","video","img","source","image","track"]);let Kt=null;const de=Rt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ge="http://www.w3.org/1998/Math/MathML",Me="http://www.w3.org/2000/svg",Zt="http://www.w3.org/1999/xhtml";let pe=Zt,Te=!1,Ie=null;const Ca=Rt({},[ge,Me,Zt],Ph);let wi=Rt({},["mi","mo","mn","ms","mtext"]),Si=Rt({},["annotation-xml"]);const Ls=Rt({},["title","style","font","a","script"]);let zn=null;const ka=["application/xhtml+xml","text/html"],ih="text/html";let be=null,Cr=null;const sh=r.createElement("form"),qn=function(q){return q instanceof RegExp||q instanceof Function},Bs=function(){let q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Cr&&Cr===q)){if((!q||typeof q!="object")&&(q={}),q=qr(q),zn=ka.indexOf(q.PARSER_MEDIA_TYPE)===-1?ih:q.PARSER_MEDIA_TYPE,be=zn==="application/xhtml+xml"?Ph:il,Y=Nr(q,"ALLOWED_TAGS")?Rt({},q.ALLOWED_TAGS,be):et,M=Nr(q,"ALLOWED_ATTR")?Rt({},q.ALLOWED_ATTR,be):ct,Ie=Nr(q,"ALLOWED_NAMESPACES")?Rt({},q.ALLOWED_NAMESPACES,Ph):Ca,Kt=Nr(q,"ADD_URI_SAFE_ATTR")?Rt(qr(de),q.ADD_URI_SAFE_ATTR,be):de,pt=Nr(q,"ADD_DATA_URI_TAGS")?Rt(qr(_t),q.ADD_DATA_URI_TAGS,be):_t,J=Nr(q,"FORBID_CONTENTS")?Rt({},q.FORBID_CONTENTS,be):at,lt=Nr(q,"FORBID_TAGS")?Rt({},q.FORBID_TAGS,be):qr({}),It=Nr(q,"FORBID_ATTR")?Rt({},q.FORBID_ATTR,be):qr({}),H=Nr(q,"USE_PROFILES")?q.USE_PROFILES:!1,Ct=q.ALLOW_ARIA_ATTR!==!1,G=q.ALLOW_DATA_ATTR!==!1,it=q.ALLOW_UNKNOWN_PROTOCOLS||!1,kt=q.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Tt=q.SAFE_FOR_TEMPLATES||!1,qt=q.SAFE_FOR_XML!==!1,Qt=q.WHOLE_DOCUMENT||!1,Xt=q.RETURN_DOM||!1,Ye=q.RETURN_DOM_FRAGMENT||!1,le=q.RETURN_TRUSTED_TYPE||!1,Se=q.FORCE_BODY||!1,Ae=q.SANITIZE_DOM!==!1,De=q.SANITIZE_NAMED_PROPS||!1,W=q.KEEP_CONTENT!==!1,Z=q.IN_PLACE||!1,j=q.ALLOWED_URI_REGEXP||qb,pe=q.NAMESPACE||Zt,wi=q.MATHML_TEXT_INTEGRATION_POINTS||wi,Si=q.HTML_INTEGRATION_POINTS||Si,X=q.CUSTOM_ELEMENT_HANDLING||go(null),q.CUSTOM_ELEMENT_HANDLING&&qn(q.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(X.tagNameCheck=q.CUSTOM_ELEMENT_HANDLING.tagNameCheck),q.CUSTOM_ELEMENT_HANDLING&&qn(q.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(X.attributeNameCheck=q.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),q.CUSTOM_ELEMENT_HANDLING&&typeof q.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(X.allowCustomizedBuiltInElements=q.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Tt&&(G=!1),Ye&&(Xt=!0),H&&(Y=Rt({},Jm),M=go(null),H.html===!0&&(Rt(Y,Zm),Rt(M,tg)),H.svg===!0&&(Rt(Y,Dh),Rt(M,zh),Rt(M,Aa)),H.svgFilters===!0&&(Rt(Y,Oh),Rt(M,zh),Rt(M,Aa)),H.mathMl===!0&&(Rt(Y,Rh),Rt(M,eg),Rt(M,Aa))),Pt.tagCheck=null,Pt.attributeCheck=null,q.ADD_TAGS&&(typeof q.ADD_TAGS=="function"?Pt.tagCheck=q.ADD_TAGS:(Y===et&&(Y=qr(Y)),Rt(Y,q.ADD_TAGS,be))),q.ADD_ATTR&&(typeof q.ADD_ATTR=="function"?Pt.attributeCheck=q.ADD_ATTR:(M===ct&&(M=qr(M)),Rt(M,q.ADD_ATTR,be))),q.ADD_URI_SAFE_ATTR&&Rt(Kt,q.ADD_URI_SAFE_ATTR,be),q.FORBID_CONTENTS&&(J===at&&(J=qr(J)),Rt(J,q.FORBID_CONTENTS,be)),q.ADD_FORBID_CONTENTS&&(J===at&&(J=qr(J)),Rt(J,q.ADD_FORBID_CONTENTS,be)),W&&(Y["#text"]=!0),Qt&&Rt(Y,["html","head","body"]),Y.table&&(Rt(Y,["tbody"]),delete lt.tbody),q.TRUSTED_TYPES_POLICY){if(typeof q.TRUSTED_TYPES_POLICY.createHTML!="function")throw Zs('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof q.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Zs('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=q.TRUSTED_TYPES_POLICY,_=w.createHTML("")}else w===void 0&&(w=sI(p,i)),w!==null&&typeof _=="string"&&(_=w.createHTML(""));Je&&Je(q),Cr=q}},As=Rt({},[...Dh,...Oh,...GM]),va=Rt({},[...Rh,...XM]),wa=function(q){let st=b(q);(!st||!st.tagName)&&(st={namespaceURI:pe,tagName:"template"});const ft=il(q.tagName),ie=il(st.tagName);return Ie[q.namespaceURI]?q.namespaceURI===Me?st.namespaceURI===Zt?ft==="svg":st.namespaceURI===ge?ft==="svg"&&(ie==="annotation-xml"||wi[ie]):!!As[ft]:q.namespaceURI===ge?st.namespaceURI===Zt?ft==="math":st.namespaceURI===Me?ft==="math"&&Si[ie]:!!va[ft]:q.namespaceURI===Zt?st.namespaceURI===Me&&!Si[ie]||st.namespaceURI===ge&&!wi[ie]?!1:!va[ft]&&(Ls[ft]||!As[ft]):!!(zn==="application/xhtml+xml"&&Ie[q.namespaceURI]):!1},dr=function(q){Qs(e.removed,{element:q});try{b(q).removeChild(q)}catch{g(q)}},Rr=function(q,st){try{Qs(e.removed,{attribute:st.getAttributeNode(q),from:st})}catch{Qs(e.removed,{attribute:null,from:st})}if(st.removeAttribute(q),q==="is")if(Xt||Ye)try{dr(st)}catch{}else try{st.setAttribute(q,"")}catch{}},Ms=function(q){let st=null,ft=null;if(Se)q="<remove></remove>"+q;else{const xe=$h(q,/^[\r\n\t ]+/);ft=xe&&xe[0]}zn==="application/xhtml+xml"&&pe===Zt&&(q='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+q+"</body></html>");const ie=w?w.createHTML(q):q;if(pe===Zt)try{st=new f().parseFromString(ie,zn)}catch{}if(!st||!st.documentElement){st=T.createDocument(pe,"template",null);try{st.documentElement.innerHTML=Te?_:ie}catch{}}const _e=st.body||st.documentElement;return q&&ft&&_e.insertBefore(r.createTextNode(ft),_e.childNodes[0]||null),pe===Zt?B.call(st,Qt?"html":"body")[0]:Qt?st.documentElement:_e},Is=function(q){return S.call(q.ownerDocument||q,q,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},Fs=function(q){return q instanceof d&&(typeof q.nodeName!="string"||typeof q.textContent!="string"||typeof q.removeChild!="function"||!(q.attributes instanceof u)||typeof q.removeAttribute!="function"||typeof q.setAttribute!="function"||typeof q.namespaceURI!="string"||typeof q.insertBefore!="function"||typeof q.hasChildNodes!="function")},Ti=function(q){return typeof a=="function"&&q instanceof a};function _r(St,q,st){Ks(St,ft=>{ft.call(e,q,st,Cr)})}const Ps=function(q){let st=null;if(_r(A.beforeSanitizeElements,q,null),Fs(q))return dr(q),!0;const ft=be(q.nodeName);if(_r(A.uponSanitizeElement,q,{tagName:ft,allowedTags:Y}),qt&&q.hasChildNodes()&&!Ti(q.firstElementChild)&&Xe(/<[/\w!]/g,q.innerHTML)&&Xe(/<[/\w!]/g,q.textContent)||qt&&q.namespaceURI===Zt&&ft==="style"&&Ti(q.firstElementChild)||q.nodeType===to.progressingInstruction||qt&&q.nodeType===to.comment&&Xe(/<[/\w]/g,q.data))return dr(q),!0;if(lt[ft]||!(Pt.tagCheck instanceof Function&&Pt.tagCheck(ft))&&!Y[ft]){if(!lt[ft]&&Ds(ft)&&(X.tagNameCheck instanceof RegExp&&Xe(X.tagNameCheck,ft)||X.tagNameCheck instanceof Function&&X.tagNameCheck(ft)))return!1;if(W&&!J[ft]){const ie=b(q)||q.parentNode,_e=k(q)||q.childNodes;if(_e&&ie){const xe=_e.length;for(let Oe=xe-1;Oe>=0;--Oe){const Ge=x(_e[Oe],!0);Ge.__removalCount=(q.__removalCount||0)+1,ie.insertBefore(Ge,y(q))}}}return dr(q),!0}return q instanceof c&&!wa(q)||(ft==="noscript"||ft==="noembed"||ft==="noframes")&&Xe(/<\/no(script|embed|frames)/i,q.innerHTML)?(dr(q),!0):(Tt&&q.nodeType===to.text&&(st=q.textContent,Ks([R,z,P],ie=>{st=Ni(st,ie," ")}),q.textContent!==st&&(Qs(e.removed,{element:q.cloneNode()}),q.textContent=st)),_r(A.afterSanitizeElements,q,null),!1)},$s=function(q,st,ft){if(It[st]||Ae&&(st==="id"||st==="name")&&(ft in r||ft in sh))return!1;if(!(G&&!It[st]&&Xe(I,st))){if(!(Ct&&Xe(F,st))){if(!(Pt.attributeCheck instanceof Function&&Pt.attributeCheck(st,q))){if(!M[st]||It[st]){if(!(Ds(q)&&(X.tagNameCheck instanceof RegExp&&Xe(X.tagNameCheck,q)||X.tagNameCheck instanceof Function&&X.tagNameCheck(q))&&(X.attributeNameCheck instanceof RegExp&&Xe(X.attributeNameCheck,st)||X.attributeNameCheck instanceof Function&&X.attributeNameCheck(st,q))||st==="is"&&X.allowCustomizedBuiltInElements&&(X.tagNameCheck instanceof RegExp&&Xe(X.tagNameCheck,ft)||X.tagNameCheck instanceof Function&&X.tagNameCheck(ft))))return!1}else if(!Kt[st]){if(!Xe(j,Ni(ft,O,""))){if(!((st==="src"||st==="xlink:href"||st==="href")&&q!=="script"&&HM(ft,"data:")===0&&pt[q])){if(!(it&&!Xe($,Ni(ft,O,"")))){if(ft)return!1}}}}}}}return!0},Ds=function(q){return q!=="annotation-xml"&&$h(q,D)},Sa=function(q){_r(A.beforeSanitizeAttributes,q,null);const{attributes:st}=q;if(!st||Fs(q))return;const ft={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:M,forceKeepAttr:void 0};let ie=st.length;for(;ie--;){const _e=st[ie],{name:xe,namespaceURI:Oe,value:Ge}=_e,zr=be(xe),Fe=Ge;let Jt=xe==="value"?Fe:UM(Fe);if(ft.attrName=zr,ft.attrValue=Jt,ft.keepAttr=!0,ft.forceKeepAttr=void 0,_r(A.uponSanitizeAttribute,q,ft),Jt=ft.attrValue,De&&(zr==="id"||zr==="name")&&(Rr(xe,q),Jt=Le+Jt),qt&&Xe(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Jt)){Rr(xe,q);continue}if(zr==="attributename"&&$h(Jt,"href")){Rr(xe,q);continue}if(ft.forceKeepAttr)continue;if(!ft.keepAttr){Rr(xe,q);continue}if(!kt&&Xe(/\/>/i,Jt)){Rr(xe,q);continue}Tt&&Ks([R,z,P],Rs=>{Jt=Ni(Jt,Rs," ")});const Ta=be(q.nodeName);if(!$s(Ta,zr,Jt)){Rr(xe,q);continue}if(w&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!Oe)switch(p.getAttributeType(Ta,zr)){case"TrustedHTML":{Jt=w.createHTML(Jt);break}case"TrustedScriptURL":{Jt=w.createScriptURL(Jt);break}}if(Jt!==Fe)try{Oe?q.setAttributeNS(Oe,xe,Jt):q.setAttribute(xe,Jt),Fs(q)?dr(q):Qm(e.removed)}catch{Rr(xe,q)}}_r(A.afterSanitizeAttributes,q,null)},Os=function(q){let st=null;const ft=Is(q);for(_r(A.beforeSanitizeShadowDOM,q,null);st=ft.nextNode();)_r(A.uponSanitizeShadowNode,st,null),Ps(st),Sa(st),st.content instanceof s&&Os(st.content);_r(A.afterSanitizeShadowDOM,q,null)};return e.sanitize=function(St){let q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},st=null,ft=null,ie=null,_e=null;if(Te=!St,Te&&(St="<!-->"),typeof St!="string"&&!Ti(St))if(typeof St.toString=="function"){if(St=St.toString(),typeof St!="string")throw Zs("dirty is not a string, aborting")}else throw Zs("toString is not a function");if(!e.isSupported)return St;if(Gt||Bs(q),e.removed=[],typeof St=="string"&&(Z=!1),Z){if(St.nodeName){const Ge=be(St.nodeName);if(!Y[Ge]||lt[Ge])throw Zs("root node is forbidden and cannot be sanitized in-place")}}else if(St instanceof a)st=Ms("<!---->"),ft=st.ownerDocument.importNode(St,!0),ft.nodeType===to.element&&ft.nodeName==="BODY"||ft.nodeName==="HTML"?st=ft:st.appendChild(ft);else{if(!Xt&&!Tt&&!Qt&&St.indexOf("<")===-1)return w&&le?w.createHTML(St):St;if(st=Ms(St),!st)return Xt?null:le?_:""}st&&Se&&dr(st.firstChild);const xe=Is(Z?St:st);for(;ie=xe.nextNode();)Ps(ie),Sa(ie),ie.content instanceof s&&Os(ie.content);if(Z)return St;if(Xt){if(Tt){st.normalize();let Ge=st.innerHTML;Ks([R,z,P],zr=>{Ge=Ni(Ge,zr," ")}),st.innerHTML=Ge}if(Ye)for(_e=L.call(st.ownerDocument);st.firstChild;)_e.appendChild(st.firstChild);else _e=st;return(M.shadowroot||M.shadowrootmode)&&(_e=N.call(n,_e,!0)),_e}let Oe=Qt?st.outerHTML:st.innerHTML;return Qt&&Y["!doctype"]&&st.ownerDocument&&st.ownerDocument.doctype&&st.ownerDocument.doctype.name&&Xe(Wb,st.ownerDocument.doctype.name)&&(Oe="<!DOCTYPE "+st.ownerDocument.doctype.name+`>
342
- `+Oe),Tt&&Ks([R,z,P],Ge=>{Oe=Ni(Oe,Ge," ")}),w&&le?w.createHTML(Oe):Oe},e.setConfig=function(){let St=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Bs(St),Gt=!0},e.clearConfig=function(){Cr=null,Gt=!1},e.isValidAttribute=function(St,q,st){Cr||Bs({});const ft=be(St),ie=be(q);return $s(ft,ie,st)},e.addHook=function(St,q){typeof q=="function"&&Qs(A[St],q)},e.removeHook=function(St,q){if(q!==void 0){const st=qM(A[St],q);return st===-1?void 0:WM(A[St],st,1)[0]}return Qm(A[St])},e.removeHooks=function(St){A[St]=[]},e.removeAllHooks=function(){A=ng()},e}var us=Hb(),Ub=/^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s,Eo=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,oI=/\s*%%.*\n/gm,Gi,Vb=(Gi=class extends Error{constructor(e){super(e),this.name="UnknownDiagramError"}},v(Gi,"UnknownDiagramError"),Gi),ai={},Tp=v(function(t,e){t=t.replace(Ub,"").replace(Eo,"").replace(oI,`
343
- `);for(const[r,{detector:n}]of Object.entries(ai))if(n(t,e))return r;throw new Vb(`No diagram type detected matching given configuration for text: ${t}`)},"detectType"),Mu=v((...t)=>{for(const{id:e,detector:r,loader:n}of t)Yb(e,r,n)},"registerLazyLoadedDiagrams"),Yb=v((t,e,r)=>{ai[t]&&rt.warn(`Detector with key ${t} already exists. Overwriting.`),ai[t]={detector:e,loader:r},rt.debug(`Detector with key ${t} added${r?" with loader":""}`)},"addDetector"),aI=v(t=>ai[t].loader,"getDiagramLoader"),Iu=v((t,e,{depth:r=2,clobber:n=!1}={})=>{const i={depth:r,clobber:n};return Array.isArray(e)&&!Array.isArray(t)?(e.forEach(s=>Iu(t,s,i)),t):Array.isArray(e)&&Array.isArray(t)?(e.forEach(s=>{t.includes(s)||t.push(s)}),t):t===void 0||r<=0?t!=null&&typeof t=="object"&&typeof e=="object"?Object.assign(t,e):e:(e!==void 0&&typeof t=="object"&&typeof e=="object"&&Object.keys(e).forEach(s=>{typeof e[s]=="object"&&e[s]!==null&&(t[s]===void 0||typeof t[s]=="object")?(t[s]===void 0&&(t[s]=Array.isArray(e[s])?[]:{}),t[s]=Iu(t[s],e[s],{depth:r-1,clobber:n})):(n||typeof t[s]!="object"&&typeof e[s]!="object")&&(t[s]=e[s])}),t)},"assignWithDepth"),Ne=Iu,Jr="#ffffff",tn="#f2f2f2",Bt=v((t,e)=>e?E(t,{s:-40,l:10}):E(t,{s:-40,l:-10}),"mkBorder"),Xi,lI=(Xi=class{constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.useGradient=!0,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){var r,n,i,s,o,a,c,h,u,d,f,p,m,x,g,y,k,b,w,_,T,S;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||E(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||E(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Bt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Bt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Bt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Bt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||V(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||V(this.tertiaryColor),this.lineColor=this.lineColor||V(this.background),this.arrowheadColor=this.arrowheadColor||V(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||K(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||V(this.lineColor),this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||Q(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||"navy",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.darkMode?(this.rowOdd=this.rowOdd||K(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||K(this.mainBkg,10)):(this.rowOdd=this.rowOdd||Q(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||Q(this.mainBkg,5)),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||E(this.primaryColor,{h:30}),this.cScale4=this.cScale4||E(this.primaryColor,{h:60}),this.cScale5=this.cScale5||E(this.primaryColor,{h:90}),this.cScale6=this.cScale6||E(this.primaryColor,{h:120}),this.cScale7=this.cScale7||E(this.primaryColor,{h:150}),this.cScale8=this.cScale8||E(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||E(this.primaryColor,{h:270}),this.cScale10=this.cScale10||E(this.primaryColor,{h:300}),this.cScale11=this.cScale11||E(this.primaryColor,{h:330}),this.darkMode)for(let L=0;L<this.THEME_COLOR_LIMIT;L++)this["cScale"+L]=K(this["cScale"+L],75);else for(let L=0;L<this.THEME_COLOR_LIMIT;L++)this["cScale"+L]=K(this["cScale"+L],25);for(let L=0;L<this.THEME_COLOR_LIMIT;L++)this["cScaleInv"+L]=this["cScaleInv"+L]||V(this["cScale"+L]);for(let L=0;L<this.THEME_COLOR_LIMIT;L++)this.darkMode?this["cScalePeer"+L]=this["cScalePeer"+L]||Q(this["cScale"+L],10):this["cScalePeer"+L]=this["cScalePeer"+L]||K(this["cScale"+L],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let L=0;L<this.THEME_COLOR_LIMIT;L++)this["cScaleLabel"+L]=this["cScaleLabel"+L]||this.scaleLabelColor;const e=this.darkMode?-4:-1;for(let L=0;L<5;L++)this["surface"+L]=this["surface"+L]||E(this.mainBkg,{h:180,s:-15,l:e*(5+L*3)}),this["surfacePeer"+L]=this["surfacePeer"+L]||E(this.mainBkg,{h:180,s:-15,l:e*(8+L*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||E(this.primaryColor,{h:64}),this.fillType3=this.fillType3||E(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||E(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||E(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||E(this.primaryColor,{h:128}),this.fillType7=this.fillType7||E(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||E(this.primaryColor,{l:-10}),this.pie5=this.pie5||E(this.secondaryColor,{l:-10}),this.pie6=this.pie6||E(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||E(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||E(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||E(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||E(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||E(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||E(this.primaryColor,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.venn1=this.venn1??E(this.primaryColor,{l:-30}),this.venn2=this.venn2??E(this.secondaryColor,{l:-30}),this.venn3=this.venn3??E(this.tertiaryColor,{l:-30}),this.venn4=this.venn4??E(this.primaryColor,{h:60,l:-30}),this.venn5=this.venn5??E(this.primaryColor,{h:-60,l:-30}),this.venn6=this.venn6??E(this.secondaryColor,{h:60,l:-30}),this.venn7=this.venn7??E(this.primaryColor,{h:120,l:-30}),this.venn8=this.venn8??E(this.secondaryColor,{h:120,l:-30}),this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.radar={axisColor:((r=this.radar)==null?void 0:r.axisColor)||this.lineColor,axisStrokeWidth:((n=this.radar)==null?void 0:n.axisStrokeWidth)||2,axisLabelFontSize:((i=this.radar)==null?void 0:i.axisLabelFontSize)||12,curveOpacity:((s=this.radar)==null?void 0:s.curveOpacity)||.5,curveStrokeWidth:((o=this.radar)==null?void 0:o.curveStrokeWidth)||2,graticuleColor:((a=this.radar)==null?void 0:a.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((c=this.radar)==null?void 0:c.graticuleStrokeWidth)||1,graticuleOpacity:((h=this.radar)==null?void 0:h.graticuleOpacity)||.3,legendBoxSize:((u=this.radar)==null?void 0:u.legendBoxSize)||12,legendFontSize:((d=this.radar)==null?void 0:d.legendFontSize)||12},this.archEdgeColor=this.archEdgeColor||"#777",this.archEdgeArrowColor=this.archEdgeArrowColor||"#777",this.archEdgeWidth=this.archEdgeWidth||"3",this.archGroupBorderColor=this.archGroupBorderColor||"#000",this.archGroupBorderWidth=this.archGroupBorderWidth||"2px",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||E(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||E(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||E(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||E(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||E(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||E(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Dr(this.quadrant1Fill)?Q(this.quadrant1Fill):K(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((f=this.xyChart)==null?void 0:f.backgroundColor)||this.background,titleColor:((p=this.xyChart)==null?void 0:p.titleColor)||this.primaryTextColor,dataLabelColor:((m=this.xyChart)==null?void 0:m.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((x=this.xyChart)==null?void 0:x.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((g=this.xyChart)==null?void 0:g.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((y=this.xyChart)==null?void 0:y.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((k=this.xyChart)==null?void 0:k.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((b=this.xyChart)==null?void 0:b.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((w=this.xyChart)==null?void 0:w.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((_=this.xyChart)==null?void 0:_.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((T=this.xyChart)==null?void 0:T.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((S=this.xyChart)==null?void 0:S.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||E(this.primaryColor,{h:-30}),this.git4=this.git4||E(this.primaryColor,{h:-60}),this.git5=this.git5||E(this.primaryColor,{h:-90}),this.git6=this.git6||E(this.primaryColor,{h:60}),this.git7=this.git7||E(this.primaryColor,{h:120}),this.darkMode?(this.git0=Q(this.git0,25),this.git1=Q(this.git1,25),this.git2=Q(this.git2,25),this.git3=Q(this.git3,25),this.git4=Q(this.git4,25),this.git5=Q(this.git5,25),this.git6=Q(this.git6,25),this.git7=Q(this.git7,25)):(this.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(this.git7,25)),this.gitInv0=this.gitInv0||V(this.git0),this.gitInv1=this.gitInv1||V(this.git1),this.gitInv2=this.gitInv2||V(this.git2),this.gitInv3=this.gitInv3||V(this.git3),this.gitInv4=this.gitInv4||V(this.git4),this.gitInv5=this.gitInv5||V(this.git5),this.gitInv6=this.gitInv6||V(this.git6),this.gitInv7=this.gitInv7||V(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Jr,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||tn,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(Xi,"Theme"),Xi),cI=v(t=>{const e=new lI;return e.calculate(t),e},"getThemeVariables"),Ki,hI=(Ki=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=Q(this.primaryColor,16),this.tertiaryColor=E(this.primaryColor,{h:-160}),this.primaryBorderColor=V(this.background),this.secondaryBorderColor=Bt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Bt(this.tertiaryColor,this.darkMode),this.primaryTextColor=V(this.primaryColor),this.secondaryTextColor=V(this.secondaryColor),this.tertiaryTextColor=V(this.tertiaryColor),this.lineColor=V(this.background),this.textColor=V(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=Q(V("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=Nn(255,255,255,.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.clusterBkg="#302F3D",this.sectionBkgColor=K("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=K(this.sectionBkgColor,10),this.taskBorderColor=Nn(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=Nn(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||Q(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||K(this.mainBkg,10),this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal"}updateColors(){var e,r,n,i,s,o,a,c,h,u,d,f,p,m,x,g,y,k,b,w,_,T;this.secondBkg=Q(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=Q(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.actorBorder,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.altSectionBkgColor=this.background,this.taskBkgColor=Q(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=V(this.doneTaskBkgColor),this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=E(this.primaryColor,{h:64}),this.fillType3=E(this.secondaryColor,{h:64}),this.fillType4=E(this.primaryColor,{h:-64}),this.fillType5=E(this.secondaryColor,{h:-64}),this.fillType6=E(this.primaryColor,{h:128}),this.fillType7=E(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||E(this.primaryColor,{h:30}),this.cScale4=this.cScale4||E(this.primaryColor,{h:60}),this.cScale5=this.cScale5||E(this.primaryColor,{h:90}),this.cScale6=this.cScale6||E(this.primaryColor,{h:120}),this.cScale7=this.cScale7||E(this.primaryColor,{h:150}),this.cScale8=this.cScale8||E(this.primaryColor,{h:210}),this.cScale9=this.cScale9||E(this.primaryColor,{h:270}),this.cScale10=this.cScale10||E(this.primaryColor,{h:300}),this.cScale11=this.cScale11||E(this.primaryColor,{h:330});for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["cScaleInv"+S]=this["cScaleInv"+S]||V(this["cScale"+S]);for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["cScalePeer"+S]=this["cScalePeer"+S]||Q(this["cScale"+S],10);for(let S=0;S<5;S++)this["surface"+S]=this["surface"+S]||E(this.mainBkg,{h:30,s:-30,l:-(-10+S*4)}),this["surfacePeer"+S]=this["surfacePeer"+S]||E(this.mainBkg,{h:30,s:-30,l:-(-7+S*4)});this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor);for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["cScaleLabel"+S]=this["cScaleLabel"+S]||this.scaleLabelColor;for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["pie"+S]=this["cScale"+S];this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.mainContrastColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.mainContrastColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7";for(let S=0;S<8;S++)this["venn"+(S+1)]=this["venn"+(S+1)]??Q(this["cScale"+S],30);this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||E(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||E(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||E(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||E(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||E(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||E(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Dr(this.quadrant1Fill)?Q(this.quadrant1Fill):K(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((e=this.xyChart)==null?void 0:e.backgroundColor)||this.background,titleColor:((r=this.xyChart)==null?void 0:r.titleColor)||this.primaryTextColor,dataLabelColor:((n=this.xyChart)==null?void 0:n.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((i=this.xyChart)==null?void 0:i.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((s=this.xyChart)==null?void 0:s.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((o=this.xyChart)==null?void 0:o.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((a=this.xyChart)==null?void 0:a.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((c=this.xyChart)==null?void 0:c.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((h=this.xyChart)==null?void 0:h.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((u=this.xyChart)==null?void 0:u.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((d=this.xyChart)==null?void 0:d.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((f=this.xyChart)==null?void 0:f.plotColorPalette)||"#3498db,#2ecc71,#e74c3c,#f1c40f,#bdc3c7,#ffffff,#34495e,#9b59b6,#1abc9c,#e67e22"},this.packet={startByteColor:this.primaryTextColor,endByteColor:this.primaryTextColor,labelColor:this.primaryTextColor,titleColor:this.primaryTextColor,blockStrokeColor:this.primaryTextColor,blockFillColor:this.background},this.radar={axisColor:((p=this.radar)==null?void 0:p.axisColor)||this.lineColor,axisStrokeWidth:((m=this.radar)==null?void 0:m.axisStrokeWidth)||2,axisLabelFontSize:((x=this.radar)==null?void 0:x.axisLabelFontSize)||12,curveOpacity:((g=this.radar)==null?void 0:g.curveOpacity)||.5,curveStrokeWidth:((y=this.radar)==null?void 0:y.curveStrokeWidth)||2,graticuleColor:((k=this.radar)==null?void 0:k.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((b=this.radar)==null?void 0:b.graticuleStrokeWidth)||1,graticuleOpacity:((w=this.radar)==null?void 0:w.graticuleOpacity)||.3,legendBoxSize:((_=this.radar)==null?void 0:_.legendBoxSize)||12,legendFontSize:((T=this.radar)==null?void 0:T.legendFontSize)||12},this.classText=this.primaryTextColor,this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=Q(this.secondaryColor,20),this.git1=Q(this.pie2||this.secondaryColor,20),this.git2=Q(this.pie3||this.tertiaryColor,20),this.git3=Q(this.pie4||E(this.primaryColor,{h:-30}),20),this.git4=Q(this.pie5||E(this.primaryColor,{h:-60}),20),this.git5=Q(this.pie6||E(this.primaryColor,{h:-90}),10),this.git6=Q(this.pie7||E(this.primaryColor,{h:60}),10),this.git7=Q(this.pie8||E(this.primaryColor,{h:120}),20),this.gitInv0=this.gitInv0||V(this.git0),this.gitInv1=this.gitInv1||V(this.git1),this.gitInv2=this.gitInv2||V(this.git2),this.gitInv3=this.gitInv3||V(this.git3),this.gitInv4=this.gitInv4||V(this.git4),this.gitInv5=this.gitInv5||V(this.git5),this.gitInv6=this.gitInv6||V(this.git6),this.gitInv7=this.gitInv7||V(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||V(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||V(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Q(this.background,12),this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||Q(this.background,2),this.nodeBorder=this.nodeBorder||"#999"}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(Ki,"Theme"),Ki),uI=v(t=>{const e=new hI;return e.calculate(t),e},"getThemeVariables"),Qi,dI=(Qi=class{constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=E(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=E(this.primaryColor,{h:-160}),this.primaryBorderColor=Bt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Bt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Bt(this.tertiaryColor,this.darkMode),this.primaryTextColor=V(this.primaryColor),this.secondaryTextColor=V(this.secondaryColor),this.tertiaryTextColor=V(this.tertiaryColor),this.lineColor=V(this.background),this.textColor=V(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.primaryBorderColor=Bt(this.primaryColor,this.darkMode),this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="rgba(232,232,232, 0.8)",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.clusterBkg="#FBFBFF",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.sectionBkgColor=Nn(102,102,255,.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="navy",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd="calculated",this.rowEven="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!1,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow(1px 2px 2px rgba(185, 185, 185, 1))",this.updateColors()}updateColors(){var e,r,n,i,s,o,a,c,h,u,d,f,p,m,x,g,y,k,b,w,_,T;this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||E(this.primaryColor,{h:30}),this.cScale4=this.cScale4||E(this.primaryColor,{h:60}),this.cScale5=this.cScale5||E(this.primaryColor,{h:90}),this.cScale6=this.cScale6||E(this.primaryColor,{h:120}),this.cScale7=this.cScale7||E(this.primaryColor,{h:150}),this.cScale8=this.cScale8||E(this.primaryColor,{h:210}),this.cScale9=this.cScale9||E(this.primaryColor,{h:270}),this.cScale10=this.cScale10||E(this.primaryColor,{h:300}),this.cScale11=this.cScale11||E(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||K(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||K(this.tertiaryColor,40);for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["cScale"+S]=K(this["cScale"+S],10),this["cScalePeer"+S]=this["cScalePeer"+S]||K(this["cScale"+S],25);for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["cScaleInv"+S]=this["cScaleInv"+S]||E(this["cScale"+S],{h:180});for(let S=0;S<5;S++)this["surface"+S]=this["surface"+S]||E(this.mainBkg,{h:30,l:-(5+S*5)}),this["surfacePeer"+S]=this["surfacePeer"+S]||E(this.mainBkg,{h:30,l:-(7+S*5)});if(this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor,this.labelTextColor!=="calculated"){this.cScaleLabel0=this.cScaleLabel0||V(this.labelTextColor),this.cScaleLabel3=this.cScaleLabel3||V(this.labelTextColor);for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["cScaleLabel"+S]=this["cScaleLabel"+S]||this.labelTextColor}this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.textColor,this.edgeLabelBackground=this.labelBackground,this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.signalColor=this.textColor,this.signalTextColor=this.textColor,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.rowOdd=this.rowOdd||Q(this.primaryColor,75)||"#ffffff",this.rowEven=this.rowEven||Q(this.primaryColor,1),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=E(this.primaryColor,{h:64}),this.fillType3=E(this.secondaryColor,{h:64}),this.fillType4=E(this.primaryColor,{h:-64}),this.fillType5=E(this.secondaryColor,{h:-64}),this.fillType6=E(this.primaryColor,{h:128}),this.fillType7=E(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||E(this.tertiaryColor,{l:-40}),this.pie4=this.pie4||E(this.primaryColor,{l:-10}),this.pie5=this.pie5||E(this.secondaryColor,{l:-30}),this.pie6=this.pie6||E(this.tertiaryColor,{l:-20}),this.pie7=this.pie7||E(this.primaryColor,{h:60,l:-20}),this.pie8=this.pie8||E(this.primaryColor,{h:-60,l:-40}),this.pie9=this.pie9||E(this.primaryColor,{h:120,l:-40}),this.pie10=this.pie10||E(this.primaryColor,{h:60,l:-40}),this.pie11=this.pie11||E(this.primaryColor,{h:-90,l:-40}),this.pie12=this.pie12||E(this.primaryColor,{h:120,l:-30}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.venn1=this.venn1??E(this.primaryColor,{l:-30}),this.venn2=this.venn2??E(this.secondaryColor,{l:-30}),this.venn3=this.venn3??E(this.tertiaryColor,{l:-40}),this.venn4=this.venn4??E(this.primaryColor,{h:60,l:-30}),this.venn5=this.venn5??E(this.primaryColor,{h:-60,l:-30}),this.venn6=this.venn6??E(this.secondaryColor,{h:60,l:-30}),this.venn7=this.venn7??E(this.primaryColor,{h:120,l:-30}),this.venn8=this.venn8??E(this.secondaryColor,{h:120,l:-30}),this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||E(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||E(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||E(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||E(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||E(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||E(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Dr(this.quadrant1Fill)?Q(this.quadrant1Fill):K(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.radar={axisColor:((e=this.radar)==null?void 0:e.axisColor)||this.lineColor,axisStrokeWidth:((r=this.radar)==null?void 0:r.axisStrokeWidth)||2,axisLabelFontSize:((n=this.radar)==null?void 0:n.axisLabelFontSize)||12,curveOpacity:((i=this.radar)==null?void 0:i.curveOpacity)||.5,curveStrokeWidth:((s=this.radar)==null?void 0:s.curveStrokeWidth)||2,graticuleColor:((o=this.radar)==null?void 0:o.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((a=this.radar)==null?void 0:a.graticuleStrokeWidth)||1,graticuleOpacity:((c=this.radar)==null?void 0:c.graticuleOpacity)||.3,legendBoxSize:((h=this.radar)==null?void 0:h.legendBoxSize)||12,legendFontSize:((u=this.radar)==null?void 0:u.legendFontSize)||12},this.xyChart={backgroundColor:((d=this.xyChart)==null?void 0:d.backgroundColor)||this.background,titleColor:((f=this.xyChart)==null?void 0:f.titleColor)||this.primaryTextColor,dataLabelColor:((p=this.xyChart)==null?void 0:p.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((m=this.xyChart)==null?void 0:m.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((x=this.xyChart)==null?void 0:x.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((g=this.xyChart)==null?void 0:g.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((y=this.xyChart)==null?void 0:y.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((k=this.xyChart)==null?void 0:k.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((b=this.xyChart)==null?void 0:b.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((w=this.xyChart)==null?void 0:w.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((_=this.xyChart)==null?void 0:_.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((T=this.xyChart)==null?void 0:T.plotColorPalette)||"#ECECFF,#8493A6,#FFC3A0,#DCDDE1,#B8E994,#D1A36F,#C3CDE6,#FFB6C1,#496078,#F8F3E3"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.labelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||E(this.primaryColor,{h:-30}),this.git4=this.git4||E(this.primaryColor,{h:-60}),this.git5=this.git5||E(this.primaryColor,{h:-90}),this.git6=this.git6||E(this.primaryColor,{h:60}),this.git7=this.git7||E(this.primaryColor,{h:120}),this.darkMode?(this.git0=Q(this.git0,25),this.git1=Q(this.git1,25),this.git2=Q(this.git2,25),this.git3=Q(this.git3,25),this.git4=Q(this.git4,25),this.git5=Q(this.git5,25),this.git6=Q(this.git6,25),this.git7=Q(this.git7,25)):(this.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(this.git7,25)),this.gitInv0=this.gitInv0||K(V(this.git0),25),this.gitInv1=this.gitInv1||V(this.git1),this.gitInv2=this.gitInv2||V(this.git2),this.gitInv3=this.gitInv3||V(this.git3),this.gitInv4=this.gitInv4||V(this.git4),this.gitInv5=this.gitInv5||V(this.git5),this.gitInv6=this.gitInv6||V(this.git6),this.gitInv7=this.gitInv7||V(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||V(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||V(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Jr,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||tn}calculate(e){if(Object.keys(this).forEach(n=>{this[n]==="calculated"&&(this[n]=void 0)}),typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(Qi,"Theme"),Qi),pI=v(t=>{const e=new dI;return e.calculate(t),e},"getThemeVariables"),Zi,fI=(Zi=class{constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=Q("#cde498",10),this.primaryBorderColor=Bt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Bt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Bt(this.tertiaryColor,this.darkMode),this.primaryTextColor=V(this.primaryColor),this.secondaryTextColor=V(this.secondaryColor),this.tertiaryTextColor=V(this.primaryColor),this.lineColor=V(this.background),this.textColor=V(this.background),this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.5))"}updateColors(){var e,r,n,i,s,o,a,c,h,u,d,f,p,m,x,g,y,k,b,w,_,T;this.actorBorder=K(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||E(this.primaryColor,{h:30}),this.cScale4=this.cScale4||E(this.primaryColor,{h:60}),this.cScale5=this.cScale5||E(this.primaryColor,{h:90}),this.cScale6=this.cScale6||E(this.primaryColor,{h:120}),this.cScale7=this.cScale7||E(this.primaryColor,{h:150}),this.cScale8=this.cScale8||E(this.primaryColor,{h:210}),this.cScale9=this.cScale9||E(this.primaryColor,{h:270}),this.cScale10=this.cScale10||E(this.primaryColor,{h:300}),this.cScale11=this.cScale11||E(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||K(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||K(this.tertiaryColor,40);for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["cScale"+S]=K(this["cScale"+S],10),this["cScalePeer"+S]=this["cScalePeer"+S]||K(this["cScale"+S],25);for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["cScaleInv"+S]=this["cScaleInv"+S]||E(this["cScale"+S],{h:180});this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor;for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["cScaleLabel"+S]=this["cScaleLabel"+S]||this.scaleLabelColor;for(let S=0;S<5;S++)this["surface"+S]=this["surface"+S]||E(this.mainBkg,{h:30,s:-30,l:-(5+S*5)}),this["surfacePeer"+S]=this["surfacePeer"+S]||E(this.mainBkg,{h:30,s:-30,l:-(8+S*5)});this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.taskBorderColor=this.border1,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.rowOdd=this.rowOdd||Q(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||Q(this.mainBkg,20),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=E(this.primaryColor,{h:64}),this.fillType3=E(this.secondaryColor,{h:64}),this.fillType4=E(this.primaryColor,{h:-64}),this.fillType5=E(this.secondaryColor,{h:-64}),this.fillType6=E(this.primaryColor,{h:128}),this.fillType7=E(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||E(this.primaryColor,{l:-30}),this.pie5=this.pie5||E(this.secondaryColor,{l:-30}),this.pie6=this.pie6||E(this.tertiaryColor,{h:40,l:-40}),this.pie7=this.pie7||E(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||E(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||E(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||E(this.primaryColor,{h:60,l:-50}),this.pie11=this.pie11||E(this.primaryColor,{h:-60,l:-50}),this.pie12=this.pie12||E(this.primaryColor,{h:120,l:-50}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.venn1=this.venn1??E(this.primaryColor,{l:-30}),this.venn2=this.venn2??E(this.secondaryColor,{l:-30}),this.venn3=this.venn3??E(this.tertiaryColor,{l:-30}),this.venn4=this.venn4??E(this.primaryColor,{h:60,l:-30}),this.venn5=this.venn5??E(this.primaryColor,{h:-60,l:-30}),this.venn6=this.venn6??E(this.secondaryColor,{h:60,l:-30}),this.venn7=this.venn7??E(this.primaryColor,{h:120,l:-30}),this.venn8=this.venn8??E(this.secondaryColor,{h:120,l:-30}),this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||E(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||E(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||E(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||E(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||E(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||E(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Dr(this.quadrant1Fill)?Q(this.quadrant1Fill):K(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.packet={startByteColor:this.primaryTextColor,endByteColor:this.primaryTextColor,labelColor:this.primaryTextColor,titleColor:this.primaryTextColor,blockStrokeColor:this.primaryTextColor,blockFillColor:this.mainBkg},this.radar={axisColor:((e=this.radar)==null?void 0:e.axisColor)||this.lineColor,axisStrokeWidth:((r=this.radar)==null?void 0:r.axisStrokeWidth)||2,axisLabelFontSize:((n=this.radar)==null?void 0:n.axisLabelFontSize)||12,curveOpacity:((i=this.radar)==null?void 0:i.curveOpacity)||.5,curveStrokeWidth:((s=this.radar)==null?void 0:s.curveStrokeWidth)||2,graticuleColor:((o=this.radar)==null?void 0:o.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((a=this.radar)==null?void 0:a.graticuleStrokeWidth)||1,graticuleOpacity:((c=this.radar)==null?void 0:c.graticuleOpacity)||.3,legendBoxSize:((h=this.radar)==null?void 0:h.legendBoxSize)||12,legendFontSize:((u=this.radar)==null?void 0:u.legendFontSize)||12},this.xyChart={backgroundColor:((d=this.xyChart)==null?void 0:d.backgroundColor)||this.background,titleColor:((f=this.xyChart)==null?void 0:f.titleColor)||this.primaryTextColor,dataLabelColor:((p=this.xyChart)==null?void 0:p.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((m=this.xyChart)==null?void 0:m.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((x=this.xyChart)==null?void 0:x.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((g=this.xyChart)==null?void 0:g.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((y=this.xyChart)==null?void 0:y.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((k=this.xyChart)==null?void 0:k.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((b=this.xyChart)==null?void 0:b.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((w=this.xyChart)==null?void 0:w.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((_=this.xyChart)==null?void 0:_.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((T=this.xyChart)==null?void 0:T.plotColorPalette)||"#CDE498,#FF6B6B,#A0D2DB,#D7BDE2,#F0F0F0,#FFC3A0,#7FD8BE,#FF9A8B,#FAF3E0,#FFF176"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||E(this.primaryColor,{h:-30}),this.git4=this.git4||E(this.primaryColor,{h:-60}),this.git5=this.git5||E(this.primaryColor,{h:-90}),this.git6=this.git6||E(this.primaryColor,{h:60}),this.git7=this.git7||E(this.primaryColor,{h:120}),this.darkMode?(this.git0=Q(this.git0,25),this.git1=Q(this.git1,25),this.git2=Q(this.git2,25),this.git3=Q(this.git3,25),this.git4=Q(this.git4,25),this.git5=Q(this.git5,25),this.git6=Q(this.git6,25),this.git7=Q(this.git7,25)):(this.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(this.git7,25)),this.gitInv0=this.gitInv0||V(this.git0),this.gitInv1=this.gitInv1||V(this.git1),this.gitInv2=this.gitInv2||V(this.git2),this.gitInv3=this.gitInv3||V(this.git3),this.gitInv4=this.gitInv4||V(this.git4),this.gitInv5=this.gitInv5||V(this.git5),this.gitInv6=this.gitInv6||V(this.git6),this.gitInv7=this.gitInv7||V(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||V(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||V(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Jr,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||tn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(Zi,"Theme"),Zi),mI=v(t=>{const e=new fI;return e.calculate(t),e},"getThemeVariables"),Ji,gI=(Ji=class{constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=Q(this.contrast,55),this.background="#ffffff",this.tertiaryColor=E(this.primaryColor,{h:-160}),this.primaryBorderColor=Bt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Bt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Bt(this.tertiaryColor,this.darkMode),this.primaryTextColor=V(this.primaryColor),this.secondaryTextColor=V(this.secondaryColor),this.tertiaryTextColor=V(this.tertiaryColor),this.lineColor=V(this.background),this.textColor=V(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor=this.actorBorder,this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.rowOdd=this.rowOdd||Q(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||"#f4f4f4",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){var e,r,n,i,s,o,a,c,h,u,d,f,p,m,x,g,y,k,b,w,_,T;this.secondBkg=Q(this.contrast,55),this.border2=this.contrast,this.actorBorder=Q(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.actorBorder,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["cScaleInv"+S]=this["cScaleInv"+S]||V(this["cScale"+S]);for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this.darkMode?this["cScalePeer"+S]=this["cScalePeer"+S]||Q(this["cScale"+S],10):this["cScalePeer"+S]=this["cScalePeer"+S]||K(this["cScale"+S],10);this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor),this.cScaleLabel0=this.cScaleLabel0||this.cScale1,this.cScaleLabel2=this.cScaleLabel2||this.cScale1;for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["cScaleLabel"+S]=this["cScaleLabel"+S]||this.scaleLabelColor;for(let S=0;S<5;S++)this["surface"+S]=this["surface"+S]||E(this.mainBkg,{l:-(5+S*5)}),this["surfacePeer"+S]=this["surfacePeer"+S]||E(this.mainBkg,{l:-(8+S*5)});this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.text,this.sectionBkgColor=Q(this.contrast,30),this.sectionBkgColor2=Q(this.contrast,30),this.taskBorderColor=K(this.contrast,10),this.taskBkgColor=this.contrast,this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor=this.text,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.gridColor=Q(this.border1,30),this.doneTaskBkgColor=this.done,this.doneTaskBorderColor=this.lineColor,this.critBkgColor=this.critical,this.critBorderColor=K(this.critBkgColor,10),this.todayLineColor=this.critBkgColor,this.vertLineColor=this.critBkgColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||"#000",this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f4f4f4",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.stateBorder=this.stateBorder||"#000",this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#222",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=E(this.primaryColor,{h:64}),this.fillType3=E(this.secondaryColor,{h:64}),this.fillType4=E(this.primaryColor,{h:-64}),this.fillType5=E(this.secondaryColor,{h:-64}),this.fillType6=E(this.primaryColor,{h:128}),this.fillType7=E(this.secondaryColor,{h:128});for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["pie"+S]=this["cScale"+S];this.pie12=this.pie0,this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7";for(let S=0;S<8;S++)this["venn"+(S+1)]=this["venn"+(S+1)]??this["cScale"+S];this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||E(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||E(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||E(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||E(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||E(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||E(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Dr(this.quadrant1Fill)?Q(this.quadrant1Fill):K(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((e=this.xyChart)==null?void 0:e.backgroundColor)||this.background,titleColor:((r=this.xyChart)==null?void 0:r.titleColor)||this.primaryTextColor,dataLabelColor:((n=this.xyChart)==null?void 0:n.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((i=this.xyChart)==null?void 0:i.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((s=this.xyChart)==null?void 0:s.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((o=this.xyChart)==null?void 0:o.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((a=this.xyChart)==null?void 0:a.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((c=this.xyChart)==null?void 0:c.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((h=this.xyChart)==null?void 0:h.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((u=this.xyChart)==null?void 0:u.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((d=this.xyChart)==null?void 0:d.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((f=this.xyChart)==null?void 0:f.plotColorPalette)||"#EEE,#6BB8E4,#8ACB88,#C7ACD6,#E8DCC2,#FFB2A8,#FFF380,#7E8D91,#FFD8B1,#FAF3E0"},this.radar={axisColor:((p=this.radar)==null?void 0:p.axisColor)||this.lineColor,axisStrokeWidth:((m=this.radar)==null?void 0:m.axisStrokeWidth)||2,axisLabelFontSize:((x=this.radar)==null?void 0:x.axisLabelFontSize)||12,curveOpacity:((g=this.radar)==null?void 0:g.curveOpacity)||.5,curveStrokeWidth:((y=this.radar)==null?void 0:y.curveStrokeWidth)||2,graticuleColor:((k=this.radar)==null?void 0:k.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((b=this.radar)==null?void 0:b.graticuleStrokeWidth)||1,graticuleOpacity:((w=this.radar)==null?void 0:w.graticuleOpacity)||.3,legendBoxSize:((_=this.radar)==null?void 0:_.legendBoxSize)||12,legendFontSize:((T=this.radar)==null?void 0:T.legendFontSize)||12},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=K(this.pie1,25)||this.primaryColor,this.git1=this.pie2||this.secondaryColor,this.git2=this.pie3||this.tertiaryColor,this.git3=this.pie4||E(this.primaryColor,{h:-30}),this.git4=this.pie5||E(this.primaryColor,{h:-60}),this.git5=this.pie6||E(this.primaryColor,{h:-90}),this.git6=this.pie7||E(this.primaryColor,{h:60}),this.git7=this.pie8||E(this.primaryColor,{h:120}),this.gitInv0=this.gitInv0||V(this.git0),this.gitInv1=this.gitInv1||V(this.git1),this.gitInv2=this.gitInv2||V(this.git2),this.gitInv3=this.gitInv3||V(this.git3),this.gitInv4=this.gitInv4||V(this.git4),this.gitInv5=this.gitInv5||V(this.git5),this.gitInv6=this.gitInv6||V(this.git6),this.gitInv7=this.gitInv7||V(this.git7),this.branchLabelColor=this.branchLabelColor||this.labelTextColor,this.gitBranchLabel0=this.branchLabelColor,this.gitBranchLabel1="white",this.gitBranchLabel2=this.branchLabelColor,this.gitBranchLabel3="white",this.gitBranchLabel4=this.branchLabelColor,this.gitBranchLabel5=this.branchLabelColor,this.gitBranchLabel6=this.branchLabelColor,this.gitBranchLabel7=this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Jr,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||tn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(Ji,"Theme"),Ji),xI=v(t=>{const e=new gI;return e.calculate(t),e},"getThemeVariables"),ts,yI=(ts=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=2,this.primaryBorderColor=Bt(this.primaryColor,this.darkMode),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.nodeBorder="#000000",this.stateBorder="#000000",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 0px 1px 2px rgba(0, 0, 0, 0.25));",this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){var s,o,a,c,h,u,d,f,p,m,x;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||E(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||E(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Bt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Bt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Bt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Bt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||V(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||V(this.tertiaryColor),this.lineColor=this.lineColor||V(this.background),this.arrowheadColor=this.arrowheadColor||V(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||K(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||V(this.lineColor);const e="#ECECFE",r="#E9E9F1",n=E(e,{h:180,l:5});if(this.sectionBkgColor=this.sectionBkgColor||n,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||e,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||e,this.activeTaskBorderColor=this.activeTaskBorderColor||e,this.activeTaskBkgColor=this.activeTaskBkgColor||Q(e,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||e,this.cScale1=this.cScale1||r,this.cScale2=this.cScale2||n,this.cScale3=this.cScale3||E(e,{h:30}),this.cScale4=this.cScale4||E(e,{h:60}),this.cScale5=this.cScale5||E(e,{h:90}),this.cScale6=this.cScale6||E(e,{h:120}),this.cScale7=this.cScale7||E(e,{h:150}),this.cScale8=this.cScale8||E(e,{h:210,l:150}),this.cScale9=this.cScale9||E(e,{h:270}),this.cScale10=this.cScale10||E(e,{h:300}),this.cScale11=this.cScale11||E(e,{h:330}),this.darkMode)for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=K(this["cScale"+g],75);else for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=K(this["cScale"+g],25);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleInv"+g]=this["cScaleInv"+g]||V(this["cScale"+g]);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this.darkMode?this["cScalePeer"+g]=this["cScalePeer"+g]||Q(this["cScale"+g],10):this["cScalePeer"+g]=this["cScalePeer"+g]||K(this["cScale"+g],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleLabel"+g]=this["cScaleLabel"+g]||this.scaleLabelColor;const i=this.darkMode?-4:-1;for(let g=0;g<5;g++)this["surface"+g]=this["surface"+g]||E(this.mainBkg,{h:180,s:-15,l:i*(5+g*3)}),this["surfacePeer"+g]=this["surfacePeer"+g]||E(this.mainBkg,{h:180,s:-15,l:i*(8+g*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||e,this.fillType1=this.fillType1||r,this.fillType2=this.fillType2||E(e,{h:64}),this.fillType3=this.fillType3||E(r,{h:64}),this.fillType4=this.fillType4||E(e,{h:-64}),this.fillType5=this.fillType5||E(r,{h:-64}),this.fillType6=this.fillType6||E(e,{h:128}),this.fillType7=this.fillType7||E(r,{h:128}),this.pie1=this.pie1||e,this.pie2=this.pie2||r,this.pie3=this.pie3||n,this.pie4=this.pie4||E(e,{l:-10}),this.pie5=this.pie5||E(r,{l:-10}),this.pie6=this.pie6||E(n,{l:-10}),this.pie7=this.pie7||E(e,{h:60,l:-10}),this.pie8=this.pie8||E(e,{h:-60,l:-10}),this.pie9=this.pie9||E(e,{h:120,l:0}),this.pie10=this.pie10||E(e,{h:60,l:-20}),this.pie11=this.pie11||E(e,{h:-60,l:-20}),this.pie12=this.pie12||E(e,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||e,this.quadrant2Fill=this.quadrant2Fill||E(e,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||E(e,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||E(e,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||E(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||E(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||E(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Dr(this.quadrant1Fill)?Q(this.quadrant1Fill):K(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((s=this.xyChart)==null?void 0:s.backgroundColor)||this.background,titleColor:((o=this.xyChart)==null?void 0:o.titleColor)||this.primaryTextColor,xAxisTitleColor:((a=this.xyChart)==null?void 0:a.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((c=this.xyChart)==null?void 0:c.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((h=this.xyChart)==null?void 0:h.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((u=this.xyChart)==null?void 0:u.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((d=this.xyChart)==null?void 0:d.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((f=this.xyChart)==null?void 0:f.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((p=this.xyChart)==null?void 0:p.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((m=this.xyChart)==null?void 0:m.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((x=this.xyChart)==null?void 0:x.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||e,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||e,this.git1=this.git1||r,this.git2=this.git2||n,this.git3=this.git3||E(e,{h:-30}),this.git4=this.git4||E(e,{h:-60}),this.git5=this.git5||E(e,{h:-90}),this.git6=this.git6||E(e,{h:60}),this.git7=this.git7||E(e,{h:120}),this.darkMode?(this.git0=Q(this.git0,25),this.git1=Q(this.git1,25),this.git2=Q(this.git2,25),this.git3=Q(this.git3,25),this.git4=Q(this.git4,25),this.git5=Q(this.git5,25),this.git6=Q(this.git6,25),this.git7=Q(this.git7,25)):(this.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(this.git7,25)),this.gitInv0=this.gitInv0||V(this.git0),this.gitInv1=this.gitInv1||V(this.git1),this.gitInv2=this.gitInv2||V(this.git2),this.gitInv3=this.gitInv3||V(this.git3),this.gitInv4=this.gitInv4||V(this.git4),this.gitInv5=this.gitInv5||V(this.git5),this.gitInv6=this.gitInv6||V(this.git6),this.gitInv7=this.gitInv7||V(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Jr,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||tn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(ts,"Theme"),ts),bI=v(t=>{const e=new yI;return e.calculate(t),e},"getThemeVariables"),es,CI=(es=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=Q(this.primaryColor,16),this.tertiaryColor=E(this.primaryColor,{h:-160}),this.primaryBorderColor=V(this.background),this.secondaryBorderColor=Bt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Bt(this.tertiaryColor,this.darkMode),this.primaryTextColor=V(this.primaryColor),this.secondaryTextColor=V(this.secondaryColor),this.tertiaryTextColor=V(this.tertiaryColor),this.mainBkg="#2a2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=Q(V("#323D47"),10),this.border1="#ccc",this.border2=Nn(255,255,255,.25),this.arrowheadColor=V(this.background),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=1,this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily="arial, sans-serif",this.fontSize="14px",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.2))",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){var r,n,i,s,o,a,c,h,u,d,f;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||E(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||E(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Bt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Bt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Bt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Bt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||V(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||V(this.tertiaryColor),this.lineColor=this.lineColor||V(this.background),this.arrowheadColor=this.arrowheadColor||V(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||K(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||V(this.lineColor),this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||Q(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||E(this.primaryColor,{h:30}),this.cScale4=this.cScale4||E(this.primaryColor,{h:60}),this.cScale5=this.cScale5||E(this.primaryColor,{h:90}),this.cScale6=this.cScale6||E(this.primaryColor,{h:120}),this.cScale7=this.cScale7||E(this.primaryColor,{h:150}),this.cScale8=this.cScale8||E(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||E(this.primaryColor,{h:270}),this.cScale10=this.cScale10||E(this.primaryColor,{h:300}),this.cScale11=this.cScale11||E(this.primaryColor,{h:330}),this.darkMode)for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScale"+p]=K(this["cScale"+p],75);else for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScale"+p]=K(this["cScale"+p],25);for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScaleInv"+p]=this["cScaleInv"+p]||V(this["cScale"+p]);for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this.darkMode?this["cScalePeer"+p]=this["cScalePeer"+p]||Q(this["cScale"+p],10):this["cScalePeer"+p]=this["cScalePeer"+p]||K(this["cScale"+p],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScaleLabel"+p]=this["cScaleLabel"+p]||this.scaleLabelColor;const e=this.darkMode?-4:-1;for(let p=0;p<5;p++)this["surface"+p]=this["surface"+p]||E(this.mainBkg,{h:180,s:-15,l:e*(5+p*3)}),this["surfacePeer"+p]=this["surfacePeer"+p]||E(this.mainBkg,{h:180,s:-15,l:e*(8+p*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||E(this.primaryColor,{h:64}),this.fillType3=this.fillType3||E(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||E(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||E(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||E(this.primaryColor,{h:128}),this.fillType7=this.fillType7||E(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||E(this.primaryColor,{l:-10}),this.pie5=this.pie5||E(this.secondaryColor,{l:-10}),this.pie6=this.pie6||E(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||E(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||E(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||E(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||E(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||E(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||E(this.primaryColor,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||E(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||E(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||E(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||E(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||E(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||E(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Dr(this.quadrant1Fill)?Q(this.quadrant1Fill):K(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((r=this.xyChart)==null?void 0:r.backgroundColor)||this.background,titleColor:((n=this.xyChart)==null?void 0:n.titleColor)||this.primaryTextColor,xAxisTitleColor:((i=this.xyChart)==null?void 0:i.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((s=this.xyChart)==null?void 0:s.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((o=this.xyChart)==null?void 0:o.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((a=this.xyChart)==null?void 0:a.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((c=this.xyChart)==null?void 0:c.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((h=this.xyChart)==null?void 0:h.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((u=this.xyChart)==null?void 0:u.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((d=this.xyChart)==null?void 0:d.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((f=this.xyChart)==null?void 0:f.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||"#0b0000",this.git1=this.git1||"#4d1037",this.git2=this.git2||"#3f5258",this.git3=this.git3||"#4f2f1b",this.git4=this.git4||"#6e0a0a",this.git5=this.git5||"#3b0048",this.git6=this.git6||"#995a01",this.git7=this.git7||"#154706",this.gitDarkMode=!0,this.gitDarkMode?(this.git0=Q(this.git0,25),this.git1=Q(this.git1,25),this.git2=Q(this.git2,25),this.git3=Q(this.git3,25),this.git4=Q(this.git4,25),this.git5=Q(this.git5,25),this.git6=Q(this.git6,25),this.git7=Q(this.git7,25)):(this.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(this.git7,25)),this.gitInv0=this.gitInv0||V(this.git0),this.gitInv1=this.gitInv1||V(this.git1),this.gitInv2=this.gitInv2||V(this.git2),this.gitInv3=this.gitInv3||V(this.git3),this.gitInv4=this.gitInv4||V(this.git4),this.gitInv5=this.gitInv5||V(this.git5),this.gitInv6=this.gitInv6||V(this.git6),this.gitInv7=this.gitInv7||V(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Jr,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||tn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(es,"Theme"),es),kI=v(t=>{const e=new CI;return e.calculate(t),e},"getThemeVariables"),rs,vI=(rs=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=Bt("#28253D",this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.clusterBkg="#F9F9FB",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.filterColor="#000000"}updateColors(){var s,o,a,c,h,u,d,f,p,m,x;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||E(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||E(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Bt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Bt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Bt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Bt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#FEF9C3",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||V(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||V(this.tertiaryColor),this.lineColor=this.lineColor||V(this.background),this.arrowheadColor=this.arrowheadColor||V(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.noteFontWeight=600,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||K(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||V(this.lineColor);const e="#ECECFE",r="#E9E9F1",n=E(e,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||n,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||e,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||e,this.activeTaskBorderColor=this.activeTaskBorderColor||e,this.activeTaskBkgColor=this.activeTaskBkgColor||Q(e,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.compositeTitleBackground="#F9F9FB",this.altBackground="#F9F9FB",this.stateEdgeLabelBackground="#FFFFFF",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor;for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=this.mainBkg;if(this.darkMode)for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=K(this["cScale"+g],75);else for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=K(this["cScale"+g],25);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleInv"+g]=this["cScaleInv"+g]||V(this["cScale"+g]);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this.darkMode?this["cScalePeer"+g]=this["cScalePeer"+g]||Q(this["cScale"+g],10):this["cScalePeer"+g]=this["cScalePeer"+g]||K(this["cScale"+g],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleLabel"+g]=this["cScaleLabel"+g]||this.scaleLabelColor;const i=this.darkMode?-4:-1;for(let g=0;g<5;g++)this["surface"+g]=this["surface"+g]||E(this.mainBkg,{h:180,s:-15,l:i*(5+g*3)}),this["surfacePeer"+g]=this["surfacePeer"+g]||E(this.mainBkg,{h:180,s:-15,l:i*(8+g*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||e,this.fillType1=this.fillType1||r,this.fillType2=this.fillType2||E(e,{h:64}),this.fillType3=this.fillType3||E(r,{h:64}),this.fillType4=this.fillType4||E(e,{h:-64}),this.fillType5=this.fillType5||E(r,{h:-64}),this.fillType6=this.fillType6||E(e,{h:128}),this.fillType7=this.fillType7||E(r,{h:128}),this.pie1=this.pie1||e,this.pie2=this.pie2||r,this.pie3=this.pie3||n,this.pie4=this.pie4||E(e,{l:-10}),this.pie5=this.pie5||E(r,{l:-10}),this.pie6=this.pie6||E(n,{l:-10}),this.pie7=this.pie7||E(e,{h:60,l:-10}),this.pie8=this.pie8||E(e,{h:-60,l:-10}),this.pie9=this.pie9||E(e,{h:120,l:0}),this.pie10=this.pie10||E(e,{h:60,l:-20}),this.pie11=this.pie11||E(e,{h:-60,l:-20}),this.pie12=this.pie12||E(e,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||e,this.quadrant2Fill=this.quadrant2Fill||E(e,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||E(e,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||E(e,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||E(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||E(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||E(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Dr(this.quadrant1Fill)?Q(this.quadrant1Fill):K(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((s=this.xyChart)==null?void 0:s.backgroundColor)||this.background,titleColor:((o=this.xyChart)==null?void 0:o.titleColor)||this.primaryTextColor,xAxisTitleColor:((a=this.xyChart)==null?void 0:a.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((c=this.xyChart)==null?void 0:c.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((h=this.xyChart)==null?void 0:h.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((u=this.xyChart)==null?void 0:u.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((d=this.xyChart)==null?void 0:d.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((f=this.xyChart)==null?void 0:f.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((p=this.xyChart)==null?void 0:p.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((m=this.xyChart)==null?void 0:m.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((x=this.xyChart)==null?void 0:x.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||e,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.requirementEdgeLabelBackground="#FFFFFF",this.git0=this.git0||e,this.git1=this.git1||r,this.git2=this.git2||n,this.git3=this.git3||E(e,{h:-30}),this.git4=this.git4||E(e,{h:-60}),this.git5=this.git5||E(e,{h:-90}),this.git6=this.git6||E(e,{h:60}),this.git7=this.git7||E(e,{h:120}),this.darkMode?(this.git0=Q(this.git0,25),this.git1=Q(this.git1,25),this.git2=Q(this.git2,25),this.git3=Q(this.git3,25),this.git4=Q(this.git4,25),this.git5=Q(this.git5,25),this.git6=Q(this.git6,25),this.git7=Q(this.git7,25)):(this.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(this.git7,25)),this.gitInv0=this.gitInv0||V(this.git0),this.gitInv1=this.gitInv1||V(this.git1),this.gitInv2=this.gitInv2||V(this.git2),this.gitInv3=this.gitInv3||V(this.git3),this.gitInv4=this.gitInv4||V(this.git4),this.gitInv5=this.gitInv5||V(this.git5),this.gitInv6=this.gitInv6||V(this.git6),this.gitInv7=this.gitInv7||V(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.commitLineColor=this.commitLineColor??"#BDBCCC",this.erEdgeLabelBackground="#FFFFFF",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Jr,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||tn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(rs,"Theme"),rs),wI=v(t=>{const e=new vI;return e.calculate(t),e},"getThemeVariables"),ns,SI=(ns=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=Q(this.primaryColor,16),this.tertiaryColor=E(this.primaryColor,{h:-160}),this.primaryBorderColor=V(this.background),this.secondaryBorderColor=Bt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Bt(this.tertiaryColor,this.darkMode),this.primaryTextColor=V(this.primaryColor),this.secondaryTextColor=V(this.secondaryColor),this.tertiaryTextColor=V(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=Q(V("#323D47"),10),this.border1="#ccc",this.border2=Nn(255,255,255,.25),this.arrowheadColor=V(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.filterColor="#FFFFFF"}updateColors(){var r,n,i,s,o,a,c,h,u,d,f;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||E(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||E(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Bt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Bt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Bt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Bt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||V(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||V(this.tertiaryColor),this.lineColor=this.lineColor||V(this.background),this.arrowheadColor=this.arrowheadColor||V(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||K(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||V(this.lineColor),this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||Q(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.compositeBackground="#16141F",this.altBackground="#16141F",this.compositeTitleBackground="#16141F",this.stateEdgeLabelBackground="#16141F",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||E(this.primaryColor,{h:30}),this.cScale4=this.cScale4||E(this.primaryColor,{h:60}),this.cScale5=this.cScale5||E(this.primaryColor,{h:90}),this.cScale6=this.cScale6||E(this.primaryColor,{h:120}),this.cScale7=this.cScale7||E(this.primaryColor,{h:150}),this.cScale8=this.cScale8||E(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||E(this.primaryColor,{h:270}),this.cScale10=this.cScale10||E(this.primaryColor,{h:300}),this.cScale11=this.cScale11||E(this.primaryColor,{h:330}),this.darkMode)for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScale"+p]=K(this["cScale"+p],75);else for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScale"+p]=K(this["cScale"+p],25);for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScaleInv"+p]=this["cScaleInv"+p]||V(this["cScale"+p]);for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this.darkMode?this["cScalePeer"+p]=this["cScalePeer"+p]||Q(this["cScale"+p],10):this["cScalePeer"+p]=this["cScalePeer"+p]||K(this["cScale"+p],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScaleLabel"+p]=this["cScaleLabel"+p]||this.scaleLabelColor;const e=this.darkMode?-4:-1;for(let p=0;p<5;p++)this["surface"+p]=this["surface"+p]||E(this.mainBkg,{h:180,s:-15,l:e*(5+p*3)}),this["surfacePeer"+p]=this["surfacePeer"+p]||E(this.mainBkg,{h:180,s:-15,l:e*(8+p*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||E(this.primaryColor,{h:64}),this.fillType3=this.fillType3||E(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||E(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||E(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||E(this.primaryColor,{h:128}),this.fillType7=this.fillType7||E(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||E(this.primaryColor,{l:-10}),this.pie5=this.pie5||E(this.secondaryColor,{l:-10}),this.pie6=this.pie6||E(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||E(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||E(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||E(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||E(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||E(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||E(this.primaryColor,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||E(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||E(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||E(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||E(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||E(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||E(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Dr(this.quadrant1Fill)?Q(this.quadrant1Fill):K(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((r=this.xyChart)==null?void 0:r.backgroundColor)||this.background,titleColor:((n=this.xyChart)==null?void 0:n.titleColor)||this.primaryTextColor,xAxisTitleColor:((i=this.xyChart)==null?void 0:i.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((s=this.xyChart)==null?void 0:s.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((o=this.xyChart)==null?void 0:o.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((a=this.xyChart)==null?void 0:a.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((c=this.xyChart)==null?void 0:c.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((h=this.xyChart)==null?void 0:h.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((u=this.xyChart)==null?void 0:u.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((d=this.xyChart)==null?void 0:d.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((f=this.xyChart)==null?void 0:f.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.requirementEdgeLabelBackground="#16141F",this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||E(this.primaryColor,{h:-30}),this.git4=this.git4||E(this.primaryColor,{h:-60}),this.git5=this.git5||E(this.primaryColor,{h:-90}),this.git6=this.git6||E(this.primaryColor,{h:60}),this.git7=this.git7||E(this.primaryColor,{h:120}),this.darkMode?(this.git0=Q(this.git0,25),this.git1=Q(this.git1,25),this.git2=Q(this.git2,25),this.git3=Q(this.git3,25),this.git4=Q(this.git4,25),this.git5=Q(this.git5,25),this.git6=Q(this.git6,25),this.git7=Q(this.git7,25)):(this.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(this.git7,25)),this.gitInv0=this.gitInv0||V(this.git0),this.gitInv1=this.gitInv1||V(this.git1),this.gitInv2=this.gitInv2||V(this.git2),this.gitInv3=this.gitInv3||V(this.git3),this.gitInv4=this.gitInv4||V(this.git4),this.gitInv5=this.gitInv5||V(this.git5),this.gitInv6=this.gitInv6||V(this.git6),this.gitInv7=this.gitInv7||V(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.commitLineColor=this.commitLineColor??"#BDBCCC",this.erEdgeLabelBackground="#16141F",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Jr,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||tn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(ns,"Theme"),ns),TI=v(t=>{const e=new SI;return e.calculate(t),e},"getThemeVariables"),is,_I=(is=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=Bt(this.primaryColor,this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=["#FDF4FF","#F0FDFA","#FFF7ED","#ECFEFF","#F0FDF4","#F5F3FF","#FEF2F2","#FEFCE8","#EEF2FF","#F7FEE7","#F0F9FF","#FFF1F2"],this.filterColor="#000000"}updateColors(){var s,o,a,c,h,u,d,f,p,m,x;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||E(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||E(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Bt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Bt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Bt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Bt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||V(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||V(this.tertiaryColor),this.lineColor=this.lineColor||V(this.background),this.arrowheadColor=this.arrowheadColor||V(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||K(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||V(this.lineColor);const e="#ECECFE",r="#E9E9F1",n=E(e,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||n,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||e,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||e,this.activeTaskBorderColor=this.activeTaskBorderColor||e,this.activeTaskBkgColor=this.activeTaskBkgColor||Q(e,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleInv"+g]=this["cScaleInv"+g]||V(this["cScale"+g]);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this.darkMode?this["cScalePeer"+g]=this["cScalePeer"+g]||Q(this["cScale"+g],10):this["cScalePeer"+g]=this["cScalePeer"+g]||K(this["cScale"+g],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleLabel"+g]=this["cScaleLabel"+g]||this.scaleLabelColor;const i=this.darkMode?-4:-1;for(let g=0;g<5;g++)this["surface"+g]=this["surface"+g]||E(this.mainBkg,{h:180,s:-15,l:i*(5+g*3)}),this["surfacePeer"+g]=this["surfacePeer"+g]||E(this.mainBkg,{h:180,s:-15,l:i*(8+g*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||e,this.fillType1=this.fillType1||r,this.fillType2=this.fillType2||E(e,{h:64}),this.fillType3=this.fillType3||E(r,{h:64}),this.fillType4=this.fillType4||E(e,{h:-64}),this.fillType5=this.fillType5||E(r,{h:-64}),this.fillType6=this.fillType6||E(e,{h:128}),this.fillType7=this.fillType7||E(r,{h:128}),this.pie1=this.pie1||e,this.pie2=this.pie2||r,this.pie3=this.pie3||n,this.pie4=this.pie4||E(e,{l:-10}),this.pie5=this.pie5||E(r,{l:-10}),this.pie6=this.pie6||E(n,{l:-10}),this.pie7=this.pie7||E(e,{h:60,l:-10}),this.pie8=this.pie8||E(e,{h:-60,l:-10}),this.pie9=this.pie9||E(e,{h:120,l:0}),this.pie10=this.pie10||E(e,{h:60,l:-20}),this.pie11=this.pie11||E(e,{h:-60,l:-20}),this.pie12=this.pie12||E(e,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||e,this.quadrant2Fill=this.quadrant2Fill||E(e,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||E(e,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||E(e,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||E(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||E(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||E(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Dr(this.quadrant1Fill)?Q(this.quadrant1Fill):K(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((s=this.xyChart)==null?void 0:s.backgroundColor)||this.background,titleColor:((o=this.xyChart)==null?void 0:o.titleColor)||this.primaryTextColor,xAxisTitleColor:((a=this.xyChart)==null?void 0:a.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((c=this.xyChart)==null?void 0:c.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((h=this.xyChart)==null?void 0:h.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((u=this.xyChart)==null?void 0:u.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((d=this.xyChart)==null?void 0:d.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((f=this.xyChart)==null?void 0:f.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((p=this.xyChart)==null?void 0:p.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((m=this.xyChart)==null?void 0:m.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((x=this.xyChart)==null?void 0:x.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||e,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||e,this.git1=this.git1||r,this.git2=this.git2||n,this.git3=this.git3||E(e,{h:-30}),this.git4=this.git4||E(e,{h:-60}),this.git5=this.git5||E(e,{h:-90}),this.git6=this.git6||E(e,{h:60}),this.git7=this.git7||E(e,{h:120}),this.darkMode?(this.git0=Q(this.git0,25),this.git1=Q(this.git1,25),this.git2=Q(this.git2,25),this.git3=Q(this.git3,25),this.git4=Q(this.git4,25),this.git5=Q(this.git5,25),this.git6=Q(this.git6,25),this.git7=Q(this.git7,25)):(this.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(this.git7,25)),this.gitInv0=this.gitInv0||V(this.git0),this.gitInv1=this.gitInv1||V(this.git1),this.gitInv2=this.gitInv2||V(this.git2),this.gitInv3=this.gitInv3||V(this.git3),this.gitInv4=this.gitInv4||V(this.git4),this.gitInv5=this.gitInv5||V(this.git5),this.gitInv6=this.gitInv6||V(this.git6),this.gitInv7=this.gitInv7||V(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLineColor=this.commitLineColor??"#BDBCCC",this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.fontWeight=600,this.erEdgeLabelBackground="#FFFFFF",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Jr,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||tn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(is,"Theme"),is),jI=v(t=>{const e=new _I;return e.calculate(t),e},"getThemeVariables"),ss,NI=(ss=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=Q(this.primaryColor,16),this.tertiaryColor=E(this.primaryColor,{h:-160}),this.primaryBorderColor=V(this.background),this.secondaryBorderColor=Bt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Bt(this.tertiaryColor,this.darkMode),this.primaryTextColor=V(this.primaryColor),this.secondaryTextColor=V(this.secondaryColor),this.tertiaryTextColor=V(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=Q(V("#323D47"),10),this.border1="#ccc",this.border2=Nn(255,255,255,.25),this.arrowheadColor=V(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=[],this.filterColor="#FFFFFF"}updateColors(){var r,n,i,s,o,a,c,h,u,d,f;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||E(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||E(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Bt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Bt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Bt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Bt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||V(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||V(this.tertiaryColor),this.lineColor=this.lineColor||V(this.background),this.arrowheadColor=this.arrowheadColor||V(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||K(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||V(this.lineColor),this.rootLabelColor="#FFFFFF",this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||Q(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScaleInv"+p]=this["cScaleInv"+p]||V(this["cScale"+p]);for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this.darkMode?this["cScalePeer"+p]=this["cScalePeer"+p]||Q(this["cScale"+p],10):this["cScalePeer"+p]=this["cScalePeer"+p]||K(this["cScale"+p],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScaleLabel"+p]=K(this["cScale"+p],75);const e=this.darkMode?-4:-1;for(let p=0;p<5;p++)this["surface"+p]=this["surface"+p]||E(this.mainBkg,{h:180,s:-15,l:e*(5+p*3)}),this["surfacePeer"+p]=this["surfacePeer"+p]||E(this.mainBkg,{h:180,s:-15,l:e*(8+p*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||E(this.primaryColor,{h:64}),this.fillType3=this.fillType3||E(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||E(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||E(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||E(this.primaryColor,{h:128}),this.fillType7=this.fillType7||E(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||E(this.primaryColor,{l:-10}),this.pie5=this.pie5||E(this.secondaryColor,{l:-10}),this.pie6=this.pie6||E(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||E(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||E(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||E(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||E(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||E(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||E(this.primaryColor,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||E(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||E(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||E(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||E(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||E(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||E(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Dr(this.quadrant1Fill)?Q(this.quadrant1Fill):K(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((r=this.xyChart)==null?void 0:r.backgroundColor)||this.background,titleColor:((n=this.xyChart)==null?void 0:n.titleColor)||this.primaryTextColor,xAxisTitleColor:((i=this.xyChart)==null?void 0:i.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((s=this.xyChart)==null?void 0:s.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((o=this.xyChart)==null?void 0:o.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((a=this.xyChart)==null?void 0:a.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((c=this.xyChart)==null?void 0:c.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((h=this.xyChart)==null?void 0:h.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((u=this.xyChart)==null?void 0:u.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((d=this.xyChart)==null?void 0:d.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((f=this.xyChart)==null?void 0:f.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?K(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||E(this.primaryColor,{h:-30}),this.git4=this.git4||E(this.primaryColor,{h:-60}),this.git5=this.git5||E(this.primaryColor,{h:-90}),this.git6=this.git6||E(this.primaryColor,{h:60}),this.git7=this.git7||E(this.primaryColor,{h:120}),this.darkMode?(this.git0=Q(this.git0,25),this.git1=Q(this.git1,25),this.git2=Q(this.git2,25),this.git3=Q(this.git3,25),this.git4=Q(this.git4,25),this.git5=Q(this.git5,25),this.git6=Q(this.git6,25),this.git7=Q(this.git7,25)):(this.git0=K(this.git0,25),this.git1=K(this.git1,25),this.git2=K(this.git2,25),this.git3=K(this.git3,25),this.git4=K(this.git4,25),this.git5=K(this.git5,25),this.git6=K(this.git6,25),this.git7=K(this.git7,25)),this.gitInv0=this.gitInv0||V(this.git0),this.gitInv1=this.gitInv1||V(this.git1),this.gitInv2=this.gitInv2||V(this.git2),this.gitInv3=this.gitInv3||V(this.git3),this.gitInv4=this.gitInv4||V(this.git4),this.gitInv5=this.gitInv5||V(this.git5),this.gitInv6=this.gitInv6||V(this.git6),this.gitInv7=this.gitInv7||V(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.commitLineColor=this.commitLineColor??"#BDBCCC",this.fontWeight=600,this.erEdgeLabelBackground="#16141F",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Jr,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||tn}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(ss,"Theme"),ss),EI=v(t=>{const e=new NI;return e.calculate(t),e},"getThemeVariables"),cn={base:{getThemeVariables:cI},dark:{getThemeVariables:uI},default:{getThemeVariables:pI},forest:{getThemeVariables:mI},neutral:{getThemeVariables:xI},neo:{getThemeVariables:bI},"neo-dark":{getThemeVariables:kI},redux:{getThemeVariables:wI},"redux-dark":{getThemeVariables:TI},"redux-color":{getThemeVariables:jI},"redux-dark-color":{getThemeVariables:EI}},pr={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:null,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200,inheritDir:!1},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,maxLabelWidth:360,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],titleColor:"",titleFontFamily:'"trebuchet ms", verdana, arial, sans-serif',titleFontSize:"4ex"},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,nodeSpacing:140,rankSpacing:80,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:.75},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showDataLabel:!1,showDataLabelOutsideBar:!1,showTitle:!0,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200,layoutAlgorithm:"cose-bilkent"},ishikawa:{useMaxWidth:!0,diagramPadding:20},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:""},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},treeView:{useMaxWidth:!0,rowIndent:10,paddingX:5,paddingY:5,lineThickness:1},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16,randomize:!1},radar:{useMaxWidth:!0,width:600,height:600,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,axisScaleFactor:1,axisLabelFactor:1.05,curveTension:.17},venn:{useMaxWidth:!0,width:800,height:450,padding:8,useDebugLayout:!1},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:5e4,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1},Gb={...pr,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES"},themeCSS:void 0,themeVariables:cn.default.getThemeVariables(),sequence:{...pr.sequence,messageFont:v(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:v(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:v(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{hideEmptyMembersBox:!1},gantt:{...pr.gantt,tickInterval:void 0,useWidth:void 0},c4:{...pr.c4,useWidth:void 0,personFont:v(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...pr.flowchart,inheritDir:!1},external_personFont:v(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:v(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:v(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:v(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:v(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:v(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:v(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:v(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:v(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:v(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:v(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:v(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:v(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:v(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:v(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:v(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:v(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:v(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:v(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:v(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:v(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...pr.pie,useWidth:984},xyChart:{...pr.xyChart,useWidth:void 0},requirement:{...pr.requirement,useWidth:void 0},packet:{...pr.packet},treeView:{...pr.treeView,useWidth:void 0},radar:{...pr.radar},ishikawa:{...pr.ishikawa},treemap:{useMaxWidth:!0,padding:10,diagramPadding:8,showValues:!0,nodeWidth:100,nodeHeight:40,borderWidth:1,valueFontSize:12,labelFontSize:14,valueFormat:","},venn:{...pr.venn}},Xb=v((t,e="")=>Object.keys(t).reduce((r,n)=>Array.isArray(t[n])?r:typeof t[n]=="object"&&t[n]!==null?[...r,e+n,...Xb(t[n],"")]:[...r,e+n],[]),"keyify"),LI=new Set(Xb(Gb,"")),Kb=Gb,Bl=v(t=>{if(rt.debug("sanitizeDirective called with",t),!(typeof t!="object"||t==null)){if(Array.isArray(t)){t.forEach(e=>Bl(e));return}for(const e of Object.keys(t)){if(rt.debug("Checking key",e),e.startsWith("__")||e.includes("proto")||e.includes("constr")||!LI.has(e)||t[e]==null){rt.debug("sanitize deleting key: ",e),delete t[e];continue}if(typeof t[e]=="object"){rt.debug("sanitizing object",e),Bl(t[e]);continue}const r=["themeCSS","fontFamily","altFontFamily"];for(const n of r)e.includes(n)&&(rt.debug("sanitizing css option",e),t[e]=BI(t[e]))}if(t.themeVariables)for(const e of Object.keys(t.themeVariables)){const r=t.themeVariables[e];r!=null&&r.match&&!r.match(/^[\d "#%(),.;A-Za-z]+$/)&&(t.themeVariables[e]="")}rt.debug("After sanitization",t)}},"sanitizeDirective"),BI=v(t=>{let e=0,r=0;for(const n of t){if(e<r)return"{ /* ERROR: Unbalanced CSS */ }";n==="{"?e++:n==="}"&&r++}return e!==r?"{ /* ERROR: Unbalanced CSS */ }":t},"sanitizeCss"),ds=Object.freeze(Kb),gn=v(t=>!(t===!1||["false","null","0"].includes(String(t).trim().toLowerCase())),"evaluate"),sr=Ne({},ds),Al,li=[],Lo=Ne({},ds),Ac=v((t,e)=>{let r=Ne({},t),n={};for(const i of e)Jb(i),n=Ne(n,i);if(r=Ne(r,n),n.theme&&n.theme in cn){const i=Ne({},Al),s=Ne(i.themeVariables||{},n.themeVariables);r.theme&&r.theme in cn&&(r.themeVariables=cn[r.theme].getThemeVariables(s))}return Lo=r,e1(Lo),Lo},"updateCurrentConfig"),AI=v(t=>(sr=Ne({},ds),sr=Ne(sr,t),t.theme&&cn[t.theme]&&(sr.themeVariables=cn[t.theme].getThemeVariables(t.themeVariables)),Ac(sr,li),sr),"setSiteConfig"),MI=v(t=>{Al=Ne({},t)},"saveConfigFromInitialize"),II=v(t=>(sr=Ne(sr,t),Ac(sr,li),sr),"updateSiteConfig"),Qb=v(()=>Ne({},sr),"getSiteConfig"),Zb=v(t=>(e1(t),Ne(Lo,t),me()),"setConfig"),me=v(()=>Ne({},Lo),"getConfig"),Jb=v(t=>{t&&(["secure",...sr.secure??[]].forEach(e=>{Object.hasOwn(t,e)&&(rt.debug(`Denied attempt to modify a secure key ${e}`,t[e]),delete t[e])}),Object.keys(t).forEach(e=>{e.startsWith("__")&&delete t[e]}),Object.keys(t).forEach(e=>{typeof t[e]=="string"&&(t[e].includes("<")||t[e].includes(">")||t[e].includes("url(data:"))&&delete t[e],typeof t[e]=="object"&&Jb(t[e])}))},"sanitize"),FI=v(t=>{var e;Bl(t),t.fontFamily&&!((e=t.themeVariables)!=null&&e.fontFamily)&&(t.themeVariables={...t.themeVariables,fontFamily:t.fontFamily}),li.push(t),Ac(sr,li)},"addDirective"),Ml=v((t=sr)=>{li=[],Ac(t,li)},"reset"),PI={LAZY_LOAD_DEPRECATED:"The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead.",FLOWCHART_HTML_LABELS_DEPRECATED:"flowchart.htmlLabels is deprecated. Please use global htmlLabels instead."},ig={},t1=v(t=>{ig[t]||(rt.warn(PI[t]),ig[t]=!0)},"issueWarning"),e1=v(t=>{t&&(t.lazyLoadedDiagrams||t.loadExternalDiagramsAtStartup)&&t1("LAZY_LOAD_DEPRECATED")},"checkConfig"),gK=v(()=>{let t={};Al&&(t=Ne(t,Al));for(const e of li)t=Ne(t,e);return t},"getUserDefinedConfig"),er=v(t=>{var e,r;return((e=t.flowchart)==null?void 0:e.htmlLabels)!=null&&t1("FLOWCHART_HTML_LABELS_DEPRECATED"),gn(t.htmlLabels??((r=t.flowchart)==null?void 0:r.htmlLabels)??!0)},"getEffectiveHtmlLabels"),la=/<br\s*\/?>/gi,$I=v(t=>t?i1(t).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),DI=(()=>{let t=!1;return()=>{t||(r1(),t=!0)}})();function r1(){const t="data-temp-href-target";us.addHook("beforeSanitizeAttributes",e=>{e.tagName==="A"&&e.hasAttribute("target")&&e.setAttribute(t,e.getAttribute("target")??"")}),us.addHook("afterSanitizeAttributes",e=>{e.tagName==="A"&&e.hasAttribute(t)&&(e.setAttribute("target",e.getAttribute(t)??""),e.removeAttribute(t),e.getAttribute("target")==="_blank"&&e.setAttribute("rel","noopener"))})}v(r1,"setupDompurifyHooks");var n1=v(t=>(DI(),us.sanitize(t)),"removeScript"),sg=v((t,e)=>{if(er(e)){const r=e.securityLevel;r==="antiscript"||r==="strict"||r==="sandbox"?t=n1(t):r!=="loose"&&(t=i1(t),t=t.replace(/</g,"&lt;").replace(/>/g,"&gt;"),t=t.replace(/=/g,"&equals;"),t=qI(t))}return t},"sanitizeMore"),$r=v((t,e)=>t&&(e.dompurifyConfig?t=us.sanitize(sg(t,e),e.dompurifyConfig).toString():t=us.sanitize(sg(t,e),{FORBID_TAGS:["style"]}).toString(),t),"sanitizeText"),OI=v((t,e)=>typeof t=="string"?$r(t,e):t.flat().map(r=>$r(r,e)),"sanitizeTextOrArray"),RI=v(t=>la.test(t),"hasBreaks"),zI=v(t=>t.split(la),"splitBreaks"),qI=v(t=>t.replace(/#br#/g,"<br/>"),"placeholderToBreak"),i1=v(t=>t.replace(la,"#br#"),"breakToPlaceholder"),WI=v(t=>{let e="";return t&&(e=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,e=CSS.escape(e)),e},"getUrl"),HI=v(function(...t){const e=t.filter(r=>!isNaN(r));return Math.max(...e)},"getMax"),UI=v(function(...t){const e=t.filter(r=>!isNaN(r));return Math.min(...e)},"getMin"),og=v(function(t){const e=t.split(/(,)/),r=[];for(let n=0;n<e.length;n++){let i=e[n];if(i===","&&n>0&&n+1<e.length){const s=e[n-1],o=e[n+1];VI(s,o)&&(i=s+","+o,n++,r.pop())}r.push(YI(i))}return r.join("")},"parseGenericTypes"),Fu=v((t,e)=>Math.max(0,t.split(e).length-1),"countOccurrence"),VI=v((t,e)=>{const r=Fu(t,"~"),n=Fu(e,"~");return r===1&&n===1},"shouldCombineSets"),YI=v(t=>{const e=Fu(t,"~");let r=!1;if(e<=1)return t;e%2!==0&&t.startsWith("~")&&(t=t.substring(1),r=!0);const n=[...t];let i=n.indexOf("~"),s=n.lastIndexOf("~");for(;i!==-1&&s!==-1&&i!==s;)n[i]="<",n[s]=">",i=n.indexOf("~"),s=n.lastIndexOf("~");return r&&n.unshift("~"),n.join("")},"processSet"),ag=v(()=>window.MathMLElement!==void 0,"isMathMLSupported"),Pu=/\$\$(.*)\$\$/g,Ro=v(t=>{var e;return(((e=t.match(Pu))==null?void 0:e.length)??0)>0},"hasKatex"),xK=v(async(t,e)=>{const r=document.createElement("div");r.innerHTML=await s1(t,e),r.id="katex-temp",r.style.visibility="hidden",r.style.position="absolute",r.style.top="0";const n=document.querySelector("body");n==null||n.insertAdjacentElement("beforeend",r);const i={width:r.clientWidth,height:r.clientHeight};return r.remove(),i},"calculateMathMLDimensions"),GI=v(async(t,e)=>{if(!Ro(t))return t;if(!(ag()||e.legacyMathML||e.forceLegacyMathML))return t.replace(Pu,"MathML is unsupported in this environment.");{const{default:r}=await Ht(async()=>{const{default:i}=await import("./katex-DkKDou_j.js");return{default:i}},[]),n=e.forceLegacyMathML||!ag()&&e.legacyMathML?"htmlAndMathml":"mathml";return t.split(la).map(i=>Ro(i)?`<div style="display: flex; align-items: center; justify-content: center; white-space: nowrap;">${i}</div>`:`<div>${i}</div>`).join("").replace(Pu,(i,s)=>r.renderToString(s,{throwOnError:!0,displayMode:!0,output:n}).replace(/\n/g," ").replace(/<annotation.*<\/annotation>/g,""))}},"renderKatexUnsanitized"),s1=v(async(t,e)=>$r(await GI(t,e),e),"renderKatexSanitized"),ca={getRows:$I,sanitizeText:$r,sanitizeTextOrArray:OI,hasBreaks:RI,splitBreaks:zI,lineBreakRegex:la,removeScript:n1,getUrl:WI,evaluate:gn,getMax:HI,getMin:UI},XI=v(function(t,e){for(let r of e)t.attr(r[0],r[1])},"d3Attrs"),KI=v(function(t,e,r){let n=new Map;return r?(n.set("width","100%"),n.set("style",`max-width: ${e}px;`)):(n.set("height",t),n.set("width",e)),n},"calculateSvgSizeAttrs"),o1=v(function(t,e,r,n){const i=KI(e,r,n);XI(t,i)},"configureSvgSize"),QI=v(function(t,e,r,n){const i=e.node().getBBox(),s=i.width,o=i.height;rt.info(`SVG bounds: ${s}x${o}`,i);let a=0,c=0;rt.info(`Graph bounds: ${a}x${c}`,t),a=s+r*2,c=o+r*2,rt.info(`Calculated bounds: ${a}x${c}`),o1(e,c,a,n);const h=`${i.x-r} ${i.y-r} ${i.width+2*r} ${i.height+2*r}`;e.attr("viewBox",h)},"setupGraphViewbox"),sl={},ZI=v((t,e,r,n)=>{let i="";return t in sl&&sl[t]?i=sl[t]({...r,svgId:n}):rt.warn(`No theme found for ${t}`),` & {
344
- font-family: ${r.fontFamily};
345
- font-size: ${r.fontSize};
346
- fill: ${r.textColor}
347
- }
348
- @keyframes edge-animation-frame {
349
- from {
350
- stroke-dashoffset: 0;
351
- }
352
- }
353
- @keyframes dash {
354
- to {
355
- stroke-dashoffset: 0;
356
- }
357
- }
358
- & .edge-animation-slow {
359
- stroke-dasharray: 9,5 !important;
360
- stroke-dashoffset: 900;
361
- animation: dash 50s linear infinite;
362
- stroke-linecap: round;
363
- }
364
- & .edge-animation-fast {
365
- stroke-dasharray: 9,5 !important;
366
- stroke-dashoffset: 900;
367
- animation: dash 20s linear infinite;
368
- stroke-linecap: round;
369
- }
370
- /* Classes common for multiple diagrams */
371
-
372
- & .error-icon {
373
- fill: ${r.errorBkgColor};
374
- }
375
- & .error-text {
376
- fill: ${r.errorTextColor};
377
- stroke: ${r.errorTextColor};
378
- }
379
-
380
- & .edge-thickness-normal {
381
- stroke-width: ${r.strokeWidth??1}px;
382
- }
383
- & .edge-thickness-thick {
384
- stroke-width: 3.5px
385
- }
386
- & .edge-pattern-solid {
387
- stroke-dasharray: 0;
388
- }
389
- & .edge-thickness-invisible {
390
- stroke-width: 0;
391
- fill: none;
392
- }
393
- & .edge-pattern-dashed{
394
- stroke-dasharray: 3;
395
- }
396
- .edge-pattern-dotted {
397
- stroke-dasharray: 2;
398
- }
399
-
400
- & .marker {
401
- fill: ${r.lineColor};
402
- stroke: ${r.lineColor};
403
- }
404
- & .marker.cross {
405
- stroke: ${r.lineColor};
406
- }
407
-
408
- & svg {
409
- font-family: ${r.fontFamily};
410
- font-size: ${r.fontSize};
411
- }
412
- & p {
413
- margin: 0
414
- }
415
-
416
- ${i}
417
- .node .neo-node {
418
- stroke: ${r.nodeBorder};
419
- }
420
-
421
- [data-look="neo"].node rect, [data-look="neo"].cluster rect, [data-look="neo"].node polygon {
422
- stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
423
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
424
- }
425
-
426
-
427
- [data-look="neo"].node path {
428
- stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
429
- stroke-width: ${r.strokeWidth??1}px;
430
- }
431
-
432
- [data-look="neo"].node .outer-path {
433
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
434
- }
435
-
436
- [data-look="neo"].node .neo-line path {
437
- stroke: ${r.nodeBorder};
438
- filter: none;
439
- }
440
-
441
- [data-look="neo"].node circle{
442
- stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
443
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
444
- }
445
-
446
- [data-look="neo"].node circle .state-start{
447
- fill: #000000;
448
- }
449
-
450
- [data-look="neo"].icon-shape .icon {
451
- fill: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
452
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
453
- }
454
-
455
- [data-look="neo"].icon-shape .icon-neo path {
456
- stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
457
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
458
- }
459
-
460
- ${e}
461
- `},"getStyles"),JI=v((t,e)=>{e!==void 0&&(sl[t]=e)},"addStylesForDiagram"),t4=ZI,a1={};BM(a1,{clear:()=>e4,getAccDescription:()=>s4,getAccTitle:()=>n4,getDiagramTitle:()=>a4,setAccDescription:()=>i4,setAccTitle:()=>r4,setDiagramTitle:()=>o4});var _p="",jp="",Np="",Ep=v(t=>$r(t,me()),"sanitizeText"),e4=v(()=>{_p="",Np="",jp=""},"clear"),r4=v(t=>{_p=Ep(t).replace(/^\s+/g,"")},"setAccTitle"),n4=v(()=>_p,"getAccTitle"),i4=v(t=>{Np=Ep(t).replace(/\n\s+/g,`
462
- `)},"setAccDescription"),s4=v(()=>Np,"getAccDescription"),o4=v(t=>{jp=Ep(t)},"setDiagramTitle"),a4=v(()=>jp,"getDiagramTitle"),lg=rt,l4=Sp,Vt=me,yK=Zb,bK=ds,Lp=v(t=>$r(t,Vt()),"sanitizeText"),c4=QI,h4=v(()=>a1,"getCommonDb"),Il={},Fl=v((t,e,r)=>{var n;Il[t]&&lg.warn(`Diagram with id ${t} already registered. Overwriting.`),Il[t]=e,r&&Yb(t,r),JI(t,e.styles),(n=e.injectUtils)==null||n.call(e,lg,l4,Vt,Lp,c4,h4(),()=>{})},"registerDiagram"),$u=v(t=>{if(t in Il)return Il[t];throw new u4(t)},"getDiagram"),os,u4=(os=class extends Error{constructor(e){super(`Diagram ${e} not found.`)}},v(os,"DiagramNotFoundError"),os),d4={value:()=>{}};function l1(){for(var t=0,e=arguments.length,r={},n;t<e;++t){if(!(n=arguments[t]+"")||n in r||/[\s.]/.test(n))throw new Error("illegal type: "+n);r[n]=[]}return new ol(r)}function ol(t){this._=t}function p4(t,e){return t.trim().split(/^|\s+/).map(function(r){var n="",i=r.indexOf(".");if(i>=0&&(n=r.slice(i+1),r=r.slice(0,i)),r&&!e.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}ol.prototype=l1.prototype={constructor:ol,on:function(t,e){var r=this._,n=p4(t+"",r),i,s=-1,o=n.length;if(arguments.length<2){for(;++s<o;)if((i=(t=n[s]).type)&&(i=f4(r[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<o;)if(i=(t=n[s]).type)r[i]=cg(r[i],t.name,e);else if(e==null)for(i in r)r[i]=cg(r[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new ol(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var r=new Array(i),n=0,i,s;n<i;++n)r[n]=arguments[n+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=this._[t],n=0,i=s.length;n<i;++n)s[n].value.apply(e,r)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],i=0,s=n.length;i<s;++i)n[i].value.apply(e,r)}};function f4(t,e){for(var r=0,n=t.length,i;r<n;++r)if((i=t[r]).name===e)return i.value}function cg(t,e,r){for(var n=0,i=t.length;n<i;++n)if(t[n].name===e){t[n]=d4,t=t.slice(0,n).concat(t.slice(n+1));break}return r!=null&&t.push({name:e,value:r}),t}var Du="http://www.w3.org/1999/xhtml";const hg={svg:"http://www.w3.org/2000/svg",xhtml:Du,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Mc(t){var e=t+="",r=e.indexOf(":");return r>=0&&(e=t.slice(0,r))!=="xmlns"&&(t=t.slice(r+1)),hg.hasOwnProperty(e)?{space:hg[e],local:t}:t}function m4(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===Du&&e.documentElement.namespaceURI===Du?e.createElement(t):e.createElementNS(r,t)}}function g4(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function c1(t){var e=Mc(t);return(e.local?g4:m4)(e)}function x4(){}function Bp(t){return t==null?x4:function(){return this.querySelector(t)}}function y4(t){typeof t!="function"&&(t=Bp(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s=e[i],o=s.length,a=n[i]=new Array(o),c,h,u=0;u<o;++u)(c=s[u])&&(h=t.call(c,c.__data__,u,s))&&("__data__"in c&&(h.__data__=c.__data__),a[u]=h);return new br(n,this._parents)}function b4(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function C4(){return[]}function h1(t){return t==null?C4:function(){return this.querySelectorAll(t)}}function k4(t){return function(){return b4(t.apply(this,arguments))}}function v4(t){typeof t=="function"?t=k4(t):t=h1(t);for(var e=this._groups,r=e.length,n=[],i=[],s=0;s<r;++s)for(var o=e[s],a=o.length,c,h=0;h<a;++h)(c=o[h])&&(n.push(t.call(c,c.__data__,h,o)),i.push(c));return new br(n,i)}function u1(t){return function(){return this.matches(t)}}function d1(t){return function(e){return e.matches(t)}}var w4=Array.prototype.find;function S4(t){return function(){return w4.call(this.children,t)}}function T4(){return this.firstElementChild}function _4(t){return this.select(t==null?T4:S4(typeof t=="function"?t:d1(t)))}var j4=Array.prototype.filter;function N4(){return Array.from(this.children)}function E4(t){return function(){return j4.call(this.children,t)}}function L4(t){return this.selectAll(t==null?N4:E4(typeof t=="function"?t:d1(t)))}function B4(t){typeof t!="function"&&(t=u1(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s=e[i],o=s.length,a=n[i]=[],c,h=0;h<o;++h)(c=s[h])&&t.call(c,c.__data__,h,s)&&a.push(c);return new br(n,this._parents)}function p1(t){return new Array(t.length)}function A4(){return new br(this._enter||this._groups.map(p1),this._parents)}function Pl(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Pl.prototype={constructor:Pl,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function M4(t){return function(){return t}}function I4(t,e,r,n,i,s){for(var o=0,a,c=e.length,h=s.length;o<h;++o)(a=e[o])?(a.__data__=s[o],n[o]=a):r[o]=new Pl(t,s[o]);for(;o<c;++o)(a=e[o])&&(i[o]=a)}function F4(t,e,r,n,i,s,o){var a,c,h=new Map,u=e.length,d=s.length,f=new Array(u),p;for(a=0;a<u;++a)(c=e[a])&&(f[a]=p=o.call(c,c.__data__,a,e)+"",h.has(p)?i[a]=c:h.set(p,c));for(a=0;a<d;++a)p=o.call(t,s[a],a,s)+"",(c=h.get(p))?(n[a]=c,c.__data__=s[a],h.delete(p)):r[a]=new Pl(t,s[a]);for(a=0;a<u;++a)(c=e[a])&&h.get(f[a])===c&&(i[a]=c)}function P4(t){return t.__data__}function $4(t,e){if(!arguments.length)return Array.from(this,P4);var r=e?F4:I4,n=this._parents,i=this._groups;typeof t!="function"&&(t=M4(t));for(var s=i.length,o=new Array(s),a=new Array(s),c=new Array(s),h=0;h<s;++h){var u=n[h],d=i[h],f=d.length,p=D4(t.call(u,u&&u.__data__,h,n)),m=p.length,x=a[h]=new Array(m),g=o[h]=new Array(m),y=c[h]=new Array(f);r(u,d,x,g,y,p,e);for(var k=0,b=0,w,_;k<m;++k)if(w=x[k]){for(k>=b&&(b=k+1);!(_=g[b])&&++b<m;);w._next=_||null}}return o=new br(o,n),o._enter=a,o._exit=c,o}function D4(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function O4(){return new br(this._exit||this._groups.map(p1),this._parents)}function R4(t,e,r){var n=this.enter(),i=this,s=this.exit();return typeof t=="function"?(n=t(n),n&&(n=n.selection())):n=n.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),r==null?s.remove():r(s),n&&i?n.merge(i).order():i}function z4(t){for(var e=t.selection?t.selection():t,r=this._groups,n=e._groups,i=r.length,s=n.length,o=Math.min(i,s),a=new Array(i),c=0;c<o;++c)for(var h=r[c],u=n[c],d=h.length,f=a[c]=new Array(d),p,m=0;m<d;++m)(p=h[m]||u[m])&&(f[m]=p);for(;c<i;++c)a[c]=r[c];return new br(a,this._parents)}function q4(){for(var t=this._groups,e=-1,r=t.length;++e<r;)for(var n=t[e],i=n.length-1,s=n[i],o;--i>=0;)(o=n[i])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function W4(t){t||(t=H4);function e(d,f){return d&&f?t(d.__data__,f.__data__):!d-!f}for(var r=this._groups,n=r.length,i=new Array(n),s=0;s<n;++s){for(var o=r[s],a=o.length,c=i[s]=new Array(a),h,u=0;u<a;++u)(h=o[u])&&(c[u]=h);c.sort(e)}return new br(i,this._parents).order()}function H4(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function U4(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function V4(){return Array.from(this)}function Y4(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n=t[e],i=0,s=n.length;i<s;++i){var o=n[i];if(o)return o}return null}function G4(){let t=0;for(const e of this)++t;return t}function X4(){return!this.node()}function K4(t){for(var e=this._groups,r=0,n=e.length;r<n;++r)for(var i=e[r],s=0,o=i.length,a;s<o;++s)(a=i[s])&&t.call(a,a.__data__,s,i);return this}function Q4(t){return function(){this.removeAttribute(t)}}function Z4(t){return function(){this.removeAttributeNS(t.space,t.local)}}function J4(t,e){return function(){this.setAttribute(t,e)}}function tF(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function eF(t,e){return function(){var r=e.apply(this,arguments);r==null?this.removeAttribute(t):this.setAttribute(t,r)}}function rF(t,e){return function(){var r=e.apply(this,arguments);r==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,r)}}function nF(t,e){var r=Mc(t);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((e==null?r.local?Z4:Q4:typeof e=="function"?r.local?rF:eF:r.local?tF:J4)(r,e))}function f1(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function iF(t){return function(){this.style.removeProperty(t)}}function sF(t,e,r){return function(){this.style.setProperty(t,e,r)}}function oF(t,e,r){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(t):this.style.setProperty(t,n,r)}}function aF(t,e,r){return arguments.length>1?this.each((e==null?iF:typeof e=="function"?oF:sF)(t,e,r??"")):ps(this.node(),t)}function ps(t,e){return t.style.getPropertyValue(e)||f1(t).getComputedStyle(t,null).getPropertyValue(e)}function lF(t){return function(){delete this[t]}}function cF(t,e){return function(){this[t]=e}}function hF(t,e){return function(){var r=e.apply(this,arguments);r==null?delete this[t]:this[t]=r}}function uF(t,e){return arguments.length>1?this.each((e==null?lF:typeof e=="function"?hF:cF)(t,e)):this.node()[t]}function m1(t){return t.trim().split(/^|\s+/)}function Ap(t){return t.classList||new g1(t)}function g1(t){this._node=t,this._names=m1(t.getAttribute("class")||"")}g1.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function x1(t,e){for(var r=Ap(t),n=-1,i=e.length;++n<i;)r.add(e[n])}function y1(t,e){for(var r=Ap(t),n=-1,i=e.length;++n<i;)r.remove(e[n])}function dF(t){return function(){x1(this,t)}}function pF(t){return function(){y1(this,t)}}function fF(t,e){return function(){(e.apply(this,arguments)?x1:y1)(this,t)}}function mF(t,e){var r=m1(t+"");if(arguments.length<2){for(var n=Ap(this.node()),i=-1,s=r.length;++i<s;)if(!n.contains(r[i]))return!1;return!0}return this.each((typeof e=="function"?fF:e?dF:pF)(r,e))}function gF(){this.textContent=""}function xF(t){return function(){this.textContent=t}}function yF(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function bF(t){return arguments.length?this.each(t==null?gF:(typeof t=="function"?yF:xF)(t)):this.node().textContent}function CF(){this.innerHTML=""}function kF(t){return function(){this.innerHTML=t}}function vF(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function wF(t){return arguments.length?this.each(t==null?CF:(typeof t=="function"?vF:kF)(t)):this.node().innerHTML}function SF(){this.nextSibling&&this.parentNode.appendChild(this)}function TF(){return this.each(SF)}function _F(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function jF(){return this.each(_F)}function NF(t){var e=typeof t=="function"?t:c1(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function EF(){return null}function LF(t,e){var r=typeof t=="function"?t:c1(t),n=e==null?EF:typeof e=="function"?e:Bp(e);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}function BF(){var t=this.parentNode;t&&t.removeChild(this)}function AF(){return this.each(BF)}function MF(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function IF(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function FF(t){return this.select(t?IF:MF)}function PF(t){return arguments.length?this.property("__data__",t):this.node().__data__}function $F(t){return function(e){t.call(this,e,this.__data__)}}function DF(t){return t.trim().split(/^|\s+/).map(function(e){var r="",n=e.indexOf(".");return n>=0&&(r=e.slice(n+1),e=e.slice(0,n)),{type:e,name:r}})}function OF(t){return function(){var e=this.__on;if(e){for(var r=0,n=-1,i=e.length,s;r<i;++r)s=e[r],(!t.type||s.type===t.type)&&s.name===t.name?this.removeEventListener(s.type,s.listener,s.options):e[++n]=s;++n?e.length=n:delete this.__on}}}function RF(t,e,r){return function(){var n=this.__on,i,s=$F(e);if(n){for(var o=0,a=n.length;o<a;++o)if((i=n[o]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=r),i.value=e;return}}this.addEventListener(t.type,s,r),i={type:t.type,name:t.name,value:e,listener:s,options:r},n?n.push(i):this.__on=[i]}}function zF(t,e,r){var n=DF(t+""),i,s=n.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,h=a.length,u;c<h;++c)for(i=0,u=a[c];i<s;++i)if((o=n[i]).type===u.type&&o.name===u.name)return u.value}return}for(a=e?RF:OF,i=0;i<s;++i)this.each(a(n[i],e,r));return this}function b1(t,e,r){var n=f1(t),i=n.CustomEvent;typeof i=="function"?i=new i(e,r):(i=n.document.createEvent("Event"),r?(i.initEvent(e,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function qF(t,e){return function(){return b1(this,t,e)}}function WF(t,e){return function(){return b1(this,t,e.apply(this,arguments))}}function HF(t,e){return this.each((typeof e=="function"?WF:qF)(t,e))}function*UF(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n=t[e],i=0,s=n.length,o;i<s;++i)(o=n[i])&&(yield o)}var C1=[null];function br(t,e){this._groups=t,this._parents=e}function ha(){return new br([[document.documentElement]],C1)}function VF(){return this}br.prototype=ha.prototype={constructor:br,select:y4,selectAll:v4,selectChild:_4,selectChildren:L4,filter:B4,data:$4,enter:A4,exit:O4,join:R4,merge:z4,selection:VF,order:q4,sort:W4,call:U4,nodes:V4,node:Y4,size:G4,empty:X4,each:K4,attr:nF,style:aF,property:uF,classed:mF,text:bF,html:wF,raise:TF,lower:jF,append:NF,insert:LF,remove:AF,clone:FF,datum:PF,on:zF,dispatch:HF,[Symbol.iterator]:UF};function Ot(t){return typeof t=="string"?new br([[document.querySelector(t)]],[document.documentElement]):new br([[t]],C1)}function Mp(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function k1(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function ua(){}var zo=.7,$l=1/zo,Ui="\\s*([+-]?\\d+)\\s*",qo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Yr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",YF=/^#([0-9a-f]{3,8})$/,GF=new RegExp(`^rgb\\(${Ui},${Ui},${Ui}\\)$`),XF=new RegExp(`^rgb\\(${Yr},${Yr},${Yr}\\)$`),KF=new RegExp(`^rgba\\(${Ui},${Ui},${Ui},${qo}\\)$`),QF=new RegExp(`^rgba\\(${Yr},${Yr},${Yr},${qo}\\)$`),ZF=new RegExp(`^hsl\\(${qo},${Yr},${Yr}\\)$`),JF=new RegExp(`^hsla\\(${qo},${Yr},${Yr},${qo}\\)$`),ug={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Mp(ua,Wo,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:dg,formatHex:dg,formatHex8:tP,formatHsl:eP,formatRgb:pg,toString:pg});function dg(){return this.rgb().formatHex()}function tP(){return this.rgb().formatHex8()}function eP(){return v1(this).formatHsl()}function pg(){return this.rgb().formatRgb()}function Wo(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=YF.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?fg(e):r===3?new ar(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?Ma(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?Ma(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=GF.exec(t))?new ar(e[1],e[2],e[3],1):(e=XF.exec(t))?new ar(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=KF.exec(t))?Ma(e[1],e[2],e[3],e[4]):(e=QF.exec(t))?Ma(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=ZF.exec(t))?xg(e[1],e[2]/100,e[3]/100,1):(e=JF.exec(t))?xg(e[1],e[2]/100,e[3]/100,e[4]):ug.hasOwnProperty(t)?fg(ug[t]):t==="transparent"?new ar(NaN,NaN,NaN,0):null}function fg(t){return new ar(t>>16&255,t>>8&255,t&255,1)}function Ma(t,e,r,n){return n<=0&&(t=e=r=NaN),new ar(t,e,r,n)}function rP(t){return t instanceof ua||(t=Wo(t)),t?(t=t.rgb(),new ar(t.r,t.g,t.b,t.opacity)):new ar}function Ou(t,e,r,n){return arguments.length===1?rP(t):new ar(t,e,r,n??1)}function ar(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}Mp(ar,Ou,k1(ua,{brighter(t){return t=t==null?$l:Math.pow($l,t),new ar(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?zo:Math.pow(zo,t),new ar(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new ar(ri(this.r),ri(this.g),ri(this.b),Dl(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:mg,formatHex:mg,formatHex8:nP,formatRgb:gg,toString:gg}));function mg(){return`#${Zn(this.r)}${Zn(this.g)}${Zn(this.b)}`}function nP(){return`#${Zn(this.r)}${Zn(this.g)}${Zn(this.b)}${Zn((isNaN(this.opacity)?1:this.opacity)*255)}`}function gg(){const t=Dl(this.opacity);return`${t===1?"rgb(":"rgba("}${ri(this.r)}, ${ri(this.g)}, ${ri(this.b)}${t===1?")":`, ${t})`}`}function Dl(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function ri(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Zn(t){return t=ri(t),(t<16?"0":"")+t.toString(16)}function xg(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new Br(t,e,r,n)}function v1(t){if(t instanceof Br)return new Br(t.h,t.s,t.l,t.opacity);if(t instanceof ua||(t=Wo(t)),!t)return new Br;if(t instanceof Br)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,i=Math.min(e,r,n),s=Math.max(e,r,n),o=NaN,a=s-i,c=(s+i)/2;return a?(e===s?o=(r-n)/a+(r<n)*6:r===s?o=(n-e)/a+2:o=(e-r)/a+4,a/=c<.5?s+i:2-s-i,o*=60):a=c>0&&c<1?0:o,new Br(o,a,c,t.opacity)}function iP(t,e,r,n){return arguments.length===1?v1(t):new Br(t,e,r,n??1)}function Br(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}Mp(Br,iP,k1(ua,{brighter(t){return t=t==null?$l:Math.pow($l,t),new Br(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?zo:Math.pow(zo,t),new Br(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new ar(qh(t>=240?t-240:t+120,i,n),qh(t,i,n),qh(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new Br(yg(this.h),Ia(this.s),Ia(this.l),Dl(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Dl(this.opacity);return`${t===1?"hsl(":"hsla("}${yg(this.h)}, ${Ia(this.s)*100}%, ${Ia(this.l)*100}%${t===1?")":`, ${t})`}`}}));function yg(t){return t=(t||0)%360,t<0?t+360:t}function Ia(t){return Math.max(0,Math.min(1,t||0))}function qh(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}const Ip=t=>()=>t;function w1(t,e){return function(r){return t+r*e}}function sP(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}function CK(t,e){var r=e-t;return r?w1(t,r>180||r<-180?r-360*Math.round(r/360):r):Ip(isNaN(t)?e:t)}function oP(t){return(t=+t)==1?S1:function(e,r){return r-e?sP(e,r,t):Ip(isNaN(e)?r:e)}}function S1(t,e){var r=e-t;return r?w1(t,r):Ip(isNaN(t)?e:t)}const bg=(function t(e){var r=oP(e);function n(i,s){var o=r((i=Ou(i)).r,(s=Ou(s)).r),a=r(i.g,s.g),c=r(i.b,s.b),h=S1(i.opacity,s.opacity);return function(u){return i.r=o(u),i.g=a(u),i.b=c(u),i.opacity=h(u),i+""}}return n.gamma=t,n})(1);function Tn(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}var Ru=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Wh=new RegExp(Ru.source,"g");function aP(t){return function(){return t}}function lP(t){return function(e){return t(e)+""}}function cP(t,e){var r=Ru.lastIndex=Wh.lastIndex=0,n,i,s,o=-1,a=[],c=[];for(t=t+"",e=e+"";(n=Ru.exec(t))&&(i=Wh.exec(e));)(s=i.index)>r&&(s=e.slice(r,s),a[o]?a[o]+=s:a[++o]=s),(n=n[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,c.push({i:o,x:Tn(n,i)})),r=Wh.lastIndex;return r<e.length&&(s=e.slice(r),a[o]?a[o]+=s:a[++o]=s),a.length<2?c[0]?lP(c[0].x):aP(e):(e=c.length,function(h){for(var u=0,d;u<e;++u)a[(d=c[u]).i]=d.x(h);return a.join("")})}var Cg=180/Math.PI,zu={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function T1(t,e,r,n,i,s){var o,a,c;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(c=t*r+e*n)&&(r-=t*c,n-=e*c),(a=Math.sqrt(r*r+n*n))&&(r/=a,n/=a,c/=a),t*n<e*r&&(t=-t,e=-e,c=-c,o=-o),{translateX:i,translateY:s,rotate:Math.atan2(e,t)*Cg,skewX:Math.atan(c)*Cg,scaleX:o,scaleY:a}}var Fa;function hP(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?zu:T1(e.a,e.b,e.c,e.d,e.e,e.f)}function uP(t){return t==null||(Fa||(Fa=document.createElementNS("http://www.w3.org/2000/svg","g")),Fa.setAttribute("transform",t),!(t=Fa.transform.baseVal.consolidate()))?zu:(t=t.matrix,T1(t.a,t.b,t.c,t.d,t.e,t.f))}function _1(t,e,r,n){function i(h){return h.length?h.pop()+" ":""}function s(h,u,d,f,p,m){if(h!==d||u!==f){var x=p.push("translate(",null,e,null,r);m.push({i:x-4,x:Tn(h,d)},{i:x-2,x:Tn(u,f)})}else(d||f)&&p.push("translate("+d+e+f+r)}function o(h,u,d,f){h!==u?(h-u>180?u+=360:u-h>180&&(h+=360),f.push({i:d.push(i(d)+"rotate(",null,n)-2,x:Tn(h,u)})):u&&d.push(i(d)+"rotate("+u+n)}function a(h,u,d,f){h!==u?f.push({i:d.push(i(d)+"skewX(",null,n)-2,x:Tn(h,u)}):u&&d.push(i(d)+"skewX("+u+n)}function c(h,u,d,f,p,m){if(h!==d||u!==f){var x=p.push(i(p)+"scale(",null,",",null,")");m.push({i:x-4,x:Tn(h,d)},{i:x-2,x:Tn(u,f)})}else(d!==1||f!==1)&&p.push(i(p)+"scale("+d+","+f+")")}return function(h,u){var d=[],f=[];return h=t(h),u=t(u),s(h.translateX,h.translateY,u.translateX,u.translateY,d,f),o(h.rotate,u.rotate,d,f),a(h.skewX,u.skewX,d,f),c(h.scaleX,h.scaleY,u.scaleX,u.scaleY,d,f),h=u=null,function(p){for(var m=-1,x=f.length,g;++m<x;)d[(g=f[m]).i]=g.x(p);return d.join("")}}}var dP=_1(hP,"px, ","px)","deg)"),pP=_1(uP,", ",")",")"),fs=0,xo=0,eo=0,j1=1e3,Ol,yo,Rl=0,ci=0,Ic=0,Ho=typeof performance=="object"&&performance.now?performance:Date,N1=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Fp(){return ci||(N1(fP),ci=Ho.now()+Ic)}function fP(){ci=0}function zl(){this._call=this._time=this._next=null}zl.prototype=E1.prototype={constructor:zl,restart:function(t,e,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?Fp():+r)+(e==null?0:+e),!this._next&&yo!==this&&(yo?yo._next=this:Ol=this,yo=this),this._call=t,this._time=r,qu()},stop:function(){this._call&&(this._call=null,this._time=1/0,qu())}};function E1(t,e,r){var n=new zl;return n.restart(t,e,r),n}function mP(){Fp(),++fs;for(var t=Ol,e;t;)(e=ci-t._time)>=0&&t._call.call(void 0,e),t=t._next;--fs}function kg(){ci=(Rl=Ho.now())+Ic,fs=xo=0;try{mP()}finally{fs=0,xP(),ci=0}}function gP(){var t=Ho.now(),e=t-Rl;e>j1&&(Ic-=e,Rl=t)}function xP(){for(var t,e=Ol,r,n=1/0;e;)e._call?(n>e._time&&(n=e._time),t=e,e=e._next):(r=e._next,e._next=null,e=t?t._next=r:Ol=r);yo=t,qu(n)}function qu(t){if(!fs){xo&&(xo=clearTimeout(xo));var e=t-ci;e>24?(t<1/0&&(xo=setTimeout(kg,t-Ho.now()-Ic)),eo&&(eo=clearInterval(eo))):(eo||(Rl=Ho.now(),eo=setInterval(gP,j1)),fs=1,N1(kg))}}function vg(t,e,r){var n=new zl;return e=e==null?0:+e,n.restart(i=>{n.stop(),t(i+e)},e,r),n}var yP=l1("start","end","cancel","interrupt"),bP=[],L1=0,wg=1,Wu=2,al=3,Sg=4,Hu=5,ll=6;function Fc(t,e,r,n,i,s){var o=t.__transition;if(!o)t.__transition={};else if(r in o)return;CP(t,r,{name:e,index:n,group:i,on:yP,tween:bP,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:L1})}function Pp(t,e){var r=Or(t,e);if(r.state>L1)throw new Error("too late; already scheduled");return r}function en(t,e){var r=Or(t,e);if(r.state>al)throw new Error("too late; already running");return r}function Or(t,e){var r=t.__transition;if(!r||!(r=r[e]))throw new Error("transition not found");return r}function CP(t,e,r){var n=t.__transition,i;n[e]=r,r.timer=E1(s,0,r.time);function s(h){r.state=wg,r.timer.restart(o,r.delay,r.time),r.delay<=h&&o(h-r.delay)}function o(h){var u,d,f,p;if(r.state!==wg)return c();for(u in n)if(p=n[u],p.name===r.name){if(p.state===al)return vg(o);p.state===Sg?(p.state=ll,p.timer.stop(),p.on.call("interrupt",t,t.__data__,p.index,p.group),delete n[u]):+u<e&&(p.state=ll,p.timer.stop(),p.on.call("cancel",t,t.__data__,p.index,p.group),delete n[u])}if(vg(function(){r.state===al&&(r.state=Sg,r.timer.restart(a,r.delay,r.time),a(h))}),r.state=Wu,r.on.call("start",t,t.__data__,r.index,r.group),r.state===Wu){for(r.state=al,i=new Array(f=r.tween.length),u=0,d=-1;u<f;++u)(p=r.tween[u].value.call(t,t.__data__,r.index,r.group))&&(i[++d]=p);i.length=d+1}}function a(h){for(var u=h<r.duration?r.ease.call(null,h/r.duration):(r.timer.restart(c),r.state=Hu,1),d=-1,f=i.length;++d<f;)i[d].call(t,u);r.state===Hu&&(r.on.call("end",t,t.__data__,r.index,r.group),c())}function c(){r.state=ll,r.timer.stop(),delete n[e];for(var h in n)return;delete t.__transition}}function kP(t,e){var r=t.__transition,n,i,s=!0,o;if(r){e=e==null?null:e+"";for(o in r){if((n=r[o]).name!==e){s=!1;continue}i=n.state>Wu&&n.state<Hu,n.state=ll,n.timer.stop(),n.on.call(i?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete r[o]}s&&delete t.__transition}}function vP(t){return this.each(function(){kP(this,t)})}function wP(t,e){var r,n;return function(){var i=en(this,t),s=i.tween;if(s!==r){n=r=s;for(var o=0,a=n.length;o<a;++o)if(n[o].name===e){n=n.slice(),n.splice(o,1);break}}i.tween=n}}function SP(t,e,r){var n,i;if(typeof r!="function")throw new Error;return function(){var s=en(this,t),o=s.tween;if(o!==n){i=(n=o).slice();for(var a={name:e,value:r},c=0,h=i.length;c<h;++c)if(i[c].name===e){i[c]=a;break}c===h&&i.push(a)}s.tween=i}}function TP(t,e){var r=this._id;if(t+="",arguments.length<2){for(var n=Or(this.node(),r).tween,i=0,s=n.length,o;i<s;++i)if((o=n[i]).name===t)return o.value;return null}return this.each((e==null?wP:SP)(r,t,e))}function $p(t,e,r){var n=t._id;return t.each(function(){var i=en(this,n);(i.value||(i.value={}))[e]=r.apply(this,arguments)}),function(i){return Or(i,n).value[e]}}function B1(t,e){var r;return(typeof e=="number"?Tn:e instanceof Wo?bg:(r=Wo(e))?(e=r,bg):cP)(t,e)}function _P(t){return function(){this.removeAttribute(t)}}function jP(t){return function(){this.removeAttributeNS(t.space,t.local)}}function NP(t,e,r){var n,i=r+"",s;return function(){var o=this.getAttribute(t);return o===i?null:o===n?s:s=e(n=o,r)}}function EP(t,e,r){var n,i=r+"",s;return function(){var o=this.getAttributeNS(t.space,t.local);return o===i?null:o===n?s:s=e(n=o,r)}}function LP(t,e,r){var n,i,s;return function(){var o,a=r(this),c;return a==null?void this.removeAttribute(t):(o=this.getAttribute(t),c=a+"",o===c?null:o===n&&c===i?s:(i=c,s=e(n=o,a)))}}function BP(t,e,r){var n,i,s;return function(){var o,a=r(this),c;return a==null?void this.removeAttributeNS(t.space,t.local):(o=this.getAttributeNS(t.space,t.local),c=a+"",o===c?null:o===n&&c===i?s:(i=c,s=e(n=o,a)))}}function AP(t,e){var r=Mc(t),n=r==="transform"?pP:B1;return this.attrTween(t,typeof e=="function"?(r.local?BP:LP)(r,n,$p(this,"attr."+t,e)):e==null?(r.local?jP:_P)(r):(r.local?EP:NP)(r,n,e))}function MP(t,e){return function(r){this.setAttribute(t,e.call(this,r))}}function IP(t,e){return function(r){this.setAttributeNS(t.space,t.local,e.call(this,r))}}function FP(t,e){var r,n;function i(){var s=e.apply(this,arguments);return s!==n&&(r=(n=s)&&IP(t,s)),r}return i._value=e,i}function PP(t,e){var r,n;function i(){var s=e.apply(this,arguments);return s!==n&&(r=(n=s)&&MP(t,s)),r}return i._value=e,i}function $P(t,e){var r="attr."+t;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;var n=Mc(t);return this.tween(r,(n.local?FP:PP)(n,e))}function DP(t,e){return function(){Pp(this,t).delay=+e.apply(this,arguments)}}function OP(t,e){return e=+e,function(){Pp(this,t).delay=e}}function RP(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?DP:OP)(e,t)):Or(this.node(),e).delay}function zP(t,e){return function(){en(this,t).duration=+e.apply(this,arguments)}}function qP(t,e){return e=+e,function(){en(this,t).duration=e}}function WP(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?zP:qP)(e,t)):Or(this.node(),e).duration}function HP(t,e){if(typeof e!="function")throw new Error;return function(){en(this,t).ease=e}}function UP(t){var e=this._id;return arguments.length?this.each(HP(e,t)):Or(this.node(),e).ease}function VP(t,e){return function(){var r=e.apply(this,arguments);if(typeof r!="function")throw new Error;en(this,t).ease=r}}function YP(t){if(typeof t!="function")throw new Error;return this.each(VP(this._id,t))}function GP(t){typeof t!="function"&&(t=u1(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i)for(var s=e[i],o=s.length,a=n[i]=[],c,h=0;h<o;++h)(c=s[h])&&t.call(c,c.__data__,h,s)&&a.push(c);return new dn(n,this._parents,this._name,this._id)}function XP(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,r=t._groups,n=e.length,i=r.length,s=Math.min(n,i),o=new Array(n),a=0;a<s;++a)for(var c=e[a],h=r[a],u=c.length,d=o[a]=new Array(u),f,p=0;p<u;++p)(f=c[p]||h[p])&&(d[p]=f);for(;a<n;++a)o[a]=e[a];return new dn(o,this._parents,this._name,this._id)}function KP(t){return(t+"").trim().split(/^|\s+/).every(function(e){var r=e.indexOf(".");return r>=0&&(e=e.slice(0,r)),!e||e==="start"})}function QP(t,e,r){var n,i,s=KP(e)?Pp:en;return function(){var o=s(this,t),a=o.on;a!==n&&(i=(n=a).copy()).on(e,r),o.on=i}}function ZP(t,e){var r=this._id;return arguments.length<2?Or(this.node(),r).on.on(t):this.each(QP(r,t,e))}function JP(t){return function(){var e=this.parentNode;for(var r in this.__transition)if(+r!==t)return;e&&e.removeChild(this)}}function t$(){return this.on("end.remove",JP(this._id))}function e$(t){var e=this._name,r=this._id;typeof t!="function"&&(t=Bp(t));for(var n=this._groups,i=n.length,s=new Array(i),o=0;o<i;++o)for(var a=n[o],c=a.length,h=s[o]=new Array(c),u,d,f=0;f<c;++f)(u=a[f])&&(d=t.call(u,u.__data__,f,a))&&("__data__"in u&&(d.__data__=u.__data__),h[f]=d,Fc(h[f],e,r,f,h,Or(u,r)));return new dn(s,this._parents,e,r)}function r$(t){var e=this._name,r=this._id;typeof t!="function"&&(t=h1(t));for(var n=this._groups,i=n.length,s=[],o=[],a=0;a<i;++a)for(var c=n[a],h=c.length,u,d=0;d<h;++d)if(u=c[d]){for(var f=t.call(u,u.__data__,d,c),p,m=Or(u,r),x=0,g=f.length;x<g;++x)(p=f[x])&&Fc(p,e,r,x,f,m);s.push(f),o.push(u)}return new dn(s,o,e,r)}var n$=ha.prototype.constructor;function i$(){return new n$(this._groups,this._parents)}function s$(t,e){var r,n,i;return function(){var s=ps(this,t),o=(this.style.removeProperty(t),ps(this,t));return s===o?null:s===r&&o===n?i:i=e(r=s,n=o)}}function A1(t){return function(){this.style.removeProperty(t)}}function o$(t,e,r){var n,i=r+"",s;return function(){var o=ps(this,t);return o===i?null:o===n?s:s=e(n=o,r)}}function a$(t,e,r){var n,i,s;return function(){var o=ps(this,t),a=r(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(t),ps(this,t))),o===c?null:o===n&&c===i?s:(i=c,s=e(n=o,a))}}function l$(t,e){var r,n,i,s="style."+e,o="end."+s,a;return function(){var c=en(this,t),h=c.on,u=c.value[s]==null?a||(a=A1(e)):void 0;(h!==r||i!==u)&&(n=(r=h).copy()).on(o,i=u),c.on=n}}function c$(t,e,r){var n=(t+="")=="transform"?dP:B1;return e==null?this.styleTween(t,s$(t,n)).on("end.style."+t,A1(t)):typeof e=="function"?this.styleTween(t,a$(t,n,$p(this,"style."+t,e))).each(l$(this._id,t)):this.styleTween(t,o$(t,n,e),r).on("end.style."+t,null)}function h$(t,e,r){return function(n){this.style.setProperty(t,e.call(this,n),r)}}function u$(t,e,r){var n,i;function s(){var o=e.apply(this,arguments);return o!==i&&(n=(i=o)&&h$(t,o,r)),n}return s._value=e,s}function d$(t,e,r){var n="style."+(t+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,u$(t,e,r??""))}function p$(t){return function(){this.textContent=t}}function f$(t){return function(){var e=t(this);this.textContent=e??""}}function m$(t){return this.tween("text",typeof t=="function"?f$($p(this,"text",t)):p$(t==null?"":t+""))}function g$(t){return function(e){this.textContent=t.call(this,e)}}function x$(t){var e,r;function n(){var i=t.apply(this,arguments);return i!==r&&(e=(r=i)&&g$(i)),e}return n._value=t,n}function y$(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,x$(t))}function b$(){for(var t=this._name,e=this._id,r=M1(),n=this._groups,i=n.length,s=0;s<i;++s)for(var o=n[s],a=o.length,c,h=0;h<a;++h)if(c=o[h]){var u=Or(c,e);Fc(c,t,r,h,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new dn(n,this._parents,t,r)}function C$(){var t,e,r=this,n=r._id,i=r.size();return new Promise(function(s,o){var a={value:o},c={value:function(){--i===0&&s()}};r.each(function(){var h=en(this,n),u=h.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(c)),h.on=e}),i===0&&s()})}var k$=0;function dn(t,e,r,n){this._groups=t,this._parents=e,this._name=r,this._id=n}function M1(){return++k$}var sn=ha.prototype;dn.prototype={constructor:dn,select:e$,selectAll:r$,selectChild:sn.selectChild,selectChildren:sn.selectChildren,filter:GP,merge:XP,selection:i$,transition:b$,call:sn.call,nodes:sn.nodes,node:sn.node,size:sn.size,empty:sn.empty,each:sn.each,on:ZP,attr:AP,attrTween:$P,style:c$,styleTween:d$,text:m$,textTween:y$,remove:t$,tween:TP,delay:RP,duration:WP,ease:UP,easeVarying:YP,end:C$,[Symbol.iterator]:sn[Symbol.iterator]};function v$(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var w$={time:null,delay:0,duration:250,ease:v$};function S$(t,e){for(var r;!(r=t.__transition)||!(r=r[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return r}function T$(t){var e,r;t instanceof dn?(e=t._id,t=t._name):(e=M1(),(r=w$).time=Fp(),t=t==null?null:t+"");for(var n=this._groups,i=n.length,s=0;s<i;++s)for(var o=n[s],a=o.length,c,h=0;h<a;++h)(c=o[h])&&Fc(c,t,e,h,o,r||S$(c,e));return new dn(n,this._parents,t,e)}ha.prototype.interrupt=vP;ha.prototype.transition=T$;const Uu=Math.PI,Vu=2*Uu,Vn=1e-6,_$=Vu-Vn;function I1(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=arguments[e]+t[e]}function j$(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return I1;const r=10**e;return function(n){this._+=n[0];for(let i=1,s=n.length;i<s;++i)this._+=Math.round(arguments[i]*r)/r+n[i]}}class N${constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?I1:j$(e)}moveTo(e,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,r){this._append`L${this._x1=+e},${this._y1=+r}`}quadraticCurveTo(e,r,n,i){this._append`Q${+e},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(e,r,n,i,s,o){this._append`C${+e},${+r},${+n},${+i},${this._x1=+s},${this._y1=+o}`}arcTo(e,r,n,i,s){if(e=+e,r=+r,n=+n,i=+i,s=+s,s<0)throw new Error(`negative radius: ${s}`);let o=this._x1,a=this._y1,c=n-e,h=i-r,u=o-e,d=a-r,f=u*u+d*d;if(this._x1===null)this._append`M${this._x1=e},${this._y1=r}`;else if(f>Vn)if(!(Math.abs(d*c-h*u)>Vn)||!s)this._append`L${this._x1=e},${this._y1=r}`;else{let p=n-o,m=i-a,x=c*c+h*h,g=p*p+m*m,y=Math.sqrt(x),k=Math.sqrt(f),b=s*Math.tan((Uu-Math.acos((x+f-g)/(2*y*k)))/2),w=b/k,_=b/y;Math.abs(w-1)>Vn&&this._append`L${e+w*u},${r+w*d}`,this._append`A${s},${s},0,0,${+(d*p>u*m)},${this._x1=e+_*c},${this._y1=r+_*h}`}}arc(e,r,n,i,s,o){if(e=+e,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let a=n*Math.cos(i),c=n*Math.sin(i),h=e+a,u=r+c,d=1^o,f=o?i-s:s-i;this._x1===null?this._append`M${h},${u}`:(Math.abs(this._x1-h)>Vn||Math.abs(this._y1-u)>Vn)&&this._append`L${h},${u}`,n&&(f<0&&(f=f%Vu+Vu),f>_$?this._append`A${n},${n},0,1,${d},${e-a},${r-c}A${n},${n},0,1,${d},${this._x1=h},${this._y1=u}`:f>Vn&&this._append`A${n},${n},0,${+(f>=Uu)},${d},${this._x1=e+n*Math.cos(s)},${this._y1=r+n*Math.sin(s)}`)}rect(e,r,n,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function Ei(t){return function(){return t}}const kK=Math.abs,vK=Math.atan2,wK=Math.cos,SK=Math.max,TK=Math.min,_K=Math.sin,jK=Math.sqrt,Tg=1e-12,Dp=Math.PI,_g=Dp/2,NK=2*Dp;function EK(t){return t>1?0:t<-1?Dp:Math.acos(t)}function LK(t){return t>=1?_g:t<=-1?-_g:Math.asin(t)}function E$(t){let e=3;return t.digits=function(r){if(!arguments.length)return e;if(r==null)e=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);e=n}return t},()=>new N$(e)}function L$(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function F1(t){this._context=t}F1.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function Bo(t){return new F1(t)}function B$(t){return t[0]}function A$(t){return t[1]}function M$(t,e){var r=Ei(!0),n=null,i=Bo,s=null,o=E$(a);t=typeof t=="function"?t:t===void 0?B$:Ei(t),e=typeof e=="function"?e:e===void 0?A$:Ei(e);function a(c){var h,u=(c=L$(c)).length,d,f=!1,p;for(n==null&&(s=i(p=o())),h=0;h<=u;++h)!(h<u&&r(d=c[h],h,c))===f&&((f=!f)?s.lineStart():s.lineEnd()),f&&s.point(+t(d,h,c),+e(d,h,c));if(p)return s=null,p+""||null}return a.x=function(c){return arguments.length?(t=typeof c=="function"?c:Ei(+c),a):t},a.y=function(c){return arguments.length?(e=typeof c=="function"?c:Ei(+c),a):e},a.defined=function(c){return arguments.length?(r=typeof c=="function"?c:Ei(!!c),a):r},a.curve=function(c){return arguments.length?(i=c,n!=null&&(s=i(n)),a):i},a.context=function(c){return arguments.length?(c==null?n=s=null:s=i(n=c),a):n},a}class P1{constructor(e,r){this._context=e,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,r){switch(e=+e,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,r,e,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,e,this._y0,e,r);break}}this._x0=e,this._y0=r}}function $1(t){return new P1(t,!0)}function D1(t){return new P1(t,!1)}function Mn(){}function ql(t,e,r){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6)}function Pc(t){this._context=t}Pc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:ql(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:ql(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Yu(t){return new Pc(t)}function O1(t){this._context=t}O1.prototype={areaStart:Mn,areaEnd:Mn,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:ql(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function I$(t){return new O1(t)}function R1(t){this._context=t}R1.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:ql(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function F$(t){return new R1(t)}function z1(t,e){this._basis=new Pc(t),this._beta=e}z1.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,r=t.length-1;if(r>0)for(var n=t[0],i=e[0],s=t[r]-n,o=e[r]-i,a=-1,c;++a<=r;)c=a/r,this._basis.point(this._beta*t[a]+(1-this._beta)*(n+c*s),this._beta*e[a]+(1-this._beta)*(i+c*o));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};const P$=(function t(e){function r(n){return e===1?new Pc(n):new z1(n,e)}return r.beta=function(n){return t(+n)},r})(.85);function Wl(t,e,r){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-r),t._x2,t._y2)}function Op(t,e){this._context=t,this._k=(1-e)/6}Op.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Wl(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:Wl(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const q1=(function t(e){function r(n){return new Op(n,e)}return r.tension=function(n){return t(+n)},r})(0);function Rp(t,e){this._context=t,this._k=(1-e)/6}Rp.prototype={areaStart:Mn,areaEnd:Mn,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Wl(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const $$=(function t(e){function r(n){return new Rp(n,e)}return r.tension=function(n){return t(+n)},r})(0);function zp(t,e){this._context=t,this._k=(1-e)/6}zp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Wl(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const D$=(function t(e){function r(n){return new zp(n,e)}return r.tension=function(n){return t(+n)},r})(0);function qp(t,e,r){var n=t._x1,i=t._y1,s=t._x2,o=t._y2;if(t._l01_a>Tg){var a=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,c=3*t._l01_a*(t._l01_a+t._l12_a);n=(n*a-t._x0*t._l12_2a+t._x2*t._l01_2a)/c,i=(i*a-t._y0*t._l12_2a+t._y2*t._l01_2a)/c}if(t._l23_a>Tg){var h=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);s=(s*h+t._x1*t._l23_2a-e*t._l12_2a)/u,o=(o*h+t._y1*t._l23_2a-r*t._l12_2a)/u}t._context.bezierCurveTo(n,i,s,o,t._x2,t._y2)}function W1(t,e){this._context=t,this._alpha=e}W1.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:qp(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const H1=(function t(e){function r(n){return e?new W1(n,e):new Op(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function U1(t,e){this._context=t,this._alpha=e}U1.prototype={areaStart:Mn,areaEnd:Mn,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:qp(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const O$=(function t(e){function r(n){return e?new U1(n,e):new Rp(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function V1(t,e){this._context=t,this._alpha=e}V1.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:qp(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const R$=(function t(e){function r(n){return e?new V1(n,e):new zp(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function Y1(t){this._context=t}Y1.prototype={areaStart:Mn,areaEnd:Mn,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function z$(t){return new Y1(t)}function jg(t){return t<0?-1:1}function Ng(t,e,r){var n=t._x1-t._x0,i=e-t._x1,s=(t._y1-t._y0)/(n||i<0&&-0),o=(r-t._y1)/(i||n<0&&-0),a=(s*i+o*n)/(n+i);return(jg(s)+jg(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function Eg(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function Hh(t,e,r){var n=t._x0,i=t._y0,s=t._x1,o=t._y1,a=(s-n)/3;t._context.bezierCurveTo(n+a,i+a*e,s-a,o-a*r,s,o)}function Hl(t){this._context=t}Hl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Hh(this,this._t0,Eg(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var r=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,Hh(this,Eg(this,r=Ng(this,t,e)),r);break;default:Hh(this,this._t0,r=Ng(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=r}}};function G1(t){this._context=new X1(t)}(G1.prototype=Object.create(Hl.prototype)).point=function(t,e){Hl.prototype.point.call(this,e,t)};function X1(t){this._context=t}X1.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,r,n,i,s){this._context.bezierCurveTo(e,t,n,r,s,i)}};function K1(t){return new Hl(t)}function Q1(t){return new G1(t)}function Z1(t){this._context=t}Z1.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,r=t.length;if(r)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),r===2)this._context.lineTo(t[1],e[1]);else for(var n=Lg(t),i=Lg(e),s=0,o=1;o<r;++s,++o)this._context.bezierCurveTo(n[0][s],i[0][s],n[1][s],i[1][s],t[o],e[o]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};function Lg(t){var e,r=t.length-1,n,i=new Array(r),s=new Array(r),o=new Array(r);for(i[0]=0,s[0]=2,o[0]=t[0]+2*t[1],e=1;e<r-1;++e)i[e]=1,s[e]=4,o[e]=4*t[e]+2*t[e+1];for(i[r-1]=2,s[r-1]=7,o[r-1]=8*t[r-1]+t[r],e=1;e<r;++e)n=i[e]/s[e-1],s[e]-=n,o[e]-=n*o[e-1];for(i[r-1]=o[r-1]/s[r-1],e=r-2;e>=0;--e)i[e]=(o[e]-i[e+1])/s[e];for(s[r-1]=(t[r]+i[r-1])/2,e=0;e<r-1;++e)s[e]=2*t[e+1]-i[e+1];return[i,s]}function J1(t){return new Z1(t)}function $c(t,e){this._context=t,this._t=e}$c.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var r=this._x*(1-this._t)+t*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,e)}break}}this._x=t,this._y=e}};function tC(t){return new $c(t,.5)}function eC(t){return new $c(t,0)}function rC(t){return new $c(t,1)}function bo(t,e,r){this.k=t,this.x=e,this.y=r}bo.prototype={constructor:bo,scale:function(t){return t===1?this:new bo(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new bo(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};bo.prototype;var q$=v(t=>{var i;const{securityLevel:e}=Vt();let r=Ot("body");if(e==="sandbox"){const o=((i=Ot(`#i${t}`).node())==null?void 0:i.contentDocument)??document;r=Ot(o.body)}return r.select(`#${t}`)},"selectSvgElement");function Wp(t){return typeof t>"u"||t===null}v(Wp,"isNothing");function nC(t){return typeof t=="object"&&t!==null}v(nC,"isObject");function iC(t){return Array.isArray(t)?t:Wp(t)?[]:[t]}v(iC,"toArray");function sC(t,e){var r,n,i,s;if(e)for(s=Object.keys(e),r=0,n=s.length;r<n;r+=1)i=s[r],t[i]=e[i];return t}v(sC,"extend");function oC(t,e){var r="",n;for(n=0;n<e;n+=1)r+=t;return r}v(oC,"repeat");function aC(t){return t===0&&Number.NEGATIVE_INFINITY===1/t}v(aC,"isNegativeZero");var W$=Wp,H$=nC,U$=iC,V$=oC,Y$=aC,G$=sC,Ee={isNothing:W$,isObject:H$,toArray:U$,repeat:V$,isNegativeZero:Y$,extend:G$};function Hp(t,e){var r="",n=t.reason||"(unknown reason)";return t.mark?(t.mark.name&&(r+='in "'+t.mark.name+'" '),r+="("+(t.mark.line+1)+":"+(t.mark.column+1)+")",!e&&t.mark.snippet&&(r+=`
463
-
464
- `+t.mark.snippet),n+" "+r):n}v(Hp,"formatError");function ms(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=Hp(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}v(ms,"YAMLException$1");ms.prototype=Object.create(Error.prototype);ms.prototype.constructor=ms;ms.prototype.toString=v(function(e){return this.name+": "+Hp(this,e)},"toString");var or=ms;function cl(t,e,r,n,i){var s="",o="",a=Math.floor(i/2)-1;return n-e>a&&(s=" ... ",e=n-a+s.length),r-n>a&&(o=" ...",r=n+a-o.length),{str:s+t.slice(e,r).replace(/\t/g,"→")+o,pos:n-e+s.length}}v(cl,"getLine");function hl(t,e){return Ee.repeat(" ",e-t.length)+t}v(hl,"padStart");function lC(t,e){if(e=Object.create(e||null),!t.buffer)return null;e.maxLength||(e.maxLength=79),typeof e.indent!="number"&&(e.indent=1),typeof e.linesBefore!="number"&&(e.linesBefore=3),typeof e.linesAfter!="number"&&(e.linesAfter=2);for(var r=/\r?\n|\r|\0/g,n=[0],i=[],s,o=-1;s=r.exec(t.buffer);)i.push(s.index),n.push(s.index+s[0].length),t.position<=s.index&&o<0&&(o=n.length-2);o<0&&(o=n.length-1);var a="",c,h,u=Math.min(t.line+e.linesAfter,i.length).toString().length,d=e.maxLength-(e.indent+u+3);for(c=1;c<=e.linesBefore&&!(o-c<0);c++)h=cl(t.buffer,n[o-c],i[o-c],t.position-(n[o]-n[o-c]),d),a=Ee.repeat(" ",e.indent)+hl((t.line-c+1).toString(),u)+" | "+h.str+`
465
- `+a;for(h=cl(t.buffer,n[o],i[o],t.position,d),a+=Ee.repeat(" ",e.indent)+hl((t.line+1).toString(),u)+" | "+h.str+`
466
- `,a+=Ee.repeat("-",e.indent+u+3+h.pos)+`^
467
- `,c=1;c<=e.linesAfter&&!(o+c>=i.length);c++)h=cl(t.buffer,n[o+c],i[o+c],t.position-(n[o]-n[o+c]),d),a+=Ee.repeat(" ",e.indent)+hl((t.line+c+1).toString(),u)+" | "+h.str+`
468
- `;return a.replace(/\n$/,"")}v(lC,"makeSnippet");var X$=lC,K$=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Q$=["scalar","sequence","mapping"];function cC(t){var e={};return t!==null&&Object.keys(t).forEach(function(r){t[r].forEach(function(n){e[String(n)]=r})}),e}v(cC,"compileStyleAliases");function hC(t,e){if(e=e||{},Object.keys(e).forEach(function(r){if(K$.indexOf(r)===-1)throw new or('Unknown option "'+r+'" is met in definition of "'+t+'" YAML type.')}),this.options=e,this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(r){return r},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=cC(e.styleAliases||null),Q$.indexOf(this.kind)===-1)throw new or('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}v(hC,"Type$1");var He=hC;function Gu(t,e){var r=[];return t[e].forEach(function(n){var i=r.length;r.forEach(function(s,o){s.tag===n.tag&&s.kind===n.kind&&s.multi===n.multi&&(i=o)}),r[i]=n}),r}v(Gu,"compileList");function uC(){var t={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},e,r;function n(i){i.multi?(t.multi[i.kind].push(i),t.multi.fallback.push(i)):t[i.kind][i.tag]=t.fallback[i.tag]=i}for(v(n,"collectType"),e=0,r=arguments.length;e<r;e+=1)arguments[e].forEach(n);return t}v(uC,"compileMap");function Ul(t){return this.extend(t)}v(Ul,"Schema$1");Ul.prototype.extend=v(function(e){var r=[],n=[];if(e instanceof He)n.push(e);else if(Array.isArray(e))n=n.concat(e);else if(e&&(Array.isArray(e.implicit)||Array.isArray(e.explicit)))e.implicit&&(r=r.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit));else throw new or("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(s){if(!(s instanceof He))throw new or("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new or("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(s.multi)throw new or("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(s){if(!(s instanceof He))throw new or("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(Ul.prototype);return i.implicit=(this.implicit||[]).concat(r),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=Gu(i,"implicit"),i.compiledExplicit=Gu(i,"explicit"),i.compiledTypeMap=uC(i.compiledImplicit,i.compiledExplicit),i},"extend");var Z$=Ul,J$=new He("tag:yaml.org,2002:str",{kind:"scalar",construct:v(function(t){return t!==null?t:""},"construct")}),tD=new He("tag:yaml.org,2002:seq",{kind:"sequence",construct:v(function(t){return t!==null?t:[]},"construct")}),eD=new He("tag:yaml.org,2002:map",{kind:"mapping",construct:v(function(t){return t!==null?t:{}},"construct")}),rD=new Z$({explicit:[J$,tD,eD]});function dC(t){if(t===null)return!0;var e=t.length;return e===1&&t==="~"||e===4&&(t==="null"||t==="Null"||t==="NULL")}v(dC,"resolveYamlNull");function pC(){return null}v(pC,"constructYamlNull");function fC(t){return t===null}v(fC,"isNull");var nD=new He("tag:yaml.org,2002:null",{kind:"scalar",resolve:dC,construct:pC,predicate:fC,represent:{canonical:v(function(){return"~"},"canonical"),lowercase:v(function(){return"null"},"lowercase"),uppercase:v(function(){return"NULL"},"uppercase"),camelcase:v(function(){return"Null"},"camelcase"),empty:v(function(){return""},"empty")},defaultStyle:"lowercase"});function mC(t){if(t===null)return!1;var e=t.length;return e===4&&(t==="true"||t==="True"||t==="TRUE")||e===5&&(t==="false"||t==="False"||t==="FALSE")}v(mC,"resolveYamlBoolean");function gC(t){return t==="true"||t==="True"||t==="TRUE"}v(gC,"constructYamlBoolean");function xC(t){return Object.prototype.toString.call(t)==="[object Boolean]"}v(xC,"isBoolean");var iD=new He("tag:yaml.org,2002:bool",{kind:"scalar",resolve:mC,construct:gC,predicate:xC,represent:{lowercase:v(function(t){return t?"true":"false"},"lowercase"),uppercase:v(function(t){return t?"TRUE":"FALSE"},"uppercase"),camelcase:v(function(t){return t?"True":"False"},"camelcase")},defaultStyle:"lowercase"});function yC(t){return 48<=t&&t<=57||65<=t&&t<=70||97<=t&&t<=102}v(yC,"isHexCode");function bC(t){return 48<=t&&t<=55}v(bC,"isOctCode");function CC(t){return 48<=t&&t<=57}v(CC,"isDecCode");function kC(t){if(t===null)return!1;var e=t.length,r=0,n=!1,i;if(!e)return!1;if(i=t[r],(i==="-"||i==="+")&&(i=t[++r]),i==="0"){if(r+1===e)return!0;if(i=t[++r],i==="b"){for(r++;r<e;r++)if(i=t[r],i!=="_"){if(i!=="0"&&i!=="1")return!1;n=!0}return n&&i!=="_"}if(i==="x"){for(r++;r<e;r++)if(i=t[r],i!=="_"){if(!yC(t.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}if(i==="o"){for(r++;r<e;r++)if(i=t[r],i!=="_"){if(!bC(t.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}}if(i==="_")return!1;for(;r<e;r++)if(i=t[r],i!=="_"){if(!CC(t.charCodeAt(r)))return!1;n=!0}return!(!n||i==="_")}v(kC,"resolveYamlInteger");function vC(t){var e=t,r=1,n;if(e.indexOf("_")!==-1&&(e=e.replace(/_/g,"")),n=e[0],(n==="-"||n==="+")&&(n==="-"&&(r=-1),e=e.slice(1),n=e[0]),e==="0")return 0;if(n==="0"){if(e[1]==="b")return r*parseInt(e.slice(2),2);if(e[1]==="x")return r*parseInt(e.slice(2),16);if(e[1]==="o")return r*parseInt(e.slice(2),8)}return r*parseInt(e,10)}v(vC,"constructYamlInteger");function wC(t){return Object.prototype.toString.call(t)==="[object Number]"&&t%1===0&&!Ee.isNegativeZero(t)}v(wC,"isInteger");var sD=new He("tag:yaml.org,2002:int",{kind:"scalar",resolve:kC,construct:vC,predicate:wC,represent:{binary:v(function(t){return t>=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},"binary"),octal:v(function(t){return t>=0?"0o"+t.toString(8):"-0o"+t.toString(8).slice(1)},"octal"),decimal:v(function(t){return t.toString(10)},"decimal"),hexadecimal:v(function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)},"hexadecimal")},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),oD=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function SC(t){return!(t===null||!oD.test(t)||t[t.length-1]==="_")}v(SC,"resolveYamlFloat");function TC(t){var e,r;return e=t.replace(/_/g,"").toLowerCase(),r=e[0]==="-"?-1:1,"+-".indexOf(e[0])>=0&&(e=e.slice(1)),e===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:e===".nan"?NaN:r*parseFloat(e,10)}v(TC,"constructYamlFloat");var aD=/^[-+]?[0-9]+e/;function _C(t,e){var r;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Ee.isNegativeZero(t))return"-0.0";return r=t.toString(10),aD.test(r)?r.replace("e",".e"):r}v(_C,"representYamlFloat");function jC(t){return Object.prototype.toString.call(t)==="[object Number]"&&(t%1!==0||Ee.isNegativeZero(t))}v(jC,"isFloat");var lD=new He("tag:yaml.org,2002:float",{kind:"scalar",resolve:SC,construct:TC,predicate:jC,represent:_C,defaultStyle:"lowercase"}),NC=rD.extend({implicit:[nD,iD,sD,lD]}),cD=NC,EC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),LC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function BC(t){return t===null?!1:EC.exec(t)!==null||LC.exec(t)!==null}v(BC,"resolveYamlTimestamp");function AC(t){var e,r,n,i,s,o,a,c=0,h=null,u,d,f;if(e=EC.exec(t),e===null&&(e=LC.exec(t)),e===null)throw new Error("Date resolve error");if(r=+e[1],n=+e[2]-1,i=+e[3],!e[4])return new Date(Date.UTC(r,n,i));if(s=+e[4],o=+e[5],a=+e[6],e[7]){for(c=e[7].slice(0,3);c.length<3;)c+="0";c=+c}return e[9]&&(u=+e[10],d=+(e[11]||0),h=(u*60+d)*6e4,e[9]==="-"&&(h=-h)),f=new Date(Date.UTC(r,n,i,s,o,a,c)),h&&f.setTime(f.getTime()-h),f}v(AC,"constructYamlTimestamp");function MC(t){return t.toISOString()}v(MC,"representYamlTimestamp");var hD=new He("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:BC,construct:AC,instanceOf:Date,represent:MC});function IC(t){return t==="<<"||t===null}v(IC,"resolveYamlMerge");var uD=new He("tag:yaml.org,2002:merge",{kind:"scalar",resolve:IC}),Up=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
469
- \r`;function FC(t){if(t===null)return!1;var e,r,n=0,i=t.length,s=Up;for(r=0;r<i;r++)if(e=s.indexOf(t.charAt(r)),!(e>64)){if(e<0)return!1;n+=6}return n%8===0}v(FC,"resolveYamlBinary");function PC(t){var e,r,n=t.replace(/[\r\n=]/g,""),i=n.length,s=Up,o=0,a=[];for(e=0;e<i;e++)e%4===0&&e&&(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)),o=o<<6|s.indexOf(n.charAt(e));return r=i%4*6,r===0?(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)):r===18?(a.push(o>>10&255),a.push(o>>2&255)):r===12&&a.push(o>>4&255),new Uint8Array(a)}v(PC,"constructYamlBinary");function $C(t){var e="",r=0,n,i,s=t.length,o=Up;for(n=0;n<s;n++)n%3===0&&n&&(e+=o[r>>18&63],e+=o[r>>12&63],e+=o[r>>6&63],e+=o[r&63]),r=(r<<8)+t[n];return i=s%3,i===0?(e+=o[r>>18&63],e+=o[r>>12&63],e+=o[r>>6&63],e+=o[r&63]):i===2?(e+=o[r>>10&63],e+=o[r>>4&63],e+=o[r<<2&63],e+=o[64]):i===1&&(e+=o[r>>2&63],e+=o[r<<4&63],e+=o[64],e+=o[64]),e}v($C,"representYamlBinary");function DC(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}v(DC,"isBinary");var dD=new He("tag:yaml.org,2002:binary",{kind:"scalar",resolve:FC,construct:PC,predicate:DC,represent:$C}),pD=Object.prototype.hasOwnProperty,fD=Object.prototype.toString;function OC(t){if(t===null)return!0;var e=[],r,n,i,s,o,a=t;for(r=0,n=a.length;r<n;r+=1){if(i=a[r],o=!1,fD.call(i)!=="[object Object]")return!1;for(s in i)if(pD.call(i,s))if(!o)o=!0;else return!1;if(!o)return!1;if(e.indexOf(s)===-1)e.push(s);else return!1}return!0}v(OC,"resolveYamlOmap");function RC(t){return t!==null?t:[]}v(RC,"constructYamlOmap");var mD=new He("tag:yaml.org,2002:omap",{kind:"sequence",resolve:OC,construct:RC}),gD=Object.prototype.toString;function zC(t){if(t===null)return!0;var e,r,n,i,s,o=t;for(s=new Array(o.length),e=0,r=o.length;e<r;e+=1){if(n=o[e],gD.call(n)!=="[object Object]"||(i=Object.keys(n),i.length!==1))return!1;s[e]=[i[0],n[i[0]]]}return!0}v(zC,"resolveYamlPairs");function qC(t){if(t===null)return[];var e,r,n,i,s,o=t;for(s=new Array(o.length),e=0,r=o.length;e<r;e+=1)n=o[e],i=Object.keys(n),s[e]=[i[0],n[i[0]]];return s}v(qC,"constructYamlPairs");var xD=new He("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:zC,construct:qC}),yD=Object.prototype.hasOwnProperty;function WC(t){if(t===null)return!0;var e,r=t;for(e in r)if(yD.call(r,e)&&r[e]!==null)return!1;return!0}v(WC,"resolveYamlSet");function HC(t){return t!==null?t:{}}v(HC,"constructYamlSet");var bD=new He("tag:yaml.org,2002:set",{kind:"mapping",resolve:WC,construct:HC}),UC=cD.extend({implicit:[hD,uD],explicit:[dD,mD,xD,bD]}),In=Object.prototype.hasOwnProperty,Vl=1,VC=2,YC=3,Yl=4,Uh=1,CD=2,Bg=3,kD=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,vD=/[\x85\u2028\u2029]/,wD=/[,\[\]\{\}]/,GC=/^(?:!|!!|![a-z\-]+!)$/i,XC=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Xu(t){return Object.prototype.toString.call(t)}v(Xu,"_class");function Fr(t){return t===10||t===13}v(Fr,"is_EOL");function En(t){return t===9||t===32}v(En,"is_WHITE_SPACE");function Qe(t){return t===9||t===32||t===10||t===13}v(Qe,"is_WS_OR_EOL");function Jn(t){return t===44||t===91||t===93||t===123||t===125}v(Jn,"is_FLOW_INDICATOR");function KC(t){var e;return 48<=t&&t<=57?t-48:(e=t|32,97<=e&&e<=102?e-97+10:-1)}v(KC,"fromHexCode");function QC(t){return t===120?2:t===117?4:t===85?8:0}v(QC,"escapedHexLen");function ZC(t){return 48<=t&&t<=57?t-48:-1}v(ZC,"fromDecimalCode");function Ku(t){return t===48?"\0":t===97?"\x07":t===98?"\b":t===116||t===9?" ":t===110?`
470
- `:t===118?"\v":t===102?"\f":t===114?"\r":t===101?"\x1B":t===32?" ":t===34?'"':t===47?"/":t===92?"\\":t===78?"…":t===95?" ":t===76?"\u2028":t===80?"\u2029":""}v(Ku,"simpleEscapeSequence");function JC(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}v(JC,"charFromCodepoint");function Vp(t,e,r){e==="__proto__"?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,writable:!0,value:r}):t[e]=r}v(Vp,"setProperty");var tk=new Array(256),ek=new Array(256);for(Hn=0;Hn<256;Hn++)tk[Hn]=Ku(Hn)?1:0,ek[Hn]=Ku(Hn);var Hn;function rk(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||UC,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}v(rk,"State$1");function Yp(t,e){var r={name:t.filename,buffer:t.input.slice(0,-1),position:t.position,line:t.line,column:t.position-t.lineStart};return r.snippet=X$(r),new or(e,r)}v(Yp,"generateError");function wt(t,e){throw Yp(t,e)}v(wt,"throwError");function Uo(t,e){t.onWarning&&t.onWarning.call(null,Yp(t,e))}v(Uo,"throwWarning");var Ag={YAML:v(function(e,r,n){var i,s,o;e.version!==null&&wt(e,"duplication of %YAML directive"),n.length!==1&&wt(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),i===null&&wt(e,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),o=parseInt(i[2],10),s!==1&&wt(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&Uo(e,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:v(function(e,r,n){var i,s;n.length!==2&&wt(e,"TAG directive accepts exactly two arguments"),i=n[0],s=n[1],GC.test(i)||wt(e,"ill-formed tag handle (first argument) of the TAG directive"),In.call(e.tagMap,i)&&wt(e,'there is a previously declared suffix for "'+i+'" tag handle'),XC.test(s)||wt(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{wt(e,"tag prefix is malformed: "+s)}e.tagMap[i]=s},"handleTagDirective")};function hn(t,e,r,n){var i,s,o,a;if(e<r){if(a=t.input.slice(e,r),n)for(i=0,s=a.length;i<s;i+=1)o=a.charCodeAt(i),o===9||32<=o&&o<=1114111||wt(t,"expected valid JSON character");else kD.test(a)&&wt(t,"the stream contains non-printable characters");t.result+=a}}v(hn,"captureSegment");function Qu(t,e,r,n){var i,s,o,a;for(Ee.isObject(r)||wt(t,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(r),o=0,a=i.length;o<a;o+=1)s=i[o],In.call(e,s)||(Vp(e,s,r[s]),n[s]=!0)}v(Qu,"mergeMappings");function ti(t,e,r,n,i,s,o,a,c){var h,u;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),h=0,u=i.length;h<u;h+=1)Array.isArray(i[h])&&wt(t,"nested arrays are not supported inside keys"),typeof i=="object"&&Xu(i[h])==="[object Object]"&&(i[h]="[object Object]");if(typeof i=="object"&&Xu(i)==="[object Object]"&&(i="[object Object]"),i=String(i),e===null&&(e={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(h=0,u=s.length;h<u;h+=1)Qu(t,e,s[h],r);else Qu(t,e,s,r);else!t.json&&!In.call(r,i)&&In.call(e,i)&&(t.line=o||t.line,t.lineStart=a||t.lineStart,t.position=c||t.position,wt(t,"duplicated mapping key")),Vp(e,i,s),delete r[i];return e}v(ti,"storeMappingPair");function Dc(t){var e;e=t.input.charCodeAt(t.position),e===10?t.position++:e===13?(t.position++,t.input.charCodeAt(t.position)===10&&t.position++):wt(t,"a line break is expected"),t.line+=1,t.lineStart=t.position,t.firstTabInLine=-1}v(Dc,"readLineBreak");function ke(t,e,r){for(var n=0,i=t.input.charCodeAt(t.position);i!==0;){for(;En(i);)i===9&&t.firstTabInLine===-1&&(t.firstTabInLine=t.position),i=t.input.charCodeAt(++t.position);if(e&&i===35)do i=t.input.charCodeAt(++t.position);while(i!==10&&i!==13&&i!==0);if(Fr(i))for(Dc(t),i=t.input.charCodeAt(t.position),n++,t.lineIndent=0;i===32;)t.lineIndent++,i=t.input.charCodeAt(++t.position);else break}return r!==-1&&n!==0&&t.lineIndent<r&&Uo(t,"deficient indentation"),n}v(ke,"skipSeparationSpace");function da(t){var e=t.position,r;return r=t.input.charCodeAt(e),!!((r===45||r===46)&&r===t.input.charCodeAt(e+1)&&r===t.input.charCodeAt(e+2)&&(e+=3,r=t.input.charCodeAt(e),r===0||Qe(r)))}v(da,"testDocumentSeparator");function Oc(t,e){e===1?t.result+=" ":e>1&&(t.result+=Ee.repeat(`
471
- `,e-1))}v(Oc,"writeFoldedLines");function nk(t,e,r){var n,i,s,o,a,c,h,u,d=t.kind,f=t.result,p;if(p=t.input.charCodeAt(t.position),Qe(p)||Jn(p)||p===35||p===38||p===42||p===33||p===124||p===62||p===39||p===34||p===37||p===64||p===96||(p===63||p===45)&&(i=t.input.charCodeAt(t.position+1),Qe(i)||r&&Jn(i)))return!1;for(t.kind="scalar",t.result="",s=o=t.position,a=!1;p!==0;){if(p===58){if(i=t.input.charCodeAt(t.position+1),Qe(i)||r&&Jn(i))break}else if(p===35){if(n=t.input.charCodeAt(t.position-1),Qe(n))break}else{if(t.position===t.lineStart&&da(t)||r&&Jn(p))break;if(Fr(p))if(c=t.line,h=t.lineStart,u=t.lineIndent,ke(t,!1,-1),t.lineIndent>=e){a=!0,p=t.input.charCodeAt(t.position);continue}else{t.position=o,t.line=c,t.lineStart=h,t.lineIndent=u;break}}a&&(hn(t,s,o,!1),Oc(t,t.line-c),s=o=t.position,a=!1),En(p)||(o=t.position+1),p=t.input.charCodeAt(++t.position)}return hn(t,s,o,!1),t.result?!0:(t.kind=d,t.result=f,!1)}v(nk,"readPlainScalar");function ik(t,e){var r,n,i;if(r=t.input.charCodeAt(t.position),r!==39)return!1;for(t.kind="scalar",t.result="",t.position++,n=i=t.position;(r=t.input.charCodeAt(t.position))!==0;)if(r===39)if(hn(t,n,t.position,!0),r=t.input.charCodeAt(++t.position),r===39)n=t.position,t.position++,i=t.position;else return!0;else Fr(r)?(hn(t,n,i,!0),Oc(t,ke(t,!1,e)),n=i=t.position):t.position===t.lineStart&&da(t)?wt(t,"unexpected end of the document within a single quoted scalar"):(t.position++,i=t.position);wt(t,"unexpected end of the stream within a single quoted scalar")}v(ik,"readSingleQuotedScalar");function sk(t,e){var r,n,i,s,o,a;if(a=t.input.charCodeAt(t.position),a!==34)return!1;for(t.kind="scalar",t.result="",t.position++,r=n=t.position;(a=t.input.charCodeAt(t.position))!==0;){if(a===34)return hn(t,r,t.position,!0),t.position++,!0;if(a===92){if(hn(t,r,t.position,!0),a=t.input.charCodeAt(++t.position),Fr(a))ke(t,!1,e);else if(a<256&&tk[a])t.result+=ek[a],t.position++;else if((o=QC(a))>0){for(i=o,s=0;i>0;i--)a=t.input.charCodeAt(++t.position),(o=KC(a))>=0?s=(s<<4)+o:wt(t,"expected hexadecimal character");t.result+=JC(s),t.position++}else wt(t,"unknown escape sequence");r=n=t.position}else Fr(a)?(hn(t,r,n,!0),Oc(t,ke(t,!1,e)),r=n=t.position):t.position===t.lineStart&&da(t)?wt(t,"unexpected end of the document within a double quoted scalar"):(t.position++,n=t.position)}wt(t,"unexpected end of the stream within a double quoted scalar")}v(sk,"readDoubleQuotedScalar");function ok(t,e){var r=!0,n,i,s,o=t.tag,a,c=t.anchor,h,u,d,f,p,m=Object.create(null),x,g,y,k;if(k=t.input.charCodeAt(t.position),k===91)u=93,p=!1,a=[];else if(k===123)u=125,p=!0,a={};else return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=a),k=t.input.charCodeAt(++t.position);k!==0;){if(ke(t,!0,e),k=t.input.charCodeAt(t.position),k===u)return t.position++,t.tag=o,t.anchor=c,t.kind=p?"mapping":"sequence",t.result=a,!0;r?k===44&&wt(t,"expected the node content, but found ','"):wt(t,"missed comma between flow collection entries"),g=x=y=null,d=f=!1,k===63&&(h=t.input.charCodeAt(t.position+1),Qe(h)&&(d=f=!0,t.position++,ke(t,!0,e))),n=t.line,i=t.lineStart,s=t.position,hi(t,e,Vl,!1,!0),g=t.tag,x=t.result,ke(t,!0,e),k=t.input.charCodeAt(t.position),(f||t.line===n)&&k===58&&(d=!0,k=t.input.charCodeAt(++t.position),ke(t,!0,e),hi(t,e,Vl,!1,!0),y=t.result),p?ti(t,a,m,g,x,y,n,i,s):d?a.push(ti(t,null,m,g,x,y,n,i,s)):a.push(x),ke(t,!0,e),k=t.input.charCodeAt(t.position),k===44?(r=!0,k=t.input.charCodeAt(++t.position)):r=!1}wt(t,"unexpected end of the stream within a flow collection")}v(ok,"readFlowCollection");function ak(t,e){var r,n,i=Uh,s=!1,o=!1,a=e,c=0,h=!1,u,d;if(d=t.input.charCodeAt(t.position),d===124)n=!1;else if(d===62)n=!0;else return!1;for(t.kind="scalar",t.result="";d!==0;)if(d=t.input.charCodeAt(++t.position),d===43||d===45)Uh===i?i=d===43?Bg:CD:wt(t,"repeat of a chomping mode identifier");else if((u=ZC(d))>=0)u===0?wt(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?wt(t,"repeat of an indentation width identifier"):(a=e+u-1,o=!0);else break;if(En(d)){do d=t.input.charCodeAt(++t.position);while(En(d));if(d===35)do d=t.input.charCodeAt(++t.position);while(!Fr(d)&&d!==0)}for(;d!==0;){for(Dc(t),t.lineIndent=0,d=t.input.charCodeAt(t.position);(!o||t.lineIndent<a)&&d===32;)t.lineIndent++,d=t.input.charCodeAt(++t.position);if(!o&&t.lineIndent>a&&(a=t.lineIndent),Fr(d)){c++;continue}if(t.lineIndent<a){i===Bg?t.result+=Ee.repeat(`
472
- `,s?1+c:c):i===Uh&&s&&(t.result+=`
473
- `);break}for(n?En(d)?(h=!0,t.result+=Ee.repeat(`
474
- `,s?1+c:c)):h?(h=!1,t.result+=Ee.repeat(`
475
- `,c+1)):c===0?s&&(t.result+=" "):t.result+=Ee.repeat(`
476
- `,c):t.result+=Ee.repeat(`
477
- `,s?1+c:c),s=!0,o=!0,c=0,r=t.position;!Fr(d)&&d!==0;)d=t.input.charCodeAt(++t.position);hn(t,r,t.position,!1)}return!0}v(ak,"readBlockScalar");function Zu(t,e){var r,n=t.tag,i=t.anchor,s=[],o,a=!1,c;if(t.firstTabInLine!==-1)return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=s),c=t.input.charCodeAt(t.position);c!==0&&(t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,wt(t,"tab characters must not be used in indentation")),!(c!==45||(o=t.input.charCodeAt(t.position+1),!Qe(o))));){if(a=!0,t.position++,ke(t,!0,-1)&&t.lineIndent<=e){s.push(null),c=t.input.charCodeAt(t.position);continue}if(r=t.line,hi(t,e,YC,!1,!0),s.push(t.result),ke(t,!0,-1),c=t.input.charCodeAt(t.position),(t.line===r||t.lineIndent>e)&&c!==0)wt(t,"bad indentation of a sequence entry");else if(t.lineIndent<e)break}return a?(t.tag=n,t.anchor=i,t.kind="sequence",t.result=s,!0):!1}v(Zu,"readBlockSequence");function lk(t,e,r){var n,i,s,o,a,c,h=t.tag,u=t.anchor,d={},f=Object.create(null),p=null,m=null,x=null,g=!1,y=!1,k;if(t.firstTabInLine!==-1)return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=d),k=t.input.charCodeAt(t.position);k!==0;){if(!g&&t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,wt(t,"tab characters must not be used in indentation")),n=t.input.charCodeAt(t.position+1),s=t.line,(k===63||k===58)&&Qe(n))k===63?(g&&(ti(t,d,f,p,m,null,o,a,c),p=m=x=null),y=!0,g=!0,i=!0):g?(g=!1,i=!0):wt(t,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),t.position+=1,k=n;else{if(o=t.line,a=t.lineStart,c=t.position,!hi(t,r,VC,!1,!0))break;if(t.line===s){for(k=t.input.charCodeAt(t.position);En(k);)k=t.input.charCodeAt(++t.position);if(k===58)k=t.input.charCodeAt(++t.position),Qe(k)||wt(t,"a whitespace character is expected after the key-value separator within a block mapping"),g&&(ti(t,d,f,p,m,null,o,a,c),p=m=x=null),y=!0,g=!1,i=!1,p=t.tag,m=t.result;else if(y)wt(t,"can not read an implicit mapping pair; a colon is missed");else return t.tag=h,t.anchor=u,!0}else if(y)wt(t,"can not read a block mapping entry; a multiline key may not be an implicit key");else return t.tag=h,t.anchor=u,!0}if((t.line===s||t.lineIndent>e)&&(g&&(o=t.line,a=t.lineStart,c=t.position),hi(t,e,Yl,!0,i)&&(g?m=t.result:x=t.result),g||(ti(t,d,f,p,m,x,o,a,c),p=m=x=null),ke(t,!0,-1),k=t.input.charCodeAt(t.position)),(t.line===s||t.lineIndent>e)&&k!==0)wt(t,"bad indentation of a mapping entry");else if(t.lineIndent<e)break}return g&&ti(t,d,f,p,m,null,o,a,c),y&&(t.tag=h,t.anchor=u,t.kind="mapping",t.result=d),y}v(lk,"readBlockMapping");function ck(t){var e,r=!1,n=!1,i,s,o;if(o=t.input.charCodeAt(t.position),o!==33)return!1;if(t.tag!==null&&wt(t,"duplication of a tag property"),o=t.input.charCodeAt(++t.position),o===60?(r=!0,o=t.input.charCodeAt(++t.position)):o===33?(n=!0,i="!!",o=t.input.charCodeAt(++t.position)):i="!",e=t.position,r){do o=t.input.charCodeAt(++t.position);while(o!==0&&o!==62);t.position<t.length?(s=t.input.slice(e,t.position),o=t.input.charCodeAt(++t.position)):wt(t,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!Qe(o);)o===33&&(n?wt(t,"tag suffix cannot contain exclamation marks"):(i=t.input.slice(e-1,t.position+1),GC.test(i)||wt(t,"named tag handle cannot contain such characters"),n=!0,e=t.position+1)),o=t.input.charCodeAt(++t.position);s=t.input.slice(e,t.position),wD.test(s)&&wt(t,"tag suffix cannot contain flow indicator characters")}s&&!XC.test(s)&&wt(t,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{wt(t,"tag name is malformed: "+s)}return r?t.tag=s:In.call(t.tagMap,i)?t.tag=t.tagMap[i]+s:i==="!"?t.tag="!"+s:i==="!!"?t.tag="tag:yaml.org,2002:"+s:wt(t,'undeclared tag handle "'+i+'"'),!0}v(ck,"readTagProperty");function hk(t){var e,r;if(r=t.input.charCodeAt(t.position),r!==38)return!1;for(t.anchor!==null&&wt(t,"duplication of an anchor property"),r=t.input.charCodeAt(++t.position),e=t.position;r!==0&&!Qe(r)&&!Jn(r);)r=t.input.charCodeAt(++t.position);return t.position===e&&wt(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(e,t.position),!0}v(hk,"readAnchorProperty");function uk(t){var e,r,n;if(n=t.input.charCodeAt(t.position),n!==42)return!1;for(n=t.input.charCodeAt(++t.position),e=t.position;n!==0&&!Qe(n)&&!Jn(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&wt(t,"name of an alias node must contain at least one character"),r=t.input.slice(e,t.position),In.call(t.anchorMap,r)||wt(t,'unidentified alias "'+r+'"'),t.result=t.anchorMap[r],ke(t,!0,-1),!0}v(uk,"readAlias");function hi(t,e,r,n,i){var s,o,a,c=1,h=!1,u=!1,d,f,p,m,x,g;if(t.listener!==null&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,s=o=a=Yl===r||YC===r,n&&ke(t,!0,-1)&&(h=!0,t.lineIndent>e?c=1:t.lineIndent===e?c=0:t.lineIndent<e&&(c=-1)),c===1)for(;ck(t)||hk(t);)ke(t,!0,-1)?(h=!0,a=s,t.lineIndent>e?c=1:t.lineIndent===e?c=0:t.lineIndent<e&&(c=-1)):a=!1;if(a&&(a=h||i),(c===1||Yl===r)&&(Vl===r||VC===r?x=e:x=e+1,g=t.position-t.lineStart,c===1?a&&(Zu(t,g)||lk(t,g,x))||ok(t,x)?u=!0:(o&&ak(t,x)||ik(t,x)||sk(t,x)?u=!0:uk(t)?(u=!0,(t.tag!==null||t.anchor!==null)&&wt(t,"alias node should not have any properties")):nk(t,x,Vl===r)&&(u=!0,t.tag===null&&(t.tag="?")),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):c===0&&(u=a&&Zu(t,g))),t.tag===null)t.anchor!==null&&(t.anchorMap[t.anchor]=t.result);else if(t.tag==="?"){for(t.result!==null&&t.kind!=="scalar"&&wt(t,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+t.kind+'"'),d=0,f=t.implicitTypes.length;d<f;d+=1)if(m=t.implicitTypes[d],m.resolve(t.result)){t.result=m.construct(t.result),t.tag=m.tag,t.anchor!==null&&(t.anchorMap[t.anchor]=t.result);break}}else if(t.tag!=="!"){if(In.call(t.typeMap[t.kind||"fallback"],t.tag))m=t.typeMap[t.kind||"fallback"][t.tag];else for(m=null,p=t.typeMap.multi[t.kind||"fallback"],d=0,f=p.length;d<f;d+=1)if(t.tag.slice(0,p[d].tag.length)===p[d].tag){m=p[d];break}m||wt(t,"unknown tag !<"+t.tag+">"),t.result!==null&&m.kind!==t.kind&&wt(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+m.kind+'", not "'+t.kind+'"'),m.resolve(t.result,t.tag)?(t.result=m.construct(t.result,t.tag),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):wt(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")}return t.listener!==null&&t.listener("close",t),t.tag!==null||t.anchor!==null||u}v(hi,"composeNode");function dk(t){var e=t.position,r,n,i,s=!1,o;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap=Object.create(null),t.anchorMap=Object.create(null);(o=t.input.charCodeAt(t.position))!==0&&(ke(t,!0,-1),o=t.input.charCodeAt(t.position),!(t.lineIndent>0||o!==37));){for(s=!0,o=t.input.charCodeAt(++t.position),r=t.position;o!==0&&!Qe(o);)o=t.input.charCodeAt(++t.position);for(n=t.input.slice(r,t.position),i=[],n.length<1&&wt(t,"directive name must not be less than one character in length");o!==0;){for(;En(o);)o=t.input.charCodeAt(++t.position);if(o===35){do o=t.input.charCodeAt(++t.position);while(o!==0&&!Fr(o));break}if(Fr(o))break;for(r=t.position;o!==0&&!Qe(o);)o=t.input.charCodeAt(++t.position);i.push(t.input.slice(r,t.position))}o!==0&&Dc(t),In.call(Ag,n)?Ag[n](t,n,i):Uo(t,'unknown document directive "'+n+'"')}if(ke(t,!0,-1),t.lineIndent===0&&t.input.charCodeAt(t.position)===45&&t.input.charCodeAt(t.position+1)===45&&t.input.charCodeAt(t.position+2)===45?(t.position+=3,ke(t,!0,-1)):s&&wt(t,"directives end mark is expected"),hi(t,t.lineIndent-1,Yl,!1,!0),ke(t,!0,-1),t.checkLineBreaks&&vD.test(t.input.slice(e,t.position))&&Uo(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&da(t)){t.input.charCodeAt(t.position)===46&&(t.position+=3,ke(t,!0,-1));return}if(t.position<t.length-1)wt(t,"end of the stream or a document separator is expected");else return}v(dk,"readDocument");function Gp(t,e){t=String(t),e=e||{},t.length!==0&&(t.charCodeAt(t.length-1)!==10&&t.charCodeAt(t.length-1)!==13&&(t+=`
478
- `),t.charCodeAt(0)===65279&&(t=t.slice(1)));var r=new rk(t,e),n=t.indexOf("\0");for(n!==-1&&(r.position=n,wt(r,"null byte is not allowed in input")),r.input+="\0";r.input.charCodeAt(r.position)===32;)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)dk(r);return r.documents}v(Gp,"loadDocuments");function SD(t,e,r){e!==null&&typeof e=="object"&&typeof r>"u"&&(r=e,e=null);var n=Gp(t,r);if(typeof e!="function")return n;for(var i=0,s=n.length;i<s;i+=1)e(n[i])}v(SD,"loadAll$1");function pk(t,e){var r=Gp(t,e);if(r.length!==0){if(r.length===1)return r[0];throw new or("expected a single document in the stream, but found more")}}v(pk,"load$1");var TD=pk,_D={load:TD},fk=Object.prototype.toString,mk=Object.prototype.hasOwnProperty,Xp=65279,jD=9,Vo=10,ND=13,ED=32,LD=33,BD=34,Ju=35,AD=37,MD=38,ID=39,FD=42,gk=44,PD=45,Gl=58,$D=61,DD=62,OD=63,RD=64,xk=91,yk=93,zD=96,bk=123,qD=124,Ck=125,Ve={};Ve[0]="\\0";Ve[7]="\\a";Ve[8]="\\b";Ve[9]="\\t";Ve[10]="\\n";Ve[11]="\\v";Ve[12]="\\f";Ve[13]="\\r";Ve[27]="\\e";Ve[34]='\\"';Ve[92]="\\\\";Ve[133]="\\N";Ve[160]="\\_";Ve[8232]="\\L";Ve[8233]="\\P";var WD=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],HD=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function kk(t,e){var r,n,i,s,o,a,c;if(e===null)return{};for(r={},n=Object.keys(e),i=0,s=n.length;i<s;i+=1)o=n[i],a=String(e[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),c=t.compiledTypeMap.fallback[o],c&&mk.call(c.styleAliases,a)&&(a=c.styleAliases[a]),r[o]=a;return r}v(kk,"compileStyleMap");function vk(t){var e,r,n;if(e=t.toString(16).toUpperCase(),t<=255)r="x",n=2;else if(t<=65535)r="u",n=4;else if(t<=4294967295)r="U",n=8;else throw new or("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+Ee.repeat("0",n-e.length)+e}v(vk,"encodeHex");var UD=1,Yo=2;function wk(t){this.schema=t.schema||UC,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=Ee.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=kk(this.schema,t.styles||null),this.sortKeys=t.sortKeys||!1,this.lineWidth=t.lineWidth||80,this.noRefs=t.noRefs||!1,this.noCompatMode=t.noCompatMode||!1,this.condenseFlow=t.condenseFlow||!1,this.quotingType=t.quotingType==='"'?Yo:UD,this.forceQuotes=t.forceQuotes||!1,this.replacer=typeof t.replacer=="function"?t.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}v(wk,"State");function td(t,e){for(var r=Ee.repeat(" ",e),n=0,i=-1,s="",o,a=t.length;n<a;)i=t.indexOf(`
479
- `,n),i===-1?(o=t.slice(n),n=a):(o=t.slice(n,i+1),n=i+1),o.length&&o!==`
480
- `&&(s+=r),s+=o;return s}v(td,"indentString");function Xl(t,e){return`
481
- `+Ee.repeat(" ",t.indent*e)}v(Xl,"generateNextLine");function Sk(t,e){var r,n,i;for(r=0,n=t.implicitTypes.length;r<n;r+=1)if(i=t.implicitTypes[r],i.resolve(e))return!0;return!1}v(Sk,"testImplicitResolving");function Go(t){return t===ED||t===jD}v(Go,"isWhitespace");function gs(t){return 32<=t&&t<=126||161<=t&&t<=55295&&t!==8232&&t!==8233||57344<=t&&t<=65533&&t!==Xp||65536<=t&&t<=1114111}v(gs,"isPrintable");function ed(t){return gs(t)&&t!==Xp&&t!==ND&&t!==Vo}v(ed,"isNsCharOrWhitespace");function rd(t,e,r){var n=ed(t),i=n&&!Go(t);return(r?n:n&&t!==gk&&t!==xk&&t!==yk&&t!==bk&&t!==Ck)&&t!==Ju&&!(e===Gl&&!i)||ed(e)&&!Go(e)&&t===Ju||e===Gl&&i}v(rd,"isPlainSafe");function Tk(t){return gs(t)&&t!==Xp&&!Go(t)&&t!==PD&&t!==OD&&t!==Gl&&t!==gk&&t!==xk&&t!==yk&&t!==bk&&t!==Ck&&t!==Ju&&t!==MD&&t!==FD&&t!==LD&&t!==qD&&t!==$D&&t!==DD&&t!==ID&&t!==BD&&t!==AD&&t!==RD&&t!==zD}v(Tk,"isPlainSafeFirst");function _k(t){return!Go(t)&&t!==Gl}v(_k,"isPlainSafeLast");function Ri(t,e){var r=t.charCodeAt(e),n;return r>=55296&&r<=56319&&e+1<t.length&&(n=t.charCodeAt(e+1),n>=56320&&n<=57343)?(r-55296)*1024+n-56320+65536:r}v(Ri,"codePointAt");function Kp(t){var e=/^\n* /;return e.test(t)}v(Kp,"needIndentIndicator");var jk=1,nd=2,Nk=3,Ek=4,$i=5;function Lk(t,e,r,n,i,s,o,a){var c,h=0,u=null,d=!1,f=!1,p=n!==-1,m=-1,x=Tk(Ri(t,0))&&_k(Ri(t,t.length-1));if(e||o)for(c=0;c<t.length;h>=65536?c+=2:c++){if(h=Ri(t,c),!gs(h))return $i;x=x&&rd(h,u,a),u=h}else{for(c=0;c<t.length;h>=65536?c+=2:c++){if(h=Ri(t,c),h===Vo)d=!0,p&&(f=f||c-m-1>n&&t[m+1]!==" ",m=c);else if(!gs(h))return $i;x=x&&rd(h,u,a),u=h}f=f||p&&c-m-1>n&&t[m+1]!==" "}return!d&&!f?x&&!o&&!i(t)?jk:s===Yo?$i:nd:r>9&&Kp(t)?$i:o?s===Yo?$i:nd:f?Ek:Nk}v(Lk,"chooseScalarStyle");function Bk(t,e,r,n,i){t.dump=(function(){if(e.length===0)return t.quotingType===Yo?'""':"''";if(!t.noCompatMode&&(WD.indexOf(e)!==-1||HD.test(e)))return t.quotingType===Yo?'"'+e+'"':"'"+e+"'";var s=t.indent*Math.max(1,r),o=t.lineWidth===-1?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-s),a=n||t.flowLevel>-1&&r>=t.flowLevel;function c(h){return Sk(t,h)}switch(v(c,"testAmbiguity"),Lk(e,a,t.indent,o,c,t.quotingType,t.forceQuotes&&!n,i)){case jk:return e;case nd:return"'"+e.replace(/'/g,"''")+"'";case Nk:return"|"+id(e,t.indent)+sd(td(e,s));case Ek:return">"+id(e,t.indent)+sd(td(Ak(e,o),s));case $i:return'"'+Mk(e)+'"';default:throw new or("impossible error: invalid scalar style")}})()}v(Bk,"writeScalar");function id(t,e){var r=Kp(t)?String(e):"",n=t[t.length-1]===`
482
- `,i=n&&(t[t.length-2]===`
483
- `||t===`
484
- `),s=i?"+":n?"":"-";return r+s+`
485
- `}v(id,"blockHeader");function sd(t){return t[t.length-1]===`
486
- `?t.slice(0,-1):t}v(sd,"dropEndingNewline");function Ak(t,e){for(var r=/(\n+)([^\n]*)/g,n=(function(){var h=t.indexOf(`
487
- `);return h=h!==-1?h:t.length,r.lastIndex=h,od(t.slice(0,h),e)})(),i=t[0]===`
488
- `||t[0]===" ",s,o;o=r.exec(t);){var a=o[1],c=o[2];s=c[0]===" ",n+=a+(!i&&!s&&c!==""?`
489
- `:"")+od(c,e),i=s}return n}v(Ak,"foldString");function od(t,e){if(t===""||t[0]===" ")return t;for(var r=/ [^ ]/g,n,i=0,s,o=0,a=0,c="";n=r.exec(t);)a=n.index,a-i>e&&(s=o>i?o:a,c+=`
490
- `+t.slice(i,s),i=s+1),o=a;return c+=`
491
- `,t.length-i>e&&o>i?c+=t.slice(i,o)+`
492
- `+t.slice(o+1):c+=t.slice(i),c.slice(1)}v(od,"foldLine");function Mk(t){for(var e="",r=0,n,i=0;i<t.length;r>=65536?i+=2:i++)r=Ri(t,i),n=Ve[r],!n&&gs(r)?(e+=t[i],r>=65536&&(e+=t[i+1])):e+=n||vk(r);return e}v(Mk,"escapeString");function Ik(t,e,r){var n="",i=t.tag,s,o,a;for(s=0,o=r.length;s<o;s+=1)a=r[s],t.replacer&&(a=t.replacer.call(r,String(s),a)),(Xr(t,e,a,!1,!1)||typeof a>"u"&&Xr(t,e,null,!1,!1))&&(n!==""&&(n+=","+(t.condenseFlow?"":" ")),n+=t.dump);t.tag=i,t.dump="["+n+"]"}v(Ik,"writeFlowSequence");function ad(t,e,r,n){var i="",s=t.tag,o,a,c;for(o=0,a=r.length;o<a;o+=1)c=r[o],t.replacer&&(c=t.replacer.call(r,String(o),c)),(Xr(t,e+1,c,!0,!0,!1,!0)||typeof c>"u"&&Xr(t,e+1,null,!0,!0,!1,!0))&&((!n||i!=="")&&(i+=Xl(t,e)),t.dump&&Vo===t.dump.charCodeAt(0)?i+="-":i+="- ",i+=t.dump);t.tag=s,t.dump=i||"[]"}v(ad,"writeBlockSequence");function Fk(t,e,r){var n="",i=t.tag,s=Object.keys(r),o,a,c,h,u;for(o=0,a=s.length;o<a;o+=1)u="",n!==""&&(u+=", "),t.condenseFlow&&(u+='"'),c=s[o],h=r[c],t.replacer&&(h=t.replacer.call(r,c,h)),Xr(t,e,c,!1,!1)&&(t.dump.length>1024&&(u+="? "),u+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),Xr(t,e,h,!1,!1)&&(u+=t.dump,n+=u));t.tag=i,t.dump="{"+n+"}"}v(Fk,"writeFlowMapping");function Pk(t,e,r,n){var i="",s=t.tag,o=Object.keys(r),a,c,h,u,d,f;if(t.sortKeys===!0)o.sort();else if(typeof t.sortKeys=="function")o.sort(t.sortKeys);else if(t.sortKeys)throw new or("sortKeys must be a boolean or a function");for(a=0,c=o.length;a<c;a+=1)f="",(!n||i!=="")&&(f+=Xl(t,e)),h=o[a],u=r[h],t.replacer&&(u=t.replacer.call(r,h,u)),Xr(t,e+1,h,!0,!0,!0)&&(d=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,d&&(t.dump&&Vo===t.dump.charCodeAt(0)?f+="?":f+="? "),f+=t.dump,d&&(f+=Xl(t,e)),Xr(t,e+1,u,!0,d)&&(t.dump&&Vo===t.dump.charCodeAt(0)?f+=":":f+=": ",f+=t.dump,i+=f));t.tag=s,t.dump=i||"{}"}v(Pk,"writeBlockMapping");function ld(t,e,r){var n,i,s,o,a,c;for(i=r?t.explicitTypes:t.implicitTypes,s=0,o=i.length;s<o;s+=1)if(a=i[s],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof e=="object"&&e instanceof a.instanceOf)&&(!a.predicate||a.predicate(e))){if(r?a.multi&&a.representName?t.tag=a.representName(e):t.tag=a.tag:t.tag="?",a.represent){if(c=t.styleMap[a.tag]||a.defaultStyle,fk.call(a.represent)==="[object Function]")n=a.represent(e,c);else if(mk.call(a.represent,c))n=a.represent[c](e,c);else throw new or("!<"+a.tag+'> tag resolver accepts not "'+c+'" style');t.dump=n}return!0}return!1}v(ld,"detectType");function Xr(t,e,r,n,i,s,o){t.tag=null,t.dump=r,ld(t,r,!1)||ld(t,r,!0);var a=fk.call(t.dump),c=n,h;n&&(n=t.flowLevel<0||t.flowLevel>e);var u=a==="[object Object]"||a==="[object Array]",d,f;if(u&&(d=t.duplicates.indexOf(r),f=d!==-1),(t.tag!==null&&t.tag!=="?"||f||t.indent!==2&&e>0)&&(i=!1),f&&t.usedDuplicates[d])t.dump="*ref_"+d;else{if(u&&f&&!t.usedDuplicates[d]&&(t.usedDuplicates[d]=!0),a==="[object Object]")n&&Object.keys(t.dump).length!==0?(Pk(t,e,t.dump,i),f&&(t.dump="&ref_"+d+t.dump)):(Fk(t,e,t.dump),f&&(t.dump="&ref_"+d+" "+t.dump));else if(a==="[object Array]")n&&t.dump.length!==0?(t.noArrayIndent&&!o&&e>0?ad(t,e-1,t.dump,i):ad(t,e,t.dump,i),f&&(t.dump="&ref_"+d+t.dump)):(Ik(t,e,t.dump),f&&(t.dump="&ref_"+d+" "+t.dump));else if(a==="[object String]")t.tag!=="?"&&Bk(t,t.dump,e,s,c);else{if(a==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new or("unacceptable kind of an object to dump "+a)}t.tag!==null&&t.tag!=="?"&&(h=encodeURI(t.tag[0]==="!"?t.tag.slice(1):t.tag).replace(/!/g,"%21"),t.tag[0]==="!"?h="!"+h:h.slice(0,18)==="tag:yaml.org,2002:"?h="!!"+h.slice(18):h="!<"+h+">",t.dump=h+" "+t.dump)}return!0}v(Xr,"writeNode");function $k(t,e){var r=[],n=[],i,s;for(Kl(t,r,n),i=0,s=n.length;i<s;i+=1)e.duplicates.push(r[n[i]]);e.usedDuplicates=new Array(s)}v($k,"getDuplicateReferences");function Kl(t,e,r){var n,i,s;if(t!==null&&typeof t=="object")if(i=e.indexOf(t),i!==-1)r.indexOf(i)===-1&&r.push(i);else if(e.push(t),Array.isArray(t))for(i=0,s=t.length;i<s;i+=1)Kl(t[i],e,r);else for(n=Object.keys(t),i=0,s=n.length;i<s;i+=1)Kl(t[n[i]],e,r)}v(Kl,"inspectNode");function VD(t,e){e=e||{};var r=new wk(e);r.noRefs||$k(t,r);var n=t;return r.replacer&&(n=r.replacer.call({"":n},"",n)),Xr(r,0,n,!0,!0)?r.dump+`
493
- `:""}v(VD,"dump$1");function YD(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}v(YD,"renamed");var GD=NC,XD=_D.load;/*! Bundled license information:
494
-
495
- js-yaml/dist/js-yaml.mjs:
496
- (*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
497
- */var ro=v((t,e)=>{if(e)return"translate("+-t.width/2+", "+-t.height/2+")";const r=t.x??0,n=t.y??0;return"translate("+-(r+t.width/2)+", "+-(n+t.height/2)+")"},"computeLabelTransform"),ze={aggregation:17.25,extension:17.25,composition:17.25,dependency:6,lollipop:13.5,arrow_point:4,arrow_barb:0,arrow_barb_neo:5.5},Mg={arrow_point:4,arrow_cross:12.5,arrow_circle:12.5};function Co(t,e){if(t===void 0||e===void 0)return{angle:0,deltaX:0,deltaY:0};t=ue(t),e=ue(e);const[r,n]=[t.x,t.y],[i,s]=[e.x,e.y],o=i-r,a=s-n;return{angle:Math.atan(a/o),deltaX:o,deltaY:a}}v(Co,"calculateDeltaAndAngle");var ue=v(t=>Array.isArray(t)?{x:t[0],y:t[1]}:t,"pointTransformer"),KD=v(t=>({x:v(function(e,r,n){let i=0;const s=ue(n[0]).x<ue(n[n.length-1]).x?"left":"right";if(r===0&&Object.hasOwn(ze,t.arrowTypeStart)){const{angle:p,deltaX:m}=Co(n[0],n[1]);i=ze[t.arrowTypeStart]*Math.cos(p)*(m>=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(ze,t.arrowTypeEnd)){const{angle:p,deltaX:m}=Co(n[n.length-1],n[n.length-2]);i=ze[t.arrowTypeEnd]*Math.cos(p)*(m>=0?1:-1)}const o=Math.abs(ue(e).x-ue(n[n.length-1]).x),a=Math.abs(ue(e).y-ue(n[n.length-1]).y),c=Math.abs(ue(e).x-ue(n[0]).x),h=Math.abs(ue(e).y-ue(n[0]).y),u=ze[t.arrowTypeStart],d=ze[t.arrowTypeEnd],f=1;if(o<d&&o>0&&a<d){let p=d+f-o;p*=s==="right"?-1:1,i-=p}if(c<u&&c>0&&h<u){let p=u+f-c;p*=s==="right"?-1:1,i+=p}return ue(e).x+i},"x"),y:v(function(e,r,n){let i=0;const s=ue(n[0]).y<ue(n[n.length-1]).y?"down":"up";if(r===0&&Object.hasOwn(ze,t.arrowTypeStart)){const{angle:p,deltaY:m}=Co(n[0],n[1]);i=ze[t.arrowTypeStart]*Math.abs(Math.sin(p))*(m>=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(ze,t.arrowTypeEnd)){const{angle:p,deltaY:m}=Co(n[n.length-1],n[n.length-2]);i=ze[t.arrowTypeEnd]*Math.abs(Math.sin(p))*(m>=0?1:-1)}const o=Math.abs(ue(e).y-ue(n[n.length-1]).y),a=Math.abs(ue(e).x-ue(n[n.length-1]).x),c=Math.abs(ue(e).y-ue(n[0]).y),h=Math.abs(ue(e).x-ue(n[0]).x),u=ze[t.arrowTypeStart],d=ze[t.arrowTypeEnd],f=1;if(o<d&&o>0&&a<d){let p=d+f-o;p*=s==="up"?-1:1,i-=p}if(c<u&&c>0&&h<u){let p=u+f-c;p*=s==="up"?-1:1,i+=p}return ue(e).y+i},"y")}),"getLineFunctionsWithOffset"),Pa={},je={},Ig;function QD(){return Ig||(Ig=1,Object.defineProperty(je,"__esModule",{value:!0}),je.BLANK_URL=je.relativeFirstCharacters=je.whitespaceEscapeCharsRegex=je.urlSchemeRegex=je.ctrlCharactersRegex=je.htmlCtrlEntityRegex=je.htmlEntitiesRegex=je.invalidProtocolRegex=void 0,je.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im,je.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g,je.htmlCtrlEntityRegex=/&(newline|tab);/gi,je.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,je.urlSchemeRegex=/^.+(:|&colon;)/gim,je.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g,je.relativeFirstCharacters=[".","/"],je.BLANK_URL="about:blank"),je}var Fg;function ZD(){if(Fg)return Pa;Fg=1,Object.defineProperty(Pa,"__esModule",{value:!0}),Pa.sanitizeUrl=s;var t=QD();function e(o){return t.relativeFirstCharacters.indexOf(o[0])>-1}function r(o){var a=o.replace(t.ctrlCharactersRegex,"");return a.replace(t.htmlEntitiesRegex,function(c,h){return String.fromCharCode(h)})}function n(o){return URL.canParse(o)}function i(o){try{return decodeURIComponent(o)}catch{return o}}function s(o){if(!o)return t.BLANK_URL;var a,c=i(o.trim());do c=r(c).replace(t.htmlCtrlEntityRegex,"").replace(t.ctrlCharactersRegex,"").replace(t.whitespaceEscapeCharsRegex,"").trim(),c=i(c),a=c.match(t.ctrlCharactersRegex)||c.match(t.htmlEntitiesRegex)||c.match(t.htmlCtrlEntityRegex)||c.match(t.whitespaceEscapeCharsRegex);while(a&&a.length>0);var h=c;if(!h)return t.BLANK_URL;if(e(h))return h;var u=h.trimStart(),d=u.match(t.urlSchemeRegex);if(!d)return h;var f=d[0].toLowerCase().trim();if(t.invalidProtocolRegex.test(f))return t.BLANK_URL;var p=u.replace(/\\/g,"/");if(f==="mailto:"||f.includes("://"))return p;if(f==="http:"||f==="https:"){if(!n(p))return t.BLANK_URL;var m=new URL(p);return m.protocol=m.protocol.toLowerCase(),m.hostname=m.hostname.toLowerCase(),m.toString()}return p}return Pa}var JD=ZD(),Dk=typeof global=="object"&&global&&global.Object===Object&&global,tO=typeof self=="object"&&self&&self.Object===Object&&self,rn=Dk||tO||Function("return this")(),Ql=rn.Symbol,Ok=Object.prototype,eO=Ok.hasOwnProperty,rO=Ok.toString,no=Ql?Ql.toStringTag:void 0;function nO(t){var e=eO.call(t,no),r=t[no];try{t[no]=void 0;var n=!0}catch{}var i=rO.call(t);return n&&(e?t[no]=r:delete t[no]),i}var iO=Object.prototype,sO=iO.toString;function oO(t){return sO.call(t)}var aO="[object Null]",lO="[object Undefined]",Pg=Ql?Ql.toStringTag:void 0;function Ss(t){return t==null?t===void 0?lO:aO:Pg&&Pg in Object(t)?nO(t):oO(t)}function yi(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var cO="[object AsyncFunction]",hO="[object Function]",uO="[object GeneratorFunction]",dO="[object Proxy]";function Qp(t){if(!yi(t))return!1;var e=Ss(t);return e==hO||e==uO||e==cO||e==dO}var Vh=rn["__core-js_shared__"],$g=(function(){var t=/[^.]+$/.exec(Vh&&Vh.keys&&Vh.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function pO(t){return!!$g&&$g in t}var fO=Function.prototype,mO=fO.toString;function bi(t){if(t!=null){try{return mO.call(t)}catch{}try{return t+""}catch{}}return""}var gO=/[\\^$.*+?()[\]{}|]/g,xO=/^\[object .+?Constructor\]$/,yO=Function.prototype,bO=Object.prototype,CO=yO.toString,kO=bO.hasOwnProperty,vO=RegExp("^"+CO.call(kO).replace(gO,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function wO(t){if(!yi(t)||pO(t))return!1;var e=Qp(t)?vO:xO;return e.test(bi(t))}function SO(t,e){return t==null?void 0:t[e]}function Ci(t,e){var r=SO(t,e);return wO(r)?r:void 0}var Xo=Ci(Object,"create");function TO(){this.__data__=Xo?Xo(null):{},this.size=0}function _O(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var jO="__lodash_hash_undefined__",NO=Object.prototype,EO=NO.hasOwnProperty;function LO(t){var e=this.__data__;if(Xo){var r=e[t];return r===jO?void 0:r}return EO.call(e,t)?e[t]:void 0}var BO=Object.prototype,AO=BO.hasOwnProperty;function MO(t){var e=this.__data__;return Xo?e[t]!==void 0:AO.call(e,t)}var IO="__lodash_hash_undefined__";function FO(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Xo&&e===void 0?IO:e,this}function ui(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}ui.prototype.clear=TO;ui.prototype.delete=_O;ui.prototype.get=LO;ui.prototype.has=MO;ui.prototype.set=FO;function PO(){this.__data__=[],this.size=0}function Rc(t,e){return t===e||t!==t&&e!==e}function zc(t,e){for(var r=t.length;r--;)if(Rc(t[r][0],e))return r;return-1}var $O=Array.prototype,DO=$O.splice;function OO(t){var e=this.__data__,r=zc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():DO.call(e,r,1),--this.size,!0}function RO(t){var e=this.__data__,r=zc(e,t);return r<0?void 0:e[r][1]}function zO(t){return zc(this.__data__,t)>-1}function qO(t,e){var r=this.__data__,n=zc(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}function xn(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}xn.prototype.clear=PO;xn.prototype.delete=OO;xn.prototype.get=RO;xn.prototype.has=zO;xn.prototype.set=qO;var Ko=Ci(rn,"Map");function WO(){this.size=0,this.__data__={hash:new ui,map:new(Ko||xn),string:new ui}}function HO(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function qc(t,e){var r=t.__data__;return HO(e)?r[typeof e=="string"?"string":"hash"]:r.map}function UO(t){var e=qc(this,t).delete(t);return this.size-=e?1:0,e}function VO(t){return qc(this,t).get(t)}function YO(t){return qc(this,t).has(t)}function GO(t,e){var r=qc(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}function On(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}On.prototype.clear=WO;On.prototype.delete=UO;On.prototype.get=VO;On.prototype.has=YO;On.prototype.set=GO;var XO="Expected a function";function pa(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(XO);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=t.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(pa.Cache||On),r}pa.Cache=On;function KO(){this.__data__=new xn,this.size=0}function QO(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}function ZO(t){return this.__data__.get(t)}function JO(t){return this.__data__.has(t)}var tR=200;function eR(t,e){var r=this.__data__;if(r instanceof xn){var n=r.__data__;if(!Ko||n.length<tR-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new On(n)}return r.set(t,e),this.size=r.size,this}function Ts(t){var e=this.__data__=new xn(t);this.size=e.size}Ts.prototype.clear=KO;Ts.prototype.delete=QO;Ts.prototype.get=ZO;Ts.prototype.has=JO;Ts.prototype.set=eR;var Zl=(function(){try{var t=Ci(Object,"defineProperty");return t({},"",{}),t}catch{}})();function Zp(t,e,r){e=="__proto__"&&Zl?Zl(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}function cd(t,e,r){(r!==void 0&&!Rc(t[e],r)||r===void 0&&!(e in t))&&Zp(t,e,r)}function rR(t){return function(e,r,n){for(var i=-1,s=Object(e),o=n(e),a=o.length;a--;){var c=o[++i];if(r(s[c],c,s)===!1)break}return e}}var nR=rR(),Rk=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Dg=Rk&&typeof module=="object"&&module&&!module.nodeType&&module,iR=Dg&&Dg.exports===Rk,Og=iR?rn.Buffer:void 0,Rg=Og?Og.allocUnsafe:void 0;function sR(t,e){if(e)return t.slice();var r=t.length,n=Rg?Rg(r):new t.constructor(r);return t.copy(n),n}var zg=rn.Uint8Array;function oR(t){var e=new t.constructor(t.byteLength);return new zg(e).set(new zg(t)),e}function aR(t,e){var r=e?oR(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function lR(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var qg=Object.create,cR=(function(){function t(){}return function(e){if(!yi(e))return{};if(qg)return qg(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}})();function zk(t,e){return function(r){return t(e(r))}}var qk=zk(Object.getPrototypeOf,Object),hR=Object.prototype;function Wc(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||hR;return t===r}function uR(t){return typeof t.constructor=="function"&&!Wc(t)?cR(qk(t)):{}}function fa(t){return t!=null&&typeof t=="object"}var dR="[object Arguments]";function Wg(t){return fa(t)&&Ss(t)==dR}var Wk=Object.prototype,pR=Wk.hasOwnProperty,fR=Wk.propertyIsEnumerable,Jl=Wg((function(){return arguments})())?Wg:function(t){return fa(t)&&pR.call(t,"callee")&&!fR.call(t,"callee")},tc=Array.isArray,mR=9007199254740991;function Hk(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=mR}function Hc(t){return t!=null&&Hk(t.length)&&!Qp(t)}function gR(t){return fa(t)&&Hc(t)}function xR(){return!1}var Uk=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Hg=Uk&&typeof module=="object"&&module&&!module.nodeType&&module,yR=Hg&&Hg.exports===Uk,Ug=yR?rn.Buffer:void 0,bR=Ug?Ug.isBuffer:void 0,Jp=bR||xR,CR="[object Object]",kR=Function.prototype,vR=Object.prototype,Vk=kR.toString,wR=vR.hasOwnProperty,SR=Vk.call(Object);function TR(t){if(!fa(t)||Ss(t)!=CR)return!1;var e=qk(t);if(e===null)return!0;var r=wR.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&Vk.call(r)==SR}var _R="[object Arguments]",jR="[object Array]",NR="[object Boolean]",ER="[object Date]",LR="[object Error]",BR="[object Function]",AR="[object Map]",MR="[object Number]",IR="[object Object]",FR="[object RegExp]",PR="[object Set]",$R="[object String]",DR="[object WeakMap]",OR="[object ArrayBuffer]",RR="[object DataView]",zR="[object Float32Array]",qR="[object Float64Array]",WR="[object Int8Array]",HR="[object Int16Array]",UR="[object Int32Array]",VR="[object Uint8Array]",YR="[object Uint8ClampedArray]",GR="[object Uint16Array]",XR="[object Uint32Array]",he={};he[zR]=he[qR]=he[WR]=he[HR]=he[UR]=he[VR]=he[YR]=he[GR]=he[XR]=!0;he[_R]=he[jR]=he[OR]=he[NR]=he[RR]=he[ER]=he[LR]=he[BR]=he[AR]=he[MR]=he[IR]=he[FR]=he[PR]=he[$R]=he[DR]=!1;function KR(t){return fa(t)&&Hk(t.length)&&!!he[Ss(t)]}function QR(t){return function(e){return t(e)}}var Yk=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ao=Yk&&typeof module=="object"&&module&&!module.nodeType&&module,ZR=Ao&&Ao.exports===Yk,Yh=ZR&&Dk.process,Vg=(function(){try{var t=Ao&&Ao.require&&Ao.require("util").types;return t||Yh&&Yh.binding&&Yh.binding("util")}catch{}})(),Yg=Vg&&Vg.isTypedArray,tf=Yg?QR(Yg):KR;function hd(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var JR=Object.prototype,t6=JR.hasOwnProperty;function e6(t,e,r){var n=t[e];(!(t6.call(t,e)&&Rc(n,r))||r===void 0&&!(e in t))&&Zp(t,e,r)}function r6(t,e,r,n){var i=!r;r||(r={});for(var s=-1,o=e.length;++s<o;){var a=e[s],c=void 0;c===void 0&&(c=t[a]),i?Zp(r,a,c):e6(r,a,c)}return r}function n6(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var i6=9007199254740991,s6=/^(?:0|[1-9]\d*)$/;function Gk(t,e){var r=typeof t;return e=e??i6,!!e&&(r=="number"||r!="symbol"&&s6.test(t))&&t>-1&&t%1==0&&t<e}var o6=Object.prototype,a6=o6.hasOwnProperty;function l6(t,e){var r=tc(t),n=!r&&Jl(t),i=!r&&!n&&Jp(t),s=!r&&!n&&!i&&tf(t),o=r||n||i||s,a=o?n6(t.length,String):[],c=a.length;for(var h in t)(e||a6.call(t,h))&&!(o&&(h=="length"||i&&(h=="offset"||h=="parent")||s&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||Gk(h,c)))&&a.push(h);return a}function c6(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var h6=Object.prototype,u6=h6.hasOwnProperty;function d6(t){if(!yi(t))return c6(t);var e=Wc(t),r=[];for(var n in t)n=="constructor"&&(e||!u6.call(t,n))||r.push(n);return r}function Xk(t){return Hc(t)?l6(t,!0):d6(t)}function p6(t){return r6(t,Xk(t))}function f6(t,e,r,n,i,s,o){var a=hd(t,r),c=hd(e,r),h=o.get(c);if(h){cd(t,r,h);return}var u=s?s(a,c,r+"",t,e,o):void 0,d=u===void 0;if(d){var f=tc(c),p=!f&&Jp(c),m=!f&&!p&&tf(c);u=c,f||p||m?tc(a)?u=a:gR(a)?u=lR(a):p?(d=!1,u=sR(c,!0)):m?(d=!1,u=aR(c,!0)):u=[]:TR(c)||Jl(c)?(u=a,Jl(a)?u=p6(a):(!yi(a)||Qp(a))&&(u=uR(c))):d=!1}d&&(o.set(c,u),i(u,c,n,s,o),o.delete(c)),cd(t,r,u)}function Kk(t,e,r,n,i){t!==e&&nR(e,function(s,o){if(i||(i=new Ts),yi(s))f6(t,e,o,r,Kk,n,i);else{var a=n?n(hd(t,o),s,o+"",t,e,i):void 0;a===void 0&&(a=s),cd(t,o,a)}},Xk)}function Qk(t){return t}function m6(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var Gg=Math.max;function g6(t,e,r){return e=Gg(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,s=Gg(n.length-e,0),o=Array(s);++i<s;)o[i]=n[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=n[i];return a[e]=r(o),m6(t,this,a)}}function x6(t){return function(){return t}}var y6=Zl?function(t,e){return Zl(t,"toString",{configurable:!0,enumerable:!1,value:x6(e),writable:!0})}:Qk,b6=800,C6=16,k6=Date.now;function v6(t){var e=0,r=0;return function(){var n=k6(),i=C6-(n-r);if(r=n,i>0){if(++e>=b6)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var w6=v6(y6);function S6(t,e){return w6(g6(t,e,Qk),t+"")}function T6(t,e,r){if(!yi(r))return!1;var n=typeof e;return(n=="number"?Hc(r)&&Gk(e,r.length):n=="string"&&e in r)?Rc(r[e],t):!1}function _6(t){return S6(function(e,r){var n=-1,i=r.length,s=i>1?r[i-1]:void 0,o=i>2?r[2]:void 0;for(s=t.length>3&&typeof s=="function"?(i--,s):void 0,o&&T6(r[0],r[1],o)&&(s=i<3?void 0:s,i=1),e=Object(e);++n<i;){var a=r[n];a&&t(e,a,n,s)}return e})}var j6=_6(function(t,e,r){Kk(t,e,r)}),N6="​",E6={curveBasis:Yu,curveBasisClosed:I$,curveBasisOpen:F$,curveBumpX:$1,curveBumpY:D1,curveBundle:P$,curveCardinalClosed:$$,curveCardinalOpen:D$,curveCardinal:q1,curveCatmullRomClosed:O$,curveCatmullRomOpen:R$,curveCatmullRom:H1,curveLinear:Bo,curveLinearClosed:z$,curveMonotoneX:K1,curveMonotoneY:Q1,curveNatural:J1,curveStep:tC,curveStepAfter:rC,curveStepBefore:eC},L6=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,B6=v(function(t,e){const r=Zk(t,/(?:init\b)|(?:initialize\b)/);let n={};if(Array.isArray(r)){const o=r.map(a=>a.args);Bl(o),n=Ne(n,[...o])}else n=r.args;if(!n)return;let i=Tp(t,e);const s="config";return n[s]!==void 0&&(i==="flowchart-v2"&&(i="flowchart"),n[i]=n[s],delete n[s]),n},"detectInit"),Zk=v(function(t,e=null){var r,n;try{const i=new RegExp(`[%]{2}(?![{]${L6.source})(?=[}][%]{2}).*
498
- `,"ig");t=t.trim().replace(i,"").replace(/'/gm,'"'),rt.debug(`Detecting diagram directive${e!==null?" type:"+e:""} based on the text:${t}`);let s;const o=[];for(;(s=Eo.exec(t))!==null;)if(s.index===Eo.lastIndex&&Eo.lastIndex++,s&&!e||e&&((r=s[1])!=null&&r.match(e))||e&&((n=s[2])!=null&&n.match(e))){const a=s[1]?s[1]:s[2],c=s[3]?s[3].trim():s[4]?JSON.parse(s[4].trim()):null;o.push({type:a,args:c})}return o.length===0?{type:t,args:null}:o.length===1?o[0]:o}catch(i){return rt.error(`ERROR: ${i.message} - Unable to parse directive type: '${e}' based on the text: '${t}'`),{type:void 0,args:null}}},"detectDirective"),A6=v(function(t){return t.replace(Eo,"")},"removeDirectives"),M6=v(function(t,e){for(const[r,n]of e.entries())if(n.match(t))return r;return-1},"isSubstringInArray");function ef(t,e){if(!t)return e;const r=`curve${t.charAt(0).toUpperCase()+t.slice(1)}`;return E6[r]??e}v(ef,"interpolateToCurve");function Jk(t,e){const r=t.trim();if(r)return e.securityLevel!=="loose"?JD.sanitizeUrl(r):r}v(Jk,"formatUrl");var I6=v((t,...e)=>{const r=t.split("."),n=r.length-1,i=r[n];let s=window;for(let o=0;o<n;o++)if(s=s[r[o]],!s){rt.error(`Function name: ${t} not found in window`);return}s[i](...e)},"runFunc");function rf(t,e){return!t||!e?0:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}v(rf,"distance");function tv(t){let e,r=0;t.forEach(i=>{r+=rf(i,e),e=i});const n=r/2;return nf(t,n)}v(tv,"traverseEdge");function ev(t){return t.length===1?t[0]:tv(t)}v(ev,"calcLabelPosition");var Xg=v((t,e=2)=>{const r=Math.pow(10,e);return Math.round(t*r)/r},"roundNumber"),nf=v((t,e)=>{let r,n=e;for(const i of t){if(r){const s=rf(i,r);if(s===0)return r;if(s<n)n-=s;else{const o=n/s;if(o<=0)return r;if(o>=1)return{x:i.x,y:i.y};if(o>0&&o<1)return{x:Xg((1-o)*r.x+o*i.x,5),y:Xg((1-o)*r.y+o*i.y,5)}}}r=i}throw new Error("Could not find a suitable point for the given distance")},"calculatePoint"),F6=v((t,e,r)=>{rt.info(`our points ${JSON.stringify(e)}`),e[0]!==r&&(e=e.reverse());const i=nf(e,25),s=t?10:5,o=Math.atan2(e[0].y-i.y,e[0].x-i.x),a={x:0,y:0};return a.x=Math.sin(o)*s+(e[0].x+i.x)/2,a.y=-Math.cos(o)*s+(e[0].y+i.y)/2,a},"calcCardinalityPosition");function rv(t,e,r){const n=structuredClone(r);rt.info("our points",n),e!=="start_left"&&e!=="start_right"&&n.reverse();const i=25+t,s=nf(n,i),o=10+t*.5,a=Math.atan2(n[0].y-s.y,n[0].x-s.x),c={x:0,y:0};return e==="start_left"?(c.x=Math.sin(a+Math.PI)*o+(n[0].x+s.x)/2,c.y=-Math.cos(a+Math.PI)*o+(n[0].y+s.y)/2):e==="end_right"?(c.x=Math.sin(a-Math.PI)*o+(n[0].x+s.x)/2-5,c.y=-Math.cos(a-Math.PI)*o+(n[0].y+s.y)/2-5):e==="end_left"?(c.x=Math.sin(a)*o+(n[0].x+s.x)/2-5,c.y=-Math.cos(a)*o+(n[0].y+s.y)/2-5):(c.x=Math.sin(a)*o+(n[0].x+s.x)/2,c.y=-Math.cos(a)*o+(n[0].y+s.y)/2),c}v(rv,"calcTerminalLabelPosition");function nv(t){let e="",r="";for(const n of t)n!==void 0&&(n.startsWith("color:")||n.startsWith("text-align:")?r=r+n+";":e=e+n+";");return{style:e,labelStyle:r}}v(nv,"getStylesFromArray");var Kg=0,P6=v(()=>(Kg++,"id-"+Math.random().toString(36).substr(2,12)+"-"+Kg),"generateId");function iv(t){let e="";const r="0123456789abcdef",n=r.length;for(let i=0;i<t;i++)e+=r.charAt(Math.floor(Math.random()*n));return e}v(iv,"makeRandomHex");var $6=v(t=>iv(t.length),"random"),D6=v(function(){return{x:0,y:0,fill:void 0,anchor:"start",style:"#666",width:100,height:100,textMargin:0,rx:0,ry:0,valign:void 0,text:""}},"getTextObj"),O6=v(function(t,e){const r=e.text.replace(ca.lineBreakRegex," "),[,n]=Uc(e.fontSize),i=t.append("text");i.attr("x",e.x),i.attr("y",e.y),i.style("text-anchor",e.anchor),i.style("font-family",e.fontFamily),i.style("font-size",n),i.style("font-weight",e.fontWeight),i.attr("fill",e.fill),e.class!==void 0&&i.attr("class",e.class);const s=i.append("tspan");return s.attr("x",e.x+e.textMargin*2),s.attr("fill",e.fill),s.text(r),i},"drawSimpleText"),R6=pa((t,e,r)=>{if(!t||(r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"<br/>"},r),ca.lineBreakRegex.test(t)))return t;const n=t.split(" ").filter(Boolean),i=[];let s="";return n.forEach((o,a)=>{const c=pn(`${o} `,r),h=pn(s,r);if(c>e){const{hyphenatedStrings:f,remainingWord:p}=z6(o,e,"-",r);i.push(s,...f),s=p}else h+c>=e?(i.push(s),s=o):s=[s,o].filter(Boolean).join(" ");a+1===n.length&&i.push(s)}),i.filter(o=>o!=="").join(r.joinWith)},(t,e,r)=>`${t}${e}${r.fontSize}${r.fontWeight}${r.fontFamily}${r.joinWith}`),z6=pa((t,e,r="-",n)=>{n=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:0},n);const i=[...t],s=[];let o="";return i.forEach((a,c)=>{const h=`${o}${a}`;if(pn(h,n)>=e){const d=c+1,f=i.length===d,p=`${h}${r}`;s.push(f?h:p),o=""}else o=h}),{hyphenatedStrings:s,remainingWord:o}},(t,e,r="-",n)=>`${t}${e}${r}${n.fontSize}${n.fontWeight}${n.fontFamily}`);function sv(t,e){return sf(t,e).height}v(sv,"calculateTextHeight");function pn(t,e){return sf(t,e).width}v(pn,"calculateTextWidth");var sf=pa((t,e)=>{const{fontSize:r=12,fontFamily:n="Arial",fontWeight:i=400}=e;if(!t)return{width:0,height:0};const[,s]=Uc(r),o=["sans-serif",n],a=t.split(ca.lineBreakRegex),c=[],h=Ot("body");if(!h.remove)return{width:0,height:0,lineHeight:0};const u=h.append("svg");for(const f of o){let p=0;const m={width:0,height:0,lineHeight:0};for(const x of a){const g=D6();g.text=x||N6;const y=O6(u,g).style("font-size",s).style("font-weight",i).style("font-family",f),k=(y._groups||y)[0][0].getBBox();if(k.width===0&&k.height===0)throw new Error("svg element not in render tree");m.width=Math.round(Math.max(m.width,k.width)),p=Math.round(k.height),m.height+=p,m.lineHeight=Math.round(Math.max(m.lineHeight,p))}c.push(m)}u.remove();const d=isNaN(c[1].height)||isNaN(c[1].width)||isNaN(c[1].lineHeight)||c[0].height>c[1].height&&c[0].width>c[1].width&&c[0].lineHeight>c[1].lineHeight?0:1;return c[d]},(t,e)=>`${t}${e.fontSize}${e.fontWeight}${e.fontFamily}`),as,q6=(as=class{constructor(e=!1,r){this.count=0,this.count=r?r.length:0,this.next=e?()=>this.count++:()=>Date.now()}},v(as,"InitIDGenerator"),as),$a,W6=v(function(t){return $a=$a||document.createElement("div"),t=escape(t).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),$a.innerHTML=t,unescape($a.textContent)},"entityDecode");function of(t){return"str"in t}v(of,"isDetailedError");var H6=v((t,e,r,n)=>{var s;if(!n)return;const i=(s=t.node())==null?void 0:s.getBBox();i&&t.append("text").text(n).attr("text-anchor","middle").attr("x",i.x+i.width/2).attr("y",-r).attr("class",e)},"insertTitle"),Uc=v(t=>{if(typeof t=="number")return[t,t+"px"];const e=parseInt(t??"",10);return Number.isNaN(e)?[void 0,void 0]:t===String(e)?[e,t+"px"]:[e,t]},"parseFontSize");function af(t,e){return j6({},t,e)}v(af,"cleanAndMerge");var Ar={assignWithDepth:Ne,wrapLabel:R6,calculateTextHeight:sv,calculateTextWidth:pn,calculateTextDimensions:sf,cleanAndMerge:af,detectInit:B6,detectDirective:Zk,isSubstringInArray:M6,interpolateToCurve:ef,calcLabelPosition:ev,calcCardinalityPosition:F6,calcTerminalLabelPosition:rv,formatUrl:Jk,getStylesFromArray:nv,generateId:P6,random:$6,runFunc:I6,entityDecode:W6,insertTitle:H6,isLabelCoordinateInPath:ov,parseFontSize:Uc,InitIDGenerator:q6},U6=v(function(t){let e=t;return e=e.replace(/style.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),e=e.replace(/classDef.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),e=e.replace(/#\w+;/g,function(r){const n=r.substring(1,r.length-1);return/^\+?\d+$/.test(n)?"fl°°"+n+"¶ß":"fl°"+n+"¶ß"}),e},"encodeEntities"),di=v(function(t){return t.replace(/fl°°/g,"&#").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),BK=v((t,e,{counter:r=0,prefix:n,suffix:i},s)=>s||`${n?`${n}_`:""}${t}_${e}_${r}${i?`_${i}`:""}`,"getEdgeId");function Be(t){return t??null}v(Be,"handleUndefinedAttr");function ov(t,e){const r=Math.round(t.x),n=Math.round(t.y),i=e.replace(/(\d+\.\d+)/g,s=>Math.round(parseFloat(s)).toString());return i.includes(r.toString())||i.includes(n.toString())}v(ov,"isLabelCoordinateInPath");var lf=v(({flowchart:t})=>{var i,s;const e=((i=t==null?void 0:t.subGraphTitleMargin)==null?void 0:i.top)??0,r=((s=t==null?void 0:t.subGraphTitleMargin)==null?void 0:s.bottom)??0,n=e+r;return{subGraphTitleTopMargin:e,subGraphTitleBottomMargin:r,subGraphTitleTotalMargin:n}},"getSubGraphTitleMargins");async function av(t,e){const r=t.getElementsByTagName("img");if(!r||r.length===0)return;const n=e.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...r].map(i=>new Promise(s=>{function o(){if(i.style.display="flex",i.style.flexDirection="column",n){const a=Vt().fontSize?Vt().fontSize:window.getComputedStyle(document.body).fontSize,c=5,[h=Kb.fontSize]=Uc(a),u=h*c+"px";i.style.minWidth=u,i.style.maxWidth=u}else i.style.width="100%";s(i)}v(o,"setupImage"),setTimeout(()=>{i.complete&&o()}),i.addEventListener("error",o),i.addEventListener("load",o)})))}v(av,"configureLabelImages");var V6=v(t=>{const{handDrawnSeed:e}=Vt();return{fill:t,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:t,seed:e}},"solidStateFill"),_s=v(t=>{const e=Y6([...t.cssCompiledStyles||[],...t.cssStyles||[],...t.labelStyle||[]]);return{stylesMap:e,stylesArray:[...e]}},"compileStyles"),Y6=v(t=>{const e=new Map;return t.forEach(r=>{const[n,i]=r.split(":");e.set(n.trim(),i==null?void 0:i.trim())}),e},"styles2Map"),lv=v(t=>t==="color"||t==="font-size"||t==="font-family"||t==="font-weight"||t==="font-style"||t==="text-decoration"||t==="text-align"||t==="text-transform"||t==="line-height"||t==="letter-spacing"||t==="word-spacing"||t==="text-shadow"||t==="text-overflow"||t==="white-space"||t==="word-wrap"||t==="word-break"||t==="overflow-wrap"||t==="hyphens","isLabelStyle"),xt=v(t=>{const{stylesArray:e}=_s(t),r=[],n=[],i=[],s=[];return e.forEach(o=>{const a=o[0];lv(a)?r.push(o.join(":")+" !important"):(n.push(o.join(":")+" !important"),a.includes("stroke")&&i.push(o.join(":")+" !important"),a==="fill"&&s.push(o.join(":")+" !important"))}),{labelStyles:r.join(";"),nodeStyles:n.join(";"),stylesArray:e,borderStyles:i,backgroundStyles:s}},"styles2String"),gt=v((t,e)=>{var c;const{themeVariables:r,handDrawnSeed:n}=Vt(),{nodeBorder:i,mainBkg:s}=r,{stylesMap:o}=_s(t);return Object.assign({roughness:.7,fill:o.get("fill")||s,fillStyle:"hachure",fillWeight:4,hachureGap:5.2,stroke:o.get("stroke")||i,seed:n,strokeWidth:((c=o.get("stroke-width"))==null?void 0:c.replace("px",""))||1.3,fillLineDash:[0,0],strokeLineDash:G6(o.get("stroke-dasharray"))},e)},"userNodeOverrides"),G6=v(t=>{if(!t)return[0,0];const e=t.trim().split(/\s+/).map(Number);if(e.length===1){const i=isNaN(e[0])?0:e[0];return[i,i]}const r=isNaN(e[0])?0:e[0],n=isNaN(e[1])?0:e[1];return[r,n]},"getStrokeDashArray");const X6=Object.freeze({left:0,top:0,width:16,height:16}),ec=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),cv=Object.freeze({...X6,...ec}),K6=Object.freeze({...cv,body:"",hidden:!1}),Q6=Object.freeze({width:null,height:null}),Z6=Object.freeze({...Q6,...ec}),J6=(t,e,r,n="")=>{const i=t.split(":");if(t.slice(0,1)==="@"){if(i.length<2||i.length>3)return null;n=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){const a=i.pop(),c=i.pop(),h={provider:i.length>0?i[0]:n,prefix:c,name:a};return Gh(h)?h:null}const s=i[0],o=s.split("-");if(o.length>1){const a={provider:n,prefix:o.shift(),name:o.join("-")};return Gh(a)?a:null}if(r&&n===""){const a={provider:n,prefix:"",name:s};return Gh(a,r)?a:null}return null},Gh=(t,e)=>t?!!((e&&t.prefix===""||t.prefix)&&t.name):!1;function t8(t,e){const r={};!t.hFlip!=!e.hFlip&&(r.hFlip=!0),!t.vFlip!=!e.vFlip&&(r.vFlip=!0);const n=((t.rotate||0)+(e.rotate||0))%4;return n&&(r.rotate=n),r}function Qg(t,e){const r=t8(t,e);for(const n in K6)n in ec?n in t&&!(n in r)&&(r[n]=ec[n]):n in e?r[n]=e[n]:n in t&&(r[n]=t[n]);return r}function e8(t,e){const r=t.icons,n=t.aliases||Object.create(null),i=Object.create(null);function s(o){if(r[o])return i[o]=[];if(!(o in i)){i[o]=null;const a=n[o]&&n[o].parent,c=a&&s(a);c&&(i[o]=[a].concat(c))}return i[o]}return(e||Object.keys(r).concat(Object.keys(n))).forEach(s),i}function Zg(t,e,r){const n=t.icons,i=t.aliases||Object.create(null);let s={};function o(a){s=Qg(n[a]||i[a],s)}return o(e),r.forEach(o),Qg(t,s)}function r8(t,e){if(t.icons[e])return Zg(t,e,[]);const r=e8(t,[e])[e];return r?Zg(t,e,r):null}const n8=/(-?[0-9.]*[0-9]+[0-9.]*)/g,i8=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Jg(t,e,r){if(e===1)return t;if(r=r||100,typeof t=="number")return Math.ceil(t*e*r)/r;if(typeof t!="string")return t;const n=t.split(n8);if(n===null||!n.length)return t;const i=[];let s=n.shift(),o=i8.test(s);for(;;){if(o){const a=parseFloat(s);isNaN(a)?i.push(s):i.push(Math.ceil(a*e*r)/r)}else i.push(s);if(s=n.shift(),s===void 0)return i.join("");o=!o}}function s8(t,e="defs"){let r="";const n=t.indexOf("<"+e);for(;n>=0;){const i=t.indexOf(">",n),s=t.indexOf("</"+e);if(i===-1||s===-1)break;const o=t.indexOf(">",s);if(o===-1)break;r+=t.slice(i+1,s).trim(),t=t.slice(0,n).trim()+t.slice(o+1)}return{defs:r,content:t}}function o8(t,e){return t?"<defs>"+t+"</defs>"+e:e}function a8(t,e,r){const n=s8(t);return o8(n.defs,e+n.content+r)}const l8=t=>t==="unset"||t==="undefined"||t==="none";function c8(t,e){const r={...cv,...t},n={...Z6,...e},i={left:r.left,top:r.top,width:r.width,height:r.height};let s=r.body;[r,n].forEach(x=>{const g=[],y=x.hFlip,k=x.vFlip;let b=x.rotate;y?k?b+=2:(g.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),g.push("scale(-1 1)"),i.top=i.left=0):k&&(g.push("translate("+(0-i.left).toString()+" "+(i.height+i.top).toString()+")"),g.push("scale(1 -1)"),i.top=i.left=0);let w;switch(b<0&&(b-=Math.floor(b/4)*4),b=b%4,b){case 1:w=i.height/2+i.top,g.unshift("rotate(90 "+w.toString()+" "+w.toString()+")");break;case 2:g.unshift("rotate(180 "+(i.width/2+i.left).toString()+" "+(i.height/2+i.top).toString()+")");break;case 3:w=i.width/2+i.left,g.unshift("rotate(-90 "+w.toString()+" "+w.toString()+")");break}b%2===1&&(i.left!==i.top&&(w=i.left,i.left=i.top,i.top=w),i.width!==i.height&&(w=i.width,i.width=i.height,i.height=w)),g.length&&(s=a8(s,'<g transform="'+g.join(" ")+'">',"</g>"))});const o=n.width,a=n.height,c=i.width,h=i.height;let u,d;o===null?(d=a===null?"1em":a==="auto"?h:a,u=Jg(d,c/h)):(u=o==="auto"?c:o,d=a===null?Jg(u,h/c):a==="auto"?h:a);const f={},p=(x,g)=>{l8(g)||(f[x]=g.toString())};p("width",u),p("height",d);const m=[i.left,i.top,c,h];return f.viewBox=m.join(" "),{attributes:f,viewBox:m,body:s}}const h8=/\sid="(\S+)"/g,tx=new Map;function u8(t){t=t.replace(/[0-9]+$/,"")||"a";const e=tx.get(t)||0;return tx.set(t,e+1),e?`${t}${e}`:t}function d8(t){const e=[];let r;for(;r=h8.exec(t);)e.push(r[1]);if(!e.length)return t;const n="suffix"+(Math.random()*16777216|Date.now()).toString(16);return e.forEach(i=>{const s=u8(i),o=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replace(new RegExp('([#;"])('+o+')([")]|\\.[a-z])',"g"),"$1"+s+n+"$3")}),t=t.replace(new RegExp(n,"g"),""),t}function p8(t,e){let r=t.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const n in e)r+=" "+n+'="'+e[n]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+r+">"+t+"</svg>"}function cf(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ki=cf();function hv(t){ki=t}var Mo={exec:()=>null};function Yt(t,e=""){let r=typeof t=="string"?t:t.source,n={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(Ze.caret,"$1"),r=r.replace(i,o),n},getRegex:()=>new RegExp(r,e)};return n}var f8=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Ze={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,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ 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,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},m8=/^(?:[ \t]*(?:\n|$))+/,g8=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,x8=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ma=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,y8=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hf=/(?:[*+-]|\d{1,9}[.)])/,uv=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,dv=Yt(uv).replace(/bull/g,hf).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}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),b8=Yt(uv).replace(/bull/g,hf).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}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),uf=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,C8=/^[^\n]+/,df=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,k8=Yt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",df).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),v8=Yt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,hf).getRegex(),Vc="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",pf=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,w8=Yt("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\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",pf).replace("tag",Vc).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),pv=Yt(uf).replace("hr",ma).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Vc).getRegex(),S8=Yt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",pv).getRegex(),ff={blockquote:S8,code:g8,def:k8,fences:x8,heading:y8,hr:ma,html:w8,lheading:dv,list:v8,newline:m8,paragraph:pv,table:Mo,text:C8},ex=Yt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ma).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Vc).getRegex(),T8={...ff,lheading:b8,table:ex,paragraph:Yt(uf).replace("hr",ma).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ex).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Vc).getRegex()},_8={...ff,html:Yt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",pf).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:Mo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Yt(uf).replace("hr",ma).replace("heading",` *#{1,6} *[^
499
- ]`).replace("lheading",dv).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},j8=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,N8=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,fv=/^( {2,}|\\)\n(?!\s*$)/,E8=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Yc=/[\p{P}\p{S}]/u,mf=/[\s\p{P}\p{S}]/u,mv=/[^\s\p{P}\p{S}]/u,L8=Yt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,mf).getRegex(),gv=/(?!~)[\p{P}\p{S}]/u,B8=/(?!~)[\s\p{P}\p{S}]/u,A8=/(?:[^\s\p{P}\p{S}]|~)/u,M8=Yt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",f8?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),xv=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,I8=Yt(xv,"u").replace(/punct/g,Yc).getRegex(),F8=Yt(xv,"u").replace(/punct/g,gv).getRegex(),yv="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",P8=Yt(yv,"gu").replace(/notPunctSpace/g,mv).replace(/punctSpace/g,mf).replace(/punct/g,Yc).getRegex(),$8=Yt(yv,"gu").replace(/notPunctSpace/g,A8).replace(/punctSpace/g,B8).replace(/punct/g,gv).getRegex(),D8=Yt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,mv).replace(/punctSpace/g,mf).replace(/punct/g,Yc).getRegex(),O8=Yt(/\\(punct)/,"gu").replace(/punct/g,Yc).getRegex(),R8=Yt(/^<(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(),z8=Yt(pf).replace("(?:-->|$)","-->").getRegex(),q8=Yt("^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",z8).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),rc=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,W8=Yt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",rc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),bv=Yt(/^!?\[(label)\]\[(ref)\]/).replace("label",rc).replace("ref",df).getRegex(),Cv=Yt(/^!?\[(ref)\](?:\[\])?/).replace("ref",df).getRegex(),H8=Yt("reflink|nolink(?!\\()","g").replace("reflink",bv).replace("nolink",Cv).getRegex(),rx=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,gf={_backpedal:Mo,anyPunctuation:O8,autolink:R8,blockSkip:M8,br:fv,code:N8,del:Mo,emStrongLDelim:I8,emStrongRDelimAst:P8,emStrongRDelimUnd:D8,escape:j8,link:W8,nolink:Cv,punctuation:L8,reflink:bv,reflinkSearch:H8,tag:q8,text:E8,url:Mo},U8={...gf,link:Yt(/^!?\[(label)\]\((.*?)\)/).replace("label",rc).getRegex(),reflink:Yt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",rc).getRegex()},ud={...gf,emStrongRDelimAst:$8,emStrongLDelim:F8,url:Yt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",rx).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:Yt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",rx).getRegex()},V8={...ud,br:Yt(fv).replace("{2,}","*").getRegex(),text:Yt(ud.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Da={normal:ff,gfm:T8,pedantic:_8},io={normal:gf,gfm:ud,breaks:V8,pedantic:U8},Y8={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},nx=t=>Y8[t];function Wr(t,e){if(e){if(Ze.escapeTest.test(t))return t.replace(Ze.escapeReplace,nx)}else if(Ze.escapeTestNoEncode.test(t))return t.replace(Ze.escapeReplaceNoEncode,nx);return t}function ix(t){try{t=encodeURI(t).replace(Ze.percentDecode,"%")}catch{return null}return t}function sx(t,e){var s;let r=t.replace(Ze.findPipe,(o,a,c)=>{let h=!1,u=a;for(;--u>=0&&c[u]==="\\";)h=!h;return h?"|":" |"}),n=r.split(Ze.splitPipe),i=0;if(n[0].trim()||n.shift(),n.length>0&&!((s=n.at(-1))!=null&&s.trim())&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(Ze.slashPipe,"|");return n}function so(t,e,r){let n=t.length;if(n===0)return"";let i=0;for(;i<n&&t.charAt(n-i-1)===e;)i++;return t.slice(0,n-i)}function G8(t,e){if(t.indexOf(e[1])===-1)return-1;let r=0;for(let n=0;n<t.length;n++)if(t[n]==="\\")n++;else if(t[n]===e[0])r++;else if(t[n]===e[1]&&(r--,r<0))return n;return r>0?-2:-1}function ox(t,e,r,n,i){let s=e.href,o=e.title||null,a=t[1].replace(i.other.outputLinkReplace,"$1");n.state.inLink=!0;let c={type:t[0].charAt(0)==="!"?"image":"link",raw:r,href:s,title:o,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,c}function X8(t,e,r){let n=t.match(r.other.indentCodeCompensation);if(n===null)return e;let i=n[1];return e.split(`
500
- `).map(s=>{let o=s.match(r.other.beginningSpace);if(o===null)return s;let[a]=o;return a.length>=i.length?s.slice(i.length):s}).join(`
501
- `)}var nc=class{constructor(e){ee(this,"options");ee(this,"rules");ee(this,"lexer");this.options=e||ki}space(e){let r=this.rules.block.newline.exec(e);if(r&&r[0].length>0)return{type:"space",raw:r[0]}}code(e){let r=this.rules.block.code.exec(e);if(r){let n=r[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:r[0],codeBlockStyle:"indented",text:this.options.pedantic?n:so(n,`
502
- `)}}}fences(e){let r=this.rules.block.fences.exec(e);if(r){let n=r[0],i=X8(n,r[3]||"",this.rules);return{type:"code",raw:n,lang:r[2]?r[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):r[2],text:i}}}heading(e){let r=this.rules.block.heading.exec(e);if(r){let n=r[2].trim();if(this.rules.other.endingHash.test(n)){let i=so(n,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(n=i.trim())}return{type:"heading",raw:r[0],depth:r[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let r=this.rules.block.hr.exec(e);if(r)return{type:"hr",raw:so(r[0],`
503
- `)}}blockquote(e){let r=this.rules.block.blockquote.exec(e);if(r){let n=so(r[0],`
504
- `).split(`
505
- `),i="",s="",o=[];for(;n.length>0;){let a=!1,c=[],h;for(h=0;h<n.length;h++)if(this.rules.other.blockquoteStart.test(n[h]))c.push(n[h]),a=!0;else if(!a)c.push(n[h]);else break;n=n.slice(h);let u=c.join(`
506
- `),d=u.replace(this.rules.other.blockquoteSetextReplace,`
507
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
508
- ${u}`:u,s=s?`${s}
509
- ${d}`:d;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(d,o,!0),this.lexer.state.top=f,n.length===0)break;let p=o.at(-1);if((p==null?void 0:p.type)==="code")break;if((p==null?void 0:p.type)==="blockquote"){let m=p,x=m.raw+`
510
- `+n.join(`
511
- `),g=this.blockquote(x);o[o.length-1]=g,i=i.substring(0,i.length-m.raw.length)+g.raw,s=s.substring(0,s.length-m.text.length)+g.text;break}else if((p==null?void 0:p.type)==="list"){let m=p,x=m.raw+`
512
- `+n.join(`
513
- `),g=this.list(x);o[o.length-1]=g,i=i.substring(0,i.length-p.raw.length)+g.raw,s=s.substring(0,s.length-m.raw.length)+g.raw,n=x.substring(o.at(-1).raw.length).split(`
514
- `);continue}}return{type:"blockquote",raw:i,tokens:o,text:s}}}list(e){let r=this.rules.block.list.exec(e);if(r){let n=r[1].trim(),i=n.length>1,s={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");let o=this.rules.other.listItemRegex(n),a=!1;for(;e;){let h=!1,u="",d="";if(!(r=o.exec(e))||this.rules.block.hr.test(e))break;u=r[0],e=e.substring(u.length);let f=r[2].split(`
515
- `,1)[0].replace(this.rules.other.listReplaceTabs,k=>" ".repeat(3*k.length)),p=e.split(`
516
- `,1)[0],m=!f.trim(),x=0;if(this.options.pedantic?(x=2,d=f.trimStart()):m?x=r[1].length+1:(x=r[2].search(this.rules.other.nonSpaceChar),x=x>4?1:x,d=f.slice(x),x+=r[1].length),m&&this.rules.other.blankLine.test(p)&&(u+=p+`
517
- `,e=e.substring(p.length+1),h=!0),!h){let k=this.rules.other.nextBulletRegex(x),b=this.rules.other.hrRegex(x),w=this.rules.other.fencesBeginRegex(x),_=this.rules.other.headingBeginRegex(x),T=this.rules.other.htmlBeginRegex(x);for(;e;){let S=e.split(`
518
- `,1)[0],L;if(p=S,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),L=p):L=p.replace(this.rules.other.tabCharGlobal," "),w.test(p)||_.test(p)||T.test(p)||k.test(p)||b.test(p))break;if(L.search(this.rules.other.nonSpaceChar)>=x||!p.trim())d+=`
519
- `+L.slice(x);else{if(m||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||w.test(f)||_.test(f)||b.test(f))break;d+=`
520
- `+p}!m&&!p.trim()&&(m=!0),u+=S+`
521
- `,e=e.substring(S.length+1),f=L.slice(x)}}s.loose||(a?s.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(a=!0));let g=null,y;this.options.gfm&&(g=this.rules.other.listIsTask.exec(d),g&&(y=g[0]!=="[ ] ",d=d.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:u,task:!!g,checked:y,loose:!1,text:d,tokens:[]}),s.raw+=u}let c=s.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let h=0;h<s.items.length;h++)if(this.lexer.state.top=!1,s.items[h].tokens=this.lexer.blockTokens(s.items[h].text,[]),!s.loose){let u=s.items[h].tokens.filter(f=>f.type==="space"),d=u.length>0&&u.some(f=>this.rules.other.anyLine.test(f.raw));s.loose=d}if(s.loose)for(let h=0;h<s.items.length;h++)s.items[h].loose=!0;return s}}html(e){let r=this.rules.block.html.exec(e);if(r)return{type:"html",block:!0,raw:r[0],pre:r[1]==="pre"||r[1]==="script"||r[1]==="style",text:r[0]}}def(e){let r=this.rules.block.def.exec(e);if(r){let n=r[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=r[2]?r[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=r[3]?r[3].substring(1,r[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):r[3];return{type:"def",tag:n,raw:r[0],href:i,title:s}}}table(e){var a;let r=this.rules.block.table.exec(e);if(!r||!this.rules.other.tableDelimiter.test(r[2]))return;let n=sx(r[1]),i=r[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(a=r[3])!=null&&a.trim()?r[3].replace(this.rules.other.tableRowBlankLine,"").split(`
522
- `):[],o={type:"table",raw:r[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let c of i)this.rules.other.tableAlignRight.test(c)?o.align.push("right"):this.rules.other.tableAlignCenter.test(c)?o.align.push("center"):this.rules.other.tableAlignLeft.test(c)?o.align.push("left"):o.align.push(null);for(let c=0;c<n.length;c++)o.header.push({text:n[c],tokens:this.lexer.inline(n[c]),header:!0,align:o.align[c]});for(let c of s)o.rows.push(sx(c,o.header.length).map((h,u)=>({text:h,tokens:this.lexer.inline(h),header:!1,align:o.align[u]})));return o}}lheading(e){let r=this.rules.block.lheading.exec(e);if(r)return{type:"heading",raw:r[0],depth:r[2].charAt(0)==="="?1:2,text:r[1],tokens:this.lexer.inline(r[1])}}paragraph(e){let r=this.rules.block.paragraph.exec(e);if(r){let n=r[1].charAt(r[1].length-1)===`
523
- `?r[1].slice(0,-1):r[1];return{type:"paragraph",raw:r[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let r=this.rules.block.text.exec(e);if(r)return{type:"text",raw:r[0],text:r[0],tokens:this.lexer.inline(r[0])}}escape(e){let r=this.rules.inline.escape.exec(e);if(r)return{type:"escape",raw:r[0],text:r[1]}}tag(e){let r=this.rules.inline.tag.exec(e);if(r)return!this.lexer.state.inLink&&this.rules.other.startATag.test(r[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(r[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(r[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(r[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:r[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:r[0]}}link(e){let r=this.rules.inline.link.exec(e);if(r){let n=r[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let o=so(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=G8(r[2],"()");if(o===-2)return;if(o>-1){let a=(r[0].indexOf("!")===0?5:4)+r[1].length+o;r[2]=r[2].substring(0,o),r[0]=r[0].substring(0,a).trim(),r[3]=""}}let i=r[2],s="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(i);o&&(i=o[1],s=o[3])}else s=r[3]?r[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?i=i.slice(1):i=i.slice(1,-1)),ox(r,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},r[0],this.lexer,this.rules)}}reflink(e,r){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let i=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=r[i.toLowerCase()];if(!s){let o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return ox(n,s,n[0],this.lexer,this.rules)}}emStrong(e,r,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!(!i||i[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[2])||!n||this.rules.inline.punctuation.exec(n))){let s=[...i[0]].length-1,o,a,c=s,h=0,u=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,r=r.slice(-1*e.length+s);(i=u.exec(r))!=null;){if(o=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!o)continue;if(a=[...o].length,i[3]||i[4]){c+=a;continue}else if((i[5]||i[6])&&s%3&&!((s+a)%3)){h+=a;continue}if(c-=a,c>0)continue;a=Math.min(a,a+c+h);let d=[...i[0]][0].length,f=e.slice(0,s+i.index+d+a);if(Math.min(s,a)%2){let m=f.slice(1,-1);return{type:"em",raw:f,text:m,tokens:this.lexer.inlineTokens(m)}}let p=f.slice(2,-2);return{type:"strong",raw:f,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(e){let r=this.rules.inline.code.exec(e);if(r){let n=r[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return i&&s&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:r[0],text:n}}}br(e){let r=this.rules.inline.br.exec(e);if(r)return{type:"br",raw:r[0]}}del(e){let r=this.rules.inline.del.exec(e);if(r)return{type:"del",raw:r[0],text:r[2],tokens:this.lexer.inlineTokens(r[2])}}autolink(e){let r=this.rules.inline.autolink.exec(e);if(r){let n,i;return r[2]==="@"?(n=r[1],i="mailto:"+n):(n=r[1],i=n),{type:"link",raw:r[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let r;if(r=this.rules.inline.url.exec(e)){let i,s;if(r[2]==="@")i=r[0],s="mailto:"+i;else{let o;do o=r[0],r[0]=((n=this.rules.inline._backpedal.exec(r[0]))==null?void 0:n[0])??"";while(o!==r[0]);i=r[0],r[1]==="www."?s="http://"+r[0]:s=r[0]}return{type:"link",raw:r[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e){let r=this.rules.inline.text.exec(e);if(r){let n=this.lexer.state.inRawBlock;return{type:"text",raw:r[0],text:r[0],escaped:n}}}},Er=class dd{constructor(e){ee(this,"tokens");ee(this,"options");ee(this,"state");ee(this,"tokenizer");ee(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||ki,this.options.tokenizer=this.options.tokenizer||new nc,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 r={other:Ze,block:Da.normal,inline:io.normal};this.options.pedantic?(r.block=Da.pedantic,r.inline=io.pedantic):this.options.gfm&&(r.block=Da.gfm,this.options.breaks?r.inline=io.breaks:r.inline=io.gfm),this.tokenizer.rules=r}static get rules(){return{block:Da,inline:io}}static lex(e,r){return new dd(r).lex(e)}static lexInline(e,r){return new dd(r).inlineTokens(e)}lex(e){e=e.replace(Ze.carriageReturn,`
524
- `),this.blockTokens(e,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let n=this.inlineQueue[r];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,r=[],n=!1){var i,s,o;for(this.options.pedantic&&(e=e.replace(Ze.tabCharGlobal," ").replace(Ze.spaceLine,""));e;){let a;if((s=(i=this.options.extensions)==null?void 0:i.block)!=null&&s.some(h=>(a=h.call({lexer:this},e,r))?(e=e.substring(a.raw.length),r.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let h=r.at(-1);a.raw.length===1&&h!==void 0?h.raw+=`
525
- `:r.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let h=r.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
526
- `)?"":`
527
- `)+a.raw,h.text+=`
528
- `+a.text,this.inlineQueue.at(-1).src=h.text):r.push(a);continue}if(a=this.tokenizer.fences(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.heading(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.hr(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.blockquote(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.list(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.html(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.def(e)){e=e.substring(a.raw.length);let h=r.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
529
- `)?"":`
530
- `)+a.raw,h.text+=`
531
- `+a.raw,this.inlineQueue.at(-1).src=h.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},r.push(a));continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),r.push(a);continue}let c=e;if((o=this.options.extensions)!=null&&o.startBlock){let h=1/0,u=e.slice(1),d;this.options.extensions.startBlock.forEach(f=>{d=f.call({lexer:this},u),typeof d=="number"&&d>=0&&(h=Math.min(h,d))}),h<1/0&&h>=0&&(c=e.substring(0,h+1))}if(this.state.top&&(a=this.tokenizer.paragraph(c))){let h=r.at(-1);n&&(h==null?void 0:h.type)==="paragraph"?(h.raw+=(h.raw.endsWith(`
532
- `)?"":`
533
- `)+a.raw,h.text+=`
534
- `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):r.push(a),n=c.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);let h=r.at(-1);(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
535
- `)?"":`
536
- `)+a.raw,h.text+=`
537
- `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):r.push(a);continue}if(e){let h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}inlineTokens(e,r=[]){var c,h,u,d,f;let n=e,i=null;if(this.tokens.links){let p=Object.keys(this.tokens.links);if(p.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)p.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,i.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)s=i[2]?i[2].length:0,n=n.slice(0,i.index+s)+"["+"a".repeat(i[0].length-s-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=((h=(c=this.options.hooks)==null?void 0:c.emStrongMask)==null?void 0:h.call({lexer:this},n))??n;let o=!1,a="";for(;e;){o||(a=""),o=!1;let p;if((d=(u=this.options.extensions)==null?void 0:u.inline)!=null&&d.some(x=>(p=x.call({lexer:this},e,r))?(e=e.substring(p.raw.length),r.push(p),!0):!1))continue;if(p=this.tokenizer.escape(e)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.tag(e)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.link(e)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(p.raw.length);let x=r.at(-1);p.type==="text"&&(x==null?void 0:x.type)==="text"?(x.raw+=p.raw,x.text+=p.text):r.push(p);continue}if(p=this.tokenizer.emStrong(e,n,a)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.codespan(e)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.br(e)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.del(e)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.autolink(e)){e=e.substring(p.raw.length),r.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(e))){e=e.substring(p.raw.length),r.push(p);continue}let m=e;if((f=this.options.extensions)!=null&&f.startInline){let x=1/0,g=e.slice(1),y;this.options.extensions.startInline.forEach(k=>{y=k.call({lexer:this},g),typeof y=="number"&&y>=0&&(x=Math.min(x,y))}),x<1/0&&x>=0&&(m=e.substring(0,x+1))}if(p=this.tokenizer.inlineText(m)){e=e.substring(p.raw.length),p.raw.slice(-1)!=="_"&&(a=p.raw.slice(-1)),o=!0;let x=r.at(-1);(x==null?void 0:x.type)==="text"?(x.raw+=p.raw,x.text+=p.text):r.push(p);continue}if(e){let x="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(x);break}else throw new Error(x)}}return r}},ic=class{constructor(e){ee(this,"options");ee(this,"parser");this.options=e||ki}space(e){return""}code({text:e,lang:r,escaped:n}){var o;let i=(o=(r||"").match(Ze.notSpaceStart))==null?void 0:o[0],s=e.replace(Ze.endingNewline,"")+`
538
- `;return i?'<pre><code class="language-'+Wr(i)+'">'+(n?s:Wr(s,!0))+`</code></pre>
539
- `:"<pre><code>"+(n?s:Wr(s,!0))+`</code></pre>
540
- `}blockquote({tokens:e}){return`<blockquote>
541
- ${this.parser.parse(e)}</blockquote>
542
- `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:r}){return`<h${r}>${this.parser.parseInline(e)}</h${r}>
543
- `}hr(e){return`<hr>
544
- `}list(e){let r=e.ordered,n=e.start,i="";for(let a=0;a<e.items.length;a++){let c=e.items[a];i+=this.listitem(c)}let s=r?"ol":"ul",o=r&&n!==1?' start="'+n+'"':"";return"<"+s+o+`>
545
- `+i+"</"+s+`>
546
- `}listitem(e){var n;let r="";if(e.task){let i=this.checkbox({checked:!!e.checked});e.loose?((n=e.tokens[0])==null?void 0:n.type)==="paragraph"?(e.tokens[0].text=i+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=i+" "+Wr(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:i+" ",text:i+" ",escaped:!0}):r+=i+" "}return r+=this.parser.parse(e.tokens,!!e.loose),`<li>${r}</li>
547
- `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
548
- `}table(e){let r="",n="";for(let s=0;s<e.header.length;s++)n+=this.tablecell(e.header[s]);r+=this.tablerow({text:n});let i="";for(let s=0;s<e.rows.length;s++){let o=e.rows[s];n="";for(let a=0;a<o.length;a++)n+=this.tablecell(o[a]);i+=this.tablerow({text:n})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
549
- <thead>
550
- `+r+`</thead>
551
- `+i+`</table>
552
- `}tablerow({text:e}){return`<tr>
553
- ${e}</tr>
554
- `}tablecell(e){let r=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+r+`</${n}>
555
- `}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>${Wr(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:r,tokens:n}){let i=this.parser.parseInline(n),s=ix(e);if(s===null)return i;e=s;let o='<a href="'+e+'"';return r&&(o+=' title="'+Wr(r)+'"'),o+=">"+i+"</a>",o}image({href:e,title:r,text:n,tokens:i}){i&&(n=this.parser.parseInline(i,this.parser.textRenderer));let s=ix(e);if(s===null)return Wr(n);e=s;let o=`<img src="${e}" alt="${n}"`;return r&&(o+=` title="${Wr(r)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Wr(e.text)}},xf=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""}},Lr=class pd{constructor(e){ee(this,"options");ee(this,"renderer");ee(this,"textRenderer");this.options=e||ki,this.options.renderer=this.options.renderer||new ic,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new xf}static parse(e,r){return new pd(r).parse(e)}static parseInline(e,r){return new pd(r).parseInline(e)}parse(e,r=!0){var i,s;let n="";for(let o=0;o<e.length;o++){let a=e[o];if((s=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&s[a.type]){let h=a,u=this.options.extensions.renderers[h.type].call({parser:this},h);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(h.type)){n+=u||"";continue}}let c=a;switch(c.type){case"space":{n+=this.renderer.space(c);continue}case"hr":{n+=this.renderer.hr(c);continue}case"heading":{n+=this.renderer.heading(c);continue}case"code":{n+=this.renderer.code(c);continue}case"table":{n+=this.renderer.table(c);continue}case"blockquote":{n+=this.renderer.blockquote(c);continue}case"list":{n+=this.renderer.list(c);continue}case"html":{n+=this.renderer.html(c);continue}case"def":{n+=this.renderer.def(c);continue}case"paragraph":{n+=this.renderer.paragraph(c);continue}case"text":{let h=c,u=this.renderer.text(h);for(;o+1<e.length&&e[o+1].type==="text";)h=e[++o],u+=`
556
- `+this.renderer.text(h);r?n+=this.renderer.paragraph({type:"paragraph",raw:u,text:u,tokens:[{type:"text",raw:u,text:u,escaped:!0}]}):n+=u;continue}default:{let h='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return n}parseInline(e,r=this.renderer){var i,s;let n="";for(let o=0;o<e.length;o++){let a=e[o];if((s=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&s[a.type]){let h=this.options.extensions.renderers[a.type].call({parser:this},a);if(h!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){n+=h||"";continue}}let c=a;switch(c.type){case"escape":{n+=r.text(c);break}case"html":{n+=r.html(c);break}case"link":{n+=r.link(c);break}case"image":{n+=r.image(c);break}case"strong":{n+=r.strong(c);break}case"em":{n+=r.em(c);break}case"codespan":{n+=r.codespan(c);break}case"br":{n+=r.br(c);break}case"del":{n+=r.del(c);break}case"text":{n+=r.text(c);break}default:{let h='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return n}},tl,ko=(tl=class{constructor(e){ee(this,"options");ee(this,"block");this.options=e||ki}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Er.lex:Er.lexInline}provideParser(){return this.block?Lr.parse:Lr.parseInline}},ee(tl,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ee(tl,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),tl),K8=class{constructor(...e){ee(this,"defaults",cf());ee(this,"options",this.setOptions);ee(this,"parse",this.parseMarkdown(!0));ee(this,"parseInline",this.parseMarkdown(!1));ee(this,"Parser",Lr);ee(this,"Renderer",ic);ee(this,"TextRenderer",xf);ee(this,"Lexer",Er);ee(this,"Tokenizer",nc);ee(this,"Hooks",ko);this.use(...e)}walkTokens(e,r){var i,s;let n=[];for(let o of e)switch(n=n.concat(r.call(this,o)),o.type){case"table":{let a=o;for(let c of a.header)n=n.concat(this.walkTokens(c.tokens,r));for(let c of a.rows)for(let h of c)n=n.concat(this.walkTokens(h.tokens,r));break}case"list":{let a=o;n=n.concat(this.walkTokens(a.items,r));break}default:{let a=o;(s=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&s[a.type]?this.defaults.extensions.childTokens[a.type].forEach(c=>{let h=a[c].flat(1/0);n=n.concat(this.walkTokens(h,r))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,r)))}}return n}use(...e){let r=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let i={...n};if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let o=r.renderers[s.name];o?r.renderers[s.name]=function(...a){let c=s.renderer.apply(this,a);return c===!1&&(c=o.apply(this,a)),c}:r.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=r[s.level];o?o.unshift(s.tokenizer):r[s.level]=[s.tokenizer],s.start&&(s.level==="block"?r.startBlock?r.startBlock.push(s.start):r.startBlock=[s.start]:s.level==="inline"&&(r.startInline?r.startInline.push(s.start):r.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(r.childTokens[s.name]=s.childTokens)}),i.extensions=r),n.renderer){let s=this.defaults.renderer||new ic(this.defaults);for(let o in n.renderer){if(!(o in s))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let a=o,c=n.renderer[a],h=s[a];s[a]=(...u)=>{let d=c.apply(s,u);return d===!1&&(d=h.apply(s,u)),d||""}}i.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new nc(this.defaults);for(let o in n.tokenizer){if(!(o in s))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let a=o,c=n.tokenizer[a],h=s[a];s[a]=(...u)=>{let d=c.apply(s,u);return d===!1&&(d=h.apply(s,u)),d}}i.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new ko;for(let o in n.hooks){if(!(o in s))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let a=o,c=n.hooks[a],h=s[a];ko.passThroughHooks.has(o)?s[a]=u=>{if(this.defaults.async&&ko.passThroughHooksRespectAsync.has(o))return(async()=>{let f=await c.call(s,u);return h.call(s,f)})();let d=c.call(s,u);return h.call(s,d)}:s[a]=(...u)=>{if(this.defaults.async)return(async()=>{let f=await c.apply(s,u);return f===!1&&(f=await h.apply(s,u)),f})();let d=c.apply(s,u);return d===!1&&(d=h.apply(s,u)),d}}i.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,o=n.walkTokens;i.walkTokens=function(a){let c=[];return c.push(o.call(this,a)),s&&(c=c.concat(s.call(this,a))),c}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,r){return Er.lex(e,r??this.defaults)}parser(e,r){return Lr.parse(e,r??this.defaults)}parseMarkdown(e){return(r,n)=>{let i={...n},s={...this.defaults,...i},o=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&i.async===!1)return o(new 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 r>"u"||r===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return(async()=>{let a=s.hooks?await s.hooks.preprocess(r):r,c=await(s.hooks?await s.hooks.provideLexer():e?Er.lex:Er.lexInline)(a,s),h=s.hooks?await s.hooks.processAllTokens(c):c;s.walkTokens&&await Promise.all(this.walkTokens(h,s.walkTokens));let u=await(s.hooks?await s.hooks.provideParser():e?Lr.parse:Lr.parseInline)(h,s);return s.hooks?await s.hooks.postprocess(u):u})().catch(o);try{s.hooks&&(r=s.hooks.preprocess(r));let a=(s.hooks?s.hooks.provideLexer():e?Er.lex:Er.lexInline)(r,s);s.hooks&&(a=s.hooks.processAllTokens(a)),s.walkTokens&&this.walkTokens(a,s.walkTokens);let c=(s.hooks?s.hooks.provideParser():e?Lr.parse:Lr.parseInline)(a,s);return s.hooks&&(c=s.hooks.postprocess(c)),c}catch(a){return o(a)}}}onError(e,r){return n=>{if(n.message+=`
557
- Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+Wr(n.message+"",!0)+"</pre>";return r?Promise.resolve(i):i}if(r)return Promise.reject(n);throw n}}},pi=new K8;function re(t,e){return pi.parse(t,e)}re.options=re.setOptions=function(t){return pi.setOptions(t),re.defaults=pi.defaults,hv(re.defaults),re};re.getDefaults=cf;re.defaults=ki;re.use=function(...t){return pi.use(...t),re.defaults=pi.defaults,hv(re.defaults),re};re.walkTokens=function(t,e){return pi.walkTokens(t,e)};re.parseInline=pi.parseInline;re.Parser=Lr;re.parser=Lr.parse;re.Renderer=ic;re.TextRenderer=xf;re.Lexer=Er;re.lexer=Er.lex;re.Tokenizer=nc;re.Hooks=ko;re.parse=re;re.options;re.setOptions;re.use;re.walkTokens;re.parseInline;Lr.parse;Er.lex;function kv(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=Array.from(typeof t=="string"?[t]:t);n[n.length-1]=n[n.length-1].replace(/\r?\n([\t ]*)$/,"");var i=n.reduce(function(a,c){var h=c.match(/\n([\t ]+|(?!\s).)/g);return h?a.concat(h.map(function(u){var d,f;return(f=(d=u.match(/[\t ]/g))===null||d===void 0?void 0:d.length)!==null&&f!==void 0?f:0})):a},[]);if(i.length){var s=new RegExp(`
558
- [ ]{`+Math.min.apply(Math,i)+"}","g");n=n.map(function(a){return a.replace(s,`
559
- `)})}n[0]=n[0].replace(/^\r?\n/,"");var o=n[0];return e.forEach(function(a,c){var h=o.match(/(?:^|\n)( *)$/),u=h?h[1]:"",d=a;typeof a=="string"&&a.includes(`
560
- `)&&(d=String(a).split(`
561
- `).map(function(f,p){return p===0?f:""+u+f}).join(`
562
- `)),o+=d+n[c+1]}),o}var Q8={body:'<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/><text transform="translate(21.16 64.67)" style="fill: #fff; font-family: ArialMT, Arial; font-size: 67.75px;"><tspan x="0" y="0">?</tspan></text></g>',height:80,width:80},fd=new Map,vv=new Map,Z8=v(t=>{for(const e of t){if(!e.name)throw new Error('Invalid icon loader. Must have a "name" property with non-empty string value.');if(rt.debug("Registering icon pack:",e.name),"loader"in e)vv.set(e.name,e.loader);else if("icons"in e)fd.set(e.name,e.icons);else throw rt.error("Invalid icon loader:",e),new Error('Invalid icon loader. Must have either "icons" or "loader" property.')}},"registerIconPacks"),wv=v(async(t,e)=>{const r=J6(t,!0,e!==void 0);if(!r)throw new Error(`Invalid icon name: ${t}`);const n=r.prefix||e;if(!n)throw new Error(`Icon name must contain a prefix: ${t}`);let i=fd.get(n);if(!i){const o=vv.get(n);if(!o)throw new Error(`Icon set not found: ${r.prefix}`);try{i={...await o(),prefix:n},fd.set(n,i)}catch(a){throw rt.error(a),new Error(`Failed to load icon set: ${r.prefix}`)}}const s=r8(i,r.name);if(!s)throw new Error(`Icon not found: ${t}`);return s},"getRegisteredIconData"),J8=v(async t=>{try{return await wv(t),!0}catch{return!1}},"isIconAvailable"),ga=v(async(t,e,r)=>{let n;try{n=await wv(t,e==null?void 0:e.fallbackPrefix)}catch(o){rt.error(o),n=Q8}const i=c8(n,e),s=p8(d8(i.body),{...i.attributes,...r});return $r(s,me())},"getIconSVG");function Sv(t,{markdownAutoWrap:e}){const n=t.replace(/<br\/>/g,`
563
- `).replace(/\n{2,}/g,`
564
- `);return kv(n)}v(Sv,"preprocessMarkdown");function Tv(t){return t.split(/\\n|\n|<br\s*\/?>/gi).map(e=>{var r;return((r=e.trim().match(/<[^>]+>|[^\s<>]+/g))==null?void 0:r.map(n=>({content:n,type:"normal"})))??[]})}v(Tv,"nonMarkdownToLines");function _v(t,e={}){const r=Sv(t,e),n=re.lexer(r),i=[[]];let s=0;function o(a,c="normal"){a.type==="text"?a.text.split(`
565
- `).forEach((u,d)=>{d!==0&&(s++,i.push([])),u.split(" ").forEach(f=>{f=f.replace(/&#39;/g,"'"),f&&i[s].push({content:f,type:c})})}):a.type==="strong"||a.type==="em"?a.tokens.forEach(h=>{o(h,a.type)}):a.type==="html"&&i[s].push({content:a.text,type:"normal"})}return v(o,"processNode"),n.forEach(a=>{var c;a.type==="paragraph"?(c=a.tokens)==null||c.forEach(h=>{o(h)}):a.type==="html"?i[s].push({content:a.text,type:"normal"}):i[s].push({content:a.raw,type:"normal"})}),i}v(_v,"markdownToLines");function jv(t){return t?`<p>${t.replace(/\\n|\n/g,"<br />")}</p>`:""}v(jv,"nonMarkdownToHTML");function Nv(t,{markdownAutoWrap:e}={}){const r=re.lexer(t);function n(i){var s,o,a;return i.type==="text"?e===!1?i.text.replace(/\n */g,"<br/>").replace(/ /g,"&nbsp;"):i.text.replace(/\n */g,"<br/>"):i.type==="strong"?`<strong>${(s=i.tokens)==null?void 0:s.map(n).join("")}</strong>`:i.type==="em"?`<em>${(o=i.tokens)==null?void 0:o.map(n).join("")}</em>`:i.type==="paragraph"?`<p>${(a=i.tokens)==null?void 0:a.map(n).join("")}</p>`:i.type==="space"?"":i.type==="html"?`${i.text}`:i.type==="escape"?i.text:(rt.warn(`Unsupported markdown: ${i.type}`),i.raw)}return v(n,"output"),r.map(n).join("")}v(Nv,"markdownToHTML");function Ev(t){return Intl.Segmenter?[...new Intl.Segmenter().segment(t)].map(e=>e.segment):[...t]}v(Ev,"splitTextToChars");function Lv(t,e){const r=Ev(e.content);return yf(t,[],r,e.type)}v(Lv,"splitWordToFitWidth");function yf(t,e,r,n){if(r.length===0)return[{content:e.join(""),type:n},{content:"",type:n}];const[i,...s]=r,o=[...e,i];return t([{content:o.join(""),type:n}])?yf(t,o,s,n):(e.length===0&&i&&(e.push(i),r.shift()),[{content:e.join(""),type:n},{content:r.join(""),type:n}])}v(yf,"splitWordToFitWidthRecursion");function Bv(t,e){if(t.some(({content:r})=>r.includes(`
566
- `)))throw new Error("splitLineToFitWidth does not support newlines in the line");return sc(t,e)}v(Bv,"splitLineToFitWidth");function sc(t,e,r=[],n=[]){if(t.length===0)return n.length>0&&r.push(n),r.length>0?r:[];let i="";t[0].content===" "&&(i=" ",t.shift());const s=t.shift()??{content:" ",type:"normal"},o=[...n];if(i!==""&&o.push({content:i,type:"normal"}),o.push(s),e(o))return sc(t,e,r,o);if(n.length>0)r.push(n),t.unshift(s);else if(s.content){const[a,c]=Lv(e,s);r.push([a]),c.content&&t.unshift(c)}return sc(t,e,r)}v(sc,"splitLineToFitWidthRecursion");function md(t,e){e&&t.attr("style",e)}v(md,"applyStyle");var ax=16384;async function Av(t,e,r,n,i=!1,s=me()){const o=t.append("foreignObject");o.attr("width",`${Math.min(10*r,ax)}px`),o.attr("height",`${Math.min(10*r,ax)}px`);const a=o.append("xhtml:div"),c=Ro(e.label)?await s1(e.label.replace(ca.lineBreakRegex,`
567
- `),s):$r(e.label,s),h=e.isNode?"nodeLabel":"edgeLabel",u=a.append("span");u.html(c),md(u,e.labelStyle),u.attr("class",`${h} ${n}`),md(a,e.labelStyle),a.style("display","table-cell"),a.style("white-space","nowrap"),a.style("line-height","1.5"),r!==Number.POSITIVE_INFINITY&&(a.style("max-width",r+"px"),a.style("text-align","center")),a.attr("xmlns","http://www.w3.org/1999/xhtml"),i&&a.attr("class","labelBkg");let d=a.node().getBoundingClientRect();return d.width===r&&(a.style("display","table"),a.style("white-space","break-spaces"),a.style("width",r+"px"),d=a.node().getBoundingClientRect()),o.node()}v(Av,"addHtmlSpan");function Gc(t,e,r,n=!1){const i=t.append("tspan").attr("class","text-outer-tspan").attr("x",0).attr("y",e*r-.1+"em").attr("dy",r+"em");return n&&i.attr("text-anchor","middle"),i}v(Gc,"createTspan");function Mv(t,e,r){const n=t.append("text"),i=Gc(n,1,e);Xc(i,r);const s=i.node().getComputedTextLength();return n.remove(),s}v(Mv,"computeWidthOfText");function tz(t,e,r){var o;const n=t.append("text"),i=Gc(n,1,e);Xc(i,[{content:r,type:"normal"}]);const s=(o=i.node())==null?void 0:o.getBoundingClientRect();return s&&n.remove(),s}v(tz,"computeDimensionOfText");function Iv(t,e,r,n=!1,i=!1){const o=e.append("g"),a=o.insert("rect").attr("class","background").attr("style","stroke: none"),c=o.append("text").attr("y","-10.1");i&&c.attr("text-anchor","middle");let h=0;for(const u of r){const d=v(p=>Mv(o,1.1,p)<=t,"checkWidth"),f=d(u)?[u]:Bv(u,d);for(const p of f){const m=Gc(c,h,1.1,i);Xc(m,p),h++}}if(n){const u=c.node().getBBox(),d=2;return a.attr("x",u.x-d).attr("y",u.y-d).attr("width",u.width+2*d).attr("height",u.height+2*d),o.node()}else return c.node()}v(Iv,"createFormattedText");function gd(t){const e=/&(amp|lt|gt);/g;return t.replace(e,(r,n)=>{switch(n){case"amp":return"&";case"lt":return"<";case"gt":return">";default:return r}})}v(gd,"decodeHTMLEntities");function Xc(t,e){t.text(""),e.forEach((r,n)=>{const i=t.append("tspan").attr("font-style",r.type==="em"?"italic":"normal").attr("class","text-inner-tspan").attr("font-weight",r.type==="strong"?"bold":"normal");n===0?i.text(gd(r.content)):i.text(" "+gd(r.content))})}v(Xc,"updateTextContentAndStyles");async function Fv(t,e={}){const r=[];t.replace(/(fa[bklrs]?):fa-([\w-]+)/g,(i,s,o)=>(r.push((async()=>{const a=`${s}:${o}`;return await J8(a)?await ga(a,void 0,{class:"label-icon"}):`<i class='${$r(i,e).replace(":"," ")}'></i>`})()),i));const n=await Promise.all(r);return t.replace(/(fa[bklrs]?):fa-([\w-]+)/g,()=>n.shift()??"")}v(Fv,"replaceIconSubstring");var yn=v(async(t,e="",{style:r="",isTitle:n=!1,classes:i="",useHtmlLabels:s=!0,markdown:o=!0,isNode:a=!0,width:c=200,addSvgBackground:h=!1}={},u)=>{if(rt.debug("XYZ createText",e,r,n,i,s,a,"addSvgBackground: ",h),s){const d=o?Nv(e,u):jv(e),f=await Fv(di(d),u),p=e.replace(/\\\\/g,"\\"),m={isNode:a,label:Ro(e)?p:f,labelStyle:r.replace("fill:","color:")};return await Av(t,m,c,i,h,u)}else{const d=di(e.replace(/<br\s*\/?>/g,"<br/>")),f=o?_v(d.replace("<br>","<br/>"),u):Tv(d),p=Iv(c,t,f,e?h:!1,!a);if(a){/stroke:/.exec(r)&&(r=r.replace("stroke:","lineColor:"));const m=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");Ot(p).attr("style",m)}else{const m=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/background:/g,"fill:");Ot(p).select("rect").attr("style",m.replace(/background:/g,"fill:"));const x=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");Ot(p).select("text").attr("style",x)}return n?Ot(p).selectAll("tspan.text-outer-tspan").classed("title-row",!0):Ot(p).selectAll("tspan.text-outer-tspan").classed("row",!0),p}},"createText");function Xh(t,e,r){if(t&&t.length){const[n,i]=e,s=Math.PI/180*r,o=Math.cos(s),a=Math.sin(s);for(const c of t){const[h,u]=c;c[0]=(h-n)*o-(u-i)*a+n,c[1]=(h-n)*a+(u-i)*o+i}}}function ez(t,e){return t[0]===e[0]&&t[1]===e[1]}function rz(t,e,r,n=1){const i=r,s=Math.max(e,.1),o=t[0]&&t[0][0]&&typeof t[0][0]=="number"?[t]:t,a=[0,0];if(i)for(const h of o)Xh(h,a,i);const c=(function(h,u,d){const f=[];for(const k of h){const b=[...k];ez(b[0],b[b.length-1])||b.push([b[0][0],b[0][1]]),b.length>2&&f.push(b)}const p=[];u=Math.max(u,.1);const m=[];for(const k of f)for(let b=0;b<k.length-1;b++){const w=k[b],_=k[b+1];if(w[1]!==_[1]){const T=Math.min(w[1],_[1]);m.push({ymin:T,ymax:Math.max(w[1],_[1]),x:T===w[1]?w[0]:_[0],islope:(_[0]-w[0])/(_[1]-w[1])})}}if(m.sort(((k,b)=>k.ymin<b.ymin?-1:k.ymin>b.ymin?1:k.x<b.x?-1:k.x>b.x?1:k.ymax===b.ymax?0:(k.ymax-b.ymax)/Math.abs(k.ymax-b.ymax))),!m.length)return p;let x=[],g=m[0].ymin,y=0;for(;x.length||m.length;){if(m.length){let k=-1;for(let b=0;b<m.length&&!(m[b].ymin>g);b++)k=b;m.splice(0,k+1).forEach((b=>{x.push({s:g,edge:b})}))}if(x=x.filter((k=>!(k.edge.ymax<=g))),x.sort(((k,b)=>k.edge.x===b.edge.x?0:(k.edge.x-b.edge.x)/Math.abs(k.edge.x-b.edge.x))),(d!==1||y%u==0)&&x.length>1)for(let k=0;k<x.length;k+=2){const b=k+1;if(b>=x.length)break;const w=x[k].edge,_=x[b].edge;p.push([[Math.round(w.x),g],[Math.round(_.x),g]])}g+=d,x.forEach((k=>{k.edge.x=k.edge.x+d*k.edge.islope})),y++}return p})(o,s,n);if(i){for(const h of o)Xh(h,a,-i);(function(h,u,d){const f=[];h.forEach((p=>f.push(...p))),Xh(f,u,d)})(c,a,-i)}return c}function xa(t,e){var r;const n=e.hachureAngle+90;let i=e.hachureGap;i<0&&(i=4*e.strokeWidth),i=Math.round(Math.max(i,.1));let s=1;return e.roughness>=1&&(((r=e.randomizer)===null||r===void 0?void 0:r.next())||Math.random())>.7&&(s=i),rz(t,i,n,s||1)}class bf{constructor(e){this.helper=e}fillPolygons(e,r){return this._fillPolygons(e,r)}_fillPolygons(e,r){const n=xa(e,r);return{type:"fillSketch",ops:this.renderLines(n,r)}}renderLines(e,r){const n=[];for(const i of e)n.push(...this.helper.doubleLineOps(i[0][0],i[0][1],i[1][0],i[1][1],r));return n}}function Kc(t){const e=t[0],r=t[1];return Math.sqrt(Math.pow(e[0]-r[0],2)+Math.pow(e[1]-r[1],2))}class nz extends bf{fillPolygons(e,r){let n=r.hachureGap;n<0&&(n=4*r.strokeWidth),n=Math.max(n,.1);const i=xa(e,Object.assign({},r,{hachureGap:n})),s=Math.PI/180*r.hachureAngle,o=[],a=.5*n*Math.cos(s),c=.5*n*Math.sin(s);for(const[h,u]of i)Kc([h,u])&&o.push([[h[0]-a,h[1]+c],[...u]],[[h[0]+a,h[1]-c],[...u]]);return{type:"fillSketch",ops:this.renderLines(o,r)}}}class iz extends bf{fillPolygons(e,r){const n=this._fillPolygons(e,r),i=Object.assign({},r,{hachureAngle:r.hachureAngle+90}),s=this._fillPolygons(e,i);return n.ops=n.ops.concat(s.ops),n}}class sz{constructor(e){this.helper=e}fillPolygons(e,r){const n=xa(e,r=Object.assign({},r,{hachureAngle:0}));return this.dotsOnLines(n,r)}dotsOnLines(e,r){const n=[];let i=r.hachureGap;i<0&&(i=4*r.strokeWidth),i=Math.max(i,.1);let s=r.fillWeight;s<0&&(s=r.strokeWidth/2);const o=i/4;for(const a of e){const c=Kc(a),h=c/i,u=Math.ceil(h)-1,d=c-u*i,f=(a[0][0]+a[1][0])/2-i/4,p=Math.min(a[0][1],a[1][1]);for(let m=0;m<u;m++){const x=p+d+m*i,g=f-o+2*Math.random()*o,y=x-o+2*Math.random()*o,k=this.helper.ellipse(g,y,s,s,r);n.push(...k.ops)}}return{type:"fillSketch",ops:n}}}class oz{constructor(e){this.helper=e}fillPolygons(e,r){const n=xa(e,r);return{type:"fillSketch",ops:this.dashedLine(n,r)}}dashedLine(e,r){const n=r.dashOffset<0?r.hachureGap<0?4*r.strokeWidth:r.hachureGap:r.dashOffset,i=r.dashGap<0?r.hachureGap<0?4*r.strokeWidth:r.hachureGap:r.dashGap,s=[];return e.forEach((o=>{const a=Kc(o),c=Math.floor(a/(n+i)),h=(a+i-c*(n+i))/2;let u=o[0],d=o[1];u[0]>d[0]&&(u=o[1],d=o[0]);const f=Math.atan((d[1]-u[1])/(d[0]-u[0]));for(let p=0;p<c;p++){const m=p*(n+i),x=m+n,g=[u[0]+m*Math.cos(f)+h*Math.cos(f),u[1]+m*Math.sin(f)+h*Math.sin(f)],y=[u[0]+x*Math.cos(f)+h*Math.cos(f),u[1]+x*Math.sin(f)+h*Math.sin(f)];s.push(...this.helper.doubleLineOps(g[0],g[1],y[0],y[1],r))}})),s}}class az{constructor(e){this.helper=e}fillPolygons(e,r){const n=r.hachureGap<0?4*r.strokeWidth:r.hachureGap,i=r.zigzagOffset<0?n:r.zigzagOffset,s=xa(e,r=Object.assign({},r,{hachureGap:n+i}));return{type:"fillSketch",ops:this.zigzagLines(s,i,r)}}zigzagLines(e,r,n){const i=[];return e.forEach((s=>{const o=Kc(s),a=Math.round(o/(2*r));let c=s[0],h=s[1];c[0]>h[0]&&(c=s[1],h=s[0]);const u=Math.atan((h[1]-c[1])/(h[0]-c[0]));for(let d=0;d<a;d++){const f=2*d*r,p=2*(d+1)*r,m=Math.sqrt(2*Math.pow(r,2)),x=[c[0]+f*Math.cos(u),c[1]+f*Math.sin(u)],g=[c[0]+p*Math.cos(u),c[1]+p*Math.sin(u)],y=[x[0]+m*Math.cos(u+Math.PI/4),x[1]+m*Math.sin(u+Math.PI/4)];i.push(...this.helper.doubleLineOps(x[0],x[1],y[0],y[1],n),...this.helper.doubleLineOps(y[0],y[1],g[0],g[1],n))}})),i}}const nr={};class lz{constructor(e){this.seed=e}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}}const cz=0,Kh=1,lx=2,Oa={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function Qh(t,e){return t.type===e}function Cf(t){const e=[],r=(function(o){const a=new Array;for(;o!=="";)if(o.match(/^([ \t\r\n,]+)/))o=o.substr(RegExp.$1.length);else if(o.match(/^([aAcChHlLmMqQsStTvVzZ])/))a[a.length]={type:cz,text:RegExp.$1},o=o.substr(RegExp.$1.length);else{if(!o.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];a[a.length]={type:Kh,text:`${parseFloat(RegExp.$1)}`},o=o.substr(RegExp.$1.length)}return a[a.length]={type:lx,text:""},a})(t);let n="BOD",i=0,s=r[i];for(;!Qh(s,lx);){let o=0;const a=[];if(n==="BOD"){if(s.text!=="M"&&s.text!=="m")return Cf("M0,0"+t);i++,o=Oa[s.text],n=s.text}else Qh(s,Kh)?o=Oa[n]:(i++,o=Oa[s.text],n=s.text);if(!(i+o<r.length))throw new Error("Path data ended short");for(let c=i;c<i+o;c++){const h=r[c];if(!Qh(h,Kh))throw new Error("Param not a number: "+n+","+h.text);a[a.length]=+h.text}if(typeof Oa[n]!="number")throw new Error("Bad segment: "+n);{const c={key:n,data:a};e.push(c),i+=o,s=r[i],n==="M"&&(n="L"),n==="m"&&(n="l")}}return e}function Pv(t){let e=0,r=0,n=0,i=0;const s=[];for(const{key:o,data:a}of t)switch(o){case"M":s.push({key:"M",data:[...a]}),[e,r]=a,[n,i]=a;break;case"m":e+=a[0],r+=a[1],s.push({key:"M",data:[e,r]}),n=e,i=r;break;case"L":s.push({key:"L",data:[...a]}),[e,r]=a;break;case"l":e+=a[0],r+=a[1],s.push({key:"L",data:[e,r]});break;case"C":s.push({key:"C",data:[...a]}),e=a[4],r=a[5];break;case"c":{const c=a.map(((h,u)=>u%2?h+r:h+e));s.push({key:"C",data:c}),e=c[4],r=c[5];break}case"Q":s.push({key:"Q",data:[...a]}),e=a[2],r=a[3];break;case"q":{const c=a.map(((h,u)=>u%2?h+r:h+e));s.push({key:"Q",data:c}),e=c[2],r=c[3];break}case"A":s.push({key:"A",data:[...a]}),e=a[5],r=a[6];break;case"a":e+=a[5],r+=a[6],s.push({key:"A",data:[a[0],a[1],a[2],a[3],a[4],e,r]});break;case"H":s.push({key:"H",data:[...a]}),e=a[0];break;case"h":e+=a[0],s.push({key:"H",data:[e]});break;case"V":s.push({key:"V",data:[...a]}),r=a[0];break;case"v":r+=a[0],s.push({key:"V",data:[r]});break;case"S":s.push({key:"S",data:[...a]}),e=a[2],r=a[3];break;case"s":{const c=a.map(((h,u)=>u%2?h+r:h+e));s.push({key:"S",data:c}),e=c[2],r=c[3];break}case"T":s.push({key:"T",data:[...a]}),e=a[0],r=a[1];break;case"t":e+=a[0],r+=a[1],s.push({key:"T",data:[e,r]});break;case"Z":case"z":s.push({key:"Z",data:[]}),e=n,r=i}return s}function $v(t){const e=[];let r="",n=0,i=0,s=0,o=0,a=0,c=0;for(const{key:h,data:u}of t){switch(h){case"M":e.push({key:"M",data:[...u]}),[n,i]=u,[s,o]=u;break;case"C":e.push({key:"C",data:[...u]}),n=u[4],i=u[5],a=u[2],c=u[3];break;case"L":e.push({key:"L",data:[...u]}),[n,i]=u;break;case"H":n=u[0],e.push({key:"L",data:[n,i]});break;case"V":i=u[0],e.push({key:"L",data:[n,i]});break;case"S":{let d=0,f=0;r==="C"||r==="S"?(d=n+(n-a),f=i+(i-c)):(d=n,f=i),e.push({key:"C",data:[d,f,...u]}),a=u[0],c=u[1],n=u[2],i=u[3];break}case"T":{const[d,f]=u;let p=0,m=0;r==="Q"||r==="T"?(p=n+(n-a),m=i+(i-c)):(p=n,m=i);const x=n+2*(p-n)/3,g=i+2*(m-i)/3,y=d+2*(p-d)/3,k=f+2*(m-f)/3;e.push({key:"C",data:[x,g,y,k,d,f]}),a=p,c=m,n=d,i=f;break}case"Q":{const[d,f,p,m]=u,x=n+2*(d-n)/3,g=i+2*(f-i)/3,y=p+2*(d-p)/3,k=m+2*(f-m)/3;e.push({key:"C",data:[x,g,y,k,p,m]}),a=d,c=f,n=p,i=m;break}case"A":{const d=Math.abs(u[0]),f=Math.abs(u[1]),p=u[2],m=u[3],x=u[4],g=u[5],y=u[6];d===0||f===0?(e.push({key:"C",data:[n,i,g,y,g,y]}),n=g,i=y):(n!==g||i!==y)&&(Dv(n,i,g,y,d,f,p,m,x).forEach((function(k){e.push({key:"C",data:k})})),n=g,i=y);break}case"Z":e.push({key:"Z",data:[]}),n=s,i=o}r=h}return e}function oo(t,e,r){return[t*Math.cos(r)-e*Math.sin(r),t*Math.sin(r)+e*Math.cos(r)]}function Dv(t,e,r,n,i,s,o,a,c,h){const u=(d=o,Math.PI*d/180);var d;let f=[],p=0,m=0,x=0,g=0;if(h)[p,m,x,g]=h;else{[t,e]=oo(t,e,-u),[r,n]=oo(r,n,-u);const z=(t-r)/2,P=(e-n)/2;let I=z*z/(i*i)+P*P/(s*s);I>1&&(I=Math.sqrt(I),i*=I,s*=I);const F=i*i,$=s*s,O=F*$-F*P*P-$*z*z,D=F*P*P+$*z*z,j=(a===c?-1:1)*Math.sqrt(Math.abs(O/D));x=j*i*P/s+(t+r)/2,g=j*-s*z/i+(e+n)/2,p=Math.asin(parseFloat(((e-g)/s).toFixed(9))),m=Math.asin(parseFloat(((n-g)/s).toFixed(9))),t<x&&(p=Math.PI-p),r<x&&(m=Math.PI-m),p<0&&(p=2*Math.PI+p),m<0&&(m=2*Math.PI+m),c&&p>m&&(p-=2*Math.PI),!c&&m>p&&(m-=2*Math.PI)}let y=m-p;if(Math.abs(y)>120*Math.PI/180){const z=m,P=r,I=n;m=c&&m>p?p+120*Math.PI/180*1:p+120*Math.PI/180*-1,f=Dv(r=x+i*Math.cos(m),n=g+s*Math.sin(m),P,I,i,s,o,0,c,[m,z,x,g])}y=m-p;const k=Math.cos(p),b=Math.sin(p),w=Math.cos(m),_=Math.sin(m),T=Math.tan(y/4),S=4/3*i*T,L=4/3*s*T,B=[t,e],N=[t+S*b,e-L*k],A=[r+S*_,n-L*w],R=[r,n];if(N[0]=2*B[0]-N[0],N[1]=2*B[1]-N[1],h)return[N,A,R].concat(f);{f=[N,A,R].concat(f);const z=[];for(let P=0;P<f.length;P+=3){const I=oo(f[P][0],f[P][1],u),F=oo(f[P+1][0],f[P+1][1],u),$=oo(f[P+2][0],f[P+2][1],u);z.push([I[0],I[1],F[0],F[1],$[0],$[1]])}return z}}const hz={randOffset:function(t,e){return Lt(t,e)},randOffsetWithRange:function(t,e,r){return oc(t,e,r)},ellipse:function(t,e,r,n,i){const s=Rv(r,n,i);return xd(t,e,i,s).opset},doubleLineOps:function(t,e,r,n,i){return Fn(t,e,r,n,i,!0)}};function Ov(t,e,r,n,i){return{type:"path",ops:Fn(t,e,r,n,i)}}function ul(t,e,r){const n=(t||[]).length;if(n>2){const i=[];for(let s=0;s<n-1;s++)i.push(...Fn(t[s][0],t[s][1],t[s+1][0],t[s+1][1],r));return e&&i.push(...Fn(t[n-1][0],t[n-1][1],t[0][0],t[0][1],r)),{type:"path",ops:i}}return n===2?Ov(t[0][0],t[0][1],t[1][0],t[1][1],r):{type:"path",ops:[]}}function uz(t,e,r,n,i){return(function(s,o){return ul(s,!0,o)})([[t,e],[t+r,e],[t+r,e+n],[t,e+n]],i)}function cx(t,e){if(t.length){const r=typeof t[0][0]=="number"?[t]:t,n=Ra(r[0],1*(1+.2*e.roughness),e),i=e.disableMultiStroke?[]:Ra(r[0],1.5*(1+.22*e.roughness),dx(e));for(let s=1;s<r.length;s++){const o=r[s];if(o.length){const a=Ra(o,1*(1+.2*e.roughness),e),c=e.disableMultiStroke?[]:Ra(o,1.5*(1+.22*e.roughness),dx(e));for(const h of a)h.op!=="move"&&n.push(h);for(const h of c)h.op!=="move"&&i.push(h)}}return{type:"path",ops:n.concat(i)}}return{type:"path",ops:[]}}function Rv(t,e,r){const n=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(t/2,2)+Math.pow(e/2,2))/2)),i=Math.ceil(Math.max(r.curveStepCount,r.curveStepCount/Math.sqrt(200)*n)),s=2*Math.PI/i;let o=Math.abs(t/2),a=Math.abs(e/2);const c=1-r.curveFitting;return o+=Lt(o*c,r),a+=Lt(a*c,r),{increment:s,rx:o,ry:a}}function xd(t,e,r,n){const[i,s]=px(n.increment,t,e,n.rx,n.ry,1,n.increment*oc(.1,oc(.4,1,r),r),r);let o=ac(i,null,r);if(!r.disableMultiStroke&&r.roughness!==0){const[a]=px(n.increment,t,e,n.rx,n.ry,1.5,0,r),c=ac(a,null,r);o=o.concat(c)}return{estimatedPoints:s,opset:{type:"path",ops:o}}}function hx(t,e,r,n,i,s,o,a,c){const h=t,u=e;let d=Math.abs(r/2),f=Math.abs(n/2);d+=Lt(.01*d,c),f+=Lt(.01*f,c);let p=i,m=s;for(;p<0;)p+=2*Math.PI,m+=2*Math.PI;m-p>2*Math.PI&&(p=0,m=2*Math.PI);const x=2*Math.PI/c.curveStepCount,g=Math.min(x/2,(m-p)/2),y=fx(g,h,u,d,f,p,m,1,c);if(!c.disableMultiStroke){const k=fx(g,h,u,d,f,p,m,1.5,c);y.push(...k)}return o&&(a?y.push(...Fn(h,u,h+d*Math.cos(p),u+f*Math.sin(p),c),...Fn(h,u,h+d*Math.cos(m),u+f*Math.sin(m),c)):y.push({op:"lineTo",data:[h,u]},{op:"lineTo",data:[h+d*Math.cos(p),u+f*Math.sin(p)]})),{type:"path",ops:y}}function ux(t,e){const r=$v(Pv(Cf(t))),n=[];let i=[0,0],s=[0,0];for(const{key:o,data:a}of r)switch(o){case"M":s=[a[0],a[1]],i=[a[0],a[1]];break;case"L":n.push(...Fn(s[0],s[1],a[0],a[1],e)),s=[a[0],a[1]];break;case"C":{const[c,h,u,d,f,p]=a;n.push(...dz(c,h,u,d,f,p,s,e)),s=[f,p];break}case"Z":n.push(...Fn(s[0],s[1],i[0],i[1],e)),s=[i[0],i[1]]}return{type:"path",ops:n}}function Zh(t,e){const r=[];for(const n of t)if(n.length){const i=e.maxRandomnessOffset||0,s=n.length;if(s>2){r.push({op:"move",data:[n[0][0]+Lt(i,e),n[0][1]+Lt(i,e)]});for(let o=1;o<s;o++)r.push({op:"lineTo",data:[n[o][0]+Lt(i,e),n[o][1]+Lt(i,e)]})}}return{type:"fillPath",ops:r}}function Li(t,e){return(function(r,n){let i=r.fillStyle||"hachure";if(!nr[i])switch(i){case"zigzag":nr[i]||(nr[i]=new nz(n));break;case"cross-hatch":nr[i]||(nr[i]=new iz(n));break;case"dots":nr[i]||(nr[i]=new sz(n));break;case"dashed":nr[i]||(nr[i]=new oz(n));break;case"zigzag-line":nr[i]||(nr[i]=new az(n));break;default:i="hachure",nr[i]||(nr[i]=new bf(n))}return nr[i]})(e,hz).fillPolygons(t,e)}function dx(t){const e=Object.assign({},t);return e.randomizer=void 0,t.seed&&(e.seed=t.seed+1),e}function zv(t){return t.randomizer||(t.randomizer=new lz(t.seed||0)),t.randomizer.next()}function oc(t,e,r,n=1){return r.roughness*n*(zv(r)*(e-t)+t)}function Lt(t,e,r=1){return oc(-t,t,e,r)}function Fn(t,e,r,n,i,s=!1){const o=s?i.disableMultiStrokeFill:i.disableMultiStroke,a=yd(t,e,r,n,i,!0,!1);if(o)return a;const c=yd(t,e,r,n,i,!0,!0);return a.concat(c)}function yd(t,e,r,n,i,s,o){const a=Math.pow(t-r,2)+Math.pow(e-n,2),c=Math.sqrt(a);let h=1;h=c<200?1:c>500?.4:-.0016668*c+1.233334;let u=i.maxRandomnessOffset||0;u*u*100>a&&(u=c/10);const d=u/2,f=.2+.2*zv(i);let p=i.bowing*i.maxRandomnessOffset*(n-e)/200,m=i.bowing*i.maxRandomnessOffset*(t-r)/200;p=Lt(p,i,h),m=Lt(m,i,h);const x=[],g=()=>Lt(d,i,h),y=()=>Lt(u,i,h),k=i.preserveVertices;return o?x.push({op:"move",data:[t+(k?0:g()),e+(k?0:g())]}):x.push({op:"move",data:[t+(k?0:Lt(u,i,h)),e+(k?0:Lt(u,i,h))]}),o?x.push({op:"bcurveTo",data:[p+t+(r-t)*f+g(),m+e+(n-e)*f+g(),p+t+2*(r-t)*f+g(),m+e+2*(n-e)*f+g(),r+(k?0:g()),n+(k?0:g())]}):x.push({op:"bcurveTo",data:[p+t+(r-t)*f+y(),m+e+(n-e)*f+y(),p+t+2*(r-t)*f+y(),m+e+2*(n-e)*f+y(),r+(k?0:y()),n+(k?0:y())]}),x}function Ra(t,e,r){if(!t.length)return[];const n=[];n.push([t[0][0]+Lt(e,r),t[0][1]+Lt(e,r)]),n.push([t[0][0]+Lt(e,r),t[0][1]+Lt(e,r)]);for(let i=1;i<t.length;i++)n.push([t[i][0]+Lt(e,r),t[i][1]+Lt(e,r)]),i===t.length-1&&n.push([t[i][0]+Lt(e,r),t[i][1]+Lt(e,r)]);return ac(n,null,r)}function ac(t,e,r){const n=t.length,i=[];if(n>3){const s=[],o=1-r.curveTightness;i.push({op:"move",data:[t[1][0],t[1][1]]});for(let a=1;a+2<n;a++){const c=t[a];s[0]=[c[0],c[1]],s[1]=[c[0]+(o*t[a+1][0]-o*t[a-1][0])/6,c[1]+(o*t[a+1][1]-o*t[a-1][1])/6],s[2]=[t[a+1][0]+(o*t[a][0]-o*t[a+2][0])/6,t[a+1][1]+(o*t[a][1]-o*t[a+2][1])/6],s[3]=[t[a+1][0],t[a+1][1]],i.push({op:"bcurveTo",data:[s[1][0],s[1][1],s[2][0],s[2][1],s[3][0],s[3][1]]})}}else n===3?(i.push({op:"move",data:[t[1][0],t[1][1]]}),i.push({op:"bcurveTo",data:[t[1][0],t[1][1],t[2][0],t[2][1],t[2][0],t[2][1]]})):n===2&&i.push(...yd(t[0][0],t[0][1],t[1][0],t[1][1],r,!0,!0));return i}function px(t,e,r,n,i,s,o,a){const c=[],h=[];if(a.roughness===0){t/=4,h.push([e+n*Math.cos(-t),r+i*Math.sin(-t)]);for(let u=0;u<=2*Math.PI;u+=t){const d=[e+n*Math.cos(u),r+i*Math.sin(u)];c.push(d),h.push(d)}h.push([e+n*Math.cos(0),r+i*Math.sin(0)]),h.push([e+n*Math.cos(t),r+i*Math.sin(t)])}else{const u=Lt(.5,a)-Math.PI/2;h.push([Lt(s,a)+e+.9*n*Math.cos(u-t),Lt(s,a)+r+.9*i*Math.sin(u-t)]);const d=2*Math.PI+u-.01;for(let f=u;f<d;f+=t){const p=[Lt(s,a)+e+n*Math.cos(f),Lt(s,a)+r+i*Math.sin(f)];c.push(p),h.push(p)}h.push([Lt(s,a)+e+n*Math.cos(u+2*Math.PI+.5*o),Lt(s,a)+r+i*Math.sin(u+2*Math.PI+.5*o)]),h.push([Lt(s,a)+e+.98*n*Math.cos(u+o),Lt(s,a)+r+.98*i*Math.sin(u+o)]),h.push([Lt(s,a)+e+.9*n*Math.cos(u+.5*o),Lt(s,a)+r+.9*i*Math.sin(u+.5*o)])}return[h,c]}function fx(t,e,r,n,i,s,o,a,c){const h=s+Lt(.1,c),u=[];u.push([Lt(a,c)+e+.9*n*Math.cos(h-t),Lt(a,c)+r+.9*i*Math.sin(h-t)]);for(let d=h;d<=o;d+=t)u.push([Lt(a,c)+e+n*Math.cos(d),Lt(a,c)+r+i*Math.sin(d)]);return u.push([e+n*Math.cos(o),r+i*Math.sin(o)]),u.push([e+n*Math.cos(o),r+i*Math.sin(o)]),ac(u,null,c)}function dz(t,e,r,n,i,s,o,a){const c=[],h=[a.maxRandomnessOffset||1,(a.maxRandomnessOffset||1)+.3];let u=[0,0];const d=a.disableMultiStroke?1:2,f=a.preserveVertices;for(let p=0;p<d;p++)p===0?c.push({op:"move",data:[o[0],o[1]]}):c.push({op:"move",data:[o[0]+(f?0:Lt(h[0],a)),o[1]+(f?0:Lt(h[0],a))]}),u=f?[i,s]:[i+Lt(h[p],a),s+Lt(h[p],a)],c.push({op:"bcurveTo",data:[t+Lt(h[p],a),e+Lt(h[p],a),r+Lt(h[p],a),n+Lt(h[p],a),u[0],u[1]]});return c}function ao(t){return[...t]}function mx(t,e=0){const r=t.length;if(r<3)throw new Error("A curve must have at least three points.");const n=[];if(r===3)n.push(ao(t[0]),ao(t[1]),ao(t[2]),ao(t[2]));else{const i=[];i.push(t[0],t[0]);for(let a=1;a<t.length;a++)i.push(t[a]),a===t.length-1&&i.push(t[a]);const s=[],o=1-e;n.push(ao(i[0]));for(let a=1;a+2<i.length;a++){const c=i[a];s[0]=[c[0],c[1]],s[1]=[c[0]+(o*i[a+1][0]-o*i[a-1][0])/6,c[1]+(o*i[a+1][1]-o*i[a-1][1])/6],s[2]=[i[a+1][0]+(o*i[a][0]-o*i[a+2][0])/6,i[a+1][1]+(o*i[a][1]-o*i[a+2][1])/6],s[3]=[i[a+1][0],i[a+1][1]],n.push(s[1],s[2],s[3])}}return n}function dl(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)}function pz(t,e,r){const n=dl(e,r);if(n===0)return dl(t,e);let i=((t[0]-e[0])*(r[0]-e[0])+(t[1]-e[1])*(r[1]-e[1]))/n;return i=Math.max(0,Math.min(1,i)),dl(t,Yn(e,r,i))}function Yn(t,e,r){return[t[0]+(e[0]-t[0])*r,t[1]+(e[1]-t[1])*r]}function bd(t,e,r,n){const i=n||[];if((function(a,c){const h=a[c+0],u=a[c+1],d=a[c+2],f=a[c+3];let p=3*u[0]-2*h[0]-f[0];p*=p;let m=3*u[1]-2*h[1]-f[1];m*=m;let x=3*d[0]-2*f[0]-h[0];x*=x;let g=3*d[1]-2*f[1]-h[1];return g*=g,p<x&&(p=x),m<g&&(m=g),p+m})(t,e)<r){const a=t[e+0];i.length?(s=i[i.length-1],o=a,Math.sqrt(dl(s,o))>1&&i.push(a)):i.push(a),i.push(t[e+3])}else{const c=t[e+0],h=t[e+1],u=t[e+2],d=t[e+3],f=Yn(c,h,.5),p=Yn(h,u,.5),m=Yn(u,d,.5),x=Yn(f,p,.5),g=Yn(p,m,.5),y=Yn(x,g,.5);bd([c,f,x,y],0,r,i),bd([y,g,m,d],0,r,i)}var s,o;return i}function fz(t,e){return lc(t,0,t.length,e)}function lc(t,e,r,n,i){const s=i||[],o=t[e],a=t[r-1];let c=0,h=1;for(let u=e+1;u<r-1;++u){const d=pz(t[u],o,a);d>c&&(c=d,h=u)}return Math.sqrt(c)>n?(lc(t,e,h+1,n,s),lc(t,h,r,n,s)):(s.length||s.push(o),s.push(a)),s}function Jh(t,e=.15,r){const n=[],i=(t.length-1)/3;for(let s=0;s<i;s++)bd(t,3*s,e,n);return r&&r>0?lc(n,0,n.length,r):n}const fr="none";class cc{constructor(e){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=e||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(Math.random()*2**31)}_o(e){return e?Object.assign({},this.defaultOptions,e):this.defaultOptions}_d(e,r,n){return{shape:e,sets:r||[],options:n||this.defaultOptions}}line(e,r,n,i,s){const o=this._o(s);return this._d("line",[Ov(e,r,n,i,o)],o)}rectangle(e,r,n,i,s){const o=this._o(s),a=[],c=uz(e,r,n,i,o);if(o.fill){const h=[[e,r],[e+n,r],[e+n,r+i],[e,r+i]];o.fillStyle==="solid"?a.push(Zh([h],o)):a.push(Li([h],o))}return o.stroke!==fr&&a.push(c),this._d("rectangle",a,o)}ellipse(e,r,n,i,s){const o=this._o(s),a=[],c=Rv(n,i,o),h=xd(e,r,o,c);if(o.fill)if(o.fillStyle==="solid"){const u=xd(e,r,o,c).opset;u.type="fillPath",a.push(u)}else a.push(Li([h.estimatedPoints],o));return o.stroke!==fr&&a.push(h.opset),this._d("ellipse",a,o)}circle(e,r,n,i){const s=this.ellipse(e,r,n,n,i);return s.shape="circle",s}linearPath(e,r){const n=this._o(r);return this._d("linearPath",[ul(e,!1,n)],n)}arc(e,r,n,i,s,o,a=!1,c){const h=this._o(c),u=[],d=hx(e,r,n,i,s,o,a,!0,h);if(a&&h.fill)if(h.fillStyle==="solid"){const f=Object.assign({},h);f.disableMultiStroke=!0;const p=hx(e,r,n,i,s,o,!0,!1,f);p.type="fillPath",u.push(p)}else u.push((function(f,p,m,x,g,y,k){const b=f,w=p;let _=Math.abs(m/2),T=Math.abs(x/2);_+=Lt(.01*_,k),T+=Lt(.01*T,k);let S=g,L=y;for(;S<0;)S+=2*Math.PI,L+=2*Math.PI;L-S>2*Math.PI&&(S=0,L=2*Math.PI);const B=(L-S)/k.curveStepCount,N=[];for(let A=S;A<=L;A+=B)N.push([b+_*Math.cos(A),w+T*Math.sin(A)]);return N.push([b+_*Math.cos(L),w+T*Math.sin(L)]),N.push([b,w]),Li([N],k)})(e,r,n,i,s,o,h));return h.stroke!==fr&&u.push(d),this._d("arc",u,h)}curve(e,r){const n=this._o(r),i=[],s=cx(e,n);if(n.fill&&n.fill!==fr)if(n.fillStyle==="solid"){const o=cx(e,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(o.ops)})}else{const o=[],a=e;if(a.length){const c=typeof a[0][0]=="number"?[a]:a;for(const h of c)h.length<3?o.push(...h):h.length===3?o.push(...Jh(mx([h[0],h[0],h[1],h[2]]),10,(1+n.roughness)/2)):o.push(...Jh(mx(h),10,(1+n.roughness)/2))}o.length&&i.push(Li([o],n))}return n.stroke!==fr&&i.push(s),this._d("curve",i,n)}polygon(e,r){const n=this._o(r),i=[],s=ul(e,!0,n);return n.fill&&(n.fillStyle==="solid"?i.push(Zh([e],n)):i.push(Li([e],n))),n.stroke!==fr&&i.push(s),this._d("polygon",i,n)}path(e,r){const n=this._o(r),i=[];if(!e)return this._d("path",i,n);e=(e||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");const s=n.fill&&n.fill!=="transparent"&&n.fill!==fr,o=n.stroke!==fr,a=!!(n.simplification&&n.simplification<1),c=(function(u,d,f){const p=$v(Pv(Cf(u))),m=[];let x=[],g=[0,0],y=[];const k=()=>{y.length>=4&&x.push(...Jh(y,d)),y=[]},b=()=>{k(),x.length&&(m.push(x),x=[])};for(const{key:_,data:T}of p)switch(_){case"M":b(),g=[T[0],T[1]],x.push(g);break;case"L":k(),x.push([T[0],T[1]]);break;case"C":if(!y.length){const S=x.length?x[x.length-1]:g;y.push([S[0],S[1]])}y.push([T[0],T[1]]),y.push([T[2],T[3]]),y.push([T[4],T[5]]);break;case"Z":k(),x.push([g[0],g[1]])}if(b(),!f)return m;const w=[];for(const _ of m){const T=fz(_,f);T.length&&w.push(T)}return w})(e,1,a?4-4*(n.simplification||1):(1+n.roughness)/2),h=ux(e,n);if(s)if(n.fillStyle==="solid")if(c.length===1){const u=ux(e,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(u.ops)})}else i.push(Zh(c,n));else i.push(Li(c,n));return o&&(a?c.forEach((u=>{i.push(ul(u,!1,n))})):i.push(h)),this._d("path",i,n)}opsToPath(e,r){let n="";for(const i of e.ops){const s=typeof r=="number"&&r>=0?i.data.map((o=>+o.toFixed(r))):i.data;switch(i.op){case"move":n+=`M${s[0]} ${s[1]} `;break;case"bcurveTo":n+=`C${s[0]} ${s[1]}, ${s[2]} ${s[3]}, ${s[4]} ${s[5]} `;break;case"lineTo":n+=`L${s[0]} ${s[1]} `}}return n.trim()}toPaths(e){const r=e.sets||[],n=e.options||this.defaultOptions,i=[];for(const s of r){let o=null;switch(s.type){case"path":o={d:this.opsToPath(s),stroke:n.stroke,strokeWidth:n.strokeWidth,fill:fr};break;case"fillPath":o={d:this.opsToPath(s),stroke:fr,strokeWidth:0,fill:n.fill||fr};break;case"fillSketch":o=this.fillSketch(s,n)}o&&i.push(o)}return i}fillSketch(e,r){let n=r.fillWeight;return n<0&&(n=r.strokeWidth/2),{d:this.opsToPath(e),stroke:r.fill||fr,strokeWidth:n,fill:fr}}_mergedShape(e){return e.filter(((r,n)=>n===0||r.op!=="move"))}}class mz{constructor(e,r){this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.gen=new cc(r)}draw(e){const r=e.sets||[],n=e.options||this.getDefaultOptions(),i=this.ctx,s=e.options.fixedDecimalPlaceDigits;for(const o of r)switch(o.type){case"path":i.save(),i.strokeStyle=n.stroke==="none"?"transparent":n.stroke,i.lineWidth=n.strokeWidth,n.strokeLineDash&&i.setLineDash(n.strokeLineDash),n.strokeLineDashOffset&&(i.lineDashOffset=n.strokeLineDashOffset),this._drawToContext(i,o,s),i.restore();break;case"fillPath":{i.save(),i.fillStyle=n.fill||"";const a=e.shape==="curve"||e.shape==="polygon"||e.shape==="path"?"evenodd":"nonzero";this._drawToContext(i,o,s,a),i.restore();break}case"fillSketch":this.fillSketch(i,o,n)}}fillSketch(e,r,n){let i=n.fillWeight;i<0&&(i=n.strokeWidth/2),e.save(),n.fillLineDash&&e.setLineDash(n.fillLineDash),n.fillLineDashOffset&&(e.lineDashOffset=n.fillLineDashOffset),e.strokeStyle=n.fill||"",e.lineWidth=i,this._drawToContext(e,r,n.fixedDecimalPlaceDigits),e.restore()}_drawToContext(e,r,n,i="nonzero"){e.beginPath();for(const s of r.ops){const o=typeof n=="number"&&n>=0?s.data.map((a=>+a.toFixed(n))):s.data;switch(s.op){case"move":e.moveTo(o[0],o[1]);break;case"bcurveTo":e.bezierCurveTo(o[0],o[1],o[2],o[3],o[4],o[5]);break;case"lineTo":e.lineTo(o[0],o[1])}}r.type==="fillPath"?e.fill(i):e.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(e,r,n,i,s){const o=this.gen.line(e,r,n,i,s);return this.draw(o),o}rectangle(e,r,n,i,s){const o=this.gen.rectangle(e,r,n,i,s);return this.draw(o),o}ellipse(e,r,n,i,s){const o=this.gen.ellipse(e,r,n,i,s);return this.draw(o),o}circle(e,r,n,i){const s=this.gen.circle(e,r,n,i);return this.draw(s),s}linearPath(e,r){const n=this.gen.linearPath(e,r);return this.draw(n),n}polygon(e,r){const n=this.gen.polygon(e,r);return this.draw(n),n}arc(e,r,n,i,s,o,a=!1,c){const h=this.gen.arc(e,r,n,i,s,o,a,c);return this.draw(h),h}curve(e,r){const n=this.gen.curve(e,r);return this.draw(n),n}path(e,r){const n=this.gen.path(e,r);return this.draw(n),n}}const za="http://www.w3.org/2000/svg";class gz{constructor(e,r){this.svg=e,this.gen=new cc(r)}draw(e){const r=e.sets||[],n=e.options||this.getDefaultOptions(),i=this.svg.ownerDocument||window.document,s=i.createElementNS(za,"g"),o=e.options.fixedDecimalPlaceDigits;for(const a of r){let c=null;switch(a.type){case"path":c=i.createElementNS(za,"path"),c.setAttribute("d",this.opsToPath(a,o)),c.setAttribute("stroke",n.stroke),c.setAttribute("stroke-width",n.strokeWidth+""),c.setAttribute("fill","none"),n.strokeLineDash&&c.setAttribute("stroke-dasharray",n.strokeLineDash.join(" ").trim()),n.strokeLineDashOffset&&c.setAttribute("stroke-dashoffset",`${n.strokeLineDashOffset}`);break;case"fillPath":c=i.createElementNS(za,"path"),c.setAttribute("d",this.opsToPath(a,o)),c.setAttribute("stroke","none"),c.setAttribute("stroke-width","0"),c.setAttribute("fill",n.fill||""),e.shape!=="curve"&&e.shape!=="polygon"||c.setAttribute("fill-rule","evenodd");break;case"fillSketch":c=this.fillSketch(i,a,n)}c&&s.appendChild(c)}return s}fillSketch(e,r,n){let i=n.fillWeight;i<0&&(i=n.strokeWidth/2);const s=e.createElementNS(za,"path");return s.setAttribute("d",this.opsToPath(r,n.fixedDecimalPlaceDigits)),s.setAttribute("stroke",n.fill||""),s.setAttribute("stroke-width",i+""),s.setAttribute("fill","none"),n.fillLineDash&&s.setAttribute("stroke-dasharray",n.fillLineDash.join(" ").trim()),n.fillLineDashOffset&&s.setAttribute("stroke-dashoffset",`${n.fillLineDashOffset}`),s}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(e,r){return this.gen.opsToPath(e,r)}line(e,r,n,i,s){const o=this.gen.line(e,r,n,i,s);return this.draw(o)}rectangle(e,r,n,i,s){const o=this.gen.rectangle(e,r,n,i,s);return this.draw(o)}ellipse(e,r,n,i,s){const o=this.gen.ellipse(e,r,n,i,s);return this.draw(o)}circle(e,r,n,i){const s=this.gen.circle(e,r,n,i);return this.draw(s)}linearPath(e,r){const n=this.gen.linearPath(e,r);return this.draw(n)}polygon(e,r){const n=this.gen.polygon(e,r);return this.draw(n)}arc(e,r,n,i,s,o,a=!1,c){const h=this.gen.arc(e,r,n,i,s,o,a,c);return this.draw(h)}curve(e,r){const n=this.gen.curve(e,r);return this.draw(n)}path(e,r){const n=this.gen.path(e,r);return this.draw(n)}}var mt={canvas:(t,e)=>new mz(t,e),svg:(t,e)=>new gz(t,e),generator:t=>new cc(t),newSeed:()=>cc.newSeed()},Et=v(async(t,e,r)=>{var p,m;let n;const i=e.useHtmlLabels||gn((p=Vt())==null?void 0:p.htmlLabels);r?n=r:n="node default";const s=t.insert("g").attr("class",n).attr("id",e.domId||e.id),o=s.insert("g").attr("class","label").attr("style",Be(e.labelStyle));let a;e.label===void 0?a="":a=typeof e.label=="string"?e.label:e.label[0];const c=!!e.icon||!!e.img,h=e.labelType==="markdown",u=await yn(o,$r(di(a),Vt()),{useHtmlLabels:i,width:e.width||((m=Vt().flowchart)==null?void 0:m.wrappingWidth),classes:h?"markdown-node-label":"",style:e.labelStyle,addSvgBackground:c,markdown:h},Vt());let d=u.getBBox();const f=((e==null?void 0:e.padding)??0)/2;if(i){const x=u.children[0],g=Ot(u);await av(x,a),d=x.getBoundingClientRect(),g.attr("width",d.width),g.attr("height",d.height)}return i?o.attr("transform","translate("+-d.width/2+", "+-d.height/2+")"):o.attr("transform","translate(0, "+-d.height/2+")"),e.centerLabel&&o.attr("transform","translate("+-d.width/2+", "+-d.height/2+")"),o.insert("rect",":first-child"),{shapeSvg:s,bbox:d,halfPadding:f,label:o}},"labelHelper"),tu=v(async(t,e,r)=>{var c,h;const n=r.useHtmlLabels??er(Vt()),i=t.insert("g").attr("class","label").attr("style",r.labelStyle||""),s=await yn(i,$r(di(e),Vt()),{useHtmlLabels:n,width:r.width||((h=(c=Vt())==null?void 0:c.flowchart)==null?void 0:h.wrappingWidth),style:r.labelStyle,addSvgBackground:!!r.icon||!!r.img});let o=s.getBBox();const a=r.padding/2;if(er(Vt())){const u=s.children[0],d=Ot(s);o=u.getBoundingClientRect(),d.attr("width",o.width),d.attr("height",o.height)}return n?i.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"):i.attr("transform","translate(0, "+-o.height/2+")"),r.centerLabel&&i.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"),i.insert("rect",":first-child"),{shapeSvg:t,bbox:o,halfPadding:a,label:i}},"insertLabel"),yt=v((t,e)=>{const r=e.node().getBBox();t.width=r.width,t.height=r.height},"updateNodeBounds"),Nt=v((t,e)=>(t.look==="handDrawn"?"rough-node":"node")+" "+t.cssClasses+" "+(e||""),"getNodeClasses");function Wt(t){const e=t.map((r,n)=>`${n===0?"M":"L"}${r.x},${r.y}`);return e.push("Z"),e.join(" ")}v(Wt,"createPathFromPoints");function Pn(t,e,r,n,i,s){const o=[],c=r-t,h=n-e,u=c/s,d=2*Math.PI/u,f=e+h/2;for(let p=0;p<=50;p++){const m=p/50,x=t+m*c,g=f+i*Math.sin(d*(x-t));o.push({x,y:g})}return o}v(Pn,"generateFullSineWavePoints");function Qo(t,e,r,n,i,s){const o=[],a=i*Math.PI/180,u=(s*Math.PI/180-a)/(n-1);for(let d=0;d<n;d++){const f=a+d*u,p=t+r*Math.cos(f),m=e+r*Math.sin(f);o.push({x:-p,y:-m})}return o}v(Qo,"generateCirclePoints");function Cd(t){const e=Array.from(t.childNodes).filter(c=>c.tagName==="path"),r=document.createElementNS("http://www.w3.org/2000/svg","path"),n=e.map(c=>c.getAttribute("d")).filter(c=>c!==null).join(" ");r.setAttribute("d",n);const i=e.find(c=>c.getAttribute("fill")!=="none"),s=e.find(c=>c.getAttribute("stroke")!=="none"),o=v((c,h)=>(c==null?void 0:c.getAttribute(h))??void 0,"getAttr");if(i){const c={fill:o(i,"fill"),"fill-opacity":o(i,"fill-opacity")??"1"};Object.entries(c).forEach(([h,u])=>{u&&r.setAttribute(h,u)})}if(s){const c={stroke:o(s,"stroke"),"stroke-width":o(s,"stroke-width")??"1","stroke-opacity":o(s,"stroke-opacity")??"1"};Object.entries(c).forEach(([h,u])=>{u&&r.setAttribute(h,u)})}const a=document.createElementNS("http://www.w3.org/2000/svg","g");return a.appendChild(r),a}v(Cd,"mergePaths");var xz=v((t,e)=>{var r=t.x,n=t.y,i=e.x-r,s=e.y-n,o=t.width/2,a=t.height/2,c,h;return Math.abs(s)*o>Math.abs(i)*a?(s<0&&(a=-a),c=s===0?0:a*i/s,h=a):(i<0&&(o=-o),c=o,h=i===0?0:o*s/i),{x:r+c,y:n+h}},"intersectRect"),js=xz,yz=v(async(t,e,r,n=!1,i=!1)=>{let s=e||"";typeof s=="object"&&(s=s[0]);const o=Vt(),a=er(o);return await yn(t,s,{style:r,isTitle:n,useHtmlLabels:a,markdown:!1,isNode:i,width:Number.POSITIVE_INFINITY},o)},"createLabel"),_n=yz,Rn=v((t,e,r,n,i)=>["M",t+i,e,"H",t+r-i,"A",i,i,0,0,1,t+r,e+i,"V",e+n-i,"A",i,i,0,0,1,t+r-i,e+n,"H",t+i,"A",i,i,0,0,1,t,e+n-i,"V",e+i,"A",i,i,0,0,1,t+i,e,"Z"].join(" "),"createRoundedRectPathD"),qv=v(async(t,e)=>{rt.info("Creating subgraph rect for ",e.id,e);const r=Vt(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:s,clusterBorder:o}=n,{labelStyles:a,nodeStyles:c,borderStyles:h,backgroundStyles:u}=xt(e),d=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.domId).attr("data-look",e.look),f=er(r),p=d.insert("g").attr("class","cluster-label ");let m;e.labelType==="markdown"?m=await yn(p,e.label,{style:e.labelStyle,useHtmlLabels:f,isNode:!0,width:e.width}):m=await _n(p,e.label,e.labelStyle||"",!1,!0);let x=m.getBBox();if(er(r)){const S=m.children[0],L=Ot(m);x=S.getBoundingClientRect(),L.attr("width",x.width),L.attr("height",x.height)}const g=e.width<=x.width+e.padding?x.width+e.padding:e.width;e.width<=x.width+e.padding?e.diff=(g-e.width)/2-e.padding:e.diff=-e.padding;const y=e.height,k=e.x-g/2,b=e.y-y/2;rt.trace("Data ",e,JSON.stringify(e));let w;if(e.look==="handDrawn"){const S=mt.svg(d),L=gt(e,{roughness:.7,fill:s,stroke:o,fillWeight:3,seed:i}),B=S.path(Rn(k,b,g,y,0),L);w=d.insert(()=>(rt.debug("Rough node insert CXC",B),B),":first-child"),w.select("path:nth-child(2)").attr("style",h.join(";")),w.select("path").attr("style",u.join(";").replace("fill","stroke"))}else w=d.insert("rect",":first-child"),w.attr("style",c).attr("rx",e.rx).attr("ry",e.ry).attr("x",k).attr("y",b).attr("width",g).attr("height",y);const{subGraphTitleTopMargin:_}=lf(r);if(p.attr("transform",`translate(${e.x-x.width/2}, ${e.y-e.height/2+_})`),a){const S=p.select("span");S&&S.attr("style",a)}const T=w.node().getBBox();return e.offsetX=0,e.width=T.width,e.height=T.height,e.offsetY=x.height-e.padding/2,e.intersect=function(S){return js(e,S)},{cluster:d,labelBBox:x}},"rect"),bz=v((t,e)=>{const r=t.insert("g").attr("class","note-cluster").attr("id",e.domId),n=r.insert("rect",":first-child"),i=0*e.padding,s=i/2;n.attr("rx",e.rx).attr("ry",e.ry).attr("x",e.x-e.width/2-s).attr("y",e.y-e.height/2-s).attr("width",e.width+i).attr("height",e.height+i).attr("fill","none");const o=n.node().getBBox();return e.width=o.width,e.height=o.height,e.intersect=function(a){return js(e,a)},{cluster:r,labelBBox:{width:0,height:0}}},"noteGroup"),Cz=v(async(t,e)=>{const r=Vt(),{themeVariables:n,handDrawnSeed:i}=r,{altBackground:s,compositeBackground:o,compositeTitleBackground:a,nodeBorder:c}=n,h=t.insert("g").attr("class",e.cssClasses).attr("id",e.domId).attr("data-id",e.id).attr("data-look",e.look),u=h.insert("g",":first-child"),d=h.insert("g").attr("class","cluster-label");let f=h.append("rect");const p=await _n(d,e.label,e.labelStyle,void 0,!0);let m=p.getBBox();if(er(r)){const B=p.children[0],N=Ot(p);m=B.getBoundingClientRect(),N.attr("width",m.width),N.attr("height",m.height)}const x=0*e.padding,g=x/2,y=(e.width<=m.width+e.padding?m.width+e.padding:e.width)+x;e.width<=m.width+e.padding?e.diff=(y-e.width)/2-e.padding:e.diff=-e.padding;const k=e.height+x,b=e.height+x-m.height-6,w=e.x-y/2,_=e.y-k/2;e.width=y;const T=e.y-e.height/2-g+m.height+2;let S;if(e.look==="handDrawn"){const B=e.cssClasses.includes("statediagram-cluster-alt"),N=mt.svg(h),A=e.rx||e.ry?N.path(Rn(w,_,y,k,10),{roughness:.7,fill:a,fillStyle:"solid",stroke:c,seed:i}):N.rectangle(w,_,y,k,{seed:i});S=h.insert(()=>A,":first-child");const R=N.rectangle(w,T,y,b,{fill:B?s:o,fillStyle:B?"hachure":"solid",stroke:c,seed:i});S=h.insert(()=>A,":first-child"),f=h.insert(()=>R)}else S=u.insert("rect",":first-child"),S.attr("class","outer").attr("x",w).attr("y",_).attr("width",y).attr("height",k).attr("data-look",e.look),f.attr("class","inner").attr("x",w).attr("y",T).attr("width",y).attr("height",b);d.attr("transform",`translate(${e.x-m.width/2}, ${_+1-(er(r)?0:3)})`);const L=S.node().getBBox();return e.height=L.height,e.offsetX=0,e.offsetY=m.height-e.padding/2,e.labelBBox=m,e.intersect=function(B){return js(e,B)},{cluster:h,labelBBox:m}},"roundedWithTitle"),kz=v(async(t,e)=>{rt.info("Creating subgraph rect for ",e.id,e);const r=Vt(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:s,clusterBorder:o}=n,{labelStyles:a,nodeStyles:c,borderStyles:h,backgroundStyles:u}=xt(e),d=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.domId).attr("data-look",e.look),f=er(r),p=d.insert("g").attr("class","cluster-label "),m=await yn(p,e.label,{style:e.labelStyle,useHtmlLabels:f,isNode:!0,width:e.width});let x=m.getBBox();if(er(r)){const S=m.children[0],L=Ot(m);x=S.getBoundingClientRect(),L.attr("width",x.width),L.attr("height",x.height)}const g=e.width<=x.width+e.padding?x.width+e.padding:e.width;e.width<=x.width+e.padding?e.diff=(g-e.width)/2-e.padding:e.diff=-e.padding;const y=e.height,k=e.x-g/2,b=e.y-y/2;rt.trace("Data ",e,JSON.stringify(e));let w;if(e.look==="handDrawn"){const S=mt.svg(d),L=gt(e,{roughness:.7,fill:s,stroke:o,fillWeight:4,seed:i}),B=S.path(Rn(k,b,g,y,e.rx),L);w=d.insert(()=>(rt.debug("Rough node insert CXC",B),B),":first-child"),w.select("path:nth-child(2)").attr("style",h.join(";")),w.select("path").attr("style",u.join(";").replace("fill","stroke"))}else w=d.insert("rect",":first-child"),w.attr("style",c).attr("rx",e.rx).attr("ry",e.ry).attr("x",k).attr("y",b).attr("width",g).attr("height",y);const{subGraphTitleTopMargin:_}=lf(r);if(p.attr("transform",`translate(${e.x-x.width/2}, ${e.y-e.height/2+_})`),a){const S=p.select("span");S&&S.attr("style",a)}const T=w.node().getBBox();return e.offsetX=0,e.width=T.width,e.height=T.height,e.offsetY=x.height-e.padding/2,e.intersect=function(S){return js(e,S)},{cluster:d,labelBBox:x}},"kanbanSection"),vz=v((t,e)=>{const r=Vt(),{themeVariables:n,handDrawnSeed:i}=r,{nodeBorder:s}=n,o=t.insert("g").attr("class",e.cssClasses).attr("id",e.domId).attr("data-look",e.look),a=o.insert("g",":first-child"),c=0*e.padding,h=e.width+c;e.diff=-e.padding;const u=e.height+c,d=e.x-h/2,f=e.y-u/2;e.width=h;let p;if(e.look==="handDrawn"){const g=mt.svg(o).rectangle(d,f,h,u,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:s,seed:i});p=o.insert(()=>g,":first-child")}else{p=a.insert("rect",":first-child");let x="outer";e.look,x="divider",p.attr("class",x).attr("x",d).attr("y",f).attr("width",h).attr("height",u).attr("data-look",e.look)}const m=p.node().getBBox();return e.height=m.height,e.offsetX=0,e.offsetY=0,e.intersect=function(x){return js(e,x)},{cluster:o,labelBBox:{}}},"divider"),wz=qv,Sz={rect:qv,squareRect:wz,roundedWithTitle:Cz,noteGroup:bz,divider:vz,kanbanSection:kz},Wv=new Map,Tz=v(async(t,e)=>{const r=e.shape||"rect",n=await Sz[r](t,e);return Wv.set(e.id,n),n},"insertCluster"),$K=v(()=>{Wv=new Map},"clear");function Hv(t,e){return t.intersect(e)}v(Hv,"intersectNode");var _z=Hv;function Uv(t,e,r,n){var i=t.x,s=t.y,o=i-n.x,a=s-n.y,c=Math.sqrt(e*e*a*a+r*r*o*o),h=Math.abs(e*r*o/c);n.x<i&&(h=-h);var u=Math.abs(e*r*a/c);return n.y<s&&(u=-u),{x:i+h,y:s+u}}v(Uv,"intersectEllipse");var Vv=Uv;function Yv(t,e,r){return Vv(t,e,e,r)}v(Yv,"intersectCircle");var jz=Yv;function Gv(t,e,r,n){{const i=e.y-t.y,s=t.x-e.x,o=e.x*t.y-t.x*e.y,a=i*r.x+s*r.y+o,c=i*n.x+s*n.y+o,h=1e-6;if(a!==0&&c!==0&&kd(a,c))return;const u=n.y-r.y,d=r.x-n.x,f=n.x*r.y-r.x*n.y,p=u*t.x+d*t.y+f,m=u*e.x+d*e.y+f;if(Math.abs(p)<h&&Math.abs(m)<h&&kd(p,m))return;const x=i*d-u*s;if(x===0)return;const g=Math.abs(x/2);let y=s*f-d*o;const k=y<0?(y-g)/x:(y+g)/x;y=u*o-i*f;const b=y<0?(y-g)/x:(y+g)/x;return{x:k,y:b}}}v(Gv,"intersectLine");function kd(t,e){return t*e>0}v(kd,"sameSign");var Nz=Gv;function Xv(t,e,r){let n=t.x,i=t.y,s=[],o=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY;typeof e.forEach=="function"?e.forEach(function(u){o=Math.min(o,u.x),a=Math.min(a,u.y)}):(o=Math.min(o,e.x),a=Math.min(a,e.y));let c=n-t.width/2-o,h=i-t.height/2-a;for(let u=0;u<e.length;u++){let d=e[u],f=e[u<e.length-1?u+1:0],p=Nz(t,r,{x:c+d.x,y:h+d.y},{x:c+f.x,y:h+f.y});p&&s.push(p)}return s.length?(s.length>1&&s.sort(function(u,d){let f=u.x-r.x,p=u.y-r.y,m=Math.sqrt(f*f+p*p),x=d.x-r.x,g=d.y-r.y,y=Math.sqrt(x*x+g*g);return m<y?-1:m===y?0:1}),s[0]):t}v(Xv,"intersectPolygon");var Ez=Xv,dt={node:_z,circle:jz,ellipse:Vv,polygon:Ez,rect:js};function Kv(t,e){const{labelStyles:r}=xt(e);e.labelStyle=r;const n=Nt(e);let i=n;n||(i="anchor");const s=t.insert("g").attr("class",i).attr("id",e.domId||e.id),o=1,{cssStyles:a}=e,c=mt.svg(s),h=gt(e,{fill:"black",stroke:"none",fillStyle:"solid"});e.look!=="handDrawn"&&(h.roughness=0);const u=c.circle(0,0,o*2,h),d=s.insert(()=>u,":first-child");return d.attr("class","anchor").attr("style",Be(a)),yt(e,d),e.intersect=function(f){return rt.info("Circle intersect",e,o,f),dt.circle(e,o,f)},s}v(Kv,"anchor");function vd(t,e,r,n,i,s,o){const c=(t+r)/2,h=(e+n)/2,u=Math.atan2(n-e,r-t),d=(r-t)/2,f=(n-e)/2,p=d/i,m=f/s,x=Math.sqrt(p**2+m**2);if(x>1)throw new Error("The given radii are too small to create an arc between the points.");const g=Math.sqrt(1-x**2),y=c+g*s*Math.sin(u)*(o?-1:1),k=h-g*i*Math.cos(u)*(o?-1:1),b=Math.atan2((e-k)/s,(t-y)/i);let _=Math.atan2((n-k)/s,(r-y)/i)-b;o&&_<0&&(_+=2*Math.PI),!o&&_>0&&(_-=2*Math.PI);const T=[];for(let S=0;S<20;S++){const L=S/19,B=b+L*_,N=y+i*Math.cos(B),A=k+s*Math.sin(B);T.push({x:N,y:A})}return T}v(vd,"generateArcPoints");function Qv(t,e,r){const[n,i]=[e,r].sort((s,o)=>o-s);return i*(1-Math.sqrt(1-(t/n/2)**2))}v(Qv,"calculateArcSagitta");async function Zv(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i,a=v(B=>B+o,"calcTotalHeight"),c=v(B=>{const N=B/2;return[N/(2.5+B/50),N]},"calcEllipseRadius"),{shapeSvg:h,bbox:u}=await Et(t,e,Nt(e)),d=a(e!=null&&e.height?e==null?void 0:e.height:u.height),[f,p]=c(d),m=Qv(d,f,p),g=(e!=null&&e.width?e==null?void 0:e.width:u.width)+s*2+m-m,y=d,{cssStyles:k}=e,b=[{x:g/2,y:-y/2},{x:-g/2,y:-y/2},...vd(-g/2,-y/2,-g/2,y/2,f,p,!1),{x:g/2,y:y/2},...vd(g/2,y/2,g/2,-y/2,f,p,!0)],w=mt.svg(h),_=gt(e,{});e.look!=="handDrawn"&&(_.roughness=0,_.fillStyle="solid");const T=Wt(b),S=w.path(T,_),L=h.insert(()=>S,":first-child");return L.attr("class","basic label-container outer-path"),k&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",k),n&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",n),L.attr("transform",`translate(${f/2}, 0)`),yt(e,L),e.intersect=function(B){return dt.polygon(e,b,B)},h}v(Zv,"bowTieRect");function bn(t,e,r,n){return t.insert("polygon",":first-child").attr("points",n.map(function(i){return i.x+","+i.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-e/2+","+r/2+")")}v(bn,"insertPolygonShape");var qa=12;async function Jv(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?28:i,o=e.look==="neo"?24:i,{shapeSvg:a,bbox:c}=await Et(t,e,Nt(e)),h=((e==null?void 0:e.width)??c.width)+(e.look==="neo"?s*2:s+qa),u=((e==null?void 0:e.height)??c.height)+(e.look==="neo"?o*2:o),d=0,f=h,p=-u,m=0,x=[{x:d+qa,y:p},{x:f,y:p},{x:f,y:m},{x:d,y:m},{x:d,y:p+qa},{x:d+qa,y:p}];let g;const{cssStyles:y}=e;if(e.look==="handDrawn"){const k=mt.svg(a),b=gt(e,{}),w=Wt(x),_=k.path(w,b);g=a.insert(()=>_,":first-child").attr("transform",`translate(${-h/2}, ${u/2})`),y&&g.attr("style",y)}else g=bn(a,h,u,x);return n&&g.attr("style",n),yt(e,g),e.intersect=function(k){return dt.polygon(e,x,k)},a}v(Jv,"card");function tw(t,e){const{nodeStyles:r}=xt(e);e.label="";const n=t.insert("g").attr("class",Nt(e)).attr("id",e.domId??e.id),{cssStyles:i}=e,s=Math.max(28,e.width??0),o=[{x:0,y:s/2},{x:s/2,y:0},{x:0,y:-s/2},{x:-s/2,y:0}],a=mt.svg(n),c=gt(e,{});e.look!=="handDrawn"&&(c.roughness=0,c.fillStyle="solid");const h=Wt(o),u=a.path(h,c),d=n.insert(()=>u,":first-child");return i&&e.look!=="handDrawn"&&d.selectAll("path").attr("style",i),r&&e.look!=="handDrawn"&&d.selectAll("path").attr("style",r),e.width=28,e.height=28,e.intersect=function(f){return dt.polygon(e,o,f)},n}v(tw,"choice");async function kf(t,e,r){const{labelStyles:n,nodeStyles:i}=xt(e);e.labelStyle=n;const{shapeSvg:s,bbox:o,halfPadding:a}=await Et(t,e,Nt(e)),c=16,h=(r==null?void 0:r.padding)??a,u=e.look==="neo"?o.width/2+c*2:o.width/2+h;let d;const{cssStyles:f}=e;if(e.look==="handDrawn"){const p=mt.svg(s),m=gt(e,{}),x=p.circle(0,0,u*2,m);d=s.insert(()=>x,":first-child"),d.attr("class","basic label-container").attr("style",Be(f))}else d=s.insert("circle",":first-child").attr("class","basic label-container").attr("style",i).attr("r",u).attr("cx",0).attr("cy",0);return yt(e,d),e.calcIntersect=function(p,m){const x=p.width/2;return dt.circle(p,x,m)},e.intersect=function(p){return rt.info("Circle intersect",e,u,p),dt.circle(e,u,p)},s}v(kf,"circle");function ew(t){const e=Math.cos(Math.PI/4),r=Math.sin(Math.PI/4),n=t*2,i={x:n/2*e,y:n/2*r},s={x:-(n/2)*e,y:n/2*r},o={x:-(n/2)*e,y:-(n/2)*r},a={x:n/2*e,y:-(n/2)*r};return`M ${s.x},${s.y} L ${a.x},${a.y}
568
- M ${i.x},${i.y} L ${o.x},${o.y}`}v(ew,"createLine");function rw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r,e.label="";const i=t.insert("g").attr("class",Nt(e)).attr("id",e.domId??e.id),s=Math.max(30,(e==null?void 0:e.width)??0),{cssStyles:o}=e,a=mt.svg(i),c=gt(e,{});e.look!=="handDrawn"&&(c.roughness=0,c.fillStyle="solid");const h=a.circle(0,0,s*2,c),u=ew(s),d=a.path(u,c),f=i.insert(()=>h,":first-child");return f.insert(()=>d),f.attr("class","outer-path"),o&&e.look!=="handDrawn"&&f.selectAll("path").attr("style",o),n&&e.look!=="handDrawn"&&f.selectAll("path").attr("style",n),yt(e,f),e.intersect=function(p){return rt.info("crossedCircle intersect",e,{radius:s,point:p}),dt.circle(e,s,p)},i}v(rw,"crossedCircle");function on(t,e,r,n=100,i=0,s=180){const o=[],a=i*Math.PI/180,u=(s*Math.PI/180-a)/(n-1);for(let d=0;d<n;d++){const f=a+d*u,p=t+r*Math.cos(f),m=e+r*Math.sin(f);o.push({x:-p,y:-m})}return o}v(on,"generateCirclePoints");async function nw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Et(t,e,Nt(e)),a=e.look==="neo"?18:e.padding??0,c=e.look==="neo"?12:e.padding??0,h=s.width+a,u=s.height+c,d=Math.max(5,u*.1),{cssStyles:f}=e,p=[...on(h/2,-u/2,d,30,-90,0),{x:-h/2-d,y:d},...on(h/2+d*2,-d,d,20,-180,-270),...on(h/2+d*2,d,d,20,-90,-180),{x:-h/2-d,y:-u/2},...on(h/2,u/2,d,20,0,90)],m=[{x:h/2,y:-u/2-d},{x:-h/2,y:-u/2-d},...on(h/2,-u/2,d,20,-90,0),{x:-h/2-d,y:-d},...on(h/2+h*.1,-d,d,20,-180,-270),...on(h/2+h*.1,d,d,20,-90,-180),{x:-h/2-d,y:u/2},...on(h/2,u/2,d,20,0,90),{x:-h/2,y:u/2+d},{x:h/2,y:u/2+d}],x=mt.svg(i),g=gt(e,{fill:"none"});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const k=Wt(p).replace("Z",""),b=x.path(k,g),w=Wt(m),_=x.path(w,{...g}),T=i.insert("g",":first-child");return T.insert(()=>_,":first-child").attr("stroke-opacity",0),T.insert(()=>b,":first-child"),T.attr("class","text"),f&&e.look!=="handDrawn"&&T.selectAll("path").attr("style",f),n&&e.look!=="handDrawn"&&T.selectAll("path").attr("style",n),T.attr("transform",`translate(${d}, 0)`),o.attr("transform",`translate(${-h/2+d-(s.x-(s.left??0))},${-u/2+(e.padding??0)/2-(s.y-(s.top??0))})`),yt(e,T),e.intersect=function(S){return dt.polygon(e,m,S)},i}v(nw,"curlyBraceLeft");function an(t,e,r,n=100,i=0,s=180){const o=[],a=i*Math.PI/180,u=(s*Math.PI/180-a)/(n-1);for(let d=0;d<n;d++){const f=a+d*u,p=t+r*Math.cos(f),m=e+r*Math.sin(f);o.push({x:p,y:m})}return o}v(an,"generateCirclePoints");async function iw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Et(t,e,Nt(e)),a=e.look==="neo"?18:e.padding??0,c=e.look==="neo"?12:e.padding??0,h=s.width+(e.look==="neo"?a*2:a),u=s.height+(e.look==="neo"?c*2:c),d=Math.max(5,u*.1),{cssStyles:f}=e,p=[...an(h/2,-u/2,d,20,-90,0),{x:h/2+d,y:-d},...an(h/2+d*2,-d,d,20,-180,-270),...an(h/2+d*2,d,d,20,-90,-180),{x:h/2+d,y:u/2},...an(h/2,u/2,d,20,0,90)],m=[{x:-h/2,y:-u/2-d},{x:h/2,y:-u/2-d},...an(h/2,-u/2,d,20,-90,0),{x:h/2+d,y:-d},...an(h/2+d*2,-d,d,20,-180,-270),...an(h/2+d*2,d,d,20,-90,-180),{x:h/2+d,y:u/2},...an(h/2,u/2,d,20,0,90),{x:h/2,y:u/2+d},{x:-h/2,y:u/2+d}],x=mt.svg(i),g=gt(e,{fill:"none"});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const k=Wt(p).replace("Z",""),b=x.path(k,g),w=Wt(m),_=x.path(w,{...g}),T=i.insert("g",":first-child");return T.insert(()=>_,":first-child").attr("stroke-opacity",0),T.insert(()=>b,":first-child"),T.attr("class","text"),f&&e.look!=="handDrawn"&&T.selectAll("path").attr("style",f),n&&e.look!=="handDrawn"&&T.selectAll("path").attr("style",n),T.attr("transform",`translate(${-d}, 0)`),o.attr("transform",`translate(${-h/2+(e.padding??0)/2-(s.x-(s.left??0))},${-u/2+(e.padding??0)/2-(s.y-(s.top??0))})`),yt(e,T),e.intersect=function(S){return dt.polygon(e,m,S)},i}v(iw,"curlyBraceRight");function Pe(t,e,r,n=100,i=0,s=180){const o=[],a=i*Math.PI/180,u=(s*Math.PI/180-a)/(n-1);for(let d=0;d<n;d++){const f=a+d*u,p=t+r*Math.cos(f),m=e+r*Math.sin(f);o.push({x:-p,y:-m})}return o}v(Pe,"generateCirclePoints");async function sw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Et(t,e,Nt(e)),a=e.look==="neo"?18:e.padding??0,c=e.look==="neo"?12:e.padding??0,h=s.width+(e.look==="neo"?a*2:a),u=s.height+(e.look==="neo"?c*2:c),d=Math.max(5,u*.1),{cssStyles:f}=e,p=[...Pe(h/2,-u/2,d,30,-90,0),{x:-h/2-d,y:d},...Pe(h/2+d*2,-d,d,20,-180,-270),...Pe(h/2+d*2,d,d,20,-90,-180),{x:-h/2-d,y:-u/2},...Pe(h/2,u/2,d,20,0,90)],m=[...Pe(-h/2+d+d/2,-u/2,d,20,-90,-180),{x:h/2-d/2,y:d},...Pe(-h/2-d/2,-d,d,20,0,90),...Pe(-h/2-d/2,d,d,20,-90,0),{x:h/2-d/2,y:-d},...Pe(-h/2+d+d/2,u/2,d,30,-180,-270)],x=[{x:h/2,y:-u/2-d},{x:-h/2,y:-u/2-d},...Pe(h/2,-u/2,d,20,-90,0),{x:-h/2-d,y:-d},...Pe(h/2+d*2,-d,d,20,-180,-270),...Pe(h/2+d*2,d,d,20,-90,-180),{x:-h/2-d,y:u/2},...Pe(h/2,u/2,d,20,0,90),{x:-h/2,y:u/2+d},{x:h/2-d-d/2,y:u/2+d},...Pe(-h/2+d+d/2,-u/2,d,20,-90,-180),{x:h/2-d/2,y:d},...Pe(-h/2-d/2,-d,d,20,0,90),...Pe(-h/2-d/2,d,d,20,-90,0),{x:h/2-d/2,y:-d},...Pe(-h/2+d+d/2,u/2,d,30,-180,-270)],g=mt.svg(i),y=gt(e,{fill:"none"});e.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const b=Wt(p).replace("Z",""),w=g.path(b,y),T=Wt(m).replace("Z",""),S=g.path(T,y),L=Wt(x),B=g.path(L,{...y}),N=i.insert("g",":first-child");return N.insert(()=>B,":first-child").attr("stroke-opacity",0),N.insert(()=>w,":first-child"),N.insert(()=>S,":first-child"),N.attr("class","text"),f&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",f),n&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",n),N.attr("transform",`translate(${d-d/4}, 0)`),o.attr("transform",`translate(${-h/2+(e.padding??0)/2-(s.x-(s.left??0))},${-u/2+(e.padding??0)/2-(s.y-(s.top??0))})`),yt(e,N),e.intersect=function(A){return dt.polygon(e,x,A)},i}v(sw,"curlyBraces");async function ow(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i,a=20,c=5,{shapeSvg:h,bbox:u}=await Et(t,e,Nt(e)),d=Math.max(a,(u.width+s*2)*1.25,(e==null?void 0:e.width)??0),f=Math.max(c,u.height+o*2,(e==null?void 0:e.height)??0),p=f/2,{cssStyles:m}=e,x=mt.svg(h),g=gt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=d,k=f,b=y-p,w=k/4,_=[{x:b,y:0},{x:w,y:0},{x:0,y:k/2},{x:w,y:k},{x:b,y:k},...Qo(-b,-k/2,p,50,270,90)],T=Wt(_),S=x.path(T,g),L=h.insert(()=>S,":first-child");return L.attr("class","basic label-container outer-path"),m&&e.look!=="handDrawn"&&L.selectChildren("path").attr("style",m),n&&e.look!=="handDrawn"&&L.selectChildren("path").attr("style",n),L.attr("transform",`translate(${-d/2}, ${-f/2})`),yt(e,L),e.intersect=function(B){return dt.polygon(e,_,B)},h}v(ow,"curvedTrapezoid");var Lz=v((t,e,r,n,i,s)=>[`M${t},${e+s}`,`a${i},${s} 0,0,0 ${r},0`,`a${i},${s} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${s} 0,0,0 ${r},0`,`l0,${-n}`].join(" "),"createCylinderPathD"),Bz=v((t,e,r,n,i,s)=>[`M${t},${e+s}`,`M${t+r},${e+s}`,`a${i},${s} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${s} 0,0,0 ${r},0`,`l0,${-n}`].join(" "),"createOuterCylinderPathD"),Az=v((t,e,r,n,i,s)=>[`M${t-r/2},${-n/2}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),gx=8,xx=8;async function aw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?24:i,o=e.look==="neo"?24:i;if(e.width||e.height){const g=e.width??0;e.width=(e.width??0)-o,e.width<xx&&(e.width=xx);const k=g/2/(2.5+g/50);e.height=(e.height??0)-s-k*3,e.height<gx&&(e.height=gx)}const{shapeSvg:a,bbox:c,label:h}=await Et(t,e,Nt(e)),u=(e.width?e.width:c.width)+o,d=u/2,f=d/(2.5+u/50),p=(e.height?e.height:c.height)+s+f;let m;const{cssStyles:x}=e;if(e.look==="handDrawn"){const g=mt.svg(a),y=Bz(0,0,u,p,d,f),k=Az(0,f,u,p,d,f),b=gt(e,{}),w=g.path(y,b),_=g.path(k,gt(e,{fill:"none"}));m=a.insert(()=>_,":first-child"),m=a.insert(()=>w,":first-child"),m.attr("class","basic label-container"),x&&m.attr("style",x)}else{const g=Lz(0,0,u,p,d,f);m=a.insert("path",":first-child").attr("d",g).attr("class","basic label-container outer-path").attr("style",Be(x)).attr("style",n)}return m.attr("label-offset-y",f),m.attr("transform",`translate(${-u/2}, ${-(p/2+f)})`),yt(e,m),h.attr("transform",`translate(${-(c.width/2)-(c.x-(c.left??0))}, ${-(c.height/2)+(e.padding??0)/1.5-(c.y-(c.top??0))})`),e.intersect=function(g){const y=dt.rect(e,g),k=y.x-(e.x??0);if(d!=0&&(Math.abs(k)<(e.width??0)/2||Math.abs(k)==(e.width??0)/2&&Math.abs(y.y-(e.y??0))>(e.height??0)/2-f)){let b=f*f*(1-k*k/(d*d));b>0&&(b=Math.sqrt(b)),b=f-b,g.y-(e.y??0)>0&&(b=-b),y.y+=b}return y},a}v(aw,"cylinder");async function lw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.look==="neo"?16:e.padding??0,s=e.look==="neo"?16:e.padding??0,{shapeSvg:o,bbox:a,label:c}=await Et(t,e,Nt(e)),h=a.width+i,u=a.height+s,d=u*.2,f=-h/2,p=-u/2-d/2,{cssStyles:m}=e,x=mt.svg(o),g=gt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=[{x:f,y:p+d},{x:-f,y:p+d},{x:-f,y:-p},{x:f,y:-p},{x:f,y:p},{x:-f,y:p},{x:-f,y:p+d}],k=x.polygon(y.map(w=>[w.x,w.y]),g),b=o.insert(()=>k,":first-child");return b.attr("class","basic label-container outer-path"),m&&e.look!=="handDrawn"&&b.selectAll("path").attr("style",m),n&&e.look!=="handDrawn"&&b.selectAll("path").attr("style",n),c.attr("transform",`translate(${f+(e.padding??0)/2-(a.x-(a.left??0))}, ${p+d+(e.padding??0)/2-(a.y-(a.top??0))})`),yt(e,b),e.intersect=function(w){return dt.rect(e,w)},o}v(lw,"dividedRectangle");async function cw(t,e){var p,m;const{labelStyles:r,nodeStyles:n}=xt(e),i=e.look==="neo"?12:5;e.labelStyle=r;const s=e.padding??0,o=e.look==="neo"?16:s,{shapeSvg:a,bbox:c}=await Et(t,e,Nt(e)),h=(e!=null&&e.width?(e==null?void 0:e.width)/2:c.width/2)+(o??0),u=h-i;let d;const{cssStyles:f}=e;if(e.look==="handDrawn"){const x=mt.svg(a),g=gt(e,{roughness:.2,strokeWidth:2.5}),y=gt(e,{roughness:.2,strokeWidth:1.5}),k=x.circle(0,0,h*2,g),b=x.circle(0,0,u*2,y);d=a.insert("g",":first-child"),d.attr("class",Be(e.cssClasses)).attr("style",Be(f)),(p=d.node())==null||p.appendChild(k),(m=d.node())==null||m.appendChild(b)}else{d=a.insert("g",":first-child");const x=d.insert("circle",":first-child"),g=d.insert("circle");d.attr("class","basic label-container").attr("style",n),x.attr("class","outer-circle").attr("style",n).attr("r",h).attr("cx",0).attr("cy",0),g.attr("class","inner-circle").attr("style",n).attr("r",u).attr("cx",0).attr("cy",0)}return yt(e,d),e.intersect=function(x){return rt.info("DoubleCircle intersect",e,h,x),dt.circle(e,h,x)},a}v(cw,"doublecircle");function hw(t,e,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:i}=xt(e);e.label="",e.labelStyle=n;const s=t.insert("g").attr("class",Nt(e)).attr("id",e.domId??e.id),o=7,{cssStyles:a}=e,c=mt.svg(s),{nodeBorder:h}=r,u=gt(e,{fillStyle:"solid"});e.look!=="handDrawn"&&(u.roughness=0);const d=c.circle(0,0,o*2,u),f=s.insert(()=>d,":first-child");return f.selectAll("path").attr("style",`fill: ${h} !important;`),a&&a.length>0&&e.look!=="handDrawn"&&f.selectAll("path").attr("style",a),i&&e.look!=="handDrawn"&&f.selectAll("path").attr("style",i),yt(e,f),e.intersect=function(p){return rt.info("filledCircle intersect",e,{radius:o,point:p}),dt.circle(e,o,p)},s}v(hw,"filledCircle");var yx=10,bx=10;async function uw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?i*2:i;(e.width||e.height)&&(e.height=(e==null?void 0:e.height)??0,e.height<yx&&(e.height=yx),e.width=((e==null?void 0:e.width)??0)-s-s/2,e.width<bx&&(e.width=bx));const{shapeSvg:o,bbox:a,label:c}=await Et(t,e,Nt(e)),h=(e!=null&&e.width?e==null?void 0:e.width:a.width)+(s??0),u=e!=null&&e.height?e==null?void 0:e.height:h+a.height,d=u,f=[{x:0,y:-u},{x:d,y:-u},{x:d/2,y:0}],{cssStyles:p}=e,m=mt.svg(o),x=gt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=Wt(f),y=m.path(g,x),k=o.insert(()=>y,":first-child").attr("transform",`translate(${-u/2}, ${u/2})`).attr("class","outer-path");return p&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",p),n&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",n),e.width=h,e.height=u,yt(e,k),c.attr("transform",`translate(${-a.width/2-(a.x-(a.left??0))}, ${-u/2+(e.padding??0)/2+(a.y-(a.top??0))})`),e.intersect=function(b){return rt.info("Triangle intersect",e,f,b),dt.polygon(e,f,b)},o}v(uw,"flippedTriangle");function dw(t,e,{dir:r,config:{state:n,themeVariables:i}}){const{nodeStyles:s}=xt(e);e.label="";const o=t.insert("g").attr("class",Nt(e)).attr("id",e.domId??e.id),{cssStyles:a}=e;let c=Math.max(70,(e==null?void 0:e.width)??0),h=Math.max(10,(e==null?void 0:e.height)??0);r==="LR"&&(c=Math.max(10,(e==null?void 0:e.width)??0),h=Math.max(70,(e==null?void 0:e.height)??0));const u=-1*c/2,d=-1*h/2,f=mt.svg(o),p=gt(e,{stroke:i.lineColor,fill:i.lineColor});e.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const m=f.rectangle(u,d,c,h,p),x=o.insert(()=>m,":first-child");a&&e.look!=="handDrawn"&&x.selectAll("path").attr("style",a),s&&e.look!=="handDrawn"&&x.selectAll("path").attr("style",s),yt(e,x);const g=(n==null?void 0:n.padding)??0;return e.width&&e.height&&(e.width+=g/2||0,e.height+=g/2||0),e.intersect=function(y){return dt.rect(e,y)},o}v(dw,"forkJoin");async function pw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=15,s=10,o=e.look==="neo"?16:e.padding??0,a=e.look==="neo"?12:e.padding??0;(e.width||e.height)&&(e.height=((e==null?void 0:e.height)??0)-a*2,e.height<s&&(e.height=s),e.width=((e==null?void 0:e.width)??0)-o*2,e.width<i&&(e.width=i));const{shapeSvg:c,bbox:h}=await Et(t,e,Nt(e)),u=(e!=null&&e.width?e==null?void 0:e.width:Math.max(i,h.width))+o*2,d=(e!=null&&e.height?e==null?void 0:e.height:Math.max(s,h.height))+a*2,f=d/2,{cssStyles:p}=e,m=mt.svg(c),x=gt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-u/2,y:-d/2},{x:u/2-f,y:-d/2},...Qo(-u/2+f,0,f,50,90,270),{x:u/2-f,y:d/2},{x:-u/2,y:d/2}],y=Wt(g),k=m.path(y,x),b=c.insert(()=>k,":first-child");return b.attr("class","basic label-container outer-path"),p&&e.look!=="handDrawn"&&b.selectChildren("path").attr("style",p),n&&e.look!=="handDrawn"&&b.selectChildren("path").attr("style",n),yt(e,b),e.intersect=function(w){return rt.info("Pill intersect",e,{radius:f,point:w}),dt.polygon(e,g,w)},c}v(pw,"halfRoundedRectangle");var Mz=v((t,e,r,n,i)=>[`M${t+i},${e}`,`L${t+r-i},${e}`,`L${t+r},${e-n/2}`,`L${t+r-i},${e-n}`,`L${t+i},${e-n}`,`L${t},${e-n/2}`,"Z"].join(" "),"createHexagonPathD");async function fw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e),i=e.look==="neo"?3.5:4;e.labelStyle=r;const s=e.padding??0,o=70,a=32,c=e.look==="neo"?o:s,h=e.look==="neo"?a:s;if(e.width||e.height){const b=(e.height??0)/i;e.width=((e==null?void 0:e.width)??0)-2*b-h,e.height=(e.height??0)-c}const{shapeSvg:u,bbox:d}=await Et(t,e,Nt(e)),f=(e!=null&&e.height?e==null?void 0:e.height:d.height)+c,p=f/i,m=(e!=null&&e.width?e==null?void 0:e.width:d.width)+2*p+h,x=[{x:p,y:0},{x:m-p,y:0},{x:m,y:-f/2},{x:m-p,y:-f},{x:p,y:-f},{x:0,y:-f/2}];let g;const{cssStyles:y}=e;if(e.look==="handDrawn"){const k=mt.svg(u),b=gt(e,{}),w=Mz(0,0,m,f,p),_=k.path(w,b);g=u.insert(()=>_,":first-child").attr("transform",`translate(${-m/2}, ${f/2})`),y&&g.attr("style",y)}else g=bn(u,m,f,x);return n&&g.attr("style",n),e.width=m,e.height=f,yt(e,g),e.intersect=function(k){return dt.polygon(e,x,k)},u}v(fw,"hexagon");async function mw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.label="",e.labelStyle=r;const{shapeSvg:i}=await Et(t,e,Nt(e)),s=Math.max(30,(e==null?void 0:e.width)??0),o=Math.max(30,(e==null?void 0:e.height)??0),{cssStyles:a}=e,c=mt.svg(i),h=gt(e,{});e.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");const u=[{x:0,y:0},{x:s,y:0},{x:0,y:o},{x:s,y:o}],d=Wt(u),f=c.path(d,h),p=i.insert(()=>f,":first-child");return p.attr("class","basic label-container outer-path"),a&&e.look!=="handDrawn"&&p.selectChildren("path").attr("style",a),n&&e.look!=="handDrawn"&&p.selectChildren("path").attr("style",n),p.attr("transform",`translate(${-s/2}, ${-o/2})`),yt(e,p),e.intersect=function(m){return rt.info("Pill intersect",e,{points:u}),dt.polygon(e,u,m)},i}v(mw,"hourglass");async function gw(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=xt(e);e.labelStyle=i;const s=e.assetHeight??48,o=e.assetWidth??48,a=Math.max(s,o),c=n==null?void 0:n.wrappingWidth;e.width=Math.max(a,c??0);const{shapeSvg:h,bbox:u,label:d}=await Et(t,e,"icon-shape default"),f=e.pos==="t",p=a,m=a,{nodeBorder:x}=r,{stylesMap:g}=_s(e),y=-m/2,k=-p/2,b=e.label?8:0,w=mt.svg(h),_=gt(e,{stroke:"none",fill:"none"});e.look!=="handDrawn"&&(_.roughness=0,_.fillStyle="solid");const T=w.rectangle(y,k,m,p,_),S=Math.max(m,u.width),L=p+u.height+b,B=w.rectangle(-S/2,-L/2,S,L,{..._,fill:"transparent",stroke:"none"}),N=h.insert(()=>T,":first-child"),A=h.insert(()=>B);if(e.icon){const R=h.append("g");R.html(`<g>${await ga(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const z=R.node().getBBox(),P=z.width,I=z.height,F=z.x,$=z.y;R.attr("transform",`translate(${-P/2-F},${f?u.height/2+b/2-I/2-$:-u.height/2-b/2-I/2-$})`),R.attr("style",`color: ${g.get("stroke")??x};`)}return d.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${f?-L/2:L/2-u.height})`),N.attr("transform",`translate(0,${f?u.height/2+b/2:-u.height/2-b/2})`),yt(e,A),e.intersect=function(R){if(rt.info("iconSquare intersect",e,R),!e.label)return dt.rect(e,R);const z=e.x??0,P=e.y??0,I=e.height??0;let F=[];return f?F=[{x:z-u.width/2,y:P-I/2},{x:z+u.width/2,y:P-I/2},{x:z+u.width/2,y:P-I/2+u.height+b},{x:z+m/2,y:P-I/2+u.height+b},{x:z+m/2,y:P+I/2},{x:z-m/2,y:P+I/2},{x:z-m/2,y:P-I/2+u.height+b},{x:z-u.width/2,y:P-I/2+u.height+b}]:F=[{x:z-m/2,y:P-I/2},{x:z+m/2,y:P-I/2},{x:z+m/2,y:P-I/2+p},{x:z+u.width/2,y:P-I/2+p},{x:z+u.width/2/2,y:P+I/2},{x:z-u.width/2,y:P+I/2},{x:z-u.width/2,y:P-I/2+p},{x:z-m/2,y:P-I/2+p}],dt.polygon(e,F,R)},h}v(gw,"icon");async function xw(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=xt(e);e.labelStyle=i;const s=e.assetHeight??48,o=e.assetWidth??48,a=Math.max(s,o),c=n==null?void 0:n.wrappingWidth;e.width=Math.max(a,c??0);const{shapeSvg:h,bbox:u,label:d}=await Et(t,e,"icon-shape default"),f=20,p=e.label?8:0,m=e.pos==="t",{nodeBorder:x,mainBkg:g}=r,{stylesMap:y}=_s(e),k=mt.svg(h),b=gt(e,{});e.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");const w=y.get("fill");b.stroke=w??g;const _=h.append("g");e.icon&&_.html(`<g>${await ga(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const T=_.node().getBBox(),S=T.width,L=T.height,B=T.x,N=T.y,A=Math.max(S,L)*Math.SQRT2+f*2,R=k.circle(0,0,A,b),z=Math.max(A,u.width),P=A+u.height+p,I=k.rectangle(-z/2,-P/2,z,P,{...b,fill:"transparent",stroke:"none"}),F=h.insert(()=>R,":first-child"),$=h.insert(()=>I);return _.attr("transform",`translate(${-S/2-B},${m?u.height/2+p/2-L/2-N:-u.height/2-p/2-L/2-N})`),_.attr("style",`color: ${y.get("stroke")??x};`),d.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${m?-P/2:P/2-u.height})`),F.attr("transform",`translate(0,${m?u.height/2+p/2:-u.height/2-p/2})`),yt(e,$),e.intersect=function(O){return rt.info("iconSquare intersect",e,O),dt.rect(e,O)},h}v(xw,"iconCircle");async function yw(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=xt(e);e.labelStyle=i;const s=e.assetHeight??48,o=e.assetWidth??48,a=Math.max(s,o),c=n==null?void 0:n.wrappingWidth;e.width=Math.max(a,c??0);const{shapeSvg:h,bbox:u,halfPadding:d,label:f}=await Et(t,e,"icon-shape default"),p=e.pos==="t",m=a+d*2,x=a+d*2,{nodeBorder:g,mainBkg:y}=r,{stylesMap:k}=_s(e),b=-x/2,w=-m/2,_=e.label?8:0,T=mt.svg(h),S=gt(e,{});e.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");const L=k.get("fill");S.stroke=L??y;const B=T.path(Rn(b,w,x,m,5),S),N=Math.max(x,u.width),A=m+u.height+_,R=T.rectangle(-N/2,-A/2,N,A,{...S,fill:"transparent",stroke:"none"}),z=h.insert(()=>B,":first-child").attr("class","icon-shape2"),P=h.insert(()=>R);if(e.icon){const I=h.append("g");I.html(`<g>${await ga(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const F=I.node().getBBox(),$=F.width,O=F.height,D=F.x,j=F.y;I.attr("transform",`translate(${-$/2-D},${p?u.height/2+_/2-O/2-j:-u.height/2-_/2-O/2-j})`),I.attr("style",`color: ${k.get("stroke")??g};`)}return f.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${p?-A/2:A/2-u.height})`),z.attr("transform",`translate(0,${p?u.height/2+_/2:-u.height/2-_/2})`),yt(e,P),e.intersect=function(I){if(rt.info("iconSquare intersect",e,I),!e.label)return dt.rect(e,I);const F=e.x??0,$=e.y??0,O=e.height??0;let D=[];return p?D=[{x:F-u.width/2,y:$-O/2},{x:F+u.width/2,y:$-O/2},{x:F+u.width/2,y:$-O/2+u.height+_},{x:F+x/2,y:$-O/2+u.height+_},{x:F+x/2,y:$+O/2},{x:F-x/2,y:$+O/2},{x:F-x/2,y:$-O/2+u.height+_},{x:F-u.width/2,y:$-O/2+u.height+_}]:D=[{x:F-x/2,y:$-O/2},{x:F+x/2,y:$-O/2},{x:F+x/2,y:$-O/2+m},{x:F+u.width/2,y:$-O/2+m},{x:F+u.width/2/2,y:$+O/2},{x:F-u.width/2,y:$+O/2},{x:F-u.width/2,y:$-O/2+m},{x:F-x/2,y:$-O/2+m}],dt.polygon(e,D,I)},h}v(yw,"iconRounded");async function bw(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=xt(e);e.labelStyle=i;const s=e.assetHeight??48,o=e.assetWidth??48,a=Math.max(s,o),c=n==null?void 0:n.wrappingWidth;e.width=Math.max(a,c??0);const{shapeSvg:h,bbox:u,halfPadding:d,label:f}=await Et(t,e,"icon-shape default"),p=e.pos==="t",m=a+d*2,x=a+d*2,{nodeBorder:g,mainBkg:y}=r,{stylesMap:k}=_s(e),b=-x/2,w=-m/2,_=e.label?8:0,T=mt.svg(h),S=gt(e,{});e.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");const L=k.get("fill");S.stroke=L??y;const B=T.path(Rn(b,w,x,m,.1),S),N=Math.max(x,u.width),A=m+u.height+_,R=T.rectangle(-N/2,-A/2,N,A,{...S,fill:"transparent",stroke:"none"}),z=h.insert(()=>B,":first-child"),P=h.insert(()=>R);if(e.icon){const I=h.append("g");I.html(`<g>${await ga(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const F=I.node().getBBox(),$=F.width,O=F.height,D=F.x,j=F.y;I.attr("transform",`translate(${-$/2-D},${p?u.height/2+_/2-O/2-j:-u.height/2-_/2-O/2-j})`),I.attr("style",`color: ${k.get("stroke")??g};`)}return f.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${p?-A/2:A/2-u.height})`),z.attr("transform",`translate(0,${p?u.height/2+_/2:-u.height/2-_/2})`),yt(e,P),e.intersect=function(I){if(rt.info("iconSquare intersect",e,I),!e.label)return dt.rect(e,I);const F=e.x??0,$=e.y??0,O=e.height??0;let D=[];return p?D=[{x:F-u.width/2,y:$-O/2},{x:F+u.width/2,y:$-O/2},{x:F+u.width/2,y:$-O/2+u.height+_},{x:F+x/2,y:$-O/2+u.height+_},{x:F+x/2,y:$+O/2},{x:F-x/2,y:$+O/2},{x:F-x/2,y:$-O/2+u.height+_},{x:F-u.width/2,y:$-O/2+u.height+_}]:D=[{x:F-x/2,y:$-O/2},{x:F+x/2,y:$-O/2},{x:F+x/2,y:$-O/2+m},{x:F+u.width/2,y:$-O/2+m},{x:F+u.width/2/2,y:$+O/2},{x:F-u.width/2,y:$+O/2},{x:F-u.width/2,y:$-O/2+m},{x:F-x/2,y:$-O/2+m}],dt.polygon(e,D,I)},h}v(bw,"iconSquare");async function Cw(t,e,{config:{flowchart:r}}){const n=new Image;n.src=(e==null?void 0:e.img)??"",await n.decode();const i=Number(n.naturalWidth.toString().replace("px","")),s=Number(n.naturalHeight.toString().replace("px",""));e.imageAspectRatio=i/s;const{labelStyles:o}=xt(e);e.labelStyle=o;const a=r==null?void 0:r.wrappingWidth;e.defaultWidth=r==null?void 0:r.wrappingWidth;const c=Math.max(e.label?a??0:0,(e==null?void 0:e.assetWidth)??i),h=e.constraint==="on"&&e!=null&&e.assetHeight?e.assetHeight*e.imageAspectRatio:c,u=e.constraint==="on"?h/e.imageAspectRatio:(e==null?void 0:e.assetHeight)??s;e.width=Math.max(h,a??0);const{shapeSvg:d,bbox:f,label:p}=await Et(t,e,"image-shape default"),m=e.pos==="t",x=-h/2,g=-u/2,y=e.label?8:0,k=mt.svg(d),b=gt(e,{});e.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");const w=k.rectangle(x,g,h,u,b),_=Math.max(h,f.width),T=u+f.height+y,S=k.rectangle(-_/2,-T/2,_,T,{...b,fill:"none",stroke:"none"}),L=d.insert(()=>w,":first-child"),B=d.insert(()=>S);if(e.img){const N=d.append("image");N.attr("href",e.img),N.attr("width",h),N.attr("height",u),N.attr("preserveAspectRatio","none"),N.attr("transform",`translate(${-h/2},${m?T/2-u:-T/2})`)}return p.attr("transform",`translate(${-f.width/2-(f.x-(f.left??0))},${m?-u/2-f.height/2-y/2:u/2-f.height/2+y/2})`),L.attr("transform",`translate(0,${m?f.height/2+y/2:-f.height/2-y/2})`),yt(e,B),e.intersect=function(N){if(rt.info("iconSquare intersect",e,N),!e.label)return dt.rect(e,N);const A=e.x??0,R=e.y??0,z=e.height??0;let P=[];return m?P=[{x:A-f.width/2,y:R-z/2},{x:A+f.width/2,y:R-z/2},{x:A+f.width/2,y:R-z/2+f.height+y},{x:A+h/2,y:R-z/2+f.height+y},{x:A+h/2,y:R+z/2},{x:A-h/2,y:R+z/2},{x:A-h/2,y:R-z/2+f.height+y},{x:A-f.width/2,y:R-z/2+f.height+y}]:P=[{x:A-h/2,y:R-z/2},{x:A+h/2,y:R-z/2},{x:A+h/2,y:R-z/2+u},{x:A+f.width/2,y:R-z/2+u},{x:A+f.width/2/2,y:R+z/2},{x:A-f.width/2,y:R+z/2},{x:A-f.width/2,y:R-z/2+u},{x:A-h/2,y:R-z/2+u}],dt.polygon(e,P,N)},d}v(Cw,"imageSquare");async function kw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.padding??0,s=i,o=e.look==="neo"?i*2:i,{shapeSvg:a,bbox:c}=await Et(t,e,Nt(e)),h=Math.max(c.width+(o??0)*2,(e==null?void 0:e.width)??0),u=Math.max(c.height+(s??0)*2,(e==null?void 0:e.height)??0),d=[{x:0,y:0},{x:h,y:0},{x:h+3*u/6,y:-u},{x:-3*u/6,y:-u}];let f;const{cssStyles:p}=e;if(e.look==="handDrawn"){const m=mt.svg(a),x=gt(e,{}),g=Wt(d),y=m.path(g,x);f=a.insert(()=>y,":first-child").attr("transform",`translate(${-h/2}, ${u/2})`),p&&f.attr("style",p)}else f=bn(a,h,u,d);return n&&f.attr("style",n),e.width=h,e.height=u,yt(e,f),e.intersect=function(m){return dt.polygon(e,d,m)},a}v(kw,"inv_trapezoid");async function ya(t,e,r){const{labelStyles:n,nodeStyles:i}=xt(e);e.labelStyle=n;const{shapeSvg:s,bbox:o}=await Et(t,e,Nt(e)),a=Math.max(o.width+r.labelPaddingX*2,(e==null?void 0:e.width)||0),c=Math.max(o.height+r.labelPaddingY*2,(e==null?void 0:e.height)||0),h=-a/2,u=-c/2;let d,{rx:f,ry:p}=e;const{cssStyles:m}=e;if(r!=null&&r.rx&&r.ry&&(f=r.rx,p=r.ry),e.look==="handDrawn"){const x=mt.svg(s),g=gt(e,{}),y=f||p?x.path(Rn(h,u,a,c,f||0),g):x.rectangle(h,u,a,c,g);d=s.insert(()=>y,":first-child"),d.attr("class","basic label-container").attr("style",Be(m))}else d=s.insert("rect",":first-child"),d.attr("class","basic label-container").attr("style",i).attr("rx",Be(f)).attr("ry",Be(p)).attr("x",h).attr("y",u).attr("width",a).attr("height",c);return yt(e,d),e.calcIntersect=function(x,g){return dt.rect(x,g)},e.intersect=function(x){return dt.rect(e,x)},s}v(ya,"drawRect");async function vw(t,e){const{shapeSvg:r,bbox:n,label:i}=await Et(t,e,"label"),s=r.insert("rect",":first-child");return s.attr("width",.1).attr("height",.1),r.attr("class","label edgeLabel"),i.attr("transform",`translate(${-(n.width/2)-(n.x-(n.left??0))}, ${-(n.height/2)-(n.y-(n.top??0))})`),yt(e,s),e.intersect=function(c){return dt.rect(e,c)},r}v(vw,"labelRect");async function ww(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.padding??0,s=i,o=e.look==="neo"?i*2:i,{shapeSvg:a,bbox:c}=await Et(t,e,Nt(e)),h=((e==null?void 0:e.height)??c.height)+s,u=((e==null?void 0:e.width)??c.width)+o,d=[{x:0,y:0},{x:u+3*h/6,y:0},{x:u,y:-h},{x:-(3*h)/6,y:-h}];let f;const{cssStyles:p}=e;if(e.look==="handDrawn"){const m=mt.svg(a),x=gt(e,{}),g=Wt(d),y=m.path(g,x);f=a.insert(()=>y,":first-child").attr("transform",`translate(${-u/2}, ${h/2})`),p&&f.attr("style",p)}else f=bn(a,u,h,d);return n&&f.attr("style",n),e.width=u,e.height=h,yt(e,f),e.intersect=function(m){return dt.polygon(e,d,m)},a}v(ww,"lean_left");async function Sw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.padding??0,s=i,o=e.look==="neo"?i*2:i,{shapeSvg:a,bbox:c}=await Et(t,e,Nt(e)),h=((e==null?void 0:e.height)??c.height)+s,u=((e==null?void 0:e.width)??c.width)+o,d=[{x:-3*h/6,y:0},{x:u,y:0},{x:u+3*h/6,y:-h},{x:0,y:-h}];let f;const{cssStyles:p}=e;if(e.look==="handDrawn"){const m=mt.svg(a),x=gt(e,{}),g=Wt(d),y=m.path(g,x);f=a.insert(()=>y,":first-child").attr("transform",`translate(${-u/2}, ${h/2})`),p&&f.attr("style",p)}else f=bn(a,u,h,d);return n&&f.attr("style",n),e.width=u,e.height=h,yt(e,f),e.intersect=function(m){return dt.polygon(e,d,m)},a}v(Sw,"lean_right");function Tw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.label="",e.labelStyle=r;const i=t.insert("g").attr("class",Nt(e)).attr("id",e.domId??e.id),{cssStyles:s}=e,o=Math.max(35,(e==null?void 0:e.width)??0),a=Math.max(35,(e==null?void 0:e.height)??0),c=7,h=[{x:o,y:0},{x:0,y:a+c/2},{x:o-2*c,y:a+c/2},{x:0,y:2*a},{x:o,y:a-c/2},{x:2*c,y:a-c/2}],u=mt.svg(i),d=gt(e,{});e.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const f=Wt(h),p=u.path(f,d),m=i.insert(()=>p,":first-child");return m.attr("class","outer-path"),s&&e.look!=="handDrawn"&&m.selectAll("path").attr("style",s),n&&e.look!=="handDrawn"&&m.selectAll("path").attr("style",n),m.attr("transform",`translate(-${o/2},${-a})`),yt(e,m),e.intersect=function(x){return rt.info("lightningBolt intersect",e,x),dt.polygon(e,h,x)},i}v(Tw,"lightningBolt");var Iz=v((t,e,r,n,i,s,o)=>[`M${t},${e+s}`,`a${i},${s} 0,0,0 ${r},0`,`a${i},${s} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${s} 0,0,0 ${r},0`,`l0,${-n}`,`M${t},${e+s+o}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createCylinderPathD"),Fz=v((t,e,r,n,i,s,o)=>[`M${t},${e+s}`,`M${t+r},${e+s}`,`a${i},${s} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${s} 0,0,0 ${r},0`,`l0,${-n}`,`M${t},${e+s+o}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createOuterCylinderPathD"),Pz=v((t,e,r,n,i,s)=>[`M${t-r/2},${-n/2}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),Cx=10,kx=10;async function _w(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?24:i;if(e.width||e.height){const y=e.width??0;e.width=(e.width??0)-s,e.width<kx&&(e.width=kx);const b=y/2/(2.5+y/50);e.height=(e.height??0)-o-b*3,e.height<Cx&&(e.height=Cx)}const{shapeSvg:a,bbox:c,label:h}=await Et(t,e,Nt(e)),u=(e!=null&&e.width?e==null?void 0:e.width:c.width)+s*2,d=u/2,f=d/(2.5+u/50),p=(e!=null&&e.height?e==null?void 0:e.height:c.height)+f+o*2,m=p*.1;let x;const{cssStyles:g}=e;if(e.look==="handDrawn"){const y=mt.svg(a),k=Fz(0,0,u,p,d,f,m),b=Pz(0,f,u,p,d,f),w=gt(e,{}),_=y.path(k,w),T=y.path(b,w);a.insert(()=>T,":first-child").attr("class","line"),x=a.insert(()=>_,":first-child"),x.attr("class","basic label-container"),g&&x.attr("style",g)}else{const y=Iz(0,0,u,p,d,f,m);x=a.insert("path",":first-child").attr("d",y).attr("class","basic label-container outer-path").attr("style",Be(g)).attr("style",n)}return x.attr("label-offset-y",f),x.attr("transform",`translate(${-u/2}, ${-(p/2+f)})`),yt(e,x),h.attr("transform",`translate(${-(c.width/2)-(c.x-(c.left??0))}, ${-(c.height/2)+f-(c.y-(c.top??0))})`),e.intersect=function(y){const k=dt.rect(e,y),b=k.x-(e.x??0);if(d!=0&&(Math.abs(b)<(e.width??0)/2||Math.abs(b)==(e.width??0)/2&&Math.abs(k.y-(e.y??0))>(e.height??0)/2-f)){let w=f*f*(1-b*b/(d*d));w>0&&(w=Math.sqrt(w)),w=f-w,y.y-(e.y??0)>0&&(w=-w),k.y+=w}return k},a}v(_w,"linedCylinder");async function jw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i;if(e.width||e.height){const w=e.width;e.width=(w??0)*10/11-s*2,e.width<10&&(e.width=10),e.height=((e==null?void 0:e.height)??0)-o*2,e.height<10&&(e.height=10)}const{shapeSvg:a,bbox:c,label:h}=await Et(t,e,Nt(e)),u=(e!=null&&e.width?e==null?void 0:e.width:c.width)+(s??0)*2,d=(e!=null&&e.height?e==null?void 0:e.height:c.height)+(o??0)*2,f=e.look==="neo"?d/4:d/8,p=d+f,{cssStyles:m}=e,x=mt.svg(a),g=gt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=[{x:-u/2-u/2*.1,y:-p/2},{x:-u/2-u/2*.1,y:p/2},...Pn(-u/2-u/2*.1,p/2,u/2+u/2*.1,p/2,f,.8),{x:u/2+u/2*.1,y:-p/2},{x:-u/2-u/2*.1,y:-p/2},{x:-u/2,y:-p/2},{x:-u/2,y:p/2*1.1},{x:-u/2,y:-p/2}],k=x.polygon(y.map(w=>[w.x,w.y]),g),b=a.insert(()=>k,":first-child");return b.attr("class","basic label-container outer-path"),m&&e.look!=="handDrawn"&&b.selectAll("path").attr("style",m),n&&e.look!=="handDrawn"&&b.selectAll("path").attr("style",n),b.attr("transform",`translate(0,${-f/2})`),h.attr("transform",`translate(${-u/2+(e.padding??0)+u/2*.1/2-(c.x-(c.left??0))},${-d/2+(e.padding??0)-f/2-(c.y-(c.top??0))})`),yt(e,b),e.intersect=function(w){return dt.polygon(e,y,w)},a}v(jw,"linedWaveEdgedRect");async function Nw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i,a=e.look==="neo"?10:5;(e.width||e.height)&&(e.width=Math.max(((e==null?void 0:e.width)??0)-s*2-2*a,10),e.height=Math.max(((e==null?void 0:e.height)??0)-o*2-2*a,10));const{shapeSvg:c,bbox:h,label:u}=await Et(t,e,Nt(e)),d=(e!=null&&e.width?e==null?void 0:e.width:h.width)+s*2+2*a,f=(e!=null&&e.height?e==null?void 0:e.height:h.height)+o*2+2*a,p=d-2*a,m=f-2*a,x=-p/2,g=-m/2,{cssStyles:y}=e,k=mt.svg(c),b=gt(e,{}),w=[{x:x-a,y:g+a},{x:x-a,y:g+m+a},{x:x+p-a,y:g+m+a},{x:x+p-a,y:g+m},{x:x+p,y:g+m},{x:x+p,y:g+m-a},{x:x+p+a,y:g+m-a},{x:x+p+a,y:g-a},{x:x+a,y:g-a},{x:x+a,y:g},{x,y:g},{x,y:g+a}],_=[{x,y:g+a},{x:x+p-a,y:g+a},{x:x+p-a,y:g+m},{x:x+p,y:g+m},{x:x+p,y:g},{x,y:g}];e.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");const T=Wt(w);let S=k.path(T,b);const L=Wt(_);let B=k.path(L,b);e.look!=="handDrawn"&&(S=Cd(S),B=Cd(B));const N=c.insert("g",":first-child");return N.insert(()=>S),N.insert(()=>B),N.attr("class","basic label-container outer-path"),y&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",y),n&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",n),u.attr("transform",`translate(${-(h.width/2)-a-(h.x-(h.left??0))}, ${-(h.height/2)+a-(h.y-(h.top??0))})`),yt(e,N),e.intersect=function(A){return dt.polygon(e,w,A)},c}v(Nw,"multiRect");async function Ew(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Et(t,e,Nt(e)),a=e.padding??0,c=e.look==="neo"?16:a,h=e.look==="neo"?12:a;let u=!0;(e.width||e.height)&&(u=!1,e.width=((e==null?void 0:e.width)??0)-c*2,e.height=((e==null?void 0:e.height)??0)-h*3);const d=Math.max(s.width,(e==null?void 0:e.width)??0)+c*2,f=Math.max(s.height,(e==null?void 0:e.height)??0)+h*3,p=e.look==="neo"?f/4:f/8,m=f+(u?p/2:-p/2),x=-d/2,g=-m/2,y=10,{cssStyles:k}=e,b=Pn(x-y,g+m+y,x+d-y,g+m+y,p,.8),w=b==null?void 0:b[b.length-1],_=[{x:x-y,y:g+y},{x:x-y,y:g+m+y},...b,{x:x+d-y,y:w.y-y},{x:x+d,y:w.y-y},{x:x+d,y:w.y-2*y},{x:x+d+y,y:w.y-2*y},{x:x+d+y,y:g-y},{x:x+y,y:g-y},{x:x+y,y:g},{x,y:g},{x,y:g+y}],T=[{x,y:g+y},{x:x+d-y,y:g+y},{x:x+d-y,y:w.y-y},{x:x+d,y:w.y-y},{x:x+d,y:g},{x,y:g}],S=mt.svg(i),L=gt(e,{});e.look!=="handDrawn"&&(L.roughness=0,L.fillStyle="solid");const B=Wt(_),N=S.path(B,L),A=Wt(T),R=S.path(A,L),z=i.insert(()=>N,":first-child");return z.insert(()=>R),z.attr("class","basic label-container outer-path"),k&&e.look!=="handDrawn"&&z.selectAll("path").attr("style",k),n&&e.look!=="handDrawn"&&z.selectAll("path").attr("style",n),z.attr("transform",`translate(0,${-p/2})`),o.attr("transform",`translate(${-(s.width/2)-y-(s.x-(s.left??0))}, ${-(s.height/2)+y-p/2-(s.y-(s.top??0))})`),yt(e,z),e.intersect=function(P){return dt.polygon(e,_,P)},i}v(Ew,"multiWaveEdgedRectangle");async function Lw(t,e,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:i}=xt(e);e.labelStyle=n,e.useHtmlLabels||er(me())||(e.centerLabel=!0);const{shapeSvg:o,bbox:a,label:c}=await Et(t,e,Nt(e)),h=Math.max(a.width+(e.padding??0)*2,(e==null?void 0:e.width)??0),u=Math.max(a.height+(e.padding??0)*2,(e==null?void 0:e.height)??0),d=-h/2,f=-u/2,{cssStyles:p}=e,m=mt.svg(o),x=gt(e,{fill:r.noteBkgColor,stroke:r.noteBorderColor});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=m.rectangle(d,f,h,u,x),y=o.insert(()=>g,":first-child");return y.attr("class","basic label-container outer-path"),c.attr("class","label noteLabel"),p&&e.look!=="handDrawn"&&y.selectAll("path").attr("style",p),i&&e.look!=="handDrawn"&&y.selectAll("path").attr("style",i),c.attr("transform",`translate(${-a.width/2-(a.x-(a.left??0))}, ${-(a.height/2)-(a.y-(a.top??0))})`),yt(e,y),e.intersect=function(k){return dt.rect(e,k)},o}v(Lw,"note");var $z=v((t,e,r)=>[`M${t+r/2},${e}`,`L${t+r},${e-r/2}`,`L${t+r/2},${e-r}`,`L${t},${e-r/2}`,"Z"].join(" "),"createDecisionBoxPathD");async function Bw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s}=await Et(t,e,Nt(e)),o=s.width+(e.padding??0),a=s.height+(e.padding??0),c=o+a,h=.5,u=[{x:c/2,y:0},{x:c,y:-c/2},{x:c/2,y:-c},{x:0,y:-c/2}];let d;const{cssStyles:f}=e;if(e.look==="handDrawn"){const p=mt.svg(i),m=gt(e,{}),x=$z(0,0,c),g=p.path(x,m);d=i.insert(()=>g,":first-child").attr("transform",`translate(${-c/2+h}, ${c/2})`),f&&d.attr("style",f)}else d=bn(i,c,c,u),d.attr("transform",`translate(${-c/2+h}, ${c/2})`);return n&&d.attr("style",n),yt(e,d),e.calcIntersect=function(p,m){const x=p.width,g=[{x:x/2,y:0},{x,y:-x/2},{x:x/2,y:-x},{x:0,y:-x/2}],y=dt.polygon(p,g,m);return{x:y.x-.5,y:y.y-.5}},e.intersect=function(p){return this.calcIntersect(e,p)},i}v(Bw,"question");async function Aw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?21:i??0,o=e.look==="neo"?12:i??0,{shapeSvg:a,bbox:c,label:h}=await Et(t,e,Nt(e)),u=((e==null?void 0:e.width)??c.width)+(e.look==="neo"?s*2:s),d=((e==null?void 0:e.height)??c.height)+(e.look==="neo"?o*2:o),f=-u/2,p=-d/2,m=p/2,x=[{x:f+m,y:p},{x:f,y:0},{x:f+m,y:-p},{x:-f,y:-p},{x:-f,y:p}],{cssStyles:g}=e,y=mt.svg(a),k=gt(e,{});e.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");const b=Wt(x),w=y.path(b,k),_=a.insert(()=>w,":first-child");return _.attr("class","basic label-container outer-path"),g&&e.look!=="handDrawn"&&_.selectAll("path").attr("style",g),n&&e.look!=="handDrawn"&&_.selectAll("path").attr("style",n),_.attr("transform",`translate(${-m/2},0)`),h.attr("transform",`translate(${-m/2-c.width/2-(c.x-(c.left??0))}, ${-(c.height/2)-(c.y-(c.top??0))})`),yt(e,_),e.intersect=function(T){return dt.polygon(e,x,T)},a}v(Aw,"rect_left_inv_arrow");async function Mw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;let i;e.cssClasses?i="node "+e.cssClasses:i="node default";const s=t.insert("g").attr("class",i).attr("id",e.domId||e.id),o=s.insert("g"),a=s.insert("g").attr("class","label").attr("style",n),c=e.description,h=e.label,u=await _n(a,h,e.labelStyle,!0,!0);let d={width:0,height:0};if(er(Vt())){const L=u.children[0],B=Ot(u);d=L.getBoundingClientRect(),B.attr("width",d.width),B.attr("height",d.height)}rt.info("Text 2",c);const f=c||[],p=u.getBBox(),m=await _n(a,Array.isArray(f)?f.join("<br/>"):f,e.labelStyle,!0,!0),x=m.children[0],g=Ot(m);d=x.getBoundingClientRect(),g.attr("width",d.width),g.attr("height",d.height);const y=(e.padding||0)/2;Ot(m).attr("transform","translate( "+(d.width>p.width?0:(p.width-d.width)/2)+", "+(p.height+y+5)+")"),Ot(u).attr("transform","translate( "+(d.width<p.width?0:-(p.width-d.width)/2)+", 0)"),d=a.node().getBBox(),a.attr("transform","translate("+-d.width/2+", "+(-d.height/2-y+3)+")");const k=d.width+(e.padding||0),b=d.height+(e.padding||0),w=-d.width/2-y,_=-d.height/2-y;let T,S;if(e.look==="handDrawn"){const L=mt.svg(s),B=gt(e,{}),N=L.path(Rn(w,_,k,b,e.rx||0),B),A=L.line(-d.width/2-y,-d.height/2-y+p.height+y,d.width/2+y,-d.height/2-y+p.height+y,B);S=s.insert(()=>(rt.debug("Rough node insert CXC",N),A),":first-child"),T=s.insert(()=>(rt.debug("Rough node insert CXC",N),N),":first-child")}else T=o.insert("rect",":first-child"),S=o.insert("line"),T.attr("class","outer title-state").attr("style",n).attr("x",-d.width/2-y).attr("y",-d.height/2-y).attr("width",d.width+(e.padding||0)).attr("height",d.height+(e.padding||0)),S.attr("class","divider").attr("x1",-d.width/2-y).attr("x2",d.width/2+y).attr("y1",-d.height/2-y+p.height+y).attr("y2",-d.height/2-y+p.height+y);return yt(e,T),e.intersect=function(L){return dt.rect(e,L)},s}v(Mw,"rectWithTitle");async function Iw(t,e,{config:{themeVariables:r}}){const n=(r==null?void 0:r.radius)??5,i={rx:n,ry:n,labelPaddingX:((e==null?void 0:e.padding)??0)*1,labelPaddingY:((e==null?void 0:e.padding)??0)*1};return ya(t,e,i)}v(Iw,"roundedRect");var Un=8;async function Fw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.look==="neo"?16:e.padding??0,s=e.look==="neo"?12:e.padding??0,{shapeSvg:o,bbox:a,label:c}=await Et(t,e,Nt(e)),h=((e==null?void 0:e.width)??a.width)+i*2+(e.look==="neo"?Un:Un*2),u=((e==null?void 0:e.height)??a.height)+s*2,d=h-Un,f=u,p=Un-h/2,m=-u/2,{cssStyles:x}=e,g=mt.svg(o),y=gt(e,{});e.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const k=[{x:p,y:m},{x:p+d,y:m},{x:p+d,y:m+f},{x:p-Un,y:m+f},{x:p-Un,y:m},{x:p,y:m},{x:p,y:m+f}],b=g.polygon(k.map(_=>[_.x,_.y]),y),w=o.insert(()=>b,":first-child");return w.attr("class","basic label-container outer-path").attr("style",Be(x)),n&&e.look!=="handDrawn"&&w.selectAll("path").attr("style",n),x&&e.look!=="handDrawn"&&w.selectAll("path").attr("style",n),c.attr("transform",`translate(${Un/2-a.width/2-(a.x-(a.left??0))}, ${-(a.height/2)-(a.y-(a.top??0))})`),yt(e,w),e.intersect=function(_){return dt.rect(e,_)},o}v(Fw,"shadedProcess");async function Pw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i;(e.width||e.height)&&(e.width=Math.max(((e==null?void 0:e.width)??0)-s*2,10),e.height=Math.max(((e==null?void 0:e.height)??0)/1.5-o*2,10));const{shapeSvg:a,bbox:c,label:h}=await Et(t,e,Nt(e)),u=(e!=null&&e.width?e==null?void 0:e.width:c.width)+s*2,d=((e!=null&&e.height?e==null?void 0:e.height:c.height)+o*2)*1.5,f=u,p=d/1.5,m=-f/2,x=-p/2,{cssStyles:g}=e,y=mt.svg(a),k=gt(e,{});e.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");const b=[{x:m,y:x},{x:m,y:x+p},{x:m+f,y:x+p},{x:m+f,y:x-p/2}],w=Wt(b),_=y.path(w,k),T=a.insert(()=>_,":first-child");return T.attr("class","basic label-container outer-path"),g&&e.look!=="handDrawn"&&T.selectChildren("path").attr("style",g),n&&e.look!=="handDrawn"&&T.selectChildren("path").attr("style",n),T.attr("transform",`translate(0, ${p/4})`),h.attr("transform",`translate(${-f/2+(e.padding??0)-(c.x-(c.left??0))}, ${-p/4+(e.padding??0)-(c.y-(c.top??0))})`),yt(e,T),e.intersect=function(S){return dt.polygon(e,b,S)},a}v(Pw,"slopedRect");async function $w(t,e){const r=e.padding??0,n=e.look==="neo"?16:r*2,i=e.look==="neo"?12:r,s={rx:0,ry:0,labelPaddingX:e.labelPaddingX??n,labelPaddingY:i};return ya(t,e,s)}v($w,"squareRect");async function Dw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?20:i,o=e.look==="neo"?12:i,{shapeSvg:a,bbox:c}=await Et(t,e,Nt(e)),h=c.height+(e.look==="neo"?o*2:o),u=c.width+h/4+(e.look==="neo"?s*2:s),d=h/2,{cssStyles:f}=e,p=mt.svg(a),m=gt(e,{});e.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const x=[{x:-u/2+d,y:-h/2},{x:u/2-d,y:-h/2},...Qo(-u/2+d,0,d,50,90,270),{x:u/2-d,y:h/2},...Qo(u/2-d,0,d,50,270,450)],g=Wt(x),y=p.path(g,m),k=a.insert(()=>y,":first-child");return k.attr("class","basic label-container outer-path"),f&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",f),n&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",n),yt(e,k),e.intersect=function(b){return dt.polygon(e,x,b)},a}v(Dw,"stadium");async function Ow(t,e){const r={rx:e.look==="neo"?3:5,ry:e.look==="neo"?3:5};return ya(t,e,r)}v(Ow,"state");function Rw(t,e,{config:{themeVariables:r}}){var k,b;const{labelStyles:n,nodeStyles:i}=xt(e);e.labelStyle=n;const{cssStyles:s}=e,{lineColor:o,stateBorder:a,nodeBorder:c,nodeShadow:h}=r;(e.width||e.height)&&((e.width??0)<14&&(e.width=14),(e.height??0)<14&&(e.height=14)),e.width||(e.width=14),e.height||(e.height=14);const u=t.insert("g").attr("class","node default").attr("id",e.domId??e.id),d=mt.svg(u),f=gt(e,{});e.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");const p=d.circle(0,0,e.width,{...f,stroke:o,strokeWidth:2}),m=a??c,x=(e.width??0)*5/14,g=d.circle(0,0,x,{...f,fill:m,stroke:m,strokeWidth:2,fillStyle:"solid"}),y=u.insert(()=>p,":first-child");if(y.insert(()=>g),e.look!=="handDrawn"&&y.attr("class","outer-path"),s&&y.selectAll("path").attr("style",s),i&&y.selectAll("path").attr("style",i),e.width<25&&h&&e.look!=="handDrawn"){const w=((b=(k=t.node())==null?void 0:k.ownerSVGElement)==null?void 0:b.id)??"",_=w?`${w}-drop-shadow-small`:"drop-shadow-small";y.attr("style",`filter:url(#${_})`)}return yt(e,y),e.intersect=function(w){return dt.circle(e,(e.width??0)/2,w)},u}v(Rw,"stateEnd");function zw(t,e,{config:{themeVariables:r}}){var a,c;const{lineColor:n,nodeShadow:i}=r;(e.width||e.height)&&((e.width??0)<14&&(e.width=14),(e.height??0)<14&&(e.height=14)),e.width||(e.width=14),e.height||(e.height=14);const s=t.insert("g").attr("class","node default").attr("id",e.domId||e.id);let o;if(e.look==="handDrawn"){const u=mt.svg(s).circle(0,0,e.width,V6(n));o=s.insert(()=>u),o.attr("class","state-start").attr("r",(e.width??7)/2).attr("width",e.width??14).attr("height",e.height??14)}else o=s.insert("circle",":first-child"),o.attr("class","state-start").attr("r",(e.width??7)/2).attr("width",e.width??14).attr("height",e.height??14);if(e.width<25&&i&&e.look!=="handDrawn"){const h=((c=(a=t.node())==null?void 0:a.ownerSVGElement)==null?void 0:c.id)??"",u=h?`${h}-drop-shadow-small`:"drop-shadow-small";o.attr("style",`filter:url(#${u})`)}return yt(e,o),e.intersect=function(h){return dt.circle(e,(e.width??7)/2,h)},s}v(zw,"stateStart");var Bi=8;async function qw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=(e==null?void 0:e.padding)??8,s=e.look==="neo"?28:i,o=e.look==="neo"?12:i,{shapeSvg:a,bbox:c}=await Et(t,e,Nt(e)),h=((e==null?void 0:e.width)??c.width)+2*Bi+s,u=((e==null?void 0:e.height)??c.height)+o,d=h-2*Bi,f=u,p=-h/2,m=-u/2,x=[{x:0,y:0},{x:d,y:0},{x:d,y:-f},{x:0,y:-f},{x:0,y:0},{x:-8,y:0},{x:d+8,y:0},{x:d+8,y:-f},{x:-8,y:-f},{x:-8,y:0}];if(e.look==="handDrawn"){const g=mt.svg(a),y=gt(e,{}),k=g.rectangle(p,m,d+16,f,y),b=g.line(p+Bi,m,p+Bi,m+f,y),w=g.line(p+Bi+d,m,p+Bi+d,m+f,y);a.insert(()=>b,":first-child"),a.insert(()=>w,":first-child");const _=a.insert(()=>k,":first-child"),{cssStyles:T}=e;_.attr("class","basic label-container").attr("style",Be(T)),yt(e,_)}else{const g=bn(a,d,f,x);n&&g.attr("style",n),yt(e,g)}return e.intersect=function(g){return dt.polygon(e,x,g)},a}v(qw,"subroutine");var eu=.2;async function Ww(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i;(e.width||e.height)&&(e.height=Math.max(((e==null?void 0:e.height)??0)-o*2,10),e.width=Math.max(((e==null?void 0:e.width)??0)-s*2-eu*(e.height+o*2),10));const{shapeSvg:a,bbox:c}=await Et(t,e,Nt(e)),h=(e!=null&&e.height?e==null?void 0:e.height:c.height)+o*2,u=eu*h,d=eu*h,p=(e!=null&&e.width?e==null?void 0:e.width:c.width)+s*2+u-u,m=h,x=-p/2,g=-m/2,{cssStyles:y}=e,k=mt.svg(a),b=gt(e,{}),w=[{x:x-u/2,y:g},{x:x+p+u/2,y:g},{x:x+p+u/2,y:g+m},{x:x-u/2,y:g+m}],_=[{x:x+p-u/2,y:g+m},{x:x+p+u/2,y:g+m},{x:x+p+u/2,y:g+m-d}];e.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");const T=Wt(w),S=k.path(T,b),L=Wt(_),B=k.path(L,{...b,fillStyle:"solid"}),N=a.insert(()=>B,":first-child");return N.insert(()=>S,":first-child"),N.attr("class","basic label-container outer-path"),y&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",y),n&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",n),yt(e,N),e.intersect=function(A){return dt.polygon(e,w,A)},a}v(Ww,"taggedRect");async function Hw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Et(t,e,Nt(e)),a=Math.max(s.width+(e.padding??0)*2,(e==null?void 0:e.width)??0),c=Math.max(s.height+(e.padding??0)*2,(e==null?void 0:e.height)??0),h=c/8,u=.2*a,d=.2*c,f=c+h,{cssStyles:p}=e,m=mt.svg(i),x=gt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-a/2-a/2*.1,y:f/2},...Pn(-a/2-a/2*.1,f/2,a/2+a/2*.1,f/2,h,.8),{x:a/2+a/2*.1,y:-f/2},{x:-a/2-a/2*.1,y:-f/2}],y=-a/2+a/2*.1,k=-f/2-d*.4,b=[{x:y+a-u,y:(k+c)*1.3},{x:y+a,y:k+c-d},{x:y+a,y:(k+c)*.9},...Pn(y+a,(k+c)*1.25,y+a-u,(k+c)*1.3,-c*.02,.5)],w=Wt(g),_=m.path(w,x),T=Wt(b),S=m.path(T,{...x,fillStyle:"solid"}),L=i.insert(()=>S,":first-child");return L.insert(()=>_,":first-child"),L.attr("class","basic label-container outer-path"),p&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",p),n&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",n),L.attr("transform",`translate(0,${-h/2})`),o.attr("transform",`translate(${-a/2+(e.padding??0)-(s.x-(s.left??0))},${-c/2+(e.padding??0)-h/2-(s.y-(s.top??0))})`),yt(e,L),e.intersect=function(B){return dt.polygon(e,g,B)},i}v(Hw,"taggedWaveEdgedRectangle");async function Uw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s}=await Et(t,e,Nt(e)),o=Math.max(s.width+(e.padding??0),(e==null?void 0:e.width)||0),a=Math.max(s.height+(e.padding??0),(e==null?void 0:e.height)||0),c=-o/2,h=-a/2,u=i.insert("rect",":first-child");return u.attr("class","text").attr("style",n).attr("rx",0).attr("ry",0).attr("x",c).attr("y",h).attr("width",o).attr("height",a),yt(e,u),e.intersect=function(d){return dt.rect(e,d)},i}v(Uw,"text");var Dz=v((t,e,r,n,i,s)=>`M${t},${e}
569
- a${i},${s} 0,0,1 0,${-n}
570
- l${r},0
571
- a${i},${s} 0,0,1 0,${n}
572
- M${r},${-n}
573
- a${i},${s} 0,0,0 0,${n}
574
- l${-r},0`,"createCylinderPathD"),Oz=v((t,e,r,n,i,s)=>[`M${t},${e}`,`M${t+r},${e}`,`a${i},${s} 0,0,0 0,${-n}`,`l${-r},0`,`a${i},${s} 0,0,0 0,${n}`,`l${r},0`].join(" "),"createOuterCylinderPathD"),Rz=v((t,e,r,n,i,s)=>[`M${t+r/2},${-n/2}`,`a${i},${s} 0,0,0 0,${n}`].join(" "),"createInnerCylinderPathD"),vx=5,wx=10;async function Vw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?12:i/2;if(e.width||e.height){const x=e.height??0;e.height=(e.height??0)-s,e.height<vx&&(e.height=vx);const y=x/2/(2.5+x/50);e.width=(e.width??0)-s-y*3,e.width<wx&&(e.width=wx)}const{shapeSvg:o,bbox:a,label:c}=await Et(t,e,Nt(e)),h=(e.height?e.height:a.height)+s,u=h/2,d=u/(2.5+h/50),f=(e.width?e.width:a.width)+d+s,{cssStyles:p}=e;let m;if(e.look==="handDrawn"){const x=mt.svg(o),g=Oz(0,0,f,h,d,u),y=Rz(0,0,f,h,d,u),k=x.path(g,gt(e,{})),b=x.path(y,gt(e,{fill:"none"}));m=o.insert(()=>b,":first-child"),m=o.insert(()=>k,":first-child"),m.attr("class","basic label-container"),p&&m.attr("style",p)}else{const x=Dz(0,0,f,h,d,u);m=o.insert("path",":first-child").attr("d",x).attr("class","basic label-container").attr("style",Be(p)).attr("style",n),m.attr("class","basic label-container outer-path"),p&&m.selectAll("path").attr("style",p),n&&m.selectAll("path").attr("style",n)}return m.attr("label-offset-x",d),m.attr("transform",`translate(${-f/2}, ${h/2} )`),c.attr("transform",`translate(${-(a.width/2)-d-(a.x-(a.left??0))}, ${-(a.height/2)-(a.y-(a.top??0))})`),yt(e,m),e.intersect=function(x){const g=dt.rect(e,x),y=g.y-(e.y??0);if(u!=0&&(Math.abs(y)<(e.height??0)/2||Math.abs(y)==(e.height??0)/2&&Math.abs(g.x-(e.x??0))>(e.width??0)/2-d)){let k=d*d*(1-y*y/(u*u));k!=0&&(k=Math.sqrt(Math.abs(k))),k=d-k,x.x-(e.x??0)>0&&(k=-k),g.x+=k}return g},o}v(Vw,"tiltedCylinder");async function Yw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.padding??0,s=(e.look==="neo",i),o=e.look==="neo"?i*2:i,{shapeSvg:a,bbox:c}=await Et(t,e,Nt(e)),h=((e==null?void 0:e.height)??c.height)+s,u=((e==null?void 0:e.width)??c.width)+o,d=[{x:-3*h/6,y:0},{x:u+3*h/6,y:0},{x:u,y:-h},{x:0,y:-h}];let f;const{cssStyles:p}=e;if(e.look==="handDrawn"){const m=mt.svg(a),x=gt(e,{}),g=Wt(d),y=m.path(g,x);f=a.insert(()=>y,":first-child").attr("transform",`translate(${-u/2}, ${h/2})`),p&&f.attr("style",p)}else f=bn(a,u,h,d);return n&&f.attr("style",n),e.width=u,e.height=h,yt(e,f),e.intersect=function(m){return dt.polygon(e,d,m)},a}v(Yw,"trapezoid");async function Gw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i,a=15,c=5;(e.width||e.height)&&(e.height=(e.height??0)-o*2,e.height<c&&(e.height=c),e.width=(e.width??0)-s*2,e.width<a&&(e.width=a));const{shapeSvg:h,bbox:u}=await Et(t,e,Nt(e)),d=(e!=null&&e.width?e==null?void 0:e.width:u.width)+s*2,f=(e!=null&&e.height?e==null?void 0:e.height:u.height)+o*2,{cssStyles:p}=e,m=mt.svg(h),x=gt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-d/2*.8,y:-f/2},{x:d/2*.8,y:-f/2},{x:d/2,y:-f/2*.6},{x:d/2,y:f/2},{x:-d/2,y:f/2},{x:-d/2,y:-f/2*.6}],y=Wt(g),k=m.path(y,x),b=h.insert(()=>k,":first-child");return b.attr("class","basic label-container outer-path"),p&&e.look!=="handDrawn"&&b.selectChildren("path").attr("style",p),n&&e.look!=="handDrawn"&&b.selectChildren("path").attr("style",n),yt(e,b),e.intersect=function(w){return dt.polygon(e,g,w)},h}v(Gw,"trapezoidalPentagon");var Sx=10,Tx=10;async function Xw(t,e){var w;const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?i*2:i;(e.width||e.height)&&(e.width=(((e==null?void 0:e.width)??0)-s)/2,e.width<Tx&&(e.width=Tx),e.height=(e==null?void 0:e.height)??0,e.height<Sx&&(e.height=Sx));const{shapeSvg:o,bbox:a,label:c}=await Et(t,e,Nt(e)),h=gn((w=Vt().flowchart)==null?void 0:w.htmlLabels),u=(e!=null&&e.width?e==null?void 0:e.width:a.width)+s,d=e!=null&&e.height?e==null?void 0:e.height:u+a.height,f=d,p=[{x:0,y:0},{x:f,y:0},{x:f/2,y:-d}],{cssStyles:m}=e,x=mt.svg(o),g=gt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=Wt(p),k=x.path(y,g),b=o.insert(()=>k,":first-child").attr("transform",`translate(${-d/2}, ${d/2})`).attr("class","outer-path");return m&&e.look!=="handDrawn"&&b.selectChildren("path").attr("style",m),n&&e.look!=="handDrawn"&&b.selectChildren("path").attr("style",n),e.width=u,e.height=d,yt(e,b),c.attr("transform",`translate(${-a.width/2-(a.x-(a.left??0))}, ${d/2-(a.height+(e.padding??0)/(h?2:1)-(a.y-(a.top??0)))})`),e.intersect=function(_){return rt.info("Triangle intersect",e,p,_),dt.polygon(e,p,_)},o}v(Xw,"triangle");async function Kw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i;let a=!0;(e.width||e.height)&&(a=!1,e.width=((e==null?void 0:e.width)??0)-s*2,e.width<10&&(e.width=10),e.height=((e==null?void 0:e.height)??0)-o*2,e.height<10&&(e.height=10));const{shapeSvg:c,bbox:h,label:u}=await Et(t,e,Nt(e)),d=(e!=null&&e.width?e==null?void 0:e.width:h.width)+(s??0)*2,f=(e!=null&&e.height?e==null?void 0:e.height:h.height)+(o??0)*2,p=e.look==="neo"?f/4:f/8,m=f+(a?p:-p),{cssStyles:x}=e,y=14-d,k=y>0?y/2:0,b=mt.svg(c),w=gt(e,{});e.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");const _=[{x:-d/2-k,y:m/2},...Pn(-d/2-k,m/2,d/2+k,m/2,p,.8),{x:d/2+k,y:-m/2},{x:-d/2-k,y:-m/2}],T=Wt(_),S=b.path(T,w),L=c.insert(()=>S,":first-child");return L.attr("class","basic label-container outer-path"),x&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",x),n&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",n),L.attr("transform",`translate(0,${-p/2})`),u.attr("transform",`translate(${-d/2+(e.padding??0)-(h.x-(h.left??0))},${-f/2+(e.padding??0)-p-(h.y-(h.top??0))})`),yt(e,L),e.intersect=function(B){return dt.polygon(e,_,B)},c}v(Kw,"waveEdgedRectangle");async function Qw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?20:i;if(e.width||e.height){e.width=(e==null?void 0:e.width)??0,e.width<20&&(e.width=20),e.height=(e==null?void 0:e.height)??0,e.height<10&&(e.height=10);const w=Math.min(e.height*.2,e.height/4);e.height=Math.ceil(e.height-o-w*(20/9)),e.width=e.width-s*2}const{shapeSvg:a,bbox:c}=await Et(t,e,Nt(e)),h=(e!=null&&e.width?e==null?void 0:e.width:c.width)+s*2,u=(e!=null&&e.height?e==null?void 0:e.height:c.height)+o,d=u/8,f=u+d*2,{cssStyles:p}=e,m=mt.svg(a),x=gt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-h/2,y:f/2},...Pn(-h/2,f/2,h/2,f/2,d,1),{x:h/2,y:-f/2},...Pn(h/2,-f/2,-h/2,-f/2,d,-1)],y=Wt(g),k=m.path(y,x),b=a.insert(()=>k,":first-child");return b.attr("class","basic label-container"),p&&e.look!=="handDrawn"&&b.selectAll("path").attr("style",p),n&&e.look!=="handDrawn"&&b.selectAll("path").attr("style",n),yt(e,b),e.intersect=function(w){return dt.polygon(e,g,w)},a}v(Qw,"waveRectangle");var ye=10;async function Zw(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e.look==="neo"?16:e.padding??0,s=e.look==="neo"?12:e.padding??0;(e.width||e.height)&&(e.width=Math.max(((e==null?void 0:e.width)??0)-i*2-ye,10),e.height=Math.max(((e==null?void 0:e.height)??0)-s*2-ye,10));const{shapeSvg:o,bbox:a,label:c}=await Et(t,e,Nt(e)),h=(e!=null&&e.width?e==null?void 0:e.width:a.width)+i*2+ye,u=(e!=null&&e.height?e==null?void 0:e.height:a.height)+s*2+ye,d=h-ye,f=u-ye,p=-d/2,m=-f/2,{cssStyles:x}=e,g=mt.svg(o),y=gt(e,{}),k=[{x:p-ye,y:m-ye},{x:p-ye,y:m+f},{x:p+d,y:m+f},{x:p+d,y:m-ye}],b=`M${p-ye},${m-ye} L${p+d},${m-ye} L${p+d},${m+f} L${p-ye},${m+f} L${p-ye},${m-ye}
575
- M${p-ye},${m} L${p+d},${m}
576
- M${p},${m-ye} L${p},${m+f}`;e.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const w=g.path(b,y),_=o.insert(()=>w,":first-child");return _.attr("transform",`translate(${ye/2}, ${ye/2})`),_.attr("class","basic label-container outer-path"),x&&e.look!=="handDrawn"&&_.selectAll("path").attr("style",x),n&&e.look!=="handDrawn"&&_.selectAll("path").attr("style",n),c.attr("transform",`translate(${-(a.width/2)+ye/2-(a.x-(a.left??0))}, ${-(a.height/2)+ye/2-(a.y-(a.top??0))})`),yt(e,_),e.intersect=function(T){return dt.polygon(e,k,T)},o}v(Zw,"windowPane");var _x=new Set(["redux-color","redux-dark-color"]),zz=new Set(["redux","redux-dark","redux-color","redux-dark-color"]);async function vf(t,e){var lt,It,Pt,Ct;const r=e;r.alias&&(e.label=r.alias);const{theme:n,themeVariables:i}=me(),{rowEven:s,rowOdd:o,nodeBorder:a,borderColorArray:c}=i;if(e.look==="handDrawn"){const{themeVariables:G}=me(),{background:it}=G,kt={...e,id:e.id+"-background",domId:(e.domId||e.id)+"-background",look:"default",cssStyles:["stroke: none",`fill: ${it}`]};await vf(t,kt)}const h=me();e.useHtmlLabels=h.htmlLabels;let u=((lt=h.er)==null?void 0:lt.diagramPadding)??10,d=((It=h.er)==null?void 0:It.entityPadding)??6;const{cssStyles:f}=e,{labelStyles:p,nodeStyles:m}=xt(e);if(r.attributes.length===0&&e.label){const G={rx:0,ry:0,labelPaddingX:u,labelPaddingY:u*1.5};pn(e.label,h)+G.labelPaddingX*2<h.er.minEntityWidth&&(e.width=h.er.minEntityWidth);const it=await ya(t,e,G);if(n!=null&&_x.has(n)){const kt=r.colorIndex??0;it.attr("data-color-id",`color-${kt%c.length}`)}if(!gn(h.htmlLabels)){const kt=it.select("text"),Tt=(Pt=kt.node())==null?void 0:Pt.getBBox();kt.attr("transform",`translate(${-Tt.width/2}, 0)`)}return it}h.htmlLabels||(u*=1.25,d*=1.25);let x=Nt(e);x||(x="node default");const g=t.insert("g").attr("class",x).attr("id",e.domId||e.id),y=await Di(g,e.label??"",h,0,0,["name"],p);y.height+=d;let k=0;const b=[],w=[];let _=0,T=0,S=0,L=0,B=!0,N=!0;for(const G of r.attributes){const it=await Di(g,G.type,h,0,k,["attribute-type"],p);_=Math.max(_,it.width+u);const kt=await Di(g,G.name,h,0,k,["attribute-name"],p);T=Math.max(T,kt.width+u);const Tt=await Di(g,G.keys.join(),h,0,k,["attribute-keys"],p);S=Math.max(S,Tt.width+u);const qt=await Di(g,G.comment,h,0,k,["attribute-comment"],p);L=Math.max(L,qt.width+u);const Qt=Math.max(it.height,kt.height,Tt.height,qt.height)+d;w.push({yOffset:k,rowHeight:Qt}),k+=Qt}let A=4;S<=u&&(B=!1,S=0,A--),L<=u&&(N=!1,L=0,A--);const R=g.node().getBBox();if(y.width+u*2-(_+T+S+L)>0){const G=y.width+u*2-(_+T+S+L);_+=G/A,T+=G/A,S>0&&(S+=G/A),L>0&&(L+=G/A)}const z=_+T+S+L,P=mt.svg(g),I=gt(e,{});e.look!=="handDrawn"&&(I.roughness=0,I.fillStyle="solid");let F=0;w.length>0&&(F=w.reduce((G,it)=>G+((it==null?void 0:it.rowHeight)??0),0));const $=Math.max(R.width+u*2,(e==null?void 0:e.width)||0,z),O=Math.max((F??0)+y.height,(e==null?void 0:e.height)||0),D=-$/2,j=-O/2;if(g.selectAll("g:not(:first-child)").each((G,it,kt)=>{const Tt=Ot(kt[it]),qt=Tt.attr("transform");let Qt=0,Gt=0;if(qt){const Xt=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(qt);Xt&&(Qt=parseFloat(Xt[1]),Gt=parseFloat(Xt[2]),Tt.attr("class").includes("attribute-name")?Qt+=_:Tt.attr("class").includes("attribute-keys")?Qt+=_+T:Tt.attr("class").includes("attribute-comment")&&(Qt+=_+T+S))}Tt.attr("transform",`translate(${D+u/2+Qt}, ${Gt+j+y.height+d/2})`)}),g.select(".name").attr("transform","translate("+-y.width/2+", "+(j+d/2)+")"),n!=null&&_x.has(n)){const G=r.colorIndex??0;g.attr("data-color-id",`color-${G%c.length}`)}const Y=P.rectangle(D,j,$,O,I),et=g.insert(()=>Y,":first-child").attr("class","outer-path").attr("style",f.join(""));b.push(0);for(const[G,it]of w.entries()){const Tt=(G+1)%2===0&&it.yOffset!==0,qt=P.rectangle(D,y.height+j+(it==null?void 0:it.yOffset),$,it==null?void 0:it.rowHeight,{...I,fill:Tt?s:o,stroke:a});g.insert(()=>qt,"g.label").attr("style",f.join("")).attr("class",`row-rect-${Tt?"even":"odd"}`)}const M=1e-4;let ct=Oi(D,y.height+j,$+D,y.height+j,M),X=P.polygon(ct.map(G=>[G.x,G.y]),I);if(g.insert(()=>X).attr("class","divider"),ct=Oi(_+D,y.height+j,_+D,O+j,M),X=P.polygon(ct.map(G=>[G.x,G.y]),I),g.insert(()=>X).attr("class","divider"),B){const G=_+T+D;ct=Oi(G,y.height+j,G,O+j,M),X=P.polygon(ct.map(it=>[it.x,it.y]),I),g.insert(()=>X).attr("class","divider")}if(N){const G=_+T+S+D;ct=Oi(G,y.height+j,G,O+j,M),X=P.polygon(ct.map(it=>[it.x,it.y]),I),g.insert(()=>X).attr("class","divider")}for(const G of b){const it=y.height+j+G;ct=Oi(D,it,$+D,it,M),X=P.polygon(ct.map(kt=>[kt.x,kt.y]),I),g.insert(()=>X).attr("class","divider")}if(yt(e,et),m&&e.look!=="handDrawn")if(n!=null&&zz.has(n))g.selectAll("path").attr("style",m);else{const G=m.split(";"),it=(Ct=G==null?void 0:G.filter(kt=>kt.includes("stroke")))==null?void 0:Ct.map(kt=>`${kt}`).join("; ");g.selectAll("path").attr("style",it??""),g.selectAll(".row-rect-even path").attr("style",m)}return e.intersect=function(G){return dt.rect(e,G)},g}v(vf,"erBox");async function Di(t,e,r,n=0,i=0,s=[],o=""){const a=t.insert("g").attr("class",`label ${s.join(" ")}`).attr("transform",`translate(${n}, ${i})`).attr("style",o);e!==og(e)&&(e=og(e),e=e.replaceAll("<","&lt;").replaceAll(">","&gt;"));const c=a.node().appendChild(await yn(a,e,{width:pn(e,r)+100,style:o,useHtmlLabels:r.htmlLabels},r));if(e.includes("&lt;")||e.includes("&gt;")){let u=c.children[0];for(u.textContent=u.textContent.replaceAll("&lt;","<").replaceAll("&gt;",">");u.childNodes[0];)u=u.childNodes[0],u.textContent=u.textContent.replaceAll("&lt;","<").replaceAll("&gt;",">")}let h=c.getBBox();if(gn(r.htmlLabels)){const u=c.children[0];u.style.textAlign="start";const d=Ot(c);h=u.getBoundingClientRect(),d.attr("width",h.width),d.attr("height",h.height)}return h}v(Di,"addText");function Oi(t,e,r,n,i){return t===r?[{x:t-i/2,y:e},{x:t+i/2,y:e},{x:r+i/2,y:n},{x:r-i/2,y:n}]:[{x:t,y:e-i/2},{x:t,y:e+i/2},{x:r,y:n+i/2},{x:r,y:n-i/2}]}v(Oi,"lineToPolygon");async function Jw(t,e,r,n,i=r.class.padding??12){const s=n?0:3,o=t.insert("g").attr("class",Nt(e)).attr("id",e.domId||e.id);let a=null,c=null,h=null,u=null,d=0,f=0,p=0;if(a=o.insert("g").attr("class","annotation-group text"),e.annotations.length>0){const k=e.annotations[0];await vo(a,{text:`«${k}»`},0),d=a.node().getBBox().height}c=o.insert("g").attr("class","label-group text"),await vo(c,e,0,["font-weight: bolder"]);const m=c.node().getBBox();f=m.height,h=o.insert("g").attr("class","members-group text");let x=0;for(const k of e.members){const b=await vo(h,k,x,[k.parseClassifier()]);x+=b+s}p=h.node().getBBox().height,p<=0&&(p=i/2),u=o.insert("g").attr("class","methods-group text");let g=0;for(const k of e.methods){const b=await vo(u,k,g,[k.parseClassifier()]);g+=b+s}let y=o.node().getBBox();if(a!==null){const k=a.node().getBBox();a.attr("transform",`translate(${-k.width/2})`)}return c.attr("transform",`translate(${-m.width/2}, ${d})`),y=o.node().getBBox(),h.attr("transform",`translate(0, ${d+f+i*2})`),y=o.node().getBBox(),u.attr("transform",`translate(0, ${d+f+(p?p+i*4:i*2)})`),y=o.node().getBBox(),{shapeSvg:o,bbox:y}}v(Jw,"textHelper");async function vo(t,e,r,n=[]){const i=t.insert("g").attr("class","label").attr("style",n.join("; ")),s=me();let o="useHtmlLabels"in e?e.useHtmlLabels:gn(s.htmlLabels)??!0,a="";"text"in e?a=e.text:a=e.label,!o&&a.startsWith("\\")&&(a=a.substring(1)),Ro(a)&&(o=!0);const c=await yn(i,Lp(di(a)),{width:pn(a,s)+50,classes:"markdown-node-label",useHtmlLabels:o},s);let h,u=1;if(o){const d=c.children[0],f=Ot(c);u=d.innerHTML.split("<br>").length,d.innerHTML.includes("</math>")&&(u+=d.innerHTML.split("<mrow>").length-1);const p=d.getElementsByTagName("img");if(p){const m=a.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...p].map(x=>new Promise(g=>{function y(){var k;if(x.style.display="flex",x.style.flexDirection="column",m){const b=((k=s.fontSize)==null?void 0:k.toString())??window.getComputedStyle(document.body).fontSize,_=parseInt(b,10)*5+"px";x.style.minWidth=_,x.style.maxWidth=_}else x.style.width="100%";g(x)}v(y,"setupImage"),setTimeout(()=>{x.complete&&y()}),x.addEventListener("error",y),x.addEventListener("load",y)})))}h=d.getBoundingClientRect(),f.attr("width",h.width),f.attr("height",h.height)}else{n.includes("font-weight: bolder")&&Ot(c).selectAll("tspan").attr("font-weight",""),u=c.children.length;const d=c.children[0];(c.textContent===""||c.textContent.includes("&gt"))&&(d.textContent=a[0]+a.substring(1).replaceAll("&gt;",">").replaceAll("&lt;","<").trim(),a[1]===" "&&(d.textContent=d.textContent[0]+" "+d.textContent.substring(1))),d.textContent==="undefined"&&(d.textContent=""),h=c.getBBox()}return i.attr("transform","translate(0,"+(-h.height/(2*u)+r)+")"),h.height}v(vo,"addText");async function t2(t,e){var P,I;const r=Vt(),{themeVariables:n}=r,{useGradient:i}=n,s=r.class.padding??12,o=s,a=e.useHtmlLabels??gn(r.htmlLabels)??!0,c=e;c.annotations=c.annotations??[],c.members=c.members??[],c.methods=c.methods??[];const{shapeSvg:h,bbox:u}=await Jw(t,e,r,a,o),{labelStyles:d,nodeStyles:f}=xt(e);e.labelStyle=d,e.cssStyles=c.styles||"";const p=((P=c.styles)==null?void 0:P.join(";"))||f||"";e.cssStyles||(e.cssStyles=p.replaceAll("!important","").split(";"));const m=c.members.length===0&&c.methods.length===0&&!((I=r.class)!=null&&I.hideEmptyMembersBox),x=mt.svg(h),g=gt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=Math.max(e.width??0,u.width);let k=Math.max(e.height??0,u.height);const b=(e.height??0)>u.height;c.members.length===0&&c.methods.length===0?k+=o:c.members.length>0&&c.methods.length===0&&(k+=o*2);const w=-y/2,_=-k/2;let T=m?s*2:c.members.length===0&&c.methods.length===0?-s:0;b&&(T=s*2);const S=x.rectangle(w-s,_-s-(m?s:c.members.length===0&&c.methods.length===0?-s/2:0),y+2*s,k+2*s+T,g),L=h.insert(()=>S,":first-child");L.attr("class","basic label-container outer-path");const B=L.node().getBBox(),N=h.select(".annotation-group").node().getBBox().height-(m?s/2:0)||0,A=h.select(".label-group").node().getBBox().height-(m?s/2:0)||0,R=h.select(".members-group").node().getBBox().height-(m?s/2:0)||0,z=(N+A+_+s-(_-s-(m?s:c.members.length===0&&c.methods.length===0?-s/2:0)))/2;if(h.selectAll(".text").each((F,$,O)=>{var ct,X;const D=Ot(O[$]),j=D.attr("transform");let Y=0;if(j){const It=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(j);It&&(Y=parseFloat(It[2]))}let et=Y+_+s-(m?s:c.members.length===0&&c.methods.length===0?-s/2:0);if(D.attr("class").includes("methods-group")){const lt=Math.max(R,o/2);b?et=Math.max(z,N+A+lt+_+o*2+s)+o*2:et=N+A+lt+_+o*4+s}c.members.length===0&&c.methods.length===0&&((ct=r.class)!=null&&ct.hideEmptyMembersBox)&&(c.annotations.length>0?et=Y-o:et=Y),a||(et-=4);let M=w;(D.attr("class").includes("label-group")||D.attr("class").includes("annotation-group"))&&(M=-((X=D.node())==null?void 0:X.getBBox().width)/2||0,h.selectAll("text").each(function(lt,It,Pt){window.getComputedStyle(Pt[It]).textAnchor==="middle"&&(M=0)})),D.attr("transform",`translate(${M}, ${et})`)}),c.members.length>0||c.methods.length>0||m){const F=N+A+_+s,$=x.line(B.x,F,B.x+B.width,F+.001,g);h.insert(()=>$).attr("class",`divider${e.look==="neo"&&!i?" neo-line":""}`).attr("style",p)}if(m||c.members.length>0||c.methods.length>0){const F=N+A+R+_+o*2+s,$=x.line(B.x,b?Math.max(z,F):F,B.x+B.width,(b?Math.max(z,F):F)+.001,g);h.insert(()=>$).attr("class",`divider${e.look==="neo"&&!i?" neo-line":""}`).attr("style",p)}if(c.look!=="handDrawn"&&h.selectAll("path").attr("style",p),L.select(":nth-child(2)").attr("style",p),h.selectAll(".divider").select("path").attr("style",p),e.labelStyle?h.selectAll("span").attr("style",e.labelStyle):h.selectAll("span").attr("style",p),!a){const F=RegExp(/color\s*:\s*([^;]*)/),$=F.exec(p);if($){const O=$[0].replace("color","fill");h.selectAll("tspan").attr("style",O)}else if(d){const O=F.exec(d);if(O){const D=O[0].replace("color","fill");h.selectAll("tspan").attr("style",D)}}}return yt(e,L),e.intersect=function(F){return dt.rect(e,F)},h}v(t2,"classBox");async function e2(t,e){var B,N;const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const i=e,s=e,o=20,a=20,c="verifyMethod"in e,h=Nt(e),{themeVariables:u}=Vt(),{borderColorArray:d,requirementEdgeLabelBackground:f}=u,p=t.insert("g").attr("class",h).attr("id",e.domId??e.id);let m;c?m=await Hr(p,`&lt;&lt;${i.type}&gt;&gt;`,0,e.labelStyle):m=await Hr(p,"&lt;&lt;Element&gt;&gt;",0,e.labelStyle);let x=m;const g=await Hr(p,i.name,x,e.labelStyle+"; font-weight: bold;");if(x+=g+a,c){const A=await Hr(p,`${i.requirementId?`ID: ${i.requirementId}`:""}`,x,e.labelStyle);x+=A;const R=await Hr(p,`${i.text?`Text: ${i.text}`:""}`,x,e.labelStyle);x+=R;const z=await Hr(p,`${i.risk?`Risk: ${i.risk}`:""}`,x,e.labelStyle);x+=z,await Hr(p,`${i.verifyMethod?`Verification: ${i.verifyMethod}`:""}`,x,e.labelStyle)}else{const A=await Hr(p,`${s.type?`Type: ${s.type}`:""}`,x,e.labelStyle);x+=A,await Hr(p,`${s.docRef?`Doc Ref: ${s.docRef}`:""}`,x,e.labelStyle)}const y=(((B=p.node())==null?void 0:B.getBBox().width)??200)+o,k=(((N=p.node())==null?void 0:N.getBBox().height)??200)+o,b=-y/2,w=-k/2,_=mt.svg(p),T=gt(e,{});e.look!=="handDrawn"&&(T.roughness=0,T.fillStyle="solid");const S=_.rectangle(b,w,y,k,T),L=p.insert(()=>S,":first-child");if(L.attr("class","basic label-container outer-path").attr("style",n),d!=null&&d.length){const A=e.colorIndex??0;p.attr("data-color-id",`color-${A%d.length}`)}if(p.selectAll(".label").each((A,R,z)=>{const P=Ot(z[R]),I=P.attr("transform");let F=0,$=0;if(I){const Y=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(I);Y&&(F=parseFloat(Y[1]),$=parseFloat(Y[2]))}const O=$-k/2;let D=b+o/2;(R===0||R===1)&&(D=F),P.attr("transform",`translate(${D}, ${O+o})`)}),x>m+g+a){const A=w+m+g+a;let R;if(e.look==="neo"){const I=[[b,A],[b+y,A],[b+y,A+.001],[b,A+.001]];R=_.polygon(I,T)}else R=_.line(b,A,b+y,A,T);p.insert(()=>R).attr("class","divider")}return yt(e,L),e.intersect=function(A){return dt.rect(e,A)},n&&e.look!=="handDrawn"&&(f||d!=null&&d.length)&&p.selectAll("path").attr("style",n),p}v(e2,"requirementBox");async function Hr(t,e,r,n=""){if(e==="")return 0;const i=t.insert("g").attr("class","label").attr("style",n),s=Vt(),o=s.htmlLabels??!0,a=await yn(i,Lp(di(e)),{width:pn(e,s)+50,classes:"markdown-node-label",useHtmlLabels:o,style:n},s);let c;if(o){const h=a.children[0],u=Ot(a);c=h.getBoundingClientRect(),u.attr("width",c.width),u.attr("height",c.height)}else{const h=a.children[0];for(const u of h.children)n&&u.setAttribute("style",n);c=a.getBBox(),c.height+=6}return i.attr("transform",`translate(${-c.width/2},${-c.height/2+r})`),c.height}v(Hr,"addText");var qz=v(t=>{switch(t){case"Very High":return"red";case"High":return"orange";case"Medium":return null;case"Low":return"blue";case"Very Low":return"lightblue"}},"colorFromPriority");async function r2(t,e,{config:r}){var R,z;const{labelStyles:n,nodeStyles:i}=xt(e);e.labelStyle=n||"";const s=10,o=e.width;e.width=(e.width??200)-10;const{shapeSvg:a,bbox:c,label:h}=await Et(t,e,Nt(e)),u=e.padding||10;let d="",f;"ticket"in e&&e.ticket&&((R=r==null?void 0:r.kanban)!=null&&R.ticketBaseUrl)&&(d=(z=r==null?void 0:r.kanban)==null?void 0:z.ticketBaseUrl.replace("#TICKET#",e.ticket),f=a.insert("svg:a",":first-child").attr("class","kanban-ticket-link").attr("xlink:href",d).attr("target","_blank"));const p={useHtmlLabels:e.useHtmlLabels,labelStyle:e.labelStyle||"",width:e.width,img:e.img,padding:e.padding||8,centerLabel:!1};let m,x;f?{label:m,bbox:x}=await tu(f,"ticket"in e&&e.ticket||"",p):{label:m,bbox:x}=await tu(a,"ticket"in e&&e.ticket||"",p);const{label:g,bbox:y}=await tu(a,"assigned"in e&&e.assigned||"",p);e.width=o;const k=10,b=(e==null?void 0:e.width)||0,w=Math.max(x.height,y.height)/2,_=Math.max(c.height+k*2,(e==null?void 0:e.height)||0)+w,T=-b/2,S=-_/2;h.attr("transform","translate("+(u-b/2)+", "+(-w-c.height/2)+")"),m.attr("transform","translate("+(u-b/2)+", "+(-w+c.height/2)+")"),g.attr("transform","translate("+(u+b/2-y.width-2*s)+", "+(-w+c.height/2)+")");let L;const{rx:B,ry:N}=e,{cssStyles:A}=e;if(e.look==="handDrawn"){const P=mt.svg(a),I=gt(e,{}),F=B||N?P.path(Rn(T,S,b,_,B||0),I):P.rectangle(T,S,b,_,I);L=a.insert(()=>F,":first-child"),L.attr("class","basic label-container").attr("style",A||null)}else{L=a.insert("rect",":first-child"),L.attr("class","basic label-container __APA__").attr("style",i).attr("rx",B??5).attr("ry",N??5).attr("x",T).attr("y",S).attr("width",b).attr("height",_);const P="priority"in e&&e.priority;if(P){const I=a.append("line"),F=T+2,$=S+Math.floor((B??0)/2),O=S+_-Math.floor((B??0)/2);I.attr("x1",F).attr("y1",$).attr("x2",F).attr("y2",O).attr("stroke-width","4").attr("stroke",qz(P))}}return yt(e,L),e.height=_,e.intersect=function(P){return dt.rect(e,P)},a}v(r2,"kanbanItem");async function n2(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await Et(t,e,Nt(e)),c=s.width+10*o,h=s.height+8*o,u=.15*c,{cssStyles:d}=e,f=s.width+20,p=s.height+20,m=Math.max(c,f),x=Math.max(h,p);a.attr("transform",`translate(${-s.width/2}, ${-s.height/2})`);let g;const y=`M0 0
577
- a${u},${u} 1 0,0 ${m*.25},${-1*x*.1}
578
- a${u},${u} 1 0,0 ${m*.25},0
579
- a${u},${u} 1 0,0 ${m*.25},0
580
- a${u},${u} 1 0,0 ${m*.25},${x*.1}
581
-
582
- a${u},${u} 1 0,0 ${m*.15},${x*.33}
583
- a${u*.8},${u*.8} 1 0,0 0,${x*.34}
584
- a${u},${u} 1 0,0 ${-1*m*.15},${x*.33}
585
-
586
- a${u},${u} 1 0,0 ${-1*m*.25},${x*.15}
587
- a${u},${u} 1 0,0 ${-1*m*.25},0
588
- a${u},${u} 1 0,0 ${-1*m*.25},0
589
- a${u},${u} 1 0,0 ${-1*m*.25},${-1*x*.15}
590
-
591
- a${u},${u} 1 0,0 ${-1*m*.1},${-1*x*.33}
592
- a${u*.8},${u*.8} 1 0,0 0,${-1*x*.34}
593
- a${u},${u} 1 0,0 ${m*.1},${-1*x*.33}
594
- H0 V0 Z`;if(e.look==="handDrawn"){const k=mt.svg(i),b=gt(e,{}),w=k.path(y,b);g=i.insert(()=>w,":first-child"),g.attr("class","basic label-container").attr("style",Be(d))}else g=i.insert("path",":first-child").attr("class","basic label-container").attr("style",n).attr("d",y);return g.attr("transform",`translate(${-m/2}, ${-x/2})`),yt(e,g),e.calcIntersect=function(k,b){return dt.rect(k,b)},e.intersect=function(k){return rt.info("Bang intersect",e,k),dt.rect(e,k)},i}v(n2,"bang");async function i2(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await Et(t,e,Nt(e)),c=s.width+2*o,h=s.height+2*o,u=.15*c,d=.25*c,f=.35*c,p=.2*c,{cssStyles:m}=e;let x;const g=`M0 0
595
- a${u},${u} 0 0,1 ${c*.25},${-1*c*.1}
596
- a${f},${f} 1 0,1 ${c*.4},${-1*c*.1}
597
- a${d},${d} 1 0,1 ${c*.35},${c*.2}
598
-
599
- a${u},${u} 1 0,1 ${c*.15},${h*.35}
600
- a${p},${p} 1 0,1 ${-1*c*.15},${h*.65}
601
-
602
- a${d},${u} 1 0,1 ${-1*c*.25},${c*.15}
603
- a${f},${f} 1 0,1 ${-1*c*.5},0
604
- a${u},${u} 1 0,1 ${-1*c*.25},${-1*c*.15}
605
-
606
- a${u},${u} 1 0,1 ${-1*c*.1},${-1*h*.35}
607
- a${p},${p} 1 0,1 ${c*.1},${-1*h*.65}
608
- H0 V0 Z`;if(e.look==="handDrawn"){const y=mt.svg(i),k=gt(e,{}),b=y.path(g,k);x=i.insert(()=>b,":first-child"),x.attr("class","basic label-container").attr("style",Be(m))}else x=i.insert("path",":first-child").attr("class","basic label-container").attr("style",n).attr("d",g);return a.attr("transform",`translate(${-s.width/2}, ${-s.height/2})`),x.attr("transform",`translate(${-c/2}, ${-h/2})`),yt(e,x),e.calcIntersect=function(y,k){return dt.rect(y,k)},e.intersect=function(y){return rt.info("Cloud intersect",e,y),dt.rect(e,y)},i}v(i2,"cloud");async function s2(t,e){const{labelStyles:r,nodeStyles:n}=xt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await Et(t,e,Nt(e)),c=s.width+8*o,h=s.height+2*o,u=5,d=e.look==="neo"?`
609
- M${-c/2} ${h/2-u}
610
- v${-h+2*u}
611
- q0,-${u} ${u},-${u}
612
- h${c-2*u}
613
- q${u},0 ${u},${u}
614
- v${h-u}
615
- H${-c/2}
616
- Z
617
- `:`
618
- M${-c/2} ${h/2-u}
619
- v${-h+2*u}
620
- q0,-${u} ${u},-${u}
621
- h${c-2*u}
622
- q${u},0 ${u},${u}
623
- v${h-2*u}
624
- q0,${u} ${-u},${u}
625
- h${-(c-2*u)}
626
- q${-u},0 ${-u},${-u}
627
- Z
628
- `;if(!e.domId)throw new Error(`defaultMindmapNode: node "${e.id}" is missing a domId — was render.ts domId prefixing skipped?`);const f=i.append("path").attr("id",e.domId).attr("class","node-bkg node-"+e.type).attr("style",n).attr("d",d);return i.append("line").attr("class","node-line-").attr("x1",-c/2).attr("y1",h/2).attr("x2",c/2).attr("y2",h/2),a.attr("transform",`translate(${-s.width/2}, ${-s.height/2})`),i.append(()=>a.node()),yt(e,f),e.calcIntersect=function(p,m){return dt.rect(p,m)},e.intersect=function(p){return dt.rect(e,p)},i}v(s2,"defaultMindmapNode");async function o2(t,e){const r={padding:e.padding??0};return kf(t,e,r)}v(o2,"mindmapCircle");var Wz=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:$w},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:Iw},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:Dw},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:qw},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:aw},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:kf},{semanticName:"Bang",name:"Bang",shortName:"bang",description:"Bang",aliases:["bang"],handler:n2},{semanticName:"Cloud",name:"Cloud",shortName:"cloud",description:"cloud",aliases:["cloud"],handler:i2},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:Bw},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:fw},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:Sw},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:ww},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:Yw},{semanticName:"Manual Operation",name:"Trapezoid Base Top",shortName:"trap-t",description:"Represents a manual task",aliases:["manual","trapezoid-top","inv-trapezoid"],internalAliases:["inv_trapezoid"],handler:kw},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:cw},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:Uw},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:Jv},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:Fw},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:zw},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:Rw},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:dw},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:mw},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:nw},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:iw},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:sw},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:Tw},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:Kw},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:pw},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:Vw},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:_w},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:ow},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:lw},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:Xw},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:Zw},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:hw},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:Gw},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:uw},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:Pw},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:Ew},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:Nw},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:Zv},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:rw},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:Hw},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:Ww},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:Qw},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:Aw},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:jw}],Hz=v(()=>{const e=[...Object.entries({state:Ow,choice:tw,note:Lw,rectWithTitle:Mw,labelRect:vw,iconSquare:bw,iconCircle:xw,icon:gw,iconRounded:yw,imageSquare:Cw,anchor:Kv,kanbanItem:r2,mindmapCircle:o2,defaultMindmapNode:s2,classBox:t2,erBox:vf,requirementBox:e2}),...Wz.flatMap(r=>[r.shortName,..."aliases"in r?r.aliases:[],..."internalAliases"in r?r.internalAliases:[]].map(i=>[i,r.handler]))];return Object.fromEntries(e)},"generateShapeMap"),a2=Hz();function Uz(t){return t in a2}v(Uz,"isValidShape");var Qc=new Map;async function l2(t,e,r){let n,i;e.shape==="rect"&&(e.rx&&e.ry?e.shape="roundedRect":e.shape="squareRect");const s=e.shape?a2[e.shape]:void 0;if(!s)throw new Error(`No such shape: ${e.shape}. Please check your syntax.`);if(e.link){let o;r.config.securityLevel==="sandbox"?o="_top":e.linkTarget&&(o=e.linkTarget||"_blank"),n=t.insert("svg:a").attr("xlink:href",e.link).attr("target",o??null),i=await s(n,e,r)}else i=await s(t,e,r),n=i;return n.attr("data-look",Be(e.look)),e.tooltip&&i.attr("title",e.tooltip),Qc.set(e.id,n),e.haveCallback&&n.attr("class",n.attr("class")+" clickable"),n}v(l2,"insertNode");var DK=v((t,e)=>{Qc.set(e.id,t)},"setNodeElem"),OK=v(()=>{Qc.clear()},"clear"),RK=v(t=>{const e=Qc.get(t.id);rt.trace("Transforming node",t.diff,t,"translate("+(t.x-t.width/2-5)+", "+t.width/2+")");const r=8,n=t.diff||0;return t.clusterNode?e.attr("transform","translate("+(t.x+n-t.width/2)+", "+(t.y-t.height/2-r)+")"):e.attr("transform","translate("+t.x+", "+t.y+")"),n},"positionNode"),Vz=v((t,e,r,n,i,s=!1,o)=>{e.arrowTypeStart&&jx(t,"start",e.arrowTypeStart,r,n,i,s,o),e.arrowTypeEnd&&jx(t,"end",e.arrowTypeEnd,r,n,i,s,o)},"addEdgeMarkers"),Yz={arrow_cross:{type:"cross",fill:!1},arrow_point:{type:"point",fill:!0},arrow_barb:{type:"barb",fill:!0},arrow_barb_neo:{type:"barb",fill:!0},arrow_circle:{type:"circle",fill:!1},aggregation:{type:"aggregation",fill:!1},extension:{type:"extension",fill:!1},composition:{type:"composition",fill:!0},dependency:{type:"dependency",fill:!0},lollipop:{type:"lollipop",fill:!1},only_one:{type:"onlyOne",fill:!1},zero_or_one:{type:"zeroOrOne",fill:!1},one_or_more:{type:"oneOrMore",fill:!1},zero_or_more:{type:"zeroOrMore",fill:!1},requirement_arrow:{type:"requirement_arrow",fill:!1},requirement_contains:{type:"requirement_contains",fill:!1}},Gz=["cross","point","circle","lollipop","aggregation","extension","composition","dependency","barb"],jx=v((t,e,r,n,i,s,o=!1,a)=>{var m;const c=Yz[r],h=c&&Gz.includes(c.type);if(!c){rt.warn(`Unknown arrow type: ${r}`);return}const u=c.type,p=`${i}_${s}-${u}${e==="start"?"Start":"End"}${o&&h?"-margin":""}`;if(a&&a.trim()!==""){const x=a.replace(/[^\dA-Za-z]/g,"_"),g=`${p}_${x}`;if(!document.getElementById(g)){const y=document.getElementById(p);if(y){const k=y.cloneNode(!0);k.id=g,k.querySelectorAll("path, circle, line").forEach(w=>{w.setAttribute("stroke",a),c.fill&&w.setAttribute("fill",a)}),(m=y.parentNode)==null||m.appendChild(k)}}t.attr(`marker-${e}`,`url(${n}#${g})`)}else t.attr(`marker-${e}`,`url(${n}#${p})`)},"addEdgeMarker"),Xz=v(t=>{var e,r;return typeof t=="string"?t:(r=(e=Vt())==null?void 0:e.flowchart)==null?void 0:r.curve},"resolveEdgeCurveType"),hc=new Map,$e=new Map,zK=v(()=>{hc.clear(),$e.clear()},"clear"),lo=v(t=>t?typeof t=="string"?t:t.reduce((e,r)=>e+";"+r,""):"","getLabelStyles"),Kz=v(async(t,e)=>{const r=Vt();let n=er(r);const{labelStyles:i}=xt(e);e.labelStyle=i;const s=t.insert("g").attr("class","edgeLabel"),o=s.insert("g").attr("class","label").attr("data-id",e.id),a=e.labelType==="markdown",h=await yn(t,e.label,{style:lo(e.labelStyle),useHtmlLabels:n,addSvgBackground:!0,isNode:!1,markdown:a,width:a?void 0:void 0},r);o.node().appendChild(h),rt.info("abc82",e,e.labelType);let u=h.getBBox(),d=u;if(n){const p=h.children[0],m=Ot(h);u=p.getBoundingClientRect(),d=u,m.attr("width",u.width),m.attr("height",u.height)}else{const p=Ot(h).select("text").node();p&&typeof p.getBBox=="function"&&(d=p.getBBox())}o.attr("transform",ro(d,n)),hc.set(e.id,s),e.width=u.width,e.height=u.height;let f;if(e.startLabelLeft){const p=t.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),x=await _n(m,e.startLabelLeft,lo(e.labelStyle)||"",!1,!1);f=x;let g=x.getBBox();if(n){const y=x.children[0],k=Ot(x);g=y.getBoundingClientRect(),k.attr("width",g.width),k.attr("height",g.height)}m.attr("transform",ro(g,n)),$e.get(e.id)||$e.set(e.id,{}),$e.get(e.id).startLeft=p,wo(f,e.startLabelLeft)}if(e.startLabelRight){const p=t.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),x=await _n(m,e.startLabelRight,lo(e.labelStyle)||"",!1,!1);f=x,m.node().appendChild(x);let g=x.getBBox();if(n){const y=x.children[0],k=Ot(x);g=y.getBoundingClientRect(),k.attr("width",g.width),k.attr("height",g.height)}m.attr("transform",ro(g,n)),$e.get(e.id)||$e.set(e.id,{}),$e.get(e.id).startRight=p,wo(f,e.startLabelRight)}if(e.endLabelLeft){const p=t.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),x=await _n(m,e.endLabelLeft,lo(e.labelStyle)||"",!1,!1);f=x;let g=x.getBBox();if(n){const y=x.children[0],k=Ot(x);g=y.getBoundingClientRect(),k.attr("width",g.width),k.attr("height",g.height)}m.attr("transform",ro(g,n)),p.node().appendChild(x),$e.get(e.id)||$e.set(e.id,{}),$e.get(e.id).endLeft=p,wo(f,e.endLabelLeft)}if(e.endLabelRight){const p=t.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),x=await _n(m,e.endLabelRight,lo(e.labelStyle)||"",!1,!1);f=x;let g=x.getBBox();if(n){const y=x.children[0],k=Ot(x);g=y.getBoundingClientRect(),k.attr("width",g.width),k.attr("height",g.height)}m.attr("transform",ro(g,n)),p.node().appendChild(x),$e.get(e.id)||$e.set(e.id,{}),$e.get(e.id).endRight=p,wo(f,e.endLabelRight)}return h},"insertEdgeLabel");function wo(t,e){er(Vt())&&t&&(t.style.width=e.length*9+"px",t.style.height="12px")}v(wo,"setTerminalWidth");var Qz=v((t,e)=>{rt.debug("Moving label abc88 ",t.id,t.label,hc.get(t.id),e);let r=e.updatedPath?e.updatedPath:e.originalPath;const n=Vt(),{subGraphTitleTotalMargin:i}=lf(n);if(t.label){const s=hc.get(t.id);let o=t.x,a=t.y;if(r){const c=Ar.calcLabelPosition(r);rt.debug("Moving label "+t.label+" from (",o,",",a,") to (",c.x,",",c.y,") abc88"),e.updatedPath&&(o=c.x,a=c.y)}s.attr("transform",`translate(${o}, ${a+i/2})`)}if(t.startLabelLeft){const s=$e.get(t.id).startLeft;let o=t.x,a=t.y;if(r){const c=Ar.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_left",r);o=c.x,a=c.y}s.attr("transform",`translate(${o}, ${a})`)}if(t.startLabelRight){const s=$e.get(t.id).startRight;let o=t.x,a=t.y;if(r){const c=Ar.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_right",r);o=c.x,a=c.y}s.attr("transform",`translate(${o}, ${a})`)}if(t.endLabelLeft){const s=$e.get(t.id).endLeft;let o=t.x,a=t.y;if(r){const c=Ar.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_left",r);o=c.x,a=c.y}s.attr("transform",`translate(${o}, ${a})`)}if(t.endLabelRight){const s=$e.get(t.id).endRight;let o=t.x,a=t.y;if(r){const c=Ar.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",r);o=c.x,a=c.y}s.attr("transform",`translate(${o}, ${a})`)}},"positionEdgeLabel"),Zz=v((t,e)=>{const r=t.x,n=t.y,i=Math.abs(e.x-r),s=Math.abs(e.y-n),o=t.width/2,a=t.height/2;return i>=o||s>=a},"outsideNode"),Jz=v((t,e,r)=>{rt.debug(`intersection calc abc89:
629
- outsidePoint: ${JSON.stringify(e)}
630
- insidePoint : ${JSON.stringify(r)}
631
- node : x:${t.x} y:${t.y} w:${t.width} h:${t.height}`);const n=t.x,i=t.y,s=Math.abs(n-r.x),o=t.width/2;let a=r.x<e.x?o-s:o+s;const c=t.height/2,h=Math.abs(e.y-r.y),u=Math.abs(e.x-r.x);if(Math.abs(i-e.y)*o>Math.abs(n-e.x)*c){let d=r.y<e.y?e.y-c-i:i-c-e.y;a=u*d/h;const f={x:r.x<e.x?r.x+a:r.x-u+a,y:r.y<e.y?r.y+h-d:r.y-h+d};return a===0&&(f.x=e.x,f.y=e.y),u===0&&(f.x=e.x),h===0&&(f.y=e.y),rt.debug(`abc89 top/bottom calc, Q ${h}, q ${d}, R ${u}, r ${a}`,f),f}else{r.x<e.x?a=e.x-o-n:a=n-o-e.x;let d=h*a/u,f=r.x<e.x?r.x+u-a:r.x-u+a,p=r.y<e.y?r.y+d:r.y-d;return rt.debug(`sides calc abc89, Q ${h}, q ${d}, R ${u}, r ${a}`,{_x:f,_y:p}),a===0&&(f=e.x,p=e.y),u===0&&(f=e.x),h===0&&(p=e.y),{x:f,y:p}}},"intersection"),Nx=v((t,e)=>{rt.warn("abc88 cutPathAtIntersect",t,e);let r=[],n=t[0],i=!1;return t.forEach(s=>{if(rt.info("abc88 checking point",s,e),!Zz(e,s)&&!i){const o=Jz(e,n,s);rt.debug("abc88 inside",s,n,o),rt.debug("abc88 intersection",o,e);let a=!1;r.forEach(c=>{a=a||c.x===o.x&&c.y===o.y}),r.some(c=>c.x===o.x&&c.y===o.y)?rt.warn("abc88 no intersect",o,r):r.push(o),i=!0}else rt.warn("abc88 outside",s,n),n=s,i||r.push(s)}),rt.debug("returning points",r),r},"cutPathAtIntersect");function c2(t){const e=[],r=[];for(let n=1;n<t.length-1;n++){const i=t[n-1],s=t[n],o=t[n+1];(i.x===s.x&&s.y===o.y&&Math.abs(s.x-o.x)>5&&Math.abs(s.y-i.y)>5||i.y===s.y&&s.x===o.x&&Math.abs(s.x-i.x)>5&&Math.abs(s.y-o.y)>5)&&(e.push(s),r.push(n))}return{cornerPoints:e,cornerPointPositions:r}}v(c2,"extractCornerPoints");var Ex=v(function(t,e,r){const n=e.x-t.x,i=e.y-t.y,s=Math.sqrt(n*n+i*i),o=r/s;return{x:e.x-o*n,y:e.y-o*i}},"findAdjacentPoint"),t9=v(function(t){const{cornerPointPositions:e}=c2(t),r=[];for(let n=0;n<t.length;n++)if(e.includes(n)){const i=t[n-1],s=t[n+1],o=t[n],a=Ex(i,o,5),c=Ex(s,o,5),h=c.x-a.x,u=c.y-a.y;r.push(a);const d=Math.sqrt(2)*2;let f={x:o.x,y:o.y};if(Math.abs(s.x-i.x)>10&&Math.abs(s.y-i.y)>=10){rt.debug("Corner point fixing",Math.abs(s.x-i.x),Math.abs(s.y-i.y));const p=5;o.x===a.x?f={x:h<0?a.x-p+d:a.x+p-d,y:u<0?a.y-d:a.y+d}:f={x:h<0?a.x-d:a.x+d,y:u<0?a.y-p+d:a.y+p-d}}else rt.debug("Corner point skipping fixing",Math.abs(s.x-i.x),Math.abs(s.y-i.y));r.push(f,c)}else r.push(t[n]);return r},"fixCorners"),e9=v((t,e,r)=>{const n=t-e-r,i=2,s=2,o=i+s,a=Math.floor(n/o),c=Array(a).fill(`${i} ${s}`).join(" ");return`0 ${e} ${c} ${r}`},"generateDashArray"),r9=v(function(t,e,r,n,i,s,o,a=!1){var $;if(!o)throw new Error(`insertEdge: missing diagramId for edge "${e.id}" — edge IDs require a diagram prefix for uniqueness`);const{handDrawnSeed:c}=Vt();let h=e.points,u=!1;const d=i;var f=s;const p=[];for(const O in e.cssCompiledStyles)lv(O)||p.push(e.cssCompiledStyles[O]);rt.debug("UIO intersect check",e.points,f.x,d.x),f.intersect&&d.intersect&&!a&&(h=h.slice(1,e.points.length-1),h.unshift(d.intersect(h[0])),rt.debug("Last point UIO",e.start,"-->",e.end,h[h.length-1],f,f.intersect(h[h.length-1])),h.push(f.intersect(h[h.length-1])));const m=btoa(JSON.stringify(h));e.toCluster&&(rt.info("to cluster abc88",r.get(e.toCluster)),h=Nx(e.points,r.get(e.toCluster).node),u=!0),e.fromCluster&&(rt.debug("from cluster abc88",r.get(e.fromCluster),JSON.stringify(h,null,2)),h=Nx(h.reverse(),r.get(e.fromCluster).node).reverse(),u=!0);let x=h.filter(O=>!Number.isNaN(O.y));const g=Xz(e.curve);g!=="rounded"&&(x=t9(x));let y=Bo;switch(g){case"linear":y=Bo;break;case"basis":y=Yu;break;case"cardinal":y=q1;break;case"bumpX":y=$1;break;case"bumpY":y=D1;break;case"catmullRom":y=H1;break;case"monotoneX":y=K1;break;case"monotoneY":y=Q1;break;case"natural":y=J1;break;case"step":y=tC;break;case"stepAfter":y=rC;break;case"stepBefore":y=eC;break;case"rounded":y=Bo;break;default:y=Yu}const{x:k,y:b}=KD(e),w=M$().x(k).y(b).curve(y);let _;switch(e.thickness){case"normal":_="edge-thickness-normal";break;case"thick":_="edge-thickness-thick";break;case"invisible":_="edge-thickness-invisible";break;default:_="edge-thickness-normal"}switch(e.pattern){case"solid":_+=" edge-pattern-solid";break;case"dotted":_+=" edge-pattern-dotted";break;case"dashed":_+=" edge-pattern-dashed";break;default:_+=" edge-pattern-solid"}let T,S=g==="rounded"?h2(u2(x,e),5):w(x);const L=Array.isArray(e.style)?e.style:[e.style];let B=L.find(O=>O==null?void 0:O.startsWith("stroke:")),N="";e.animate&&(N="edge-animation-fast"),e.animation&&(N="edge-animation-"+e.animation);let A=!1;if(e.look==="handDrawn"){const O=mt.svg(t);Object.assign([],x);const D=O.path(S,{roughness:.3,seed:c});_+=" transition",T=Ot(D).select("path").attr("id",`${o}-${e.id}`).attr("class"," "+_+(e.classes?" "+e.classes:"")+(N?" "+N:"")).attr("style",L?L.reduce((Y,et)=>Y+";"+et,""):"");let j=T.attr("d");T.attr("d",j),t.node().appendChild(T.node())}else{const O=p.join(";"),D=L?L.reduce((X,lt)=>X+lt+";",""):"",j=(O?O+";"+D+";":D)+";"+(L?L.reduce((X,lt)=>X+";"+lt,""):"");T=t.append("path").attr("d",S).attr("id",`${o}-${e.id}`).attr("class"," "+_+(e.classes?" "+e.classes:"")+(N?" "+N:"")).attr("style",j),B=($=j.match(/stroke:([^;]+)/))==null?void 0:$[1],A=e.animate===!0||!!e.animation||O.includes("animation");const Y=T.node(),et=typeof Y.getTotalLength=="function"?Y.getTotalLength():0,M=Mg[e.arrowTypeStart]||0,ct=Mg[e.arrowTypeEnd]||0;if(e.look==="neo"&&!A){const lt=`stroke-dasharray: ${e.pattern==="dotted"||e.pattern==="dashed"?e9(et,M,ct):`0 ${M} ${et-M-ct} ${ct}`}; stroke-dashoffset: 0;`;T.attr("style",lt+T.attr("style"))}}T.attr("data-edge",!0),T.attr("data-et","edge"),T.attr("data-id",e.id),T.attr("data-points",m),T.attr("data-look",Be(e.look)),e.showPoints&&x.forEach(O=>{t.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",O.x).attr("cy",O.y)});let R="";(Vt().flowchart.arrowMarkerAbsolute||Vt().state.arrowMarkerAbsolute)&&(R=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,R=R.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),rt.info("arrowTypeStart",e.arrowTypeStart),rt.info("arrowTypeEnd",e.arrowTypeEnd);const z=!A&&(e==null?void 0:e.look)==="neo";Vz(T,e,R,o,n,z,B);const P=Math.floor(h.length/2),I=h[P];Ar.isLabelCoordinateInPath(I,T.attr("d"))||(u=!0);let F={};return u&&(F.updatedPath=h),F.originalPath=e.points,F},"insertEdge");function h2(t,e){if(t.length<2)return"";let r="";const n=t.length,i=1e-5;for(let s=0;s<n;s++){const o=t[s],a=t[s-1],c=t[s+1];if(s===0)r+=`M${o.x},${o.y}`;else if(s===n-1)r+=`L${o.x},${o.y}`;else{const h=o.x-a.x,u=o.y-a.y,d=c.x-o.x,f=c.y-o.y,p=Math.hypot(h,u),m=Math.hypot(d,f);if(p<i||m<i){r+=`L${o.x},${o.y}`;continue}const x=h/p,g=u/p,y=d/m,k=f/m,b=x*y+g*k,w=Math.max(-1,Math.min(1,b)),_=Math.acos(w);if(_<i||Math.abs(Math.PI-_)<i){r+=`L${o.x},${o.y}`;continue}const T=Math.min(e/Math.sin(_/2),p/2,m/2),S=o.x-x*T,L=o.y-g*T,B=o.x+y*T,N=o.y+k*T;r+=`L${S},${L}`,r+=`Q${o.x},${o.y} ${B},${N}`}}return r}v(h2,"generateRoundedPath");function wd(t,e){if(!t||!e)return{angle:0,deltaX:0,deltaY:0};const r=e.x-t.x,n=e.y-t.y;return{angle:Math.atan2(n,r),deltaX:r,deltaY:n}}v(wd,"calculateDeltaAndAngle");function u2(t,e){const r=t.map(i=>({...i}));if(t.length>=2&&ze[e.arrowTypeStart]){const i=ze[e.arrowTypeStart],s=t[0],o=t[1],{angle:a}=wd(s,o),c=i*Math.cos(a),h=i*Math.sin(a);r[0].x=s.x+c,r[0].y=s.y+h}const n=t.length;if(n>=2&&ze[e.arrowTypeEnd]){const i=ze[e.arrowTypeEnd],s=t[n-1],o=t[n-2],{angle:a}=wd(o,s),c=i*Math.cos(a),h=i*Math.sin(a);r[n-1].x=s.x-c,r[n-1].y=s.y-h}return r}v(u2,"applyMarkerOffsetsToPoints");var n9=v((t,e,r,n)=>{e.forEach(i=>{_9[i](t,r,n)})},"insertMarkers"),i9=v((t,e,r)=>{rt.trace("Making markers for ",r),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionStart").attr("class","marker extension "+e).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M 1,7 L18,13 V 1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionEnd").attr("class","marker extension "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z"),t.append("marker").attr("id",r+"_"+e+"-extensionStart-margin").attr("class","marker extension "+e).attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("viewBox","0 0 20 14").append("polygon").attr("points","10,7 18,13 18,1").style("stroke-width",2).style("stroke-dasharray","0"),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionEnd-margin").attr("class","marker extension "+e).attr("refX",9).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("viewBox","0 0 20 14").append("polygon").attr("points","10,1 10,13 18,7").style("stroke-width",2).style("stroke-dasharray","0")},"extension"),s9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionStart").attr("class","marker composition "+e).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionEnd").attr("class","marker composition "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionStart-margin").attr("class","marker composition "+e).attr("refX",15).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("viewBox","0 0 15 15").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionEnd-margin").attr("class","marker composition "+e).attr("refX",3.5).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),o9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationStart").attr("class","marker aggregation "+e).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationEnd").attr("class","marker aggregation "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationStart-margin").attr("class","marker aggregation "+e).attr("refX",15).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",2).attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationEnd-margin").attr("class","marker aggregation "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",2).attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),a9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyStart").attr("class","marker dependency "+e).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyEnd").attr("class","marker dependency "+e).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyStart-margin").attr("class","marker dependency "+e).attr("refX",4).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyEnd-margin").attr("class","marker dependency "+e).attr("refX",16).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),l9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopStart").attr("class","marker lollipop "+e).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopEnd").attr("class","marker lollipop "+e).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopStart-margin").attr("class","marker lollipop "+e).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6).attr("stroke-width",2),t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopEnd-margin").attr("class","marker lollipop "+e).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6).attr("stroke-width",2)},"lollipop"),c9=v((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-pointEnd").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-pointStart").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-pointEnd-margin").attr("class","marker "+e).attr("viewBox","0 0 11.5 14").attr("refX",11.5).attr("refY",7).attr("markerUnits","userSpaceOnUse").attr("markerWidth",10.5).attr("markerHeight",14).attr("orient","auto").append("path").attr("d","M 0 0 L 11.5 7 L 0 14 z").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-pointStart-margin").attr("class","marker "+e).attr("viewBox","0 0 11.5 14").attr("refX",1).attr("refY",7).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11.5).attr("markerHeight",14).attr("orient","auto").append("polygon").attr("points","0,7 11.5,14 11.5,0").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0")},"point"),h9=v((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-circleEnd").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-circleStart").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-circleEnd-margin").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refY",5).attr("refX",12.25).attr("markerUnits","userSpaceOnUse").attr("markerWidth",14).attr("markerHeight",14).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-circleStart-margin").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",-2).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",14).attr("markerHeight",14).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0")},"circle"),u9=v((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-crossEnd").attr("class","marker cross "+e).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-crossStart").attr("class","marker cross "+e).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-crossEnd-margin").attr("class","marker cross "+e).attr("viewBox","0 0 15 15").attr("refX",17.7).attr("refY",7.5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 1,1 L 14,14 M 1,14 L 14,1").attr("class","arrowMarkerPath").style("stroke-width",2.5),t.append("marker").attr("id",r+"_"+e+"-crossStart-margin").attr("class","marker cross "+e).attr("viewBox","0 0 15 15").attr("refX",-3.5).attr("refY",7.5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 1,1 L 14,14 M 1,14 L 14,1").attr("class","arrowMarkerPath").style("stroke-width",2.5).style("stroke-dasharray","1,0")},"cross"),d9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),p9=v((t,e,r)=>{const n=me(),{themeVariables:i}=n,{transitionColor:s}=i;t.append("defs").append("marker").attr("id",r+"_"+e+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L11,14 L13,7 L11,0 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-barbEnd-margin").attr("refX",17).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L11,14 L13,7 L11,0 Z").attr("fill",`${s}`)},"barbNeo"),f9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-onlyOneStart").attr("class","marker onlyOne "+e).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M9,0 L9,18 M15,0 L15,18"),t.append("defs").append("marker").attr("id",r+"_"+e+"-onlyOneEnd").attr("class","marker onlyOne "+e).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M3,0 L3,18 M9,0 L9,18")},"only_one"),m9=v((t,e,r)=>{const n=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrOneStart").attr("class","marker zeroOrOne "+e).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),n.append("path").attr("d","M9,0 L9,18");const i=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+e).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),i.append("path").attr("d","M21,0 L21,18")},"zero_or_one"),g9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-oneOrMoreStart").attr("class","marker oneOrMore "+e).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),t.append("defs").append("marker").attr("id",r+"_"+e+"-oneOrMoreEnd").attr("class","marker oneOrMore "+e).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18")},"one_or_more"),x9=v((t,e,r)=>{const n=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+e).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),n.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18");const i=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+e).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),i.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},"zero_or_more"),y9=v((t,e,r)=>{const n=me(),{themeVariables:i}=n,{strokeWidth:s}=i;t.append("defs").append("marker").attr("id",r+"_"+e+"-onlyOneStart").attr("class","marker onlyOne "+e).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M9,0 L9,18 M15,0 L15,18").attr("stroke-width",`${s}`),t.append("defs").append("marker").attr("id",r+"_"+e+"-onlyOneEnd").attr("class","marker onlyOne "+e).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M3,0 L3,18 M9,0 L9,18").attr("stroke-width",`${s}`)},"only_one_neo"),b9=v((t,e,r)=>{const n=me(),{themeVariables:i}=n,{strokeWidth:s,mainBkg:o}=i,a=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrOneStart").attr("class","marker zeroOrOne "+e).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto").attr("markerUnits","userSpaceOnUse");a.append("circle").attr("fill",o??"white").attr("cx",21).attr("cy",9).attr("stroke-width",`${s}`).attr("r",6),a.append("path").attr("d","M9,0 L9,18").attr("stroke-width",`${s}`);const c=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+e).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("markerUnits","userSpaceOnUse").attr("orient","auto");c.append("circle").attr("fill",o??"white").attr("cx",9).attr("cy",9).attr("stroke-width",`${s}`).attr("r",6),c.append("path").attr("d","M21,0 L21,18").attr("stroke-width",`${s}`)},"zero_or_one_neo"),C9=v((t,e,r)=>{const n=me(),{themeVariables:i}=n,{strokeWidth:s}=i;t.append("defs").append("marker").attr("id",r+"_"+e+"-oneOrMoreStart").attr("class","marker oneOrMore "+e).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27").attr("stroke-width",`${s}`),t.append("defs").append("marker").attr("id",r+"_"+e+"-oneOrMoreEnd").attr("class","marker oneOrMore "+e).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18").attr("stroke-width",`${s}`)},"one_or_more_neo"),k9=v((t,e,r)=>{const n=me(),{themeVariables:i}=n,{strokeWidth:s,mainBkg:o}=i,a=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+e).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("markerUnits","userSpaceOnUse").attr("orient","auto");a.append("circle").attr("fill",o??"white").attr("cx",45.5).attr("cy",18).attr("r",6).attr("stroke-width",`${s}`),a.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18").attr("stroke-width",`${s}`);const c=t.append("defs").append("marker").attr("id",r+"_"+e+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+e).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto").attr("markerUnits","userSpaceOnUse");c.append("circle").attr("fill",o??"white").attr("cx",11).attr("cy",18).attr("r",6).attr("stroke-width",`${s}`),c.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18").attr("stroke-width",`${s}`)},"zero_or_more_neo"),v9=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0
632
- L20,10
633
- M20,10
634
- L0,20`)},"requirement_arrow"),w9=v((t,e,r)=>{const n=me(),{themeVariables:i}=n,{strokeWidth:s}=i;t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("stroke-width",`${s}`).attr("viewBox","0 0 25 20").append("path").attr("d",`M0,0
635
- L20,10
636
- M20,10
637
- L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),S9=v((t,e,r)=>{const n=t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");n.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),n.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),n.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),T9=v((t,e,r)=>{const n=me(),{themeVariables:i}=n,{strokeWidth:s}=i,o=t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");o.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),o.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),o.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),o.selectAll("*").attr("stroke-width",`${s}`)},"requirement_contains_neo"),_9={extension:i9,composition:s9,aggregation:o9,dependency:a9,lollipop:l9,point:c9,circle:h9,cross:u9,barb:d9,barbNeo:p9,only_one:f9,zero_or_one:m9,one_or_more:g9,zero_or_more:x9,only_one_neo:y9,zero_or_one_neo:b9,one_or_more_neo:C9,zero_or_more_neo:k9,requirement_arrow:v9,requirement_contains:S9,requirement_arrow_neo:w9,requirement_contains_neo:T9},j9=n9,N9={common:ca,getConfig:me,insertCluster:Tz,insertEdge:r9,insertEdgeLabel:Kz,insertMarkers:j9,insertNode:l2,interpolateToCurve:ef,labelHelper:Et,log:rt,positionEdgeLabel:Qz},Zo={},d2=v(t=>{for(const e of t)Zo[e.name]=e},"registerLayoutLoaders"),E9=v(()=>{d2([{name:"dagre",loader:v(async()=>await Ht(()=>import("./dagre-KV5264BT-CTcTVGdU.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),"loader")},{name:"cose-bilkent",loader:v(async()=>await Ht(()=>import("./cose-bilkent-S5V4N54A-DzzRyJtB.js"),__vite__mapDeps([11,10,6,7,8,9])),"loader")}])},"registerDefaultLayoutLoaders");E9();var qK=v(async(t,e)=>{if(!(t.layoutAlgorithm in Zo))throw new Error(`Unknown layout algorithm: ${t.layoutAlgorithm}`);if(t.diagramId)for(const u of t.nodes){const d=u.domId||u.id;u.domId=`${t.diagramId}-${d}`}const r=Zo[t.layoutAlgorithm],n=await r.loader(),{theme:i,themeVariables:s}=t.config,{useGradient:o,gradientStart:a,gradientStop:c}=s,h=e.attr("id");if(e.append("defs").append("filter").attr("id",`${h}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${i!=null&&i.includes("dark")?"#FFFFFF":"#000000"}`),e.append("defs").append("filter").attr("id",`${h}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${i!=null&&i.includes("dark")?"#FFFFFF":"#000000"}`),o){const u=e.append("linearGradient").attr("id",e.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");u.append("svg:stop").attr("offset","0%").attr("stop-color",a).attr("stop-opacity",1),u.append("svg:stop").attr("offset","100%").attr("stop-color",c).attr("stop-opacity",1)}return n.render(t,e,N9,{algorithm:r.algorithm})},"render"),WK=v((t="",{fallback:e="dagre"}={})=>{if(t in Zo)return t;if(e in Zo)return rt.warn(`Layout algorithm ${t} is not registered. Using ${e} as fallback.`),e;throw new Error(`Both layout algorithms ${t} and ${e} are not registered.`)},"getRegisteredLayoutAlgorithm"),p2="comm",f2="rule",m2="decl",L9="@import",B9="@namespace",A9="@keyframes",M9="@layer",g2=Math.abs,wf=String.fromCharCode;function x2(t){return t.trim()}function pl(t,e,r){return t.replace(e,r)}function I9(t,e,r){return t.indexOf(e,r)}function Vi(t,e){return t.charCodeAt(e)|0}function xs(t,e,r){return t.slice(e,r)}function Vr(t){return t.length}function F9(t){return t.length}function Wa(t,e){return e.push(t),t}var Zc=1,ys=1,y2=0,Sr=0,we=0,Ns="";function Sf(t,e,r,n,i,s,o,a){return{value:t,root:e,parent:r,type:n,props:i,children:s,line:Zc,column:ys,length:o,return:"",siblings:a}}function P9(){return we}function $9(){return we=Sr>0?Vi(Ns,--Sr):0,ys--,we===10&&(ys=1,Zc--),we}function Pr(){return we=Sr<y2?Vi(Ns,Sr++):0,ys++,we===10&&(ys=1,Zc++),we}function jn(){return Vi(Ns,Sr)}function fl(){return Sr}function Jc(t,e){return xs(Ns,t,e)}function Jo(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function D9(t){return Zc=ys=1,y2=Vr(Ns=t),Sr=0,[]}function O9(t){return Ns="",t}function ru(t){return x2(Jc(Sr-1,Sd(t===91?t+2:t===40?t+1:t)))}function R9(t){for(;(we=jn())&&we<33;)Pr();return Jo(t)>2||Jo(we)>3?"":" "}function z9(t,e){for(;--e&&Pr()&&!(we<48||we>102||we>57&&we<65||we>70&&we<97););return Jc(t,fl()+(e<6&&jn()==32&&Pr()==32))}function Sd(t){for(;Pr();)switch(we){case t:return Sr;case 34:case 39:t!==34&&t!==39&&Sd(we);break;case 40:t===41&&Sd(t);break;case 92:Pr();break}return Sr}function q9(t,e){for(;Pr()&&t+we!==57;)if(t+we===84&&jn()===47)break;return"/*"+Jc(e,Sr-1)+"*"+wf(t===47?t:Pr())}function W9(t){for(;!Jo(jn());)Pr();return Jc(t,Sr)}function H9(t){return O9(ml("",null,null,null,[""],t=D9(t),0,[0],t))}function ml(t,e,r,n,i,s,o,a,c){for(var h=0,u=0,d=o,f=0,p=0,m=0,x=1,g=1,y=1,k=0,b="",w=i,_=s,T=n,S=b;g;)switch(m=k,k=Pr()){case 40:if(m!=108&&Vi(S,d-1)==58){I9(S+=pl(ru(k),"&","&\f"),"&\f",g2(h?a[h-1]:0))!=-1&&(y=-1);break}case 34:case 39:case 91:S+=ru(k);break;case 9:case 10:case 13:case 32:S+=R9(m);break;case 92:S+=z9(fl()-1,7);continue;case 47:switch(jn()){case 42:case 47:Wa(U9(q9(Pr(),fl()),e,r,c),c),(Jo(m||1)==5||Jo(jn()||1)==5)&&Vr(S)&&xs(S,-1,void 0)!==" "&&(S+=" ");break;default:S+="/"}break;case 123*x:a[h++]=Vr(S)*y;case 125*x:case 59:case 0:switch(k){case 0:case 125:g=0;case 59+u:y==-1&&(S=pl(S,/\f/g,"")),p>0&&(Vr(S)-d||x===0&&m===47)&&Wa(p>32?Bx(S+";",n,r,d-1,c):Bx(pl(S," ","")+";",n,r,d-2,c),c);break;case 59:S+=";";default:if(Wa(T=Lx(S,e,r,h,u,i,a,b,w=[],_=[],d,s),s),k===123)if(u===0)ml(S,e,T,T,w,s,d,a,_);else{switch(f){case 99:if(Vi(S,3)===110)break;case 108:if(Vi(S,2)===97)break;default:u=0;case 100:case 109:case 115:}u?ml(t,T,T,n&&Wa(Lx(t,T,T,0,0,i,a,b,i,w=[],d,_),_),i,_,d,a,n?w:_):ml(S,T,T,T,[""],_,0,a,_)}}h=u=p=0,x=y=1,b=S="",d=o;break;case 58:d=1+Vr(S),p=m;default:if(x<1){if(k==123)--x;else if(k==125&&x++==0&&$9()==125)continue}switch(S+=wf(k),k*x){case 38:y=u>0?1:(S+="\f",-1);break;case 44:a[h++]=(Vr(S)-1)*y,y=1;break;case 64:jn()===45&&(S+=ru(Pr())),f=jn(),u=d=Vr(b=S+=W9(fl())),k++;break;case 45:m===45&&Vr(S)==2&&(x=0)}}return s}function Lx(t,e,r,n,i,s,o,a,c,h,u,d){for(var f=i-1,p=i===0?s:[""],m=F9(p),x=0,g=0,y=0;x<n;++x)for(var k=0,b=xs(t,f+1,f=g2(g=o[x])),w=t;k<m;++k)(w=x2(g>0?p[k]+" "+b:pl(b,/&\f/g,p[k])))&&(c[y++]=w);return Sf(t,e,r,i===0?f2:a,c,h,u,d)}function U9(t,e,r,n){return Sf(t,e,r,p2,wf(P9()),xs(t,2,-2),0,n)}function Bx(t,e,r,n,i){return Sf(t,e,r,m2,xs(t,0,n),xs(t,n+1,-1),n,i)}function Td(t,e){for(var r="",n=0;n<t.length;n++)r+=e(t[n],n,t,e)||"";return r}function V9(t,e,r,n){switch(t.type){case M9:if(t.children.length)break;case L9:case B9:case m2:return t.return=t.return||t.value;case p2:return"";case A9:return t.return=t.value+"{"+Td(t.children,n)+"}";case f2:if(!Vr(t.value=t.props.join(",")))return""}return Vr(r=Td(t.children,n))?t.return=t.value+"{"+r+"}":""}var Y9=zk(Object.keys,Object),G9=Object.prototype,X9=G9.hasOwnProperty;function K9(t){if(!Wc(t))return Y9(t);var e=[];for(var r in Object(t))X9.call(t,r)&&r!="constructor"&&e.push(r);return e}var _d=Ci(rn,"DataView"),jd=Ci(rn,"Promise"),Nd=Ci(rn,"Set"),Ed=Ci(rn,"WeakMap"),Ax="[object Map]",Q9="[object Object]",Mx="[object Promise]",Ix="[object Set]",Fx="[object WeakMap]",Px="[object DataView]",Z9=bi(_d),J9=bi(Ko),t7=bi(jd),e7=bi(Nd),r7=bi(Ed),Gn=Ss;(_d&&Gn(new _d(new ArrayBuffer(1)))!=Px||Ko&&Gn(new Ko)!=Ax||jd&&Gn(jd.resolve())!=Mx||Nd&&Gn(new Nd)!=Ix||Ed&&Gn(new Ed)!=Fx)&&(Gn=function(t){var e=Ss(t),r=e==Q9?t.constructor:void 0,n=r?bi(r):"";if(n)switch(n){case Z9:return Px;case J9:return Ax;case t7:return Mx;case e7:return Ix;case r7:return Fx}return e});var n7="[object Map]",i7="[object Set]",s7=Object.prototype,o7=s7.hasOwnProperty;function $x(t){if(t==null)return!0;if(Hc(t)&&(tc(t)||typeof t=="string"||typeof t.splice=="function"||Jp(t)||tf(t)||Jl(t)))return!t.length;var e=Gn(t);if(e==n7||e==i7)return!t.size;if(Wc(t))return!K9(t).length;for(var r in t)if(o7.call(t,r))return!1;return!0}var b2="c4",a7=v(t=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(t),"detector"),l7=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./c4Diagram-AHTNJAMY-nBIRLJTv.js");return{diagram:e}},__vite__mapDeps([12,13,6,7,8,9,10]));return{id:b2,diagram:t}},"loader"),c7={id:b2,detector:a7,loader:l7},h7=c7,C2="flowchart",u7=v((t,e)=>{var r,n;return((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="dagre-wrapper"||((n=e==null?void 0:e.flowchart)==null?void 0:n.defaultRenderer)==="elk"?!1:/^\s*graph/.test(t)},"detector"),d7=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./flowDiagram-DWJPFMVM-BzzO4JYU.js");return{diagram:e}},__vite__mapDeps([14,15,13,16,17,18,6,7,8,9,10]));return{id:C2,diagram:t}},"loader"),p7={id:C2,detector:u7,loader:d7},f7=p7,k2="flowchart-v2",m7=v((t,e)=>{var r,n,i;return((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="dagre-d3"?!1:(((n=e==null?void 0:e.flowchart)==null?void 0:n.defaultRenderer)==="elk"&&(e.layout="elk"),/^\s*graph/.test(t)&&((i=e==null?void 0:e.flowchart)==null?void 0:i.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(t))},"detector"),g7=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./flowDiagram-DWJPFMVM-BzzO4JYU.js");return{diagram:e}},__vite__mapDeps([14,15,13,16,17,18,6,7,8,9,10]));return{id:k2,diagram:t}},"loader"),x7={id:k2,detector:m7,loader:g7},y7=x7,v2="er",b7=v(t=>/^\s*erDiagram/.test(t),"detector"),C7=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./erDiagram-SMLLAGMA-CtxJi57K.js");return{diagram:e}},__vite__mapDeps([19,16,17,18,6,7,8,9,10]));return{id:v2,diagram:t}},"loader"),k7={id:v2,detector:b7,loader:C7},v7=k7,w2="gitGraph",w7=v(t=>/^\s*gitGraph/.test(t),"detector"),S7=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./gitGraphDiagram-UUTBAWPF-tnNFXfMM.js");return{diagram:e}},__vite__mapDeps([20,21,22,23,8,6,7,9,4,2,10]));return{id:w2,diagram:t}},"loader"),T7={id:w2,detector:w7,loader:S7},_7=T7,S2="gantt",j7=v(t=>/^\s*gantt/.test(t),"detector"),N7=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./ganttDiagram-T4ZO3ILL-Dn0wIyhR.js");return{diagram:e}},__vite__mapDeps([24,6,7,25,26,27,8,9,10]));return{id:S2,diagram:t}},"loader"),E7={id:S2,detector:j7,loader:N7},L7=E7,T2="info",B7=v(t=>/^\s*info/.test(t),"detector"),A7=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./infoDiagram-42DDH7IO-BXLvLeS0.js");return{diagram:e}},__vite__mapDeps([28,23,8,6,7,9,4,2,10]));return{id:T2,diagram:t}},"loader"),M7={id:T2,detector:B7,loader:A7},_2="pie",I7=v(t=>/^\s*pie/.test(t),"detector"),F7=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./pieDiagram-DEJITSTG-gglmeMav.js");return{diagram:e}},__vite__mapDeps([29,21,23,8,6,7,9,4,2,30,31,26,10]));return{id:_2,diagram:t}},"loader"),P7={id:_2,detector:I7,loader:F7},j2="quadrantChart",$7=v(t=>/^\s*quadrantChart/.test(t),"detector"),D7=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./quadrantDiagram-34T5L4WZ-CqFC_htU.js");return{diagram:e}},__vite__mapDeps([32,25,26,27,6,7,8,9,10]));return{id:j2,diagram:t}},"loader"),O7={id:j2,detector:$7,loader:D7},R7=O7,N2="xychart",z7=v(t=>/^\s*xychart(-beta)?/.test(t),"detector"),q7=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./xychartDiagram-5P7HB3ND-CynkZcUb.js");return{diagram:e}},__vite__mapDeps([33,26,31,25,27,6,7,8,9,10]));return{id:N2,diagram:t}},"loader"),W7={id:N2,detector:z7,loader:q7},H7=W7,E2="requirement",U7=v(t=>/^\s*requirement(Diagram)?/.test(t),"detector"),V7=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./requirementDiagram-MS252O5E-B1ZFIotK.js");return{diagram:e}},__vite__mapDeps([34,16,17,6,7,8,9,10]));return{id:E2,diagram:t}},"loader"),Y7={id:E2,detector:U7,loader:V7},G7=Y7,L2="sequence",X7=v(t=>/^\s*sequenceDiagram/.test(t),"detector"),K7=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./sequenceDiagram-FGHM5R23-CAIn5Z3U.js");return{diagram:e}},__vite__mapDeps([35,13,22,6,7,8,9,10]));return{id:L2,diagram:t}},"loader"),Q7={id:L2,detector:X7,loader:K7},Z7=Q7,B2="class",J7=v((t,e)=>{var r;return((r=e==null?void 0:e.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(t)},"detector"),tq=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./classDiagram-6PBFFD2Q-DshSQDF9.js");return{diagram:e}},__vite__mapDeps([36,37,15,13,16,17,6,7,8,9,10]));return{id:B2,diagram:t}},"loader"),eq={id:B2,detector:J7,loader:tq},rq=eq,A2="classDiagram",nq=v((t,e)=>{var r;return/^\s*classDiagram/.test(t)&&((r=e==null?void 0:e.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(t)},"detector"),iq=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./classDiagram-v2-HSJHXN6E-DshSQDF9.js");return{diagram:e}},__vite__mapDeps([38,37,15,13,16,17,6,7,8,9,10]));return{id:A2,diagram:t}},"loader"),sq={id:A2,detector:nq,loader:iq},oq=sq,M2="state",aq=v((t,e)=>{var r;return((r=e==null?void 0:e.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(t)},"detector"),lq=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./stateDiagram-FHFEXIEX-CyJrGzib.js");return{diagram:e}},__vite__mapDeps([39,40,16,17,1,2,3,4,6,7,8,9,10]));return{id:M2,diagram:t}},"loader"),cq={id:M2,detector:aq,loader:lq},hq=cq,I2="stateDiagram",uq=v((t,e)=>{var r;return!!(/^\s*stateDiagram-v2/.test(t)||/^\s*stateDiagram/.test(t)&&((r=e==null?void 0:e.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper")},"detector"),dq=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./stateDiagram-v2-QKLJ7IA2-DprhF_Ho.js");return{diagram:e}},__vite__mapDeps([41,40,16,17,6,7,8,9,10]));return{id:I2,diagram:t}},"loader"),pq={id:I2,detector:uq,loader:dq},fq=pq,F2="journey",mq=v(t=>/^\s*journey/.test(t),"detector"),gq=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./journeyDiagram-VCZTEJTY-C42hXNha.js");return{diagram:e}},__vite__mapDeps([42,15,13,30,6,7,8,9,10]));return{id:F2,diagram:t}},"loader"),xq={id:F2,detector:mq,loader:gq},yq=xq,bq=v((t,e,r)=>{rt.debug(`rendering svg for syntax error
638
- `);const n=q$(e),i=n.append("g");n.attr("viewBox","0 0 2412 512"),o1(n,100,512,!0),i.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),i.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),i.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),i.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),i.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),i.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),i.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),i.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),P2={draw:bq},Cq=P2,kq={db:{},renderer:P2,parser:{parse:v(()=>{},"parse")}},vq=kq,$2="flowchart-elk",wq=v((t,e={})=>{var r;return/^\s*flowchart-elk/.test(t)||/^\s*(flowchart|graph)/.test(t)&&((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="elk"?(e.layout="elk",!0):!1},"detector"),Sq=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./flowDiagram-DWJPFMVM-BzzO4JYU.js");return{diagram:e}},__vite__mapDeps([14,15,13,16,17,18,6,7,8,9,10]));return{id:$2,diagram:t}},"loader"),Tq={id:$2,detector:wq,loader:Sq},_q=Tq,D2="timeline",jq=v(t=>/^\s*timeline/.test(t),"detector"),Nq=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./timeline-definition-GMOUNBTQ-k_0vJQAK.js");return{diagram:e}},__vite__mapDeps([43,30,6,7,8,9,10]));return{id:D2,diagram:t}},"loader"),Eq={id:D2,detector:jq,loader:Nq},Lq=Eq,O2="mindmap",Bq=v(t=>/^\s*mindmap/.test(t),"detector"),Aq=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./mindmap-definition-QFDTVHPH-d9SSh2nG.js");return{diagram:e}},__vite__mapDeps([44,16,17,6,7,8,9,10]));return{id:O2,diagram:t}},"loader"),Mq={id:O2,detector:Bq,loader:Aq},Iq=Mq,R2="kanban",Fq=v(t=>/^\s*kanban/.test(t),"detector"),Pq=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./kanban-definition-6JOO6SKY-CEq930ew.js");return{diagram:e}},__vite__mapDeps([45,15,6,7,8,9,10]));return{id:R2,diagram:t}},"loader"),$q={id:R2,detector:Fq,loader:Pq},Dq=$q,z2="sankey",Oq=v(t=>/^\s*sankey(-beta)?/.test(t),"detector"),Rq=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./sankeyDiagram-XADWPNL6-BvItvZt5.js");return{diagram:e}},__vite__mapDeps([46,31,26,6,7,8,9,10]));return{id:z2,diagram:t}},"loader"),zq={id:z2,detector:Oq,loader:Rq},qq=zq,q2="packet",Wq=v(t=>/^\s*packet(-beta)?/.test(t),"detector"),Hq=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./diagram-TYMM5635-q8Id8eFG.js");return{diagram:e}},__vite__mapDeps([47,21,23,8,6,7,9,4,2,10]));return{id:q2,diagram:t}},"loader"),Uq={id:q2,detector:Wq,loader:Hq},W2="radar",Vq=v(t=>/^\s*radar-beta/.test(t),"detector"),Yq=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./diagram-MMDJMWI5-B68cPonH.js");return{diagram:e}},__vite__mapDeps([48,21,23,8,6,7,9,4,2,10]));return{id:W2,diagram:t}},"loader"),Gq={id:W2,detector:Vq,loader:Yq},H2="block",Xq=v(t=>/^\s*block(-beta)?/.test(t),"detector"),Kq=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./blockDiagram-DXYQGD6D-BgcMJjAR.js");return{diagram:e}},__vite__mapDeps([49,15,5,1,2,18,6,7,8,9,10]));return{id:H2,diagram:t}},"loader"),Qq={id:H2,detector:Xq,loader:Kq},Zq=Qq,U2="treeView",Jq=v(t=>/^\s*treeView-beta/.test(t),"detector"),tW=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./diagram-5BDNPKRD-qR6mc8kJ.js");return{diagram:e}},__vite__mapDeps([50,21,22,23,8,6,7,9,4,2,10]));return{id:U2,diagram:t}},"loader"),eW={id:U2,detector:Jq,loader:tW},rW=eW,V2="architecture",nW=v(t=>/^\s*architecture/.test(t),"detector"),iW=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./architectureDiagram-Q4EWVU46-BV1r86-w.js");return{diagram:e}},__vite__mapDeps([51,21,23,8,6,7,9,4,2,10]));return{id:V2,diagram:t}},"loader"),sW={id:V2,detector:nW,loader:iW},oW=sW,Y2="ishikawa",aW=v(t=>/^\s*ishikawa(-beta)?\b/i.test(t),"detector"),lW=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./ishikawaDiagram-UXIWVN3A-DWx-7BBy.js");return{diagram:e}},__vite__mapDeps([52,6,7,8,9,10]));return{id:Y2,diagram:t}},"loader"),cW={id:Y2,detector:aW,loader:lW},G2="venn",hW=v(t=>/^\s*venn-beta/.test(t),"detector"),uW=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./vennDiagram-DHZGUBPP-TZAW60b0.js");return{diagram:e}},__vite__mapDeps([53,6,7,8,9,10]));return{id:G2,diagram:t}},"loader"),dW={id:G2,detector:hW,loader:uW},pW=dW,X2="treemap",fW=v(t=>/^\s*treemap/.test(t),"detector"),mW=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./diagram-G4DWMVQ6-CUcGXyNb.js");return{diagram:e}},__vite__mapDeps([54,17,21,23,8,6,7,9,4,2,27,31,26,10]));return{id:X2,diagram:t}},"loader"),gW={id:X2,detector:fW,loader:mW},K2="wardley-beta",xW=v(t=>/^\s*wardley-beta/i.test(t),"detector"),yW=v(async()=>{const{diagram:t}=await Ht(async()=>{const{diagram:e}=await import("./wardleyDiagram-NUSXRM2D-BAoVVIjZ.js");return{diagram:e}},__vite__mapDeps([55,21,23,8,6,7,9,4,2,10]));return{id:K2,diagram:t}},"loader"),bW={id:K2,detector:xW,loader:yW},CW=bW,Dx=!1,th=v(()=>{Dx||(Dx=!0,Fl("error",vq,t=>t.toLowerCase().trim()==="error"),Fl("---",{db:{clear:v(()=>{},"clear")},styles:{},renderer:{draw:v(()=>{},"draw")},parser:{parse:v(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:v(()=>null,"init")},t=>t.toLowerCase().trimStart().startsWith("---")),Mu(_q,Iq,oW),Mu(h7,Dq,oq,rq,v7,L7,M7,P7,G7,Z7,y7,f7,Lq,_7,fq,hq,yq,R7,qq,Uq,H7,Zq,rW,Gq,cW,gW,pW,CW))},"addDiagrams"),kW=v(async()=>{rt.debug("Loading registered diagrams");const e=(await Promise.allSettled(Object.entries(ai).map(async([r,{detector:n,loader:i}])=>{if(i)try{$u(r)}catch{try{const{diagram:s,id:o}=await i();Fl(o,s,n)}catch(s){throw rt.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete ai[r],s}}}))).filter(r=>r.status==="rejected");if(e.length>0){rt.error(`Failed to load ${e.length} external diagrams`);for(const r of e)rt.error(r);throw new Error(`Failed to load ${e.length} external diagrams`)}},"loadRegisteredDiagrams"),vW="graphics-document document";function Q2(t,e){t.attr("role",vW),e!==""&&t.attr("aria-roledescription",e)}v(Q2,"setA11yDiagramInfo");function Z2(t,e,r,n){if(t.insert!==void 0){if(r){const i=`chart-desc-${n}`;t.attr("aria-describedby",i),t.insert("desc",":first-child").attr("id",i).text(r)}if(e){const i=`chart-title-${n}`;t.attr("aria-labelledby",i),t.insert("title",":first-child").attr("id",i).text(e)}}}v(Z2,"addSVGa11yTitleDescription");var ni,Ld=(ni=class{constructor(e,r,n,i,s){this.type=e,this.text=r,this.db=n,this.parser=i,this.renderer=s}static async fromText(e,r={}){var h,u;const n=me(),i=Tp(e,n);e=U6(e)+`
639
- `;try{$u(i)}catch{const d=aI(i);if(!d)throw new Vb(`Diagram ${i} not found.`);const{id:f,diagram:p}=await d();Fl(f,p)}const{db:s,parser:o,renderer:a,init:c}=$u(i);return o.parser&&(o.parser.yy=s),(h=s.clear)==null||h.call(s),c==null||c(n),r.title&&((u=s.setDiagramTitle)==null||u.call(s,r.title)),await o.parse(e),new ni(i,e,s,o,a)}async render(e,r){await this.renderer.draw(this.text,e,r,this)}getParser(){return this.parser}getType(){return this.type}},v(ni,"Diagram"),ni),Ox=[],wW=v(()=>{Ox.forEach(t=>{t()}),Ox=[]},"attachFunctions"),SW=v(t=>t.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function J2(t){const e=t.match(Ub);if(!e)return{text:t,metadata:{}};let r=XD(e[1],{schema:GD})??{};r=typeof r=="object"&&!Array.isArray(r)?r:{};const n={};return r.displayMode&&(n.displayMode=r.displayMode.toString()),r.title&&(n.title=r.title.toString()),r.config&&(n.config=r.config),{text:t.slice(e[0].length),metadata:n}}v(J2,"extractFrontMatter");var TW=v(t=>t.replace(/\r\n?/g,`
640
- `).replace(/<(\w+)([^>]*)>/g,(e,r,n)=>"<"+r+n.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),_W=v(t=>{const{text:e,metadata:r}=J2(t),{displayMode:n,title:i,config:s={}}=r;return n&&(s.gantt||(s.gantt={}),s.gantt.displayMode=n),{title:i,config:s,text:e}},"processFrontmatter"),jW=v(t=>{const e=Ar.detectInit(t)??{},r=Ar.detectDirective(t,"wrap");return Array.isArray(r)?e.wrap=r.some(({type:n})=>n==="wrap"):(r==null?void 0:r.type)==="wrap"&&(e.wrap=!0),{text:A6(t),directive:e}},"processDirectives");function Tf(t){const e=TW(t),r=_W(e),n=jW(r.text),i=af(r.config,n.directive);return t=SW(n.text),{code:t,title:r.title,config:i}}v(Tf,"preprocessDiagram");function tS(t){const e=new TextEncoder().encode(t),r=Array.from(e,n=>String.fromCodePoint(n)).join("");return btoa(r)}v(tS,"toBase64");var NW=5e4,EW="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",LW="sandbox",BW="loose",AW="http://www.w3.org/2000/svg",MW="http://www.w3.org/1999/xlink",IW="http://www.w3.org/1999/xhtml",FW="100%",PW="100%",$W="border:0;margin:0;",DW="margin:0",OW="allow-top-navigation-by-user-activation allow-popups",RW='The "iframe" tag is not supported by your browser.',zW=["foreignobject"],qW=["dominant-baseline"];function _f(t){const e=Tf(t);return Ml(),FI(e.config??{}),e}v(_f,"processAndSetConfigs");async function eS(t,e){th();try{const{code:r,config:n}=_f(t);return{diagramType:(await nS(r)).type,config:n}}catch(r){if(e!=null&&e.suppressErrors)return!1;throw r}}v(eS,"parse");var Rx=v((t,e,r=[])=>`
641
- .${t} ${e} { ${r.join(" !important; ")} !important; }`,"cssImportantStyles"),WW=v((t,e=new Map)=>{let r="";if(t.themeCSS!==void 0&&(r+=`
642
- ${t.themeCSS}`),t.fontFamily!==void 0&&(r+=`
643
- :root { --mermaid-font-family: ${t.fontFamily}}`),t.altFontFamily!==void 0&&(r+=`
644
- :root { --mermaid-alt-font-family: ${t.altFontFamily}}`),e instanceof Map){const o=er(t)?["> *","span"]:["rect","polygon","ellipse","circle","path"];e.forEach(a=>{$x(a.styles)||o.forEach(c=>{r+=Rx(a.id,c,a.styles)}),$x(a.textStyles)||(r+=Rx(a.id,"tspan",((a==null?void 0:a.textStyles)||[]).map(c=>c.replace("color","fill"))))})}return r},"createCssStyles"),HW=v((t,e,r,n)=>{const i=WW(t,r),s=t4(e,i,{...t.themeVariables,theme:t.theme,look:t.look},n);return Td(H9(`${n}{${s}}`),V9)},"createUserStyles"),UW=v((t="",e,r)=>{let n=t;return!r&&!e&&(n=n.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,'marker-end="url(#')),n=di(n),n=n.replace(/<br>/g,"<br/>"),n},"cleanUpSvgCode"),VW=v((t="",e)=>{var i,s;const r=(s=(i=e==null?void 0:e.viewBox)==null?void 0:i.baseVal)!=null&&s.height?e.viewBox.baseVal.height+"px":PW,n=tS(`<body style="${DW}">${t}</body>`);return`<iframe style="width:${FW};height:${r};${$W}" src="data:text/html;charset=UTF-8;base64,${n}" sandbox="${OW}">
645
- ${RW}
646
- </iframe>`},"putIntoIFrame"),zx=v((t,e,r,n,i)=>{const s=t.append("div");s.attr("id",r),n&&s.attr("style",n);const o=s.append("svg").attr("id",e).attr("width","100%").attr("xmlns",AW);return i&&o.attr("xmlns:xlink",i),o.append("g"),t},"appendDivSvgG");function Bd(t,e){return t.append("iframe").attr("id",e).attr("style","width: 100%; height: 100%;").attr("sandbox","")}v(Bd,"sandboxedIframe");var YW=v((t,e,r,n)=>{var i,s,o;(i=t.getElementById(e))==null||i.remove(),(s=t.getElementById(r))==null||s.remove(),(o=t.getElementById(n))==null||o.remove()},"removeExistingElements"),GW=v(async function(t,e,r){var R,z,P,I,F,$;th();const n=_f(e);e=n.code;const i=me();rt.debug(i),e.length>((i==null?void 0:i.maxTextSize)??NW)&&(e=EW);const s="#"+t,o="i"+t,a="#"+o,c="d"+t,h="#"+c,u=v(()=>{const D=Ot(f?a:h).node();D&&"remove"in D&&D.remove()},"removeTempElements");let d=Ot("body");const f=i.securityLevel===LW,p=i.securityLevel===BW,m=i.fontFamily;if(r!==void 0){if(r&&(r.innerHTML=""),f){const O=Bd(Ot(r),o);d=Ot(O.nodes()[0].contentDocument.body),d.node().style.margin=0}else d=Ot(r);zx(d,t,c,`font-family: ${m}`,MW)}else{if(YW(document,t,c,o),f){const O=Bd(Ot("body"),o);d=Ot(O.nodes()[0].contentDocument.body),d.node().style.margin=0}else d=Ot("body");zx(d,t,c)}let x,g;try{x=await Ld.fromText(e,{title:n.title})}catch(O){if(i.suppressErrorRendering)throw u(),O;x=await Ld.fromText("error"),g=O}const y=d.select(h).node(),k=x.type,b=y.firstChild,w=b.firstChild,_=(z=(R=x.renderer).getClasses)==null?void 0:z.call(R,e,x),T=HW(i,k,_,s),S=document.createElement("style");S.innerHTML=T,b.insertBefore(S,w);try{await x.renderer.draw(e,t,"11.14.0",x)}catch(O){throw i.suppressErrorRendering?u():Cq.draw(e,t,"11.14.0"),O}const L=d.select(`${h} svg`),B=(I=(P=x.db).getAccTitle)==null?void 0:I.call(P),N=($=(F=x.db).getAccDescription)==null?void 0:$.call(F);iS(k,L,B,N),d.select(`[id="${t}"]`).selectAll("foreignobject > *").attr("xmlns",IW);let A=d.select(h).node().innerHTML;if(rt.debug("config.arrowMarkerAbsolute",i.arrowMarkerAbsolute),A=UW(A,f,gn(i.arrowMarkerAbsolute)),f){const O=d.select(h+" svg").node();A=VW(A,O)}else p||(A=us.sanitize(A,{ADD_TAGS:zW,ADD_ATTR:qW,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(wW(),g)throw g;return u(),{diagramType:k,svg:A,bindFunctions:x.db.bindFunctions}},"render");function rS(t={}){var n;const e=Ne({},t);e!=null&&e.fontFamily&&!((n=e.themeVariables)!=null&&n.fontFamily)&&(e.themeVariables||(e.themeVariables={}),e.themeVariables.fontFamily=e.fontFamily),MI(e),e!=null&&e.theme&&e.theme in cn?e.themeVariables=cn[e.theme].getThemeVariables(e.themeVariables):e&&(e.themeVariables=cn.default.getThemeVariables(e.themeVariables));const r=typeof e=="object"?AI(e):Qb();Sp(r.logLevel),th()}v(rS,"initialize");var nS=v((t,e={})=>{const{code:r}=Tf(t);return Ld.fromText(r,e)},"getDiagramFromText");function iS(t,e,r,n){Q2(e,t),Z2(e,r,n,e.attr("id"))}v(iS,"addA11yInfo");var fi=Object.freeze({render:GW,parse:eS,getDiagramFromText:nS,initialize:rS,getConfig:me,setConfig:Zb,getSiteConfig:Qb,updateSiteConfig:II,reset:v(()=>{Ml()},"reset"),globalReset:v(()=>{Ml(ds)},"globalReset"),defaultConfig:ds});Sp(me().logLevel);Ml(me());var XW=v((t,e,r)=>{rt.warn(t),of(t)?(r&&r(t.str,t.hash),e.push({...t,message:t.str,error:t})):(r&&r(t),t instanceof Error&&e.push({str:t.message,message:t.message,hash:t.name,error:t}))},"handleError"),sS=v(async function(t={querySelector:".mermaid"}){try{await KW(t)}catch(e){if(of(e)&&rt.error(e.str),yr.parseError&&yr.parseError(e),!t.suppressErrors)throw rt.error("Use the suppressErrors option to suppress these errors"),e}},"run"),KW=v(async function({postRenderCallback:t,querySelector:e,nodes:r}={querySelector:".mermaid"}){const n=fi.getConfig();rt.debug(`${t?"":"No "}Callback function found`);let i;if(r)i=r;else if(e)i=document.querySelectorAll(e);else throw new Error("Nodes and querySelector are both undefined");rt.debug(`Found ${i.length} diagrams`),(n==null?void 0:n.startOnLoad)!==void 0&&(rt.debug("Start On Load: "+(n==null?void 0:n.startOnLoad)),fi.updateSiteConfig({startOnLoad:n==null?void 0:n.startOnLoad}));const s=new Ar.InitIDGenerator(n.deterministicIds,n.deterministicIDSeed);let o;const a=[];for(const c of Array.from(i)){if(rt.info("Rendering diagram: "+c.id),c.getAttribute("data-processed"))continue;c.setAttribute("data-processed","true");const h=`mermaid-${s.next()}`;o=c.innerHTML,o=kv(Ar.entityDecode(o)).trim().replace(/<br\s*\/?>/gi,"<br/>");const u=Ar.detectInit(o);u&&rt.debug("Detected early reinit: ",u);try{const{svg:d,bindFunctions:f}=await cS(h,o,c);c.innerHTML=d,t&&await t(h),f&&f(c)}catch(d){XW(d,a,yr.parseError)}}if(a.length>0)throw a[0]},"runThrowsErrors"),oS=v(function(t){fi.initialize(t)},"initialize"),QW=v(async function(t,e,r){rt.warn("mermaid.init is deprecated. Please use run instead."),t&&oS(t);const n={postRenderCallback:r,querySelector:".mermaid"};typeof e=="string"?n.querySelector=e:e&&(e instanceof HTMLElement?n.nodes=[e]:n.nodes=e),await sS(n)},"init"),ZW=v(async(t,{lazyLoad:e=!0}={})=>{th(),Mu(...t),e===!1&&await kW()},"registerExternalDiagrams"),aS=v(function(){if(yr.startOnLoad){const{startOnLoad:t}=fi.getConfig();t&&yr.run().catch(e=>rt.error("Mermaid failed to initialize",e))}},"contentLoaded");typeof document<"u"&&window.addEventListener("load",aS,!1);var JW=v(function(t){yr.parseError=t},"setParseErrorHandler"),uc=[],nu=!1,lS=v(async()=>{if(!nu){for(nu=!0;uc.length>0;){const t=uc.shift();if(t)try{await t()}catch(e){rt.error("Error executing queue",e)}}nu=!1}},"executeQueue"),tH=v(async(t,e)=>new Promise((r,n)=>{const i=v(()=>new Promise((s,o)=>{fi.parse(t,e).then(a=>{s(a),r(a)},a=>{var c;rt.error("Error parsing",a),(c=yr.parseError)==null||c.call(yr,a),o(a),n(a)})}),"performCall");uc.push(i),lS().catch(n)}),"parse"),cS=v((t,e,r)=>new Promise((n,i)=>{const s=v(()=>new Promise((o,a)=>{fi.render(t,e,r).then(c=>{o(c),n(c)},c=>{var h;rt.error("Error parsing",c),(h=yr.parseError)==null||h.call(yr,c),a(c),i(c)})}),"performCall");uc.push(s),lS().catch(i)}),"render"),eH=v(()=>Object.keys(ai).map(t=>({id:t})),"getRegisteredDiagramsMetadata"),yr={startOnLoad:!0,mermaidAPI:fi,parse:tH,render:cS,init:QW,run:sS,registerExternalDiagrams:ZW,registerLayoutLoaders:d2,initialize:oS,parseError:void 0,contentLoaded:aS,setParseErrorHandler:JW,detectType:Tp,registerIconPacks:Z8,getRegisteredDiagramsMetadata:eH},hS=yr;/*! Check if previously processed *//*!
647
- * Wait for document loaded before starting the execution
648
- */hS.initialize({startOnLoad:!1,theme:"dark",themeVariables:{primaryColor:"#3b82f6",primaryTextColor:"#e2e8f0",lineColor:"#475569",secondaryColor:"#1e293b",tertiaryColor:"#0f172a"}});function rH({code:t}){const e=C.useRef(null),r=C.useId(),[n,i]=C.useState(null),[s,o]=C.useState(null);return C.useEffect(()=>{let a=!1;const c=`mermaid-${r.replace(/:/g,"")}`;return hS.render(c,t).then(({svg:h})=>{a||i(h)}).catch(h=>{a||o(h.message||"Invalid diagram")}),()=>{a=!0}},[t,r]),s?l.jsx("pre",{className:"text-[11px] text-destructive bg-destructive/10 border border-destructive/20 rounded p-3 overflow-x-auto",children:`Mermaid error: ${s}
649
-
650
- ${t}`}):n?l.jsx("div",{ref:e,className:"my-3 overflow-x-auto",dangerouslySetInnerHTML:{__html:n}}):l.jsx("div",{className:"text-[11px] text-muted-foreground py-2",children:"Rendering diagram..."})}function nH({className:t,children:e,...r}){const n=/language-(\w+)/.exec(t||"");return(n==null?void 0:n[1])==="mermaid"?l.jsx(rH,{code:String(e).trim()}):l.jsx("code",{className:t,...r,children:e})}const iH=`prose prose-sm prose-invert max-w-none
651
- prose-headings:text-foreground prose-p:text-muted-foreground
652
- prose-a:text-accent prose-strong:text-foreground
653
- prose-code:text-accent prose-code:bg-muted prose-code:px-1 prose-code:rounded
654
- prose-pre:bg-muted prose-pre:border prose-pre:border-border
655
- prose-li:text-muted-foreground prose-table:text-xs
656
- prose-th:text-foreground prose-td:text-muted-foreground
657
- prose-hr:border-border`;function eh({content:t,className:e}){return l.jsx("article",{className:nt(iH,e),children:l.jsx(pp,{remarkPlugins:[xp],components:{code:nH},children:t||""})})}function sH(t){const e={name:"",children:new Map,files:[]};for(const r of t){const n=r.split("/");let i=e;for(let s=0;s<n.length-1;s++)i.children.has(n[s])||i.children.set(n[s],{name:n[s],children:new Map,files:[]}),i=i.children.get(n[s]);i.files.push({name:n[n.length-1],path:r})}return e}function uS(t,e){if(!e)return t;const r=e.toLowerCase(),n={name:t.name,children:new Map,files:t.files.filter(i=>i.name.toLowerCase().includes(r)||i.path.toLowerCase().includes(r))};for(const[i,s]of t.children){const o=uS(s,e);(o.files.length>0||o.children.size>0)&&n.children.set(i,o)}return n}function dS(t){let e=t.files.length;for(const r of t.children.values())e+=dS(r);return e}function pS({node:t,depth:e,expandedDirs:r,onToggleDir:n,selectedFile:i,onSelectFile:s,trackedPaths:o,searchQuery:a}){const c=oH(t,e),h=r.has(c)||!!a,u=dS(t);return l.jsxs("div",{children:[l.jsxs("button",{onClick:()=>n(c),className:"flex items-center gap-1.5 w-full px-2 py-1 text-left hover:bg-muted/30 transition-colors rounded-sm",style:{paddingLeft:`${e*16+4}px`},children:[h?l.jsx(p_,{className:"h-3.5 w-3.5 shrink-0 text-accent"}):l.jsx(Gd,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),l.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:t.name}),l.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto tabular-nums shrink-0",children:u})]}),h&&l.jsxs(l.Fragment,{children:[[...t.children.values()].sort((d,f)=>d.name.localeCompare(f.name)).map(d=>l.jsx(pS,{node:d,depth:e+1,expandedDirs:r,onToggleDir:n,selectedFile:i,onSelectFile:s,trackedPaths:o,searchQuery:a},d.name)),t.files.sort((d,f)=>d.name.localeCompare(f.name)).map(d=>l.jsx(fS,{file:d,depth:e+1,isSelected:i===d.path,isTracked:o.has(d.path),onSelect:()=>s(d.path)},d.path))]})]})}function fS({file:t,depth:e,isSelected:r,isTracked:n,onSelect:i}){return l.jsxs("button",{onClick:i,className:nt("flex items-center gap-1.5 w-full px-2 py-1 text-left transition-colors rounded-sm",r?"bg-accent/10 text-accent":"hover:bg-muted/30"),style:{paddingLeft:`${e*16+4}px`},children:[l.jsx(mi,{className:"h-3 w-3 shrink-0",style:{color:n?"hsl(var(--primary))":void 0}}),l.jsx("span",{className:nt("text-xs truncate",r?"text-accent font-medium":"text-foreground"),children:t.name}),n&&l.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0 ml-auto",style:{background:"hsl(var(--primary))"}})]})}function oH(t,e){return`dir-${e}-${t.name}`}function mS({items:t,selectedFile:e,onSelectedFileChange:r,previousView:n,onBack:i,featureCode:s,focusActive:o,onToggleFocus:a}){const[c,h]=C.useState([]),[u,d]=C.useState(!0),[f,p]=C.useState(null),m=e||f,x=G=>{p(G),r&&r(G)},[g,y]=C.useState(null),[k,b]=C.useState(!1),[w,_]=C.useState(!1),[T,S]=C.useState(""),[L,B]=C.useState(null),[N,A]=C.useState(!1),R=C.useRef(null),[z,P]=C.useState(""),[I,F]=C.useState(()=>new Set(["dir-0-docs"])),[$,O]=C.useState(()=>{try{return parseInt(localStorage.getItem("compose:docsTreeWidth"),10)||260}catch{return 260}}),D=C.useRef(!1),j=C.useRef(null),Y=C.useCallback(G=>{G.preventDefault(),D.current=!0;const it=Tt=>{if(!D.current||!j.current)return;const qt=j.current.getBoundingClientRect(),Qt=Math.min(Math.max(Tt.clientX-qt.left,160),500);O(Qt)},kt=()=>{D.current=!1,document.removeEventListener("mousemove",it),document.removeEventListener("mouseup",kt),O(Tt=>(localStorage.setItem("compose:docsTreeWidth",Tt),Tt))};document.addEventListener("mousemove",it),document.addEventListener("mouseup",kt)},[]),et=w&&T!==L,M=C.useCallback(async()=>{if(!(!m||N)){A(!0);try{const G=await vt("/api/file",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:m,content:T})});G.ok?(B(T),y(T),se("Saved","info")):se(`Save failed (${G.status})`,"error")}catch(G){se(`Save failed: ${G.message}`,"error")}A(!1)}},[m,T,N]),ct=C.useCallback(()=>{_(G=>(!G&&g!==null&&(S(g),B(g)),!G))},[g]);C.useEffect(()=>{if(!w)return;const G=it=>{(it.metaKey||it.ctrlKey)&&it.key==="s"&&(it.preventDefault(),M())};return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[w,M]),C.useEffect(()=>{_(!1),S(""),B(null)},[m]),C.useEffect(()=>{vt("/api/files").then(G=>G.json()).then(G=>{h(G.files||[]),d(!1);const it=new Set(["dir-0-docs"]);for(const kt of G.files||[]){const Tt=kt.split("/");Tt.length>1&&it.add(`dir-1-${Tt[1]}`)}F(it)}).catch(()=>d(!1))},[]),C.useEffect(()=>{if(!m){y(null);return}b(!0),vt(`/api/file?path=${encodeURIComponent(m)}`).then(G=>G.json()).then(G=>{y(G.content??null),b(!1)}).catch(()=>{y(null),b(!1)})},[m]);const X=C.useMemo(()=>!o||!s?c:c.filter(G=>G.includes(`features/${s}/`)),[c,o,s]),lt=C.useMemo(()=>{const G=new Set,it=kt=>kt.split("/").pop();for(const kt of t){const Tt=`${kt.title||""} ${kt.description||""} ${kt.planLink||""}`.toLowerCase();for(const qt of X)(Tt.includes(qt.toLowerCase())||Tt.includes(it(qt).replace(".md","").toLowerCase()))&&G.add(qt)}return G},[t,X]),It=C.useMemo(()=>sH(X),[X]),Pt=C.useMemo(()=>uS(It,z),[It,z]),Ct=C.useCallback(G=>{F(it=>{const kt=new Set(it);return kt.has(G)?kt.delete(G):kt.add(G),kt})},[]);return u?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading docs..."})}):l.jsxs("div",{ref:j,className:"flex-1 flex min-h-0",children:[l.jsxs("div",{className:"shrink-0 flex flex-col min-h-0",style:{width:`${$}px`},children:[l.jsxs("div",{className:"px-2 py-2 shrink-0",style:{borderBottom:"1px solid hsl(var(--border))"},children:[l.jsx("div",{className:"flex items-center gap-2 mb-1.5",children:l.jsx(oa,{featureCode:s,active:o,onToggle:a})}),l.jsxs("div",{className:"relative",children:[l.jsx(fn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),l.jsx(qd,{placeholder:"Search files...",value:z,onChange:G=>P(G.target.value),className:"h-7 pl-7 pr-7 text-xs"}),z&&l.jsx("button",{onClick:()=>P(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:l.jsx(Kr,{className:"h-3 w-3"})})]}),l.jsxs("div",{className:"flex items-center justify-between mt-1.5 px-1",children:[l.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[X.length," files"]}),l.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[X.length-lt.size," untracked"]})]})]}),l.jsx(An,{className:"flex-1",children:l.jsxs("div",{className:"py-1",children:[[...Pt.children.values()].sort((G,it)=>G.name.localeCompare(it.name)).map(G=>l.jsx(pS,{node:G,depth:0,expandedDirs:I,onToggleDir:Ct,selectedFile:m,onSelectFile:x,trackedPaths:lt,searchQuery:z},G.name)),Pt.files.sort((G,it)=>G.name.localeCompare(it.name)).map(G=>l.jsx(fS,{file:G,depth:0,isSelected:m===G.path,isTracked:lt.has(G.path),onSelect:()=>x(G.path)},G.path))]})})]}),l.jsx("div",{onMouseDown:Y,className:"w-1 shrink-0 cursor-col-resize hover:bg-accent/30 active:bg-accent/50 transition-colors",style:{background:"hsl(var(--border))"}}),l.jsx("div",{className:"flex-1 flex flex-col min-h-0 min-w-0",children:m?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 py-2 shrink-0 flex items-center gap-2",style:{borderBottom:"1px solid hsl(var(--border))"},children:[n&&i&&l.jsxs("button",{onClick:i,className:"flex items-center gap-1 text-xs text-accent hover:text-accent/80 transition-colors shrink-0",title:`Back to ${n}`,children:[l.jsx(DT,{className:"h-3 w-3"}),"Back to ",n.charAt(0).toUpperCase()+n.slice(1)]}),l.jsx("span",{className:"text-xs text-muted-foreground truncate flex-1",children:m}),et&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium",style:{color:"hsl(var(--accent))",background:"hsl(var(--accent) / 0.1)"},children:"modified"}),lt.has(m)&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{color:"hsl(var(--primary))",background:"hsl(var(--primary) / 0.1)"},children:"tracked"}),w&&l.jsxs("button",{onClick:M,disabled:N||!et,className:nt("flex items-center gap-1 text-xs px-2 py-0.5 rounded transition-colors",et?"bg-accent text-accent-foreground hover:bg-accent/80":"bg-muted text-muted-foreground cursor-default"),title:"Save (Cmd+S)",children:[l.jsx(V_,{className:"h-3 w-3"}),N?"Saving...":"Save"]}),l.jsx("button",{onClick:ct,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors px-1.5 py-0.5 rounded hover:bg-muted/50",title:w?"Preview":"Edit",disabled:g===null,children:w?l.jsx(K0,{className:"h-3.5 w-3.5"}):l.jsx(Z0,{className:"h-3.5 w-3.5"})})]}),k?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):g!==null&&w?l.jsx("textarea",{ref:R,value:T,onChange:G=>S(G.target.value),className:"flex-1 w-full resize-none border-0 outline-none px-4 py-3 text-sm",style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',background:"hsl(var(--background))",color:"hsl(var(--foreground))",tabSize:2},spellCheck:!1}):g!==null?l.jsx(An,{className:"flex-1",children:l.jsx("div",{className:"px-6 py-4 max-w-3xl",children:l.jsx(eh,{content:g})})}):l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx("span",{className:"text-sm text-muted-foreground",children:"Could not load file"})})]}):l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsxs("div",{className:"text-center",children:[l.jsx(mi,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground/30"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a file to preview"}),l.jsx("p",{className:"text-xs text-muted-foreground/60 mt-1",children:"Markdown files from the project docs/ directory"})]})})})]})}class aH{diff(e,r,n={}){let i;typeof n=="function"?(i=n,n={}):"callback"in n&&(i=n.callback);const s=this.castInput(e,n),o=this.castInput(r,n),a=this.removeEmpty(this.tokenize(s,n)),c=this.removeEmpty(this.tokenize(o,n));return this.diffWithOptionsObj(a,c,n,i)}diffWithOptionsObj(e,r,n,i){var s;const o=k=>{if(k=this.postProcess(k,n),i){setTimeout(function(){i(k)},0);return}else return k},a=r.length,c=e.length;let h=1,u=a+c;n.maxEditLength!=null&&(u=Math.min(u,n.maxEditLength));const d=(s=n.timeout)!==null&&s!==void 0?s:1/0,f=Date.now()+d,p=[{oldPos:-1,lastComponent:void 0}];let m=this.extractCommon(p[0],r,e,0,n);if(p[0].oldPos+1>=c&&m+1>=a)return o(this.buildValues(p[0].lastComponent,r,e));let x=-1/0,g=1/0;const y=()=>{for(let k=Math.max(x,-h);k<=Math.min(g,h);k+=2){let b;const w=p[k-1],_=p[k+1];w&&(p[k-1]=void 0);let T=!1;if(_){const L=_.oldPos-k;T=_&&0<=L&&L<a}const S=w&&w.oldPos+1<c;if(!T&&!S){p[k]=void 0;continue}if(!S||T&&w.oldPos<_.oldPos?b=this.addToPath(_,!0,!1,0,n):b=this.addToPath(w,!1,!0,1,n),m=this.extractCommon(b,r,e,k,n),b.oldPos+1>=c&&m+1>=a)return o(this.buildValues(b.lastComponent,r,e))||!0;p[k]=b,b.oldPos+1>=c&&(g=Math.min(g,k-1)),m+1>=a&&(x=Math.max(x,k+1))}h++};if(i)(function k(){setTimeout(function(){if(h>u||Date.now()>f)return i(void 0);y()||k()},0)})();else for(;h<=u&&Date.now()<=f;){const k=y();if(k)return k}}addToPath(e,r,n,i,s){const o=e.lastComponent;return o&&!s.oneChangePerToken&&o.added===r&&o.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:r,removed:n,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:r,removed:n,previousComponent:o}}}extractCommon(e,r,n,i,s){const o=r.length,a=n.length;let c=e.oldPos,h=c-i,u=0;for(;h+1<o&&c+1<a&&this.equals(n[c+1],r[h+1],s);)h++,c++,u++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!s.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=c,h}equals(e,r,n){return n.comparator?n.comparator(e,r):e===r||!!n.ignoreCase&&e.toLowerCase()===r.toLowerCase()}removeEmpty(e){const r=[];for(let n=0;n<e.length;n++)e[n]&&r.push(e[n]);return r}castInput(e,r){return e}tokenize(e,r){return Array.from(e)}join(e){return e.join("")}postProcess(e,r){return e}get useLongestToken(){return!1}buildValues(e,r,n){const i=[];let s;for(;e;)i.push(e),s=e.previousComponent,delete e.previousComponent,e=s;i.reverse();const o=i.length;let a=0,c=0,h=0;for(;a<o;a++){const u=i[a];if(u.removed)u.value=this.join(n.slice(h,h+u.count)),h+=u.count;else{if(!u.added&&this.useLongestToken){let d=r.slice(c,c+u.count);d=d.map(function(f,p){const m=n[h+p];return m.length>f.length?m:f}),u.value=this.join(d)}else u.value=this.join(r.slice(c,c+u.count));c+=u.count,u.added||(h+=u.count)}}return i}}class lH extends aH{constructor(){super(...arguments),this.tokenize=uH}equals(e,r,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
658
- `))&&(e=e.trim()),(!n.newlineIsToken||!r.includes(`
659
- `))&&(r=r.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
660
- `)&&(e=e.slice(0,-1)),r.endsWith(`
661
- `)&&(r=r.slice(0,-1))),super.equals(e,r,n)}}const cH=new lH;function hH(t,e,r){return cH.diff(t,e,r)}function uH(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
662
- `));const r=[],n=t.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(let i=0;i<n.length;i++){const s=n[i];i%2&&!e.newlineIsToken?r[r.length-1]+=s:r.push(s)}return r}function jf({oldText:t,newText:e}){const[r,n]=C.useState(!1),{parts:i,addCount:s,removeCount:o}=C.useMemo(()=>{if(!t||!e)return{parts:[],addCount:0,removeCount:0};const a=hH(t,e);let c=0,h=0;for(const u of a){const d=u.value.split(`
663
- `).filter(f=>f!=="").length;u.added&&(c+=d),u.removed&&(h+=d)}return{parts:a,addCount:c,removeCount:h}},[t,e]);return!t||!e?null:s===0&&o===0?l.jsx("span",{className:"text-[9px] text-muted-foreground/50 italic",children:"No changes"}):r?l.jsxs("div",{className:"mt-1.5",children:[l.jsx("button",{onClick:()=>n(!1),className:"text-[9px] text-blue-400 hover:text-blue-300 transition-colors mb-1",children:"Hide changes"}),l.jsx("div",{className:"rounded border border-border bg-muted/30 overflow-x-auto max-h-[300px] overflow-y-auto",children:l.jsx("pre",{className:"text-[10px] font-mono leading-relaxed",children:i.map((a,c)=>{const h=a.value.split(`
664
- `);return h[h.length-1]===""&&h.pop(),h.map((u,d)=>l.jsxs("div",{className:a.added?"bg-emerald-500/15 text-emerald-300":a.removed?"bg-red-500/15 text-red-300 line-through":"text-muted-foreground",style:{padding:"0 8px"},children:[l.jsx("span",{className:"inline-block w-3 text-muted-foreground/40 select-none mr-1",children:a.added?"+":a.removed?"-":" "}),u||" "]},`${c}-${d}`))})})})]}):l.jsxs("button",{onClick:()=>n(!0),className:"text-[9px] text-blue-400 hover:text-blue-300 transition-colors",children:["Show changes (+",s," -",o,")"]})}function gS(t){if(!t)return"";const e=Date.now()-new Date(t).getTime(),r=Math.floor(e/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function dH({gate:t}){var n,i;const e=t.artifactAssessment;if(!e)return null;const r=ry[t.fromPhase];return e.exists?l.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[r&&l.jsx("span",{className:"font-mono",children:r}),r&&": ",Math.round(e.completeness*100),"% complete"," · ",e.wordCount," words",((i=(n=e.sections)==null?void 0:n.missing)==null?void 0:i.length)>0&&l.jsxs("span",{className:"text-amber-400",children:[" (missing: ",e.sections.missing.join(", "),")"]}),!e.meetsMinWordCount&&l.jsx("span",{className:"text-amber-400",children:" (below min word count)"})]}):l.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[r??"Artifact"," not found"]})}function pH(t){var p;const e=t.artifactAssessment,r=t.summary;if(r){const m=new RegExp("(?<!\\bno\\s)(?<!\\b0\\s)\\b(critical|error|fail|missing)\\b","i").test(r);return{sentence:r,outcome:m?"revise":"approve"}}if(!e)return null;if(e.exists===!1)return{sentence:"Required artifact is missing",outcome:"revise"};const{completeness:n,wordCount:i,sections:s,meetsMinWordCount:o,findings:a}=e,c=(a??[]).filter(m=>/critical|error|fatal/i.test(m.severity??m.level??"")).length,h=((p=s==null?void 0:s.missing)==null?void 0:p.length)??0;if(c>0)return{sentence:`${c} critical finding${c>1?"s":""}`,outcome:"revise"};if(!o&&i!==void 0)return{sentence:`Thin artifact (${i} words)`,outcome:"revise"};if(h>0)return{sentence:`Missing ${h} section${h>1?"s":""}`,outcome:"revise"};const u=n!==void 0?`${Math.round(n*100)}% complete`:null,d=i!==void 0?`${i}w`:null;return{sentence:[u,d].filter(Boolean).join(", ")||"Ready",outcome:"approve"}}function fH({gate:t}){const e=pH(t);if(!e)return null;const r=e.outcome==="approve";return l.jsxs("div",{className:`text-[10px] px-2 py-0.5 rounded font-medium ${r?"bg-success/10 text-success border border-success/20":"bg-amber-400/10 text-amber-400 border border-amber-400/20"}`,children:[r?"Recommended: approve":"Recommended: revise"," — ",e.sentence]})}function qx({title:t,count:e,color:r,children:n}){return l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[l.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:r}}),l.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:t}),l.jsx("span",{className:"text-[10px] text-muted-foreground",children:e})]}),n]})}function mH({gate:t,item:e,priorRevision:r,isExpanded:n,expandedAction:i,onExpand:s,onResolve:o,onSelect:a}){const[c,h]=C.useState(""),[u,d]=C.useState(!1),f=()=>{o(t.id,"revised",c||void 0),s(null,null),h("")},p=()=>{c.trim()&&(o(t.id,"killed",c),s(null,null),h(""))};return l.jsxs("div",{className:"px-3 py-2 border-l-2 border-l-transparent hover:bg-muted/50 transition-colors",children:[l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[l.jsx("button",{onClick:()=>a(t.itemId),className:"text-sm text-foreground hover:text-accent transition-colors truncate block",children:(e==null?void 0:e.title)??"Unknown"}),l.jsx("p",{className:"text-[10px] text-muted-foreground",children:un[t.stepId]??`${Ce[t.fromPhase]??t.fromPhase} → ${Ce[t.toPhase]??t.toPhase}`}),l.jsx(dH,{gate:t}),t.artifactSnapshot?l.jsxs("div",{className:"space-y-1",children:[l.jsxs("button",{onClick:()=>d(m=>!m),className:"flex items-center gap-1 text-[10px] text-accent hover:underline","data-testid":"gate-artifact-toggle",children:[u?l.jsx(ks,{className:"h-3 w-3"}):l.jsx(ii,{className:"h-3 w-3"}),u?"Hide artifact":"View artifact"]}),u&&l.jsx("div",{className:"px-2 py-2 rounded bg-muted/40 border border-border max-h-96 overflow-auto","data-testid":"gate-artifact-body",children:l.jsx(eh,{content:t.artifactSnapshot})})]}):null,r?l.jsxs("div",{className:"space-y-1",children:[l.jsxs("div",{className:"text-[10px] px-2 py-1 rounded bg-amber-400/10 border border-amber-400/20 text-amber-400",children:["Prior revision: ",r.comment||"No comment"]}),r.priorSnapshot&&r.currentSnapshot&&l.jsx("div",{className:"px-2",children:l.jsx(jf,{oldText:r.priorSnapshot,newText:r.currentSnapshot})})]}):null]}),l.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums shrink-0",children:gS(t.createdAt)})]}),l.jsx("div",{className:"mt-1.5",children:l.jsx(fH,{gate:t})}),l.jsxs("div",{className:"flex items-center gap-1.5 mt-1.5",children:[l.jsx(At,{variant:"outline",size:"sm",className:"h-6 text-[10px] gap-1 text-success border-success/30 hover:bg-success/10",onClick:()=>o(t.id,"approved"),children:"Approve"}),l.jsx(At,{variant:"outline",size:"sm",className:nt("h-6 text-[10px] gap-1 text-amber-400 border-amber-400/30 hover:bg-amber-400/10",n&&i==="revise"&&"bg-amber-400/10"),onClick:()=>{n&&i==="revise"?s(null,null):(s(t.id,"revise"),h(""))},children:"Revise"}),l.jsx(At,{variant:"outline",size:"sm",className:nt("h-6 text-[10px] gap-1 text-destructive border-destructive/30 hover:bg-destructive/10",n&&i==="kill"&&"bg-destructive/10"),onClick:()=>{n&&i==="kill"?s(null,null):(s(t.id,"kill"),h(""))},children:"Kill"})]}),n&&l.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[l.jsx("input",{className:"flex-1 text-xs bg-muted text-foreground px-2 py-1 rounded border border-border outline-none",placeholder:i==="revise"?"Feedback (optional)...":"Kill reason (required)...",value:c,onChange:m=>h(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(i==="revise"?f():i==="kill"&&p()),m.key==="Escape"&&s(null,null)},autoFocus:!0}),l.jsx(At,{variant:"outline",size:"sm",className:"h-6 text-[10px]",disabled:i==="kill"&&!c.trim(),onClick:i==="revise"?f:p,children:i==="revise"?"Submit":"Confirm Kill"})]})]})}function gH(t){if(t.resolvedBy==="system"){const e=t.policyMode;return e==="flag"?"auto (flag)":e==="skip"?"auto (skip)":"auto"}return t.resolvedBy??"human"}function xH({gate:t,item:e}){const r={approved:{color:"text-success",border:"border-success/30"},approve:{color:"text-success",border:"border-success/30"},revised:{color:"text-amber-400",border:"border-amber-400/30"},revise:{color:"text-amber-400",border:"border-amber-400/30"},killed:{color:"text-destructive",border:"border-destructive/30"},kill:{color:"text-destructive",border:"border-destructive/30"}},n=r[t.outcome]||r.approved,i=gH(t);return l.jsxs("div",{className:"px-3 py-2 border-l-2 border-l-transparent",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"flex-1 text-sm text-muted-foreground truncate",children:(e==null?void 0:e.title)??"Unknown"}),l.jsx(cr,{variant:"outline",className:nt("text-[10px] px-1.5 py-0 h-4",n.color,n.border),children:t.outcome}),i!=="human"&&l.jsx("span",{className:"text-[9px] px-1 py-0 rounded bg-muted text-muted-foreground",children:i}),l.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums shrink-0",children:gS(t.resolvedAt)})]}),l.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:un[t.stepId]??`${Ce[t.fromPhase]??t.fromPhase} → ${Ce[t.toPhase]??t.toPhase}`}),t.comment&&l.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 truncate italic",children:t.comment})]})}function xS({gates:t,items:e,onResolve:r,onSelect:n,featureCode:i,focusActive:s,onToggleFocus:o,focusedGateId:a,onFocusHandled:c}){const[h,u]=C.useState(null),[d,f]=C.useState(null),p=C.useRef(new Map),[m,x]=C.useState(null),g=C.useMemo(()=>{if(!s||!i)return t;const L=new Set(e.filter(B=>{var N;return B.featureCode===i||((N=B.lifecycle)==null?void 0:N.featureCode)===i}).map(B=>B.id));return t.filter(B=>L.has(B.itemId))},[t,e,s,i]),y=(L,B)=>{u(L),f(B)},{pending:k,resolved:b,priorRevisions:w}=C.useMemo(()=>{const L=[],B=[];for(const A of g)A.status==="pending"?L.push(A):A.resolvedAt&&B.push(A);L.sort((A,R)=>new Date(A.createdAt)-new Date(R.createdAt)),B.sort((A,R)=>new Date(R.resolvedAt)-new Date(A.resolvedAt));const N=new Map;for(const A of L){const R=B.find(z=>z.stepId===A.stepId&&z.itemId===A.itemId&&(z.outcome==="revised"||z.outcome==="revise")&&z.comment);R&&N.set(A.id,{comment:R.comment,priorSnapshot:R.artifactSnapshot||null,currentSnapshot:A.artifactSnapshot||null})}return{pending:L,resolved:B,priorRevisions:N}},[g]),[_,T]=C.useState(!1),S=C.useMemo(()=>new Map(e.map(L=>[L.id,L])),[e]);return C.useEffect(()=>{var N;if(!a)return;const L=p.current.get(a);if(!L)return;(N=L.scrollIntoView)==null||N.call(L,{behavior:"smooth",block:"center"}),x(a),c==null||c();const B=setTimeout(()=>x(null),1600);return()=>clearTimeout(B)},[a,k,b,c]),l.jsxs("div",{className:"flex-1 overflow-auto flex flex-col",children:[l.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0",children:[l.jsx(oa,{featureCode:i,active:s,onToggle:o}),l.jsx("span",{className:"text-xs font-medium text-foreground",children:"Gates"}),k.length>0?l.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-amber-400/15 text-amber-400 font-medium",children:[k.length," pending"]}):l.jsx("span",{className:"text-[10px] text-muted-foreground",children:"No gates pending"}),b.length>0&&l.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["· ",b.length," resolved"]})]}),l.jsxs("div",{className:"flex-1 overflow-auto",children:[k.length>0&&l.jsx(qx,{title:"Pending",count:k.length,color:"#f59e0b",children:k.map(L=>l.jsx("div",{ref:B=>{B?p.current.set(L.id,B):p.current.delete(L.id)},className:nt("transition-colors duration-500",m===L.id&&"bg-amber-400/15 ring-1 ring-amber-400/40 rounded"),children:l.jsx(mH,{gate:L,item:S.get(L.itemId),priorRevision:w.get(L.id),isExpanded:h===L.id,expandedAction:h===L.id?d:null,onExpand:y,onResolve:r,onSelect:n})},L.id))}),b.length>0&&l.jsxs(qx,{title:"History",count:b.length,color:"#22c55e",children:[(_?b.slice(0,50):b.slice(0,10)).map(L=>l.jsx("div",{ref:B=>{B?p.current.set(L.id,B):p.current.delete(L.id)},className:nt("transition-colors duration-500",m===L.id&&"bg-amber-400/15 ring-1 ring-amber-400/40 rounded"),children:l.jsx(xH,{gate:L,item:S.get(L.itemId)})},L.id)),b.length>10&&!_&&l.jsxs("button",{className:"w-full px-3 py-1.5 text-[10px] text-muted-foreground hover:text-foreground transition-colors",onClick:()=>T(!0),children:["Show all ",b.length," resolved gates"]})]}),k.length===0&&b.length===0&&l.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"No gates pending."})]})]})}function yS({event:t,items:e,onNavigate:r}){const[n,i]=C.useState(!1),[s,o]=C.useState(null);if(C.useEffect(()=>{if(!t)return;o(t),i(!0);const u=setTimeout(()=>i(!1),5e3);return()=>clearTimeout(u)},[t]),!n||!s)return null;const a=e.find(u=>u.id===s.itemId),c=(a==null?void 0:a.title)??"Unknown",h=s.type==="pending"?`Gate pending: ${$o(s,a)}`:`Gate ${s.outcome}: ${c}`;return l.jsx("button",{onClick:()=>{r(),i(!1)},className:"fixed bottom-4 right-4 z-50 max-w-sm px-4 py-3 rounded-lg border border-border bg-card shadow-lg text-sm text-foreground cursor-pointer hover:bg-muted/50 transition-all animate-in fade-in slide-in-from-bottom-2",children:h})}function yH({item:t,onUpdate:e}){const{newIds:r,changedIds:n}=C.useContext(Nc),i=r.has(t.id)?"vision-entering":n.has(t.id)?"vision-updated":"",[s,o]=C.useState(!1),[a,c]=C.useState(""),h=t.status==="complete"||t.status==="killed",{baseDesc:u,resolution:d}=C.useMemo(()=>{if(!t.description)return{baseDesc:"",resolution:""};const x=`
665
-
666
- ---
667
- Resolution:`,g=t.description.indexOf(x);return g===-1?{baseDesc:t.description,resolution:""}:{baseDesc:t.description.slice(0,g).trim(),resolution:t.description.slice(g+x.length).trim()}},[t.description]),f=C.useCallback(async()=>{const g=`Be brief. Summarize, give your recommendation, refine the decision wording based on the resolution if needed: ${t.description||t.title}
668
- `;try{const y=await vt(wT("/api/agent/message"),{method:"POST",headers:Mr({"Content-Type":"application/json"}),body:JSON.stringify({prompt:g})});if(!y.ok){se(`Could not send to terminal (${y.status})`,"error");return}const k=document.querySelector(".xterm-helper-textarea");k&&k.focus()}catch(y){console.error("Failed to inject into terminal:",y),se(`Could not send to terminal: ${y.message}`,"error")}},[t]),p=C.useCallback(()=>{const x=a.trim()?`${t.description||""}
669
-
670
- ---
671
- Resolution: ${a.trim()}`:t.description;e(t.id,{status:"complete",description:x}),o(!1),c("")},[t.id,t.description,a,e]),m=C.useCallback(()=>{e(t.id,{status:"killed"})},[t.id,e]);return l.jsxs("div",{className:nt("rounded-lg border p-3 space-y-2 transition-all",h?"border-border/50 bg-muted/20 opacity-60":"border-border bg-muted/30",i),children:[l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("div",{className:"w-2 h-2 rounded-full shrink-0 mt-1.5",style:{background:h?"hsl(var(--muted-foreground))":hr.question}}),l.jsx("p",{className:nt("text-sm font-medium leading-snug flex-1",h?"text-muted-foreground line-through":"text-foreground"),children:t.title})]}),u&&l.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed pl-4",children:u}),d&&l.jsxs("div",{className:nt("ml-4 pl-3 border-l-2 border-success/40 py-1",n.has(t.id)&&"resolution-sparkle"),children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-success mb-0.5",children:"Resolution"}),l.jsx("p",{className:"text-xs text-foreground leading-relaxed",children:d})]}),s&&l.jsxs("div",{className:"ml-4 flex items-center gap-1.5",children:[l.jsx("input",{className:"flex-1 text-xs bg-muted text-foreground px-2 py-1.5 rounded border border-border outline-none focus:border-ring",placeholder:"Resolution note (optional)...",value:a,onChange:x=>c(x.target.value),onKeyDown:x=>{x.key==="Enter"&&p(),x.key==="Escape"&&o(!1)},autoFocus:!0}),l.jsx(At,{variant:"ghost",size:"icon",className:"h-7 w-7 text-success",onClick:p,children:l.jsx(Xd,{className:"h-3 w-3"})}),l.jsx(At,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>o(!1),children:l.jsx(Kr,{className:"h-3 w-3"})})]}),!h&&!s&&l.jsxs("div",{className:"flex items-center gap-1.5 pl-4",children:[l.jsxs("button",{onClick:f,className:"text-[10px] px-2 py-0.5 rounded-md text-accent hover:bg-accent/10 flex items-center gap-1 transition-colors",children:[l.jsx(kc,{className:"h-2.5 w-2.5"})," Discuss"]}),l.jsxs("button",{onClick:()=>o(!0),className:"text-[10px] px-2 py-0.5 rounded-md text-success hover:bg-success/10 flex items-center gap-1 transition-colors",children:[l.jsx(Cs,{className:"h-2.5 w-2.5"})," Resolve"]}),l.jsxs("button",{onClick:m,className:"text-[10px] px-2 py-0.5 rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10 flex items-center gap-1 transition-colors",children:[l.jsx(e_,{className:"h-2.5 w-2.5"})," Dismiss"]})]}),h&&l.jsx("div",{className:"pl-4",children:l.jsx("span",{className:nt("text-[10px] px-1.5 py-0.5 rounded-full",t.status==="complete"?"bg-success/10 text-success":"bg-muted text-muted-foreground"),children:t.status==="complete"?"Resolved":"Dismissed"})})]})}function bS({item:t,items:e,connections:r,onUpdate:n,onClose:i}){const[s,o]=C.useState(null),[a,c]=C.useState(null),[h,u]=C.useState(""),d=C.useRef(null),f=C.useMemo(()=>{const x=new Map(e.map(y=>[y.id,y])),g=[];for(const y of r)if(y.type==="contradicts"){if(y.toId===t.id){const k=x.get(y.fromId);k&&g.push(k)}if(y.fromId===t.id){const k=x.get(y.toId);k&&g.push(k)}}return g.sort((y,k)=>{const b=new Date(y.createdAt||0).getTime();return new Date(k.createdAt||0).getTime()-b}),g},[t.id,e,r]),p=f.filter(x=>x.status!=="complete"&&x.status!=="killed").length;C.useEffect(()=>{if(!(!s||a!=="running"))return d.current=setInterval(async()=>{try{const x=await vt(`/api/agent/${s}`);if(!x.ok)return;const g=await x.json();g.status!=="running"&&(c(g.status),clearInterval(d.current))}catch{}},1500),()=>clearInterval(d.current)},[s,a]);const m=C.useCallback(async()=>{if(a==="running")return;const x=t.description?`
672
- Description: ${t.description}`:"",g=["Challenge the assumptions of this item and create counter-questions.","",`Item: "${t.title}" (type: ${t.type}, status: ${t.status})${x}`,"","Create 2-3 challenging questions that probe weaknesses, missing considerations, or alternative approaches. For each question, run:",`node scripts/vision-track.mjs create "<your question>" --type question --phase ${t.phase||"vision"} --description "<why this matters>" --connects-to ${t.id}:contradicts`,"","Be specific and constructive. Challenge the idea, not the person.","Only run the vision-track.mjs commands above. Do not do anything else."].join(`
673
- `);c("running");try{const y=await vt("/api/agent/spawn",{method:"POST",headers:Mr({"Content-Type":"application/json"}),body:JSON.stringify({prompt:g})});if(!y.ok){const b=await y.json().catch(()=>({}));c("failed"),u(b.error||"Failed to spawn agent"),se(`Could not start challenge agent (${y.status})`,"error");return}const k=await y.json();o(k.agentId)}catch(y){c("failed"),u(y.message),se(`Could not start challenge agent: ${y.message}`,"error")}},[t,a]);return l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:i}),l.jsxs("div",{className:"relative w-full max-w-lg max-h-[80vh] flex flex-col rounded-xl border border-border bg-card shadow-2xl mx-4",children:[l.jsxs("div",{className:"flex items-start gap-3 p-4 pb-3 border-b border-border shrink-0",children:[l.jsx(Cl,{className:"h-5 w-5 text-amber-400 shrink-0 mt-0.5"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Pressure Test"}),l.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:t.title})]}),l.jsx(At,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:i,children:l.jsx(Kr,{className:"h-3.5 w-3.5"})})]}),l.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-3",children:[a==="running"&&l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-accent/10 border border-accent/20",children:[l.jsx(xl,{className:"h-3.5 w-3.5 text-accent animate-spin"}),l.jsx("span",{className:"text-xs text-accent",children:"Generating challenges..."})]}),a==="failed"&&l.jsx("div",{className:"px-3 py-2 rounded-lg bg-destructive/10 border border-destructive/20",children:l.jsxs("span",{className:"text-xs text-destructive",children:["Failed: ",h]})}),f.length===0&&!a?l.jsxs("div",{className:"text-center py-8",children:[l.jsx("p",{className:"text-sm text-muted-foreground",children:"No challenges yet."}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Run a pressure test to generate counter-questions."})]}):f.map(x=>l.jsx(yH,{item:x,onUpdate:n},x.id))]}),l.jsxs("div",{className:"flex items-center justify-between p-4 pt-3 border-t border-border shrink-0",children:[l.jsx("span",{className:"text-[10px] text-muted-foreground",children:p>0?`${p} open / ${f.length} total`:f.length>0?`${f.length} resolved`:"No challenges"}),l.jsxs(At,{size:"sm",className:nt("h-8 text-xs gap-1.5",a==="running"&&"opacity-50 pointer-events-none"),onClick:m,children:[l.jsx(Cl,{className:"h-3.5 w-3.5"}),a==="running"?"Generating...":"Run Pressure Test"]})]})]})]})}const bH=["explore_design","prd","architecture","blueprint","verification","plan","execute","report","docs","ship"],CH=["gate","flag","skip"],kH=["light","dark","system"],Wx=["graph","tree","pipeline","gates","docs","design","sessions","settings"];function co({title:t,children:e}){return l.jsxs("div",{className:"mb-6",children:[l.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-3",children:t}),e]})}function Ai({label:t,children:e}){return l.jsxs("div",{className:"flex items-center justify-between py-1.5 px-1",children:[l.jsx("label",{className:"text-sm text-foreground",children:t}),e]})}function vH({value:t,className:e,onCommit:r}){const[n,i]=C.useState(t||"");return C.useEffect(()=>{i(t||"")},[t]),l.jsx("input",{type:"text",className:e,value:n,onChange:s=>i(s.target.value),onBlur:()=>{n.trim()&&n.trim()!==t&&r(n.trim())}})}function CS({settings:t,onSettingsChange:e,onReset:r}){var p,m,x,g,y,k;const n=Wd();if(!t)return l.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Loading settings..."});const i=C.useCallback((b,w)=>{const _=w==="null"?null:w;e({policies:{[b]:_}})},[e]),s=C.useCallback((b,w)=>{const _=parseInt(w,10);_>=1&&_<=100&&e({iterations:{[b]:{maxIterations:_}}})},[e]),o=C.useCallback((b,w)=>{w.trim()&&e({models:{[b]:w.trim()}})},[e]),a=C.useCallback(b=>{if(e({ui:{theme:b}}),b==="system"){const w=window.matchMedia("(prefers-color-scheme: dark)").matches;document.documentElement.classList.toggle("dark",w),localStorage.removeItem("compose:theme")}else document.documentElement.classList.toggle("dark",b==="dark"),localStorage.setItem("compose:theme",b)},[e]),c=C.useCallback(b=>{e({ui:{defaultView:b}})},[e]),h=C.useCallback(b=>{e({capabilities:{enforcement:b}})},[e]),u=C.useCallback(async()=>{await n({title:"Reset all settings to defaults?",destructive:!0})&&r()},[r,n]),d="h-7 text-xs rounded-md border border-input bg-background px-2 py-1",f="h-7 text-xs rounded-md border border-input bg-background px-2 py-1 w-24";return l.jsxs("div",{className:"flex-1 overflow-auto p-6 max-w-2xl",children:[l.jsx("h2",{className:"text-lg font-semibold mb-4",children:"Settings"}),l.jsx(co,{title:"Phase Policies",children:bH.map(b=>l.jsx(Ai,{label:Ce[b]||b,children:l.jsxs("select",{className:d,value:t.policies[b]===null?"null":t.policies[b]||"skip",onChange:w=>i(b,w.target.value),children:[b==="explore_design"&&l.jsx("option",{value:"null",children:"—"}),CH.map(w=>l.jsx("option",{value:w,children:w},w))]})},b))}),l.jsxs(co,{title:"Iteration Limits",children:[l.jsx(Ai,{label:"Review max iterations",children:l.jsx("input",{type:"number",className:f,min:1,max:100,value:((m=(p=t.iterations)==null?void 0:p.review)==null?void 0:m.maxIterations)??10,onChange:b=>s("review",b.target.value)})}),l.jsx(Ai,{label:"Coverage max iterations",children:l.jsx("input",{type:"number",className:f,min:1,max:100,value:((g=(x=t.iterations)==null?void 0:x.coverage)==null?void 0:g.maxIterations)??15,onChange:b=>s("coverage",b.target.value)})})]}),l.jsx(co,{title:"Agent Models",children:["interactive","agentRun","summarizer"].map(b=>{var w;return l.jsx(Ai,{label:b,children:l.jsx(vH,{className:f+" w-48",value:((w=t.models)==null?void 0:w[b])||"",onCommit:_=>o(b,_)},b)},b)})}),l.jsxs(co,{title:"Appearance",children:[l.jsx(Ai,{label:"Theme",children:l.jsx("select",{className:d,value:((y=t.ui)==null?void 0:y.theme)||"system",onChange:b=>a(b.target.value),children:kH.map(b=>l.jsx("option",{value:b,children:b},b))})}),l.jsx(Ai,{label:"Default view",children:l.jsx("select",{className:d,value:Wx.includes((k=t.ui)==null?void 0:k.defaultView)?t.ui.defaultView:"graph",onChange:b=>c(b.target.value),children:Wx.map(b=>l.jsx("option",{value:b,children:b},b))})})]}),l.jsx(co,{title:"Capability Enforcement",children:l.jsxs("div",{className:"space-y-2 px-1",children:[[{value:"log",label:"Log (default)"},{value:"block",label:"Block"}].map(({value:b,label:w})=>{var _;return l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"radio",name:"enforcement",value:b,checked:(((_=t.capabilities)==null?void 0:_.enforcement)??"log")===b,onChange:()=>h(b),className:"accent-accent"}),l.jsx("span",{className:"text-sm text-foreground",children:w})]},b)}),l.jsx("p",{className:"text-[11px] text-muted-foreground pt-1",children:"Block stops the build on disallowed tool use; Log records but continues."})]})}),l.jsx("button",{onClick:u,className:"text-xs text-destructive hover:underline mt-2",children:"Reset to Defaults"})]})}function wH(){const[t,e]=C.useState([]),[r,n]=C.useState(!0),[i,s]=C.useState(null);C.useEffect(()=>{vt("/api/pipeline/templates").then(a=>a.json()).then(a=>{e(a.templates||[]),n(!1)}).catch(()=>n(!1))},[]);const o=async a=>{s(a);try{const c=await vt("/api/pipeline/draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:a})});c.ok||se(`Could not create draft (${c.status})`,"error")}catch(c){console.error("[TemplateSelector] Failed to create draft:",c),se(`Could not create draft: ${c.message}`,"error")}s(null)};return r?l.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[l.jsx(xl,{className:"w-4 h-4 animate-spin mr-2"}),"Loading templates..."]}):t.length===0?l.jsx("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:"No pipeline templates found"}):l.jsxs("div",{className:"p-4 space-y-3",children:[l.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Choose a pipeline template"}),l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:t.map(a=>l.jsxs("button",{onClick:()=>o(a.id),disabled:i!==null,className:nt("flex flex-col gap-2 p-3 rounded-lg border text-left transition-all","hover:ring-1 hover:ring-accent/50",i===a.id&&"opacity-60",xj[a.category]||"border-border bg-card"),children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(mi,{className:"w-4 h-4 shrink-0"}),l.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:a.label})]}),l.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:a.description}),l.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground mt-auto",children:[l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx(v_,{className:"w-3 h-3"})," ",a.steps," steps"]}),l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx(X0,{className:"w-3 h-3"})," ~",a.estimated_minutes,"m"]}),l.jsx("span",{className:"ml-auto capitalize",children:a.category})]})]},a.id))})]})}function kS({activeBuild:t,pipelineDraft:e,onSelectStep:r,onRefresh:n}){const[i,s]=C.useState(null),[o,a]=C.useState(!1),[c,h]=C.useState(!1),u=k=>{const b=i===k?null:k;s(b),r&&r(b)},d=()=>{n&&n()},f=async()=>{if(e!=null&&e.draftId){a(!0);try{const k=await vt("/api/pipeline/draft/approve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draftId:e.draftId})});k.ok?se("Draft approved","info"):se(`Approve failed (${k.status})`,"error")}catch(k){console.error("[PipelineView] Approve failed:",k),se(`Approve failed: ${k.message}`,"error")}a(!1)}},p=async()=>{if(e!=null&&e.draftId){h(!0);try{const k=await vt("/api/pipeline/draft/reject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draftId:e.draftId})});k.ok||se(`Reject failed (${k.status})`,"error")}catch(k){console.error("[PipelineView] Reject failed:",k),se(`Reject failed: ${k.message}`,"error")}h(!1)}};if(!t&&!e)return l.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[l.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0 h-9",children:[l.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Pipeline Templates"}),l.jsx("div",{className:"ml-auto",children:l.jsxs("button",{onClick:d,className:"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground px-2 py-0.5 rounded border border-border",children:[l.jsx(Po,{className:"w-3 h-3"})," Refresh"]})})]}),l.jsx("div",{className:"flex-1 overflow-auto",children:l.jsx(wH,{})})]});if(e){const k=e.steps||[],b=e.metadata||{};return l.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[l.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0 h-9",children:[l.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Draft Review"}),l.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[l.jsxs("button",{onClick:p,disabled:c||o,className:nt("flex items-center gap-1 text-[10px] px-2 py-0.5 rounded border","text-red-400 border-red-500/30 hover:bg-red-500/10",c&&"opacity-60"),children:[l.jsx(Kr,{className:"w-3 h-3"})," Reject"]}),l.jsxs("button",{onClick:f,disabled:o||c,className:nt("flex items-center gap-1 text-[10px] px-2 py-0.5 rounded border","text-emerald-400 border-emerald-500/30 hover:bg-emerald-500/10",o&&"opacity-60"),children:[l.jsx(Cs,{className:"w-3 h-3"})," Approve"]})]})]}),l.jsxs("div",{className:"mx-3 mt-3 px-3 py-2 rounded-lg border ring-1 ring-amber-500/30 border-amber-500/20 bg-amber-500/5 text-[11px]",children:[l.jsxs("span",{className:"text-amber-400 font-medium",children:["Draft: ",b.label||b.id||"Pipeline"]}),l.jsx("span",{className:"text-muted-foreground ml-2",children:b.description||""}),b.category&&l.jsxs("span",{className:"text-muted-foreground ml-2",children:["· ",b.category]})]}),l.jsx("div",{className:"flex-1 overflow-auto p-3",children:l.jsx("div",{className:"space-y-1",children:k.map((w,_)=>l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-slate-800/40 bg-card",children:[l.jsx("div",{className:"w-5 h-5 rounded flex items-center justify-center shrink-0 bg-slate-500/15 text-slate-400 text-[10px] font-mono",children:_+1}),l.jsx("span",{className:"text-xs text-foreground",children:w.id}),w.agent&&l.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto",children:w.agent}),w.function&&l.jsxs("span",{className:"text-[10px] text-muted-foreground ml-auto",children:["fn:",w.function]})]},w.id||_))})})]})}const m=(t==null?void 0:t.currentStepId)??null,x=ST(Pf,(t==null?void 0:t.steps)??[],m),g=Array.isArray(t==null?void 0:t.steps)?Object.fromEntries(t.steps.map(k=>[k.id,k.status])):{},y=Object.keys(Of).map(k=>({phase:k,config:Of[k],steps:x.filter(b=>b.phase===k)}));return l.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[l.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0 h-9",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Ha,{icon:qi,color:"text-orange-400 bg-orange-500/10",label:"Claude"}),l.jsx(Ha,{icon:Yd,color:"text-emerald-400 bg-emerald-500/10",label:"Codex"}),l.jsx(Ha,{icon:Kd,color:"text-slate-300 bg-slate-500/10",label:"Human"}),l.jsx(Ha,{icon:gi,color:"text-amber-400 bg-amber-500/10",label:"Gate"})]}),l.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[t&&l.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["Live: ",l.jsx("span",{className:"text-blue-400 font-medium",children:t.featureCode})]}),l.jsxs("button",{onClick:d,className:"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground px-2 py-0.5 rounded border border-border",children:[l.jsx(Po,{className:"w-3 h-3"})," Refresh"]})]})]}),t&&l.jsxs("div",{className:"mx-3 mt-3 px-3 py-2 rounded-lg border ring-1 ring-blue-500/30 border-blue-500/20 bg-blue-500/5 text-[11px]",children:[l.jsxs("span",{className:"text-blue-400 font-medium",children:["Active Build: ",t.featureCode]}),l.jsxs("span",{className:"text-muted-foreground ml-2",children:["status: ",t.status," · step ",t.stepNum??"?","/",t.totalSteps??Pf.length]}),m&&l.jsxs("span",{className:"text-foreground ml-2",children:["· Current: ",l.jsx("span",{className:"font-medium",children:m})]})]}),l.jsx("div",{className:"flex-1 overflow-auto p-3 space-y-3",children:y.map(({phase:k,config:b,steps:w})=>l.jsxs("div",{className:nt("rounded-lg border p-3",b.color),children:[l.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:b.label}),l.jsx("div",{className:"flex flex-wrap gap-1.5",children:w.map((_,T)=>{const S=g[_.id]??null,L=_.id===m,B=_.id===i;return l.jsxs(Dt.Fragment,{children:[l.jsx(SH,{step:_,liveStatus:S,isCurrent:L,isSelected:B,onClick:()=>u(_.id)}),T<w.length-1&&l.jsx(U0,{className:"h-3 w-3 self-center text-muted-foreground/40"})]},_.id)})})]},k))})]})}function SH({step:t,liveStatus:e,isCurrent:r,isSelected:n,onClick:i}){const s=t.hasGate?gi:t.agent==="claude"?qi:t.agent==="codex"?Yd:Kd,o={active:"border-blue-500/80 bg-blue-500/10",done:"border-emerald-500/50 bg-emerald-500/5",failed:"border-red-500/60 bg-red-500/10",pending:"border-slate-800/60 bg-card"}[e]??"border-slate-800/40 bg-card";return l.jsxs("button",{onClick:i,className:nt("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border text-left transition-all min-w-[120px]",n?"border-accent/80 bg-accent/10":o,t.hasGate&&!e&&"border-amber-500/30 bg-amber-500/5",r&&"ring-1 ring-blue-400/40"),children:[l.jsx("div",{className:nt("w-5 h-5 rounded flex items-center justify-center shrink-0",t.hasGate?"bg-amber-500/15 text-amber-400":t.agent==="claude"?"bg-orange-500/15 text-orange-400":t.agent==="codex"?"bg-emerald-500/15 text-emerald-400":"bg-slate-500/15 text-slate-400"),children:l.jsx(s,{className:"w-3 h-3"})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"text-[10px] font-medium text-foreground truncate leading-tight",children:t.name}),e&&l.jsx("p",{className:"text-[8px] text-muted-foreground capitalize",children:e})]})]})}function Ha({icon:t,color:e,label:r}){return l.jsxs("div",{className:nt("flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",e),children:[l.jsx(t,{className:"w-3 h-3"}),l.jsx("span",{children:r})]})}function TH(t,{search:e="",agentFilter:r="all",statusFilter:n="all"}={}){let i=t;if(e){const s=e.toLowerCase();i=i.filter(o=>{var a,c,h,u;return((a=o.featureCode)==null?void 0:a.toLowerCase().includes(s))||((c=o.feature_code)==null?void 0:c.toLowerCase().includes(s))||((h=o.summary)==null?void 0:h.toLowerCase().includes(s))||((u=o.agent)==null?void 0:u.toLowerCase().includes(s))})}return r!=="all"&&(i=i.filter(s=>s.agent===r)),n!=="all"&&(i=i.filter(s=>s.status===n)),[...i].sort((s,o)=>s.status==="active"&&o.status!=="active"?-1:o.status==="active"&&s.status!=="active"?1:new Date(o.startedAt||o.created_date||0)-new Date(s.startedAt||s.created_date||0))}const _H={claude:{bg:"bg-orange-500/20",text:"text-orange-400",Icon:qi},codex:{bg:"bg-emerald-500/20",text:"text-emerald-400",Icon:Yd},gemini:{bg:"bg-blue-500/20",text:"text-blue-400",Icon:qi},human:{bg:"bg-slate-500/20",text:"text-slate-400",Icon:Kd},unassigned:{bg:"bg-slate-800",text:"text-slate-600",Icon:qi}},jH={bg:"bg-slate-800",text:"text-slate-600",Icon:qi},Hx={sm:{outer:"w-6 h-6",icon:"w-3 h-3"},md:{outer:"w-8 h-8",icon:"w-4 h-4"},lg:{outer:"w-10 h-10",icon:"w-5 h-5"}};function NH({agent:t,size:e="md",className:r}){const n=_H[t]||jH,i=Hx[e]||Hx.md,{Icon:s}=n;return l.jsx("span",{className:nt("inline-flex items-center justify-center rounded-full shrink-0",n.bg,n.text,i.outer,r),title:t||"unassigned",children:l.jsx(s,{className:i.icon})})}function oe(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function $n(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}const vS=6048e5,EH=864e5,Ua=43200,Ux=1440;let LH={};function ba(){return LH}function ta(t,e){var a,c,h,u;const r=ba(),n=(e==null?void 0:e.weekStartsOn)??((c=(a=e==null?void 0:e.locale)==null?void 0:a.options)==null?void 0:c.weekStartsOn)??r.weekStartsOn??((u=(h=r.locale)==null?void 0:h.options)==null?void 0:u.weekStartsOn)??0,i=oe(t),s=i.getDay(),o=(s<n?7:0)+s-n;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function dc(t){return ta(t,{weekStartsOn:1})}function wS(t){const e=oe(t),r=e.getFullYear(),n=$n(t,0);n.setFullYear(r+1,0,4),n.setHours(0,0,0,0);const i=dc(n),s=$n(t,0);s.setFullYear(r,0,4),s.setHours(0,0,0,0);const o=dc(s);return e.getTime()>=i.getTime()?r+1:e.getTime()>=o.getTime()?r:r-1}function Vx(t){const e=oe(t);return e.setHours(0,0,0,0),e}function pc(t){const e=oe(t),r=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return r.setUTCFullYear(e.getFullYear()),+t-+r}function BH(t,e){const r=Vx(t),n=Vx(e),i=+r-pc(r),s=+n-pc(n);return Math.round((i-s)/EH)}function AH(t){const e=wS(t),r=$n(t,0);return r.setFullYear(e,0,4),r.setHours(0,0,0,0),dc(r)}function gl(t,e){const r=oe(t),n=oe(e),i=r.getTime()-n.getTime();return i<0?-1:i>0?1:i}function MH(t){return $n(t,Date.now())}function IH(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function FH(t){if(!IH(t)&&typeof t!="number")return!1;const e=oe(t);return!isNaN(Number(e))}function PH(t,e){const r=oe(t),n=oe(e),i=r.getFullYear()-n.getFullYear(),s=r.getMonth()-n.getMonth();return i*12+s}function $H(t){return e=>{const n=(t?Math[t]:Math.trunc)(e);return n===0?0:n}}function DH(t,e){return+oe(t)-+oe(e)}function OH(t){const e=oe(t);return e.setHours(23,59,59,999),e}function RH(t){const e=oe(t),r=e.getMonth();return e.setFullYear(e.getFullYear(),r+1,0),e.setHours(23,59,59,999),e}function zH(t){const e=oe(t);return+OH(e)==+RH(e)}function qH(t,e){const r=oe(t),n=oe(e),i=gl(r,n),s=Math.abs(PH(r,n));let o;if(s<1)o=0;else{r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-i*s);let a=gl(r,n)===-i;zH(oe(t))&&s===1&&gl(t,n)===1&&(a=!1),o=i*(s-Number(a))}return o===0?0:o}function WH(t,e,r){const n=DH(t,e)/1e3;return $H(r==null?void 0:r.roundingMethod)(n)}function HH(t){const e=oe(t),r=$n(t,0);return r.setFullYear(e.getFullYear(),0,1),r.setHours(0,0,0,0),r}const UH={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},VH=(t,e,r)=>{let n;const i=UH[t];return typeof i=="string"?n=i:e===1?n=i.one:n=i.other.replace("{{count}}",e.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function iu(t){return(e={})=>{const r=e.width?String(e.width):t.defaultWidth;return t.formats[r]||t.formats[t.defaultWidth]}}const YH={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},GH={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},XH={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},KH={date:iu({formats:YH,defaultWidth:"full"}),time:iu({formats:GH,defaultWidth:"full"}),dateTime:iu({formats:XH,defaultWidth:"full"})},QH={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},ZH=(t,e,r,n)=>QH[t];function ho(t){return(e,r)=>{const n=r!=null&&r.context?String(r.context):"standalone";let i;if(n==="formatting"&&t.formattingValues){const o=t.defaultFormattingWidth||t.defaultWidth,a=r!=null&&r.width?String(r.width):o;i=t.formattingValues[a]||t.formattingValues[o]}else{const o=t.defaultWidth,a=r!=null&&r.width?String(r.width):t.defaultWidth;i=t.values[a]||t.values[o]}const s=t.argumentCallback?t.argumentCallback(e):e;return i[s]}}const JH={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},tU={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},eU={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},rU={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},nU={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},iU={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},sU=(t,e)=>{const r=Number(t),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},oU={ordinalNumber:sU,era:ho({values:JH,defaultWidth:"wide"}),quarter:ho({values:tU,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ho({values:eU,defaultWidth:"wide"}),day:ho({values:rU,defaultWidth:"wide"}),dayPeriod:ho({values:nU,defaultWidth:"wide",formattingValues:iU,defaultFormattingWidth:"wide"})};function uo(t){return(e,r={})=>{const n=r.width,i=n&&t.matchPatterns[n]||t.matchPatterns[t.defaultMatchWidth],s=e.match(i);if(!s)return null;const o=s[0],a=n&&t.parsePatterns[n]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(a)?lU(a,d=>d.test(o)):aU(a,d=>d.test(o));let h;h=t.valueCallback?t.valueCallback(c):c,h=r.valueCallback?r.valueCallback(h):h;const u=e.slice(o.length);return{value:h,rest:u}}}function aU(t,e){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&e(t[r]))return r}function lU(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return r}function cU(t){return(e,r={})=>{const n=e.match(t.matchPattern);if(!n)return null;const i=n[0],s=e.match(t.parsePattern);if(!s)return null;let o=t.valueCallback?t.valueCallback(s[0]):s[0];o=r.valueCallback?r.valueCallback(o):o;const a=e.slice(i.length);return{value:o,rest:a}}}const hU=/^(\d+)(th|st|nd|rd)?/i,uU=/\d+/i,dU={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},pU={any:[/^b/i,/^(a|c)/i]},fU={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},mU={any:[/1/i,/2/i,/3/i,/4/i]},gU={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},xU={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},yU={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},bU={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},CU={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},kU={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},vU={ordinalNumber:cU({matchPattern:hU,parsePattern:uU,valueCallback:t=>parseInt(t,10)}),era:uo({matchPatterns:dU,defaultMatchWidth:"wide",parsePatterns:pU,defaultParseWidth:"any"}),quarter:uo({matchPatterns:fU,defaultMatchWidth:"wide",parsePatterns:mU,defaultParseWidth:"any",valueCallback:t=>t+1}),month:uo({matchPatterns:gU,defaultMatchWidth:"wide",parsePatterns:xU,defaultParseWidth:"any"}),day:uo({matchPatterns:yU,defaultMatchWidth:"wide",parsePatterns:bU,defaultParseWidth:"any"}),dayPeriod:uo({matchPatterns:CU,defaultMatchWidth:"any",parsePatterns:kU,defaultParseWidth:"any"})},SS={code:"en-US",formatDistance:VH,formatLong:KH,formatRelative:ZH,localize:oU,match:vU,options:{weekStartsOn:0,firstWeekContainsDate:1}};function wU(t){const e=oe(t);return BH(e,HH(e))+1}function SU(t){const e=oe(t),r=+dc(e)-+AH(e);return Math.round(r/vS)+1}function TS(t,e){var u,d,f,p;const r=oe(t),n=r.getFullYear(),i=ba(),s=(e==null?void 0:e.firstWeekContainsDate)??((d=(u=e==null?void 0:e.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??i.firstWeekContainsDate??((p=(f=i.locale)==null?void 0:f.options)==null?void 0:p.firstWeekContainsDate)??1,o=$n(t,0);o.setFullYear(n+1,0,s),o.setHours(0,0,0,0);const a=ta(o,e),c=$n(t,0);c.setFullYear(n,0,s),c.setHours(0,0,0,0);const h=ta(c,e);return r.getTime()>=a.getTime()?n+1:r.getTime()>=h.getTime()?n:n-1}function TU(t,e){var a,c,h,u;const r=ba(),n=(e==null?void 0:e.firstWeekContainsDate)??((c=(a=e==null?void 0:e.locale)==null?void 0:a.options)==null?void 0:c.firstWeekContainsDate)??r.firstWeekContainsDate??((u=(h=r.locale)==null?void 0:h.options)==null?void 0:u.firstWeekContainsDate)??1,i=TS(t,e),s=$n(t,0);return s.setFullYear(i,0,n),s.setHours(0,0,0,0),ta(s,e)}function _U(t,e){const r=oe(t),n=+ta(r,e)-+TU(r,e);return Math.round(n/vS)+1}function ne(t,e){const r=t<0?"-":"",n=Math.abs(t).toString().padStart(e,"0");return r+n}const vn={y(t,e){const r=t.getFullYear(),n=r>0?r:1-r;return ne(e==="yy"?n%100:n,e.length)},M(t,e){const r=t.getMonth();return e==="M"?String(r+1):ne(r+1,2)},d(t,e){return ne(t.getDate(),e.length)},a(t,e){const r=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(t,e){return ne(t.getHours()%12||12,e.length)},H(t,e){return ne(t.getHours(),e.length)},m(t,e){return ne(t.getMinutes(),e.length)},s(t,e){return ne(t.getSeconds(),e.length)},S(t,e){const r=e.length,n=t.getMilliseconds(),i=Math.trunc(n*Math.pow(10,r-3));return ne(i,e.length)}},Mi={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Yx={G:function(t,e,r){const n=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(t,e,r){if(e==="yo"){const n=t.getFullYear(),i=n>0?n:1-n;return r.ordinalNumber(i,{unit:"year"})}return vn.y(t,e)},Y:function(t,e,r,n){const i=TS(t,n),s=i>0?i:1-i;if(e==="YY"){const o=s%100;return ne(o,2)}return e==="Yo"?r.ordinalNumber(s,{unit:"year"}):ne(s,e.length)},R:function(t,e){const r=wS(t);return ne(r,e.length)},u:function(t,e){const r=t.getFullYear();return ne(r,e.length)},Q:function(t,e,r){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return ne(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(t,e,r){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return ne(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(t,e,r){const n=t.getMonth();switch(e){case"M":case"MM":return vn.M(t,e);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(t,e,r){const n=t.getMonth();switch(e){case"L":return String(n+1);case"LL":return ne(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(t,e,r,n){const i=_U(t,n);return e==="wo"?r.ordinalNumber(i,{unit:"week"}):ne(i,e.length)},I:function(t,e,r){const n=SU(t);return e==="Io"?r.ordinalNumber(n,{unit:"week"}):ne(n,e.length)},d:function(t,e,r){return e==="do"?r.ordinalNumber(t.getDate(),{unit:"date"}):vn.d(t,e)},D:function(t,e,r){const n=wU(t);return e==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):ne(n,e.length)},E:function(t,e,r){const n=t.getDay();switch(e){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(t,e,r,n){const i=t.getDay(),s=(i-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return ne(s,2);case"eo":return r.ordinalNumber(s,{unit:"day"});case"eee":return r.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(i,{width:"short",context:"formatting"});case"eeee":default:return r.day(i,{width:"wide",context:"formatting"})}},c:function(t,e,r,n){const i=t.getDay(),s=(i-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return ne(s,e.length);case"co":return r.ordinalNumber(s,{unit:"day"});case"ccc":return r.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(i,{width:"narrow",context:"standalone"});case"cccccc":return r.day(i,{width:"short",context:"standalone"});case"cccc":default:return r.day(i,{width:"wide",context:"standalone"})}},i:function(t,e,r){const n=t.getDay(),i=n===0?7:n;switch(e){case"i":return String(i);case"ii":return ne(i,e.length);case"io":return r.ordinalNumber(i,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(t,e,r){const i=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,e,r){const n=t.getHours();let i;switch(n===12?i=Mi.noon:n===0?i=Mi.midnight:i=n/12>=1?"pm":"am",e){case"b":case"bb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,e,r){const n=t.getHours();let i;switch(n>=17?i=Mi.evening:n>=12?i=Mi.afternoon:n>=4?i=Mi.morning:i=Mi.night,e){case"B":case"BB":case"BBB":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,e,r){if(e==="ho"){let n=t.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return vn.h(t,e)},H:function(t,e,r){return e==="Ho"?r.ordinalNumber(t.getHours(),{unit:"hour"}):vn.H(t,e)},K:function(t,e,r){const n=t.getHours()%12;return e==="Ko"?r.ordinalNumber(n,{unit:"hour"}):ne(n,e.length)},k:function(t,e,r){let n=t.getHours();return n===0&&(n=24),e==="ko"?r.ordinalNumber(n,{unit:"hour"}):ne(n,e.length)},m:function(t,e,r){return e==="mo"?r.ordinalNumber(t.getMinutes(),{unit:"minute"}):vn.m(t,e)},s:function(t,e,r){return e==="so"?r.ordinalNumber(t.getSeconds(),{unit:"second"}):vn.s(t,e)},S:function(t,e){return vn.S(t,e)},X:function(t,e,r){const n=t.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return Xx(n);case"XXXX":case"XX":return Xn(n);case"XXXXX":case"XXX":default:return Xn(n,":")}},x:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"x":return Xx(n);case"xxxx":case"xx":return Xn(n);case"xxxxx":case"xxx":default:return Xn(n,":")}},O:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Gx(n,":");case"OOOO":default:return"GMT"+Xn(n,":")}},z:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Gx(n,":");case"zzzz":default:return"GMT"+Xn(n,":")}},t:function(t,e,r){const n=Math.trunc(t.getTime()/1e3);return ne(n,e.length)},T:function(t,e,r){const n=t.getTime();return ne(n,e.length)}};function Gx(t,e=""){const r=t>0?"-":"+",n=Math.abs(t),i=Math.trunc(n/60),s=n%60;return s===0?r+String(i):r+String(i)+e+ne(s,2)}function Xx(t,e){return t%60===0?(t>0?"-":"+")+ne(Math.abs(t)/60,2):Xn(t,e)}function Xn(t,e=""){const r=t>0?"-":"+",n=Math.abs(t),i=ne(Math.trunc(n/60),2),s=ne(n%60,2);return r+i+e+s}const Kx=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},_S=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},jU=(t,e)=>{const r=t.match(/(P+)(p+)?/)||[],n=r[1],i=r[2];if(!i)return Kx(t,e);let s;switch(n){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;case"PPPP":default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",Kx(n,e)).replace("{{time}}",_S(i,e))},NU={p:_S,P:jU},EU=/^D+$/,LU=/^Y+$/,BU=["D","DD","YY","YYYY"];function AU(t){return EU.test(t)}function MU(t){return LU.test(t)}function IU(t,e,r){const n=FU(t,e,r);if(console.warn(n),BU.includes(t))throw new RangeError(n)}function FU(t,e,r){const n=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const PU=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,$U=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,DU=/^'([^]*?)'?$/,OU=/''/g,RU=/[a-zA-Z]/;function zU(t,e,r){var u,d,f,p;const n=ba(),i=n.locale??SS,s=n.firstWeekContainsDate??((d=(u=n.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,o=n.weekStartsOn??((p=(f=n.locale)==null?void 0:f.options)==null?void 0:p.weekStartsOn)??0,a=oe(t);if(!FH(a))throw new RangeError("Invalid time value");let c=e.match($U).map(m=>{const x=m[0];if(x==="p"||x==="P"){const g=NU[x];return g(m,i.formatLong)}return m}).join("").match(PU).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const x=m[0];if(x==="'")return{isToken:!1,value:qU(m)};if(Yx[x])return{isToken:!0,value:m};if(x.match(RU))throw new RangeError("Format string contains an unescaped latin alphabet character `"+x+"`");return{isToken:!1,value:m}});i.localize.preprocessor&&(c=i.localize.preprocessor(a,c));const h={firstWeekContainsDate:s,weekStartsOn:o,locale:i};return c.map(m=>{if(!m.isToken)return m.value;const x=m.value;(MU(x)||AU(x))&&IU(x,e,String(t));const g=Yx[x[0]];return g(a,x,i.localize,h)}).join("")}function qU(t){const e=t.match(DU);return e?e[1].replace(OU,"'"):t}function WU(t,e,r){const n=ba(),i=(r==null?void 0:r.locale)??n.locale??SS,s=2520,o=gl(t,e);if(isNaN(o))throw new RangeError("Invalid time value");const a=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:o});let c,h;o>0?(c=oe(e),h=oe(t)):(c=oe(t),h=oe(e));const u=WH(h,c),d=(pc(h)-pc(c))/1e3,f=Math.round((u-d)/60);let p;if(f<2)return r!=null&&r.includeSeconds?u<5?i.formatDistance("lessThanXSeconds",5,a):u<10?i.formatDistance("lessThanXSeconds",10,a):u<20?i.formatDistance("lessThanXSeconds",20,a):u<40?i.formatDistance("halfAMinute",0,a):u<60?i.formatDistance("lessThanXMinutes",1,a):i.formatDistance("xMinutes",1,a):f===0?i.formatDistance("lessThanXMinutes",1,a):i.formatDistance("xMinutes",f,a);if(f<45)return i.formatDistance("xMinutes",f,a);if(f<90)return i.formatDistance("aboutXHours",1,a);if(f<Ux){const m=Math.round(f/60);return i.formatDistance("aboutXHours",m,a)}else{if(f<s)return i.formatDistance("xDays",1,a);if(f<Ua){const m=Math.round(f/Ux);return i.formatDistance("xDays",m,a)}else if(f<Ua*2)return p=Math.round(f/Ua),i.formatDistance("aboutXMonths",p,a)}if(p=qH(h,c),p<12){const m=Math.round(f/Ua);return i.formatDistance("xMonths",m,a)}else{const m=p%12,x=Math.trunc(p/12);return m<3?i.formatDistance("aboutXYears",x,a):m<9?i.formatDistance("overXYears",x,a):i.formatDistance("almostXYears",x+1,a)}}function HU(t,e){return WU(t,MH(t),e)}function Nf({date:t,className:e}){if(!t)return l.jsx("span",{className:nt("text-muted-foreground",e),children:"—"});let r;try{if(r=typeof t=="string"?new Date(t):t,isNaN(r.getTime()))return l.jsx("span",{className:nt("text-muted-foreground",e),children:"—"})}catch{return l.jsx("span",{className:nt("text-muted-foreground",e),children:"—"})}const n=HU(r,{addSuffix:!0}),i=zU(r,"PPpp");return l.jsx("time",{dateTime:r.toISOString(),title:i,className:nt("text-muted-foreground tabular-nums",e),children:n})}function jS({sessions:t=[],items:e=[],onSelectItem:r,featureCode:n,focusActive:i,onToggleFocus:s}){const[o,a]=C.useState(""),[c,h]=C.useState("all"),[u,d]=C.useState("all"),f=C.useMemo(()=>t.filter(m=>m.status==="active").length,[t]),p=C.useMemo(()=>{let m=TH(t,{search:o,agentFilter:c,statusFilter:u});return i&&n&&(m=m.filter(x=>x.featureCode===n||x.feature_code===n)),m},[t,o,c,u,i,n]);return l.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2 border-b border-border shrink-0",children:[l.jsx(oa,{featureCode:n,active:i,onToggle:s}),l.jsxs("div",{className:"flex items-center gap-1 text-[10px]",children:[l.jsx("span",{className:nt("w-2 h-2 rounded-full",f>0?"bg-emerald-400":"bg-slate-600")}),l.jsxs("span",{className:"text-muted-foreground",children:[f," active"]})]}),l.jsx("div",{className:"h-4 w-px bg-border"}),l.jsxs("div",{className:"relative",children:[l.jsx(fn,{className:"absolute left-1.5 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),l.jsx("input",{type:"text",placeholder:"Search…",value:o,onChange:m=>a(m.target.value),className:"text-xs pl-5 pr-2 py-0.5 h-6 rounded bg-muted text-foreground border border-border w-32"})]}),l.jsxs("select",{value:c,onChange:m=>h(m.target.value),className:"text-xs px-1.5 py-0.5 h-6 rounded bg-muted text-foreground border border-border cursor-pointer",children:[l.jsx("option",{value:"all",children:"All agents"}),ny.filter(m=>m!=="unassigned").map(m=>l.jsx("option",{value:m,children:m},m))]}),l.jsxs("select",{value:u,onChange:m=>d(m.target.value),className:"text-xs px-1.5 py-0.5 h-6 rounded bg-muted text-foreground border border-border cursor-pointer",children:[l.jsx("option",{value:"all",children:"All status"}),["active","completed","failed","paused"].map(m=>l.jsx("option",{value:m,children:m},m))]}),l.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[p.length,"/",t.length]})]}),l.jsxs("div",{className:"flex-1 overflow-auto",children:[p.length===0&&l.jsx(aa,{icon:Ud,title:"No sessions",description:"Sessions appear when agents start working",className:"py-8"}),p.map(m=>l.jsx(UU,{session:m,items:e,onSelectItem:r},m.id))]})]})}function UU({session:t,items:e,onSelectItem:r}){const n=t.workType||t.work_type,i=t.featureCode||t.feature_code,s=t.startedAt||t.created_date,o=Df[n]||Df.exploring,a=i?e.find(c=>{var h;return c.featureCode===i||c.feature_code===i||((h=c.lifecycle)==null?void 0:h.featureCode)===i}):null;return l.jsxs("div",{className:"flex flex-col gap-1 px-3 py-2.5 border-b border-border/50 hover:bg-muted/30 transition-colors",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(NH,{agent:t.agent,size:"sm",className:"shrink-0"}),l.jsx(wp,{status:t.status,className:"shrink-0"}),n&&l.jsx("span",{className:nt("text-[10px] px-1.5 py-0.5 rounded",o),children:n}),i&&l.jsx("button",{onClick:()=>a&&(r==null?void 0:r(a.id)),className:nt("text-[10px] font-mono",a?"text-blue-400 hover:underline cursor-pointer":"text-muted-foreground cursor-default"),children:i}),l.jsx(Nf,{date:s,className:"ml-auto text-[10px] shrink-0"})]}),t.summary&&l.jsx("p",{className:"text-[11px] text-muted-foreground truncate",children:t.summary}),l.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground",children:[l.jsxs("span",{children:["📄 ",t.reads??0]}),l.jsxs("span",{children:["📤 ",t.writes??0]}),l.jsxs("span",{className:(t.errors??0)>0?"text-red-400":void 0,children:["⚠ ",t.errors??0]})]})]})}const Qx=t=>Symbol.iterator in t,Zx=t=>"entries"in t,Jx=(t,e)=>{const r=t instanceof Map?t:new Map(t.entries()),n=e instanceof Map?e:new Map(e.entries());if(r.size!==n.size)return!1;for(const[i,s]of r)if(!n.has(i)||!Object.is(s,n.get(i)))return!1;return!0},VU=(t,e)=>{const r=t[Symbol.iterator](),n=e[Symbol.iterator]();let i=r.next(),s=n.next();for(;!i.done&&!s.done;){if(!Object.is(i.value,s.value))return!1;i=r.next(),s=n.next()}return!!i.done&&!!s.done};function YU(t,e){return Object.is(t,e)?!0:typeof t!="object"||t===null||typeof e!="object"||e===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e)?!1:Qx(t)&&Qx(e)?Zx(t)&&Zx(e)?Jx(t,e):VU(t,e):Jx({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function vi(t){const e=Dt.useRef(void 0);return r=>{const n=t(r);return YU(e.current,n)?e.current:e.current=n}}function NS({open:t,onClose:e,onSelectItem:r,onSelectGate:n}){const{items:i,gates:s,sessions:o}=lr(vi(g=>({items:g.items,gates:g.gates,sessions:g.sessions}))),[a,c]=C.useState(""),[h,u]=C.useState(0),d=C.useRef(null);C.useEffect(()=>{t&&(c(""),u(0),setTimeout(()=>{var g;return(g=d.current)==null?void 0:g.focus()},0))},[t]);const f=C.useMemo(()=>{if(!t)return[];if(!a.trim()){const w=s.filter(T=>T.status==="pending").slice(0,3).map(T=>({type:"gate",id:T.id,label:$o(T,i.find(S=>S.id===T.itemId)),sub:un[T.stepId]?`${Ce[T.fromPhase]??T.fromPhase} → ${Ce[T.toPhase]??T.toPhase}`:null,status:"pending",gate:T})),_=i.filter(T=>T.status==="blocked").slice(0,3).map(T=>({type:"item",id:T.id,label:T.title,sub:T.type,status:T.status,item:T}));return[...w.length?[{type:"section",label:"Pending Gates"}]:[],...w,..._.length?[{type:"section",label:"Blocked Items"}]:[],..._]}const g=a.toLowerCase(),y=i.filter(w=>{var _,T;return((_=w.title)==null?void 0:_.toLowerCase().includes(g))||((T=w.featureCode)==null?void 0:T.toLowerCase().includes(g))||(w.description||"").toLowerCase().includes(g)}).slice(0,5).map(w=>({type:"item",id:w.id,label:w.title,sub:`${w.type} · ${w.phase??""}`,status:w.status,item:w})),k=s.filter(w=>{var _;return(w.fromPhase||"").toLowerCase().includes(g)||(w.toPhase||"").toLowerCase().includes(g)||(((_=i.find(T=>T.id===w.itemId))==null?void 0:_.title)??"").toLowerCase().includes(g)}).slice(0,3).map(w=>({type:"gate",id:w.id,label:$o(w,i.find(_=>_.id===w.itemId)),sub:w.status,status:w.status,gate:w})),b=(o||[]).filter(w=>(w.featureCode||"").toLowerCase().includes(g)||(w.summary||"").toLowerCase().includes(g)).slice(0,2).map(w=>({type:"session",id:w.id,label:w.featureCode||w.id,sub:w.summary||w.agent||"",status:w.status,session:w}));return[...y.length?[{type:"section",label:"Items"}]:[],...y,...k.length?[{type:"section",label:"Gates"}]:[],...k,...b.length?[{type:"section",label:"Sessions"}]:[],...b]},[t,a,i,s,o]),p=f.filter(g=>g.type!=="section"),m=C.useCallback(g=>{if(g.key==="Escape"){e();return}if(g.key==="ArrowDown"){g.preventDefault(),u(y=>(y+1)%Math.max(1,p.length));return}if(g.key==="ArrowUp"){g.preventDefault(),u(y=>(y-1+Math.max(1,p.length))%Math.max(1,p.length));return}if(g.key==="Enter"){const y=p[h];if(!y)return;y.type==="gate"?n==null||n(y.id):y.type==="item"?r==null||r(y.id):e();return}if(g.key==="Backspace"&&a===""){e();return}},[p,h,a,e,n,r]);let x=0;return t?l.jsx("div",{className:"fixed inset-0 z-[100] flex items-start justify-center pt-[15vh]",onClick:e,children:l.jsxs("div",{className:"w-full max-w-[640px] mx-4 rounded-xl border border-slate-700 bg-card shadow-2xl overflow-hidden",onClick:g=>g.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-slate-700/50",children:[l.jsx(fn,{className:"h-4 w-4 text-muted-foreground shrink-0"}),l.jsx("input",{ref:d,value:a,onChange:g=>{c(g.target.value),u(0)},onKeyDown:m,placeholder:"Search items, gates, sessions…",className:"flex-1 bg-transparent text-sm text-foreground placeholder:text-muted-foreground outline-none"}),l.jsx("kbd",{className:"text-[10px] text-muted-foreground border border-border rounded px-1 py-0.5",children:"esc"})]}),l.jsxs("div",{className:"max-h-80 overflow-y-auto py-1",children:[f.length===0&&l.jsx("div",{className:"py-8 text-center text-xs text-muted-foreground",children:a?"No results":"No pending gates or blocked items"}),f.map((g,y)=>{if(g.type==="section")return l.jsx("div",{className:"px-4 pt-2 pb-1",children:l.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:g.label})},`section-${y}`);const k=x++,b=h===k;return l.jsxs("button",{className:nt("flex w-full items-center gap-3 px-4 py-2 text-left transition-colors",b?"bg-accent/10":"hover:bg-muted/50"),onMouseEnter:()=>u(k),onClick:()=>{g.type==="gate"?n==null||n(g.id):g.type==="item"?r==null||r(g.id):e()},children:[g.type==="gate"&&l.jsx(gi,{className:"h-4 w-4 text-amber-400 shrink-0"}),g.type==="item"&&l.jsx(vc,{className:"h-4 w-4 text-muted-foreground/60 shrink-0"}),g.type==="session"&&l.jsx(Ud,{className:"h-4 w-4 text-blue-400 shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-sm text-foreground truncate",children:g.label}),g.sub&&l.jsx("div",{className:"text-[10px] text-muted-foreground truncate",children:g.sub})]}),g.status&&l.jsx(wp,{status:g.status})]},g.id)})]}),l.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-t border-slate-700/50 text-[10px] text-muted-foreground",children:[l.jsxs("span",{children:[l.jsx("kbd",{className:"border border-border rounded px-1",children:"↑↓"})," navigate"]}),l.jsxs("span",{children:[l.jsx("kbd",{className:"border border-border rounded px-1",children:"↵"})," select"]}),l.jsxs("span",{children:[l.jsx("kbd",{className:"border border-border rounded px-1",children:"esc"})," close"]})]})]})}):null}const Va=[{id:"feature",label:"Feature",defaults:{type:"feature",phase:"vision",priority:2,governance:"gate"}},{id:"task",label:"Task",defaults:{type:"task",phase:"planning",priority:1,governance:"flag"}},{id:"decision",label:"Decision",defaults:{type:"decision",phase:"specification",priority:2,governance:"gate"}},{id:"question",label:"Question",defaults:{type:"question",phase:"specification",priority:1,governance:"flag"}},{id:"idea",label:"Idea",defaults:{type:"idea",phase:"vision",priority:0,governance:"skip"}},{id:"spec",label:"Spec",defaults:{type:"spec",phase:"specification",priority:2,governance:"gate"}}],GU=["gate","flag","skip"];function t0(t){return{type:"task",title:"",description:"",phase:(t==null?void 0:t.phase)??"planning",priority:1,assignedTo:"unassigned",governance:"flag",featureCode:""}}function ES({open:t,onClose:e,parentItem:r,initialType:n="task"}){const i=lr(b=>b.createItem),[s,o]=C.useState(()=>t0(r)),[a,c]=C.useState("task"),[h,u]=C.useState(!1),[d,f]=C.useState(!1),[p,m]=C.useState(""),x=C.useRef(null);C.useEffect(()=>{if(t){const b=Va.find(_=>_.id===n)||Va.find(_=>_.id==="task"),w=t0(r);o({...w,type:b.defaults.type,phase:(r==null?void 0:r.phase)??b.defaults.phase,priority:b.defaults.priority,governance:b.defaults.governance}),c(b.id),u(!1),m(""),setTimeout(()=>{var _;return(_=x.current)==null?void 0:_.focus()},50)}},[t,r,n]);const g=b=>{const w=Va.find(_=>_.id===b);w&&(c(b),o(_=>({..._,type:w.defaults.type,phase:(r==null?void 0:r.phase)??w.defaults.phase,priority:w.defaults.priority,governance:w.defaults.governance})))},y=async()=>{if(!s.title.trim()){m("Title is required");return}f(!0),m("");try{const b={type:s.type,title:s.title.trim(),description:s.description.trim()||void 0,phase:s.phase||void 0,status:"planned",confidence:0,priority:s.priority,assignedTo:s.assignedTo!=="unassigned"?s.assignedTo:void 0,governance:s.governance!=="flag"?s.governance:void 0,featureCode:s.featureCode.trim()||void 0};await i(b),e()}catch{m("Failed to create item")}finally{f(!1)}},k=b=>{b.key==="Enter"&&!b.shiftKey&&b.target.tagName!=="TEXTAREA"&&(b.preventDefault(),y())};return l.jsx(xc,{open:t,onOpenChange:b=>!b&&e(),children:l.jsxs(yc,{className:"max-w-md",onKeyDown:k,children:[l.jsx(bc,{children:l.jsx(Cc,{children:"New Item"})}),l.jsxs("div",{className:"px-6 pb-2 space-y-4",children:[l.jsx("div",{className:"grid grid-cols-5 gap-1.5",children:Va.map(b=>l.jsx("button",{type:"button",onClick:()=>g(b.id),className:nt("rounded-md px-2 py-1.5 text-[11px] font-medium border transition-colors",a===b.id?"bg-accent/10 border-accent/60 text-accent":"border-border/40 text-muted-foreground hover:border-border hover:text-foreground"),children:b.label},b.id))}),l.jsx("input",{ref:x,type:"text",placeholder:"Item title…",value:s.title,onChange:b=>o(w=>({...w,title:b.target.value})),className:"w-full text-sm bg-muted text-foreground px-3 py-2 rounded-md border border-border outline-none focus:border-ring"}),l.jsx("textarea",{placeholder:"Description (optional)…",value:s.description,onChange:b=>o(w=>({...w,description:b.target.value})),rows:2,className:"w-full text-sm bg-muted text-foreground px-3 py-2 rounded-md border border-border outline-none focus:border-ring resize-none"}),l.jsxs("button",{type:"button",onClick:()=>u(b=>!b),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[h?l.jsx(G0,{className:"h-3 w-3"}):l.jsx(ks,{className:"h-3 w-3"}),"Advanced"]}),h&&l.jsxs("div",{className:"space-y-3 border border-border/40 rounded-md p-3 bg-muted/20",children:[l.jsxs("label",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Feature Code"}),l.jsx("input",{type:"text",placeholder:"e.g. COMP-UI-5",value:s.featureCode,onChange:b=>o(w=>({...w,featureCode:b.target.value})),className:"text-xs bg-muted text-foreground px-2 py-1 rounded border border-border outline-none"})]}),l.jsxs("label",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Phase"}),l.jsx("select",{value:s.phase,onChange:b=>o(w=>({...w,phase:b.target.value})),className:"text-xs bg-muted text-foreground px-2 py-1 rounded border border-border cursor-pointer",children:ey.map(b=>l.jsx("option",{value:b,children:kl[b]??b},b))})]}),l.jsxs("label",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Priority"}),l.jsxs("select",{value:s.priority,onChange:b=>o(w=>({...w,priority:Number(b.target.value)})),className:"text-xs bg-muted text-foreground px-2 py-1 rounded border border-border cursor-pointer",children:[l.jsx("option",{value:0,children:"Low (0)"}),l.jsx("option",{value:1,children:"Normal (1)"}),l.jsx("option",{value:2,children:"High (2)"}),l.jsx("option",{value:3,children:"Critical (3)"})]})]}),l.jsxs("label",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Assign to"}),l.jsx("select",{value:s.assignedTo,onChange:b=>o(w=>({...w,assignedTo:b.target.value})),className:"text-xs bg-muted text-foreground px-2 py-1 rounded border border-border cursor-pointer",children:ny.map(b=>l.jsx("option",{value:b,children:b},b))})]}),l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Governance"}),l.jsx("div",{className:"flex gap-1.5",children:GU.map(b=>l.jsx("button",{type:"button",onClick:()=>o(w=>({...w,governance:b})),className:nt("flex-1 text-[11px] px-2 py-1 rounded border transition-colors",s.governance===b?b==="gate"?"bg-amber-500/20 text-amber-300 border-amber-500/40":b==="flag"?"bg-blue-500/20 text-blue-300 border-blue-500/40":"bg-slate-700 text-slate-400 border-slate-600":"border-border/40 text-muted-foreground hover:border-border"),children:b},b))})]})]}),p&&l.jsx("p",{className:"text-xs text-destructive",children:p})]}),l.jsxs(Hd,{children:[l.jsx(At,{variant:"ghost",size:"sm",onClick:e,disabled:d,children:"Cancel"}),l.jsx(At,{size:"sm",onClick:y,disabled:d||!s.title.trim(),children:d?"Creating…":"Create"})]})]})})}const XU=["explore_design","prd","architecture","blueprint","verification","plan","execute","report","docs","ship"],KU=[{id:"gate",Icon:gi,label:"Gate",active:"bg-amber-500/20 text-amber-300 border-amber-500/40"},{id:"flag",Icon:K0,label:"Flag",active:"bg-blue-500/20 text-blue-300 border-blue-500/40"},{id:"skip",Icon:J0,label:"Skip",active:"bg-slate-700 text-slate-400 border-slate-600"}];function QU(t,e){var r,n;return((n=(r=t==null?void 0:t.governance)==null?void 0:r.phases)==null?void 0:n[e])??"flag"}function LS({open:t,onClose:e,settings:r,onSettingsChange:n}){const[i,s]=C.useState(!1),o=C.useRef(null),a=C.useCallback((c,h)=>{n==null||n({governance:{phases:{[c]:h}}}),clearTimeout(o.current),s(!0),o.current=setTimeout(()=>s(!1),1500)},[n]);return l.jsx(xc,{open:t,onOpenChange:c=>!c&&e(),children:l.jsxs(yc,{className:"max-w-sm",children:[l.jsx(bc,{children:l.jsxs("div",{className:"flex items-center justify-between pr-6",children:[l.jsx(Cc,{children:"Governance Settings"}),i&&l.jsx("span",{className:"text-[11px] text-emerald-400 font-medium",children:"Saved ✓"})]})}),l.jsx("div",{className:"px-6 pb-6 space-y-1 max-h-96 overflow-y-auto",children:XU.map(c=>{const h=c==="explore_design",u=QU(r,c),d=Ce[c]??c;return l.jsxs("div",{className:nt("flex items-center gap-3 rounded-md px-2 py-1.5",h&&"opacity-40"),children:[l.jsx("span",{className:nt("text-xs flex-1 min-w-0 truncate",h?"text-muted-foreground":"text-foreground"),children:d}),h?l.jsx("span",{className:"text-[10px] text-muted-foreground italic",children:"no policy"}):l.jsx("div",{className:"flex gap-1 shrink-0",children:KU.map(f=>{const p=u===f.id,{Icon:m}=f;return l.jsxs("button",{onClick:()=>a(c,f.id),title:f.label,className:nt("flex items-center gap-1 px-2 py-0.5 text-[10px] rounded border transition-colors",p?f.active:"border-border/30 text-muted-foreground hover:border-border hover:text-foreground"),children:[l.jsx(m,{className:"h-2.5 w-2.5"}),f.label]},f.id)})})]},c)})}),l.jsx("div",{className:"px-6 pb-4 text-[10px] text-muted-foreground border-t border-border/30 pt-3",children:"Agent config via Compose CLI"})]})})}function BS({onOpenGate:t}){const{gates:e,items:r}=lr(vi(g=>({gates:g.gates,items:g.items}))),[n,i]=C.useState(new Set),[s,o]=C.useState(0),a=e.filter(g=>g.status==="pending"&&!n.has(g.id));if(a.length===0)return null;const c=Math.min(s,a.length-1),h=a[c],u=r.find(g=>g.id===h.itemId)||r.find(g=>{var y;return((y=g.lifecycle)==null?void 0:y.featureCode)&&h.featureCode&&g.lifecycle.featureCode===h.featureCode}),d=$o(h,u),f=yj[h.fromPhase]??bj,p=()=>{i(g=>new Set([...g,h.id])),c>=a.length-1&&c>0&&o(c-1)},m=()=>o(Math.max(0,c-1)),x=()=>o(Math.min(a.length-1,c+1));return l.jsxs("div",{className:nt("shrink-0 h-10 border-t flex items-center gap-2 px-3",f.bg,f.border),children:[l.jsx(gi,{className:nt("h-3.5 w-3.5 shrink-0",f.text)}),l.jsx("span",{className:nt("text-[11px] font-medium truncate flex-1 min-w-0",f.text),children:d}),a.length>1&&l.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[l.jsx("button",{onClick:m,disabled:c===0,className:"p-0.5 rounded hover:bg-muted/50 disabled:opacity-30 transition-colors",children:l.jsx(Y0,{className:"h-3 w-3"})}),l.jsxs("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:[c+1,"/",a.length]}),l.jsx("button",{onClick:x,disabled:c===a.length-1,className:"p-0.5 rounded hover:bg-muted/50 disabled:opacity-30 transition-colors",children:l.jsx(ii,{className:"h-3 w-3"})})]}),l.jsx("button",{onClick:()=>t==null?void 0:t(h.id),className:nt("shrink-0 text-[10px] px-2 py-0.5 rounded border transition-colors hover:opacity-80",f.border,f.text),children:"Review"}),l.jsx("button",{onClick:p,className:"shrink-0 p-0.5 rounded hover:bg-muted/50 text-muted-foreground hover:text-foreground transition-colors",title:"Dismiss (page session only)",children:l.jsx(Kr,{className:"h-3 w-3"})})]})}const ZU="●",JU="text-zinc-400";function tV(t,e){if(!t)return"";const n=(e??Date.now())-new Date(t).getTime(),i=Math.floor(n/6e4);if(i<1)return"now";if(i<60)return`${i}m`;const s=Math.floor(i/60);return s<24?`${s}h`:`${Math.floor(s/24)}d`}function eV(t){var e;return((e=iy[t])==null?void 0:e.icon)??ZU}function rV(t){var e;return((e=iy[t])==null?void 0:e.color)??JU}const nV={IMPLEMENTER:"bg-blue-500/15 text-blue-300 border border-blue-500/25",REVIEWER:"bg-emerald-500/15 text-emerald-300 border border-emerald-500/25",PRODUCER:"bg-purple-500/15 text-purple-300 border border-purple-500/25"};function iV(t){return nV[t]??"bg-zinc-500/15 text-zinc-300 border border-zinc-500/25"}function sV(t,e){return t.filter(r=>r.feature_code===e).slice().sort((r,n)=>r.timestamp.localeCompare(n.timestamp))}function oV(t){if(!t)return"";try{return new Date(t).toISOString().slice(11,16)}catch{return""}}function aV({event:t,now:e}){const r=eV(t.kind),n=rV(t.kind),i=tV(t.timestamp,e);return l.jsxs("div",{"data-decision-card":!0,className:"inline-flex flex-col gap-0.5 w-40 shrink-0 rounded border border-border/40 bg-muted/20 px-2 py-1.5 text-left",children:[l.jsxs("div",{className:"flex items-center justify-between gap-1",children:[l.jsx("span",{className:nt("text-[11px] shrink-0",n),children:r}),l.jsx("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums",children:i||oV(t.timestamp)})]}),l.jsx("p",{className:"text-[11px] text-foreground/80 truncate leading-tight",children:t.title}),t.roles&&t.roles.length>0&&l.jsx("div",{className:"flex flex-wrap gap-0.5 mt-0.5",children:t.roles.map((s,o)=>l.jsx("span",{"data-role-chip":!0,className:nt("text-[9px] px-1 py-px rounded-full leading-tight",iV(s.name)),children:s.name},o))})]})}function AS({events:t=[],currentFeatureCode:e,now:r}){const n=sV(t,e);return n.length===0?null:l.jsx("div",{className:"w-full overflow-x-auto whitespace-nowrap border-b border-border/30 bg-background/95 backdrop-blur-sm",style:{height:72,minHeight:72,maxHeight:72,position:"sticky",top:32,zIndex:20},"data-decision-timeline-strip":!0,children:l.jsx("div",{className:"flex items-center gap-2 px-3 h-full",children:n.map(i=>l.jsx(aV,{event:i,now:r},i.id))})})}function lV(t){if(!t)return[];const e=[];t.active_phase!=null&&e.push({label:"Phase",value:t.active_phase});const r=t.pending_gates??[];e.push({label:"Pending gates",value:r.length===0?"none":r.join(", ")}),e.push({label:"Open loops",value:t.open_loops_count??0}),e.push({label:"Gate load (24h)",value:t.gate_load_24h??0});const n=t.drift_alerts??[];return n.length>0?e.push({label:"Drift alerts",value:n.map(i=>i.axis_id||i.name||"unknown").join(", ")}):e.push({label:"Drift alerts",value:"none"}),t.computed_at&&e.push({label:"Updated",value:t.computed_at}),e}const cV="Select a feature to see status.";function MS({featureCode:t,snapshot:e}){const[r,n]=C.useState(!1),i=C.useCallback(()=>{n(a=>!a)},[]),s=(e==null?void 0:e.sentence)??cV,o=lV(e);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{"data-status-band":!0,onClick:i,style:{position:"sticky",top:"0px",zIndex:30,height:"32px",minHeight:"32px",maxHeight:"32px",cursor:"pointer",display:"flex",alignItems:"center",paddingLeft:"12px",paddingRight:"12px",userSelect:"none",overflow:"hidden"},className:"w-full bg-background/95 backdrop-blur-sm border-b border-border/30 text-sm text-foreground/80",title:s,"aria-expanded":r,role:"button",tabIndex:0,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&i()},children:[l.jsx("span",{style:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",flex:1},children:s}),l.jsx("span",{style:{marginLeft:8,opacity:.5,fontSize:10},"aria-hidden":"true",children:r?"▲":"▼"})]}),r&&l.jsx("div",{"data-status-band-expansion":!0,style:{position:"relative",width:"100%",zIndex:29,maxHeight:200,overflowY:"auto"},className:"bg-background/98 border-b border-border/50 text-xs text-foreground/70",children:l.jsx("div",{style:{padding:"8px 12px"},children:o.length===0?l.jsx("span",{className:"text-muted-foreground",children:"No details available."}):l.jsx("table",{style:{width:"100%",borderCollapse:"collapse"},children:l.jsx("tbody",{children:o.map((a,c)=>l.jsxs("tr",{children:[l.jsx("td",{style:{paddingRight:16,paddingBottom:2,fontWeight:500,whiteSpace:"nowrap"},className:"text-foreground/60",children:a.label}),l.jsx("td",{style:{paddingBottom:2},children:String(a.value)})]},c))})})})})]})}function hV({onContextSelect:t,sidebarOpen:e=!0,onToggleSidebar:r}){const{items:n,connections:i,connected:s,uiCommand:o,clearUICommand:a,recentChanges:c,createItem:h,updateItem:u,deleteItem:d,createConnection:f,deleteConnection:p,agentActivity:m,agentErrors:x,sessionState:g,registerSnapshotProvider:y,gates:k,gateEvent:b,resolveGate:w,settings:_,updateSettings:T,resetSettings:S,activeBuild:L,setActiveBuild:B,pipelineDraft:N,sessions:A,selectedPhase:R,setSelectedPhase:z,decisionEvents:P,statusSnapshots:I,setStatusSnapshot:F}=lr(),[$,O]=C.useState(()=>sessionStorage.getItem("vision-selectedItemId")||null),D=C.useRef(!!sessionStorage.getItem("vision-activeView")),[j,Y]=C.useState(()=>sessionStorage.getItem("vision-activeView")||"roadmap"),[et,M]=C.useState(""),[ct,X]=C.useState(null),[lt,It]=C.useState(!1),[Pt,Ct]=C.useState(!1),[G,it]=C.useState(!1);C.useEffect(()=>{sessionStorage.setItem("vision-activeView",j)},[j]),C.useEffect(()=>{$?sessionStorage.setItem("vision-selectedItemId",$):sessionStorage.removeItem("vision-selectedItemId")},[$]);const kt=C.useRef(!1);C.useEffect(()=>{var W;(W=_==null?void 0:_.ui)!=null&&W.defaultView&&!kt.current&&!D.current&&(Y(_.ui.defaultView),kt.current=!0)},[_]),C.useEffect(()=>{o&&(o.view&&Y(o.view),o.phase!==void 0&&z(o.phase),o.select!==void 0&&O(o.select),a())},[o,a]),C.useEffect(()=>{const W=()=>{var H;return["INPUT","TEXTAREA","SELECT"].includes((H=document.activeElement)==null?void 0:H.tagName)},Z=H=>{(H.metaKey||H.ctrlKey)&&H.key==="k"&&(H.preventDefault(),It(J=>!J)),(H.metaKey||H.ctrlKey)&&H.key==="n"&&(H.preventDefault(),Ct(!0)),H.key===","&&!H.metaKey&&!H.ctrlKey&&!W()&&it(!0)};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[]);const Tt=C.useMemo(()=>{let W=n;if(R&&(W=W.filter(Z=>Z.phase===R)),et){const Z=et.toLowerCase();W=W.filter(H=>H.title.toLowerCase().includes(Z)||(H.description||"").toLowerCase().includes(Z))}return W},[n,R,et]),qt=C.useMemo(()=>R?n.filter(W=>W.phase===R):n,[n,R]),Qt=C.useMemo(()=>new Set(qt.map(W=>W.id)),[qt]),Gt=C.useMemo(()=>R?k.filter(W=>Qt.has(W.itemId)):k,[k,Qt,R]),Se=C.useMemo(()=>{if(!R&&!et)return i;const W=new Set(Tt.map(Z=>Z.id));return i.filter(Z=>W.has(Z.fromId)&&W.has(Z.toId))},[i,Tt,R,et]);C.useEffect(()=>{y(()=>({activeView:j,selectedPhase:R,searchQuery:et,selectedItemId:$,totalItems:n.length,filteredCount:Tt.length,connected:s}))},[y,j,R,et,$,n.length,Tt.length,s]);const Xt=C.useCallback(W=>{O(W),t&&t({type:"item",id:W})},[t]),Ye=C.useCallback((W,Z)=>{u(W,Z)},[u]);C.useCallback(async()=>{const Z=await h({type:"task",title:"New item",description:"",status:"planned",confidence:0,phase:R||"vision"});Z&&Z.id&&O(Z.id)},[h,R]),C.useCallback(async W=>{await d(W),$===W&&(O(null),t&&t(null))},[d,$,t]);const le=C.useCallback(W=>{const Z=k.find(H=>H.id===W);Z&&(O(Z.itemId),t&&t({type:"item",id:Z.itemId}))},[k,t]);C.useCallback(async W=>f(W),[f]),C.useCallback(async W=>p(W),[p]);const Ae=C.useCallback(()=>{vt("/api/build/state").then(W=>W.json()).then(W=>B(W.state??null)).catch(()=>{})},[B]),De=C.useCallback(W=>{t&&t({type:"step",id:W})},[t]),Le=C.useMemo(()=>{var Z;if(!$)return null;const W=n.find(H=>H.id===$);return((Z=W==null?void 0:W.lifecycle)==null?void 0:Z.featureCode)||null},[$,n]);return C.useEffect(()=>{Le&&(I&&I[Le]||vt(`/api/lifecycle/status?featureCode=${encodeURIComponent(Le)}`).then(W=>W.json()).then(W=>{W.snapshot&&F&&F(Le,W.snapshot)}).catch(()=>{}))},[Le]),l.jsx(Nc.Provider,{value:c,children:l.jsxs("div",{className:"h-full flex flex-col bg-background","data-snapshot-root":!0,children:[l.jsx(MS,{featureCode:Le,snapshot:Le?(I==null?void 0:I[Le])??null:null}),Le&&l.jsx(AS,{events:P,currentFeatureCode:Le}),l.jsxs("div",{className:"flex-1 flex min-h-0",children:[l.jsxs("div",{className:"flex h-full shrink-0",style:{borderRight:"1px solid hsl(var(--border))"},children:[r&&l.jsx("button",{className:"w-4 h-full flex items-center justify-center text-[10px] text-muted-foreground hover:text-foreground transition-colors select-none",onClick:r,title:e?"Collapse sidebar":"Expand sidebar","aria-expanded":e,"aria-label":"Toggle sidebar",style:{background:"hsl(var(--muted) / 0.3)"},children:e?"‹":"›"}),e&&l.jsx(Mb,{items:n,gates:k,activeBuild:L,activeView:j,onViewChange:Y,selectedPhase:R,onPhaseSelect:z,searchQuery:et,onSearchChange:M,connected:s,agentActivity:m,agentErrors:x,sessionState:g,onSelectItem:Xt,onThemeChange:T,onNewItem:()=>Ct(!0)})]}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[!s&&l.jsx("div",{className:"text-center text-[10px] py-0.5 bg-destructive text-destructive-foreground",children:"Disconnected — reconnecting..."}),j==="tree"&&l.jsx(Fb,{items:Tt,connections:Se,selectedItemId:$,onSelect:Xt}),j==="graph"&&l.jsx($b,{items:Tt,connections:Se,selectedItemId:$,onSelect:Xt}),j==="pipeline"&&l.jsx(kS,{activeBuild:L,pipelineDraft:N,onSelectStep:De,onRefresh:Ae}),j==="sessions"&&l.jsx(jS,{sessions:A,items:n,onSelectItem:Xt}),j==="docs"&&l.jsx(mS,{items:qt}),j==="gates"&&l.jsx(xS,{gates:Gt,items:qt,onResolve:w,onSelect:Xt}),j==="settings"&&l.jsx(CS,{settings:_,onSettingsChange:T,onReset:S})]}),l.jsx(BS,{onOpenGate:le}),ct&&(()=>{const W=n.find(Z=>Z.id===ct);return W?l.jsx(bS,{item:W,items:n,connections:i,onUpdate:Ye,onClose:()=>X(null)}):null})(),l.jsx(yS,{event:b,items:n,onNavigate:()=>Y("gates")}),l.jsx(NS,{open:lt,onClose:()=>It(!1),onSelectItem:W=>{Xt(W),It(!1)},onSelectGate:W=>{le(W),It(!1)}}),l.jsx(ES,{open:Pt,onClose:()=>Ct(!1)}),l.jsx(LS,{open:G,onClose:()=>it(!1),settings:_,onSettingsChange:T})]})]})})}ra.use(H0);const uV={background:"#0b0b14",overlay:"#161625",textPrimary:"#f1f5f9",textSecondary:"#94a3b8",textTertiary:"#64748b",textMuted:"#475569",accent:"#FBBF24"},dV={background:"#FFFFFF",overlay:"#F5F5F5",textPrimary:"#0a0a0a",textSecondary:"#404040",textTertiary:"#737373",textMuted:"#a3a3a3",accent:"#FBBF24"};function pV(t){return[{selector:"node",style:{label:"data(label)","text-valign":"center","text-halign":"center","font-size":"11px","font-weight":600,"font-family":'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',color:t.textPrimary,"text-wrap":"wrap","text-max-width":"110px","background-color":t.overlay,"border-width":1,"border-color":"data(color)","border-opacity":.5,width:140,height:52,shape:"round-rectangle","text-outline-width":0,"overlay-padding":4,"overlay-opacity":0}},{selector:'node[shape = "diamond"]',style:{shape:"diamond",width:160,height:80,"font-size":"10px"}},{selector:"node:selected",style:{"border-width":2,"border-opacity":1,"border-color":t.accent}},{selector:"edge",style:{width:1,"line-color":t.textMuted,"target-arrow-color":t.textMuted,"target-arrow-shape":"triangle","curve-style":"bezier","arrow-scale":.7,opacity:.5}},{selector:"edge[label]",style:{label:"data(label)","font-size":"10px","font-family":'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',color:t.textSecondary,"text-rotation":"autorotate","text-margin-y":-8,"text-outline-width":3,"text-outline-color":t.background}},{selector:"edge[color]",style:{"line-color":"data(color)","target-arrow-color":"data(color)"}},{selector:'edge[lineStyle = "dashed"]',style:{"line-style":"dashed"}},{selector:'edge[lineStyle = "dotted"]',style:{"line-style":"dotted"}},{selector:":parent",style:{"background-color":t.overlay,"background-opacity":.3,"border-width":1,"border-color":"data(color)","border-opacity":.3,"text-valign":"top","text-halign":"center","font-size":"10px",color:t.textTertiary,padding:"16px"}}]}function fV(){const[t,e]=C.useState(()=>document.documentElement.classList.contains("dark"));return C.useEffect(()=>{const r=new MutationObserver(()=>e(document.documentElement.classList.contains("dark")));return r.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),t}const mV={"dagre-tb":{name:"dagre",rankDir:"LR",rankSep:80,nodeSep:50,padding:40},"dagre-lr":{name:"dagre",rankDir:"TB",rankSep:100,nodeSep:40,padding:40},circle:{name:"circle",padding:40},grid:{name:"grid",padding:40,rows:3},concentric:{name:"concentric",padding:40,minNodeSpacing:60},breadthfirst:{name:"breadthfirst",padding:40,spacingFactor:1.2}},gV={"dagre-tb":"Top → Down","dagre-lr":"Left → Right",circle:"Circle",grid:"Grid",concentric:"Concentric",breadthfirst:"Breadthfirst"};function xV(t,e){const r=[];for(const n of t)r.push({data:{id:n.id,label:n.label,sublabel:n.sublabel||void 0,color:n.color||CY.textMuted,parent:n.parent||void 0,shape:n.shape||void 0},...n.position?{position:n.position}:{}});for(const n of e)r.push({data:{id:n.id||`${n.from}-${n.to}-${n.label||""}`,source:n.from,target:n.to,label:n.label||void 0,color:n.color||void 0,lineStyle:n.style||"solid",edgeType:n.type||void 0}});return r}const fc="compose:graph:";function yV(t){try{const e=localStorage.getItem(fc+t);return e?JSON.parse(e):null}catch{return null}}function bV(t,e){try{localStorage.setItem(fc+t,JSON.stringify(e))}catch{}}const CV=[{style:"solid",label:"Structural / hard",dash:null},{style:"dashed",label:"Informational / weak",dash:"4,3"},{style:"dotted",label:"Soft dependency",dash:"1.5,3"}];function zi({onClick:t,active:e,children:r,title:n}){return l.jsx("button",{onClick:t,title:n,className:"text-xs rounded cursor-pointer transition-colors font-semibold",style:{padding:"4px 8px",borderRadius:"0.375rem",border:"1px solid",borderColor:e?"hsl(var(--primary) / 0.1)":"hsl(var(--border))",background:e?"hsl(var(--primary) / 0.1)":"hsl(var(--accent))",color:e?"hsl(var(--primary))":"hsl(var(--muted-foreground))"},children:r})}function Ya({mode:t,active:e,onClick:r}){return l.jsx("button",{onClick:r,className:"text-xs rounded cursor-pointer capitalize transition-colors font-semibold",style:{padding:"4px 8px",borderRadius:"0.375rem",border:"1px solid",borderColor:e?"hsl(var(--primary) / 0.1)":"hsl(var(--border))",background:e?"hsl(var(--primary) / 0.1)":"hsl(var(--accent))",color:e?"hsl(var(--primary))":"hsl(var(--muted-foreground) / 0.6)"},children:t})}function su(){return l.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"hsl(var(--border))"}})}function e0({arrow:t,label:e,edgeStyle:r,color:n,targetLabel:i,targetColor:s,suffix:o}){return l.jsxs("div",{className:"flex items-center gap-2 text-xs",style:{padding:"4px 8px",color:"hsl(var(--muted-foreground))"},children:[l.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:t}),l.jsx("span",{style:{color:n||"hsl(var(--muted-foreground))",fontStyle:r==="dashed"?"italic":"normal"},children:e||"connects"}),i?l.jsxs(l.Fragment,{children:[l.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:"→"}),l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0",style:{background:s||"hsl(var(--muted-foreground) / 0.6)"}}),l.jsx("span",{style:{color:"hsl(var(--foreground))"},children:i})]})]}):o?l.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:o}):null,r&&r!=="solid"&&l.jsxs("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:["(",r,")"]})]})}function kV({nodes:t,edges:e,graphKey:r}){const[n,i]=C.useState(()=>{try{const c=localStorage.getItem(fc+r+":tree-collapsed");return c?new Set(JSON.parse(c)):new Set}catch{return new Set}});C.useEffect(()=>{try{localStorage.setItem(fc+r+":tree-collapsed",JSON.stringify([...n]))}catch{}},[n,r]);const s=C.useMemo(()=>{const c={};for(const h of t)c[h.id]=h;return c},[t]),o=C.useMemo(()=>{var u,d;const c={},h={};for(const f of t)c[f.id]=[],h[f.id]=[];for(const f of e)(u=c[f.from])==null||u.push(f),(d=h[f.to])==null||d.push(f);return{out:c,inc:h}},[t,e]),a=c=>i(h=>{const u=new Set(h);return u.has(c)?u.delete(c):u.add(c),u});return l.jsxs("div",{className:"w-full h-full overflow-y-auto",style:{background:"hsl(var(--background))",padding:"1rem"},children:[l.jsxs("div",{className:"flex items-center mb-4",style:{gap:"8px"},children:[l.jsx(zi,{onClick:()=>i(new Set),children:"Expand all"}),l.jsx(zi,{onClick:()=>i(new Set(t.map(c=>c.id))),children:"Collapse all"}),l.jsxs("span",{className:"text-xs ml-auto",style:{color:"hsl(var(--muted-foreground))"},children:[t.length," entities · ",e.length," relations"]})]}),t.map(c=>{const h=n.has(c.id),u=o.out[c.id]||[],d=o.inc[c.id]||[],f=u.filter(g=>g.from===g.to),p=u.filter(g=>g.from!==g.to),m=d.filter(g=>g.from!==g.to),x=p.length+m.length+f.length;return l.jsxs("div",{className:"mb-0.5",children:[l.jsxs("button",{onClick:()=>a(c.id),className:"flex items-center w-full text-left bg-transparent border-none cursor-pointer rounded-md transition-colors hover:bg-[hsl(var(--accent))]",style:{gap:"8px",padding:"8px"},children:[l.jsx("span",{className:"text-xs w-4 text-center inline-block transition-transform",style:{color:"hsl(var(--muted-foreground))",transform:h?"rotate(-90deg)":"rotate(0deg)"},children:"▼"}),l.jsx("span",{className:"w-3 h-3 shrink-0",style:{borderRadius:c.shape==="diamond"?0:3,background:c.color,transform:c.shape==="diamond"?"rotate(45deg) scale(0.8)":"none"}}),l.jsx("span",{className:"text-sm font-semibold",style:{color:"hsl(var(--foreground))"},children:c.label}),c.sublabel&&l.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--muted-foreground))"},children:["— ",c.sublabel]}),l.jsx("span",{className:"text-xs ml-auto",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:x})]}),!h&&l.jsxs("div",{style:{paddingLeft:"32px",paddingBottom:"4px"},children:[p.map((g,y)=>{var k,b;return l.jsx(e0,{arrow:"→",label:g.label,edgeStyle:g.style,color:g.color,targetLabel:((k=s[g.to])==null?void 0:k.label)||g.to,targetColor:(b=s[g.to])==null?void 0:b.color},`out-${y}`)}),f.map((g,y)=>l.jsx(e0,{arrow:"↻",label:g.label,edgeStyle:g.style,color:g.color,suffix:"(self)"},`self-${y}`)),m.map((g,y)=>{var k,b;return l.jsxs("div",{className:"flex items-center gap-2 text-xs",style:{padding:"4px 8px",color:"hsl(var(--muted-foreground))"},children:[l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0",style:{background:((k=s[g.from])==null?void 0:k.color)||"hsl(var(--muted-foreground) / 0.6)"}}),l.jsx("span",{style:{color:"hsl(var(--foreground))"},children:((b=s[g.from])==null?void 0:b.label)||g.from})]}),l.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:"→"}),l.jsx("span",{style:{color:g.color||"hsl(var(--muted-foreground))",fontStyle:g.style==="dashed"?"italic":"normal"},children:g.label||"connects"}),l.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:"→ this"}),g.style&&g.style!=="solid"&&l.jsxs("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:["(",g.style,")"]})]},`in-${y}`)}),x===0&&l.jsx("div",{className:"text-xs italic",style:{padding:"4px 8px",color:"hsl(var(--muted-foreground) / 0.6)"},children:"no relations"})]})]},c.id)})]})}function vV({elements:t,nodes:e,edges:r,layout:n,style:i,title:s,subtitle:o,graphKey:a="default",onNodeClick:c}){const h=C.useRef(null),u=C.useRef(null),[d,f]=C.useState(null),p=fV(),m=p?uV:dV,x=C.useMemo(()=>yV(a),[a]),[g,y]=C.useState((x==null?void 0:x.layoutKey)||"dagre-tb"),[k,b]=C.useState((x==null?void 0:x.showEdgeLabels)??!0),[w,_]=C.useState(()=>new Set((x==null?void 0:x.hiddenNodes)||[])),[T,S]=C.useState((x==null?void 0:x.showLegend)??!0),[L,B]=C.useState((x==null?void 0:x.viewMode)||"graph");C.useEffect(()=>{bV(a,{layoutKey:g,showEdgeLabels:k,hiddenNodes:[...w],showLegend:T,viewMode:L})},[a,g,k,w,T,L]);const N=t||(e&&r?xV(e,r):[]),A=C.useMemo(()=>i||pV(m),[i,p]),R=n||mV[g],z=C.useMemo(()=>N.filter(j=>!j.data.source).map(j=>({id:j.data.id,label:j.data.label,color:j.data.color})),[JSON.stringify(N)]),P=C.useMemo(()=>w.size===0?N:N.filter(j=>j.data.source?!w.has(j.data.source)&&!w.has(j.data.target):!w.has(j.data.id)),[N,w]);C.useEffect(()=>{if(!h.current)return;const j=ra({container:h.current,elements:P,style:A,layout:R,minZoom:.2,maxZoom:4,wheelSensitivity:.3,boxSelectionEnabled:!1});return u.current=j,j.on("mouseover","node",Y=>{const et=Y.target;et.style("border-width",2),et.style("border-opacity",1);const M=et.renderedPosition();f({x:M.x,y:M.y-et.renderedHeight()/2-12,label:et.data("label"),sublabel:et.data("sublabel"),id:et.id(),color:et.data("color")})}),j.on("mouseout","node",Y=>{Y.target.style("border-width",1),Y.target.style("border-opacity",.5),f(null)}),c&&j.on("tap","node",Y=>c(Y.target.id())),j.on("layoutstop",()=>j.fit(void 0,40)),()=>{j.destroy(),u.current=null}},[JSON.stringify(P),JSON.stringify(R),p,L]),C.useEffect(()=>{const j=u.current;j&&j.edges().forEach(Y=>{Y.data("label")&&Y.style("label",k?Y.data("label"):"")})},[k]);const I=C.useCallback(()=>{var j;return(j=u.current)==null?void 0:j.fit(void 0,40)},[]),F=C.useCallback(()=>{const j=u.current;j&&j.zoom({level:j.zoom()*1.3,renderedPosition:{x:j.width()/2,y:j.height()/2}})},[]),$=C.useCallback(()=>{const j=u.current;j&&j.zoom({level:j.zoom()/1.3,renderedPosition:{x:j.width()/2,y:j.height()/2}})},[]),O=C.useCallback(j=>{_(Y=>{const et=new Set(Y);return et.has(j)?et.delete(j):et.add(j),et})},[]),D=C.useCallback(()=>_(new Set),[]);return L==="tree"?l.jsxs("div",{className:"w-full h-full flex flex-col",style:{background:"hsl(var(--background))"},children:[l.jsxs("div",{className:"flex items-center justify-between shrink-0",style:{padding:"8px 16px",borderBottom:"1px solid hsl(var(--border))"},children:[l.jsxs("div",{className:"flex items-center",style:{gap:"8px"},children:[s&&l.jsx("span",{className:"text-sm font-semibold",style:{color:"hsl(var(--foreground))"},children:s}),o&&l.jsx("span",{className:"text-xs",style:{color:"hsl(var(--muted-foreground))"},children:o})]}),l.jsxs("div",{className:"flex",style:{gap:"4px"},children:[l.jsx(Ya,{mode:"graph",active:L==="graph",onClick:()=>B("graph")}),l.jsx(Ya,{mode:"tree",active:L==="tree",onClick:()=>B("tree")})]})]}),l.jsx("div",{className:"flex-1 min-h-0",children:l.jsx(kV,{nodes:e||[],edges:r||[],graphKey:a})})]}):l.jsxs("div",{className:"w-full h-full relative",style:{background:"hsl(var(--background))"},children:[(s||o)&&l.jsxs("div",{className:"absolute top-0 left-0 right-0 z-[2] pointer-events-none",style:{padding:"8px 16px",background:"linear-gradient(to bottom, hsl(var(--background)) 0%, transparent 100%)"},children:[s&&l.jsx("div",{className:"text-sm font-semibold",style:{color:"hsl(var(--foreground))"},children:s}),o&&l.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"hsl(var(--muted-foreground))"},children:o})]}),l.jsxs("div",{className:"absolute top-2 right-3 z-[2] flex items-center",style:{gap:"4px"},children:[l.jsx("select",{value:g,onChange:j=>y(j.target.value),className:"text-xs rounded cursor-pointer appearance-none",style:{padding:"4px 8px",borderRadius:"0.375rem",background:"hsl(var(--accent))",border:"1px solid hsl(var(--border))",color:"hsl(var(--muted-foreground))"},title:"Graph layout",children:Object.entries(gV).map(([j,Y])=>l.jsx("option",{value:j,style:{background:"hsl(var(--accent))",color:"hsl(var(--foreground))"},children:Y},j))}),l.jsx(su,{}),l.jsx(zi,{onClick:$,title:"Zoom out",children:"−"}),l.jsx(zi,{onClick:I,title:"Fit to view",children:"Fit"}),l.jsx(zi,{onClick:F,title:"Zoom in",children:"+"}),l.jsx(su,{}),l.jsx(zi,{onClick:()=>S(!T),active:T,title:T?"Hide legend":"Show legend",children:"Legend"}),l.jsx(su,{}),l.jsx(Ya,{mode:"graph",active:L==="graph",onClick:()=>B("graph")}),l.jsx(Ya,{mode:"tree",active:L==="tree",onClick:()=>B("tree")})]}),T&&l.jsxs("div",{className:"absolute bottom-3 left-3 z-[2]",style:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:"0.5rem",padding:"8px 16px",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",minWidth:150,maxWidth:210},children:[l.jsxs("div",{className:"flex justify-between items-center mb-1.5",children:[l.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"hsl(var(--muted-foreground))"},children:"Entities"}),w.size>0&&l.jsx("button",{onClick:D,className:"text-[10px] bg-transparent border-none cursor-pointer p-0",style:{color:"hsl(var(--primary))"},children:"Show all"})]}),l.jsx("div",{className:"flex flex-col gap-1",children:z.map(j=>{const Y=w.has(j.id);return l.jsxs("button",{onClick:()=>O(j.id),className:"flex items-center gap-1.5 bg-transparent border-none py-0.5 cursor-pointer transition-opacity",style:{opacity:Y?.35:1},title:Y?`Show ${j.label}`:`Hide ${j.label}`,children:[l.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0 transition-colors",style:{background:Y?"transparent":j.color,border:`1.5px solid ${j.color}`}}),l.jsx("span",{className:"text-xs",style:{color:Y?"hsl(var(--muted-foreground) / 0.6)":"hsl(var(--muted-foreground))",textDecoration:Y?"line-through":"none"},children:j.label})]},j.id)})}),l.jsxs("div",{className:"flex justify-between items-center mt-2.5 mb-1.5",children:[l.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"hsl(var(--muted-foreground))"},children:"Edges"}),l.jsx("button",{onClick:()=>b(!k),className:"text-[10px] bg-transparent border-none cursor-pointer p-0",style:{color:k?"hsl(var(--primary))":"hsl(var(--muted-foreground) / 0.6)"},children:k?"Hide labels":"Show labels"})]}),l.jsx("div",{className:"flex flex-col gap-1",children:CV.map(j=>l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("svg",{width:"20",height:"6",className:"shrink-0",children:l.jsx("line",{x1:"0",y1:"3",x2:"20",y2:"3",stroke:"hsl(var(--muted-foreground))",strokeWidth:"1.5",strokeDasharray:j.dash||"none"})}),l.jsx("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:j.label})]},j.style))})]}),d&&l.jsxs("div",{className:"absolute z-10 text-center pointer-events-none backdrop-blur-sm",style:{left:d.x,top:d.y,transform:"translate(-50%, -100%)",background:"hsl(var(--accent))",border:"1px solid hsl(var(--border))",borderRadius:"0.5rem",padding:"4px 8px",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",minWidth:110,maxWidth:200},children:[l.jsx("div",{className:"text-sm font-semibold",style:{color:d.color||"hsl(var(--foreground))"},children:d.label}),d.sublabel&&l.jsx("div",{className:"text-xs mt-0.5",style:{color:"hsl(var(--muted-foreground))"},children:d.sublabel}),l.jsx("div",{className:"text-[10px] mt-1 font-mono",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:d.id})]}),l.jsx("div",{ref:h,className:"w-full h-full"})]})}const Ft={discovery:"#a78bfa",feature:"#3b82f6",track:"#06b6d4",task:"#94a3b8",spec:"#a78bfa",idea:"#fbbf24",question:"#f472b6",evaluation:"#f59e0b",thread:"#64748b",decision:"#22c55e",artifact:"#a87cb8",informs:"#64748b",pipeline:"#6366f1"},wV=[{id:"discovery",label:"Discovery",sublabel:"orthogonal process",color:Ft.discovery,shape:"diamond"},{id:"pipeline",label:"Feature Development Pipeline",color:Ft.pipeline},{id:"p-vision",label:"Vision",parent:"pipeline",color:Ft.pipeline},{id:"p-specification",label:"Specification",parent:"pipeline",color:Ft.pipeline},{id:"p-planning",label:"Planning",parent:"pipeline",color:Ft.pipeline},{id:"p-implementation",label:"Implementation",parent:"pipeline",color:Ft.pipeline},{id:"p-verification",label:"Verification",parent:"pipeline",color:Ft.pipeline},{id:"p-release",label:"Release",parent:"pipeline",color:Ft.pipeline},{id:"feature",label:"Feature",sublabel:"strategic container",color:Ft.feature},{id:"track",label:"Track",sublabel:"deliverable unit",color:Ft.track},{id:"task",label:"Task",sublabel:"planned → doing → done",color:Ft.task},{id:"spec",label:"Spec",sublabel:"behavioral specification",color:Ft.spec},{id:"evaluation",label:"Evaluation",sublabel:"assessment / gap analysis",color:Ft.evaluation},{id:"idea",label:"Idea",sublabel:"can float free",color:Ft.idea},{id:"thread",label:"Thread",sublabel:"deliberation",color:Ft.thread},{id:"decision",label:"Decision",sublabel:"resolved choice",color:Ft.decision},{id:"question",label:"Question",sublabel:"may block progress",color:Ft.question},{id:"artifact",label:"Artifact",sublabel:"journal / doc / output",color:Ft.artifact}],SV=[{from:"p-vision",to:"p-specification",color:Ft.pipeline},{from:"p-specification",to:"p-planning",color:Ft.pipeline},{from:"p-planning",to:"p-implementation",color:Ft.pipeline},{from:"p-implementation",to:"p-verification",color:Ft.pipeline},{from:"p-verification",to:"p-release",color:Ft.pipeline},{from:"idea",to:"p-vision",label:"lives in",color:Ft.idea,style:"dotted"},{from:"spec",to:"p-specification",label:"lives in",color:Ft.spec,style:"dotted"},{from:"task",to:"p-implementation",label:"lives in",color:Ft.task,style:"dotted"},{from:"evaluation",to:"p-verification",label:"lives in",color:Ft.evaluation,style:"dotted"},{from:"discovery",to:"feature",label:"produces",color:Ft.discovery,style:"dashed"},{from:"discovery",to:"idea",label:"produces",color:Ft.discovery,style:"dashed"},{from:"discovery",to:"thread",label:"produces",color:Ft.discovery,style:"dashed"},{from:"discovery",to:"decision",label:"produces",color:Ft.discovery,style:"dashed"},{from:"discovery",to:"question",label:"produces",color:Ft.discovery,style:"dashed"},{from:"discovery",to:"spec",label:"produces",color:Ft.discovery,style:"dashed"},{from:"track",to:"feature",label:"implements",color:Ft.track},{from:"task",to:"feature",label:"implements",color:Ft.task},{from:"spec",to:"feature",label:"implements",color:Ft.spec},{from:"feature",to:"feature",label:"blocks",color:Ft.question,id:"feat-blocks"},{from:"idea",to:"feature",label:"informs",color:Ft.informs,style:"dashed"},{from:"thread",to:"decision",label:"informs",color:Ft.informs,style:"dashed"},{from:"evaluation",to:"decision",label:"informs",color:Ft.informs,style:"dashed"},{from:"artifact",to:"feature",label:"supports",color:Ft.artifact},{from:"question",to:"decision",label:"contradicts",color:Ft.question},{from:"feature",to:"p-vision",label:"enters",color:Ft.feature,style:"dashed"}];function TV(){return l.jsx(vV,{graphKey:"product",nodes:wV,edges:SV,title:"Compose Product Ontology",subtitle:"10 entity types · 6 phases · 5 edge types · Discovery orthogonal"})}const _V="compose-popout";function IS(t){if(t==="vision://surface")return"Vision Tracker";if(t.startsWith("graph://")){const r=t.replace("graph://","");return r.charAt(0).toUpperCase()+r.slice(1)+" Graph"}const e=t.split("/");return e.length>1?e.slice(-2).join("/"):e[e.length-1]}function Ga({path:t,onDock:e}){return l.jsxs("div",{className:"flex items-center justify-between px-3 shrink-0",style:{height:"28px",borderBottom:"1px solid hsl(var(--border))",background:"hsl(var(--background))"},children:[l.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:IS(t)}),l.jsxs("button",{onClick:e,className:"flex items-center gap-1 px-2 py-0.5 rounded text-[10px] uppercase tracking-wider",style:{color:"hsl(var(--primary))",background:"none",border:"none",cursor:"pointer"},title:"Pop back into main window",children:[l.jsx(PT,{style:{width:11,height:11}}),"pop in"]})]})}function jV({path:t}){const[e,r]=C.useState(null),[n,i]=C.useState(!0),s=C.useRef(null),o=C.useRef(null),a=t.startsWith("vision://")?"vision":t.startsWith("graph://")?"graph":t.endsWith(".html")||t.endsWith(".htm")?"html":"markdown";C.useEffect(()=>{document.title=IS(t)+" — Compose"},[t]),C.useEffect(()=>{const h=new BroadcastChannel(_V);s.current=h,h.postMessage({type:"popout-mounted",path:t});const u=()=>{h.postMessage({type:"popout-closed",path:t})};return window.addEventListener("beforeunload",u),()=>{u(),h.close(),window.removeEventListener("beforeunload",u)}},[t]);const c=C.useCallback(()=>{var h;(h=s.current)==null||h.postMessage({type:"popout-dock",path:t}),window.close()},[t]);return C.useEffect(()=>{if(a==="vision"||a==="graph"){i(!1);return}vt(`/api/file?path=${encodeURIComponent(t)}`).then(h=>h.json()).then(h=>{h.content!==void 0&&r(h.content),i(!1)}).catch(()=>i(!1))},[t,a]),C.useEffect(()=>{if(a==="vision"||a==="graph")return;const h=new WebSocket(TT());return o.current=h,h.onmessage=u=>{try{const d=JSON.parse(u.data);d.type==="fileChanged"&&d.path===t&&r(d.content)}catch{}},()=>h.close()},[t,a]),n?l.jsx("div",{className:"h-screen w-screen flex items-center justify-center bg-background",children:l.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):a==="vision"?l.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[l.jsx(Ga,{path:t,onDock:c}),l.jsx("div",{className:"flex-1 min-h-0",children:l.jsx(hV,{})})]}):a==="graph"?l.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[l.jsx(Ga,{path:t,onDock:c}),l.jsx("div",{className:"flex-1 min-h-0",children:l.jsx(TV,{})})]}):a==="html"?l.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[l.jsx(Ga,{path:t,onDock:c}),l.jsx("div",{className:"flex-1 min-h-0",children:l.jsx("iframe",{srcDoc:e,className:"w-full h-full border-0",sandbox:"allow-scripts allow-same-origin",title:t})})]}):l.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[l.jsx(Ga,{path:t,onDock:c}),l.jsx("div",{className:"flex-1 overflow-y-auto px-8 py-6",children:l.jsx("div",{className:"canvas-markdown max-w-4xl mx-auto",children:l.jsx(pp,{remarkPlugins:[xp],children:e||""})})})]})}const NV="/api/stratum";async function rh(t,e={}){return(await vt(`${NV}${t}`,{headers:{"Content-Type":"application/json",...e.headers||{}},...e})).json()}function EV(t,e){return rh(t,{method:"POST",body:JSON.stringify(e)})}function FS({status:t}){const e={running:"hsl(var(--background))",awaiting_gate:"#7c3aed",complete:"#166534",killed:"#7f1d1d",blocked:"#7f1d1d"},r={running:"running",awaiting_gate:"gate pending",complete:"complete",killed:"killed",blocked:"blocked"};return l.jsx("span",{style:{fontSize:"0.72em",padding:"2px 6px",borderRadius:4,background:e[t]||"#333",color:"#e5e7eb",textTransform:"uppercase",letterSpacing:"0.05em"},children:r[t]||t})}function Ef(){return l.jsx("span",{style:{opacity:.5,fontSize:"0.85em"},children:"loading…"})}function LV({onAction:t}){const[e,r]=C.useState(null),[n,i]=C.useState(null),[s,o]=C.useState({}),[a,c]=C.useState({}),h=C.useCallback(()=>{rh("/gates").then(d=>{r(Array.isArray(d)?d:[]),i(null)}).catch(d=>i(d.message))},[]);C.useEffect(()=>{h();const d=setInterval(h,1e4);return()=>clearInterval(d)},[h]);async function u(d,f,p){const m=`${d}/${f}/${p}`;o(g=>({...g,[m]:!0}));const x=a[`${d}/${f}`]||"";try{const g=await EV(`/gates/${d}/${f}/${p}`,{note:x});g.conflict?i(`Gate already resolved (${d}/${f})`):g.error?i(g.error.message):(t==null||t(),h())}catch(g){i(g.message)}finally{o(g=>({...g,[m]:!1}))}}return e===null&&!n?l.jsx(Ef,{}):l.jsxs("section",{children:[l.jsxs("h3",{style:{fontSize:"0.8em",textTransform:"uppercase",letterSpacing:"0.08em",opacity:.5,margin:"0 0 8px"},children:["Pending Gates ",(e==null?void 0:e.length)>0&&l.jsxs("span",{style:{opacity:1,color:"#f59e0b"},children:["(",e.length,")"]})]}),n&&l.jsx("p",{style:{color:"#ef4444",fontSize:"0.8em",margin:"0 0 8px"},children:n}),(e==null?void 0:e.length)===0&&l.jsx("p",{style:{opacity:.4,fontSize:"0.85em"},children:"No pending gates."}),e==null?void 0:e.map(d=>{const f=`${d.flow_id}/${d.step_id}`,p=m=>s[`${f}/${m}`];return l.jsxs("div",{style:{border:"1px solid #3f3f46",borderRadius:6,padding:"10px 12px",marginBottom:8,background:"#18181b"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[l.jsx("span",{style:{fontWeight:600,fontSize:"0.9em"},children:d.flow_name||d.flow_id}),l.jsx("span",{style:{opacity:.4,fontSize:"0.8em"},children:"›"}),l.jsx("span",{style:{fontFamily:"monospace",fontSize:"0.82em",opacity:.7},children:d.step_id}),d.function&&l.jsxs("span",{style:{opacity:.4,fontSize:"0.78em"},children:["fn:",d.function]})]}),l.jsx("input",{type:"text",placeholder:"Note (optional)",value:a[f]||"",onChange:m=>c(x=>({...x,[f]:m.target.value})),style:{width:"100%",boxSizing:"border-box",marginBottom:8,background:"#27272a",border:"1px solid #3f3f46",borderRadius:4,color:"#e4e4e7",padding:"4px 8px",fontSize:"0.82em"}}),l.jsx("div",{style:{display:"flex",gap:6},children:[{a:"approve",label:"Approve",color:"#166534",hover:"#15803d"},{a:"reject",label:"Reject",color:"#7f1d1d",hover:"#b91c1c"},{a:"revise",label:"Revise",color:"#1e3a5f",hover:"#1d4ed8"}].map(({a:m,label:x,color:g})=>l.jsx("button",{disabled:p(m),onClick:()=>u(d.flow_id,d.step_id,m),style:{padding:"4px 12px",fontSize:"0.8em",borderRadius:4,border:"none",background:g,color:"#e5e7eb",cursor:p(m)?"not-allowed":"pointer",opacity:p(m)?.5:1},children:p(m)?"…":x},m))})]},f)})]})}function BV({flowId:t,onClose:e}){const[r,n]=C.useState(null),[i,s]=C.useState(null);return C.useEffect(()=>{rh(`/flows/${t}`).then(o=>{o.error?s(o.error.message):n(o)}).catch(o=>s(o.message))},[t]),l.jsxs("div",{style:{border:"1px solid #3f3f46",borderRadius:6,padding:"10px 12px",background:"#18181b"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[l.jsx("span",{style:{fontWeight:600,fontSize:"0.9em"},children:(r==null?void 0:r.flow_name)||t}),l.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"#9ca3af",cursor:"pointer",fontSize:"1.1em"},children:"✕"})]}),i&&l.jsx("p",{style:{color:"#ef4444",fontSize:"0.8em"},children:i}),!r&&!i&&l.jsx(Ef,{}),r&&l.jsx("div",{style:{fontSize:"0.82em",opacity:.8},children:(()=>{const o=new Set(Array.isArray(r.completed_steps)?r.completed_steps:[]),a=new Set(Array.isArray(r.active_steps)?r.active_steps:[]),c=o.size,h=r.step_count??"?";return l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:[l.jsx("span",{children:l.jsx(FS,{status:r.status})}),l.jsxs("span",{children:["steps ",c,"/",h,a.size>0&&l.jsxs("span",{style:{marginLeft:6,color:"#34d399",fontSize:"0.85em"},children:["∥ ",a.size," running"]})]}),r.round>0&&l.jsxs("span",{children:["round ",r.round]})]}),Array.isArray(r.ordered_steps)&&r.ordered_steps.length>0&&l.jsx("ol",{style:{margin:0,padding:"0 0 0 18px",lineHeight:1.7},children:r.ordered_steps.map(u=>l.jsxs("li",{style:{opacity:o.has(u.id)?.4:1,fontWeight:a.has(u.id)?700:"normal",color:a.has(u.id)?"#34d399":"inherit"},children:[l.jsx("span",{style:{fontFamily:"monospace"},children:u.id}),u.mode==="gate"&&l.jsx("span",{style:{marginLeft:6,color:"#f59e0b",fontSize:"0.9em"},children:"gate"}),a.has(u.id)&&l.jsx("span",{style:{marginLeft:6,fontSize:"0.85em"},children:"∥ running"})]},u.id))})]})})()})]})}function AV({activeBuild:t}){const[e,r]=C.useState(null),[n,i]=C.useState(null),[s,o]=C.useState(null),a=C.useCallback(()=>{rh("/flows").then(c=>{r(Array.isArray(c)?c:[]),i(null)}).catch(c=>i(c.message))},[]);return C.useEffect(()=>{a();const c=setInterval(a,15e3);return()=>clearInterval(c)},[a]),C.useEffect(()=>{t&&a()},[t,a]),e===null&&!n?l.jsx(Ef,{}):l.jsxs("section",{children:[l.jsx("h3",{style:{fontSize:"0.8em",textTransform:"uppercase",letterSpacing:"0.08em",opacity:.5,margin:"0 0 8px"},children:"Flows"}),n&&l.jsx("p",{style:{color:"#ef4444",fontSize:"0.8em"},children:n}),(e==null?void 0:e.length)===0&&l.jsx("p",{style:{opacity:.4,fontSize:"0.85em"},children:"No flows found."}),e==null?void 0:e.map(c=>l.jsx("div",{onClick:()=>o(s===c.flow_id?null:c.flow_id),style:{border:`1px solid ${s===c.flow_id?"#6366f1":"#3f3f46"}`,borderRadius:6,padding:"8px 12px",marginBottom:6,background:s===c.flow_id?"#1e1b4b":"#18181b",cursor:"pointer"},children:l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[l.jsx("span",{style:{fontSize:"0.88em",fontWeight:500},children:c.flow_name||c.flow_id}),l.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[l.jsxs("span",{style:{fontSize:"0.78em",opacity:.5},children:[Array.isArray(c.completed_steps)?c.completed_steps.length:c.completed_steps??0,"/",c.step_count??"?"]}),l.jsx(FS,{status:c.status})]})]})},c.flow_id)),s&&l.jsx("div",{style:{marginTop:8},children:l.jsx(BV,{flowId:s,onClose:()=>o(null)})})]})}const MV={display:"inline-block",width:8,height:8,borderRadius:"50%",background:"#22c55e",marginRight:8,animation:"pulse-dot 1.5s ease-in-out infinite"};if(typeof document<"u"&&!document.getElementById("pulse-dot-style")){const t=document.createElement("style");t.id="pulse-dot-style",t.textContent="@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }",document.head.appendChild(t)}function IV({build:t,onDismiss:e}){const r=t.status==="running",n=["complete","failed","aborted"].includes(t.status);C.useEffect(()=>{if(t.status==="complete"){const s=setTimeout(()=>e==null?void 0:e(),5e3);return()=>clearTimeout(s)}},[t.status,e]);const i={running:"#166534",complete:"#14532d",failed:"#7f1d1d",aborted:"#78350f"};return l.jsxs("div",{style:{border:`1px solid ${r?"#22c55e33":"#3f3f46"}`,borderRadius:6,padding:"10px 12px",marginBottom:12,background:i[t.status]||"#18181b"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[r&&l.jsx("span",{style:MV}),l.jsx("span",{style:{fontWeight:600,fontSize:"0.88em"},children:t.featureCode}),l.jsx("span",{style:{opacity:.5,fontSize:"0.78em"},children:r?"building":t.status})]}),n&&t.status!=="complete"&&l.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"#9ca3af",cursor:"pointer",fontSize:"0.9em"},children:"✕"})]}),l.jsxs("div",{style:{fontSize:"0.8em",opacity:.7,marginTop:4,fontFamily:"monospace"},children:[t.currentStepId,t.stepNum!=null&&t.totalSteps!=null&&l.jsxs("span",{style:{marginLeft:8,opacity:.5},children:["(",t.stepNum,"/",t.totalSteps,")"]}),t.retries>0&&l.jsxs("span",{style:{marginLeft:8,color:"#f59e0b"},children:["retry ",t.retries]})]})]})}function FV(){const t=lr(s=>s.activeBuild),[e,r]=C.useState(null),n=C.useCallback(()=>{t&&r(`${t.flowId}:${t.completedAt}`)},[t]);C.useEffect(()=>{(t==null?void 0:t.status)==="running"&&r(null)},[t==null?void 0:t.status]);const i=t&&!(e&&e===`${t.flowId}:${t.completedAt}`);return l.jsxs("div",{style:{padding:"12px 14px",color:"#e4e4e7",fontSize:"0.9em",overflowY:"auto",height:"100%"},children:[i&&l.jsx(IV,{build:t,onDismiss:n}),l.jsx(LV,{}),l.jsx("div",{style:{marginTop:20},children:l.jsx(AV,{activeBuild:t})})]})}function PV({projectName:t,projectRoot:e,onSwitch:r}){const[n,i]=C.useState(!1),[s,o]=C.useState(e||""),a=C.useRef(null);return C.useEffect(()=>{o(e||"")},[e]),C.useEffect(()=>{if(!n)return;const c=h=>{var u;(u=a.current)!=null&&u.contains(h.target)||i(!1)};return window.addEventListener("mousedown",c),()=>window.removeEventListener("mousedown",c)},[n]),C.useEffect(()=>{if(!n)return;const c=h=>{h.key==="Escape"&&i(!1)};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[n]),l.jsxs("div",{ref:a,className:"flex items-center shrink-0 gap-2 relative",children:[l.jsx("span",{className:"text-xs font-semibold tracking-widest uppercase text-blue-600 dark:text-accent",children:"Compose"}),l.jsx("button",{"data-testid":"project-btn",className:"text-[10px] uppercase tracking-wider text-muted-foreground hover:text-foreground transition-colors",onClick:()=>i(c=>!c),title:e||"Switch project","aria-label":"Switch project","aria-haspopup":"dialog","aria-expanded":n,children:t||"no project"}),n&&l.jsxs("div",{"data-testid":"project-popover",role:"dialog","aria-label":"Switch project",className:"absolute top-full left-0 mt-1 z-50 p-2 rounded-md shadow-lg",style:{background:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",minWidth:"280px"},children:[l.jsxs("div",{className:"text-[10px] text-muted-foreground mb-1 px-1",children:["Current: ",e]}),l.jsx("input",{autoFocus:!0,"data-testid":"project-input",className:"w-full px-2 py-1 text-xs rounded border bg-background text-foreground",style:{borderColor:"hsl(var(--border))"},placeholder:"Absolute path to project...",value:s,onChange:c=>o(c.target.value),onKeyDown:async c=>{c.key==="Enter"&&await r(s)&&i(!1),c.key==="Escape"&&i(!1)}})]})]})}const $V={dashboard:{label:"Dashboard",icon:S_,tip:"Overview of project status and activity"},tree:{label:"Items",icon:Q0,tip:"Hierarchical list of all items and features"},graph:{label:"Graph",icon:$_,tip:"Visual dependency graph of items"},pipeline:{label:"Pipeline",icon:pj,tip:"Build pipeline stages and progress"},sessions:{label:"Sessions",icon:Ud,tip:"Active and past agent sessions"},"build-history":{label:"Builds",icon:xu,tip:"History of past build runs and outcomes"},gates:{label:"Gates",icon:gi,tip:"Quality gates and approval checkpoints"},validate:{label:"Validate",icon:E_,tip:"Cross-artifact validation findings (compose validate)"},"qa-scope":{label:"QA Scope",icon:h_,tip:"Affected routes for the active feature (qa-scope)"},docs:{label:"Docs",icon:mi,tip:"Project documentation and specs"},journal:{label:"Journal",icon:V0,tip:"Project journal and changelog"},design:{label:"Design",icon:kc,tip:"Design agent conversations and decisions"},ideabox:{label:"Ideabox",icon:si,tip:"Captured ideas and suggestions"}};function DV({tabs:t=[],activeTab:e,onTabChange:r,onOpenPalette:n,badges:i={}}){return l.jsxs("div",{className:"flex items-center gap-0.5 h-full",role:"tablist","aria-label":"Main views",children:[t.map(s=>{const o=$V[s],a=s===e,c=o==null?void 0:o.icon,h=(o==null?void 0:o.label)||s,u=i[s];return l.jsxs("button",{role:"tab","aria-selected":a,title:o==null?void 0:o.tip,className:["flex items-center gap-1.5 px-3 h-full text-[11px] uppercase tracking-wider font-medium transition-colors","border-b-2 -mb-px",a?"border-blue-600 text-blue-600 dark:border-accent dark:text-accent":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"].join(" "),onClick:()=>r==null?void 0:r(s),children:[c&&l.jsx(c,{style:{width:12,height:12}}),h,u>0&&l.jsx("span",{className:"text-[9px] min-w-[16px] h-4 flex items-center justify-center rounded-full px-1 tabular-nums",style:{background:"hsl(var(--destructive) / 0.15)",color:"hsl(var(--destructive))"},children:u})]},s)}),l.jsx("div",{className:"flex-1"}),n&&l.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 px-2.5 h-full text-[11px] text-muted-foreground hover:text-foreground transition-colors",title:"Search (⌘K)",children:[l.jsx(fn,{style:{width:12,height:12}}),l.jsx("kbd",{className:"text-[9px] font-mono opacity-50 bg-muted px-1 py-0.5 rounded",children:"⌘K"})]})]})}function OV(){const[t,e]=C.useState(oy);function r(){const n=!t;zj(n),e(n)}return l.jsx("button",{className:"compose-btn-icon shrink-0",onClick:r,title:t?"Hide verbose events":"Show verbose events","aria-label":"Toggle verbose stream",style:t?{background:"hsl(210 60% 60% / 0.15)",color:"hsl(210 60% 60%)",borderRadius:"3px",padding:"1px 4px",fontSize:"10px"}:{fontSize:"10px"},children:"{ }"})}const qe={COLLAPSED:"collapsed",EXPANDED:"expanded",MAXIMIZED:"maximized"},RV={[qe.COLLAPSED]:qe.EXPANDED,[qe.EXPANDED]:qe.MAXIMIZED,[qe.MAXIMIZED]:qe.COLLAPSED};function zV(t){return RV[t]??qe.COLLAPSED}function qV(t){return qe.COLLAPSED}function WV(t){return qe.MAXIMIZED}const HV=new Set(Object.values(qe));function UV(t){return HV.has(t)}function VV(t){switch(t){case qe.COLLAPSED:return"h-7";case qe.EXPANDED:return"h-[40vh]";case qe.MAXIMIZED:return"flex-1";default:return"h-7"}}const PS="compose:agentBarState";function YV(){var t;try{const e=(t=globalThis.localStorage)==null?void 0:t.getItem(PS);return UV(e)?e:qe.COLLAPSED}catch{return qe.COLLAPSED}}function GV(t){var e;try{(e=globalThis.localStorage)==null||e.setItem(PS,t)}catch{}}const r0="▾",XV="▴",KV="⤢";function QV({barState:t="collapsed",onStateChange:e}){const[r,n]=C.useState("ready"),[i,s]=C.useState(null);C.useEffect(()=>{function u(d){const{status:f,tool:p,category:m,parallelTasks:x}=d.detail??{};if(s(x??null),x){const{total:g,completed:y,failed:k,active:b}=x;n(`∥ ${y}/${g} tasks${k?` (${k} failed)`:""}${b?` • ${b} active`:""}`)}else n(f==="idle"?"ready":p?`${p} — ${m??f}`:m||(f==="idle"?"ready":f??"ready"))}return window.addEventListener("compose:agent-status",u),()=>window.removeEventListener("compose:agent-status",u)},[]);const o=C.useCallback(()=>{e==null||e(zV(t))},[t,e]),a=C.useCallback(()=>{e==null||e(qV())},[t,e]);C.useCallback(()=>{e==null||e(WV())},[t,e]);const c=t==="collapsed",h=t==="expanded";return l.jsxs("div",{className:"flex flex-col h-full overflow-hidden",style:{borderTop:"1px solid hsl(var(--border))"},"data-agent-bar-state":t,children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 h-7 shrink-0 select-none",style:{borderBottom:c?"none":"1px solid hsl(var(--border) / 0.5)"},children:[l.jsx("button",{className:"compose-btn-icon shrink-0",onClick:o,title:c?"Expand agent bar":h?"Maximize agent bar":"Collapse agent bar","aria-label":"Toggle agent bar",children:c?XV:h?KV:r0}),l.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold shrink-0",style:{color:"hsl(var(--accent))"},children:"Agent"}),l.jsx("span",{className:"flex-1 min-w-0 truncate text-[11px] font-mono",style:{color:"hsl(var(--muted-foreground))"},children:r}),l.jsx(OV,{}),i&&i.total>0&&l.jsx("div",{className:"shrink-0 flex items-center gap-1",title:`${i.completed}/${i.total} tasks complete`,children:l.jsx("div",{style:{width:48,height:4,borderRadius:2,background:"hsl(var(--muted))",overflow:"hidden"},children:l.jsx("div",{style:{width:`${i.completed/i.total*100}%`,height:"100%",borderRadius:2,background:i.failed?"hsl(var(--destructive))":"hsl(var(--accent))",transition:"width 300ms ease"}})})}),!c&&l.jsx("button",{className:"compose-btn-icon shrink-0",onClick:a,title:"Collapse agent bar","aria-label":"Collapse agent bar",children:r0})]}),!c&&l.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:l.jsx(cy,{})})]})}const $S=C.createContext(null);function ZV(){return C.useContext($S)}const JV={item:"openItem",feature:"openFeature",gate:"openGate",view:"openView"};function Es({kind:t,id:e,label:r,className:n}){const i=ZV(),s=r??e,o=i==null?void 0:i[JV[t]],a=typeof(i==null?void 0:i.canNavigate)=="function"?i.canNavigate(t,e):!0;return typeof o!="function"||!a?l.jsx("span",{className:nt("text-[11px] font-mono text-muted-foreground",n),children:s}):l.jsx("button",{type:"button",onClick:c=>{c.stopPropagation();try{o(e)}catch{}},className:nt("text-[11px] font-mono text-blue-400 hover:underline cursor-pointer",n),children:s})}const tY=280,eY=.6;function rY({isOpen:t=!1,onToggle:e,widthPx:r=380,onResizePx:n,children:i,activeBuild:s,gates:o=[],agentErrors:a=[],items:c=[]}){const h=C.useRef(!1),u=C.useCallback(f=>{f.preventDefault(),h.current=!0;const p=x=>{if(!h.current)return;const g=window.innerWidth-x.clientX,y=window.innerWidth*eY,k=Math.max(tY,Math.min(y,g));n==null||n(k)},m=()=>{h.current=!1,document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",m)};document.addEventListener("mousemove",p),document.addEventListener("mouseup",m)},[n]),d=o.filter(f=>f.status==="pending"||f.status==="awaiting");return l.jsxs("div",{className:"flex shrink-0 h-full",style:{borderLeft:"1px solid hsl(var(--border))"},"data-context-panel-open":t,children:[t&&n&&l.jsx("div",{className:"w-1 cursor-col-resize hover:bg-accent/30 active:bg-accent/50 transition-colors flex-shrink-0",onMouseDown:u}),l.jsx("button",{className:["w-4 h-full flex items-center justify-center","text-[10px] text-muted-foreground hover:text-foreground","transition-colors select-none"].join(" "),onClick:e,title:t?"Close context panel":"Open context panel","aria-expanded":t,"aria-label":"Toggle context panel",style:{background:"hsl(var(--muted) / 0.3)"},children:t?"›":"‹"}),t&&l.jsx("div",{className:"flex flex-col h-full overflow-hidden",style:{width:`${r}px`},children:Dt.Children.toArray(i).length>0?l.jsx("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:i}):l.jsx(iY,{activeBuild:s,pendingGates:d,agentErrors:a,items:c})})]})}const nY={implementation:"#3b82f6",vision:"#a855f7",planning:"#f59e0b",specification:"#06b6d4",verification:"#22c55e",design:"#f43f5e"};function n0(t){return nY[t]||"#6b7280"}function iY({activeBuild:t,pendingGates:e,agentErrors:r,items:n}){const i={};for(const a of n){const c=a.phase||"unknown";i[c]=(i[c]||0)+1}const s=n.length||1,o=r.slice(-5);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-7 flex items-center px-3 shrink-0",style:{borderBottom:"1px solid hsl(var(--border))"},children:l.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold text-muted-foreground",children:"Project Overview"})}),l.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto p-3 space-y-4",children:[t?l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Active Build"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs text-accent font-mono",children:t.featureCode||"—"}),l.jsx("span",{className:"text-[10px] text-muted-foreground",children:"·"}),l.jsx("span",{className:"text-[10px] text-foreground",children:t.currentStep||t.step||"—"})]})]}):l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Build Status"}),l.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"No active build"})]}),l.jsxs("div",{children:[l.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:["Pending Gates (",e.length,")"]}),e.length===0?l.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"None"}):l.jsx("div",{className:"space-y-0.5",children:e.slice(0,5).map((a,c)=>l.jsx("p",{className:"text-[10px] truncate",children:l.jsx(Es,{kind:"gate",id:a.id,label:$o(a,n.find(h=>h.id===a.itemId)),className:"text-[10px]"})},c))})]}),l.jsxs("div",{children:[l.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:["Recent Errors (",o.length,")"]}),o.length===0?l.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"None"}):l.jsx("div",{className:"space-y-0.5",children:o.map((a,c)=>l.jsx("p",{className:"text-[10px] text-destructive truncate",children:a.message||a.error||"Error"},c))})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Phase Distribution"}),l.jsx("div",{className:"flex h-2 rounded overflow-hidden gap-px",children:Object.entries(i).map(([a,c])=>l.jsx("div",{className:"h-full",style:{width:`${c/s*100}%`,background:n0(a),opacity:.75,minWidth:"2px"},title:`${a}: ${c}`},a))}),l.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 mt-1",children:Object.entries(i).map(([a,c])=>l.jsxs("span",{className:"text-[9px] text-muted-foreground flex items-center gap-1",children:[l.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:n0(a)}}),a,": ",c]},a))})]})]})]})}const wn=60,jr=24,Xa=80,ou=28,au=48,i0=8,Yi=5,mc=9;function sY(t,e){return t?t.length>e?t.slice(0,e)+"…":t:""}function oY(t,e,r){const n=new Map(e.map(a=>[a.id,a])),i=[],s=[],o=new Map;for(const a of r){if(a.toId===t.id){const c=n.get(a.fromId);c&&i.push(c)}if(a.fromId===t.id){const c=n.get(a.toId);c&&s.push(c)}}for(const a of s){const c=[];for(const h of r)if(h.fromId===a.id&&h.toId!==t.id){const u=n.get(h.toId);u&&c.push(u)}c.length>0&&o.set(a.id,c)}return{parents:i,children:s,grandchildren:o}}function lu(t,e,r,n,i){const s=Math.min(t,Yi),o=s*n+(s-1)*i0,a=(r-o)/2,c=[];for(let h=0;h<s;h++)c.push({x:a+h*(n+i0),y:e,w:n,h:i});return{positions:c,overflow:t>Yi?t-Yi+1:0}}function Ka({item:t,x:e,y:r,w:n,h:i,isSelected:s,isDashed:o,onSelect:a,onHover:c,onLeave:h}){const u=hr[t.type]||hr.task,d=s?.2:.08;return l.jsxs("g",{style:{cursor:"pointer"},onClick:()=>a(t.id),onMouseEnter:f=>c(t,f),onMouseLeave:h,children:[l.jsx("rect",{x:e,y:r,width:n,height:i,rx:4,fill:u,fillOpacity:d,stroke:u,strokeWidth:s?2:1.5,strokeDasharray:o?"4 2":void 0}),l.jsx("text",{x:e+n/2,y:r+i/2,textAnchor:"middle",dominantBaseline:"central",fontSize:s?mc+1:mc,fontWeight:s?600:400,fill:"hsl(var(--foreground))",children:sY(t.title,s?10:8)})]})}function aY({item:t,pos:e}){if(!t||!e)return null;const r=hr[t.type]||hr.task,n=Bn[t.status]||Bn.planned;return l.jsxs("div",{className:"absolute z-50 pointer-events-none px-2 py-1.5 rounded bg-popover border border-border shadow-md",style:{left:e.x,top:e.y,transform:"translate(-50%, -100%)"},children:[l.jsx("p",{className:"text-xs font-medium text-foreground whitespace-nowrap",children:t.title}),l.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[l.jsx("span",{className:"text-[10px]",style:{color:r},children:t.type}),l.jsxs("span",{className:"text-[10px] flex items-center gap-1",children:[l.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:n}}),t.status]}),l.jsx("span",{className:"text-[10px] text-muted-foreground",children:Qd[t.confidence||0]})]})]})}function lY({item:t,items:e,connections:r,onSelect:n}){const[i,s]=C.useState(null),[o,a]=C.useState(null),{parents:c,children:h,grandchildren:u}=C.useMemo(()=>oY(t,e,r),[t,e,r]),d=C.useCallback((I,F)=>{const $=F.currentTarget.closest(".connection-graph-wrap").getBoundingClientRect(),O=F.currentTarget.getBoundingClientRect();s(I),a({x:O.x+O.width/2-$.x,y:O.y-$.y-4})},[]),f=C.useCallback(()=>{s(null),a(null)},[]);if(!(c.length>0||h.length>0))return null;const m=288,x=[];let g=12,y=[],k=0;if(c.length>0){const I=lu(c.length,g,m,wn,jr);y=I.positions,k=I.overflow,g+=jr+au}const b=(m-Xa)/2,w=g;g+=ou+au;let _=[],T=0;if(h.length>0){const I=lu(h.length,g,m,wn,jr);_=I.positions,T=I.overflow,g+=jr}let S=new Map,L=new Map;const B=[...u.entries()];let N=[];if(B.length>0){g+=au;for(const[$,O]of B)for(const D of O)N.push({...D,_parentChildId:$});const I=lu(N.length,g,m,wn,jr);let F=0;for(const[$,O]of B){const D=[];for(let j=0;j<O.length&&F<I.positions.length;j++,F++)D.push(I.positions[F]);S.set($,D)}I.overflow>0&&L.set("all",I.overflow),g+=jr}const A=g+12;for(let I=0;I<y.length;I++){const F=y[I];x.push({x1:F.x+F.w/2,y1:F.y+F.h,x2:b+Xa/2,y2:w})}for(let I=0;I<_.length;I++){const F=_[I];x.push({x1:b+Xa/2,y1:w+ou,x2:F.x+F.w/2,y2:F.y})}for(const[I,F]of S){const $=h.findIndex(O=>O.id===I);if($>=0&&$<_.length){const O=_[$];for(const D of F)x.push({x1:O.x+O.w/2,y1:O.y+O.h,x2:D.x+D.w/2,y2:D.y})}}const R=c.slice(0,Yi-(k>0?1:0)),z=h.slice(0,Yi-(T>0?1:0)),P=N.slice(0,Yi-(L.size>0?1:0));return l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Graph"}),l.jsxs("div",{className:"relative connection-graph-wrap",children:[l.jsxs("svg",{width:m,height:A,className:"w-full",viewBox:`0 0 ${m} ${A}`,children:[x.map((I,F)=>l.jsx("line",{x1:I.x1,y1:I.y1,x2:I.x2,y2:I.y2,stroke:"hsl(var(--muted-foreground))",strokeOpacity:.3,strokeWidth:1},F)),R.map((I,F)=>l.jsx(Ka,{item:I,x:y[F].x,y:y[F].y,w:wn,h:jr,isSelected:!1,isDashed:!0,onSelect:n,onHover:d,onLeave:f},I.id)),k>0&&l.jsxs("text",{x:y[y.length-1].x+wn/2,y:y[0].y+jr/2,textAnchor:"middle",dominantBaseline:"central",fontSize:mc,fill:"hsl(var(--muted-foreground))",children:["+",k," more"]}),l.jsx(Ka,{item:t,x:b,y:w,w:Xa,h:ou,isSelected:!0,isDashed:!1,onSelect:n,onHover:d,onLeave:f}),z.map((I,F)=>l.jsx(Ka,{item:I,x:_[F].x,y:_[F].y,w:wn,h:jr,isSelected:!1,isDashed:!1,onSelect:n,onHover:d,onLeave:f},I.id)),T>0&&l.jsxs("text",{x:_[_.length-1].x+wn/2,y:_[0].y+jr/2,textAnchor:"middle",dominantBaseline:"central",fontSize:mc,fill:"hsl(var(--muted-foreground))",children:["+",T," more"]}),P.map((I,F)=>{const O=[...S.values()].flat()[F];return O?l.jsx(Ka,{item:I,x:O.x,y:O.y,w:wn,h:jr,isSelected:!1,isDashed:!1,onSelect:n,onHover:d,onLeave:f},I.id):null})]}),l.jsx(aY,{item:i,pos:o})]})]})}const cY=["Untested","Low","Moderate","High","Crystallized"];function hY({level:t=0,className:e}){const r=Math.max(0,Math.min(4,t||0)),n=cY[r]??"Untested",i=r===0?zf[0]:zf[r];return l.jsxs("span",{className:nt("inline-flex items-center gap-1",e),children:[l.jsx("span",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(s=>l.jsx("span",{className:nt("h-2.5 w-1.5 rounded-sm",s<=r?i:"bg-slate-600")},s))}),l.jsx("span",{className:"text-[10px] text-muted-foreground",children:n})]})}function uY(t,e){const r=(t||"").toLowerCase();return e?r==="complete"?{kind:"aligned",diverged:!1,message:null}:r==="killed"?{kind:"aligned-terminal",diverged:!1,message:null}:{kind:"diverged",diverged:!0,message:`Recorded complete (${e.commit_sha_short||(e.commit_sha||"").slice(0,8)||"—"}) but status is "${r||"unknown"}".`}:r==="complete"?{kind:"diverged",diverged:!0,message:"Status complete but no recorded completion (no commit-bound evidence)."}:{kind:"none",diverged:!1,message:null}}function dY({featureCode:t,status:e}){const[r,n]=C.useState(void 0),[i,s]=C.useState(!0),o=C.useRef(0);if(C.useEffect(()=>{if(!t){n(null),s(!1);return}const c=++o.current,h=new AbortController;return s(!0),vt(`/api/completions?featureCode=${encodeURIComponent(t)}&limit=1`,{signal:h.signal}).then(u=>u.json()).then(u=>{if(c!==o.current)return;const d=Array.isArray(u==null?void 0:u.completions)?u.completions[0]:null;n(d||null)}).catch(()=>{c===o.current&&n(null)}).finally(()=>{c===o.current&&s(!1)}),()=>h.abort()},[t]),!t||i)return null;const a=uY(e,r);return l.jsxs("div",{className:"space-y-1","data-testid":"completion-badge",children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Recorded Completion"}),r?l.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[l.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[10px] font-mono bg-muted text-foreground","data-testid":"completion-sha",children:r.commit_sha_short||(r.commit_sha||"").slice(0,8)||"—"}),l.jsx("span",{className:nt("inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[10px] font-medium",r.tests_pass?"bg-emerald-500/15 text-emerald-400":"bg-rose-500/15 text-rose-400"),"data-testid":"completion-tests",children:r.tests_pass?"tests pass":"tests failed"}),l.jsx(Nf,{date:r.recorded_at,className:"text-[10px]"})]}):l.jsx("p",{className:"text-[10px] text-muted-foreground/70 italic","data-testid":"completion-none",children:"No recorded completion."}),a.diverged&&l.jsx("div",{className:"flex items-start gap-1.5 px-2 py-1 rounded bg-amber-400/10 border border-amber-400/20","data-testid":"completion-divergence",children:l.jsxs("span",{className:"text-[10px] text-amber-400 leading-relaxed",children:["⚠ ",a.message]})})]})}function pY(t,e=Date.now()){if(!t)return null;const r=Date.parse(t);if(Number.isNaN(r))return null;const n=e-r,i=Math.floor(n/36e5);return i<1?"<1h ago":i<48?`${i}h ago`:`${Math.floor(i/24)}d ago`}function s0(t){return t==null?"—":t<1e3?String(t):t<1e6?`${(t/1e3).toFixed(1)}k`:`${(t/1e6).toFixed(1)}M`}function fY(t){return t==null?"—":`$${Number(t).toFixed(t<1?3:2)}`}function mY(t){if(t==null)return"—";const e=Math.round(t/1e3);if(e<60)return`${e}s`;const r=Math.round(e/60);if(r<60)return`${r}m`;const n=Math.floor(r/60),i=r%60;return`${n}h${i?` ${i}m`:""}`}function gY(t,e=Date.now()){const r=(t||[]).filter(i=>i==null?void 0:i.started_at);if(!r.length)return null;let n=null;for(const i of r){const s=Date.parse(i.started_at);!Number.isNaN(s)&&(n==null||s>n)&&(n=s)}return n==null?null:pY(new Date(n).toISOString(),e)}function xY(t,e=Date.now()){const r=(t==null?void 0:t.branches)||[],n=r.filter(h=>h.state==="complete"),i=r.filter(h=>h.state==="running"),s=r.length,o=gY(r,e),a=n.length>=2;return{summary:i.length>0&&n.length<2?`${n.length} of ${s} branches ready`:`${s} branch${s===1?"":"es"}${o?` · last fork ${o}`:""}`,canCompare:a,completeBranches:n,runningCount:i.length,totalCount:s}}function yY(t,e=[]){const r=new Map(t.map(s=>[s.branch_id,s])),n=e[0]&&r.has(e[0])?r.get(e[0]):t[0]||null,i=e[1]&&r.has(e[1])?r.get(e[1]):t[1]||null;return[n,i]}function o0({branch:t,extraRows:e=[]}){var o;const r=t.files_touched||[],n=t.tests||{},i=t.cost||{},s=[{label:"Files touched",value:r.length},{label:"Tests",value:`${n.passed??0} / ${n.failed??0} / ${n.skipped??0}`},{label:"Tokens in / out",value:`${s0(i.tokens_in)} / ${s0(i.tokens_out)}`},{label:"USD",value:fY(i.usd)},{label:"Wall clock",value:mY(i.wall_clock_ms)},{label:"Final artifact",value:((o=t.final_artifact)==null?void 0:o.path)||"—"},...e];return l.jsx("div",{className:"space-y-1",children:s.map((a,c)=>l.jsxs("div",{className:"flex justify-between gap-2 text-[10px]",children:[l.jsx("span",{className:"text-muted-foreground",children:a.label}),l.jsx("span",{className:"font-mono text-right truncate",title:typeof a.value=="string"?a.value:void 0,children:a.value})]},c))})}function bY({lineage:t,selectedPair:e=[],onSelectPair:r=()=>{},extraMetricsForBranch:n=()=>[],now:i=Date.now()}){var g,y;const[s,o]=C.useState(!1),{summary:a,canCompare:c,completeBranches:h}=xY(t,i),[u,d]=yY(h,e),f=()=>{c&&(o(k=>!k),!s&&u&&d&&r([u.branch_id,d.branch_id]))};if(!s)return l.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[l.jsx("span",{children:a}),l.jsx("button",{disabled:!c,onClick:f,className:"text-[10px] px-2 py-0.5 rounded border border-border "+(c?"hover:bg-muted/40 text-foreground cursor-pointer":"opacity-40 cursor-not-allowed"),"data-testid":"branch-compare-toggle",children:"Compare"})]});const p=(g=u==null?void 0:u.final_artifact)==null?void 0:g.snapshot,m=(y=d==null?void 0:d.final_artifact)==null?void 0:y.snapshot,x=!!p&&!!m;return l.jsxs("div",{className:"space-y-2 rounded border border-border p-2 bg-muted/10",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[10px] text-muted-foreground",children:a}),l.jsx("button",{onClick:()=>o(!1),className:"text-[10px] text-muted-foreground hover:text-foreground",children:"Collapse"})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-[10px] font-semibold mb-1 font-mono truncate",title:u==null?void 0:u.branch_id,children:u?`A: ${u.branch_id.slice(0,8)}…`:"A: (none)"}),u&&l.jsx(o0,{branch:u,extraRows:n(u)})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-[10px] font-semibold mb-1 font-mono truncate",title:d==null?void 0:d.branch_id,children:d?`B: ${d.branch_id.slice(0,8)}…`:"B: (none)"}),d&&l.jsx(o0,{branch:d,extraRows:n(d)})]})]}),l.jsx("div",{className:"col-span-2",children:x?l.jsx(jf,{oldText:p,newText:m}):l.jsxs("div",{className:"text-[10px] italic text-muted-foreground",children:["No artifact produced on ",!p&&!m?"either branch":p?"branch B":"branch A","."]})})]})}const kY={path_drift:"Path drift",contract_drift:"Contract drift",review_debt_drift:"Review debt"};function vY(t){return kY[t]??t}function a0(t){return t==null||typeof t!="number"||isNaN(t)?"—":`${Math.round(t*100)}%`}function wY(t){var r,n;return(((n=(r=t==null?void 0:t.lifecycle)==null?void 0:r.lifecycle_ext)==null?void 0:n.drift_axes)??[]).filter(i=>i.breached===!0)}function SY({item:t}){const[e,r]=C.useState(!1),n=wY(t);if(n.length===0)return null;const i=n.length;return l.jsxs("div",{className:"drift-ribbon",style:{background:"hsl(var(--destructive) / 0.12)",borderLeft:"3px solid hsl(var(--destructive))",minHeight:"28px",padding:e?"6px 10px 8px":"0 10px",display:"flex",flexDirection:"column",justifyContent:"center",gap:0,borderRadius:"4px",marginBottom:"4px"},children:[l.jsxs("button",{onClick:()=>r(s=>!s),style:{display:"flex",alignItems:"center",gap:"6px",background:"none",border:"none",cursor:"pointer",padding:"4px 0",color:"hsl(var(--destructive))",fontSize:"12px",fontWeight:600,width:"100%",textAlign:"left"},"aria-expanded":e,"data-testid":"drift-ribbon-toggle",children:[l.jsx(vc,{size:13}),l.jsxs("span",{children:[i," drift alert",i!==1?"s":""," — click to ",e?"collapse":"expand"]}),e?l.jsx(G0,{size:13,style:{marginLeft:"auto"}}):l.jsx(ks,{size:13,style:{marginLeft:"auto"}})]}),e&&l.jsxs("table",{style:{width:"100%",fontSize:"11px",borderCollapse:"collapse",marginTop:"4px"},"data-testid":"drift-ribbon-table",children:[l.jsx("thead",{children:l.jsxs("tr",{style:{color:"hsl(var(--muted-foreground))"},children:[l.jsx("th",{style:{textAlign:"left",padding:"2px 4px",fontWeight:500},children:"Axis"}),l.jsx("th",{style:{textAlign:"right",padding:"2px 4px",fontWeight:500},children:"Ratio"}),l.jsx("th",{style:{textAlign:"right",padding:"2px 4px",fontWeight:500},children:"Threshold"}),l.jsx("th",{style:{textAlign:"left",padding:"2px 4px",fontWeight:500},children:"Explanation"})]})}),l.jsx("tbody",{children:n.map(s=>l.jsxs("tr",{"data-testid":`drift-axis-row-${s.axis_id}`,children:[l.jsx("td",{style:{padding:"2px 4px",color:"hsl(var(--foreground))",fontWeight:500},children:vY(s.axis_id)}),l.jsx("td",{style:{padding:"2px 4px",textAlign:"right",color:"hsl(var(--destructive))"},children:a0(s.ratio)}),l.jsx("td",{style:{padding:"2px 4px",textAlign:"right",color:"hsl(var(--muted-foreground))"},children:a0(s.threshold)}),l.jsx("td",{style:{padding:"2px 4px",color:"hsl(var(--muted-foreground))",maxWidth:"200px",wordBreak:"break-word"},children:s.explanation??""})]},s.axis_id))})]})]})}async function nh({featureCode:t,mode:e="feature",description:r="",resume:n=!1}){const i={mode:e,description:r};t&&(i.featureCode=t),n&&(i.resume=n);const s=await vt("/api/build/start",{method:"POST",headers:Mr({"Content-Type":"application/json"}),body:JSON.stringify(i)});if(!s.ok){let o=null;try{o=await s.json()}catch{}const a=new Error(o&&o.error||`Failed to start build (HTTP ${s.status})`);throw a.status=s.status,a}return s}function TY({item:t,onClose:e}){var m;const r=((m=t==null?void 0:t.lifecycle)==null?void 0:m.featureCode)||(t==null?void 0:t.featureCode)||(t==null?void 0:t.id)||"",[n,i]=C.useState(r),[s,o]=C.useState((t==null?void 0:t.type)==="bug"?"bug":"feature"),[a,c]=C.useState(""),[h,u]=C.useState(!1),[d,f]=C.useState(null);async function p(x){x==null||x.preventDefault();const g=n.trim();if(!g){f("Feature code is required");return}u(!0),f(null);try{await nh({featureCode:g,mode:s,description:a.trim()}),e==null||e()}catch(y){f(y.message||"Failed to start build"),u(!1)}}return l.jsx("div",{className:"absolute bottom-full left-0 mb-1 w-64 rounded-md border border-border bg-popover shadow-lg z-50","data-testid":"start-build-popover",children:l.jsxs("form",{className:"p-2 space-y-2",onSubmit:p,children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("label",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",htmlFor:"start-build-feature",children:"Feature code"}),l.jsx("input",{id:"start-build-feature",type:"text",className:"w-full text-xs bg-muted text-foreground px-2 py-1.5 rounded border border-border outline-none",value:n,onChange:x=>i(x.target.value),"data-testid":"start-build-feature-input",autoFocus:!0})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Mode"}),l.jsxs("div",{className:"flex items-center gap-1.5",role:"radiogroup","aria-label":"Build mode",children:[l.jsx("button",{type:"button",role:"radio","aria-checked":s==="feature",className:`text-[10px] px-2 py-1 rounded border cursor-pointer ${s==="feature"?"bg-accent/10 border-accent text-foreground":"bg-muted border-border text-muted-foreground"}`,"data-testid":"start-build-mode-feature",onClick:()=>o("feature"),children:"Feature"}),l.jsx("button",{type:"button",role:"radio","aria-checked":s==="bug",className:`text-[10px] px-2 py-1 rounded border cursor-pointer ${s==="bug"?"bg-accent/10 border-accent text-foreground":"bg-muted border-border text-muted-foreground"}`,"data-testid":"start-build-mode-bug",onClick:()=>o("bug"),children:"Bug"})]})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("label",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",htmlFor:"start-build-desc",children:"Description (optional)"}),l.jsx("textarea",{id:"start-build-desc",className:"w-full text-xs bg-muted text-foreground px-2 py-1.5 rounded border border-border outline-none resize-none",rows:3,value:a,onChange:x=>c(x.target.value),"data-testid":"start-build-description"})]}),d?l.jsx("div",{className:"text-[10px] text-destructive",role:"alert",children:d}):null,l.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[l.jsx("button",{type:"button",className:"text-[10px] px-2 py-1 rounded border border-border text-muted-foreground hover:bg-muted/50",onClick:()=>e==null?void 0:e(),disabled:h,"data-testid":"start-build-cancel",children:"Cancel"}),l.jsx("button",{type:"submit",className:"text-[10px] px-2 py-1 rounded border border-accent bg-accent/10 text-foreground disabled:opacity-50",disabled:h||!n.trim(),"data-testid":"start-build-submit",children:h?"Starting…":"Start"})]})]})})}function _Y({level:t,onChange:e}){const r=["hsl(var(--muted-foreground))","hsl(var(--destructive))","hsl(var(--accent))","hsl(var(--success))","hsl(var(--success))"],n=r[t]||r[0];return l.jsxs("button",{onClick:()=>e((t+1)%5),className:"flex items-center gap-2 px-2 py-1 rounded-md bg-muted hover:bg-muted/80 transition-colors",title:"Click to cycle confidence",children:[l.jsx("span",{className:"text-xs text-muted-foreground",children:Qd[t]}),l.jsx("div",{className:"flex items-center gap-0.5",children:[0,1,2,3].map(i=>l.jsx("div",{className:"rounded-full transition-all",style:{width:6,height:6,background:i<t?n:"transparent",border:`1.5px solid ${i<t?n:"hsl(var(--border))"}`}},i))})]})}function jY({item:t,connections:e,items:r,onSelect:n,onDeleteConnection:i}){const s=new Map(r.map(c=>[c.id,c])),o=[];for(const c of e)if(c.type!=="contradicts"){if(c.fromId===t.id){const h=s.get(c.toId);h&&o.push({item:h,type:c.type,direction:"outgoing",connId:c.id})}if(c.toId===t.id){const h=s.get(c.fromId);h&&o.push({item:h,type:c.type,direction:"incoming",connId:c.id})}}if(o.length===0)return null;const a={};for(const c of o){const h=`${c.type}-${c.direction}`;a[h]||(a[h]={type:c.type,direction:c.direction,items:[]}),a[h].items.push({item:c.item,connId:c.connId})}return l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Connections"}),Object.values(a).map(c=>l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] text-muted-foreground mb-1",children:c.direction==="incoming"?`${c.type} from`:`${c.type} to`}),l.jsx("div",{className:"space-y-0.5",children:c.items.map(({item:h,connId:u})=>l.jsxs("div",{className:"flex w-full items-center gap-2 px-2 py-1 rounded text-left hover:bg-muted/50 transition-colors group/conn",children:[l.jsxs("button",{onClick:()=>n(h.id),className:"flex flex-1 items-center gap-2 min-w-0",children:[l.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:Bn[h.status]||Bn.planned}}),l.jsx("span",{className:"text-xs text-foreground truncate",children:h.title}),l.jsx("span",{className:"text-[10px] ml-auto shrink-0",style:{color:hr[h.type]},children:h.type})]}),i&&l.jsx("button",{onClick:()=>i(u),className:"opacity-0 group-hover/conn:opacity-100 p-0.5 rounded hover:bg-destructive/20 text-muted-foreground hover:text-destructive transition-all shrink-0",title:"Remove connection",children:l.jsx(Kr,{className:"h-3 w-3"})})]},u))})]},`${c.type}-${c.direction}`))]})}function Qa(t){if(!t)return"";const e=new Date(t);return e.toLocaleDateString("en-US",{month:"short",day:"numeric"})+" "+e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}function NY({featureCode:t,lineage:e}){const r=lr(i=>i.selectedBranches),n=lr(i=>i.setSelectedBranches);return l.jsx(bY,{lineage:e,selectedPair:(r==null?void 0:r[t])||[],onSelectPair:i=>n(t,i)})}function EY({featureCode:t}){const[e,r]=C.useState([]),[n,i]=C.useState(!0);return C.useEffect(()=>{const s=new AbortController;return i(!0),vt(`/api/session/history?featureCode=${encodeURIComponent(t)}&limit=10`,{signal:s.signal}).then(o=>o.json()).then(o=>{s.signal.aborted||r(o.sessions||[])}).catch(o=>{s.signal.aborted||r([])}).finally(()=>{s.signal.aborted||i(!1)}),()=>s.abort()},[t]),n||e.length===0?null:l.jsxs("div",{children:[l.jsxs("div",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:["Sessions (",e.length,")"]}),l.jsx("div",{className:"space-y-2",children:e.map(s=>{var o;return l.jsxs("div",{className:"text-xs text-muted-foreground border-l-2 border-border pl-2",children:[l.jsxs("div",{className:"font-medium text-foreground",children:[((o=s.phaseAtBind)==null?void 0:o.replace(/_/g," "))||"—",s.phaseAtEnd&&s.phaseAtEnd!==s.phaseAtBind&&` → ${s.phaseAtEnd.replace(/_/g," ")}`]}),l.jsxs("div",{children:[s.toolCount," tools · ",Math.round((new Date(s.endedAt)-new Date(s.startedAt))/6e4),"m"]})]},s.id)})})]})}const LY=["informs","supports","blocks","contradicts"];function BY({item:t,items:e,onCreateConnection:r,onDismiss:n}){const[i,s]=C.useState(""),[o,a]=C.useState("informs"),c=e.filter(u=>u.id===t.id?!1:i?u.title.toLowerCase().includes(i.toLowerCase()):!0).slice(0,8),h=C.useCallback(async u=>{await r({fromId:t.id,toId:u,type:o}),n()},[t.id,o,r,n]);return l.jsx("div",{className:"absolute bottom-full left-0 mb-1 w-64 rounded-md border border-border bg-popover shadow-lg z-50",children:l.jsxs("div",{className:"p-2 space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("select",{className:"text-[10px] px-1.5 py-1 rounded bg-muted text-foreground border border-border cursor-pointer",value:o,onChange:u=>a(u.target.value),children:LY.map(u=>l.jsx("option",{value:u,children:u},u))}),l.jsx("span",{className:"text-[10px] text-muted-foreground",children:"to..."})]}),l.jsxs("div",{className:"relative",children:[l.jsx(fn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),l.jsx("input",{className:"w-full text-xs bg-muted text-foreground pl-7 pr-2 py-1.5 rounded border border-border outline-none",placeholder:"Search items...",value:i,onChange:u=>s(u.target.value),autoFocus:!0})]}),l.jsx("div",{className:"max-h-40 overflow-auto space-y-0.5",children:c.length===0?l.jsx("p",{className:"text-[10px] text-muted-foreground text-center py-2",children:"No items found"}):c.map(u=>l.jsxs("button",{onClick:()=>h(u.id),className:"flex w-full items-center gap-2 px-2 py-1 rounded text-left hover:bg-muted/50 transition-colors",children:[l.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:Bn[u.status]||Bn.planned}}),l.jsx("span",{className:"text-xs text-foreground truncate",children:u.title}),l.jsx("span",{className:"text-[10px] ml-auto shrink-0",style:{color:hr[u.type]},children:u.type})]},u.id))})]})})}function AY({gate:t,onResolveGate:e}){const[r,n]=C.useState(null),[i,s]=C.useState(""),o=()=>{e(t.id,"revised",i||void 0),n(null),s("")},a=()=>{i.trim()&&(e(t.id,"killed",i),n(null),s(""))};return l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(At,{variant:"outline",size:"sm",className:"h-6 text-[10px] gap-1 text-success border-success/30 hover:bg-success/10",onClick:()=>e(t.id,"approved"),children:"Approve"}),l.jsx(At,{variant:"outline",size:"sm",className:nt("h-6 text-[10px] gap-1 text-amber-400 border-amber-400/30 hover:bg-amber-400/10",r==="revise"&&"bg-amber-400/10"),onClick:()=>{n(r==="revise"?null:"revise"),s("")},children:"Revise"}),l.jsx(At,{variant:"outline",size:"sm",className:nt("h-6 text-[10px] gap-1 text-destructive border-destructive/30 hover:bg-destructive/10",r==="kill"&&"bg-destructive/10"),onClick:()=>{n(r==="kill"?null:"kill"),s("")},children:"Kill"})]}),r&&l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("input",{className:"flex-1 text-xs bg-muted text-foreground px-2 py-1 rounded border border-border outline-none",placeholder:r==="revise"?"Feedback (optional)...":"Kill reason (required)...",value:i,onChange:c=>s(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(r==="revise"?o():a()),c.key==="Escape"&&n(null)},autoFocus:!0}),l.jsx(At,{variant:"outline",size:"sm",className:"h-6 text-[10px]",disabled:r==="kill"&&!i.trim(),onClick:r==="revise"?o:a,children:r==="revise"?"Submit":"Confirm Kill"})]})]})}function MY({item:t,items:e,connections:r,gates:n,onUpdate:i,onDelete:s,onCreateConnection:o,onDeleteConnection:a,onSelect:c,onClose:h,onPressureTest:u,onResolveGate:d}){var O,D,j,Y,et,M,ct;const f=Wd(),[p,m]=C.useState(!1),[x,g]=C.useState(""),[y,k]=C.useState(!1),[b,w]=C.useState(""),[_,T]=C.useState(!1),[S,L]=C.useState(!1),[B,N]=C.useState("");C.useEffect(()=>{N((t==null?void 0:t.group)||"")},[t==null?void 0:t.id,t==null?void 0:t.group]);const A=C.useCallback(()=>{const X=B.trim(),lt=(t==null?void 0:t.group)||"";X!==lt&&i(t.id,{group:X||null})},[B,t==null?void 0:t.id,t==null?void 0:t.group,i]),R=C.useCallback(()=>{g(t.title),m(!0)},[t==null?void 0:t.title]),z=C.useCallback(()=>{x.trim()&&x!==t.title&&i(t.id,{title:x.trim()}),m(!1)},[x,t==null?void 0:t.id,t==null?void 0:t.title,i]),P=C.useCallback(()=>{w(t.description||""),k(!0)},[t==null?void 0:t.description]),I=C.useCallback(()=>{b!==(t.description||"")&&i(t.id,{description:b}),k(!1)},[b,t==null?void 0:t.id,t==null?void 0:t.description,i]),F=C.useMemo(()=>{if(!t)return 0;let X=0;for(const lt of r)lt.type==="contradicts"&&(lt.fromId===t.id||lt.toId===t.id)&&X++;return X},[t==null?void 0:t.id,r]);if(!t)return null;const $=hr[t.type]||hr.task;return l.jsxs("div",{className:"w-full bg-card flex flex-col h-full",children:[l.jsxs("div",{className:"p-3 pb-2 flex items-start gap-2",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[l.jsx(cr,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4",style:{color:$,borderColor:$},children:t.type}),t.phase&&l.jsx(cr,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4",children:kl[t.phase]||t.phase})]}),p?l.jsx("input",{className:"w-full text-sm font-semibold bg-muted text-foreground px-1.5 py-0.5 rounded border border-ring outline-none",value:x,onChange:X=>g(X.target.value),onBlur:z,onKeyDown:X=>{X.key==="Enter"&&z(),X.key==="Escape"&&m(!1)},autoFocus:!0}):l.jsx("h3",{className:"text-sm font-semibold text-foreground cursor-pointer hover:text-accent transition-colors",onDoubleClick:R,title:"Double-click to edit",children:t.title})]}),l.jsx(At,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:h,children:l.jsx(Kr,{className:"h-3.5 w-3.5"})})]}),l.jsx(El,{}),l.jsx(An,{className:"flex-1",children:l.jsxs("div",{className:"p-3 space-y-4",children:[l.jsx(SY,{item:t}),((O=t.lifecycle)==null?void 0:O.featureCode)&&l.jsx(NY,{featureCode:t.lifecycle.featureCode,lineage:(D=t.lifecycle.lifecycle_ext)==null?void 0:D.branch_lineage}),l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx("select",{className:"text-xs px-2 py-1 rounded-md bg-muted text-foreground border border-border cursor-pointer",value:t.status||"planned",onChange:X=>i(t.id,{status:X.target.value}),children:mj.map(X=>l.jsx("option",{value:X,children:X.replace("_"," ")},X))}),l.jsx(_Y,{level:t.confidence||0,onChange:X=>i(t.id,{confidence:X})})]}),l.jsx(hY,{level:t.confidence||0}),l.jsx(dY,{featureCode:(j=t.lifecycle)==null?void 0:j.featureCode,status:t.status}),l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Phase"}),l.jsxs("select",{className:"text-xs px-2 py-1 rounded-md bg-muted text-foreground border border-border cursor-pointer w-full",value:t.phase||"",onChange:X=>i(t.id,{phase:X.target.value||null}),children:[l.jsx("option",{value:"",children:"No phase"}),ey.map(X=>l.jsx("option",{value:X,children:kl[X]},X))]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Group"}),l.jsx("input",{type:"text",className:"w-full text-xs bg-muted text-foreground px-2 py-1 rounded-md border border-border outline-none focus:border-ring",value:B,placeholder:"(none)",onChange:X=>N(X.target.value),onBlur:A,onKeyDown:X=>{X.key==="Enter"&&(X.preventDefault(),X.currentTarget.blur()),X.key==="Escape"&&(N(t.group||""),X.currentTarget.blur())},"data-testid":"item-detail-group-input"})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Description"}),y?l.jsx("textarea",{className:"w-full text-xs bg-muted text-foreground px-2 py-1.5 rounded border border-ring outline-none resize-none",rows:4,value:b,onChange:X=>w(X.target.value),onBlur:I,onKeyDown:X=>{X.key==="Escape"&&k(!1)},autoFocus:!0}):l.jsx("p",{className:nt("text-xs leading-relaxed cursor-pointer rounded px-2 py-1.5 hover:bg-muted/50 transition-colors",t.description?"text-muted-foreground":"text-muted-foreground/50 italic"),onClick:P,children:t.description||"Click to add description..."})]}),l.jsx(jY,{item:t,connections:r,items:e,onSelect:c,onDeleteConnection:a}),l.jsx(lY,{item:t,items:e,connections:r,onSelect:c}),((Y=t.lifecycle)==null?void 0:Y.featureCode)&&l.jsx(EY,{featureCode:t.lifecycle.featureCode}),(t.lifecycle||n&&n.some(X=>X.itemId===t.id))&&(()=>{var Ct;const X=t.lifecycle,lt=n?n.filter(G=>G.itemId===t.id):[],It=lt.filter(G=>G.status==="pending"),Pt=lt.filter(G=>G.status!=="pending");return l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:"Lifecycle"}),l.jsxs("div",{className:"space-y-1.5",children:[X&&l.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded bg-muted/30",children:[l.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Phase:"}),l.jsx("span",{className:"text-[10px] text-foreground font-medium",children:Ce[X.currentPhase]??X.currentPhase}),X.featureCode&&l.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto font-mono",children:X.featureCode})]}),((Ct=X==null?void 0:X.phaseHistory)==null?void 0:Ct.length)>1&&l.jsxs("div",{className:"px-2 py-1 rounded bg-muted/30",children:[l.jsx("p",{className:"text-[10px] text-muted-foreground mb-0.5",children:"History"}),l.jsx("div",{className:"flex flex-wrap gap-x-1 gap-y-0.5",children:X.phaseHistory.map((G,it)=>l.jsxs("span",{className:nt("text-[10px]",G.phase===X.currentPhase?"text-foreground font-medium":"text-muted-foreground"),children:[Ce[G.phase]??G.phase,G.outcome&&G.outcome!=="approved"&&l.jsxs("span",{className:"text-amber-400",children:[" (",G.outcome,")"]}),it<X.phaseHistory.length-1&&" → "]},it))})]}),It.map(G=>{var Tt,qt;const it=G.artifactAssessment,kt=ry[G.fromPhase];return l.jsxs("div",{className:"rounded bg-amber-400/10 border border-amber-400/20 px-2 py-1.5",children:[l.jsxs("p",{className:"text-[10px] text-amber-400 font-medium mb-1",children:["Pending:"," ",l.jsx(Es,{kind:"gate",id:G.id,label:un[G.stepId]??`${Ce[G.fromPhase]??G.fromPhase} → ${Ce[G.toPhase]??G.toPhase}`,className:"text-[10px]"})]}),it&&it.exists&&l.jsxs("p",{className:"text-[10px] text-muted-foreground mb-1",children:[kt&&l.jsx("span",{className:"font-mono",children:kt}),kt&&": ",Math.round(it.completeness*100),"% complete"," · ",it.wordCount," words",((qt=(Tt=it.sections)==null?void 0:Tt.missing)==null?void 0:qt.length)>0&&l.jsxs("span",{className:"text-amber-400",children:[" (missing: ",it.sections.missing.join(", "),")"]}),!it.meetsMinWordCount&&l.jsx("span",{className:"text-amber-400",children:" (below min word count)"})]}),it&&!it.exists&&l.jsxs("p",{className:"text-[10px] text-muted-foreground mb-1",children:[kt??"Artifact"," not found"]}),d&&l.jsx(AY,{gate:G,onResolveGate:d})]},G.id)}),Pt.map(G=>{const it={approved:"text-success",revised:"text-amber-400",killed:"text-destructive"};return l.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded bg-muted/30",children:[l.jsx("span",{className:"text-[10px] text-muted-foreground",children:un[G.stepId]??`${Ce[G.fromPhase]??G.fromPhase} → ${Ce[G.toPhase]??G.toPhase}`}),l.jsx(cr,{variant:"outline",className:nt("text-[10px] px-1.5 py-0 h-4 ml-auto",it[G.outcome]||""),children:G.outcome})]},G.id)})]})]})})(),((M=(et=t.evidence)==null?void 0:et.stratumViolations)==null?void 0:M.length)>0&&l.jsxs("div",{children:[l.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-destructive mb-1.5",children:["Blocked — Ensure Violations",t.evidence.violatedAt&&l.jsx("span",{className:"ml-2 font-normal normal-case text-muted-foreground",children:Qa(t.evidence.violatedAt)})]}),l.jsx("div",{className:"space-y-0.5",children:t.evidence.stratumViolations.map((X,lt)=>l.jsxs("div",{className:"flex items-start gap-2 px-2 py-1 rounded bg-destructive/10",children:[l.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0 mt-1",style:{background:"hsl(var(--destructive))"}}),l.jsx("span",{className:"text-[10px] text-destructive leading-relaxed",children:X})]},lt))})]}),((ct=t.evidence)==null?void 0:ct.stratumTrace)&&l.jsxs("div",{children:[l.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:["Stratum Trace",t.evidence.tracedAt&&l.jsx("span",{className:"ml-2 font-normal normal-case",children:Qa(t.evidence.tracedAt)})]}),l.jsx("div",{className:"space-y-0.5",children:(t.evidence.stratumTrace.trace||[]).map(X=>l.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded bg-muted/30",children:[l.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:"hsl(var(--success))"}}),l.jsx("span",{className:"text-[10px] font-mono text-foreground truncate flex-1",children:X.step_id}),X.attempts>1&&l.jsxs("span",{className:"text-[10px] text-amber-400 shrink-0",children:[X.attempts,"x"]}),X.duration_ms!=null&&l.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:X.duration_ms<1e3?`${X.duration_ms}ms`:`${(X.duration_ms/1e3).toFixed(1)}s`})]},X.step_id))})]}),l.jsxs("div",{className:"space-y-0.5",children:[l.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Created ",Qa(t.createdAt)]}),l.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Updated ",Qa(t.updatedAt)]})]}),l.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[!t.lifecycle&&t.status!=="killed"&&t.type!=="question"&&l.jsxs("div",{className:"relative",children:[l.jsxs(At,{variant:"outline",size:"sm",className:nt("h-7 text-xs gap-1",S&&"bg-accent/10 border-accent"),onClick:()=>L(!S),"data-testid":"item-start-build",title:"Start the build/bug-fix lifecycle for this item",children:[l.jsx(R_,{className:"h-3 w-3"})," Start"]}),S&&l.jsx(TY,{item:t,onClose:()=>L(!1)})]}),l.jsxs("div",{className:"relative",children:[l.jsxs(At,{variant:"outline",size:"sm",className:nt("h-7 text-xs gap-1",_&&"bg-accent/10 border-accent"),onClick:()=>T(!_),children:[l.jsx(j_,{className:"h-3 w-3"})," Connect"]}),_&&l.jsx(BY,{item:t,items:e,onCreateConnection:o,onDismiss:()=>T(!1)})]}),l.jsxs(At,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:R,children:[l.jsx(Z0,{className:"h-3 w-3"})," Rename"]}),t.type!=="question"&&l.jsxs(At,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>u(t.id),title:"Challenge this item's assumptions",children:[l.jsx(Cl,{className:"h-3 w-3"})," Pressure Test",F>0&&l.jsx("span",{className:"ml-0.5 text-[10px] px-1 py-0 rounded-full bg-amber-500/20 text-amber-400",children:F})]}),t.status!=="killed"&&l.jsxs(At,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1 text-destructive border-destructive/30 hover:bg-destructive/10",onClick:async()=>{if(t.lifecycle)try{const X=await vt(`/api/vision/items/${t.id}/lifecycle/kill`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Killed via UI"})});if(!X.ok){const lt=await X.json().catch(()=>({}));console.error("[vision] Lifecycle kill failed:",lt.error),se(`Kill failed: ${lt.error||X.status}`,"error")}}catch(X){console.error("[vision] Lifecycle kill failed:",X.message),se(`Kill failed: ${X.message}`,"error")}else i(t.id,{status:"killed"})},children:[l.jsx(bl,{className:"h-3 w-3"})," Kill"]}),s&&l.jsxs(At,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1 text-destructive border-destructive/30 hover:bg-destructive/10",onClick:async()=>{await f({title:"Delete permanently?",body:`"${t.title}" cannot be undone.`,destructive:!0})&&s(t.id)},title:"Permanently delete this item",children:[l.jsx(bl,{className:"h-3 w-3"})," Delete"]})]})]})})]})}const DS=[{id:"overview",label:"Overview"},{id:"pipeline",label:"Pipeline"},{id:"sessions",label:"Sessions"},{id:"errors",label:"Errors"},{id:"files",label:"Files"}];DS.map(t=>t.id);const IY={overview:mi,pipeline:Q0,sessions:X0,errors:vc,files:Gd};function FY({activeTab:t="overview",onTabChange:e,errorCount:r=0}){return l.jsx("div",{className:"flex items-center gap-0 shrink-0",style:{height:"28px",borderBottom:"1px solid hsl(var(--border))",background:"hsl(var(--muted) / 0.3)"},role:"tablist","aria-label":"Detail sections",children:DS.map(({id:n,label:i})=>{const s=IY[n],o=n===t,a=n==="errors"?r:0;return l.jsxs("button",{role:"tab","aria-selected":o,className:["flex items-center gap-1 px-2 h-full text-[10px] uppercase tracking-wider font-medium transition-colors","border-b-2 -mb-px",o?"border-accent text-accent":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"].join(" "),onClick:()=>e==null?void 0:e(n),children:[l.jsx(s,{style:{width:10,height:10}}),i,a>0&&l.jsx("span",{className:"text-[8px] min-w-[14px] h-3.5 flex items-center justify-center rounded-full px-0.5 tabular-nums",style:{background:"hsl(var(--destructive) / 0.15)",color:"hsl(var(--destructive))"},children:a})]},n)})})}const l0=[{id:"design",label:"Design"},{id:"blueprint",label:"Blueprint"},{id:"execute",label:"Execute"},{id:"review",label:"Review"},{id:"coverage",label:"Coverage"},{id:"ship",label:"Ship"}];function Ad(t,e,r,n){if(r&&r.featureCode===n&&r.currentStep===t)return"active";if(e&&Array.isArray(e)){const i=e.find(s=>s.phase===t||s.step===t);if(i)return i.status==="failed"?"failed":"complete"}return"pending"}function PY({item:t,activeBuild:e}){const[r,n]=C.useState(null),i=(t==null?void 0:t.phaseHistory)||[],s=(t==null?void 0:t.featureCode)||(t==null?void 0:t.text)||"";return l.jsxs("div",{className:"p-3",children:[l.jsx("div",{className:"flex items-center gap-0 mb-3",children:l0.map((o,a)=>{const c=Ad(o.id,i,e,s),h=Rf[c],u=r===o.id;return l.jsxs(Dt.Fragment,{children:[a>0&&l.jsx("div",{className:"flex-1 h-px",style:{background:c==="pending"?"hsl(var(--muted-foreground) / 0.2)":h,minWidth:"8px"}}),l.jsxs("button",{onClick:()=>n(u?null:o.id),className:"relative flex flex-col items-center group",title:o.label,children:[l.jsx("div",{className:["w-3 h-3 rounded-full border-2 transition-all",c==="active"?"animate-pulse":"",u?"ring-2 ring-accent/30":""].join(" "),style:{borderColor:h,background:c==="complete"||c==="failed"?h:"transparent"}}),l.jsx("span",{className:"text-[8px] text-muted-foreground mt-1 opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap",children:o.label})]})]},o.id)})}),l.jsx("div",{className:"flex justify-between px-0.5",children:l0.map(o=>{const a=Ad(o.id,i,e,s);return l.jsx("span",{className:"text-[8px] font-medium uppercase tracking-wider",style:{color:a==="pending"?"hsl(var(--muted-foreground) / 0.4)":Rf[a]},children:o.label},o.id)})}),r&&l.jsx("div",{className:"mt-3 p-2 rounded border border-border/50 bg-muted/20",children:l.jsx($Y,{stepId:r,phaseHistory:i,activeBuild:e,featureCode:s})})]})}function $Y({stepId:t,phaseHistory:e,activeBuild:r,featureCode:n}){const i=Ad(t,e,r,n),s=e==null?void 0:e.find(a=>a.phase===t||a.step===t),o={complete:"text-success",active:"text-accent",failed:"text-destructive",pending:"text-muted-foreground"};return l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-xs font-semibold text-foreground capitalize",children:t}),l.jsx("span",{className:`text-[10px] font-medium ${o[i]}`,children:i})]}),(s==null?void 0:s.summary)&&l.jsx("p",{className:"text-[10px] text-muted-foreground",children:s.summary}),(s==null?void 0:s.durationMs)!=null&&l.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Duration: ",s.durationMs<1e3?`${s.durationMs}ms`:`${(s.durationMs/1e3).toFixed(1)}s`]}),(s==null?void 0:s.agent)&&l.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Agent: ",s.agent]}),i==="active"&&r&&l.jsx("p",{className:"text-[10px] text-accent",children:"Running..."}),i==="pending"&&l.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"Not started"})]})}function DY(t){if(!t)return"";const e=Date.now()-new Date(t).getTime();return e<6e4?"just now":e<36e5?`${Math.floor(e/6e4)}m ago`:e<864e5?`${Math.floor(e/36e5)}h ago`:`${Math.floor(e/864e5)}d ago`}function OY(t){return t?t<1e3?`${t}ms`:t<6e4?`${(t/1e3).toFixed(0)}s`:`${(t/6e4).toFixed(1)}m`:"—"}function RY({featureCode:t,sessions:e=[],items:r=[]}){const[n,i]=C.useState(null),s=C.useMemo(()=>t?new Set(r.filter(a=>{var c;return((c=a.lifecycle)==null?void 0:c.featureCode)===t||a.featureCode===t||a.feature_code===t}).map(a=>a.id)):new Set,[t,r]),o=C.useMemo(()=>s.size===0?e.slice(0,20):e.filter(a=>!!(a.featureCode===t||a.itemsWorked&&a.itemsWorked.some(c=>s.has(c))||a.summary&&a.summary.includes(t))),[e,t,s]);return o.length===0?l.jsx("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:"No sessions for this feature."}):l.jsxs("div",{className:"p-2 space-y-0.5",children:[l.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground px-1 mb-1",children:["Sessions (",o.length,")"]}),o.map(a=>{const c=n===a.id;return l.jsxs("div",{children:[l.jsxs("button",{onClick:()=>i(c?null:a.id),className:"flex items-center gap-2 w-full px-2 py-1.5 text-left rounded hover:bg-muted/30 transition-colors",children:[l.jsx("span",{className:"text-[10px] font-mono text-accent shrink-0 w-12 truncate",children:a.source||"agent"}),l.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0 w-16 truncate",children:a.classification||a.workType||"—"}),l.jsxs("span",{className:"text-[9px] text-muted-foreground tabular-nums flex gap-1.5 shrink-0",children:[l.jsxs("span",{title:"reads",children:[a.reads||0,"r"]}),l.jsxs("span",{title:"writes",children:[a.writes||0,"w"]}),l.jsxs("span",{title:"errors",style:a.errors>0?{color:"hsl(var(--destructive))"}:{},children:[a.errors||0,"e"]})]}),l.jsx("span",{className:"text-[9px] text-muted-foreground tabular-nums shrink-0",children:OY(a.durationMs)}),l.jsx("span",{className:"text-[9px] text-muted-foreground ml-auto shrink-0",children:DY(a.startedAt||a.createdAt)})]}),c&&a.summary&&l.jsx("div",{className:"px-3 py-1.5 text-[10px] text-muted-foreground bg-muted/10 rounded mx-1 mb-1",children:a.summary})]},a.id)})]})}function zY(t){if(!t)return"";const e=Date.now()-new Date(t).getTime();return e<6e4?"just now":e<36e5?`${Math.floor(e/6e4)}m ago`:e<864e5?`${Math.floor(e/36e5)}h ago`:`${Math.floor(e/864e5)}d ago`}const cu=10;function qY({featureCode:t,errors:e=[],items:r=[]}){const[n,i]=C.useState(null),[s,o]=C.useState(!1),a=C.useMemo(()=>t?new Set(r.filter(u=>{var d;return((d=u.lifecycle)==null?void 0:d.featureCode)===t||u.featureCode===t||u.feature_code===t}).map(u=>u.id)):new Set,[t,r]),c=C.useMemo(()=>!t&&a.size===0?[]:e.filter(u=>!!(t&&u.featureCode===t||u.itemId&&a.has(u.itemId)||t&&u.message&&u.message.includes(t))),[e,t,a]);if(c.length===0)return l.jsxs("div",{className:"p-3 flex flex-col items-center gap-2 text-muted-foreground",children:[l.jsx(ZT,{style:{width:20,height:20,color:"hsl(var(--success, 160 60% 45%))"}}),l.jsx("span",{className:"text-[11px] italic",children:"No errors for this feature."})]});const h=s?c:c.slice(0,cu);return l.jsxs("div",{className:"p-2 space-y-0.5",children:[l.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground px-1 mb-1",children:["Errors (",c.length,")"]}),h.map((u,d)=>{const f=n===d;return l.jsxs("button",{onClick:()=>i(f?null:d),className:"flex flex-col w-full px-2 py-1.5 text-left rounded hover:bg-destructive/5 transition-colors",children:[l.jsxs("div",{className:"flex items-center gap-2 w-full",children:[l.jsx("span",{className:"text-[10px] text-destructive shrink-0",children:"✕"}),l.jsx("span",{className:"text-[10px] font-mono text-muted-foreground shrink-0 w-16 truncate",children:u.tool||u.toolName||"unknown"}),l.jsx("span",{className:`text-[10px] text-foreground flex-1 ${f?"":"line-clamp-2"} truncate`,children:u.message||u.error||"Unknown error"}),l.jsx("span",{className:"text-[9px] text-muted-foreground shrink-0 ml-auto",children:zY(u.timestamp||u.createdAt)})]}),f&&l.jsx("div",{className:"mt-1.5 px-5 py-1.5 text-[10px] text-foreground font-mono bg-muted/10 rounded whitespace-pre-wrap break-all",children:u.message||u.error||u.stack||"No additional details"})]},d)}),!s&&c.length>cu&&l.jsxs("button",{onClick:()=>o(!0),className:"w-full text-center text-[10px] text-accent hover:underline py-1",children:["Show ",c.length-cu," more"]})]})}function WY(t){return t?t<1024?`${t}B`:t<1048576?`${(t/1024).toFixed(1)}KB`:`${(t/1048576).toFixed(1)}MB`:"—"}function HY(t){if(!t)return"";const e=Date.now()-new Date(t).getTime();return e<6e4?"just now":e<36e5?`${Math.floor(e/6e4)}m ago`:e<864e5?`${Math.floor(e/36e5)}h ago`:`${Math.floor(e/864e5)}d ago`}function UY({featureCode:t,onOpenFile:e}){const[r,n]=C.useState([]),[i,s]=C.useState(!0);C.useEffect(()=>{const c=new AbortController;return s(!0),vt("/api/files",{signal:c.signal}).then(h=>h.json()).then(h=>{c.signal.aborted||(n(Array.isArray(h)?h:h.files||[]),s(!1))}).catch(h=>{c.signal.aborted||(n([]),s(!1))}),()=>c.abort()},[t]);const o=`docs/features/${t}/`,a=C.useMemo(()=>r.filter(c=>(typeof c=="string"?c:c.path||c.name||"").startsWith(o)),[r,o]);return i?l.jsx("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:"Loading files..."}):a.length===0?l.jsxs("div",{className:"p-3 flex flex-col items-center gap-2 text-muted-foreground",children:[l.jsx(Gd,{style:{width:20,height:20,opacity:.5}}),l.jsx("span",{className:"text-[11px] italic",children:"No files in feature folder."})]}):l.jsxs("div",{className:"p-2 space-y-0.5",children:[l.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground px-1 mb-1",children:["Files (",a.length,")"]}),a.map((c,h)=>{const u=typeof c=="string"?c:c.path||c.name||"",d=u.split("/").pop(),f=typeof c=="object"?c.size:null,p=typeof c=="object"?c.modified||c.mtime:null;return l.jsxs("button",{onClick:()=>e==null?void 0:e(u),className:"flex items-center gap-2 w-full px-2 py-1.5 text-left rounded hover:bg-accent/10 transition-colors",children:[l.jsx(mi,{className:"h-3 w-3 shrink-0 text-accent"}),l.jsx("span",{className:"text-xs text-foreground truncate flex-1",children:d}),f!=null&&l.jsx("span",{className:"text-[9px] text-muted-foreground tabular-nums shrink-0",children:WY(f)}),p&&l.jsx("span",{className:"text-[9px] text-muted-foreground shrink-0",children:HY(p)})]},h)})]})}function VY({itemId:t,onSelect:e,onClose:r,onOpenFile:n,onViewInGraph:i,onViewInTree:s}){var T;const{items:o,connections:a,gates:c,updateItem:h,deleteItem:u,createConnection:d,deleteConnection:f,resolveGate:p,activeBuild:m,sessions:x,agentErrors:g}=lr(vi(S=>({items:S.items,connections:S.connections,gates:S.gates,updateItem:S.updateItem,deleteItem:S.deleteItem,createConnection:S.createConnection,deleteConnection:S.deleteConnection,resolveGate:S.resolveGate,activeBuild:S.activeBuild,sessions:S.sessions,agentErrors:S.agentErrors}))),y=o.find(S=>S.id===t)||null,[k,b]=C.useState("overview"),w=((T=y==null?void 0:y.lifecycle)==null?void 0:T.featureCode)||(y==null?void 0:y.featureCode)||(y==null?void 0:y.feature_code)||"",_=C.useMemo(()=>w?g.filter(S=>S.featureCode===w||w&&S.message&&S.message.includes(w)):[],[g,w]);return y?l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsx(FY,{activeTab:k,onTabChange:b,errorCount:_.length}),l.jsxs("div",{className:"flex-1 min-h-0 overflow-auto",children:[k==="overview"&&l.jsxs(l.Fragment,{children:[l.jsx(MY,{item:y,items:o,connections:a,gates:c,onUpdate:(S,L)=>h(S,L),onDelete:S=>{u(S),r()},onCreateConnection:d,onDeleteConnection:f,onSelect:e,onClose:r,onPressureTest:()=>{},onResolveGate:p}),l.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 mt-1",style:{borderTop:"1px solid hsl(var(--border))"},children:[i&&l.jsxs("button",{onClick:()=>i(t),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[l.jsx("span",{style:{fontSize:10},children:"↑"})," View in Graph"]}),s&&l.jsxs("button",{onClick:()=>s(t),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[l.jsx("span",{style:{fontSize:10},children:"↓"})," View in Tree"]})]})]}),k==="pipeline"&&l.jsx(PY,{item:y,activeBuild:m}),k==="sessions"&&l.jsx(RY,{featureCode:w,sessions:x,items:o}),k==="errors"&&l.jsx(qY,{featureCode:w,errors:g,items:o}),k==="files"&&l.jsx(UY,{featureCode:w,onOpenFile:n})]})]}):l.jsx("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:"Item not found."})}function YY(t){if(!t)return null;const{retries:e}=t;return e==null?null:Array.isArray(e)?e.length===0?null:{count:e.length,isArray:!0,items:e}:typeof e=="number"&&e>0?{count:e,isArray:!1,items:[]}:null}function GY(t){var e;return(e=t==null?void 0:t.violations)!=null&&e.length?t.violations:[]}function XY(t,e){if(!t)return null;for(const r of t.values())if(r.stepId===e)return r;return null}function KY(t,e,r){var h;if(!t||t.status!=="running")return null;const n=t.startedAt?Date.parse(t.startedAt):r,i=r-n,s=t.wallClockTimeout!=null?t.wallClockTimeout*60*1e3:null,o=(h=e==null?void 0:e.per_loop_type)==null?void 0:h[t.loopType],a=(o==null?void 0:o.maxTotal)!=null?o.usedIterations:null,c=(o==null?void 0:o.maxTotal)??null;return{count:t.count??0,maxIterations:t.maxIterations??null,loopType:t.loopType,elapsedMs:i,timeoutMs:s,usedIterations:a,maxTotal:c}}function QY(t){if(!(t!=null&&t.per_loop_type))return"";const e={review:"r",coverage:"c"},r=[];for(const[n,i]of Object.entries(e)){const s=t.per_loop_type[n];!s||s.maxTotal==null||r.push(`${i} ${s.usedIterations}/${s.maxTotal}`)}return r.join(" · ")}function c0(t){return!t||t<=0?"$0.00":`$${t.toFixed(4)}`}const h0=[{id:"T0",name:"schema",label:"T0"},{id:"T1",name:"lint",label:"T1"},{id:"T2",name:"tests",label:"T2"},{id:"T3",name:"review",label:"T3"},{id:"T4",name:"codex",label:"T4"}];function ZY({tierMap:t,tierSummary:e}){const[r,n]=C.useState(null),i=s=>n(o=>o===s?null:s);return l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:"Tier Pipeline"}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[h0.map((s,o)=>{var d;const a=t[s.id],c=(d=e==null?void 0:e.tiersSkipped)==null?void 0:d.includes(s.id);let h,u;return c?(h="bg-muted-foreground/40",u=`${s.id} (${s.name}): skipped`):a===!0?(h="bg-success",u=`${s.id} (${s.name}): passed`):a===!1?(h="bg-destructive",u=`${s.id} (${s.name}): failed`):(h="bg-muted-foreground/20",u=`${s.id} (${s.name}): not run`),l.jsxs(Dt.Fragment,{children:[o>0&&l.jsx("div",{className:"h-px w-3 bg-muted-foreground/20 shrink-0"}),l.jsxs("button",{className:"flex flex-col items-center gap-0.5 group",onClick:()=>i(s.id),title:u,children:[l.jsx("div",{className:`w-2.5 h-2.5 rounded-full transition-all group-hover:scale-125 ${h} ${r===s.id?"ring-1 ring-foreground/40":""}`}),l.jsx("span",{className:"text-[8px] text-muted-foreground leading-none",children:s.label})]})]},s.id)}),(e==null?void 0:e.costSaved)>0&&l.jsxs("span",{className:"ml-2 text-[9px] text-success/80",children:["saved ~$",e.costSaved.toFixed(2)]})]}),r&&l.jsx("div",{className:"mt-1.5 px-2 py-1 rounded bg-muted/20 text-[9px] text-muted-foreground",children:(()=>{var c;const s=t[r],o=(c=e==null?void 0:e.tiersSkipped)==null?void 0:c.includes(r),a=h0.find(h=>h.id===r);return o?`${r} (${a==null?void 0:a.name}): skipped — short-circuited by earlier failure`:s===!0?`${r} (${a==null?void 0:a.name}): passed`:s===!1?`${r} (${a==null?void 0:a.name}): failed`:`${r} (${a==null?void 0:a.name}): not run this build`})()})]})}function hu(t){return t>=80?"text-success":t>=60?"text-amber-400":"text-destructive"}function JY(t){return t==="improving"?"↑":t==="declining"?"↓":"→"}const u0={test_coverage:"Tests",review_findings:"Review",contract_compliance:"Contracts",runtime_errors:"Runtime",doc_freshness:"Docs",plan_completion:"Plan"};function d0(t){if(t==null)return"—";const e=Math.floor(t/1e3);if(e<60)return`${e}s`;const r=Math.floor(e/60),n=e%60;return`${r}:${String(n).padStart(2,"0")}`}function tG({loopState:t,budget:e}){const[r,n]=C.useState(()=>Date.now());C.useEffect(()=>{if(!t||t.status!=="running")return;const s=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(s)},[t]);const i=KY(t,e,r);return i?l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Live Counters"}),l.jsxs("div",{className:"space-y-0.5 text-[10px]",children:[l.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[l.jsxs("span",{className:"text-foreground font-mono font-medium",children:["attempt ",i.count,"/",i.maxIterations??"?"]}),l.jsx("span",{className:"text-muted-foreground",children:"·"}),l.jsxs("span",{className:"text-foreground font-mono",children:[d0(i.elapsedMs),i.timeoutMs!=null&&l.jsxs("span",{className:"text-muted-foreground",children:[" / ",d0(i.timeoutMs)]})]}),i.usedIterations!=null&&i.maxTotal!=null&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-muted-foreground",children:"·"}),l.jsxs("span",{className:"text-foreground font-mono",children:["cumulative ",i.usedIterations,"/",i.maxTotal]})]})]}),l.jsxs("div",{className:"text-muted-foreground/70 text-[9px]",children:["loop: ",i.loopType]})]})]}):null}function eG({stepId:t,tierEvents:e=[],healthEvents:r=[],capabilityEvents:n=[]}){const{activeBuild:i,iterationStates:s}=lr(vi(B=>({activeBuild:B.activeBuild,iterationStates:B.iterationStates}))),[o,a]=C.useState(!1),[c,h]=C.useState(null),u=(i==null?void 0:i.featureCode)??null,d=C.useRef(null);C.useEffect(()=>{if(!u){h(null);return}u!==d.current&&(d.current=u,vt(`/api/lifecycle/budget?featureCode=${encodeURIComponent(u)}`).then(B=>B.json()).then(B=>h(B)).catch(()=>{}))},[u]);const{step:f,allSteps:p}=C.useMemo(()=>i!=null&&i.steps?{step:i.steps.find(N=>N.id===t||N.step_id===t)||null,allSteps:i.steps}:{step:null,allSteps:[]},[i,t]),m=C.useMemo(()=>{if(!r||r.length===0)return null;for(let B=r.length-1;B>=0;B--){const N=r[B];if(N.subtype==="health_score"&&typeof N.score=="number")return N}return null},[r]),{tierMap:x,tierSummary:g}=C.useMemo(()=>{if(!e||e.length===0)return{tierMap:{},tierSummary:null};const B={};let N=null;for(const A of e)A.subtype==="gate_tier_result"?B[A.tierId]=A.passed:A.subtype==="gate_tier_summary"&&(N=A);return{tierMap:B,tierSummary:N}},[e]),y=Object.keys(x).length>0||g!==null,k=C.useMemo(()=>{const B=p.filter(N=>N.cost_usd!=null);return B.length===0?[]:[...B].sort((N,A)=>o?(N.cost_usd??0)-(A.cost_usd??0):(A.cost_usd??0)-(N.cost_usd??0))},[p,o]),b=k.length>0?k[0].id:null,w=C.useMemo(()=>YY(f),[f]),_=C.useMemo(()=>GY(f),[f]),T=C.useMemo(()=>XY(s,t),[s,t]),S=C.useMemo(()=>{if(!n||n.length===0)return null;const B=n.filter(R=>R.stepId===t);if(B.length===0)return null;const N=B.filter(R=>R.severity==="violation").length,A=B.filter(R=>R.severity==="warning").length;return{total:B.length,hardViolations:N,warnings:A}},[n,t]);if(!f)return l.jsxs("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:["Step “",t,"” not found in active build."]});const L={done:"text-success",running:"text-accent",failed:"text-destructive",pending:"text-muted-foreground",skipped:"text-muted-foreground"};return l.jsxs("div",{className:"p-3 space-y-3",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Build Step"}),l.jsx("p",{className:"text-sm font-semibold text-foreground font-mono",children:f.id||f.step_id})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Status:"}),l.jsx("span",{className:`text-xs font-medium ${L[f.status]||"text-foreground"}`,children:f.status||"unknown"})]}),w&&l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-amber-400/80 mb-1",children:"Retries"}),l.jsxs("p",{className:"text-xs text-amber-400",children:["Retried ",w.count," ",w.count===1?"time":"times"]}),w.isArray&&w.items.length>0&&l.jsx("div",{className:"mt-1 space-y-0.5",children:w.items.map((B,N)=>l.jsxs("div",{className:"text-[10px] text-muted-foreground pl-2",children:["#",N+1,B.reason?`: ${B.reason}`:""]},N))})]}),f.durationMs!=null&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Duration:"}),l.jsx("span",{className:"text-xs text-foreground",children:f.durationMs<1e3?`${f.durationMs}ms`:f.durationMs<6e4?`${(f.durationMs/1e3).toFixed(1)}s`:`${(f.durationMs/6e4).toFixed(1)}m`})]}),f.summary&&l.jsxs("div",{children:[l.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Summary:"}),l.jsx("p",{className:"text-xs text-foreground mt-0.5",children:f.summary})]}),f.artifact&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Artifact:"}),l.jsx("span",{className:"text-xs text-foreground font-mono truncate",children:f.artifact})]}),f.agent&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Agent:"}),l.jsx("span",{className:"text-xs text-foreground font-mono",children:f.agent})]}),f.filesChanged&&f.filesChanged.length>0&&l.jsxs("div",{children:[l.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:["Files Changed (",f.filesChanged.length,")"]}),l.jsx("div",{className:"space-y-0.5 max-h-32 overflow-y-auto",children:f.filesChanged.map((B,N)=>l.jsx("p",{className:"text-[10px] text-foreground font-mono truncate",children:B},N))})]}),(f.input_tokens>0||f.output_tokens>0||f.cost_usd>0)&&l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Tokens & Cost"}),l.jsxs("div",{className:"grid grid-cols-3 gap-1 text-[10px]",children:[l.jsx("span",{className:"text-muted-foreground",children:"Input"}),l.jsx("span",{className:"text-muted-foreground",children:"Output"}),l.jsx("span",{className:"text-muted-foreground",children:"Cost"}),l.jsx("span",{className:"text-foreground font-mono",children:(f.input_tokens??0).toLocaleString()}),l.jsx("span",{className:"text-foreground font-mono",children:(f.output_tokens??0).toLocaleString()}),l.jsx("span",{className:"text-foreground font-mono",children:c0(f.cost_usd)})]})]}),y&&l.jsx("div",{children:l.jsx(ZY,{tierMap:x,tierSummary:g})}),_.length>0&&l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-destructive mb-1",children:"Postcondition Violations"}),l.jsx("div",{className:"space-y-0.5",children:_.map((B,N)=>l.jsxs("div",{className:"flex items-start gap-2 px-2 py-1 rounded bg-destructive/10",children:[l.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0 mt-1",style:{background:"hsl(var(--destructive))"}}),l.jsx("span",{className:"text-[10px] text-destructive leading-relaxed",children:typeof B=="string"?B:B.message||JSON.stringify(B)})]},N))})]}),S&&l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-amber-400/80 mb-1",children:"Capability Findings"}),l.jsxs("p",{className:"text-xs text-amber-400",children:[S.total," ",S.total===1?"finding":"findings"," ","(",S.hardViolations," ",S.hardViolations===1?"violation":"violations",","," ",S.warnings," ",S.warnings===1?"warning":"warnings",")"]})]}),(T==null?void 0:T.status)==="running"&&l.jsx(tG,{loopState:T,budget:c}),m!=null&&l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:"Health Score"}),l.jsxs("div",{className:"flex items-baseline gap-2 mb-2",children:[l.jsx("span",{className:`text-2xl font-bold font-mono tabular-nums ${hu(m.score)}`,children:m.score}),l.jsx("span",{className:"text-[10px] text-muted-foreground",children:"/100"}),m.trend&&l.jsxs("span",{className:`text-sm font-mono ${hu(m.score)}`,children:[JY(m.trend.direction),m.trend.delta!=null&&l.jsxs("span",{className:"text-[10px] ml-0.5",children:[m.trend.delta>0?"+":"",Math.round(m.trend.delta)]})]})]}),m.breakdown&&Object.keys(m.breakdown).length>0&&l.jsxs("div",{className:"space-y-1",children:[Object.entries(m.breakdown).map(([B,N])=>l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-[9px] text-muted-foreground w-16 shrink-0",children:u0[B]??B}),l.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-muted-foreground/20 overflow-hidden",children:l.jsx("div",{className:`h-full rounded-full transition-all ${N>=80?"bg-success":N>=60?"bg-amber-400":"bg-destructive"}`,style:{width:`${N}%`}})}),l.jsx("span",{className:`text-[9px] font-mono w-6 text-right ${hu(N)}`,children:N})]},B)),m.missing&&m.missing.length>0&&l.jsxs("p",{className:"text-[9px] text-muted-foreground/60 mt-0.5",children:["No data: ",m.missing.map(B=>u0[B]??B).join(", ")]})]})]}),k.length>1&&l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-1",children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Build Cost Breakdown"}),l.jsx("button",{className:"text-[9px] text-muted-foreground hover:text-foreground transition-colors",onClick:()=>a(B=>!B),children:o?"cost asc":"cost desc"})]}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-[10px] border-collapse",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"text-muted-foreground",children:[l.jsx("th",{className:"text-left pr-2 pb-0.5 font-medium",children:"Step"}),l.jsx("th",{className:"text-right pr-2 pb-0.5 font-medium",children:"In"}),l.jsx("th",{className:"text-right pr-2 pb-0.5 font-medium",children:"Out"}),l.jsx("th",{className:"text-right pb-0.5 font-medium",children:"Cost"}),l.jsx("th",{className:"text-right pb-0.5 pl-2 font-medium",children:"Dur"})]})}),l.jsx("tbody",{children:k.map(B=>{const N=B.id===b,A=B.id===t,R=B.durationMs!=null?B.durationMs<1e3?`${B.durationMs}ms`:B.durationMs<6e4?`${(B.durationMs/1e3).toFixed(1)}s`:`${(B.durationMs/6e4).toFixed(1)}m`:"—";return l.jsxs("tr",{className:`${N?"text-amber-400":"text-foreground"} ${A?"font-semibold":""}`,children:[l.jsx("td",{className:"pr-2 py-0.5 font-mono truncate max-w-[80px]",children:B.id}),l.jsxs("td",{className:"text-right pr-2 py-0.5 font-mono",children:[((B.input_tokens??0)/1e3).toFixed(1),"k"]}),l.jsxs("td",{className:"text-right pr-2 py-0.5 font-mono",children:[((B.output_tokens??0)/1e3).toFixed(1),"k"]}),l.jsx("td",{className:"text-right py-0.5 font-mono",children:c0(B.cost_usd)}),l.jsx("td",{className:"text-right pl-2 py-0.5 text-muted-foreground",children:R})]},B.id)})})]})})]})]})}function OS(t){const e=[],r=/```decision\n([\s\S]*?)```/g;let n=0,i;for(;(i=r.exec(t))!==null;){i.index>n&&e.push({type:"text",content:t.slice(n,i.index)});const s=i[1].trim();try{e.push({type:"decision",content:JSON.parse(s)})}catch{e.push({type:"text",content:s})}n=i.index+i[0].length}return n<t.length&&e.push({type:"text",content:t.slice(n)}),e.length===0&&e.push({type:"text",content:t}),{parts:e}}function p0(t,e){var c;const r=(e||[]).filter(h=>!h.superseded);if(r.length===0)return"";let n=`# Design Document
674
-
675
- `;const i=(t||[]).filter(h=>h.role==="human"&&h.type==="text").slice(0,3);i.length>0&&(n+=`## Problem
676
-
677
- `,n+=i.map(h=>h.content).join(`
678
-
679
- `),n+=`
680
-
681
- `);for(const h of r){const u=h.selectedOption||{};n+=`## ${h.question}
682
-
683
- `,n+=`**Decision:** ${u.title||u.id||"Selected option"}
684
-
685
- `,Array.isArray(u.bullets)&&u.bullets.length>0&&(n+=u.bullets.map(d=>`- ${d}`).join(`
686
- `),n+=`
687
-
688
- `),h.comment&&(n+=`*Note: ${h.comment}*
689
-
690
- `)}const s=(c=r[r.length-1])==null?void 0:c.timestamp,o=s?(t||[]).filter(h=>h.role==="assistant"&&h.timestamp>s):[],a=[];for(const h of o){if(typeof h.content!="string")continue;const u=h.content.split(`
691
- `);for(const d of u){const f=d.trim();f.endsWith("?")&&f.length>10&&f.length<200&&a.push(f)}}return n+=`## Open Threads
692
-
693
- `,a.length>0?(n+=a.map(h=>`- ${h}`).join(`
694
- `),n+=`
695
- `):n+=`_No open threads._
696
- `,n}function rG(t,e){return(e||[]).filter(n=>!n.superseded).map(n=>({title:n.question,type:"decision",decided:!0}))}const po={es:null},Ln=yp((t,e)=>({session:null,messages:[],decisions:[],status:"idle",error:null,streamingMessage:null,scope:null,featureCode:null,designDocPath:null,draftDoc:"",docManuallyEdited:!1,researchItems:[],topicOutline:[],hydrate:async(r,n)=>{if(!r){const c=e().scope;if(c)r=c,n=e().featureCode||null;else try{const h=JSON.parse(localStorage.getItem("compose:designSession")||"{}");r=h.scope||"product",n=h.featureCode||null}catch{r="product"}}const i=e().docManuallyEdited,s=e().draftDoc,o=e().researchItems||[];t({session:null,messages:[],decisions:[],status:"idle",error:null,streamingMessage:null,designDocPath:null,scope:r,featureCode:n,draftDoc:"",docManuallyEdited:!1,researchItems:[],topicOutline:[]});const a=r==="feature"&&n?`?scope=feature&featureCode=${n}`:`?scope=${r}`;try{const c=await vt(`/api/design/session${a}`),{session:h}=await c.json();if(h){const u=h.messages||[],d=h.decisions||[],f=p0(u,d),p=rG(u,d);t({session:h,messages:u,decisions:d,status:h.status==="complete"?"complete":"active",scope:r,featureCode:n,draftDoc:i?s:f,docManuallyEdited:i,topicOutline:p,researchItems:o}),e().disconnectSSE(),e().connectSSE()}else t({session:null,messages:[],decisions:[],status:"idle",error:null,streamingMessage:null,scope:r,featureCode:n,draftDoc:"",docManuallyEdited:!1,researchItems:[],topicOutline:[]}),e().disconnectSSE()}catch(c){t({error:c.message})}},startSession:async(r="product",n=null)=>{try{const i=await vt("/api/design/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:r,featureCode:n})});if(!i.ok){const{error:o}=await i.json();t({error:o});return}const{session:s}=await i.json();try{localStorage.setItem("compose:designSession",JSON.stringify({scope:r,featureCode:n}))}catch{}t({session:s,messages:s.messages||[],decisions:s.decisions||[],status:"active",error:null,scope:r,featureCode:n}),e().connectSSE()}catch(i){t({error:i.message})}},sendMessage:async r=>{const{session:n,messages:i}=e();if(!n)return;const s=n.scope,o=n.featureCode,a={role:"human",type:"text",content:r,timestamp:new Date().toISOString()};t(c=>({messages:[...c.messages,a],status:"streaming"}));try{const c=await vt("/api/design/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:s,featureCode:o,type:"text",content:r})});c.ok||t({messages:i,status:"active",error:`Failed to send message: ${c.status}`})}catch(c){t({messages:i,status:"active",error:c.message})}},selectCard:async(r,n=null,i=null)=>{const{session:s,messages:o}=e();if(!s)return;const a={role:"human",type:"card_select",content:{cardId:r,comment:n},timestamp:new Date().toISOString()};t(c=>({messages:[...c.messages,a],status:"streaming"}));try{const c=await vt("/api/design/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:s.scope,featureCode:s.featureCode,type:"card_select",cardId:r,comment:n,messageIndex:i})});c.ok||t({messages:o,status:"active",error:`Failed to select card: ${c.status}`})}catch(c){t({messages:o,status:"active",error:c.message})}},reviseDecision:async r=>{const{session:n}=e();if(!n)return;const i=e().decisions[r];if(!(!i||i.superseded))try{const s=await vt("/api/design/revise",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:n.scope,featureCode:n.featureCode,decisionIndex:r})});if(!s.ok){const{error:o}=await s.json().catch(()=>({error:"Revision failed"}));t({error:o});return}e().hydrate(n.scope,n.featureCode)}catch(s){t({error:s.message})}},completeDesign:async()=>{const{session:r,draftDoc:n}=e();if(r){t({status:"summarizing"});try{const i={scope:r.scope,featureCode:r.featureCode};n&&(i.draftDoc=n);const s=await vt("/api/design/complete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!s.ok){const{error:c}=await s.json().catch(()=>({error:"Unknown error"}));t({error:c,status:"active"});return}const o=await s.json(),a={session:o.session,status:"complete",designDocPath:o.designDocPath||null};o.error&&(a.error=o.error),t(a)}catch(i){t({error:i.message,status:"active"})}}},connectSSE:()=>{if(po.es)return;const{scope:r,featureCode:n}=e(),i=new URLSearchParams({scope:r||"product"});n&&i.set("featureCode",n);const s=R0("/api/design/stream"),o=s.includes("?")?"&":"?",a=new EventSource(`${s}${o}${i}`);po.es=a,a.addEventListener("ack",()=>{t(c=>c.status!=="streaming"?{status:"streaming"}:{})}),a.addEventListener("text",c=>{const h=JSON.parse(c.data);t(u=>u.streamingMessage?{streamingMessage:{...u.streamingMessage,content:u.streamingMessage.content+h.content}}:{status:"streaming",streamingMessage:{role:"assistant",type:"text",content:h.content,timestamp:new Date().toISOString()}})}),a.addEventListener("decision",c=>{const h=JSON.parse(c.data);t(u=>({status:"streaming",streamingMessage:u.streamingMessage?{...u.streamingMessage,type:"decision",decisionData:h}:{role:"assistant",type:"decision",content:"",decisionData:h,timestamp:new Date().toISOString()}}))}),a.addEventListener("done",()=>{t(c=>({messages:c.streamingMessage?[...c.messages,c.streamingMessage]:c.messages,streamingMessage:null,status:"active"})),e().hydrate()}),a.addEventListener("research",c=>{const h=JSON.parse(c.data);t(u=>({researchItems:[...u.researchItems,{id:h.id,tool:h.tool,input:h.input,timestamp:h.timestamp,summary:null}]}))}),a.addEventListener("research_result",c=>{const h=JSON.parse(c.data);t(u=>{const d=[...u.researchItems],f=h.id?d.findIndex(p=>p.id===h.id):-1;return f!==-1&&(d[f]={...d[f],summary:h.summary}),{researchItems:d}})}),a.addEventListener("error",c=>{try{const h=JSON.parse(c.data);t(u=>({status:"active",streamingMessage:null,error:h.message||"Agent error",messages:u.messages}))}catch{t({status:"active",streamingMessage:null})}}),a.onerror=()=>{t({status:"active"})}},disconnectSSE:()=>{po.es&&(po.es.close(),po.es=null)},reset:()=>{try{localStorage.removeItem("compose:designSession")}catch{}t({session:null,messages:[],decisions:[],status:"idle",error:null,streamingMessage:null,scope:null,featureCode:null,designDocPath:null,draftDoc:"",docManuallyEdited:!1,researchItems:[],topicOutline:[]})},updateDraftDoc:r=>{t({draftDoc:r,docManuallyEdited:!0})},resetDocEdited:()=>{const{messages:r,decisions:n}=e(),i=p0(r,n);t({draftDoc:i,docManuallyEdited:!1})}}));function nG(){const{draftDoc:t,docManuallyEdited:e,updateDraftDoc:r,resetDocEdited:n}=Ln(vi(h=>({draftDoc:h.draftDoc,docManuallyEdited:h.docManuallyEdited,updateDraftDoc:h.updateDraftDoc,resetDocEdited:h.resetDocEdited}))),[i,s]=C.useState(!1),o=!t;let a="empty",c={color:"hsl(var(--muted-foreground))"};return e?(a="edited",c={color:"hsl(var(--primary))"}):o||(a="draft",c={color:"hsl(var(--muted-foreground))"}),l.jsxs("div",{className:"h-full flex flex-col",style:{fontFamily:"inherit"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-2 shrink-0",style:{borderBottom:"1px solid hsl(var(--border))"},children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-[12px] font-semibold",style:{color:"hsl(var(--foreground))"},children:"Design Document"}),l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{...c,background:"hsl(var(--muted))"},children:a})]}),!o&&l.jsx("button",{onClick:()=>s(h=>!h),className:"text-[11px] px-2 py-1 rounded transition-colors",style:{color:"hsl(var(--muted-foreground))",background:i?"hsl(var(--accent))":"transparent"},onMouseEnter:h=>{h.currentTarget.style.color="hsl(var(--foreground))"},onMouseLeave:h=>{h.currentTarget.style.color="hsl(var(--muted-foreground))"},children:i?"Preview":"Edit"})]}),l.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:o?l.jsx("div",{className:"p-4 text-[12px] italic",style:{color:"hsl(var(--muted-foreground))"},children:"Start the design conversation to see the document build here."}):i?l.jsxs("div",{className:"h-full flex flex-col p-2 gap-2",children:[l.jsx("textarea",{className:"flex-1 min-h-0 w-full resize-none rounded p-2 text-[12px]",style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",background:"hsl(var(--background))",color:"hsl(var(--foreground))",border:"1px solid hsl(var(--border))",outline:"none"},value:t,onChange:h=>r(h.target.value),spellCheck:!1}),l.jsx("button",{onClick:()=>{n(),s(!1)},className:"shrink-0 text-[11px] px-3 py-1.5 rounded transition-colors self-start",style:{color:"hsl(var(--muted-foreground))",border:"1px solid hsl(var(--border))",background:"transparent"},onMouseEnter:h=>{h.currentTarget.style.color="hsl(var(--foreground))",h.currentTarget.style.borderColor="hsl(var(--foreground))"},onMouseLeave:h=>{h.currentTarget.style.color="hsl(var(--muted-foreground))",h.currentTarget.style.borderColor="hsl(var(--border))"},children:"Reset to auto-generated"})]}):l.jsx("div",{className:"p-4 prose prose-sm max-w-none",style:{color:"hsl(var(--foreground))","--tw-prose-body":"hsl(var(--foreground))","--tw-prose-headings":"hsl(var(--foreground))","--tw-prose-code":"hsl(var(--foreground))","--tw-prose-bold":"hsl(var(--foreground))","--tw-prose-links":"hsl(var(--primary))",fontSize:"12px"},children:l.jsx(pp,{remarkPlugins:[xp],children:t})})})]})}function f0(t){if(!t)return"—";const e=Date.now()-new Date(t).getTime(),r=Math.floor(e/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function iG(t){if(!t)return"";const e=Math.max(0,Math.floor((new Date(t).getTime()-Date.now())/1e3));if(e<=0)return"expired";const r=Math.floor(e/60),n=e%60;return`${r}:${String(n).padStart(2,"0")}`}function sG({device:t,idx:e,onRevoke:r}){const[n,i]=C.useState(!1),s=C.useRef(null),o=C.useCallback(()=>{if(!n){i(!0),s.current=setTimeout(()=>i(!1),3e3);return}clearTimeout(s.current),i(!1),r(t.id)},[n,t.id,r]);return C.useEffect(()=>()=>clearTimeout(s.current),[]),l.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 rounded-lg bg-muted/30 border border-border",style:{opacity:t.revoked?.5:1},children:[l.jsx(ty,{className:"h-4 w-4 text-muted-foreground shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:t.name||"Unknown device"}),t.revoked&&l.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full bg-destructive/10 text-destructive shrink-0",children:"revoked"})]}),l.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:["Paired ",f0(t.paired_at),t.last_seen&&!t.revoked&&` · seen ${f0(t.last_seen)}`]})]}),!t.revoked&&l.jsx("button",{"data-testid":`pair-device-revoke-${e}`,onClick:o,className:`shrink-0 text-[10px] px-2 py-1 rounded transition-colors ${n?"bg-destructive text-destructive-foreground hover:bg-destructive/90":"text-muted-foreground hover:text-destructive hover:bg-destructive/10"}`,title:n?"Click again to confirm revoke":"Revoke device",children:n?l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx(bl,{className:"h-3 w-3"})," Confirm"]}):l.jsx(bl,{className:"h-3 w-3"})})]})}function oG({open:t,onClose:e,publicHost:r}){const[n,i]=C.useState("idle"),[s,o]=C.useState(null),[a,c]=C.useState(""),[h,u]=C.useState(null),[d,f]=C.useState(""),[p,m]=C.useState(null),[x,g]=C.useState(""),[y,k]=C.useState(null),[b,w]=C.useState([]),[_,T]=C.useState(!1),S=C.useRef(null),L=C.useRef(null),B=C.useCallback(async()=>{T(!0);try{const z=await vt("/api/auth/devices",{headers:Mr()});if(z.ok){const P=await z.json();w(P.devices||[])}}catch{}finally{T(!1)}},[]),N=C.useCallback(async z=>{try{(await vt(`/api/auth/devices/${z}`,{method:"DELETE",headers:Mr()})).ok&&await B()}catch{}},[B]),A=C.useCallback(async()=>{i("loading"),g(""),k(null),o(null),c(""),u(null),f("");try{const z=await vt("/api/auth/pair/init",{method:"POST",headers:Mr({"Content-Type":"application/json"})});if(z.status===503){i("error"),g("COMPOSE_API_TOKEN is not set — the server cannot authenticate this request. Start compose via `compose start` so the supervisor generates the token, or set COMPOSE_API_TOKEN manually.");return}if(!z.ok){const $=await z.json().catch(()=>({}));i("error"),g($.error||`Server returned ${z.status}`);return}const P=await z.json(),I=P.public_host||r||(typeof window<"u"?window.location.origin:""),F=P.pair_url||`${I}/m/pair?code=${P.code}`;m(P.public_host||r||null),o(P.code),c(F),u(P.expires_at),i("ready")}catch(z){i("error"),g(z.message||"Network error")}},[r]);if(C.useEffect(()=>{if(!t){i("idle"),o(null),c(""),u(null),f(""),g(""),k(null),clearInterval(L.current);return}A(),B()},[t]),C.useEffect(()=>{if(n!=="ready"||!a||!S.current)return;let z=!1;return(async()=>{try{const P=(await Ht(async()=>{const{default:I}=await import("./browser-CnKiSnlr.js").then(F=>F.b);return{default:I}},__vite__mapDeps([56,6,7]))).default;!z&&S.current&&await P.toCanvas(S.current,a,{width:200,margin:2,color:{dark:"#000000",light:"#ffffff"}})}catch{}})(),()=>{z=!0}},[n,a]),C.useEffect(()=>{if(!h){clearInterval(L.current);return}clearInterval(L.current);const z=()=>f(iG(h));return z(),L.current=setInterval(z,1e3),()=>clearInterval(L.current)},[h]),C.useEffect(()=>{if(!t)return;function z(P){const{name:I,device_id:F}=P.detail??{};k({name:I||"New device",id:F}),clearInterval(L.current),f(""),B()}return window.addEventListener("compose:devicePaired",z),()=>window.removeEventListener("compose:devicePaired",z)},[t,B]),!t)return null;const R=!p;return l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",role:"dialog","aria-modal":"true","aria-label":"Pair mobile device","data-testid":"pair-device-modal",children:[l.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:e}),l.jsxs("div",{className:"relative w-full max-w-md max-h-[85vh] flex flex-col rounded-xl border border-border bg-card shadow-2xl mx-4",children:[l.jsxs("div",{className:"flex items-center gap-3 p-4 pb-3 border-b border-border shrink-0",children:[l.jsx(ty,{className:"h-5 w-5 text-accent shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Pair mobile device"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Scan the QR code on your phone to connect remotely"})]}),l.jsx("button",{className:"shrink-0 opacity-60 hover:opacity-100 transition-opacity",onClick:e,"aria-label":"Close",children:l.jsx(Kr,{className:"h-4 w-4"})})]}),l.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-4",children:[y&&l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-success/10 border border-success/20",children:[l.jsx(Vd,{className:"h-4 w-4 text-success shrink-0"}),l.jsxs("span",{className:"text-xs text-success font-medium",children:["Paired: ",y.name]})]}),n==="loading"&&l.jsxs("div",{className:"flex items-center justify-center py-10 gap-2 text-muted-foreground",children:[l.jsx(xl,{className:"h-5 w-5 animate-spin"}),l.jsx("span",{className:"text-xs",children:"Generating pairing code…"})]}),n==="error"&&l.jsxs("div",{"data-testid":"pair-device-error",className:"px-3 py-3 rounded-lg bg-destructive/10 border border-destructive/20 space-y-2",children:[l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx(uj,{className:"h-4 w-4 text-destructive shrink-0 mt-0.5"}),l.jsx("p",{className:"text-xs text-destructive leading-relaxed",children:x})]}),l.jsx("button",{className:"text-[10px] text-accent hover:underline",onClick:A,children:"Retry"})]}),n==="ready"&&l.jsxs("div",{className:"space-y-3",children:[R&&l.jsxs("div",{className:"text-[10px] text-amber-500 bg-amber-500/10 border border-amber-500/20 rounded px-2 py-1.5",children:["No public host configured — the URL below uses your local origin. For remote pairing, configure a public host (e.g. via"," ",l.jsx("code",{className:"font-mono",children:"compose remote pair --public-host=<URL>"}),")."]}),l.jsx("div",{className:"flex justify-center",children:l.jsx("canvas",{ref:S,"data-testid":"pair-device-qr",className:"rounded border border-border bg-white",width:200,height:200,"aria-label":"QR code for pairing"})}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("label",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:"Pairing URL"}),l.jsx("input",{"data-testid":"pair-device-url",readOnly:!0,value:a,className:"w-full text-[10px] font-mono bg-muted text-foreground px-2 py-1.5 rounded border border-border outline-none select-all cursor-text",onFocus:z=>z.target.select(),"aria-label":"Pairing URL"})]}),d&&l.jsxs("p",{className:"text-[10px] text-center text-muted-foreground",children:["Expires in"," ",l.jsx("span",{className:d==="expired"?"text-destructive font-semibold":"text-foreground font-mono",children:d}),d!=="expired"&&l.jsx("button",{className:"ml-2 text-accent hover:underline",onClick:A,children:"Refresh"}),d==="expired"&&l.jsx("button",{className:"ml-2 text-accent hover:underline",onClick:A,children:"Generate new code"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Paired devices"}),_&&l.jsx(xl,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),l.jsxs("div",{"data-testid":"pair-device-list",className:"space-y-1.5",children:[!_&&b.length===0&&l.jsx("p",{className:"text-xs text-muted-foreground text-center py-3",children:"No paired devices yet"}),b.map((z,P)=>l.jsx(sG,{device:z,idx:P,onRevoke:N},z.id))]})]})]})]})]})}const uu={build:{background:"hsl(217 91% 60% / 0.12)",borderColor:"hsl(217 91% 60% / 0.3)",color:"hsl(217 91% 60%)"},gate:{background:"hsl(38 92% 50% / 0.12)",borderColor:"hsl(38 92% 50% / 0.3)",color:"hsl(38 92% 50%)"},error:{background:"hsl(0 72% 51% / 0.12)",borderColor:"hsl(0 72% 51% / 0.3)",color:"hsl(0 72% 51%)"},done:{background:"hsl(160 60% 45% / 0.12)",borderColor:"hsl(160 60% 45% / 0.3)",color:"hsl(160 60% 45%)"},iteration:{background:"hsl(217 91% 60% / 0.12)",borderColor:"hsl(217 91% 60% / 0.3)",color:"hsl(210 100% 66%)"}},m0={enter:{transform:"translateX(20px)",opacity:0},steady:{transform:"translateX(0)",opacity:1},flash:{transform:"translateX(0)",opacity:1},exit:{transform:"translateX(0)",opacity:0}};function aG({type:t="build",label:e,retries:r=0,onClick:n,onApprove:i,onDismiss:s,animationState:o="steady"}){const a=(o==="flash"?uu.done:uu[t])||uu.build,c=m0[o]||m0.steady,h=o==="exit"?"200ms":o==="flash"?"300ms":"200ms";return l.jsxs("div",{className:"ops-strip-entry",style:{display:"inline-flex",alignItems:"center",gap:"4px",height:"24px",padding:"0 10px",borderRadius:"12px",border:`1px solid ${a.borderColor}`,background:a.background,color:a.color,fontSize:"11px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.04em",cursor:n?"pointer":"default",whiteSpace:"nowrap",transition:`transform ${h} ease, opacity ${h} ease, background 300ms ease, border-color 300ms ease, color 300ms ease`,...c},onClick:n,role:"button",tabIndex:0,onKeyDown:u=>{u.key==="Enter"&&n&&n()},children:[l.jsxs("span",{style:{fontSize:"12px",lineHeight:1},children:[t==="build"&&"▶",t==="gate"&&"⚠",t==="error"&&"✕",t==="done"&&"✓",t==="iteration"&&"↻"]}),l.jsx("span",{children:e}),r>0&&l.jsx("span",{style:{background:"hsl(38 90% 50% / 0.2)",color:"hsl(38 90% 60%)",padding:"0 5px",borderRadius:"9999px",fontSize:"9px"},children:r}),t==="gate"&&i&&l.jsx("button",{className:"ops-strip-approve",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"18px",height:"18px",borderRadius:"9px",border:`1px solid ${a.borderColor}`,background:"transparent",color:a.color,fontSize:"11px",cursor:"pointer",padding:0,marginLeft:"2px",lineHeight:1},onClick:u=>{u.stopPropagation(),i()},title:"Approve gate",children:"✓"}),t==="error"&&s&&l.jsx("button",{className:"ops-strip-dismiss",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"18px",height:"18px",borderRadius:"9px",border:"none",background:"transparent",color:a.color,fontSize:"10px",cursor:"pointer",padding:0,marginLeft:"2px",opacity:.6,lineHeight:1},onClick:u=>{u.stopPropagation(),s()},title:"Dismiss error",children:"✕"})]})}function lG(t){return!t||t<=0?"":`$${t.toFixed(2)}`}function cG(t){const e=Math.floor(t/1e3),r=Math.floor(e/60),n=e%60;return`${r}:${String(n).padStart(2,"0")}`}function hG(t){const e=Math.round(t*60),r=Math.floor(e/60),n=e%60;return`${r}:${String(n).padStart(2,"0")}`}function uG({activeBuild:t,gates:e,items:r,recentErrors:n,iterationStates:i,now:s=Date.now()}){const o=[];if(t&&t.featureCode){const a=t.currentStep?`${t.currentStep}`:"building",c=t.totalSteps?` · step ${t.currentStepIndex??"?"}/${t.totalSteps}`:"",h=lG(t.cumulative_cost_usd),u=h?` · ${h}`:"",d=t.flowId||t.startedAt||t.featureCode;o.push({key:`build-${t.featureCode}-${d}`,type:t.status==="complete"?"done":"build",label:`${t.featureCode} · ${a}${c}${u}`,featureCode:t.featureCode,retries:t.retries??0})}if(Array.isArray(e)){for(const a of e)if(a.status==="pending"){const c=un[a.stepId]??(a.fromPhase||a.toPhase||"Gate"),h=Array.isArray(r)?r.find(d=>d.id===a.itemId):null,u=(h==null?void 0:h.title)||a.featureCode||"";o.push({key:`gate-${a.id}`,type:"gate",label:u?`${c} — ${u}`:c,featureCode:a.featureCode||"",gateId:a.id})}}if(i){for(const[a,c]of i)if(c.status==="running"){const h=c.loopType==="review"?"review":"coverage",u=`${c.count}/${c.maxIterations}`;let d="";if(c.wallClockTimeout!=null&&c.startedAt){const f=s-new Date(c.startedAt).getTime();d=`, ${cG(f)}/${hG(c.wallClockTimeout)}`}o.push({key:`iter-${a}`,type:"iteration",label:`${h} ${u}${d}`})}}if(Array.isArray(n))for(const a of n){const c=a.featureCode||"system",h=(a.message||a.errorType||"error").substring(0,60);o.push({key:`error-${a.timestamp}-${h.substring(0,10)}`,type:"error",label:`${c} · ${h}`,featureCode:c,timestamp:a.timestamp})}return o}function dG({activeView:t,onSelectFeature:e}){const{activeBuild:r,gates:n,items:i,recentErrors:s,resolveGate:o,iterationStates:a}=lr(vi(P=>({activeBuild:P.activeBuild,gates:P.gates,items:P.items,recentErrors:P.recentErrors,resolveGate:P.resolveGate,iterationStates:P.iterationStates}))),[c,h]=C.useState(new Map),u=C.useRef([]),d=C.useRef(new Set),f=C.useRef(new Set),[p,m]=C.useState(null),x=C.useRef(null),g=(r==null?void 0:r.featureCode)??null;C.useEffect(()=>{if(!g){m(null),x.current=null;return}g!==x.current&&(x.current=g,vt(`/api/lifecycle/budget?featureCode=${encodeURIComponent(g)}`).then(P=>P.json()).then(P=>m(P)).catch(()=>{}))},[g]);const y=C.useRef(0);C.useEffect(()=>{if(!g)return;const P=a?[...a.values()].reduce((I,F)=>I+(F.count??0),0):0;P!==y.current&&(y.current=P,vt(`/api/lifecycle/budget?featureCode=${encodeURIComponent(g)}`).then(I=>I.json()).then(I=>m(I)).catch(()=>{}))},[a,g]);const k=C.useRef(r),[b,w]=C.useState(null);C.useEffect(()=>{const P=k.current;if(P&&P.featureCode&&!r){w({...P,status:"complete"});const I=setTimeout(()=>w(null),3e3);return k.current=r,()=>clearTimeout(I)}k.current=r},[r]);const _=r||b,[T,S]=C.useState(()=>Date.now()),L=a&&[...a.values()].some(P=>P.status==="running");C.useEffect(()=>{if(!L)return;const P=setInterval(()=>S(Date.now()),1e3);return()=>clearInterval(P)},[L]);const B=C.useMemo(()=>uG({activeBuild:_,gates:n,items:i,recentErrors:s,iterationStates:a,now:T}),[_,n,i,s,a,T]),N=C.useMemo(()=>B.filter(P=>!d.current.has(P.key)),[B]);C.useEffect(()=>{const P=new Set(u.current.map(F=>F.key)),I=N.filter(F=>!P.has(F.key)).map(F=>F.key);I.length>0&&(h(F=>{const $=new Map(F);for(const O of I)$.set(O,"enter");return $}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{h(F=>{const $=new Map(F);for(const O of I)$.get(O)==="enter"&&$.set(O,"steady");return $})})}));for(const F of N)F.type==="done"&&!f.current.has(F.key)&&(f.current.add(F.key),h($=>{const O=new Map($);return O.set(F.key,"flash"),O}),setTimeout(()=>{h($=>{const O=new Map($);return O.set(F.key,"exit"),O}),setTimeout(()=>{d.current.add(F.key),h($=>{const O=new Map($);return O.delete(F.key),O})},500)},2e3));u.current=N},[N]);const A=C.useCallback(P=>{h(I=>{const F=new Map(I);return F.set(P,"exit"),F}),setTimeout(()=>{d.current.add(P),h(I=>{const F=new Map(I);return F.delete(P),F})},200)},[]),R=C.useCallback(P=>{o&&o(P,"approve","Approved from ops strip")},[o]);if(t==="docs"||N.length===0)return null;const z=QY(p);return l.jsxs("div",{className:"ops-strip",style:{height:"36px",display:"flex",alignItems:"center",gap:"6px",padding:"0 12px",overflowX:"auto",overflowY:"hidden",borderTop:"1px solid hsl(var(--border))",background:"hsl(var(--background))",flexShrink:0},children:[N.map(P=>l.jsx(aG,{type:P.type,label:P.label,retries:P.retries,animationState:c.get(P.key)||"steady",onClick:e?()=>e(P.featureCode):void 0,onApprove:P.type==="gate"&&P.gateId?()=>R(P.gateId):void 0,onDismiss:P.type==="error"?()=>A(P.key):void 0},P.key)),z&&l.jsx("span",{className:"ml-auto text-[9px] text-muted-foreground font-mono shrink-0 opacity-70",title:"Cumulative budget usage: review / coverage",children:z})]})}const pG={ok:"hsl(var(--success))",warn:"hsl(var(--warning))",error:"hsl(var(--destructive))"},Za="hsl(var(--muted-foreground))",fG={"installed-current":"hsl(var(--success))",absent:"hsl(var(--muted-foreground))",foreign:"hsl(var(--destructive))","installed-stale":"hsl(var(--warning))","workspace-unverified":"hsl(var(--warning))",unavailable:"hsl(var(--muted-foreground))"};function ln({color:t}){return l.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:t,display:"inline-block",flexShrink:0}})}function du({title:t,children:e}){return l.jsxs("div",{className:"mt-2 first:mt-0",children:[l.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-1",children:t}),e]})}function mG(t){return t.optional?"hsl(var(--warning))":"hsl(var(--destructive))"}async function gG(t){var e;try{return await((e=navigator.clipboard)==null?void 0:e.writeText(t)),!0}catch{return!1}}function RS({command:t,testid:e,label:r="copy"}){const[n,i]=C.useState(!1);return t?l.jsx("button",{"data-testid":e,className:"text-[10px] text-muted-foreground hover:text-foreground transition-colors shrink-0",title:`Copy: ${t}`,"aria-label":`Copy command: ${t}`,onClick:async s=>{s.stopPropagation(),await gG(t)&&(i(!0),setTimeout(()=>i(!1),1200))},children:n?"✓ copied":r}):null}function xG(){var w;const{loading:t,workspace:e}=q0()||{},[r,n]=C.useState(null),[i,s]=C.useState(!1),[o,a]=C.useState(null),[c,h]=C.useState(!1),[u,d]=C.useState(!1),[f,p]=C.useState(null),m=C.useRef(null),x=C.useRef(0),g=C.useCallback(async(_=!1)=>{const T=++x.current;s(!0);try{const L=await(await vt(`/api/environment-health${_?"?refresh=1":""}`)).json();if(T!==x.current)return;n(L),a(null)}catch(S){if(T!==x.current)return;n(null),a((S==null?void 0:S.message)||"unavailable")}finally{T===x.current&&s(!1)}},[]),y=C.useCallback(async _=>{d(!0),p(null);try{const T=await vt("/api/environment-health/repair-hooks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({force:!!_})}),S=await T.json().catch(()=>null);(!T.ok||(S==null?void 0:S.ok)!==!0)&&p((S==null?void 0:S.error)||`repair failed (${T.status})`)}catch(T){p((T==null?void 0:T.message)||"repair failed")}finally{d(!1),g(!1)}},[g]);C.useEffect(()=>{t||!e||g(!1)},[t,e==null?void 0:e.id,e==null?void 0:e.root,g]),C.useEffect(()=>{if(!c)return;const _=S=>{var L;(L=m.current)!=null&&L.contains(S.target)||h(!1)},T=S=>{S.key==="Escape"&&h(!1)};return window.addEventListener("mousedown",_),window.addEventListener("keydown",T),()=>{window.removeEventListener("mousedown",_),window.removeEventListener("keydown",T)}},[c]);const k=r==null?void 0:r.summary,b=k?pG[k]:Za;return l.jsxs("div",{ref:m,className:"relative flex items-center shrink-0",children:[l.jsx("button",{"data-testid":"env-health-dot",className:"compose-btn-icon",onClick:()=>h(_=>!_),title:`Environment health: ${k||(i?"checking…":"unknown")}`,"aria-label":"Environment health","aria-haspopup":"dialog","aria-expanded":c,children:l.jsx(ln,{color:b})}),c&&l.jsxs("div",{"data-testid":"env-health-panel",role:"dialog","aria-label":"Environment health",className:"absolute top-full right-0 mt-1 z-50 p-2 rounded-md shadow-lg text-xs",style:{background:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",minWidth:280,maxWidth:360},children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Environment Health"}),l.jsx("button",{"data-testid":"env-health-refresh",className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50",onClick:()=>g(!0),disabled:i,title:"Refresh","aria-label":"Refresh environment health",children:"↻"})]}),o&&l.jsxs("div",{className:"mt-1 text-destructive",children:["Unavailable: ",o]}),!r&&!o&&l.jsx("div",{className:"mt-1 text-muted-foreground",children:i?"Checking…":"No data"}),r&&l.jsxs(l.Fragment,{children:[l.jsxs(du,{title:"Dependencies",children:[g0(r.dependencies,"dependency"),g0(r.binaries,"binary")]}),l.jsx(du,{title:"Version",children:l.jsx("div",{"data-testid":"env-health-version",className:"flex items-center gap-1.5",children:r.version?r.version.behind?l.jsxs(l.Fragment,{children:[l.jsx(ln,{color:"hsl(var(--warning))"}),l.jsxs("span",{className:"flex-1",children:[r.version.current," → ",r.version.latest," (behind — run ",l.jsx("code",{children:"compose update"}),")"]}),l.jsx(RS,{command:"compose update",testid:"env-health-copy-version"})]}):l.jsxs(l.Fragment,{children:[l.jsx(ln,{color:"hsl(var(--success))"}),l.jsxs("span",{children:[r.version.current," (up to date)"]})]}):l.jsxs(l.Fragment,{children:[l.jsx(ln,{color:Za}),l.jsx("span",{className:"text-muted-foreground",children:"version check unavailable"})]})})}),l.jsxs(du,{title:"Git Hooks",children:[Object.entries(r.hooks||{}).filter(([_])=>_!=="unavailable").map(([_,T])=>l.jsxs("div",{"data-testid":`env-health-hook-${_}`,className:"flex items-center gap-1.5",children:[l.jsx(ln,{color:fG[T.state]||Za}),l.jsx("span",{className:"font-mono",children:_}),l.jsxs("span",{className:"text-muted-foreground",children:[T.state,T.reason?` (${T.reason})`:""]})]},_)),((w=r.hooks)==null?void 0:w.unavailable)&&l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(ln,{color:Za}),l.jsx("span",{className:"text-muted-foreground",children:"hook status unavailable"})]}),(()=>{const _=Object.entries(r.hooks||{}).filter(([B])=>B!=="unavailable"),T=["installed-stale","absent","foreign"],S=_.some(([,B])=>T.includes(B==null?void 0:B.state)),L=_.some(([,B])=>(B==null?void 0:B.state)==="foreign");return S?l.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[l.jsx("button",{"data-testid":"env-health-repair-hooks",className:"text-[11px] px-2 py-0.5 rounded border border-border hover:bg-accent/30 transition-colors disabled:opacity-50",disabled:u,onClick:()=>{if(L){if(!window.confirm("A foreign git hook exists. Overwrite it with the Compose hook?"))return;y(!0)}else y(!1)},title:"Install / refresh Compose git hooks for this workspace",children:u?"Repairing…":"Repair hooks"}),f&&l.jsx("span",{className:"text-destructive text-[10px]",children:f})]}):null})()]})]})]})]})}function g0(t,e){if(!t||t.unavailable)return l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(ln,{color:"hsl(var(--warning))"}),l.jsxs("span",{className:"text-muted-foreground",children:[e==="binary"?"binaries":"skills"," unavailable"]})]});const r=t.missing||[],n=(t.present||[]).length;return l.jsxs(l.Fragment,{children:[r.map(i=>l.jsxs("div",{"data-testid":`env-health-${e}-${i.id}`,className:"flex items-center gap-1.5",children:[l.jsx(ln,{color:mG(i)}),l.jsx("span",{className:"font-mono truncate",children:i.id}),l.jsxs("span",{className:"text-muted-foreground flex-1",children:["missing",i.optional?" (optional)":""]}),l.jsx(RS,{command:i.install,testid:`env-health-copy-${i.id}`,label:"copy install"})]},i.id)),r.length===0&&l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(ln,{color:"hsl(var(--success))"}),l.jsxs("span",{className:"text-muted-foreground",children:[n," ",e==="binary"?"binaries":"skills"," present"]})]})]})}function yG(t,e={}){const{bugCode:r="",intent:n="",description:i="",resumableCode:s=""}=e;if(t==="new"){const a=(n||"").trim();return a?{args:{mode:"new",description:a}}:{error:"Product intent is required"}}if(t==="resume"){const a=(s||"").trim();return a?{args:{featureCode:a,mode:"bug",resume:!0}}:{error:"No active fix to resume"}}const o=(r||"").trim();return o?{args:{featureCode:o,mode:"bug",description:(i||"").trim()}}:{error:"Bug code is required"}}function bG({activeBuild:t,onClose:e}){const r=t&&t.mode==="bug"&&t.featureCode?t.featureCode:"",[n,i]=C.useState("fix"),[s,o]=C.useState(""),[a,c]=C.useState(""),[h,u]=C.useState(""),[d,f]=C.useState(!1),[p,m]=C.useState(null);async function x(y){y==null||y.preventDefault(),m(null);const k=yG(n,{bugCode:s,intent:a,description:h,resumableCode:r});if(k.error){m(k.error);return}f(!0);try{await nh(k.args),e==null||e()}catch(b){m(b.message||"Failed to launch"),f(!1)}}const g=d||n==="fix"&&!s.trim()||n==="new"&&!a.trim()||n==="resume"&&!r;return l.jsx("div",{className:"absolute top-full right-0 mt-1 w-64 rounded-md border border-border bg-popover shadow-lg z-50","data-testid":"launch-popover",children:l.jsxs("form",{className:"p-2 space-y-2",onSubmit:x,children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Lifecycle"}),l.jsxs("div",{className:"flex items-center gap-1.5",role:"radiogroup","aria-label":"Launch lifecycle",children:[l.jsx("button",{type:"button",role:"radio","aria-checked":n==="fix",className:`text-[10px] px-2 py-1 rounded border cursor-pointer ${n==="fix"?"bg-accent/10 border-accent text-foreground":"bg-muted border-border text-muted-foreground"}`,"data-testid":"launch-mode-fix",onClick:()=>i("fix"),children:"Fix"}),l.jsx("button",{type:"button",role:"radio","aria-checked":n==="new",className:`text-[10px] px-2 py-1 rounded border cursor-pointer ${n==="new"?"bg-accent/10 border-accent text-foreground":"bg-muted border-border text-muted-foreground"}`,"data-testid":"launch-mode-new",onClick:()=>i("new"),children:"New"}),l.jsx("button",{type:"button",role:"radio","aria-checked":n==="resume","aria-disabled":!r,disabled:!r,className:`text-[10px] px-2 py-1 rounded border ${r?n==="resume"?"bg-accent/10 border-accent text-foreground cursor-pointer":"bg-muted border-border text-muted-foreground cursor-pointer":"bg-muted border-border text-muted-foreground opacity-50 cursor-not-allowed"}`,"data-testid":"launch-mode-resume",onClick:()=>{r&&i("resume")},children:"Resume"})]})]}),n==="new"?l.jsxs("div",{className:"space-y-1",children:[l.jsx("label",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",htmlFor:"launch-intent",children:"Product intent"}),l.jsx("textarea",{id:"launch-intent",className:"w-full text-xs bg-muted text-foreground px-2 py-1.5 rounded border border-border outline-none resize-none",rows:3,value:a,onChange:y=>c(y.target.value),"data-testid":"launch-intent-input",autoFocus:!0})]}):n==="resume"?l.jsx("div",{className:"text-[10px] text-muted-foreground","data-testid":"launch-resume-target",children:r?l.jsxs(l.Fragment,{children:["Resume active fix: ",l.jsx("span",{className:"text-foreground",children:r})]}):"No active fix to resume."}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("label",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",htmlFor:"launch-bugcode",children:"Bug code"}),l.jsx("input",{id:"launch-bugcode",type:"text",className:"w-full text-xs bg-muted text-foreground px-2 py-1.5 rounded border border-border outline-none",value:s,onChange:y=>o(y.target.value),"data-testid":"launch-bugcode-input",autoFocus:!0})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("label",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",htmlFor:"launch-desc",children:"Description (optional)"}),l.jsx("textarea",{id:"launch-desc",className:"w-full text-xs bg-muted text-foreground px-2 py-1.5 rounded border border-border outline-none resize-none",rows:3,value:h,onChange:y=>u(y.target.value),"data-testid":"launch-description"})]})]}),p?l.jsx("div",{className:"text-[10px] text-destructive",role:"alert",children:p}):null,l.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[l.jsx("button",{type:"button",className:"text-[10px] px-2 py-1 rounded border border-border text-muted-foreground hover:bg-muted/50",onClick:()=>e==null?void 0:e(),disabled:d,"data-testid":"launch-cancel",children:"Cancel"}),l.jsx("button",{type:"submit",className:"text-[10px] px-2 py-1 rounded border border-accent bg-accent/10 text-foreground disabled:opacity-50",disabled:g,"data-testid":"launch-submit",children:d?"Launching…":"Launch"})]})]})})}const CG={title:"Build all PLANNED features?",body:"This builds every still-buildable (PLANNED/PARTIAL) feature on the roadmap in dependency order. It is roadmap-wide and expensive."};function kG(){return{mode:"all"}}function zS(t){return(t??"").trim()}function vG(t){return zS(t).length>0}function wG(t){const e=zS(t);return e?{featureCode:e,mode:"gsd"}:null}function SG(){const t=Wd(),[e,r]=C.useState(!1),[n,i]=C.useState(""),[s,o]=C.useState(!1),[a,c]=C.useState(null),h=C.useRef(null);C.useEffect(()=>{if(!e)return;const m=g=>{var y;(y=h.current)!=null&&y.contains(g.target)||r(!1)},x=g=>{g.key==="Escape"&&r(!1)};return window.addEventListener("mousedown",m),window.addEventListener("keydown",x),()=>{window.removeEventListener("mousedown",m),window.removeEventListener("keydown",x)}},[e]);function u(){c(null),o(!1)}async function d(m){o(!0),c(null);try{await nh(m),r(!1),i(""),o(!1)}catch(x){c(x.message||"Failed to start build"),o(!1)}}async function f(){await t(CG)&&await d(kG())}async function p(m){m==null||m.preventDefault();const x=wG(n);if(!x){c("Feature code is required");return}await d(x)}return l.jsxs("div",{ref:h,className:"relative flex items-center shrink-0",children:[l.jsx("button",{type:"button","data-testid":"build-all-gsd-trigger",className:"compose-btn-icon",onClick:()=>{r(m=>!m),u()},title:"Batch builds: build all PLANNED features or run GSD on one feature","aria-label":"Batch builds","aria-haspopup":"dialog","aria-expanded":e,children:l.jsx("span",{"aria-hidden":"true",className:"text-[13px] leading-none",children:"≣"})}),e&&l.jsx("div",{"data-testid":"build-all-gsd-popover",role:"dialog","aria-label":"Batch builds",className:"absolute top-full right-0 mt-1 w-64 rounded-md border border-border bg-popover shadow-lg z-50",children:l.jsxs("div",{className:"p-2 space-y-3",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Build all"}),l.jsx("button",{type:"button","data-testid":"build-all-submit",className:"w-full text-[10px] px-2 py-1.5 rounded border border-accent bg-accent/10 text-foreground disabled:opacity-50",disabled:s,onClick:f,children:s?"Starting…":"Build all PLANNED features"})]}),l.jsxs("form",{className:"space-y-1",onSubmit:p,children:[l.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",htmlFor:"build-gsd-feature",children:"GSD"}),l.jsx("input",{id:"build-gsd-feature",type:"text",className:"w-full text-xs bg-muted text-foreground px-2 py-1.5 rounded border border-border outline-none",placeholder:"FEATURE-CODE",value:n,onChange:m=>i(m.target.value),"data-testid":"build-gsd-feature-input"}),l.jsx("button",{type:"submit","data-testid":"build-gsd-submit",className:"w-full text-[10px] px-2 py-1.5 rounded border border-accent bg-accent/10 text-foreground disabled:opacity-50",disabled:s||!vG(n),children:s?"Starting…":"Run GSD"})]}),a?l.jsx("div",{className:"text-[10px] text-destructive",role:"alert","data-testid":"build-all-gsd-error",children:a}):null]})})]})}const pu=["dashboard","graph","tree","docs","journal","design","gates","validate","qa-scope","pipeline","sessions","build-history","ideabox"];function TG(t,e){return!e||!Array.isArray(t)?!1:t.includes(e)}function _G(t){return(t==null?void 0:t[0])??null}const jG="compose:mainTabs",qS="compose:activeTab";function NG(){var t;try{const e=(t=globalThis.localStorage)==null?void 0:t.getItem(jG);if(!e)return[...pu];const r=JSON.parse(e);if(Array.isArray(r)&&r.length>=1){let n=r;for(const i of pu)if(!n.includes(i)){const s=n.indexOf("docs");s>=0?n=[...n.slice(0,s+1),i,...n.slice(s+1)]:n=[...n,i]}return n}}catch{}return[...pu]}function EG(t){var e;try{const r=(e=globalThis.localStorage)==null?void 0:e.getItem(qS);if(r&&TG(t,r))return r}catch{}return _G(t)}function x0(t){var e;try{(e=globalThis.localStorage)==null||e.setItem(qS,t)}catch{}}function WS(t,e){var r;try{const n=(r=globalThis.localStorage)==null?void 0:r.getItem(t);return n==null?e:n!=="false"}catch{return e}}function HS(t,e){var r;try{(r=globalThis.localStorage)==null||r.setItem(t,String(!!e))}catch{}}const US="compose:sidebarOpen",VS="compose:contextPanelOpen";function LG(){return WS(US,!0)}function BG(t){return HS(US,t)}function AG(){return WS(VS,!1)}function y0(t){return HS(VS,t)}const b0={complete:"bg-emerald-500/15 text-emerald-400 border border-emerald-500/30",failed:"bg-red-500/15 text-red-400 border border-red-500/30",aborted:"bg-amber-500/15 text-amber-400 border border-amber-500/30",killed:"bg-slate-500/15 text-slate-400 border border-slate-500/30"};function MG(t){if(typeof t!="number"||t<0)return"—";const e=Math.round(t/1e3);if(e<60)return`${e}s`;const r=Math.floor(e/60),n=e%60;return r<60?`${r}m ${n}s`:`${Math.floor(r/60)}h ${r%60}m`}function IG(t){return typeof t!="number"||t<=0?null:`$${t.toFixed(t<1?4:2)}`}function FG({builds:t=[],items:e=[],onSelectItem:r}){const[n,i]=C.useState(""),[s,o]=C.useState("all"),a=C.useMemo(()=>{let c=t;if(s!=="all"&&(c=c.filter(h=>h.status===s)),n.trim()){const h=n.toLowerCase();c=c.filter(u=>(u.featureCode||"").toLowerCase().includes(h))}return c},[t,n,s]);return l.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2 border-b border-border shrink-0",children:[l.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[l.jsx(xu,{className:"h-3 w-3"}),l.jsx("span",{children:"Past builds"})]}),l.jsx("div",{className:"h-4 w-px bg-border"}),l.jsxs("div",{className:"relative",children:[l.jsx(fn,{className:"absolute left-1.5 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),l.jsx("input",{type:"text",placeholder:"Search feature…",value:n,onChange:c=>i(c.target.value),className:"text-xs pl-5 pr-2 py-0.5 h-6 rounded bg-muted text-foreground border border-border w-36"})]}),l.jsxs("select",{value:s,onChange:c=>o(c.target.value),className:"text-xs px-1.5 py-0.5 h-6 rounded bg-muted text-foreground border border-border cursor-pointer",children:[l.jsx("option",{value:"all",children:"All status"}),["complete","failed","aborted","killed"].map(c=>l.jsx("option",{value:c,children:c},c))]}),l.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[a.length,"/",t.length]})]}),l.jsxs("div",{className:"flex-1 overflow-auto",children:[a.length===0&&l.jsx(aa,{icon:xu,title:"No past builds yet",description:"Builds are recorded here after each run completes",className:"py-8"}),a.map((c,h)=>l.jsx(PG,{build:c,items:e,onSelectItem:r},`${c.featureCode}-${c.completedAt}-${h}`))]})]})}function PG({build:t,items:e,onSelectItem:r}){const n=t.featureCode?e.find(u=>{var d;return u.featureCode===t.featureCode||u.feature_code===t.featureCode||((d=u.lifecycle)==null?void 0:d.featureCode)===t.featureCode}):null,i=b0[t.status]||b0.killed,s=IG(t.cost_usd),o=t.status==="failed"||t.status==="aborted",[a,c]=C.useState(!1);async function h(){const u=t.featureCode;c(!0);try{await nh({featureCode:u,mode:t.mode}),se(`Build restarted for ${u}`,"info")}catch(d){d.status===409?se(`A build for ${u} is already active`,"warn"):se(d.message||"Failed to restart build","error")}finally{c(!1)}}return l.jsxs("div",{className:"flex flex-col gap-1 px-3 py-2.5 border-b border-border/50 hover:bg-muted/30 transition-colors",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:nt("text-[10px] px-1.5 py-0.5 rounded capitalize",i),children:t.status}),t.featureCode&&l.jsx("button",{onClick:()=>n&&(r==null?void 0:r(n.id)),className:nt("text-[11px] font-mono",n?"text-blue-400 hover:underline cursor-pointer":"text-muted-foreground cursor-default"),children:t.featureCode}),t.mode==="bug"&&l.jsx("span",{className:"text-[10px] px-1 py-0.5 rounded bg-rose-500/15 text-rose-400",children:"bug"}),l.jsx(Nf,{date:t.completedAt,className:"ml-auto text-[10px] shrink-0"})]}),l.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground",children:[l.jsxs("span",{children:["⏱ ",MG(t.durationMs)]}),s&&l.jsxs("span",{children:["💵 ",s]}),typeof t.stepCount=="number"&&l.jsxs("span",{children:["◆ ",t.stepCount," steps"]})]}),(t.failureReason||o)&&l.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.failureReason&&l.jsx("p",{className:"text-[11px] text-red-400/90 truncate flex-1 min-w-0",children:t.failureReason}),o&&l.jsxs("button",{onClick:h,disabled:a,className:"flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded border border-border text-muted-foreground hover:text-foreground hover:bg-muted/50 disabled:opacity-50 shrink-0 ml-auto cursor-pointer",title:`Restart build for ${t.featureCode}`,"data-testid":"past-build-retry",children:[l.jsx(H_,{className:"h-2.5 w-2.5"}),a?"Retrying…":"Retry"]})]})]})}const Md=C.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:nt("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Md.displayName="Card";const Id=C.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:nt("flex flex-col space-y-1.5 p-6",t),...e}));Id.displayName="CardHeader";const Fd=C.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:nt("font-semibold leading-none tracking-tight",t),...e}));Fd.displayName="CardTitle";const $G=C.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:nt("text-sm text-muted-foreground",t),...e}));$G.displayName="CardDescription";const Pd=C.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:nt("p-6 pt-0",t),...e}));Pd.displayName="CardContent";const DG=C.forwardRef(({className:t,...e},r)=>l.jsx("div",{ref:r,className:nt("flex items-center p-6 pt-0",t),...e}));DG.displayName="CardFooter";function OG(t){const e=Math.floor(t/1e3);if(e<60)return`${e}s`;const r=Math.floor(e/60);return r<60?`${r}m ${e%60}s`:`${Math.floor(r/60)}h ${r%60}m`}function C0({agent:t,toolCount:e,errorCount:r,currentTool:n,currentCategory:i,onStop:s}){const o=t.status==="running",a=t.status==="killed",c=t.status==="failed"||t.status==="error"||a,h=!o&&!c,u=t.silent,[d,f]=C.useState(()=>{const m=t.startedAt?new Date(t.startedAt).getTime():Date.now();return(t.completedAt?new Date(t.completedAt).getTime():Date.now())-m});C.useEffect(()=>{if(!o)return;const m=t.startedAt?new Date(t.startedAt).getTime():Date.now(),x=()=>f(Date.now()-m);x();const g=setInterval(x,1e3);return()=>clearInterval(g)},[o,t.startedAt]);const p=t.agentType||t.type||t.agent||"agent";return l.jsxs("div",{className:"px-3 py-2 rounded border border-border bg-muted/20",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("span",{className:"text-[11px] text-foreground font-medium truncate",children:p}),l.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",children:[l.jsx("span",{className:nt("w-1.5 h-1.5 rounded-full inline-block",o&&!u&&"bg-green-400",o&&u&&"bg-yellow-400",h&&"bg-emerald-400",c&&"bg-red-400"),style:o&&!u?{animation:"phase-active-pulse 2s ease-in-out infinite"}:void 0}),l.jsx("span",{className:nt("text-[10px]",o&&!u&&"text-green-400",o&&u&&"text-yellow-400",h&&"text-emerald-400",c&&"text-red-400"),children:u?"silent":t.status}),l.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:OG(d)}),o&&s&&l.jsx("button",{onClick:m=>{m.stopPropagation(),s(t.agentId||t.id)},className:"text-[10px] text-muted-foreground hover:text-destructive cursor-pointer ml-0.5",title:"Stop agent",children:"x"})]})]}),l.jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:e!=null&&l.jsxs(l.Fragment,{children:[l.jsxs("span",{children:[e," tools"]}),l.jsx("span",{className:"mx-1",children:"·"}),l.jsxs("span",{className:nt(r>0&&"text-red-400"),children:[r??0," err"]}),o&&n&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"mx-1",children:"·"}),l.jsxs("span",{children:[i||"working"," (",n,")"]})]})]})})]})}function Ii(t,e,r){let n=r.initialDeps??[],i,s=!0;function o(){var a,c,h;let u;r.key&&((a=r.debug)!=null&&a.call(r))&&(u=Date.now());const d=t();if(!(d.length!==n.length||d.some((m,x)=>n[x]!==m)))return i;n=d;let p;if(r.key&&((c=r.debug)!=null&&c.call(r))&&(p=Date.now()),i=e(...d),r.key&&((h=r.debug)!=null&&h.call(r))){const m=Math.round((Date.now()-u)*100)/100,x=Math.round((Date.now()-p)*100)/100,g=x/16,y=(k,b)=>{for(k=String(k);k.length<b;)k=" "+k;return k};console.info(`%c⏱ ${y(x,5)} /${y(m,5)} ms`,`
697
- font-size: .6rem;
698
- font-weight: bold;
699
- color: hsl(${Math.max(0,Math.min(120-120*g,120))}deg 100% 31%);`,r==null?void 0:r.key)}return r!=null&&r.onChange&&!(s&&r.skipInitialOnChange)&&r.onChange(i),s=!1,i}return o.updateDeps=a=>{n=a},o}function k0(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const RG=(t,e)=>Math.abs(t-e)<1.01,zG=(t,e,r)=>{let n;return function(...i){t.clearTimeout(n),n=t.setTimeout(()=>e.apply(this,i),r)}},v0=t=>{const{offsetWidth:e,offsetHeight:r}=t;return{width:e,height:r}},qG=t=>t,WG=t=>{const e=Math.max(t.startIndex-t.overscan,0),r=Math.min(t.endIndex+t.overscan,t.count-1),n=[];for(let i=e;i<=r;i++)n.push(i);return n},HG=(t,e)=>{const r=t.scrollElement;if(!r)return;const n=t.targetWindow;if(!n)return;const i=o=>{const{width:a,height:c}=o;e({width:Math.round(a),height:Math.round(c)})};if(i(v0(r)),!n.ResizeObserver)return()=>{};const s=new n.ResizeObserver(o=>{const a=()=>{const c=o[0];if(c!=null&&c.borderBoxSize){const h=c.borderBoxSize[0];if(h){i({width:h.inlineSize,height:h.blockSize});return}}i(v0(r))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return s.observe(r,{box:"border-box"}),()=>{s.unobserve(r)}},w0={passive:!0},S0=typeof window>"u"?!0:"onscrollend"in window,UG=(t,e)=>{const r=t.scrollElement;if(!r)return;const n=t.targetWindow;if(!n)return;let i=0;const s=t.options.useScrollendEvent&&S0?()=>{}:zG(n,()=>{e(i,!1)},t.options.isScrollingResetDelay),o=u=>()=>{const{horizontal:d,isRtl:f}=t.options;i=d?r.scrollLeft*(f&&-1||1):r.scrollTop,s(),e(i,u)},a=o(!0),c=o(!1);r.addEventListener("scroll",a,w0);const h=t.options.useScrollendEvent&&S0;return h&&r.addEventListener("scrollend",c,w0),()=>{r.removeEventListener("scroll",a),h&&r.removeEventListener("scrollend",c)}},VG=(t,e,r)=>{if(e!=null&&e.borderBoxSize){const n=e.borderBoxSize[0];if(n)return Math.round(n[r.options.horizontal?"inlineSize":"blockSize"])}return t[r.options.horizontal?"offsetWidth":"offsetHeight"]},YG=(t,{adjustments:e=0,behavior:r},n)=>{var i,s;const o=t+e;(s=(i=n.scrollElement)==null?void 0:i.scrollTo)==null||s.call(i,{[n.options.horizontal?"left":"top"]:o,behavior:r})};class GG{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var r,n,i;return((i=(n=(r=this.targetWindow)==null?void 0:r.performance)==null?void 0:n.now)==null?void 0:i.call(n))??Date.now()},this.observer=(()=>{let r=null;const n=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(i=>{i.forEach(s=>{const o=()=>{const a=s.target,c=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(a,s,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var i;(i=n())==null||i.disconnect(),r=null},observe:i=>{var s;return(s=n())==null?void 0:s.observe(i,{box:"border-box"})},unobserve:i=>{var s;return(s=n())==null?void 0:s.unobserve(i)}}})(),this.range=null,this.setOptions=r=>{Object.entries(r).forEach(([n,i])=>{typeof i>"u"&&delete r[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:qG,rangeExtractor:WG,onChange:()=>{},measureElement:VG,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...r}},this.notify=r=>{var n,i;(i=(n=this.options).onChange)==null||i.call(n,this,r)},this.maybeNotify=Ii(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),r=>{this.notify(r)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(r=>r()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var r;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((r=this.scrollElement)==null?void 0:r.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,s)=>{this.scrollAdjustments=0,this.scrollDirection=s?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=s,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(r,n)=>{const i=new Map,s=new Map;for(let o=n-1;o>=0;o--){const a=r[o];if(i.has(a.lane))continue;const c=s.get(a.lane);if(c==null||a.end>c.end?s.set(a.lane,a):a.end<c.end&&i.set(a.lane,!0),i.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((o,a)=>o.end===a.end?o.index-a.index:o.end-a.end)[0]:void 0},this.getMeasurementOptions=Ii(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(r,n,i,s,o,a,c)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:r,paddingStart:n,scrollMargin:i,getItemKey:s,enabled:o,lanes:a,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=Ii(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:r,paddingStart:n,scrollMargin:i,getItemKey:s,enabled:o,lanes:a,laneAssignmentMode:c},h)=>{if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>r)for(const p of this.laneAssignments.keys())p>=r&&this.laneAssignments.delete(p);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(p=>{this.itemSizeCache.set(p.key,p.size)}));const u=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===r&&(this.lanesSettling=!1);const d=this.measurementsCache.slice(0,u),f=new Array(a).fill(void 0);for(let p=0;p<u;p++){const m=d[p];m&&(f[m.lane]=p)}for(let p=u;p<r;p++){const m=s(p),x=this.laneAssignments.get(p);let g,y;const k=c==="estimate"||h.has(m);if(x!==void 0&&this.options.lanes>1){g=x;const T=f[g],S=T!==void 0?d[T]:void 0;y=S?S.end+this.options.gap:n+i}else{const T=this.options.lanes===1?d[p-1]:this.getFurthestMeasurement(d,p);y=T?T.end+this.options.gap:n+i,g=T?T.lane:p%this.options.lanes,this.options.lanes>1&&k&&this.laneAssignments.set(p,g)}const b=h.get(m),w=typeof b=="number"?b:this.options.estimateSize(p),_=y+w;d[p]={index:p,start:y,size:w,end:_,key:m,lane:g},f[g]=p}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Ii(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,n,i,s)=>this.range=r.length>0&&n>0?XG({measurements:r,outerSize:n,scrollOffset:i,lanes:s}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Ii(()=>{let r=null,n=null;const i=this.calculateRange();return i&&(r=i.startIndex,n=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,n]},(r,n,i,s,o)=>s===null||o===null?[]:r({startIndex:s,endIndex:o,overscan:n,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=r=>{const n=this.options.indexAttribute,i=r.getAttribute(n);return i?parseInt(i,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=r=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const i=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(i!==void 0&&this.range){const s=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,i-s),a=Math.min(this.options.count-1,i+s);return r>=o&&r<=a}return!0},this.measureElement=r=>{if(!r){this.elementsCache.forEach((o,a)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(a))});return}const n=this.indexFromElement(r),i=this.options.getItemKey(n),s=this.elementsCache.get(i);s!==r&&(s&&this.observer.unobserve(s),this.observer.observe(r),this.elementsCache.set(i,r)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(r,void 0,this))},this.resizeItem=(r,n)=>{var i;const s=this.measurementsCache[r];if(!s)return;const o=this.itemSizeCache.get(s.key)??s.size,a=n-o;a!==0&&(((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,a,this):s.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(s.index),this.itemSizeCache=new Map(this.itemSizeCache.set(s.key,n)),this.notify(!1))},this.getVirtualItems=Ii(()=>[this.getVirtualIndexes(),this.getMeasurements()],(r,n)=>{const i=[];for(let s=0,o=r.length;s<o;s++){const a=r[s],c=n[a];i.push(c)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=r=>{const n=this.getMeasurements();if(n.length!==0)return k0(n[YS(0,n.length-1,i=>k0(n[i]).start,r)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const r=this.scrollElement.document.documentElement;return this.options.horizontal?r.scrollWidth-this.scrollElement.innerWidth:r.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(r,n,i=0)=>{if(!this.scrollElement)return 0;const s=this.getSize(),o=this.getScrollOffset();n==="auto"&&(n=r>=o+s?"end":"start"),n==="center"?r+=(i-s)/2:n==="end"&&(r-=s);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,r),0)},this.getOffsetForIndex=(r,n="auto")=>{r=Math.max(0,Math.min(r,this.options.count-1));const i=this.getSize(),s=this.getScrollOffset(),o=this.measurementsCache[r];if(!o)return;if(n==="auto")if(o.end>=s+i-this.options.scrollPaddingEnd)n="end";else if(o.start<=s+this.options.scrollPaddingStart)n="start";else return[s,n];if(n==="end"&&r===this.options.count-1)return[this.getMaxScrollOffset(),n];const a=n==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,n,o.size),n]},this.scrollToOffset=(r,{align:n="start",behavior:i="auto"}={})=>{const s=this.getOffsetForAlignment(r,n),o=this.now();this.scrollState={index:null,align:n,behavior:i,startedAt:o,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToIndex=(r,{align:n="auto",behavior:i="auto"}={})=>{r=Math.max(0,Math.min(r,this.options.count-1));const s=this.getOffsetForIndex(r,n);if(!s)return;const[o,a]=s,c=this.now();this.scrollState={index:r,align:a,behavior:i,startedAt:c,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollBy=(r,{behavior:n="auto"}={})=>{const i=this.getScrollOffset()+r,s=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:s,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var r;const n=this.getMeasurements();let i;if(n.length===0)i=this.options.paddingStart;else if(this.options.lanes===1)i=((r=n[n.length-1])==null?void 0:r.end)??0;else{const s=Array(this.options.lanes).fill(null);let o=n.length-1;for(;o>=0&&s.some(a=>a===null);){const a=n[o];s[a.lane]===null&&(s[a.lane]=a.end),o--}i=Math.max(...s.filter(a=>a!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(r,{adjustments:n,behavior:i})=>{this.options.scrollToFn(r,{behavior:i,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const n=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,i=n?n[0]:this.scrollState.lastTargetOffset,s=1,o=i!==this.scrollState.lastTargetOffset;if(!o&&RG(i,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=s){this.scrollState=null;return}}else this.scrollState.stableFrames=0,o&&(this.scrollState.lastTargetOffset=i,this.scrollState.behavior="auto",this._scrollToOffset(i,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const YS=(t,e,r,n)=>{for(;t<=e;){const i=(t+e)/2|0,s=r(i);if(s<n)t=i+1;else if(s>n)e=i-1;else return i}return t>0?t-1:0};function XG({measurements:t,outerSize:e,scrollOffset:r,lanes:n}){const i=t.length-1,s=c=>t[c].start;if(t.length<=n)return{startIndex:0,endIndex:i};let o=YS(0,i,s,r),a=o;if(n===1)for(;a<i&&t[a].end<r+e;)a++;else if(n>1){const c=Array(n).fill(0);for(;a<i&&c.some(u=>u<r+e);){const u=t[a];c[u.lane]=u.end,a++}const h=Array(n).fill(r+e);for(;o>=0&&h.some(u=>u>=r);){const u=t[o];h[u.lane]=u.start,o--}o=Math.max(0,o-o%n),a=Math.min(i,a+(n-1-a%n))}return{startIndex:o,endIndex:a}}const T0=typeof document<"u"?C.useLayoutEffect:C.useEffect;function KG({useFlushSync:t=!0,...e}){const r=C.useReducer(()=>({}),{})[1],n={...e,onChange:(s,o)=>{var a;t&&o?BT.flushSync(r):r(),(a=e.onChange)==null||a.call(e,s,o)}},[i]=C.useState(()=>new GG(n));return i.setOptions(n),T0(()=>i._didMount(),[]),T0(()=>i._willUpdate()),i}function QG(t){return KG({observeElementRect:HG,observeElementOffset:UG,scrollToFn:YG,...t})}function ZG(t,e,r){var a,c;const n=[],i=(r==null?void 0:r.id)??null;if(Array.isArray(t))for(const h of t){if(n.push({id:`session-start-${h.id}`,timestamp:h.startedAt,category:"session",title:"Session started",detail:h.source?`Source: ${h.source}`:null,severity:"info",sessionId:h.id,meta:{toolCount:h.toolCount,source:h.source}}),h.endedAt&&n.push({id:`session-end-${h.id}`,timestamp:h.endedAt,category:"session",title:`Session ended (${h.toolCount??0} tools${(a=h.errors)!=null&&a.length?`, ${h.errors.length} error${h.errors.length>1?"s":""}`:""})`,detail:null,severity:"info",sessionId:h.id,meta:{toolCount:h.toolCount,errorCount:((c=h.errors)==null?void 0:c.length)??0}}),Array.isArray(h.errors))for(let u=0;u<h.errors.length;u++){const d=h.errors[u];n.push({id:`error-${h.id}-${u}`,timestamp:d.timestamp||h.startedAt,category:"error",title:d.message||`${d.type} error`,detail:d.tool?`Tool: ${d.tool}`:null,severity:d.severity==="error"?"error":"warning",sessionId:h.id,meta:{type:d.type,tool:d.tool}})}if(h.phaseAtBind&&h.phaseAtEnd&&h.phaseAtBind!==h.phaseAtEnd){const u=new Date(h.startedAt).getTime(),d=h.endedAt?new Date(h.endedAt).getTime():u,f=new Date(u+(d-u)*.8).toISOString();n.push({id:`phase-${h.id}`,timestamp:f,category:"phase",title:`Phase: ${h.phaseAtBind} → ${h.phaseAtEnd}`,detail:null,severity:"success",sessionId:h.id,meta:{from:h.phaseAtBind,to:h.phaseAtEnd}})}}if(Array.isArray(e)){const h=i?e.filter(u=>u.itemId===i):e;for(const u of h){if(u.createdAt){const d=un[u.stepId]??(u.fromPhase&&u.toPhase?`${Ce[u.fromPhase]??u.fromPhase} → ${Ce[u.toPhase]??u.toPhase}`:"Gate created");n.push({id:`gate-created-${u.id}`,timestamp:u.createdAt,category:"gate",title:d,detail:null,severity:"info",sessionId:null,meta:{gateId:u.id,fromPhase:u.fromPhase,toPhase:u.toPhase}})}if(u.resolvedAt&&u.outcome){const f={approve:"approve",approved:"approve",revise:"revise",revised:"revise",kill:"kill",killed:"kill"}[u.outcome]||u.outcome,p={approve:"success",revise:"warning",kill:"error"},m={approve:"approved",revise:"revised",kill:"killed"};n.push({id:`gate-resolved-${u.id}`,timestamp:u.resolvedAt,category:"gate",title:`Gate ${m[f]||u.outcome}`,detail:u.comment||null,severity:p[f]||"info",sessionId:null,meta:{gateId:u.id,outcome:u.outcome,comment:u.comment}})}}}const s=new Set,o=[];for(const h of n)s.has(h.id)||(s.add(h.id),o.push(h));return o.sort((h,u)=>h.timestamp.localeCompare(u.timestamp)),o}const JG={phase:"→",gate:"◈",session:"●",iteration:"↻",error:"⚠"};function tX(t){if(!t)return"";const e=Date.now()-new Date(t).getTime(),r=Math.floor(e/6e4);if(r<1)return"now";if(r<60)return`${r}m`;const n=Math.floor(r/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}function eX({event:t,onSelectItem:e,style:r}){const n=JG[t.category]||"●",i=kj[t.category]||"text-zinc-400",s=Cj[t.severity]||"text-zinc-400";return l.jsxs("div",{className:"flex items-start gap-2 px-2 py-1.5 rounded",style:r,children:[l.jsx("span",{className:nt("text-[11px] shrink-0 w-4 text-center leading-4",i),children:n}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:nt("text-[11px] truncate",s),children:t.title}),t.detail&&l.jsx("p",{className:"text-[10px] text-muted-foreground/60 truncate",children:t.detail})]}),l.jsx("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums shrink-0 leading-4",children:tX(t.timestamp)})]})}const rX=["all","phase","gate","session","iteration","error"],_0={all:"All",phase:"Phase",gate:"Gate",session:"Session",iteration:"Iteration",error:"Error"};function nX({featureCode:t,itemId:e,onSelectItem:r}){const[n,i]=C.useState("all"),[s,o]=C.useState([]),a=C.useRef(null),c=lr(m=>m.gates),h=lr(m=>m.featureTimeline),u=lr(m=>m.setFeatureTimeline);C.useEffect(()=>{if(!t)return;let m=!1;return vt(`/api/session/history?featureCode=${encodeURIComponent(t)}&limit=50`).then(x=>x.json()).then(x=>{if(m)return;const g=e?(c||[]).filter(k=>k.itemId===e):c||[],y=ZG(x.sessions||[],g,{id:e});o(y)}).catch(()=>{m||o([])}),()=>{m=!0}},[t,e]);const d=C.useMemo(()=>{var g,y;const m=new Map;for(const k of s)m.set(k.id,k);for(const k of h){const b=(g=k.meta)==null?void 0:g.itemId,w=(y=k.meta)==null?void 0:y.featureCode;(!b&&!w||b===e||w===t)&&m.set(k.id,k)}const x=[...m.values()];return x.sort((k,b)=>k.timestamp.localeCompare(b.timestamp)),x},[s,h,e,t]),f=C.useMemo(()=>n==="all"?d:d.filter(m=>m.category===n),[d,n]),p=QG({count:f.length,getScrollElement:()=>a.current,estimateSize:()=>48,overscan:5});return C.useEffect(()=>{u&&u([])},[t]),t?l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsx("div",{className:"flex flex-wrap gap-1 px-2 py-2 border-b border-border",children:rX.map(m=>l.jsxs("button",{className:nt("px-2 py-0.5 rounded text-[10px] font-medium transition-colors",n===m?"bg-foreground/10 text-foreground":"text-muted-foreground/60 hover:text-muted-foreground hover:bg-muted/30"),onClick:()=>i(m),children:[_0[m],m!=="all"&&l.jsx("span",{className:"ml-1 text-[9px] opacity-60",children:d.filter(x=>x.category===m).length})]},m))}),l.jsx("div",{className:"px-2 py-1",children:l.jsxs("span",{className:"text-[10px] text-muted-foreground/50",children:[f.length," event",f.length!==1?"s":""]})}),l.jsx("div",{ref:a,className:"flex-1 overflow-auto",children:f.length===0?l.jsxs("p",{className:"text-[11px] text-muted-foreground/50 px-2 py-4 text-center",children:["No events",n!=="all"?` in "${_0[n]}"`:"","."]}):l.jsx("div",{style:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"},children:p.getVirtualItems().map(m=>l.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:`${m.size}px`,transform:`translateY(${m.start}px)`},children:l.jsx(eX,{event:f[m.index],onSelectItem:r})},m.key))})})]}):l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx("p",{className:"text-[11px] text-muted-foreground/50",children:"Select a feature to see its timeline."})})}const Io=["explore_design","prd","architecture","blueprint","plan","execute","report"];function iX(t){if(!t)return"";const e=Date.now()-new Date(t).getTime(),r=Math.floor(e/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function sX({currentPhase:t}){const e=Io.indexOf(t);return l.jsx("div",{className:"space-y-1.5",children:Io.map((r,n)=>{const i=e>n,s=e===n,o=Ce[r]??r;return l.jsxs("div",{className:"flex items-center gap-2",style:{animation:`phase-slide-in 300ms ease-out ${n*50}ms both`},children:[i?l.jsx(Vd,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0",style:{animation:"phase-check-pop 400ms ease-out"}}):s?l.jsx(U0,{className:"w-3.5 h-3.5 text-blue-400 shrink-0",style:{animation:"phase-active-pulse 2s ease-in-out infinite"}}):l.jsx(n_,{className:"w-3.5 h-3.5 text-muted-foreground/40 shrink-0"}),l.jsx("span",{className:nt("text-[11px] transition-colors duration-500",i&&"text-emerald-400",s&&"text-blue-400 font-medium",!i&&!s&&"text-muted-foreground/50"),children:o})]},r)})})}function oX({spawnedAgents:t,activeBuild:e,sessionState:r,agentActivity:n}){const i=(t||[]).filter(a=>a.status==="running"),s=(t||[]).filter(a=>a.status!=="running").slice(-3).reverse(),o=C.useMemo(()=>{const a=["design.md","blueprint.md","plan.md","prd.md","architecture.md"],c=new Set(((e==null?void 0:e.steps)||[]).filter(h=>h.status==="done"||h.status==="completed").map(h=>h.id||h.name));return a.map(h=>({name:h,done:c.has(h)||((e==null?void 0:e.steps)||[]).some(u=>{var d,f;return(u.status==="done"||u.status==="completed")&&(((d=u.id)==null?void 0:d.includes(h.replace(".md","")))||((f=u.name)==null?void 0:f.includes(h.replace(".md",""))))})}))},[e]);return l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Agents"}),i.length===0&&s.length===0&&l.jsx("p",{className:"text-[11px] text-muted-foreground/50 mt-1",children:"No agents active"}),l.jsxs("div",{className:"mt-1 space-y-1.5",children:[i.map((a,c)=>l.jsx(C0,{agent:a,toolCount:(r==null?void 0:r.toolCount)||0,errorCount:(r==null?void 0:r.errorCount)||0,currentTool:n==null?void 0:n.tool,currentCategory:n==null?void 0:n.category},a.agentId||c)),s.map((a,c)=>l.jsx(C0,{agent:a},a.agentId||`r-${c}`))]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Artifacts"}),l.jsx("div",{className:"mt-1 space-y-1",children:o.map(a=>l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(mi,{className:nt("w-3 h-3",a.done?"text-emerald-400":"text-muted-foreground/40")}),l.jsx("span",{className:nt("text-[11px] font-mono",a.done?"text-foreground":"text-muted-foreground/50"),children:a.name})]},a.name))})]})]})}function aX({gates:t,allGates:e,items:r,onResolveGate:n}){const i=AT(),s=C.useMemo(()=>{const o=new Map,a=(e||[]).filter(c=>c.resolvedAt&&(c.outcome==="revised"||c.outcome==="revise")).sort((c,h)=>new Date(h.resolvedAt)-new Date(c.resolvedAt));for(const c of t||[]){const h=a.find(u=>u.stepId===c.stepId&&u.itemId===c.itemId);h!=null&&h.artifactSnapshot&&c.artifactSnapshot&&o.set(c.id,{priorSnapshot:h.artifactSnapshot,currentSnapshot:c.artifactSnapshot})}return o},[t,e]);return!t||t.length===0?l.jsx("p",{className:"text-[11px] text-muted-foreground/50 px-1",children:"No gates pending."}):l.jsx("div",{className:"space-y-2",children:t.map(o=>{var h;const a=r.find(u=>u.id===o.itemId),c=(h=o.artifactAssessment)==null?void 0:h.completeness;return l.jsx("div",{className:"px-3 py-2 rounded border border-border bg-muted/30",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"text-[11px] text-foreground truncate",children:(a==null?void 0:a.title)??"Unknown"}),l.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[un[o.stepId]??Ce[o.fromPhase]??o.fromPhase??"Gate",c!=null&&` · ${Math.round(c*100)}% complete`]}),s.has(o.id)&&l.jsx("div",{className:"mt-1",children:l.jsx(jf,{oldText:s.get(o.id).priorSnapshot,newText:s.get(o.id).currentSnapshot})})]}),l.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[l.jsx(At,{variant:"outline",size:"sm",className:"h-6 text-[10px] gap-1 text-success border-success/30 hover:bg-success/10",onClick:()=>n(o.id,"approved"),children:"Approve"}),l.jsx(At,{variant:"outline",size:"sm",className:"h-6 text-[10px] gap-1 text-amber-400 border-amber-400/30 hover:bg-amber-400/10",onClick:()=>n(o.id,"revised"),children:"Revise"}),l.jsx(At,{variant:"outline",size:"sm",className:"h-6 text-[10px] gap-1 text-destructive border-destructive/30 hover:bg-destructive/10",onClick:async()=>{const u=await i({title:"Kill this gate?",label:"Reason (required)",destructive:!0});u&&n(o.id,"killed",u)},children:"Kill"})]})]})},o.id)})})}function lX({sessions:t,items:e,onSelect:r}){const n=(t||[]).slice(-5).reverse();return n.length===0?l.jsx("p",{className:"text-[11px] text-muted-foreground/50 px-1",children:"No sessions yet."}):l.jsx("div",{className:"space-y-1",children:n.map(i=>{const s=i.featureCode||i.feature_code,o=s?e.find(c=>{var h;return c.featureCode===s||c.feature_code===s||((h=c.lifecycle)==null?void 0:h.featureCode)===s}):null,a=i.startedAt||i.created_date;return l.jsxs("div",{className:nt("flex items-center gap-2 px-2 py-1.5 rounded hover:bg-muted/50 transition-colors",o&&"cursor-pointer"),onClick:()=>o&&r(o.id),children:[l.jsx(oj,{className:"w-3 h-3 text-muted-foreground shrink-0"}),l.jsx("span",{className:"text-[11px] text-foreground",children:i.agent||"agent"}),s&&l.jsx(Es,{kind:"feature",id:s,label:s,className:"text-[9px]"}),l.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground tabular-nums shrink-0",children:iX(a)}),l.jsx("span",{className:nt("w-1.5 h-1.5 rounded-full shrink-0",i.status==="active"?"bg-emerald-400":"bg-slate-600")})]},i.id)})})}function cX({items:t=[],gates:e=[],sessions:r=[],activeBuild:n,spawnedAgents:i=[],featureCode:s,sessionState:o,agentActivity:a,iterationStates:c,onSelect:h,onResolveGate:u,onOpenGate:d,onCreateFeature:f,isEmptyProject:p}){var T;const m=C.useMemo(()=>t.find(S=>{var L;return S.featureCode===s||((L=S.lifecycle)==null?void 0:L.featureCode)===s}),[t,s]),[x,g]=C.useState(()=>{try{return localStorage.getItem("compose:timeline-open")==="true"}catch{return!1}}),y=C.useCallback(()=>{g(S=>{const L=!S;try{localStorage.setItem("compose:timeline-open",String(L))}catch{}return L})},[]),k=((T=m==null?void 0:m.lifecycle)==null?void 0:T.currentPhase)||(m==null?void 0:m.phase)||(n==null?void 0:n.currentStepId)||(n==null?void 0:n.currentStep)||null,b=Io.indexOf(k),w=k?Math.max(0,(b+1)/Io.length):0,_=C.useMemo(()=>{let S=e.filter(L=>L.status==="pending"||!L.resolvedAt);if(s){const L=new Set(t.filter(B=>{var N;return B.featureCode===s||((N=B.lifecycle)==null?void 0:N.featureCode)===s}).map(B=>B.id));S=S.filter(B=>L.has(B.itemId))}return S},[e,t,s]);if(!s){const S=t.filter(L=>L.type==="feature"&&(L.status==="complete"||L.status==="done")).slice(-5);return l.jsx("div",{className:"flex-1 overflow-auto p-4",children:l.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 py-16 text-center",children:[l.jsx("p",{className:"text-sm text-muted-foreground",children:p?"No items yet.":"No feature in progress."}),p&&f&&l.jsx(At,{variant:"outline",size:"sm",onClick:f,children:"Create your first feature"}),l.jsx("p",{className:"text-[11px] text-muted-foreground/70 font-mono",children:"Run /compose <feature-code> in the terminal to start."}),S.length>0&&l.jsxs("div",{className:"mt-6 w-full max-w-sm",children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Recently completed"}),l.jsx("div",{className:"mt-2 space-y-1",children:S.map(L=>l.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>h(L.id),children:[l.jsx(Vd,{className:"w-3 h-3 text-emerald-400 shrink-0"}),l.jsx("span",{className:"text-[11px] text-foreground truncate",children:L.title}),L.featureCode&&l.jsx(cr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono ml-auto shrink-0",children:L.featureCode})]},L.id))})]})]})})}return l.jsxs("div",{className:"flex-1 flex flex-row overflow-hidden",children:[l.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-4 min-w-0",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("h2",{className:"text-sm font-semibold text-foreground truncate",children:(m==null?void 0:m.title)??s}),l.jsx(cr,{variant:"outline",className:"text-[9px] px-1.5 py-0 h-4 font-mono shrink-0",children:s}),k&&l.jsx(cr,{variant:"secondary",className:"text-[9px] px-1.5 py-0 h-4 shrink-0",children:Ce[k]??k}),l.jsxs("button",{className:nt("ml-auto flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-medium transition-colors shrink-0",x?"bg-foreground/10 text-foreground":"text-muted-foreground/60 hover:text-muted-foreground hover:bg-muted/30"),onClick:y,children:[l.jsx(B_,{className:"w-3 h-3"}),"Timeline"]})]}),l.jsx("div",{className:"mt-2 h-1.5 rounded-full bg-muted overflow-hidden",children:l.jsx("div",{className:"h-full rounded-full bg-blue-500",style:{width:`${Math.round(w*100)}%`,transition:"width 800ms cubic-bezier(0.4, 0, 0.2, 1)"}})}),l.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:b>=0?`${b+1} of ${Io.length} phases`:"Phase unknown"})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs(Md,{className:"bg-card border-border",style:{animation:"phase-card-enter 400ms ease-out"},children:[l.jsx(Id,{className:"p-3 pb-2",children:l.jsx(Fd,{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Phase Timeline"})}),l.jsx(Pd,{className:"p-3 pt-0",children:l.jsx(sX,{currentPhase:k})})]}),l.jsxs(Md,{className:"bg-card border-border",style:{animation:"phase-card-enter 400ms ease-out 100ms both"},children:[l.jsx(Id,{className:"p-3 pb-2",children:l.jsx(Fd,{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Agents & Artifacts"})}),l.jsx(Pd,{className:"p-3 pt-0",children:l.jsx(oX,{spawnedAgents:i,activeBuild:n,sessionState:o,agentActivity:a})})]})]}),c&&c.size>0&&l.jsx("div",{className:"space-y-2",children:[...c.values()].map(S=>l.jsxs("div",{className:"px-3 py-2.5 rounded border border-blue-500/30 bg-blue-500/10",children:[l.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[l.jsxs("span",{className:"text-[11px] text-blue-400 font-medium",children:[S.status==="running"?"↻":S.outcome==="clean"?"✓":"✗"," ",S.loopType==="review"?"Review Loop":"Coverage Sweep"]}),l.jsxs("span",{className:"text-[11px] text-blue-300 font-mono",children:[S.count," of ",S.maxIterations]})]}),l.jsx("div",{className:"h-1.5 rounded-full bg-blue-500/20 overflow-hidden",children:l.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.round(S.count/S.maxIterations*100)}%`,transition:"width 600ms cubic-bezier(0.4, 0, 0.2, 1)",backgroundColor:S.outcome==="clean"?"#22c55e":S.outcome==="max_reached"?"#ef4444":"#3b82f6"}})}),l.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:S.status==="running"?S.loopType==="review"?"Waiting for clean review...":"Waiting for tests passing...":S.outcome==="clean"?"Clean!":S.outcome==="max_reached"?"Max iterations reached":"Aborted"})]},S.loopId))}),l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Pending Gates"}),_.length>0&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-amber-400/15 text-amber-400 font-medium",children:_.length})]}),l.jsx(aX,{gates:_,allGates:e,items:t,onResolveGate:u})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Recent Sessions"}),l.jsx("div",{className:"mt-2",children:l.jsx(lX,{sessions:r,items:t,onSelect:h})})]})]}),x&&l.jsxs("div",{className:"w-80 border-l border-border flex flex-col shrink-0",children:[l.jsx("div",{className:"px-3 py-2 border-b border-border",children:l.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Event Timeline"})}),l.jsx(nX,{featureCode:s,itemId:m==null?void 0:m.id,onSelectItem:h})]})]})}function hX(t,e){var i,s;if(!((i=t.tags)!=null&&i.length)||!((s=e.tags)!=null&&s.length))return 0;const r=new Set(t.tags);return e.tags.filter(o=>r.has(o)).length/Math.max(t.tags.length,e.tags.length)}function uX(t,e){return e.filter(r=>r.id!==t.id).map(r=>({idea:r,score:hX(t,r)})).filter(({score:r})=>r>.25).sort((r,n)=>n.score-r.score).slice(0,3).map(({idea:r})=>r)}function dX({results:t,onClose:e}){const r=C.useMemo(()=>{const i={P0:0,P1:0,P2:0,killed:0,promoted:0,skipped:0};for(const s of t)s.action==="skip"?i.skipped++:s.action==="kill"?i.killed++:s.action==="promote"?i.promoted++:s.priority==="P0"?i.P0++:s.priority==="P1"?i.P1++:s.priority==="P2"&&i.P2++;return i},[t]),n=t.filter(i=>i.action!=="skip").length;return l.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 p-8 text-center",children:[l.jsx("div",{className:"w-10 h-10 rounded-full bg-emerald-400/20 flex items-center justify-center",children:l.jsx(si,{className:"w-5 h-5 text-emerald-400"})}),l.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Triage complete"}),l.jsxs("p",{className:"text-[12px] text-muted-foreground",children:["Triaged ",n," of ",t.length," ideas"]}),l.jsxs("div",{className:"flex gap-3 text-[11px]",children:[r.P0>0&&l.jsxs("span",{className:"text-red-400",children:[r.P0," P0"]}),r.P1>0&&l.jsxs("span",{className:"text-amber-400",children:[r.P1," P1"]}),r.P2>0&&l.jsxs("span",{className:"text-blue-400",children:[r.P2," P2"]}),r.promoted>0&&l.jsxs("span",{className:"text-emerald-400",children:[r.promoted," promoted"]}),r.killed>0&&l.jsxs("span",{className:"text-muted-foreground",children:[r.killed," killed"]}),r.skipped>0&&l.jsxs("span",{className:"text-muted-foreground/60",children:[r.skipped," skipped"]})]}),l.jsx(At,{size:"sm",onClick:e,className:"mt-2",children:"Done"})]})}function pX({ideas:t,onClose:e}){const{setPriority:r,killIdea:n,promoteIdea:i,ideas:s}=hs(),[o,a]=C.useState(()=>[...t]),[c,h]=C.useState(0),[u,d]=C.useState([]),[f,p]=C.useState(!1),[m,x]=C.useState(""),[g,y]=C.useState(!1),[k,b]=C.useState(!1),w=o[c]??null;o.length-c;const _=C.useMemo(()=>w?uX(w,s.filter(A=>A.id!==w.id)):[],[w,s]),T=C.useCallback(()=>{const A=c+1;A>=o.length?p(!0):(h(A),y(!1),x(""))},[c,o.length]),S=C.useCallback(async A=>{if(!(!w||k)){b(!0);try{await r(w.id,A),d(R=>[...R,{id:w.id,action:"priority",priority:A}]),T()}finally{b(!1)}}},[w,k,r,T]),L=C.useCallback(async()=>{if(!(!w||k)){b(!0);try{await n(w.id,m),d(A=>[...A,{id:w.id,action:"kill"}]),y(!1),x(""),T()}finally{b(!1)}}},[w,k,n,m,T]),B=C.useCallback(()=>{w&&(d(A=>[...A,{id:w.id,action:"skip"}]),T())},[w,T]),N=C.useCallback(async()=>{if(!(!w||k)){b(!0);try{await i(w.id),d(A=>[...A,{id:w.id,action:"promote"}]),T()}finally{b(!1)}}},[w,k,i,T]);return C.useEffect(()=>{const A=R=>{if(R.key==="Escape"){e();return}g||(R.key==="0"&&S("P0"),R.key==="1"&&S("P1"),R.key==="2"&&S("P2"),(R.key==="s"||R.key==="ArrowRight")&&B(),R.key==="k"&&y(!0))};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[g,S,B,e]),l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"hsl(var(--background) / 0.8)",backdropFilter:"blur(4px)"},children:l.jsxs("div",{className:"w-full max-w-lg mx-4 rounded-xl border border-border bg-card shadow-2xl flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-border flex items-center gap-2",children:[l.jsx(si,{className:"w-4 h-4 text-amber-400 shrink-0"}),l.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Triage"}),!f&&l.jsxs("span",{className:"text-[11px] text-muted-foreground ml-1",children:[c+1," of ",o.length," untriaged"]}),l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:e,className:"text-muted-foreground/60 hover:text-foreground transition-colors",children:l.jsx(Kr,{className:"w-4 h-4"})})]}),!f&&l.jsx("div",{className:"h-1 bg-muted",children:l.jsx("div",{className:"h-full bg-accent transition-all duration-300",style:{width:`${Math.round(c/o.length*100)}%`}})}),l.jsx("div",{className:"flex-1 p-4",children:f?l.jsx(dX,{results:u,onClose:e}):w?l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx(cr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono",children:w.id}),w.cluster&&l.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:w.cluster})]}),l.jsx("h3",{className:"text-[14px] text-foreground font-semibold leading-snug mb-2",children:w.title}),w.description&&l.jsx("p",{className:"text-[12px] text-muted-foreground leading-relaxed mb-2",children:w.description}),l.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:(w.tags||[]).map(A=>l.jsx("span",{className:"text-[10px] bg-muted px-1.5 py-0.5 rounded font-mono text-muted-foreground",children:A},A))}),w.source&&l.jsxs("p",{className:"text-[10px] text-muted-foreground/50 mt-2",children:["Source: ",w.source]})]}),_.length>0&&l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold mb-1.5",children:"Similar to:"}),l.jsx("div",{className:"space-y-1",children:_.map(A=>l.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded bg-muted/30 border border-border/40",children:[l.jsx(cr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono opacity-70",children:A.id}),l.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:A.title})]},A.id))})]}),g&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("input",{autoFocus:!0,type:"text",placeholder:"Reason for killing (optional)…",value:m,onChange:A=>x(A.target.value),onKeyDown:A=>{A.key==="Enter"&&L(),A.key==="Escape"&&y(!1)},className:"w-full text-[12px] bg-muted text-foreground px-3 py-2 rounded border border-border outline-none focus:border-ring"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(At,{size:"sm",variant:"outline",className:"flex-1 h-7 text-[11px]",onClick:()=>{y(!1),x("")},children:"Cancel"}),l.jsx(At,{size:"sm",className:"flex-1 h-7 text-[11px] bg-destructive/80 hover:bg-destructive text-destructive-foreground",onClick:L,disabled:k,children:"Confirm Kill"})]})]})]}):l.jsx("p",{className:"text-[12px] text-muted-foreground text-center py-8",children:"No more untriaged ideas."})}),!f&&w&&!g&&l.jsxs("div",{className:"px-4 pb-4 space-y-2",children:[l.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[l.jsxs(At,{size:"sm",className:"h-9 text-[12px] bg-red-500/80 hover:bg-red-500 text-white border-0",onClick:()=>S("P0"),disabled:k,title:"Press 0",children:["P0 ",l.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"0"})]}),l.jsxs(At,{size:"sm",className:"h-9 text-[12px] bg-amber-500/80 hover:bg-amber-500 text-white border-0",onClick:()=>S("P1"),disabled:k,title:"Press 1",children:["P1 ",l.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"1"})]}),l.jsxs(At,{size:"sm",className:"h-9 text-[12px] bg-blue-500/80 hover:bg-blue-500 text-white border-0",onClick:()=>S("P2"),disabled:k,title:"Press 2",children:["P2 ",l.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"2"})]})]}),l.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[l.jsx(At,{size:"sm",variant:"outline",className:"h-7 text-[11px] text-emerald-400 border-emerald-400/30 hover:bg-emerald-400/10",onClick:N,disabled:k,children:"Promote"}),l.jsxs(At,{size:"sm",variant:"outline",className:"h-7 text-[11px] text-destructive border-destructive/30 hover:bg-destructive/10",onClick:()=>y(!0),title:"Press k",children:["Kill ",l.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"k"})]}),l.jsxs(At,{size:"sm",variant:"outline",className:"h-7 text-[11px] text-muted-foreground gap-1",onClick:B,title:"Press s or →",children:[l.jsx(J0,{className:"w-3 h-3"}),"Skip ",l.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"s"})]})]})]})]})})}function j0(t){var n;if(!t)return"";const r=(t.cluster||"").toUpperCase().replace(/[^A-Z0-9]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").slice(0,8);if(!r){const i=(((n=t.tags)==null?void 0:n[0])||"").replace("#","").toUpperCase().slice(0,6);return i?`${i}-1`:"FEAT-1"}return`${r}-1`}function fX(t,e){const r=new Date().toISOString().slice(0,10),n=(t.tags||[]).join(", ")||"N/A";return`# ${e}: ${t.title}
700
-
701
- **Date:** ${r}
702
- **Promoted from:** ${t.id}
703
- **Priority:** ${t.priority||"TBD"}
704
- **Tags:** ${n}
705
-
706
- ## Context
707
-
708
- ${t.description||t.title}
709
-
710
- ## Source
711
-
712
- ${t.source||"Internal idea"}
713
-
714
- ## Goals
715
-
716
- - [ ] Define acceptance criteria
717
- - [ ] Identify affected components
718
- - [ ] Estimate effort
719
-
720
- ## Related
721
-
722
- ${t.mapsTo?`- Maps to: ${t.mapsTo}`:"- TBD"}
723
- `.trimStart()}function mX({step:t,current:e}){const r=e>t,n=e===t;return l.jsx("div",{className:"flex items-center gap-1.5",children:l.jsx("div",{className:nt("w-5 h-5 rounded-full flex items-center justify-center text-[10px] font-semibold border transition-colors",r?"bg-emerald-400/20 border-emerald-400/60 text-emerald-400":n?"bg-accent/20 border-accent/60 text-accent":"bg-muted border-border/40 text-muted-foreground/40"),children:r?l.jsx(Cs,{className:"w-3 h-3"}):t})})}function gX({idea:t,onClose:e}){var _;const{promoteIdea:r}=hs(),[n,i]=C.useState(1),[s,o]=C.useState(()=>j0(t)),[a,c]=C.useState(""),[h,u]=C.useState(""),[d,f]=C.useState(!1),[p,m]=C.useState(null),x=C.useRef(null);C.useEffect(()=>{u(fX(t,s||"FEAT-?"))},[t,s]),C.useEffect(()=>{n===1&&setTimeout(()=>{var T;return(T=x.current)==null?void 0:T.focus()},50)},[n]);const g=()=>s.trim()?/^[A-Z0-9][A-Z0-9-]*[A-Z0-9]$/i.test(s.trim())?(c(""),!0):(c("Use format like FEAT-1 or COMP-UI-5"),!1):(c("Feature code is required"),!1),y=()=>{n===1&&!g()||i(T=>T+1)},k=()=>i(T=>T-1),b=async()=>{if(!d){f(!0);try{await r(t.id,s.trim().toUpperCase()),m({featureCode:s.trim().toUpperCase()}),i(4)}catch(T){c(T.message||"Failed to promote"),i(1)}finally{f(!1)}}},w=["Feature ID","Preview","Confirm"];return l.jsx(xc,{open:!0,onOpenChange:T=>!T&&e(),children:l.jsxs(yc,{className:"max-w-lg",children:[l.jsx(bc,{children:l.jsxs(Cc,{className:"flex items-center gap-2",children:[l.jsx(si,{className:"w-4 h-4 text-amber-400"}),"Promote to Feature"]})}),n<4&&l.jsx("div",{className:"px-6 -mt-1 mb-1",children:l.jsx("div",{className:"flex items-center gap-2",children:[1,2,3].map((T,S)=>l.jsxs(Dt.Fragment,{children:[l.jsx(mX,{step:T,current:n}),l.jsx("span",{className:nt("text-[10px] transition-colors",n===T?"text-foreground font-medium":"text-muted-foreground/60"),children:w[S]}),S<2&&l.jsx(ii,{className:"w-3 h-3 text-muted-foreground/30 mx-0.5"})]},T))})}),l.jsxs("div",{className:"px-6 pb-2",children:[n<4&&l.jsxs("div",{className:"mb-4 px-3 py-2 rounded border border-border/50 bg-muted/20",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[l.jsx(cr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono opacity-70",children:t.id}),t.priority&&t.priority!=="—"&&l.jsx("span",{className:nt("text-[9px] px-1 py-0.5 rounded font-mono font-semibold",t.priority==="P0"?"text-red-400":t.priority==="P1"?"text-amber-400":"text-blue-400"),children:t.priority})]}),l.jsx("p",{className:"text-[12px] text-foreground font-medium leading-snug",children:t.title})]}),n===1&&l.jsxs("div",{className:"space-y-3",children:[l.jsxs("label",{className:"block",children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold block mb-1.5",children:"Feature Code"}),l.jsx("input",{ref:x,type:"text",value:s,onChange:T=>{o(T.target.value.toUpperCase()),c("")},onKeyDown:T=>{T.key==="Enter"&&y()},placeholder:"e.g. COMP-UI-5",className:"w-full text-sm bg-muted text-foreground px-3 py-2 rounded-md border border-border outline-none focus:border-ring font-mono"}),a&&l.jsx("p",{className:"text-[11px] text-destructive mt-1",children:a})]}),t.cluster&&l.jsxs("p",{className:"text-[10px] text-muted-foreground/60",children:["Suggested from cluster: ",l.jsx("span",{className:"text-muted-foreground",children:t.cluster})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold mb-1.5",children:"Suggestions"}),l.jsx("div",{className:"flex flex-wrap gap-1.5",children:[j0(t),`COMP-${(((_=t.tags)==null?void 0:_[0])||"FEAT").replace("#","").toUpperCase()}-1`].filter((T,S,L)=>L.indexOf(T)===S).map(T=>l.jsx("button",{onClick:()=>{o(T),c("")},className:nt("text-[10px] px-2 py-1 rounded border font-mono transition-colors",s===T?"bg-accent/10 border-accent/60 text-accent":"border-border/40 text-muted-foreground hover:border-border hover:text-foreground"),children:T},T))})]})]}),n===2&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Generated plan.md stub"}),l.jsx("pre",{className:"text-[10px] font-mono text-muted-foreground bg-muted/40 border border-border/40 rounded p-3 overflow-auto max-h-48 whitespace-pre-wrap leading-relaxed",children:h}),l.jsx("p",{className:"text-[10px] text-muted-foreground/60",children:"This stub will be created when you run the promote workflow from the CLI."})]}),n===3&&l.jsxs("div",{className:"space-y-3",children:[l.jsxs("p",{className:"text-[12px] text-muted-foreground",children:["Promote ",l.jsx("span",{className:"text-foreground font-medium",children:t.id})," to feature"," ",l.jsx("span",{className:"font-mono text-accent font-semibold",children:s}),"?"]}),l.jsxs("p",{className:"text-[11px] text-muted-foreground/70",children:["The idea will be marked ",l.jsxs("span",{className:"font-mono",children:["PROMOTED (",s,")"]})," in the ideabox."]})]}),n===4&&p&&l.jsxs("div",{className:"flex flex-col items-center gap-3 py-4 text-center",children:[l.jsx("div",{className:"w-10 h-10 rounded-full bg-emerald-400/20 flex items-center justify-center",children:l.jsx(Cs,{className:"w-5 h-5 text-emerald-400"})}),l.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Promoted!"}),l.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[t.id," is now linked to feature"," ",l.jsx("span",{className:"font-mono text-accent font-semibold",children:p.featureCode})]}),l.jsx(At,{size:"sm",onClick:e,className:"mt-1",children:"Close"})]})]}),n<4&&l.jsxs(Hd,{children:[n>1&&l.jsxs(At,{variant:"ghost",size:"sm",onClick:k,disabled:d,children:[l.jsx(Y0,{className:"w-3 h-3 mr-1"}),"Back"]}),l.jsx(At,{variant:"ghost",size:"sm",onClick:e,disabled:d,children:"Cancel"}),n<3?l.jsxs(At,{size:"sm",onClick:y,children:["Next",l.jsx(ii,{className:"w-3 h-3 ml-1"})]}):l.jsx(At,{size:"sm",onClick:b,disabled:d,children:d?"Promoting…":"Promote"})]})]})})}const $d=["S","M","L"],xX=["high","medium","low"],yX={"high-S":"Quick Wins","high-M":"Quick Wins","high-L":"Big Bets","medium-S":"Fill-ins","medium-M":"Fill-ins","medium-L":"Money Pits","low-S":"Fill-ins","low-M":"Fill-ins","low-L":"Money Pits"},N0={"Quick Wins":"bg-emerald-400/8 border-emerald-400/20","Big Bets":"bg-blue-400/8 border-blue-400/20","Fill-ins":"bg-amber-400/8 border-amber-400/20","Money Pits":"bg-red-400/8 border-red-400/20"},E0=["bg-blue-400","bg-violet-400","bg-emerald-400","bg-amber-400","bg-rose-400","bg-cyan-400","bg-orange-400","bg-pink-400"];function bX({idea:t,onSubmit:e,onCancel:r}){const[n,i]=C.useState(t.effort||""),[s,o]=C.useState(t.impact||"");return l.jsxs("div",{className:"p-2 bg-card border border-border rounded-lg shadow-md w-52",children:[l.jsxs("p",{className:"text-[10px] text-muted-foreground mb-2 truncate font-medium",children:[t.id,": ",t.title]}),l.jsxs("div",{className:"mb-2",children:[l.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1",children:"Effort"}),l.jsx("div",{className:"flex gap-1",children:$d.map(a=>l.jsx("button",{onClick:()=>i(a),className:nt("flex-1 text-[10px] py-0.5 rounded border transition-colors",n===a?"bg-primary/20 border-primary/50 text-primary":"border-border/40 text-muted-foreground hover:border-border"),children:a},a))})]}),l.jsxs("div",{className:"mb-2.5",children:[l.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1",children:"Impact"}),l.jsx("div",{className:"flex gap-1",children:["high","medium","low"].map(a=>l.jsx("button",{onClick:()=>o(a),className:nt("flex-1 text-[9px] py-0.5 rounded border transition-colors capitalize",s===a?"bg-primary/20 border-primary/50 text-primary":"border-border/40 text-muted-foreground hover:border-border"),children:a},a))})]}),l.jsxs("div",{className:"flex gap-1",children:[l.jsx("button",{onClick:r,className:"flex-1 text-[10px] py-1 rounded border border-border/40 text-muted-foreground hover:border-border transition-colors",children:"Cancel"}),l.jsx("button",{onClick:()=>n&&s&&e(t.id,{effort:n,impact:s}),disabled:!n||!s,className:"flex-1 text-[10px] py-1 rounded border border-primary/50 bg-primary/10 text-primary hover:bg-primary/20 disabled:opacity-40 transition-colors",children:"Save"})]})]})}function CX({ideas:t,selectedIdeaId:e,onSelectIdea:r,onUpdateIdea:n}){const[i,s]=C.useState(null),o=C.useMemo(()=>{const u=[...new Set(t.map(f=>f.cluster||"__none__"))],d={};return u.forEach((f,p)=>{d[f]=E0[p%E0.length]}),d},[t]),a=C.useMemo(()=>t.filter(u=>u.effort&&u.impact),[t]),c=C.useMemo(()=>t.filter(u=>!u.effort||!u.impact),[t]),h=C.useCallback(async(u,d)=>{await n(u,d),s(null)},[n]);return l.jsxs("div",{className:"flex flex-col gap-4",children:[l.jsxs("div",{children:[l.jsx("div",{className:"flex mb-1 ml-12",children:$d.map(u=>l.jsx("div",{className:"flex-1 text-center text-[10px] text-muted-foreground font-medium uppercase tracking-wider",children:u},u))}),xX.map(u=>l.jsxs("div",{className:"flex mb-1",children:[l.jsx("div",{className:"w-12 shrink-0 flex items-center justify-end pr-2",children:l.jsx("span",{className:"text-[9px] text-muted-foreground capitalize",children:u})}),$d.map(d=>{const f=`${u}-${d}`,p=yX[f],m=a.filter(x=>x.impact===u&&x.effort===d);return l.jsxs("div",{className:nt("flex-1 min-h-[90px] rounded border p-1.5 mr-1 relative transition-colors",N0[p]||"border-border/30"),children:[l.jsx("span",{className:"absolute top-1 right-1 text-[8px] text-muted-foreground/50 italic",children:p}),l.jsx("div",{className:"flex flex-wrap gap-1 pt-1",children:m.map(x=>{const g=o[x.cluster||"__none__"]||"bg-muted-foreground",y=x.id===e;return l.jsx("button",{onClick:()=>r==null?void 0:r(x.id),title:`${x.id}: ${x.title}`,className:nt("w-5 h-5 rounded-full border-2 transition-all hover:scale-110 flex items-center justify-center",g,y?"border-foreground ring-1 ring-foreground":"border-transparent")},x.id)})})]},d)})]},u)),l.jsx("div",{className:"flex ml-12",children:l.jsx("div",{className:"flex-1 text-center text-[9px] text-muted-foreground/60 mt-0.5",children:"Effort (S = small, M = medium, L = large)"})})]}),l.jsx("div",{className:"flex flex-wrap gap-3 text-[10px]",children:Object.entries(N0).map(([u,d])=>l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("div",{className:nt("w-2.5 h-2.5 rounded-sm border",d)}),l.jsx("span",{className:"text-muted-foreground",children:u})]},u))}),c.length>0&&l.jsxs("div",{children:[l.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-2",children:["Unassigned (",c.length,") — click to assign effort/impact"]}),l.jsx("div",{className:"flex flex-wrap gap-2",children:c.map(u=>l.jsxs("div",{className:"relative",children:[l.jsxs("button",{onClick:()=>s((i==null?void 0:i.id)===u.id?null:u),className:nt("text-[10px] px-2 py-1 rounded border transition-colors",(i==null?void 0:i.id)===u.id?"border-accent bg-accent/10 text-foreground":"border-border/50 text-muted-foreground hover:border-border hover:text-foreground"),children:[l.jsx("span",{className:"font-mono text-[9px] mr-1 opacity-60",children:u.id}),u.title.slice(0,30),u.title.length>30?"…":""]}),(i==null?void 0:i.id)===u.id&&l.jsx("div",{className:"absolute left-0 top-full mt-1 z-10",children:l.jsx(bX,{idea:u,onSubmit:h,onCancel:()=>s(null)})})]},u.id))})]})]})}function fu({value:t,max:e,color:r="bg-primary/60"}){const n=e>0?Math.round(t/e*100):0;return l.jsx("div",{className:"flex-1 h-1.5 bg-muted/50 rounded-full overflow-hidden",children:l.jsx("div",{className:nt("h-full rounded-full transition-all",r),style:{width:`${n}%`}})})}function kX({ideas:t,killed:e}){const[r,n]=C.useState(!1),i=C.useMemo(()=>{var k,b,w,_;const s=[...t,...e||[]],o={};for(const T of s){const S=((k=T.source)==null?void 0:k.trim())||"(no source)",L=S.length>30?S.slice(0,30)+"…":S;o[L]=(o[L]||0)+1}const a=Object.entries(o).sort((T,S)=>S[1]-T[1]).slice(0,6),c=((b=a[0])==null?void 0:b[1])||1,h=s.filter(T=>T.status==="NEW").length,u=s.filter(T=>T.status==="DISCUSSING").length,d=s.filter(T=>{var S;return(S=T.status)==null?void 0:S.startsWith("PROMOTED")}).length,f=(e||[]).length,p=t.length,m=s.length>0?Math.round(f/s.length*100):0,x={};for(const T of s){const S=T.cluster||"(unclustered)";x[S]||(x[S]={total:0,promoted:0}),x[S].total+=1,(w=T.status)!=null&&w.startsWith("PROMOTED")&&(x[S].promoted+=1)}const g=Object.entries(x).sort((T,S)=>S[1].total-T[1].total).slice(0,5),y=((_=g[0])==null?void 0:_[1].total)||1;return{sourceEntries:a,maxSourceCount:c,newCount:h,discussingCount:u,promotedCount:d,killedCount:f,killRate:m,totalActive:p,clusterEntries:g,maxClusterTotal:y}},[t,e]);return t.length===0&&(!e||e.length===0)?null:l.jsxs("div",{className:"mt-1.5",children:[l.jsxs("button",{onClick:()=>n(s=>!s),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/70 hover:text-muted-foreground transition-colors",children:[r?l.jsx(ks,{className:"w-3 h-3"}):l.jsx(ii,{className:"w-3 h-3"}),l.jsx(UT,{className:"w-3 h-3"}),l.jsx("span",{children:"Analytics"})]}),r&&l.jsxs("div",{className:"mt-2 space-y-3 border border-border/30 rounded-lg p-3 bg-muted/10",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1.5 font-semibold",children:"Status Funnel"}),l.jsx("div",{className:"space-y-1",children:[{label:"NEW",count:i.newCount,color:"bg-emerald-400/60"},{label:"DISCUSSING",count:i.discussingCount,color:"bg-amber-400/60"},{label:"PROMOTED",count:i.promotedCount,color:"bg-blue-400/60"},{label:"KILLED",count:i.killedCount,color:"bg-muted-foreground/40"}].map(({label:s,count:o,color:a})=>l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"w-16 text-[9px] text-muted-foreground shrink-0",children:s}),l.jsx(fu,{value:o,max:Math.max(i.newCount,i.discussingCount,i.promotedCount,i.killedCount,1),color:a}),l.jsx("span",{className:"w-5 text-right text-[9px] text-muted-foreground shrink-0",children:o})]},s))}),i.killRate>0&&l.jsxs("p",{className:"text-[9px] text-muted-foreground/60 mt-1",children:["Kill rate: ",i.killRate,"%"]})]}),i.sourceEntries.length>0&&l.jsxs("div",{children:[l.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1.5 font-semibold",children:"By Source"}),l.jsx("div",{className:"space-y-1",children:i.sourceEntries.map(([s,o])=>l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"w-24 text-[9px] text-muted-foreground truncate shrink-0",title:s,children:s}),l.jsx(fu,{value:o,max:i.maxSourceCount,color:"bg-violet-400/50"}),l.jsx("span",{className:"w-5 text-right text-[9px] text-muted-foreground shrink-0",children:o})]},s))})]}),i.clusterEntries.length>0&&l.jsxs("div",{children:[l.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1.5 font-semibold",children:"Cluster Health"}),l.jsx("div",{className:"space-y-1",children:i.clusterEntries.map(([s,{total:o,promoted:a}])=>{const c=o>0?Math.round(a/o*100):0;return l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"w-24 text-[9px] text-muted-foreground truncate shrink-0",title:s,children:s}),l.jsx(fu,{value:o,max:i.maxClusterTotal,color:"bg-cyan-400/50"}),l.jsx("span",{className:"w-5 text-right text-[9px] text-muted-foreground shrink-0",children:o}),c>0&&l.jsxs("span",{className:"text-[9px] text-blue-400 shrink-0",children:[c,"%"]})]},s)})})]})]})]})}const vX=[{key:"—",label:"Untriaged",color:"text-muted-foreground",bg:"bg-muted/20",border:"border-border/50"},{key:"P0",label:"P0",color:"text-red-400",bg:"bg-red-400/10",border:"border-red-400/30"},{key:"P1",label:"P1",color:"text-amber-400",bg:"bg-amber-400/10",border:"border-amber-400/30"},{key:"P2",label:"P2",color:"text-blue-400",bg:"bg-blue-400/10",border:"border-blue-400/30"}];function L0(t){return t==="P0"?0:t==="P1"?1:t==="P2"?2:3}function GS({status:t}){const e=t==="NEW"?"bg-emerald-400":t==="DISCUSSING"?"bg-amber-400":t!=null&&t.startsWith("PROMOTED")?"bg-blue-400":"bg-muted-foreground/40";return l.jsx("span",{className:nt("inline-block w-2 h-2 rounded-full shrink-0",e),title:t})}function wX({priority:t}){if(!t||t==="—")return l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded border border-border/40 text-muted-foreground/60",children:"untriaged"});const e={P0:"bg-red-400/15 text-red-400 border-red-400/30",P1:"bg-amber-400/15 text-amber-400 border-amber-400/30",P2:"bg-blue-400/15 text-blue-400 border-blue-400/30"};return l.jsx("span",{className:nt("text-[9px] px-1.5 py-0.5 rounded border font-mono font-semibold",e[t]||"border-border/40 text-muted-foreground"),children:t})}function SX({idea:t,selected:e,onClick:r,onDragStart:n,onDragEnd:i}){var s;return l.jsxs("div",{draggable:!0,onDragStart:o=>n==null?void 0:n(o,t.id),onDragEnd:i,onClick:()=>r==null?void 0:r(t.id),className:nt("group px-3 py-2.5 rounded border cursor-pointer transition-colors select-none","hover:border-accent/50",e?"border-accent/60 bg-accent/5":"border-border/50 bg-card/60"),children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[l.jsx(cr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono shrink-0",children:t.id}),l.jsx(GS,{status:t.status}),l.jsx("div",{className:"flex-1"}),l.jsx(wX,{priority:t.priority})]}),l.jsx("p",{className:"text-[12px] text-foreground font-medium leading-snug mb-1 line-clamp-2",children:t.title}),((s=t.tags)==null?void 0:s.length)>0&&l.jsxs("div",{className:"flex flex-wrap gap-1 mb-1",children:[t.tags.slice(0,4).map(o=>l.jsx("span",{className:"text-[9px] text-muted-foreground/70 font-mono",children:o},o)),t.tags.length>4&&l.jsxs("span",{className:"text-[9px] text-muted-foreground/50",children:["+",t.tags.length-4]})]}),t.source&&l.jsx("p",{className:"text-[10px] text-muted-foreground/60 truncate",children:t.source})]})}function TX({idea:t,onClose:e,onPromote:r,onKill:n,onSetPriority:i,onAddDiscussion:s}){var y,k,b,w;const[o,a]=C.useState(""),[c,h]=C.useState(!1),[u,d]=C.useState(!1),[f,p]=C.useState(""),[m,x]=C.useState(!1);if(!t)return null;const g=async()=>{const _=f.trim();if(_){x(!0);try{await s(t.id,"human",_),p("")}finally{x(!1)}}};return l.jsxs("div",{className:"w-80 border-l border-border flex flex-col shrink-0 overflow-hidden",children:[l.jsxs("div",{className:"px-3 py-2 border-b border-border flex items-center gap-2",children:[l.jsx(cr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono",children:t.id}),l.jsx(GS,{status:t.status}),l.jsx("span",{className:"text-[11px] text-muted-foreground flex-1 truncate",children:t.status}),l.jsx("button",{onClick:e,className:"text-muted-foreground/60 hover:text-foreground text-xs px-1",children:"x"})]}),l.jsxs("div",{className:"flex-1 overflow-auto p-3 space-y-3",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Title"}),l.jsx("p",{className:"text-[13px] text-foreground font-medium leading-snug",children:t.title})]}),t.description&&l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Description"}),l.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:t.description})]}),t.source&&l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Source"}),l.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.source})]}),t.cluster&&l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Cluster"}),l.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.cluster})]}),((y=t.tags)==null?void 0:y.length)>0&&l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Tags"}),l.jsx("div",{className:"flex flex-wrap gap-1",children:t.tags.map(_=>l.jsx("span",{className:"text-[10px] bg-muted/50 px-1.5 py-0.5 rounded font-mono text-muted-foreground",children:_},_))})]}),t.mapsTo&&l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Maps To"}),l.jsx("p",{className:"text-[11px] text-muted-foreground font-mono",children:t.mapsTo})]}),l.jsxs("div",{children:[l.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1.5 flex items-center gap-1",children:[l.jsx(kc,{className:"w-3 h-3"}),"Discussion",((k=t.discussion)==null?void 0:k.length)>0&&l.jsxs("span",{className:"text-muted-foreground/50",children:["(",t.discussion.length,")"]})]}),((b=t.discussion)==null?void 0:b.length)>0&&l.jsx("div",{className:"space-y-1.5 mb-2",children:t.discussion.map((_,T)=>l.jsxs("div",{className:"px-2 py-1.5 rounded bg-muted/30 border border-border/30",children:[l.jsxs("div",{className:"flex items-center gap-1 mb-0.5",children:[l.jsx("span",{className:nt("text-[9px] font-mono font-semibold",_.author==="agent"?"text-blue-400":"text-emerald-400"),children:_.author}),l.jsx("span",{className:"text-[9px] text-muted-foreground/50",children:_.date})]}),l.jsx("p",{className:"text-[10px] text-muted-foreground leading-relaxed",children:_.text})]},T))}),l.jsxs("div",{className:"flex gap-1.5 items-end",children:[l.jsx("input",{type:"text",placeholder:"Add comment…",value:f,onChange:_=>p(_.target.value),onKeyDown:_=>_.key==="Enter"&&!_.shiftKey&&g(),className:"flex-1 text-[11px] bg-muted text-foreground px-2 py-1.5 rounded border border-border outline-none focus:border-ring",disabled:m}),l.jsx("button",{onClick:g,disabled:!f.trim()||m,className:"shrink-0 p-1.5 rounded border border-border/50 text-muted-foreground hover:text-foreground disabled:opacity-40 transition-colors",children:l.jsx(Xd,{className:"w-3 h-3"})})]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1.5",children:"Priority"}),l.jsx("div",{className:"flex gap-1.5",children:["P0","P1","P2","—"].map(_=>l.jsx("button",{onClick:()=>i(t.id,_),className:nt("flex-1 text-[10px] px-1.5 py-1 rounded border transition-colors",t.priority===_?_==="P0"?"bg-red-400/20 text-red-400 border-red-400/50":_==="P1"?"bg-amber-400/20 text-amber-400 border-amber-400/50":_==="P2"?"bg-blue-400/20 text-blue-400 border-blue-400/50":"bg-muted text-muted-foreground border-border":"border-border/40 text-muted-foreground hover:border-border"),children:_==="—"?"none":_},_))})]})]}),!((w=t.status)!=null&&w.startsWith("PROMOTED"))&&t.status!=="KILLED"&&l.jsxs("div",{className:"p-3 border-t border-border space-y-2",children:[l.jsx(At,{size:"sm",className:"w-full h-7 text-[11px]",onClick:()=>r(t),children:"Promote to Feature"}),c?l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("input",{autoFocus:!0,type:"text",placeholder:"Reason for killing…",value:o,onChange:_=>a(_.target.value),className:"w-full text-[11px] bg-muted text-foreground px-2 py-1.5 rounded border border-border outline-none focus:border-ring"}),l.jsxs("div",{className:"flex gap-1.5",children:[l.jsx(At,{size:"sm",variant:"outline",className:"flex-1 h-7 text-[10px]",onClick:()=>{h(!1),a("")},children:"Cancel"}),l.jsx(At,{size:"sm",className:"flex-1 h-7 text-[10px] bg-destructive/80 hover:bg-destructive text-destructive-foreground",onClick:()=>{n(t.id,o),h(!1),a("")},children:"Confirm Kill"})]})]}):l.jsx(At,{size:"sm",variant:"outline",className:"w-full h-7 text-[11px] text-destructive border-destructive/30 hover:bg-destructive/10",onClick:()=>h(!0),children:"Kill"})]})]})}function _X({killed:t,onResurrect:e}){const[r,n]=C.useState(!1);return t.length===0?null:l.jsxs("div",{className:"mt-4 border border-border/40 rounded-lg overflow-hidden",children:[l.jsxs("button",{onClick:()=>n(i=>!i),className:"w-full flex items-center gap-2 px-4 py-2.5 bg-muted/30 hover:bg-muted/50 transition-colors text-left",children:[r?l.jsx(ks,{className:"w-3 h-3 text-muted-foreground"}):l.jsx(ii,{className:"w-3 h-3 text-muted-foreground"}),l.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Graveyard"}),l.jsxs("span",{className:"text-[10px] text-muted-foreground/60 ml-1",children:["(",t.length,")"]})]}),r&&l.jsx("div",{className:"p-3 grid grid-cols-1 gap-2 bg-muted/10",children:t.map(i=>l.jsx("div",{className:"px-3 py-2 rounded border border-border/40 bg-card/40",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[l.jsx(cr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono shrink-0 opacity-60",children:i.id}),l.jsx("p",{className:"text-[11px] text-muted-foreground/70 line-clamp-1 font-medium",children:i.title})]}),i.killedDate&&l.jsxs("p",{className:"text-[10px] text-muted-foreground/50",children:["Killed ",i.killedDate,i.killedReason?` — ${i.killedReason}`:""]})]}),l.jsx("button",{onClick:()=>e(i.id),className:"shrink-0 text-[10px] text-muted-foreground/60 hover:text-foreground border border-border/40 px-1.5 py-0.5 rounded transition-colors",title:"Resurrect",children:"Resurrect"})]})},i.id))})]})}function jX(){const{ideas:t,killed:e,loading:r,error:n,selectedIdeaId:i,filters:s,hydrate:o,setPriority:a,killIdea:c,resurrectIdea:h,setSelectedIdea:u,updateFilters:d,addDiscussion:f,updateIdea:p}=hs(),[m,x]=C.useState(!1),[g,y]=C.useState(null),[k,b]=C.useState(null),[w,_]=C.useState(null),[T,S]=C.useState("cards"),L=C.useMemo(()=>{var et;const $=t.filter(M=>M.status==="NEW").length,O=t.filter(M=>!M.priority||M.priority==="—").length,D=t.filter(M=>M.priority==="P0").length,j={};t.filter(M=>M.priority==="P0"&&M.cluster).forEach(M=>{j[M.cluster]=(j[M.cluster]||0)+1});const Y=((et=Object.entries(j).sort((M,ct)=>ct[1]-M[1])[0])==null?void 0:et[0])??null;return{newCount:$,untriaged:O,p0Count:D,topCluster:Y}},[t]),B=C.useMemo(()=>{const $=new Set;return t.forEach(O=>(O.tags||[]).forEach(D=>$.add(D))),[...$].sort()},[t]),N=C.useMemo(()=>t.filter($=>{var O;if(s.tag&&!((O=$.tags)!=null&&O.includes(s.tag))||s.status&&($.status||"").split(/\s+/)[0]!==s.status||s.priority&&$.priority!==s.priority)return!1;if(s.search){const D=s.search.toLowerCase();if(!`${$.title} ${$.description} ${$.id} ${($.tags||[]).join(" ")}`.toLowerCase().includes(D))return!1}return!0}),[t,s]),A=C.useMemo(()=>{const $=new Map,O=[];N.forEach(Y=>{Y.cluster?($.has(Y.cluster)||$.set(Y.cluster,[]),$.get(Y.cluster).push(Y)):O.push(Y)});const D=Y=>[...Y].sort((et,M)=>L0(et.priority)-L0(M.priority)),j=[];for(const[Y,et]of $)j.push({cluster:Y,ideas:D(et)});return O.length>0&&j.push({cluster:null,ideas:D(O)}),j},[N]),R=C.useMemo(()=>t.find($=>$.id===i)||e.find($=>$.id===i)||null,[t,e,i]),z=C.useCallback(($,O)=>{b(O),$.dataTransfer.effectAllowed="move"},[]),P=C.useCallback(()=>{b(null),_(null)},[]),I=C.useCallback(($,O)=>{$.preventDefault(),$.dataTransfer.dropEffect="move",_(O)},[]),F=C.useCallback(async($,O)=>{$.preventDefault(),k&&await a(k,O),b(null),_(null)},[k,a]);return l.jsxs("div",{className:"flex-1 flex flex-row overflow-hidden",children:[l.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[l.jsxs("div",{className:"px-4 py-2.5 border-b border-border shrink-0",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx(si,{className:"w-4 h-4 text-amber-400 shrink-0"}),l.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Ideabox"}),r&&l.jsx(Po,{className:"w-3 h-3 text-muted-foreground animate-spin"}),l.jsx("div",{className:"flex-1"}),l.jsxs("div",{className:"flex items-center gap-0.5 border border-border/50 rounded-md p-0.5",children:[l.jsx("button",{onClick:()=>S("cards"),className:nt("text-[10px] px-2 py-0.5 rounded transition-colors",T==="cards"?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:"Cards"}),l.jsx("button",{onClick:()=>S("matrix"),className:nt("text-[10px] px-2 py-0.5 rounded transition-colors",T==="matrix"?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:"Matrix"})]}),l.jsx("button",{onClick:()=>o(),className:"text-[10px] text-muted-foreground/60 hover:text-muted-foreground transition-colors",title:"Refresh",children:l.jsx(Po,{className:"w-3 h-3"})}),l.jsxs(At,{size:"sm",variant:"outline",className:"h-6 text-[10px] gap-1",onClick:()=>x(!0),disabled:L.untriaged===0,children:["Triage (",L.untriaged,")"]})]}),l.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground",children:[L.newCount>0&&l.jsxs("span",{className:"text-emerald-400",children:[L.newCount," new"]}),l.jsxs("span",{children:[L.untriaged," untriaged"]}),L.p0Count>0&&l.jsxs("span",{className:"text-red-400",children:[L.p0Count," P0"]}),L.topCluster&&l.jsxs("span",{children:["top cluster: ",l.jsx("span",{className:"text-foreground",children:L.topCluster})]}),l.jsxs("span",{className:"text-muted-foreground/40",children:[t.length," total"]})]}),l.jsx(kX,{ideas:t,killed:e})]}),l.jsxs("div",{className:"px-4 py-2 border-b border-border shrink-0 flex items-center gap-2 flex-wrap",children:[l.jsx(g_,{className:"w-3 h-3 text-muted-foreground/60 shrink-0"}),l.jsxs("select",{value:s.tag,onChange:$=>d({tag:$.target.value}),className:"text-[11px] bg-muted text-foreground px-2 py-1 rounded border border-border/50 cursor-pointer h-6",children:[l.jsx("option",{value:"",children:"All tags"}),B.map($=>l.jsx("option",{value:$,children:$},$))]}),l.jsxs("select",{value:s.status,onChange:$=>d({status:$.target.value}),className:"text-[11px] bg-muted text-foreground px-2 py-1 rounded border border-border/50 cursor-pointer h-6",children:[l.jsx("option",{value:"",children:"All statuses"}),l.jsx("option",{value:"NEW",children:"New"}),l.jsx("option",{value:"DISCUSSING",children:"Discussing"}),l.jsx("option",{value:"PROMOTED",children:"Promoted"})]}),l.jsxs("select",{value:s.priority,onChange:$=>d({priority:$.target.value}),className:"text-[11px] bg-muted text-foreground px-2 py-1 rounded border border-border/50 cursor-pointer h-6",children:[l.jsx("option",{value:"",children:"All priorities"}),l.jsx("option",{value:"P0",children:"P0"}),l.jsx("option",{value:"P1",children:"P1"}),l.jsx("option",{value:"P2",children:"P2"}),l.jsx("option",{value:"—",children:"Untriaged"})]}),l.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-[120px]",children:[l.jsx(fn,{className:"w-3 h-3 text-muted-foreground/60 shrink-0"}),l.jsx("input",{type:"text",placeholder:"Search…",value:s.search,onChange:$=>d({search:$.target.value}),className:"flex-1 text-[11px] bg-transparent text-foreground outline-none placeholder:text-muted-foreground/40 min-w-0"})]}),(s.tag||s.status||s.priority||s.search)&&l.jsx("button",{onClick:()=>hs.getState().clearFilters(),className:"text-[10px] text-muted-foreground/60 hover:text-foreground transition-colors",children:"Clear"})]}),l.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[n&&l.jsx("div",{className:"mb-4 px-3 py-2 rounded border border-destructive/30 bg-destructive/10",children:l.jsx("p",{className:"text-[11px] text-destructive",children:n})}),T==="matrix"&&l.jsx(CX,{ideas:N,selectedIdeaId:i,onSelectIdea:u,onUpdateIdea:p}),T==="cards"&&N.length===0&&!r&&l.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center gap-2",children:[l.jsx(si,{className:"w-8 h-8 text-muted-foreground/30"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"No ideas yet."}),l.jsxs("p",{className:"text-[11px] text-muted-foreground/60",children:["Use the CLI: ",l.jsx("span",{className:"font-mono",children:'compose idea "Your idea title"'})]})]}),T==="cards"&&A.map(({cluster:$,ideas:O})=>l.jsxs("div",{className:"mb-6",children:[$&&l.jsxs("h3",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold mb-3 flex items-center gap-2",children:[l.jsx("span",{children:$}),l.jsxs("span",{className:"text-muted-foreground/40 normal-case tracking-normal font-normal",children:["(",O.length,")"]})]}),l.jsx("div",{className:"grid grid-cols-4 gap-3",children:vX.map(D=>{const j=O.filter(et=>et.priority===D.key),Y=w===D.key&&k;return l.jsxs("div",{className:nt("rounded-lg border p-2 min-h-[80px] transition-colors",D.bg,D.border,Y&&"ring-1 ring-accent"),onDragOver:et=>I(et,D.key),onDrop:et=>F(et,D.key),children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[l.jsx("span",{className:nt("text-[10px] font-semibold uppercase tracking-wider",D.color),children:D.label}),l.jsxs("span",{className:"text-[9px] text-muted-foreground/50",children:["(",j.length,")"]})]}),l.jsxs("div",{className:"space-y-1.5",children:[j.map(et=>l.jsx(SX,{idea:et,selected:i===et.id,onClick:u,onDragStart:z,onDragEnd:P},et.id)),j.length===0&&l.jsx("p",{className:"text-[10px] text-muted-foreground/30 text-center py-2",children:"Drop here"})]})]},D.key)})})]},$||"__unclustered__")),T==="cards"&&l.jsx(_X,{killed:e,onResurrect:h})]})]}),R&&l.jsx(TX,{idea:R,onClose:()=>u(null),onPromote:$=>y($),onKill:c,onSetPriority:a,onAddDiscussion:f}),m&&l.jsx(pX,{ideas:t.filter($=>!$.priority||$.priority==="—"),onClose:()=>x(!1)}),g&&l.jsx(gX,{idea:g,onClose:()=>y(null)})]})}const B0={error:"hsl(var(--destructive))",warning:"hsl(var(--warning))",info:"hsl(var(--muted-foreground))"},A0=["error","warning","info"];function NX({featureCode:t}){const[e,r]=C.useState("project"),[n,i]=C.useState(null),[s,o]=C.useState(!1),[a,c]=C.useState(null),h=C.useRef(0),u=e==="feature"&&t?"feature":"project",d=C.useCallback(async()=>{const m=++h.current;o(!0);try{const x=u==="feature"?`?scope=feature&featureCode=${encodeURIComponent(t)}`:"?scope=project",y=await(await vt(`/api/validate${x}`)).json();if(m!==h.current)return;i(y),c(null)}catch(x){if(m!==h.current)return;i(null),c((x==null?void 0:x.message)||"unavailable")}finally{m===h.current&&o(!1)}},[u,t]);C.useEffect(()=>{d()},[d]);const f=Array.isArray(n==null?void 0:n.findings)?n.findings:[],p=A0.map(m=>[m,f.filter(x=>x.severity===m)]);return l.jsxs("div",{className:"flex-1 flex flex-col min-h-0","data-testid":"validate-view",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2 border-b border-border shrink-0",children:[l.jsxs("select",{"data-testid":"validate-scope",value:e,onChange:m=>r(m.target.value),className:"text-xs px-1.5 py-0.5 h-6 rounded bg-muted text-foreground border border-border cursor-pointer",children:[l.jsx("option",{value:"project",children:"Project"}),l.jsx("option",{value:"feature",disabled:!t,children:t?`Feature: ${t}`:"Feature (none focused)"})]}),A0.map(m=>{var x;return l.jsxs("span",{className:"flex items-center gap-1 text-[10px]",children:[l.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:B0[m],display:"inline-block"}}),l.jsxs("span",{className:"text-muted-foreground",children:[((x=n==null?void 0:n.bySeverity)==null?void 0:x[m])??0," ",m]})]},m)}),l.jsx("button",{"data-testid":"validate-refresh",className:"ml-auto text-[11px] text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50",onClick:d,disabled:s,title:"Refresh","aria-label":"Refresh validation findings",children:"↻"})]}),l.jsxs("div",{className:"flex-1 overflow-auto",children:[a&&l.jsxs("div",{className:"px-3 py-2 text-destructive text-xs",children:["Unavailable: ",a]}),(n==null?void 0:n.unavailable)&&!a&&l.jsxs("div",{className:"px-3 py-2 text-muted-foreground text-xs",children:["Validation unavailable",n.error?`: ${n.error}`:""]}),!a&&!(n!=null&&n.unavailable)&&f.length===0&&l.jsx(aa,{icon:gi,title:s?"Validating…":"No findings",description:"Cross-artifact validation found no issues for this scope",className:"py-8"}),p.map(([m,x])=>x.length>0&&l.jsxs("div",{"data-testid":`validate-group-${m}`,children:[l.jsxs("div",{className:"px-3 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground sticky top-0 bg-background",children:[m," (",x.length,")"]}),x.map((g,y)=>l.jsxs("div",{"data-testid":`validate-finding-${m}`,className:"flex items-start gap-2 px-3 py-2 border-b border-border/50 hover:bg-muted/30 transition-colors",children:[l.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:B0[m],display:"inline-block",marginTop:4,flexShrink:0}}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-[11px] font-mono text-foreground",children:g.kind}),g.feature_code&&l.jsx("span",{className:"text-[10px] font-mono text-blue-400",children:g.feature_code})]}),l.jsx("p",{className:"text-[11px] text-muted-foreground",children:g.detail})]})]},`${m}-${y}`))]},m))]})]})}function mu({testid:t,label:e,routes:r,empty:n}){return l.jsxs("div",{className:"mt-3 first:mt-0","data-testid":t,children:[l.jsxs("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-1",children:[e," (",r.length,")"]}),r.length===0?l.jsx("div",{className:"text-[11px] text-muted-foreground italic",children:n}):l.jsx("ul",{className:"text-[12px] font-mono space-y-0.5",children:r.map(i=>l.jsx("li",{children:i},i))})]})}function EX({featureCode:t}){const[e,r]=C.useState(null),[n,i]=C.useState(!1),[s,o]=C.useState(null),a=C.useRef(0),c=C.useCallback(async()=>{if(!t)return;const h=++a.current;i(!0);try{const d=await(await vt(`/api/qa-scope?featureCode=${encodeURIComponent(t)}`)).json();if(h!==a.current)return;r(d),o(null)}catch(u){if(h!==a.current)return;r(null),o((u==null?void 0:u.message)||"unavailable")}finally{h===a.current&&i(!1)}},[t]);return C.useEffect(()=>{r(null),o(null)},[t]),C.useEffect(()=>{c()},[c]),t?l.jsxs("div",{"data-testid":"qa-scope-view",className:"flex-1 overflow-auto p-4 text-foreground",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2 mb-3",children:[l.jsxs("h2",{className:"text-sm font-semibold",children:["QA Scope · ",l.jsx("span",{className:"font-mono",children:t})]}),l.jsx("button",{"data-testid":"qa-scope-refresh",className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50",onClick:c,disabled:n,title:"Refresh",children:"↻"})]}),s&&l.jsxs("div",{"data-testid":"qa-scope-error",className:"text-destructive text-[12px]",children:["Unavailable: ",s]}),!e&&!s&&l.jsx("div",{className:"text-muted-foreground text-[12px]",children:n?"Analyzing…":"No data"}),e&&e.found===!1&&l.jsxs("div",{"data-testid":"qa-scope-not-found",className:"text-muted-foreground text-[12px]",children:["No feature found for ",l.jsx("span",{className:"font-mono",children:t}),"."]}),e&&e.found&&e.error&&l.jsxs("div",{"data-testid":"qa-scope-degraded",className:"text-destructive text-[12px]",children:["QA scope failed: ",e.error]}),e&&e.found&&!e.error&&e.emptyDiff&&l.jsxs("div",{"data-testid":"qa-scope-empty-diff",className:"text-muted-foreground text-[12px]",children:["No filesChanged recorded for ",t,". Run a build first so the pipeline tracks touched files."]}),e&&e.found&&!e.error&&!e.emptyDiff&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"text-[11px] text-muted-foreground mb-2",children:["Framework: ",l.jsx("span",{className:"font-mono",children:e.framework}),e.docsOnly?" · docs-only":""]}),l.jsx(mu,{testid:"qa-scope-affected",label:"Affected routes",routes:e.affected||[],empty:"(none — no code files mapped to known routes)"}),l.jsx(mu,{testid:"qa-scope-adjacent",label:"Adjacent routes",routes:e.adjacent||[],empty:"(none)"}),l.jsx(mu,{testid:"qa-scope-unmapped",label:"Unmapped files",routes:e.unmappedFiles||[],empty:"(none)"})]})]}):l.jsx("div",{"data-testid":"qa-scope-empty",className:"flex-1 flex items-center justify-center text-[12px] text-muted-foreground italic",children:"Select a feature to see its QA scope."})}const LX=/^[A-Z][A-Z0-9-]*[A-Z0-9]$/;function BX({open:t,onClose:e,onCreated:r}){const[n,i]=C.useState(""),[s,o]=C.useState(""),[a,c]=C.useState(""),[h,u]=C.useState(""),[d,f]=C.useState(!1),[p,m]=C.useState(null),x=C.useRef(null);C.useEffect(()=>{t&&(i(""),o(""),c(""),u(""),m(null),f(!1),setTimeout(()=>{var y;return(y=x.current)==null?void 0:y.focus()},50))},[t]);const g=async()=>{if(d)return;const y=n.trim().toUpperCase();if(!LX.test(y)){u("Use a code like COMP-FOO-1");return}if(!s.trim()){u("Description is required");return}f(!0),u("");try{const k=await vt("/api/features/scaffold",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:y,description:s.trim(),phase:a.trim()||void 0})}),b=await k.json();if(!k.ok)throw new Error(b.error||`HTTP ${k.status}`);m({code:b.code,featurePath:b.featurePath}),r==null||r(b)}catch(k){u(k.message||"Failed to create feature")}finally{f(!1)}};return l.jsx(xc,{open:t,onOpenChange:y=>!y&&e(),children:l.jsxs(yc,{className:"max-w-lg",children:[l.jsx(bc,{children:l.jsxs(Cc,{className:"flex items-center gap-2",children:[l.jsx(l_,{className:"w-4 h-4 text-accent"}),"New Feature"]})}),p?l.jsxs("div",{className:"px-6 pb-2 flex flex-col items-center gap-3 py-4 text-center",children:[l.jsx("div",{className:"w-10 h-10 rounded-full bg-emerald-400/20 flex items-center justify-center",children:l.jsx(Cs,{className:"w-5 h-5 text-emerald-400"})}),l.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Created!"}),l.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[l.jsx("span",{className:"font-mono text-accent font-semibold",children:p.code}),p.featurePath&&l.jsxs(l.Fragment,{children:[" · ",l.jsx("span",{className:"font-mono",children:p.featurePath})]})]}),l.jsx(At,{size:"sm",onClick:e,className:"mt-1",children:"Close"})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-6 pb-2 space-y-3",children:[l.jsxs("label",{className:"block",children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold block mb-1.5",children:"Feature Code"}),l.jsx("input",{ref:x,type:"text",value:n,onChange:y=>{i(y.target.value.toUpperCase()),u("")},onKeyDown:y=>{y.key==="Enter"&&g()},placeholder:"e.g. COMP-FOO-1",className:"w-full text-sm bg-muted text-foreground px-3 py-2 rounded-md border border-border outline-none focus:border-ring font-mono"})]}),l.jsxs("label",{className:"block",children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold block mb-1.5",children:"Description"}),l.jsx("input",{type:"text",value:s,onChange:y=>{o(y.target.value),u("")},onKeyDown:y=>{y.key==="Enter"&&g()},placeholder:"One-line description for the ROADMAP cell",className:"w-full text-sm bg-muted text-foreground px-3 py-2 rounded-md border border-border outline-none focus:border-ring"})]}),l.jsxs("label",{className:"block",children:[l.jsxs("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold block mb-1.5",children:["Phase ",l.jsx("span",{className:"opacity-60 normal-case",children:"(optional)"})]}),l.jsx("input",{type:"text",value:a,onChange:y=>c(y.target.value),placeholder:"Phase heading (default: Backlog)",className:"w-full text-sm bg-muted text-foreground px-3 py-2 rounded-md border border-border outline-none focus:border-ring"})]}),h&&l.jsx("p",{className:"text-[11px] text-destructive",children:h})]}),l.jsxs(Hd,{children:[l.jsx(At,{variant:"ghost",size:"sm",onClick:e,disabled:d,children:"Cancel"}),l.jsx(At,{size:"sm",onClick:g,disabled:d,children:d?"Creating…":"Create Feature"})]})]})]})})}const XS=[["what_happened","What happened"],["what_we_built","What we built"],["what_we_learned","What we learned"],["open_threads","Open threads"]],M0={summary:"",feature_code:"",what_happened:"",what_we_built:"",what_we_learned:"",open_threads:""};function AX(){const[t,e]=C.useState("journal"),[r,n]=C.useState(""),[i,s]=C.useState([]),[o,a]=C.useState(!0),[c,h]=C.useState(null),[u,d]=C.useState(!1),[f,p]=C.useState(M0),[m,x]=C.useState(!1),g=C.useRef(0),y=C.useCallback(async()=>{const w=++g.current;a(!0),h(null);try{const _=new URLSearchParams;r.trim()&&_.set("feature",r.trim());const T=_.toString(),S=await vt(`/api/${t}${T?`?${T}`:""}`);if(!S.ok)throw new Error(`fetch failed (${S.status})`);const L=await S.json();if(w!==g.current)return;s(L.entries||[])}catch(_){if(w!==g.current)return;h(_.message||String(_)),s([])}finally{w===g.current&&a(!1)}},[t,r]);C.useEffect(()=>{y()},[y]);const k=C.useRef(y);C.useEffect(()=>{k.current=y},[y]);const b=async()=>{x(!0);try{const w=await vt("/api/journal",{method:"POST",headers:Mr({"Content-Type":"application/json"}),body:JSON.stringify({summary:f.summary,...f.feature_code.trim()?{feature_code:f.feature_code.trim()}:{},sections:{what_happened:f.what_happened,what_we_built:f.what_we_built,what_we_learned:f.what_we_learned,open_threads:f.open_threads}})});if(!w.ok){let _=`journal write failed (${w.status})`;try{const T=await w.json();T!=null&&T.error&&(_=T.error)}catch{}throw new Error(_)}se("Journal entry written","info"),p(M0),d(!1),k.current()}catch(w){se(w.message||String(w),"error")}finally{x(!1)}};return l.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2 border-b border-border shrink-0",children:[l.jsx("div",{className:"flex rounded overflow-hidden border border-border",role:"group","aria-label":"Source",children:["journal","changelog"].map(w=>l.jsx("button",{type:"button",onClick:()=>e(w),className:nt("text-xs px-2 py-0.5 h-6 capitalize cursor-pointer",t===w?"bg-muted text-foreground":"bg-transparent text-muted-foreground hover:text-foreground"),children:w},w))}),l.jsx("input",{type:"text",placeholder:"Filter by feature code…","aria-label":"Feature filter",value:r,onChange:w=>n(w.target.value),className:"text-xs px-2 py-0.5 h-6 rounded bg-muted text-foreground border border-border w-44 font-mono"}),l.jsx("button",{type:"button",onClick:y,title:"Refresh",className:"text-xs px-1.5 py-0.5 h-6 rounded bg-muted text-muted-foreground border border-border hover:text-foreground cursor-pointer",children:l.jsx(Po,{className:"h-3 w-3"})}),l.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[i.length," entries"]}),t==="journal"&&l.jsxs("button",{type:"button",onClick:()=>d(w=>(w||p(_=>({..._,feature_code:_.feature_code||r.trim()})),!w)),className:"ml-auto flex items-center gap-1 text-xs px-2 py-0.5 h-6 rounded bg-muted text-foreground border border-border hover:bg-accent cursor-pointer",children:[l.jsx(yl,{className:"h-3 w-3"}),"New entry"]})]}),u&&t==="journal"&&l.jsxs("div",{className:"px-3 py-2 border-b border-border shrink-0 space-y-1.5","data-testid":"journal-write-form",children:[l.jsx("input",{type:"text",placeholder:"Summary (one line)","aria-label":"Summary",value:f.summary,onChange:w=>p(_=>({..._,summary:w.target.value})),className:"text-xs px-2 py-1 rounded bg-muted text-foreground border border-border w-full"}),l.jsx("input",{type:"text",placeholder:"Feature code (optional)","aria-label":"Feature code",value:f.feature_code,onChange:w=>p(_=>({..._,feature_code:w.target.value})),className:"text-xs px-2 py-1 rounded bg-muted text-foreground border border-border w-full font-mono"}),XS.map(([w,_])=>l.jsx("textarea",{placeholder:_,"aria-label":_,rows:2,value:f[w],onChange:T=>p(S=>({...S,[w]:T.target.value})),className:"text-xs px-2 py-1 rounded bg-muted text-foreground border border-border w-full resize-y"},w)),l.jsxs("div",{className:"flex gap-1.5",children:[l.jsx("button",{type:"button",disabled:m,onClick:b,className:"text-xs px-2 py-0.5 rounded bg-blue-600 text-white hover:bg-blue-500 disabled:opacity-50 cursor-pointer",children:m?"Writing…":"Write entry"}),l.jsx("button",{type:"button",onClick:()=>d(!1),className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground border border-border cursor-pointer",children:"Cancel"})]})]}),l.jsxs("div",{className:"flex-1 overflow-auto",children:[o&&l.jsx("div",{className:"py-8 text-center text-[11px] text-muted-foreground",children:"Loading…"}),!o&&c&&l.jsx("div",{className:"py-8 text-center text-[11px] text-red-400",children:c}),!o&&!c&&i.length===0&&l.jsx(aa,{icon:V0,title:t==="journal"?"No journal entries":"No changelog entries",description:t==="journal"?"Journal entries appear as sessions are written up":"Changelog entries appear as features ship",className:"py-8"}),!o&&!c&&t==="journal"&&i.map(w=>l.jsx(MX,{entry:w},w.path||`${w.date}-${w.slug}`)),!o&&!c&&t==="changelog"&&i.map((w,_)=>l.jsx(IX,{entry:w},`${w.line_number??_}`))]})]})}function MX({entry:t}){return l.jsxs("div",{className:"px-3 py-2.5 border-b border-border/50",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:t.date}),l.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["Session ",t.session_number]}),t.feature_code&&l.jsx(Es,{kind:"feature",id:t.feature_code})]}),t.summary&&l.jsx("div",{className:"text-xs text-foreground mt-0.5 font-medium",children:t.summary}),l.jsx("div",{className:"mt-1.5 space-y-1.5",children:XS.map(([e,r])=>{var n;return(n=t.sections)!=null&&n[e]?l.jsxs("div",{children:[l.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:r}),l.jsx(eh,{content:t.sections[e],className:"prose prose-invert prose-sm max-w-none text-xs"})]},e):null})}),t.closing_line&&l.jsx("div",{className:"mt-1.5 text-[11px] italic text-muted-foreground",children:t.closing_line})]})}function IX({entry:t}){return l.jsxs("div",{className:"px-3 py-2.5 border-b border-border/50",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:t.date_or_version}),t.code&&l.jsx(Es,{kind:"feature",id:t.code})]}),t.summary&&l.jsx("div",{className:"text-xs text-foreground mt-0.5 font-medium",children:t.summary}),t.body&&l.jsx("div",{className:"mt-1",children:l.jsx(eh,{content:t.body,className:"prose prose-invert prose-sm max-w-none text-xs"})})]})}const FX=["A","B","C","D","E","F","G","H"];function PX({card:t,recommended:e=!1,selected:r=!1,disabled:n=!1,onSelect:i}){var a;const s=parseInt(t.id,10),o=Number.isFinite(s)?FX[s]??t.id:t.id;return l.jsxs("button",{type:"button",disabled:n,onClick:()=>i==null?void 0:i(t.id),className:["relative w-full text-left rounded-lg border p-3 transition-colors cursor-pointer","bg-card",r?"border-accent":"border-border hover:border-foreground",n&&"opacity-50 pointer-events-none"].filter(Boolean).join(" "),children:[(r||e)&&l.jsx("span",{className:"absolute top-2 right-2 text-accent",children:r?l.jsx(Cs,{style:{width:14,height:14}}):l.jsx(rj,{style:{width:14,height:14}})}),l.jsxs("span",{className:"block text-[12px] font-bold text-foreground",children:[o,". ",t.title]}),((a=t.bullets)==null?void 0:a.length)>0&&l.jsx("ul",{className:"mt-1.5 space-y-0.5 list-none pl-0",children:t.bullets.map((c,h)=>l.jsxs("li",{className:"text-[11px] text-muted-foreground leading-snug",children:[l.jsx("span",{className:"mr-1",children:"•"}),c]},h))})]})}function $X(){var R;const{session:t,messages:e,decisions:r,status:n,error:i,streamingMessage:s,designDocPath:o,hydrate:a,startSession:c,sendMessage:h,selectCard:u,completeDesign:d,connectSSE:f,disconnectSSE:p,reset:m}=Ln(),[x,g]=C.useState(""),[y,k]=C.useState(null),[b,w]=C.useState(""),_=C.useRef(null),T=W0();C.useEffect(()=>(Ln.setState({scope:null,featureCode:null}),a(),()=>p()),[]),C.useEffect(()=>{var z;(z=_.current)==null||z.scrollIntoView({behavior:"smooth"})},[e,s]);const S=C.useCallback(()=>{x.trim()&&(h(x.trim()),g(""))},[x,h]),L=C.useCallback((z,P)=>{k({messageIndex:P,cardId:z})},[]),B=C.useCallback(()=>{y&&(u(y.cardId,b||null,y.messageIndex),k(null),w(""))},[y,b,u]),N=n==="streaming"||n==="summarizing",A=e.reduce((z,P,I)=>P.role==="assistant"&&P.content&&OS(P.content).parts.some(F=>F.type==="decision")?I:z,-1);return t?l.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[i&&l.jsx("div",{className:"px-3 py-1.5 text-[11px] text-red-400 bg-red-500/10 border-b border-red-500/20 shrink-0",children:i}),n==="complete"&&l.jsxs("div",{className:"px-3 py-2 text-[11px] bg-green-500/10 border-b border-green-500/20 shrink-0 flex items-center gap-2",children:[l.jsx($f,{style:{width:12,height:12},className:"text-green-400"}),l.jsx("span",{className:"text-green-400 font-medium",children:"Design complete."}),o&&l.jsxs("span",{className:"text-muted-foreground",children:["Document written to ",l.jsx("code",{className:"text-foreground",children:o})]}),l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:()=>{m()},className:"px-2 py-1 text-[10px] font-medium rounded border border-border text-muted-foreground hover:text-foreground hover:border-foreground transition-colors",children:"New Session"})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[e.map((z,P)=>l.jsx(I0,{messageIndex:P,message:z,onCardSelect:L,selectedCard:y,isStreaming:N,cardsDisabled:N||P!==A},P)),s&&l.jsx(I0,{message:s,onCardSelect:L,selectedCard:y,isStreaming:N}),!i&&(n==="active"||n==="streaming")&&!s&&e.length>0&&((R=e[e.length-1])==null?void 0:R.role)==="human"&&l.jsx("div",{className:"flex justify-start",role:"status","aria-live":"polite",children:l.jsxs("div",{className:"flex items-center gap-2 rounded-lg px-3 py-2 bg-muted text-muted-foreground text-[12px]",children:[l.jsx("div",{className:"w-3 h-3 rounded-full animate-spin",style:{border:"2px solid hsl(var(--muted-foreground) / 0.2)",borderTopColor:"hsl(var(--muted-foreground))"}}),l.jsx("span",{children:"Agent thinking..."})]})}),n==="summarizing"&&l.jsx("div",{className:"flex justify-start",role:"status","aria-live":"polite",children:l.jsxs("div",{className:"flex items-center gap-2 rounded-lg px-3 py-2 bg-muted text-muted-foreground text-[12px]",children:[l.jsx("div",{className:"w-3 h-3 rounded-full animate-spin",style:{border:"2px solid hsl(var(--muted-foreground) / 0.2)",borderTopColor:"hsl(var(--muted-foreground))"}}),l.jsx("span",{children:"Generating design document..."})]})}),l.jsx("div",{ref:_})]}),n!=="complete"&&l.jsxs("div",{className:"border-t border-border p-3 shrink-0",children:[y?l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Selected: ",l.jsx("span",{className:"font-semibold text-foreground",children:y.cardId})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{type:"text",value:b,onChange:z=>w(z.target.value),onKeyDown:z=>z.key==="Enter"&&B(),placeholder:"Add a comment (optional)...",className:"flex-1 bg-muted border border-border rounded px-3 py-1.5 text-[12px] text-foreground placeholder:text-muted-foreground outline-none focus:border-accent"}),l.jsx("button",{onClick:B,disabled:N,className:"px-3 py-1.5 text-[11px] font-medium rounded bg-accent text-accent-foreground hover:opacity-90 transition-opacity disabled:opacity-50",children:"Send"}),l.jsx("button",{onClick:()=>{k(null),w("")},className:"px-3 py-1.5 text-[11px] rounded border border-border text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"})]})]}):l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{type:"text",value:x,onChange:z=>g(z.target.value),onKeyDown:z=>z.key==="Enter"&&!z.shiftKey&&S(),placeholder:N?"Waiting for response...":"Type a response...",disabled:N,className:"flex-1 bg-muted border border-border rounded px-3 py-1.5 text-[12px] text-foreground placeholder:text-muted-foreground outline-none focus:border-accent disabled:opacity-50"}),l.jsx("button",{onClick:S,disabled:N||!x.trim(),className:"px-3 py-1.5 rounded bg-accent text-accent-foreground disabled:opacity-50 transition-opacity",children:l.jsx(Xd,{style:{width:14,height:14}})})]}),n==="active"&&r.length>=2&&l.jsxs("button",{onClick:d,className:"mt-2 w-full py-1.5 text-[11px] font-medium rounded border border-border text-muted-foreground hover:text-foreground hover:border-foreground transition-colors flex items-center justify-center gap-1.5",children:[l.jsx($f,{style:{width:12,height:12}}),"Complete Design"]})]})]}):l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-8",children:[l.jsx(kc,{className:"text-muted-foreground",style:{width:48,height:48}}),l.jsx("h2",{className:"text-[14px] font-semibold text-foreground",children:"Start a Design Conversation"}),l.jsx("p",{className:"text-[12px] text-muted-foreground text-center max-w-md",children:"Have an interactive design conversation with the AI. It will ask questions, present options with trade-offs, and build a design document from your decisions."}),i&&l.jsx("p",{className:"text-[11px] text-red-400 text-center max-w-md",children:i}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:()=>c("product"),className:"px-4 py-2 text-[11px] font-medium rounded bg-accent text-accent-foreground hover:opacity-90 transition-opacity",children:"Product Design"}),l.jsx("button",{onClick:async()=>{const z=await T({title:"Feature code",required:!0});z&&c("feature",z)},className:"px-4 py-2 text-[11px] font-medium rounded border border-border text-foreground hover:bg-muted transition-colors",children:"Feature Design"})]})]})}function I0({message:t,messageIndex:e,onCardSelect:r,selectedCard:n,isStreaming:i,cardsDisabled:s}){var c,h;const o=t.role==="human",a=!o&&t.content?OS(t.content):null;return l.jsx("div",{className:nt("flex",o?"justify-end":"justify-start"),children:l.jsx("div",{className:nt("max-w-[85%] rounded-lg px-3 py-2 text-[12px]",o?"bg-accent/20 text-foreground":"bg-muted text-foreground"),children:o?l.jsx("div",{children:t.type==="card_select"?l.jsxs("span",{children:["Selected ",l.jsx("strong",{children:(c=t.content)==null?void 0:c.cardId}),(h=t.content)!=null&&h.comment?`: ${t.content.comment}`:""]}):l.jsx("span",{children:t.content})}):a?l.jsx("div",{className:"space-y-3",children:a.parts.map((u,d)=>{var f,p;return u.type==="text"?l.jsx("div",{className:"whitespace-pre-wrap",children:u.content},d):l.jsxs("div",{className:"space-y-2",children:[l.jsx("div",{className:"flex flex-col gap-2 mt-2",children:(f=u.content.options)==null?void 0:f.map(m=>{var x;return l.jsx(PX,{card:m,recommended:((x=u.content.recommendation)==null?void 0:x.id)===m.id,selected:(n==null?void 0:n.messageIndex)===e&&(n==null?void 0:n.cardId)===m.id,disabled:s,onSelect:g=>r(g,e)},m.id)})}),((p=u.content.recommendation)==null?void 0:p.rationale)&&l.jsx("div",{className:"text-[11px] text-muted-foreground italic mt-1",children:u.content.recommendation.rationale})]},d)})}):l.jsx("div",{className:"whitespace-pre-wrap",children:t.content})})})}const DX=new Set(["Read","Grep","Glob","read_file","search_files","list_directory"]),OX=new Set(["WebSearch","web_search"]);function RX({expanded:t}){return l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",style:{transform:t?"rotate(90deg)":"rotate(0deg)",transition:"transform 150ms ease",flexShrink:0},children:l.jsx("path",{d:"M3 2L7 5L3 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function zX(){return l.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",style:{flexShrink:0},children:[l.jsx("circle",{cx:"5",cy:"5",r:"4",stroke:"hsl(var(--accent))",strokeWidth:"1.2"}),l.jsx("path",{d:"M3 5l1.5 1.5L7 3.5",stroke:"hsl(var(--accent))",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function qX(){return l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",style:{flexShrink:0},children:l.jsx("circle",{cx:"5",cy:"5",r:"4",stroke:"hsl(var(--muted-foreground))",strokeWidth:"1.2"})})}function gu({title:t,count:e,defaultExpanded:r,children:n}){const[i,s]=C.useState(r);return l.jsxs("div",{className:"border-b",style:{borderColor:"hsl(var(--sidebar-border))"},children:[l.jsxs("button",{onClick:()=>s(o=>!o),className:"flex items-center gap-1.5 w-full px-3 py-2 text-left transition-colors hover:bg-sidebar-accent/30",children:[l.jsx(RX,{expanded:i}),l.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider flex-1",style:{color:"hsl(var(--muted-foreground))"},children:t}),e>0&&l.jsx("span",{className:"text-[9px] min-w-[14px] h-3.5 flex items-center justify-center rounded-full px-1 tabular-nums",style:{background:"hsl(var(--accent) / 0.12)",color:"hsl(var(--accent))"},children:e})]}),i&&l.jsx("div",{className:"pb-1",children:n})]})}function Ja(t,e=80){return t?t.length>e?t.slice(0,e)+"…":t:""}function F0(t,e){return e?typeof e=="string"?e:e.path||e.pattern||e.query||e.file_path||JSON.stringify(e).slice(0,60):""}function WX({researchItems:t=[],topicOutline:e=[]}){const r=t.filter(o=>DX.has(o.tool)),n=t.filter(o=>OX.has(o.tool)),i=[...r].reverse(),s=[...n].reverse();return l.jsx(An,{className:"flex-1",children:l.jsxs("div",{children:[l.jsx(gu,{title:"Topic Outline",count:e.length,defaultExpanded:e.length>0,children:e.length===0?l.jsx("p",{className:"px-3 py-2 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:"No topics yet"}):l.jsx("ul",{className:"px-3 space-y-1 pt-0.5",children:e.map((o,a)=>l.jsxs("li",{className:"flex items-start gap-1.5 py-0.5",children:[l.jsx("span",{className:"mt-0.5",children:o.decided?l.jsx(zX,{}):l.jsx(qX,{})}),l.jsx("span",{className:"text-[11px] leading-snug",style:{color:o.decided?"hsl(var(--foreground))":"hsl(var(--muted-foreground))"},children:o.title})]},a))})}),l.jsx(gu,{title:"Codebase Refs",count:r.length,defaultExpanded:r.length>0,children:r.length===0?l.jsx("p",{className:"px-3 py-2 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:"No file references yet"}):l.jsx("ul",{className:"px-2 space-y-1 pt-0.5",children:i.map((o,a)=>l.jsxs("li",{className:"px-2 py-1.5 rounded-md",style:{background:"hsl(var(--sidebar-accent) / 0.3)"},children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"text-[9px] font-medium uppercase tracking-wider px-1 rounded",style:{background:"hsl(var(--accent) / 0.12)",color:"hsl(var(--accent))"},children:o.tool}),l.jsx("span",{className:"text-[10px] font-mono leading-tight truncate flex-1",style:{color:"hsl(var(--foreground))"},title:typeof o.input=="string"?o.input:JSON.stringify(o.input),children:Ja(F0(o.tool,o.input),50)})]}),o.summary&&l.jsx("p",{className:"text-[10px] leading-snug mt-1",style:{color:"hsl(var(--muted-foreground))"},children:Ja(o.summary,100)})]},a))})}),l.jsx(gu,{title:"Web Searches",count:n.length,defaultExpanded:n.length>0,children:n.length===0?l.jsx("p",{className:"px-3 py-2 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:"No web searches yet"}):l.jsx("ul",{className:"px-2 space-y-1 pt-0.5",children:s.map((o,a)=>l.jsxs("li",{className:"px-2 py-1.5 rounded-md",style:{background:"hsl(var(--sidebar-accent) / 0.3)"},children:[l.jsx("p",{className:"text-[10px] font-medium leading-snug",style:{color:"hsl(var(--foreground))"},children:Ja(F0(o.tool,o.input),80)}),o.summary&&l.jsx("p",{className:"text-[10px] leading-snug mt-1",style:{color:"hsl(var(--muted-foreground))"},children:Ja(o.summary,100)})]},a))})})]})})}function HX({decisions:t=[],onReviseDecision:e,sessionComplete:r=!1,widthPx:n}){const[i,s]=C.useState("decisions"),o=t.filter(h=>!h.superseded).length,a=Ln(h=>h.researchItems)||[],c=Ln(h=>h.topicOutline)||[];return l.jsxs("aside",{className:"shrink-0 flex flex-col bg-sidebar border-r border-sidebar-border",style:{width:n??208},children:[l.jsx("div",{className:"p-3 pb-0",children:l.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"hsl(var(--foreground))"},children:"Design"})}),l.jsxs("div",{className:"flex px-2 pt-2 gap-1",style:{borderBottom:"1px solid hsl(var(--sidebar-border))"},children:[l.jsxs("button",{onClick:()=>s("decisions"),className:"flex items-center gap-1 px-2 py-1.5 text-[11px] font-medium transition-colors",style:{color:i==="decisions"?"hsl(var(--foreground))":"hsl(var(--muted-foreground))",borderBottom:i==="decisions"?"2px solid hsl(var(--accent))":"2px solid transparent",marginBottom:"-1px"},children:["Decisions",o>0&&l.jsx("span",{className:"text-[9px] min-w-[14px] h-3.5 flex items-center justify-center rounded-full px-1 tabular-nums",style:{background:"hsl(var(--accent) / 0.15)",color:"hsl(var(--accent))"},children:o})]}),l.jsxs("button",{onClick:()=>s("research"),className:"flex items-center gap-1 px-2 py-1.5 text-[11px] font-medium transition-colors",style:{color:i==="research"?"hsl(var(--foreground))":"hsl(var(--muted-foreground))",borderBottom:i==="research"?"2px solid hsl(var(--accent))":"2px solid transparent",marginBottom:"-1px"},children:["Research",a.length>0&&l.jsx("span",{className:"text-[9px] min-w-[14px] h-3.5 flex items-center justify-center rounded-full px-1 tabular-nums",style:{background:"hsl(var(--accent) / 0.15)",color:"hsl(var(--accent))"},children:a.length})]})]}),i==="decisions"&&l.jsx(An,{className:"flex-1",children:t.length===0?l.jsx("div",{className:"px-3 py-6 text-center text-[11px]",style:{color:"hsl(var(--muted-foreground))"},children:"No decisions yet"}):l.jsx("div",{className:"px-2 pb-2 pt-1",children:t.map((h,u)=>{var d;return l.jsxs("button",{disabled:h.superseded||r,onClick:()=>!h.superseded&&!r&&(e==null?void 0:e(u)),className:`flex flex-col w-full text-left rounded-md px-2 py-1.5 transition-colors ${h.superseded||r?"cursor-not-allowed opacity-40":"cursor-pointer hover:bg-sidebar-accent/50"}`,children:[l.jsx("span",{className:"text-[11px] font-medium leading-tight",style:{color:"hsl(var(--foreground))",textDecoration:h.superseded?"line-through":void 0},children:((d=h.selectedOption)==null?void 0:d.title)||h.question}),h.comment&&l.jsx("span",{className:"text-[10px] leading-snug mt-0.5",style:{color:"hsl(var(--muted-foreground))"},children:h.comment}),h.superseded&&l.jsx("span",{className:"text-[9px] mt-0.5 uppercase tracking-wider font-medium",style:{color:"hsl(var(--muted-foreground))"},children:"superseded"})]},u)})})}),i==="research"&&l.jsx(WX,{researchItems:a,topicOutline:c})]})}function UX(t){return[...t].sort((e,r)=>Date.parse(e.created_at)-Date.parse(r.created_at))}function VX(t,e){const r=(e??Date.now())-Date.parse(t);if(r<0)return"0m";const n=Math.floor(r/6e4);if(n<60)return`${n}m`;const i=Math.floor(r/36e5);return i<24?`${i}h`:`${Math.floor(r/864e5)}d`}function YX(t,e){if(t.resolution)return!1;const r=t.ttl_days??90;return(e??Date.now())-Date.parse(t.created_at)>r*24*60*60*1e3}const GX=320,XX=40,KX={deferred:"Deferred",blocked:"Blocked",open_question:"Question"};function KS(t){return t?`compose:${t}:openLoopsCollapsed`:null}function P0(t){const e=KS(t);if(!e)return!1;try{return localStorage.getItem(e)==="true"}catch{return!1}}function QX(t,e){const r=KS(t);if(r)try{localStorage.setItem(r,e?"true":"false")}catch{}}function ZX({onConfirm:t,onCancel:e}){const[r,n]=C.useState("deferred"),[i,s]=C.useState(""),[o,a]=C.useState(""),c=h=>{h.preventDefault(),i.trim()&&t({kind:r,summary:i.trim(),ttl_days:o?parseInt(o,10):void 0})};return l.jsx("div",{"data-testid":"add-loop-modal",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:h=>{h.target===h.currentTarget&&e()},children:l.jsxs("form",{onSubmit:c,style:{background:"#1e1e2e",borderRadius:8,padding:24,width:360,display:"flex",flexDirection:"column",gap:12},children:[l.jsx("h3",{style:{margin:0,color:"#cdd6f4",fontSize:14},children:"Add Open Loop"}),l.jsxs("label",{style:{color:"#a6adc8",fontSize:12},children:["Kind",l.jsxs("select",{value:r,onChange:h=>n(h.target.value),style:{display:"block",width:"100%",marginTop:4,background:"#313244",color:"#cdd6f4",border:"1px solid #45475a",borderRadius:4,padding:"4px 8px"},children:[l.jsx("option",{value:"deferred",children:"Deferred"}),l.jsx("option",{value:"blocked",children:"Blocked"}),l.jsx("option",{value:"open_question",children:"Open Question"})]})]}),l.jsxs("label",{style:{color:"#a6adc8",fontSize:12},children:["Summary (max 280 chars)",l.jsx("textarea",{"data-testid":"add-loop-summary",value:i,onChange:h=>s(h.target.value),maxLength:280,rows:3,required:!0,style:{display:"block",width:"100%",marginTop:4,background:"#313244",color:"#cdd6f4",border:"1px solid #45475a",borderRadius:4,padding:"4px 8px",resize:"vertical",boxSizing:"border-box"}})]}),l.jsxs("label",{style:{color:"#a6adc8",fontSize:12},children:["TTL days (optional, default 90)",l.jsx("input",{type:"number",value:o,onChange:h=>a(h.target.value),min:1,style:{display:"block",width:"100%",marginTop:4,background:"#313244",color:"#cdd6f4",border:"1px solid #45475a",borderRadius:4,padding:"4px 8px",boxSizing:"border-box"}})]}),l.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:4},children:[l.jsx("button",{type:"button",onClick:e,style:{padding:"6px 16px",background:"#313244",color:"#cdd6f4",border:"1px solid #45475a",borderRadius:4,cursor:"pointer"},children:"Cancel"}),l.jsx("button",{type:"submit","data-testid":"add-loop-submit",style:{padding:"6px 16px",background:"#89b4fa",color:"#1e1e2e",border:"none",borderRadius:4,cursor:"pointer",fontWeight:600},children:"Add"})]})]})})}function JX({loop:t,onResolve:e,nowMs:r}){const n=YX(t,r),i=!!t.resolution;return l.jsxs("div",{"data-testid":`loop-row-${t.id}`,style:{padding:"8px 12px",borderBottom:"1px solid #313244",opacity:i?.5:1},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[l.jsx("span",{style:{fontSize:10,color:"#6c7086",background:"#313244",borderRadius:3,padding:"1px 5px"},children:KX[t.kind]||t.kind}),n&&!i&&l.jsx("span",{"data-testid":`stale-badge-${t.id}`,style:{fontSize:10,color:"#f38ba8",background:"#3e1111",borderRadius:3,padding:"1px 5px"},children:">TTL"}),l.jsxs("span",{style:{marginLeft:"auto",display:"inline-flex",alignItems:"center",gap:6},children:[t.parent_feature&&l.jsx(Es,{kind:"feature",id:t.parent_feature,label:t.parent_feature,className:"text-[10px]"}),l.jsx("span",{style:{fontSize:10,color:"#6c7086"},children:VX(t.created_at,r)})]})]}),l.jsx("p",{style:{margin:"4px 0 6px",fontSize:12,color:n&&!i?"#f38ba8":"#cdd6f4",lineHeight:1.4},children:t.summary}),!i&&l.jsx("button",{"data-testid":`resolve-btn-${t.id}`,onClick:()=>e(t.id),style:{fontSize:11,padding:"3px 10px",background:"#313244",color:"#a6e3a1",border:"1px solid #a6e3a1",borderRadius:3,cursor:"pointer"},children:"Resolve"}),i&&l.jsx("span",{style:{fontSize:11,color:"#a6e3a1"},children:"Resolved"})]})}function tK({featureCode:t,items:e=[],onAddLoop:r,onResolveLoop:n}){var y,k;const i=W0(),[s,o]=C.useState(()=>P0(t)),[a,c]=C.useState(!1),[h,u]=C.useState(()=>Date.now());C.useEffect(()=>{const b=setInterval(()=>u(Date.now()),6e4);return()=>clearInterval(b)},[]),C.useEffect(()=>{o(P0(t))},[t]);const d=C.useCallback(()=>{o(b=>{const w=!b;return QX(t,w),w})},[t]),f=C.useMemo(()=>!t||!e?null:e.find(b=>{var w;return((w=b.lifecycle)==null?void 0:w.featureCode)===t})??null,[t,e]),p=((k=(y=f==null?void 0:f.lifecycle)==null?void 0:y.lifecycle_ext)==null?void 0:k.open_loops)??[],m=C.useMemo(()=>UX(p.filter(b=>b.resolution==null)),[p]),x=C.useCallback(async b=>{if(c(!1),r)try{await r(t,b)}catch(w){console.error("[OpenLoopsPanel] addLoop failed:",w.message),se(`Could not add loop: ${w.message}`,"error")}},[t,r]),g=C.useCallback(async b=>{if(n){const w=await i({title:"Resolve note",label:"(optional)"});if(w===null)return;try{await n(t,b,{note:w})}catch(_){console.error("[OpenLoopsPanel] resolveLoop failed:",_.message),se(`Could not resolve loop: ${_.message}`,"error")}}},[t,n,i]);return t?s?l.jsxs("div",{"data-testid":"open-loops-panel-collapsed",style:{width:XX,background:"#181825",display:"flex",flexDirection:"column",alignItems:"center",paddingTop:12,borderLeft:"1px solid #313244",flexShrink:0},children:[l.jsx("button",{"data-testid":"open-loops-expand-btn",onClick:d,title:`Open loops (${m.length})`,style:{background:"none",border:"none",cursor:"pointer",color:"#a6adc8",fontSize:18},children:"↺"}),m.length>0&&l.jsx("span",{style:{fontSize:10,color:"#f5c2e7",marginTop:4},children:m.length})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{"data-testid":"open-loops-panel",style:{width:GX,background:"#181825",display:"flex",flexDirection:"column",borderLeft:"1px solid #313244",flexShrink:0,overflow:"hidden"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"8px 12px",borderBottom:"1px solid #313244",gap:8},children:[l.jsxs("span",{style:{fontSize:12,fontWeight:600,color:"#cdd6f4",flex:1},children:["Open Loops ",m.length>0&&l.jsxs("span",{style:{color:"#a6adc8"},children:["(",m.length,")"]})]}),l.jsx("button",{"data-testid":"add-loop-btn",onClick:()=>c(!0),title:"Add open loop",style:{background:"none",border:"1px solid #45475a",color:"#a6e3a1",borderRadius:4,padding:"2px 8px",cursor:"pointer",fontSize:12},children:"+"}),l.jsx("button",{"data-testid":"open-loops-collapse-btn",onClick:d,title:"Collapse",style:{background:"none",border:"none",cursor:"pointer",color:"#6c7086",fontSize:16},children:"›"})]}),l.jsx("div",{style:{flex:1,overflowY:"auto"},children:m.length===0?l.jsxs("div",{"data-testid":"open-loops-empty",style:{padding:"16px 12px",color:"#6c7086",fontSize:12,textAlign:"center"},children:["No open loops for this feature",l.jsx("br",{}),l.jsx("button",{onClick:()=>c(!0),style:{marginTop:8,background:"none",border:"1px solid #45475a",color:"#a6adc8",borderRadius:4,padding:"3px 10px",cursor:"pointer",fontSize:11},children:"+ Add loop"})]}):m.map(b=>l.jsx(JX,{loop:b,onResolve:g,nowMs:h},b.id))})]}),a&&l.jsx(ZX,{onConfirm:x,onCancel:()=>c(!1)})]}):null}const Fi={building:"building",gate_pending:"gate_pending",blocked_downstream:"blocked_downstream",error:"error"},eK=new Set(["blocks","informs"]);function $0(t,e){return t.find(r=>r.featureCode===e)||t.find(r=>r.title===e)||t.find(r=>r.title&&r.title.startsWith(e+":"))}function rK(t){return t.featureCode?t.featureCode:t.title&&t.title.includes(":")?t.title.split(":")[0].trim():t.title||t.id}function nK(t,e,r,n){if(!t)return{};const i={},{featureCode:s,status:o,currentStepId:a}=t;if(!s)return{};if(o==="failed")i[s]=Fi.error;else if(o==="running"){const h=a&&a.endsWith("_gate"),u=$0(e,s);h&&u&&n.some(f=>f.itemId===u.id&&!f.resolvedAt)?i[s]=Fi.gate_pending:i[s]=Fi.building}const c=$0(e,s);if(c&&(i[s]===Fi.building||i[s]===Fi.gate_pending)){const h=new Set([c.id]),u=iK(h,r),d=new Map(e.map(f=>[f.id,rK(f)]));for(const f of u){const p=d.get(f);p&&!i[p]&&(i[p]=Fi.blocked_downstream)}}return i}function iK(t,e){if(!t.size||!e.length)return new Set;const r=new Map;for(const o of e)eK.has(o.type)&&(r.has(o.fromId)||r.set(o.fromId,[]),r.get(o.fromId).push(o.toId));const n=new Set(t),i=[...t],s=new Set;for(;i.length>0;){const o=i.shift(),a=r.get(o)||[];for(const c of a)n.has(c)||(n.add(c),s.add(c),i.push(c))}return s}function sK(t,e){if(!t||!t.length)return{nodes:[],edges:[],activeEdgeIds:new Set};const r=[],n=new Map;r.push({data:{id:"agent-topology",label:"Agent Topology",isAgentGroup:!0}}),r.push({data:{id:"agent-session",label:"Session",isAgentNode:!0,agentType:"session",agentStatus:"running",agentColor:"#64748b",parent:"agent-topology"}});const i=new Set(t.map(c=>c.agentId));for(const c of t){const h=c.agentType||"claude",u=vj[h]||"#3b82f6";r.push({data:{id:`agent-${c.agentId}`,label:`${h}
724
- ${c.agentId.slice(0,6)}`,isAgentNode:!0,agentType:h,agentStatus:c.status||"running",agentColor:u,parent:"agent-topology"}});const f=c.parentSessionId&&i.has(c.parentSessionId)?`agent-${c.parentSessionId}`:"agent-session",p=`relay-${f}-agent-${c.agentId}`;n.has(p)||n.set(p,{data:{id:p,source:f,target:`agent-${c.agentId}`,isRelayEdge:!0}})}const s=Date.now()-3e4,o=new Set,a=c=>c==="session"?"agent-session":i.has(c)?`agent-${c}`:"agent-session";for(const c of e||[]){if(new Date(c.timestamp).getTime()<s)continue;const h=a(c.fromAgentId),u=a(c.toAgentId),d=c.direction==="dispatch"?`relay-${h}-${u}`:`relay-${u}-${h}`;o.add(d)}return{nodes:r,edges:[...n.values()],activeEdgeIds:o}}class mr extends Dt.Component{constructor(){super(...arguments);ee(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}render(){var r,n;return this.state.error?l.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center gap-3 p-4",style:{background:"hsl(var(--background))",color:"hsl(var(--muted-foreground))"},children:[l.jsx("div",{className:"text-xs uppercase tracking-wider font-semibold",style:{color:"hsl(var(--destructive))"},children:this.props.zone?`${this.props.zone} crashed`:"panel crashed"}),l.jsx("div",{className:"text-[11px] max-w-[300px] text-center opacity-70 font-mono",children:(n=(r=this.state.error)==null?void 0:r.message)==null?void 0:n.substring(0,120)}),l.jsx("button",{className:"mt-2 px-3 py-1 text-xs rounded border",style:{borderColor:"hsl(var(--border))",color:"hsl(var(--foreground))"},onClick:()=>this.setState({error:null}),children:"retry"})]}):this.props.children}}class oK extends Dt.Component{constructor(){super(...arguments);ee(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}render(){var r,n;return this.state.error?l.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[l.jsxs("div",{className:"h-8 flex items-center justify-between px-3 shrink-0",style:{borderBottom:"1px solid hsl(var(--border))",background:"hsl(var(--destructive) / 0.1)"},children:[l.jsxs("span",{className:"text-[10px] uppercase tracking-wider font-semibold",style:{color:"hsl(var(--destructive))"},children:["safe mode — UI crashed: ",(n=(r=this.state.error)==null?void 0:r.message)==null?void 0:n.substring(0,80)]}),l.jsx("button",{className:"px-2 py-0.5 text-[10px] rounded border",style:{borderColor:"hsl(var(--border))",color:"hsl(var(--foreground))"},onClick:()=>this.setState({error:null}),children:"retry"})]}),l.jsx("div",{className:"flex-1 min-h-0",children:l.jsx(cy,{})})]}):this.props.children}}const Dd="compose:fontSize",aK="compose:theme",Fo=13,Od=10,Rd=20;function lK(){try{const t=parseInt(localStorage.getItem(Dd),10);return t>=Od&&t<=Rd?t:Fo}catch{return Fo}}const D0=new URLSearchParams(window.location.search).get("popout");function cK(){return D0?l.jsx(jV,{path:D0}):l.jsx(oK,{children:l.jsx(uK,{})})}function hK({activeView:t,items:e,filteredItems:r,phaseFilteredItems:n,phaseFilteredGates:i,connections:s,filteredConnections:o,sessions:a,activeBuild:c,pipelineDraft:h,buildHistory:u,gates:d,settings:f,selectedPhase:p,selectedItemId:m,buildStateMap:x,agentOverlay:g,spawnedAgents:y,agentRelays:k,docsSelectedFile:b,onDocsSelectedFileChange:w,docsPreviousView:_,onDocsBack:T,visibleTracks:S,hiddenGroups:L,onSelect:B,onUpdate:N,onCreate:A,onCreateFeature:R,isEmptyProject:z,onDelete:P,onOpenGate:I,onCreateConnection:F,onDeleteConnection:$,onRefreshBuild:O,onSelectStep:D,onResolveGate:j,onUpdateSettings:Y,onResetSettings:et,projectRoot:M,featureCode:ct,focusActive:X,onToggleFocus:lt,sessionState:It,agentActivity:Pt,iterationStates:Ct,focusedGateId:G,onFocusHandled:it}){switch(t){case"dashboard":return l.jsx(cX,{items:n,gates:i,sessions:a,activeBuild:c,spawnedAgents:y,featureCode:ct,sessionState:It,agentActivity:Pt,iterationStates:Ct,onSelect:B,onResolveGate:j,onOpenGate:I,onCreateFeature:R,isEmptyProject:z});case"tree":return l.jsx(Fb,{items:r,connections:o,selectedItemId:m,onSelect:B,onCreate:A,onCreateFeature:R,isEmptyProject:z,featureCode:ct,focusActive:X,onToggleFocus:lt});case"graph":return l.jsx($b,{items:e,connections:s,selectedItemId:m,onSelect:B,onCreateFeature:R,isEmptyProject:z,visibleTracks:S,hiddenGroups:L,buildStateMap:x,resolveGate:j,gates:d,spawnedAgents:y,agentRelays:k,agentOverlay:g,featureCode:ct,focusActive:X,onToggleFocus:lt});case"pipeline":return l.jsx(kS,{activeBuild:c,pipelineDraft:h,onSelectStep:D,onRefresh:O});case"sessions":return l.jsx(jS,{sessions:a,items:e,onSelectItem:B,featureCode:ct,focusActive:X,onToggleFocus:lt});case"build-history":return l.jsx(FG,{builds:u,items:e,onSelectItem:B});case"gates":return l.jsx(xS,{gates:i,items:n,onResolve:j,onSelect:B,featureCode:ct,focusActive:X,onToggleFocus:lt,focusedGateId:G,onFocusHandled:it});case"validate":return l.jsx(NX,{featureCode:ct});case"docs":return l.jsx(mS,{items:n,selectedFile:b,onSelectedFileChange:w,previousView:_,onBack:T,featureCode:ct,focusActive:X,onToggleFocus:lt});case"design":return l.jsx($X,{},M);case"ideabox":return l.jsx(jX,{});case"qa-scope":return l.jsx(EX,{featureCode:ct});case"journal":return l.jsx(AX,{});case"settings":return l.jsx(CS,{settings:f,onSettingsChange:Y,onReset:et});case"stratum":return l.jsx(FV,{});default:return l.jsxs("div",{className:"flex-1 flex items-center justify-center text-[12px] text-muted-foreground italic",children:["View “",t,"” not found."]})}}function uK(){const{refresh:t}=q0(),e=Ln(U=>U.decisions),r=Ln(U=>U.status),[n,i]=C.useState(lK),[s,o]=C.useState(()=>document.documentElement.classList.contains("dark")),[a]=C.useState(NG),[c,h]=C.useState(()=>EG(a)),[u,d]=C.useState(YV),[f,p]=C.useState(LG),[m,x]=C.useState(AG),[g,y]=C.useState(null),[k,b]=C.useState(()=>{try{return parseInt(localStorage.getItem("compose:contextWidthPx"),10)||420}catch{return 420}}),[w,_]=C.useState(()=>{try{return parseInt(localStorage.getItem("compose:sidebarWidthPx"),10)||220}catch{return 220}}),{items:T,connections:S,connected:L,uiCommand:B,clearUICommand:N,recentChanges:A,createItem:R,updateItem:z,deleteItem:P,createConnection:I,deleteConnection:F,agentActivity:$,agentErrors:O,spawnedAgents:D,agentRelays:j,sessionState:Y,registerSnapshotProvider:et,gates:M,gateEvent:ct,resolveGate:X,settings:lt,updateSettings:It,resetSettings:Pt,activeBuild:Ct,setActiveBuild:G,pipelineDraft:it,sessions:kt,iterationStates:Tt,buildHistory:qt,fetchBuildHistory:Qt,selectedPhase:Gt,setSelectedPhase:Se,statusSnapshots:Xt,setStatusSnapshot:Ye}=lr(vi(U=>({items:U.items,connections:U.connections,connected:U.connected,uiCommand:U.uiCommand,clearUICommand:U.clearUICommand,recentChanges:U.recentChanges,createItem:U.createItem,updateItem:U.updateItem,deleteItem:U.deleteItem,createConnection:U.createConnection,deleteConnection:U.deleteConnection,agentActivity:U.agentActivity,agentErrors:U.agentErrors,spawnedAgents:U.spawnedAgents,agentRelays:U.agentRelays,sessionState:U.sessionState,registerSnapshotProvider:U.registerSnapshotProvider,gates:U.gates,gateEvent:U.gateEvent,resolveGate:U.resolveGate,settings:U.settings,updateSettings:U.updateSettings,resetSettings:U.resetSettings,activeBuild:U.activeBuild,setActiveBuild:U.setActiveBuild,pipelineDraft:U.pipelineDraft,sessions:U.sessions,iterationStates:U.iterationStates,buildHistory:U.buildHistory,fetchBuildHistory:U.fetchBuildHistory,selectedPhase:U.selectedPhase,setSelectedPhase:U.setSelectedPhase,statusSnapshots:U.statusSnapshots,setStatusSnapshot:U.setStatusSnapshot}))),le=(Y==null?void 0:Y.featureCode)||null;C.useEffect(()=>{le&&(Xt&&Xt[le]||vt(`/api/lifecycle/status?featureCode=${encodeURIComponent(le)}`).then(U=>U.json()).then(U=>{U!=null&&U.snapshot&&Ye&&Ye(le,U.snapshot)}).catch(()=>{}))},[le,Xt,Ye]);const[Ae,De]=C.useState(null),Le=C.useRef(!!localStorage.getItem("compose:activeView")),[W,Z]=C.useState(()=>localStorage.getItem("compose:activeView")||"dashboard"),[H,J]=C.useState(""),at=C.useCallback(U=>{b(U),localStorage.setItem("compose:contextWidthPx",String(Math.round(U)))},[]),pt=C.useRef(!1),_t=C.useCallback(U=>{U.preventDefault(),pt.current=!0;const ht=te=>{if(!pt.current)return;const rr=te.clientX-16,zs=Math.max(160,Math.min(window.innerWidth*.4,rr));_(zs),localStorage.setItem("compose:sidebarWidthPx",String(Math.round(zs)))},ut=()=>{pt.current=!1,document.removeEventListener("mousemove",ht),document.removeEventListener("mouseup",ut)};document.addEventListener("mousemove",ht),document.addEventListener("mouseup",ut)},[]),[Kt,de]=C.useState(null),[ge,Me]=C.useState(null),[Zt,pe]=C.useState(()=>localStorage.getItem("compose:selectedTrack")||null),[Te,Ie]=C.useState(()=>{try{const U=localStorage.getItem("compose:visibleTracks");if(U){const ht=JSON.parse(U);return new Set(ht)}}catch{}return null}),[Ca,wi]=C.useState(new Set),[Si,Ls]=C.useState(!1),zn=C.useCallback(U=>{wi(ht=>{const ut=new Set(ht);return ut.has(U)?ut.delete(U):ut.add(U),ut})},[]),[ka,ih]=C.useState(null),[be,Cr]=C.useState(!1),[sh,qn]=C.useState(!1),[Bs,As]=C.useState("task"),[va,wa]=C.useState(!1),[dr,Rr]=C.useState(!1),[Ms,Is]=C.useState(!1),[Fs,Ti]=C.useState(!1),[_r,Ps]=C.useState(""),[$s,Ds]=C.useState("");C.useEffect(()=>{vt("/api/project").then(U=>U.json()).then(U=>{Ps(U.name||""),Ds(U.targetRoot||"")}).catch(()=>{})},[]);const Sa=C.useCallback(async U=>{try{const ut=await(await vt("/api/project/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:U})})).json();return ut.ok?(await t(),Ps(ut.name),Ds(ut.targetRoot),!0):!1}catch{return!1}},[t]),Os=u===qe.MAXIMIZED,St=C.useCallback(U=>{h(U),x0(U),Z(U)},[]),q=C.useCallback(U=>{Z(U),h(U),x0(U)},[]);C.useEffect(()=>{localStorage.setItem("compose:activeView",W),W!=="docs"&&(Me(null),de(null))},[W]),C.useEffect(()=>{Zt?localStorage.setItem("compose:selectedTrack",Zt):localStorage.removeItem("compose:selectedTrack")},[Zt]),C.useEffect(()=>{Ae?sessionStorage.setItem("vision-selectedItemId",Ae):sessionStorage.removeItem("vision-selectedItemId")},[Ae]),C.useEffect(()=>{try{Te?localStorage.setItem("compose:visibleTracks",JSON.stringify([...Te])):localStorage.removeItem("compose:visibleTracks")}catch{}},[Te]);const st=C.useRef(!1);C.useEffect(()=>{var U;st.current||Le.current||(U=lt==null?void 0:lt.ui)!=null&&U.defaultView&&(q(lt.ui.defaultView),st.current=!0)},[lt]),C.useEffect(()=>{B&&(B.view&&q(B.view),B.phase!==void 0&&Se(B.phase),B.select!==void 0&&Jt(B.select),N())},[B,N]),C.useEffect(()=>{const U=()=>{var ut;return["INPUT","TEXTAREA","SELECT"].includes((ut=document.activeElement)==null?void 0:ut.tagName)},ht=ut=>{(ut.metaKey||ut.ctrlKey)&&ut.key==="k"&&(ut.preventDefault(),Cr(te=>!te)),(ut.metaKey||ut.ctrlKey)&&ut.key==="n"&&(ut.preventDefault(),qn(!0)),ut.key===","&&!ut.metaKey&&!ut.ctrlKey&&!U()&&wa(!0)};return window.addEventListener("keydown",ht),()=>window.removeEventListener("keydown",ht)},[]);const ft=C.useMemo(()=>{let U=T;if(Gt&&(U=U.filter(ht=>ht.phase===Gt)),Zt&&(U=U.filter(ht=>{const ut=(ht.description||"").match(/Track:\s*(\w+)/i);return ut&&ut[1].toLowerCase()===Zt})),H){const ht=H.toLowerCase();U=U.filter(ut=>ut.title.toLowerCase().includes(ht)||(ut.description||"").toLowerCase().includes(ht))}return U},[T,Gt,Zt,H]),ie=C.useMemo(()=>Gt?T.filter(U=>U.phase===Gt):T,[T,Gt]),_e=C.useMemo(()=>new Set(ie.map(U=>U.id)),[ie]),xe=C.useMemo(()=>Gt?M.filter(U=>_e.has(U.itemId)):M,[M,_e,Gt]),Oe=C.useMemo(()=>{if(!Gt&&!Zt&&!H)return S;const U=new Set(ft.map(ht=>ht.id));return S.filter(ht=>U.has(ht.fromId)&&U.has(ht.toId))},[S,ft,Gt,Zt,H]),Ge=C.useMemo(()=>nK(Ct,T,S,M),[Ct,T,S,M]),zr=C.useMemo(()=>sK(D,j),[D,j]),Fe=C.useCallback(U=>{y(U)},[]),Jt=C.useCallback(U=>{De(ht=>ht===U?(Fe(null),null):(Fe({type:"item",id:U}),U))},[Fe]),Ta=C.useCallback(async U=>{try{const ht=await vt(`/api/agent/${U}/stop`,{method:"POST",headers:Mr({"Content-Type":"application/json"})});ht.ok||se(`Could not stop agent (${ht.status})`,"error")}catch(ht){console.error(`[App] Failed to stop agent ${U}:`,ht.message),se(`Could not stop agent: ${ht.message}`,"error")}},[]),Rs=C.useRef(Ct);C.useEffect(()=>{!Rs.current&&Ct&&Ct.featureItemId&&Jt(Ct.featureItemId),Rs.current=Ct},[Ct]);const oh=C.useCallback(U=>{if(!U)return;const ht=T.find(ut=>{var te,rr;return((te=ut.lifecycle)==null?void 0:te.featureCode)===U||ut.featureCode===U||ut.feature_code===U||((rr=ut.title)==null?void 0:rr.includes(U))});ht&&Jt(ht.id)},[T,Jt]);C.useEffect(()=>{const U=ht=>{const{featureCode:ut}=ht.detail||{};ut&&oh(ut)};return window.addEventListener("compose:select-feature",U),()=>window.removeEventListener("compose:select-feature",U)},[oh]);const _a=C.useCallback(U=>T.find(ht=>{var ut;return((ut=ht.lifecycle)==null?void 0:ut.featureCode)===U})||null,[T]),QS=C.useCallback(async(U,ht)=>{const ut=_a(U);if(!ut)throw new Error(`No item found for feature ${U}`);const te=await vt(`/api/vision/items/${ut.id}/loops`,{method:"POST",headers:Mr({"Content-Type":"application/json"}),body:JSON.stringify(ht)});if(!te.ok)throw new Error(`Add loop failed: ${te.status}`)},[_a]),ZS=C.useCallback(async(U,ht,{note:ut})=>{const te=_a(U);if(!te)throw new Error(`No item found for feature ${U}`);const rr=await vt(`/api/vision/items/${te.id}/loops/${ht}/resolve`,{method:"POST",headers:Mr({"Content-Type":"application/json"}),body:JSON.stringify({note:ut})});if(!rr.ok)throw new Error(`Resolve loop failed: ${rr.status}`)},[_a]);C.useEffect(()=>{et(()=>({activeView:W,selectedPhase:Gt,searchQuery:H,selectedItemId:Ae,totalItems:T.length,filteredCount:ft.length,connected:L}))},[et,W,Gt,H,Ae,T.length,ft.length,L]),C.useEffect(()=>{const U=new MutationObserver(()=>{o(document.documentElement.classList.contains("dark"))});return U.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>U.disconnect()},[]),C.useEffect(()=>{g&&!m&&(x(!0),y0(!0))},[g]),C.useEffect(()=>{W==="design"?y({type:"design-doc"}):(g==null?void 0:g.type)==="design-doc"&&y(null)},[W]),C.useEffect(()=>{W==="build-history"&&Qt()},[W,Qt]);const JS=C.useCallback(()=>{const U=s?"light":"dark";document.documentElement.classList.toggle("dark",U==="dark"),localStorage.setItem(aK,U),vt("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ui:{theme:U}})}).catch(()=>{})},[s]),Lf=C.useCallback(U=>{i(ht=>{const ut=Math.min(Math.max(ht+U,Od),Rd);return localStorage.setItem(Dd,ut),ut})},[]),tT=C.useCallback(()=>{i(Fo),localStorage.setItem(Dd,Fo)},[]),eT=C.useCallback(U=>{d(U),GV(U)},[]),rT=C.useCallback(()=>{p(U=>(BG(!U),!U))},[]),nT=C.useCallback(()=>{x(U=>(y0(!U),!U))},[]),Bf=C.useCallback((U,ht)=>{z(U,ht)},[z]),iT=C.useCallback(async()=>{const ht=await R({type:"task",title:"New item",description:"",status:"planned",confidence:0,phase:Gt||"vision"});ht&&ht.id&&Jt(ht.id)},[R,Gt]),sT=C.useCallback(()=>{As("feature"),qn(!0)},[]),oT=T.length===0,aT=C.useCallback(async U=>{await P(U),Ae===U&&(De(null),Fe(null))},[P,Ae,Fe]),ah=C.useCallback(U=>{const ht=M.find(ut=>ut.id===U);ht&&(De(ht.itemId),Fe({type:"item",id:ht.itemId}))},[M,Fe]),[lT,Af]=C.useState(null),Mf=C.useCallback(U=>{M.find(ut=>ut.id===U)&&(Se(null),Ls(!1),Af(U),q("gates"))},[M,Se,Ls,q]),cT=C.useCallback(()=>Af(null),[]),If=C.useCallback(U=>{if(!U)return;const ht=T.find(ut=>{var te;return ut.featureCode===U||ut.feature_code===U||((te=ut.lifecycle)==null?void 0:te.featureCode)===U});ht&&Jt(ht.id)},[T,Jt]),Ff=C.useCallback((U,ht)=>{if(!ht)return!1;switch(U){case"gate":return M.some(ut=>ut.id===ht);case"item":return T.some(ut=>ut.id===ht);case"feature":return T.some(ut=>{var te;return ut.featureCode===ht||ut.feature_code===ht||((te=ut.lifecycle)==null?void 0:te.featureCode)===ht});case"view":return!0;default:return!1}},[M,T]),hT=C.useMemo(()=>({openItem:Jt,openGate:Mf,openView:q,openFeature:If,canNavigate:Ff}),[Jt,Mf,q,If,Ff]),uT=C.useCallback(async U=>I(U),[I]),dT=C.useCallback(async U=>F(U),[F]),pT=C.useCallback(()=>{vt("/api/build/state").then(U=>U.json()).then(U=>G(U.state??null)).catch(()=>{})},[G]),fT=C.useCallback(U=>{Fe({type:"step",id:U})},[Fe]),ja=C.useCallback(U=>{const ht=T.find(rr=>rr.id===U);if(!ht)return;const ut=(ht.description||"").match(/Track:\s*(\w+)/i),te=ut?ut[1].toLowerCase():null;Zt&&te&&Zt!==te&&pe(null),te&&Te&&!Te.has(te)&&Ie(rr=>{const zs=new Set(rr);return zs.add(te),zs})},[T,Zt,Te]),mT=C.useCallback(U=>{ja(U),De(U),Fe({type:"item",id:U}),q("graph")},[q,Fe,ja]),gT=C.useCallback(U=>{ja(U),De(U),Fe({type:"item",id:U}),q("tree")},[q,Fe,ja]),xT=C.useCallback(U=>{Me(W),de(U),q("docs")},[W,q]),yT=C.useCallback(()=>{ge&&(q(ge),Me(null),de(null))},[ge,q]);return l.jsx($S.Provider,{value:hT,children:l.jsx(Nc.Provider,{value:A,children:l.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background overflow-hidden",style:{fontSize:`${n}px`},children:[l.jsx(mr,{zone:"header",children:l.jsxs("header",{className:"h-9 flex items-center px-3 gap-3 shrink-0 justify-between",style:{borderBottom:"1px solid hsl(var(--border))"},children:[l.jsx(PV,{projectName:_r,projectRoot:$s,onSwitch:Sa}),l.jsx("div",{className:"flex-1 min-w-0 h-full flex items-center",children:l.jsx(DV,{tabs:a,activeTab:c,onTabChange:St,onOpenPalette:()=>Cr(U=>!U),badges:{gates:M.filter(U=>!U.resolvedAt).length}})}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[!L&&l.jsx("span",{className:"text-[9px] uppercase tracking-wider text-destructive animate-pulse",children:"disconnected"}),l.jsx(xG,{}),l.jsx(SG,{}),l.jsxs("div",{className:"relative",children:[l.jsx("button",{className:"compose-btn-icon",onClick:()=>Is(U=>!U),title:"Launch a fix, new feature, or resume","aria-label":"Launch lifecycle","aria-expanded":Ms,"data-testid":"launch-popover-toggle",children:"🚀"}),Ms&&l.jsx(bG,{activeBuild:Ct,onClose:()=>Is(!1)})]}),l.jsx("button",{className:"compose-btn-icon",onClick:()=>Ti(!0),title:"New feature","aria-label":"New feature","data-testid":"new-feature-toggle",children:"➕"}),l.jsx("button",{className:"compose-btn-icon",onClick:()=>Rr(!0),title:"Pair mobile device","aria-label":"Pair mobile device",children:"📱"}),l.jsx("button",{className:"compose-btn-icon",onClick:JS,title:s?"Switch to light mode":"Switch to dark mode",children:s?"☀":"☾"}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{className:"compose-btn-icon",onClick:()=>Lf(-1),disabled:n<=Od,title:"Decrease font size",children:"A−"}),l.jsx("span",{className:"text-[10px] tabular-nums min-w-[20px] text-center text-muted-foreground",children:n}),l.jsx("button",{className:"compose-btn-icon",onClick:()=>Lf(1),disabled:n>=Rd,title:"Increase font size",children:"A+"})]}),l.jsx("button",{className:"compose-btn-icon",onClick:tT,disabled:n===Fo,title:"Reset to default size",children:"100%"})]})]})}),l.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[!Os&&l.jsxs("div",{className:"flex-1 min-h-0 flex overflow-hidden",children:[l.jsx(mr,{zone:"sidebar",children:l.jsxs("div",{className:"flex h-full shrink-0",style:{borderRight:"1px solid hsl(var(--border))"},children:[l.jsx("button",{className:"w-4 h-full flex items-center justify-center text-[10px] text-muted-foreground hover:text-foreground transition-colors select-none",onClick:rT,title:f?"Collapse sidebar":"Expand sidebar","aria-expanded":f,"aria-label":"Toggle sidebar",style:{background:"hsl(var(--muted) / 0.3)"},children:f?"‹":"›"}),f&&l.jsx("div",{className:"w-1 cursor-col-resize hover:bg-accent/30 active:bg-accent/50 transition-colors flex-shrink-0 order-last",onMouseDown:_t}),f&&(W==="design"?l.jsx(HX,{decisions:e,sessionComplete:r==="complete",onReviseDecision:U=>Ln.getState().reviseDecision(U),widthPx:w}):l.jsx(Mb,{items:T,gates:M,activeBuild:Ct,onViewChange:q,selectedPhase:Gt,onPhaseSelect:Se,selectedTrack:Zt,onTrackSelect:pe,visibleTracks:Te,onToggleVisibleTrack:(U,ht)=>Ie(ut=>{if(!ut){const rr=new Set(ht);return rr.delete(U),rr}const te=new Set(ut);return te.has(U)?te.delete(U):te.add(U),ht&&te.size>=ht.length?null:te}),onShowAllTracks:()=>Ie(null),hiddenGroups:Ca,onToggleGroup:zn,searchQuery:H,onSearchChange:J,connected:L,agentActivity:$,agentErrors:O,spawnedAgents:D,agentRelays:j,sessionState:Y,onSelectItem:Jt,onStopAgent:Ta,onThemeChange:It,onNewItem:()=>qn(!0),widthPx:w}))]})}),l.jsxs("main",{className:"flex-1 min-w-0 min-h-0 flex flex-col overflow-hidden",children:[l.jsx(MS,{featureCode:le,snapshot:le?(Xt==null?void 0:Xt[le])??null:null}),le&&l.jsx(AS,{currentFeatureCode:le}),l.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:l.jsx(mr,{children:l.jsx(hK,{activeView:W,items:T,filteredItems:ft,phaseFilteredItems:ie,phaseFilteredGates:xe,connections:S,filteredConnections:Oe,sessions:kt,buildHistory:qt,activeBuild:Ct,pipelineDraft:it,gates:M,settings:lt,selectedPhase:Gt,selectedItemId:Ae,onSelect:Jt,onUpdate:Bf,onCreate:iT,onCreateFeature:sT,isEmptyProject:oT,onDelete:aT,onOpenGate:ah,onCreateConnection:uT,onDeleteConnection:dT,onRefreshBuild:pT,onSelectStep:fT,onResolveGate:X,onUpdateSettings:It,onResetSettings:Pt,visibleTracks:Te,hiddenGroups:Ca,buildStateMap:Ge,agentOverlay:zr,spawnedAgents:D,agentRelays:j,docsSelectedFile:Kt,onDocsSelectedFileChange:de,docsPreviousView:ge,onDocsBack:yT,projectRoot:$s,featureCode:le,focusActive:Si,onToggleFocus:()=>Ls(U=>!U),sessionState:Y,agentActivity:$,iterationStates:Tt,focusedGateId:lT,onFocusHandled:cT})})})]}),W!=="docs"&&l.jsx(mr,{children:l.jsxs(rY,{isOpen:m,onToggle:nT,widthPx:k,onResizePx:at,activeBuild:Ct,gates:M,agentErrors:O,items:T,children:[(g==null?void 0:g.type)==="item"&&l.jsx(VY,{itemId:g.id,onSelect:U=>{y({type:"item",id:U}),De(U)},onClose:()=>{y(null),De(null)},onOpenFile:xT,onViewInGraph:mT,onViewInTree:gT}),(g==null?void 0:g.type)==="step"&&l.jsx(eG,{stepId:g.id,tierEvents:Ct==null?void 0:Ct.tierEvents,healthEvents:(Ct==null?void 0:Ct.health_score)!=null?[{score:Ct.health_score,breakdown:Ct.health_breakdown,missing:Ct.health_missing}]:void 0,capabilityEvents:Ct==null?void 0:Ct.capabilityEvents}),(g==null?void 0:g.type)==="design-doc"&&l.jsx(nG,{})]})}),le&&W!=="docs"&&l.jsx(mr,{zone:"open loops panel",children:l.jsx(tK,{featureCode:le,items:T,onAddLoop:QS,onResolveLoop:ZS})})]}),l.jsx(mr,{zone:"ops strip",children:l.jsx(dG,{activeView:W,onSelectFeature:oh})}),l.jsx(mr,{zone:"agent bar",children:l.jsx("div",{className:["shrink-0 flex flex-col overflow-hidden",Os?"flex-1 min-h-0":VV(u)].join(" "),children:l.jsx(QV,{barState:u,onStateChange:eT})})})]}),l.jsx(mr,{zone:"notifications",children:l.jsx(_T,{})}),l.jsx(mr,{zone:"gate notifications",children:l.jsx(BS,{onOpenGate:ah})}),l.jsx(mr,{zone:"challenge modal",children:ka&&(()=>{const U=T.find(ht=>ht.id===ka);return U?l.jsx(bS,{item:U,items:T,connections:S,onUpdate:Bf,onClose:()=>ih(null)}):null})()}),l.jsx(yS,{event:ct,items:T,onNavigate:()=>q("gates")}),l.jsx(mr,{zone:"command palette",children:l.jsx(NS,{open:be,onClose:()=>Cr(!1),onSelectItem:U=>{Jt(U),Cr(!1)},onSelectGate:U=>{ah(U),Cr(!1)}})}),l.jsx(mr,{zone:"item form",children:l.jsx(ES,{open:sh,initialType:Bs,onClose:()=>{qn(!1),As("task")}})}),l.jsx(mr,{zone:"settings",children:l.jsx(LS,{open:va,onClose:()=>wa(!1),settings:lt,onSettingsChange:It})}),l.jsx(oG,{open:dr,onClose:()=>Rr(!1)}),l.jsx(BX,{open:Fs,onClose:()=>Ti(!1)})]})})})}const HK=Object.freeze(Object.defineProperty({__proto__:null,default:cK},Symbol.toStringTag,{value:"Module"}));export{a1 as $,bK as A,Nn as B,BM as C,me as D,c4 as E,af as F,Kb as G,$6 as H,q$ as I,GD as J,pI as K,Ro as L,xK as M,Uc as N,WI as O,s1 as P,og as Q,M$ as R,Yu as S,P6 as T,la as U,Dr as V,Q as W,K as X,QI as Y,N6 as Z,v as _,n4 as a,yi as a$,E$ as a0,Dp as a1,wK as a2,_K as a3,Ei as a4,_g as a5,Tg as a6,NK as a7,jK as a8,TK as a9,yt as aA,DK as aB,r9 as aC,Qz as aD,Kz as aE,tz as aF,Rb as aG,L$ as aH,gK as aI,Hc as aJ,tc as aK,Qk as aL,Ip as aM,Tn as aN,Wo as aO,bg as aP,cP as aQ,r6 as aR,Xk as aS,qk as aT,oR as aU,Ql as aV,aR as aW,fa as aX,Gn as aY,QR as aZ,Vg as a_,kK as aa,vK as ab,SK as ac,LK as ad,EK as ae,Tz as af,l2 as ag,RK as ah,KD as ai,er as aj,yn as ak,ro as al,lf as am,nv as an,di as ao,av as ap,Mt as aq,Gr as ar,ga as as,Z8 as at,Q8 as au,mt as av,j9 as aw,OK as ax,zK as ay,$K as az,r4 as b,lR as b0,Jp as b1,sR as b2,uR as b3,Ts as b4,e6 as b5,S6 as b6,gR as b7,x6 as b8,Qp as b9,T6 as bA,Zp as bB,j6 as bC,HK as bD,$x as ba,xt as bb,lv as bc,ar as bd,rP as be,Mp as bf,k1 as bg,ua as bh,S1 as bi,CK as bj,LM as bk,Ss as bl,l6 as bm,K9 as bn,pa as bo,Jl as bp,On as bq,Rc as br,zg as bs,tf as bt,Hk as bu,Gk as bv,nR as bw,Nd as bx,w6 as by,g6 as bz,Vt as c,Ot as d,o1 as e,Ne as f,s4 as g,pn as h,$r as i,JD as j,ca as k,rt as l,sv as m,yK as n,WK as o,o4 as p,a4 as q,qK as r,i4 as s,XD as t,Ar as u,Uz as v,R6 as w,BK as x,us as y,e4 as z};